// File: /workspace/github_c_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl $0x1, %r15d
movl $0x1, %esi
callq 0x115b0
movl %eax, %ebp
testl %eax, %eax
je 0x3df9c
movq %rbx, %rdi
movl $0x1, %esi
callq 0x11af0
movq %rax, %r14
movl $0x2, %r15d
jmp 0x3df9c
leal 0x1(%r15), %r12d
movq %rbx, %rdi
movl $0x50, %esi
movl %r15d, %edx
callq 0x11150
cmpl $0x1802, %eax           # imm = 0x1802
je 0x3e034
cmpl $0x1801, %eax           # imm = 0x1801
je 0x3e008
cmpl $0x1800, %eax           # imm = 0x1800
jne 0x3e05e
addl $0x2, %r15d
movq %rbx, %rdi
movl %r12d, %esi
callq 0x11af0
movq %rax, %r12
movq %rsp, %rdx
movq %rbx, %rdi
movl %r15d, %esi
callq 0x113f0
testl %ebp, %ebp
je 0x3e0ab
movq 0x183a8(%rip), %rax     # 0x563a0
movq %rsp, %rcx
movl %r14d, %edi
movl $0x1800, %esi           # imm = 0x1800
movl %r12d, %edx
jmp 0x3e05a
movq %rbx, %rdi
movl %r12d, %esi
callq 0x11a80
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%rsp)
testl %ebp, %ebp
je 0x3e087
movq 0x18379(%rip), %rax     # 0x563a0
movq %rsp, %rcx
movl %r14d, %edi
movl $0x1801, %esi           # imm = 0x1801
jmp 0x3e058
movq %rbx, %rdi
movl %r12d, %esi
callq 0x11af0
movl %eax, (%rsp)
testl %ebp, %ebp
je 0x3e098
movq 0x18cb3(%rip), %rax     # 0x56d00
movq %rsp, %rcx
movl %r14d, %edi
movl $0x1802, %esi           # imm = 0x1802
xorl %edx, %edx
callq *(%rax)
jmp 0x3e0bf
leaq 0x1220(%rip), %rsi      # 0x3f285
leaq 0xde3d(%rip), %rdx      # 0x4bea9
movq %rbx, %rdi
movl $0xe8, %ecx
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x11ae0
movq 0x18eda(%rip), %rax     # 0x56f68
movq %rsp, %rdx
movl $0x1801, %edi           # imm = 0x1801
jmp 0x3e0a7
movq 0x18b01(%rip), %rax     # 0x56ba0
movq %rsp, %rdx
movl $0x1802, %edi           # imm = 0x1802
xorl %esi, %esi
jmp 0x3e0bd
movq 0x18eb6(%rip), %rax     # 0x56f68
movq %rsp, %rdx
movl $0x1800, %edi           # imm = 0x1800
movl %r12d, %esi
callq *(%rax)
movq %rbx, %rdi
callq 0x11870
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq