// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %r15
movl %r15d, %esi
callq 0x115b0
movl %eax, %ebp
testl %eax, %eax
je 0x3ab86
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x11af0
movq %rax, %r14
pushq $0x2
popq %r15
jmp 0x3ab86
leal 0x1(%r15), %r12d
pushq $0x50
popq %rsi
movq %rbx, %rdi
movl %r15d, %edx
callq 0x11150
cmpl $0x1802, %eax           # imm = 0x1802
je 0x3ac1c
cmpl $0x1801, %eax           # imm = 0x1801
je 0x3abf0
cmpl $0x1800, %eax           # imm = 0x1800
jne 0x3ac46
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 0x3ac93
movq 0x1a7c0(%rip), %rax     # 0x553a0
movq %rsp, %rcx
movl %r14d, %edi
movl $0x1800, %esi           # imm = 0x1800
movl %r12d, %edx
jmp 0x3ac42
movq %rbx, %rdi
movl %r12d, %esi
callq 0x11a80
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%rsp)
testl %ebp, %ebp
je 0x3ac6f
movq 0x1a791(%rip), %rax     # 0x553a0
movq %rsp, %rcx
movl %r14d, %edi
movl $0x1801, %esi           # imm = 0x1801
jmp 0x3ac40
movq %rbx, %rdi
movl %r12d, %esi
callq 0x11af0
movl %eax, (%rsp)
testl %ebp, %ebp
je 0x3ac80
movq 0x1b0cb(%rip), %rax     # 0x55d00
movq %rsp, %rcx
movl %r14d, %edi
movl $0x1802, %esi           # imm = 0x1802
xorl %edx, %edx
callq *(%rax)
jmp 0x3aca7
leaq 0x638(%rip), %rsi       # 0x3b285
leaq 0xd27d(%rip), %rdx      # 0x47ed1
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 0x1b2f2(%rip), %rax     # 0x55f68
movq %rsp, %rdx
movl $0x1801, %edi           # imm = 0x1801
jmp 0x3ac8f
movq 0x1af19(%rip), %rax     # 0x55ba0
movq %rsp, %rdx
movl $0x1802, %edi           # imm = 0x1802
xorl %esi, %esi
jmp 0x3aca5
movq 0x1b2ce(%rip), %rax     # 0x55f68
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