// File: /workspace/github_c_makefile_star2_O0/stetre[P]moongl/src/whole_framebuffer.c
// Function: ClearBuffer
static int ClearBuffer(lua_State *L)
/* clear_buffer("color", drawbuffer, red, green, blue, alpha)
 * clear_buffer("depth", value)
 * clear_buffer("stencil", value)
 */
    {
    int named, arg = 1;
    GLuint framebuffer;
    GLint drawbuffer;
    GLfloat value[4];
    GLint stencil;
    GLenum buffer;
    if(lua_isinteger(L, 1))
        { 
        named = 1; 
        framebuffer = luaL_checkinteger(L, arg++);
        }
    else
        named = 0;
    buffer = checkclearbuffer(L, arg++);
    switch(buffer)
        {
        case GL_COLOR:      drawbuffer = luaL_checkinteger(L, arg++);
                            checkcolor(L, arg, value);
                            if(named)
                                glClearNamedFramebufferfv(framebuffer, buffer, drawbuffer, value);
                            else
                                glClearBufferfv(buffer, drawbuffer, value);
                            break;

        case GL_DEPTH:      value[0] = luaL_checknumber(L, arg++);
                            if(named)
                                glClearNamedFramebufferfv(framebuffer, buffer, 0, value);
                            else
                                glClearBufferfv(buffer, 0, value);
                            break;
        case GL_STENCIL:    stencil = luaL_checkinteger(L, arg++);
                            if(named)
                                glClearNamedFramebufferiv(framebuffer, buffer, 0, &stencil);
                            else
                                glClearBufferiv(buffer, 0, &stencil);
                            break;
        default:
            return luaL_error(L, UNEXPECTED_ERROR);
        }
    CheckError(L);
    return 0;
    }

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movl $0x1, 0x30(%rsp)
movq 0x38(%rsp), %rdi
movl $0x1, %esi
callq 0x115c0
cmpl $0x0, %eax
je 0x516da
movl $0x1, 0x34(%rsp)
movq 0x38(%rsp), %rdi
movl 0x30(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
callq 0x11af0
movl %eax, 0x2c(%rsp)
jmp 0x516e2
movl $0x0, 0x34(%rsp)
movq 0x38(%rsp), %rdi
movl 0x30(%rsp), %edx
movl %edx, %eax
incl %eax
movl %eax, 0x30(%rsp)
movl $0x50, %esi
callq 0x11160
movl %eax, 0x8(%rsp)
movl 0x8(%rsp), %eax
movl %eax, 0x4(%rsp)
subl $0x1800, %eax           # imm = 0x1800
je 0x51737
jmp 0x51712
movl 0x4(%rsp), %eax
subl $0x1801, %eax           # imm = 0x1801
je 0x517a9
jmp 0x51723
movl 0x4(%rsp), %eax
subl $0x1802, %eax           # imm = 0x1802
je 0x51807
jmp 0x5185f
movq 0x38(%rsp), %rdi
movl 0x30(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
callq 0x11af0
movl %eax, 0x28(%rsp)
movq 0x38(%rsp), %rdi
movl 0x30(%rsp), %esi
leaq 0x10(%rsp), %rdx
callq 0x11400
cmpl $0x0, 0x34(%rsp)
je 0x5178b
movq 0x15a8d(%rip), %rax     # 0x67200
movq (%rax), %rax
movl 0x2c(%rsp), %edi
movl 0x8(%rsp), %esi
movl 0x28(%rsp), %edx
leaq 0x10(%rsp), %rcx
callq *%rax
jmp 0x517a4
movq 0x167be(%rip), %rax     # 0x67f50
movq (%rax), %rax
movl 0x8(%rsp), %edi
movl 0x28(%rsp), %esi
leaq 0x10(%rsp), %rdx
callq *%rax
jmp 0x51884
movq 0x38(%rsp), %rdi
movl 0x30(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
callq 0x11a80
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x10(%rsp)
cmpl $0x0, 0x34(%rsp)
je 0x517ee
movq 0x15a28(%rip), %rax     # 0x67200
movq (%rax), %rax
movl 0x2c(%rsp), %edi
movl 0x8(%rsp), %esi
leaq 0x10(%rsp), %rcx
xorl %edx, %edx
callq *%rax
jmp 0x51805
movq 0x1675b(%rip), %rax     # 0x67f50
movq (%rax), %rax
movl 0x8(%rsp), %edi
leaq 0x10(%rsp), %rdx
xorl %esi, %esi
callq *%rax
jmp 0x51884
movq 0x38(%rsp), %rdi
movl 0x30(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
callq 0x11af0
movl %eax, 0xc(%rsp)
cmpl $0x0, 0x34(%rsp)
je 0x51846
movq 0x16450(%rip), %rax     # 0x67c80
movq (%rax), %rax
movl 0x2c(%rsp), %edi
movl 0x8(%rsp), %esi
xorl %edx, %edx
leaq 0xc(%rsp), %rcx
callq *%rax
jmp 0x5185d
movq 0x1628b(%rip), %rax     # 0x67ad8
movq (%rax), %rax
movl 0x8(%rsp), %edi
xorl %esi, %esi
leaq 0xc(%rsp), %rdx
callq *%rax
jmp 0x51884
movq 0x38(%rsp), %rdi
leaq 0xa1a(%rip), %rsi       # 0x52285
leaq 0xcdfb(%rip), %rdx      # 0x5e66d
movl $0xe8, %ecx
movb $0x0, %al
callq 0x11ae0
movl %eax, 0x44(%rsp)
jmp 0x51896
movq 0x38(%rsp), %rdi
callq 0x11880
movl $0x0, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nop