// File: /workspace/github_c_makefile_star2_O2/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 0x59614c(%rip), %r15    # 0x5f3740
leaq 0x40f89(%rip), %r12     # 0x9e584
leaq 0x119c4e(%rip), %r13    # 0x177250
cmpq $0x6, %r14
je 0x5d71d
movq (%rbx,%r14,8), %rax
testq %rax, %rax
je 0x5d715
movl (%rax), %esi
testl %esi, %esi
je 0x5d715
movl $0xde1, %edi            # imm = 0xDE1
callq *0xc8(%r15)
movl (%r12), %eax
testl %eax, %eax
js 0x5d641
pushq $0x5
popq %rcx
cmpl $0x6, %eax
jae 0x5d643
jmp 0x5d649
xorl %ecx, %ecx
movl %ecx, (%r12)
movl %ecx, %eax
movl %eax, %eax
shlq $0x4, %rax
leaq 0x40eca(%rip), %rbp     # 0x9e520
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 0xe93f(%rip), %xmm0     # 0x6bfd4
jbe 0x5d6cf
leaq 0x5962e6(%rip), %rax    # 0x5f3984
movl (%rax), %eax
testl %eax, %eax
jle 0x5d6ad
cvtsi2ss %eax, %xmm1
ucomiss %xmm0, %xmm1
jbe 0x5d6ba
cvttss2si %xmm0, %eax
leaq 0x5962cc(%rip), %rcx    # 0x5f3984
movl %eax, (%rcx)
cvtsi2ss %eax, %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
jmp 0x5d602
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq