/* reversi-view.c generated by valac 0.56.19, the Vala compiler
 * generated from reversi-view.vala, do not modify */

/* -*- Mode: vala; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
   This file is part of GNOME Reversi, also known as Iagno.

   Copyright 2010-2013 Robert Ancell
   Copyright 2013-2014 Michael Catanzaro
   Copyright 2014-2019 Arnaud Bonatti

   GNOME Reversi 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.

   GNOME Reversi is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with GNOME Reversi.  If not, see <https://www.gnu.org/licenses/>.
*/

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <gdk/gdk.h>
#include <adwaita.h>
#include <float.h>
#include <math.h>
#include <graphene-gobject.h>
#include <string.h>
#include <gsk/gsk.h>
#include <stdlib.h>

#define REVERSI_VIEW_HIGHLIGHT_MAX ((guint8) 5)
#define REVERSI_VIEW_PIXMAP_FLIP_DELAY 20
#define REVERSI_VIEW_HUMANS_OPENING_INTENSITY_MAX ((guint8) 15)
#define REVERSI_VIEW_OVERTURE_STEPS_MAX ((guint8) 10)
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_REVERSI_VIEW (reversi_view_get_type ())
#define REVERSI_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_REVERSI_VIEW, ReversiView))
#define REVERSI_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_REVERSI_VIEW, ReversiViewClass))
#define IS_REVERSI_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_REVERSI_VIEW))
#define IS_REVERSI_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_REVERSI_VIEW))
#define REVERSI_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_REVERSI_VIEW, ReversiViewClass))

typedef struct _ReversiView ReversiView;
typedef struct _ReversiViewClass ReversiViewClass;
typedef struct _ReversiViewPrivate ReversiViewPrivate;

#define TYPE_GAME (game_get_type ())
#define GAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GAME, Game))
#define GAME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GAME, GameClass))
#define IS_GAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GAME))
#define IS_GAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GAME))
#define GAME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GAME, GameClass))

typedef struct _Game Game;
typedef struct _GameClass GameClass;

#define TYPE_IAGNO (iagno_get_type ())
#define IAGNO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IAGNO, Iagno))
#define IAGNO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IAGNO, IagnoClass))
#define IS_IAGNO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IAGNO))
#define IS_IAGNO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IAGNO))
#define IAGNO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IAGNO, IagnoClass))

typedef struct _Iagno Iagno;
typedef struct _IagnoClass IagnoClass;

#define TYPE_THEME (theme_get_type ())
#define THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THEME, Theme))
#define THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THEME, ThemeClass))
#define IS_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THEME))
#define IS_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THEME))
#define THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THEME, ThemeClass))

typedef struct _Theme Theme;
typedef struct _ThemeClass ThemeClass;

#define TYPE_GAME_STATE_OBJECT (game_state_object_get_type ())
#define GAME_STATE_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GAME_STATE_OBJECT, GameStateObject))
#define GAME_STATE_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GAME_STATE_OBJECT, GameStateObjectClass))
#define IS_GAME_STATE_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GAME_STATE_OBJECT))
#define IS_GAME_STATE_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GAME_STATE_OBJECT))
#define GAME_STATE_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GAME_STATE_OBJECT, GameStateObjectClass))

typedef struct _GameStateObject GameStateObject;
typedef struct _GameStateObjectClass GameStateObjectClass;
typedef enum  {
	PLAYER_NONE,
	PLAYER_DARK,
	PLAYER_LIGHT
} Player;

#define TYPE_PLAYER (player_get_type ())
enum  {
	REVERSI_VIEW_0_PROPERTY,
	REVERSI_VIEW_SHOW_PLAYABLE_TILES_PROPERTY,
	REVERSI_VIEW_SHOW_TURNABLE_TILES_PROPERTY,
	REVERSI_VIEW_GAME_PROPERTY,
	REVERSI_VIEW_IAGNO_INSTANCE_PROPERTY,
	REVERSI_VIEW_THEME_PROPERTY,
	REVERSI_VIEW_NUM_PROPERTIES
};
static GParamSpec* reversi_view_properties[REVERSI_VIEW_NUM_PROPERTIES];
typedef enum  {
	REVERSI_VIEW_DIRECTION_TOP,
	REVERSI_VIEW_DIRECTION_LEFT,
	REVERSI_VIEW_DIRECTION_RIGHT,
	REVERSI_VIEW_DIRECTION_BOTTOM
} ReversiViewDirection;

#define REVERSI_VIEW_TYPE_DIRECTION (reversi_view_direction_get_type ())
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define __vala_GskStroke_free0(var) ((var == NULL) ? NULL : (var = (_vala_GskStroke_free (var), NULL)))
#define _gsk_path_unref0(var) ((var == NULL) ? NULL : (var = (gsk_path_unref (var), NULL)))
#define _gsk_path_builder_unref0(var) ((var == NULL) ? NULL : (var = (gsk_path_builder_unref (var), NULL)))
typedef enum  {
	OPENING_HUMANS,
	OPENING_REVERSI,
	OPENING_INVERTED,
	OPENING_ALTER_TOP,
	OPENING_ALTER_LEFT,
	OPENING_ALTER_RIGHT,
	OPENING_ALTER_BOTTOM
} Opening;

#define TYPE_OPENING (opening_get_type ())

#define TYPE_COMPUTER_PLAYER (computer_player_get_type ())
#define COMPUTER_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COMPUTER_PLAYER, ComputerPlayer))
#define COMPUTER_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COMPUTER_PLAYER, ComputerPlayerClass))
#define IS_COMPUTER_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COMPUTER_PLAYER))
#define IS_COMPUTER_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COMPUTER_PLAYER))
#define COMPUTER_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COMPUTER_PLAYER, ComputerPlayerClass))

typedef struct _ComputerPlayer ComputerPlayer;
typedef struct _ComputerPlayerClass ComputerPlayerClass;

#define TYPE_POSSIBLE_MOVE (possible_move_get_type ())
typedef struct _PossibleMove PossibleMove;
typedef struct _Block2Data Block2Data;
typedef struct _Block3Data Block3Data;
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	REVERSI_VIEW_MOVE_SIGNAL,
	REVERSI_VIEW_CLEAR_IMPOSSIBLE_TO_MOVE_HERE_WARNING_SIGNAL,
	REVERSI_VIEW_NOTIFY_FINAL_ANIMATION_SIGNAL,
	REVERSI_VIEW_NUM_SIGNALS
};
static guint reversi_view_signals[REVERSI_VIEW_NUM_SIGNALS] = {0};
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _ReversiView {
	GtkWidget parent_instance;
	ReversiViewPrivate * priv;
};

struct _ReversiViewClass {
	GtkWidgetClass parent_class;
};

struct _ReversiViewPrivate {
	gboolean _show_playable_tiles;
	gboolean _show_turnable_tiles;
	gint board_x;
	gint board_y;
	gboolean show_highlight;
	gboolean highlight_set;
	guint8 highlight_x;
	guint8 highlight_y;
	guint8 old_highlight_x;
	guint8 old_highlight_y;
	guint8 highlight_state;
	gboolean show_mouse_highlight;
	gboolean mouse_position_set;
	guint8 mouse_highlight_x;
	guint8 mouse_highlight_y;
	guint8 mouse_position_x;
	guint8 mouse_position_y;
	guint render_size;
	GdkTexture* tiles_pattern;
	GdkTexture* noise_texture;
	gint* pixmaps;
	gint pixmaps_length1;
	gint pixmaps_length2;
	guint animate_timeout;
	guint8 humans_opening_intensity;
	gboolean game_is_set;
	guint8 game_size;
	Game* _game;
	Iagno* _iagno_instance;
	Theme* _theme;
	gboolean configuration_done;
	gint paving_size;
	gint tile_size;
	gint board_size;
	gint* overture_origin_xs;
	gint overture_origin_xs_length1;
	gint _overture_origin_xs_size_;
	gint overture_origin_y;
	guint8* overture_steps;
	gint overture_steps_length1;
	gint _overture_steps_size_;
	guint8* overture_target;
	gint overture_target_length1;
	gint _overture_target_size_;
	guint8 current_overture_playable;
	gboolean last_state_set;
	GameStateObject* last_state;
	gboolean flip_final_result_now;
	Player winning_color;
	gint n_winning_tiles;
	Player losing_color;
	gint n_losing_tiles;
	gboolean mouse_is_in;
	guint timeout_id;
	guint8 playable_tiles_highlight_state;
	gboolean* possible_moves;
	gint possible_moves_length1;
	gint possible_moves_length2;
};

struct _PossibleMove {
	guint8 x;
	guint8 y;
	guint8 n_tiles;
	guint8 n_tiles_n;
	guint8 n_tiles_ne;
	guint8 n_tiles_e;
	guint8 n_tiles_se;
	guint8 n_tiles_s;
	guint8 n_tiles_so;
	guint8 n_tiles_o;
	guint8 n_tiles_no;
};

struct _Block2Data {
	int _ref_count_;
	ReversiView* self;
	gboolean is_final_animation;
};

struct _Block3Data {
	int _ref_count_;
	ReversiView* self;
	guint8 x;
	guint8 y;
};

static gint ReversiView_private_offset;
static gpointer reversi_view_parent_class = NULL;

VALA_EXTERN GType reversi_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ReversiView, g_object_unref)
VALA_EXTERN GType game_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Game, g_object_unref)
VALA_EXTERN GType iagno_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Iagno, g_object_unref)
VALA_EXTERN GType theme_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Theme, g_object_unref)
VALA_EXTERN GType game_state_object_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GameStateObject, g_object_unref)
VALA_EXTERN GType player_get_type (void) G_GNUC_CONST ;
static GType reversi_view_direction_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
VALA_EXTERN ReversiView* reversi_view_new (Iagno* iagno_instance);
VALA_EXTERN ReversiView* reversi_view_construct (GType object_type,
                                     Iagno* iagno_instance);
static void reversi_view_configure_theme (ReversiView* self);
VALA_EXTERN Theme* reversi_view_get_theme (ReversiView* self);
VALA_EXTERN gint theme_get_border_width (Theme* self);
VALA_EXTERN gint theme_get_spacing_width (Theme* self);
static inline void reversi_view_configure_overture_origin (ReversiView* self);
static void reversi_view_real_snapshot (GtkWidget* base,
                                 GtkSnapshot* snapshot);
static inline void reversi_view_draw_board_background (ReversiView* self,
                                         GtkSnapshot* snapshot);
static inline void reversi_view_draw_tiles_background (ReversiView* self,
                                         GtkSnapshot* snapshot);
VALA_EXTERN GdkTexture* theme_tileset_for_size (Theme* self,
                                    gint tile_size);
static inline void reversi_view_draw_overture (ReversiView* self,
                                 GtkSnapshot* snapshot);
static inline void reversi_view_draw_highlight (ReversiView* self,
                                  GtkSnapshot* snapshot);
static inline void reversi_view_add_highlights (ReversiView* self,
                                  GtkSnapshot* snapshot);
static inline void reversi_view_draw_playables (ReversiView* self,
                                  GtkSnapshot* snapshot);
static inline void reversi_view_draw_overture_playables (ReversiView* self,
                                           GtkSnapshot* snapshot);
VALA_EXTERN gdouble theme_get_spacing_red (Theme* self);
VALA_EXTERN gdouble theme_get_spacing_green (Theme* self);
VALA_EXTERN gdouble theme_get_spacing_blue (Theme* self);
VALA_EXTERN gdouble theme_get_border_red (Theme* self);
VALA_EXTERN gdouble theme_get_border_green (Theme* self);
VALA_EXTERN gdouble theme_get_border_blue (Theme* self);
static void _vala_GskStroke_free (GskStroke* self);
static inline void reversi_view_draw_tile_background (ReversiView* self,
                                        GtkSnapshot* snapshot,
                                        gint tile_x,
                                        gint tile_y);
static inline GskPath* reversi_view_rounded_square (ReversiView* self,
                                      gfloat x,
                                      gfloat y,
                                      gfloat size,
                                      gint radius_percent);
VALA_EXTERN gint theme_get_background_radius (Theme* self);
VALA_EXTERN gboolean theme_get_apply_texture (Theme* self);
VALA_EXTERN gdouble theme_get_background_red (Theme* self);
VALA_EXTERN gdouble theme_get_background_green (Theme* self);
VALA_EXTERN gdouble theme_get_background_blue (Theme* self);
static void reversi_view_darken_tile (ReversiView* self,
                               GtkSnapshot* snapshot,
                               guint8 x,
                               guint8 y);
VALA_EXTERN Game* reversi_view_get_game (ReversiView* self);
VALA_EXTERN GType opening_get_type (void) G_GNUC_CONST ;
VALA_EXTERN Opening game_get_opening (Game* self);
VALA_EXTERN gboolean game_get_is_complete (Game* self);
static Iagno* reversi_view_get_iagno_instance (ReversiView* self);
VALA_EXTERN Player iagno_get_player_one (Iagno* self);
VALA_EXTERN Player game_get_current_color (Game* self);
VALA_EXTERN GType computer_player_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ComputerPlayer, g_object_unref)
VALA_EXTERN ComputerPlayer* iagno_get_computer (Iagno* self);
static inline void reversi_view_draw_tile_highlight (ReversiView* self,
                                       GtkSnapshot* snapshot,
                                       guint8 x,
                                       guint8 y);
VALA_EXTERN GType possible_move_get_type (void) G_GNUC_CONST ;
VALA_EXTERN PossibleMove* possible_move_dup (const PossibleMove* self);
VALA_EXTERN void possible_move_free (PossibleMove* self);
VALA_EXTERN gboolean game_test_placing_tile (Game* self,
                                 guint8 x,
                                 guint8 y,
                                 PossibleMove* move);
static void reversi_view_queue_draw_idle (ReversiView* self);
static void reversi_view_highlight_tile (ReversiView* self,
                                  GtkSnapshot* snapshot,
                                  guint8 x,
                                  guint8 y,
                                  guint8 intensity,
                                  gboolean soft_highlight);
static gboolean reversi_view_get_show_turnable_tiles (ReversiView* self);
static inline void reversi_view_highlight_turnable_tiles (ReversiView* self,
                                            GtkSnapshot* snapshot,
                                            guint8 x,
                                            guint8 y,
                                            gint8 x_step,
                                            gint8 y_step,
                                            guint8 count);
static gboolean reversi_view_get_show_playable_tiles (ReversiView* self);
static void reversi_view_init_possible_moves (ReversiView* self);
static inline void reversi_view_add_highlight (ReversiView* self,
                                 GtkSnapshot* snapshot,
                                 guint8 x,
                                 guint8 y,
                                 guint8 intensity);
static inline void reversi_view_draw_playable (ReversiView* self,
                                 GtkSnapshot* snapshot,
                                 gint pixmap,
                                 gint tile_x,
                                 gint tile_y);
static inline void reversi_view_draw_overture_indicator (ReversiView* self,
                                           GtkSnapshot* snapshot);
static inline void reversi_view_draw_overture_playable (ReversiView* self,
                                          GtkSnapshot* snapshot,
                                          guint8 playable_id);
static void reversi_view_get_x_and_y (ReversiView* self,
                               guint8 playable_id,
                               guint8* x,
                               guint8* y);
VALA_EXTERN gdouble theme_get_highlight_soft_red (Theme* self);
VALA_EXTERN gdouble theme_get_highlight_soft_green (Theme* self);
VALA_EXTERN gdouble theme_get_highlight_soft_blue (Theme* self);
VALA_EXTERN gdouble theme_get_highlight_soft_alpha (Theme* self);
VALA_EXTERN gdouble theme_get_highlight_hard_red (Theme* self);
VALA_EXTERN gdouble theme_get_highlight_hard_green (Theme* self);
VALA_EXTERN gdouble theme_get_highlight_hard_blue (Theme* self);
VALA_EXTERN gdouble theme_get_highlight_hard_alpha (Theme* self);
static void __lambda12_ (ReversiView* self);
static void ___lambda12__gsource_once_func (gpointer self);
static inline void reversi_view_update_highlight_after_undo (ReversiView* self);
static void reversi_view_get_missing_tile (ReversiView* self,
                                    guint8* x,
                                    guint8* y);
static void reversi_view_set_square (ReversiView* self,
                              guint8 x,
                              guint8 y,
                              gint pixmap,
                              gboolean is_final_animation,
                              gboolean force_redraw);
static gint reversi_view_get_pixmap (Player color);
VALA_EXTERN Player game_get_owner (Game* self,
                       guint8 x,
                       guint8 y);
static inline void reversi_view_highlight_playable_tiles (ReversiView* self,
                                            gboolean force_reload);
VALA_EXTERN Player game_state_object_get_owner (GameStateObject* self,
                                    guint8 x,
                                    guint8 y);
static void reversi_view_turn_ended_cb (ReversiView* self,
                                 gboolean undoing,
                                 gboolean no_draw);
VALA_EXTERN GameStateObject* game_get_current_state (Game* self);
static inline void reversi_view_update_squares (ReversiView* self);
static inline void reversi_view_update_square (ReversiView* self,
                                 guint8 x,
                                 guint8 y);
static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (void * _userdata_);
static gboolean ____lambda11_ (Block2Data* _data2_);
static void reversi_view_flip_final_result_tile (ReversiView* self,
                                          guint8 x,
                                          guint8 y);
static void _reversi_view_on_motion (ReversiView* self,
                              guint8 x,
                              guint8 y,
                              gboolean force_redraw);
static gboolean _____lambda11__gsource_func (gpointer self);
static void reversi_view_game_is_complete_cb (ReversiView* self);
VALA_EXTERN guint8 game_get_n_light_tiles (Game* self);
VALA_EXTERN guint8 game_get_n_dark_tiles (Game* self);
static gboolean ___lambda10_ (ReversiView* self);
static void reversi_view_set_winner_and_loser_variables (ReversiView* self);
static gboolean ____lambda10__gsource_func (gpointer self);
VALA_EXTERN gboolean reversi_view_undo_final_animation (ReversiView* self);
static void reversi_view_init_mouse (ReversiView* self);
static void reversi_view_on_motion (ReversiView* self,
                             GtkEventControllerMotion* _motion_controller,
                             gdouble event_x,
                             gdouble event_y);
static void _reversi_view_on_motion_gtk_event_controller_motion_motion (GtkEventControllerMotion* _sender,
                                                                 gdouble x,
                                                                 gdouble y,
                                                                 gpointer self);
static void reversi_view_on_mouse_in (ReversiView* self,
                               GtkEventControllerMotion* _motion_controller,
                               gdouble event_x,
                               gdouble event_y);
static void _reversi_view_on_mouse_in_gtk_event_controller_motion_enter (GtkEventControllerMotion* _sender,
                                                                  gdouble x,
                                                                  gdouble y,
                                                                  gpointer self);
static void reversi_view_on_mouse_out (ReversiView* self,
                                GtkEventControllerMotion* _motion_controller);
static void _reversi_view_on_mouse_out_gtk_event_controller_motion_leave (GtkEventControllerMotion* _sender,
                                                                   gpointer self);
static inline void reversi_view_on_click (ReversiView* self,
                            GtkGestureClick* _click_controller,
                            gint n_press,
                            gdouble event_x,
                            gdouble event_y);
static void _reversi_view_on_click_gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                                       gint n_press,
                                                       gdouble x,
                                                       gdouble y,
                                                       gpointer self);
static gboolean reversi_view_pointer_is_in_board (ReversiView* self,
                                           gdouble pos_x,
                                           gdouble pos_y,
                                           guint8* x,
                                           guint8* y);
static void reversi_view_on_cursor_moving_in (ReversiView* self,
                                       guint8 x,
                                       guint8 y);
static Block3Data* block3_data_ref (Block3Data* _data3_);
static void block3_data_unref (void * _userdata_);
static gboolean ______lambda14_ (Block3Data* _data3_);
static gboolean _______lambda14__gsource_func (gpointer self);
static inline void reversi_view_move_if_possible (ReversiView* self,
                                    guint8 x,
                                    guint8 y);
static void reversi_view_init_keyboard (ReversiView* self);
static inline gboolean reversi_view_on_key_pressed (ReversiView* self,
                                      GtkEventControllerKey* _key_controller,
                                      guint keyval,
                                      guint keycode,
                                      GdkModifierType state);
static gboolean _reversi_view_on_key_pressed_gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                            guint keyval,
                                                                            guint keycode,
                                                                            GdkModifierType state,
                                                                            gpointer self);
static void reversi_view_set_highlight_position_if_needed (ReversiView* self,
                                                    ReversiViewDirection direction);
static void reversi_view_init_highlight_on_light_tile_if_needed (ReversiView* self);
static void reversi_view_init_highlight_on_light_tile (ReversiView* self);
VALA_EXTERN void game_get_possible_moves (Game* self,
                              GSList** moves);
static void _possible_move_free0_ (gpointer var);
static inline void _g_slist_free__possible_move_free0_ (GSList* self);
static void __lambda13_ (ReversiView* self,
                  PossibleMove* move);
static void ___lambda13__gfunc (gconstpointer data,
                         gpointer self);
VALA_EXTERN void reversi_view_set_show_playable_tiles (ReversiView* self,
                                           gboolean value);
VALA_EXTERN void reversi_view_set_show_turnable_tiles (ReversiView* self,
                                           gboolean value);
VALA_EXTERN void reversi_view_set_game (ReversiView* self,
                            Game* value);
VALA_EXTERN guint8 game_get_size (Game* self);
static void _reversi_view_game_is_complete_cb_game_completeness_updated (Game* _sender,
                                                                  gboolean completeness,
                                                                  gpointer self);
static void _reversi_view_turn_ended_cb_game_turn_ended (Game* _sender,
                                                  gboolean undoing,
                                                  gboolean no_draw,
                                                  gpointer self);
static void reversi_view_set_iagno_instance (ReversiView* self,
                                      Iagno* value);
VALA_EXTERN void reversi_view_set_theme (ReversiView* self,
                             Theme* value);
static void g_cclosure_user_marshal_VOID__UCHAR_UCHAR (GClosure * closure,
                                                GValue * return_value,
                                                guint n_param_values,
                                                const GValue * param_values,
                                                gpointer invocation_hint,
                                                gpointer marshal_data);
static GObject * reversi_view_constructor (GType type,
                                    guint n_construct_properties,
                                    GObjectConstructParam * construct_properties);
static void reversi_view_finalize (GObject * obj);
static GType reversi_view_get_type_once (void);
static void _vala_reversi_view_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec);
static void _vala_reversi_view_set_property (GObject * object,
                                      guint property_id,
                                      const GValue * value,
                                      GParamSpec * pspec);

static inline gpointer
reversi_view_get_instance_private (ReversiView* self)
{
	return G_STRUCT_MEMBER_P (self, ReversiView_private_offset);
}

 G_GNUC_NO_INLINE static GType
reversi_view_direction_get_type_once (void)
{
	static const GEnumValue values[] = {{REVERSI_VIEW_DIRECTION_TOP, "REVERSI_VIEW_DIRECTION_TOP", "top"}, {REVERSI_VIEW_DIRECTION_LEFT, "REVERSI_VIEW_DIRECTION_LEFT", "left"}, {REVERSI_VIEW_DIRECTION_RIGHT, "REVERSI_VIEW_DIRECTION_RIGHT", "right"}, {REVERSI_VIEW_DIRECTION_BOTTOM, "REVERSI_VIEW_DIRECTION_BOTTOM", "bottom"}, {0, NULL, NULL}};
	GType reversi_view_direction_type_id;
	reversi_view_direction_type_id = g_enum_register_static ("ReversiViewDirection", values);
	return reversi_view_direction_type_id;
}

static GType
reversi_view_direction_get_type (void)
{
	static gsize reversi_view_direction_type_id__once = 0;
	if (g_once_init_enter (&reversi_view_direction_type_id__once)) {
		GType reversi_view_direction_type_id;
		reversi_view_direction_type_id = reversi_view_direction_get_type_once ();
		g_once_init_leave (&reversi_view_direction_type_id__once, reversi_view_direction_type_id);
	}
	return reversi_view_direction_type_id__once;
}

ReversiView*
reversi_view_construct (GType object_type,
                        Iagno* iagno_instance)
{
	ReversiView * self = NULL;
	g_return_val_if_fail (iagno_instance != NULL, NULL);
	self = (ReversiView*) g_object_new (object_type, "iagno-instance", iagno_instance, NULL);
	return self;
}

ReversiView*
reversi_view_new (Iagno* iagno_instance)
{
	return reversi_view_construct (TYPE_REVERSI_VIEW, iagno_instance);
}

static void
reversi_view_configure_theme (ReversiView* self)
{
	gint width = 0;
	gint height = 0;
	gint size = 0;
	Theme* _tmp0_;
	Theme* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	Theme* _tmp4_;
	Theme* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	Theme* _tmp8_;
	Theme* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	Theme* _tmp12_;
	Theme* _tmp13_;
	gint _tmp14_;
	gint _tmp15_;
	Theme* _tmp16_;
	Theme* _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	Theme* _tmp20_;
	Theme* _tmp21_;
	gint _tmp22_;
	gint _tmp23_;
	Theme* _tmp24_;
	Theme* _tmp25_;
	gint _tmp26_;
	gint _tmp27_;
	g_return_if_fail (self != NULL);
	width = gtk_widget_get_width ((GtkWidget*) self);
	height = gtk_widget_get_height ((GtkWidget*) self);
	size = MIN (width, height);
	_tmp0_ = reversi_view_get_theme (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = theme_get_border_width (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = reversi_view_get_theme (self);
	_tmp5_ = _tmp4_;
	_tmp6_ = theme_get_spacing_width (_tmp5_);
	_tmp7_ = _tmp6_;
	self->priv->paving_size = ((size - (2 * _tmp3_)) + _tmp7_) / self->priv->game_size;
	_tmp8_ = reversi_view_get_theme (self);
	_tmp9_ = _tmp8_;
	_tmp10_ = theme_get_spacing_width (_tmp9_);
	_tmp11_ = _tmp10_;
	self->priv->tile_size = self->priv->paving_size - _tmp11_;
	_tmp12_ = reversi_view_get_theme (self);
	_tmp13_ = _tmp12_;
	_tmp14_ = theme_get_spacing_width (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = reversi_view_get_theme (self);
	_tmp17_ = _tmp16_;
	_tmp18_ = theme_get_border_width (_tmp17_);
	_tmp19_ = _tmp18_;
	self->priv->board_size = ((self->priv->paving_size * self->priv->game_size) - _tmp15_) + (2 * _tmp19_);
	_tmp20_ = reversi_view_get_theme (self);
	_tmp21_ = _tmp20_;
	_tmp22_ = theme_get_border_width (_tmp21_);
	_tmp23_ = _tmp22_;
	self->priv->board_x = ((width - self->priv->board_size) / 2) + _tmp23_;
	_tmp24_ = reversi_view_get_theme (self);
	_tmp25_ = _tmp24_;
	_tmp26_ = theme_get_border_width (_tmp25_);
	_tmp27_ = _tmp26_;
	self->priv->board_y = ((height - self->priv->board_size) / 2) + _tmp27_;
	if (((gint) self->priv->humans_opening_intensity) != 0) {
		reversi_view_configure_overture_origin (self);
	}
}

static inline void
reversi_view_configure_overture_origin (ReversiView* self)
{
	g_return_if_fail (self != NULL);
	if ((self->priv->game_size % 2) == 0) {
		gint* _tmp0_;
		gint _tmp0__length1;
		Theme* _tmp1_;
		Theme* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint* _tmp5_;
		gint _tmp5__length1;
		Theme* _tmp6_;
		Theme* _tmp7_;
		gint _tmp8_;
		gint _tmp9_;
		gint* _tmp10_;
		gint _tmp10__length1;
		Theme* _tmp11_;
		Theme* _tmp12_;
		gint _tmp13_;
		gint _tmp14_;
		gint* _tmp15_;
		gint _tmp15__length1;
		Theme* _tmp16_;
		Theme* _tmp17_;
		gint _tmp18_;
		gint _tmp19_;
		_tmp0_ = self->priv->overture_origin_xs;
		_tmp0__length1 = self->priv->overture_origin_xs_length1;
		_tmp1_ = reversi_view_get_theme (self);
		_tmp2_ = _tmp1_;
		_tmp3_ = theme_get_border_width (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_[0] = ((((self->priv->game_size - 3) * self->priv->board_size) / (2 * self->priv->game_size)) - _tmp4_) - (self->priv->tile_size / 2);
		_tmp5_ = self->priv->overture_origin_xs;
		_tmp5__length1 = self->priv->overture_origin_xs_length1;
		_tmp6_ = reversi_view_get_theme (self);
		_tmp7_ = _tmp6_;
		_tmp8_ = theme_get_border_width (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp5_[1] = ((((self->priv->game_size - 1) * self->priv->board_size) / (2 * self->priv->game_size)) - _tmp9_) - (self->priv->tile_size / 2);
		_tmp10_ = self->priv->overture_origin_xs;
		_tmp10__length1 = self->priv->overture_origin_xs_length1;
		_tmp11_ = reversi_view_get_theme (self);
		_tmp12_ = _tmp11_;
		_tmp13_ = theme_get_border_width (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp10_[2] = ((((self->priv->game_size + 1) * self->priv->board_size) / (2 * self->priv->game_size)) - _tmp14_) - (self->priv->tile_size / 2);
		_tmp15_ = self->priv->overture_origin_xs;
		_tmp15__length1 = self->priv->overture_origin_xs_length1;
		_tmp16_ = reversi_view_get_theme (self);
		_tmp17_ = _tmp16_;
		_tmp18_ = theme_get_border_width (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp15_[3] = ((((self->priv->game_size + 3) * self->priv->board_size) / (2 * self->priv->game_size)) - _tmp19_) - (self->priv->tile_size / 2);
		if (((gint) self->priv->game_size) == 4) {
			Theme* _tmp20_;
			Theme* _tmp21_;
			gint _tmp22_;
			gint _tmp23_;
			_tmp20_ = reversi_view_get_theme (self);
			_tmp21_ = _tmp20_;
			_tmp22_ = theme_get_border_width (_tmp21_);
			_tmp23_ = _tmp22_;
			self->priv->overture_origin_y = (gint) (((((self->priv->game_size + 2.6) * self->priv->board_size) / (2 * self->priv->game_size)) - _tmp23_) - (self->priv->tile_size / 2));
		} else {
			Theme* _tmp24_;
			Theme* _tmp25_;
			gint _tmp26_;
			gint _tmp27_;
			_tmp24_ = reversi_view_get_theme (self);
			_tmp25_ = _tmp24_;
			_tmp26_ = theme_get_border_width (_tmp25_);
			_tmp27_ = _tmp26_;
			self->priv->overture_origin_y = ((((self->priv->game_size + 4) * self->priv->board_size) / (2 * self->priv->game_size)) - _tmp27_) - (self->priv->tile_size / 2);
		}
	} else {
		gint* _tmp28_;
		gint _tmp28__length1;
		Theme* _tmp29_;
		Theme* _tmp30_;
		gint _tmp31_;
		gint _tmp32_;
		gint* _tmp33_;
		gint _tmp33__length1;
		Theme* _tmp34_;
		Theme* _tmp35_;
		gint _tmp36_;
		gint _tmp37_;
		gint* _tmp38_;
		gint _tmp38__length1;
		Theme* _tmp39_;
		Theme* _tmp40_;
		gint _tmp41_;
		gint _tmp42_;
		gint* _tmp43_;
		gint _tmp43__length1;
		gint* _tmp44_;
		gint _tmp44__length1;
		gint _tmp45_;
		gint* _tmp46_;
		gint _tmp46__length1;
		gint* _tmp47_;
		gint _tmp47__length1;
		gint _tmp48_;
		gint* _tmp49_;
		gint _tmp49__length1;
		gint* _tmp50_;
		gint _tmp50__length1;
		gint _tmp51_;
		_tmp28_ = self->priv->overture_origin_xs;
		_tmp28__length1 = self->priv->overture_origin_xs_length1;
		_tmp29_ = reversi_view_get_theme (self);
		_tmp30_ = _tmp29_;
		_tmp31_ = theme_get_border_width (_tmp30_);
		_tmp32_ = _tmp31_;
		_tmp28_[0] = ((((self->priv->game_size - 2) * self->priv->board_size) / (2 * self->priv->game_size)) - _tmp32_) - (self->priv->tile_size / 2);
		_tmp33_ = self->priv->overture_origin_xs;
		_tmp33__length1 = self->priv->overture_origin_xs_length1;
		_tmp34_ = reversi_view_get_theme (self);
		_tmp35_ = _tmp34_;
		_tmp36_ = theme_get_border_width (_tmp35_);
		_tmp37_ = _tmp36_;
		_tmp33_[2] = (((self->priv->game_size * self->priv->board_size) / (2 * self->priv->game_size)) - _tmp37_) - (self->priv->tile_size / 2);
		_tmp38_ = self->priv->overture_origin_xs;
		_tmp38__length1 = self->priv->overture_origin_xs_length1;
		_tmp39_ = reversi_view_get_theme (self);
		_tmp40_ = _tmp39_;
		_tmp41_ = theme_get_border_width (_tmp40_);
		_tmp42_ = _tmp41_;
		_tmp38_[4] = ((((self->priv->game_size + 2) * self->priv->board_size) / (2 * self->priv->game_size)) - _tmp42_) - (self->priv->tile_size / 2);
		_tmp43_ = self->priv->overture_origin_xs;
		_tmp43__length1 = self->priv->overture_origin_xs_length1;
		_tmp44_ = self->priv->overture_origin_xs;
		_tmp44__length1 = self->priv->overture_origin_xs_length1;
		_tmp45_ = _tmp44_[0];
		_tmp43_[1] = _tmp45_;
		_tmp46_ = self->priv->overture_origin_xs;
		_tmp46__length1 = self->priv->overture_origin_xs_length1;
		_tmp47_ = self->priv->overture_origin_xs;
		_tmp47__length1 = self->priv->overture_origin_xs_length1;
		_tmp48_ = _tmp47_[2];
		_tmp46_[3] = _tmp48_;
		_tmp49_ = self->priv->overture_origin_xs;
		_tmp49__length1 = self->priv->overture_origin_xs_length1;
		_tmp50_ = self->priv->overture_origin_xs;
		_tmp50__length1 = self->priv->overture_origin_xs_length1;
		_tmp51_ = _tmp50_[4];
		_tmp49_[5] = _tmp51_;
		if (((gint) self->priv->game_size) == 5) {
			Theme* _tmp52_;
			Theme* _tmp53_;
			gint _tmp54_;
			gint _tmp55_;
			_tmp52_ = reversi_view_get_theme (self);
			_tmp53_ = _tmp52_;
			_tmp54_ = theme_get_border_width (_tmp53_);
			_tmp55_ = _tmp54_;
			self->priv->overture_origin_y = (gint) (((((self->priv->game_size + 3.6) * self->priv->board_size) / (2 * self->priv->game_size)) - _tmp55_) - (self->priv->tile_size / 2));
		} else {
			Theme* _tmp56_;
			Theme* _tmp57_;
			gint _tmp58_;
			gint _tmp59_;
			_tmp56_ = reversi_view_get_theme (self);
			_tmp57_ = _tmp56_;
			_tmp58_ = theme_get_border_width (_tmp57_);
			_tmp59_ = _tmp58_;
			self->priv->overture_origin_y = ((((self->priv->game_size + 5) * self->priv->board_size) / (2 * self->priv->game_size)) - _tmp59_) - (self->priv->tile_size / 2);
		}
	}
}

static void
reversi_view_real_snapshot (GtkWidget* base,
                            GtkSnapshot* snapshot)
{
	ReversiView * self;
	Theme* _tmp0_;
	Theme* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	Theme* _tmp4_;
	Theme* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	graphene_point_t _tmp8_ = {0};
	graphene_point_t _tmp9_ = {0};
	gboolean _tmp10_ = FALSE;
	GdkTexture* _tmp11_;
	self = (ReversiView*) base;
	g_return_if_fail (snapshot != NULL);
	if (!self->priv->game_is_set) {
		return;
	}
	reversi_view_configure_theme (self);
	gtk_snapshot_save (snapshot);
	_tmp0_ = reversi_view_get_theme (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = theme_get_border_width (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = reversi_view_get_theme (self);
	_tmp5_ = _tmp4_;
	_tmp6_ = theme_get_border_width (_tmp5_);
	_tmp7_ = _tmp6_;
	memset (&_tmp8_, 0, sizeof (graphene_point_t));
	_tmp8_.x = (gfloat) (self->priv->board_x - _tmp3_);
	_tmp8_.y = (gfloat) (self->priv->board_y - _tmp7_);
	gtk_snapshot_translate (snapshot, &_tmp8_);
	reversi_view_draw_board_background (self, snapshot);
	reversi_view_draw_tiles_background (self, snapshot);
	gtk_snapshot_restore (snapshot);
	memset (&_tmp9_, 0, sizeof (graphene_point_t));
	_tmp9_.x = (gfloat) self->priv->board_x;
	_tmp9_.y = (gfloat) self->priv->board_y;
	gtk_snapshot_translate (snapshot, &_tmp9_);
	_tmp11_ = self->priv->tiles_pattern;
	if (_tmp11_ == NULL) {
		_tmp10_ = TRUE;
	} else {
		_tmp10_ = self->priv->render_size != ((guint) self->priv->tile_size);
	}
	if (_tmp10_) {
		Theme* _tmp12_;
		Theme* _tmp13_;
		GdkTexture* _tmp14_;
		_tmp12_ = reversi_view_get_theme (self);
		_tmp13_ = _tmp12_;
		_tmp14_ = theme_tileset_for_size (_tmp13_, self->priv->tile_size);
		_g_object_unref0 (self->priv->tiles_pattern);
		self->priv->tiles_pattern = _tmp14_;
		self->priv->render_size = (guint) self->priv->tile_size;
	}
	if (((gint) self->priv->humans_opening_intensity) != 0) {
		reversi_view_draw_overture (self, snapshot);
	}
	reversi_view_draw_highlight (self, snapshot);
	reversi_view_add_highlights (self, snapshot);
	if (((gint) self->priv->humans_opening_intensity) == 0) {
		reversi_view_draw_playables (self, snapshot);
	} else {
		reversi_view_draw_overture_playables (self, snapshot);
	}
}

static void
_vala_GskStroke_free (GskStroke* self)
{
	g_boxed_free (gsk_stroke_get_type (), self);
}

static inline void
reversi_view_draw_board_background (ReversiView* self,
                                    GtkSnapshot* snapshot)
{
	GskPathBuilder* builder = NULL;
	GskPathBuilder* _tmp0_;
	Theme* _tmp1_;
	Theme* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	Theme* _tmp5_;
	Theme* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	graphene_point_t _tmp9_ = {0};
	Theme* _tmp10_;
	Theme* _tmp11_;
	gint _tmp12_;
	gint _tmp13_;
	Theme* _tmp14_;
	Theme* _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	graphene_size_t _tmp18_ = {0};
	graphene_rect_t _tmp19_ = {0};
	GskPath* path = NULL;
	GskPath* _tmp20_;
	Theme* _tmp21_;
	Theme* _tmp22_;
	gdouble _tmp23_;
	gdouble _tmp24_;
	Theme* _tmp25_;
	Theme* _tmp26_;
	gdouble _tmp27_;
	gdouble _tmp28_;
	Theme* _tmp29_;
	Theme* _tmp30_;
	gdouble _tmp31_;
	gdouble _tmp32_;
	GdkRGBA _tmp33_ = {0};
	Theme* _tmp34_;
	Theme* _tmp35_;
	gint _tmp36_;
	gint _tmp37_;
	GskStroke* _tmp38_;
	GskStroke* _tmp39_;
	Theme* _tmp40_;
	Theme* _tmp41_;
	gdouble _tmp42_;
	gdouble _tmp43_;
	Theme* _tmp44_;
	Theme* _tmp45_;
	gdouble _tmp46_;
	gdouble _tmp47_;
	Theme* _tmp48_;
	Theme* _tmp49_;
	gdouble _tmp50_;
	gdouble _tmp51_;
	GdkRGBA _tmp52_ = {0};
	g_return_if_fail (self != NULL);
	g_return_if_fail (snapshot != NULL);
	_tmp0_ = gsk_path_builder_new ();
	builder = _tmp0_;
	_tmp1_ = reversi_view_get_theme (self);
	_tmp2_ = _tmp1_;
	_tmp3_ = theme_get_border_width (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = reversi_view_get_theme (self);
	_tmp6_ = _tmp5_;
	_tmp7_ = theme_get_border_width (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_.x = ((gfloat) _tmp4_) / 2;
	_tmp9_.y = ((gfloat) _tmp8_) / 2;
	_tmp10_ = reversi_view_get_theme (self);
	_tmp11_ = _tmp10_;
	_tmp12_ = theme_get_border_width (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = reversi_view_get_theme (self);
	_tmp15_ = _tmp14_;
	_tmp16_ = theme_get_border_width (_tmp15_);
	_tmp17_ = _tmp16_;
	_tmp18_.width = (gfloat) (self->priv->board_size - _tmp13_);
	_tmp18_.height = (gfloat) (self->priv->board_size - _tmp17_);
	memset (&_tmp19_, 0, sizeof (graphene_rect_t));
	_tmp19_.origin = _tmp9_;
	_tmp19_.size = _tmp18_;
	gsk_path_builder_add_rect (builder, &_tmp19_);
	_tmp20_ = gsk_path_builder_to_path (builder);
	path = _tmp20_;
	_tmp21_ = reversi_view_get_theme (self);
	_tmp22_ = _tmp21_;
	_tmp23_ = theme_get_spacing_red (_tmp22_);
	_tmp24_ = _tmp23_;
	_tmp25_ = reversi_view_get_theme (self);
	_tmp26_ = _tmp25_;
	_tmp27_ = theme_get_spacing_green (_tmp26_);
	_tmp28_ = _tmp27_;
	_tmp29_ = reversi_view_get_theme (self);
	_tmp30_ = _tmp29_;
	_tmp31_ = theme_get_spacing_blue (_tmp30_);
	_tmp32_ = _tmp31_;
	memset (&_tmp33_, 0, sizeof (GdkRGBA));
	_tmp33_.red = (gfloat) _tmp24_;
	_tmp33_.green = (gfloat) _tmp28_;
	_tmp33_.blue = (gfloat) _tmp32_;
	_tmp33_.alpha = 1.0f;
	gtk_snapshot_append_fill (snapshot, path, GSK_FILL_RULE_WINDING, &_tmp33_);
	_tmp34_ = reversi_view_get_theme (self);
	_tmp35_ = _tmp34_;
	_tmp36_ = theme_get_border_width (_tmp35_);
	_tmp37_ = _tmp36_;
	_tmp38_ = gsk_stroke_new ((gfloat) _tmp37_);
	_tmp39_ = _tmp38_;
	_tmp40_ = reversi_view_get_theme (self);
	_tmp41_ = _tmp40_;
	_tmp42_ = theme_get_border_red (_tmp41_);
	_tmp43_ = _tmp42_;
	_tmp44_ = reversi_view_get_theme (self);
	_tmp45_ = _tmp44_;
	_tmp46_ = theme_get_border_green (_tmp45_);
	_tmp47_ = _tmp46_;
	_tmp48_ = reversi_view_get_theme (self);
	_tmp49_ = _tmp48_;
	_tmp50_ = theme_get_border_blue (_tmp49_);
	_tmp51_ = _tmp50_;
	memset (&_tmp52_, 0, sizeof (GdkRGBA));
	_tmp52_.red = (gfloat) _tmp43_;
	_tmp52_.green = (gfloat) _tmp47_;
	_tmp52_.blue = (gfloat) _tmp51_;
	_tmp52_.alpha = 1.0f;
	gtk_snapshot_append_stroke (snapshot, path, _tmp39_, &_tmp52_);
	__vala_GskStroke_free0 (_tmp39_);
	_gsk_path_unref0 (path);
	_gsk_path_builder_unref0 (builder);
}

static inline void
reversi_view_draw_tiles_background (ReversiView* self,
                                    GtkSnapshot* snapshot)
{
	Theme* _tmp0_;
	Theme* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	Theme* _tmp4_;
	Theme* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	graphene_point_t _tmp8_ = {0};
	g_return_if_fail (self != NULL);
	g_return_if_fail (snapshot != NULL);
	gtk_snapshot_save (snapshot);
	_tmp0_ = reversi_view_get_theme (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = theme_get_border_width (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = reversi_view_get_theme (self);
	_tmp5_ = _tmp4_;
	_tmp6_ = theme_get_border_width (_tmp5_);
	_tmp7_ = _tmp6_;
	memset (&_tmp8_, 0, sizeof (graphene_point_t));
	_tmp8_.x = (gfloat) _tmp3_;
	_tmp8_.y = (gfloat) _tmp7_;
	gtk_snapshot_translate (snapshot, &_tmp8_);
	{
		guint8 x = 0U;
		x = (guint8) 0;
		{
			gboolean _tmp9_ = FALSE;
			_tmp9_ = TRUE;
			while (TRUE) {
				if (!_tmp9_) {
					guint8 _tmp10_;
					_tmp10_ = x;
					x = _tmp10_ + 1;
				}
				_tmp9_ = FALSE;
				if (!(x < self->priv->game_size)) {
					break;
				}
				{
					guint8 y = 0U;
					y = (guint8) 0;
					{
						gboolean _tmp11_ = FALSE;
						_tmp11_ = TRUE;
						while (TRUE) {
							if (!_tmp11_) {
								guint8 _tmp12_;
								_tmp12_ = y;
								y = _tmp12_ + 1;
							}
							_tmp11_ = FALSE;
							if (!(y < self->priv->game_size)) {
								break;
							}
							reversi_view_draw_tile_background (self, snapshot, self->priv->paving_size * x, self->priv->paving_size * y);
						}
					}
				}
			}
		}
	}
	gtk_snapshot_restore (snapshot);
}

static inline void
reversi_view_draw_tile_background (ReversiView* self,
                                   GtkSnapshot* snapshot,
                                   gint tile_x,
                                   gint tile_y)
{
	graphene_rect_t rect = {0};
	graphene_point_t _tmp0_ = {0};
	graphene_size_t _tmp1_ = {0};
	graphene_rect_t _tmp2_ = {0};
	GskPath* path = NULL;
	Theme* _tmp3_;
	Theme* _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	GskPath* _tmp7_;
	Theme* _tmp8_;
	Theme* _tmp9_;
	gboolean _tmp10_;
	gboolean _tmp11_;
	GskPath* _tmp14_;
	Theme* _tmp15_;
	Theme* _tmp16_;
	gdouble _tmp17_;
	gdouble _tmp18_;
	Theme* _tmp19_;
	Theme* _tmp20_;
	gdouble _tmp21_;
	gdouble _tmp22_;
	Theme* _tmp23_;
	Theme* _tmp24_;
	gdouble _tmp25_;
	gdouble _tmp26_;
	GdkRGBA _tmp27_ = {0};
	Theme* _tmp28_;
	Theme* _tmp29_;
	gboolean _tmp30_;
	gboolean _tmp31_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (snapshot != NULL);
	_tmp0_.x = (gfloat) tile_x;
	_tmp0_.y = (gfloat) tile_y;
	_tmp1_.width = (gfloat) self->priv->tile_size;
	_tmp1_.height = (gfloat) self->priv->tile_size;
	memset (&_tmp2_, 0, sizeof (graphene_rect_t));
	_tmp2_.origin = _tmp0_;
	_tmp2_.size = _tmp1_;
	rect = _tmp2_;
	_tmp3_ = reversi_view_get_theme (self);
	_tmp4_ = _tmp3_;
	_tmp5_ = theme_get_background_radius (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = reversi_view_rounded_square (self, (gfloat) tile_x, (gfloat) tile_y, (gfloat) self->priv->tile_size, _tmp6_);
	path = _tmp7_;
	_tmp8_ = reversi_view_get_theme (self);
	_tmp9_ = _tmp8_;
	_tmp10_ = theme_get_apply_texture (_tmp9_);
	_tmp11_ = _tmp10_;
	if (_tmp11_) {
		GdkTexture* _tmp12_;
		graphene_rect_t _tmp13_;
		gtk_snapshot_push_mask (snapshot, GSK_MASK_MODE_ALPHA);
		_tmp12_ = self->priv->noise_texture;
		_tmp13_ = rect;
		gtk_snapshot_append_texture (snapshot, _tmp12_, &_tmp13_);
		gtk_snapshot_pop (snapshot);
	}
	_tmp14_ = path;
	_tmp15_ = reversi_view_get_theme (self);
	_tmp16_ = _tmp15_;
	_tmp17_ = theme_get_background_red (_tmp16_);
	_tmp18_ = _tmp17_;
	_tmp19_ = reversi_view_get_theme (self);
	_tmp20_ = _tmp19_;
	_tmp21_ = theme_get_background_green (_tmp20_);
	_tmp22_ = _tmp21_;
	_tmp23_ = reversi_view_get_theme (self);
	_tmp24_ = _tmp23_;
	_tmp25_ = theme_get_background_blue (_tmp24_);
	_tmp26_ = _tmp25_;
	memset (&_tmp27_, 0, sizeof (GdkRGBA));
	_tmp27_.red = (gfloat) _tmp18_;
	_tmp27_.green = (gfloat) _tmp22_;
	_tmp27_.blue = (gfloat) _tmp26_;
	_tmp27_.alpha = 1.0f;
	gtk_snapshot_append_fill (snapshot, _tmp14_, GSK_FILL_RULE_WINDING, &_tmp27_);
	_tmp28_ = reversi_view_get_theme (self);
	_tmp29_ = _tmp28_;
	_tmp30_ = theme_get_apply_texture (_tmp29_);
	_tmp31_ = _tmp30_;
	if (_tmp31_) {
		gtk_snapshot_pop (snapshot);
	}
	_gsk_path_unref0 (path);
}

static inline void
reversi_view_draw_overture (ReversiView* self,
                            GtkSnapshot* snapshot)
{
	guint8 half_game_size = 0U;
	Game* _tmp14_;
	Game* _tmp15_;
	Opening _tmp16_;
	Opening _tmp17_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (snapshot != NULL);
	half_game_size = (guint8) (self->priv->game_size / 2);
	{
		guint8 x = 0U;
		x = (guint8) 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				if (!_tmp0_) {
					guint8 _tmp1_;
					_tmp1_ = x;
					x = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(x < self->priv->game_size)) {
					break;
				}
				{
					guint8 y = 0U;
					y = (guint8) 0;
					{
						gboolean _tmp2_ = FALSE;
						_tmp2_ = TRUE;
						while (TRUE) {
							gboolean _tmp4_ = FALSE;
							gboolean _tmp5_ = FALSE;
							gboolean _tmp7_ = FALSE;
							if (!_tmp2_) {
								guint8 _tmp3_;
								_tmp3_ = y;
								y = _tmp3_ + 1;
							}
							_tmp2_ = FALSE;
							if (!(y < self->priv->game_size)) {
								break;
							}
							if (x == half_game_size) {
								_tmp5_ = TRUE;
							} else {
								_tmp5_ = ((gint) x) == (half_game_size - 1);
							}
							if (_tmp5_) {
								gboolean _tmp6_ = FALSE;
								if (y == half_game_size) {
									_tmp6_ = TRUE;
								} else {
									_tmp6_ = ((gint) y) == (half_game_size - 1);
								}
								_tmp4_ = _tmp6_;
							} else {
								_tmp4_ = FALSE;
							}
							if (_tmp4_) {
								continue;
							}
							if ((self->priv->game_size % 2) != 0) {
								gboolean _tmp8_ = FALSE;
								gboolean _tmp9_ = FALSE;
								if (((gint) y) == (half_game_size + 1)) {
									gboolean _tmp10_ = FALSE;
									gboolean _tmp11_ = FALSE;
									if (((gint) x) == (half_game_size - 1)) {
										_tmp11_ = TRUE;
									} else {
										_tmp11_ = x == half_game_size;
									}
									if (_tmp11_) {
										_tmp10_ = TRUE;
									} else {
										_tmp10_ = ((gint) x) == (half_game_size + 1);
									}
									_tmp9_ = _tmp10_;
								} else {
									_tmp9_ = FALSE;
								}
								if (_tmp9_) {
									_tmp8_ = TRUE;
								} else {
									gboolean _tmp12_ = FALSE;
									if (((gint) x) == (half_game_size + 1)) {
										gboolean _tmp13_ = FALSE;
										if (((gint) y) == (half_game_size - 1)) {
											_tmp13_ = TRUE;
										} else {
											_tmp13_ = y == half_game_size;
										}
										_tmp12_ = _tmp13_;
									} else {
										_tmp12_ = FALSE;
									}
									_tmp8_ = _tmp12_;
								}
								_tmp7_ = _tmp8_;
							} else {
								_tmp7_ = FALSE;
							}
							if (_tmp7_) {
								continue;
							}
							reversi_view_darken_tile (self, snapshot, x, y);
						}
					}
				}
			}
		}
	}
	_tmp14_ = reversi_view_get_game (self);
	_tmp15_ = _tmp14_;
	_tmp16_ = game_get_opening (_tmp15_);
	_tmp17_ = _tmp16_;
	if (_tmp17_ != OPENING_HUMANS) {
		guint8 _tmp18_;
		_tmp18_ = self->priv->humans_opening_intensity;
		self->priv->humans_opening_intensity = _tmp18_ - 1;
		gtk_widget_queue_draw ((GtkWidget*) self);
	}
}

static inline void
reversi_view_draw_highlight (ReversiView* self,
                             GtkSnapshot* snapshot)
{
	Game* _tmp0_;
	Game* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	gboolean display_mouse_highlight = FALSE;
	gboolean _tmp18_ = FALSE;
	gboolean display_keybd_highlight = FALSE;
	gboolean _tmp19_ = FALSE;
	gboolean _tmp20_ = FALSE;
	gboolean _tmp21_ = FALSE;
	gboolean _tmp22_ = FALSE;
	gboolean display_ghost_highlight = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (snapshot != NULL);
	_tmp0_ = reversi_view_get_game (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = game_get_is_complete (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		return;
	}
	if (!self->priv->show_highlight) {
		gboolean _tmp6_ = FALSE;
		if (self->priv->show_mouse_highlight) {
			_tmp6_ = TRUE;
		} else {
			_tmp6_ = ((gint) self->priv->highlight_state) != 0;
		}
		_tmp5_ = _tmp6_;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		gboolean _tmp7_ = FALSE;
		Iagno* _tmp8_;
		Player _tmp9_;
		Player _tmp10_;
		Game* _tmp11_;
		Game* _tmp12_;
		Player _tmp13_;
		Player _tmp14_;
		_tmp8_ = self->priv->_iagno_instance;
		_tmp9_ = iagno_get_player_one (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = reversi_view_get_game (self);
		_tmp12_ = _tmp11_;
		_tmp13_ = game_get_current_color (_tmp12_);
		_tmp14_ = _tmp13_;
		if (_tmp10_ == _tmp14_) {
			_tmp7_ = TRUE;
		} else {
			Iagno* _tmp15_;
			ComputerPlayer* _tmp16_;
			ComputerPlayer* _tmp17_;
			_tmp15_ = self->priv->_iagno_instance;
			_tmp16_ = iagno_get_computer (_tmp15_);
			_tmp17_ = _tmp16_;
			_tmp7_ = _tmp17_ == NULL;
		}
		_tmp4_ = _tmp7_;
	} else {
		_tmp4_ = FALSE;
	}
	display_mouse_highlight = _tmp4_;
	if (self->priv->show_highlight) {
		_tmp18_ = !self->priv->show_mouse_highlight;
	} else {
		_tmp18_ = FALSE;
	}
	display_keybd_highlight = _tmp18_;
	if (!self->priv->show_highlight) {
		_tmp22_ = !self->priv->show_mouse_highlight;
	} else {
		_tmp22_ = FALSE;
	}
	if (_tmp22_) {
		_tmp21_ = ((gint) self->priv->highlight_state) != 0;
	} else {
		_tmp21_ = FALSE;
	}
	if (_tmp21_) {
		_tmp20_ = self->priv->old_highlight_x != G_MAXUINT8;
	} else {
		_tmp20_ = FALSE;
	}
	if (_tmp20_) {
		_tmp19_ = self->priv->old_highlight_y != G_MAXUINT8;
	} else {
		_tmp19_ = FALSE;
	}
	display_ghost_highlight = _tmp19_;
	if (display_ghost_highlight) {
		reversi_view_draw_tile_highlight (self, snapshot, self->priv->old_highlight_x, self->priv->old_highlight_y);
	} else {
		if (display_mouse_highlight) {
			reversi_view_draw_tile_highlight (self, snapshot, self->priv->mouse_highlight_x, self->priv->mouse_highlight_y);
		} else {
			if (display_keybd_highlight) {
				reversi_view_draw_tile_highlight (self, snapshot, self->priv->highlight_x, self->priv->highlight_y);
			}
		}
	}
}

static inline void
reversi_view_draw_tile_highlight (ReversiView* self,
                                  GtkSnapshot* snapshot,
                                  guint8 x,
                                  guint8 y)
{
	PossibleMove move = {0};
	gboolean test_placing_tile = FALSE;
	Game* _tmp0_;
	Game* _tmp1_;
	PossibleMove _tmp2_ = {0};
	gboolean _tmp3_;
	gboolean _tmp4_ = FALSE;
	gboolean highlight_on = FALSE;
	gboolean _tmp7_ = FALSE;
	gboolean _tmp12_ = FALSE;
	gboolean _tmp13_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (snapshot != NULL);
	_tmp0_ = reversi_view_get_game (self);
	_tmp1_ = _tmp0_;
	_tmp3_ = game_test_placing_tile (_tmp1_, x, y, &_tmp2_);
	move = _tmp2_;
	test_placing_tile = _tmp3_;
	if (self->priv->show_highlight) {
		_tmp4_ = TRUE;
	} else {
		gboolean _tmp5_ = FALSE;
		gboolean _tmp6_ = FALSE;
		if (self->priv->mouse_is_in) {
			_tmp6_ = self->priv->show_mouse_highlight;
		} else {
			_tmp6_ = FALSE;
		}
		if (_tmp6_) {
			_tmp5_ = test_placing_tile;
		} else {
			_tmp5_ = FALSE;
		}
		_tmp4_ = _tmp5_;
	}
	highlight_on = _tmp4_;
	if (highlight_on) {
		_tmp7_ = self->priv->highlight_state != REVERSI_VIEW_HIGHLIGHT_MAX;
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		guint8 _tmp8_;
		_tmp8_ = self->priv->highlight_state;
		self->priv->highlight_state = _tmp8_ + 1;
		reversi_view_queue_draw_idle (self);
	} else {
		gboolean _tmp9_ = FALSE;
		if (!highlight_on) {
			_tmp9_ = ((gint) self->priv->highlight_state) != 0;
		} else {
			_tmp9_ = FALSE;
		}
		if (_tmp9_) {
			guint8 _tmp10_;
			gboolean _tmp11_ = FALSE;
			_tmp10_ = self->priv->highlight_state;
			self->priv->highlight_state = _tmp10_ - 1;
			reversi_view_queue_draw_idle (self);
			if (self->priv->old_highlight_x != x) {
				_tmp11_ = TRUE;
			} else {
				_tmp11_ = self->priv->old_highlight_y != y;
			}
			if (_tmp11_) {
				return;
			}
		}
	}
	reversi_view_highlight_tile (self, snapshot, x, y, self->priv->highlight_state, FALSE);
	if (test_placing_tile) {
		gboolean _tmp14_;
		_tmp14_ = self->priv->_show_turnable_tiles;
		_tmp13_ = _tmp14_;
	} else {
		_tmp13_ = FALSE;
	}
	if (_tmp13_) {
		gboolean _tmp15_ = FALSE;
		Iagno* _tmp16_;
		ComputerPlayer* _tmp17_;
		ComputerPlayer* _tmp18_;
		_tmp16_ = self->priv->_iagno_instance;
		_tmp17_ = iagno_get_computer (_tmp16_);
		_tmp18_ = _tmp17_;
		if (_tmp18_ != NULL) {
			Iagno* _tmp19_;
			Player _tmp20_;
			Player _tmp21_;
			Game* _tmp22_;
			Game* _tmp23_;
			Player _tmp24_;
			Player _tmp25_;
			_tmp19_ = self->priv->_iagno_instance;
			_tmp20_ = iagno_get_player_one (_tmp19_);
			_tmp21_ = _tmp20_;
			_tmp22_ = reversi_view_get_game (self);
			_tmp23_ = _tmp22_;
			_tmp24_ = game_get_current_color (_tmp23_);
			_tmp25_ = _tmp24_;
			_tmp15_ = _tmp21_ != _tmp25_;
		} else {
			_tmp15_ = FALSE;
		}
		_tmp12_ = !_tmp15_;
	} else {
		_tmp12_ = FALSE;
	}
	if (_tmp12_) {
		PossibleMove _tmp26_;
		PossibleMove _tmp27_;
		PossibleMove _tmp28_;
		PossibleMove _tmp29_;
		PossibleMove _tmp30_;
		PossibleMove _tmp31_;
		PossibleMove _tmp32_;
		PossibleMove _tmp33_;
		PossibleMove _tmp34_;
		PossibleMove _tmp35_;
		PossibleMove _tmp36_;
		PossibleMove _tmp37_;
		PossibleMove _tmp38_;
		PossibleMove _tmp39_;
		PossibleMove _tmp40_;
		PossibleMove _tmp41_;
		PossibleMove _tmp42_;
		PossibleMove _tmp43_;
		PossibleMove _tmp44_;
		PossibleMove _tmp45_;
		PossibleMove _tmp46_;
		PossibleMove _tmp47_;
		PossibleMove _tmp48_;
		PossibleMove _tmp49_;
		_tmp26_ = move;
		_tmp27_ = move;
		_tmp28_ = move;
		reversi_view_highlight_turnable_tiles (self, snapshot, _tmp26_.x, _tmp27_.y, (gint8) 0, (gint8) -1, _tmp28_.n_tiles_n);
		_tmp29_ = move;
		_tmp30_ = move;
		_tmp31_ = move;
		reversi_view_highlight_turnable_tiles (self, snapshot, _tmp29_.x, _tmp30_.y, (gint8) 1, (gint8) -1, _tmp31_.n_tiles_ne);
		_tmp32_ = move;
		_tmp33_ = move;
		_tmp34_ = move;
		reversi_view_highlight_turnable_tiles (self, snapshot, _tmp32_.x, _tmp33_.y, (gint8) 1, (gint8) 0, _tmp34_.n_tiles_e);
		_tmp35_ = move;
		_tmp36_ = move;
		_tmp37_ = move;
		reversi_view_highlight_turnable_tiles (self, snapshot, _tmp35_.x, _tmp36_.y, (gint8) 1, (gint8) 1, _tmp37_.n_tiles_se);
		_tmp38_ = move;
		_tmp39_ = move;
		_tmp40_ = move;
		reversi_view_highlight_turnable_tiles (self, snapshot, _tmp38_.x, _tmp39_.y, (gint8) 0, (gint8) 1, _tmp40_.n_tiles_s);
		_tmp41_ = move;
		_tmp42_ = move;
		_tmp43_ = move;
		reversi_view_highlight_turnable_tiles (self, snapshot, _tmp41_.x, _tmp42_.y, (gint8) -1, (gint8) 1, _tmp43_.n_tiles_so);
		_tmp44_ = move;
		_tmp45_ = move;
		_tmp46_ = move;
		reversi_view_highlight_turnable_tiles (self, snapshot, _tmp44_.x, _tmp45_.y, (gint8) -1, (gint8) 0, _tmp46_.n_tiles_o);
		_tmp47_ = move;
		_tmp48_ = move;
		_tmp49_ = move;
		reversi_view_highlight_turnable_tiles (self, snapshot, _tmp47_.x, _tmp48_.y, (gint8) -1, (gint8) -1, _tmp49_.n_tiles_no);
	}
}

static inline void
reversi_view_highlight_turnable_tiles (ReversiView* self,
                                       GtkSnapshot* snapshot,
                                       guint8 x,
                                       guint8 y,
                                       gint8 x_step,
                                       gint8 y_step,
                                       guint8 count)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (snapshot != NULL);
	{
		gboolean _tmp0_ = FALSE;
		_tmp0_ = TRUE;
		while (TRUE) {
			gint8 _x = 0;
			gint8 _y = 0;
			if (!_tmp0_) {
				guint8 _tmp1_;
				_tmp1_ = count;
				count = _tmp1_ - 1;
			}
			_tmp0_ = FALSE;
			if (!(((gint) count) > 0)) {
				break;
			}
			_x = ((gint8) x) + (((gint8) count) * x_step);
			_y = ((gint8) y) + (((gint8) count) * y_step);
			reversi_view_queue_draw_idle (self);
			reversi_view_highlight_tile (self, snapshot, (guint8) _x, (guint8) _y, self->priv->highlight_state, TRUE);
		}
	}
}

static inline void
reversi_view_add_highlights (ReversiView* self,
                             GtkSnapshot* snapshot)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_ = FALSE;
	Iagno* _tmp4_;
	ComputerPlayer* _tmp5_;
	ComputerPlayer* _tmp6_;
	gboolean _tmp14_ = FALSE;
	gboolean _tmp15_;
	gboolean _tmp16_;
	gboolean decreasing = FALSE;
	guint8 intensity = 0U;
	gboolean _tmp32_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (snapshot != NULL);
	_tmp1_ = reversi_view_get_show_playable_tiles (self);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		_tmp0_ = ((gint) self->priv->playable_tiles_highlight_state) == 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		return;
	}
	_tmp4_ = self->priv->_iagno_instance;
	_tmp5_ = iagno_get_computer (_tmp4_);
	_tmp6_ = _tmp5_;
	if (_tmp6_ != NULL) {
		Iagno* _tmp7_;
		Player _tmp8_;
		Player _tmp9_;
		Game* _tmp10_;
		Game* _tmp11_;
		Player _tmp12_;
		Player _tmp13_;
		_tmp7_ = self->priv->_iagno_instance;
		_tmp8_ = iagno_get_player_one (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = reversi_view_get_game (self);
		_tmp11_ = _tmp10_;
		_tmp12_ = game_get_current_color (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp3_ = _tmp9_ != _tmp13_;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		reversi_view_init_possible_moves (self);
		return;
	}
	_tmp15_ = reversi_view_get_show_playable_tiles (self);
	_tmp16_ = _tmp15_;
	if (_tmp16_) {
		gboolean _tmp17_;
		_tmp17_ = self->priv->_show_turnable_tiles;
		_tmp14_ = _tmp17_;
	} else {
		_tmp14_ = FALSE;
	}
	if (_tmp14_) {
		PossibleMove move = {0};
		gboolean _tmp18_ = FALSE;
		gboolean _tmp23_ = FALSE;
		if (self->priv->show_mouse_highlight) {
			Game* _tmp19_;
			Game* _tmp20_;
			PossibleMove _tmp21_ = {0};
			gboolean _tmp22_;
			_tmp19_ = reversi_view_get_game (self);
			_tmp20_ = _tmp19_;
			_tmp22_ = game_test_placing_tile (_tmp20_, self->priv->mouse_highlight_x, self->priv->mouse_highlight_y, &_tmp21_);
			move = _tmp21_;
			_tmp18_ = _tmp22_;
		} else {
			_tmp18_ = FALSE;
		}
		if (_tmp18_) {
			return;
		}
		if (self->priv->show_highlight) {
			Game* _tmp24_;
			Game* _tmp25_;
			PossibleMove _tmp26_ = {0};
			gboolean _tmp27_;
			_tmp24_ = reversi_view_get_game (self);
			_tmp25_ = _tmp24_;
			_tmp27_ = game_test_placing_tile (_tmp25_, self->priv->highlight_x, self->priv->highlight_y, &_tmp26_);
			move = _tmp26_;
			_tmp23_ = _tmp27_;
		} else {
			_tmp23_ = FALSE;
		}
		if (_tmp23_) {
			return;
		}
	}
	decreasing = self->priv->playable_tiles_highlight_state > REVERSI_VIEW_HIGHLIGHT_MAX;
	if (decreasing) {
		intensity = (guint8) (((2 * REVERSI_VIEW_HIGHLIGHT_MAX) + 1) - self->priv->playable_tiles_highlight_state);
	} else {
		intensity = self->priv->playable_tiles_highlight_state;
	}
	{
		guint8 x = 0U;
		x = (guint8) 0;
		{
			gboolean _tmp28_ = FALSE;
			_tmp28_ = TRUE;
			while (TRUE) {
				if (!_tmp28_) {
					guint8 _tmp29_;
					_tmp29_ = x;
					x = _tmp29_ + 1;
				}
				_tmp28_ = FALSE;
				if (!(x < self->priv->game_size)) {
					break;
				}
				{
					guint8 y = 0U;
					y = (guint8) 0;
					{
						gboolean _tmp30_ = FALSE;
						_tmp30_ = TRUE;
						while (TRUE) {
							if (!_tmp30_) {
								guint8 _tmp31_;
								_tmp31_ = y;
								y = _tmp31_ + 1;
							}
							_tmp30_ = FALSE;
							if (!(y < self->priv->game_size)) {
								break;
							}
							reversi_view_add_highlight (self, snapshot, x, y, intensity);
						}
					}
				}
			}
		}
	}
	if (decreasing) {
		_tmp32_ = ((gint) intensity) == 1;
	} else {
		_tmp32_ = FALSE;
	}
	if (_tmp32_) {
		reversi_view_init_possible_moves (self);
	} else {
		gboolean _tmp33_;
		gboolean _tmp34_;
		_tmp33_ = reversi_view_get_show_playable_tiles (self);
		_tmp34_ = _tmp33_;
		if (!_tmp34_) {
			guint8 _tmp35_;
			_tmp35_ = self->priv->playable_tiles_highlight_state;
			self->priv->playable_tiles_highlight_state = _tmp35_ + 1;
		} else {
			if (self->priv->playable_tiles_highlight_state < REVERSI_VIEW_HIGHLIGHT_MAX) {
				guint8 _tmp36_;
				_tmp36_ = self->priv->playable_tiles_highlight_state;
				self->priv->playable_tiles_highlight_state = _tmp36_ + 1;
			}
		}
	}
}

static inline void
reversi_view_add_highlight (ReversiView* self,
                            GtkSnapshot* snapshot,
                            guint8 x,
                            guint8 y,
                            guint8 intensity)
{
	gboolean* _tmp0_;
	gint _tmp0__length1;
	gint _tmp0__length2;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (snapshot != NULL);
	_tmp0_ = self->priv->possible_moves;
	_tmp0__length1 = self->priv->possible_moves_length1;
	_tmp0__length2 = self->priv->possible_moves_length2;
	_tmp1_ = _tmp0_[(x * _tmp0__length2) + y];
	if (_tmp1_ == FALSE) {
		return;
	}
	reversi_view_queue_draw_idle (self);
	reversi_view_highlight_tile (self, snapshot, x, y, intensity, TRUE);
}

static inline void
reversi_view_draw_playables (ReversiView* self,
                             GtkSnapshot* snapshot)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (snapshot != NULL);
	{
		guint8 x = 0U;
		x = (guint8) 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				if (!_tmp0_) {
					guint8 _tmp1_;
					_tmp1_ = x;
					x = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(x < self->priv->game_size)) {
					break;
				}
				{
					guint8 y = 0U;
					y = (guint8) 0;
					{
						gboolean _tmp2_ = FALSE;
						_tmp2_ = TRUE;
						while (TRUE) {
							gint* _tmp4_;
							gint _tmp4__length1;
							gint _tmp4__length2;
							gint _tmp5_;
							if (!_tmp2_) {
								guint8 _tmp3_;
								_tmp3_ = y;
								y = _tmp3_ + 1;
							}
							_tmp2_ = FALSE;
							if (!(y < self->priv->game_size)) {
								break;
							}
							_tmp4_ = self->priv->pixmaps;
							_tmp4__length1 = self->priv->pixmaps_length1;
							_tmp4__length2 = self->priv->pixmaps_length2;
							_tmp5_ = _tmp4_[(x * _tmp4__length2) + y];
							reversi_view_draw_playable (self, snapshot, _tmp5_, self->priv->paving_size * x, self->priv->paving_size * y);
						}
					}
				}
			}
		}
	}
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static inline void
reversi_view_draw_playable (ReversiView* self,
                            GtkSnapshot* snapshot,
                            gint pixmap,
                            gint tile_x,
                            gint tile_y)
{
	gboolean _tmp0_ = FALSE;
	GdkTexture* texture = NULL;
	GdkTexture* _tmp2_;
	GdkTexture* _tmp3_;
	graphene_point_t _tmp4_ = {0};
	graphene_rect_t tile_rect = {0};
	graphene_point_t _tmp5_ = {0};
	graphene_size_t _tmp6_ = {0};
	graphene_rect_t _tmp7_ = {0};
	graphene_rect_t _tmp8_;
	graphene_point_t _tmp9_ = {0};
	GdkTexture* _tmp10_;
	GdkTexture* _tmp11_;
	GdkTexture* _tmp12_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (snapshot != NULL);
	if (pixmap == 0) {
		_tmp0_ = TRUE;
	} else {
		GdkTexture* _tmp1_;
		_tmp1_ = self->priv->tiles_pattern;
		_tmp0_ = _tmp1_ == NULL;
	}
	if (_tmp0_) {
		return;
	}
	_tmp2_ = self->priv->tiles_pattern;
	_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gdk_texture_get_type (), GdkTexture));
	texture = _tmp3_;
	gtk_snapshot_save (snapshot);
	memset (&_tmp4_, 0, sizeof (graphene_point_t));
	_tmp4_.x = (gfloat) tile_x;
	_tmp4_.y = (gfloat) tile_y;
	gtk_snapshot_translate (snapshot, &_tmp4_);
	_tmp5_.x = (gfloat) 0;
	_tmp5_.y = (gfloat) 0;
	_tmp6_.width = (gfloat) self->priv->tile_size;
	_tmp6_.height = (gfloat) self->priv->tile_size;
	memset (&_tmp7_, 0, sizeof (graphene_rect_t));
	_tmp7_.origin = _tmp5_;
	_tmp7_.size = _tmp6_;
	tile_rect = _tmp7_;
	_tmp8_ = tile_rect;
	gtk_snapshot_push_clip (snapshot, &_tmp8_);
	gtk_snapshot_save (snapshot);
	memset (&_tmp9_, 0, sizeof (graphene_point_t));
	_tmp9_.x = (gfloat) ((-(pixmap % 8)) * self->priv->tile_size);
	_tmp9_.y = (gfloat) ((-(pixmap / 8)) * self->priv->tile_size);
	gtk_snapshot_translate (snapshot, &_tmp9_);
	_tmp10_ = texture;
	_tmp11_ = texture;
	_tmp12_ = texture;
	gdk_paintable_snapshot ((GdkPaintable*) _tmp10_, (GdkSnapshot*) snapshot, (gdouble) gdk_texture_get_width (_tmp11_), (gdouble) gdk_texture_get_height (_tmp12_));
	gtk_snapshot_restore (snapshot);
	gtk_snapshot_pop (snapshot);
	gtk_snapshot_restore (snapshot);
	_g_object_unref0 (texture);
}

static inline void
reversi_view_draw_overture_playables (ReversiView* self,
                                      GtkSnapshot* snapshot)
{
	gboolean even_board = FALSE;
	gint _tmp0_ = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (snapshot != NULL);
	even_board = (self->priv->game_size % 2) == 0;
	if (even_board) {
		_tmp0_ = 4;
	} else {
		_tmp0_ = 6;
	}
	if (((gint) self->priv->current_overture_playable) < _tmp0_) {
		reversi_view_draw_overture_indicator (self, snapshot);
	}
	{
		guint8 i = 0U;
		i = (guint8) 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				gint _tmp3_ = 0;
				if (!_tmp1_) {
					guint8 _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (even_board) {
					_tmp3_ = 4;
				} else {
					_tmp3_ = 6;
				}
				if (!(((gint) i) < _tmp3_)) {
					break;
				}
				reversi_view_draw_overture_playable (self, snapshot, i);
			}
		}
	}
	if (!even_board) {
		guint8 half_game_size = 0U;
		gint* _tmp4_;
		gint _tmp4__length1;
		gint _tmp4__length2;
		gint _tmp5_;
		half_game_size = (guint8) (self->priv->game_size / 2);
		_tmp4_ = self->priv->pixmaps;
		_tmp4__length1 = self->priv->pixmaps_length1;
		_tmp4__length2 = self->priv->pixmaps_length2;
		_tmp5_ = _tmp4_[(half_game_size * _tmp4__length2) + half_game_size];
		reversi_view_draw_playable (self, snapshot, _tmp5_, self->priv->paving_size * half_game_size, self->priv->paving_size * half_game_size);
	}
}

static inline void
reversi_view_draw_overture_indicator (ReversiView* self,
                                      GtkSnapshot* snapshot)
{
	gfloat _tmp0_ = 0.0F;
	gfloat diameter_factor = 0.0F;
	GskPathBuilder* builder = NULL;
	GskPathBuilder* _tmp1_;
	gint* _tmp2_;
	gint _tmp2__length1;
	gint _tmp3_;
	graphene_point_t _tmp4_ = {0};
	GskPath* circle = NULL;
	GskPath* _tmp5_;
	Theme* _tmp6_;
	Theme* _tmp7_;
	gdouble _tmp8_;
	gdouble _tmp9_;
	Theme* _tmp10_;
	Theme* _tmp11_;
	gdouble _tmp12_;
	gdouble _tmp13_;
	Theme* _tmp14_;
	Theme* _tmp15_;
	gdouble _tmp16_;
	gdouble _tmp17_;
	GdkRGBA _tmp18_ = {0};
	g_return_if_fail (self != NULL);
	g_return_if_fail (snapshot != NULL);
	if (((gint) self->priv->game_size) == 4) {
		_tmp0_ = 1.95f;
	} else {
		_tmp0_ = 1.8f;
	}
	diameter_factor = _tmp0_;
	_tmp1_ = gsk_path_builder_new ();
	builder = _tmp1_;
	_tmp2_ = self->priv->overture_origin_xs;
	_tmp2__length1 = self->priv->overture_origin_xs_length1;
	_tmp3_ = _tmp2_[self->priv->current_overture_playable];
	memset (&_tmp4_, 0, sizeof (graphene_point_t));
	_tmp4_.x = ((gfloat) _tmp3_) + (((gfloat) self->priv->tile_size) / 2.0f);
	_tmp4_.y = ((gfloat) self->priv->overture_origin_y) + (((gfloat) self->priv->tile_size) / 2.0f);
	gsk_path_builder_add_circle (builder, &_tmp4_, ((gfloat) self->priv->tile_size) / diameter_factor);
	_tmp5_ = gsk_path_builder_to_path (builder);
	circle = _tmp5_;
	_tmp6_ = reversi_view_get_theme (self);
	_tmp7_ = _tmp6_;
	_tmp8_ = theme_get_background_red (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = reversi_view_get_theme (self);
	_tmp11_ = _tmp10_;
	_tmp12_ = theme_get_background_green (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = reversi_view_get_theme (self);
	_tmp15_ = _tmp14_;
	_tmp16_ = theme_get_background_blue (_tmp15_);
	_tmp17_ = _tmp16_;
	memset (&_tmp18_, 0, sizeof (GdkRGBA));
	_tmp18_.red = (gfloat) _tmp9_;
	_tmp18_.green = (gfloat) _tmp13_;
	_tmp18_.blue = (gfloat) _tmp17_;
	_tmp18_.alpha = 1.0f;
	gtk_snapshot_append_fill (snapshot, circle, GSK_FILL_RULE_WINDING, &_tmp18_);
	_gsk_path_unref0 (circle);
	_gsk_path_builder_unref0 (builder);
}

static inline void
reversi_view_draw_overture_playable (ReversiView* self,
                                     GtkSnapshot* snapshot,
                                     guint8 playable_id)
{
	guint8* _tmp0_;
	gint _tmp0__length1;
	guint8 _tmp1_;
	gint tile_x = 0;
	gint* _tmp6_;
	gint _tmp6__length1;
	gint _tmp7_;
	gint tile_y = 0;
	guint8* _tmp8_;
	gint _tmp8__length1;
	guint8 _tmp9_;
	gint _tmp18_ = 0;
	gint pixmap = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (snapshot != NULL);
	_tmp0_ = self->priv->overture_steps;
	_tmp0__length1 = self->priv->overture_steps_length1;
	_tmp1_ = _tmp0_[playable_id];
	if (_tmp1_ == REVERSI_VIEW_OVERTURE_STEPS_MAX) {
		guint8 x = 0U;
		guint8 y = 0U;
		guint8 _tmp2_ = 0U;
		guint8 _tmp3_ = 0U;
		gint* _tmp4_;
		gint _tmp4__length1;
		gint _tmp4__length2;
		gint _tmp5_;
		reversi_view_get_x_and_y (self, playable_id, &_tmp2_, &_tmp3_);
		x = _tmp2_;
		y = _tmp3_;
		_tmp4_ = self->priv->pixmaps;
		_tmp4__length1 = self->priv->pixmaps_length1;
		_tmp4__length2 = self->priv->pixmaps_length2;
		_tmp5_ = _tmp4_[(x * _tmp4__length2) + y];
		reversi_view_draw_playable (self, snapshot, _tmp5_, self->priv->paving_size * x, self->priv->paving_size * y);
		return;
	}
	_tmp6_ = self->priv->overture_origin_xs;
	_tmp6__length1 = self->priv->overture_origin_xs_length1;
	_tmp7_ = _tmp6_[playable_id];
	tile_x = _tmp7_;
	tile_y = self->priv->overture_origin_y;
	_tmp8_ = self->priv->overture_target;
	_tmp8__length1 = self->priv->overture_target_length1;
	_tmp9_ = _tmp8_[playable_id];
	if (((gint) _tmp9_) != 0) {
		guint8 x = 0U;
		guint8 y = 0U;
		guint8 _tmp10_ = 0U;
		guint8 _tmp11_ = 0U;
		guint8* _tmp12_;
		gint _tmp12__length1;
		guint8 _tmp13_;
		guint8* _tmp14_;
		gint _tmp14__length1;
		guint8 _tmp15_;
		guint8* _tmp16_;
		gint _tmp16__length1;
		guint8 _tmp17_;
		reversi_view_get_x_and_y (self, playable_id, &_tmp10_, &_tmp11_);
		x = _tmp10_;
		y = _tmp11_;
		_tmp12_ = self->priv->overture_steps;
		_tmp12__length1 = self->priv->overture_steps_length1;
		_tmp13_ = _tmp12_[playable_id];
		tile_x += (((self->priv->paving_size * x) - tile_x) * _tmp13_) / REVERSI_VIEW_OVERTURE_STEPS_MAX;
		_tmp14_ = self->priv->overture_steps;
		_tmp14__length1 = self->priv->overture_steps_length1;
		_tmp15_ = _tmp14_[playable_id];
		tile_y += (((self->priv->paving_size * y) - tile_y) * _tmp15_) / REVERSI_VIEW_OVERTURE_STEPS_MAX;
		_tmp16_ = self->priv->overture_steps;
		_tmp16__length1 = self->priv->overture_steps_length1;
		_tmp17_ = _tmp16_[playable_id];
		_tmp16_[playable_id] = _tmp17_ + 1;
		gtk_widget_queue_draw ((GtkWidget*) self);
	}
	if ((self->priv->game_size % 2) == 0) {
		_tmp18_ = ((playable_id % 2) * 30) + 1;
	} else {
		_tmp18_ = ((((playable_id / 2) + 1) % 2) * 30) + 1;
	}
	pixmap = _tmp18_;
	reversi_view_draw_playable (self, snapshot, pixmap, tile_x, tile_y);
}

static void
reversi_view_get_x_and_y (ReversiView* self,
                          guint8 playable_id,
                          guint8* x,
                          guint8* y)
{
	guint8 _vala_x = 0U;
	guint8 _vala_y = 0U;
	guint8 half_game_size = 0U;
	g_return_if_fail (self != NULL);
	half_game_size = (guint8) (self->priv->game_size / 2);
	if ((self->priv->game_size % 2) == 0) {
		guint8* _tmp0_;
		gint _tmp0__length1;
		guint8 _tmp1_;
		_tmp0_ = self->priv->overture_target;
		_tmp0__length1 = self->priv->overture_target_length1;
		_tmp1_ = _tmp0_[playable_id];
		switch (_tmp1_) {
			case 1:
			{
				_vala_x = (guint8) (half_game_size - 1);
				_vala_y = (guint8) (half_game_size - 1);
				break;
			}
			case 2:
			{
				_vala_x = half_game_size;
				_vala_y = (guint8) (half_game_size - 1);
				break;
			}
			case 3:
			{
				_vala_x = (guint8) (half_game_size - 1);
				_vala_y = half_game_size;
				break;
			}
			case 4:
			{
				_vala_x = half_game_size;
				_vala_y = half_game_size;
				break;
			}
			default:
			{
				g_assert_not_reached ();
			}
		}
	} else {
		guint8* _tmp2_;
		gint _tmp2__length1;
		guint8 _tmp3_;
		_tmp2_ = self->priv->overture_target;
		_tmp2__length1 = self->priv->overture_target_length1;
		_tmp3_ = _tmp2_[playable_id];
		switch (_tmp3_) {
			case 1:
			{
				_vala_x = (guint8) (half_game_size - 1);
				_vala_y = (guint8) (half_game_size - 1);
				break;
			}
			case 2:
			{
				_vala_x = half_game_size;
				_vala_y = (guint8) (half_game_size - 1);
				break;
			}
			case 3:
			{
				_vala_x = (guint8) (half_game_size + 1);
				_vala_y = (guint8) (half_game_size - 1);
				break;
			}
			case 4:
			{
				_vala_x = (guint8) (half_game_size - 1);
				_vala_y = half_game_size;
				break;
			}
			case 6:
			{
				_vala_x = (guint8) (half_game_size + 1);
				_vala_y = half_game_size;
				break;
			}
			case 7:
			{
				_vala_x = (guint8) (half_game_size - 1);
				_vala_y = (guint8) (half_game_size + 1);
				break;
			}
			case 8:
			{
				_vala_x = half_game_size;
				_vala_y = (guint8) (half_game_size + 1);
				break;
			}
			case 9:
			{
				_vala_x = (guint8) (half_game_size + 1);
				_vala_y = (guint8) (half_game_size + 1);
				break;
			}
			default:
			{
				g_assert_not_reached ();
			}
		}
	}
	if (x) {
		*x = _vala_x;
	}
	if (y) {
		*y = _vala_y;
	}
}

static inline GskPath*
reversi_view_rounded_square (ReversiView* self,
                             gfloat x,
                             gfloat y,
                             gfloat size,
                             gint radius_percent)
{
	graphene_rect_t rect = {0};
	graphene_point_t _tmp0_ = {0};
	graphene_size_t _tmp1_ = {0};
	graphene_rect_t _tmp2_ = {0};
	graphene_size_t corner = {0};
	graphene_size_t _tmp3_ = {0};
	GskPathBuilder* builder = NULL;
	GskPathBuilder* _tmp4_;
	graphene_rect_t _tmp5_;
	graphene_size_t _tmp6_;
	graphene_size_t _tmp7_;
	graphene_size_t _tmp8_;
	graphene_size_t _tmp9_;
	graphene_size_t _tmp10_[4] = {0};
	GskRoundedRect _tmp11_ = {0};
	GskPath* _tmp12_;
	GskPath* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_.x = x;
	_tmp0_.y = y;
	_tmp1_.width = size;
	_tmp1_.height = size;
	memset (&_tmp2_, 0, sizeof (graphene_rect_t));
	_tmp2_.origin = _tmp0_;
	_tmp2_.size = _tmp1_;
	rect = _tmp2_;
	memset (&_tmp3_, 0, sizeof (graphene_size_t));
	_tmp3_.width = (size * CLAMP (radius_percent, 0, 50)) / 100.0f;
	_tmp3_.height = (size * CLAMP (radius_percent, 0, 50)) / 100.0f;
	corner = _tmp3_;
	_tmp4_ = gsk_path_builder_new ();
	builder = _tmp4_;
	_tmp5_ = rect;
	_tmp6_ = corner;
	_tmp7_ = corner;
	_tmp8_ = corner;
	_tmp9_ = corner;
	_tmp10_[0] = _tmp6_;
	_tmp10_[1] = _tmp7_;
	_tmp10_[2] = _tmp8_;
	_tmp10_[3] = _tmp9_;
	memset (&_tmp11_, 0, sizeof (GskRoundedRect));
	_tmp11_.bounds = _tmp5_;
	memcpy (_tmp11_.corner, _tmp10_, 4 * sizeof (graphene_size_t));
	gsk_path_builder_add_rounded_rect (builder, &_tmp11_);
	_tmp12_ = gsk_path_builder_to_path (builder);
	result = _tmp12_;
	_gsk_path_builder_unref0 (builder);
	return result;
}

static void
reversi_view_highlight_tile (ReversiView* self,
                             GtkSnapshot* snapshot,
                             guint8 x,
                             guint8 y,
                             guint8 intensity,
                             gboolean soft_highlight)
{
	GskPath* path = NULL;
	Theme* _tmp0_;
	Theme* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	GskPath* _tmp4_;
	GdkRGBA _tmp5_ = {0};
	GdkRGBA color = {0};
	GskPath* _tmp40_;
	GdkRGBA _tmp41_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (snapshot != NULL);
	_tmp0_ = reversi_view_get_theme (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = theme_get_background_radius (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = reversi_view_rounded_square (self, (gfloat) ((self->priv->paving_size * x) + ((self->priv->tile_size * (REVERSI_VIEW_HIGHLIGHT_MAX - intensity)) / (2 * REVERSI_VIEW_HIGHLIGHT_MAX))), (gfloat) ((self->priv->paving_size * y) + ((self->priv->tile_size * (REVERSI_VIEW_HIGHLIGHT_MAX - intensity)) / (2 * REVERSI_VIEW_HIGHLIGHT_MAX))), (gfloat) ((self->priv->tile_size * intensity) / REVERSI_VIEW_HIGHLIGHT_MAX), _tmp3_);
	path = _tmp4_;
	if (soft_highlight) {
		Theme* _tmp6_;
		Theme* _tmp7_;
		gdouble _tmp8_;
		gdouble _tmp9_;
		Theme* _tmp10_;
		Theme* _tmp11_;
		gdouble _tmp12_;
		gdouble _tmp13_;
		Theme* _tmp14_;
		Theme* _tmp15_;
		gdouble _tmp16_;
		gdouble _tmp17_;
		Theme* _tmp18_;
		Theme* _tmp19_;
		gdouble _tmp20_;
		gdouble _tmp21_;
		GdkRGBA _tmp22_ = {0};
		_tmp6_ = reversi_view_get_theme (self);
		_tmp7_ = _tmp6_;
		_tmp8_ = theme_get_highlight_soft_red (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = reversi_view_get_theme (self);
		_tmp11_ = _tmp10_;
		_tmp12_ = theme_get_highlight_soft_green (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = reversi_view_get_theme (self);
		_tmp15_ = _tmp14_;
		_tmp16_ = theme_get_highlight_soft_blue (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = reversi_view_get_theme (self);
		_tmp19_ = _tmp18_;
		_tmp20_ = theme_get_highlight_soft_alpha (_tmp19_);
		_tmp21_ = _tmp20_;
		memset (&_tmp22_, 0, sizeof (GdkRGBA));
		_tmp22_.red = (gfloat) _tmp9_;
		_tmp22_.green = (gfloat) _tmp13_;
		_tmp22_.blue = (gfloat) _tmp17_;
		_tmp22_.alpha = (gfloat) _tmp21_;
		_tmp5_ = _tmp22_;
	} else {
		Theme* _tmp23_;
		Theme* _tmp24_;
		gdouble _tmp25_;
		gdouble _tmp26_;
		Theme* _tmp27_;
		Theme* _tmp28_;
		gdouble _tmp29_;
		gdouble _tmp30_;
		Theme* _tmp31_;
		Theme* _tmp32_;
		gdouble _tmp33_;
		gdouble _tmp34_;
		Theme* _tmp35_;
		Theme* _tmp36_;
		gdouble _tmp37_;
		gdouble _tmp38_;
		GdkRGBA _tmp39_ = {0};
		_tmp23_ = reversi_view_get_theme (self);
		_tmp24_ = _tmp23_;
		_tmp25_ = theme_get_highlight_hard_red (_tmp24_);
		_tmp26_ = _tmp25_;
		_tmp27_ = reversi_view_get_theme (self);
		_tmp28_ = _tmp27_;
		_tmp29_ = theme_get_highlight_hard_green (_tmp28_);
		_tmp30_ = _tmp29_;
		_tmp31_ = reversi_view_get_theme (self);
		_tmp32_ = _tmp31_;
		_tmp33_ = theme_get_highlight_hard_blue (_tmp32_);
		_tmp34_ = _tmp33_;
		_tmp35_ = reversi_view_get_theme (self);
		_tmp36_ = _tmp35_;
		_tmp37_ = theme_get_highlight_hard_alpha (_tmp36_);
		_tmp38_ = _tmp37_;
		memset (&_tmp39_, 0, sizeof (GdkRGBA));
		_tmp39_.red = (gfloat) _tmp26_;
		_tmp39_.green = (gfloat) _tmp30_;
		_tmp39_.blue = (gfloat) _tmp34_;
		_tmp39_.alpha = (gfloat) _tmp38_;
		_tmp5_ = _tmp39_;
	}
	color = _tmp5_;
	_tmp40_ = path;
	_tmp41_ = color;
	gtk_snapshot_append_fill (snapshot, _tmp40_, GSK_FILL_RULE_WINDING, &_tmp41_);
	_gsk_path_unref0 (path);
}

static void
reversi_view_darken_tile (ReversiView* self,
                          GtkSnapshot* snapshot,
                          guint8 x,
                          guint8 y)
{
	GskPath* path = NULL;
	Theme* _tmp0_;
	Theme* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	GskPath* _tmp4_;
	GdkRGBA color = {0};
	Theme* _tmp5_;
	Theme* _tmp6_;
	gdouble _tmp7_;
	gdouble _tmp8_;
	Theme* _tmp9_;
	Theme* _tmp10_;
	gdouble _tmp11_;
	gdouble _tmp12_;
	Theme* _tmp13_;
	Theme* _tmp14_;
	gdouble _tmp15_;
	gdouble _tmp16_;
	Theme* _tmp17_;
	Theme* _tmp18_;
	gdouble _tmp19_;
	gdouble _tmp20_;
	GdkRGBA _tmp21_ = {0};
	GdkRGBA _tmp22_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (snapshot != NULL);
	_tmp0_ = reversi_view_get_theme (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = theme_get_background_radius (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = reversi_view_rounded_square (self, (gfloat) (self->priv->paving_size * x), (gfloat) (self->priv->paving_size * y), (gfloat) self->priv->tile_size, _tmp3_);
	path = _tmp4_;
	_tmp5_ = reversi_view_get_theme (self);
	_tmp6_ = _tmp5_;
	_tmp7_ = theme_get_highlight_hard_red (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = reversi_view_get_theme (self);
	_tmp10_ = _tmp9_;
	_tmp11_ = theme_get_highlight_hard_green (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = reversi_view_get_theme (self);
	_tmp14_ = _tmp13_;
	_tmp15_ = theme_get_highlight_hard_blue (_tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = reversi_view_get_theme (self);
	_tmp18_ = _tmp17_;
	_tmp19_ = theme_get_highlight_hard_alpha (_tmp18_);
	_tmp20_ = _tmp19_;
	memset (&_tmp21_, 0, sizeof (GdkRGBA));
	_tmp21_.red = (gfloat) _tmp8_;
	_tmp21_.green = (gfloat) _tmp12_;
	_tmp21_.blue = (gfloat) _tmp16_;
	_tmp21_.alpha = ((((gfloat) _tmp20_) * 1.6f) * ((gfloat) self->priv->humans_opening_intensity)) / ((gfloat) REVERSI_VIEW_HUMANS_OPENING_INTENSITY_MAX);
	color = _tmp21_;
	_tmp22_ = color;
	gtk_snapshot_append_fill (snapshot, path, GSK_FILL_RULE_WINDING, &_tmp22_);
	_gsk_path_unref0 (path);
}

static void
__lambda12_ (ReversiView* self)
{
	gtk_widget_queue_draw ((GtkWidget*) self);
}

static void
___lambda12__gsource_once_func (gpointer self)
{
	__lambda12_ ((ReversiView*) self);
	g_object_unref (self);
}

static void
reversi_view_queue_draw_idle (ReversiView* self)
{
	g_return_if_fail (self != NULL);
	g_timeout_add_once ((guint) 10, ___lambda12__gsource_once_func, g_object_ref (self));
}

static inline void
reversi_view_update_highlight_after_undo (ReversiView* self)
{
	guint8 x = 0U;
	guint8 y = 0U;
	guint8 _tmp0_ = 0U;
	guint8 _tmp1_ = 0U;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp16_;
	gboolean _tmp17_;
	g_return_if_fail (self != NULL);
	_vala_return_if_fail (self->priv->last_state_set, "last_state_set");
	reversi_view_get_missing_tile (self, &_tmp0_, &_tmp1_);
	x = _tmp0_;
	y = _tmp1_;
	if (self->priv->show_highlight) {
		_tmp3_ = TRUE;
	} else {
		_tmp3_ = self->priv->show_mouse_highlight;
	}
	if (_tmp3_) {
		_tmp2_ = TRUE;
	} else {
		_tmp2_ = ((gint) self->priv->highlight_state) != 0;
	}
	if (_tmp2_) {
		Game* _tmp8_;
		Game* _tmp9_;
		gboolean _tmp10_;
		gboolean _tmp11_;
		self->priv->highlight_state = (guint8) 0;
		if (self->priv->show_highlight) {
			Game* _tmp4_;
			Game* _tmp5_;
			_tmp4_ = reversi_view_get_game (self);
			_tmp5_ = _tmp4_;
			reversi_view_set_square (self, self->priv->highlight_x, self->priv->highlight_y, reversi_view_get_pixmap (game_get_owner (_tmp5_, self->priv->highlight_x, self->priv->highlight_y)), FALSE, TRUE);
		}
		if (self->priv->show_mouse_highlight) {
			Game* _tmp6_;
			Game* _tmp7_;
			_tmp6_ = reversi_view_get_game (self);
			_tmp7_ = _tmp6_;
			reversi_view_set_square (self, self->priv->mouse_highlight_x, self->priv->mouse_highlight_y, reversi_view_get_pixmap (game_get_owner (_tmp7_, self->priv->mouse_highlight_x, self->priv->mouse_highlight_y)), FALSE, TRUE);
		}
		_tmp8_ = reversi_view_get_game (self);
		_tmp9_ = _tmp8_;
		_tmp10_ = game_get_is_complete (_tmp9_);
		_tmp11_ = _tmp10_;
		if (!_tmp11_) {
			gboolean _tmp12_ = FALSE;
			gboolean _tmp13_ = FALSE;
			if (self->priv->show_highlight) {
				_tmp13_ = x == self->priv->highlight_x;
			} else {
				_tmp13_ = FALSE;
			}
			if (_tmp13_) {
				_tmp12_ = y == self->priv->highlight_y;
			} else {
				_tmp12_ = FALSE;
			}
			if (_tmp12_) {
				self->priv->highlight_state = REVERSI_VIEW_HIGHLIGHT_MAX;
			} else {
				gboolean _tmp14_ = FALSE;
				gboolean _tmp15_ = FALSE;
				if (self->priv->show_mouse_highlight) {
					_tmp15_ = x == self->priv->mouse_highlight_x;
				} else {
					_tmp15_ = FALSE;
				}
				if (_tmp15_) {
					_tmp14_ = y == self->priv->mouse_highlight_y;
				} else {
					_tmp14_ = FALSE;
				}
				if (_tmp14_) {
					self->priv->highlight_state = REVERSI_VIEW_HIGHLIGHT_MAX;
				} else {
					self->priv->highlight_state = (guint8) 1;
				}
			}
		}
	}
	self->priv->highlight_set = TRUE;
	self->priv->highlight_x = x;
	self->priv->highlight_y = y;
	self->priv->mouse_highlight_x = x;
	self->priv->mouse_highlight_y = y;
	if (!self->priv->mouse_is_in) {
		self->priv->show_highlight = TRUE;
	} else {
		if (!self->priv->show_highlight) {
			self->priv->show_mouse_highlight = TRUE;
		}
	}
	_tmp16_ = reversi_view_get_show_playable_tiles (self);
	_tmp17_ = _tmp16_;
	if (_tmp17_) {
		reversi_view_init_possible_moves (self);
		reversi_view_highlight_playable_tiles (self, TRUE);
	}
}

static void
reversi_view_get_missing_tile (ReversiView* self,
                               guint8* x,
                               guint8* y)
{
	guint8 _vala_x = 0U;
	guint8 _vala_y = 0U;
	g_return_if_fail (self != NULL);
	_vala_y = (guint8) 0;
	{
		gboolean _tmp0_ = FALSE;
		_vala_x = (guint8) 0;
		_tmp0_ = TRUE;
		while (TRUE) {
			if (!_tmp0_) {
				guint8 _tmp1_;
				_tmp1_ = _vala_x;
				_vala_x = _tmp1_ + 1;
			}
			_tmp0_ = FALSE;
			if (!(_vala_x < self->priv->game_size)) {
				break;
			}
			{
				gboolean _tmp2_ = FALSE;
				_vala_y = (guint8) 0;
				_tmp2_ = TRUE;
				while (TRUE) {
					Game* _tmp4_;
					Game* _tmp5_;
					GameStateObject* _tmp6_;
					Game* _tmp7_;
					Game* _tmp8_;
					Player _tmp9_;
					Player _tmp10_;
					if (!_tmp2_) {
						guint8 _tmp3_;
						_tmp3_ = _vala_y;
						_vala_y = _tmp3_ + 1;
					}
					_tmp2_ = FALSE;
					if (!(_vala_y < self->priv->game_size)) {
						break;
					}
					_tmp4_ = reversi_view_get_game (self);
					_tmp5_ = _tmp4_;
					if (game_get_owner (_tmp5_, _vala_x, _vala_y) != PLAYER_NONE) {
						continue;
					}
					_tmp6_ = self->priv->last_state;
					_tmp7_ = reversi_view_get_game (self);
					_tmp8_ = _tmp7_;
					_tmp9_ = game_get_current_color (_tmp8_);
					_tmp10_ = _tmp9_;
					if (game_state_object_get_owner (_tmp6_, _vala_x, _vala_y) == _tmp10_) {
						if (x) {
							*x = _vala_x;
						}
						if (y) {
							*y = _vala_y;
						}
						return;
					}
				}
			}
		}
	}
	g_assert_not_reached ();
}

static void
reversi_view_turn_ended_cb (ReversiView* self,
                            gboolean undoing,
                            gboolean no_draw)
{
	Game* _tmp92_;
	Game* _tmp93_;
	GameStateObject* _tmp94_;
	GameStateObject* _tmp95_;
	GameStateObject* _tmp96_;
	g_return_if_fail (self != NULL);
	if (((gint) self->priv->humans_opening_intensity) != 0) {
		gboolean even_board = FALSE;
		guint8 half_game_size = 0U;
		guint8 target = 0U;
		even_board = (self->priv->game_size % 2) == 0;
		half_game_size = (guint8) (self->priv->game_size / 2);
		if (even_board) {
			gboolean _tmp0_ = FALSE;
			gboolean _tmp1_ = FALSE;
			guint8* _tmp28_;
			gint _tmp28__length1;
			guint8 _tmp29_;
			if (!self->priv->last_state_set) {
				_tmp1_ = TRUE;
			} else {
				GameStateObject* _tmp2_;
				_tmp2_ = self->priv->last_state;
				_tmp1_ = game_state_object_get_owner (_tmp2_, (guint8) (half_game_size - 1), (guint8) (half_game_size - 1)) == PLAYER_NONE;
			}
			if (_tmp1_) {
				Game* _tmp3_;
				Game* _tmp4_;
				GameStateObject* _tmp5_;
				GameStateObject* _tmp6_;
				_tmp3_ = reversi_view_get_game (self);
				_tmp4_ = _tmp3_;
				_tmp5_ = game_get_current_state (_tmp4_);
				_tmp6_ = _tmp5_;
				_tmp0_ = game_state_object_get_owner (_tmp6_, (guint8) (half_game_size - 1), (guint8) (half_game_size - 1)) != PLAYER_NONE;
			} else {
				_tmp0_ = FALSE;
			}
			if (_tmp0_) {
				target = (guint8) 1;
			} else {
				gboolean _tmp7_ = FALSE;
				gboolean _tmp8_ = FALSE;
				if (!self->priv->last_state_set) {
					_tmp8_ = TRUE;
				} else {
					GameStateObject* _tmp9_;
					_tmp9_ = self->priv->last_state;
					_tmp8_ = game_state_object_get_owner (_tmp9_, half_game_size, (guint8) (half_game_size - 1)) == PLAYER_NONE;
				}
				if (_tmp8_) {
					Game* _tmp10_;
					Game* _tmp11_;
					GameStateObject* _tmp12_;
					GameStateObject* _tmp13_;
					_tmp10_ = reversi_view_get_game (self);
					_tmp11_ = _tmp10_;
					_tmp12_ = game_get_current_state (_tmp11_);
					_tmp13_ = _tmp12_;
					_tmp7_ = game_state_object_get_owner (_tmp13_, half_game_size, (guint8) (half_game_size - 1)) != PLAYER_NONE;
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					target = (guint8) 2;
				} else {
					gboolean _tmp14_ = FALSE;
					gboolean _tmp15_ = FALSE;
					if (!self->priv->last_state_set) {
						_tmp15_ = TRUE;
					} else {
						GameStateObject* _tmp16_;
						_tmp16_ = self->priv->last_state;
						_tmp15_ = game_state_object_get_owner (_tmp16_, (guint8) (half_game_size - 1), half_game_size) == PLAYER_NONE;
					}
					if (_tmp15_) {
						Game* _tmp17_;
						Game* _tmp18_;
						GameStateObject* _tmp19_;
						GameStateObject* _tmp20_;
						_tmp17_ = reversi_view_get_game (self);
						_tmp18_ = _tmp17_;
						_tmp19_ = game_get_current_state (_tmp18_);
						_tmp20_ = _tmp19_;
						_tmp14_ = game_state_object_get_owner (_tmp20_, (guint8) (half_game_size - 1), half_game_size) != PLAYER_NONE;
					} else {
						_tmp14_ = FALSE;
					}
					if (_tmp14_) {
						target = (guint8) 3;
					} else {
						gboolean _tmp21_ = FALSE;
						gboolean _tmp22_ = FALSE;
						if (!self->priv->last_state_set) {
							_tmp22_ = TRUE;
						} else {
							GameStateObject* _tmp23_;
							_tmp23_ = self->priv->last_state;
							_tmp22_ = game_state_object_get_owner (_tmp23_, half_game_size, half_game_size) == PLAYER_NONE;
						}
						if (_tmp22_) {
							Game* _tmp24_;
							Game* _tmp25_;
							GameStateObject* _tmp26_;
							GameStateObject* _tmp27_;
							_tmp24_ = reversi_view_get_game (self);
							_tmp25_ = _tmp24_;
							_tmp26_ = game_get_current_state (_tmp25_);
							_tmp27_ = _tmp26_;
							_tmp21_ = game_state_object_get_owner (_tmp27_, half_game_size, half_game_size) != PLAYER_NONE;
						} else {
							_tmp21_ = FALSE;
						}
						if (_tmp21_) {
							target = (guint8) 4;
						} else {
							g_assert_not_reached ();
						}
					}
				}
			}
			_tmp28_ = self->priv->overture_target;
			_tmp28__length1 = self->priv->overture_target_length1;
			_tmp28_[self->priv->current_overture_playable] = target;
			_tmp29_ = self->priv->current_overture_playable;
			self->priv->current_overture_playable = _tmp29_ + 1;
		} else {
			gboolean _tmp30_ = FALSE;
			gboolean _tmp31_ = FALSE;
			guint8* _tmp86_;
			gint _tmp86__length1;
			guint8 _tmp87_;
			guint8* _tmp88_;
			gint _tmp88__length1;
			guint8 _tmp89_;
			if (!self->priv->last_state_set) {
				_tmp31_ = TRUE;
			} else {
				GameStateObject* _tmp32_;
				_tmp32_ = self->priv->last_state;
				_tmp31_ = game_state_object_get_owner (_tmp32_, (guint8) (half_game_size - 1), (guint8) (half_game_size - 1)) == PLAYER_NONE;
			}
			if (_tmp31_) {
				Game* _tmp33_;
				Game* _tmp34_;
				GameStateObject* _tmp35_;
				GameStateObject* _tmp36_;
				_tmp33_ = reversi_view_get_game (self);
				_tmp34_ = _tmp33_;
				_tmp35_ = game_get_current_state (_tmp34_);
				_tmp36_ = _tmp35_;
				_tmp30_ = game_state_object_get_owner (_tmp36_, (guint8) (half_game_size - 1), (guint8) (half_game_size - 1)) != PLAYER_NONE;
			} else {
				_tmp30_ = FALSE;
			}
			if (_tmp30_) {
				target = (guint8) 1;
			} else {
				gboolean _tmp37_ = FALSE;
				gboolean _tmp38_ = FALSE;
				if (!self->priv->last_state_set) {
					_tmp38_ = TRUE;
				} else {
					GameStateObject* _tmp39_;
					_tmp39_ = self->priv->last_state;
					_tmp38_ = game_state_object_get_owner (_tmp39_, half_game_size, (guint8) (half_game_size - 1)) == PLAYER_NONE;
				}
				if (_tmp38_) {
					Game* _tmp40_;
					Game* _tmp41_;
					GameStateObject* _tmp42_;
					GameStateObject* _tmp43_;
					_tmp40_ = reversi_view_get_game (self);
					_tmp41_ = _tmp40_;
					_tmp42_ = game_get_current_state (_tmp41_);
					_tmp43_ = _tmp42_;
					_tmp37_ = game_state_object_get_owner (_tmp43_, half_game_size, (guint8) (half_game_size - 1)) != PLAYER_NONE;
				} else {
					_tmp37_ = FALSE;
				}
				if (_tmp37_) {
					target = (guint8) 2;
				} else {
					gboolean _tmp44_ = FALSE;
					gboolean _tmp45_ = FALSE;
					if (!self->priv->last_state_set) {
						_tmp45_ = TRUE;
					} else {
						GameStateObject* _tmp46_;
						_tmp46_ = self->priv->last_state;
						_tmp45_ = game_state_object_get_owner (_tmp46_, (guint8) (half_game_size + 1), (guint8) (half_game_size - 1)) == PLAYER_NONE;
					}
					if (_tmp45_) {
						Game* _tmp47_;
						Game* _tmp48_;
						GameStateObject* _tmp49_;
						GameStateObject* _tmp50_;
						_tmp47_ = reversi_view_get_game (self);
						_tmp48_ = _tmp47_;
						_tmp49_ = game_get_current_state (_tmp48_);
						_tmp50_ = _tmp49_;
						_tmp44_ = game_state_object_get_owner (_tmp50_, (guint8) (half_game_size + 1), (guint8) (half_game_size - 1)) != PLAYER_NONE;
					} else {
						_tmp44_ = FALSE;
					}
					if (_tmp44_) {
						target = (guint8) 3;
					} else {
						gboolean _tmp51_ = FALSE;
						gboolean _tmp52_ = FALSE;
						if (!self->priv->last_state_set) {
							_tmp52_ = TRUE;
						} else {
							GameStateObject* _tmp53_;
							_tmp53_ = self->priv->last_state;
							_tmp52_ = game_state_object_get_owner (_tmp53_, (guint8) (half_game_size - 1), half_game_size) == PLAYER_NONE;
						}
						if (_tmp52_) {
							Game* _tmp54_;
							Game* _tmp55_;
							GameStateObject* _tmp56_;
							GameStateObject* _tmp57_;
							_tmp54_ = reversi_view_get_game (self);
							_tmp55_ = _tmp54_;
							_tmp56_ = game_get_current_state (_tmp55_);
							_tmp57_ = _tmp56_;
							_tmp51_ = game_state_object_get_owner (_tmp57_, (guint8) (half_game_size - 1), half_game_size) != PLAYER_NONE;
						} else {
							_tmp51_ = FALSE;
						}
						if (_tmp51_) {
							target = (guint8) 4;
						} else {
							gboolean _tmp58_ = FALSE;
							gboolean _tmp59_ = FALSE;
							if (!self->priv->last_state_set) {
								_tmp59_ = TRUE;
							} else {
								GameStateObject* _tmp60_;
								_tmp60_ = self->priv->last_state;
								_tmp59_ = game_state_object_get_owner (_tmp60_, (guint8) (half_game_size + 1), half_game_size) == PLAYER_NONE;
							}
							if (_tmp59_) {
								Game* _tmp61_;
								Game* _tmp62_;
								GameStateObject* _tmp63_;
								GameStateObject* _tmp64_;
								_tmp61_ = reversi_view_get_game (self);
								_tmp62_ = _tmp61_;
								_tmp63_ = game_get_current_state (_tmp62_);
								_tmp64_ = _tmp63_;
								_tmp58_ = game_state_object_get_owner (_tmp64_, (guint8) (half_game_size + 1), half_game_size) != PLAYER_NONE;
							} else {
								_tmp58_ = FALSE;
							}
							if (_tmp58_) {
								target = (guint8) 6;
							} else {
								gboolean _tmp65_ = FALSE;
								gboolean _tmp66_ = FALSE;
								if (!self->priv->last_state_set) {
									_tmp66_ = TRUE;
								} else {
									GameStateObject* _tmp67_;
									_tmp67_ = self->priv->last_state;
									_tmp66_ = game_state_object_get_owner (_tmp67_, (guint8) (half_game_size - 1), (guint8) (half_game_size + 1)) == PLAYER_NONE;
								}
								if (_tmp66_) {
									Game* _tmp68_;
									Game* _tmp69_;
									GameStateObject* _tmp70_;
									GameStateObject* _tmp71_;
									_tmp68_ = reversi_view_get_game (self);
									_tmp69_ = _tmp68_;
									_tmp70_ = game_get_current_state (_tmp69_);
									_tmp71_ = _tmp70_;
									_tmp65_ = game_state_object_get_owner (_tmp71_, (guint8) (half_game_size - 1), (guint8) (half_game_size + 1)) != PLAYER_NONE;
								} else {
									_tmp65_ = FALSE;
								}
								if (_tmp65_) {
									target = (guint8) 7;
								} else {
									gboolean _tmp72_ = FALSE;
									gboolean _tmp73_ = FALSE;
									if (!self->priv->last_state_set) {
										_tmp73_ = TRUE;
									} else {
										GameStateObject* _tmp74_;
										_tmp74_ = self->priv->last_state;
										_tmp73_ = game_state_object_get_owner (_tmp74_, half_game_size, (guint8) (half_game_size + 1)) == PLAYER_NONE;
									}
									if (_tmp73_) {
										Game* _tmp75_;
										Game* _tmp76_;
										GameStateObject* _tmp77_;
										GameStateObject* _tmp78_;
										_tmp75_ = reversi_view_get_game (self);
										_tmp76_ = _tmp75_;
										_tmp77_ = game_get_current_state (_tmp76_);
										_tmp78_ = _tmp77_;
										_tmp72_ = game_state_object_get_owner (_tmp78_, half_game_size, (guint8) (half_game_size + 1)) != PLAYER_NONE;
									} else {
										_tmp72_ = FALSE;
									}
									if (_tmp72_) {
										target = (guint8) 8;
									} else {
										gboolean _tmp79_ = FALSE;
										gboolean _tmp80_ = FALSE;
										if (!self->priv->last_state_set) {
											_tmp80_ = TRUE;
										} else {
											GameStateObject* _tmp81_;
											_tmp81_ = self->priv->last_state;
											_tmp80_ = game_state_object_get_owner (_tmp81_, (guint8) (half_game_size + 1), (guint8) (half_game_size + 1)) == PLAYER_NONE;
										}
										if (_tmp80_) {
											Game* _tmp82_;
											Game* _tmp83_;
											GameStateObject* _tmp84_;
											GameStateObject* _tmp85_;
											_tmp82_ = reversi_view_get_game (self);
											_tmp83_ = _tmp82_;
											_tmp84_ = game_get_current_state (_tmp83_);
											_tmp85_ = _tmp84_;
											_tmp79_ = game_state_object_get_owner (_tmp85_, (guint8) (half_game_size + 1), (guint8) (half_game_size + 1)) != PLAYER_NONE;
										} else {
											_tmp79_ = FALSE;
										}
										if (_tmp79_) {
											target = (guint8) 9;
										} else {
											g_assert_not_reached ();
										}
									}
								}
							}
						}
					}
				}
			}
			_tmp86_ = self->priv->overture_target;
			_tmp86__length1 = self->priv->overture_target_length1;
			_tmp86_[self->priv->current_overture_playable] = target;
			_tmp87_ = self->priv->current_overture_playable;
			self->priv->current_overture_playable = _tmp87_ + 1;
			_tmp88_ = self->priv->overture_target;
			_tmp88__length1 = self->priv->overture_target_length1;
			_tmp88_[self->priv->current_overture_playable] = (guint8) (10 - target);
			_tmp89_ = self->priv->current_overture_playable;
			self->priv->current_overture_playable = _tmp89_ + 1;
		}
	}
	if (!no_draw) {
		reversi_view_update_squares (self);
		self->priv->playable_tiles_highlight_state = (guint8) 0;
		if (undoing) {
			reversi_view_update_highlight_after_undo (self);
		} else {
			gboolean _tmp90_;
			gboolean _tmp91_;
			_tmp90_ = reversi_view_get_show_playable_tiles (self);
			_tmp91_ = _tmp90_;
			if (_tmp91_) {
				reversi_view_highlight_playable_tiles (self, FALSE);
			}
		}
	}
	_tmp92_ = reversi_view_get_game (self);
	_tmp93_ = _tmp92_;
	_tmp94_ = game_get_current_state (_tmp93_);
	_tmp95_ = _tmp94_;
	_tmp96_ = _g_object_ref0 (_tmp95_);
	_g_object_unref0 (self->priv->last_state);
	self->priv->last_state = _tmp96_;
	self->priv->last_state_set = TRUE;
}

static inline void
reversi_view_update_squares (ReversiView* self)
{
	g_return_if_fail (self != NULL);
	{
		guint8 x = 0U;
		x = (guint8) 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				if (!_tmp0_) {
					guint8 _tmp1_;
					_tmp1_ = x;
					x = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(x < self->priv->game_size)) {
					break;
				}
				{
					guint8 y = 0U;
					y = (guint8) 0;
					{
						gboolean _tmp2_ = FALSE;
						_tmp2_ = TRUE;
						while (TRUE) {
							if (!_tmp2_) {
								guint8 _tmp3_;
								_tmp3_ = y;
								y = _tmp3_ + 1;
							}
							_tmp2_ = FALSE;
							if (!(y < self->priv->game_size)) {
								break;
							}
							reversi_view_update_square (self, x, y);
						}
					}
				}
			}
		}
	}
}

static inline void
reversi_view_update_square (ReversiView* self,
                            guint8 x,
                            guint8 y)
{
	Game* _tmp0_;
	Game* _tmp1_;
	g_return_if_fail (self != NULL);
	_vala_return_if_fail (self->priv->game_is_set, "game_is_set");
	_tmp0_ = reversi_view_get_game (self);
	_tmp1_ = _tmp0_;
	reversi_view_set_square (self, x, y, reversi_view_get_pixmap (game_get_owner (_tmp1_, x, y)), FALSE, FALSE);
}

static Block2Data*
block2_data_ref (Block2Data* _data2_)
{
	g_atomic_int_inc (&_data2_->_ref_count_);
	return _data2_;
}

static void
block2_data_unref (void * _userdata_)
{
	Block2Data* _data2_;
	_data2_ = (Block2Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
		ReversiView* self;
		self = _data2_->self;
		_g_object_unref0 (self);
		g_slice_free (Block2Data, _data2_);
	}
}

static gboolean
____lambda11_ (Block2Data* _data2_)
{
	ReversiView* self;
	gboolean animating = FALSE;
	gboolean result;
	self = _data2_->self;
	animating = FALSE;
	{
		guint8 ix = 0U;
		ix = (guint8) 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				if (!_tmp0_) {
					guint8 _tmp1_;
					_tmp1_ = ix;
					ix = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(ix < self->priv->game_size)) {
					break;
				}
				{
					guint8 iy = 0U;
					iy = (guint8) 0;
					{
						gboolean _tmp2_ = FALSE;
						_tmp2_ = TRUE;
						while (TRUE) {
							gint old = 0;
							gint* _tmp4_;
							gint _tmp4__length1;
							gint _tmp4__length2;
							gint _tmp5_;
							gboolean _tmp6_ = FALSE;
							gboolean _tmp7_ = FALSE;
							gint* _tmp12_;
							gint _tmp12__length1;
							gint _tmp12__length2;
							gint _tmp13_;
							if (!_tmp2_) {
								guint8 _tmp3_;
								_tmp3_ = iy;
								iy = _tmp3_ + 1;
							}
							_tmp2_ = FALSE;
							if (!(iy < self->priv->game_size)) {
								break;
							}
							_tmp4_ = self->priv->pixmaps;
							_tmp4__length1 = self->priv->pixmaps_length1;
							_tmp4__length2 = self->priv->pixmaps_length2;
							_tmp5_ = _tmp4_[(ix * _tmp4__length2) + iy];
							old = _tmp5_;
							if (_data2_->is_final_animation) {
								_tmp7_ = self->priv->flip_final_result_now;
							} else {
								_tmp7_ = FALSE;
							}
							if (_tmp7_) {
								Game* _tmp8_;
								Game* _tmp9_;
								gboolean _tmp10_;
								gboolean _tmp11_;
								_tmp8_ = reversi_view_get_game (self);
								_tmp9_ = _tmp8_;
								_tmp10_ = game_get_is_complete (_tmp9_);
								_tmp11_ = _tmp10_;
								_tmp6_ = _tmp11_;
							} else {
								_tmp6_ = FALSE;
							}
							if (_tmp6_) {
								reversi_view_flip_final_result_tile (self, ix, iy);
							} else {
								reversi_view_update_square (self, ix, iy);
							}
							_tmp12_ = self->priv->pixmaps;
							_tmp12__length1 = self->priv->pixmaps_length1;
							_tmp12__length2 = self->priv->pixmaps_length2;
							_tmp13_ = _tmp12_[(ix * _tmp12__length2) + iy];
							if (_tmp13_ != old) {
								animating = TRUE;
							}
						}
					}
				}
			}
		}
	}
	if (animating) {
		result = G_SOURCE_CONTINUE;
		return result;
	} else {
		self->priv->animate_timeout = (guint) 0;
		if (!self->priv->show_highlight) {
			_reversi_view_on_motion (self, self->priv->mouse_position_x, self->priv->mouse_position_y, TRUE);
		}
		result = G_SOURCE_REMOVE;
		return result;
	}
}

static gboolean
_____lambda11__gsource_func (gpointer self)
{
	gboolean result;
	result = ____lambda11_ (self);
	return result;
}

static void
reversi_view_set_square (ReversiView* self,
                         guint8 x,
                         guint8 y,
                         gint pixmap,
                         gboolean is_final_animation,
                         gboolean force_redraw)
{
	Block2Data* _data2_;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp3_ = FALSE;
	g_return_if_fail (self != NULL);
	_data2_ = g_slice_new0 (Block2Data);
	_data2_->_ref_count_ = 1;
	_data2_->self = g_object_ref (self);
	_data2_->is_final_animation = is_final_animation;
	if (!force_redraw) {
		gint* _tmp1_;
		gint _tmp1__length1;
		gint _tmp1__length2;
		gint _tmp2_;
		_tmp1_ = self->priv->pixmaps;
		_tmp1__length1 = self->priv->pixmaps_length1;
		_tmp1__length2 = self->priv->pixmaps_length2;
		_tmp2_ = _tmp1_[(x * _tmp1__length2) + y];
		_tmp0_ = _tmp2_ == pixmap;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		block2_data_unref (_data2_);
		_data2_ = NULL;
		return;
	}
	if (pixmap == 0) {
		_tmp3_ = TRUE;
	} else {
		gint* _tmp4_;
		gint _tmp4__length1;
		gint _tmp4__length2;
		gint _tmp5_;
		_tmp4_ = self->priv->pixmaps;
		_tmp4__length1 = self->priv->pixmaps_length1;
		_tmp4__length2 = self->priv->pixmaps_length2;
		_tmp5_ = _tmp4_[(x * _tmp4__length2) + y];
		_tmp3_ = _tmp5_ == 0;
	}
	if (_tmp3_) {
		gint* _tmp6_;
		gint _tmp6__length1;
		gint _tmp6__length2;
		_tmp6_ = self->priv->pixmaps;
		_tmp6__length1 = self->priv->pixmaps_length1;
		_tmp6__length2 = self->priv->pixmaps_length2;
		_tmp6_[(x * _tmp6__length2) + y] = pixmap;
	} else {
		gint* _tmp7_;
		gint _tmp7__length1;
		gint _tmp7__length2;
		gint _tmp8_;
		_tmp7_ = self->priv->pixmaps;
		_tmp7__length1 = self->priv->pixmaps_length1;
		_tmp7__length2 = self->priv->pixmaps_length2;
		_tmp8_ = _tmp7_[(x * _tmp7__length2) + y];
		if (pixmap > _tmp8_) {
			gint* _tmp9_;
			gint _tmp9__length1;
			gint _tmp9__length2;
			gint _tmp10_;
			_tmp9_ = self->priv->pixmaps;
			_tmp9__length1 = self->priv->pixmaps_length1;
			_tmp9__length2 = self->priv->pixmaps_length2;
			_tmp10_ = _tmp9_[(x * _tmp9__length2) + y];
			_tmp9_[(x * _tmp9__length2) + y] = _tmp10_ + 1;
		} else {
			gint* _tmp11_;
			gint _tmp11__length1;
			gint _tmp11__length2;
			gint _tmp12_;
			_tmp11_ = self->priv->pixmaps;
			_tmp11__length1 = self->priv->pixmaps_length1;
			_tmp11__length2 = self->priv->pixmaps_length2;
			_tmp12_ = _tmp11_[(x * _tmp11__length2) + y];
			_tmp11_[(x * _tmp11__length2) + y] = _tmp12_ - 1;
		}
		if (self->priv->animate_timeout == ((guint) 0)) {
			self->priv->animate_timeout = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) REVERSI_VIEW_PIXMAP_FLIP_DELAY, _____lambda11__gsource_func, block2_data_ref (_data2_), block2_data_unref);
		}
	}
	reversi_view_queue_draw_idle (self);
	block2_data_unref (_data2_);
	_data2_ = NULL;
}

static gint
reversi_view_get_pixmap (Player color)
{
	gint result;
	switch (color) {
		default:
		case PLAYER_NONE:
		{
			result = 0;
			return result;
		}
		case PLAYER_DARK:
		{
			result = 1;
			return result;
		}
		case PLAYER_LIGHT:
		{
			result = 31;
			return result;
		}
	}
}

static gboolean
___lambda10_ (ReversiView* self)
{
	Game* _tmp0_;
	Game* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gboolean result;
	_tmp0_ = reversi_view_get_game (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = game_get_is_complete (_tmp1_);
	_tmp3_ = _tmp2_;
	if (!_tmp3_) {
		result = G_SOURCE_REMOVE;
		return result;
	}
	g_signal_emit (self, reversi_view_signals[REVERSI_VIEW_NOTIFY_FINAL_ANIMATION_SIGNAL], 0, FALSE);
	reversi_view_set_winner_and_loser_variables (self);
	self->priv->flip_final_result_now = TRUE;
	{
		guint8 x = 0U;
		x = (guint8) 0;
		{
			gboolean _tmp4_ = FALSE;
			_tmp4_ = TRUE;
			while (TRUE) {
				if (!_tmp4_) {
					guint8 _tmp5_;
					_tmp5_ = x;
					x = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				if (!(x < self->priv->game_size)) {
					break;
				}
				{
					guint8 y = 0U;
					y = (guint8) 0;
					{
						gboolean _tmp6_ = FALSE;
						_tmp6_ = TRUE;
						while (TRUE) {
							if (!_tmp6_) {
								guint8 _tmp7_;
								_tmp7_ = y;
								y = _tmp7_ + 1;
							}
							_tmp6_ = FALSE;
							if (!(y < self->priv->game_size)) {
								break;
							}
							reversi_view_flip_final_result_tile (self, x, y);
						}
					}
				}
			}
		}
	}
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
____lambda10__gsource_func (gpointer self)
{
	gboolean result;
	result = ___lambda10_ ((ReversiView*) self);
	return result;
}

static void
reversi_view_game_is_complete_cb (ReversiView* self)
{
	Game* _tmp0_;
	Game* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_ = FALSE;
	Game* _tmp5_;
	Game* _tmp6_;
	guint8 _tmp7_;
	guint8 _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = reversi_view_get_game (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = game_get_is_complete (_tmp1_);
	_tmp3_ = _tmp2_;
	if (!_tmp3_) {
		return;
	}
	_tmp5_ = reversi_view_get_game (self);
	_tmp6_ = _tmp5_;
	_tmp7_ = game_get_n_light_tiles (_tmp6_);
	_tmp8_ = _tmp7_;
	if (((gint) _tmp8_) == 0) {
		_tmp4_ = TRUE;
	} else {
		Game* _tmp9_;
		Game* _tmp10_;
		guint8 _tmp11_;
		guint8 _tmp12_;
		_tmp9_ = reversi_view_get_game (self);
		_tmp10_ = _tmp9_;
		_tmp11_ = game_get_n_dark_tiles (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp4_ = ((gint) _tmp12_) == 0;
	}
	if (_tmp4_) {
		return;
	}
	if (((gint) self->priv->game_size) >= 6) {
		g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 2, ____lambda10__gsource_func, g_object_ref (self), g_object_unref);
	}
}

static void
reversi_view_flip_final_result_tile (ReversiView* self,
                                     guint8 x,
                                     guint8 y)
{
	gint pixmap = 0;
	guint8 n = 0U;
	g_return_if_fail (self != NULL);
	n = (y * self->priv->game_size) + x;
	if (((gint) n) < self->priv->n_winning_tiles) {
		pixmap = reversi_view_get_pixmap (self->priv->winning_color);
	} else {
		if (((gint) n) < (self->priv->n_winning_tiles + self->priv->n_losing_tiles)) {
			pixmap = reversi_view_get_pixmap (self->priv->losing_color);
		} else {
			pixmap = reversi_view_get_pixmap (PLAYER_NONE);
		}
	}
	reversi_view_set_square (self, x, y, pixmap, TRUE, FALSE);
}

static void
reversi_view_set_winner_and_loser_variables (ReversiView* self)
{
	Game* _tmp0_;
	Game* _tmp1_;
	guint8 _tmp2_;
	guint8 _tmp3_;
	Game* _tmp4_;
	Game* _tmp5_;
	guint8 _tmp6_;
	guint8 _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = reversi_view_get_game (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = game_get_n_light_tiles (_tmp1_);
	_tmp3_ = _tmp2_;
	self->priv->n_winning_tiles = (gint) _tmp3_;
	_tmp4_ = reversi_view_get_game (self);
	_tmp5_ = _tmp4_;
	_tmp6_ = game_get_n_dark_tiles (_tmp5_);
	_tmp7_ = _tmp6_;
	self->priv->n_losing_tiles = (gint) _tmp7_;
	if (self->priv->n_losing_tiles > self->priv->n_winning_tiles) {
		gint t = 0;
		self->priv->winning_color = PLAYER_DARK;
		self->priv->losing_color = PLAYER_LIGHT;
		t = self->priv->n_winning_tiles;
		self->priv->n_winning_tiles = self->priv->n_losing_tiles;
		self->priv->n_losing_tiles = t;
	} else {
		self->priv->winning_color = PLAYER_LIGHT;
		self->priv->losing_color = PLAYER_DARK;
	}
}

gboolean
reversi_view_undo_final_animation (ReversiView* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (!self->priv->flip_final_result_now) {
		result = FALSE;
		return result;
	}
	g_signal_emit (self, reversi_view_signals[REVERSI_VIEW_NOTIFY_FINAL_ANIMATION_SIGNAL], 0, TRUE);
	self->priv->flip_final_result_now = FALSE;
	reversi_view_update_squares (self);
	reversi_view_highlight_playable_tiles (self, FALSE);
	result = TRUE;
	return result;
}

static void
_reversi_view_on_motion_gtk_event_controller_motion_motion (GtkEventControllerMotion* _sender,
                                                            gdouble x,
                                                            gdouble y,
                                                            gpointer self)
{
	reversi_view_on_motion ((ReversiView*) self, _sender, x, y);
}

static void
_reversi_view_on_mouse_in_gtk_event_controller_motion_enter (GtkEventControllerMotion* _sender,
                                                             gdouble x,
                                                             gdouble y,
                                                             gpointer self)
{
	reversi_view_on_mouse_in ((ReversiView*) self, _sender, x, y);
}

static void
_reversi_view_on_mouse_out_gtk_event_controller_motion_leave (GtkEventControllerMotion* _sender,
                                                              gpointer self)
{
	reversi_view_on_mouse_out ((ReversiView*) self, _sender);
}

static void
_reversi_view_on_click_gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                                  gint n_press,
                                                  gdouble x,
                                                  gdouble y,
                                                  gpointer self)
{
	reversi_view_on_click ((ReversiView*) self, _sender, n_press, x, y);
}

static void
reversi_view_init_mouse (ReversiView* self)
{
	GtkEventControllerMotion* motion_controller = NULL;
	GtkEventControllerMotion* _tmp0_;
	GtkEventController* _tmp1_;
	GtkGestureClick* click_controller = NULL;
	GtkGestureClick* _tmp2_;
	GtkEventController* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = (GtkEventControllerMotion*) gtk_event_controller_motion_new ();
	motion_controller = _tmp0_;
	g_signal_connect_object (motion_controller, "motion", (GCallback) _reversi_view_on_motion_gtk_event_controller_motion_motion, self, 0);
	g_signal_connect_object (motion_controller, "enter", (GCallback) _reversi_view_on_mouse_in_gtk_event_controller_motion_enter, self, 0);
	g_signal_connect_object (motion_controller, "leave", (GCallback) _reversi_view_on_mouse_out_gtk_event_controller_motion_leave, self, 0);
	_tmp1_ = _g_object_ref0 ((GtkEventController*) motion_controller);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp1_);
	_tmp2_ = (GtkGestureClick*) gtk_gesture_click_new ();
	click_controller = _tmp2_;
	gtk_gesture_single_set_button ((GtkGestureSingle*) click_controller, (guint) 0);
	g_signal_connect_object (click_controller, "pressed", (GCallback) _reversi_view_on_click_gtk_gesture_click_pressed, self, 0);
	_tmp3_ = _g_object_ref0 ((GtkEventController*) click_controller);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp3_);
	_g_object_unref0 (click_controller);
	_g_object_unref0 (motion_controller);
}

static void
reversi_view_on_mouse_in (ReversiView* self,
                          GtkEventControllerMotion* _motion_controller,
                          gdouble event_x,
                          gdouble event_y)
{
	guint8 x = 0U;
	guint8 y = 0U;
	guint8 _tmp0_ = 0U;
	guint8 _tmp1_ = 0U;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (_motion_controller != NULL);
	_tmp2_ = reversi_view_pointer_is_in_board (self, event_x, event_y, &_tmp0_, &_tmp1_);
	x = _tmp0_;
	y = _tmp1_;
	if (_tmp2_) {
		reversi_view_on_cursor_moving_in (self, x, y);
	} else {
		if (self->priv->mouse_is_in) {
			g_assert_not_reached ();
		}
	}
}

static void
reversi_view_on_cursor_moving_in (ReversiView* self,
                                  guint8 x,
                                  guint8 y)
{
	g_return_if_fail (self != NULL);
	self->priv->mouse_position_x = x;
	self->priv->mouse_position_y = y;
	self->priv->mouse_position_set = TRUE;
	self->priv->mouse_is_in = TRUE;
	_reversi_view_on_motion (self, x, y, TRUE);
}

static void
reversi_view_on_mouse_out (ReversiView* self,
                           GtkEventControllerMotion* _motion_controller)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (_motion_controller != NULL);
	self->priv->mouse_is_in = FALSE;
	if (self->priv->mouse_position_set) {
		gtk_widget_queue_draw ((GtkWidget*) self);
	}
}

static gboolean
reversi_view_pointer_is_in_board (ReversiView* self,
                                  gdouble pos_x,
                                  gdouble pos_y,
                                  guint8* x,
                                  guint8* y)
{
	guint8 _vala_x = 0U;
	guint8 _vala_y = 0U;
	gint _x = 0;
	gint _y = 0;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_x = (gint) floor ((pos_x - ((gdouble) self->priv->board_x)) / ((gdouble) self->priv->paving_size));
	_y = (gint) floor ((pos_y - ((gdouble) self->priv->board_y)) / ((gdouble) self->priv->paving_size));
	if (_x >= 0) {
		_tmp2_ = _x < ((gint) self->priv->game_size);
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		_tmp1_ = _y >= 0;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		_tmp0_ = _y < ((gint) self->priv->game_size);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		_vala_x = (guint8) _x;
		_vala_y = (guint8) _y;
		result = TRUE;
		if (x) {
			*x = _vala_x;
		}
		if (y) {
			*y = _vala_y;
		}
		return result;
	} else {
		_vala_x = G_MAXUINT8;
		_vala_y = G_MAXUINT8;
		result = FALSE;
		if (x) {
			*x = _vala_x;
		}
		if (y) {
			*y = _vala_y;
		}
		return result;
	}
}

static Block3Data*
block3_data_ref (Block3Data* _data3_)
{
	g_atomic_int_inc (&_data3_->_ref_count_);
	return _data3_;
}

static void
block3_data_unref (void * _userdata_)
{
	Block3Data* _data3_;
	_data3_ = (Block3Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
		ReversiView* self;
		self = _data3_->self;
		_g_object_unref0 (self);
		g_slice_free (Block3Data, _data3_);
	}
}

static gboolean
______lambda14_ (Block3Data* _data3_)
{
	ReversiView* self;
	gboolean result;
	self = _data3_->self;
	if (self->priv->mouse_is_in) {
		_reversi_view_on_motion (self, _data3_->x, _data3_->y, FALSE);
	}
	self->priv->timeout_id = (guint) 0;
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
_______lambda14__gsource_func (gpointer self)
{
	gboolean result;
	result = ______lambda14_ (self);
	return result;
}

static void
reversi_view_on_motion (ReversiView* self,
                        GtkEventControllerMotion* _motion_controller,
                        gdouble event_x,
                        gdouble event_y)
{
	Block3Data* _data3_;
	guint8 _tmp0_ = 0U;
	guint8 _tmp1_ = 0U;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (_motion_controller != NULL);
	_data3_ = g_slice_new0 (Block3Data);
	_data3_->_ref_count_ = 1;
	_data3_->self = g_object_ref (self);
	_tmp2_ = reversi_view_pointer_is_in_board (self, event_x, event_y, &_tmp0_, &_tmp1_);
	_data3_->x = _tmp0_;
	_data3_->y = _tmp1_;
	if (_tmp2_) {
		if (!self->priv->mouse_is_in) {
			reversi_view_on_cursor_moving_in (self, _data3_->x, _data3_->y);
		} else {
			gboolean _tmp3_ = FALSE;
			if (_data3_->x != self->priv->mouse_position_x) {
				_tmp3_ = TRUE;
			} else {
				_tmp3_ = _data3_->y != self->priv->mouse_position_y;
			}
			if (_tmp3_) {
				gboolean _tmp4_ = FALSE;
				gboolean _tmp5_ = FALSE;
				self->priv->mouse_position_x = _data3_->x;
				self->priv->mouse_position_y = _data3_->y;
				self->priv->mouse_position_set = TRUE;
				if (self->priv->show_highlight) {
					_tmp5_ = TRUE;
				} else {
					_tmp5_ = _data3_->x != self->priv->mouse_highlight_x;
				}
				if (_tmp5_) {
					_tmp4_ = TRUE;
				} else {
					_tmp4_ = _data3_->y != self->priv->mouse_highlight_y;
				}
				if (_tmp4_) {
					guint delay = 0U;
					gboolean _tmp6_;
					if (self->priv->timeout_id != ((guint) 0)) {
						g_source_remove (self->priv->timeout_id);
						self->priv->timeout_id = (guint) 0;
					}
					_tmp6_ = self->priv->_show_turnable_tiles;
					if (_tmp6_) {
						delay = (guint) 120;
					} else {
						gboolean _tmp7_;
						gboolean _tmp8_;
						_tmp7_ = reversi_view_get_show_playable_tiles (self);
						_tmp8_ = _tmp7_;
						if (_tmp8_) {
							delay = (guint) 50;
						} else {
							delay = (guint) 200;
						}
					}
					self->priv->timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT, delay, _______lambda14__gsource_func, block3_data_ref (_data3_), block3_data_unref);
				}
			}
		}
	} else {
		self->priv->mouse_is_in = FALSE;
		self->priv->show_mouse_highlight = FALSE;
		if (self->priv->mouse_position_set) {
			gtk_widget_queue_draw ((GtkWidget*) self);
		}
	}
	block3_data_unref (_data3_);
	_data3_ = NULL;
}

static void
_reversi_view_on_motion (ReversiView* self,
                         guint8 x,
                         guint8 y,
                         gboolean force_redraw)
{
	gboolean _tmp0_ = FALSE;
	gboolean old_show_mouse_highlight = FALSE;
	PossibleMove move = {0};
	gboolean _tmp2_ = FALSE;
	gboolean _tmp7_ = FALSE;
	guint8 old_mouse_highlight_x = 0U;
	guint8 old_mouse_highlight_y = 0U;
	gboolean _tmp8_ = FALSE;
	gboolean _tmp9_ = FALSE;
	gboolean _tmp11_ = FALSE;
	gboolean _tmp12_ = FALSE;
	g_return_if_fail (self != NULL);
	if (!force_redraw) {
		gboolean _tmp1_ = FALSE;
		if (x != self->priv->mouse_position_x) {
			_tmp1_ = TRUE;
		} else {
			_tmp1_ = y != self->priv->mouse_position_y;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		return;
	}
	old_show_mouse_highlight = self->priv->show_mouse_highlight;
	if (self->priv->mouse_is_in) {
		Game* _tmp3_;
		Game* _tmp4_;
		PossibleMove _tmp5_ = {0};
		gboolean _tmp6_;
		_tmp3_ = reversi_view_get_game (self);
		_tmp4_ = _tmp3_;
		_tmp6_ = game_test_placing_tile (_tmp4_, x, y, &_tmp5_);
		move = _tmp5_;
		_tmp2_ = _tmp6_;
	} else {
		_tmp2_ = FALSE;
	}
	self->priv->show_mouse_highlight = _tmp2_;
	if (self->priv->show_mouse_highlight) {
		g_signal_emit (self, reversi_view_signals[REVERSI_VIEW_CLEAR_IMPOSSIBLE_TO_MOVE_HERE_WARNING_SIGNAL], 0);
	}
	if (old_show_mouse_highlight) {
		_tmp7_ = !self->priv->show_mouse_highlight;
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		self->priv->old_highlight_x = G_MAXUINT8;
		self->priv->old_highlight_y = G_MAXUINT8;
	}
	old_mouse_highlight_x = self->priv->mouse_highlight_x;
	old_mouse_highlight_y = self->priv->mouse_highlight_y;
	self->priv->mouse_highlight_x = x;
	self->priv->mouse_highlight_y = y;
	if (old_mouse_highlight_x != G_MAXUINT8) {
		_tmp8_ = old_mouse_highlight_y != G_MAXUINT8;
	} else {
		_tmp8_ = FALSE;
	}
	if (_tmp8_) {
		gtk_widget_queue_draw ((GtkWidget*) self);
	}
	if (self->priv->show_mouse_highlight) {
		_tmp9_ = self->priv->show_highlight;
	} else {
		_tmp9_ = FALSE;
	}
	if (_tmp9_) {
		gboolean _tmp10_ = FALSE;
		self->priv->show_highlight = FALSE;
		if (self->priv->highlight_x != x) {
			_tmp10_ = TRUE;
		} else {
			_tmp10_ = self->priv->highlight_y != y;
		}
		if (_tmp10_) {
			gtk_widget_queue_draw ((GtkWidget*) self);
		}
	}
	if (self->priv->show_mouse_highlight) {
		_tmp12_ = TRUE;
	} else {
		_tmp12_ = force_redraw;
	}
	if (_tmp12_) {
		gboolean _tmp13_ = FALSE;
		if (self->priv->mouse_highlight_x != G_MAXUINT8) {
			_tmp13_ = self->priv->mouse_highlight_y != G_MAXUINT8;
		} else {
			_tmp13_ = FALSE;
		}
		_tmp11_ = _tmp13_;
	} else {
		_tmp11_ = FALSE;
	}
	if (_tmp11_) {
		gtk_widget_queue_draw ((GtkWidget*) self);
	}
}

static inline void
reversi_view_on_click (ReversiView* self,
                       GtkGestureClick* _click_controller,
                       gint n_press,
                       gdouble event_x,
                       gdouble event_y)
{
	guint button = 0U;
	gboolean _tmp0_ = FALSE;
	guint8 x = 0U;
	guint8 y = 0U;
	guint8 _tmp1_ = 0U;
	guint8 _tmp2_ = 0U;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (_click_controller != NULL);
	if (!self->priv->game_is_set) {
		return;
	}
	button = gtk_gesture_single_get_current_button ((GtkGestureSingle*) _click_controller);
	if (button != ((guint) GDK_BUTTON_PRIMARY)) {
		_tmp0_ = button != ((guint) GDK_BUTTON_SECONDARY);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		return;
	}
	_tmp3_ = reversi_view_pointer_is_in_board (self, event_x, event_y, &_tmp1_, &_tmp2_);
	x = _tmp1_;
	y = _tmp2_;
	if (_tmp3_) {
		self->priv->mouse_is_in = TRUE;
		self->priv->show_highlight = FALSE;
		self->priv->old_highlight_x = self->priv->highlight_x;
		self->priv->old_highlight_y = self->priv->highlight_y;
		gtk_widget_queue_draw ((GtkWidget*) self);
		self->priv->highlight_set = TRUE;
		self->priv->highlight_x = x;
		self->priv->highlight_y = y;
		reversi_view_move_if_possible (self, self->priv->highlight_x, self->priv->highlight_y);
	}
}

static gboolean
_reversi_view_on_key_pressed_gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                   guint keyval,
                                                                   guint keycode,
                                                                   GdkModifierType state,
                                                                   gpointer self)
{
	gboolean result;
	result = reversi_view_on_key_pressed ((ReversiView*) self, _sender, keyval, keycode, state);
	return result;
}

static void
reversi_view_init_keyboard (ReversiView* self)
{
	GtkEventControllerKey* key_controller = NULL;
	GtkEventControllerKey* _tmp0_;
	GtkEventController* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = (GtkEventControllerKey*) gtk_event_controller_key_new ();
	key_controller = _tmp0_;
	g_signal_connect_object (key_controller, "key-pressed", (GCallback) _reversi_view_on_key_pressed_gtk_event_controller_key_key_pressed, self, 0);
	_tmp1_ = _g_object_ref0 ((GtkEventController*) key_controller);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp1_);
	_g_object_unref0 (key_controller);
}

static inline gboolean
reversi_view_on_key_pressed (ReversiView* self,
                             GtkEventControllerKey* _key_controller,
                             guint keyval,
                             guint keycode,
                             GdkModifierType state)
{
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_;
	gchar* key = NULL;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp10_ = FALSE;
	gboolean _tmp11_ = FALSE;
	gboolean _tmp12_ = FALSE;
	gboolean _tmp13_ = FALSE;
	gboolean _tmp14_ = FALSE;
	gboolean _tmp15_ = FALSE;
	const gchar* _tmp63_;
	const gchar* _tmp64_;
	GQuark _tmp66_ = 0U;
	static GQuark _tmp65_label0 = 0;
	static GQuark _tmp65_label1 = 0;
	static GQuark _tmp65_label2 = 0;
	static GQuark _tmp65_label3 = 0;
	static GQuark _tmp65_label4 = 0;
	static GQuark _tmp65_label5 = 0;
	static GQuark _tmp65_label6 = 0;
	static GQuark _tmp65_label7 = 0;
	static GQuark _tmp65_label8 = 0;
	static GQuark _tmp65_label9 = 0;
	static GQuark _tmp65_label10 = 0;
	static GQuark _tmp65_label11 = 0;
	static GQuark _tmp65_label12 = 0;
	static GQuark _tmp65_label13 = 0;
	static GQuark _tmp65_label14 = 0;
	static GQuark _tmp65_label15 = 0;
	static GQuark _tmp65_label16 = 0;
	static GQuark _tmp65_label17 = 0;
	static GQuark _tmp65_label18 = 0;
	static GQuark _tmp65_label19 = 0;
	static GQuark _tmp65_label20 = 0;
	static GQuark _tmp65_label21 = 0;
	static GQuark _tmp65_label22 = 0;
	static GQuark _tmp65_label23 = 0;
	static GQuark _tmp65_label24 = 0;
	static GQuark _tmp65_label25 = 0;
	static GQuark _tmp65_label26 = 0;
	static GQuark _tmp65_label27 = 0;
	static GQuark _tmp65_label28 = 0;
	static GQuark _tmp65_label29 = 0;
	static GQuark _tmp65_label30 = 0;
	static GQuark _tmp65_label31 = 0;
	static GQuark _tmp65_label32 = 0;
	static GQuark _tmp65_label33 = 0;
	static GQuark _tmp65_label34 = 0;
	static GQuark _tmp65_label35 = 0;
	static GQuark _tmp65_label36 = 0;
	static GQuark _tmp65_label37 = 0;
	static GQuark _tmp65_label38 = 0;
	static GQuark _tmp65_label39 = 0;
	static GQuark _tmp65_label40 = 0;
	static GQuark _tmp65_label41 = 0;
	static GQuark _tmp65_label42 = 0;
	static GQuark _tmp65_label43 = 0;
	static GQuark _tmp65_label44 = 0;
	static GQuark _tmp65_label45 = 0;
	static GQuark _tmp65_label46 = 0;
	static GQuark _tmp65_label47 = 0;
	static GQuark _tmp65_label48 = 0;
	static GQuark _tmp65_label49 = 0;
	static GQuark _tmp65_label50 = 0;
	static GQuark _tmp65_label51 = 0;
	static GQuark _tmp65_label52 = 0;
	static GQuark _tmp65_label53 = 0;
	static GQuark _tmp65_label54 = 0;
	static GQuark _tmp65_label55 = 0;
	static GQuark _tmp65_label56 = 0;
	static GQuark _tmp65_label57 = 0;
	static GQuark _tmp65_label58 = 0;
	static GQuark _tmp65_label59 = 0;
	gboolean _tmp71_ = FALSE;
	gboolean _tmp72_ = FALSE;
	const gchar* _tmp73_;
	const gchar* _tmp76_;
	const gchar* _tmp77_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (_key_controller != NULL, FALSE);
	if (!self->priv->game_is_set) {
		result = FALSE;
		return result;
	}
	_tmp1_ = gdk_keyval_name (keyval);
	_tmp0_ = _tmp1_;
	if (_tmp0_ == NULL) {
		_tmp0_ = "";
	}
	_tmp2_ = g_strdup ((const gchar*) _tmp0_);
	key = _tmp2_;
	_tmp3_ = key;
	if (g_strcmp0 (_tmp3_, "") == 0) {
		result = FALSE;
		_g_free0 (key);
		return result;
	}
	if (self->priv->show_highlight) {
		gboolean _tmp5_ = FALSE;
		gboolean _tmp6_ = FALSE;
		const gchar* _tmp7_;
		_tmp7_ = key;
		if (g_strcmp0 (_tmp7_, "space") == 0) {
			_tmp6_ = TRUE;
		} else {
			const gchar* _tmp8_;
			_tmp8_ = key;
			_tmp6_ = g_strcmp0 (_tmp8_, "Return") == 0;
		}
		if (_tmp6_) {
			_tmp5_ = TRUE;
		} else {
			const gchar* _tmp9_;
			_tmp9_ = key;
			_tmp5_ = g_strcmp0 (_tmp9_, "KP_Enter") == 0;
		}
		_tmp4_ = _tmp5_;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		reversi_view_move_if_possible (self, self->priv->highlight_x, self->priv->highlight_y);
		result = TRUE;
		_g_free0 (key);
		return result;
	}
	if (((gint) self->priv->game_size) <= 4) {
		gboolean _tmp16_ = FALSE;
		gboolean _tmp17_ = FALSE;
		gboolean _tmp18_ = FALSE;
		const gchar* _tmp19_;
		_tmp19_ = key;
		if (g_strcmp0 (_tmp19_, "e") == 0) {
			_tmp18_ = TRUE;
		} else {
			const gchar* _tmp20_;
			_tmp20_ = key;
			_tmp18_ = g_strcmp0 (_tmp20_, "E") == 0;
		}
		if (_tmp18_) {
			_tmp17_ = TRUE;
		} else {
			const gchar* _tmp21_;
			_tmp21_ = key;
			_tmp17_ = g_strcmp0 (_tmp21_, "5") == 0;
		}
		if (_tmp17_) {
			_tmp16_ = TRUE;
		} else {
			const gchar* _tmp22_;
			_tmp22_ = key;
			_tmp16_ = g_strcmp0 (_tmp22_, "KP_5") == 0;
		}
		_tmp15_ = _tmp16_;
	} else {
		_tmp15_ = FALSE;
	}
	if (_tmp15_) {
		_tmp14_ = TRUE;
	} else {
		gboolean _tmp23_ = FALSE;
		if (((gint) self->priv->game_size) <= 5) {
			gboolean _tmp24_ = FALSE;
			gboolean _tmp25_ = FALSE;
			gboolean _tmp26_ = FALSE;
			const gchar* _tmp27_;
			_tmp27_ = key;
			if (g_strcmp0 (_tmp27_, "f") == 0) {
				_tmp26_ = TRUE;
			} else {
				const gchar* _tmp28_;
				_tmp28_ = key;
				_tmp26_ = g_strcmp0 (_tmp28_, "F") == 0;
			}
			if (_tmp26_) {
				_tmp25_ = TRUE;
			} else {
				const gchar* _tmp29_;
				_tmp29_ = key;
				_tmp25_ = g_strcmp0 (_tmp29_, "6") == 0;
			}
			if (_tmp25_) {
				_tmp24_ = TRUE;
			} else {
				const gchar* _tmp30_;
				_tmp30_ = key;
				_tmp24_ = g_strcmp0 (_tmp30_, "KP_6") == 0;
			}
			_tmp23_ = _tmp24_;
		} else {
			_tmp23_ = FALSE;
		}
		_tmp14_ = _tmp23_;
	}
	if (_tmp14_) {
		_tmp13_ = TRUE;
	} else {
		gboolean _tmp31_ = FALSE;
		if (((gint) self->priv->game_size) <= 6) {
			gboolean _tmp32_ = FALSE;
			gboolean _tmp33_ = FALSE;
			gboolean _tmp34_ = FALSE;
			const gchar* _tmp35_;
			_tmp35_ = key;
			if (g_strcmp0 (_tmp35_, "g") == 0) {
				_tmp34_ = TRUE;
			} else {
				const gchar* _tmp36_;
				_tmp36_ = key;
				_tmp34_ = g_strcmp0 (_tmp36_, "G") == 0;
			}
			if (_tmp34_) {
				_tmp33_ = TRUE;
			} else {
				const gchar* _tmp37_;
				_tmp37_ = key;
				_tmp33_ = g_strcmp0 (_tmp37_, "7") == 0;
			}
			if (_tmp33_) {
				_tmp32_ = TRUE;
			} else {
				const gchar* _tmp38_;
				_tmp38_ = key;
				_tmp32_ = g_strcmp0 (_tmp38_, "KP_7") == 0;
			}
			_tmp31_ = _tmp32_;
		} else {
			_tmp31_ = FALSE;
		}
		_tmp13_ = _tmp31_;
	}
	if (_tmp13_) {
		_tmp12_ = TRUE;
	} else {
		gboolean _tmp39_ = FALSE;
		if (((gint) self->priv->game_size) <= 7) {
			gboolean _tmp40_ = FALSE;
			gboolean _tmp41_ = FALSE;
			gboolean _tmp42_ = FALSE;
			const gchar* _tmp43_;
			_tmp43_ = key;
			if (g_strcmp0 (_tmp43_, "h") == 0) {
				_tmp42_ = TRUE;
			} else {
				const gchar* _tmp44_;
				_tmp44_ = key;
				_tmp42_ = g_strcmp0 (_tmp44_, "H") == 0;
			}
			if (_tmp42_) {
				_tmp41_ = TRUE;
			} else {
				const gchar* _tmp45_;
				_tmp45_ = key;
				_tmp41_ = g_strcmp0 (_tmp45_, "8") == 0;
			}
			if (_tmp41_) {
				_tmp40_ = TRUE;
			} else {
				const gchar* _tmp46_;
				_tmp46_ = key;
				_tmp40_ = g_strcmp0 (_tmp46_, "KP_8") == 0;
			}
			_tmp39_ = _tmp40_;
		} else {
			_tmp39_ = FALSE;
		}
		_tmp12_ = _tmp39_;
	}
	if (_tmp12_) {
		_tmp11_ = TRUE;
	} else {
		gboolean _tmp47_ = FALSE;
		if (((gint) self->priv->game_size) <= 8) {
			gboolean _tmp48_ = FALSE;
			gboolean _tmp49_ = FALSE;
			gboolean _tmp50_ = FALSE;
			const gchar* _tmp51_;
			_tmp51_ = key;
			if (g_strcmp0 (_tmp51_, "i") == 0) {
				_tmp50_ = TRUE;
			} else {
				const gchar* _tmp52_;
				_tmp52_ = key;
				_tmp50_ = g_strcmp0 (_tmp52_, "I") == 0;
			}
			if (_tmp50_) {
				_tmp49_ = TRUE;
			} else {
				const gchar* _tmp53_;
				_tmp53_ = key;
				_tmp49_ = g_strcmp0 (_tmp53_, "9") == 0;
			}
			if (_tmp49_) {
				_tmp48_ = TRUE;
			} else {
				const gchar* _tmp54_;
				_tmp54_ = key;
				_tmp48_ = g_strcmp0 (_tmp54_, "KP_9") == 0;
			}
			_tmp47_ = _tmp48_;
		} else {
			_tmp47_ = FALSE;
		}
		_tmp11_ = _tmp47_;
	}
	if (_tmp11_) {
		_tmp10_ = TRUE;
	} else {
		gboolean _tmp55_ = FALSE;
		if (((gint) self->priv->game_size) <= 9) {
			gboolean _tmp56_ = FALSE;
			gboolean _tmp57_ = FALSE;
			gboolean _tmp58_ = FALSE;
			const gchar* _tmp59_;
			_tmp59_ = key;
			if (g_strcmp0 (_tmp59_, "j") == 0) {
				_tmp58_ = TRUE;
			} else {
				const gchar* _tmp60_;
				_tmp60_ = key;
				_tmp58_ = g_strcmp0 (_tmp60_, "J") == 0;
			}
			if (_tmp58_) {
				_tmp57_ = TRUE;
			} else {
				const gchar* _tmp61_;
				_tmp61_ = key;
				_tmp57_ = g_strcmp0 (_tmp61_, "0") == 0;
			}
			if (_tmp57_) {
				_tmp56_ = TRUE;
			} else {
				const gchar* _tmp62_;
				_tmp62_ = key;
				_tmp56_ = g_strcmp0 (_tmp62_, "KP_0") == 0;
			}
			_tmp55_ = _tmp56_;
		} else {
			_tmp55_ = FALSE;
		}
		_tmp10_ = _tmp55_;
	}
	if (_tmp10_) {
		result = FALSE;
		_g_free0 (key);
		return result;
	}
	self->priv->old_highlight_x = self->priv->highlight_x;
	self->priv->old_highlight_y = self->priv->highlight_y;
	_tmp63_ = key;
	_tmp64_ = _tmp63_;
	_tmp66_ = (NULL == _tmp64_) ? 0 : g_quark_from_string (_tmp64_);
	if ((_tmp66_ == ((0 != _tmp65_label0) ? _tmp65_label0 : (_tmp65_label0 = g_quark_from_static_string ("Up")))) || (_tmp66_ == ((0 != _tmp65_label1) ? _tmp65_label1 : (_tmp65_label1 = g_quark_from_static_string ("KP_Up"))))) {
		switch (0) {
			default:
			{
				reversi_view_set_highlight_position_if_needed (self, REVERSI_VIEW_DIRECTION_TOP);
				if (((gint) self->priv->highlight_y) > 0) {
					guint8 _tmp67_;
					_tmp67_ = self->priv->highlight_y;
					self->priv->highlight_y = _tmp67_ - 1;
				}
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label2) ? _tmp65_label2 : (_tmp65_label2 = g_quark_from_static_string ("Left")))) || (_tmp66_ == ((0 != _tmp65_label3) ? _tmp65_label3 : (_tmp65_label3 = g_quark_from_static_string ("KP_Left"))))) {
		switch (0) {
			default:
			{
				reversi_view_set_highlight_position_if_needed (self, REVERSI_VIEW_DIRECTION_LEFT);
				if (((gint) self->priv->highlight_x) > 0) {
					guint8 _tmp68_;
					_tmp68_ = self->priv->highlight_x;
					self->priv->highlight_x = _tmp68_ - 1;
				}
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label4) ? _tmp65_label4 : (_tmp65_label4 = g_quark_from_static_string ("Right")))) || (_tmp66_ == ((0 != _tmp65_label5) ? _tmp65_label5 : (_tmp65_label5 = g_quark_from_static_string ("KP_Right"))))) {
		switch (0) {
			default:
			{
				reversi_view_set_highlight_position_if_needed (self, REVERSI_VIEW_DIRECTION_RIGHT);
				if (((gint) self->priv->highlight_x) < (self->priv->game_size - 1)) {
					guint8 _tmp69_;
					_tmp69_ = self->priv->highlight_x;
					self->priv->highlight_x = _tmp69_ + 1;
				}
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label6) ? _tmp65_label6 : (_tmp65_label6 = g_quark_from_static_string ("Down")))) || (_tmp66_ == ((0 != _tmp65_label7) ? _tmp65_label7 : (_tmp65_label7 = g_quark_from_static_string ("KP_Down"))))) {
		switch (0) {
			default:
			{
				reversi_view_set_highlight_position_if_needed (self, REVERSI_VIEW_DIRECTION_BOTTOM);
				if (((gint) self->priv->highlight_y) < (self->priv->game_size - 1)) {
					guint8 _tmp70_;
					_tmp70_ = self->priv->highlight_y;
					self->priv->highlight_y = _tmp70_ + 1;
				}
				break;
			}
		}
	} else if (((_tmp66_ == ((0 != _tmp65_label8) ? _tmp65_label8 : (_tmp65_label8 = g_quark_from_static_string ("space")))) || (_tmp66_ == ((0 != _tmp65_label9) ? _tmp65_label9 : (_tmp65_label9 = g_quark_from_static_string ("Return"))))) || (_tmp66_ == ((0 != _tmp65_label10) ? _tmp65_label10 : (_tmp65_label10 = g_quark_from_static_string ("KP_Enter"))))) {
		switch (0) {
			default:
			{
				if (self->priv->show_mouse_highlight) {
					reversi_view_move_if_possible (self, self->priv->mouse_highlight_x, self->priv->mouse_highlight_y);
					result = TRUE;
					_g_free0 (key);
					return result;
				} else {
					if (self->priv->mouse_position_set) {
						self->priv->highlight_x = self->priv->mouse_position_x;
						self->priv->highlight_y = self->priv->mouse_position_y;
					} else {
						reversi_view_init_highlight_on_light_tile_if_needed (self);
					}
				}
				break;
			}
		}
	} else if (_tmp66_ == ((0 != _tmp65_label11) ? _tmp65_label11 : (_tmp65_label11 = g_quark_from_static_string ("Escape")))) {
		switch (0) {
			default:
			{
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label12) ? _tmp65_label12 : (_tmp65_label12 = g_quark_from_static_string ("a")))) || (_tmp66_ == ((0 != _tmp65_label13) ? _tmp65_label13 : (_tmp65_label13 = g_quark_from_static_string ("A"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_x = (guint8) 0;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label14) ? _tmp65_label14 : (_tmp65_label14 = g_quark_from_static_string ("b")))) || (_tmp66_ == ((0 != _tmp65_label15) ? _tmp65_label15 : (_tmp65_label15 = g_quark_from_static_string ("B"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_x = (guint8) 1;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label16) ? _tmp65_label16 : (_tmp65_label16 = g_quark_from_static_string ("c")))) || (_tmp66_ == ((0 != _tmp65_label17) ? _tmp65_label17 : (_tmp65_label17 = g_quark_from_static_string ("C"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_x = (guint8) 2;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label18) ? _tmp65_label18 : (_tmp65_label18 = g_quark_from_static_string ("d")))) || (_tmp66_ == ((0 != _tmp65_label19) ? _tmp65_label19 : (_tmp65_label19 = g_quark_from_static_string ("D"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_x = (guint8) 3;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label20) ? _tmp65_label20 : (_tmp65_label20 = g_quark_from_static_string ("e")))) || (_tmp66_ == ((0 != _tmp65_label21) ? _tmp65_label21 : (_tmp65_label21 = g_quark_from_static_string ("E"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_x = (guint8) 4;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label22) ? _tmp65_label22 : (_tmp65_label22 = g_quark_from_static_string ("f")))) || (_tmp66_ == ((0 != _tmp65_label23) ? _tmp65_label23 : (_tmp65_label23 = g_quark_from_static_string ("F"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_x = (guint8) 5;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label24) ? _tmp65_label24 : (_tmp65_label24 = g_quark_from_static_string ("g")))) || (_tmp66_ == ((0 != _tmp65_label25) ? _tmp65_label25 : (_tmp65_label25 = g_quark_from_static_string ("G"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_x = (guint8) 6;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label26) ? _tmp65_label26 : (_tmp65_label26 = g_quark_from_static_string ("h")))) || (_tmp66_ == ((0 != _tmp65_label27) ? _tmp65_label27 : (_tmp65_label27 = g_quark_from_static_string ("H"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_x = (guint8) 7;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label28) ? _tmp65_label28 : (_tmp65_label28 = g_quark_from_static_string ("i")))) || (_tmp66_ == ((0 != _tmp65_label29) ? _tmp65_label29 : (_tmp65_label29 = g_quark_from_static_string ("I"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_x = (guint8) 8;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label30) ? _tmp65_label30 : (_tmp65_label30 = g_quark_from_static_string ("j")))) || (_tmp66_ == ((0 != _tmp65_label31) ? _tmp65_label31 : (_tmp65_label31 = g_quark_from_static_string ("J"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_x = (guint8) 9;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label32) ? _tmp65_label32 : (_tmp65_label32 = g_quark_from_static_string ("1")))) || (_tmp66_ == ((0 != _tmp65_label33) ? _tmp65_label33 : (_tmp65_label33 = g_quark_from_static_string ("KP_1"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_y = (guint8) 0;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label34) ? _tmp65_label34 : (_tmp65_label34 = g_quark_from_static_string ("2")))) || (_tmp66_ == ((0 != _tmp65_label35) ? _tmp65_label35 : (_tmp65_label35 = g_quark_from_static_string ("KP_2"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_y = (guint8) 1;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label36) ? _tmp65_label36 : (_tmp65_label36 = g_quark_from_static_string ("3")))) || (_tmp66_ == ((0 != _tmp65_label37) ? _tmp65_label37 : (_tmp65_label37 = g_quark_from_static_string ("KP_3"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_y = (guint8) 2;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label38) ? _tmp65_label38 : (_tmp65_label38 = g_quark_from_static_string ("4")))) || (_tmp66_ == ((0 != _tmp65_label39) ? _tmp65_label39 : (_tmp65_label39 = g_quark_from_static_string ("KP_4"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_y = (guint8) 3;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label40) ? _tmp65_label40 : (_tmp65_label40 = g_quark_from_static_string ("5")))) || (_tmp66_ == ((0 != _tmp65_label41) ? _tmp65_label41 : (_tmp65_label41 = g_quark_from_static_string ("KP_5"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_y = (guint8) 4;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label42) ? _tmp65_label42 : (_tmp65_label42 = g_quark_from_static_string ("6")))) || (_tmp66_ == ((0 != _tmp65_label43) ? _tmp65_label43 : (_tmp65_label43 = g_quark_from_static_string ("KP_6"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_y = (guint8) 5;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label44) ? _tmp65_label44 : (_tmp65_label44 = g_quark_from_static_string ("7")))) || (_tmp66_ == ((0 != _tmp65_label45) ? _tmp65_label45 : (_tmp65_label45 = g_quark_from_static_string ("KP_7"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_y = (guint8) 6;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label46) ? _tmp65_label46 : (_tmp65_label46 = g_quark_from_static_string ("8")))) || (_tmp66_ == ((0 != _tmp65_label47) ? _tmp65_label47 : (_tmp65_label47 = g_quark_from_static_string ("KP_8"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_y = (guint8) 7;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label48) ? _tmp65_label48 : (_tmp65_label48 = g_quark_from_static_string ("9")))) || (_tmp66_ == ((0 != _tmp65_label49) ? _tmp65_label49 : (_tmp65_label49 = g_quark_from_static_string ("KP_9"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_y = (guint8) 8;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label50) ? _tmp65_label50 : (_tmp65_label50 = g_quark_from_static_string ("0")))) || (_tmp66_ == ((0 != _tmp65_label51) ? _tmp65_label51 : (_tmp65_label51 = g_quark_from_static_string ("KP_0"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_y = (guint8) 9;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label52) ? _tmp65_label52 : (_tmp65_label52 = g_quark_from_static_string ("Home")))) || (_tmp66_ == ((0 != _tmp65_label53) ? _tmp65_label53 : (_tmp65_label53 = g_quark_from_static_string ("KP_Home"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_x = (guint8) 0;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label54) ? _tmp65_label54 : (_tmp65_label54 = g_quark_from_static_string ("End")))) || (_tmp66_ == ((0 != _tmp65_label55) ? _tmp65_label55 : (_tmp65_label55 = g_quark_from_static_string ("KP_End"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_x = (guint8) (self->priv->game_size - 1);
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label56) ? _tmp65_label56 : (_tmp65_label56 = g_quark_from_static_string ("Page_Up")))) || (_tmp66_ == ((0 != _tmp65_label57) ? _tmp65_label57 : (_tmp65_label57 = g_quark_from_static_string ("KP_Page_Up"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_y = (guint8) 0;
				break;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label58) ? _tmp65_label58 : (_tmp65_label58 = g_quark_from_static_string ("Page_Down")))) || (_tmp66_ == ((0 != _tmp65_label59) ? _tmp65_label59 : (_tmp65_label59 = g_quark_from_static_string ("KP_Next"))))) {
		switch (0) {
			default:
			{
				reversi_view_init_highlight_on_light_tile_if_needed (self);
				self->priv->highlight_y = (guint8) (self->priv->game_size - 1);
				break;
			}
		}
	} else {
		switch (0) {
			default:
			{
				result = FALSE;
				_g_free0 (key);
				return result;
			}
		}
	}
	self->priv->highlight_set = TRUE;
	_tmp73_ = key;
	if (g_strcmp0 (_tmp73_, "space") != 0) {
		const gchar* _tmp74_;
		_tmp74_ = key;
		_tmp72_ = g_strcmp0 (_tmp74_, "Return") != 0;
	} else {
		_tmp72_ = FALSE;
	}
	if (_tmp72_) {
		const gchar* _tmp75_;
		_tmp75_ = key;
		_tmp71_ = g_strcmp0 (_tmp75_, "KP_Enter") != 0;
	} else {
		_tmp71_ = FALSE;
	}
	if (_tmp71_) {
		g_signal_emit (self, reversi_view_signals[REVERSI_VIEW_CLEAR_IMPOSSIBLE_TO_MOVE_HERE_WARNING_SIGNAL], 0);
	}
	_tmp76_ = key;
	if (g_strcmp0 (_tmp76_, "Escape") == 0) {
		self->priv->show_highlight = FALSE;
	} else {
		if (self->priv->show_highlight) {
			self->priv->highlight_state = REVERSI_VIEW_HIGHLIGHT_MAX;
		} else {
			self->priv->show_highlight = TRUE;
		}
	}
	gtk_widget_queue_draw ((GtkWidget*) self);
	_tmp77_ = key;
	if (g_strcmp0 (_tmp77_, "Escape") != 0) {
		self->priv->show_mouse_highlight = FALSE;
	} else {
		gboolean _tmp78_ = FALSE;
		if (self->priv->mouse_position_set) {
			_tmp78_ = self->priv->mouse_is_in;
		} else {
			_tmp78_ = FALSE;
		}
		if (_tmp78_) {
			self->priv->highlight_x = self->priv->mouse_position_x;
			self->priv->highlight_y = self->priv->mouse_position_y;
			_reversi_view_on_motion (self, self->priv->highlight_x, self->priv->highlight_y, TRUE);
		}
	}
	result = TRUE;
	_g_free0 (key);
	return result;
}

static void
reversi_view_set_highlight_position_if_needed (ReversiView* self,
                                               ReversiViewDirection direction)
{
	gboolean _tmp0_ = FALSE;
	Game* _tmp1_;
	Game* _tmp2_;
	Player _tmp3_;
	Player _tmp4_;
	gboolean _tmp5_ = FALSE;
	Iagno* _tmp6_;
	ComputerPlayer* _tmp7_;
	ComputerPlayer* _tmp8_;
	Game* _tmp20_;
	Game* _tmp21_;
	Opening _tmp22_;
	Opening _tmp23_;
	g_return_if_fail (self != NULL);
	if (self->priv->mouse_position_set) {
		_tmp0_ = self->priv->show_mouse_highlight;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		self->priv->highlight_x = self->priv->mouse_highlight_x;
		self->priv->highlight_y = self->priv->mouse_highlight_y;
		return;
	}
	if (self->priv->highlight_set) {
		return;
	}
	_tmp1_ = reversi_view_get_game (self);
	_tmp2_ = _tmp1_;
	_tmp3_ = game_get_current_color (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_ == PLAYER_LIGHT) {
		reversi_view_init_highlight_on_light_tile (self);
		return;
	}
	_tmp6_ = self->priv->_iagno_instance;
	_tmp7_ = iagno_get_computer (_tmp6_);
	_tmp8_ = _tmp7_;
	if (_tmp8_ != NULL) {
		Iagno* _tmp9_;
		Player _tmp10_;
		Player _tmp11_;
		_tmp9_ = self->priv->_iagno_instance;
		_tmp10_ = iagno_get_player_one (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp5_ = _tmp11_ == PLAYER_LIGHT;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		if (gtk_get_locale_direction () == GTK_TEXT_DIR_LTR) {
			switch (direction) {
				case REVERSI_VIEW_DIRECTION_TOP:
				{
					guint8 _tmp12_;
					_tmp12_ = self->priv->highlight_y;
					self->priv->highlight_y = _tmp12_ + 1;
					break;
				}
				case REVERSI_VIEW_DIRECTION_LEFT:
				{
					guint8 _tmp13_;
					guint8 _tmp14_;
					_tmp13_ = self->priv->highlight_x;
					self->priv->highlight_x = _tmp13_ + 1;
					_tmp14_ = self->priv->highlight_y;
					self->priv->highlight_y = _tmp14_ + 1;
					break;
				}
				case REVERSI_VIEW_DIRECTION_RIGHT:
				{
					break;
				}
				case REVERSI_VIEW_DIRECTION_BOTTOM:
				{
					guint8 _tmp15_;
					_tmp15_ = self->priv->highlight_x;
					self->priv->highlight_x = _tmp15_ + 1;
					break;
				}
				default:
				break;
			}
		} else {
			switch (direction) {
				case REVERSI_VIEW_DIRECTION_TOP:
				{
					guint8 _tmp16_;
					guint8 _tmp17_;
					_tmp16_ = self->priv->highlight_x;
					self->priv->highlight_x = _tmp16_ + 1;
					_tmp17_ = self->priv->highlight_y;
					self->priv->highlight_y = _tmp17_ + 1;
					break;
				}
				case REVERSI_VIEW_DIRECTION_LEFT:
				{
					guint8 _tmp18_;
					_tmp18_ = self->priv->highlight_x;
					self->priv->highlight_x = _tmp18_ + 1;
					break;
				}
				case REVERSI_VIEW_DIRECTION_RIGHT:
				{
					guint8 _tmp19_;
					_tmp19_ = self->priv->highlight_y;
					self->priv->highlight_y = _tmp19_ + 1;
					break;
				}
				case REVERSI_VIEW_DIRECTION_BOTTOM:
				{
					break;
				}
				default:
				break;
			}
		}
		return;
	}
	_tmp20_ = reversi_view_get_game (self);
	_tmp21_ = _tmp20_;
	_tmp22_ = game_get_opening (_tmp21_);
	_tmp23_ = _tmp22_;
	switch (_tmp23_) {
		case OPENING_HUMANS:
		{
			if (gtk_get_locale_direction () == GTK_TEXT_DIR_LTR) {
				switch (direction) {
					case REVERSI_VIEW_DIRECTION_TOP:
					{
						guint8 _tmp24_;
						_tmp24_ = self->priv->highlight_y;
						self->priv->highlight_y = _tmp24_ + 1;
						break;
					}
					case REVERSI_VIEW_DIRECTION_LEFT:
					{
						guint8 _tmp25_;
						guint8 _tmp26_;
						_tmp25_ = self->priv->highlight_x;
						self->priv->highlight_x = _tmp25_ + 1;
						_tmp26_ = self->priv->highlight_y;
						self->priv->highlight_y = _tmp26_ + 1;
						break;
					}
					case REVERSI_VIEW_DIRECTION_RIGHT:
					{
						break;
					}
					case REVERSI_VIEW_DIRECTION_BOTTOM:
					{
						guint8 _tmp27_;
						_tmp27_ = self->priv->highlight_x;
						self->priv->highlight_x = _tmp27_ + 1;
						break;
					}
					default:
					break;
				}
			} else {
				switch (direction) {
					case REVERSI_VIEW_DIRECTION_TOP:
					{
						guint8 _tmp28_;
						guint8 _tmp29_;
						_tmp28_ = self->priv->highlight_x;
						self->priv->highlight_x = _tmp28_ + 1;
						_tmp29_ = self->priv->highlight_y;
						self->priv->highlight_y = _tmp29_ + 1;
						break;
					}
					case REVERSI_VIEW_DIRECTION_LEFT:
					{
						guint8 _tmp30_;
						_tmp30_ = self->priv->highlight_x;
						self->priv->highlight_x = _tmp30_ + 1;
						break;
					}
					case REVERSI_VIEW_DIRECTION_RIGHT:
					{
						guint8 _tmp31_;
						_tmp31_ = self->priv->highlight_y;
						self->priv->highlight_y = _tmp31_ + 1;
						break;
					}
					case REVERSI_VIEW_DIRECTION_BOTTOM:
					{
						break;
					}
					default:
					break;
				}
			}
			return;
		}
		case OPENING_REVERSI:
		{
			switch (direction) {
				case REVERSI_VIEW_DIRECTION_TOP:
				{
					break;
				}
				case REVERSI_VIEW_DIRECTION_LEFT:
				{
					break;
				}
				case REVERSI_VIEW_DIRECTION_RIGHT:
				{
					guint8 _tmp32_;
					guint8 _tmp33_;
					_tmp32_ = self->priv->highlight_x;
					self->priv->highlight_x = _tmp32_ + 1;
					_tmp33_ = self->priv->highlight_y;
					self->priv->highlight_y = _tmp33_ + 1;
					break;
				}
				case REVERSI_VIEW_DIRECTION_BOTTOM:
				{
					guint8 _tmp34_;
					guint8 _tmp35_;
					_tmp34_ = self->priv->highlight_x;
					self->priv->highlight_x = _tmp34_ + 1;
					_tmp35_ = self->priv->highlight_y;
					self->priv->highlight_y = _tmp35_ + 1;
					break;
				}
				default:
				break;
			}
			return;
		}
		case OPENING_INVERTED:
		{
			switch (direction) {
				case REVERSI_VIEW_DIRECTION_TOP:
				{
					guint8 _tmp36_;
					_tmp36_ = self->priv->highlight_x;
					self->priv->highlight_x = _tmp36_ + 1;
					break;
				}
				case REVERSI_VIEW_DIRECTION_LEFT:
				{
					guint8 _tmp37_;
					_tmp37_ = self->priv->highlight_y;
					self->priv->highlight_y = _tmp37_ + 1;
					break;
				}
				case REVERSI_VIEW_DIRECTION_RIGHT:
				{
					guint8 _tmp38_;
					_tmp38_ = self->priv->highlight_x;
					self->priv->highlight_x = _tmp38_ + 1;
					break;
				}
				case REVERSI_VIEW_DIRECTION_BOTTOM:
				{
					guint8 _tmp39_;
					_tmp39_ = self->priv->highlight_y;
					self->priv->highlight_y = _tmp39_ + 1;
					break;
				}
				default:
				break;
			}
			return;
		}
		case OPENING_ALTER_TOP:
		{
			switch (direction) {
				case REVERSI_VIEW_DIRECTION_TOP:
				{
					guint8 _tmp40_;
					_tmp40_ = self->priv->highlight_x;
					self->priv->highlight_x = _tmp40_ + 1;
					self->priv->highlight_y = (guint8) (self->priv->highlight_y + 3);
					break;
				}
				case REVERSI_VIEW_DIRECTION_LEFT:
				{
					self->priv->highlight_y = (guint8) (self->priv->highlight_y + 2);
					break;
				}
				case REVERSI_VIEW_DIRECTION_RIGHT:
				{
					guint8 _tmp41_;
					_tmp41_ = self->priv->highlight_x;
					self->priv->highlight_x = _tmp41_ + 1;
					self->priv->highlight_y = (guint8) (self->priv->highlight_y + 2);
					break;
				}
				case REVERSI_VIEW_DIRECTION_BOTTOM:
				{
					guint8 _tmp42_;
					_tmp42_ = self->priv->highlight_y;
					self->priv->highlight_y = _tmp42_ + 1;
					break;
				}
				default:
				break;
			}
			return;
		}
		case OPENING_ALTER_LEFT:
		{
			switch (direction) {
				case REVERSI_VIEW_DIRECTION_TOP:
				{
					self->priv->highlight_x = (guint8) (self->priv->highlight_x + 2);
					break;
				}
				case REVERSI_VIEW_DIRECTION_LEFT:
				{
					guint8 _tmp43_;
					self->priv->highlight_x = (guint8) (self->priv->highlight_x + 3);
					_tmp43_ = self->priv->highlight_y;
					self->priv->highlight_y = _tmp43_ + 1;
					break;
				}
				case REVERSI_VIEW_DIRECTION_RIGHT:
				{
					guint8 _tmp44_;
					_tmp44_ = self->priv->highlight_x;
					self->priv->highlight_x = _tmp44_ + 1;
					break;
				}
				case REVERSI_VIEW_DIRECTION_BOTTOM:
				{
					guint8 _tmp45_;
					self->priv->highlight_x = (guint8) (self->priv->highlight_x + 2);
					_tmp45_ = self->priv->highlight_y;
					self->priv->highlight_y = _tmp45_ + 1;
					break;
				}
				default:
				break;
			}
			return;
		}
		case OPENING_ALTER_RIGHT:
		{
			switch (direction) {
				case REVERSI_VIEW_DIRECTION_TOP:
				{
					guint8 _tmp46_;
					_tmp46_ = self->priv->highlight_x;
					self->priv->highlight_x = _tmp46_ - 1;
					break;
				}
				case REVERSI_VIEW_DIRECTION_LEFT:
				{
					break;
				}
				case REVERSI_VIEW_DIRECTION_RIGHT:
				{
					guint8 _tmp47_;
					self->priv->highlight_x = (guint8) (self->priv->highlight_x - 2);
					_tmp47_ = self->priv->highlight_y;
					self->priv->highlight_y = _tmp47_ + 1;
					break;
				}
				case REVERSI_VIEW_DIRECTION_BOTTOM:
				{
					guint8 _tmp48_;
					guint8 _tmp49_;
					_tmp48_ = self->priv->highlight_x;
					self->priv->highlight_x = _tmp48_ - 1;
					_tmp49_ = self->priv->highlight_y;
					self->priv->highlight_y = _tmp49_ + 1;
					break;
				}
				default:
				break;
			}
			return;
		}
		case OPENING_ALTER_BOTTOM:
		{
			switch (direction) {
				case REVERSI_VIEW_DIRECTION_TOP:
				{
					break;
				}
				case REVERSI_VIEW_DIRECTION_LEFT:
				{
					guint8 _tmp50_;
					_tmp50_ = self->priv->highlight_y;
					self->priv->highlight_y = _tmp50_ - 1;
					break;
				}
				case REVERSI_VIEW_DIRECTION_RIGHT:
				{
					guint8 _tmp51_;
					guint8 _tmp52_;
					_tmp51_ = self->priv->highlight_x;
					self->priv->highlight_x = _tmp51_ + 1;
					_tmp52_ = self->priv->highlight_y;
					self->priv->highlight_y = _tmp52_ - 1;
					break;
				}
				case REVERSI_VIEW_DIRECTION_BOTTOM:
				{
					guint8 _tmp53_;
					_tmp53_ = self->priv->highlight_x;
					self->priv->highlight_x = _tmp53_ + 1;
					self->priv->highlight_y = (guint8) (self->priv->highlight_y - 2);
					break;
				}
				default:
				break;
			}
			return;
		}
		default:
		break;
	}
	g_assert_not_reached ();
}

static void
reversi_view_init_highlight_on_light_tile_if_needed (ReversiView* self)
{
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	if (!self->priv->highlight_set) {
		Game* _tmp1_;
		Game* _tmp2_;
		Player _tmp3_;
		Player _tmp4_;
		_tmp1_ = reversi_view_get_game (self);
		_tmp2_ = _tmp1_;
		_tmp3_ = game_get_current_color (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_ == PLAYER_LIGHT;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		reversi_view_init_highlight_on_light_tile (self);
	}
}

static void
reversi_view_init_highlight_on_light_tile (ReversiView* self)
{
	guint8 half_size = 0U;
	Game* _tmp0_;
	Game* _tmp1_;
	Game* _tmp2_;
	Game* _tmp3_;
	Game* _tmp4_;
	Game* _tmp5_;
	Game* _tmp6_;
	Game* _tmp7_;
	g_return_if_fail (self != NULL);
	half_size = (guint8) (self->priv->game_size / 2);
	_tmp0_ = reversi_view_get_game (self);
	_tmp1_ = _tmp0_;
	if (game_get_owner (_tmp1_, (guint8) (half_size - 1), (guint8) (half_size - 1)) == PLAYER_LIGHT) {
		self->priv->highlight_x = (guint8) (half_size - 1);
		self->priv->highlight_y = self->priv->highlight_x;
		return;
	}
	_tmp2_ = reversi_view_get_game (self);
	_tmp3_ = _tmp2_;
	if (game_get_owner (_tmp3_, half_size, half_size) == PLAYER_LIGHT) {
		self->priv->highlight_x = half_size;
		self->priv->highlight_y = half_size;
		return;
	}
	_tmp4_ = reversi_view_get_game (self);
	_tmp5_ = _tmp4_;
	if (game_get_owner (_tmp5_, (guint8) (half_size - 1), half_size) == PLAYER_LIGHT) {
		self->priv->highlight_x = (guint8) (half_size - 1);
		self->priv->highlight_y = half_size;
		return;
	}
	_tmp6_ = reversi_view_get_game (self);
	_tmp7_ = _tmp6_;
	if (game_get_owner (_tmp7_, half_size, (guint8) (half_size - 1)) == PLAYER_LIGHT) {
		self->priv->highlight_x = half_size;
		self->priv->highlight_y = (guint8) (half_size - 1);
		return;
	}
	g_assert_not_reached ();
}

static void
reversi_view_init_possible_moves (ReversiView* self)
{
	gboolean* _tmp0_;
	g_return_if_fail (self != NULL);
	self->priv->playable_tiles_highlight_state = (guint8) 0;
	_tmp0_ = g_new0 (gboolean, self->priv->game_size * self->priv->game_size);
	self->priv->possible_moves = (g_free (self->priv->possible_moves), NULL);
	self->priv->possible_moves = _tmp0_;
	self->priv->possible_moves_length1 = self->priv->game_size;
	self->priv->possible_moves_length2 = self->priv->game_size;
	{
		guint8 x = 0U;
		x = (guint8) 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				if (!_tmp1_) {
					guint8 _tmp2_;
					_tmp2_ = x;
					x = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(x < self->priv->game_size)) {
					break;
				}
				{
					guint8 y = 0U;
					y = (guint8) 0;
					{
						gboolean _tmp3_ = FALSE;
						_tmp3_ = TRUE;
						while (TRUE) {
							gboolean* _tmp5_;
							gint _tmp5__length1;
							gint _tmp5__length2;
							if (!_tmp3_) {
								guint8 _tmp4_;
								_tmp4_ = y;
								y = _tmp4_ + 1;
							}
							_tmp3_ = FALSE;
							if (!(y < self->priv->game_size)) {
								break;
							}
							_tmp5_ = self->priv->possible_moves;
							_tmp5__length1 = self->priv->possible_moves_length1;
							_tmp5__length2 = self->priv->possible_moves_length2;
							_tmp5_[(x * _tmp5__length2) + y] = FALSE;
						}
					}
				}
			}
		}
	}
}

static inline void
reversi_view_move_if_possible (ReversiView* self,
                               guint8 x,
                               guint8 y)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	Iagno* _tmp2_;
	ComputerPlayer* _tmp3_;
	ComputerPlayer* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp2_ = self->priv->_iagno_instance;
	_tmp3_ = iagno_get_computer (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_ == NULL) {
		_tmp1_ = TRUE;
	} else {
		Iagno* _tmp5_;
		Player _tmp6_;
		Player _tmp7_;
		Game* _tmp8_;
		Game* _tmp9_;
		Player _tmp10_;
		Player _tmp11_;
		_tmp5_ = self->priv->_iagno_instance;
		_tmp6_ = iagno_get_player_one (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = reversi_view_get_game (self);
		_tmp9_ = _tmp8_;
		_tmp10_ = game_get_current_color (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp1_ = _tmp7_ == _tmp11_;
	}
	if (_tmp1_) {
		Game* _tmp12_;
		Game* _tmp13_;
		_tmp12_ = reversi_view_get_game (self);
		_tmp13_ = _tmp12_;
		_tmp0_ = game_get_owner (_tmp13_, x, y) != PLAYER_NONE;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		reversi_view_highlight_playable_tiles (self, FALSE);
	} else {
		g_signal_emit (self, reversi_view_signals[REVERSI_VIEW_MOVE_SIGNAL], 0, x, y);
	}
}

static void
_possible_move_free0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (possible_move_free (var), NULL));
}

static inline void
_g_slist_free__possible_move_free0_ (GSList* self)
{
	g_slist_free_full (self, (GDestroyNotify) _possible_move_free0_);
}

static void
__lambda13_ (ReversiView* self,
             PossibleMove* move)
{
	guint8 x = 0U;
	guint8 y = 0U;
	gboolean* _tmp0_;
	gint _tmp0__length1;
	gint _tmp0__length2;
	x = ((PossibleMove) (*move)).x;
	y = ((PossibleMove) (*move)).y;
	_tmp0_ = self->priv->possible_moves;
	_tmp0__length1 = self->priv->possible_moves_length1;
	_tmp0__length2 = self->priv->possible_moves_length2;
	_tmp0_[(x * _tmp0__length2) + y] = TRUE;
}

static void
___lambda13__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda13_ ((ReversiView*) self, (PossibleMove*) data);
}

static inline void
reversi_view_highlight_playable_tiles (ReversiView* self,
                                       gboolean force_reload)
{
	gboolean _tmp0_ = FALSE;
	GSList* moves = NULL;
	Game* _tmp6_;
	Game* _tmp7_;
	GSList* _tmp8_ = NULL;
	GSList* _tmp9_;
	g_return_if_fail (self != NULL);
	if (!force_reload) {
		_tmp0_ = ((gint) self->priv->playable_tiles_highlight_state) != 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		return;
	}
	{
		guint8 x = 0U;
		x = (guint8) 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				if (!_tmp1_) {
					guint8 _tmp2_;
					_tmp2_ = x;
					x = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(x < self->priv->game_size)) {
					break;
				}
				{
					guint8 y = 0U;
					y = (guint8) 0;
					{
						gboolean _tmp3_ = FALSE;
						_tmp3_ = TRUE;
						while (TRUE) {
							gboolean* _tmp5_;
							gint _tmp5__length1;
							gint _tmp5__length2;
							if (!_tmp3_) {
								guint8 _tmp4_;
								_tmp4_ = y;
								y = _tmp4_ + 1;
							}
							_tmp3_ = FALSE;
							if (!(y < self->priv->game_size)) {
								break;
							}
							_tmp5_ = self->priv->possible_moves;
							_tmp5__length1 = self->priv->possible_moves_length1;
							_tmp5__length2 = self->priv->possible_moves_length2;
							_tmp5_[(x * _tmp5__length2) + y] = FALSE;
						}
					}
				}
			}
		}
	}
	_tmp6_ = reversi_view_get_game (self);
	_tmp7_ = _tmp6_;
	game_get_possible_moves (_tmp7_, &_tmp8_);
	(moves == NULL) ? NULL : (moves = (_g_slist_free__possible_move_free0_ (moves), NULL));
	moves = _tmp8_;
	self->priv->playable_tiles_highlight_state = (guint8) 1;
	_tmp9_ = moves;
	g_slist_foreach (_tmp9_, ___lambda13__gfunc, self);
	gtk_widget_queue_draw ((GtkWidget*) self);
	(moves == NULL) ? NULL : (moves = (_g_slist_free__possible_move_free0_ (moves), NULL));
}

static gboolean
reversi_view_get_show_playable_tiles (ReversiView* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_show_playable_tiles;
	return result;
}

void
reversi_view_set_show_playable_tiles (ReversiView* self,
                                      gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_show_playable_tiles = value;
	if (self->priv->game_is_set) {
		reversi_view_highlight_playable_tiles (self, FALSE);
	}
}

static gboolean
reversi_view_get_show_turnable_tiles (ReversiView* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_show_turnable_tiles;
	return result;
}

void
reversi_view_set_show_turnable_tiles (ReversiView* self,
                                      gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_show_turnable_tiles = value;
}

Game*
reversi_view_get_game (ReversiView* self)
{
	Game* result;
	Game* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	if (!self->priv->game_is_set) {
		g_assert_not_reached ();
	}
	_tmp0_ = self->priv->_game;
	result = _tmp0_;
	return result;
}

static void
_reversi_view_game_is_complete_cb_game_completeness_updated (Game* _sender,
                                                             gboolean completeness,
                                                             gpointer self)
{
	reversi_view_game_is_complete_cb ((ReversiView*) self);
}

static void
_reversi_view_turn_ended_cb_game_turn_ended (Game* _sender,
                                             gboolean undoing,
                                             gboolean no_draw,
                                             gpointer self)
{
	reversi_view_turn_ended_cb ((ReversiView*) self, undoing, no_draw);
}

void
reversi_view_set_game (ReversiView* self,
                       Game* value)
{
	Game* test = NULL;
	Game* _tmp0_;
	Game* _tmp2_;
	Game* _tmp3_;
	guint8 _tmp4_;
	guint8 _tmp5_;
	Game* _tmp13_;
	Game* _tmp14_;
	gboolean even_board = FALSE;
	Game* _tmp15_;
	Opening _tmp16_;
	Opening _tmp17_;
	gboolean _tmp22_;
	gboolean _tmp23_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	test = _tmp0_;
	if (test == NULL) {
		g_assert_not_reached ();
	}
	if (self->priv->game_is_set) {
		Game* _tmp1_;
		_tmp1_ = self->priv->_game;
		g_signal_handlers_disconnect_by_func (_tmp1_, NULL, self);
	}
	_tmp2_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_game);
	self->priv->_game = _tmp2_;
	_tmp3_ = self->priv->_game;
	_tmp4_ = game_get_size (_tmp3_);
	_tmp5_ = _tmp4_;
	self->priv->game_size = _tmp5_;
	if (!self->priv->game_is_set) {
		gint* _tmp6_;
		_tmp6_ = g_new0 (gint, self->priv->game_size * self->priv->game_size);
		self->priv->pixmaps = (g_free (self->priv->pixmaps), NULL);
		self->priv->pixmaps = _tmp6_;
		self->priv->pixmaps_length1 = self->priv->game_size;
		self->priv->pixmaps_length2 = self->priv->game_size;
		self->priv->game_is_set = TRUE;
	}
	reversi_view_init_possible_moves (self);
	{
		guint8 x = 0U;
		x = (guint8) 0;
		{
			gboolean _tmp7_ = FALSE;
			_tmp7_ = TRUE;
			while (TRUE) {
				if (!_tmp7_) {
					guint8 _tmp8_;
					_tmp8_ = x;
					x = _tmp8_ + 1;
				}
				_tmp7_ = FALSE;
				if (!(x < self->priv->game_size)) {
					break;
				}
				{
					guint8 y = 0U;
					y = (guint8) 0;
					{
						gboolean _tmp9_ = FALSE;
						_tmp9_ = TRUE;
						while (TRUE) {
							gint* _tmp11_;
							gint _tmp11__length1;
							gint _tmp11__length2;
							Game* _tmp12_;
							if (!_tmp9_) {
								guint8 _tmp10_;
								_tmp10_ = y;
								y = _tmp10_ + 1;
							}
							_tmp9_ = FALSE;
							if (!(y < self->priv->game_size)) {
								break;
							}
							_tmp11_ = self->priv->pixmaps;
							_tmp11__length1 = self->priv->pixmaps_length1;
							_tmp11__length2 = self->priv->pixmaps_length2;
							_tmp12_ = self->priv->_game;
							_tmp11_[(x * _tmp11__length2) + y] = reversi_view_get_pixmap (game_get_owner (_tmp12_, x, y));
						}
					}
				}
			}
		}
	}
	_tmp13_ = self->priv->_game;
	g_signal_connect_object (_tmp13_, "completeness-updated", (GCallback) _reversi_view_game_is_complete_cb_game_completeness_updated, self, 0);
	_tmp14_ = self->priv->_game;
	g_signal_connect_object (_tmp14_, "turn-ended", (GCallback) _reversi_view_turn_ended_cb_game_turn_ended, self, 0);
	self->priv->show_highlight = FALSE;
	even_board = (self->priv->game_size % 2) == 0;
	if (even_board) {
		self->priv->highlight_set = FALSE;
		self->priv->highlight_x = (guint8) ((self->priv->game_size / 2) - 1);
	} else {
		self->priv->highlight_set = TRUE;
		self->priv->highlight_x = (guint8) (self->priv->game_size / 2);
	}
	self->priv->highlight_y = self->priv->highlight_x;
	self->priv->old_highlight_x = G_MAXUINT8;
	self->priv->old_highlight_y = G_MAXUINT8;
	self->priv->highlight_state = (guint8) 0;
	self->priv->show_mouse_highlight = FALSE;
	self->priv->mouse_position_set = FALSE;
	self->priv->mouse_highlight_x = G_MAXUINT8;
	self->priv->mouse_highlight_y = G_MAXUINT8;
	self->priv->mouse_position_x = G_MAXUINT8;
	self->priv->mouse_position_y = G_MAXUINT8;
	self->priv->last_state_set = FALSE;
	_tmp15_ = self->priv->_game;
	_tmp16_ = game_get_opening (_tmp15_);
	_tmp17_ = _tmp16_;
	if (_tmp17_ == OPENING_HUMANS) {
		if (even_board) {
			guint8* _tmp18_;
			guint8* _tmp19_;
			_tmp18_ = g_new0 (guint8, 4);
			_tmp18_[0] = (guint8) 0;
			_tmp18_[1] = (guint8) 0;
			_tmp18_[2] = (guint8) 0;
			_tmp18_[3] = (guint8) 0;
			self->priv->overture_steps = (g_free (self->priv->overture_steps), NULL);
			self->priv->overture_steps = _tmp18_;
			self->priv->overture_steps_length1 = 4;
			self->priv->_overture_steps_size_ = self->priv->overture_steps_length1;
			_tmp19_ = g_new0 (guint8, 4);
			_tmp19_[0] = (guint8) 0;
			_tmp19_[1] = (guint8) 0;
			_tmp19_[2] = (guint8) 0;
			_tmp19_[3] = (guint8) 0;
			self->priv->overture_target = (g_free (self->priv->overture_target), NULL);
			self->priv->overture_target = _tmp19_;
			self->priv->overture_target_length1 = 4;
			self->priv->_overture_target_size_ = self->priv->overture_target_length1;
		} else {
			guint8* _tmp20_;
			guint8* _tmp21_;
			_tmp20_ = g_new0 (guint8, 6);
			_tmp20_[0] = (guint8) 0;
			_tmp20_[1] = (guint8) 0;
			_tmp20_[2] = (guint8) 0;
			_tmp20_[3] = (guint8) 0;
			_tmp20_[4] = (guint8) 0;
			_tmp20_[5] = (guint8) 0;
			self->priv->overture_steps = (g_free (self->priv->overture_steps), NULL);
			self->priv->overture_steps = _tmp20_;
			self->priv->overture_steps_length1 = 6;
			self->priv->_overture_steps_size_ = self->priv->overture_steps_length1;
			_tmp21_ = g_new0 (guint8, 6);
			_tmp21_[0] = (guint8) 0;
			_tmp21_[1] = (guint8) 0;
			_tmp21_[2] = (guint8) 0;
			_tmp21_[3] = (guint8) 0;
			_tmp21_[4] = (guint8) 0;
			_tmp21_[5] = (guint8) 0;
			self->priv->overture_target = (g_free (self->priv->overture_target), NULL);
			self->priv->overture_target = _tmp21_;
			self->priv->overture_target_length1 = 6;
			self->priv->_overture_target_size_ = self->priv->overture_target_length1;
		}
		self->priv->current_overture_playable = (guint8) 0;
		if (self->priv->configuration_done) {
			reversi_view_configure_overture_origin (self);
		}
		self->priv->humans_opening_intensity = REVERSI_VIEW_HUMANS_OPENING_INTENSITY_MAX;
	} else {
		self->priv->humans_opening_intensity = (guint8) 0;
	}
	gtk_widget_queue_draw ((GtkWidget*) self);
	_tmp22_ = reversi_view_get_show_playable_tiles (self);
	_tmp23_ = _tmp22_;
	if (_tmp23_) {
		reversi_view_highlight_playable_tiles (self, FALSE);
	}
	_g_object_unref0 (test);
}

static Iagno*
reversi_view_get_iagno_instance (ReversiView* self)
{
	Iagno* result;
	Iagno* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_iagno_instance;
	result = _tmp0_;
	return result;
}

static void
reversi_view_set_iagno_instance (ReversiView* self,
                                 Iagno* value)
{
	Iagno* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_iagno_instance);
	self->priv->_iagno_instance = _tmp0_;
}

Theme*
reversi_view_get_theme (ReversiView* self)
{
	Theme* result;
	Theme* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_theme;
	result = _tmp0_;
	return result;
}

void
reversi_view_set_theme (ReversiView* self,
                        Theme* value)
{
	Theme* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_theme);
	self->priv->_theme = _tmp0_;
	_g_object_unref0 (self->priv->tiles_pattern);
	self->priv->tiles_pattern = NULL;
	if (self->priv->configuration_done) {
		reversi_view_configure_theme (self);
	}
	gtk_widget_queue_draw ((GtkWidget*) self);
	g_object_notify_by_pspec ((GObject *) self, reversi_view_properties[REVERSI_VIEW_THEME_PROPERTY]);
}

static void
g_cclosure_user_marshal_VOID__UCHAR_UCHAR (GClosure * closure,
                                           GValue * return_value,
                                           guint n_param_values,
                                           const GValue * param_values,
                                           gpointer invocation_hint,
                                           gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__UCHAR_UCHAR) (gpointer data1, guint8 arg_1, guint8 arg_2, gpointer data2);
	register GMarshalFunc_VOID__UCHAR_UCHAR callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__UCHAR_UCHAR) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_uchar (param_values + 1), g_value_get_uchar (param_values + 2), data2);
}

static GObject *
reversi_view_constructor (GType type,
                          guint n_construct_properties,
                          GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ReversiView * self;
	GdkTexture* _tmp0_;
	parent_class = G_OBJECT_CLASS (reversi_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_REVERSI_VIEW, ReversiView);
	gtk_widget_set_hexpand ((GtkWidget*) self, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) self, TRUE);
	gtk_widget_set_focusable ((GtkWidget*) self, TRUE);
	reversi_view_init_mouse (self);
	reversi_view_init_keyboard (self);
	_tmp0_ = gdk_texture_new_from_resource ("/org/gnome/Reversi/ui/noise.png");
	_g_object_unref0 (self->priv->noise_texture);
	self->priv->noise_texture = _tmp0_;
	return obj;
}

static void
reversi_view_class_init (ReversiViewClass * klass,
                         gpointer klass_data)
{
	reversi_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ReversiView_private_offset);
	((GtkWidgetClass *) klass)->snapshot = (void (*) (GtkWidget*, GtkSnapshot*)) reversi_view_real_snapshot;
	G_OBJECT_CLASS (klass)->get_property = _vala_reversi_view_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_reversi_view_set_property;
	G_OBJECT_CLASS (klass)->constructor = reversi_view_constructor;
	G_OBJECT_CLASS (klass)->finalize = reversi_view_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), REVERSI_VIEW_SHOW_PLAYABLE_TILES_PROPERTY, reversi_view_properties[REVERSI_VIEW_SHOW_PLAYABLE_TILES_PROPERTY] = g_param_spec_boolean ("show-playable-tiles", "show-playable-tiles", "show-playable-tiles", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), REVERSI_VIEW_SHOW_TURNABLE_TILES_PROPERTY, reversi_view_properties[REVERSI_VIEW_SHOW_TURNABLE_TILES_PROPERTY] = g_param_spec_boolean ("show-turnable-tiles", "show-turnable-tiles", "show-turnable-tiles", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), REVERSI_VIEW_GAME_PROPERTY, reversi_view_properties[REVERSI_VIEW_GAME_PROPERTY] = g_param_spec_object ("game", "game", "game", TYPE_GAME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), REVERSI_VIEW_IAGNO_INSTANCE_PROPERTY, reversi_view_properties[REVERSI_VIEW_IAGNO_INSTANCE_PROPERTY] = g_param_spec_object ("iagno-instance", "iagno-instance", "iagno-instance", TYPE_IAGNO, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), REVERSI_VIEW_THEME_PROPERTY, reversi_view_properties[REVERSI_VIEW_THEME_PROPERTY] = g_param_spec_object ("theme", "theme", "theme", TYPE_THEME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	reversi_view_signals[REVERSI_VIEW_MOVE_SIGNAL] = g_signal_new ("move", TYPE_REVERSI_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__UCHAR_UCHAR, G_TYPE_NONE, 2, G_TYPE_UCHAR, G_TYPE_UCHAR);
	reversi_view_signals[REVERSI_VIEW_CLEAR_IMPOSSIBLE_TO_MOVE_HERE_WARNING_SIGNAL] = g_signal_new ("clear-impossible-to-move-here-warning", TYPE_REVERSI_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	reversi_view_signals[REVERSI_VIEW_NOTIFY_FINAL_ANIMATION_SIGNAL] = g_signal_new ("notify-final-animation", TYPE_REVERSI_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
}

static void
reversi_view_instance_init (ReversiView * self,
                            gpointer klass)
{
	gint* _tmp0_;
	guint8* _tmp1_;
	guint8* _tmp2_;
	self->priv = reversi_view_get_instance_private (self);
	self->priv->_show_playable_tiles = FALSE;
	self->priv->_show_turnable_tiles = FALSE;
	self->priv->show_highlight = FALSE;
	self->priv->highlight_set = FALSE;
	self->priv->highlight_x = G_MAXUINT8;
	self->priv->highlight_y = G_MAXUINT8;
	self->priv->old_highlight_x = G_MAXUINT8;
	self->priv->old_highlight_y = G_MAXUINT8;
	self->priv->highlight_state = (guint8) 0;
	self->priv->show_mouse_highlight = FALSE;
	self->priv->mouse_position_set = FALSE;
	self->priv->mouse_highlight_x = G_MAXUINT8;
	self->priv->mouse_highlight_y = G_MAXUINT8;
	self->priv->mouse_position_x = G_MAXUINT8;
	self->priv->mouse_position_y = G_MAXUINT8;
	self->priv->render_size = (guint) 0;
	self->priv->tiles_pattern = NULL;
	self->priv->animate_timeout = (guint) 0;
	self->priv->humans_opening_intensity = (guint8) 0;
	self->priv->game_is_set = FALSE;
	self->priv->configuration_done = FALSE;
	_tmp0_ = g_new0 (gint, 6);
	self->priv->overture_origin_xs = _tmp0_;
	self->priv->overture_origin_xs_length1 = 6;
	self->priv->_overture_origin_xs_size_ = self->priv->overture_origin_xs_length1;
	self->priv->overture_origin_y = 0;
	_tmp1_ = g_new0 (guint8, 6);
	_tmp1_[0] = (guint8) 0;
	_tmp1_[1] = (guint8) 0;
	_tmp1_[2] = (guint8) 0;
	_tmp1_[3] = (guint8) 0;
	_tmp1_[4] = (guint8) 0;
	_tmp1_[5] = (guint8) 0;
	self->priv->overture_steps = _tmp1_;
	self->priv->overture_steps_length1 = 6;
	self->priv->_overture_steps_size_ = self->priv->overture_steps_length1;
	_tmp2_ = g_new0 (guint8, 6);
	_tmp2_[0] = (guint8) 0;
	_tmp2_[1] = (guint8) 0;
	_tmp2_[2] = (guint8) 0;
	_tmp2_[3] = (guint8) 0;
	_tmp2_[4] = (guint8) 0;
	_tmp2_[5] = (guint8) 0;
	self->priv->overture_target = _tmp2_;
	self->priv->overture_target_length1 = 6;
	self->priv->_overture_target_size_ = self->priv->overture_target_length1;
	self->priv->current_overture_playable = (guint8) 0;
	self->priv->last_state_set = FALSE;
	self->priv->flip_final_result_now = FALSE;
	self->priv->mouse_is_in = FALSE;
	self->priv->timeout_id = (guint) 0;
}

static void
reversi_view_finalize (GObject * obj)
{
	ReversiView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_REVERSI_VIEW, ReversiView);
	_g_object_unref0 (self->priv->tiles_pattern);
	_g_object_unref0 (self->priv->noise_texture);
	self->priv->pixmaps = (g_free (self->priv->pixmaps), NULL);
	_g_object_unref0 (self->priv->_game);
	_g_object_unref0 (self->priv->_iagno_instance);
	_g_object_unref0 (self->priv->_theme);
	self->priv->overture_origin_xs = (g_free (self->priv->overture_origin_xs), NULL);
	self->priv->overture_steps = (g_free (self->priv->overture_steps), NULL);
	self->priv->overture_target = (g_free (self->priv->overture_target), NULL);
	_g_object_unref0 (self->priv->last_state);
	self->priv->possible_moves = (g_free (self->priv->possible_moves), NULL);
	G_OBJECT_CLASS (reversi_view_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
reversi_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ReversiViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) reversi_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ReversiView), 0, (GInstanceInitFunc) reversi_view_instance_init, NULL };
	GType reversi_view_type_id;
	reversi_view_type_id = g_type_register_static (gtk_widget_get_type (), "ReversiView", &g_define_type_info, G_TYPE_FLAG_NONE);
	ReversiView_private_offset = g_type_add_instance_private (reversi_view_type_id, sizeof (ReversiViewPrivate));
	return reversi_view_type_id;
}

GType
reversi_view_get_type (void)
{
	static gsize reversi_view_type_id__once = 0;
	if (g_once_init_enter (&reversi_view_type_id__once)) {
		GType reversi_view_type_id;
		reversi_view_type_id = reversi_view_get_type_once ();
		g_once_init_leave (&reversi_view_type_id__once, reversi_view_type_id);
	}
	return reversi_view_type_id__once;
}

static void
_vala_reversi_view_get_property (GObject * object,
                                 guint property_id,
                                 GValue * value,
                                 GParamSpec * pspec)
{
	ReversiView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_REVERSI_VIEW, ReversiView);
	switch (property_id) {
		case REVERSI_VIEW_SHOW_PLAYABLE_TILES_PROPERTY:
		g_value_set_boolean (value, reversi_view_get_show_playable_tiles (self));
		break;
		case REVERSI_VIEW_SHOW_TURNABLE_TILES_PROPERTY:
		g_value_set_boolean (value, reversi_view_get_show_turnable_tiles (self));
		break;
		case REVERSI_VIEW_GAME_PROPERTY:
		g_value_set_object (value, reversi_view_get_game (self));
		break;
		case REVERSI_VIEW_IAGNO_INSTANCE_PROPERTY:
		g_value_set_object (value, reversi_view_get_iagno_instance (self));
		break;
		case REVERSI_VIEW_THEME_PROPERTY:
		g_value_set_object (value, reversi_view_get_theme (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_reversi_view_set_property (GObject * object,
                                 guint property_id,
                                 const GValue * value,
                                 GParamSpec * pspec)
{
	ReversiView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_REVERSI_VIEW, ReversiView);
	switch (property_id) {
		case REVERSI_VIEW_SHOW_PLAYABLE_TILES_PROPERTY:
		reversi_view_set_show_playable_tiles (self, g_value_get_boolean (value));
		break;
		case REVERSI_VIEW_SHOW_TURNABLE_TILES_PROPERTY:
		reversi_view_set_show_turnable_tiles (self, g_value_get_boolean (value));
		break;
		case REVERSI_VIEW_GAME_PROPERTY:
		reversi_view_set_game (self, g_value_get_object (value));
		break;
		case REVERSI_VIEW_IAGNO_INSTANCE_PROPERTY:
		reversi_view_set_iagno_instance (self, g_value_get_object (value));
		break;
		case REVERSI_VIEW_THEME_PROPERTY:
		reversi_view_set_theme (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

