// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/polymost.c
// Function: gltexapplyprops
void gltexapplyprops (void)
{
	int i;
	PTIter iter;
	PTHead * pth;

	if (glinfo.maxanisotropy > 1.0)
	{
		if (glanisotropy <= 0 || glanisotropy > glinfo.maxanisotropy) glanisotropy = (int)glinfo.maxanisotropy;
	}

	if (gltexfiltermode < 0) gltexfiltermode = 0;
	else if (gltexfiltermode >= (int)numglfiltermodes) gltexfiltermode = numglfiltermodes-1;

	iter = PTIterNew();
	while ((pth = PTIterNext(iter)) != 0) {
		for (i = 0; i < PTHPIC_SIZE; i++) {
			if (pth->pic[i] == 0 || pth->pic[i]->glpic == 0) {
				continue;
			}
			glfunc.glBindTexture(GL_TEXTURE_2D,pth->pic[i]->glpic);
			glfunc.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,glfiltermodes[gltexfiltermode].mag);
			glfunc.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[gltexfiltermode].min);
#ifdef GL_EXT_texture_filter_anisotropic
			if (glinfo.maxanisotropy > 1.0) {
				glfunc.glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,glanisotropy);
			}
#endif
		}
	}
	PTIterFree(iter);

	{
		int j;
		mdskinmap_t *sk;
		md2model *m;

		for (i=0;i<nextmodelid;i++)
		{
			m = (md2model *)models[i];
			if (m->mdnum < 2) continue;
			for (j=0;j<m->numskins*(HICEFFECTMASK+1);j++)
			{
				if (!m->tex[j] || !m->tex[j]->glpic) continue;
				glfunc.glBindTexture(GL_TEXTURE_2D,m->tex[j]->glpic);
				glfunc.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,glfiltermodes[gltexfiltermode].mag);
				glfunc.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[gltexfiltermode].min);
#ifdef GL_EXT_texture_filter_anisotropic
				if (glinfo.maxanisotropy > 1.0)
					glfunc.glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,glanisotropy);
#endif
			}

			for (sk=m->skinmap;sk;sk=sk->next)
				for (j=0;j<(HICEFFECTMASK+1);j++)
				{
					if (!sk->tex[j] || !sk->tex[j]->glpic) continue;
					glfunc.glBindTexture(GL_TEXTURE_2D,sk->tex[j]->glpic);
					glfunc.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,glfiltermodes[gltexfiltermode].mag);
					glfunc.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[gltexfiltermode].min);
#ifdef GL_EXT_texture_filter_anisotropic
					if (glinfo.maxanisotropy > 1.0)
						glfunc.glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,glanisotropy);
#endif
				}
			}
		}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x12e3d4(%rip), %r15    # 0x17e250
movss 0x14(%r15), %xmm0
ucomiss 0x2728b(%rip), %xmm0    # 0x77114
jbe 0x4fea8
movl 0x5aaaf3(%rip), %eax    # 0x5fa984
testl %eax, %eax
jle 0x4fe9e
cvtsi2ss %eax, %xmm1
ucomiss %xmm0, %xmm1
jbe 0x4fea8
cvttss2si %xmm0, %eax
movl %eax, 0x5aaadc(%rip)    # 0x5fa984
movl 0x556d6(%rip), %ecx     # 0xa5584
testl %ecx, %ecx
js 0x4febe
movl $0x5, %eax
cmpl $0x6, %ecx
jae 0x4fec0
jmp 0x4fec6
xorl %eax, %eax
movl %eax, 0x556be(%rip)     # 0xa5584
callq 0x6761e
movq %rax, %rbx
movq %rax, %rdi
callq 0x6762e
testq %rax, %rax
je 0x4ffa3
movq %rax, %r14
leaq 0x5aa857(%rip), %r12    # 0x5fa740
leaq 0x55630(%rip), %r13     # 0xa5520
xorl %ebp, %ebp
movq (%r14,%rbp,8), %rax
testq %rax, %rax
je 0x4ff82
movl (%rax), %esi
testl %esi, %esi
je 0x4ff82
movl $0xde1, %edi            # imm = 0xDE1
callq *0xc8(%r12)
movslq 0x5566b(%rip), %rax     # 0xa5584
shlq $0x4, %rax
movl 0xc(%rax,%r13), %edx
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2800, %esi           # imm = 0x2800
callq *0xe8(%r12)
movslq 0x55649(%rip), %rax     # 0xa5584
shlq $0x4, %rax
movl 0x8(%rax,%r13), %edx
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2801, %esi           # imm = 0x2801
callq *0xe8(%r12)
movss 0x14(%r15), %xmm0
ucomiss 0x271b1(%rip), %xmm0    # 0x77114
jbe 0x4ff82
xorps %xmm0, %xmm0
cvtsi2ssl 0x5aaa14(%rip), %xmm0 # 0x5fa984
movl $0xde1, %edi            # imm = 0xDE1
movl $0x84fe, %esi           # imm = 0x84FE
callq *0xe0(%r12)
incq %rbp
cmpq $0x6, %rbp
jne 0x4fef2
movq %rbx, %rdi
callq 0x6762e
movq %rax, %r14
testq %rax, %rax
jne 0x4fef0
movq %rbx, %rdi
callq 0x67656
leaq 0x5f9072(%rip), %rax    # 0x649024
cmpl $0x0, (%rax)
jle 0x50154
xorl %r14d, %r14d
leaq 0x5aa77b(%rip), %r13    # 0x5fa740
leaq 0x55554(%rip), %rbp     # 0xa5520
leaq 0x5f9055(%rip), %rax    # 0x649028
movq (%rax), %rax
movq (%rax,%r14,8), %r12
cmpl $0x2, (%r12)
jge 0x4fff8
incq %r14
leaq 0x5f9039(%rip), %rax    # 0x649024
movslq (%rax), %rax
cmpq %rax, %r14
jl 0x4ffcc
jmp 0x50154
cmpl $0x0, 0x50(%r12)
jle 0x500a6
xorl %ebx, %ebx
movq 0x18(%r12), %rax
movq (%rax,%rbx,8), %rax
testq %rax, %rax
je 0x50091
movl (%rax), %esi
testl %esi, %esi
je 0x50091
movl $0xde1, %edi            # imm = 0xDE1
callq *0xc8(%r13)
movslq 0x55557(%rip), %rax     # 0xa5584
shlq $0x4, %rax
movl 0xc(%rax,%rbp), %edx
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2800, %esi           # imm = 0x2800
callq *0xe8(%r13)
movslq 0x55537(%rip), %rax     # 0xa5584
shlq $0x4, %rax
movl 0x8(%rax,%rbp), %edx
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2801, %esi           # imm = 0x2801
callq *0xe8(%r13)
movss 0x14(%r15), %xmm0
ucomiss 0x270a1(%rip), %xmm0    # 0x77114
jbe 0x50091
xorps %xmm0, %xmm0
cvtsi2ssl 0x5aa904(%rip), %xmm0 # 0x5fa984
movl $0xde1, %edi            # imm = 0xDE1
movl $0x84fe, %esi           # imm = 0x84FE
callq *0xe0(%r13)
incq %rbx
movslq 0x50(%r12), %rax
shlq $0x2, %rax
cmpq %rax, %rbx
jl 0x50006
movq 0x48(%r12), %r12
testq %r12, %r12
je 0x4ffe1
xorl %ebx, %ebx
movq 0x18(%r12,%rbx,8), %rax
testq %rax, %rax
je 0x5013d
movl (%rax), %esi
testl %esi, %esi
je 0x5013d
movl $0xde1, %edi            # imm = 0xDE1
callq *0xc8(%r13)
movslq 0x554ab(%rip), %rax     # 0xa5584
shlq $0x4, %rax
movl 0xc(%rax,%rbp), %edx
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2800, %esi           # imm = 0x2800
callq *0xe8(%r13)
movslq 0x5548b(%rip), %rax     # 0xa5584
shlq $0x4, %rax
movl 0x8(%rax,%rbp), %edx
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2801, %esi           # imm = 0x2801
callq *0xe8(%r13)
movss 0x14(%r15), %xmm0
ucomiss 0x26ff5(%rip), %xmm0    # 0x77114
jbe 0x5013d
xorps %xmm0, %xmm0
cvtsi2ssl 0x5aa858(%rip), %xmm0 # 0x5fa984
movl $0xde1, %edi            # imm = 0xDE1
movl $0x84fe, %esi           # imm = 0x84FE
callq *0xe0(%r13)
incq %rbx
cmpq $0x4, %rbx
jne 0x500b6
movq 0x38(%r12), %r12
jmp 0x500ab
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq