// File: /workspace/github_c_makefile_star2_O3/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 $0x108, %rsp            # imm = 0x108
movl %r9d, 0x6c(%rsp)
movl %r8d, 0x3c(%rsp)
movq %rcx, 0x98(%rsp)
movq %rdx, %r12
movaps %xmm1, 0x20(%rsp)
movq %rsi, %r15
movq %rdi, %r13
movl 0x160(%rsp), %eax
movl %eax, 0x38(%rsp)
movl 0x158(%rsp), %ebp
movq 0x150(%rsp), %r8
movq 0x148(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq 0x140(%rsp), %r14
testq %r14, %r14
jne 0x476ac
movq 0x3f990(%rip), %rcx     # 0x86ff0
movq (%rcx), %rdi
leaq 0x29732(%rip), %rsi     # 0x70d9c
leaq 0x29749(%rip), %rdx     # 0x70dba
movl $0x60fd, %ecx           # imm = 0x60FD
xorl %eax, %eax
movaps %xmm0, (%rsp)
movq %r14, %rbx
movq %r13, %r14
movq %r12, %r13
movq %r8, %r12
callq 0x12d80
movq 0x3f95c(%rip), %rax     # 0x86ff0
movq (%rax), %rdi
callq 0x13780
movq %r12, %r8
movq %r13, %r12
movq %r14, %r13
movq %rbx, %r14
movaps (%rsp), %xmm0
testq %r15, %r15
jne 0x47704
movq 0x3f938(%rip), %rcx     # 0x86ff0
movq (%rcx), %rdi
leaq 0x296da(%rip), %rsi     # 0x70d9c
leaq 0x296f1(%rip), %rdx     # 0x70dba
movl $0x60fe, %ecx           # imm = 0x60FE
xorl %eax, %eax
movaps %xmm0, (%rsp)
movq %r14, %rbx
movq %r13, %r14
movq %r12, %r13
movq %r8, %r12
callq 0x12d80
movq 0x3f904(%rip), %rax     # 0x86ff0
movq (%rax), %rdi
callq 0x13780
movq %r12, %r8
movq %r13, %r12
movq %r14, %r13
movq %rbx, %r14
movaps (%rsp), %xmm0
testq %r8, %r8
je 0x477c2
testq %r15, %r15
je 0x47ea5
testq %r12, %r12
je 0x47ea5
testq %r14, %r14
je 0x47ea5
movss 0x8(%r8), %xmm4
movsd 0xe4(%r14), %xmm6
movsd 0xec(%r14), %xmm2
movaps %xmm4, %xmm1
shufps $0x0, %xmm4, %xmm1      # xmm1 = xmm1[0,0],xmm4[0,0]
movaps %xmm6, %xmm5
addps %xmm6, %xmm5
movaps %xmm5, 0x70(%rsp)
movaps %xmm1, 0x80(%rsp)
addps %xmm1, %xmm5
maxps 0x20(%rsp), %xmm5
movaps %xmm2, %xmm1
addps %xmm2, %xmm1
testb $0x4, %bpl
movaps %xmm4, 0xa0(%rsp)
jne 0x477ff
testb $0x2, %bpl
jne 0x47827
movaps %xmm0, %xmm7
addss %xmm4, %xmm7
addss 0xf4(%r14), %xmm7
movaps %xmm5, %xmm8
addss %xmm0, %xmm8
movaps %xmm7, %xmm3
maxss %xmm8, %xmm3
movaps %xmm7, 0xb0(%rsp)
subss %xmm7, %xmm3
movaps %xmm3, 0xc0(%rsp)
movaps %xmm0, %xmm8
jmp 0x47871
movq 0x3f827(%rip), %rbx     # 0x86ff0
movq (%rbx), %rdi
leaq 0x295c9(%rip), %rsi     # 0x70d9c
leaq 0x295e0(%rip), %rdx     # 0x70dba
movl $0x60ff, %ecx           # imm = 0x60FF
xorl %eax, %eax
callq 0x12d80
movq (%rbx), %rdi
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x13780
movaps %xmm5, %xmm8
addss %xmm0, %xmm8
subss %xmm4, %xmm8
movaps %xmm5, %xmm7
subss %xmm4, %xmm7
movss 0xf4(%r14), %xmm3
addss %xmm3, %xmm3
subss %xmm3, %xmm7
jmp 0x47861
movaps %xmm5, %xmm7
subss %xmm4, %xmm7
movss 0x2606a(%rip), %xmm3    # 0x6d8a0
movaps %xmm7, %xmm8
mulss %xmm3, %xmm8
addss %xmm0, %xmm8
movss 0xf4(%r14), %xmm4
addss %xmm4, %xmm4
subss %xmm4, %xmm7
movaps 0xa0(%rsp), %xmm4
mulss %xmm3, %xmm7
movaps %xmm7, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, %xmm3
subps %xmm2, %xmm3
addps %xmm5, %xmm1
testb $0x8, %bpl
movq %r8, 0x90(%rsp)
movaps %xmm6, 0x40(%rsp)
jne 0x478b1
testb $0x20, %bpl
jne 0x478c1
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
shufps $0x55, %xmm5, %xmm5     # xmm5 = xmm5[1,1,1,1]
movss 0x25ffd(%rip), %xmm2    # 0x6d8a0
mulss %xmm2, %xmm5
addss %xmm0, %xmm5
mulss %xmm4, %xmm2
jmp 0x478d7
shufps $0x1, %xmm8, %xmm0      # xmm0 = xmm0[1,0],xmm8[0,0]
shufps $0xe2, %xmm8, %xmm0     # xmm0 = xmm0[2,0],xmm8[2,3]
movaps %xmm0, (%rsp)
jmp 0x478e8
addps %xmm0, %xmm5
shufps $0x55, %xmm5, %xmm5     # xmm5 = xmm5[1,1,1,1]
subss %xmm4, %xmm5
movaps %xmm6, %xmm2
shufps $0x55, %xmm6, %xmm2     # xmm2 = xmm2[1,1],xmm6[1,1]
addss %xmm2, %xmm2
subss %xmm2, %xmm5
movlhps %xmm8, %xmm5            # xmm5 = xmm5[0],xmm8[0]
shufps $0xe2, %xmm8, %xmm5     # xmm5 = xmm5[2,0],xmm8[2,3]
movaps %xmm5, (%rsp)
movss 0xf8(%r14), %xmm0
movaps %xmm0, 0x20(%rsp)
addss %xmm0, %xmm0
shufps $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movaps %xmm0, 0xe0(%rsp)
movl (%r12), %ebx
movl (%r13), %eax
andl $0x2, %eax
orl $0x4, %eax
movl %eax, (%r13)
movq %r13, %rdi
movaps %xmm3, 0xd0(%rsp)
movaps %xmm3, %xmm0
movaps %xmm1, 0x50(%rsp)
movq 0x10(%rsp), %rsi
xorl %edx, %edx
callq 0x5160c
testl %eax, %eax
je 0x47953
movl $0x22, (%r13)
xorl %ecx, %ecx
testl %ebx, %ebx
sete %cl
movl $0x22, %eax
movl %ecx, %ebx
jmp 0x4795b
movl (%r13), %eax
testb $0x10, %al
jne 0x479d9
movaps (%rsp), %xmm4
movaps 0x40(%rsp), %xmm5
movaps 0x70(%rsp), %xmm2
movaps 0x50(%rsp), %xmm6
movaps 0xd0(%rsp), %xmm7
cmpq $0x0, 0x10(%rsp)
je 0x479d2
movq 0x10(%rsp), %rcx
movss 0x14c(%rcx), %xmm0
movaps %xmm7, %xmm1
addss %xmm6, %xmm1
ucomiss %xmm7, %xmm0
jb 0x479d2
ucomiss %xmm0, %xmm1
jbe 0x479d2
movq 0x10(%rsp), %rcx
movss 0x150(%rcx), %xmm0
movaps %xmm7, %xmm1
shufps $0x55, %xmm7, %xmm1     # xmm1 = xmm1[1,1],xmm7[1,1]
ucomiss %xmm1, %xmm0
jb 0x479d2
addps %xmm6, %xmm7
shufps $0x55, %xmm7, %xmm7     # xmm7 = xmm7[1,1,1,1]
ucomiss %xmm0, %xmm7
movaps 0x20(%rsp), %xmm0
jbe 0x47a58
orl $0x40, %eax
jmp 0x47a54
movaps 0x20(%rsp), %xmm0
jmp 0x47a58
cmpq $0x0, 0x10(%rsp)
movaps (%rsp), %xmm4
movaps 0x40(%rsp), %xmm5
movaps 0x50(%rsp), %xmm6
movaps 0xd0(%rsp), %xmm7
je 0x47a47
movq 0x10(%rsp), %rcx
movss 0x14c(%rcx), %xmm0
ucomiss %xmm7, %xmm0
jb 0x47a47
movaps %xmm7, %xmm1
addss %xmm6, %xmm1
ucomiss %xmm0, %xmm1
jbe 0x47a47
movq 0x10(%rsp), %rcx
movss 0x150(%rcx), %xmm2
movaps %xmm7, %xmm3
shufps $0x55, %xmm7, %xmm3     # xmm3 = xmm3[1,1],xmm7[1,1]
ucomiss %xmm3, %xmm2
jb 0x47a47
movaps %xmm7, %xmm3
addps %xmm6, %xmm3
shufps $0x55, %xmm3, %xmm3     # xmm3 = xmm3[1,1,1,1]
ucomiss %xmm2, %xmm3
jbe 0x47a47
movaps 0x70(%rsp), %xmm2
jmp 0x47992
orl $0x8, %eax
movaps 0x20(%rsp), %xmm0
movaps 0x70(%rsp), %xmm2
movl %eax, (%r13)
movaps %xmm4, %xmm1
shufps $0x1, 0xb0(%rsp), %xmm1 # xmm1 = xmm1[1,0],mem[0,0]
movaps 0xa0(%rsp), %xmm3
unpcklpd 0xc0(%rsp), %xmm3       # xmm3 = xmm3[0],mem[0]
addps %xmm4, %xmm5
shufps $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
addps 0xe0(%rsp), %xmm2
movl %ebx, (%r12)
movq 0x110(%r14), %rax
testq %rax, %rax
je 0x47ad2
movq 0x108(%r14), %rsi
movq %r15, %rdi
movaps %xmm0, 0x20(%rsp)
movaps %xmm5, 0x40(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm1, 0x10(%rsp)
movaps %xmm3, 0x50(%rsp)
callq *%rax
movaps 0x50(%rsp), %xmm3
movaps 0x10(%rsp), %xmm1
movaps 0x70(%rsp), %xmm2
movaps 0x40(%rsp), %xmm5
movaps 0x20(%rsp), %xmm0
shufps $0xe2, 0xb0(%rsp), %xmm1 # xmm1 = xmm1[2,0],mem[2,3]
movaps %xmm1, 0x10(%rsp)
shufps $0xe2, 0xc0(%rsp), %xmm3 # xmm3 = xmm3[2,0],mem[2,3]
addps %xmm5, %xmm0
movaps 0x80(%rsp), %xmm1
subps %xmm2, %xmm1
movaps %xmm1, 0x40(%rsp)
movl (%r13), %eax
movl (%r12), %ebp
cmpl $0x0, 0x6c(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm3, 0x50(%rsp)
je 0x47b2c
testb $0x10, %al
jne 0x47b4a
testb $0x20, %al
jne 0x47b63
movl $0xd0, %eax
movl $0x80, %ebx
movq %r14, %r12
jmp 0x47b71
testb $0x10, %al
jne 0x47b55
testb $0x20, %al
jne 0x47cd2
movl $0xd0, %eax
movl $0x80, %ebx
movq %r14, %r12
jmp 0x47ce0
leaq 0x28(%r14), %r12
movl $0xd4, %eax
jmp 0x47b6c
leaq 0x28(%r14), %r12
movl $0xd4, %eax
jmp 0x47cdb
leaq 0x28(%r14), %r12
movl $0xd8, %eax
movl $0xa8, %ebx
movl (%r14,%rax), %edi
movss 0xfc(%r14), %xmm0
callq 0x13e60
leaq 0xf8(%rsp), %rcx
movl %eax, 0xc(%rcx)
movq $0x0, (%rcx)
movl 0xdc(%r14), %eax
movl %eax, 0x8(%rcx)
movq %r15, %rdi
movaps 0x10(%rsp), %xmm0
movaps 0x50(%rsp), %xmm1
movq 0x98(%rsp), %rsi
movl 0x3c(%rsp), %edx
movl 0x38(%rsp), %r8d
movq 0x90(%rsp), %r9
callq 0x451c6
cmpl $0x0, (%r12)
movss 0xfc(%r14), %xmm0
je 0x47c27
movss 0x25cc6(%rip), %xmm1    # 0x6d8a8
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
addq $0x8, %r12
movzbl %al, %eax
imull $0x10101, %eax, %eax    # imm = 0x10101
orl $0xff000000, %eax       # imm = 0xFF000000
ucomiss 0x25ca1(%rip), %xmm0    # 0x6d8a4
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmovnel %eax, %edx
cmovpl %eax, %edx
movq %r15, %rdi
movaps (%rsp), %xmm0
movaps 0x80(%rsp), %xmm1
movq %r12, %rsi
callq 0x134d0
jmp 0x47ca1
movl 0x78(%r14), %edi
callq 0x13e60
movq %r15, %rdi
movaps (%rsp), %xmm0
movaps 0x80(%rsp), %xmm1
movl %eax, %esi
callq 0x13dd0
movss 0xf8(%r14), %xmm2
movss 0xfc(%r14), %xmm0
movaps %xmm2, %xmm1
addss %xmm2, %xmm1
movaps %xmm1, %xmm3
maxss 0xa0(%rsp), %xmm3
shufps $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0]
addps (%rsp), %xmm2
movaps %xmm2, (%rsp)
subss %xmm1, %xmm3
movaps %xmm3, 0x10(%rsp)
movl 0x8(%r12), %edi
callq 0x13e60
movaps 0x10(%rsp), %xmm1
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
movq %r15, %rdi
movaps (%rsp), %xmm0
movl %eax, %esi
callq 0x13dd0
testl %ebp, %ebp
je 0x47e8d
addq %r14, %rbx
leaq 0x8(%rbx), %rsi
cmpl $0x1, (%rbx)
je 0x47e29
movl (%rsi), %esi
movq %r15, %rdi
movaps 0x20(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
callq 0x13dd0
jmp 0x47e8d
leaq 0x28(%r14), %r12
movl $0xd8, %eax
movl $0xa8, %ebx
movl (%r14,%rax), %edi
movss 0xfc(%r14), %xmm0
callq 0x13e60
leaq 0xf8(%rsp), %rcx
movl %eax, 0xc(%rcx)
movq $0x0, (%rcx)
movl 0xdc(%r14), %eax
movl %eax, 0x8(%rcx)
movq %r15, %rdi
movaps 0x10(%rsp), %xmm0
movaps 0x50(%rsp), %xmm1
movq 0x98(%rsp), %rsi
movl 0x3c(%rsp), %edx
movl 0x38(%rsp), %r8d
movq 0x90(%rsp), %r9
callq 0x451c6
cmpl $0x0, (%r12)
movss 0xfc(%r14), %xmm0
je 0x47d99
movss 0x25b57(%rip), %xmm1    # 0x6d8a8
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
addq $0x8, %r12
movzbl %al, %eax
imull $0x10101, %eax, %eax    # imm = 0x10101
orl $0xff000000, %eax       # imm = 0xFF000000
ucomiss 0x25b32(%rip), %xmm0    # 0x6d8a4
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmovnel %eax, %edx
cmovpl %eax, %edx
movq %r15, %rdi
movaps (%rsp), %xmm0
movaps 0x80(%rsp), %xmm1
movq %r12, %rsi
callq 0x134d0
jmp 0x47e19
movl 0x78(%r14), %edi
callq 0x13e60
xorps %xmm2, %xmm2
movq %r15, %rdi
movaps (%rsp), %xmm0
movaps 0x80(%rsp), %xmm1
movl %eax, %esi
callq 0x12de0
movss 0xf8(%r14), %xmm2
movss 0xfc(%r14), %xmm0
movaps %xmm2, %xmm1
addss %xmm2, %xmm1
movaps %xmm1, %xmm3
maxss 0xa0(%rsp), %xmm3
shufps $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0]
addps (%rsp), %xmm2
movaps %xmm2, (%rsp)
subss %xmm1, %xmm3
movaps %xmm3, 0x10(%rsp)
movl 0x8(%r12), %edi
callq 0x13e60
movaps 0x10(%rsp), %xmm1
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
xorps %xmm2, %xmm2
movq %r15, %rdi
movaps (%rsp), %xmm0
movl %eax, %esi
callq 0x12de0
testl %ebp, %ebp
je 0x47e8d
addq %r14, %rbx
leaq 0x8(%rbx), %rsi
cmpl $0x1, (%rbx)
jne 0x47e76
movss 0xfc(%r14), %xmm0
movss 0x25a6e(%rip), %xmm1    # 0x6d8a8
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
movzbl %al, %eax
imull $0x10101, %eax, %eax    # imm = 0x10101
orl $0xff000000, %eax       # imm = 0xFF000000
ucomiss 0x25a4d(%rip), %xmm0    # 0x6d8a4
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmovnel %eax, %edx
cmovpl %eax, %edx
movq %r15, %rdi
movaps 0x20(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
callq 0x134d0
jmp 0x47e8d
movl (%rsi), %esi
xorps %xmm2, %xmm2
movq %r15, %rdi
movaps 0x20(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
callq 0x12de0
movq 0x118(%r14), %rax
testq %rax, %rax
je 0x47ea5
movq 0x108(%r14), %rsi
movq %r15, %rdi
callq *%rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq