// File: donfreiday[P]gb/./imgui/imgui.cpp
// Function: ImGui::EndGroup()
void ImGui::EndGroup()
{
    ImGuiWindow* window = GetCurrentWindow();
    ImGuiStyle& style = ImGui::GetStyle();

    IM_ASSERT(!window->DC.GroupStack.empty());

    ImGuiGroupData& group_data = window->DC.GroupStack.back();

    ImRect group_bb(group_data.BackupCursorPos, window->DC.CursorMaxPos);
    group_bb.Max.y -= style.ItemSpacing.y;      // Cancel out last vertical spacing because we are adding one ourselves.
    group_bb.Max = ImMax(group_bb.Min, group_bb.Max);

    window->DC.CursorPos = group_data.BackupCursorPos;
    window->DC.CursorMaxPos = ImMax(group_data.BackupCursorMaxPos, window->DC.CursorMaxPos);
    window->DC.CurrentLineHeight = group_data.BackupCurrentLineHeight;
    window->DC.CurrentLineTextBaseOffset = group_data.BackupCurrentLineTextBaseOffset;
    window->DC.ColumnsStartX = group_data.BackupColumnsStartX;
    window->DC.LogLinePosY = window->DC.CursorPos.y - 9999.0f;

    if (group_data.AdvanceCursor)
    {
        window->DC.CurrentLineTextBaseOffset = ImMax(window->DC.PrevLineTextBaseOffset, group_data.BackupCurrentLineTextBaseOffset);      // FIXME: Incorrect, we should grab the base offset from the *first line* of the group but it is hard to obtain now.
        ItemSize(group_bb.GetSize(), group_data.BackupCurrentLineTextBaseOffset);
        ItemAdd(group_bb, NULL);
    }

    window->DC.GroupStack.pop_back();

    //window->DrawList->AddRect(group_bb.Min, group_bb.Max, 0xFFFF00FF);   // Debug
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
callq 0x2e220
movq %rax, -0x8(%rbp)
callq 0xcab0
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
addq $0xa8, %rdi
addq $0xc0, %rdi
callq 0x30220
xorb $-0x1, %al
testb $0x1, %al
jne 0x214c9
jmp 0x214cb
jmp 0x214ea
leaq 0x3af31(%rip), %rdi     # 0x5c403
leaq 0x39dec(%rip), %rsi     # 0x5b2c5
movl $0x215a, %edx           # imm = 0x215A
leaq 0x3af3d(%rip), %rcx     # 0x5c422
callq 0x7160
movq -0x8(%rbp), %rdi
addq $0x168, %rdi            # imm = 0x168
callq 0x30190
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rsi
movq -0x8(%rbp), %rdx
addq $0xc0, %rdx
leaq -0x28(%rbp), %rdi
movq %rdi, -0x48(%rbp)
callq 0x2eb40
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rax
movss 0x30(%rax), %xmm1
leaq -0x20(%rbp), %rsi
movss -0x1c(%rbp), %xmm0
subss %xmm1, %xmm0
movss %xmm0, -0x1c(%rbp)
callq 0x16b80
movlpd %xmm0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq (%rcx), %rcx
movq %rcx, 0xa8(%rax)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
movq -0x8(%rbp), %rsi
addq $0xc0, %rsi
callq 0x16b80
movlpd %xmm0, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, 0xc0(%rax)
movq -0x18(%rbp), %rax
movss 0x14(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0xc8(%rax)
movq -0x18(%rbp), %rax
movss 0x18(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0xcc(%rax)
movq -0x18(%rbp), %rax
movss 0x10(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x194(%rax)
movq -0x8(%rbp), %rax
movss 0xac(%rax), %xmm0
movss 0x39b0c(%rip), %xmm1    # 0x5b0e8
subss %xmm1, %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0xd8(%rax)
movq -0x18(%rbp), %rax
testb $0x1, 0x20(%rax)
je 0x21649
movq -0x8(%rbp), %rax
movss 0xd4(%rax), %xmm0
movq -0x18(%rbp), %rax
movss 0x18(%rax), %xmm1
callq 0xb7c0
movq -0x8(%rbp), %rax
movss %xmm0, 0xcc(%rax)
leaq -0x28(%rbp), %rdi
callq 0x2e250
movlpd %xmm0, -0x40(%rbp)
movq -0x18(%rbp), %rax
movss 0x18(%rax), %xmm0
leaq -0x40(%rbp), %rdi
callq 0xbeb0
leaq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xc0a0
movq -0x8(%rbp), %rdi
addq $0xa8, %rdi
addq $0xc0, %rdi
callq 0x30240
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)