// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/polymost.c
// Function: polymost_drawpoly_glcall
void polymost_drawpoly_glcall(GLenum mode, struct polymostdrawpolycall *draw)
{
#ifdef DEBUGGINGAIDS
	polymostcallcounts.drawpoly_glcall++;
#endif

	glfunc.glUseProgram(polymostglsl.program);

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

	if (draw->elementbuffer > 0) {
		glfunc.glBindBuffer(GL_ARRAY_BUFFER, draw->elementbuffer);
	} else {
		// Drawing from the passed elementvbo items.
		glfunc.glBindBuffer(GL_ARRAY_BUFFER, polymostglsl.elementbuffer);
		glfunc.glBufferData(GL_ARRAY_BUFFER, draw->elementcount * sizeof(struct polymostvboitem), draw->elementvbo, GL_STREAM_DRAW);
	}

	if (draw->indexbuffer > 0) {
		glfunc.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, draw->indexbuffer);
	} else {
		glfunc.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementindexbuffer);
		checkindexbuffer(draw->indexcount);
	}

	glfunc.glVertexAttribPointer(polymostglsl.attrib_vertex, 3, GL_FLOAT, GL_FALSE,
		sizeof(struct polymostvboitem), (const GLvoid *)offsetof(struct polymostvboitem, v));
	glfunc.glVertexAttribPointer(polymostglsl.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.glActiveTexture(GL_TEXTURE1);
	glfunc.glBindTexture(GL_TEXTURE_2D, draw->texture1 ? draw->texture1 : nulltexture);

	glfunc.glUniform1f(polymostglsl.uniform_alphacut, draw->alphacut);

	glfunc.glUniform4f(
		polymostglsl.uniform_colour,
		draw->colour.r, draw->colour.g, draw->colour.b, draw->colour.a
	);
	glfunc.glUniform4f(
		polymostglsl.uniform_fogcolour,
		draw->fogcolour.r, draw->fogcolour.g, draw->fogcolour.b, draw->fogcolour.a
	);
	glfunc.glUniform1f(
		polymostglsl.uniform_fogdensity,
		draw->fogdensity
	);

	glfunc.glUniformMatrix4fv(polymostglsl.uniform_modelview, 1, GL_FALSE, draw->modelview);
	glfunc.glUniformMatrix4fv(polymostglsl.uniform_projection, 1, GL_FALSE, draw->projection);

	glfunc.glUniform1f(polymostglsl.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(polymostglsl.attrib_vertex);
	glfunc.glDisableVertexAttribArray(polymostglsl.attrib_texcoord);
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0x57a18a(%rip), %rax    # 0x5ed710
movq 0x1f0(%rax), %rax
movl 0x57a41d(%rip), %edi    # 0x5ed9b0
callq *%rax
leaq 0x57a174(%rip), %rax    # 0x5ed710
movq 0x128(%rax), %rax
movl 0x57a40f(%rip), %edi    # 0x5ed9b8
callq *%rax
leaq 0x57a15e(%rip), %rax    # 0x5ed710
movq 0x128(%rax), %rax
movl 0x57a3fd(%rip), %edi    # 0x5ed9bc
callq *%rax
movq -0x10(%rbp), %rax
cmpl $0x0, 0x48(%rax)
jbe 0x735e9
leaq 0x57a13e(%rip), %rax    # 0x5ed710
movq 0xf8(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0x48(%rcx), %esi
movl $0x8892, %edi           # imm = 0x8892
callq *%rax
jmp 0x73631
leaq 0x57a120(%rip), %rax    # 0x5ed710
movq 0xf8(%rax), %rax
movl 0x57a3b7(%rip), %esi    # 0x5ed9b4
movl $0x8892, %edi           # imm = 0x8892
callq *%rax
leaq 0x57a105(%rip), %rax    # 0x5ed710
movq 0x100(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0x4c(%rcx), %ecx
imulq $0x14, %rcx, %rsi
movq -0x10(%rbp), %rcx
movq 0x50(%rcx), %rdx
movl $0x8892, %edi           # imm = 0x8892
movl $0x88e0, %ecx           # imm = 0x88E0
callq *%rax
movq -0x10(%rbp), %rax
cmpl $0x0, 0x40(%rax)
jbe 0x73659
leaq 0x57a0ce(%rip), %rax    # 0x5ed710
movq 0xf8(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0x40(%rcx), %esi
movl $0x8893, %edi           # imm = 0x8893
callq *%rax
jmp 0x73680
leaq 0x57a0b0(%rip), %rax    # 0x5ed710
movq 0xf8(%rax), %rax
movl 0x57a337(%rip), %esi    # 0x5ed9a4
movl $0x8893, %edi           # imm = 0x8893
callq *%rax
movq -0x10(%rbp), %rax
movl 0x44(%rax), %edi
callq 0x73910
leaq 0x57a089(%rip), %rax    # 0x5ed710
movq 0x138(%rax), %rax
movl 0x57a324(%rip), %edi    # 0x5ed9b8
movl $0x3, %esi
movl $0x1406, %edx           # imm = 0x1406
xorl %ecx, %ecx
movl $0x14, %r8d
xorl %r9d, %r9d
callq *%rax
leaq 0x57a05e(%rip), %rax    # 0x5ed710
movq 0x138(%rax), %rax
movl 0x57a2fd(%rip), %edi    # 0x5ed9bc
movl $0x2, %esi
movl $0x1406, %edx           # imm = 0x1406
xorl %ecx, %ecx
movl $0x14, %r8d
movl $0xc, %r9d
callq *%rax
movl $0x84c0, %edi           # imm = 0x84C0
leaq 0x57a02b(%rip), %rax    # 0x5ed710
callq *0x140(%rax)
leaq 0x57a01e(%rip), %rax    # 0x5ed710
movq 0xc8(%rax), %rax
movq -0x10(%rbp), %rcx
movl (%rcx), %esi
movl $0xde1, %edi            # imm = 0xDE1
callq *%rax
movl $0x84c1, %edi           # imm = 0x84C1
leaq 0x579ffe(%rip), %rax    # 0x5ed710
callq *0x140(%rax)
leaq 0x579ff1(%rip), %rax    # 0x5ed710
movq 0xc8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0x73740
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x1c(%rbp)
jmp 0x73749
movl 0x57a2d2(%rip), %eax    # 0x5eda18
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %esi
movl $0xde1, %edi            # imm = 0xDE1
callq *%rax
leaq 0x579fb2(%rip), %rax    # 0x5ed710
movq 0x1c8(%rax), %rax
movl 0x57a265(%rip), %edi    # 0x5ed9d0
movq -0x10(%rbp), %rcx
movss 0x8(%rcx), %xmm0
callq *%rax
leaq 0x579f93(%rip), %rax    # 0x5ed710
movq 0x1e0(%rax), %rax
movl 0x57a24a(%rip), %edi    # 0x5ed9d4
movq -0x10(%rbp), %rcx
movss 0xc(%rcx), %xmm0
movq -0x10(%rbp), %rcx
movss 0x10(%rcx), %xmm1
movq -0x10(%rbp), %rcx
movss 0x14(%rcx), %xmm2
movq -0x10(%rbp), %rcx
movss 0x18(%rcx), %xmm3
callq *%rax
leaq 0x579f59(%rip), %rax    # 0x5ed710
movq 0x1e0(%rax), %rax
movl 0x57a214(%rip), %edi    # 0x5ed9d8
movq -0x10(%rbp), %rcx
movss 0x1c(%rcx), %xmm0
movq -0x10(%rbp), %rcx
movss 0x20(%rcx), %xmm1
movq -0x10(%rbp), %rcx
movss 0x24(%rcx), %xmm2
movq -0x10(%rbp), %rcx
movss 0x28(%rcx), %xmm3
callq *%rax
leaq 0x579f1f(%rip), %rax    # 0x5ed710
movq 0x1c8(%rax), %rax
movl 0x57a1de(%rip), %edi    # 0x5ed9dc
movq -0x10(%rbp), %rcx
movss 0x2c(%rcx), %xmm0
callq *%rax
leaq 0x579f00(%rip), %rax    # 0x5ed710
movq 0x1e8(%rax), %rax
movl 0x57a1a3(%rip), %edi    # 0x5ed9c0
movq -0x10(%rbp), %rcx
movq 0x30(%rcx), %rcx
movl $0x1, %esi
xorl %edx, %edx
callq *%rax
leaq 0x579edb(%rip), %rax    # 0x5ed710
movq 0x1e8(%rax), %rax
movl 0x57a182(%rip), %edi    # 0x5ed9c4
movq -0x10(%rbp), %rcx
movq 0x38(%rcx), %rcx
movl $0x1, %esi
xorl %edx, %edx
callq *%rax
leaq 0x579eb6(%rip), %rax    # 0x5ed710
movq 0x1c8(%rax), %rax
movq %rax, -0x28(%rbp)
movl 0x57a175(%rip), %eax    # 0x5ed9e0
movl %eax, -0x20(%rbp)
leaq 0x6d407(%rip), %rax     # 0xe0c7c
cmpl $0x1, (%rax)
jne 0x73890
leaq 0x6d403(%rip), %rax     # 0xe0c84
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x7389f
movsd 0x3e138(%rip), %xmm0    # 0xb19d0
movsd %xmm0, -0x30(%rbp)
jmp 0x7389f
movq -0x28(%rbp), %rax
movl -0x20(%rbp), %edi
movsd -0x30(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
callq *%rax
leaq 0x579e58(%rip), %rax    # 0x5ed710
movq 0x120(%rax), %rax
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rcx
movl 0x44(%rcx), %esi
movl $0x1403, %edx           # imm = 0x1403
xorl %ecx, %ecx
callq *%rax
leaq 0x579e37(%rip), %rax    # 0x5ed710
movq 0x130(%rax), %rax
movl 0x57a0d2(%rip), %edi    # 0x5ed9b8
callq *%rax
leaq 0x579e21(%rip), %rax    # 0x5ed710
movq 0x130(%rax), %rax
movl 0x57a0c0(%rip), %edi    # 0x5ed9bc
callq *%rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)