LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/utils.c
// Function: moongl_checkcolor
int checkcolor(lua_State *L, int arg, GLfloat dst[4])
    {
    int i;
    if(lua_type(L, arg) == LUA_TTABLE)
        {
        for(i=0; i<4; i++)
            {
            lua_rawgeti(L, arg, i+1);
            dst[i] = luaL_checknumber(L, -1);
            lua_pop(L, 1);
            }
        }
    else if(lua_type(L, arg) == LUA_TNUMBER)
        {
        dst[0] = luaL_checknumber(L, arg);
        dst[1] = luaL_checknumber(L, arg+1);
        dst[2] = luaL_checknumber(L, arg+2);
        dst[3] = luaL_checknumber(L, arg+3);
        }
    else
        return luaL_error(L, "color expected");
    return 0;
    }

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movl %esi, 0x14(%rsp)
movq %rdx, 0x8(%rsp)
movq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
callq 0x11860
cmpl $0x5, %eax
jne 0x4e91f
movl $0x0, 0x4(%rsp)
cmpl $0x4, 0x4(%rsp)
jge 0x4e91a
movq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
movl 0x4(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rdx
callq 0x11410
movq 0x18(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x11a80
cvtsd2ss %xmm0, %xmm0
movq 0x8(%rsp), %rax
movslq 0x4(%rsp), %rcx
movss %xmm0, (%rax,%rcx,4)
movq 0x18(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x116c0
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0x4e8bd
jmp 0x4e9c7
movq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
callq 0x11860
cmpl $0x3, %eax
jne 0x4e9ac
movq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
callq 0x11a80
cvtsd2ss %xmm0, %xmm0
movq 0x8(%rsp), %rax
movss %xmm0, (%rax)
movq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
addl $0x1, %esi
callq 0x11a80
cvtsd2ss %xmm0, %xmm0
movq 0x8(%rsp), %rax
movss %xmm0, 0x4(%rax)
movq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
addl $0x2, %esi
callq 0x11a80
cvtsd2ss %xmm0, %xmm0
movq 0x8(%rsp), %rax
movss %xmm0, 0x8(%rax)
movq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
addl $0x3, %esi
callq 0x11a80
cvtsd2ss %xmm0, %xmm0
movq 0x8(%rsp), %rax
movss %xmm0, 0xc(%rax)
jmp 0x4e9c5
movq 0x18(%rsp), %rdi
leaq 0xf9a7(%rip), %rsi      # 0x5e35f
movb $0x0, %al
callq 0x11ae0
movl %eax, 0x24(%rsp)
jmp 0x4e9cf
jmp 0x4e9c7
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/utils.c
// Function: moongl_checktargetorname
GLuint checktargetorname(lua_State *L, int arg, GLenum *dst, uint32_t domain)
/* The element at the index arg on the Lua stack may be an enum (string), or an integer.
 * In the first case the enum code is stored in 'code' and 0 is returned.
 * In the second case the integer value is returned.
 */
    {
    if(lua_isstring(L, arg))
        {
        *dst = enums_check(L, domain, arg);
        return 0;
        }
    return (GLuint)luaL_checkinteger(L, arg);
    }

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movl %esi, 0x14(%rsp)
movq %rdx, 0x8(%rsp)
movl %ecx, 0x4(%rsp)
movq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
callq 0x110b0
cmpl $0x0, %eax
je 0x4ea8e
movq 0x18(%rsp), %rdi
movl 0x4(%rsp), %esi
movl 0x14(%rsp), %edx
callq 0x11160
movl %eax, %ecx
movq 0x8(%rsp), %rax
movl %ecx, (%rax)
movl $0x0, 0x24(%rsp)
jmp 0x4eaa0
movq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
callq 0x11af0
movl %eax, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/utils.c
// Function: moongl_checkdataptr
const char *checkdataptr(lua_State *L, int arg, size_t *len)
    {
    *len = 0;
    char *data = NULL;
    if(!lua_istable(L, arg)) return NULL;
    lua_rawgeti(L, arg, 1);
    data = checklightuserdata(L, -1);
    lua_pop(L, 1);
    lua_rawgeti(L, arg, 2);
    *len = luaL_checkinteger(L, -1);
    lua_pop(L, 1);
    return data;
    }

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movl %esi, 0x14(%rsp)
movq %rdx, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq $0x0, (%rax)
movq $0x0, (%rsp)
movq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
callq 0x11860
cmpl $0x5, %eax
je 0x4eaf4
movq $0x0, 0x20(%rsp)
jmp 0x4eb6e
movq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
movl $0x1, %edx
callq 0x11410
movq 0x18(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x11780
movq %rax, (%rsp)
movq 0x18(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x116c0
movq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
movl $0x2, %edx
callq 0x11410
movq 0x18(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x11af0
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, (%rax)
movq 0x18(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x116c0
movq (%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
addq $0x28, %rsp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/vertex_array.c
// Function: EnableVertexAttribArray
UINT2_FUNC(VertexAttribDivisor)

static int EnableVertexAttribArray(lua_State *L)
/* enable_vertex_attrib_array(index)
 * enable_vertex_attrib_array(array, index)
 */
    {
    GLuint index, array;    
    if(lua_isinteger(L, 2))
        {
        array = luaL_checkinteger(L, 1);
        index = luaL_checkinteger(L, 2);
        glEnableVertexArrayAttrib(array, index);
        }
    else
        {
        index = luaL_checkinteger(L, 1);
        glEnableVertexAttribArray(index);
        }
    CheckError(L);
    return 0;
    }

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rdi
movl $0x2, %esi
callq 0x115c0
cmpl $0x0, %eax
je 0x4f6a9
movq 0x10(%rsp), %rdi
movl $0x1, %esi
callq 0x11af0
movl %eax, 0x8(%rsp)
movq 0x10(%rsp), %rdi
movl $0x2, %esi
callq 0x11af0
movl %eax, 0xc(%rsp)
movq 0x18336(%rip), %rax     # 0x679d0
movq (%rax), %rax
movl 0x8(%rsp), %edi
movl 0xc(%rsp), %esi
callq *%rax
jmp 0x4f6cc
movq 0x10(%rsp), %rdi
movl $0x1, %esi
callq 0x11af0
movl %eax, 0xc(%rsp)
movq 0x17d2d(%rip), %rax     # 0x673f0
movq (%rax), %rax
movl 0xc(%rsp), %edi
callq *%rax
movq 0x10(%rsp), %rdi
callq 0x11880
xorl %eax, %eax
addq $0x18, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/vertex_array.c
// Function: DisableVertexAttribArray
static int DisableVertexAttribArray(lua_State *L)
/* disable_vertex_attrib_array(index)
 * disable_vertex_attrib_array(array, index)
 */
    {
    GLuint index, array;    
    if(lua_isinteger(L, 2))
        {
        array = luaL_checkinteger(L, 1);
        index = luaL_checkinteger(L, 2);
        glDisableVertexArrayAttrib(array, index);
        }
    else
        {
        index = luaL_checkinteger(L, 1);
        glDisableVertexAttribArray(index);
        }
    CheckError(L);
    return 0;
    }

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rdi
movl $0x2, %esi
callq 0x115c0
cmpl $0x0, %eax
je 0x4f739
movq 0x10(%rsp), %rdi
movl $0x1, %esi
callq 0x11af0
movl %eax, 0x8(%rsp)
movq 0x10(%rsp), %rdi
movl $0x2, %esi
callq 0x11af0
movl %eax, 0xc(%rsp)
movq 0x18756(%rip), %rax     # 0x67e80
movq (%rax), %rax
movl 0x8(%rsp), %edi
movl 0xc(%rsp), %esi
callq *%rax
jmp 0x4f75c
movq 0x10(%rsp), %rdi
movl $0x1, %esi
callq 0x11af0
movl %eax, 0xc(%rsp)
movq 0x1819d(%rip), %rax     # 0x678f0
movq (%rax), %rax
movl 0xc(%rsp), %edi
callq *%rax
movq 0x10(%rsp), %rdi
callq 0x11880
xorl %eax, %eax
addq $0x18, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/vertex_array.c
// Function: VertexAttribPointerI
static int VertexAttribPointerI(lua_State *L)
/* vertex_attrib_i_pointer(index, size, type, stride, pointer) */
    {
    GLuint index = luaL_checkinteger(L, 1);
    GLint size = luaL_checkinteger(L, 2); /* no. of components */
    GLenum type = checktype(L, 3);
    GLsizei stride = luaL_checkinteger(L, 4);
    intptr_t pointer = luaL_checkinteger(L, 5);

    switch(type)
        {
        case GL_BYTE:
        case GL_UNSIGNED_BYTE:
        case GL_SHORT:
        case GL_UNSIGNED_SHORT:
        case GL_INT:
        case GL_UNSIGNED_INT:
                glVertexAttribIPointer(index, size, type, stride, (void*)pointer);
                break;
        default:
            return luaL_error(L, UNEXPECTED_ERROR);
        }
    CheckError(L);
    return 0;
    }

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq 0x18(%rsp), %rdi
movl $0x1, %esi
callq 0x11af0
movl %eax, 0x14(%rsp)
movq 0x18(%rsp), %rdi
movl $0x2, %esi
callq 0x11af0
movl %eax, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movl $0x7, %esi
movl $0x3, %edx
callq 0x11160
movl %eax, 0xc(%rsp)
movq 0x18(%rsp), %rdi
movl $0x4, %esi
callq 0x11af0
movl %eax, 0x8(%rsp)
movq 0x18(%rsp), %rdi
movl $0x5, %esi
callq 0x11af0
movq %rax, (%rsp)
movl 0xc(%rsp), %eax
addl $0xffffec00, %eax       # imm = 0xFFFFEC00
subl $0x5, %eax
ja 0x4f98f
jmp 0x4f96d
movq 0x17bb4(%rip), %rax     # 0x67528
movq (%rax), %rax
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %esi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
movq (%rsp), %r8
callq *%rax
jmp 0x4f9b4
movq 0x18(%rsp), %rdi
leaq 0x28ea(%rip), %rsi      # 0x52285
leaq 0xec3e(%rip), %rdx      # 0x5e5e0
movl $0x12b, %ecx            # imm = 0x12B
movb $0x0, %al
callq 0x11ae0
movl %eax, 0x24(%rsp)
jmp 0x4f9c6
movq 0x18(%rsp), %rdi
callq 0x11880
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/vertex_array.c
// Function: BindVertexBuffer
static int BindVertexBuffer(lua_State *L)
/* bind_vertex_buffer(index, buffer, offset, stride)
 * bind_vertex_buffer(array, index, buffer, offset, stride)
 */
    {
    int arg, named=0;
    GLuint array, index, buffer;
    GLintptr offset;
    GLsizei stride;
    arg = 1;
    if(lua_isinteger(L, 5))
        {
        named = 1;
        array = luaL_checkinteger(L, arg++);
        }
    index = luaL_checkinteger(L, arg++);
    buffer = luaL_checkinteger(L, arg++);
    offset = luaL_checkinteger(L, arg++);
    stride = luaL_checkinteger(L, arg++);
    if(named)
        glVertexArrayVertexBuffer(array, index, buffer, offset, stride);
    else    
        glBindVertexBuffer(index, buffer, offset, stride);
    CheckError(L);
    return 0;
    }

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movl $0x0, 0x28(%rsp)
movl $0x1, 0x2c(%rsp)
movq 0x30(%rsp), %rdi
movl $0x5, %esi
callq 0x115c0
cmpl $0x0, %eax
je 0x4fc50
movl $0x1, 0x28(%rsp)
movq 0x30(%rsp), %rdi
movl 0x2c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
callq 0x11af0
movl %eax, 0x24(%rsp)
movq 0x30(%rsp), %rdi
movl 0x2c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
callq 0x11af0
movl %eax, 0x20(%rsp)
movq 0x30(%rsp), %rdi
movl 0x2c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
callq 0x11af0
movl %eax, 0x1c(%rsp)
movq 0x30(%rsp), %rdi
movl 0x2c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
callq 0x11af0
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rdi
movl 0x2c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
callq 0x11af0
movl %eax, 0xc(%rsp)
cmpl $0x0, 0x28(%rsp)
je 0x4fce8
movq 0x17615(%rip), %rax     # 0x672e0
movq (%rax), %rax
movl 0x24(%rsp), %edi
movl 0x20(%rsp), %esi
movl 0x1c(%rsp), %edx
movq 0x10(%rsp), %rcx
movl 0xc(%rsp), %r8d
callq *%rax
jmp 0x4fd05
movq 0x17ea9(%rip), %rax     # 0x67b98
movq (%rax), %rax
movl 0x20(%rsp), %edi
movl 0x1c(%rsp), %esi
movq 0x10(%rsp), %rdx
movl 0xc(%rsp), %ecx
callq *%rax
movq 0x30(%rsp), %rdi
callq 0x11880
xorl %eax, %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/vertex_array.c
// Function: VertexAttribBinding
static int VertexAttribBinding(lua_State *L)
    {
    int arg, named = 0;
    GLuint array, attribindex, bindingindex;
    arg = 1;
    if(lua_isinteger(L, 3))
        {
        named = 1;
        array = luaL_checkinteger(L, arg++);
        }
    attribindex = luaL_checkinteger(L, arg++);
    bindingindex = luaL_checkinteger(L, arg++);
    if(named)
        glVertexArrayAttribBinding(array, attribindex, bindingindex);
    else
        glVertexAttribBinding(attribindex, bindingindex);
    CheckError(L);
    return 0;
    }

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl $0x0, 0x18(%rsp)
movl $0x1, 0x1c(%rsp)
movq 0x20(%rsp), %rdi
movl $0x3, %esi
callq 0x115c0
cmpl $0x0, %eax
je 0x50020
movl $0x1, 0x18(%rsp)
movq 0x20(%rsp), %rdi
movl 0x1c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
callq 0x11af0
movl %eax, 0x14(%rsp)
movq 0x20(%rsp), %rdi
movl 0x1c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
callq 0x11af0
movl %eax, 0x10(%rsp)
movq 0x20(%rsp), %rdi
movl 0x1c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
callq 0x11af0
movl %eax, 0xc(%rsp)
cmpl $0x0, 0x18(%rsp)
je 0x50077
movq 0x176cc(%rip), %rax     # 0x67730
movq (%rax), %rax
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %esi
movl 0xc(%rsp), %edx
callq *%rax
jmp 0x5008b
movq 0x1724a(%rip), %rax     # 0x672c8
movq (%rax), %rax
movl 0x10(%rsp), %edi
movl 0xc(%rsp), %esi
callq *%rax
movq 0x20(%rsp), %rdi
callq 0x11880
xorl %eax, %eax
addq $0x28, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/vertex_array.c
// Function: VertexBindingDivisor
static int VertexBindingDivisor(lua_State *L)
/* vertex_binding_divisor(index, divisor)
 * vertex_binding_divisor(array, index, divisor)
 */
    {
    GLuint index, divisor, array;   
    if(lua_isinteger(L, 3))
        {
        array = luaL_checkinteger(L, 1);
        index = luaL_checkinteger(L, 2);
        divisor = luaL_checkinteger(L, 3);
        glVertexArrayBindingDivisor(array, index, divisor);
        }
    else
        {
        index = luaL_checkinteger(L, 1);
        divisor = luaL_checkinteger(L, 2);
        glVertexBindingDivisor(index, divisor);
        }
    CheckError(L);
    return 0;
    }

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rdi
movl $0x3, %esi
callq 0x115c0
cmpl $0x0, %eax
je 0x50110
movq 0x10(%rsp), %rdi
movl $0x1, %esi
callq 0x11af0
movl %eax, 0x4(%rsp)
movq 0x10(%rsp), %rdi
movl $0x2, %esi
callq 0x11af0
movl %eax, 0xc(%rsp)
movq 0x10(%rsp), %rdi
movl $0x3, %esi
callq 0x11af0
movl %eax, 0x8(%rsp)
movq 0x17403(%rip), %rax     # 0x67500
movq (%rax), %rax
movl 0x4(%rsp), %edi
movl 0xc(%rsp), %esi
movl 0x8(%rsp), %edx
callq *%rax
jmp 0x5014a
movq 0x10(%rsp), %rdi
movl $0x1, %esi
callq 0x11af0
movl %eax, 0xc(%rsp)
movq 0x10(%rsp), %rdi
movl $0x2, %esi
callq 0x11af0
movl %eax, 0x8(%rsp)
movq 0x17753(%rip), %rax     # 0x67890
movq (%rax), %rax
movl 0xc(%rsp), %edi
movl 0x8(%rsp), %esi
callq *%rax
movq 0x10(%rsp), %rdi
callq 0x11880
xorl %eax, %eax
addq $0x18, %rsp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/vertex_array.c
// Function: BindAttribLocation
static int BindAttribLocation(lua_State *L)
    {
    GLuint program = luaL_checkinteger(L, 1);
    GLuint index = luaL_checkinteger(L, 2);
    const GLchar *name = luaL_checkstring(L, 3);
    glBindAttribLocation(program, index, name);
    CheckError(L);
    return 0;
    }

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rdi
movl $0x1, %esi
callq 0x11af0
movl %eax, 0xc(%rsp)
movq 0x10(%rsp), %rdi
movl $0x2, %esi
callq 0x11af0
movl %eax, 0x8(%rsp)
movq 0x10(%rsp), %rdi
movl $0x3, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x11450
movq %rax, (%rsp)
movq 0x17743(%rip), %rax     # 0x67d60
movq (%rax), %rax
movl 0xc(%rsp), %edi
movl 0x8(%rsp), %esi
movq (%rsp), %rdx
callq *%rax
movq 0x10(%rsp), %rdi
callq 0x11880
xorl %eax, %eax
addq $0x18, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/vertex_array.c
// Function: GetActiveAttrib
static int GetActiveAttrib(lua_State *L)
/* name, type, size = get_active_attribute(program, index) */
    {
    GLint size;
    GLenum type;
    GLsizei length;
    GLuint program = luaL_checkinteger(L, 1);
    GLuint index = luaL_checkinteger(L, 2);
    GLsizei bufsz = programGet(L, program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH);
    GLchar *name = (GLchar*)Malloc(L, bufsz*sizeof(GLchar));
    glGetActiveAttrib(program, index, bufsz, &length, &size, &type, name);
    CheckErrorFree(L, name);
    if(length == 0)
        { Free(L, name); return 0; }
    lua_pushstring(L, name);
    Free(L, name);
    pushglsltype(L, type);
    lua_pushinteger(L, size);
    return 3;
    }

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq 0x28(%rsp), %rdi
movl $0x1, %esi
callq 0x11af0
movl %eax, 0x18(%rsp)
movq 0x28(%rsp), %rdi
movl $0x2, %esi
callq 0x11af0
movl %eax, 0x14(%rsp)
movq 0x28(%rsp), %rdi
movl 0x18(%rsp), %esi
movl $0x8b8a, %edx           # imm = 0x8B8A
callq 0x11850
movl %eax, 0x10(%rsp)
movq 0x28(%rsp), %rdi
movslq 0x10(%rsp), %rsi
shlq $0x0, %rsi
callq 0x11200
movq %rax, 0x8(%rsp)
movq 0x16f5b(%rip), %rax     # 0x67600
movq (%rax), %rax
movl 0x18(%rsp), %edi
movl 0x14(%rsp), %esi
movl 0x10(%rsp), %edx
movq 0x8(%rsp), %r10
leaq 0x1c(%rsp), %rcx
leaq 0x24(%rsp), %r8
leaq 0x20(%rsp), %r9
movq %r10, (%rsp)
callq *%rax
movq 0x28(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x11550
cmpl $0x0, 0x1c(%rsp)
jne 0x506fd
movq 0x28(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x11370
movl $0x0, 0x34(%rsp)
jmp 0x50745
movq 0x28(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x110c0
movq 0x28(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x11370
movq 0x28(%rsp), %rdi
movl 0x20(%rsp), %edx
movl $0xe, %esi
callq 0x11120
movq 0x28(%rsp), %rdi
movslq 0x24(%rsp), %rsi
callq 0x113c0
movl $0x3, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/vertex_array.c
// Function: GetAttribLocation
static int GetAttribLocation(lua_State *L)
    {
    GLuint program = luaL_checkinteger(L, 1);
    const GLchar *name = luaL_checkstring(L, 2);
    GLint index = glGetAttribLocation(program, name);
    CheckError(L);
    lua_pushinteger(L, index);
    return 1;
    }

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq 0x20(%rsp), %rdi
movl $0x1, %esi
callq 0x11af0
movl %eax, 0x1c(%rsp)
movq 0x20(%rsp), %rdi
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x11450
movq %rax, 0x10(%rsp)
movq 0x1738d(%rip), %rax     # 0x67b18
movq (%rax), %rax
movl 0x1c(%rsp), %edi
movq 0x10(%rsp), %rsi
callq *%rax
movl %eax, 0xc(%rsp)
movq 0x20(%rsp), %rdi
callq 0x11880
movq 0x20(%rsp), %rdi
movslq 0xc(%rsp), %rsi
callq 0x113c0
movl $0x1, %eax
addq $0x28, %rsp
retq
// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/whole_framebuffer.c
// Function: ColorMask
static int ColorMask(lua_State *L)
    {
    GLuint buf;
    GLboolean r, g, b, a;
    if(lua_isinteger(L, 1))
        {
        buf = luaL_checkinteger(L, 1);
        r = checkboolean(L, 2);
        g = checkboolean(L, 3);
        b = checkboolean(L, 4);
        a = checkboolean(L, 5);
        glColorMaski(buf, r, g, b, a);
        }
    else
        {
        r = checkboolean(L, 1);
        g = checkboolean(L, 2);
        b = checkboolean(L, 3);
        a = checkboolean(L, 4);
        glColorMask(r, g, b, a);
        }
    CheckError(L);
    return 0;
    }

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rdi
movl $0x1, %esi
callq 0x115c0
cmpl $0x0, %eax
je 0x512df
movq 0x10(%rsp), %rdi
movl $0x1, %esi
callq 0x11af0
movl %eax, 0xc(%rsp)
movq 0x10(%rsp), %rdi
movl $0x2, %esi
callq 0x11510
movb %al, 0xb(%rsp)
movq 0x10(%rsp), %rdi
movl $0x3, %esi
callq 0x11510
movb %al, 0xa(%rsp)
movq 0x10(%rsp), %rdi
movl $0x4, %esi
callq 0x11510
movb %al, 0x9(%rsp)
movq 0x10(%rsp), %rdi
movl $0x5, %esi
callq 0x11510
movb %al, 0x8(%rsp)
movq 0x16b39(%rip), %rax     # 0x67df0
movq (%rax), %rax
movl 0xc(%rsp), %edi
movb 0xb(%rsp), %sil
movb 0xa(%rsp), %dl
movb 0x9(%rsp), %cl
movzbl %sil, %esi
movzbl %dl, %edx
movzbl %cl, %ecx
movzbl 0x8(%rsp), %r8d
callq *%rax
jmp 0x5134a
movq 0x10(%rsp), %rdi
movl $0x1, %esi
callq 0x11510
movb %al, 0xb(%rsp)
movq 0x10(%rsp), %rdi
movl $0x2, %esi
callq 0x11510
movb %al, 0xa(%rsp)
movq 0x10(%rsp), %rdi
movl $0x3, %esi
callq 0x11510
movb %al, 0x9(%rsp)
movq 0x10(%rsp), %rdi
movl $0x4, %esi
callq 0x11510
movb %al, 0x8(%rsp)
movb 0xb(%rsp), %dl
movb 0xa(%rsp), %cl
movb 0x9(%rsp), %al
movzbl %dl, %edi
movzbl %cl, %esi
movzbl %al, %edx
movzbl 0x8(%rsp), %ecx
callq 0x114f0
movq 0x10(%rsp), %rdi
callq 0x11880
xorl %eax, %eax
addq $0x18, %rsp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/whole_framebuffer.c
// Function: StencilMask
BOOLEAN_FUNC(DepthMask)

static int StencilMask(lua_State *L)
    {
    GLenum face;
    GLuint mask = luaL_checkinteger(L, 1);
    if(lua_isstring(L, 2))
        {
        face = checkface(L, 2);
        glStencilMaskSeparate(face, mask);
        }
    else
        glStencilMask(mask);
    CheckError(L);
    return 0;
    }

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rdi
movl $0x1, %esi
callq 0x11af0
movl %eax, 0x8(%rsp)
movq 0x10(%rsp), %rdi
movl $0x2, %esi
callq 0x110b0
cmpl $0x0, %eax
je 0x513fe
movq 0x10(%rsp), %rdi
movl $0x1f, %esi
movl $0x2, %edx
callq 0x11160
movl %eax, 0xc(%rsp)
movq 0x15ea1(%rip), %rax     # 0x67290
movq (%rax), %rax
movl 0xc(%rsp), %edi
movl 0x8(%rsp), %esi
callq *%rax
jmp 0x51407
movl 0x8(%rsp), %edi
callq 0x112f0
movq 0x10(%rsp), %rdi
callq 0x11880
xorl %eax, %eax
addq $0x18, %rsp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/whole_framebuffer.c
// Function: Clear
static int Clear(lua_State *L)
    {
    GLbitfield mask = CheckBufferBit(L, 1, 0);
    glClear(mask);
    CheckError(L);
    return 0;
    }

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rdi
movl $0x1, %esi
xorl %edx, %edx
leaq 0x174c4(%rip), %rcx     # 0x68900
callq 0x11b50
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %edi
callq 0x111f0
movq 0x10(%rsp), %rdi
callq 0x11880
xorl %eax, %eax
addq $0x18, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/whole_framebuffer.c
// Function: ClearColor
static int ClearColor(lua_State *L)
    {
    GLfloat color[4];
    checkcolor(L, 1, color);
    glClearColor(color[0], color[1], color[2], color[3]);
    CheckError(L);
    return 0;
    }

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rdi
movq %rsp, %rdx
movl $0x1, %esi
callq 0x11400
movss (%rsp), %xmm0
movss 0x4(%rsp), %xmm1
movss 0x8(%rsp), %xmm2
movss 0xc(%rsp), %xmm3
callq 0x11390
movq 0x10(%rsp), %rdi
callq 0x11880
xorl %eax, %eax
addq $0x18, %rsp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/whole_framebuffer.c
// Function: DrawBuffers
static int DrawBuffers(lua_State *L)
    {
    int named, arg = 1;
    GLuint framebuffer = 0;
    GLsizei n;
    GLenum *bufs;
    if(lua_isinteger(L, arg))
        {
        named = 1;
        framebuffer = luaL_checkinteger(L, arg++);
        }
    else
        named = 0;
    bufs = CheckBufList(L, arg, &n);
    if(named)
        glNamedFramebufferDrawBuffers(framebuffer, n, bufs);
    else
        glDrawBuffers(n, bufs);
    Free(L, bufs);
    CheckError(L);
    return 0;
    }

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl $0x1, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
movq 0x20(%rsp), %rdi
movl 0x18(%rsp), %esi
callq 0x115c0
cmpl $0x0, %eax
je 0x51611
movl $0x1, 0x1c(%rsp)
movq 0x20(%rsp), %rdi
movl 0x18(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
callq 0x11af0
movl %eax, 0x14(%rsp)
jmp 0x51619
movl $0x0, 0x1c(%rsp)
movq 0x20(%rsp), %rdi
movl 0x18(%rsp), %esi
leaq 0x10(%rsp), %rdx
callq 0x51990
movq %rax, 0x8(%rsp)
cmpl $0x0, 0x1c(%rsp)
je 0x51653
movq 0x16459(%rip), %rax     # 0x67a98
movq (%rax), %rax
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %esi
movq 0x8(%rsp), %rdx
callq *%rax
jmp 0x51668
movq 0x1673e(%rip), %rax     # 0x67d98
movq (%rax), %rax
movl 0x10(%rsp), %edi
movq 0x8(%rsp), %rsi
callq *%rax
movq 0x20(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x11370
movq 0x20(%rsp), %rdi
callq 0x11880
xorl %eax, %eax
addq $0x28, %rsp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/whole_framebuffer.c
// Function: ClearBufferfi
static int ClearBufferfi(lua_State *L)
/* clear_bufferfi(depth, stencil)
 */
    {
    int named, arg = 1;
    GLuint framebuffer;
    GLfloat depth;
    GLint stencil;
    if(lua_isinteger(L, 1))
        {
        named = 1;
        framebuffer = luaL_checkinteger(L, arg++);
        }
    else
        named = 0;
    depth = luaL_checknumber(L, arg++);
    stencil = luaL_checkinteger(L, arg++);
    if(named)
        {
#if 0
/*@@NOTE: The prototype for glClearNamedFramebufferfi() in glcorearb.h is/was wrong,
 *        (rfr: https://www.khronos.org/bugzilla/show_bug.cgi?id=1394 ),
 *        so this may not compile with OpenGL v4.5.
 *      In such a case, you can update the glcorearb.h file on your system with the
 *      correct version, or just disable this function by setting to 0 the above "#if 1".
 */
        glClearNamedFramebufferfi(framebuffer, GL_DEPTH_STENCIL, 0, depth, stencil);
#else
        (void)framebuffer;
        NOT_AVAILABLE;
#endif
        }
    else
        glClearBufferfi(GL_DEPTH_STENCIL, 0, depth, stencil);
    CheckError(L);
    return 0;
    }

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movl $0x1, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movl $0x1, %esi
callq 0x115c0
cmpl $0x0, %eax
je 0x518ea
movl $0x1, 0x14(%rsp)
movq 0x18(%rsp), %rdi
movl 0x10(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
callq 0x11af0
movl %eax, 0xc(%rsp)
jmp 0x518f2
movl $0x0, 0x14(%rsp)
movq 0x18(%rsp), %rdi
movl 0x10(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
callq 0x11a80
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x8(%rsp)
movq 0x18(%rsp), %rdi
movl 0x10(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
callq 0x11af0
movl %eax, 0x4(%rsp)
cmpl $0x0, 0x14(%rsp)
je 0x5194e
movq 0x18(%rsp), %rdi
leaq 0x8a0(%rip), %rsi       # 0x521e1
movb $0x0, %al
callq 0x11ae0
movl %eax, 0x24(%rsp)
jmp 0x5197d
movq 0x160cb(%rip), %rax     # 0x67a20
movq (%rax), %rax
movss 0x8(%rsp), %xmm0
movl 0x4(%rsp), %edx
movl $0x84f9, %edi           # imm = 0x84F9
xorl %esi, %esi
callq *%rax
movq 0x18(%rsp), %rdi
callq 0x11880
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/arachsys[P]init/runfg.c
// Function: main
int main(int argc, char **argv) {
  int result = EXIT_FAILURE, status;
  pid_t child, command;

  if (argc < 2) {
    fprintf(stderr, "Usage: %s CMD [ARG]...\n", argv[0]);
    return 64;
  }

  if (prctl(PR_SET_CHILD_SUBREAPER, 1) < 0)
    err(EXIT_FAILURE, "prctl PR_SET_CHILD_SUBREAPER");

  switch (command = fork()) {
    case -1:
      err(EXIT_FAILURE, "fork");
    case 0:
      execvp(argv[1], argv + 1);
      err(EXIT_FAILURE, "exec %s", argv[1]);
  }

  while (1) {
    child = waitpid(-1, &status, 0);
    if (child < 0) {
      if (errno == ECHILD)
        return result;
      if (errno != EINTR)
        err(EXIT_FAILURE, "waitpid");
    } else if (child == command) {
      if (WIFEXITED(status))
        result = WEXITSTATUS(status);
      if (WIFSIGNALED(status))
        result = 128 + WTERMSIG(status);
      command = -1;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, -0x14(%rbp)
cmpl $0x2, -0x8(%rbp)
jge 0x11ee
movq 0x2e2e(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0xe29(%rip), %rsi       # 0x2004
movb $0x0, %al
callq 0x1040
movl $0x40, -0x4(%rbp)
jmp 0x1313
movl $0x24, %edi
movl $0x1, %esi
movb $0x0, %al
callq 0x1050
cmpl $0x0, %eax
jge 0x1217
movl $0x1, %edi
leaq 0xe0c(%rip), %rsi       # 0x201c
movb $0x0, %al
callq 0x1060
callq 0x1090
movl %eax, -0x20(%rbp)
movl %eax, %ecx
movl %ecx, -0x24(%rbp)
subl $-0x1, %eax
je 0x1234
jmp 0x122b
movl -0x24(%rbp), %eax
testl %eax, %eax
je 0x1247
jmp 0x1277
movl $0x1, %edi
leaq 0xdf9(%rip), %rsi       # 0x2039
movb $0x0, %al
callq 0x1060
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
callq 0x1080
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x1, %edi
leaq 0xdce(%rip), %rsi       # 0x203e
movb $0x0, %al
callq 0x1060
jmp 0x1279
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
leaq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x1070
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0x12c3
callq 0x1030
cmpl $0xa, (%rax)
jne 0x12a4
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1313
callq 0x1030
cmpl $0x4, (%rax)
je 0x12c1
movl $0x1, %edi
leaq 0xd8c(%rip), %rsi       # 0x2046
movb $0x0, %al
callq 0x1060
jmp 0x130e
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jne 0x130c
movl -0x18(%rbp), %eax
andl $0x7f, %eax
cmpl $0x0, %eax
jne 0x12e4
movl -0x18(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
sarl $0x8, %eax
movl %eax, -0x14(%rbp)
movl -0x18(%rbp), %eax
andl $0x7f, %eax
addl $0x1, %eax
movsbl %al, %eax
sarl %eax
cmpl $0x0, %eax
jle 0x1305
movl -0x18(%rbp), %eax
andl $0x7f, %eax
addl $0x80, %eax
movl %eax, -0x14(%rbp)
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
jmp 0x130e
jmp 0x1279
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/Joy-Division[P]tools-mgs/dat-extract_enc.c
// Function: getExtensionFromHash32
char *getExtensionFromHash32(uint32_t hash) {
	char *retstring = malloc(16);
	memset(retstring, 0, 16);
	unsigned int i, testhash;
	for(i = 0; i < ZOE2_NUM_EXT; i++) {
		testhash = StrCode32(extListZoe2[i]);
		if(testhash == hash) RETPRINT(extListZoe2[i])
	}
	if(strlen(retstring) < 3) sprintf(retstring, "%08x", hash);
	return retstring;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movl $0x10, %edi
callq 0x5160
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x5100
movl $0x0, -0x14(%rbp)
cmpl $0x1b, -0x14(%rbp)
jae 0x5bc7
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0x75ce(%rip), %rax      # 0xd150
movq (%rax,%rcx,8), %rdi
callq 0x5410
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x4(%rbp), %eax
jne 0x5bba
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0x75aa(%rip), %rax      # 0xd150
movq (%rax,%rcx,8), %rdx
leaq 0x3a3e(%rip), %rsi      # 0x95ef
movb $0x0, %al
callq 0x5210
jmp 0x5bc7
jmp 0x5bbc
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5b70
movq -0x10(%rbp), %rdi
callq 0x50b0
cmpq $0x3, %rax
jae 0x5beb
movq -0x10(%rbp), %rdi
movl -0x4(%rbp), %edx
leaq 0x39be(%rip), %rsi      # 0x95a2
movb $0x0, %al
callq 0x5210
movq -0x10(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/Joy-Division[P]tools-mgs/dat-extract_enc.c
// Function: getFolderNameFromHash
char *getFolderNameFromHash(uint32_t hash, unsigned int flags) {
	char *retstring = malloc(16);
	switch(hash) {
		case 0x7F000010: RETPRINT("sound")
		case 0x7F010000: RETPRINT("nocache")
		case 0x7F000002: RETPRINT("cache")
		case 0x7F000003: RETPRINT("resident")
		case 0x7F000004: RETPRINT(flags & GAME_TTS ? "tts-04" : "delayload")
		case 0x7F000005: RETPRINT(flags & GAME_TTS ? "tts-05" : "delayload_w")
		default: {
			sprintf(retstring, "%08x", hash);
			break;
		}
	}
	return retstring;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl $0x10, %edi
callq 0x5160
movq %rax, -0x10(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x14(%rbp)
subl $0x7f000002, %eax       # imm = 0x7F000002
je 0x5cb6
jmp 0x5c2f
movl -0x14(%rbp), %eax
subl $0x7f000003, %eax       # imm = 0x7F000003
je 0x5cd4
jmp 0x5c3f
movl -0x14(%rbp), %eax
subl $0x7f000004, %eax       # imm = 0x7F000004
je 0x5cef
jmp 0x5c4f
movl -0x14(%rbp), %eax
subl $0x7f000005, %eax       # imm = 0x7F000005
je 0x5d1e
jmp 0x5c5f
movl -0x14(%rbp), %eax
subl $0x7f000010, %eax       # imm = 0x7F000010
je 0x5c7a
jmp 0x5c6b
movl -0x14(%rbp), %eax
subl $0x7f010000, %eax       # imm = 0x7F010000
je 0x5c98
jmp 0x5d4d
movq -0x10(%rbp), %rdi
leaq 0x396a(%rip), %rsi      # 0x95ef
leaq 0x391b(%rip), %rdx      # 0x95a7
movb $0x0, %al
callq 0x5210
jmp 0x5d62
movq -0x10(%rbp), %rdi
leaq 0x394c(%rip), %rsi      # 0x95ef
leaq 0x3903(%rip), %rdx      # 0x95ad
movb $0x0, %al
callq 0x5210
jmp 0x5d62
movq -0x10(%rbp), %rdi
leaq 0x392e(%rip), %rsi      # 0x95ef
leaq 0x38e7(%rip), %rdx      # 0x95af
movb $0x0, %al
callq 0x5210
jmp 0x5d62
movq -0x10(%rbp), %rdi
leaq 0x3910(%rip), %rsi      # 0x95ef
leaq 0x38cf(%rip), %rdx      # 0x95b5
movb $0x0, %al
callq 0x5210
jmp 0x5d62
movq -0x10(%rbp), %rdi
movl -0x8(%rbp), %ecx
andl $0x10, %ecx
leaq 0x38c5(%rip), %rdx      # 0x95c5
leaq 0x38b7(%rip), %rax      # 0x95be
cmpl $0x0, %ecx
cmovneq %rax, %rdx
leaq 0x38da(%rip), %rsi      # 0x95ef
movb $0x0, %al
callq 0x5210
jmp 0x5d62
movq -0x10(%rbp), %rdi
movl -0x8(%rbp), %ecx
andl $0x10, %ecx
leaq 0x38a7(%rip), %rdx      # 0x95d6
leaq 0x3899(%rip), %rax      # 0x95cf
cmpl $0x0, %ecx
cmovneq %rax, %rdx
leaq 0x38ab(%rip), %rsi      # 0x95ef
movb $0x0, %al
callq 0x5210
jmp 0x5d62
movq -0x10(%rbp), %rdi
movl -0x4(%rbp), %edx
leaq 0x3847(%rip), %rsi      # 0x95a2
movb $0x0, %al
callq 0x5210
movq -0x10(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/Joy-Division[P]tools-mgs/dat-extract_enc.c
// Function: getFileNameFromHashes
char *getFileNameFromHashes(uint32_t hash, uint32_t extension, unsigned int flags) {
	char *retstring = malloc(64);
	char *extensionstring = NULL;
	unsigned int result = matchhash(hash, extension, stagedic, numstagedic);
	if(result != 0xFFFFFFFF) sprintf(retstring, "%s", stagedic[result].name);
	else {
		result = matchhash(hash, extension, commondic, numcommondic);
		if(result != 0xFFFFFFFF) sprintf(retstring, "%s", commondic[result].name);
		else {
			if(flags & GAME_MGS2) sprintf(retstring, "%08x.%c", hash, extension+0x61 /* 'a' */);
			/* see extlist comment for info on how games are sorted */
			else if(flags & (GAME_MGS3|GAME_MGS4)) sprintf(retstring, "%08x.%s", hash, extList[(flags & GAME_MGS4) ? 1 : 0][extension]);
			else if(flags & GAME_ZOE2) {
				extensionstring = getExtensionFromHash32(extension);
				sprintf(retstring, "%08x.%s", hash, extensionstring);
				free(extensionstring);
			}
		}
	}
	return retstring;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
movl $0x40, %edi
callq 0x5160
movq %rax, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movq 0x74dc(%rip), %rdx      # 0xd280
movl 0x74e2(%rip), %ecx      # 0xd28c
callq 0x5ac0
movl %eax, -0x24(%rbp)
cmpl $-0x1, -0x24(%rbp)
je 0x5de7
movq -0x18(%rbp), %rdi
movq 0x74bd(%rip), %rdx      # 0xd280
movl -0x24(%rbp), %eax
imulq $0x108, %rax, %rax      # imm = 0x108
addq %rax, %rdx
addq $0x8, %rdx
leaq 0x3814(%rip), %rsi      # 0x95ef
movb $0x0, %al
callq 0x5210
jmp 0x5ef0
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movq 0x7484(%rip), %rdx      # 0xd278
movl 0x748e(%rip), %ecx      # 0xd288
callq 0x5ac0
movl %eax, -0x24(%rbp)
cmpl $-0x1, -0x24(%rbp)
je 0x5e37
movq -0x18(%rbp), %rdi
movq 0x7465(%rip), %rdx      # 0xd278
movl -0x24(%rbp), %eax
imulq $0x108, %rax, %rax      # imm = 0x108
addq %rax, %rdx
addq $0x8, %rdx
leaq 0x37c4(%rip), %rsi      # 0x95ef
movb $0x0, %al
callq 0x5210
jmp 0x5eee
movl -0xc(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x5e62
movq -0x18(%rbp), %rdi
movl -0x4(%rbp), %edx
movl -0x8(%rbp), %ecx
addl $0x61, %ecx
leaq 0x378c(%rip), %rsi      # 0x95e2
movb $0x0, %al
callq 0x5210
jmp 0x5eec
movl -0xc(%rbp), %eax
andl $0x6, %eax
cmpl $0x0, %eax
je 0x5eaf
movq -0x18(%rbp), %rdi
movl -0x4(%rbp), %edx
movl -0xc(%rbp), %esi
andl $0x4, %esi
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %esi
cmovnel %ecx, %eax
movslq %eax, %rcx
leaq 0x62bf(%rip), %rax      # 0xc150
shlq $0xb, %rcx
addq %rcx, %rax
movl -0x8(%rbp), %ecx
movq (%rax,%rcx,8), %rcx
leaq 0x3744(%rip), %rsi      # 0x95ea
movb $0x0, %al
callq 0x5210
jmp 0x5eea
movl -0xc(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x5ee8
movl -0x8(%rbp), %edi
callq 0x5b40
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movl -0x4(%rbp), %edx
movq -0x20(%rbp), %rcx
leaq 0x3712(%rip), %rsi      # 0x95ea
movb $0x0, %al
callq 0x5210
movq -0x20(%rbp), %rdi
callq 0x5030
jmp 0x5eea
jmp 0x5eec
jmp 0x5eee
jmp 0x5ef0
movq -0x18(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/Joy-Division[P]tools-mgs/dat-extract_enc.c
// Function: decryptHeader
unsigned int decryptHeader(unsigned char *data, unsigned int length, unsigned int flags) {
	uint32_t *values = (uint32_t *)data;
	uint32_t seed, workkey;
	if(flags & IS_BIGENDIAN) workkey = initialkeybig;
	else workkey = initialkey;
	unsigned int i;
	for(i = 0; i < length ;i++) {
		seed = workkey * key1;
		values[i] ^= workkey;
		if(flags & IS_BIGENDIAN) workkey = seed + (initialkeybig ^ 0x0000F0F0);
		else workkey = seed + (initialkey ^ 0x0000F0F0);
	}
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movl -0x10(%rbp), %eax
andl $0x14, %eax
cmpl $0x0, %eax
je 0x5f2c
movl 0x734d(%rip), %eax      # 0xd274
movl %eax, -0x20(%rbp)
jmp 0x5f35
movl 0x733e(%rip), %eax      # 0xd270
movl %eax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0xc(%rbp), %eax
jae 0x5fa3
movl -0x20(%rbp), %eax
imull 0x61e2(%rip), %eax      # 0xc130
movl %eax, -0x1c(%rbp)
movl -0x20(%rbp), %edx
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
xorl (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
movl -0x10(%rbp), %eax
andl $0x14, %eax
cmpl $0x0, %eax
je 0x5f82
movl -0x1c(%rbp), %eax
movl 0x72ff(%rip), %ecx      # 0xd274
xorl $0xf0f0, %ecx           # imm = 0xF0F0
addl %ecx, %eax
movl %eax, -0x20(%rbp)
jmp 0x5f96
movl -0x1c(%rbp), %eax
movl 0x72e5(%rip), %ecx      # 0xd270
xorl $0xf0f0, %ecx           # imm = 0xF0F0
addl %ecx, %eax
movl %eax, -0x20(%rbp)
jmp 0x5f98
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x5f3c
movl $0x1, %eax
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/Joy-Division[P]tools-mgs/dat-extract_enc.c
// Function: decryptStage
unsigned int decryptStage(unsigned char *data, unsigned int length, char *name, unsigned int flags) {
	uint32_t *values = (uint32_t *)data;
	uint32_t seed, workkey, namehash, workkeyt;
	unsigned int i;
	if(flags & GAME_ZOE2) namehash = StrCode32(name);
	else namehash = StrCode24(name);
	workkeyt = (namehash << 0x07) + namehash + key2;
	if(flags & IS_BIGENDIAN) workkey = (namehash << 0x07) + initialkeybig + namehash + key34;
	else workkey = (namehash << 0x07) + initialkey + namehash + key34;
	for(i = 0; i < length; i++) {
		seed = workkey * key1;
		values[i] ^= workkey;
		workkey = seed + workkeyt;
	}
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movl -0x1c(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x5fe7
movq -0x18(%rbp), %rdi
callq 0x5410
movl %eax, -0x34(%rbp)
jmp 0x5ff3
movq -0x18(%rbp), %rdi
callq 0x5390
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
shll $0x7, %eax
addl -0x34(%rbp), %eax
addl 0x6132(%rip), %eax      # 0xc134
movl %eax, -0x38(%rbp)
movl -0x1c(%rbp), %eax
andl $0x14, %eax
cmpl $0x0, %eax
je 0x602a
movl -0x34(%rbp), %eax
shll $0x7, %eax
addl 0x7258(%rip), %eax      # 0xd274
addl -0x34(%rbp), %eax
addl 0x6113(%rip), %eax      # 0xc138
movl %eax, -0x30(%rbp)
jmp 0x6042
movl -0x34(%rbp), %eax
shll $0x7, %eax
addl 0x723a(%rip), %eax      # 0xd270
addl -0x34(%rbp), %eax
addl 0x60f9(%rip), %eax      # 0xc138
movl %eax, -0x30(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jae 0x6082
movl -0x30(%rbp), %eax
imull 0x60d5(%rip), %eax      # 0xc130
movl %eax, -0x2c(%rbp)
movl -0x30(%rbp), %edx
movq -0x28(%rbp), %rax
movl -0x3c(%rbp), %ecx
xorl (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
movl -0x2c(%rbp), %eax
addl -0x38(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x6049
movl $0x1, %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/Joy-Division[P]tools-mgs/dat-extract_enc.c
// Function: decryptContent
unsigned int decryptContent(unsigned char *data, unsigned int length) {
	uint32_t *values = (uint32_t *)data;
	uint32_t seed, workkey, workkeyt, workkeyv;
	unsigned int i;
	workkeyv = key5 ^ key6;
	workkeyt = workkeyv * key7;
	workkey = workkeyv | ((workkeyv ^ key8) << 0x10);
	for(i = 0; i < length; i++) {
		seed = workkey * key1;
		values[i] ^= workkey;
		workkey = seed + workkeyt;
	}
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movl 0x6093(%rip), %eax      # 0xc13c
xorl 0x6091(%rip), %eax      # 0xc140
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
imull 0x6088(%rip), %eax      # 0xc144
movl %eax, -0x24(%rbp)
movl -0x28(%rbp), %eax
movl -0x28(%rbp), %ecx
xorl 0x607d(%rip), %ecx      # 0xc148
shll $0x10, %ecx
orl %ecx, %eax
movl %eax, -0x20(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jae 0x6113
movl -0x20(%rbp), %eax
imull 0x6044(%rip), %eax      # 0xc130
movl %eax, -0x1c(%rbp)
movl -0x20(%rbp), %edx
movq -0x18(%rbp), %rax
movl -0x2c(%rbp), %ecx
xorl (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
movl -0x1c(%rbp), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x60da
movl $0x1, %eax
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/videolan[P]bitstream/examples/dvb_ecmg_test.c
// Function: send_channel_setup
static void send_channel_setup(void)
{
    uint8_t p_tlv_h[MAX_TLV_SIZE];
    uint8_t *p_tlv = tlvh_get_tlv(p_tlv_h);
    uint8_t *p_tlv_n;

    tlvh_set_version(p_tlv_h, i_version);
    ecmg_init(p_tlv);
    tlv_set_type(p_tlv, ECMG_TYPE_CHANNEL_SETUP);
    /* length will be written at the end */
    tlv_set_length(p_tlv, MAX_TLV_SIZE);

    ecmg_append_channelid(p_tlv, i_channelid);
    ecmg_append_supercasid(p_tlv, i_supercasid);

    p_tlv_n = tlv_find_param(p_tlv, TLV_PARAM_EMPTY, 0);
    tlv_set_length(p_tlv, p_tlv_n - p_tlv - TLV_HEADER_SIZE);
    write_wrapper(p_tlv_h, p_tlv_n - p_tlv_h);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x410, %rsp            # imm = 0x410
leaq -0x400(%rbp), %rdi
callq 0x18a0
movq %rax, -0x408(%rbp)
leaq -0x400(%rbp), %rdi
movzbl 0x58bc(%rip), %esi      # 0x7098
callq 0x23b0
movq -0x408(%rbp), %rdi
callq 0x23d0
movq -0x408(%rbp), %rdi
movl $0x1, %esi
callq 0x23f0
movq -0x408(%rbp), %rdi
movl $0x3fc, %esi            # imm = 0x3FC
callq 0x2430
movq -0x408(%rbp), %rdi
movzwl 0x589b(%rip), %esi      # 0x70b8
callq 0x2470
movq -0x408(%rbp), %rdi
movl 0x588d(%rip), %esi      # 0x70bc
callq 0x2540
movq -0x408(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x2600
movq %rax, -0x410(%rbp)
movq -0x408(%rbp), %rdi
movq -0x410(%rbp), %rax
movq -0x408(%rbp), %rcx
subq %rcx, %rax
subq $0x4, %rax
movzwl %ax, %esi
callq 0x2430
leaq -0x400(%rbp), %rdi
movq -0x410(%rbp), %rsi
leaq -0x400(%rbp), %rax
subq %rax, %rsi
callq 0x12e0
addq $0x410, %rsp            # imm = 0x410
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/videolan[P]bitstream/examples/dvb_ecmg_test.c
// Function: handle_channel_status
static void handle_channel_status(uint8_t *p_tlv)
{
    uint16_t i_wanted_channelid = ecmg_find_channelid(p_tlv, 0);

    if (i_wanted_channelid != i_channelid) {
        send_channel_error(i_wanted_channelid, 0x6);
        exit(EXIT_FAILURE);
    }

    if (!b_init)
        return;

    if (ecmg_find_maxstreams(p_tlv, 0) < i_wanted_streams) {
        fprintf(stderr, "not enough supported streams (%hu)\n",
                ecmg_find_maxstreams(p_tlv, 0));
        exit(EXIT_FAILURE);
    }

    if (ecmg_find_mincpdur(p_tlv, 0) > i_period * 10) {
        fprintf(stderr, "crypto-period too short (%hu)\n",
                ecmg_find_mincpdur(p_tlv, 0));
        exit(EXIT_FAILURE);
    }

    i_sectiontspkt = ecmg_find_sectiontspkt(p_tlv, 0);
    i_nb_cw = ecmg_find_cwpermsg(p_tlv, 0);
    i_lead_cw = ecmg_find_leadcw(p_tlv, 0);

    fprintf(stderr,
            "starting channel ID=0x%hx version=%hhu super CAS ID=0x%x\n",
            i_channelid, i_version, i_supercasid);
    b_init = false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x2a50
movw %ax, -0xa(%rbp)
movzwl -0xa(%rbp), %eax
movzwl 0x53a2(%rip), %ecx      # 0x70b8
cmpl %ecx, %eax
je 0x1d32
movl $0x6, %esi
movzwl -0xa(%rbp), %edi
callq 0x18f0
movl $0x1, %edi
callq 0x10f0
testb $0x1, 0x5360(%rip)      # 0x7099
jne 0x1d40
jmp 0x1e46
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x2ae0
movzwl %ax, %eax
cmpl 0x5354(%rip), %eax      # 0x70a8
jge 0x1d8e
movq 0x529b(%rip), %rax      # 0x6ff8
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x2ae0
movq -0x18(%rbp), %rdi
movzwl %ax, %edx
leaq 0x2351(%rip), %rsi      # 0x40ce
movb $0x0, %al
callq 0x1080
movl $0x1, %edi
callq 0x10f0
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x2b70
movzwl %ax, %eax
imull $0xa, 0x5309(%rip), %ecx # 0x70ac
cmpl %ecx, %eax
jle 0x1ddf
movq 0x524a(%rip), %rax      # 0x6ff8
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x2b70
movq -0x20(%rbp), %rdi
movzwl %ax, %edx
leaq 0x2324(%rip), %rsi      # 0x40f2
movb $0x0, %al
callq 0x1080
movl $0x1, %edi
callq 0x10f0
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x2c00
movb %al, 0x52d4(%rip)       # 0x70c4
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x2c90
movb %al, 0x52c4(%rip)       # 0x70c5
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x2d20
movb %al, 0x52b4(%rip)       # 0x70c6
movq 0x51df(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
movzwl 0x5295(%rip), %edx      # 0x70b8
movzbl 0x526e(%rip), %ecx      # 0x7098
movl 0x528b(%rip), %r8d      # 0x70bc
leaq 0x22d9(%rip), %rsi      # 0x4111
movb $0x0, %al
callq 0x1080
movb $0x0, 0x5253(%rip)      # 0x7099
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/videolan[P]bitstream/examples/dvb_ecmg_test.c
// Function: handle_channel_test
static void handle_channel_test(uint8_t *p_tlv)
{
    uint16_t i_wanted_channelid = ecmg_find_channelid(p_tlv, 0);

    if (i_wanted_channelid != i_channelid) {
        send_channel_error(i_wanted_channelid, 0x6);
        exit(EXIT_FAILURE);
    }

    fprintf(stderr, "channel test received\n");
    exit(EXIT_FAILURE);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x2a50
movw %ax, -0xa(%rbp)
movzwl -0xa(%rbp), %eax
movzwl 0x5242(%rip), %ecx      # 0x70b8
cmpl %ecx, %eax
je 0x1e92
movl $0x6, %esi
movzwl -0xa(%rbp), %edi
callq 0x18f0
movl $0x1, %edi
callq 0x10f0
movq 0x515f(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x22a8(%rip), %rsi      # 0x414b
movb $0x0, %al
callq 0x1080
movl $0x1, %edi
callq 0x10f0
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/videolan[P]bitstream/examples/dvb_ecmg_test.c
// Function: handle_channel_error
static void handle_channel_error(uint8_t *p_tlv)
{
    uint16_t i_wanted_channelid = ecmg_find_channelid(p_tlv, 0);

    fprintf(stderr, "receiving error channel ID=0x%hu error=0x%hx\n",
            i_wanted_channelid, ecmg_find_errorstatus(p_tlv, 0));
    exit(EXIT_FAILURE);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x2a50
movw %ax, -0xa(%rbp)
movq 0x5116(%rip), %rax      # 0x6ff8
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movzwl -0xa(%rbp), %eax
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x2db0
movq -0x18(%rbp), %rdi
movl -0x10(%rbp), %edx
movzwl %ax, %ecx
leaq 0x2256(%rip), %rsi      # 0x4162
movb $0x0, %al
callq 0x1080
movl $0x1, %edi
callq 0x10f0
nopl (%rax)