// File: /workspace/github_c_makefile_star2_O1/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_do_toggle
NK_LIB nk_bool
nk_do_toggle(nk_flags *state,
    struct nk_command_buffer *out, struct nk_rect r,
    nk_bool *active, const char *str, int len, enum nk_toggle_type type,
    const struct nk_style_toggle *style, const struct nk_input *in,
    const struct nk_user_font *font, nk_flags widget_alignment, nk_flags text_alignment)
{
    int was_active;
    struct nk_rect bounds;
    struct nk_rect select;
    struct nk_rect cursor;
    struct nk_rect label;

    NK_ASSERT(style);
    NK_ASSERT(out);
    NK_ASSERT(font);
    if (!out || !style || !font || !active)
        return 0;

    r.w = NK_MAX(r.w, font->height + 2 * style->padding.x);
    r.h = NK_MAX(r.h, font->height + 2 * style->padding.y);

    /* add additional touch padding for touch screen devices */
    bounds.x = r.x - style->touch_padding.x;
    bounds.y = r.y - style->touch_padding.y;
    bounds.w = r.w + 2 * style->touch_padding.x;
    bounds.h = r.h + 2 * style->touch_padding.y;

    /* calculate the selector space */
    select.w = font->height;
    select.h = select.w;

    if (widget_alignment & NK_WIDGET_ALIGN_RIGHT) {
        select.x = r.x + r.w - font->height;

        /* label in front of the selector */
        label.x = r.x;
        label.w = r.w - select.w - style->spacing * 2;
    } else if (widget_alignment & NK_WIDGET_ALIGN_CENTERED) {
        select.x = r.x + (r.w - select.w) / 2;

        /* label in front of selector */
        label.x = r.x;
        label.w = (r.w - select.w - style->spacing * 2) / 2;
    } else { /* Default: NK_WIDGET_ALIGN_LEFT */
        select.x = r.x;

        /* label behind the selector */
        label.x = select.x + select.w + style->spacing;
        label.w = NK_MAX(r.x + r.w, label.x) - label.x;
    }

    if (widget_alignment & NK_WIDGET_ALIGN_TOP) {
        select.y = r.y;
    } else if (widget_alignment & NK_WIDGET_ALIGN_BOTTOM) {
        select.y = r.y + r.h - select.h - 2 * style->padding.y;
    } else { /* Default: NK_WIDGET_ALIGN_MIDDLE */
        select.y = r.y + r.h/2.0f - select.h/2.0f;
    }

    label.y = select.y;
    label.h = select.w;

    /* calculate the bounds of the cursor inside the selector */
    cursor.x = select.x + style->padding.x + style->border;
    cursor.y = select.y + style->padding.y + style->border;
    cursor.w = select.w - (2 * style->padding.x + 2 * style->border);
    cursor.h = select.h - (2 * style->padding.y + 2 * style->border);

    /* update selector */
    was_active = *active;
    *active = nk_toggle_behavior(in, bounds, state, *active);

    /* draw selector */
    if (style->draw_begin)
        style->draw_begin(out, style->userdata);
    if (type == NK_TOGGLE_CHECK) {
        nk_draw_checkbox(out, *state, style, *active, &label, &select, &cursor, str, len, font, text_alignment);
    } else {
        nk_draw_option(out, *state, style, *active, &label, &select, &cursor, str, len, font, text_alignment);
    }
    if (style->draw_end)
        style->draw_end(out, style->userdata);
    return (was_active != *active);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movl %r9d, 0x6c(%rsp)
movl %r8d, 0x1c(%rsp)
movq %rcx, 0xa8(%rsp)
movq %rdx, %r13
movaps %xmm1, 0x20(%rsp)
movq %rsi, %rbx
movq %rdi, %rbp
movq 0x130(%rsp), %r15
testq %r15, %r15
movaps %xmm0, (%rsp)
jne 0x48213
movq 0x3fe06(%rip), %r14     # 0x87ff0
movq (%r14), %rdi
leaq 0x29b98(%rip), %rsi     # 0x71d8c
leaq 0x29baf(%rip), %rdx     # 0x71daa
movl $0x60fd, %ecx           # imm = 0x60FD
xorl %eax, %eax
callq 0x12d80
movq (%r14), %rdi
callq 0x13780
movaps (%rsp), %xmm0
movq 0x140(%rsp), %r8
testq %rbx, %rbx
jne 0x4825c
movq 0x3fdc9(%rip), %r14     # 0x87ff0
movq (%r14), %rdi
leaq 0x29b5b(%rip), %rsi     # 0x71d8c
leaq 0x29b72(%rip), %rdx     # 0x71daa
movl $0x60fe, %ecx           # imm = 0x60FE
xorl %eax, %eax
movq %r15, %r12
movq %r8, %r15
callq 0x12d80
movq (%r14), %rdi
callq 0x13780
movq %r15, %r8
movq %r12, %r15
movaps (%rsp), %xmm0
testq %r8, %r8
jne 0x482a3
movq 0x3fd88(%rip), %r14     # 0x87ff0
movq (%r14), %rdi
leaq 0x29b1a(%rip), %rsi     # 0x71d8c
leaq 0x29b31(%rip), %rdx     # 0x71daa
movl $0x60ff, %ecx           # imm = 0x60FF
xorl %eax, %eax
movq %r15, %r12
movq %rbx, %r15
movq %r8, %rbx
callq 0x12d80
movq (%r14), %rdi
callq 0x13780
movq %rbx, %r8
movq %r15, %rbx
movq %r12, %r15
movaps (%rsp), %xmm0
testq %r8, %r8
sete %al
testq %rbx, %rbx
sete %cl
testq %r15, %r15
sete %dl
testq %r13, %r13
sete %sil
orb %cl, %sil
orb %dl, %sil
orb %al, %sil
jne 0x48a0e
movl 0x148(%rsp), %eax
movss 0x8(%r8), %xmm6
movsd 0xe4(%r15), %xmm7
movsd 0xec(%r15), %xmm2
movaps %xmm6, %xmm1
shufps $0x0, %xmm6, %xmm1      # xmm1 = xmm1[0,0],xmm6[0,0]
movaps %xmm7, %xmm5
addps %xmm7, %xmm5
movaps %xmm5, 0x30(%rsp)
movaps %xmm1, 0x90(%rsp)
addps %xmm1, %xmm5
maxps 0x20(%rsp), %xmm5
movaps %xmm2, %xmm1
addps %xmm2, %xmm1
testb $0x4, %al
jne 0x48355
testb $0x2, %al
jne 0x48385
movaps %xmm0, %xmm4
addss %xmm6, %xmm4
addss 0xf4(%r15), %xmm4
movaps %xmm5, %xmm8
addss %xmm0, %xmm8
movaps %xmm4, %xmm3
maxss %xmm8, %xmm3
movaps %xmm4, 0xb0(%rsp)
subss %xmm4, %xmm3
movaps %xmm3, 0xc0(%rsp)
movaps %xmm0, %xmm9
jmp 0x483cc
movaps %xmm5, %xmm9
addss %xmm0, %xmm9
subss %xmm6, %xmm9
movaps %xmm5, %xmm4
subss %xmm6, %xmm4
movss 0xf4(%r15), %xmm3
addss %xmm3, %xmm3
subss %xmm3, %xmm4
movaps %xmm4, 0xc0(%rsp)
jmp 0x483c4
movaps %xmm5, %xmm8
subss %xmm6, %xmm8
movss 0x2651a(%rip), %xmm3    # 0x6e8b0
movaps %xmm8, %xmm9
mulss %xmm3, %xmm9
addss %xmm0, %xmm9
movss 0xf4(%r15), %xmm4
addss %xmm4, %xmm4
subss %xmm4, %xmm8
mulss %xmm3, %xmm8
movaps %xmm8, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movq 0x138(%rsp), %r14
movaps %xmm0, %xmm3
subps %xmm2, %xmm3
addps %xmm5, %xmm1
testb $0x8, %al
movaps %xmm6, 0xd0(%rsp)
movaps %xmm7, 0x40(%rsp)
jne 0x48410
testb $0x20, %al
jne 0x48420
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
shufps $0x55, %xmm5, %xmm5     # xmm5 = xmm5[1,1,1,1]
movss 0x264ae(%rip), %xmm2    # 0x6e8b0
mulss %xmm2, %xmm5
addss %xmm0, %xmm5
mulss %xmm6, %xmm2
jmp 0x48436
shufps $0x1, %xmm9, %xmm0      # xmm0 = xmm0[1,0],xmm9[0,0]
shufps $0xe2, %xmm9, %xmm0     # xmm0 = xmm0[2,0],xmm9[2,3]
movaps %xmm0, (%rsp)
jmp 0x48447
addps %xmm0, %xmm5
shufps $0x55, %xmm5, %xmm5     # xmm5 = xmm5[1,1,1,1]
subss %xmm6, %xmm5
movaps %xmm7, %xmm2
shufps $0x55, %xmm7, %xmm2     # xmm2 = xmm2[1,1],xmm7[1,1]
addss %xmm2, %xmm2
subss %xmm2, %xmm5
movlhps %xmm9, %xmm5            # xmm5 = xmm5[0],xmm9[0]
shufps $0xe2, %xmm9, %xmm5     # xmm5 = xmm5[2,0],xmm9[2,3]
movaps %xmm5, (%rsp)
movss 0xf8(%r15), %xmm0
movaps %xmm0, 0x20(%rsp)
addss %xmm0, %xmm0
movaps %xmm0, 0xe0(%rsp)
movl (%r13), %r12d
movl (%rbp), %eax
andl $0x2, %eax
orl $0x4, %eax
movl %eax, (%rbp)
movq %rbp, %rdi
movaps %xmm3, 0x70(%rsp)
movaps %xmm3, %xmm0
movaps %xmm1, 0x80(%rsp)
movq %r14, %rsi
xorl %edx, %edx
callq 0x521be
testl %eax, %eax
je 0x484a4
movl $0x22, (%rbp)
xorl %eax, %eax
testl %r12d, %r12d
sete %al
movl %eax, %r12d
movaps 0x30(%rsp), %xmm5
movaps 0xe0(%rsp), %xmm8
shufps $0x0, %xmm8, %xmm8      # xmm8 = xmm8[0,0,0,0]
movl (%rbp), %eax
testb $0x10, %al
movaps (%rsp), %xmm2
movaps 0xd0(%rsp), %xmm3
movaps 0x40(%rsp), %xmm4
movaps 0x80(%rsp), %xmm6
movaps 0x70(%rsp), %xmm7
jne 0x4852b
testq %r14, %r14
je 0x4857c
movss 0x14c(%r14), %xmm0
ucomiss %xmm7, %xmm0
jb 0x4857c
movaps %xmm7, %xmm1
addss %xmm6, %xmm1
ucomiss %xmm0, %xmm1
jbe 0x4857c
movss 0x150(%r14), %xmm0
movaps %xmm7, %xmm1
shufps $0x55, %xmm7, %xmm1     # xmm1 = xmm1[1,1],xmm7[1,1]
ucomiss %xmm1, %xmm0
jb 0x4857c
addps %xmm6, %xmm7
shufps $0x55, %xmm7, %xmm7     # xmm7 = xmm7[1,1,1,1]
movl $0x40, %ecx
ucomiss %xmm0, %xmm7
ja 0x48577
jmp 0x4857c
movl $0x8, %ecx
testq %r14, %r14
je 0x48577
movss 0x14c(%r14), %xmm0
ucomiss %xmm7, %xmm0
jb 0x48577
movaps %xmm7, %xmm1
addss %xmm6, %xmm1
ucomiss %xmm0, %xmm1
jbe 0x48577
movss 0x150(%r14), %xmm0
movaps %xmm7, %xmm1
shufps $0x55, %xmm7, %xmm1     # xmm1 = xmm1[1,1],xmm7[1,1]
ucomiss %xmm1, %xmm0
jb 0x48577
movaps %xmm7, %xmm1
addps %xmm6, %xmm1
shufps $0x55, %xmm1, %xmm1     # xmm1 = xmm1[1,1,1,1]
ucomiss %xmm0, %xmm1
ja 0x484dc
orl %ecx, %eax
movl %eax, (%rbp)
movaps %xmm2, %xmm1
shufps $0x1, 0xb0(%rsp), %xmm1 # xmm1 = xmm1[1,0],mem[0,0]
unpcklpd 0xc0(%rsp), %xmm3       # xmm3 = xmm3[0],mem[0]
addps %xmm2, %xmm4
movaps 0x20(%rsp), %xmm0
shufps $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
addps %xmm8, %xmm5
movl %r12d, (%r13)
movq 0x110(%r15), %rax
testq %rax, %rax
je 0x485f5
movq 0x108(%r15), %rsi
movq %rbx, %rdi
movaps %xmm0, 0x20(%rsp)
movaps %xmm4, 0x40(%rsp)
movaps %xmm5, 0x30(%rsp)
movaps %xmm1, 0x80(%rsp)
movaps %xmm3, 0x70(%rsp)
callq *%rax
movaps 0x70(%rsp), %xmm3
movaps 0x80(%rsp), %xmm1
movaps 0x30(%rsp), %xmm5
movaps 0x40(%rsp), %xmm4
movaps 0x20(%rsp), %xmm0
shufps $0xe2, 0xb0(%rsp), %xmm1 # xmm1 = xmm1[2,0],mem[2,3]
movaps %xmm1, 0x80(%rsp)
shufps $0xe2, 0xc0(%rsp), %xmm3 # xmm3 = xmm3[2,0],mem[2,3]
addps %xmm4, %xmm0
movaps 0x90(%rsp), %xmm1
subps %xmm5, %xmm1
movaps %xmm1, 0x40(%rsp)
movl (%rbp), %eax
movl (%r13), %ebp
cmpl $0x0, 0x6c(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm3, 0x70(%rsp)
je 0x4865c
movl %ebp, %r14d
testb $0x10, %al
jne 0x48682
testb $0x20, %al
jne 0x486ad
leaq 0x80(%r15), %rbp
movl 0xd0(%r15), %eax
movl %eax, 0x64(%rsp)
movq %r15, %r12
jmp 0x486c3
testb $0x10, %al
jne 0x48696
testb $0x20, %al
jne 0x4882c
leaq 0x80(%r15), %r14
movl 0xd0(%r15), %eax
movl %eax, 0x64(%rsp)
movq %r15, %r12
jmp 0x48842
leaq 0x28(%r15), %r12
leaq 0xa8(%r15), %rbp
movl 0xd4(%r15), %eax
jmp 0x486bf
leaq 0x28(%r15), %r12
leaq 0xa8(%r15), %r14
movl 0xd4(%r15), %eax
jmp 0x4883e
leaq 0x28(%r15), %r12
leaq 0xa8(%r15), %rbp
movl 0xd8(%r15), %eax
movl %eax, 0x64(%rsp)
movss 0xfc(%r15), %xmm0
leaq 0x58(%rsp), %r13
movl 0xc(%r13), %edi
callq 0x13e60
movl %eax, 0xc(%r13)
movq $0x0, (%r13)
movl 0xdc(%r15), %eax
movl %eax, 0x8(%r13)
movq %rbx, %rdi
movaps 0x80(%rsp), %xmm0
movaps 0x70(%rsp), %xmm1
movq 0xa8(%rsp), %rsi
movl 0x1c(%rsp), %edx
movq %r13, %rcx
movl 0x150(%rsp), %r8d
movq 0x140(%rsp), %r9
callq 0x45d79
cmpl $0x0, (%r12)
movss 0xfc(%r15), %xmm0
je 0x48782
movss 0x2617b(%rip), %xmm1    # 0x6e8b8
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
addq $0x8, %r12
movzbl %al, %eax
imull $0x10101, %eax, %eax    # imm = 0x10101
orl $0xff000000, %eax       # imm = 0xFF000000
ucomiss 0x26156(%rip), %xmm0    # 0x6e8b4
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmovnel %eax, %edx
cmovpl %eax, %edx
movq %rbx, %rdi
movaps (%rsp), %xmm0
movaps 0x90(%rsp), %xmm1
movq %r12, %rsi
callq 0x134d0
jmp 0x487fc
movl 0x78(%r15), %edi
callq 0x13e60
movq %rbx, %rdi
movaps (%rsp), %xmm0
movaps 0x90(%rsp), %xmm1
movl %eax, %esi
callq 0x13dd0
movss 0xf8(%r15), %xmm2
movss 0xfc(%r15), %xmm0
movaps %xmm2, %xmm1
addss %xmm2, %xmm1
movaps %xmm1, %xmm3
maxss 0xd0(%rsp), %xmm3
shufps $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0]
addps (%rsp), %xmm2
movaps %xmm2, (%rsp)
subss %xmm1, %xmm3
movaps %xmm3, 0x30(%rsp)
movl 0x8(%r12), %edi
callq 0x13e60
movaps 0x30(%rsp), %xmm1
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
movq %rbx, %rdi
movaps (%rsp), %xmm0
movl %eax, %esi
callq 0x13dd0
testl %r14d, %r14d
je 0x489f6
leaq 0x8(%rbp), %rsi
cmpl $0x1, (%rbp)
je 0x48992
movl (%rsi), %esi
movq %rbx, %rdi
movaps 0x20(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
callq 0x13dd0
jmp 0x489f6
leaq 0x28(%r15), %r12
leaq 0xa8(%r15), %r14
movl 0xd8(%r15), %eax
movl %eax, 0x64(%rsp)
movss 0xfc(%r15), %xmm0
leaq 0x58(%rsp), %r13
movl 0xc(%r13), %edi
callq 0x13e60
movl %eax, 0xc(%r13)
movq $0x0, (%r13)
movl 0xdc(%r15), %eax
movl %eax, 0x8(%r13)
movq %rbx, %rdi
movaps 0x80(%rsp), %xmm0
movaps 0x70(%rsp), %xmm1
movq 0xa8(%rsp), %rsi
movl 0x1c(%rsp), %edx
movq %r13, %rcx
movl 0x150(%rsp), %r8d
movq 0x140(%rsp), %r9
callq 0x45d79
cmpl $0x0, (%r12)
movss 0xfc(%r15), %xmm0
je 0x48904
movss 0x25ffc(%rip), %xmm1    # 0x6e8b8
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
addq $0x8, %r12
movzbl %al, %eax
imull $0x10101, %eax, %eax    # imm = 0x10101
orl $0xff000000, %eax       # imm = 0xFF000000
ucomiss 0x25fd7(%rip), %xmm0    # 0x6e8b4
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmovnel %eax, %edx
cmovpl %eax, %edx
movq %rbx, %rdi
movaps (%rsp), %xmm0
movaps 0x90(%rsp), %xmm1
movq %r12, %rsi
callq 0x134d0
jmp 0x48984
movl 0x78(%r15), %edi
callq 0x13e60
xorps %xmm2, %xmm2
movq %rbx, %rdi
movaps (%rsp), %xmm0
movaps 0x90(%rsp), %xmm1
movl %eax, %esi
callq 0x12de0
movss 0xf8(%r15), %xmm2
movss 0xfc(%r15), %xmm0
movaps %xmm2, %xmm1
addss %xmm2, %xmm1
movaps %xmm1, %xmm3
maxss 0xd0(%rsp), %xmm3
shufps $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0]
addps (%rsp), %xmm2
movaps %xmm2, (%rsp)
subss %xmm1, %xmm3
movaps %xmm3, 0x30(%rsp)
movl 0x8(%r12), %edi
callq 0x13e60
movaps 0x30(%rsp), %xmm1
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
xorps %xmm2, %xmm2
movq %rbx, %rdi
movaps (%rsp), %xmm0
movl %eax, %esi
callq 0x12de0
testl %ebp, %ebp
je 0x489f6
leaq 0x8(%r14), %rsi
cmpl $0x1, (%r14)
jne 0x489df
movss 0xfc(%r15), %xmm0
movss 0x25f15(%rip), %xmm1    # 0x6e8b8
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
movzbl %al, %eax
imull $0x10101, %eax, %eax    # imm = 0x10101
orl $0xff000000, %eax       # imm = 0xFF000000
ucomiss 0x25ef4(%rip), %xmm0    # 0x6e8b4
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmovnel %eax, %edx
cmovpl %eax, %edx
movq %rbx, %rdi
movaps 0x20(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
callq 0x134d0
jmp 0x489f6
movl (%rsi), %esi
xorps %xmm2, %xmm2
movq %rbx, %rdi
movaps 0x20(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
callq 0x12de0
movq 0x118(%r15), %rax
testq %rax, %rax
je 0x48a0e
movq 0x108(%r15), %rsi
movq %rbx, %rdi
callq *%rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq