// File: /workspace/github_c_makefile_star2_O3/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 0x583a
leaq 0x6000(%rip), %r12      # 0xb938
movl $0xb71, %edi            # imm = 0xB71
callq *(%r12)
movl $0xb44, %edi            # imm = 0xB44
callq *(%r12)
leaq 0x668f(%rip), %rax      # 0xbfe0
movl 0x6929(%rip), %edi      # 0xc280
callq *(%rax)
leaq 0x5e30(%rip), %rax      # 0xb790
movss 0x32dc(%rip), %xmm0     # 0x8c44
movss 0x32d8(%rip), %xmm1     # 0x8c48
movss 0x32d4(%rip), %xmm2     # 0x8c4c
movss 0x1698(%rip), %xmm3     # 0x7018
callq *(%rax)
leaq 0x5ddf(%rip), %rax      # 0xb768
movl $0x4100, %edi           # imm = 0x4100
callq *(%rax)
leaq 0x6629(%rip), %rax      # 0xbfc0
movl 0x68f7(%rip), %edi      # 0xc294
leaq 0x697c(%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 0x6987(%rip), %rbx      # 0xc370
movl %edi, -0x2c(%rbp)
cmpb $0x0, (%r13,%rbx)
je 0x5ac4
movl -0xc(%r13,%rbx), %eax
addl %r12d, %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
cmpl $0x3, %ecx
ja 0x5ac4
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 0x5ac4
cmpl $0x3, %eax
ja 0x5ac4
movl 0x684c(%rip), %edi      # 0xc290
movl %esi, %r14d
movl $0x1, %esi
xorl %edx, %edx
leaq 0x688b(%rip), %rcx      # 0xc2e0
leaq 0x6564(%rip), %rax      # 0xbfc0
callq *(%rax)
movl $0x84c0, %edi           # imm = 0x84C0
leaq 0x5c2e(%rip), %rax      # 0xb698
callq *(%rax)
movl 0x68ee(%rip), %esi      # 0xc360
movl $0xde1, %edi            # imm = 0xDE1
leaq 0x5c8a(%rip), %rax      # 0xb708
callq *(%rax)
movl -0x18(%r13,%rbx), %edi
leaq 0x5c84(%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 0x5e41(%rip), %rax      # 0xb8e8
callq *(%rax)
xorl %edi, %edi
callq *(%r15)
movl $0xde1, %edi            # imm = 0xDE1
xorl %esi, %esi
leaq 0x5c4c(%rip), %rax      # 0xb708
callq *(%rax)
movl -0x2c(%rbp), %edi
movl %r14d, %esi
addq $0x1c, %r13
cmpq $0x1c18, %r13           # imm = 0x1C18
jne 0x59ec
xorl %edi, %edi
leaq 0x6502(%rip), %rax      # 0xbfe0
callq *(%rax)
leaq 0x5de9(%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)