// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::Checkbox(char const*, bool*)
bool ImGui::Checkbox(const char* label, bool* v)
{
    ImGuiWindow* window = GetCurrentWindow();
    if (window->SkipItems)
        return false;

    ImGuiContext& g = *GImGui;
    const ImGuiStyle& style = g.Style;
    const ImGuiID id = window->GetID(label);
    const ImVec2 label_size = CalcTextSize(label, NULL, true);

    const float square_sz = GetFrameHeight();
    const ImVec2 pos = window->DC.CursorPos;
    const ImRect total_bb(pos, pos + ImVec2(square_sz + (label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f), label_size.y + style.FramePadding.y * 2.0f));
    ItemSize(total_bb, style.FramePadding.y);
    if (!ItemAdd(total_bb, id))
    {
        IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.ItemFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));
        return false;
    }

    bool hovered, held;
    bool pressed = ButtonBehavior(total_bb, id, &hovered, &held);
    if (pressed)
    {
        *v = !(*v);
        MarkItemEdited(id);
    }

    const ImRect check_bb(pos, pos + ImVec2(square_sz, square_sz));
    RenderNavHighlight(total_bb, id);
    RenderFrame(check_bb.Min, check_bb.Max, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), true, style.FrameRounding);
    ImU32 check_col = GetColorU32(ImGuiCol_CheckMark);
    bool mixed_value = (window->DC.ItemFlags & ImGuiItemFlags_MixedValue) != 0;
    if (mixed_value)
    {
        // Undocumented tristate/mixed/indeterminate checkbox (#2644)
        // This may seem awkwardly designed because the aim is to make ImGuiItemFlags_MixedValue supported by all widgets (not just checkbox)
        ImVec2 pad(ImMax(1.0f, IM_FLOOR(square_sz / 3.6f)), ImMax(1.0f, IM_FLOOR(square_sz / 3.6f)));
        window->DrawList->AddRectFilled(check_bb.Min + pad, check_bb.Max - pad, check_col, style.FrameRounding);
    }
    else if (*v)
    {
        const float pad = ImMax(1.0f, IM_FLOOR(square_sz / 6.0f));
        RenderCheckMark(window->DrawList, check_bb.Min + ImVec2(pad, pad), check_col, square_sz - pad * 2.0f);
    }

    if (g.LogEnabled)
        LogRenderedText(&total_bb.Min, mixed_value ? "[~]" : *v ? "[x]" : "[ ]");
    if (label_size.x > 0.0f)
        RenderText(ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y), label);

    IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.ItemFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));
    return pressed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
callq 0xeb270
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
testb $0x1, 0x93(%rax)
je 0x13c7f2
movb $0x0, -0x1(%rbp)
jmp 0x13cd14
leaq 0xd6747(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
addq $0x1560, %rax           # imm = 0x1560
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, -0xe8(%rbp)
callq 0xc9910
movq -0xe8(%rbp), %rsi
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %edx
movss 0x3573f(%rip), %xmm0    # 0x171f80
callq 0xc87e0
movlpd %xmm0, -0x3c(%rbp)
callq 0xdd050
movss %xmm0, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq 0xd8(%rax), %rax
movq %rax, -0x48(%rbp)
movss -0x40(%rbp), %xmm0
movss %xmm0, -0xdc(%rbp)
movss -0x3c(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x13c896
movq -0x30(%rbp), %rax
movss 0x50(%rax), %xmm0
addss -0x3c(%rbp), %xmm0
movss %xmm0, -0xec(%rbp)
jmp 0x13c8a3
xorps %xmm0, %xmm0
movss %xmm0, -0xec(%rbp)
jmp 0x13c8a3
movss -0xdc(%rbp), %xmm0
movss -0xec(%rbp), %xmm1
addss %xmm1, %xmm0
movss -0x38(%rbp), %xmm2
movq -0x30(%rbp), %rax
movss 0x3c(%rax), %xmm1
addss %xmm1, %xmm1
addss %xmm2, %xmm1
leaq -0x68(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0xbf4c0
movq -0xf8(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x139090
movlpd %xmm0, -0x60(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0xe8660
movq -0x30(%rbp), %rax
movss 0x3c(%rax), %xmm0
leaq -0x58(%rbp), %rdi
callq 0xdc300
movl -0x34(%rbp), %esi
leaq -0x58(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0xd6250
testb $0x1, %al
jne 0x13c936
jmp 0x13c92b
jmp 0x13c92d
movb $0x0, -0x1(%rbp)
jmp 0x13cd14
movl -0x34(%rbp), %esi
leaq -0x58(%rbp), %rdi
leaq -0x69(%rbp), %rdx
leaq -0x6a(%rbp), %rcx
xorl %r8d, %r8d
callq 0x139df0
andb $0x1, %al
movb %al, -0x6b(%rbp)
testb $0x1, -0x6b(%rbp)
je 0x13c972
movq -0x18(%rbp), %rax
movb (%rax), %cl
xorb $-0x1, %cl
movq -0x18(%rbp), %rax
andb $0x1, %cl
movb %cl, (%rax)
movl -0x34(%rbp), %edi
callq 0xca110
movss -0x40(%rbp), %xmm1
leaq -0x8c(%rbp), %rdi
movq %rdi, -0x100(%rbp)
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0x100(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x139090
movlpd %xmm0, -0x84(%rbp)
leaq -0x7c(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x84(%rbp), %rdx
callq 0xe8660
movl -0x34(%rbp), %esi
leaq -0x58(%rbp), %rdi
movl $0x1, %edx
callq 0xc91e0
movq -0x7c(%rbp), %rax
movq %rax, -0x94(%rbp)
movq -0x74(%rbp), %rax
movq %rax, -0x9c(%rbp)
testb $0x1, -0x6a(%rbp)
je 0x13c9f9
testb $0x1, -0x69(%rbp)
je 0x13c9f9
movl $0x9, %eax
movl %eax, -0x104(%rbp)
jmp 0x13ca12
movb -0x69(%rbp), %dl
movl $0x7, %eax
movl $0x8, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x104(%rbp)
movl -0x104(%rbp), %edi
movss 0x3421c(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movl %eax, %edi
movq -0x30(%rbp), %rax
movss 0x40(%rax), %xmm2
movsd -0x94(%rbp), %xmm0
movsd -0x9c(%rbp), %xmm1
movl $0x1, %esi
callq 0xc8f20
movl $0x12, %edi
movss 0x341e5(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movl %eax, -0xa0(%rbp)
movq -0x20(%rbp), %rax
movl 0x1cc(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0xa1(%rbp)
testb $0x1, -0xa1(%rbp)
je 0x13cb83
movss -0x40(%rbp), %xmm0
movss 0x5174d(%rip), %xmm1    # 0x18e1e4
movss %xmm1, -0x124(%rbp)
divss %xmm1, %xmm0
cvttps2dq %xmm0, %xmm0
cvtdq2ps %xmm0, %xmm1
movss 0x3418a(%rip), %xmm0    # 0x170c3c
movss %xmm0, -0x120(%rbp)
callq 0x139050
movss -0x124(%rbp), %xmm2
movaps %xmm0, %xmm1
movss -0x120(%rbp), %xmm0
movss %xmm1, -0x11c(%rbp)
movss -0x40(%rbp), %xmm1
divss %xmm2, %xmm1
cvttps2dq %xmm1, %xmm1
cvtdq2ps %xmm1, %xmm1
callq 0x139050
movaps %xmm0, %xmm1
movss -0x11c(%rbp), %xmm0
leaq -0xac(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0xbf4c0
movq -0x118(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0x110(%rbp)
leaq -0x7c(%rbp), %rdi
callq 0x139090
movq -0x118(%rbp), %rsi
movlpd %xmm0, -0xb4(%rbp)
leaq -0x74(%rbp), %rdi
callq 0x1390e0
movq -0x110(%rbp), %rdi
movlpd %xmm0, -0xbc(%rbp)
movl -0xa0(%rbp), %ecx
movq -0x30(%rbp), %rax
movss 0x40(%rax), %xmm0
leaq -0xb4(%rbp), %rsi
leaq -0xbc(%rbp), %rdx
movl $0xf, %r8d
callq 0x113090
jmp 0x13cc36
movq -0x18(%rbp), %rax
testb $0x1, (%rax)
je 0x13cc34
movss -0x40(%rbp), %xmm0
movss 0x35443(%rip), %xmm1    # 0x171fe0
divss %xmm1, %xmm0
cvttps2dq %xmm0, %xmm0
cvtdq2ps %xmm0, %xmm1
movss 0x3408c(%rip), %xmm0    # 0x170c3c
callq 0x139050
movss %xmm0, -0xc0(%rbp)
movq -0x20(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0x130(%rbp)
movss -0xc0(%rbp), %xmm1
leaq -0xd0(%rbp), %rdi
movq %rdi, -0x138(%rbp)
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0x138(%rbp), %rsi
leaq -0x7c(%rbp), %rdi
callq 0x139090
movq -0x130(%rbp), %rdi
movlpd %xmm0, -0xc8(%rbp)
movl -0xa0(%rbp), %esi
movss -0x40(%rbp), %xmm1
movss -0xc0(%rbp), %xmm0
addss %xmm0, %xmm0
subss %xmm0, %xmm1
movsd -0xc8(%rbp), %xmm0
callq 0x11cde0
jmp 0x13cc36
movq -0x28(%rbp), %rax
testb $0x1, 0x3138(%rax)
je 0x13ccb5
leaq -0x58(%rbp), %rax
movq %rax, -0x140(%rbp)
testb $0x1, -0xa1(%rbp)
je 0x13cc67
leaq 0x519e7(%rip), %rax     # 0x18e645
movq %rax, -0x148(%rbp)
jmp 0x13cc9e
movq -0x18(%rbp), %rax
testb $0x1, (%rax)
je 0x13cc80
leaq 0x519d2(%rip), %rax     # 0x18e649
movq %rax, -0x150(%rbp)
jmp 0x13cc90
leaq 0x519c6(%rip), %rax     # 0x18e64d
movq %rax, -0x150(%rbp)
jmp 0x13cc90
movq -0x150(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x140(%rbp), %rdi
movq -0x148(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xc8240
movss -0x3c(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x13cd08
movss -0x78(%rbp), %xmm1
movss -0x74(%rbp), %xmm0
movq -0x30(%rbp), %rax
movss 0x3c(%rax), %xmm2
movss 0x50(%rax), %xmm3
addss %xmm3, %xmm0
addss %xmm2, %xmm1
leaq -0xd8(%rbp), %rdi
callq 0xbf4c0
movq -0x10(%rbp), %rdi
movsd -0xd8(%rbp), %xmm0
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0xc8120
jmp 0x13cd0a
jmp 0x13cd0c
movb -0x6b(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nopw %cs:(%rax,%rax)