// File: /workspace/github_c_makefile_star2_O2/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 %rbx
subq $0x28, %rsp
movss %xmm0, -0x10(%rbp)
cmpb $0x0, 0x8d73(%rip)      # 0xb5e1
je 0x2884
movss 0x8d70(%rip), %xmm0     # 0xb5e8
subss %xmm1, %xmm0
movss %xmm0, 0x8d64(%rip)     # 0xb5e8
cmpb $0x0, 0x8d57(%rip)      # 0xb5e2
je 0x28a1
movss 0x8d53(%rip), %xmm0     # 0xb5e8
addss %xmm1, %xmm0
movss %xmm0, 0x8d47(%rip)     # 0xb5e8
cmpb $0x0, 0x8d3b(%rip)      # 0xb5e3
je 0x28be
movss 0x893a(%rip), %xmm0     # 0xb1ec
addss %xmm1, %xmm0
movss %xmm0, 0x892e(%rip)     # 0xb1ec
cmpb $0x0, 0x8d1f(%rip)      # 0xb5e4
je 0x28db
movss 0x891d(%rip), %xmm0     # 0xb1ec
subss %xmm1, %xmm0
movss %xmm0, 0x8911(%rip)     # 0xb1ec
cmpb $0x0, 0x8d03(%rip)      # 0xb5e5
je 0x2941
cvtss2sd 0x8cfc(%rip), %xmm0     # 0xb5e8
callq 0x2160
cvtss2sd -0x10(%rbp), %xmm2
movsd %xmm2, -0x18(%rbp)
cvtss2sd 0x8ce9(%rip), %xmm1     # 0xb5ec
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x8cd5(%rip)     # 0xb5ec
cvtss2sd 0x8cc9(%rip), %xmm0     # 0xb5e8
callq 0x2290
cvtss2sd 0x8cc8(%rip), %xmm1     # 0xb5f4
mulsd -0x18(%rbp), %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x8cb3(%rip)     # 0xb5f4
cmpb $0x0, 0x8c9e(%rip)      # 0xb5e6
je 0x29a7
cvtss2sd 0x8c96(%rip), %xmm0     # 0xb5e8
callq 0x2160
cvtss2sd -0x10(%rbp), %xmm2
movsd %xmm2, -0x18(%rbp)
cvtss2sd 0x8c83(%rip), %xmm1     # 0xb5ec
mulsd %xmm2, %xmm0
subsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm0
movss %xmm0, 0x8c6f(%rip)     # 0xb5ec
cvtss2sd 0x8c63(%rip), %xmm0     # 0xb5e8
callq 0x2290
cvtss2sd 0x8c62(%rip), %xmm1     # 0xb5f4
mulsd -0x18(%rbp), %xmm0
subsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm0
movss %xmm0, 0x8c4d(%rip)     # 0xb5f4
cmpb $0x0, 0x8c39(%rip)      # 0xb5e7
sete %cl
movb 0x8c41(%rip), %al       # 0xb5f8
orb %al, %cl
testb $0x1, %cl
jne 0x29e3
cvtss2sd -0x10(%rbp), %xmm0
cvtss2sd 0x8c25(%rip), %xmm1     # 0xb5f0
mulsd 0x4635(%rip), %xmm0     # 0x7008
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x8c0d(%rip)     # 0xb5f0
testb $0x1, %al
je 0x2a09
movss 0x8c01(%rip), %xmm0     # 0xb5f0
movss 0x4621(%rip), %xmm1     # 0x7018
ucomiss %xmm0, %xmm1
jbe 0x2a09
subss -0x10(%rbp), %xmm0
movss %xmm0, 0x8be7(%rip)     # 0xb5f0
leaq -0x24(%rbp), %rbx
movq %rbx, %rdi
callq 0x2bc4
movss (%rbx), %xmm0
movss 0x4(%rbx), %xmm1
movss %xmm0, 0x8bda(%rip)     # 0xb600
leaq 0x8bd3(%rip), %rdi      # 0xb600
movss 0x87bf(%rip), %xmm0     # 0xb1f4
movss %xmm0, 0x8bc7(%rip)     # 0xb604
movss 0x87b3(%rip), %xmm2     # 0xb1f8
movss %xmm2, 0x8bbb(%rip)     # 0xb608
movss 0x879b(%rip), %xmm3     # 0xb1f0
movss %xmm3, 0x8bbb(%rip)     # 0xb618
movss %xmm1, 0x8bb7(%rip)     # 0xb61c
movss %xmm2, 0x8bb3(%rip)     # 0xb620
movss %xmm3, 0x8bbb(%rip)     # 0xb630
movss %xmm0, 0x8bb7(%rip)     # 0xb634
movss 0x8(%rbx), %xmm0
movss %xmm0, 0x8bae(%rip)     # 0xb638
callq 0x6b32
testb %al, %al
je 0x2a9a
andl $0x0, 0x8b52(%rip)      # 0xb5ec
leaq 0x8b77(%rip), %rdi      # 0xb618
callq 0x6b32
testb %al, %al
je 0x2ab1
andl $0x0, 0x8b3f(%rip)      # 0xb5f0
testb %al, %al
sete 0x8b3e(%rip)            # 0xb5f8
leaq 0x8b6f(%rip), %rdi      # 0xb630
callq 0x6b32
testb %al, %al
je 0x2ad1
andl $0x0, 0x8b23(%rip)      # 0xb5f4
leaq 0x8718(%rip), %rdi      # 0xb1f0
callq 0x2bc4
movss 0x870b(%rip), %xmm0     # 0xb1f0
movss %xmm0, 0x8b5b(%rip)     # 0xb648
movss 0x86ff(%rip), %xmm1     # 0xb1f4
addss 0x451f(%rip), %xmm1     # 0x701c
movss %xmm1, 0x8b47(%rip)     # 0xb64c
movss 0x86eb(%rip), %xmm1     # 0xb1f8
movss %xmm1, 0x8b3b(%rip)     # 0xb650
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x10(%rbp)
cvtss2sd 0x8ac2(%rip), %xmm0     # 0xb5e8
callq 0x2160
addsd -0x10(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x8b18(%rip)     # 0xb654
cvtss2sd 0x8b0c(%rip), %xmm0     # 0xb650
movsd %xmm0, -0x10(%rbp)
cvtss2sd 0x8a97(%rip), %xmm0     # 0xb5e8
callq 0x2290
addsd -0x10(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x8af5(%rip)     # 0xb65c
cvtss2sd 0x8add(%rip), %xmm0     # 0xb64c
movsd %xmm0, -0x10(%rbp)
cvtss2sd 0x8670(%rip), %xmm0     # 0xb1ec
callq 0x2160
addsd -0x10(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x8ac6(%rip)     # 0xb658
xorl %eax, %eax
leaq 0x8a51(%rip), %rcx      # 0xb5ec
movss 0x447d(%rip), %xmm0     # 0x7020
cmpq $0xc, %rax
je 0x2bbd
movss (%rax,%rcx), %xmm1
mulss %xmm0, %xmm1
movss %xmm1, (%rax,%rcx)
addq $0x4, %rax
jmp 0x2ba3
addq $0x28, %rsp
popq %rbx
popq %rbp
retq