// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
pushq $0x2c
popq %rsi
pushq $0x1
popq %rdx
callq 0x11150
movl %eax, %r14d
pushq $0x2d
popq %rsi
pushq $0x2
popq %rdx
movq %rbx, %rdi
callq 0x11150
movl %eax, %r13d
xorl %ebp, %ebp
leaq 0x3(%rbp), %r15
movq %rbx, %rdi
movl %r15d, %esi
callq 0x11850
testl %eax, %eax
jle 0x13e32
movq %rbx, %rdi
movl %r15d, %esi
callq 0x11af0
incq %rbp
jmp 0x13e0f
leal 0x3(%rbp), %esi
pushq $0x3
popq %r12
movl %ebp, %eax
xorl %edx, %edx
divl %r12d
movl %eax, %ecx
movl %ebp, %eax
cltd
idivl %r12d
cmpl $0x5, %esi
jb 0x13eee
movl %eax, %r15d
imull $-0x3, %ecx, %eax
addl %ebp, %eax
jne 0x13eee
movl %r13d, 0x10(%rsp)
movl %r14d, 0x14(%rsp)
movslq %r15d, %rcx
leaq (,%rcx,8), %rsi
shlq $0x2, %rcx
leaq 0x8(%rsp), %rdx
movq %rsp, %r8
movq %rbx, %rdi
movq %rcx, %r9
callq 0x119d0
movq %rax, %r13
xorl %r14d, %r14d
pushq $0x3
popq %rcx
movq %rbp, %rax
xorl %edx, %edx
divq %rcx
movq %rax, %rbp
cmpq %r14, %rbp
je 0x13f0d
movq %rbx, %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0x11040
movq %rax, (%r13,%r14,8)
leal 0x1(%r12), %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x11040
movq 0x8(%rsp), %rcx
movl %eax, (%rcx,%r14,4)
leal 0x2(%r12), %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x11040
movq (%rsp), %rcx
movl %eax, (%rcx,%r14,4)
incq %r14
addl $0x3, %r12d
jmp 0x13e9f
leaq 0x27689(%rip), %rsi     # 0x3b57e
movq %rbx, %rdi
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11ae0
movq 0x4184c(%rip), %rax     # 0x55760
movq 0x8(%rsp), %rsi
movq (%rsp), %r9
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %edx
movq %r13, %rcx
movl %r15d, %r8d
callq *(%rax)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x11360
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x11360
movq (%rsp), %rsi
movq %rbx, %rdi
callq 0x11360
movq %rbx, %rdi
callq 0x11870
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq