// File: /workspace/github_c_makefile_star2_O2/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, %edi
cvttss2si %xmm1, %esi
cvttss2si %xmm2, %r15d
pushq $0x4
popq %rcx
movl %edi, -0x30(%rbp)
movl %esi, -0x2c(%rbp)
movl %r15d, %edx
callq 0x5894
leaq 0x5fcc(%rip), %r12      # 0xb938
movl $0xb71, %edi            # imm = 0xB71
callq *(%r12)
movl $0xb44, %edi            # imm = 0xB44
callq *(%r12)
leaq 0x665b(%rip), %rax      # 0xbfe0
movl 0x68f5(%rip), %edi      # 0xc280
callq *(%rax)
leaq 0x5dfc(%rip), %rax      # 0xb790
movss 0x32a8(%rip), %xmm0     # 0x8c44
movss 0x32a4(%rip), %xmm1     # 0x8c48
movss 0x32a0(%rip), %xmm2     # 0x8c4c
movss 0x1664(%rip), %xmm3     # 0x7018
callq *(%rax)
leaq 0x5dab(%rip), %rax      # 0xb768
movl $0x4100, %edi           # imm = 0x4100
callq *(%rax)
leaq 0x65f5(%rip), %rax      # 0xbfc0
movl 0x68c3(%rip), %edi      # 0xc294
leaq 0x6948(%rip), %rcx      # 0xc320
pushq $0x1
popq %rsi
xorl %r13d, %r13d
xorl %edx, %edx
callq *(%rax)
leaq 0x6987(%rip), %r12      # 0xc370
cmpq $0x1c00, %r13           # imm = 0x1C00
je 0x5a93
cmpb $0x0, 0x18(%r13,%r12)
je 0x5a8a
leaq (%r12,%r13), %rdi
movl -0x30(%rbp), %esi
movl -0x2c(%rbp), %edx
movl %r15d, %ecx
pushq $0x4
popq %r8
callq 0x5aba
testb %al, %al
je 0x5a8a
movl 0x686e(%rip), %edi      # 0xc290
pushq $0x1
popq %rsi
xorl %edx, %edx
leaq 0x68b2(%rip), %rcx      # 0xc2e0
leaq 0x658b(%rip), %rax      # 0xbfc0
callq *(%rax)
movl $0x84c0, %edi           # imm = 0x84C0
leaq 0x5c55(%rip), %rax      # 0xb698
callq *(%rax)
movl 0x6915(%rip), %esi      # 0xc360
movl $0xde1, %edi            # imm = 0xDE1
leaq 0x5cb1(%rip), %rbx      # 0xb708
callq *(%rbx)
movl (%r13,%r12), %edi
leaq 0x5cab(%rip), %r14      # 0xb710
callq *(%r14)
imull $0x6, 0x8(%r13,%r12), %edx
pushq $0x4
popq %rdi
xorl %esi, %esi
leaq 0x5e6e(%rip), %rax      # 0xb8e8
callq *(%rax)
xorl %edi, %edi
callq *(%r14)
movl $0xde1, %edi            # imm = 0xDE1
xorl %esi, %esi
callq *(%rbx)
addq $0x1c, %r13
jmp 0x59e9
xorl %edi, %edi
leaq 0x6544(%rip), %rax      # 0xbfe0
callq *(%rax)
leaq 0x5e2b(%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)