// File: /workspace/github_c_makefile_star2_O0/kernfel[P]fNEAT/main.c
// Function: run_trial
int run_trial( pNetwork *controller_structure, struct NEAT_Params *n_params, struct Robot_Params *r_params, TileMaze *maze, int *behaviour ) {
	int err=0;

	struct Implementation_Params i_params = {3};

	eNetwork controller;
	if (( err = create_eNetwork( &controller ) ))
		return err;
	if (( err = build_eNetwork( &controller, controller_structure, n_params, &i_params ) )) {
		delete_eNetwork( &controller );
		return err;
	}

	Robot bot = { 1, 1, 0 };
/*	double sensors[NUM_SENSORS+1], motors[NUM_MOTORS];*/
/*	sensors[NUM_SENSORS] = 1;*/
	double sensors[NUM_SENSORS], motors[NUM_MOTORS];
	int i, tile_counter=0, tile=0, prev_tile;
	for ( i=0; i<20000 && tile_counter < 400; i++ ) {
		get_sensor_readings_in_tilemaze( &bot, maze, r_params, sensors );
		activate( &controller, sensors, motors );
		move_robot_in_tilemaze( &bot, maze, r_params, motors );
		
		prev_tile = tile;
		tile = (int)(bot.x / maze->tile_width) + maze->x*(int)(bot.y / maze->tile_width);
		tile_counter++;
		if ( tile != prev_tile )
			tile_counter = 0;

		++behaviour[tile];
	}
	
	if ( i==tile_counter && bot.x == 1 && bot.y == 1 )
		behaviour[tile] = 0;

	delete_eNetwork( &controller );

	return err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq 0x8a53(%rip), %rax      # 0xa080
movq %rax, -0x40(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x9210
movl %eax, -0x34(%rbp)
cmpl $0x0, %eax
je 0x164d
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x183a
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x78(%rbp), %rdi
leaq -0x40(%rbp), %rcx
callq 0x9330
movl %eax, -0x34(%rbp)
cmpl $0x0, %eax
je 0x167e
leaq -0x78(%rbp), %rdi
callq 0x9280
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x183a
movq 0x8a13(%rip), %rax      # 0xa098
movq %rax, -0x90(%rbp)
movq 0x8a0d(%rip), %rax      # 0xa0a0
movq %rax, -0x88(%rbp)
movq 0x8a07(%rip), %rax      # 0xa0a8
movq %rax, -0x80(%rbp)
movl $0x0, -0xe8(%rbp)
movl $0x0, -0xec(%rbp)
movl $0x0, -0xe4(%rbp)
xorl %eax, %eax
cmpl $0x4e20, -0xe4(%rbp)    # imm = 0x4E20
movb %al, -0xf1(%rbp)
jge 0x16ea
cmpl $0x190, -0xe8(%rbp)     # imm = 0x190
setl %al
movb %al, -0xf1(%rbp)
movb -0xf1(%rbp), %al
testb $0x1, %al
jne 0x16f9
jmp 0x17db
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0xc0(%rbp), %rcx
leaq -0x90(%rbp), %rdi
callq 0x8d30
leaq -0xc0(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
leaq -0x78(%rbp), %rdi
callq 0x97b0
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0xe0(%rbp), %rcx
leaq -0x90(%rbp), %rdi
callq 0x8250
movl -0xec(%rbp), %eax
movl %eax, -0xf0(%rbp)
movsd -0x90(%rbp), %xmm0
movq -0x28(%rbp), %rax
divsd (%rax), %xmm0
cvttsd2si %xmm0, %eax
movq -0x28(%rbp), %rcx
movl 0x8(%rcx), %ecx
movsd -0x88(%rbp), %xmm0
movq -0x28(%rbp), %rdx
divsd (%rdx), %xmm0
cvttsd2si %xmm0, %edx
imull %edx, %ecx
addl %ecx, %eax
movl %eax, -0xec(%rbp)
movl -0xe8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe8(%rbp)
movl -0xec(%rbp), %eax
cmpl -0xf0(%rbp), %eax
je 0x17b3
movl $0x0, -0xe8(%rbp)
movq -0x30(%rbp), %rax
movslq -0xec(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0xe4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe4(%rbp)
jmp 0x16c3
movl -0xe4(%rbp), %eax
cmpl -0xe8(%rbp), %eax
jne 0x182b
movsd -0x90(%rbp), %xmm0
movsd 0x886f(%rip), %xmm1     # 0xa068
ucomisd %xmm1, %xmm0
jne 0x182b
jp 0x182b
movsd -0x88(%rbp), %xmm0
movsd 0x8857(%rip), %xmm1     # 0xa068
ucomisd %xmm1, %xmm0
jne 0x182b
jp 0x182b
movq -0x30(%rbp), %rax
movslq -0xec(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
leaq -0x78(%rbp), %rdi
callq 0x9280
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw %cs:(%rax,%rax)