// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/vertex_array.c
// Function: BindVertexBuffers
static int BindVertexBuffers(lua_State *L)
/*
 * bind_vertex_buffers(first, buffer1, offset1, stride1 [, buffer2, offset2, stride2, ...])
 * bind_vertex_buffers(array, first, buffer1, offset1, stride1 [, buffer2, offset2, stride2, ...])
 */
    {
    GLsizei named, count, i, arg;
    GLuint array, first;
    GLuint *buffers;
    GLintptr *offsets;
    GLsizei *strides;
    
    arg = 1;
    while(!lua_isnoneornil(L, arg))
        luaL_checkinteger(L, arg++);
    count = arg - 1;
    if(count < 4)
        return luaL_checkinteger(L, arg); /* raises an error */
    arg = 1;
    if(((count-2)%3) == 0)
        {
        named = 1;
        count = (count - 2)/3;
        array = luaL_checkinteger(L, arg++);
        }
    else if(((count-1)%3) == 0)
        {
        named = 0;
        count = (count - 1)/3;
        }
    else
        return luaL_error(L, NARGS_ERROR);
    first = lua_tointeger(L, arg++);
    buffers = (GLuint*)Malloc3(L, count*sizeof(GLuint),
                        (void**)&offsets, count*sizeof(GLintptr),
                        (void**)&strides, count*sizeof(GLsizei));
    for(i=0; i<count; i++)
        {
        buffers[i] = lua_tointeger(L, arg++);
        offsets[i] = lua_tointeger(L, arg++);
        strides[i] = lua_tointeger(L, arg++);
        }
    if(named)
        glVertexArrayVertexBuffers(array, first, count, buffers, offsets, strides);
    else
        glBindVertexBuffers(first, count, buffers, offsets, strides);
    Free(L, buffers);
    Free(L, offsets);
    Free(L, strides);
    CheckError(L);
    return 0;
    }

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movl $0x1, 0x28(%rsp)
movq 0x38(%rsp), %rdi
movl 0x28(%rsp), %esi
callq 0x11860
cmpl $0x0, %eax
setle %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x4fd4d
jmp 0x4fd66
movq 0x38(%rsp), %rdi
movl 0x28(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
callq 0x11af0
jmp 0x4fd31
movl 0x28(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x30(%rsp)
cmpl $0x4, 0x30(%rsp)
jge 0x4fd8f
movq 0x38(%rsp), %rdi
movl 0x28(%rsp), %esi
callq 0x11af0
movl %eax, 0x44(%rsp)
jmp 0x4ffbd
movl $0x1, 0x28(%rsp)
movl 0x30(%rsp), %eax
subl $0x2, %eax
movl $0x3, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x4fde3
movl $0x1, 0x34(%rsp)
movl 0x30(%rsp), %eax
subl $0x2, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %eax, 0x30(%rsp)
movq 0x38(%rsp), %rdi
movl 0x28(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
callq 0x11af0
movl %eax, 0x24(%rsp)
jmp 0x4fe32
movl 0x30(%rsp), %eax
subl $0x1, %eax
movl $0x3, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x4fe14
movl $0x0, 0x34(%rsp)
movl 0x30(%rsp), %eax
subl $0x1, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %eax, 0x30(%rsp)
jmp 0x4fe30
movq 0x38(%rsp), %rdi
leaq 0x275e(%rip), %rsi      # 0x5257e
movb $0x0, %al
callq 0x11ae0
movl %eax, 0x44(%rsp)
jmp 0x4ffbd
jmp 0x4fe32
movq 0x38(%rsp), %rdi
movl 0x28(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
xorl %eax, %eax
movl %eax, %edx
callq 0x11040
movl %eax, 0x20(%rsp)
movq 0x38(%rsp), %rdi
movslq 0x30(%rsp), %rsi
shlq $0x2, %rsi
movslq 0x30(%rsp), %rcx
shlq $0x3, %rcx
movslq 0x30(%rsp), %r9
shlq $0x2, %r9
leaq 0x10(%rsp), %rdx
leaq 0x8(%rsp), %r8
callq 0x119d0
movq %rax, 0x18(%rsp)
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x30(%rsp), %eax
jge 0x4ff2b
movq 0x38(%rsp), %rdi
movl 0x28(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
xorl %eax, %eax
movl %eax, %edx
callq 0x11040
movl %eax, %edx
movq 0x18(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x38(%rsp), %rdi
movl 0x28(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
xorl %eax, %eax
movl %eax, %edx
callq 0x11040
movq %rax, %rdx
movq 0x10(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x38(%rsp), %rdi
movl 0x28(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
xorl %eax, %eax
movl %eax, %edx
callq 0x11040
movl %eax, %edx
movq 0x8(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x4fe8d
cmpl $0x0, 0x34(%rsp)
je 0x4ff5b
movq 0x17e7f(%rip), %rax     # 0x67db8
movq (%rax), %rax
movl 0x24(%rsp), %edi
movl 0x20(%rsp), %esi
movl 0x30(%rsp), %edx
movq 0x18(%rsp), %rcx
movq 0x10(%rsp), %r8
movq 0x8(%rsp), %r9
callq *%rax
jmp 0x4ff7e
movq 0x174a6(%rip), %rax     # 0x67408
movq (%rax), %rax
movl 0x20(%rsp), %edi
movl 0x30(%rsp), %esi
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %r8
callq *%rax
movq 0x38(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x11370
movq 0x38(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x11370
movq 0x38(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x11370
movq 0x38(%rsp), %rdi
callq 0x11880
movl $0x0, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)