// File: /workspace/github_c_makefile_star2_O1/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 0x11430
movl %eax, %ebp
movq %rbx, %rdi
movl $0x14, %esi
movl $0x2, %edx
callq 0x11160
movl %eax, %r14d
cmpl $0x84fd, %eax           # imm = 0x84FD
jg 0x391ab
cmpl $0x8071, %r14d          # imm = 0x8071
jg 0x391db
cmpl $0x2801, %r14d          # imm = 0x2801
jg 0x392b8
cmpl $0x1004, %r14d          # imm = 0x1004
je 0x39356
cmpl $0x2800, %r14d          # imm = 0x2800
je 0x39338
cmpl $0x2801, %r14d          # imm = 0x2801
jne 0x392e2
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x2801, %ecx           # imm = 0x2801
movl $0x1b, %r8d
jmp 0x3934c
cmpl $0x8e41, %r14d          # imm = 0x8E41
jle 0x39226
leal -0x8e42(%r14), %eax
cmpl $0x4, %eax
jae 0x3925a
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %ecx
movl $0x18, %r8d
jmp 0x3934c
leal -0x813a(%r14), %eax
cmpl $0x2, %eax
jb 0x39249
leal -0x813c(%r14), %eax
cmpl $0x2, %eax
jae 0x392d9
movl 0xc(%rsp), %r15d
movq %rbx, %rdi
movl $0x3, %esi
callq 0x11af0
testl %ebp, %ebp
je 0x39402
movq 0x1d0b8(%rip), %rcx     # 0x562d0
movl %ebp, %edi
movl %r14d, %esi
movl %eax, %edx
callq *(%rcx)
jmp 0x39437
cmpl $0x884b, %r14d          # imm = 0x884B
jg 0x39289
cmpl $0x84fe, %r14d          # imm = 0x84FE
je 0x3930a
cmpl $0x8501, %r14d          # imm = 0x8501
jne 0x392e2
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %ecx
jmp 0x39318
cmpl $0x8e46, %r14d          # imm = 0x8E46
je 0x3938a
cmpl $0x90ea, %r14d          # imm = 0x90EA
jne 0x392e2
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x90ea, %ecx           # imm = 0x90EA
movl $0x15, %r8d
jmp 0x3934c
cmpl $0x884c, %r14d          # imm = 0x884C
je 0x39322
cmpl $0x884d, %r14d          # imm = 0x884D
jne 0x392e2
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x884d, %ecx           # imm = 0x884D
movl $0x16, %r8d
jmp 0x3934c
movl %r14d, %eax
addl $0xffffd7fe, %eax       # imm = 0xFFFFD7FE
cmpl $0x2, %eax
jae 0x392e2
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %ecx
movl $0x19, %r8d
jmp 0x3934c
cmpl $0x8072, %r14d          # imm = 0x8072
je 0x392c5
movq %rbx, %rdi
movl $0x3, %esi
xorl %edx, %edx
callq 0x11450
leaq 0x124c1(%rip), %rsi     # 0x4b7b9
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x11ae0
jmp 0x39441
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x84fe, %ecx           # imm = 0x84FE
callq 0x399da
jmp 0x3943f
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x884c, %ecx           # imm = 0x884C
movl $0x17, %r8d
jmp 0x3934c
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x2800, %ecx           # imm = 0x2800
movl $0x1a, %r8d
callq 0x39986
jmp 0x3943f
movl 0xc(%rsp), %r14d
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
movl $0x3, %esi
callq 0x11400
testl %ebp, %ebp
je 0x39411
movq 0x1d54c(%rip), %rax     # 0x568c8
leaq 0x10(%rsp), %rdx
movl %ebp, %edi
movl $0x1004, %esi           # imm = 0x1004
jmp 0x393fe
movl 0xc(%rsp), %r14d
movq %rbx, %rdi
movl $0x18, %esi
movl $0x3, %edx
callq 0x11160
movl %eax, 0x10(%rsp)
movq %rbx, %rdi
movl $0x18, %esi
movl $0x4, %edx
callq 0x11160
movl %eax, 0x14(%rsp)
movq %rbx, %rdi
movl $0x18, %esi
movl $0x5, %edx
callq 0x11160
movl %eax, 0x18(%rsp)
movq %rbx, %rdi
movl $0x18, %esi
movl $0x6, %edx
callq 0x11160
movl %eax, 0x1c(%rsp)
testl %ebp, %ebp
je 0x39425
movq 0x1daa6(%rip), %rax     # 0x56e98
leaq 0x10(%rsp), %rdx
movl %ebp, %edi
movl $0x8e46, %esi           # imm = 0x8E46
callq *(%rax)
jmp 0x39437
movl %r15d, %edi
movl %r14d, %esi
movl %eax, %edx
callq 0x11b00
jmp 0x39437
leaq 0x10(%rsp), %rdx
movl %r14d, %edi
movl $0x1004, %esi           # imm = 0x1004
callq 0x11740
jmp 0x39437
leaq 0x10(%rsp), %rdx
movl %r14d, %edi
movl $0x8e46, %esi           # imm = 0x8E46
callq 0x117d0
movq %rbx, %rdi
callq 0x11880
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq