// File: /workspace/github_c_makefile_star2_O2/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 0x3261(%rip), %rcx      # 0x60280
pushq $0x1
popq %rbp
movl %ebp, %esi
xorl %edx, %edx
callq 0x120e0
movq %rax, %r14
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x14030
cmpl $0x5, %eax
je 0x5d068
testl %eax, %eax
jne 0x5d0a2
pushq $0x3
popq %rsi
leaq 0x20(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rdx
callq 0x12dd0
movl (%r15), %edx
movq %r14, %rdi
movq %rax, %rsi
callq 0x14040
jmp 0x5d1a5
pushq $0x2
popq %rsi
leaq 0x1c(%rsp), %rdx
movq %rbx, %rdi
callq 0x12110
testl %eax, %eax
je 0x5d119
pushq $-0x1
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x12690
pushq $0x2
popq %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0x124a0
movl %eax, %ebp
jmp 0x5d1af
leaq 0x319b(%rip), %rcx      # 0x60244
pushq $0x2
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x143e0
testq %rax, %rax
je 0x5d127
movq %rax, %r15
pushq $0x3
popq %rsi
movq %rbx, %rdi
callq 0x14030
testl %eax, %eax
jle 0x5d17f
pushq $0x3
popq %rsi
leaq 0x20(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rdx
callq 0x12dd0
movq %rax, %r13
pushq $0x4
popq %rsi
movq %rbx, %rdi
callq 0x13060
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 0x132a0
jmp 0x5d1a5
movl 0x1c(%rsp), %esi
movq %r14, %rdi
callq 0x139e0
jmp 0x5d1a5
pushq $0xe
popq %rsi
pushq $0x2
popq %rdx
movq %rbx, %rdi
callq 0x13450
movl %eax, %r15d
pushq $0x3
popq %rsi
movq %rbx, %rdi
callq 0x14030
testl %eax, %eax
jle 0x5d19a
pushq $0x3
popq %rsi
leaq 0x20(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rdx
callq 0x12dd0
movq %rax, %r13
pushq $0x4
popq %rsi
movq %rbx, %rdi
callq 0x13060
movl (%r12), %ecx
movq %r14, %rdi
movl %r15d, %esi
movq %r13, %rdx
movl %eax, %r8d
callq 0x143a0
jmp 0x5d1a5
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
callq 0x12b40
jmp 0x5d1a5
movq %r14, %rdi
movl %r15d, %esi
callq 0x13550
movl %eax, %esi
movq %rbx, %rdi
callq 0x133d0
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq