// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/polymost.c
// Function: polymost_glreset
void polymost_glreset (void)
{
	//Reset if this is -1 (meaning 1st texture call ever), or > 0 (textures in memory)
	if (gltexcacnum < 0)
	{
		gltexcacnum = 0;

			//Hack for polymost_dorotatesprite calls before 1st polymost_drawrooms()
		gcosang = gcosang2 = ((double)16384)/262144.0;
		gsinang = gsinang2 = ((double)    0)/262144.0;
	}
	else
	{
		PTReset();
		clearskins();
	}

	glox1 = -1;
	lastglpolygonmode = -1;
	lastglredbluemode = -1;

	if (glfunc.glUseProgram) {
		glfunc.glUseProgram(0);
#if (USE_OPENGL == USE_GL3)
		glfunc.glBindVertexArray(0);
#endif
		glfunc.glBindBuffer(GL_ARRAY_BUFFER, 0);
		glfunc.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
	}

	if (elementindexbuffer) {
		glfunc.glDeleteBuffers(1, &elementindexbuffer);
		elementindexbuffersize = 0;
		elementindexbuffer = 0;
	}

#if (USE_OPENGL == USE_GL3)
	if (polymostglsl.vao) {
		glfunc.glDeleteVertexArrays(1, &polymostglsl.vao);
		polymostglsl.vao = 0;
	}
#endif
	if (polymostglsl.elementbuffer) {
		glfunc.glDeleteBuffers(1, &polymostglsl.elementbuffer);
		polymostglsl.elementbuffer = 0;
	}
	if (polymostglsl.program) {
		glfunc.glDeleteProgram(polymostglsl.program);
		polymostglsl.program = 0;
	}

#if (USE_OPENGL == USE_GL3)
	if (polymostauxglsl.vao) {
		glfunc.glDeleteVertexArrays(1, &polymostauxglsl.vao);
		polymostauxglsl.vao = 0;
	}
#endif
	if (polymostauxglsl.indexbuffer) {
		glfunc.glDeleteBuffers(1, &polymostauxglsl.indexbuffer);
		polymostauxglsl.indexbuffer = 0;
	}
	if (polymostauxglsl.elementbuffer) {
		glfunc.glDeleteBuffers(1, &polymostauxglsl.elementbuffer);
		polymostauxglsl.elementbuffer = 0;
	}
	if (polymostauxglsl.program) {
		glfunc.glDeleteProgram(polymostauxglsl.program);
		polymostauxglsl.program = 0;
	}

	if (texttexture) {
		glfunc.glDeleteTextures(1, &texttexture);
		texttexture = 0;
	}

	if (nulltexture) {
		glfunc.glDeleteTextures(1, &nulltexture);
		nulltexture = 0;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x0, 0x6f291(%rip)     # 0xe1bcc
jge 0x7297f
movl $0x0, 0x6f285(%rip)     # 0xe1bcc
movsd 0x43af9(%rip), %xmm0    # 0xb6448
movsd %xmm0, 0x57b021(%rip)   # 0x5ed978
movsd 0x43ae9(%rip), %xmm0    # 0xb6448
movsd %xmm0, 0x57b019(%rip)   # 0x5ed980
xorps %xmm0, %xmm0
movsd %xmm0, 0x57b016(%rip)   # 0x5ed988
xorps %xmm0, %xmm0
movsd %xmm0, 0x57b013(%rip)   # 0x5ed990
jmp 0x72989
callq 0x9a650
callq 0x8e970
movss 0x3f767(%rip), %xmm0    # 0xb20f8
movss %xmm0, 0x57afff(%rip)   # 0x5ed998
movl $0xffffffff, 0x57aff9(%rip) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x57aff3(%rip) # imm = 0xFFFFFFFF
leaq 0x57ad5c(%rip), %rax    # 0x5ed710
cmpq $0x0, 0x1f0(%rax)
je 0x729f5
xorl %edi, %edi
leaq 0x57ad49(%rip), %rax    # 0x5ed710
callq *0x1f0(%rax)
movl $0x8892, %edi           # imm = 0x8892
xorl %esi, %esi
leaq 0x57ad35(%rip), %rax    # 0x5ed710
callq *0xf8(%rax)
movl $0x8893, %edi           # imm = 0x8893
xorl %esi, %esi
leaq 0x57ad21(%rip), %rax    # 0x5ed710
callq *0xf8(%rax)
cmpl $0x0, 0x57afa8(%rip)    # 0x5ed9a4
je 0x72a2b
movl $0x1, %edi
leaq 0x57af9a(%rip), %rsi    # 0x5ed9a4
leaq 0x57acff(%rip), %rax    # 0x5ed710
callq *0x110(%rax)
movl $0x0, 0x57af87(%rip)    # 0x5ed9a8
movl $0x0, 0x57af79(%rip)    # 0x5ed9a4
cmpl $0x0, 0x57af82(%rip)    # 0x5ed9b4
je 0x72a5b
movl $0x1, %edi
leaq 0x57af6c(%rip), %rsi    # 0x5ed9ac
addq $0x8, %rsi
leaq 0x57acc5(%rip), %rax    # 0x5ed710
callq *0x110(%rax)
movl $0x0, 0x57af59(%rip)    # 0x5ed9b4
cmpl $0x0, 0x57af4e(%rip)    # 0x5ed9b0
je 0x72a84
leaq 0x57aca5(%rip), %rax    # 0x5ed710
movq 0x168(%rax), %rax
movl 0x57af38(%rip), %edi    # 0x5ed9b0
callq *%rax
movl $0x0, 0x57af2c(%rip)    # 0x5ed9b0
cmpl $0x0, 0x57af65(%rip)    # 0x5ed9f0
je 0x72ab4
movl $0x1, %edi
leaq 0x57af4b(%rip), %rsi    # 0x5ed9e4
addq $0xc, %rsi
leaq 0x57ac6c(%rip), %rax    # 0x5ed710
callq *0x110(%rax)
movl $0x0, 0x57af3c(%rip)    # 0x5ed9f0
cmpl $0x0, 0x57af31(%rip)    # 0x5ed9ec
je 0x72ae4
movl $0x1, %edi
leaq 0x57af1b(%rip), %rsi    # 0x5ed9e4
addq $0x8, %rsi
leaq 0x57ac3c(%rip), %rax    # 0x5ed710
callq *0x110(%rax)
movl $0x0, 0x57af08(%rip)    # 0x5ed9ec
cmpl $0x0, 0x57aefd(%rip)    # 0x5ed9e8
je 0x72b0d
leaq 0x57ac1c(%rip), %rax    # 0x5ed710
movq 0x168(%rax), %rax
movl 0x57aee7(%rip), %edi    # 0x5ed9e8
callq *%rax
movl $0x0, 0x57aedb(%rip)    # 0x5ed9e8
cmpl $0x0, 0x57af00(%rip)    # 0x5eda14
je 0x72b39
movl $0x1, %edi
leaq 0x57aef2(%rip), %rsi    # 0x5eda14
leaq 0x57abe7(%rip), %rax    # 0x5ed710
callq *0xc0(%rax)
movl $0x0, 0x57aedb(%rip)    # 0x5eda14
cmpl $0x0, 0x57aed8(%rip)    # 0x5eda18
je 0x72b65
movl $0x1, %edi
leaq 0x57aeca(%rip), %rsi    # 0x5eda18
leaq 0x57abbb(%rip), %rax    # 0x5ed710
callq *0xc0(%rax)
movl $0x0, 0x57aeb3(%rip)    # 0x5eda18
popq %rbp
retq
nopw (%rax,%rax)