// File: /workspace/github_c_makefile_star2_O3/stetre[P]moongl/src/texture.c
// Function: TextureParameter
static int TextureParameter(lua_State *L) 
/* texture_parameter(texture|target, pname, ...) */
    {
    int arg = 1;
    GLenum target, pname;
    GLuint texture = checktargetorname(L, arg++, &target, DOMAIN_TEXTURE_TARGET);
    pname = checktexturepname(L, arg++);
    
    switch(pname)
        {
        case GL_DEPTH_STENCIL_TEXTURE_MODE: 
                return SetEnum(L, texture, target, pname, arg, DOMAIN_DEPTH_STENCIL);
        case GL_TEXTURE_BASE_LEVEL: 
        case GL_TEXTURE_MAX_LEVEL:  return SetInt(L, texture, target, pname, arg);
        case GL_TEXTURE_BORDER_COLOR:   return SetColor(L, texture, target, pname, arg);
        case GL_TEXTURE_COMPARE_FUNC:
                return SetEnum(L, texture, target, pname, arg, DOMAIN_COMPARE_FUNC);
        case GL_TEXTURE_COMPARE_MODE:   
                return SetEnum(L, texture, target, pname, arg, DOMAIN_COMPARE_MODE);
        case GL_TEXTURE_LOD_BIAS:
        case GL_TEXTURE_MIN_LOD:
        case GL_TEXTURE_MAX_LOD:   return SetFloat(L, texture, target, pname, arg);
        case GL_TEXTURE_SWIZZLE_R:
        case GL_TEXTURE_SWIZZLE_G:
        case GL_TEXTURE_SWIZZLE_B:
        case GL_TEXTURE_SWIZZLE_A:   
                return SetEnum(L, texture, target, pname, arg, DOMAIN_RGBA);
        case GL_TEXTURE_SWIZZLE_RGBA:   
                return SetEnum4(L, texture, target, pname, arg, DOMAIN_RGBA);
        case GL_TEXTURE_MIN_FILTER:
                return SetEnum(L, texture, target, pname, arg, DOMAIN_MIN_FILTER);
        case GL_TEXTURE_MAG_FILTER:  
                return SetEnum(L, texture, target, pname, arg, DOMAIN_MAG_FILTER);
        case GL_TEXTURE_WRAP_S:
        case GL_TEXTURE_WRAP_T:
        case GL_TEXTURE_WRAP_R:  
                return SetEnum(L, texture, target, pname, arg, DOMAIN_WRAP);
        case GL_TEXTURE_MAX_ANISOTROPY:   return SetFloat(L, texture, target, pname, arg); //GL_VERSION_4_6
        default:
            return luaL_error(L, "cannot set parameter '%s'",  luaL_checkstring(L, arg));
        }
    return 0;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0xc(%rsp), %rdx
movl $0x1, %esi
movl $0x13, %ecx
callq 0x11420
movl %eax, %ebp
movq %rbx, %rdi
movl $0x14, %esi
movl $0x2, %edx
callq 0x11150
movl %eax, %r14d
cmpl $0x84fd, %eax           # imm = 0x84FD
jg 0x3924f
cmpl $0x8071, %r14d          # imm = 0x8071
jg 0x3927f
cmpl $0x2801, %r14d          # imm = 0x2801
jg 0x3935c
cmpl $0x1004, %r14d          # imm = 0x1004
je 0x393fa
cmpl $0x2800, %r14d          # imm = 0x2800
je 0x393dc
cmpl $0x2801, %r14d          # imm = 0x2801
jne 0x39386
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x2801, %ecx           # imm = 0x2801
movl $0x1b, %r8d
jmp 0x393f0
cmpl $0x8e41, %r14d          # imm = 0x8E41
jle 0x392ca
leal -0x8e42(%r14), %eax
cmpl $0x4, %eax
jae 0x392fe
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %ecx
movl $0x18, %r8d
jmp 0x393f0
leal -0x813a(%r14), %eax
cmpl $0x2, %eax
jb 0x392ed
leal -0x813c(%r14), %eax
cmpl $0x2, %eax
jae 0x3937d
movl 0xc(%rsp), %r15d
movq %rbx, %rdi
movl $0x3, %esi
callq 0x11af0
testl %ebp, %ebp
je 0x394a6
movq 0x1d014(%rip), %rcx     # 0x562d0
movl %ebp, %edi
movl %r14d, %esi
movl %eax, %edx
callq *(%rcx)
jmp 0x394db
cmpl $0x884b, %r14d          # imm = 0x884B
jg 0x3932d
cmpl $0x84fe, %r14d          # imm = 0x84FE
je 0x393ae
cmpl $0x8501, %r14d          # imm = 0x8501
jne 0x39386
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %ecx
jmp 0x393bc
cmpl $0x8e46, %r14d          # imm = 0x8E46
je 0x3942e
cmpl $0x90ea, %r14d          # imm = 0x90EA
jne 0x39386
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x90ea, %ecx           # imm = 0x90EA
movl $0x15, %r8d
jmp 0x393f0
cmpl $0x884c, %r14d          # imm = 0x884C
je 0x393c6
cmpl $0x884d, %r14d          # imm = 0x884D
jne 0x39386
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x884d, %ecx           # imm = 0x884D
movl $0x16, %r8d
jmp 0x393f0
movl %r14d, %eax
addl $0xffffd7fe, %eax       # imm = 0xFFFFD7FE
cmpl $0x2, %eax
jae 0x39386
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %ecx
movl $0x19, %r8d
jmp 0x393f0
cmpl $0x8072, %r14d          # imm = 0x8072
je 0x39369
movq %rbx, %rdi
movl $0x3, %esi
xorl %edx, %edx
callq 0x11440
leaq 0x1241d(%rip), %rsi     # 0x4b7b9
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x11ae0
jmp 0x394e5
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x84fe, %ecx           # imm = 0x84FE
callq 0x39a7e
jmp 0x394e3
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x884c, %ecx           # imm = 0x884C
movl $0x17, %r8d
jmp 0x393f0
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x2800, %ecx           # imm = 0x2800
movl $0x1a, %r8d
callq 0x39a2a
jmp 0x394e3
movl 0xc(%rsp), %r14d
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
movl $0x3, %esi
callq 0x113f0
testl %ebp, %ebp
je 0x394b5
movq 0x1d4a8(%rip), %rax     # 0x568c8
leaq 0x10(%rsp), %rdx
movl %ebp, %edi
movl $0x1004, %esi           # imm = 0x1004
jmp 0x394a2
movl 0xc(%rsp), %r14d
movq %rbx, %rdi
movl $0x18, %esi
movl $0x3, %edx
callq 0x11150
movl %eax, 0x10(%rsp)
movq %rbx, %rdi
movl $0x18, %esi
movl $0x4, %edx
callq 0x11150
movl %eax, 0x14(%rsp)
movq %rbx, %rdi
movl $0x18, %esi
movl $0x5, %edx
callq 0x11150
movl %eax, 0x18(%rsp)
movq %rbx, %rdi
movl $0x18, %esi
movl $0x6, %edx
callq 0x11150
movl %eax, 0x1c(%rsp)
testl %ebp, %ebp
je 0x394c9
movq 0x1da02(%rip), %rax     # 0x56e98
leaq 0x10(%rsp), %rdx
movl %ebp, %edi
movl $0x8e46, %esi           # imm = 0x8E46
callq *(%rax)
jmp 0x394db
movl %r15d, %edi
movl %r14d, %esi
movl %eax, %edx
callq 0x11b00
jmp 0x394db
leaq 0x10(%rsp), %rdx
movl %r14d, %edi
movl $0x1004, %esi           # imm = 0x1004
callq 0x11730
jmp 0x394db
leaq 0x10(%rsp), %rdx
movl %r14d, %edi
movl $0x8e46, %esi           # imm = 0x8E46
callq 0x117c0
movq %rbx, %rdi
callq 0x11870
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq