// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/draw.c
// Function: MultiDrawElementsBaseVertex
static int MultiDrawElementsBaseVertex(lua_State *L)
/* multi_draw_elements_base_vertex
 *  (mode, type, count1, indices1, basevertex1, [, count2, indices2, basevertex2, ...]) 
 */
    {
    GLsizei *count, drawcount, i, arg;
    GLintptr *indices;
    GLint *basevertex;
    GLenum mode = checkdrawmode(L, 1);
    GLenum type = checkdrawtype(L, 2);
    arg = 3;
    while(!lua_isnoneornil(L, arg))
        luaL_checkinteger(L, arg++);
    drawcount = arg - 3;
    if(((arg<5) || (drawcount%3) != 0))
        return luaL_error(L, NARGS_ERROR);
    drawcount /= 3;
    indices = (GLintptr*)Malloc3(L, drawcount*sizeof(GLintptr), 
                    (void**)&count, drawcount*sizeof(GLsizei),
                    (void**)&basevertex, drawcount*sizeof(GLint));
    arg = 3;
    for(i=0; i<drawcount; i++)
        {
        indices[i] = lua_tointeger(L, arg++);
        count[i] = lua_tointeger(L, arg++);
        basevertex[i] = lua_tointeger(L, arg++);
        }
    glMultiDrawElementsBaseVertex(mode, count, type, (const void* const*)indices, drawcount,basevertex);
    Free(L, indices); 
    Free(L, count);
    Free(L, basevertex);
    CheckError(L);
    return 0;
    }

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq 0x38(%rsp), %rdi
movl $0x2c, %esi
movl $0x1, %edx
callq 0x11160
movl %eax, 0xc(%rsp)
movq 0x38(%rsp), %rdi
movl $0x2d, %esi
movl $0x2, %edx
callq 0x11160
movl %eax, 0x8(%rsp)
movl $0x3, 0x24(%rsp)
movq 0x38(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x11860
cmpl $0x0, %eax
setle %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x14f7d
jmp 0x14f96
movq 0x38(%rsp), %rdi
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
callq 0x11af0
jmp 0x14f61
movl 0x24(%rsp), %eax
subl $0x3, %eax
movl %eax, 0x2c(%rsp)
cmpl $0x5, 0x24(%rsp)
jl 0x14fb9
movl 0x2c(%rsp), %eax
movl $0x3, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
je 0x14fd5
movq 0x38(%rsp), %rdi
leaq 0x3d5b9(%rip), %rsi     # 0x5257e
movb $0x0, %al
callq 0x11ae0
movl %eax, 0x44(%rsp)
jmp 0x1512e
movl 0x2c(%rsp), %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %eax, 0x2c(%rsp)
movq 0x38(%rsp), %rdi
movslq 0x2c(%rsp), %rsi
shlq $0x3, %rsi
movslq 0x2c(%rsp), %rcx
shlq $0x2, %rcx
movslq 0x2c(%rsp), %r9
shlq $0x2, %r9
leaq 0x30(%rsp), %rdx
leaq 0x10(%rsp), %r8
callq 0x119d0
movq %rax, 0x18(%rsp)
movl $0x3, 0x24(%rsp)
movl $0x0, 0x28(%rsp)
movl 0x28(%rsp), %eax
cmpl 0x2c(%rsp), %eax
jge 0x150c7
movq 0x38(%rsp), %rdi
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
xorl %eax, %eax
movl %eax, %edx
callq 0x11040
movq %rax, %rdx
movq 0x18(%rsp), %rax
movslq 0x28(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x38(%rsp), %rdi
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
xorl %eax, %eax
movl %eax, %edx
callq 0x11040
movl %eax, %edx
movq 0x30(%rsp), %rax
movslq 0x28(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x38(%rsp), %rdi
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
xorl %eax, %eax
movl %eax, %edx
callq 0x11040
movl %eax, %edx
movq 0x10(%rsp), %rax
movslq 0x28(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x15029
movq 0x52552(%rip), %rax     # 0x67620
movq (%rax), %rax
movl 0xc(%rsp), %edi
movq 0x30(%rsp), %rsi
movl 0x8(%rsp), %edx
movq 0x18(%rsp), %rcx
movl 0x2c(%rsp), %r8d
movq 0x10(%rsp), %r9
callq *%rax
movq 0x38(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x11370
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x11370
movq 0x38(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x11370
movq 0x38(%rsp), %rdi
callq 0x11880
movl $0x0, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopw (%rax,%rax)