// File: /workspace/github_c_makefile_star2_O0/kernfel[P]fNEAT/robot-simplistic.c
// Function: get_sensor_readings_in_room
void get_sensor_readings_in_room( Robot *bot, Room *room, struct Robot_Params *params, double *sensor_inputs ) {
	// Calculate sensor data
	int i;
	double s_length = params->dist_sensor_length + params->radius;
	for ( i=0; i<params->num_dist_sensors; i++ ) {
		double s_x = cos(bot->heading + params->dist_sensor_pos[i]) * s_length;
		double s_y = sin(bot->heading + params->dist_sensor_pos[i]) * s_length;
		double depth_x=0, depth_y=0;
		if ( bot->x + s_x < 0 )
			depth_x = -(bot->x + s_x) / s_x;
		else if ( bot->x + s_x > room->x )
			depth_x = (bot->x + s_x - room->x) / s_x;
		if ( bot->y + s_y < 0 )
			depth_y = -(bot->y + s_y) / s_y;
		else if ( bot->y + s_y > room->y )
			depth_y = (bot->y + s_y - room->y) / s_y;
		double reading = max(depth_x, depth_y) * s_length / params->dist_sensor_length;
		sensor_inputs[i] = params->invert_dist_sensors ? 1-reading : reading;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movsd 0x30(%rax), %xmm0
movq -0x18(%rbp), %rax
addsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jge 0x823e
movq -0x8(%rbp), %rax
movsd 0x10(%rax), %xmm0
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x24(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
callq 0x1090
mulsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movq -0x8(%rbp), %rax
movsd 0x10(%rax), %xmm0
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x24(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
callq 0x1140
mulsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x48(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x8(%rbp), %rax
movsd (%rax), %xmm1
addsd -0x38(%rbp), %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x80fd
movq -0x8(%rbp), %rax
movsd (%rax), %xmm0
addsd -0x38(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
divsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
jmp 0x8135
movq -0x8(%rbp), %rax
movsd (%rax), %xmm0
addsd -0x38(%rbp), %xmm0
movq -0x10(%rbp), %rax
ucomisd (%rax), %xmm0
jbe 0x8133
movq -0x8(%rbp), %rax
movsd (%rax), %xmm0
addsd -0x38(%rbp), %xmm0
movq -0x10(%rbp), %rax
subsd (%rax), %xmm0
divsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
jmp 0x8135
movq -0x8(%rbp), %rax
movsd 0x8(%rax), %xmm1
addsd -0x40(%rbp), %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x817d
movq -0x8(%rbp), %rax
movsd 0x8(%rax), %xmm0
addsd -0x40(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
divsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
jmp 0x81b9
movq -0x8(%rbp), %rax
movsd 0x8(%rax), %xmm0
addsd -0x40(%rbp), %xmm0
movq -0x10(%rbp), %rax
ucomisd 0x8(%rax), %xmm0
jbe 0x81b7
movq -0x8(%rbp), %rax
movsd 0x8(%rax), %xmm0
addsd -0x40(%rbp), %xmm0
movq -0x10(%rbp), %rax
subsd 0x8(%rax), %xmm0
divsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
jmp 0x81b9
movsd -0x48(%rbp), %xmm0
ucomisd -0x50(%rbp), %xmm0
jbe 0x81d1
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
jmp 0x81db
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x60(%rbp), %xmm0
mulsd -0x30(%rbp), %xmm0
movq -0x18(%rbp), %rax
divsd 0x30(%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x40(%rax), %eax
cmpl $0x0, %eax
je 0x8214
movsd 0x1e60(%rip), %xmm0     # 0xa068
subsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
jmp 0x821e
movsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x68(%rbp), %xmm0
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x8045
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)