// File: /workspace/github_c_makefile_star2_O2/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 $0x108, %rsp            # imm = 0x108
movq 0x140(%rsp), %r15
testq %r15, %r15
je 0x1418c
movq %rsi, %rbx
testq %rsi, %rsi
je 0x141ab
movq 0x150(%rsp), %rax
testq %rax, %rax
je 0x141ca
movq %rdx, %r13
testq %rdx, %rdx
je 0x14171
movq %rdi, %rbp
movl %r9d, 0x7c(%rsp)
movq %rcx, 0xa8(%rsp)
movl %r8d, 0xc(%rsp)
movaps %xmm0, %xmm2
shufps $0x55, %xmm0, %xmm2     # xmm2 = xmm2[1,1],xmm0[1,1]
movq 0x148(%rsp), %rsi
movss 0x8(%rax), %xmm7
movaps %xmm7, %xmm6
shufps $0x0, %xmm7, %xmm6      # xmm6 = xmm6[0,0],xmm7[0,0]
movss 0xc6cf(%rip), %xmm3     # 0x203d0
movaps %xmm7, %xmm4
mulss %xmm3, %xmm4
movss 0xd0(%r15), %xmm5
movaps %xmm5, 0x10(%rsp)
movaps %xmm5, %xmm8
addss %xmm5, %xmm8
movsd 0xbc(%r15), %xmm5
movsd 0xc4(%r15), %xmm9
movaps %xmm0, %xmm10
subps %xmm9, %xmm10
movaps %xmm5, 0x20(%rsp)
addps %xmm5, %xmm5
movaps %xmm5, 0x80(%rsp)
movaps %xmm6, 0x50(%rsp)
addps %xmm6, %xmm5
maxps %xmm1, %xmm5
addps %xmm9, %xmm9
addps %xmm5, %xmm9
movaps %xmm5, %xmm1
shufps $0x55, %xmm5, %xmm1     # xmm1 = xmm1[1,1],xmm5[1,1]
mulss %xmm3, %xmm1
addss %xmm2, %xmm1
subss %xmm4, %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, 0x40(%rsp)
shufps $0x0, %xmm8, %xmm8      # xmm8 = xmm8[0,0,0,0]
movaps %xmm8, 0xb0(%rsp)
movaps %xmm0, %xmm1
movaps %xmm7, 0xf0(%rsp)
addss %xmm7, %xmm1
addss 0xcc(%r15), %xmm1
addss %xmm0, %xmm5
movaps %xmm1, 0x90(%rsp)
maxss %xmm5, %xmm1
movaps %xmm1, 0x30(%rsp)
movl (%r13), %r12d
movl (%rdi), %eax
andl $0x2, %eax
orl $0x4, %eax
movl %eax, (%rdi)
movaps %xmm10, 0xc0(%rsp)
movaps %xmm10, %xmm0
movaps %xmm9, 0xd0(%rsp)
movaps %xmm9, %xmm1
xorl %edx, %edx
callq 0x1ae58
testl %eax, %eax
je 0x13e09
movl $0x22, (%rbp)
xorl %eax, %eax
testl %r12d, %r12d
sete %al
pushq $0x22
popq %r14
movl %eax, %r12d
jmp 0x13e38
movl (%rbp), %r14d
testb $0x10, %r14b
je 0x13e38
movq 0x148(%rsp), %rdi
movaps 0xc0(%rsp), %xmm0
movaps 0xd0(%rsp), %xmm1
callq 0x7d1c
testl %eax, %eax
je 0x14183
movq 0x148(%rsp), %rdi
movaps 0xc0(%rsp), %xmm0
movaps 0xd0(%rsp), %xmm1
callq 0x7d1c
testl %eax, %eax
je 0x13e82
orl $0x40, %r14d
movaps 0x30(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movaps 0x10(%rsp), %xmm2
movaps 0x80(%rsp), %xmm3
movaps 0xb0(%rsp), %xmm4
movl %r14d, (%rbp)
jmp 0x13ea1
movaps 0x30(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movaps 0x10(%rsp), %xmm2
movaps 0x80(%rsp), %xmm3
movaps 0xb0(%rsp), %xmm4
addps 0x40(%rsp), %xmm1
shufps $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0]
addps %xmm4, %xmm3
subss 0x90(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movl %r12d, (%r13)
movq 0xe0(%r15), %rax
testq %rax, %rax
movl 0x7c(%rsp), %r14d
je 0x13f00
movq 0xd8(%r15), %rsi
movq %rbx, %rdi
movaps %xmm1, 0x20(%rsp)
movaps %xmm2, 0x10(%rsp)
movaps %xmm3, 0x80(%rsp)
callq *%rax
movaps 0x80(%rsp), %xmm3
movaps 0x10(%rsp), %xmm2
movaps 0x20(%rsp), %xmm1
addps %xmm2, %xmm1
movaps 0x50(%rsp), %xmm0
subps %xmm3, %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 0x30(%rsp), %xmm0
unpcklps 0xf0(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
movl (%rbp), %eax
movl (%r13), %ebp
testl %r14d, %r14d
movaps %xmm0, 0x30(%rsp)
movaps %xmm1, 0x20(%rsp)
je 0x13f67
testb $0x10, %al
jne 0x13f8a
testb $0x20, %al
jne 0x13fb5
leaq 0x68(%r15), %r12
movl 0xa8(%r15), %eax
movl %eax, 0x74(%rsp)
movq %r15, %r14
jmp 0x13fcb
testb $0x10, %al
jne 0x13f9e
testb $0x20, %al
jne 0x14061
leaq 0x68(%r15), %r12
movl 0xa8(%r15), %eax
movl %eax, 0x74(%rsp)
movq %r15, %r14
jmp 0x14077
leaq 0x20(%r15), %r14
leaq 0x88(%r15), %r12
movl 0xac(%r15), %eax
jmp 0x13fc7
leaq 0x20(%r15), %r14
leaq 0x88(%r15), %r12
movl 0xac(%r15), %eax
jmp 0x14073
leaq 0x20(%r15), %r14
leaq 0x88(%r15), %r12
movl 0xb0(%r15), %eax
movl %eax, 0x74(%rsp)
cmpl $0x0, (%r14)
je 0x13fef
addq $0x8, %r14
pushq $-0x1
popq %rdx
movq %rbx, %rdi
movaps 0x40(%rsp), %xmm0
movaps 0x50(%rsp), %xmm1
movq %r14, %rsi
callq 0x72e2
jmp 0x14029
movl 0x60(%r15), %esi
movq %rbx, %rdi
movaps 0x40(%rsp), %xmm0
movaps 0x50(%rsp), %xmm1
callq 0x6b65
movss 0xd0(%r15), %xmm2
movaps 0x40(%rsp), %xmm0
movaps 0x50(%rsp), %xmm1
callq 0x19a20
movl 0x8(%r14), %esi
movq %rbx, %rdi
callq 0x6b65
testl %ebp, %ebp
movaps 0x20(%rsp), %xmm0
je 0x14119
leaq 0x8(%r12), %rsi
cmpl $0x1, (%r12)
jne 0x1404d
pushq $-0x1
popq %rdx
movq %rbx, %rdi
jmp 0x140f6
movl (%rsi), %esi
movq %rbx, %rdi
movaps 0x10(%rsp), %xmm1
callq 0x6b65
jmp 0x14119
leaq 0x20(%r15), %r14
leaq 0x88(%r15), %r12
movl 0xb0(%r15), %eax
movl %eax, 0x74(%rsp)
cmpl $0x0, (%r14)
je 0x1409b
addq $0x8, %r14
pushq $-0x1
popq %rdx
movq %rbx, %rdi
movaps 0x40(%rsp), %xmm0
movaps 0x50(%rsp), %xmm1
movq %r14, %rsi
callq 0x72e2
jmp 0x140db
movl 0x60(%r15), %esi
xorps %xmm2, %xmm2
movq %rbx, %rdi
movaps 0x40(%rsp), %xmm0
movaps 0x50(%rsp), %xmm1
callq 0x6858
movss 0xd0(%r15), %xmm2
movaps 0x40(%rsp), %xmm0
movaps 0x50(%rsp), %xmm1
callq 0x19a20
movl 0x8(%r14), %esi
xorps %xmm2, %xmm2
movq %rbx, %rdi
callq 0x6858
testl %ebp, %ebp
je 0x14119
leaq 0x8(%r12), %rsi
cmpl $0x1, (%r12)
jne 0x14102
pushq $-0x1
popq %rdx
movq %rbx, %rdi
movaps 0x20(%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
callq 0x72e2
jmp 0x14119
movl (%rsi), %esi
xorps %xmm2, %xmm2
movq %rbx, %rdi
movaps 0x20(%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
callq 0x6858
leaq 0x68(%rsp), %rcx
andq $0x0, (%rcx)
movl 0xb4(%r15), %eax
movl %eax, 0x8(%rcx)
pushq $0x11
popq %r8
movq %rbx, %rdi
movaps 0x90(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
movq 0xa8(%rsp), %rsi
movl 0xc(%rsp), %edx
movq 0x150(%rsp), %r9
callq 0x12660
movq 0xe8(%r15), %rax
testq %rax, %rax
je 0x14171
movq 0xd8(%r15), %rsi
movq %rbx, %rdi
callq *%rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
orl $0x8, %r14d
jmp 0x13e5d
leaq 0xfc0b(%rip), %rdi      # 0x23d9e
leaq 0xc509(%rip), %rsi      # 0x206a3
leaq 0x11fb7(%rip), %rcx     # 0x26158
movl $0x4fef, %edx           # imm = 0x4FEF
callq 0x20a0
leaq 0xf38e(%rip), %rdi      # 0x23540
leaq 0xc4ea(%rip), %rsi      # 0x206a3
leaq 0x11f98(%rip), %rcx     # 0x26158
movl $0x4ff0, %edx           # imm = 0x4FF0
callq 0x20a0
leaq 0xd4e0(%rip), %rdi      # 0x216b1
leaq 0xc4cb(%rip), %rsi      # 0x206a3
leaq 0x11f79(%rip), %rcx     # 0x26158
movl $0x4ff1, %edx           # imm = 0x4FF1
callq 0x20a0