// File: /workspace/github_c_makefile_star2_O3/space222[P]silo/./nuklear.h
// Function: nk_do_toggle(unsigned int*, nk_command_buffer*, nk_rect, int*, char const*, int, nk_toggle_type, nk_style_toggle const*, nk_input const*, nk_user_font const*)
NK_LIB int
nk_do_toggle(nk_flags *state,
    struct nk_command_buffer *out, struct nk_rect r,
    int *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)
{
    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;
    select.y = r.y + r.h/2.0f - select.h/2.0f;
    select.x = r.x;

    /* 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);

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

    /* 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);
    } else {
        nk_draw_option(out, *state, style, *active, &label, &select, &cursor, str, len, font);
    }
    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 $0x118, %rsp            # imm = 0x118
movq 0x150(%rsp), %r15
testq %r15, %r15
je 0x15be4
movq %rsi, %rbx
testq %rsi, %rsi
je 0x15c03
movq 0x160(%rsp), %rax
testq %rax, %rax
je 0x15c22
movq %rdx, %r13
testq %rdx, %rdx
je 0x15bd2
movq %rdi, %rbp
movl %r9d, 0xc(%rsp)
movq %rcx, 0xa8(%rsp)
movl %r8d, 0x2c(%rsp)
movaps %xmm0, %xmm5
shufps $0x55, %xmm0, %xmm5     # xmm5 = xmm5[1,1],xmm0[1,1]
movq 0x158(%rsp), %r14
movss 0x8(%rax), %xmm6
movaps %xmm6, %xmm7
shufps $0x0, %xmm6, %xmm7      # xmm7 = xmm7[0,0],xmm6[0,0]
movss 0xdd76(%rip), %xmm2     # 0x233f0
movaps %xmm6, %xmm3
mulss %xmm2, %xmm3
movss 0xd0(%r15), %xmm4
movaps %xmm4, 0x10(%rsp)
movaps %xmm4, %xmm8
addss %xmm4, %xmm8
movsd 0xbc(%r15), %xmm4
movsd 0xc4(%r15), %xmm10
movaps %xmm0, %xmm9
subps %xmm10, %xmm9
movaps %xmm4, 0x30(%rsp)
addps %xmm4, %xmm4
movaps %xmm4, 0x80(%rsp)
movaps %xmm7, 0x70(%rsp)
addps %xmm7, %xmm4
maxps %xmm1, %xmm4
addps %xmm10, %xmm10
addps %xmm4, %xmm10
movaps %xmm4, %xmm1
shufps $0x55, %xmm4, %xmm1     # xmm1 = xmm1[1,1],xmm4[1,1]
mulss %xmm2, %xmm1
addss %xmm5, %xmm1
subss %xmm3, %xmm1
movaps %xmm1, 0xe0(%rsp)
movlhps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
shufps $0xe2, %xmm0, %xmm1     # xmm1 = xmm1[2,0],xmm0[2,3]
movaps %xmm1, 0x60(%rsp)
shufps $0x0, %xmm8, %xmm8      # xmm8 = xmm8[0,0,0,0]
movaps %xmm8, 0xd0(%rsp)
movaps %xmm0, %xmm1
movaps %xmm6, 0xf0(%rsp)
addss %xmm6, %xmm1
addss 0xcc(%r15), %xmm1
movaps %xmm0, 0x100(%rsp)
addss %xmm0, %xmm4
movaps %xmm1, 0x90(%rsp)
movaps %xmm1, %xmm0
maxss %xmm4, %xmm0
movaps %xmm0, 0x50(%rsp)
movl (%r13), %r12d
movl (%rdi), %eax
andl $0x2, %eax
orl $0x4, %eax
movl %eax, (%rdi)
movaps %xmm9, 0xc0(%rsp)
movaps %xmm9, %xmm0
movaps %xmm10, 0xb0(%rsp)
movaps %xmm10, %xmm1
movq %r14, %rsi
xorl %edx, %edx
callq 0x1d651
testl %eax, %eax
je 0x15791
movl $0x22, (%rbp)
xorl %ecx, %ecx
testl %r12d, %r12d
sete %cl
movl $0x22, %eax
movl %ecx, %r12d
jmp 0x1579c
movl (%rbp), %eax
testb $0x10, %al
jne 0x15823
movaps 0x30(%rsp), %xmm2
movaps 0x10(%rsp), %xmm3
movaps 0x80(%rsp), %xmm4
movaps 0xd0(%rsp), %xmm5
movaps 0xc0(%rsp), %xmm6
testq %r14, %r14
je 0x15819
movss 0x14c(%r14), %xmm0
movaps %xmm6, %xmm1
addss 0xb0(%rsp), %xmm1
ucomiss %xmm6, %xmm0
jb 0x15819
ucomiss %xmm0, %xmm1
jbe 0x15819
movss 0x150(%r14), %xmm0
movaps %xmm6, %xmm1
shufps $0x55, %xmm6, %xmm1     # xmm1 = xmm1[1,1],xmm6[1,1]
ucomiss %xmm1, %xmm0
jb 0x15819
addps 0xb0(%rsp), %xmm6
shufps $0x55, %xmm6, %xmm6     # xmm6 = xmm6[1,1,1,1]
ucomiss %xmm0, %xmm6
movl 0xc(%rsp), %r14d
jbe 0x158ac
orl $0x40, %eax
jmp 0x158a9
movl 0xc(%rsp), %r14d
jmp 0x158ac
testq %r14, %r14
movaps 0x80(%rsp), %xmm4
movaps 0xd0(%rsp), %xmm5
movaps 0xc0(%rsp), %xmm6
je 0x15897
movss 0x14c(%r14), %xmm0
ucomiss %xmm6, %xmm0
jb 0x15897
movaps %xmm6, %xmm1
addss 0xb0(%rsp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x15897
movss 0x150(%r14), %xmm2
movaps %xmm6, %xmm3
shufps $0x55, %xmm6, %xmm3     # xmm3 = xmm3[1,1],xmm6[1,1]
ucomiss %xmm3, %xmm2
jb 0x15897
movaps %xmm6, %xmm3
addps 0xb0(%rsp), %xmm3
shufps $0x55, %xmm3, %xmm3     # xmm3 = xmm3[1,1,1,1]
ucomiss %xmm2, %xmm3
jbe 0x15897
movaps 0x30(%rsp), %xmm2
movaps 0x10(%rsp), %xmm3
jmp 0x157d8
orl $0x8, %eax
movaps 0x30(%rsp), %xmm2
movl 0xc(%rsp), %r14d
movaps 0x10(%rsp), %xmm3
movl %eax, (%rbp)
addps 0x60(%rsp), %xmm2
shufps $0x0, %xmm3, %xmm3      # xmm3 = xmm3[0,0,0,0]
addps %xmm5, %xmm4
movaps 0x50(%rsp), %xmm0
subss 0x90(%rsp), %xmm0
movaps %xmm0, 0x50(%rsp)
movl %r12d, (%r13)
movq 0xe0(%r15), %rax
testq %rax, %rax
je 0x1590b
movq 0xd8(%r15), %rsi
movq %rbx, %rdi
movaps %xmm2, 0x30(%rsp)
movaps %xmm3, 0x10(%rsp)
movaps %xmm4, 0x80(%rsp)
callq *%rax
movaps 0x80(%rsp), %xmm4
movaps 0x10(%rsp), %xmm3
movaps 0x30(%rsp), %xmm2
addps %xmm3, %xmm2
movaps 0x70(%rsp), %xmm0
subps %xmm4, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps 0x90(%rsp), %xmm0
unpcklps 0xe0(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
movaps %xmm0, 0x90(%rsp)
movaps 0x50(%rsp), %xmm0
unpcklps 0xf0(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
movaps %xmm0, 0x50(%rsp)
movl (%rbp), %eax
movl (%r13), %ebp
testl %r14d, %r14d
movaps %xmm2, 0x30(%rsp)
je 0x15972
testb $0x10, %al
jne 0x15995
testb $0x20, %al
jne 0x159c0
leaq 0x68(%r15), %r12
movl 0xa8(%r15), %eax
movl %eax, 0x4c(%rsp)
movq %r15, %r14
jmp 0x159d6
testb $0x10, %al
jne 0x159a9
testb $0x20, %al
jne 0x15a92
leaq 0x68(%r15), %r12
movl 0xa8(%r15), %eax
movl %eax, 0x4c(%rsp)
movq %r15, %r14
jmp 0x15aa8
leaq 0x20(%r15), %r14
leaq 0x88(%r15), %r12
movl 0xac(%r15), %eax
jmp 0x159d2
leaq 0x20(%r15), %r14
leaq 0x88(%r15), %r12
movl 0xac(%r15), %eax
jmp 0x15aa4
leaq 0x20(%r15), %r14
leaq 0x88(%r15), %r12
movl 0xb0(%r15), %eax
movl %eax, 0x4c(%rsp)
cmpl $0x0, (%r14)
je 0x159fc
addq $0x8, %r14
movq %rbx, %rdi
movaps 0x60(%rsp), %xmm0
movaps 0x70(%rsp), %xmm1
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7c36
jmp 0x15a5d
movl 0x60(%r15), %esi
movq %rbx, %rdi
movaps 0x60(%rsp), %xmm0
movaps 0x70(%rsp), %xmm1
callq 0x7499
movss 0xd0(%r15), %xmm0
movaps 0x100(%rsp), %xmm2
addss %xmm0, %xmm2
movaps 0xe0(%rsp), %xmm3
addss %xmm0, %xmm3
addss %xmm0, %xmm0
movaps %xmm0, %xmm1
maxss 0xf0(%rsp), %xmm1
unpcklps %xmm3, %xmm2            # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
subss %xmm0, %xmm1
movl 0x8(%r14), %esi
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
movq %rbx, %rdi
movaps %xmm2, %xmm0
callq 0x7499
testl %ebp, %ebp
movaps 0x30(%rsp), %xmm0
je 0x15b75
leaq 0x8(%r12), %rsi
cmpl $0x1, (%r12)
jne 0x15a7e
movq %rbx, %rdi
jmp 0x15b4d
movl (%rsi), %esi
movq %rbx, %rdi
movaps 0x10(%rsp), %xmm1
callq 0x7499
jmp 0x15b75
leaq 0x20(%r15), %r14
leaq 0x88(%r15), %r12
movl 0xb0(%r15), %eax
movl %eax, 0x4c(%rsp)
cmpl $0x0, (%r14)
je 0x15ace
addq $0x8, %r14
movq %rbx, %rdi
movaps 0x60(%rsp), %xmm0
movaps 0x70(%rsp), %xmm1
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7c36
jmp 0x15b35
movl 0x60(%r15), %esi
xorps %xmm2, %xmm2
movq %rbx, %rdi
movaps 0x60(%rsp), %xmm0
movaps 0x70(%rsp), %xmm1
callq 0x7178
movss 0xd0(%r15), %xmm0
movaps 0x100(%rsp), %xmm3
addss %xmm0, %xmm3
movaps 0xe0(%rsp), %xmm2
addss %xmm0, %xmm2
addss %xmm0, %xmm0
movaps %xmm0, %xmm1
maxss 0xf0(%rsp), %xmm1
unpcklps %xmm2, %xmm3            # xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
subss %xmm0, %xmm1
movl 0x8(%r14), %esi
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
xorps %xmm2, %xmm2
movq %rbx, %rdi
movaps %xmm3, %xmm0
callq 0x7178
testl %ebp, %ebp
je 0x15b75
leaq 0x8(%r12), %rsi
cmpl $0x1, (%r12)
jne 0x15b5e
movq %rbx, %rdi
movaps 0x30(%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7c36
jmp 0x15b75
movl (%rsi), %esi
xorps %xmm2, %xmm2
movq %rbx, %rdi
movaps 0x30(%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
callq 0x7178
leaq 0x40(%rsp), %rcx
movq $0x0, (%rcx)
movl 0xb4(%r15), %eax
movl %eax, 0x8(%rcx)
movq %rbx, %rdi
movaps 0x90(%rsp), %xmm0
movaps 0x50(%rsp), %xmm1
movq 0xa8(%rsp), %rsi
movl 0x2c(%rsp), %edx
movl $0x11, %r8d
movq 0x160(%rsp), %r9
callq 0x13fa7
movq 0xe8(%r15), %rax
testq %rax, %rax
je 0x15bd2
movq 0xd8(%r15), %rsi
movq %rbx, %rdi
callq *%rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x111e3(%rip), %rdi     # 0x26dce
leaq 0xdae1(%rip), %rsi      # 0x236d3
leaq 0x1350c(%rip), %rcx     # 0x29105
movl $0x4fef, %edx           # imm = 0x4FEF
callq 0x20a0
leaq 0x10966(%rip), %rdi     # 0x26570
leaq 0xdac2(%rip), %rsi      # 0x236d3
leaq 0x134ed(%rip), %rcx     # 0x29105
movl $0x4ff0, %edx           # imm = 0x4FF0
callq 0x20a0
leaq 0xeab8(%rip), %rdi      # 0x246e1
leaq 0xdaa3(%rip), %rsi      # 0x236d3
leaq 0x134ce(%rip), %rcx     # 0x29105
movl $0x4ff1, %edx           # imm = 0x4FF1
callq 0x20a0