// File: /workspace/github_c_makefile_star2_O1/k0n10pl4tr[P]minimal_crafter/rendering.c
// Function: render
void
render(float camX, float camY, float camZ)
{
	generateChunkModelAroundPos(camX, camY, camZ, NUM_CHUNKS_RENDER);
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_CULL_FACE);

	glUseProgram(cubeRenderingShader);
	glClearColor(0.2, 0.3, 0.7, 1.0);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	
	glUniformMatrix4fv(cubeUniformViewLocation, 1, GL_FALSE, &viewMatrix[0][0]);
	for(unsigned int i = 0; i < NUM_CHUNK_CACHED; i++) {
		if(chunkCached[i].canDraw && isChunkInsideRenderBoundry(&chunkCached[i], camX, camY, camZ, 4)) {
			glUniformMatrix4fv(cubeUniformModelLocation, 1, GL_FALSE, &modelMatrix[0][0]);

			glActiveTexture(GL_TEXTURE0);
			glBindTexture(GL_TEXTURE_2D, cubeTerrainTexture);	
			glBindVertexArray(chunkCached[i].vao);
			glDrawArrays(GL_TRIANGLES, 0, chunkCached[i].faces * 6);
			glBindVertexArray(0);
			glBindTexture(GL_TEXTURE_2D, 0);
		}
	}

	glUseProgram(0);
	glDisable(GL_DEPTH_TEST);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cvttss2si %xmm0, %r15d
cvttss2si %xmm1, %ebx
cvttss2si %xmm2, %r14d
movl %r15d, %edi
movl %ebx, %esi
movl %r14d, %edx
movl $0x4, %ecx
callq 0x5847
leaq 0x5ff3(%rip), %r12      # 0xb938
movl $0xb71, %edi            # imm = 0xB71
callq *(%r12)
movl $0xb44, %edi            # imm = 0xB44
callq *(%r12)
leaq 0x6682(%rip), %rax      # 0xbfe0
movl 0x691c(%rip), %edi      # 0xc280
callq *(%rax)
leaq 0x5e23(%rip), %rax      # 0xb790
movss 0x32cf(%rip), %xmm0     # 0x8c44
movss 0x32cb(%rip), %xmm1     # 0x8c48
movss 0x32c7(%rip), %xmm2     # 0x8c4c
movss 0x168b(%rip), %xmm3     # 0x7018
callq *(%rax)
leaq 0x5dd2(%rip), %rax      # 0xb768
movl $0x4100, %edi           # imm = 0x4100
callq *(%rax)
leaq 0x661c(%rip), %rax      # 0xbfc0
movl 0x68ea(%rip), %edi      # 0xc294
leaq 0x696f(%rip), %rcx      # 0xc320
movl $0x1, %esi
xorl %edx, %edx
callq *(%rax)
leal 0xf(%r15), %r12d
testl %r15d, %r15d
cmovnsl %r15d, %r12d
sarl $0x4, %r12d
negl %r12d
leal 0xf(%r14), %esi
testl %r14d, %r14d
cmovnsl %r14d, %esi
sarl $0x4, %esi
negl %esi
leal 0xf(%rbx), %edi
testl %ebx, %ebx
cmovnsl %ebx, %edi
sarl $0x4, %edi
negl %edi
movl $0x18, %r13d
leaq 0x697a(%rip), %rbx      # 0xc370
movl %edi, -0x2c(%rbp)
cmpb $0x0, (%r13,%rbx)
je 0x5ad1
movl -0xc(%r13,%rbx), %eax
addl %r12d, %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
cmpl $0x3, %ecx
ja 0x5ad1
movl -0x4(%r13,%rbx), %ecx
addl %esi, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
movl -0x8(%r13,%rbx), %ecx
addl %edi, %ecx
movl %ecx, %edx
negl %edx
cmovsl %ecx, %edx
cmpl $0x3, %edx
ja 0x5ad1
cmpl $0x3, %eax
ja 0x5ad1
movl 0x683f(%rip), %edi      # 0xc290
movl %esi, %r14d
movl $0x1, %esi
xorl %edx, %edx
leaq 0x687e(%rip), %rcx      # 0xc2e0
leaq 0x6557(%rip), %rax      # 0xbfc0
callq *(%rax)
movl $0x84c0, %edi           # imm = 0x84C0
leaq 0x5c21(%rip), %rax      # 0xb698
callq *(%rax)
movl 0x68e1(%rip), %esi      # 0xc360
movl $0xde1, %edi            # imm = 0xDE1
leaq 0x5c7d(%rip), %rax      # 0xb708
callq *(%rax)
movl -0x18(%r13,%rbx), %edi
leaq 0x5c77(%rip), %r15      # 0xb710
callq *(%r15)
movl -0x10(%r13,%rbx), %eax
addl %eax, %eax
leal (%rax,%rax,2), %edx
movl $0x4, %edi
xorl %esi, %esi
leaq 0x5e34(%rip), %rax      # 0xb8e8
callq *(%rax)
xorl %edi, %edi
callq *(%r15)
movl $0xde1, %edi            # imm = 0xDE1
xorl %esi, %esi
leaq 0x5c3f(%rip), %rax      # 0xb708
callq *(%rax)
movl -0x2c(%rbp), %edi
movl %r14d, %esi
addq $0x1c, %r13
cmpq $0x1c18, %r13           # imm = 0x1C18
jne 0x59f9
xorl %edi, %edi
leaq 0x64f5(%rip), %rax      # 0xbfe0
callq *(%rax)
leaq 0x5ddc(%rip), %rax      # 0xb8d0
movl $0xb71, %edi            # imm = 0xB71
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *(%rax)