// File: /workspace/github_c_makefile_star2_O2/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, %r14
pushq $0x1
popq %rbx
leaq 0xc(%rsp), %rdx
pushq $0x13
popq %rcx
movl %ebx, %esi
callq 0x11420
movl %eax, %ebp
pushq $0x14
popq %rsi
pushq $0x2
popq %rdx
movq %r14, %rdi
callq 0x11150
leal -0x82db(%rax), %ecx
cmpl $0x5, %ecx
jb 0x3652d
leal -0x8e42(%rax), %ecx
cmpl $0x4, %ecx
jb 0x36545
leal -0x2802(%rax), %ecx
cmpl $0x2, %ecx
jb 0x3654d
leal -0x813a(%rax), %ecx
cmpl $0x2, %ecx
jb 0x36566
leal -0x813c(%rax), %ecx
cmpl $0x2, %ecx
jb 0x3652d
cmpl $0x1004, %eax           # imm = 0x1004
je 0x3662e
cmpl $0x1006, %eax           # imm = 0x1006
je 0x365ac
cmpl $0x2800, %eax           # imm = 0x2800
je 0x36576
cmpl $0x2801, %eax           # imm = 0x2801
je 0x36667
cmpl $0x8072, %eax           # imm = 0x8072
je 0x3654d
cmpl $0x84fe, %eax           # imm = 0x84FE
je 0x3667e
cmpl $0x8501, %eax           # imm = 0x8501
je 0x36566
cmpl $0x884c, %eax           # imm = 0x884C
je 0x36650
cmpl $0x884d, %eax           # imm = 0x884D
je 0x36617
cmpl $0x8e46, %eax           # imm = 0x8E46
je 0x3658a
cmpl $0x90c7, %eax           # imm = 0x90C7
je 0x365d8
cmpl $0x912f, %eax           # imm = 0x912F
je 0x365bf
cmpl $0x90ea, %eax           # imm = 0x90EA
jne 0x365ef
movl 0xc(%rsp), %edx
pushq $0x15
popq %r8
movq %r14, %rdi
movl %ebp, %esi
movl $0x90ea, %ecx           # imm = 0x90EA
jmp 0x3655c
movl 0xc(%rsp), %edx
movq %r14, %rdi
movl %ebp, %esi
movl %eax, %ecx
xorl %r8d, %r8d
callq 0x36984
jmp 0x36744
movl 0xc(%rsp), %edx
pushq $0x18
jmp 0x36553
movl 0xc(%rsp), %edx
pushq $0x19
popq %r8
movq %r14, %rdi
movl %ebp, %esi
movl %eax, %ecx
callq 0x36933
jmp 0x36744
movl 0xc(%rsp), %edx
movq %r14, %rdi
movl %ebp, %esi
movl %eax, %ecx
jmp 0x3668c
movl 0xc(%rsp), %edx
pushq $0x1a
popq %r8
movq %r14, %rdi
movl %ebp, %esi
movl $0x2800, %ecx           # imm = 0x2800
jmp 0x3655c
testl %ebp, %ebp
je 0x36696
movq 0x1efa7(%rip), %rax     # 0x55540
leaq 0x10(%rsp), %rdx
movl %ebp, %edi
movl $0x8e46, %esi           # imm = 0x8E46
callq *(%rax)
jmp 0x366a9
movl 0xc(%rsp), %edx
movq %r14, %rdi
movl %ebp, %esi
movl $0x1006, %ecx           # imm = 0x1006
jmp 0x36538
movl 0xc(%rsp), %edx
pushq $0x1
popq %rbx
movq %r14, %rdi
movl %ebp, %esi
movl $0x912f, %ecx           # imm = 0x912F
movl %ebx, %r8d
jmp 0x3653b
movl 0xc(%rsp), %edx
pushq $0x1c
popq %r8
movq %r14, %rdi
movl %ebp, %esi
movl $0x90c7, %ecx           # imm = 0x90C7
jmp 0x3655c
pushq $0x2
popq %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x11440
leaq 0x111f8(%rip), %rsi     # 0x477fb
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x11ae0
movl %eax, %ebx
jmp 0x36744
movl 0xc(%rsp), %edx
pushq $0x16
popq %r8
movq %r14, %rdi
movl %ebp, %esi
movl $0x884d, %ecx           # imm = 0x884D
jmp 0x3655c
testl %ebp, %ebp
je 0x366ee
movq 0x1f053(%rip), %rax     # 0x55690
leaq 0x10(%rsp), %rdx
movl %ebp, %edi
movl $0x1004, %esi           # imm = 0x1004
callq *(%rax)
jmp 0x36701
movl 0xc(%rsp), %edx
pushq $0x17
popq %r8
movq %r14, %rdi
movl %ebp, %esi
movl $0x884c, %ecx           # imm = 0x884C
jmp 0x3655c
movl 0xc(%rsp), %edx
pushq $0x1b
popq %r8
movq %r14, %rdi
movl %ebp, %esi
movl $0x2801, %ecx           # imm = 0x2801
jmp 0x3655c
movl 0xc(%rsp), %edx
movq %r14, %rdi
movl %ebp, %esi
movl $0x84fe, %ecx           # imm = 0x84FE
callq 0x369dd
jmp 0x36744
movl 0xc(%rsp), %edi
leaq 0x10(%rsp), %rdx
movl $0x8e46, %esi           # imm = 0x8E46
callq 0x119a0
movq %r14, %rdi
callq 0x11870
movl 0x10(%rsp), %edx
pushq $0x18
popq %rbx
movq %r14, %rdi
movl %ebx, %esi
callq 0x11110
movl 0x14(%rsp), %edx
movq %r14, %rdi
movl %ebx, %esi
callq 0x11110
movl 0x18(%rsp), %edx
movq %r14, %rdi
movl %ebx, %esi
callq 0x11110
movl 0x1c(%rsp), %edx
movq %r14, %rdi
movl %ebx, %esi
callq 0x11110
jmp 0x36741
movl 0xc(%rsp), %edi
leaq 0x10(%rsp), %rdx
movl $0x1004, %esi           # imm = 0x1004
callq 0x11350
movq %r14, %rdi
callq 0x11870
cvtss2sd 0x10(%rsp), %xmm0
movq %r14, %rdi
callq 0x11370
cvtss2sd 0x14(%rsp), %xmm0
movq %r14, %rdi
callq 0x11370
cvtss2sd 0x18(%rsp), %xmm0
movq %r14, %rdi
callq 0x11370
cvtss2sd 0x1c(%rsp), %xmm0
movq %r14, %rdi
callq 0x11370
pushq $0x4
popq %rbx
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq