/* chess-engine-cecp.c generated by valac 0.36.1.2-2a0ee, the Vala compiler
 * generated from chess-engine-cecp.vala, do not modify */

/* -*- Mode: vala; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 *
 * Copyright (C) 2010-2013 Robert Ancell
 * Copyright (C) 2013-2014 Michael Catanzaro
 * Copyright (C) 2015-2016 Sahil Sareen
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
 * license.
 */

#include <glib.h>
#include <glib-object.h>
#include "libchess.h"
#include <string.h>
#include <stdlib.h>


#define TYPE_CHESS_ENGINE (chess_engine_get_type ())
#define CHESS_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CHESS_ENGINE, ChessEngine))
#define CHESS_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CHESS_ENGINE, ChessEngineClass))
#define IS_CHESS_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CHESS_ENGINE))
#define IS_CHESS_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CHESS_ENGINE))
#define CHESS_ENGINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CHESS_ENGINE, ChessEngineClass))

typedef struct _ChessEngine ChessEngine;
typedef struct _ChessEngineClass ChessEngineClass;
typedef struct _ChessEnginePrivate ChessEnginePrivate;

#define TYPE_CHESS_ENGINE_CECP (chess_engine_cecp_get_type ())
#define CHESS_ENGINE_CECP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CHESS_ENGINE_CECP, ChessEngineCECP))
#define CHESS_ENGINE_CECP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CHESS_ENGINE_CECP, ChessEngineCECPClass))
#define IS_CHESS_ENGINE_CECP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CHESS_ENGINE_CECP))
#define IS_CHESS_ENGINE_CECP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CHESS_ENGINE_CECP))
#define CHESS_ENGINE_CECP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CHESS_ENGINE_CECP, ChessEngineCECPClass))

typedef struct _ChessEngineCECP ChessEngineCECP;
typedef struct _ChessEngineCECPClass ChessEngineCECPClass;
typedef struct _ChessEngineCECPPrivate ChessEngineCECPPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _ChessEngine {
	GObject parent_instance;
	ChessEnginePrivate * priv;
};

struct _ChessEngineClass {
	GObjectClass parent_class;
	void (*process_input) (ChessEngine* self, gchar* data, int data_length1);
	void (*start_game) (ChessEngine* self);
	void (*report_move) (ChessEngine* self, ChessMove* move);
	void (*do_undo) (ChessEngine* self);
	void (*request_move) (ChessEngine* self);
};

struct _ChessEngineCECP {
	ChessEngine parent_instance;
	ChessEngineCECPPrivate * priv;
};

struct _ChessEngineCECPClass {
	ChessEngineClass parent_class;
};

struct _ChessEngineCECPPrivate {
	gchar* buffer;
	gint buffer_length1;
	gint _buffer_size_;
	gboolean moving;
	gchar** options;
	gint options_length1;
	gint _options_size_;
};


static gpointer chess_engine_cecp_parent_class = NULL;

GType chess_engine_get_type (void) G_GNUC_CONST;
GType chess_engine_cecp_get_type (void) G_GNUC_CONST;
#define CHESS_ENGINE_CECP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_CHESS_ENGINE_CECP, ChessEngineCECPPrivate))
enum  {
	CHESS_ENGINE_CECP_DUMMY_PROPERTY
};
ChessEngineCECP* chess_engine_cecp_new (const gchar* binary, gchar** args, int args_length1, guint delay_seconds, gchar** options, int options_length1);
ChessEngineCECP* chess_engine_cecp_construct (GType object_type, const gchar* binary, gchar** args, int args_length1, guint delay_seconds, gchar** options, int options_length1);
ChessEngine* chess_engine_construct (GType object_type, const gchar* binary, gchar** args, int args_length1, guint delay_seconds);
static gchar** _vala_array_dup20 (gchar** self, int length);
static void chess_engine_cecp_start_cb (ChessEngineCECP* self);
static void _chess_engine_cecp_start_cb_chess_engine_starting (ChessEngine* _sender, gpointer self);
void chess_engine_write_line (ChessEngine* self, const gchar* line);
void chess_engine_set_ready (ChessEngine* self, gboolean value);
static void chess_engine_cecp_real_process_input (ChessEngine* base, gchar* data, int data_length1);
void chess_engine_stop (ChessEngine* self, gboolean kill_engine);
static gchar* _vala_array_dup21 (gchar* self, int length);
static void chess_engine_cecp_real_start_game (ChessEngine* base);
static void chess_engine_cecp_real_request_move (ChessEngine* base);
static void chess_engine_cecp_real_report_move (ChessEngine* base, ChessMove* move);
static void chess_engine_cecp_real_do_undo (ChessEngine* base);
static void chess_engine_cecp_finalize (GObject * obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


static gchar** _vala_array_dup20 (gchar** self, int length) {
	gchar** result;
	int i;
#line 23 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	result = g_new0 (gchar*, length + 1);
#line 23 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	for (i = 0; i < length; i++) {
#line 117 "chess-engine-cecp.c"
		gchar* _tmp0_;
#line 23 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp0_ = g_strdup (self[i]);
#line 23 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		result[i] = _tmp0_;
#line 123 "chess-engine-cecp.c"
	}
#line 23 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	return result;
#line 127 "chess-engine-cecp.c"
}


static void _chess_engine_cecp_start_cb_chess_engine_starting (ChessEngine* _sender, gpointer self) {
#line 24 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	chess_engine_cecp_start_cb ((ChessEngineCECP*) self);
#line 134 "chess-engine-cecp.c"
}


ChessEngineCECP* chess_engine_cecp_construct (GType object_type, const gchar* binary, gchar** args, int args_length1, guint delay_seconds, gchar** options, int options_length1) {
	ChessEngineCECP * self = NULL;
	const gchar* _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length1;
	guint _tmp2_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	gchar** _tmp4_;
	gint _tmp4__length1;
#line 20 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	g_return_val_if_fail (binary != NULL, NULL);
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	_tmp0_ = binary;
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	_tmp1_ = args;
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	_tmp1__length1 = args_length1;
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	_tmp2_ = delay_seconds;
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	self = (ChessEngineCECP*) chess_engine_construct (object_type, _tmp0_, _tmp1_, _tmp1__length1, _tmp2_);
#line 23 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	_tmp3_ = options;
#line 23 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	_tmp3__length1 = options_length1;
#line 23 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	_tmp4_ = (_tmp3_ != NULL) ? _vala_array_dup20 (_tmp3_, _tmp3__length1) : ((gpointer) _tmp3_);
#line 23 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	_tmp4__length1 = _tmp3__length1;
#line 23 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	self->priv->options = (_vala_array_free (self->priv->options, self->priv->options_length1, (GDestroyNotify) g_free), NULL);
#line 23 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	self->priv->options = _tmp4_;
#line 23 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	self->priv->options_length1 = _tmp4__length1;
#line 23 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	self->priv->_options_size_ = self->priv->options_length1;
#line 24 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	g_signal_connect_object ((ChessEngine*) self, "starting", (GCallback) _chess_engine_cecp_start_cb_chess_engine_starting, self, 0);
#line 20 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	return self;
#line 180 "chess-engine-cecp.c"
}


ChessEngineCECP* chess_engine_cecp_new (const gchar* binary, gchar** args, int args_length1, guint delay_seconds, gchar** options, int options_length1) {
#line 20 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	return chess_engine_cecp_construct (TYPE_CHESS_ENGINE_CECP, binary, args, args_length1, delay_seconds, options, options_length1);
#line 187 "chess-engine-cecp.c"
}


static void chess_engine_cecp_start_cb (ChessEngineCECP* self) {
	gchar** _tmp0_;
	gint _tmp0__length1;
#line 27 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	g_return_if_fail (self != NULL);
#line 29 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	chess_engine_write_line ((ChessEngine*) self, "xboard");
#line 30 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	chess_engine_write_line ((ChessEngine*) self, "random");
#line 31 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	_tmp0_ = self->priv->options;
#line 31 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	_tmp0__length1 = self->priv->options_length1;
#line 204 "chess-engine-cecp.c"
	{
		gchar** o_collection = NULL;
		gint o_collection_length1 = 0;
		gint _o_collection_size_ = 0;
		gint o_it = 0;
#line 31 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		o_collection = _tmp0_;
#line 31 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		o_collection_length1 = _tmp0__length1;
#line 31 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		for (o_it = 0; o_it < _tmp0__length1; o_it = o_it + 1) {
#line 216 "chess-engine-cecp.c"
			gchar* _tmp1_;
			gchar* o = NULL;
#line 31 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			_tmp1_ = g_strdup (o_collection[o_it]);
#line 31 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			o = _tmp1_;
#line 223 "chess-engine-cecp.c"
			{
				const gchar* _tmp2_;
#line 32 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp2_ = o;
#line 32 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				chess_engine_write_line ((ChessEngine*) self, _tmp2_);
#line 31 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_g_free0 (o);
#line 232 "chess-engine-cecp.c"
			}
		}
	}
#line 33 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	chess_engine_set_ready ((ChessEngine*) self, TRUE);
#line 238 "chess-engine-cecp.c"
}


static gchar* string_slice (const gchar* self, glong start, glong end) {
	gchar* result = NULL;
	glong string_length;
	gint _tmp0_;
	gint _tmp1_;
	glong _tmp2_;
	glong _tmp5_;
	gboolean _tmp8_ = FALSE;
	glong _tmp9_;
	gboolean _tmp12_ = FALSE;
	glong _tmp13_;
	glong _tmp16_;
	glong _tmp17_;
	glong _tmp18_;
	glong _tmp19_;
	glong _tmp20_;
	gchar* _tmp21_;
#line 1355 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, NULL);
#line 1356 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	_tmp0_ = strlen (self);
#line 1356 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	_tmp1_ = _tmp0_;
#line 1356 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	string_length = (glong) _tmp1_;
#line 1357 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	_tmp2_ = start;
#line 1357 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	if (_tmp2_ < ((glong) 0)) {
#line 271 "chess-engine-cecp.c"
		glong _tmp3_;
		glong _tmp4_;
#line 1358 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
		_tmp3_ = string_length;
#line 1358 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
		_tmp4_ = start;
#line 1358 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
		start = _tmp3_ + _tmp4_;
#line 280 "chess-engine-cecp.c"
	}
#line 1360 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	_tmp5_ = end;
#line 1360 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	if (_tmp5_ < ((glong) 0)) {
#line 286 "chess-engine-cecp.c"
		glong _tmp6_;
		glong _tmp7_;
#line 1361 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
		_tmp6_ = string_length;
#line 1361 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
		_tmp7_ = end;
#line 1361 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
		end = _tmp6_ + _tmp7_;
#line 295 "chess-engine-cecp.c"
	}
#line 1363 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	_tmp9_ = start;
#line 1363 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	if (_tmp9_ >= ((glong) 0)) {
#line 301 "chess-engine-cecp.c"
		glong _tmp10_;
		glong _tmp11_;
#line 1363 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
		_tmp10_ = start;
#line 1363 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
		_tmp11_ = string_length;
#line 1363 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
		_tmp8_ = _tmp10_ <= _tmp11_;
#line 310 "chess-engine-cecp.c"
	} else {
#line 1363 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
		_tmp8_ = FALSE;
#line 314 "chess-engine-cecp.c"
	}
#line 1363 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	g_return_val_if_fail (_tmp8_, NULL);
#line 1364 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	_tmp13_ = end;
#line 1364 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	if (_tmp13_ >= ((glong) 0)) {
#line 322 "chess-engine-cecp.c"
		glong _tmp14_;
		glong _tmp15_;
#line 1364 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
		_tmp14_ = end;
#line 1364 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
		_tmp15_ = string_length;
#line 1364 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
		_tmp12_ = _tmp14_ <= _tmp15_;
#line 331 "chess-engine-cecp.c"
	} else {
#line 1364 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
		_tmp12_ = FALSE;
#line 335 "chess-engine-cecp.c"
	}
#line 1364 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	g_return_val_if_fail (_tmp12_, NULL);
#line 1365 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	_tmp16_ = start;
#line 1365 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	_tmp17_ = end;
#line 1365 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	g_return_val_if_fail (_tmp16_ <= _tmp17_, NULL);
#line 1366 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	_tmp18_ = start;
#line 1366 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	_tmp19_ = end;
#line 1366 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	_tmp20_ = start;
#line 1366 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	_tmp21_ = g_strndup (((gchar*) self) + _tmp18_, (gsize) (_tmp19_ - _tmp20_));
#line 1366 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	result = _tmp21_;
#line 1366 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	return result;
#line 357 "chess-engine-cecp.c"
}


static gchar* string_strip (const gchar* self) {
	gchar* result = NULL;
	gchar* _result_;
	gchar* _tmp0_;
	const gchar* _tmp1_;
#line 1234 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, NULL);
#line 1235 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	_tmp0_ = g_strdup (self);
#line 1235 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	_result_ = _tmp0_;
#line 1236 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	_tmp1_ = _result_;
#line 1236 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	g_strstrip (_tmp1_);
#line 1237 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	result = _result_;
#line 1237 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	return result;
#line 380 "chess-engine-cecp.c"
}


static gboolean string_contains (const gchar* self, const gchar* needle) {
	gboolean result = FALSE;
	const gchar* _tmp0_;
	gchar* _tmp1_;
#line 1403 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, FALSE);
#line 1403 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	g_return_val_if_fail (needle != NULL, FALSE);
#line 1404 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	_tmp0_ = needle;
#line 1404 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	_tmp1_ = strstr ((gchar*) self, (gchar*) _tmp0_);
#line 1404 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	result = _tmp1_ != NULL;
#line 1404 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.36/vapi/glib-2.0.vapi"
	return result;
#line 400 "chess-engine-cecp.c"
}


static gchar* _vala_array_dup21 (gchar* self, int length) {
#line 98 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	return g_memdup (self, length * sizeof (gchar));
#line 407 "chess-engine-cecp.c"
}


static void chess_engine_cecp_real_process_input (ChessEngine* base, gchar* data, int data_length1) {
	ChessEngineCECP * self;
	gint current;
	gchar* _tmp0_;
	gint _tmp0__length1;
	gchar* _tmp1_;
	gint _tmp1__length1;
	gchar* _tmp2_;
	gint _tmp2__length1;
	gint _tmp3_;
#line 36 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	self = (ChessEngineCECP*) base;
#line 39 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	_tmp0_ = self->priv->buffer;
#line 39 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	_tmp0__length1 = self->priv->buffer_length1;
#line 39 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	current = _tmp0__length1;
#line 40 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	_tmp1_ = self->priv->buffer;
#line 40 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	_tmp1__length1 = self->priv->buffer_length1;
#line 40 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	_tmp2_ = data;
#line 40 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	_tmp2__length1 = data_length1;
#line 40 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	_tmp3_ = (gint) (_tmp1__length1 + _tmp2__length1);
#line 40 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	self->priv->buffer = g_renew (gchar, self->priv->buffer, (gint) (_tmp1__length1 + _tmp2__length1));
#line 40 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	(_tmp3_ > self->priv->buffer_length1) ? memset (self->priv->buffer + self->priv->buffer_length1, 0, sizeof (gchar) * (_tmp3_ - self->priv->buffer_length1)) : NULL;
#line 40 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	self->priv->buffer_length1 = _tmp3_;
#line 40 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	self->priv->_buffer_size_ = _tmp3_;
#line 447 "chess-engine-cecp.c"
	{
		gint i;
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		i = 0;
#line 452 "chess-engine-cecp.c"
		{
			gboolean _tmp4_;
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			_tmp4_ = TRUE;
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			while (TRUE) {
#line 459 "chess-engine-cecp.c"
				gint _tmp6_;
				gchar* _tmp7_;
				gint _tmp7__length1;
				gchar* _tmp8_;
				gint _tmp8__length1;
				gint _tmp9_;
				gint _tmp10_;
				gchar* _tmp11_;
				gint _tmp11__length1;
				gint _tmp12_;
				gchar _tmp13_;
				gchar _tmp14_;
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				if (!_tmp4_) {
#line 474 "chess-engine-cecp.c"
					gint _tmp5_;
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					_tmp5_ = i;
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					i = _tmp5_ + 1;
#line 480 "chess-engine-cecp.c"
				}
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp4_ = FALSE;
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp6_ = i;
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp7_ = data;
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp7__length1 = data_length1;
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				if (!(_tmp6_ < _tmp7__length1)) {
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					break;
#line 494 "chess-engine-cecp.c"
				}
#line 42 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp8_ = self->priv->buffer;
#line 42 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp8__length1 = self->priv->buffer_length1;
#line 42 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp9_ = current;
#line 42 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp10_ = i;
#line 42 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp11_ = data;
#line 42 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp11__length1 = data_length1;
#line 42 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp12_ = i;
#line 42 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp13_ = _tmp11_[_tmp12_];
#line 42 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp8_[_tmp9_ + _tmp10_] = _tmp13_;
#line 42 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp14_ = _tmp8_[_tmp9_ + _tmp10_];
#line 516 "chess-engine-cecp.c"
			}
		}
	}
#line 45 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	while (TRUE) {
#line 522 "chess-engine-cecp.c"
		gint offset = 0;
		gint _tmp23_;
		gchar* _tmp24_;
		gint _tmp24__length1;
		gchar* _tmp25_;
		gint _tmp25__length1;
		gint _tmp26_;
		gchar _tmp27_;
		gchar* line;
		gchar* _tmp28_;
		gint _tmp28__length1;
		gchar* _tmp29_;
		const gchar* _tmp30_;
		gchar** move_prefixes;
		gchar* _tmp31_;
		gchar* _tmp32_;
		gchar* _tmp33_;
		gchar* _tmp34_;
		gchar** _tmp35_;
		gint move_prefixes_length1;
		gint _move_prefixes_size_;
		gchar** _tmp36_;
		gint _tmp36__length1;
		gboolean _tmp53_ = FALSE;
		gboolean _tmp54_ = FALSE;
		gboolean _tmp55_ = FALSE;
		const gchar* _tmp56_;
		gchar* _tmp84_;
		gint _tmp84__length1;
		gint _tmp85_;
		gchar* _tmp86_;
		gint _tmp86__length1;
		gchar* _tmp87_;
		gint _tmp87__length1;
		{
			gboolean _tmp15_;
#line 49 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			offset = 0;
#line 49 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			_tmp15_ = TRUE;
#line 49 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			while (TRUE) {
#line 565 "chess-engine-cecp.c"
				gboolean _tmp17_ = FALSE;
				gint _tmp18_;
				gchar* _tmp19_;
				gint _tmp19__length1;
#line 49 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				if (!_tmp15_) {
#line 572 "chess-engine-cecp.c"
					gint _tmp16_;
#line 49 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					_tmp16_ = offset;
#line 49 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					offset = _tmp16_ + 1;
#line 578 "chess-engine-cecp.c"
				}
#line 49 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp15_ = FALSE;
#line 49 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp18_ = offset;
#line 49 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp19_ = self->priv->buffer;
#line 49 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp19__length1 = self->priv->buffer_length1;
#line 49 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				if (_tmp18_ < _tmp19__length1) {
#line 590 "chess-engine-cecp.c"
					gchar* _tmp20_;
					gint _tmp20__length1;
					gint _tmp21_;
					gchar _tmp22_;
#line 49 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					_tmp20_ = self->priv->buffer;
#line 49 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					_tmp20__length1 = self->priv->buffer_length1;
#line 49 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					_tmp21_ = offset;
#line 49 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					_tmp22_ = _tmp20_[_tmp21_];
#line 49 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					_tmp17_ = _tmp22_ != '\n';
#line 605 "chess-engine-cecp.c"
				} else {
#line 49 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					_tmp17_ = FALSE;
#line 609 "chess-engine-cecp.c"
				}
#line 49 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				if (!_tmp17_) {
#line 49 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					break;
#line 615 "chess-engine-cecp.c"
				}
			}
		}
#line 50 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp23_ = offset;
#line 50 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp24_ = self->priv->buffer;
#line 50 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp24__length1 = self->priv->buffer_length1;
#line 50 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		if (_tmp23_ >= _tmp24__length1) {
#line 51 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			return;
#line 629 "chess-engine-cecp.c"
		}
#line 53 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp25_ = self->priv->buffer;
#line 53 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp25__length1 = self->priv->buffer_length1;
#line 53 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp26_ = offset;
#line 53 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp25_[_tmp26_] = '\0';
#line 53 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp27_ = _tmp25_[_tmp26_];
#line 54 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp28_ = self->priv->buffer;
#line 54 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp28__length1 = self->priv->buffer_length1;
#line 54 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp29_ = g_strdup ((const gchar*) _tmp28_);
#line 54 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		line = _tmp29_;
#line 56 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp30_ = line;
#line 56 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		g_debug ("chess-engine-cecp.vala:56: Read from engine: '%s'", _tmp30_);
#line 58 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp31_ = g_strdup ("My move is: ");
#line 58 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp32_ = g_strdup ("My move is : ");
#line 58 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp33_ = g_strdup ("my move is ");
#line 58 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp34_ = g_strdup ("move ");
#line 58 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp35_ = g_new0 (gchar*, 4 + 1);
#line 58 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp35_[0] = _tmp31_;
#line 58 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp35_[1] = _tmp32_;
#line 58 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp35_[2] = _tmp33_;
#line 58 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp35_[3] = _tmp34_;
#line 58 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		move_prefixes = _tmp35_;
#line 58 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		move_prefixes_length1 = 4;
#line 58 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_move_prefixes_size_ = move_prefixes_length1;
#line 59 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp36_ = move_prefixes;
#line 59 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp36__length1 = move_prefixes_length1;
#line 681 "chess-engine-cecp.c"
		{
			gchar** prefix_collection = NULL;
			gint prefix_collection_length1 = 0;
			gint _prefix_collection_size_ = 0;
			gint prefix_it = 0;
#line 59 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			prefix_collection = _tmp36_;
#line 59 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			prefix_collection_length1 = _tmp36__length1;
#line 59 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			for (prefix_it = 0; prefix_it < _tmp36__length1; prefix_it = prefix_it + 1) {
#line 693 "chess-engine-cecp.c"
				gchar* _tmp37_;
				gchar* prefix = NULL;
#line 59 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp37_ = g_strdup (prefix_collection[prefix_it]);
#line 59 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				prefix = _tmp37_;
#line 700 "chess-engine-cecp.c"
				{
					const gchar* _tmp38_;
					const gchar* _tmp39_;
					gboolean _tmp40_;
#line 61 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					_tmp38_ = line;
#line 61 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					_tmp39_ = prefix;
#line 61 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					_tmp40_ = g_str_has_prefix (_tmp38_, _tmp39_);
#line 61 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					if (_tmp40_) {
#line 713 "chess-engine-cecp.c"
						gchar* move;
						const gchar* _tmp41_;
						const gchar* _tmp42_;
						gint _tmp43_;
						gint _tmp44_;
						const gchar* _tmp45_;
						gint _tmp46_;
						gint _tmp47_;
						gchar* _tmp48_;
						const gchar* _tmp49_;
						const gchar* _tmp50_;
						gchar* _tmp51_;
						gchar* _tmp52_;
#line 63 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp41_ = line;
#line 63 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp42_ = prefix;
#line 63 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp43_ = strlen (_tmp42_);
#line 63 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp44_ = _tmp43_;
#line 63 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp45_ = line;
#line 63 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp46_ = strlen (_tmp45_);
#line 63 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp47_ = _tmp46_;
#line 63 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp48_ = string_slice (_tmp41_, (glong) _tmp44_, (glong) _tmp47_);
#line 63 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						move = _tmp48_;
#line 64 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp49_ = move;
#line 64 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						g_debug ("chess-engine-cecp.vala:64: Engine moves %s", _tmp49_);
#line 65 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						self->priv->moving = TRUE;
#line 66 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp50_ = move;
#line 66 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp51_ = string_strip (_tmp50_);
#line 66 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp52_ = _tmp51_;
#line 66 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						g_signal_emit_by_name ((ChessEngine*) self, "moved", _tmp52_);
#line 66 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_g_free0 (_tmp52_);
#line 61 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_g_free0 (move);
#line 763 "chess-engine-cecp.c"
					}
#line 59 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					_g_free0 (prefix);
#line 767 "chess-engine-cecp.c"
				}
			}
		}
#line 70 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp56_ = line;
#line 70 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		if (g_strcmp0 (_tmp56_, "resign") == 0) {
#line 70 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			_tmp55_ = TRUE;
#line 777 "chess-engine-cecp.c"
		} else {
			const gchar* _tmp57_;
#line 70 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			_tmp57_ = line;
#line 70 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			_tmp55_ = g_strcmp0 (_tmp57_, "tellics resign") == 0;
#line 784 "chess-engine-cecp.c"
		}
#line 70 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		if (_tmp55_) {
#line 70 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			_tmp54_ = TRUE;
#line 790 "chess-engine-cecp.c"
		} else {
			gboolean _tmp58_ = FALSE;
			const gchar* _tmp59_;
			gboolean _tmp60_;
#line 71 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			_tmp59_ = line;
#line 71 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			_tmp60_ = g_str_has_prefix (_tmp59_, "1-0 {");
#line 71 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			if (_tmp60_) {
#line 801 "chess-engine-cecp.c"
				const gchar* _tmp61_;
				gboolean _tmp62_;
#line 71 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp61_ = line;
#line 71 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp62_ = string_contains (_tmp61_, "resign");
#line 71 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp58_ = _tmp62_;
#line 810 "chess-engine-cecp.c"
			} else {
#line 71 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp58_ = FALSE;
#line 814 "chess-engine-cecp.c"
			}
#line 71 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			_tmp54_ = _tmp58_;
#line 818 "chess-engine-cecp.c"
		}
#line 70 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		if (_tmp54_) {
#line 70 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			_tmp53_ = TRUE;
#line 824 "chess-engine-cecp.c"
		} else {
			gboolean _tmp63_ = FALSE;
			const gchar* _tmp64_;
			gboolean _tmp65_;
#line 72 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			_tmp64_ = line;
#line 72 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			_tmp65_ = g_str_has_prefix (_tmp64_, "0-1 {");
#line 72 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			if (_tmp65_) {
#line 835 "chess-engine-cecp.c"
				const gchar* _tmp66_;
				gboolean _tmp67_;
#line 72 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp66_ = line;
#line 72 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp67_ = string_contains (_tmp66_, "resign");
#line 72 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp63_ = _tmp67_;
#line 844 "chess-engine-cecp.c"
			} else {
#line 72 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp63_ = FALSE;
#line 848 "chess-engine-cecp.c"
			}
#line 72 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			_tmp53_ = _tmp63_;
#line 852 "chess-engine-cecp.c"
		}
#line 70 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		if (_tmp53_) {
#line 74 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			g_signal_emit_by_name ((ChessEngine*) self, "resigned");
#line 858 "chess-engine-cecp.c"
		} else {
			const gchar* _tmp68_;
			gboolean _tmp69_;
#line 76 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			_tmp68_ = line;
#line 76 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			_tmp69_ = g_str_has_prefix (_tmp68_, "Illegal move: ");
#line 76 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
			if (_tmp69_) {
#line 78 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				chess_engine_stop ((ChessEngine*) self, TRUE);
#line 79 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				g_signal_emit_by_name ((ChessEngine*) self, "error");
#line 872 "chess-engine-cecp.c"
			} else {
				gboolean _tmp70_ = FALSE;
				const gchar* _tmp71_;
				gboolean _tmp72_;
#line 81 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp71_ = line;
#line 81 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				_tmp72_ = g_str_has_prefix (_tmp71_, "1-0");
#line 81 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				if (_tmp72_) {
#line 81 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					_tmp70_ = TRUE;
#line 885 "chess-engine-cecp.c"
				} else {
					const gchar* _tmp73_;
					gboolean _tmp74_;
#line 81 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					_tmp73_ = line;
#line 81 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					_tmp74_ = g_str_has_prefix (_tmp73_, "0-1");
#line 81 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					_tmp70_ = _tmp74_;
#line 895 "chess-engine-cecp.c"
				}
#line 81 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
				if (_tmp70_) {
#line 84 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					chess_engine_stop ((ChessEngine*) self, TRUE);
#line 901 "chess-engine-cecp.c"
				} else {
					gboolean _tmp75_ = FALSE;
					gboolean _tmp76_ = FALSE;
					gboolean _tmp77_ = FALSE;
					const gchar* _tmp78_;
#line 86 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					_tmp78_ = line;
#line 86 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					if (g_strcmp0 (_tmp78_, "game is a draw") == 0) {
#line 86 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp77_ = TRUE;
#line 913 "chess-engine-cecp.c"
					} else {
						const gchar* _tmp79_;
#line 87 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp79_ = line;
#line 87 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp77_ = g_strcmp0 (_tmp79_, "draw") == 0;
#line 920 "chess-engine-cecp.c"
					}
#line 86 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					if (_tmp77_) {
#line 86 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp76_ = TRUE;
#line 926 "chess-engine-cecp.c"
					} else {
						const gchar* _tmp80_;
#line 88 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp80_ = line;
#line 88 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp76_ = g_strcmp0 (_tmp80_, "Draw") == 0;
#line 933 "chess-engine-cecp.c"
					}
#line 86 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					if (_tmp76_) {
#line 86 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp75_ = TRUE;
#line 939 "chess-engine-cecp.c"
					} else {
						const gchar* _tmp81_;
						gboolean _tmp82_;
#line 89 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp81_ = line;
#line 89 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp82_ = g_str_has_prefix (_tmp81_, "1/2-1/2");
#line 89 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp75_ = _tmp82_;
#line 949 "chess-engine-cecp.c"
					}
#line 86 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
					if (_tmp75_) {
#line 91 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						g_signal_emit_by_name ((ChessEngine*) self, "claim-draw");
#line 955 "chess-engine-cecp.c"
					} else {
						const gchar* _tmp83_;
#line 93 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						_tmp83_ = line;
#line 93 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
						if (g_strcmp0 (_tmp83_, "offer draw") == 0) {
#line 95 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
							g_signal_emit_by_name ((ChessEngine*) self, "offer-draw");
#line 964 "chess-engine-cecp.c"
						}
					}
				}
			}
		}
#line 98 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp84_ = self->priv->buffer;
#line 98 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp84__length1 = self->priv->buffer_length1;
#line 98 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp85_ = offset;
#line 98 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp86_ = self->priv->buffer;
#line 98 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp86__length1 = self->priv->buffer_length1;
#line 98 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp87_ = ((_tmp84_ + (_tmp85_ + 1)) != NULL) ? _vala_array_dup21 (_tmp84_ + (_tmp85_ + 1), _tmp86__length1 - (_tmp85_ + 1)) : ((gpointer) (_tmp84_ + (_tmp85_ + 1)));
#line 98 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp87__length1 = _tmp86__length1 - (_tmp85_ + 1);
#line 98 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		self->priv->buffer = (g_free (self->priv->buffer), NULL);
#line 98 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		self->priv->buffer = _tmp87_;
#line 98 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		self->priv->buffer_length1 = _tmp87__length1;
#line 98 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		self->priv->_buffer_size_ = self->priv->buffer_length1;
#line 45 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		move_prefixes = (_vala_array_free (move_prefixes, move_prefixes_length1, (GDestroyNotify) g_free), NULL);
#line 45 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_g_free0 (line);
#line 996 "chess-engine-cecp.c"
	}
}


static void chess_engine_cecp_real_start_game (ChessEngine* base) {
	ChessEngineCECP * self;
#line 102 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	self = (ChessEngineCECP*) base;
#line 1005 "chess-engine-cecp.c"
}


static void chess_engine_cecp_real_request_move (ChessEngine* base) {
	ChessEngineCECP * self;
#line 106 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	self = (ChessEngineCECP*) base;
#line 108 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	chess_engine_write_line ((ChessEngine*) self, "go");
#line 1015 "chess-engine-cecp.c"
}


static void chess_engine_cecp_real_report_move (ChessEngine* base, ChessMove* move) {
	ChessEngineCECP * self;
	gboolean _tmp0_;
#line 111 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	self = (ChessEngineCECP*) base;
#line 111 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	g_return_if_fail (move != NULL);
#line 114 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	_tmp0_ = self->priv->moving;
#line 114 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	if (!_tmp0_) {
#line 1030 "chess-engine-cecp.c"
		ChessMove* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
#line 117 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		chess_engine_write_line ((ChessEngine*) self, "force");
#line 118 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp1_ = move;
#line 118 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp2_ = chess_move_get_engine (_tmp1_);
#line 118 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_tmp3_ = _tmp2_;
#line 118 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		chess_engine_write_line ((ChessEngine*) self, _tmp3_);
#line 118 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
		_g_free0 (_tmp3_);
#line 1046 "chess-engine-cecp.c"
	}
#line 120 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	self->priv->moving = FALSE;
#line 1050 "chess-engine-cecp.c"
}


static void chess_engine_cecp_real_do_undo (ChessEngine* base) {
	ChessEngineCECP * self;
#line 123 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	self = (ChessEngineCECP*) base;
#line 134 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	chess_engine_write_line ((ChessEngine*) self, "force");
#line 135 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	chess_engine_write_line ((ChessEngine*) self, "undo");
#line 1062 "chess-engine-cecp.c"
}


static void chess_engine_cecp_class_init (ChessEngineCECPClass * klass) {
#line 14 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	chess_engine_cecp_parent_class = g_type_class_peek_parent (klass);
#line 14 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	g_type_class_add_private (klass, sizeof (ChessEngineCECPPrivate));
#line 14 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	((ChessEngineClass *) klass)->process_input = (void (*) (ChessEngine *, gchar*, int)) chess_engine_cecp_real_process_input;
#line 14 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	((ChessEngineClass *) klass)->start_game = (void (*) (ChessEngine *)) chess_engine_cecp_real_start_game;
#line 14 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	((ChessEngineClass *) klass)->request_move = (void (*) (ChessEngine *)) chess_engine_cecp_real_request_move;
#line 14 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	((ChessEngineClass *) klass)->report_move = (void (*) (ChessEngine *, ChessMove*)) chess_engine_cecp_real_report_move;
#line 14 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	((ChessEngineClass *) klass)->do_undo = (void (*) (ChessEngine *)) chess_engine_cecp_real_do_undo;
#line 14 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	G_OBJECT_CLASS (klass)->finalize = chess_engine_cecp_finalize;
#line 1083 "chess-engine-cecp.c"
}


static void chess_engine_cecp_instance_init (ChessEngineCECP * self) {
#line 14 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	self->priv = CHESS_ENGINE_CECP_GET_PRIVATE (self);
#line 17 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	self->priv->moving = FALSE;
#line 1092 "chess-engine-cecp.c"
}


static void chess_engine_cecp_finalize (GObject * obj) {
	ChessEngineCECP * self;
#line 14 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_CHESS_ENGINE_CECP, ChessEngineCECP);
#line 16 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	self->priv->buffer = (g_free (self->priv->buffer), NULL);
#line 18 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	self->priv->options = (_vala_array_free (self->priv->options, self->priv->options_length1, (GDestroyNotify) g_free), NULL);
#line 14 "/home/mcatanzaro/Projects/GNOME/gnome-chess/src/chess-engine-cecp.vala"
	G_OBJECT_CLASS (chess_engine_cecp_parent_class)->finalize (obj);
#line 1106 "chess-engine-cecp.c"
}


GType chess_engine_cecp_get_type (void) {
	static volatile gsize chess_engine_cecp_type_id__volatile = 0;
	if (g_once_init_enter (&chess_engine_cecp_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ChessEngineCECPClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) chess_engine_cecp_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ChessEngineCECP), 0, (GInstanceInitFunc) chess_engine_cecp_instance_init, NULL };
		GType chess_engine_cecp_type_id;
		chess_engine_cecp_type_id = g_type_register_static (TYPE_CHESS_ENGINE, "ChessEngineCECP", &g_define_type_info, 0);
		g_once_init_leave (&chess_engine_cecp_type_id__volatile, chess_engine_cecp_type_id);
	}
	return chess_engine_cecp_type_id__volatile;
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



