// File: /workspace/github_c_makefile_star2_O1/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 0x11430
movl %eax, %ebp
movq %rbx, %rdi
movl $0x14, %esi
movl $0x2, %edx
callq 0x11160
cmpl $0x84fd, %eax           # imm = 0x84FD
jg 0x394d0
cmpl $0x8139, %eax           # imm = 0x8139
jle 0x394f8
leal -0x82db(%rax), %ecx
cmpl $0x5, %ecx
jb 0x394b8
leal -0x813a(%rax), %ecx
cmpl $0x2, %ecx
jb 0x3955e
movl %eax, %ecx
addl $0xffff7ec4, %ecx       # imm = 0xFFFF7EC4
cmpl $0x2, %ecx
jae 0x396dc
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl %eax, %ecx
xorl %r8d, %r8d
callq 0x39a7d
jmp 0x3971d
cmpl $0x8e41, %eax           # imm = 0x8E41
jle 0x3953d
cmpl $0x8e46, %eax           # imm = 0x8E46
jge 0x3956e
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl %eax, %ecx
movl $0x18, %r8d
jmp 0x39718
cmpl $0x2800, %eax           # imm = 0x2800
jg 0x395a8
cmpl $0x1004, %eax           # imm = 0x1004
je 0x3964c
cmpl $0x1006, %eax           # imm = 0x1006
je 0x39639
cmpl $0x2800, %eax           # imm = 0x2800
jne 0x396dc
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x2800, %ecx           # imm = 0x2800
movl $0x1a, %r8d
jmp 0x39718
cmpl $0x884b, %eax           # imm = 0x884B
jg 0x395df
cmpl $0x84fe, %eax           # imm = 0x84FE
je 0x396b1
cmpl $0x8501, %eax           # imm = 0x8501
jne 0x396dc
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl %eax, %ecx
jmp 0x396bf
cmpl $0x90e9, %eax           # imm = 0x90E9
jg 0x3960e
cmpl $0x8e46, %eax           # imm = 0x8E46
je 0x3966e
cmpl $0x90c7, %eax           # imm = 0x90C7
jne 0x396dc
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x90c7, %ecx           # imm = 0x90C7
movl $0x1c, %r8d
jmp 0x39718
leal -0x2802(%rax), %ecx
cmpl $0x2, %ecx
jb 0x395c9
cmpl $0x2801, %eax           # imm = 0x2801
je 0x39704
cmpl $0x8072, %eax           # imm = 0x8072
jne 0x396dc
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl %eax, %ecx
movl $0x19, %r8d
jmp 0x39718
cmpl $0x884c, %eax           # imm = 0x884C
je 0x396c6
cmpl $0x884d, %eax           # imm = 0x884D
jne 0x396dc
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x884d, %ecx           # imm = 0x884D
movl $0x16, %r8d
jmp 0x39718
cmpl $0x912f, %eax           # imm = 0x912F
je 0x39690
cmpl $0x90ea, %eax           # imm = 0x90EA
jne 0x396dc
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x90ea, %ecx           # imm = 0x90EA
movl $0x15, %r8d
jmp 0x39718
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x1006, %ecx           # imm = 0x1006
jmp 0x394c3
testl %ebp, %ebp
je 0x3972f
movq 0x1d035(%rip), %rax     # 0x56690
leaq 0x10(%rsp), %rdx
movl %ebp, %edi
movl $0x1004, %esi           # imm = 0x1004
callq *(%rax)
jmp 0x39742
testl %ebp, %ebp
je 0x3978d
movq 0x1cec3(%rip), %rax     # 0x56540
leaq 0x10(%rsp), %rdx
movl %ebp, %edi
movl $0x8e46, %esi           # imm = 0x8E46
callq *(%rax)
jmp 0x397a0
movl 0xc(%rsp), %edx
movl $0x1, %r14d
movq %rbx, %rdi
movl %ebp, %esi
movl $0x912f, %ecx           # imm = 0x912F
movl $0x1, %r8d
callq 0x39a7d
jmp 0x39723
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x84fe, %ecx           # imm = 0x84FE
callq 0x39ad6
jmp 0x3971d
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x884c, %ecx           # imm = 0x884C
movl $0x17, %r8d
jmp 0x39718
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x11450
leaq 0x120e1(%rip), %rsi     # 0x4b7d3
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x11ae0
movl %eax, %r14d
jmp 0x39723
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x2801, %ecx           # imm = 0x2801
movl $0x1b, %r8d
callq 0x39a2c
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 0x11360
movq %rbx, %rdi
callq 0x11880
cvtss2sd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x11380
xorps %xmm0, %xmm0
cvtss2sd 0x14(%rsp), %xmm0
movq %rbx, %rdi
callq 0x11380
xorps %xmm0, %xmm0
cvtss2sd 0x18(%rsp), %xmm0
movq %rbx, %rdi
callq 0x11380
xorps %xmm0, %xmm0
cvtss2sd 0x1c(%rsp), %xmm0
movq %rbx, %rdi
callq 0x11380
jmp 0x397ec
movl 0xc(%rsp), %edi
leaq 0x10(%rsp), %rdx
movl $0x8e46, %esi           # imm = 0x8E46
callq 0x119a0
movq %rbx, %rdi
callq 0x11880
movl 0x10(%rsp), %edx
movq %rbx, %rdi
movl $0x18, %esi
callq 0x11120
movl 0x14(%rsp), %edx
movq %rbx, %rdi
movl $0x18, %esi
callq 0x11120
movl 0x18(%rsp), %edx
movq %rbx, %rdi
movl $0x18, %esi
callq 0x11120
movl 0x1c(%rsp), %edx
movq %rbx, %rdi
movl $0x18, %esi
callq 0x11120
movl $0x4, %r14d
jmp 0x39723