// File: /workspace/github_c_makefile_star2_O1/k0n10pl4tr[P]minimal_crafter/main.c
// Function: processCamera
void
processCamera(float cameraMoveSpeed, float cameraRotateSpeed)
{
	if(keyLeft) cameraYaw -= cameraRotateSpeed;
	if(keyRight) cameraYaw += cameraRotateSpeed;
	if(keyUp) cameraPitch += cameraRotateSpeed;
	if(keyDown) cameraPitch -= cameraRotateSpeed;

	if(keyFront) { 
		velocity[0] += cos(cameraYaw) * cameraMoveSpeed;
		velocity[2] += sin(cameraYaw) * cameraMoveSpeed;
	}

	if(keyBack) { 
		velocity[0] -= cos(cameraYaw) * cameraMoveSpeed;
		velocity[2] -= sin(cameraYaw) * cameraMoveSpeed;
	}
	
	if(keySpace && !cameraFalling) 
		velocity[1] += cameraMoveSpeed * 50.0;
	
	if(cameraFalling && velocity[1] < 1.0)
		velocity[1] -= cameraMoveSpeed * 1.0;


	vec3 nextPosition;
	vec3_add(nextPosition, cameraPosition, velocity); 
	
	cameraCollisor[0].x = nextPosition[0];
	cameraCollisor[0].y = cameraPosition[1]; 
	cameraCollisor[0].z = cameraPosition[2];

	cameraCollisor[1].x = cameraPosition[0];
	cameraCollisor[1].y = nextPosition[1]; 
	cameraCollisor[1].z = cameraPosition[2];

	cameraCollisor[2].x = cameraPosition[0];
	cameraCollisor[2].y = cameraPosition[1]; 
	cameraCollisor[2].z = nextPosition[2];

	if(checkCollisionWorld(&cameraCollisor[0])) {
		velocity[0] = 0.0;
	}

	if(checkCollisionWorld(&cameraCollisor[1])) {
		cameraFalling = 0;
		velocity[1] = 0.0;
	} else {
		cameraFalling = 1;
	}

	if(checkCollisionWorld(&cameraCollisor[2])) {
		velocity[2] = 0.0;
	}
	
	vec3_add(cameraPosition, cameraPosition, velocity);
	
	cameraEye[0] = cameraPosition[0];
	cameraEye[1] = cameraPosition[1] + cameraHeight;
	cameraEye[2] = cameraPosition[2];
	
	cameraLook[0] = cameraEye[0] + cos(cameraYaw);
	cameraLook[2] = cameraEye[2] + sin(cameraYaw);
	cameraLook[1] = cameraEye[1] + cos(cameraPitch);

	vec3_scale(velocity, velocity, 0.9f);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movss %xmm0, -0x18(%rbp)
cmpb $0x0, 0x8d45(%rip)      # 0xb5e1
je 0x28b2
movss 0x8d42(%rip), %xmm0     # 0xb5e8
subss %xmm1, %xmm0
movss %xmm0, 0x8d36(%rip)     # 0xb5e8
cmpb $0x0, 0x8d29(%rip)      # 0xb5e2
je 0x28cf
movss 0x8d25(%rip), %xmm0     # 0xb5e8
addss %xmm1, %xmm0
movss %xmm0, 0x8d19(%rip)     # 0xb5e8
cmpb $0x0, 0x8d0d(%rip)      # 0xb5e3
je 0x28ec
movss 0x890c(%rip), %xmm0     # 0xb1ec
addss %xmm1, %xmm0
movss %xmm0, 0x8900(%rip)     # 0xb1ec
cmpb $0x0, 0x8cf1(%rip)      # 0xb5e4
je 0x2909
movss 0x88ef(%rip), %xmm0     # 0xb1ec
subss %xmm1, %xmm0
movss %xmm0, 0x88e3(%rip)     # 0xb1ec
cmpb $0x0, 0x8cd5(%rip)      # 0xb5e5
je 0x297b
xorps %xmm0, %xmm0
cvtss2sd 0x8ccb(%rip), %xmm0     # 0xb5e8
callq 0x2160
cvtss2sd -0x18(%rbp), %xmm2
movsd %xmm2, -0x20(%rbp)
xorps %xmm1, %xmm1
cvtss2sd 0x8cb5(%rip), %xmm1     # 0xb5ec
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x8ca1(%rip)     # 0xb5ec
xorps %xmm0, %xmm0
cvtss2sd 0x8c92(%rip), %xmm0     # 0xb5e8
callq 0x2290
xorps %xmm1, %xmm1
cvtss2sd 0x8c8e(%rip), %xmm1     # 0xb5f4
mulsd -0x20(%rbp), %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x8c79(%rip)     # 0xb5f4
cmpb $0x0, 0x8c64(%rip)      # 0xb5e6
je 0x29f6
xorps %xmm0, %xmm0
cvtss2sd 0x8c59(%rip), %xmm0     # 0xb5e8
callq 0x2160
xorps %xmm2, %xmm2
cvtss2sd -0x18(%rbp), %xmm2
movsd %xmm2, -0x20(%rbp)
xorps %xmm1, %xmm1
cvtss2sd 0x8c40(%rip), %xmm1     # 0xb5ec
mulsd %xmm2, %xmm0
subsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movss %xmm0, 0x8c29(%rip)     # 0xb5ec
xorps %xmm0, %xmm0
cvtss2sd 0x8c1a(%rip), %xmm0     # 0xb5e8
callq 0x2290
xorps %xmm1, %xmm1
cvtss2sd 0x8c16(%rip), %xmm1     # 0xb5f4
mulsd -0x20(%rbp), %xmm0
subsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movss %xmm0, 0x8bfe(%rip)     # 0xb5f4
cmpb $0x0, 0x8bea(%rip)      # 0xb5e7
sete %cl
movb 0x8bf2(%rip), %al       # 0xb5f8
orb %al, %cl
testb $0x1, %cl
jne 0x2a38
xorps %xmm0, %xmm0
cvtss2sd -0x18(%rbp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x8bd0(%rip), %xmm1     # 0xb5f0
mulsd 0x45e0(%rip), %xmm0     # 0x7008
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x8bb8(%rip)     # 0xb5f0
testb $0x1, %al
je 0x2a5e
movss 0x8bac(%rip), %xmm0     # 0xb5f0
movss 0x45cc(%rip), %xmm1     # 0x7018
ucomiss %xmm0, %xmm1
jbe 0x2a5e
subss -0x18(%rbp), %xmm0
movss %xmm0, 0x8b92(%rip)     # 0xb5f0
xorl %eax, %eax
leaq 0x8789(%rip), %r14      # 0xb1f0
leaq 0x8b7e(%rip), %rbx      # 0xb5ec
movss (%rax,%r14), %xmm0
addss (%rax,%rbx), %xmm0
movss %xmm0, -0x2c(%rbp,%rax)
addq $0x4, %rax
cmpq $0xc, %rax
jne 0x2a6e
movss -0x2c(%rbp), %xmm0
movss -0x28(%rbp), %xmm1
movss %xmm0, 0x8b65(%rip)     # 0xb600
leaq 0x8b5e(%rip), %rdi      # 0xb600
movss 0x874a(%rip), %xmm0     # 0xb1f4
movss %xmm0, 0x8b52(%rip)     # 0xb604
movss 0x873e(%rip), %xmm2     # 0xb1f8
movss %xmm2, 0x8b46(%rip)     # 0xb608
movss 0x8726(%rip), %xmm3     # 0xb1f0
movss %xmm3, 0x8b46(%rip)     # 0xb618
movss %xmm1, 0x8b42(%rip)     # 0xb61c
movss %xmm2, 0x8b3e(%rip)     # 0xb620
movss %xmm3, 0x8b46(%rip)     # 0xb630
movss %xmm0, 0x8b42(%rip)     # 0xb634
movss -0x24(%rbp), %xmm0
movss %xmm0, 0x8b39(%rip)     # 0xb638
callq 0x6c7e
testb %al, %al
je 0x2b12
movl $0x0, 0x8ada(%rip)      # 0xb5ec
leaq 0x8aff(%rip), %rdi      # 0xb618
callq 0x6c7e
testb %al, %al
je 0x2b35
movb $0x0, 0x8acf(%rip)      # 0xb5f8
movl $0x0, 0x8abd(%rip)      # 0xb5f0
jmp 0x2b3c
movb $0x1, 0x8abc(%rip)      # 0xb5f8
leaq 0x8aed(%rip), %rdi      # 0xb630
callq 0x6c7e
testb %al, %al
je 0x2b56
movl $0x0, 0x8a9e(%rip)      # 0xb5f4
xorl %eax, %eax
movss (%rax,%r14), %xmm0
addss (%rax,%rbx), %xmm0
movss %xmm0, (%rax,%r14)
addq $0x4, %rax
cmpq $0xc, %rax
jne 0x2b58
movss 0x8675(%rip), %xmm0     # 0xb1f0
movss %xmm0, 0x8ac5(%rip)     # 0xb648
movss 0x8669(%rip), %xmm1     # 0xb1f4
addss 0x4489(%rip), %xmm1     # 0x701c
movss %xmm1, 0x8ab1(%rip)     # 0xb64c
movss 0x8655(%rip), %xmm1     # 0xb1f8
movss %xmm1, 0x8aa5(%rip)     # 0xb650
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x18(%rbp)
xorps %xmm0, %xmm0
cvtss2sd 0x8a29(%rip), %xmm0     # 0xb5e8
callq 0x2160
addsd -0x18(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x8a7f(%rip)     # 0xb654
xorps %xmm0, %xmm0
cvtss2sd 0x8a70(%rip), %xmm0     # 0xb650
movsd %xmm0, -0x18(%rbp)
xorps %xmm0, %xmm0
cvtss2sd 0x89f8(%rip), %xmm0     # 0xb5e8
callq 0x2290
addsd -0x18(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x8a56(%rip)     # 0xb65c
xorps %xmm0, %xmm0
cvtss2sd 0x8a3b(%rip), %xmm0     # 0xb64c
movsd %xmm0, -0x18(%rbp)
xorps %xmm0, %xmm0
cvtss2sd 0x85cb(%rip), %xmm0     # 0xb1ec
callq 0x2160
addsd -0x18(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x8a21(%rip)     # 0xb658
xorl %eax, %eax
movss 0x43df(%rip), %xmm0     # 0x7020
movss (%rax,%rbx), %xmm1
mulss %xmm0, %xmm1
movss %xmm1, (%rax,%rbx)
addq $0x4, %rax
cmpq $0xc, %rax
jne 0x2c41
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq