// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/polymost.c
// Function: polymost_drawaux_glcall
static void polymost_drawaux_glcall(GLenum mode, struct polymostdrawauxcall *draw)
{
#ifdef DEBUGGINGAIDS
	polymostcallcounts.drawaux_glcall++;
#endif

	glfunc.glUseProgram(polymostauxglsl.program);

#if (USE_OPENGL == USE_GL3)
    glfunc.glBindVertexArray(polymostauxglsl.vao);
#else
    glfunc.glEnableVertexAttribArray(polymostauxglsl.attrib_vertex);
	glfunc.glEnableVertexAttribArray(polymostauxglsl.attrib_texcoord);
#endif

	glfunc.glBindBuffer(GL_ARRAY_BUFFER, polymostauxglsl.elementbuffer);
	glfunc.glBufferData(GL_ARRAY_BUFFER, draw->elementcount * sizeof(struct polymostvboitem), draw->elementvbo, GL_STREAM_DRAW);

	if (draw->indexes) {
		glfunc.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, polymostauxglsl.indexbuffer);
		glfunc.glBufferData(GL_ELEMENT_ARRAY_BUFFER, draw->indexcount * sizeof(GLushort), draw->indexes, GL_STREAM_DRAW);
	} else {
		glfunc.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementindexbuffer);
		checkindexbuffer(draw->indexcount);
	}

	glfunc.glVertexAttribPointer(polymostauxglsl.attrib_vertex, 3, GL_FLOAT, GL_FALSE,
		sizeof(struct polymostvboitem), (const GLvoid *)offsetof(struct polymostvboitem, v));
	glfunc.glVertexAttribPointer(polymostauxglsl.attrib_texcoord, 2, GL_FLOAT, GL_FALSE,
		sizeof(struct polymostvboitem), (const GLvoid *)offsetof(struct polymostvboitem, t));

	glfunc.glActiveTexture(GL_TEXTURE0);
	glfunc.glBindTexture(GL_TEXTURE_2D, draw->texture0);

	glfunc.glUniform4f(
		polymostauxglsl.uniform_colour,
		draw->colour.r, draw->colour.g, draw->colour.b, draw->colour.a
	);
	glfunc.glUniform4f(
		polymostauxglsl.uniform_bgcolour,
		draw->bgcolour.r, draw->bgcolour.g, draw->bgcolour.b, draw->bgcolour.a
	);
	glfunc.glUniform1i(polymostauxglsl.uniform_mode, draw->mode);

	glfunc.glUniformMatrix4fv(polymostauxglsl.uniform_projection, 1, GL_FALSE, &gorthoprojmat[0][0]);

	glfunc.glUniform1f(polymostauxglsl.uniform_gamma, usegammabrightness == 1 ? curgamma : 1.0);

	glfunc.glDrawElements(mode, draw->indexcount, GL_UNSIGNED_SHORT, 0);

#if (USE_OPENGL == USE_GL3)
    glfunc.glBindVertexArray(0);
#else
	glfunc.glDisableVertexAttribArray(polymostauxglsl.attrib_vertex);
	glfunc.glDisableVertexAttribArray(polymostauxglsl.attrib_texcoord);
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movl %edi, %ebx
leaq 0x5a0260(%rip), %r15    # 0x5f3740
movl 0x5a0532(%rip), %edi    # 0x5f3a18
callq *0x1f0(%r15)
movl 0x5a0531(%rip), %edi    # 0x5f3a24
callq *0x128(%r15)
movl 0x5a0528(%rip), %edi    # 0x5f3a28
callq *0x128(%r15)
movl 0x5a050f(%rip), %esi    # 0x5f3a1c
movl $0x8892, %edi           # imm = 0x8892
callq *0xf8(%r15)
movslq 0x38(%r14), %rax
imulq $0x14, %rax, %rsi
movq 0x40(%r14), %rdx
movl $0x8892, %edi           # imm = 0x8892
movl $0x88e0, %ecx           # imm = 0x88E0
callq *0x100(%r15)
cmpq $0x0, 0x30(%r14)
movq 0xf8(%r15), %rax
je 0x5356f
movl 0x5a04d6(%rip), %esi    # 0x5f3a20
movl $0x8893, %edi           # imm = 0x8893
callq *%rax
movl 0x28(%r14), %esi
addq %rsi, %rsi
movq 0x30(%r14), %rdx
movl $0x8893, %edi           # imm = 0x8893
movl $0x88e0, %ecx           # imm = 0x88E0
callq *0x100(%r15)
jmp 0x53585
movl 0x5a045f(%rip), %esi    # 0x5f39d4
movl $0x8893, %edi           # imm = 0x8893
callq *%rax
movl 0x28(%r14), %edi
callq 0x474b1
movl 0x5a0499(%rip), %edi    # 0x5f3a24
pushq $0x3
popq %rsi
pushq $0x14
popq %rbp
movl $0x1406, %edx           # imm = 0x1406
xorl %ecx, %ecx
movl %ebp, %r8d
xorl %r9d, %r9d
callq *0x138(%r15)
movl 0x5a047d(%rip), %edi    # 0x5f3a28
pushq $0x2
popq %rsi
pushq $0xc
popq %r9
movl $0x1406, %edx           # imm = 0x1406
xorl %ecx, %ecx
movl %ebp, %r8d
callq *0x138(%r15)
movl $0x84c0, %edi           # imm = 0x84C0
callq *0x140(%r15)
movl (%r14), %esi
movl $0xde1, %edi            # imm = 0xDE1
callq *0xc8(%r15)
movl 0x5a0450(%rip), %edi    # 0x5f3a34
movss 0x4(%r14), %xmm0
movss 0x8(%r14), %xmm1
movss 0xc(%r14), %xmm2
movss 0x10(%r14), %xmm3
callq *0x1e0(%r15)
movl 0x5a042f(%rip), %edi    # 0x5f3a38
movss 0x14(%r14), %xmm0
movss 0x18(%r14), %xmm1
movss 0x1c(%r14), %xmm2
movss 0x20(%r14), %xmm3
callq *0x1e0(%r15)
movl 0x5a040e(%rip), %edi    # 0x5f3a3c
movl 0x24(%r14), %esi
callq *0x1c0(%r15)
movl 0x5a03ed(%rip), %edi    # 0x5f3a2c
leaq 0x5a049a(%rip), %rcx    # 0x5f3ae0
pushq $0x1
popq %rsi
xorl %edx, %edx
movq %r15, %r12
callq *0x1e8(%r15)
movl 0x5a03e5(%rip), %edi    # 0x5f3a40
leaq 0x4a12a(%rip), %rax     # 0x9d78c
cmpl $0x1, (%rax)
je 0x53671
movss 0x18965(%rip), %xmm0    # 0x6bfd4
jmp 0x5367c
leaq 0x4a11c(%rip), %rax     # 0x9d794
movss (%rax), %xmm0
callq *0x1c8(%r12)
movl 0x28(%r14), %esi
movl %ebx, %edi
movl $0x1403, %edx           # imm = 0x1403
xorl %ecx, %ecx
callq *0x120(%r12)
movl 0x5a0385(%rip), %edi    # 0x5f3a24
callq *0x130(%r12)
movl 0x5a037b(%rip), %edi    # 0x5f3a28
movq %r12, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmpq *0x130(%rax)