// File: Ciaxur[P]yagb-emu/include/imgui/imgui_tables.cpp
// Function: TableFixFlags(int, ImGuiWindow*)
inline ImGuiTableFlags TableFixFlags(ImGuiTableFlags flags, ImGuiWindow* outer_window)
{
    // Adjust flags: set default sizing policy
    if ((flags & ImGuiTableFlags_SizingMask_) == 0)
        flags |= ((flags & ImGuiTableFlags_ScrollX) || (outer_window->Flags & ImGuiWindowFlags_AlwaysAutoResize)) ? ImGuiTableFlags_SizingFixedFit : ImGuiTableFlags_SizingStretchSame;

    // Adjust flags: enable NoKeepColumnsVisible when using ImGuiTableFlags_SizingFixedSame
    if ((flags & ImGuiTableFlags_SizingMask_) == ImGuiTableFlags_SizingFixedSame)
        flags |= ImGuiTableFlags_NoKeepColumnsVisible;

    // Adjust flags: enforce borders when resizable
    if (flags & ImGuiTableFlags_Resizable)
        flags |= ImGuiTableFlags_BordersInnerV;

    // Adjust flags: disable NoHostExtendX/NoHostExtendY if we have any scrolling going on
    if (flags & (ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY))
        flags &= ~(ImGuiTableFlags_NoHostExtendX | ImGuiTableFlags_NoHostExtendY);

    // Adjust flags: NoBordersInBodyUntilResize takes priority over NoBordersInBody
    if (flags & ImGuiTableFlags_NoBordersInBodyUntilResize)
        flags &= ~ImGuiTableFlags_NoBordersInBody;

    // Adjust flags: disable saved settings if there's nothing to save
    if ((flags & (ImGuiTableFlags_Resizable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Sortable)) == 0)
        flags |= ImGuiTableFlags_NoSavedSettings;

    // Inherit _NoSavedSettings from top-level window (child windows always have _NoSavedSettings set)
#ifdef IMGUI_HAS_DOCK
    ImGuiWindow* window_for_settings = outer_window->RootWindowDockStop;
#else
    ImGuiWindow* window_for_settings = outer_window->RootWindow;
#endif
    if (window_for_settings->Flags & ImGuiWindowFlags_NoSavedSettings)
        flags |= ImGuiTableFlags_NoSavedSettings;

    return flags;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x4(%rbp), %eax
andl $0xe000, %eax           # imm = 0xE000
cmpl $0x0, %eax
jne 0x136e07
movl -0x4(%rbp), %ecx
andl $0x1000000, %ecx        # imm = 0x1000000
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x19(%rbp)
jne 0x136dee
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x19(%rbp)
movb -0x19(%rbp), %dl
movl $0x8000, %eax           # imm = 0x8000
movl $0x2000, %ecx           # imm = 0x2000
testb $0x1, %dl
cmovnel %ecx, %eax
orl -0x4(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
andl $0xe000, %eax           # imm = 0xE000
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x136e21
movl -0x4(%rbp), %eax
orl $0x40000, %eax          # imm = 0x40000
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x136e37
movl -0x4(%rbp), %eax
orl $0x200, %eax            # imm = 0x200
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
andl $0x3000000, %eax        # imm = 0x3000000
cmpl $0x0, %eax
je 0x136e4f
movl -0x4(%rbp), %eax
andl $0xfffcffff, %eax       # imm = 0xFFFCFFFF
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x136e67
movl -0x4(%rbp), %eax
andl $0xfffff7ff, %eax       # imm = 0xFFFFF7FF
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
andl $0xf, %eax
cmpl $0x0, %eax
jne 0x136e7b
movl -0x4(%rbp), %eax
orl $0x10, %eax
movl %eax, -0x4(%rbp)
movq -0x10(%rbp), %rax
movq 0x390(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x136ea4
movl -0x4(%rbp), %eax
orl $0x10, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax)