// File: /workspace/github_c_makefile_star2_O3/stetre[P]moongl/src/texture.c
// Function: GetTextureParameter
static int GetTextureParameter(lua_State *L) 
/* get_texture_parameter(texture|target, pname) */
    {
    GLenum target, pname;
    GLuint texture = checktargetorname(L, 1, &target, DOMAIN_TEXTURE_TARGET);
    pname = checktexturepname(L, 2);

    switch(pname)
        {
        case GL_DEPTH_STENCIL_TEXTURE_MODE:
                return GetEnum(L, texture, target, pname, DOMAIN_DEPTH_STENCIL);
        case GL_TEXTURE_BASE_LEVEL: 
        case GL_TEXTURE_MAX_LEVEL:  return GetInt(L, texture, target, pname);

        case GL_TEXTURE_BORDER_COLOR:   return GetFloat4(L, texture, target, pname);
        case GL_TEXTURE_COMPARE_FUNC:
                return GetEnum(L, texture, target, pname, DOMAIN_COMPARE_FUNC);
        case GL_TEXTURE_COMPARE_MODE:
                return GetEnum(L, texture, target, pname, DOMAIN_COMPARE_MODE);
        case GL_TEXTURE_LOD_BIAS:
        case GL_TEXTURE_MIN_LOD:
        case GL_TEXTURE_MAX_LOD:    return GetFloat(L, texture, target, pname);
        case GL_TEXTURE_SWIZZLE_R:
        case GL_TEXTURE_SWIZZLE_G:
        case GL_TEXTURE_SWIZZLE_B:
        case GL_TEXTURE_SWIZZLE_A:  
                return GetEnum(L, texture, target, pname, DOMAIN_RGBA);
        case GL_TEXTURE_SWIZZLE_RGBA: 
            return GetEnum4(L, texture, target, pname, DOMAIN_RGBA);

        case GL_TEXTURE_MIN_FILTER:
                return GetEnum(L, texture, target, pname, DOMAIN_MIN_FILTER);
        case GL_TEXTURE_MAG_FILTER:
                return GetEnum(L, texture, target, pname, DOMAIN_MAG_FILTER);

        case GL_TEXTURE_WRAP_S:
        case GL_TEXTURE_WRAP_T:
        case GL_TEXTURE_WRAP_R:
                return GetEnum(L, texture, target, pname, DOMAIN_WRAP);
        case GL_IMAGE_FORMAT_COMPATIBILITY_TYPE:
                return GetEnum(L, texture, target, pname, DOMAIN_IMAGE_FORMAT_COMPATIBILITY);
        case GL_TEXTURE_IMMUTABLE_FORMAT:   return GetBoolean(L, texture, target, pname); 
        case GL_TEXTURE_IMMUTABLE_LEVELS:
        case GL_TEXTURE_VIEW_MIN_LEVEL:
        case GL_TEXTURE_VIEW_NUM_LEVELS:
        case GL_TEXTURE_VIEW_MIN_LAYER:
        case GL_TEXTURE_VIEW_NUM_LAYERS:    return GetInt(L, texture, target, pname);
        case GL_TEXTURE_TARGET:     return GetInt(L, texture, target, pname);
        case GL_TEXTURE_MAX_ANISOTROPY:    return GetFloat(L, texture, target, pname); //GL_VERSION_4_6
        default:
            {
            const char *name = luaL_checkstring(L, 2);
            return luaL_error(L, "cannot get parameter '%s'", name);
            }
        }
    return 0;
    }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %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
cmpl $0x84fd, %eax           # imm = 0x84FD
jg 0x39574
cmpl $0x8139, %eax           # imm = 0x8139
jle 0x3959c
leal -0x82db(%rax), %ecx
cmpl $0x5, %ecx
jb 0x3955c
leal -0x813a(%rax), %ecx
cmpl $0x2, %ecx
jb 0x39602
movl %eax, %ecx
addl $0xffff7ec4, %ecx       # imm = 0xFFFF7EC4
cmpl $0x2, %ecx
jae 0x39780
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl %eax, %ecx
xorl %r8d, %r8d
callq 0x39b21
jmp 0x397c1
cmpl $0x8e41, %eax           # imm = 0x8E41
jle 0x395e1
cmpl $0x8e46, %eax           # imm = 0x8E46
jge 0x39612
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl %eax, %ecx
movl $0x18, %r8d
jmp 0x397bc
cmpl $0x2800, %eax           # imm = 0x2800
jg 0x3964c
cmpl $0x1004, %eax           # imm = 0x1004
je 0x396f0
cmpl $0x1006, %eax           # imm = 0x1006
je 0x396dd
cmpl $0x2800, %eax           # imm = 0x2800
jne 0x39780
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x2800, %ecx           # imm = 0x2800
movl $0x1a, %r8d
jmp 0x397bc
cmpl $0x884b, %eax           # imm = 0x884B
jg 0x39683
cmpl $0x84fe, %eax           # imm = 0x84FE
je 0x39755
cmpl $0x8501, %eax           # imm = 0x8501
jne 0x39780
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl %eax, %ecx
jmp 0x39763
cmpl $0x90e9, %eax           # imm = 0x90E9
jg 0x396b2
cmpl $0x8e46, %eax           # imm = 0x8E46
je 0x39712
cmpl $0x90c7, %eax           # imm = 0x90C7
jne 0x39780
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x90c7, %ecx           # imm = 0x90C7
movl $0x1c, %r8d
jmp 0x397bc
leal -0x2802(%rax), %ecx
cmpl $0x2, %ecx
jb 0x3966d
cmpl $0x2801, %eax           # imm = 0x2801
je 0x397a8
cmpl $0x8072, %eax           # imm = 0x8072
jne 0x39780
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl %eax, %ecx
movl $0x19, %r8d
jmp 0x397bc
cmpl $0x884c, %eax           # imm = 0x884C
je 0x3976a
cmpl $0x884d, %eax           # imm = 0x884D
jne 0x39780
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x884d, %ecx           # imm = 0x884D
movl $0x16, %r8d
jmp 0x397bc
cmpl $0x912f, %eax           # imm = 0x912F
je 0x39734
cmpl $0x90ea, %eax           # imm = 0x90EA
jne 0x39780
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x90ea, %ecx           # imm = 0x90EA
movl $0x15, %r8d
jmp 0x397bc
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x1006, %ecx           # imm = 0x1006
jmp 0x39567
testl %ebp, %ebp
je 0x397d3
movq 0x1cf91(%rip), %rax     # 0x56690
leaq 0x10(%rsp), %rdx
movl %ebp, %edi
movl $0x1004, %esi           # imm = 0x1004
callq *(%rax)
jmp 0x397e6
testl %ebp, %ebp
je 0x39831
movq 0x1ce1f(%rip), %rax     # 0x56540
leaq 0x10(%rsp), %rdx
movl %ebp, %edi
movl $0x8e46, %esi           # imm = 0x8E46
callq *(%rax)
jmp 0x39844
movl 0xc(%rsp), %edx
movl $0x1, %r14d
movq %rbx, %rdi
movl %ebp, %esi
movl $0x912f, %ecx           # imm = 0x912F
movl $0x1, %r8d
callq 0x39b21
jmp 0x397c7
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x84fe, %ecx           # imm = 0x84FE
callq 0x39b7a
jmp 0x397c1
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x884c, %ecx           # imm = 0x884C
movl $0x17, %r8d
jmp 0x397bc
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x11440
leaq 0x1203d(%rip), %rsi     # 0x4b7d3
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x11ae0
movl %eax, %r14d
jmp 0x397c7
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x2801, %ecx           # imm = 0x2801
movl $0x1b, %r8d
callq 0x39ad0
movl $0x1, %r14d
movl %r14d, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl 0xc(%rsp), %edi
leaq 0x10(%rsp), %rdx
movl $0x1004, %esi           # imm = 0x1004
callq 0x11350
movq %rbx, %rdi
callq 0x11870
cvtss2sd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x11370
xorps %xmm0, %xmm0
cvtss2sd 0x14(%rsp), %xmm0
movq %rbx, %rdi
callq 0x11370
xorps %xmm0, %xmm0
cvtss2sd 0x18(%rsp), %xmm0
movq %rbx, %rdi
callq 0x11370
xorps %xmm0, %xmm0
cvtss2sd 0x1c(%rsp), %xmm0
movq %rbx, %rdi
callq 0x11370
jmp 0x39890
movl 0xc(%rsp), %edi
leaq 0x10(%rsp), %rdx
movl $0x8e46, %esi           # imm = 0x8E46
callq 0x119a0
movq %rbx, %rdi
callq 0x11870
movl 0x10(%rsp), %edx
movq %rbx, %rdi
movl $0x18, %esi
callq 0x11110
movl 0x14(%rsp), %edx
movq %rbx, %rdi
movl $0x18, %esi
callq 0x11110
movl 0x18(%rsp), %edx
movq %rbx, %rdi
movl $0x18, %esi
callq 0x11110
movl 0x1c(%rsp), %edx
movq %rbx, %rdi
movl $0x18, %esi
callq 0x11110
movl $0x4, %r14d
jmp 0x397c7