// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/teximage.c
// Function: TextureImage
static int TextureImage(lua_State *L)
    {
    intptr_t data;
    size_t len;
    GLsizei width, height, depth;
    int arg = 1;
    GLenum target = checktexturetarget(L, arg++);
    GLint level = luaL_checkinteger(L, arg++);
    GLenum intfmt = checkinternalformat(L, arg++);
    GLenum format = checkformat(L, arg++);
    GLenum type = checktype(L, arg++);
    GLint64 bound_buffer = getUint(L, GL_PIXEL_UNPACK_BUFFER_BINDING);
    if(bound_buffer == 0) /* no buffer is bound to GL_PIXEL_UNPACK_BUFFER */
        {
        if(lua_isnil(L, arg)) /* no pixel transfer */
            { data = 0; arg++; }
        else if(lua_isstring(L, arg))
            data = (intptr_t)luaL_checkstring(L, arg++);
        else if(lua_istable(L, arg))
            data = (intptr_t)checkdataptr(L, arg++, &len);
        else
            return luaL_argerror(L, arg, "invalid type");
        }
    else /* a buffer is bound to GL_PIXEL_UNPACK_BUFFER, so data must be an offset */
        data = luaL_checkinteger(L, arg++);
    width = luaL_checkinteger(L, arg++);
    if(lua_isnoneornil(L, arg))
        {
        glTexImage1D(target,level,intfmt,width,border,format,type,(void*)data);
        CheckError(L);
        return 0;
        }
    height = luaL_checkinteger(L, arg++);
    if(lua_isnoneornil(L, arg))
        {
        glTexImage2D(target,level,intfmt,width,height,border,format,type,(void*)data);
        CheckError(L);
        return 0;
        }
    depth = luaL_checkinteger(L, arg++);
    glTexImage3D(target,level,intfmt,width,height,depth,border,format,type,(void*)data);
    CheckError(L);
    return 0;
    }

// Assembly:
pushq %rbp
pushq %rbx
subq $0x78, %rsp
movq %rdi, 0x68(%rsp)
movl $0x1, 0x48(%rsp)
movq 0x68(%rsp), %rdi
movl 0x48(%rsp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
movl $0x13, %esi
callq 0x11160
movl %eax, 0x44(%rsp)
movq 0x68(%rsp), %rdi
movl 0x48(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
callq 0x11af0
movl %eax, 0x40(%rsp)
movq 0x68(%rsp), %rdi
movl 0x48(%rsp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
movl $0x11, %esi
callq 0x11160
movl %eax, 0x3c(%rsp)
movq 0x68(%rsp), %rdi
movl 0x48(%rsp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
movl $0x12, %esi
callq 0x11160
movl %eax, 0x38(%rsp)
movq 0x68(%rsp), %rdi
movl 0x48(%rsp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
movl $0x7, %esi
callq 0x11160
movl %eax, 0x34(%rsp)
movq 0x68(%rsp), %rdi
movl $0x88ef, %esi           # imm = 0x88EF
callq 0x11a70
movl %eax, %eax
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
jne 0x45a2b
movq 0x68(%rsp), %rdi
movl 0x48(%rsp), %esi
callq 0x11860
cmpl $0x0, %eax
jne 0x4599c
movq $0x0, 0x60(%rsp)
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0x45a29
movq 0x68(%rsp), %rdi
movl 0x48(%rsp), %esi
callq 0x110b0
cmpl $0x0, %eax
je 0x459d1
movq 0x68(%rsp), %rdi
movl 0x48(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
xorl %eax, %eax
movl %eax, %edx
callq 0x11450
movq %rax, 0x60(%rsp)
jmp 0x45a27
movq 0x68(%rsp), %rdi
movl 0x48(%rsp), %esi
callq 0x11860
cmpl $0x5, %eax
jne 0x45a07
movq 0x68(%rsp), %rdi
movl 0x48(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
leaq 0x58(%rsp), %rdx
callq 0x11b20
movq %rax, 0x60(%rsp)
jmp 0x45a25
movq 0x68(%rsp), %rdi
movl 0x48(%rsp), %esi
leaq 0xc7e1(%rip), %rdx      # 0x521f8
callq 0x11940
movl %eax, 0x74(%rsp)
jmp 0x45bb0
jmp 0x45a27
jmp 0x45a29
jmp 0x45a47
movq 0x68(%rsp), %rdi
movl 0x48(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
callq 0x11af0
movq %rax, 0x60(%rsp)
movq 0x68(%rsp), %rdi
movl 0x48(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
callq 0x11af0
movl %eax, 0x54(%rsp)
movq 0x68(%rsp), %rdi
movl 0x48(%rsp), %esi
callq 0x11860
cmpl $0x0, %eax
jg 0x45abc
movl 0x44(%rsp), %edi
movl 0x40(%rsp), %esi
movl 0x3c(%rsp), %edx
movl 0x54(%rsp), %ecx
movl 0x38(%rsp), %r9d
movl 0x34(%rsp), %r10d
movq 0x60(%rsp), %rax
xorl %r8d, %r8d
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x11a30
movq 0x68(%rsp), %rdi
callq 0x11880
movl $0x0, 0x74(%rsp)
jmp 0x45bb0
movq 0x68(%rsp), %rdi
movl 0x48(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
callq 0x11af0
movl %eax, 0x50(%rsp)
movq 0x68(%rsp), %rdi
movl 0x48(%rsp), %esi
callq 0x11860
cmpl $0x0, %eax
jg 0x45b38
movl 0x44(%rsp), %edi
movl 0x40(%rsp), %esi
movl 0x3c(%rsp), %edx
movl 0x54(%rsp), %ecx
movl 0x50(%rsp), %r8d
movl 0x38(%rsp), %r11d
movl 0x34(%rsp), %r10d
movq 0x60(%rsp), %rax
xorl %r9d, %r9d
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x11840
movq 0x68(%rsp), %rdi
callq 0x11880
movl $0x0, 0x74(%rsp)
jmp 0x45bb0
movq 0x68(%rsp), %rdi
movl 0x48(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
callq 0x11af0
movl %eax, 0x4c(%rsp)
movq 0x21ece(%rip), %rax     # 0x67a28
movq (%rax), %rax
movl 0x44(%rsp), %edi
movl 0x40(%rsp), %esi
movl 0x3c(%rsp), %edx
movl 0x54(%rsp), %ecx
movl 0x50(%rsp), %r8d
movl 0x4c(%rsp), %r9d
movl 0x38(%rsp), %ebx
movl 0x34(%rsp), %r11d
movq 0x60(%rsp), %r10
xorl %ebp, %ebp
movl $0x0, (%rsp)
movl %ebx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movq %r10, 0x18(%rsp)
callq *%rax
movq 0x68(%rsp), %rdi
callq 0x11880
movl $0x0, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0x78, %rsp
popq %rbx
popq %rbp
retq
nopl (%rax,%rax)