// File: /workspace/github_c_makefile_star2_O2/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, 0x7c(%rsp)
movl %r8d, 0x2c(%rsp)
movq %rcx, 0x98(%rsp)
movq %rdx, %r13
movaps %xmm1, 0x40(%rsp)
movq %rsi, %rbx
movq %rdi, %rbp
movq 0x130(%rsp), %r15
testq %r15, %r15
movaps %xmm0, (%rsp)
jne 0x43be4
movq 0x41435(%rip), %r14     # 0x84ff0
movq (%r14), %rdi
leaq 0x26147(%rip), %rsi     # 0x69d0c
leaq 0x2615e(%rip), %rdx     # 0x69d2a
movl $0x60fd, %ecx           # imm = 0x60FD
xorl %eax, %eax
callq 0x12ea0
movq (%r14), %rdi
callq 0x13960
movaps (%rsp), %xmm0
movq 0x140(%rsp), %r12
testq %rbx, %rbx
jne 0x43c21
movq 0x413f8(%rip), %r14     # 0x84ff0
movq (%r14), %rdi
leaq 0x2610a(%rip), %rsi     # 0x69d0c
leaq 0x26121(%rip), %rdx     # 0x69d2a
movl $0x60fe, %ecx           # imm = 0x60FE
xorl %eax, %eax
callq 0x12ea0
movq (%r14), %rdi
callq 0x13960
movaps (%rsp), %xmm0
testq %r12, %r12
jne 0x43c56
movq 0x413c3(%rip), %r14     # 0x84ff0
movq (%r14), %rdi
leaq 0x260d5(%rip), %rsi     # 0x69d0c
leaq 0x260ec(%rip), %rdx     # 0x69d2a
movl $0x60ff, %ecx           # imm = 0x60FF
xorl %eax, %eax
callq 0x12ea0
movq (%r14), %rdi
callq 0x13960
movaps (%rsp), %xmm0
testq %r12, %r12
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 0x44289
movl 0x148(%rsp), %eax
movss 0x8(%r12), %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, 0x80(%rsp)
movaps %xmm1, 0x60(%rsp)
addps %xmm1, %xmm5
maxps 0x40(%rsp), %xmm5
movaps %xmm2, %xmm1
addps %xmm2, %xmm1
testb $0x4, %al
jne 0x43d09
testb $0x2, %al
jne 0x43d39
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 0x43d80
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 0x43d78
movaps %xmm5, %xmm8
subss %xmm6, %xmm8
movss 0x22ae6(%rip), %xmm3    # 0x66830
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), %rsi
movaps %xmm0, %xmm3
subps %xmm2, %xmm3
addps %xmm5, %xmm1
testb $0x8, %al
movaps %xmm6, 0x10(%rsp)
movaps %xmm7, 0x30(%rsp)
jne 0x43dc1
testb $0x20, %al
jne 0x43dd1
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
shufps $0x55, %xmm5, %xmm5     # xmm5 = xmm5[1,1,1,1]
movss 0x22a7d(%rip), %xmm2    # 0x66830
mulss %xmm2, %xmm5
addss %xmm0, %xmm5
mulss %xmm6, %xmm2
jmp 0x43de7
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 0x43df8
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, 0x40(%rsp)
addss %xmm0, %xmm0
shufps $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movaps %xmm0, 0xd0(%rsp)
movl (%r13), %r12d
movl (%rbp), %eax
andl $0x2, %eax
orl $0x4, %eax
movl %eax, (%rbp)
movq %rbp, %rdi
movaps %xmm3, 0xa0(%rsp)
movaps %xmm3, %xmm0
movaps %xmm1, 0x50(%rsp)
movq %rsi, %r15
xorl %edx, %edx
callq 0x4c99d
testl %eax, %eax
je 0x43e5f
movl $0x22, (%rbp)
xorl %eax, %eax
testl %r12d, %r12d
sete %al
pushq $0x22
popq %r14
movl %eax, %r12d
jmp 0x43e86
movl (%rbp), %r14d
testb $0x10, %r14b
je 0x43e86
movq %r15, %rdi
movaps 0xa0(%rsp), %xmm0
movaps 0x50(%rsp), %xmm1
callq 0x13d20
testl %eax, %eax
je 0x4429b
movaps 0x50(%rsp), %xmm1
movaps 0xa0(%rsp), %xmm0
movq %r15, %rdi
callq 0x13d20
testl %eax, %eax
movq 0x130(%rsp), %r15
je 0x43ec7
orl $0x40, %r14d
movaps (%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
movaps 0x30(%rsp), %xmm2
movaps 0x80(%rsp), %xmm3
movl %r14d, (%rbp)
jmp 0x43edd
movaps (%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
movaps 0x30(%rsp), %xmm2
movaps 0x80(%rsp), %xmm3
movaps %xmm0, %xmm4
shufps $0x1, 0xb0(%rsp), %xmm4 # xmm4 = xmm4[1,0],mem[0,0]
unpcklpd 0xc0(%rsp), %xmm1       # xmm1 = xmm1[0],mem[0]
addps %xmm0, %xmm2
movaps 0x40(%rsp), %xmm0
shufps $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
addps 0xd0(%rsp), %xmm3
movl %r12d, (%r13)
movq 0x110(%r15), %rax
testq %rax, %rax
je 0x43f5a
movq 0x108(%r15), %rsi
movq %rbx, %rdi
movaps %xmm0, 0x40(%rsp)
movaps %xmm1, 0x10(%rsp)
movaps %xmm2, 0x30(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x50(%rsp)
callq *%rax
movaps 0x50(%rsp), %xmm4
movaps 0x80(%rsp), %xmm3
movaps 0x30(%rsp), %xmm2
movaps 0x10(%rsp), %xmm1
movaps 0x40(%rsp), %xmm0
movl 0x150(%rsp), %r14d
shufps $0xe2, 0xb0(%rsp), %xmm4 # xmm4 = xmm4[2,0],mem[2,3]
shufps $0xe2, 0xc0(%rsp), %xmm1 # xmm1 = xmm1[2,0],mem[2,3]
addps %xmm2, %xmm0
movaps 0x60(%rsp), %xmm2
subps %xmm3, %xmm2
movaps %xmm2, 0x30(%rsp)
movl (%rbp), %eax
movl (%r13), %ebp
cmpl $0x0, 0x7c(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm1, 0x10(%rsp)
movaps %xmm4, 0x50(%rsp)
je 0x43fb9
testb $0x10, %al
jne 0x43fd8
testb $0x20, %al
jne 0x43ff1
movl $0xd0, %eax
movl $0x80, %r13d
movq %r15, %r12
jmp 0x44000
testb $0x10, %al
jne 0x43fe3
testb $0x20, %al
jne 0x4411e
movl $0xd0, %eax
movl $0x80, %r13d
movq %r15, %r12
jmp 0x4412d
leaq 0x28(%r15), %r12
movl $0xd4, %eax
jmp 0x43ffa
leaq 0x28(%r15), %r12
movl $0xd4, %eax
jmp 0x44127
leaq 0x28(%r15), %r12
movl $0xd8, %eax
movl $0xa8, %r13d
movl (%r15,%rax), %edi
movss 0xfc(%r15), %xmm0
callq 0x140a0
leaq 0xe8(%rsp), %rcx
movl %eax, 0xc(%rcx)
andq $0x0, (%rcx)
movl 0xdc(%r15), %eax
movl %eax, 0x8(%rcx)
movq %rbx, %rdi
movaps 0x50(%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
movq 0x98(%rsp), %rsi
movl 0x2c(%rsp), %edx
movl %r14d, %r8d
movq 0x140(%rsp), %r9
callq 0x41852
cmpl $0x0, (%r12)
movss 0xfc(%r15), %xmm0
je 0x44088
addq $0x8, %r12
pushq $-0x1
popq %rdi
callq 0x140a0
movq %rbx, %rdi
movaps (%rsp), %xmm0
movaps 0x60(%rsp), %xmm1
movq %r12, %rsi
movl %eax, %edx
callq 0x13660
jmp 0x440ea
movl 0x78(%r15), %edi
callq 0x140a0
movq %rbx, %rdi
movaps (%rsp), %xmm0
movaps 0x60(%rsp), %xmm1
movl %eax, %esi
callq 0x13ff0
movss 0xf8(%r15), %xmm2
movaps (%rsp), %xmm0
movaps 0x60(%rsp), %xmm1
callq 0x4b175
movaps %xmm0, (%rsp)
movaps %xmm1, 0x10(%rsp)
movss 0xfc(%r15), %xmm0
movl 0x8(%r12), %edi
callq 0x140a0
movq %rbx, %rdi
movaps (%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
movl %eax, %esi
callq 0x13ff0
testl %ebp, %ebp
je 0x44271
addq %r15, %r13
leaq 0x8(%r13), %r14
cmpl $0x1, (%r13)
je 0x4422f
movl (%r14), %esi
movq %rbx, %rdi
movaps 0x40(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
callq 0x13ff0
jmp 0x44271
leaq 0x28(%r15), %r12
movl $0xd8, %eax
movl $0xa8, %r13d
movl (%r15,%rax), %edi
movss 0xfc(%r15), %xmm0
callq 0x140a0
leaq 0xe8(%rsp), %rcx
movl %eax, 0xc(%rcx)
andq $0x0, (%rcx)
movl 0xdc(%r15), %eax
movl %eax, 0x8(%rcx)
movq %rbx, %rdi
movaps 0x50(%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
movq 0x98(%rsp), %rsi
movl 0x2c(%rsp), %edx
movl %r14d, %r8d
movq 0x140(%rsp), %r9
callq 0x41852
cmpl $0x0, (%r12)
movss 0xfc(%r15), %xmm0
je 0x441b5
addq $0x8, %r12
pushq $-0x1
popq %rdi
callq 0x140a0
movq %rbx, %rdi
movaps (%rsp), %xmm0
movaps 0x60(%rsp), %xmm1
movq %r12, %rsi
movl %eax, %edx
callq 0x13660
jmp 0x4421d
movl 0x78(%r15), %edi
callq 0x140a0
xorps %xmm2, %xmm2
movq %rbx, %rdi
movaps (%rsp), %xmm0
movaps 0x60(%rsp), %xmm1
movl %eax, %esi
callq 0x12f00
movss 0xf8(%r15), %xmm2
movaps (%rsp), %xmm0
movaps 0x60(%rsp), %xmm1
callq 0x4b175
movaps %xmm0, (%rsp)
movaps %xmm1, 0x10(%rsp)
movss 0xfc(%r15), %xmm0
movl 0x8(%r12), %edi
callq 0x140a0
xorps %xmm2, %xmm2
movq %rbx, %rdi
movaps (%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
movl %eax, %esi
callq 0x12f00
testl %ebp, %ebp
je 0x44271
addq %r15, %r13
leaq 0x8(%r13), %r14
cmpl $0x1, (%r13)
jne 0x44259
movss 0xfc(%r15), %xmm0
pushq $-0x1
popq %rdi
callq 0x140a0
movq %rbx, %rdi
movaps 0x40(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
movq %r14, %rsi
movl %eax, %edx
callq 0x13660
jmp 0x44271
movl (%r14), %esi
xorps %xmm2, %xmm2
movq %rbx, %rdi
movaps 0x40(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
callq 0x12f00
movq 0x118(%r15), %rax
testq %rax, %rax
je 0x44289
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
orl $0x8, %r14d
movaps (%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
movaps 0x30(%rsp), %xmm2
movaps 0x80(%rsp), %xmm3
movq 0x130(%rsp), %r15
jmp 0x43ec1