// File: Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGui::RenderWindowDecorations(ImGuiWindow*, ImRect const&, bool, int, unsigned int const*, float)
void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size)
{
    ImGuiContext& g = *GImGui;
    ImGuiStyle& style = g.Style;
    ImGuiWindowFlags flags = window->Flags;

    // Ensure that ScrollBar doesn't read last frame's SkipItems
    IM_ASSERT(window->BeginCount == 0);
    window->SkipItems = false;

    // Draw window + handle manual resize
    // As we highlight the title bar when want_focus is set, multiple reappearing windows will have have their title bar highlighted on their reappearing frame.
    const float window_rounding = window->WindowRounding;
    const float window_border_size = window->WindowBorderSize;
    if (window->Collapsed)
    {
        // Title bar only
        float backup_border_size = style.FrameBorderSize;
        g.Style.FrameBorderSize = window->WindowBorderSize;
        ImU32 title_bar_col = GetColorU32((title_bar_is_highlight && !g.NavDisableHighlight) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBgCollapsed);
        RenderFrame(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, true, window_rounding);
        g.Style.FrameBorderSize = backup_border_size;
    }
    else
    {
        // Window background
        if (!(flags & ImGuiWindowFlags_NoBackground))
        {
            ImU32 bg_col = GetColorU32(GetWindowBgColorIdxFromFlags(flags));
            bool override_alpha = false;
            float alpha = 1.0f;
            if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasBgAlpha)
            {
                alpha = g.NextWindowData.BgAlphaVal;
                override_alpha = true;
            }
            if (override_alpha)
                bg_col = (bg_col & ~IM_COL32_A_MASK) | (IM_F32_TO_INT8_SAT(alpha) << IM_COL32_A_SHIFT);
            window->DrawList->AddRectFilled(window->Pos + ImVec2(0, window->TitleBarHeight()), window->Pos + window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Bot);
        }

        // Title bar
        if (!(flags & ImGuiWindowFlags_NoTitleBar))
        {
            ImU32 title_bar_col = GetColorU32(title_bar_is_highlight ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg);
            window->DrawList->AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, window_rounding, ImDrawCornerFlags_Top);
        }

        // Menu bar
        if (flags & ImGuiWindowFlags_MenuBar)
        {
            ImRect menu_bar_rect = window->MenuBarRect();
            menu_bar_rect.ClipWith(window->Rect());  // Soft clipping, in particular child window don't have minimum size covering the menu bar so this is useful for them.
            window->DrawList->AddRectFilled(menu_bar_rect.Min + ImVec2(window_border_size, 0), menu_bar_rect.Max - ImVec2(window_border_size, 0), GetColorU32(ImGuiCol_MenuBarBg), (flags & ImGuiWindowFlags_NoTitleBar) ? window_rounding : 0.0f, ImDrawCornerFlags_Top);
            if (style.FrameBorderSize > 0.0f && menu_bar_rect.Max.y < window->Pos.y + window->Size.y)
                window->DrawList->AddLine(menu_bar_rect.GetBL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_Border), style.FrameBorderSize);
        }

        // Scrollbars
        if (window->ScrollbarX)
            Scrollbar(ImGuiAxis_X);
        if (window->ScrollbarY)
            Scrollbar(ImGuiAxis_Y);

        // Render resize grips (after their input handling so we don't have a frame of latency)
        if (!(flags & ImGuiWindowFlags_NoResize))
        {
            for (int resize_grip_n = 0; resize_grip_n < resize_grip_count; resize_grip_n++)
            {
                const ImGuiResizeGripDef& grip = resize_grip_def[resize_grip_n];
                const ImVec2 corner = ImLerp(window->Pos, window->Pos + window->Size, grip.CornerPosN);
                window->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(window_border_size, resize_grip_draw_size) : ImVec2(resize_grip_draw_size, window_border_size)));
                window->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(resize_grip_draw_size, window_border_size) : ImVec2(window_border_size, resize_grip_draw_size)));
                window->DrawList->PathArcToFast(ImVec2(corner.x + grip.InnerDir.x * (window_rounding + window_border_size), corner.y + grip.InnerDir.y * (window_rounding + window_border_size)), window_rounding, grip.AngleMin12, grip.AngleMax12);
                window->DrawList->PathFillConvex(resize_grip_col[resize_grip_n]);
            }
        }

        // Borders
        RenderWindowOuterBorders(window);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
movl %ecx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movss %xmm0, -0x24(%rbp)
movq 0x13a4f3(%rip), %rax    # 0x212f40
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
addq $0x1560, %rax           # imm = 0x1560
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rax
movswl 0x9a(%rax), %eax
cmpl $0x0, %eax
jne 0xd8a7b
jmp 0xd8a9a
leaq 0x9e06e(%rip), %rdi     # 0x176af0
leaq 0x9a480(%rip), %rsi     # 0x172f09
movl $0x14f2, %edx           # imm = 0x14F2
leaq 0x9e073(%rip), %rcx     # 0x176b08
callq 0xd180
movq -0x8(%rbp), %rax
movb $0x0, 0x93(%rax)
movq -0x8(%rbp), %rax
movss 0x48(%rax), %xmm0
movss %xmm0, -0x40(%rbp)
movq -0x8(%rbp), %rax
movss 0x4c(%rax), %xmm0
movss %xmm0, -0x44(%rbp)
movq -0x8(%rbp), %rax
testb $0x1, 0x91(%rax)
je 0xd8b81
movq -0x38(%rbp), %rax
movss 0x44(%rax), %xmm0
movss %xmm0, -0x48(%rbp)
movq -0x8(%rbp), %rax
movss 0x4c(%rax), %xmm0
movq -0x30(%rbp), %rax
movss %xmm0, 0x15a4(%rax)
xorl %eax, %eax
testb $0x1, -0x11(%rbp)
movb %al, -0x131(%rbp)
je 0xd8b15
movq -0x30(%rbp), %rax
movb 0x1ce6(%rax), %al
xorb $-0x1, %al
movb %al, -0x131(%rbp)
movb -0x131(%rbp), %al
movzbl %al, %eax
andl $0x1, %eax
movl $0xc, %edi
subl %eax, %edi
movss 0x9810c(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
movl -0x4c(%rbp), %edi
movss -0x40(%rbp), %xmm2
movsd -0x58(%rbp), %xmm0
movsd -0x60(%rbp), %xmm1
movl $0x1, %esi
callq 0xc8f20
movss -0x48(%rbp), %xmm0
movq -0x30(%rbp), %rax
movss %xmm0, 0x15a4(%rax)
jmp 0xd921b
movl -0x3c(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0xd8cd2
movl -0x3c(%rbp), %edi
callq 0xe59d0
movl %eax, %edi
movss 0x98098(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movl %eax, -0x64(%rbp)
movb $0x0, -0x65(%rbp)
movss 0x98084(%rip), %xmm0    # 0x170c3c
movss %xmm0, -0x6c(%rbp)
movq -0x30(%rbp), %rax
movl 0x1b88(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0xd8be4
movq -0x30(%rbp), %rax
movss 0x1be8(%rax), %xmm0
movss %xmm0, -0x6c(%rbp)
movb $0x1, -0x65(%rbp)
testb $0x1, -0x65(%rbp)
je 0xd8c2c
movl -0x64(%rbp), %eax
andl $0xffffff, %eax         # imm = 0xFFFFFF
movl %eax, -0x138(%rbp)
movss -0x6c(%rbp), %xmm0
callq 0xc5aa0
movl -0x138(%rbp), %eax
movss 0x99b4c(%rip), %xmm1    # 0x17275c
mulss %xmm1, %xmm0
movss 0x993bc(%rip), %xmm1    # 0x171fd8
addss %xmm1, %xmm0
cvttss2si %xmm0, %ecx
shll $0x18, %ecx
orl %ecx, %eax
movl %eax, -0x64(%rbp)
movq -0x8(%rbp), %rdi
movq 0x2b8(%rdi), %rax
movq %rax, -0x140(%rbp)
movq %rdi, %rax
addq $0x10, %rax
movq %rax, -0x150(%rbp)
callq 0xeb6f0
movaps %xmm0, %xmm1
leaq -0x7c(%rbp), %rdi
movq %rdi, -0x148(%rbp)
xorps %xmm0, %xmm0
callq 0xbf4c0
movq -0x150(%rbp), %rdi
movq -0x148(%rbp), %rsi
callq 0xc41b0
movlpd %xmm0, -0x74(%rbp)
movq -0x8(%rbp), %rsi
movq %rsi, %rdi
addq $0x10, %rdi
addq $0x18, %rsi
callq 0xc41b0
movq -0x140(%rbp), %rdi
movlpd %xmm0, -0x84(%rbp)
movl -0x64(%rbp), %ecx
movss -0x40(%rbp), %xmm0
movl -0x3c(%rbp), %edx
andl $0x1, %edx
movl $0xc, %r8d
movl $0xf, %eax
cmpl $0x0, %edx
cmovnel %eax, %r8d
leaq -0x74(%rbp), %rsi
leaq -0x84(%rbp), %rdx
callq 0x113090
movl -0x3c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xd8d30
movb -0x11(%rbp), %cl
movl $0xa, %edi
movl $0xb, %eax
testb $0x1, %cl
cmovnel %eax, %edi
movss 0x97f44(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movl %eax, -0x88(%rbp)
movq -0x8(%rbp), %rax
movq 0x2b8(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rdx
addq $0x8, %rdx
movl -0x88(%rbp), %ecx
movss -0x40(%rbp), %xmm0
movl $0x3, %r8d
callq 0x113090
movl -0x3c(%rbp), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0xd8f41
movq -0x8(%rbp), %rdi
callq 0xee470
movlpd %xmm0, -0x98(%rbp)
leaq -0x90(%rbp), %rax
movq %rax, -0x168(%rbp)
movlpd %xmm1, -0x90(%rbp)
movq -0x8(%rbp), %rdi
callq 0xeb880
movlpd %xmm0, -0xa8(%rbp)
movlpd %xmm1, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
movq %rdi, -0x180(%rbp)
leaq -0xa8(%rbp), %rsi
callq 0xe8970
movq -0x8(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0x188(%rbp)
movss -0x44(%rbp), %xmm0
leaq -0xb8(%rbp), %rdi
movq %rdi, -0x178(%rbp)
xorps %xmm1, %xmm1
movss %xmm1, -0x16c(%rbp)
callq 0xbf4c0
movq -0x180(%rbp), %rdi
movq -0x178(%rbp), %rsi
callq 0xc41b0
movss -0x16c(%rbp), %xmm1
movlpd %xmm0, -0xb0(%rbp)
movss -0x44(%rbp), %xmm0
leaq -0xc8(%rbp), %rdi
movq %rdi, -0x160(%rbp)
callq 0xbf4c0
movq -0x168(%rbp), %rdi
movq -0x160(%rbp), %rsi
callq 0xc3c00
movlpd %xmm0, -0xc0(%rbp)
movl $0xd, %edi
movss 0x97e09(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movl %eax, -0x154(%rbp)
movl -0x3c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xd8e58
movss -0x40(%rbp), %xmm0
movss %xmm0, -0x18c(%rbp)
jmp 0xd8e65
xorps %xmm0, %xmm0
movss %xmm0, -0x18c(%rbp)
jmp 0xd8e65
movl -0x154(%rbp), %ecx
movq -0x188(%rbp), %rdi
movss -0x18c(%rbp), %xmm0
leaq -0xb0(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
movl $0x3, %r8d
callq 0x113090
movq -0x38(%rbp), %rax
movss 0x44(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0xd8f3f
movss -0x8c(%rbp), %xmm1
movq -0x8(%rbp), %rax
movss 0x14(%rax), %xmm0
movq -0x8(%rbp), %rax
addss 0x1c(%rax), %xmm0
ucomiss %xmm1, %xmm0
jbe 0xd8f3f
movq -0x8(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0x198(%rbp)
leaq -0x98(%rbp), %rdi
movq %rdi, -0x1a0(%rbp)
callq 0xee510
movq -0x1a0(%rbp), %rdi
movlpd %xmm0, -0xd0(%rbp)
callq 0xee540
movlpd %xmm0, -0xd8(%rbp)
movl $0x5, %edi
movss 0x97d27(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movq -0x198(%rbp), %rdi
movl %eax, %ecx
movq -0x38(%rbp), %rax
movss 0x44(%rax), %xmm0
leaq -0xd0(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
callq 0x112e20
jmp 0xd8f41
movq -0x8(%rbp), %rax
testb $0x1, 0x8c(%rax)
je 0xd8f55
xorl %edi, %edi
callq 0x13b650
movq -0x8(%rbp), %rax
testb $0x1, 0x8d(%rax)
je 0xd8f6c
movl $0x1, %edi
callq 0x13b650
movl -0x3c(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0xd9212
movl $0x0, -0xdc(%rbp)
movl -0xdc(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0xd9210
movslq -0xdc(%rbp), %rax
leaq (%rax,%rax,2), %rcx
leaq 0x139fba(%rip), %rax    # 0x212f60
leaq (%rax,%rcx,8), %rax
movq %rax, -0xe8(%rbp)
movq -0x8(%rbp), %rsi
movq %rsi, %rdi
addq $0x10, %rdi
movq %rdi, -0x1b8(%rbp)
addq $0x18, %rsi
callq 0xc41b0
movq -0x1b8(%rbp), %rdi
movlpd %xmm0, -0xf8(%rbp)
movq -0xe8(%rbp), %rdx
leaq -0xf8(%rbp), %rsi
callq 0xe5680
movlpd %xmm0, -0xf0(%rbp)
movq -0x8(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0x1b0(%rbp)
movq -0xe8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x1a8(%rbp)
movl -0xdc(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xd9040
movss -0x44(%rbp), %xmm0
movss -0x24(%rbp), %xmm1
leaq -0x110(%rbp), %rdi
callq 0xbf4c0
jmp 0xd9056
movss -0x24(%rbp), %xmm0
movss -0x44(%rbp), %xmm1
leaq -0x110(%rbp), %rdi
callq 0xbf4c0
movq -0x1a8(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0xd7510
movlpd %xmm0, -0x108(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0xc41b0
movq -0x1b0(%rbp), %rdi
movlpd %xmm0, -0x100(%rbp)
leaq -0x100(%rbp), %rsi
callq 0xee560
movq -0x8(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0x1c8(%rbp)
movq -0xe8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x1c0(%rbp)
movl -0xdc(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xd90e9
movss -0x24(%rbp), %xmm0
movss -0x44(%rbp), %xmm1
leaq -0x128(%rbp), %rdi
callq 0xbf4c0
jmp 0xd90ff
movss -0x44(%rbp), %xmm0
movss -0x24(%rbp), %xmm1
leaq -0x128(%rbp), %rdi
callq 0xbf4c0
movq -0x1c0(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0xd7510
movlpd %xmm0, -0x120(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0xc41b0
movq -0x1c8(%rbp), %rdi
movlpd %xmm0, -0x118(%rbp)
leaq -0x118(%rbp), %rsi
callq 0xee560
movq -0x8(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0x1d0(%rbp)
movss -0xf0(%rbp), %xmm1
movq -0xe8(%rbp), %rax
movss 0x8(%rax), %xmm0
movss -0x40(%rbp), %xmm2
addss -0x44(%rbp), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss -0xec(%rbp), %xmm2
movq -0xe8(%rbp), %rax
movss 0xc(%rax), %xmm1
movss -0x40(%rbp), %xmm3
addss -0x44(%rbp), %xmm3
mulss %xmm3, %xmm1
addss %xmm2, %xmm1
leaq -0x130(%rbp), %rdi
callq 0xbf4c0
movq -0x1d0(%rbp), %rdi
movss -0x40(%rbp), %xmm0
movq -0xe8(%rbp), %rax
movl 0x10(%rax), %edx
movq -0xe8(%rbp), %rax
movl 0x14(%rax), %ecx
leaq -0x130(%rbp), %rsi
callq 0x111da0
movq -0x8(%rbp), %rax
movq 0x2b8(%rax), %rdi
movq -0x20(%rbp), %rax
movslq -0xdc(%rbp), %rcx
movl (%rax,%rcx,4), %esi
callq 0xee590
movl -0xdc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xdc(%rbp)
jmp 0xd8f85
jmp 0xd9212
movq -0x8(%rbp), %rdi
callq 0xe5a10
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
nopw %cs:(%rax,%rax)