// File: /workspace/github_c_makefile_star2_O1/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 0x115c0
movl %eax, %ebp
testl %eax, %eax
je 0x3dfc6
movq %rbx, %rdi
movl $0x1, %esi
callq 0x11af0
movq %rax, %r14
movl $0x2, %r15d
jmp 0x3dfc6
leal 0x1(%r15), %r12d
movq %rbx, %rdi
movl $0x50, %esi
movl %r15d, %edx
callq 0x11160
cmpl $0x1802, %eax           # imm = 0x1802
je 0x3e05e
cmpl $0x1801, %eax           # imm = 0x1801
je 0x3e032
cmpl $0x1800, %eax           # imm = 0x1800
jne 0x3e088
addl $0x2, %r15d
movq %rbx, %rdi
movl %r12d, %esi
callq 0x11af0
movq %rax, %r12
movq %rsp, %rdx
movq %rbx, %rdi
movl %r15d, %esi
callq 0x11400
testl %ebp, %ebp
je 0x3e0d5
movq 0x1837e(%rip), %rax     # 0x563a0
movq %rsp, %rcx
movl %r14d, %edi
movl $0x1800, %esi           # imm = 0x1800
movl %r12d, %edx
jmp 0x3e084
movq %rbx, %rdi
movl %r12d, %esi
callq 0x11a80
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%rsp)
testl %ebp, %ebp
je 0x3e0b1
movq 0x1834f(%rip), %rax     # 0x563a0
movq %rsp, %rcx
movl %r14d, %edi
movl $0x1801, %esi           # imm = 0x1801
jmp 0x3e082
movq %rbx, %rdi
movl %r12d, %esi
callq 0x11af0
movl %eax, (%rsp)
testl %ebp, %ebp
je 0x3e0c2
movq 0x18c89(%rip), %rax     # 0x56d00
movq %rsp, %rcx
movl %r14d, %edi
movl $0x1802, %esi           # imm = 0x1802
xorl %edx, %edx
callq *(%rax)
jmp 0x3e0e9
leaq 0x11f6(%rip), %rsi      # 0x3f285
leaq 0xde13(%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 0x18eb0(%rip), %rax     # 0x56f68
movq %rsp, %rdx
movl $0x1801, %edi           # imm = 0x1801
jmp 0x3e0d1
movq 0x18ad7(%rip), %rax     # 0x56ba0
movq %rsp, %rdx
movl $0x1802, %edi           # imm = 0x1802
xorl %esi, %esi
jmp 0x3e0e7
movq 0x18e8c(%rip), %rax     # 0x56f68
movq %rsp, %rdx
movl $0x1800, %edi           # imm = 0x1800
movl %r12d, %esi
callq *(%rax)
movq %rbx, %rdi
callq 0x11880
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq