// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %rsi
leaq 0xc(%rsp), %rdx
pushq $0x13
popq %rcx
callq 0x11420
movl %eax, %ebp
pushq $0x14
popq %rsi
pushq $0x2
popq %rdx
movq %rbx, %rdi
callq 0x11150
movl %eax, %r14d
leal -0x8e42(%r14), %eax
cmpl $0x4, %eax
jb 0x36233
leal -0x2802(%r14), %eax
cmpl $0x2, %eax
jb 0x3623b
leal -0x813a(%r14), %eax
cmpl $0x2, %eax
jb 0x36255
leal -0x813c(%r14), %eax
cmpl $0x2, %eax
jb 0x36266
cmpl $0x1004, %r14d          # imm = 0x1004
je 0x36381
cmpl $0x2800, %r14d          # imm = 0x2800
je 0x362a7
cmpl $0x2801, %r14d          # imm = 0x2801
je 0x363b1
cmpl $0x8072, %r14d          # imm = 0x8072
je 0x3623b
cmpl $0x84fe, %r14d          # imm = 0x84FE
je 0x36369
cmpl $0x8501, %r14d          # imm = 0x8501
je 0x36255
cmpl $0x884c, %r14d          # imm = 0x884C
je 0x36293
cmpl $0x884d, %r14d          # imm = 0x884D
je 0x3632c
cmpl $0x8e46, %r14d          # imm = 0x8E46
je 0x362bb
cmpl $0x90ea, %r14d          # imm = 0x90EA
jne 0x36343
movl 0xc(%rsp), %edx
pushq $0x15
popq %r8
movq %rbx, %rdi
movl %ebp, %esi
movl $0x90ea, %ecx           # imm = 0x90EA
jmp 0x3624b
movl 0xc(%rsp), %edx
pushq $0x18
jmp 0x36241
movl 0xc(%rsp), %edx
pushq $0x19
popq %r8
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %ecx
callq 0x36891
jmp 0x36405
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %ecx
jmp 0x36377
movl 0xc(%rsp), %r15d
pushq $0x3
popq %rsi
movq %rbx, %rdi
callq 0x11af0
testl %ebp, %ebp
je 0x363c8
movq 0x1f04b(%rip), %rcx     # 0x552d0
movl %ebp, %edi
movl %r14d, %esi
movl %eax, %edx
callq *(%rcx)
jmp 0x363fd
movl 0xc(%rsp), %edx
pushq $0x17
popq %r8
movq %rbx, %rdi
movl %ebp, %esi
movl $0x884c, %ecx           # imm = 0x884C
jmp 0x3624b
movl 0xc(%rsp), %edx
pushq $0x1a
popq %r8
movq %rbx, %rdi
movl %ebp, %esi
movl $0x2800, %ecx           # imm = 0x2800
jmp 0x3624b
movl 0xc(%rsp), %r14d
pushq $0x18
popq %r15
pushq $0x3
popq %rdx
movq %rbx, %rdi
movl %r15d, %esi
callq 0x11150
movl %eax, 0x10(%rsp)
pushq $0x4
popq %rdx
movq %rbx, %rdi
movl %r15d, %esi
callq 0x11150
movl %eax, 0x14(%rsp)
pushq $0x5
popq %rdx
movq %rbx, %rdi
movl %r15d, %esi
callq 0x11150
movl %eax, 0x18(%rsp)
pushq $0x6
popq %rdx
movq %rbx, %rdi
movl %r15d, %esi
callq 0x11150
movl %eax, 0x1c(%rsp)
testl %ebp, %ebp
je 0x363d7
movq 0x1fb7d(%rip), %rax     # 0x55e98
leaq 0x10(%rsp), %rdx
movl %ebp, %edi
movl $0x8e46, %esi           # imm = 0x8E46
jmp 0x363ad
movl 0xc(%rsp), %edx
pushq $0x16
popq %r8
movq %rbx, %rdi
movl %ebp, %esi
movl $0x884d, %ecx           # imm = 0x884D
jmp 0x3624b
pushq $0x3
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x11440
leaq 0x1148a(%rip), %rsi     # 0x477e1
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x11ae0
jmp 0x36407
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x84fe, %ecx           # imm = 0x84FE
callq 0x368e3
jmp 0x36405
movl 0xc(%rsp), %r14d
pushq $0x3
popq %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x113f0
testl %ebp, %ebp
je 0x363eb
movq 0x1f527(%rip), %rax     # 0x558c8
leaq 0x10(%rsp), %rdx
movl %ebp, %edi
movl $0x1004, %esi           # imm = 0x1004
callq *(%rax)
jmp 0x363fd
movl 0xc(%rsp), %edx
pushq $0x1b
popq %r8
movq %rbx, %rdi
movl %ebp, %esi
movl $0x2801, %ecx           # imm = 0x2801
jmp 0x3624b
movl %r15d, %edi
movl %r14d, %esi
movl %eax, %edx
callq 0x11b00
jmp 0x363fd
leaq 0x10(%rsp), %rdx
movl %r14d, %edi
movl $0x8e46, %esi           # imm = 0x8E46
callq 0x117c0
jmp 0x363fd
leaq 0x10(%rsp), %rdx
movl %r14d, %edi
movl $0x1004, %esi           # imm = 0x1004
callq 0x11730
movq %rbx, %rdi
callq 0x11870
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq