// File: Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGui::BeginChildEx(char const*, unsigned int, ImVec2 const&, bool, int)
bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags flags)
{
    ImGuiContext& g = *GImGui;
    ImGuiWindow* parent_window = g.CurrentWindow;

    flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_ChildWindow;
    flags |= (parent_window->Flags & ImGuiWindowFlags_NoMove);  // Inherit the NoMove flag

    // Size
    const ImVec2 content_avail = GetContentRegionAvail();
    ImVec2 size = ImFloor(size_arg);
    const int auto_fit_axises = ((size.x == 0.0f) ? (1 << ImGuiAxis_X) : 0x00) | ((size.y == 0.0f) ? (1 << ImGuiAxis_Y) : 0x00);
    if (size.x <= 0.0f)
        size.x = ImMax(content_avail.x + size.x, 4.0f); // Arbitrary minimum child size (0.0f causing too much issues)
    if (size.y <= 0.0f)
        size.y = ImMax(content_avail.y + size.y, 4.0f);
    SetNextWindowSize(size);

    // Build up name. If you need to append to a same child from multiple location in the ID stack, use BeginChild(ImGuiID id) with a stable value.
    if (name)
        ImFormatString(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), "%s/%s_%08X", parent_window->Name, name, id);
    else
        ImFormatString(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), "%s/%08X", parent_window->Name, id);

    const float backup_border_size = g.Style.ChildBorderSize;
    if (!border)
        g.Style.ChildBorderSize = 0.0f;
    bool ret = Begin(g.TempBuffer, NULL, flags);
    g.Style.ChildBorderSize = backup_border_size;

    ImGuiWindow* child_window = g.CurrentWindow;
    child_window->ChildId = id;
    child_window->AutoFitChildAxises = (ImS8)auto_fit_axises;

    // Set the cursor to handle case where the user called SetNextWindowPos()+BeginChild() manually.
    // While this is not really documented/defined, it seems that the expected thing to do.
    if (child_window->BeginCount == 1)
        parent_window->DC.CursorPos = child_window->Pos;

    // Process navigation-in immediately so NavInit can run on first frame
    if (g.NavActivateId == id && !(flags & ImGuiWindowFlags_NavFlattened) && (child_window->DC.NavLayerActiveMask != 0 || child_window->DC.NavHasScroll))
    {
        FocusWindow(child_window);
        NavInitWindow(child_window, false);
        SetActiveID(id + 1, child_window); // Steal ActiveId with another arbitrary id so that key-press won't activate child item
        g.ActiveIdSource = ImGuiInputSource_Nav;
    }
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movb %cl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
movl %r8d, -0x20(%rbp)
movq 0x13d65b(%rip), %rax    # 0x212f40
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x1ae0(%rax), %rax
movq %rax, -0x30(%rbp)
movl -0x20(%rbp), %eax
orl $0x1000103, %eax        # imm = 0x1000103
movl %eax, -0x20(%rbp)
movq -0x30(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x4, %ecx
movl -0x20(%rbp), %eax
orl %ecx, %eax
movl %eax, -0x20(%rbp)
callq 0xd5b40
movlpd %xmm0, -0x38(%rbp)
movq -0x18(%rbp), %rdi
callq 0xc2f10
movlpd %xmm0, -0x40(%rbp)
movss -0x40(%rbp), %xmm0
xorps %xmm1, %xmm1
xorl %eax, %eax
movl $0x1, %ecx
ucomiss %xmm1, %xmm0
setnp %sil
sete %dl
testb %sil, %dl
cmovnel %ecx, %eax
movss -0x3c(%rbp), %xmm0
xorps %xmm1, %xmm1
xorl %ecx, %ecx
movl $0x2, %edx
ucomiss %xmm1, %xmm0
setnp %dil
sete %sil
testb %dil, %sil
cmovnel %edx, %ecx
orl %ecx, %eax
movl %eax, -0x44(%rbp)
xorps %xmm0, %xmm0
ucomiss -0x40(%rbp), %xmm0
jb 0xd5996
movss -0x38(%rbp), %xmm0
addss -0x40(%rbp), %xmm0
movss 0x9cda8(%rip), %xmm1    # 0x172734
callq 0xc88c0
movss %xmm0, -0x40(%rbp)
xorps %xmm0, %xmm0
ucomiss -0x3c(%rbp), %xmm0
jb 0xd59bb
movss -0x34(%rbp), %xmm0
addss -0x3c(%rbp), %xmm0
movss 0x9cd83(%rip), %xmm1    # 0x172734
callq 0xc88c0
movss %xmm0, -0x3c(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
callq 0xd00c0
cmpq $0x0, -0x8(%rbp)
je 0xd59fc
movq -0x28(%rbp), %rdi
addq $0x3378, %rdi           # imm = 0x3378
movq -0x30(%rbp), %rax
movq (%rax), %rcx
movq -0x8(%rbp), %r8
movl -0xc(%rbp), %r9d
movl $0xc01, %esi            # imm = 0xC01
leaq 0x9e41f(%rip), %rdx     # 0x173e12
movb $0x0, %al
callq 0xc4d30
jmp 0xd5a25
movq -0x28(%rbp), %rdi
addq $0x3378, %rdi           # imm = 0x3378
movq -0x30(%rbp), %rax
movq (%rax), %rcx
movl -0xc(%rbp), %r8d
movl $0xc01, %esi            # imm = 0xC01
leaq 0x9e3ff(%rip), %rdx     # 0x173e1d
movb $0x0, %al
callq 0xc4d30
movq -0x28(%rbp), %rax
movss 0x158c(%rax), %xmm0
movss %xmm0, -0x48(%rbp)
testb $0x1, -0x19(%rbp)
jne 0xd5a4b
movq -0x28(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x158c(%rax)
movq -0x28(%rbp), %rdi
addq $0x3378, %rdi           # imm = 0x3378
movl -0x20(%rbp), %edx
xorl %eax, %eax
movl %eax, %esi
callq 0xd0170
andb $0x1, %al
movb %al, -0x49(%rbp)
movss -0x48(%rbp), %xmm0
movq -0x28(%rbp), %rax
movss %xmm0, 0x158c(%rax)
movq -0x28(%rbp), %rax
movq 0x1ae0(%rax), %rax
movq %rax, -0x58(%rbp)
movl -0xc(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, 0x58(%rax)
movl -0x44(%rbp), %eax
movb %al, %cl
movq -0x58(%rbp), %rax
movb %cl, 0xa6(%rax)
movq -0x58(%rbp), %rax
movswl 0x9a(%rax), %eax
cmpl $0x1, %eax
jne 0xd5ac3
movq -0x58(%rbp), %rcx
movq -0x30(%rbp), %rax
movq 0x10(%rcx), %rcx
movq %rcx, 0xd8(%rax)
movq -0x28(%rbp), %rax
movl 0x1ca0(%rax), %eax
cmpl -0xc(%rbp), %eax
jne 0xd5b2a
movl -0x20(%rbp), %eax
andl $0x800000, %eax         # imm = 0x800000
cmpl $0x0, %eax
jne 0xd5b2a
movq -0x58(%rbp), %rax
cmpl $0x0, 0x150(%rax)
jne 0xd5af9
movq -0x58(%rbp), %rax
testb $0x1, 0x15d(%rax)
je 0xd5b2a
movq -0x58(%rbp), %rdi
callq 0xcb380
movq -0x58(%rbp), %rdi
xorl %esi, %esi
callq 0xd5b90
movl -0xc(%rbp), %edi
addl $0x1, %edi
movq -0x58(%rbp), %rsi
callq 0xc9ec0
movq -0x28(%rbp), %rax
movl $0x2, 0x1b68(%rax)
movb -0x49(%rbp), %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)