// File: /workspace/github_c_makefile_star2_O2/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 0x130bf7(%rip), %r15    # 0x177250
movss 0x14(%r15), %xmm0
ucomiss 0x2596e(%rip), %xmm0    # 0x6bfd4
jbe 0x46685
movl 0x5ad316(%rip), %eax    # 0x5f3984
testl %eax, %eax
jle 0x4667b
cvtsi2ss %eax, %xmm1
ucomiss %xmm0, %xmm1
jbe 0x46685
cvttss2si %xmm0, %eax
movl %eax, 0x5ad2ff(%rip)    # 0x5f3984
movl 0x57ef9(%rip), %eax     # 0x9e584
testl %eax, %eax
js 0x46699
cmpl $0x6, %eax
jb 0x466a1
pushq $0x5
popq %rax
jmp 0x4669b
xorl %eax, %eax
movl %eax, 0x57ee3(%rip)     # 0x9e584
callq 0x5ca4e
movq %rax, %rbx
leaq 0x5ad090(%rip), %r12    # 0x5f3740
leaq 0x57e69(%rip), %r13     # 0x9e520
movq %rbx, %rdi
callq 0x5ca5e
testq %rax, %rax
je 0x46768
movq %rax, %r14
xorl %ebp, %ebp
cmpq $0x6, %rbp
je 0x466b7
movq (%r14,%rbp,8), %rax
testq %rax, %rax
je 0x46760
movl (%rax), %esi
testl %esi, %esi
je 0x46760
movl $0xde1, %edi            # imm = 0xDE1
callq *0xc8(%r12)
movslq 0x57e8a(%rip), %rax     # 0x9e584
shlq $0x4, %rax
movl 0xc(%rax,%r13), %edx
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2800, %esi           # imm = 0x2800
callq *0xe8(%r12)
movslq 0x57e68(%rip), %rax     # 0x9e584
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 0x25890(%rip), %xmm0    # 0x6bfd4
jbe 0x46760
cvtsi2ssl 0x5ad236(%rip), %xmm0 # 0x5f3984
movl $0xde1, %edi            # imm = 0xDE1
movl $0x84fe, %esi           # imm = 0x84FE
callq *0xe0(%r12)
incq %rbp
jmp 0x466cd
movq %rbx, %rdi
callq 0x5ca86
xorl %ebx, %ebx
leaq 0x5fb8ab(%rip), %rax    # 0x642024
movslq (%rax), %rax
cmpq %rax, %rbx
jge 0x46908
leaq 0x5fb89c(%rip), %rax    # 0x642028
movq (%rax), %rax
movq (%rax,%rbx,8), %rbp
cmpl $0x2, (%rbp)
jge 0x4679e
incq %rbx
jmp 0x46772
xorl %r14d, %r14d
movslq 0x50(%rbp), %rax
shlq $0x2, %rax
cmpq %rax, %r14
jge 0x4684b
movq 0x18(%rbp), %rax
movq (%rax,%r14,8), %rax
testq %rax, %rax
je 0x46843
movl (%rax), %esi
testl %esi, %esi
je 0x46843
movl $0xde1, %edi            # imm = 0xDE1
callq *0xc8(%r12)
movslq 0x57da7(%rip), %rax     # 0x9e584
shlq $0x4, %rax
movl 0xc(%rax,%r13), %edx
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2800, %esi           # imm = 0x2800
callq *0xe8(%r12)
movslq 0x57d85(%rip), %rax     # 0x9e584
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 0x257ad(%rip), %xmm0    # 0x6bfd4
jbe 0x46843
cvtsi2ssl 0x5ad153(%rip), %xmm0 # 0x5f3984
movl $0xde1, %edi            # imm = 0xDE1
movl $0x84fe, %esi           # imm = 0x84FE
callq *0xe0(%r12)
incq %r14
jmp 0x467a1
addq $0x48, %rbp
movq (%rbp), %rbp
testq %rbp, %rbp
je 0x46799
xorl %r14d, %r14d
cmpq $0x4, %r14
je 0x468ff
movq 0x18(%rbp,%r14,8), %rax
testq %rax, %rax
je 0x468f7
movl (%rax), %esi
testl %esi, %esi
je 0x468f7
movl $0xde1, %edi            # imm = 0xDE1
callq *0xc8(%r12)
movslq 0x57cf3(%rip), %rax     # 0x9e584
shlq $0x4, %rax
movl 0xc(%rax,%r13), %edx
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2800, %esi           # imm = 0x2800
callq *0xe8(%r12)
movslq 0x57cd1(%rip), %rax     # 0x9e584
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 0x256f9(%rip), %xmm0    # 0x6bfd4
jbe 0x468f7
cvtsi2ssl 0x5ad09f(%rip), %xmm0 # 0x5f3984
movl $0xde1, %edi            # imm = 0xDE1
movl $0x84fe, %esi           # imm = 0x84FE
callq *0xe0(%r12)
incq %r14
jmp 0x4685f
addq $0x38, %rbp
jmp 0x4684f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq