// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/teximage.c
// Function: TextureSubImage
static int TextureSubImage(lua_State *L)
    {
    intptr_t data;
    size_t len;
    int arg = 1;
    GLint v1, v2, v3, v4, v5, v6;
    GLenum target;
    GLuint texture = checktargetorname(L, arg++, &target, DOMAIN_TEXTURE_TARGET);
    GLint level = luaL_checkinteger(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++);
    v1 = luaL_checkinteger(L, arg++);
    v2 = luaL_checkinteger(L, arg++);
    if(lua_isnoneornil(L, arg))
        {
        if(texture==0)
            glTexSubImage1D(target, level, v1, v2, format, type, (void*)data);
        else
            glTextureSubImage1D(texture, level, v1, v2, format, type, (void*)data);
        CheckError(L);
        return 0;
        }
    v3 = luaL_checkinteger(L, arg++);
    v4 = luaL_checkinteger(L, arg++);
    if(lua_isnoneornil(L, arg))
        {
        if(texture==0)
            glTexSubImage2D(target, level, v1, v2, v3, v4, format, type, (void*)data);
        else
            glTextureSubImage2D(texture, level, v1, v2, v3, v4, format, type, (void*)data);
        CheckError(L);
        return 0;
        }
    v5 = luaL_checkinteger(L, arg++);
    v6 = luaL_checkinteger(L, arg++);
    if(texture==0)
        glTexSubImage3D(target,level, v1, v2, v3, v4, v5, v6,format,type,(void*)data);
    else
        glTextureSubImage3D(texture,level,v1, v2, v3, v4, v5, v6,format,type,(void*)data); 
    CheckError(L);
    return 0;
    }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq %rdi, 0x70(%rsp)
movl $0x1, 0x5c(%rsp)
movq 0x70(%rsp), %rdi
movl 0x5c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
leaq 0x40(%rsp), %rdx
movl $0x13, %ecx
callq 0x11430
movl %eax, 0x3c(%rsp)
movq 0x70(%rsp), %rdi
movl 0x5c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
callq 0x11af0
movl %eax, 0x38(%rsp)
movq 0x70(%rsp), %rdi
movl 0x5c(%rsp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
movl $0x12, %esi
callq 0x11160
movl %eax, 0x34(%rsp)
movq 0x70(%rsp), %rdi
movl 0x5c(%rsp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
movl $0x7, %esi
callq 0x11160
movl %eax, 0x30(%rsp)
movq 0x70(%rsp), %rdi
movl $0x88ef, %esi           # imm = 0x88EF
callq 0x11a70
movl %eax, %eax
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
jne 0x45d35
movq 0x70(%rsp), %rdi
movl 0x5c(%rsp), %esi
callq 0x11860
cmpl $0x0, %eax
jne 0x45ca6
movq $0x0, 0x68(%rsp)
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0x45d33
movq 0x70(%rsp), %rdi
movl 0x5c(%rsp), %esi
callq 0x110b0
cmpl $0x0, %eax
je 0x45cdb
movq 0x70(%rsp), %rdi
movl 0x5c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
xorl %eax, %eax
movl %eax, %edx
callq 0x11450
movq %rax, 0x68(%rsp)
jmp 0x45d31
movq 0x70(%rsp), %rdi
movl 0x5c(%rsp), %esi
callq 0x11860
cmpl $0x5, %eax
jne 0x45d11
movq 0x70(%rsp), %rdi
movl 0x5c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
leaq 0x60(%rsp), %rdx
callq 0x11b20
movq %rax, 0x68(%rsp)
jmp 0x45d2f
movq 0x70(%rsp), %rdi
movl 0x5c(%rsp), %esi
leaq 0xc4d7(%rip), %rdx      # 0x521f8
callq 0x11940
movl %eax, 0x7c(%rsp)
jmp 0x45ff2
jmp 0x45d31
jmp 0x45d33
jmp 0x45d51
movq 0x70(%rsp), %rdi
movl 0x5c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
callq 0x11af0
movq %rax, 0x68(%rsp)
movq 0x70(%rsp), %rdi
movl 0x5c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
callq 0x11af0
movl %eax, 0x58(%rsp)
movq 0x70(%rsp), %rdi
movl 0x5c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
callq 0x11af0
movl %eax, 0x54(%rsp)
movq 0x70(%rsp), %rdi
movl 0x5c(%rsp), %esi
callq 0x11860
cmpl $0x0, %eax
jg 0x45e11
cmpl $0x0, 0x3c(%rsp)
jne 0x45dcb
movl 0x40(%rsp), %edi
movl 0x38(%rsp), %esi
movl 0x58(%rsp), %edx
movl 0x54(%rsp), %ecx
movl 0x34(%rsp), %r8d
movl 0x30(%rsp), %r9d
movq 0x68(%rsp), %rax
movq %rax, (%rsp)
callq 0x11240
jmp 0x45dfa
movq 0x21c66(%rip), %rax     # 0x67a38
movq (%rax), %rax
movl 0x3c(%rsp), %edi
movl 0x38(%rsp), %esi
movl 0x58(%rsp), %edx
movl 0x54(%rsp), %ecx
movl 0x34(%rsp), %r8d
movl 0x30(%rsp), %r9d
movq 0x68(%rsp), %r10
movq %r10, (%rsp)
callq *%rax
movq 0x70(%rsp), %rdi
callq 0x11880
movl $0x0, 0x7c(%rsp)
jmp 0x45ff2
movq 0x70(%rsp), %rdi
movl 0x5c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
callq 0x11af0
movl %eax, 0x50(%rsp)
movq 0x70(%rsp), %rdi
movl 0x5c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
callq 0x11af0
movl %eax, 0x4c(%rsp)
movq 0x70(%rsp), %rdi
movl 0x5c(%rsp), %esi
callq 0x11860
cmpl $0x0, %eax
jg 0x45efb
cmpl $0x0, 0x3c(%rsp)
jne 0x45ea3
movl 0x40(%rsp), %edi
movl 0x38(%rsp), %esi
movl 0x58(%rsp), %edx
movl 0x54(%rsp), %ecx
movl 0x50(%rsp), %r8d
movl 0x4c(%rsp), %r9d
movl 0x34(%rsp), %r11d
movl 0x30(%rsp), %r10d
movq 0x68(%rsp), %rax
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x11960
jmp 0x45ee4
movq 0x2196e(%rip), %rax     # 0x67818
movq (%rax), %rax
movl 0x3c(%rsp), %edi
movl 0x38(%rsp), %esi
movl 0x58(%rsp), %edx
movl 0x54(%rsp), %ecx
movl 0x50(%rsp), %r8d
movl 0x4c(%rsp), %r9d
movl 0x34(%rsp), %ebx
movl 0x30(%rsp), %r11d
movq 0x68(%rsp), %r10
movl %ebx, (%rsp)
movl %r11d, 0x8(%rsp)
movq %r10, 0x10(%rsp)
callq *%rax
movq 0x70(%rsp), %rdi
callq 0x11880
movl $0x0, 0x7c(%rsp)
jmp 0x45ff2
movq 0x70(%rsp), %rdi
movl 0x5c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
callq 0x11af0
movl %eax, 0x48(%rsp)
movq 0x70(%rsp), %rdi
movl 0x5c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
callq 0x11af0
movl %eax, 0x44(%rsp)
cmpl $0x0, 0x3c(%rsp)
jne 0x45f8d
movq 0x22059(%rip), %rax     # 0x67f98
movq (%rax), %rax
movl 0x40(%rsp), %edi
movl 0x38(%rsp), %esi
movl 0x58(%rsp), %edx
movl 0x54(%rsp), %ecx
movl 0x50(%rsp), %r8d
movl 0x4c(%rsp), %r9d
movl 0x48(%rsp), %r14d
movl 0x44(%rsp), %ebp
movl 0x34(%rsp), %ebx
movl 0x30(%rsp), %r11d
movq 0x68(%rsp), %r10
movl %r14d, (%rsp)
movl %ebp, 0x8(%rsp)
movl %ebx, 0x10(%rsp)
movl %r11d, 0x18(%rsp)
movq %r10, 0x20(%rsp)
callq *%rax
jmp 0x45fe0
movq 0x21cc4(%rip), %rax     # 0x67c58
movq (%rax), %rax
movl 0x3c(%rsp), %edi
movl 0x38(%rsp), %esi
movl 0x58(%rsp), %edx
movl 0x54(%rsp), %ecx
movl 0x50(%rsp), %r8d
movl 0x4c(%rsp), %r9d
movl 0x48(%rsp), %r14d
movl 0x44(%rsp), %ebp
movl 0x34(%rsp), %ebx
movl 0x30(%rsp), %r11d
movq 0x68(%rsp), %r10
movl %r14d, (%rsp)
movl %ebp, 0x8(%rsp)
movl %ebx, 0x10(%rsp)
movl %r11d, 0x18(%rsp)
movq %r10, 0x20(%rsp)
callq *%rax
movq 0x70(%rsp), %rdi
callq 0x11880
movl $0x0, 0x7c(%rsp)
movl 0x7c(%rsp), %eax
addq $0x80, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopw %cs:(%rax,%rax)