// File: /workspace/github_c_makefile_star2_O3/stetre[P]moongl/src/shader.c
// Function: SpecializeShader
static int SpecializeShader(lua_State *L) //GL_VERSION_4_6
    {
#define max_constants 256
    GLuint i, n = 0;
    GLuint *indices = NULL;
    GLuint *values = NULL;
    GLuint index[max_constants];
    GLuint value[max_constants];
    GLuint name = luaL_checkinteger(L, 1);
    const char *entrypoint = luaL_checkstring(L, 2);
    if(!lua_isnoneornil(L, 3))
        {
        if(lua_type(L, 3) != LUA_TTABLE)
            return luaL_argerror(L, 1, "table expected");
        if(lua_type(L, 4) != LUA_TTABLE)
            return luaL_argerror(L, 1, "table expected");
        n = luaL_len(L, 3);
        if(n > max_constants)
            return luaL_argerror(L, 1, "too many constants");
        if(n != luaL_len(L, 4))
            return luaL_argerror(L, 1, "mismatch between number of indices and of values");
        if(n>0)
            {
            for(i=0; i <n; i++)
                {
                lua_geti(L, 3, i+1);
                index[i] = luaL_checkinteger(L, -1);
                lua_pop(L, 1);
                lua_geti(L, 4, i+1);
                value[i] = luaL_checkinteger(L, -1);
                lua_pop(L, 1);
                }
            indices = index;
            values = value;
            }
        }
    glSpecializeShader(name, (GLchar*)entrypoint, n, indices, values);
    CheckError(L);
    return 0;
#undef max_constants
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x818, %rsp            # imm = 0x818
movq %rdi, %rbx
movl $0x1, %esi
callq 0x11af0
movq %rax, %r15
xorl %r12d, %r12d
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x11440
movq %rax, %r14
movq %rbx, %rdi
movl $0x3, %esi
callq 0x11850
movl $0x0, %r13d
movl $0x0, %ebp
testl %eax, %eax
jle 0x359d6
movq %rbx, %rdi
movl $0x3, %esi
callq 0x11850
cmpl $0x5, %eax
jne 0x358cf
movq %rbx, %rdi
movl $0x4, %esi
callq 0x11850
cmpl $0x5, %eax
jne 0x358cf
movq %rbx, %rdi
movl $0x3, %esi
callq 0x11220
movq %rax, %r12
cmpl $0x101, %r12d           # imm = 0x101
jb 0x358f4
leaq 0x159ec(%rip), %rdx     # 0x4b2b9
jmp 0x358d6
leaq 0x14fb4(%rip), %rdx     # 0x4a88a
movq %rbx, %rdi
movl $0x1, %esi
addq $0x818, %rsp            # imm = 0x818
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11930
movq %r14, (%rsp)
movl %r12d, %r14d
andl $0x1ff, %r14d           # imm = 0x1FF
movq %rbx, %rdi
movl $0x4, %esi
callq 0x11220
cmpq %rax, %r14
jne 0x359be
testl %r12d, %r12d
je 0x359ca
movq %r15, 0x8(%rsp)
movl %r12d, %r15d
andl $0x1ff, %r15d           # imm = 0x1FF
negq %r15
movl $0x1, %r14d
leaq 0x10(%rsp), %rbp
leaq 0x410(%rsp), %r13
movq %rbx, %rdi
movl $0x3, %esi
movq %r14, %rdx
callq 0x11810
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x11af0
movl %eax, 0x40c(%rsp,%r14,4)
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x116b0
movq %rbx, %rdi
movl $0x4, %esi
movq %r14, %rdx
callq 0x11810
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x11af0
movl %eax, 0xc(%rsp,%r14,4)
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x116b0
leaq (%r15,%r14), %rax
incq %rax
incq %r14
cmpq $0x1, %rax
jne 0x35946
movq 0x8(%rsp), %r15
jmp 0x359d2
leaq 0x15907(%rip), %rdx     # 0x4b2cc
jmp 0x358d6
xorl %r12d, %r12d
xorl %r13d, %r13d
xorl %ebp, %ebp
movq (%rsp), %r14
movq 0x20cd3(%rip), %rax     # 0x566b0
movl %r15d, %edi
movq %r14, %rsi
movl %r12d, %edx
movq %r13, %rcx
movq %rbp, %r8
callq *(%rax)
movq %rbx, %rdi
callq 0x11870
xorl %eax, %eax
addq $0x818, %rsp            # imm = 0x818
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq