// File: donfreiday[P]gb/./imgui/imgui_demo.cpp
// Function: ShowExampleAppCustomRendering(bool*)
static void ShowExampleAppCustomRendering(bool* opened)
{
    ImGui::SetNextWindowSize(ImVec2(300,350), ImGuiSetCond_FirstUseEver);
    if (!ImGui::Begin("Example: Custom rendering", opened))
    {
        ImGui::End();
        return;
    }

    // Tip: If you do a lot of custom rendering, you probably want to use your own geometrical types and benefit of overloaded operators, etc.
    // Define IM_VEC2_CLASS_EXTRA in imconfig.h to create implicit conversions between your types and ImVec2/ImVec4.
    // ImGui defines overloaded operators but they are internal to imgui.cpp and not exposed outside (to avoid messing with your types)
    // In this example we aren't using the operators.

    static ImVector<ImVec2> points;
    static bool adding_line = false;
    if (ImGui::Button("Clear")) points.clear();
    if (points.Size >= 2) { ImGui::SameLine(); if (ImGui::Button("Undo")) { points.pop_back(); points.pop_back(); } }
    ImGui::Text("Left-click and drag to add lines");
    ImGui::Text("Right-click to undo");

    ImDrawList* draw_list = ImGui::GetWindowDrawList();

    // Here we are using InvisibleButton() as a convenience to 1) advance the cursor and 2) allows us to use IsItemHovered()
    // However you can draw directly and poll mouse/keyboard by yourself. You can manipulate the cursor using GetCursorPos() and SetCursorPos().
    // If you only use the ImDrawList API, you can notify the owner window of its extends by using SetCursorPos(max).
    ImVec2 canvas_pos = ImGui::GetCursorScreenPos();            // ImDrawList API uses screen coordinates!
    ImVec2 canvas_size = ImGui::GetContentRegionAvail();        // Resize canvas to what's available
    if (canvas_size.x < 50.0f) canvas_size.x = 50.0f;
    if (canvas_size.y < 50.0f) canvas_size.y = 50.0f;
    draw_list->AddRectFilledMultiColor(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), ImColor(0,0,0), ImColor(255,0,0), ImColor(255,255,0), ImColor(0,255,0));
    draw_list->AddRect(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), ImColor(255,255,255));

    draw_list->AddBezierCurve(ImVec2(canvas_pos.x+20,canvas_pos.y+20), ImVec2(canvas_pos.x+100,canvas_pos.y+20), ImVec2(canvas_pos.x+canvas_size.x-100,canvas_pos.y+canvas_size.y-20), ImVec2(canvas_pos.x+canvas_size.x-20,canvas_pos.y+canvas_size.y-20), ImColor(255,200,0), 5.0f);

    bool adding_preview = false;
    ImGui::InvisibleButton("canvas", canvas_size);
    if (ImGui::IsItemHovered())
    {
        ImVec2 mouse_pos_in_canvas = ImVec2(ImGui::GetIO().MousePos.x - canvas_pos.x, ImGui::GetIO().MousePos.y - canvas_pos.y);
        if (!adding_line && ImGui::GetIO().MouseClicked[0])
        {
            points.push_back(mouse_pos_in_canvas);
            adding_line = true;
        }
        if (adding_line)
        {
            adding_preview = true;
            points.push_back(mouse_pos_in_canvas);
            if (!ImGui::GetIO().MouseDown[0])
                adding_line = adding_preview = false;
        }
        if (ImGui::GetIO().MouseClicked[1] && !points.empty())
        {
            adding_line = false;
            points.pop_back();
            points.pop_back();
        }
    }
    draw_list->PushClipRect(ImVec4(canvas_pos.x, canvas_pos.y, canvas_pos.x+canvas_size.x, canvas_pos.y+canvas_size.y));      // clip lines within the canvas (if we resize it, etc.)
    for (int i = 0; i < points.Size - 1; i += 2)
        draw_list->AddLine(ImVec2(canvas_pos.x + points[i].x, canvas_pos.y + points[i].y), ImVec2(canvas_pos.x + points[i+1].x, canvas_pos.y + points[i+1].y), 0xFF00FFFF, 2.0f);
    draw_list->PopClipRect();
    if (adding_preview)
        points.pop_back();
    ImGui::End();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x8(%rbp)
leaq -0x10(%rbp), %rdi
movss 0x24179(%rip), %xmm0    # 0x5d5a4
movss 0x241d1(%rip), %xmm1    # 0x5d604
callq 0x2d280
leaq -0x10(%rbp), %rdi
movl $0x4, %esi
callq 0xe790
movq -0x8(%rbp), %rsi
leaq 0x26a8d(%rip), %rdi     # 0x5fede
xorl %edx, %edx
callq 0xe7e0
testb $0x1, %al
jne 0x39466
callq 0xee30
jmp 0x39b2f
cmpb $0x0, 0x4a4e3(%rip)     # 0x83950
jne 0x394b4
leaq 0x4a4da(%rip), %rdi     # 0x83950
callq 0x72e0
cmpl $0x0, %eax
je 0x394b4
leaq 0x4a4b9(%rip), %rdi     # 0x83940
callq 0x30b50
jmp 0x3948e
leaq -0x88a5(%rip), %rdi     # 0x30bf0
leaq 0x4a4a4(%rip), %rsi     # 0x83940
leaq 0x40015(%rip), %rdx     # 0x794b8
callq 0x76b0
leaq 0x4a4a1(%rip), %rdi     # 0x83950
callq 0x7460
leaq -0x24(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x2d280
leaq 0x26a2e(%rip), %rdi     # 0x5fef8
leaq -0x24(%rbp), %rsi
callq 0x1ad10
testb $0x1, %al
jne 0x394d9
jmp 0x39504
leaq 0x4a460(%rip), %rdi     # 0x83940
callq 0x3aab0
jmp 0x39504
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq 0x4a456(%rip), %rdi     # 0x83950
callq 0x7380
jmp 0x39b38
cmpl $0x2, 0x4a435(%rip)     # 0x83940
jl 0x3955c
xorps %xmm0, %xmm0
movss 0x21b64(%rip), %xmm1    # 0x5b07c
callq 0x1a5e0
leaq -0x2c(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x2d280
leaq 0x26606(%rip), %rdi     # 0x5fb39
leaq -0x2c(%rbp), %rsi
callq 0x1ad10
testb $0x1, %al
jne 0x39542
jmp 0x3955a
leaq 0x4a3f7(%rip), %rdi     # 0x83940
callq 0x3ab00
leaq 0x4a3eb(%rip), %rdi     # 0x83940
callq 0x3ab00
jmp 0x3955c
leaq 0x2699b(%rip), %rdi     # 0x5fefe
xorl %eax, %eax
movb %al, -0x109(%rbp)
callq 0x1a220
movb -0x109(%rbp), %al
leaq 0x269a2(%rip), %rdi     # 0x5ff1f
callq 0x1a220
callq 0x19a70
movq %rax, -0x38(%rbp)
callq 0x19db0
movlpd %xmm0, -0x40(%rbp)
callq 0x15d60
movlpd %xmm0, -0x48(%rbp)
movss 0x24039(%rip), %xmm0    # 0x5d5e0
ucomiss -0x48(%rbp), %xmm0
jbe 0x395ba
movss 0x2402b(%rip), %xmm0    # 0x5d5e0
movss %xmm0, -0x48(%rbp)
movss 0x2401e(%rip), %xmm0    # 0x5d5e0
ucomiss -0x44(%rbp), %xmm0
jbe 0x395d5
movss 0x24010(%rip), %xmm0    # 0x5d5e0
movss %xmm0, -0x44(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x138(%rbp)
movss -0x40(%rbp), %xmm0
addss -0x48(%rbp), %xmm0
movss -0x3c(%rbp), %xmm1
addss -0x44(%rbp), %xmm1
leaq -0x50(%rbp), %rdi
callq 0x2d280
leaq -0x60(%rbp), %rdi
xorl %ecx, %ecx
movl $0xff, %r8d
movl %ecx, %esi
movl %ecx, %edx
callq 0x31710
leaq -0x60(%rbp), %rdi
callq 0x31950
movl %eax, -0x12c(%rbp)
leaq -0x70(%rbp), %rdi
movl $0xff, %r8d
xorl %ecx, %ecx
movl %r8d, %esi
movl %ecx, %edx
callq 0x31710
leaq -0x70(%rbp), %rdi
callq 0x31950
movl %eax, -0x128(%rbp)
leaq -0x80(%rbp), %rdi
movl $0xff, %r8d
xorl %ecx, %ecx
movl %r8d, %esi
movl %r8d, %edx
callq 0x31710
leaq -0x80(%rbp), %rdi
callq 0x31950
movl %eax, -0x124(%rbp)
leaq -0x90(%rbp), %rdi
xorl %ecx, %ecx
movl $0xff, %r8d
movl %ecx, %esi
movl %r8d, %edx
callq 0x31710
leaq -0x90(%rbp), %rdi
callq 0x31950
movq -0x138(%rbp), %rdi
movl -0x12c(%rbp), %ecx
movl -0x128(%rbp), %r8d
movl -0x124(%rbp), %r9d
leaq -0x40(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movl %eax, (%rsp)
callq 0x40710
movq -0x38(%rbp), %rax
movq %rax, -0x120(%rbp)
movss -0x40(%rbp), %xmm0
addss -0x48(%rbp), %xmm0
movss -0x3c(%rbp), %xmm1
addss -0x44(%rbp), %xmm1
leaq -0x98(%rbp), %rdi
callq 0x2d280
leaq -0xa8(%rbp), %rdi
movl $0xff, %r8d
movl %r8d, %esi
movl %r8d, %edx
movl %r8d, %ecx
callq 0x31710
leaq -0xa8(%rbp), %rdi
callq 0x31950
movq -0x120(%rbp), %rdi
movl %eax, %ecx
leaq -0x40(%rbp), %rsi
leaq -0x98(%rbp), %rdx
xorps %xmm0, %xmm0
movl $0xf, %r8d
callq 0x40590
movq -0x38(%rbp), %rax
movq %rax, -0x118(%rbp)
movss 0x23e91(%rip), %xmm0    # 0x5d5d4
addss -0x40(%rbp), %xmm0
movss 0x23e84(%rip), %xmm1    # 0x5d5d4
addss -0x3c(%rbp), %xmm1
leaq -0xb0(%rbp), %rdi
callq 0x2d280
movss 0x219bf(%rip), %xmm0    # 0x5b128
addss -0x40(%rbp), %xmm0
movss 0x23e5e(%rip), %xmm1    # 0x5d5d4
addss -0x3c(%rbp), %xmm1
leaq -0xb8(%rbp), %rdi
callq 0x2d280
movss -0x40(%rbp), %xmm0
addss -0x48(%rbp), %xmm0
movss 0x2198f(%rip), %xmm1    # 0x5b128
subss %xmm1, %xmm0
movss -0x3c(%rbp), %xmm1
addss -0x44(%rbp), %xmm1
movss 0x23e25(%rip), %xmm2    # 0x5d5d4
subss %xmm2, %xmm1
leaq -0xc0(%rbp), %rdi
callq 0x2d280
movss -0x40(%rbp), %xmm0
addss -0x48(%rbp), %xmm0
movss 0x23e03(%rip), %xmm1    # 0x5d5d4
subss %xmm1, %xmm0
movss -0x3c(%rbp), %xmm1
addss -0x44(%rbp), %xmm1
movss 0x23ded(%rip), %xmm2    # 0x5d5d4
subss %xmm2, %xmm1
leaq -0xc8(%rbp), %rdi
callq 0x2d280
leaq -0xd8(%rbp), %rdi
movl $0xff, %r8d
movl $0xc8, %edx
xorl %ecx, %ecx
movl %r8d, %esi
callq 0x31710
leaq -0xd8(%rbp), %rdi
callq 0x31950
movq -0x118(%rbp), %rdi
movl %eax, %r9d
leaq -0xb0(%rbp), %rsi
leaq -0xb8(%rbp), %rdx
leaq -0xc0(%rbp), %rcx
leaq -0xc8(%rbp), %r8
movss 0x21833(%rip), %xmm0    # 0x5b080
xorl %eax, %eax
movl $0x0, (%rsp)
callq 0x40a10
movb $0x0, -0xd9(%rbp)
leaq 0x266ca(%rip), %rdi     # 0x5ff33
leaq -0x48(%rbp), %rsi
callq 0x1add0
callq 0x11cb0
testb $0x1, %al
jne 0x39880
jmp 0x39971
callq 0xca90
movss 0xe8(%rax), %xmm0
subss -0x40(%rbp), %xmm0
movss %xmm0, -0x13c(%rbp)
callq 0xca90
movss -0x13c(%rbp), %xmm0
movss 0xec(%rax), %xmm1
subss -0x3c(%rbp), %xmm1
leaq -0xe4(%rbp), %rdi
callq 0x2d280
testb $0x1, 0x4a091(%rip)     # 0x83958
jne 0x398f1
callq 0xca90
testb $0x1, 0x34c(%rax)
je 0x398f1
leaq 0x4a062(%rip), %rdi     # 0x83940
leaq -0xe4(%rbp), %rsi
callq 0x31200
movb $0x1, 0x4a067(%rip)     # 0x83958
testb $0x1, 0x4a060(%rip)     # 0x83958
je 0x39932
movb $0x1, -0xd9(%rbp)
leaq 0x4a038(%rip), %rdi     # 0x83940
leaq -0xe4(%rbp), %rsi
callq 0x31200
callq 0xca90
testb $0x1, 0xf0(%rax)
jne 0x39930
movb $0x0, -0xd9(%rbp)
movb $0x0, 0x4a028(%rip)     # 0x83958
jmp 0x39932
callq 0xca90
testb $0x1, 0x34d(%rax)
je 0x3996f
leaq 0x49ff9(%rip), %rdi     # 0x83940
callq 0x3ab50
testb $0x1, %al
jne 0x3996f
movb $0x0, 0x4a001(%rip)     # 0x83958
leaq 0x49fe2(%rip), %rdi     # 0x83940
callq 0x3ab00
leaq 0x49fd6(%rip), %rdi     # 0x83940
callq 0x3ab00
jmp 0x39971
movq -0x38(%rbp), %rax
movq %rax, -0x148(%rbp)
movss -0x40(%rbp), %xmm0
movss -0x3c(%rbp), %xmm1
movss -0x40(%rbp), %xmm2
addss -0x48(%rbp), %xmm2
movss -0x3c(%rbp), %xmm3
addss -0x44(%rbp), %xmm3
leaq -0xf4(%rbp), %rdi
callq 0x2d2b0
movq -0x148(%rbp), %rdi
leaq -0xf4(%rbp), %rsi
callq 0x3d140
movl $0x0, -0xf8(%rbp)
movl -0xf8(%rbp), %eax
movl 0x49f71(%rip), %ecx     # 0x83940
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x39b0c
movq -0x38(%rbp), %rax
movq %rax, -0x150(%rbp)
movss -0x40(%rbp), %xmm0
movss %xmm0, -0x168(%rbp)
movl -0xf8(%rbp), %esi
leaq 0x49f41(%rip), %rdi     # 0x83940
callq 0x3ab70
movss -0x168(%rbp), %xmm0
addss (%rax), %xmm0
movss %xmm0, -0x160(%rbp)
movss -0x3c(%rbp), %xmm0
movss %xmm0, -0x164(%rbp)
movl -0xf8(%rbp), %esi
leaq 0x49f0e(%rip), %rdi     # 0x83940
callq 0x3ab70
movss -0x164(%rbp), %xmm1
movss -0x160(%rbp), %xmm0
addss 0x4(%rax), %xmm1
leaq -0x100(%rbp), %rdi
callq 0x2d280
movss -0x40(%rbp), %xmm0
movss %xmm0, -0x15c(%rbp)
movl -0xf8(%rbp), %esi
addl $0x1, %esi
leaq 0x49ecb(%rip), %rdi     # 0x83940
callq 0x3ab70
movss -0x15c(%rbp), %xmm0
addss (%rax), %xmm0
movss %xmm0, -0x154(%rbp)
movss -0x3c(%rbp), %xmm0
movss %xmm0, -0x158(%rbp)
movl -0xf8(%rbp), %esi
addl $0x1, %esi
leaq 0x49e95(%rip), %rdi     # 0x83940
callq 0x3ab70
movss -0x158(%rbp), %xmm1
movss -0x154(%rbp), %xmm0
addss 0x4(%rax), %xmm1
leaq -0x108(%rbp), %rdi
callq 0x2d280
movq -0x150(%rbp), %rdi
leaq -0x100(%rbp), %rsi
leaq -0x108(%rbp), %rdx
movl $0xff00ffff, %ecx       # imm = 0xFF00FFFF
movss 0x215c5(%rip), %xmm0    # 0x5b0b8
callq 0x404c0
movl -0xf8(%rbp), %eax
addl $0x2, %eax
movl %eax, -0xf8(%rbp)
jmp 0x399c3
movq -0x38(%rbp), %rdi
callq 0x3d1b0
testb $0x1, -0xd9(%rbp)
je 0x39b2a
leaq 0x49e1b(%rip), %rdi     # 0x83940
callq 0x3ab00
callq 0xee30
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0x74f0
nopw %cs:(%rax,%rax)