// File: /workspace/github_c_makefile_star2_O3/stetre[P]moonnuklear/src/widgets.c
// Function: Button
static int Button(lua_State *L)
    {
    int rc;
    size_t len;
    const char *title;
    nk_color_t color;
    nk_flags alignment;
    enum nk_symbol_type symbol;
    nk_image_t *image;
#if 0 //@@ for styled buttons, use nk.style_push/nk.style_pop instead
    //const nk_style_button_t *style:
    //rc = nk_button_text_styled(context, style, title, len);
    //rc = nk_button_image_styled(context, style, *image);
    //rc = nk_button_image_text_styled(context, style, *image, title, len, alignment);
    //rc = nk_button_symbol_styled(context, style, symbol);
    //rc = nk_button_symbol_text_styled(context, style, symbol, title, len, alignment);
#endif
    nk_context_t *context = checkcontext(L, 1, NULL);
    int arg_type = lua_type(L, 2);
    if(arg_type == LUA_TNIL)
        {
        title = luaL_checklstring(L, 3, &len);
        rc = nk_button_text(context, title, len);
        }
    else if(arg_type == LUA_TTABLE)
        {
        if(echeckcolor(L, 2, &color)) return argerror(L, 2);
        rc = nk_button_color(context, color);
        }
    else if((image = testimage(L, 2, NULL)) != NULL)
        {
        if(lua_isnoneornil(L, 3))
            rc = nk_button_image(context, *image);
        else
            {
            title = luaL_checklstring(L, 3, &len);
            alignment = checkflags(L, 4); /* textalign */
            rc = nk_button_image_text(context, *image, title, len, alignment);
            }
        }
    else
        {
        symbol = checksymboltype(L, 2);
        if(lua_isnoneornil(L, 3))
            rc = nk_button_symbol(context, symbol);
        else
            {
            title = luaL_checklstring(L, 3, &len);
            alignment = checkflags(L, 4); /* textalign */
            rc = nk_button_symbol_text(context, symbol, title, len, alignment);
            }
        }
    lua_pushboolean(L, rc);
    return 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x3d27(%rip), %rcx      # 0x67280
movl $0x1, %esi
xorl %edx, %edx
callq 0x120d0
movq %rax, %r14
movq %rbx, %rdi
movl $0x2, %esi
callq 0x13df0
cmpl $0x5, %eax
je 0x635a6
testl %eax, %eax
jne 0x635e4
leaq 0x20(%rsp), %r15
movq %rbx, %rdi
movl $0x3, %esi
movq %r15, %rdx
callq 0x12cd0
movl (%r15), %edx
movq %r14, %rdi
movq %rax, %rsi
callq 0x13e00
jmp 0x636f8
leaq 0x1c(%rsp), %rdx
movq %rbx, %rdi
movl $0x2, %esi
callq 0x12100
testl %eax, %eax
je 0x63663
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x12630
movq %rbx, %rdi
movl $0x2, %esi
movq %rax, %rdx
callq 0x12460
jmp 0x63707
leaq 0x3c59(%rip), %rcx      # 0x67244
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x14150
testq %rax, %rax
je 0x63674
movq %rax, %r15
movq %rbx, %rdi
movl $0x3, %esi
callq 0x13df0
testl %eax, %eax
jle 0x636d3
leaq 0x20(%rsp), %r12
movq %rbx, %rdi
movl $0x3, %esi
movq %r12, %rdx
callq 0x12cd0
movq %rax, %r13
movq %rbx, %rdi
movl $0x4, %esi
callq 0x12f30
movl (%r12), %edx
movq 0x10(%r15), %rcx
movq %rcx, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
movq %r13, %rsi
movl %eax, %ecx
callq 0x13150
jmp 0x636f8
movl 0x1c(%rsp), %esi
movq %r14, %rdi
callq 0x137f0
jmp 0x636f8
movq %rbx, %rdi
movl $0xe, %esi
movl $0x2, %edx
callq 0x132f0
movl %eax, %ebp
movq %rbx, %rdi
movl $0x3, %esi
callq 0x13df0
testl %eax, %eax
jle 0x636ee
leaq 0x20(%rsp), %r15
movq %rbx, %rdi
movl $0x3, %esi
movq %r15, %rdx
callq 0x12cd0
movq %rax, %r12
movq %rbx, %rdi
movl $0x4, %esi
callq 0x12f30
movl (%r15), %ecx
movq %r14, %rdi
movl %ebp, %esi
movq %r12, %rdx
movl %eax, %r8d
callq 0x14110
jmp 0x636f8
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
callq 0x12a80
jmp 0x636f8
movq %r14, %rdi
movl %ebp, %esi
callq 0x133d0
movl %eax, %esi
movq %rbx, %rdi
callq 0x13270
movl $0x1, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq