// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x78, %rsp
movq %rdi, 0x68(%rsp)
movq 0x68(%rsp), %rdi
movl $0x1, %esi
xorl %eax, %eax
movl %eax, %edx
leaq 0x4dc2(%rip), %rcx      # 0xa7280
callq 0x130f0
movq %rax, 0x30(%rsp)
movq 0x68(%rsp), %rdi
movl $0x2, %esi
callq 0x15090
movl %eax, 0x2c(%rsp)
cmpl $0x0, 0x2c(%rsp)
jne 0xa251a
movq 0x68(%rsp), %rdi
movl $0x3, %esi
leaq 0x58(%rsp), %rdx
callq 0x13df0
movq %rax, 0x50(%rsp)
movq 0x30(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rax
movl %eax, %edx
callq 0x150a0
movl %eax, 0x64(%rsp)
jmp 0xa26f6
cmpl $0x5, 0x2c(%rsp)
jne 0xa2589
movq 0x68(%rsp), %rdi
movl $0x2, %esi
leaq 0x4c(%rsp), %rdx
callq 0x13120
cmpl $0x0, %eax
je 0xa2572
movq 0x68(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x68(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %edx
callq 0x136c0
movq 0x20(%rsp), %rdi
movq %rax, %rdx
movl $0x2, %esi
callq 0x134c0
movl %eax, 0x74(%rsp)
jmp 0xa270c
movq 0x30(%rsp), %rdi
movl 0x4c(%rsp), %esi
callq 0x14a20
movl %eax, 0x64(%rsp)
jmp 0xa26f4
movq 0x68(%rsp), %rdi
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %edx
leaq 0x4ca6(%rip), %rcx      # 0xa7244
callq 0x15450
movq %rax, 0x38(%rsp)
cmpq $0x0, %rax
je 0xa2661
movq 0x68(%rsp), %rdi
movl $0x3, %esi
callq 0x15090
cmpl $0x0, %eax
jg 0xa25f4
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x13b70
movl %eax, 0x64(%rsp)
jmp 0xa265c
movq 0x68(%rsp), %rdi
movl $0x3, %esi
leaq 0x58(%rsp), %rdx
callq 0x13df0
movq %rax, 0x50(%rsp)
movq 0x68(%rsp), %rdi
movl $0x4, %esi
callq 0x14070
movl %eax, 0x48(%rsp)
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rax
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rcx
movl %ecx, %edx
movl 0x48(%rsp), %ecx
movq (%rax), %r8
movq %r8, (%rsp)
movq 0x8(%rax), %r8
movq %r8, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x142b0
movl %eax, 0x64(%rsp)
jmp 0xa26f2
movq 0x68(%rsp), %rdi
movl $0xe, %esi
movl $0x2, %edx
callq 0x14470
movl %eax, 0x44(%rsp)
movq 0x68(%rsp), %rdi
movl $0x3, %esi
callq 0x15090
cmpl $0x0, %eax
jg 0xa26a1
movq 0x30(%rsp), %rdi
movl 0x44(%rsp), %esi
callq 0x14570
movl %eax, 0x64(%rsp)
jmp 0xa26f0
movq 0x68(%rsp), %rdi
movl $0x3, %esi
leaq 0x58(%rsp), %rdx
callq 0x13df0
movq %rax, 0x50(%rsp)
movq 0x68(%rsp), %rdi
movl $0x4, %esi
callq 0x14070
movl %eax, 0x48(%rsp)
movq 0x30(%rsp), %rdi
movl 0x44(%rsp), %esi
movq 0x50(%rsp), %rdx
movq 0x58(%rsp), %rax
movl %eax, %ecx
movl 0x48(%rsp), %r8d
callq 0x15410
movl %eax, 0x64(%rsp)
jmp 0xa26f2
jmp 0xa26f4
jmp 0xa26f6
movq 0x68(%rsp), %rdi
movl 0x64(%rsp), %esi
callq 0x143e0
movl $0x1, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)