// File: /workspace/github_c_makefile_star2_O1/jonof[P]jftekwar/jfbuild/src/polymosttex.c
// Function: pt_load_applyparameters
static void pt_load_applyparameters(PTHead * pth)
{
	int i;

	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);

		if (gltexfiltermode < 0) {
			gltexfiltermode = 0;
		} else if (gltexfiltermode >= (int)numglfiltermodes) {
			gltexfiltermode = numglfiltermodes-1;
		}
		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) {
			if (glanisotropy <= 0 || glanisotropy > glinfo.maxanisotropy) {
				glanisotropy = (int)glinfo.maxanisotropy;
			}
			glfunc.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, glanisotropy);
		}
#endif

		if (! (pth->flags & PTH_CLAMPED)) {
			glfunc.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
			glfunc.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
		} else {     //For sprite textures, clamping looks better than wrapping
			GLint c = glinfo.clamptoedge ? GL_CLAMP_TO_EDGE : GL_CLAMP;
			glfunc.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, c);
			glfunc.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, c);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
leaq 0x593271(%rip), %r15    # 0x5f9740
leaq 0x3e0ae(%rip), %r12     # 0xa4584
leaq 0x116d73(%rip), %r13    # 0x17d250
movq (%rbx,%r14,8), %rax
testq %rax, %rax
je 0x665e7
movl (%rax), %esi
testl %esi, %esi
je 0x665e7
movl $0xde1, %edi            # imm = 0xDE1
callq *0xc8(%r15)
movl (%r12), %ecx
testl %ecx, %ecx
js 0x66514
movl $0x5, %eax
cmpl $0x6, %ecx
jge 0x66516
jmp 0x6651a
xorl %eax, %eax
movl %eax, (%r12)
movslq (%r12), %rax
shlq $0x4, %rax
leaq 0x3dff7(%rip), %rbp     # 0xa4520
movl 0xc(%rbp,%rax), %edx
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2800, %esi           # imm = 0x2800
callq *0xe8(%r15)
movslq (%r12), %rax
shlq $0x4, %rax
movl 0x8(%rbp,%rax), %edx
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2801, %esi           # imm = 0x2801
callq *0xe8(%r15)
movss 0x14(%r13), %xmm0
ucomiss 0xfa2c(%rip), %xmm0     # 0x75f94
jbe 0x665a1
leaq 0x593413(%rip), %rcx    # 0x5f9984
movl (%rcx), %eax
testl %eax, %eax
jle 0x66583
xorps %xmm1, %xmm1
cvtsi2ss %eax, %xmm1
ucomiss %xmm0, %xmm1
jbe 0x66589
cvttss2si %xmm0, %eax
movl %eax, (%rcx)
xorps %xmm0, %xmm0
cvtsi2ssl (%rcx), %xmm0
movl $0xde1, %edi            # imm = 0xDE1
movl $0x84fe, %esi           # imm = 0x84FE
callq *0xe0(%r15)
cmpb $0x0, 0x19(%r13)
movl $0x812f, %ebp           # imm = 0x812F
movl $0x2900, %eax           # imm = 0x2900
cmovel %eax, %ebp
movzwl 0x38(%rbx), %eax
testb $0x1, %al
movl $0x2901, %eax           # imm = 0x2901
cmovel %eax, %ebp
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2802, %esi           # imm = 0x2802
movl %ebp, %edx
callq *0xe8(%r15)
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2803, %esi           # imm = 0x2803
movl %ebp, %edx
callq *0xe8(%r15)
incq %r14
cmpq $0x6, %r14
jne 0x664dd
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop