// File: /workspace/github_c_makefile_star2_O0/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 %r14
pushq %rbx
subq $0xb8, %rsp
movl 0xf0(%rsp), %eax
movl 0xe8(%rsp), %eax
movq 0xe0(%rsp), %rax
movq 0xd8(%rsp), %rax
movq 0xd0(%rsp), %rax
movlpd %xmm0, 0xa4(%rsp)
movlpd %xmm1, 0xac(%rsp)
movq %rdi, 0x98(%rsp)
movq %rsi, 0x90(%rsp)
movq %rdx, 0x88(%rsp)
movq %rcx, 0x80(%rsp)
movl %r8d, 0x7c(%rsp)
movl %r9d, 0x78(%rsp)
cmpq $0x0, 0xd0(%rsp)
jne 0x6acba
movq 0x5a362(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x46708(%rip), %rsi     # 0xb13a0
leaq 0x4671f(%rip), %rdx     # 0xb13be
movl $0x60fd, %ecx           # imm = 0x60FD
movb $0x0, %al
callq 0x13ec0
movq 0x5a33e(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x6acbc
jmp 0x6acbe
cmpq $0x0, 0x90(%rsp)
jne 0x6acfc
movq 0x5a320(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x466c6(%rip), %rsi     # 0xb13a0
leaq 0x466dd(%rip), %rdx     # 0xb13be
movl $0x60fe, %ecx           # imm = 0x60FE
movb $0x0, %al
callq 0x13ec0
movq 0x5a2fc(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x6acfe
jmp 0x6ad00
cmpq $0x0, 0xe0(%rsp)
jne 0x6ad3e
movq 0x5a2de(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x46684(%rip), %rsi     # 0xb13a0
leaq 0x4669b(%rip), %rdx     # 0xb13be
movl $0x60ff, %ecx           # imm = 0x60FF
movb $0x0, %al
callq 0x13ec0
movq 0x5a2ba(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x6ad40
cmpq $0x0, 0x90(%rsp)
je 0x6ad6c
cmpq $0x0, 0xd0(%rsp)
je 0x6ad6c
cmpq $0x0, 0xe0(%rsp)
je 0x6ad6c
cmpq $0x0, 0x88(%rsp)
jne 0x6ad7c
movl $0x0, 0xb4(%rsp)
jmp 0x6b3ff
movss 0xac(%rsp), %xmm1
movq 0xe0(%rsp), %rax
movss 0x8(%rax), %xmm2
movq 0xd0(%rsp), %rax
movss 0xe4(%rax), %xmm0
addss %xmm0, %xmm0
addss %xmm2, %xmm0
ucomiss %xmm1, %xmm0
jbe 0x6addc
movq 0xe0(%rsp), %rax
movss 0x8(%rax), %xmm1
movq 0xd0(%rsp), %rax
movss 0xe4(%rax), %xmm0
addss %xmm0, %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x30(%rsp)
jmp 0x6adeb
movss 0xac(%rsp), %xmm0
movss %xmm0, 0x30(%rsp)
movss 0x30(%rsp), %xmm0
movss %xmm0, 0xac(%rsp)
movss 0xb0(%rsp), %xmm1
movq 0xe0(%rsp), %rax
movss 0x8(%rax), %xmm2
movq 0xd0(%rsp), %rax
movss 0xe8(%rax), %xmm0
addss %xmm0, %xmm0
addss %xmm2, %xmm0
ucomiss %xmm1, %xmm0
jbe 0x6ae5a
movq 0xe0(%rsp), %rax
movss 0x8(%rax), %xmm1
movq 0xd0(%rsp), %rax
movss 0xe8(%rax), %xmm0
addss %xmm0, %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x2c(%rsp)
jmp 0x6ae69
movss 0xb0(%rsp), %xmm0
movss %xmm0, 0x2c(%rsp)
movss 0x2c(%rsp), %xmm0
movss %xmm0, 0xb0(%rsp)
movss 0xa4(%rsp), %xmm0
movq 0xd0(%rsp), %rax
subss 0xec(%rax), %xmm0
movss %xmm0, 0x64(%rsp)
movss 0xa8(%rsp), %xmm0
movq 0xd0(%rsp), %rax
subss 0xf0(%rax), %xmm0
movss %xmm0, 0x68(%rsp)
movss 0xac(%rsp), %xmm1
movq 0xd0(%rsp), %rax
movss 0xec(%rax), %xmm0
addss %xmm0, %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x6c(%rsp)
movss 0xb0(%rsp), %xmm1
movq 0xd0(%rsp), %rax
movss 0xf0(%rax), %xmm0
addss %xmm0, %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x70(%rsp)
movq 0xe0(%rsp), %rax
movss 0x8(%rax), %xmm0
movss %xmm0, 0x5c(%rsp)
movss 0x5c(%rsp), %xmm0
movss %xmm0, 0x60(%rsp)
movl 0xe8(%rsp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x6afa5
movss 0xa4(%rsp), %xmm0
addss 0xac(%rsp), %xmm0
movq 0xe0(%rsp), %rax
subss 0x8(%rax), %xmm0
movss %xmm0, 0x54(%rsp)
movss 0xa4(%rsp), %xmm0
movss %xmm0, 0x34(%rsp)
movss 0xac(%rsp), %xmm1
subss 0x5c(%rsp), %xmm1
movq 0xd0(%rsp), %rax
movss 0xf4(%rax), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
addss %xmm0, %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x3c(%rsp)
jmp 0x6b0c8
movl 0xe8(%rsp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x6b040
movss 0xa4(%rsp), %xmm0
movss 0xac(%rsp), %xmm1
subss 0x5c(%rsp), %xmm1
movss 0x4250c(%rip), %xmm2    # 0xad4e4
divss %xmm2, %xmm1
addss %xmm1, %xmm0
movss %xmm0, 0x54(%rsp)
movss 0xa4(%rsp), %xmm0
movss %xmm0, 0x34(%rsp)
movss 0xac(%rsp), %xmm1
subss 0x5c(%rsp), %xmm1
movq 0xd0(%rsp), %rax
movss 0xf4(%rax), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
addss %xmm0, %xmm0
addss %xmm1, %xmm0
movss 0x424b3(%rip), %xmm1    # 0xad4e4
divss %xmm1, %xmm0
movss %xmm0, 0x3c(%rsp)
jmp 0x6b0c6
movss 0xa4(%rsp), %xmm0
movss %xmm0, 0x54(%rsp)
movss 0x54(%rsp), %xmm0
addss 0x5c(%rsp), %xmm0
movq 0xd0(%rsp), %rax
addss 0xf4(%rax), %xmm0
movss %xmm0, 0x34(%rsp)
movss 0xa4(%rsp), %xmm1
addss 0xac(%rsp), %xmm1
movss 0x34(%rsp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x6b09c
movss 0x34(%rsp), %xmm0
movss %xmm0, 0x28(%rsp)
jmp 0x6b0b4
movss 0xa4(%rsp), %xmm0
addss 0xac(%rsp), %xmm0
movss %xmm0, 0x28(%rsp)
movss 0x28(%rsp), %xmm0
subss 0x34(%rsp), %xmm0
movss %xmm0, 0x3c(%rsp)
jmp 0x6b0c8
movl 0xe8(%rsp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x6b0eb
movss 0xa8(%rsp), %xmm0
movss %xmm0, 0x58(%rsp)
jmp 0x6b172
movl 0xe8(%rsp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x6b132
movss 0xa8(%rsp), %xmm0
addss 0xb0(%rsp), %xmm0
subss 0x60(%rsp), %xmm0
movq 0xd0(%rsp), %rax
movss 0xe8(%rax), %xmm1
addss %xmm1, %xmm1
subss %xmm1, %xmm0
movss %xmm0, 0x58(%rsp)
jmp 0x6b170
movss 0xa8(%rsp), %xmm0
movss 0xb0(%rsp), %xmm1
movss 0x42398(%rip), %xmm2    # 0xad4e4
divss %xmm2, %xmm1
addss %xmm1, %xmm0
movss 0x60(%rsp), %xmm1
movss 0x42382(%rip), %xmm2    # 0xad4e4
divss %xmm2, %xmm1
subss %xmm1, %xmm0
movss %xmm0, 0x58(%rsp)
jmp 0x6b172
movss 0x58(%rsp), %xmm0
movss %xmm0, 0x38(%rsp)
movss 0x5c(%rsp), %xmm0
movss %xmm0, 0x40(%rsp)
movss 0x54(%rsp), %xmm0
movq 0xd0(%rsp), %rax
movss 0xe4(%rax), %xmm2
movss 0xf8(%rax), %xmm1
addss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x44(%rsp)
movss 0x58(%rsp), %xmm0
movq 0xd0(%rsp), %rax
movss 0xe8(%rax), %xmm2
movss 0xf8(%rax), %xmm1
addss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x48(%rsp)
movss 0x5c(%rsp), %xmm0
movq 0xd0(%rsp), %rax
movss 0xe4(%rax), %xmm1
movss 0xf8(%rax), %xmm2
addss %xmm2, %xmm2
addss %xmm1, %xmm1
addss %xmm2, %xmm1
subss %xmm1, %xmm0
movss %xmm0, 0x4c(%rsp)
movss 0x60(%rsp), %xmm0
movq 0xd0(%rsp), %rax
movss 0xe8(%rax), %xmm1
movss 0xf8(%rax), %xmm2
addss %xmm2, %xmm2
addss %xmm1, %xmm1
addss %xmm2, %xmm1
subss %xmm1, %xmm0
movss %xmm0, 0x50(%rsp)
movq 0x88(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x74(%rsp)
movq 0xd8(%rsp), %rdi
movq 0x98(%rsp), %rsi
movq 0x88(%rsp), %rax
movl (%rax), %edx
movsd 0x64(%rsp), %xmm0
movsd 0x6c(%rsp), %xmm1
callq 0x898f0
movl %eax, %ecx
movq 0x88(%rsp), %rax
movl %ecx, (%rax)
movq 0xd0(%rsp), %rax
cmpq $0x0, 0x110(%rax)
je 0x6b2c9
movq 0xd0(%rsp), %rax
movq 0x110(%rax), %rax
movq 0x90(%rsp), %rdi
movq 0xd0(%rsp), %rcx
movq 0x108(%rcx), %rsi
callq *%rax
cmpl $0x0, 0x78(%rsp)
jne 0x6b33d
movq 0x90(%rsp), %rdi
movq 0x98(%rsp), %rax
movl (%rax), %esi
movq 0xd0(%rsp), %rdx
movq 0x88(%rsp), %rax
movl (%rax), %ecx
movq 0x80(%rsp), %rbx
movl 0x7c(%rsp), %r11d
movq 0xe0(%rsp), %r10
movl 0xf0(%rsp), %eax
leaq 0x34(%rsp), %r8
leaq 0x54(%rsp), %r9
leaq 0x44(%rsp), %r14
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x899e0
jmp 0x6b3a8
movq 0x90(%rsp), %rdi
movq 0x98(%rsp), %rax
movl (%rax), %esi
movq 0xd0(%rsp), %rdx
movq 0x88(%rsp), %rax
movl (%rax), %ecx
movq 0x80(%rsp), %rbx
movl 0x7c(%rsp), %r11d
movq 0xe0(%rsp), %r10
movl 0xf0(%rsp), %eax
leaq 0x34(%rsp), %r8
leaq 0x54(%rsp), %r9
leaq 0x44(%rsp), %r14
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x89dd0
movq 0xd0(%rsp), %rax
cmpq $0x0, 0x118(%rax)
je 0x6b3e2
movq 0xd0(%rsp), %rax
movq 0x118(%rax), %rax
movq 0x90(%rsp), %rdi
movq 0xd0(%rsp), %rcx
movq 0x108(%rcx), %rsi
callq *%rax
movl 0x74(%rsp), %eax
movq 0x88(%rsp), %rcx
cmpl (%rcx), %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0xb4(%rsp)
movl 0xb4(%rsp), %eax
addq $0xb8, %rsp
popq %rbx
popq %r14
retq
nopw %cs:(%rax,%rax)