// File: Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGui::ItemSize(ImVec2 const&, float)
void ImGui::ItemSize(const ImVec2& size, float text_baseline_y)
{
    ImGuiContext& g = *GImGui;
    ImGuiWindow* window = g.CurrentWindow;
    if (window->SkipItems)
        return;

    // We increase the height in this function to accommodate for baseline offset.
    // In theory we should be offsetting the starting position (window->DC.CursorPos), that will be the topic of a larger refactor,
    // but since ItemSize() is not yet an API that moves the cursor (to handle e.g. wrapping) enlarging the height has the same effect.
    const float offset_to_match_baseline_y = (text_baseline_y >= 0) ? ImMax(0.0f, window->DC.CurrLineTextBaseOffset - text_baseline_y) : 0.0f;
    const float line_height = ImMax(window->DC.CurrLineSize.y, size.y + offset_to_match_baseline_y);

    // Always align ourselves on pixel boundaries
    //if (g.IO.KeyAlt) window->DrawList->AddRect(window->DC.CursorPos, window->DC.CursorPos + ImVec2(size.x, line_height), IM_COL32(255,0,0,200)); // [DEBUG]
    window->DC.CursorPosPrevLine.x = window->DC.CursorPos.x + size.x;
    window->DC.CursorPosPrevLine.y = window->DC.CursorPos.y;
    window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);    // Next line
    window->DC.CursorPos.y = IM_FLOOR(window->DC.CursorPos.y + line_height + g.Style.ItemSpacing.y);        // Next line
    window->DC.CursorMaxPos.x = ImMax(window->DC.CursorMaxPos.x, window->DC.CursorPosPrevLine.x);
    window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y - g.Style.ItemSpacing.y);
    //if (g.IO.KeyAlt) window->DrawList->AddCircle(window->DC.CursorMaxPos, 3.0f, IM_COL32(255,0,0,255), 4); // [DEBUG]

    window->DC.PrevLineSize.y = line_height;
    window->DC.CurrLineSize.y = 0.0f;
    window->DC.PrevLineTextBaseOffset = ImMax(window->DC.CurrLineTextBaseOffset, text_baseline_y);
    window->DC.CurrLineTextBaseOffset = 0.0f;

    // Horizontal layout mode
    if (window->DC.LayoutType == ImGuiLayoutType_Horizontal)
        SameLine();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movss %xmm0, -0xc(%rbp)
movq 0x13cef8(%rip), %rax    # 0x212f40
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x1ae0(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
testb $0x1, 0x93(%rax)
je 0xd606d
jmp 0xd623c
movss -0xc(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0xd609a
movq -0x20(%rbp), %rax
movss 0x110(%rax), %xmm1
subss -0xc(%rbp), %xmm1
xorps %xmm0, %xmm0
callq 0xc88c0
movss %xmm0, -0x2c(%rbp)
jmp 0xd60a4
xorps %xmm0, %xmm0
movss %xmm0, -0x2c(%rbp)
jmp 0xd60a4
movss -0x2c(%rbp), %xmm0
movss %xmm0, -0x24(%rbp)
movq -0x20(%rbp), %rax
movss 0x104(%rax), %xmm0
movq -0x8(%rbp), %rax
movss 0x4(%rax), %xmm1
addss -0x24(%rbp), %xmm1
callq 0xc88c0
movss %xmm0, -0x28(%rbp)
movq -0x20(%rbp), %rax
movss 0xd8(%rax), %xmm0
movq -0x8(%rbp), %rax
addss (%rax), %xmm0
movq -0x20(%rbp), %rax
movss %xmm0, 0xe0(%rax)
movq -0x20(%rbp), %rax
movss 0xdc(%rax), %xmm0
movq -0x20(%rbp), %rax
movss %xmm0, 0xe4(%rax)
movq -0x20(%rbp), %rax
movss 0x10(%rax), %xmm0
movq -0x20(%rbp), %rax
addss 0x118(%rax), %xmm0
movq -0x20(%rbp), %rax
addss 0x11c(%rax), %xmm0
cvttss2si %xmm0, %eax
cvtsi2ss %eax, %xmm0
movq -0x20(%rbp), %rax
movss %xmm0, 0xd8(%rax)
movq -0x20(%rbp), %rax
movss 0xdc(%rax), %xmm0
addss -0x28(%rbp), %xmm0
movq -0x18(%rbp), %rax
addss 0x15ac(%rax), %xmm0
cvttss2si %xmm0, %eax
cvtsi2ss %eax, %xmm0
movq -0x20(%rbp), %rax
movss %xmm0, 0xdc(%rax)
movq -0x20(%rbp), %rax
movss 0xf0(%rax), %xmm0
movq -0x20(%rbp), %rax
movss 0xe0(%rax), %xmm1
callq 0xc88c0
movq -0x20(%rbp), %rax
movss %xmm0, 0xf0(%rax)
movq -0x20(%rbp), %rax
movss 0xf4(%rax), %xmm0
movq -0x20(%rbp), %rax
movss 0xdc(%rax), %xmm1
movq -0x18(%rbp), %rax
subss 0x15ac(%rax), %xmm1
callq 0xc88c0
movq -0x20(%rbp), %rax
movss %xmm0, 0xf4(%rax)
movss -0x28(%rbp), %xmm0
movq -0x20(%rbp), %rax
movss %xmm0, 0x10c(%rax)
movq -0x20(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x104(%rax)
movq -0x20(%rbp), %rax
movss 0x110(%rax), %xmm0
movss -0xc(%rbp), %xmm1
callq 0xc88c0
movq -0x20(%rbp), %rax
movss %xmm0, 0x114(%rax)
movq -0x20(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x110(%rax)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x1bc(%rax)
jne 0xd623c
xorps %xmm0, %xmm0
movss 0x9bd49(%rip), %xmm1    # 0x171f80
callq 0xdc1c0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)