LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::BeginMainMenuBar()
bool ImGui::BeginMainMenuBar()
{
    ImGuiContext& g = *GImGui;
    g.NextWindowData.MenuBarOffsetMinVal = ImVec2(g.Style.DisplaySafeAreaPadding.x, ImMax(g.Style.DisplaySafeAreaPadding.y - g.Style.FramePadding.y, 0.0f));
    SetNextWindowPos(ImVec2(0.0f, 0.0f));
    SetNextWindowSize(ImVec2(g.IO.DisplaySize.x, g.NextWindowData.MenuBarOffsetMinVal.y + g.FontBaseSize + g.Style.FramePadding.y));
    PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
    PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0, 0));
    ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_MenuBar;
    bool is_open = Begin("##MainMenuBar", NULL, window_flags) && BeginMenuBar();
    PopStyleVar(2);
    g.NextWindowData.MenuBarOffsetMinVal = ImVec2(0.0f, 0.0f);
    if (!is_open)
    {
        End();
        return false;
    }
    return true; //-V1020
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
leaq 0xbe991(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movss 0x160c(%rax), %xmm0
movss %xmm0, -0x50(%rbp)
movq -0x10(%rbp), %rax
movss 0x1610(%rax), %xmm0
movq -0x10(%rbp), %rax
subss 0x159c(%rax), %xmm0
xorps %xmm1, %xmm1
callq 0x139050
movaps %xmm0, %xmm1
movss -0x50(%rbp), %xmm0
leaq -0x18(%rbp), %rdi
callq 0xbf4c0
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movq %rcx, 0x1bec(%rax)
leaq -0x20(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
leaq -0x28(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
leaq -0x28(%rbp), %rdx
callq 0xdab40
movq -0x10(%rbp), %rax
movss 0x10(%rax), %xmm0
movq -0x10(%rbp), %rax
movss 0x1bf0(%rax), %xmm1
movq -0x10(%rbp), %rax
addss 0x1984(%rax), %xmm1
movq -0x10(%rbp), %rax
addss 0x159c(%rax), %xmm1
leaq -0x30(%rbp), %rdi
callq 0xbf4c0
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0xd00c0
movl $0x2, %edi
xorps %xmm0, %xmm0
callq 0xc7a20
leaq -0x38(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
movl $0x4, %edi
leaq -0x38(%rbp), %rsi
callq 0xc7b50
movl $0x50f, -0x3c(%rbp)     # imm = 0x50F
movl -0x3c(%rbp), %edx
leaq 0x23186(%rip), %rdi     # 0x177836
xorl %eax, %eax
movl %eax, %esi
callq 0xd0170
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x49(%rbp)
jne 0x1546c7
jmp 0x1546cf
callq 0x1540f0
movb %al, -0x49(%rbp)
movb -0x49(%rbp), %al
andb $0x1, %al
movb %al, -0x3d(%rbp)
movl $0x2, %edi
callq 0xc7c10
leaq -0x48(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0x10(%rbp), %rax
movq -0x48(%rbp), %rcx
movq %rcx, 0x1bec(%rax)
testb $0x1, -0x3d(%rbp)
jne 0x154710
callq 0xd3b60
movb $0x0, -0x1(%rbp)
jmp 0x154714
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
nop
// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::EndMainMenuBar()
void ImGui::EndMainMenuBar()
{
    EndMenuBar();

    // When the user has left the menu layer (typically: closed menus through activation of an item), we restore focus to the previous window
    // FIXME: With this strategy we won't be able to restore a NULL focus.
    ImGuiContext& g = *GImGui;
    if (g.CurrentWindow == g.NavWindow && g.NavLayer == ImGuiNavLayer_Main && !g.NavAnyRequest)
        FocusTopMostWindowUnderOne(g.NavWindow, NULL);

    End();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
callq 0x154310
leaq 0xbe80c(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x1ae0(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x1c90(%rcx), %rax
jne 0x154781
movq -0x8(%rbp), %rax
cmpl $0x0, 0x1cdc(%rax)
jne 0x154781
movq -0x8(%rbp), %rax
testb $0x1, 0x1ce8(%rax)
jne 0x154781
movq -0x8(%rbp), %rax
movq 0x1c90(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xcfed0
callq 0xd3b60
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::EndMenu()
void ImGui::EndMenu()
{
    // Nav: When a left move request _within our child menu_ failed, close ourselves (the _parent_ menu).
    // A menu doesn't close itself because EndMenuBar() wants the catch the last Left<>Right inputs.
    // However, it means that with the current code, a BeginMenu() from outside another menu or a menu-bar won't be closable with the Left direction.
    ImGuiContext& g = *GImGui;
    ImGuiWindow* window = g.CurrentWindow;
    if (g.NavWindow && g.NavWindow->ParentWindow == window && g.NavMoveDir == ImGuiDir_Left && NavMoveRequestButNoResultYet() && window->DC.LayoutType == ImGuiLayoutType_Vertical)
    {
        ClosePopupToLevel(g.BeginPopupStack.Size, true);
        NavMoveRequestCancel();
    }

    EndPopup();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0xbdc71(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x1ae0(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x1c90(%rax)
je 0x155349
movq -0x8(%rbp), %rax
movq 0x1c90(%rax), %rax
movq 0x388(%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0x155349
movq -0x8(%rbp), %rax
cmpl $0x0, 0x1d10(%rax)
jne 0x155349
callq 0xdf630
testb $0x1, %al
jne 0x155323
jmp 0x155349
movq -0x10(%rbp), %rax
cmpl $0x1, 0x1bc(%rax)
jne 0x155349
movq -0x8(%rbp), %rax
movl 0x1c80(%rax), %edi
movl $0x1, %esi
callq 0xde1b0
callq 0xdf680
callq 0xde4e0
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::MenuItem(char const*, char const*, bool*, bool)
bool ImGui::MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled)
{
    if (MenuItem(label, shortcut, p_selected ? *p_selected : false, enabled))
    {
        if (p_selected)
            *p_selected = !*p_selected;
        return true;
    }
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %cl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
andb $0x1, %al
movb %al, -0x21(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1557ad
movq -0x20(%rbp), %rax
movb (%rax), %al
movb %al, -0x39(%rbp)
jmp 0x1557b4
xorl %eax, %eax
movb %al, -0x39(%rbp)
jmp 0x1557b4
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdi
movb -0x39(%rbp), %cl
movb -0x21(%rbp), %al
movzbl %cl, %edx
andl $0x1, %edx
movzbl %al, %ecx
andl $0x1, %ecx
callq 0x155360
testb $0x1, %al
jne 0x1557d9
jmp 0x1557f8
cmpq $0x0, -0x20(%rbp)
je 0x1557f2
movq -0x20(%rbp), %rax
movb (%rax), %cl
xorb $-0x1, %cl
movq -0x20(%rbp), %rax
andb $0x1, %cl
movb %cl, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0x1557fc
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::BeginTabBar(char const*, int)
bool    ImGui::BeginTabBar(const char* str_id, ImGuiTabBarFlags flags)
{
    ImGuiContext& g = *GImGui;
    ImGuiWindow* window = g.CurrentWindow;
    if (window->SkipItems)
        return false;

    ImGuiID id = window->GetID(str_id);
    ImGuiTabBar* tab_bar = g.TabBars.GetOrAddByKey(id);
    ImRect tab_bar_bb = ImRect(window->DC.CursorPos.x, window->DC.CursorPos.y, window->WorkRect.Max.x, window->DC.CursorPos.y + g.FontSize + g.Style.FramePadding.y * 2);
    tab_bar->ID = id;
    return BeginTabBarEx(tab_bar, tab_bar_bb, flags | ImGuiTabBarFlags_IsFocused);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
leaq 0xbd66a(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x1ae0(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
testb $0x1, 0x93(%rax)
je 0x155902
movb $0x0, -0x1(%rbp)
jmp 0x1559ab
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xc9910
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rdi
addq $0x2110, %rdi           # imm = 0x2110
movl -0x2c(%rbp), %esi
callq 0x162790
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movss 0xd8(%rax), %xmm0
movq -0x28(%rbp), %rax
movss 0xdc(%rax), %xmm1
movq -0x28(%rbp), %rax
movss 0x240(%rax), %xmm2
movq -0x28(%rbp), %rax
movss 0xdc(%rax), %xmm4
movq -0x20(%rbp), %rax
addss 0x1980(%rax), %xmm4
movq -0x20(%rbp), %rax
movss 0x159c(%rax), %xmm3
addss %xmm3, %xmm3
addss %xmm4, %xmm3
leaq -0x48(%rbp), %rdi
callq 0xec090
movl -0x2c(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x38(%rbp), %rdi
movl -0x14(%rbp), %edx
orl $0x200000, %edx         # imm = 0x200000
leaq -0x48(%rbp), %rsi
callq 0x1559c0
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: GetTabBarRefFromTabBar(ImGuiTabBar*)
static ImGuiPtrOrIndex GetTabBarRefFromTabBar(ImGuiTabBar* tab_bar)
{
    ImGuiContext& g = *GImGui;
    if (g.TabBars.Contains(tab_bar))
        return ImGuiPtrOrIndex(g.TabBars.GetIndex(tab_bar));
    return ImGuiPtrOrIndex(tab_bar);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x18(%rbp)
leaq 0xbd1fd(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
addq $0x2110, %rdi           # imm = 0x2110
movq -0x18(%rbp), %rsi
callq 0x162c70
testb $0x1, %al
jne 0x155d64
jmp 0x155d85
movq -0x20(%rbp), %rdi
addq $0x2110, %rdi           # imm = 0x2110
movq -0x18(%rbp), %rsi
callq 0x162cc0
movl %eax, %esi
leaq -0x10(%rbp), %rdi
callq 0x136fc0
jmp 0x155d92
movq -0x18(%rbp), %rsi
leaq -0x10(%rbp), %rdi
callq 0x162d60
movq -0x10(%rbp), %rax
movl -0x8(%rbp), %edx
addq $0x20, %rsp
popq %rbp
retq
nop
// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::TabBarFindTabByID(ImGuiTabBar*, unsigned int)
ImGuiTabItem* ImGui::TabBarFindTabByID(ImGuiTabBar* tab_bar, ImGuiID tab_id)
{
    if (tab_id != 0)
        for (int n = 0; n < tab_bar->Tabs.Size; n++)
            if (tab_bar->Tabs[n].ID == tab_id)
                return &tab_bar->Tabs[n];
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x15708b
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x157089
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0xecb00
movl (%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0x15707c
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0xecb00
movq %rax, -0x8(%rbp)
jmp 0x157093
jmp 0x15707e
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x15704c
jmp 0x15708b
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::TabBarRemoveTab(ImGuiTabBar*, unsigned int)
void ImGui::TabBarRemoveTab(ImGuiTabBar* tab_bar, ImGuiID tab_id)
{
    if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id))
        tab_bar->Tabs.erase(tab);
    if (tab_bar->VisibleTabId == tab_id)      { tab_bar->VisibleTabId = 0; }
    if (tab_bar->SelectedTabId == tab_id)     { tab_bar->SelectedTabId = 0; }
    if (tab_bar->NextSelectedTabId == tab_id) { tab_bar->NextSelectedTabId = 0; }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x157030
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x1570d3
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x162820
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
cmpl -0xc(%rbp), %eax
jne 0x1570ea
movq -0x8(%rbp), %rax
movl $0x0, 0x20(%rax)
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
cmpl -0xc(%rbp), %eax
jne 0x157101
movq -0x8(%rbp), %rax
movl $0x0, 0x18(%rax)
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %eax
cmpl -0xc(%rbp), %eax
jne 0x157118
movq -0x8(%rbp), %rax
movl $0x0, 0x1c(%rax)
addq $0x20, %rsp
popq %rbp
retq
nop
// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::TabBarCloseTab(ImGuiTabBar*, ImGuiTabItem*)
void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
{
    IM_ASSERT(!(tab->Flags & ImGuiTabItemFlags_Button));
    if (!(tab->Flags & ImGuiTabItemFlags_UnsavedDocument))
    {
        // This will remove a frame of lag for selecting another tab on closure.
        // However we don't run it in the case where the 'Unsaved' flag is set, so user gets a chance to fully undo the closure
        tab->WantClose = true;
        if (tab_bar->VisibleTabId == tab->ID)
        {
            tab->LastFrameVisible = -1;
            tab_bar->SelectedTabId = tab_bar->NextSelectedTabId = 0;
        }
    }
    else
    {
        // Actually select before expecting closure attempt (on an UnsavedDocument tab user is expect to e.g. show a popup)
        if (tab_bar->VisibleTabId != tab->ID)
            tab_bar->NextSelectedTabId = tab->ID;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x200000, %eax         # imm = 0x200000
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x15714a
jmp 0x15714c
jmp 0x15716b
leaq 0x39012(%rip), %rdi     # 0x190165
leaq 0x37286(%rip), %rsi     # 0x18e3e0
movl $0x1c88, %edx           # imm = 0x1C88
leaq 0x39028(%rip), %rcx     # 0x19018e
callq 0xd180
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x1571b4
movq -0x10(%rbp), %rax
movb $0x1, 0x22(%rax)
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x1571b2
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
movl $0x0, 0x1c(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x18(%rax)
jmp 0x1571d2
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
je 0x1571d0
movq -0x10(%rbp), %rax
movl (%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x1c(%rax)
jmp 0x1571d2
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::TabBarQueueReorder(ImGuiTabBar*, ImGuiTabItem const*, int)
void ImGui::TabBarQueueReorder(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, int dir)
{
    IM_ASSERT(dir == -1 || dir == +1);
    IM_ASSERT(tab_bar->ReorderRequestTabId == 0);
    tab_bar->ReorderRequestTabId = tab->ID;
    tab_bar->ReorderRequestDir = (ImS8)dir;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movb $0x1, %al
cmpl $-0x1, -0x14(%rbp)
movb %al, -0x15(%rbp)
je 0x157208
cmpl $0x1, -0x14(%rbp)
sete %al
movb %al, -0x15(%rbp)
movb -0x15(%rbp), %al
testb $0x1, %al
jne 0x157211
jmp 0x157213
jmp 0x157232
leaq 0x38fae(%rip), %rdi     # 0x1901c8
leaq 0x371bf(%rip), %rsi     # 0x18e3e0
movl $0x1cc3, %edx           # imm = 0x1CC3
leaq 0x38fb2(%rip), %rcx     # 0x1901df
callq 0xd180
movq -0x8(%rbp), %rax
cmpl $0x0, 0x64(%rax)
jne 0x15723e
jmp 0x15725d
leaq 0x38fe3(%rip), %rdi     # 0x190228
leaq 0x37194(%rip), %rsi     # 0x18e3e0
movl $0x1cc4, %edx           # imm = 0x1CC4
leaq 0x38f87(%rip), %rcx     # 0x1901df
callq 0xd180
movq -0x10(%rbp), %rax
movl (%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x64(%rax)
movl -0x14(%rbp), %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x68(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::TabBarProcessReorder(ImGuiTabBar*)
bool ImGui::TabBarProcessReorder(ImGuiTabBar* tab_bar)
{
    ImGuiTabItem* tab1 = TabBarFindTabByID(tab_bar, tab_bar->ReorderRequestTabId);
    if (tab1 == NULL || (tab1->Flags & ImGuiTabItemFlags_NoReorder))
        return false;

    //IM_ASSERT(tab_bar->Flags & ImGuiTabBarFlags_Reorderable); // <- this may happen when using debug tools
    int tab2_order = tab_bar->GetTabOrder(tab1) + tab_bar->ReorderRequestDir;
    if (tab2_order < 0 || tab2_order >= tab_bar->Tabs.Size)
        return false;

    // Reordered TabItem must share the same position flags than target
    ImGuiTabItem* tab2 = &tab_bar->Tabs[tab2_order];
    if (tab2->Flags & ImGuiTabItemFlags_NoReorder)
        return false;
    if ((tab1->Flags & (ImGuiTabItemFlags_Leading | ImGuiTabItemFlags_Trailing)) != (tab2->Flags & (ImGuiTabItemFlags_Leading | ImGuiTabItemFlags_Trailing)))
        return false;

    ImGuiTabItem item_tmp = *tab1;
    *tab1 = *tab2;
    *tab2 = item_tmp;

    if (tab_bar->Flags & ImGuiTabBarFlags_SaveSettings)
        MarkIniSettingsDirty();
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x64(%rax), %esi
callq 0x157030
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x1572b6
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x1572bf
movb $0x0, -0x1(%rbp)
jmp 0x15738b
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x162910
movq -0x10(%rbp), %rcx
movsbl 0x68(%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jl 0x1572ea
movl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jl 0x1572f3
movb $0x0, -0x1(%rbp)
jmp 0x15738b
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xecb00
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x157318
movb $0x0, -0x1(%rbp)
jmp 0x15738b
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
andl $0xc0, %eax
movq -0x28(%rbp), %rcx
movl 0x4(%rcx), %ecx
andl $0xc0, %ecx
cmpl %ecx, %eax
je 0x15733b
movb $0x0, -0x1(%rbp)
jmp 0x15738b
movq -0x18(%rbp), %rsi
leaq -0x4c(%rbp), %rdi
movl $0x24, %edx
callq 0xd0a0
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rdi
movl $0x23, %edx
callq 0xd0a0
movq -0x28(%rbp), %rdi
leaq -0x4c(%rbp), %rsi
movl $0x23, %edx
callq 0xd0a0
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x400000, %eax         # imm = 0x400000
cmpl $0x0, %eax
je 0x157387
callq 0xe0f80
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::BeginTabItem(char const*, bool*, int)
bool    ImGui::BeginTabItem(const char* label, bool* p_open, ImGuiTabItemFlags flags)
{
    ImGuiContext& g = *GImGui;
    ImGuiWindow* window = g.CurrentWindow;
    if (window->SkipItems)
        return false;

    ImGuiTabBar* tab_bar = g.CurrentTabBar;
    if (tab_bar == NULL)
    {
        IM_ASSERT_USER_ERROR(tab_bar, "Needs to be called between BeginTabBar() and EndTabBar()!");
        return false;
    }
    IM_ASSERT(!(flags & ImGuiTabItemFlags_Button)); // BeginTabItem() Can't be used with button flags, use TabItemButton() instead!

    bool ret = TabItemEx(tab_bar, label, p_open, flags);
    if (ret && !(flags & ImGuiTabItemFlags_NoPushId))
    {
        ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx];
        PushOverrideID(tab->ID); // We already hashed 'label' so push into the ID stack directly instead of doing another hash through PushID(label)
    }
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
leaq 0xbbb86(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x1ae0(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
testb $0x1, 0x93(%rax)
je 0x1573e6
movb $0x0, -0x1(%rbp)
jmp 0x1574cb
movq -0x28(%rbp), %rax
movq 0x2108(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x157442
xorl %eax, %eax
cmpq $0x0, -0x38(%rbp)
movb %al, -0x49(%rbp)
je 0x15740f
movb $0x1, %al
movb %al, -0x49(%rbp)
jmp 0x15740f
movb -0x49(%rbp), %al
testb $0x1, %al
jne 0x157418
jmp 0x15741a
jmp 0x157439
leaq 0x38e63(%rip), %rdi     # 0x190284
leaq 0x36fb8(%rip), %rsi     # 0x18e3e0
movl $0x1d5e, %edx           # imm = 0x1D5E
leaq 0x38e99(%rip), %rcx     # 0x1902cd
callq 0xd180
movb $0x0, -0x1(%rbp)
jmp 0x1574cb
movl -0x1c(%rbp), %eax
andl $0x200000, %eax         # imm = 0x200000
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x157458
jmp 0x15745a
jmp 0x157479
leaq 0x38f7d(%rip), %rdi     # 0x1903de
leaq 0x36f78(%rip), %rsi     # 0x18e3e0
movl $0x1d61, %edx           # imm = 0x1D61
leaq 0x38e59(%rip), %rcx     # 0x1902cd
callq 0xd180
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
callq 0x1574e0
andb $0x1, %al
movb %al, -0x39(%rbp)
testb $0x1, -0x39(%rbp)
je 0x1574c3
movl -0x1c(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0x1574c3
movq -0x38(%rbp), %rdi
movq -0x38(%rbp), %rax
movswl 0x70(%rax), %esi
callq 0xecb00
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movl (%rax), %edi
callq 0xdb5a0
movb -0x39(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::EndTabItem()
void    ImGui::EndTabItem()
{
    ImGuiContext& g = *GImGui;
    ImGuiWindow* window = g.CurrentWindow;
    if (window->SkipItems)
        return;

    ImGuiTabBar* tab_bar = g.CurrentTabBar;
    if (tab_bar == NULL)
    {
        IM_ASSERT_USER_ERROR(tab_bar != NULL, "Needs to be called between BeginTabBar() and EndTabBar()!");
        return;
    }
    IM_ASSERT(tab_bar->LastTabItemIdx >= 0);
    ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx];
    if (!(tab->Flags & ImGuiTabItemFlags_NoPushId))
        PopID();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
leaq 0xbadf1(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x1ae0(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
testb $0x1, 0x93(%rax)
je 0x158177
jmp 0x158223
movq -0x8(%rbp), %rax
movq 0x2108(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x1581cc
xorl %eax, %eax
cmpq $0x0, -0x18(%rbp)
movb %al, -0x21(%rbp)
je 0x1581a0
movb $0x1, %al
movb %al, -0x21(%rbp)
jmp 0x1581a0
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x1581a9
jmp 0x1581ab
jmp 0x1581ca
leaq 0x3815d(%rip), %rdi     # 0x19030f
leaq 0x36227(%rip), %rsi     # 0x18e3e0
movl $0x1d76, %edx           # imm = 0x1D76
leaq 0x3819d(%rip), %rcx     # 0x190362
callq 0xd180
jmp 0x158223
movq -0x18(%rbp), %rax
movswl 0x70(%rax), %eax
cmpl $0x0, %eax
jl 0x1581db
jmp 0x1581fa
leaq 0x38199(%rip), %rdi     # 0x19037b
leaq 0x361f7(%rip), %rsi     # 0x18e3e0
movl $0x1d79, %edx           # imm = 0x1D79
leaq 0x3816d(%rip), %rcx     # 0x190362
callq 0xd180
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rax
movswl 0x70(%rax), %esi
callq 0xecb00
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0x158223
callq 0xdb640
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::TabItemButton(char const*, int)
bool    ImGui::TabItemButton(const char* label, ImGuiTabItemFlags flags)
{
    ImGuiContext& g = *GImGui;
    ImGuiWindow* window = g.CurrentWindow;
    if (window->SkipItems)
        return false;

    ImGuiTabBar* tab_bar = g.CurrentTabBar;
    if (tab_bar == NULL)
    {
        IM_ASSERT_USER_ERROR(tab_bar != NULL, "Needs to be called between BeginTabBar() and EndTabBar()!");
        return false;
    }
    return TabItemEx(tab_bar, label, NULL, flags | ImGuiTabItemFlags_Button | ImGuiTabItemFlags_NoReorder);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
leaq 0xbacfa(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x1ae0(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
testb $0x1, 0x93(%rax)
je 0x15826f
movb $0x0, -0x1(%rbp)
jmp 0x1582ea
movq -0x20(%rbp), %rax
movq 0x2108(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x1582c8
xorl %eax, %eax
cmpq $0x0, -0x30(%rbp)
movb %al, -0x31(%rbp)
je 0x158298
movb $0x1, %al
movb %al, -0x31(%rbp)
jmp 0x158298
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x1582a1
jmp 0x1582a3
jmp 0x1582c2
leaq 0x38065(%rip), %rdi     # 0x19030f
leaq 0x3612f(%rip), %rsi     # 0x18e3e0
movl $0x1d89, %edx           # imm = 0x1D89
leaq 0x380db(%rip), %rcx     # 0x190398
callq 0xd180
movb $0x0, -0x1(%rbp)
jmp 0x1582ea
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %ecx
orl $0x200000, %ecx         # imm = 0x200000
orl $0x20, %ecx
xorl %eax, %eax
movl %eax, %edx
callq 0x1574e0
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::TabBarCalcTabID(ImGuiTabBar*, char const*)
static ImU32   ImGui::TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label)
{
    if (tab_bar->Flags & ImGuiTabBarFlags_DockNode)
    {
        ImGuiID id = ImHashStr(label);
        KeepAliveID(id);
        return id;
    }
    else
    {
        ImGuiWindow* window = GImGui->CurrentWindow;
        return window->GetID(label);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x100000, %eax         # imm = 0x100000
cmpl $0x0, %eax
je 0x158343
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0xc4f20
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %edi
callq 0xc9a90
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x15836c
leaq 0xbabf6(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq 0x1ae0(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xc9910
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::TabItemCalcSize(char const*, bool)
ImVec2 ImGui::TabItemCalcSize(const char* label, bool has_close_button)
{
    ImGuiContext& g = *GImGui;
    ImVec2 label_size = CalcTextSize(label, NULL, true);
    ImVec2 size = ImVec2(label_size.x + g.Style.FramePadding.x, label_size.y + g.Style.FramePadding.y * 2.0f);
    if (has_close_button)
        size.x += g.Style.FramePadding.x + (g.Style.ItemInnerSpacing.x + g.FontSize); // We use Y intentionally to fit the close button circle.
    else
        size.x += g.Style.FramePadding.x + 1.0f;
    return ImVec2(ImMin(size.x, TabBarCalcMaxTabWidth()), size.y);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %sil, %al
movq %rdi, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
leaq 0xbaba5(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
movss 0x19bc9(%rip), %xmm0    # 0x171f80
callq 0xc87e0
movlpd %xmm0, -0x28(%rbp)
movss -0x28(%rbp), %xmm0
movq -0x20(%rbp), %rax
addss 0x1598(%rax), %xmm0
movss -0x24(%rbp), %xmm2
movq -0x20(%rbp), %rax
movss 0x159c(%rax), %xmm1
addss %xmm1, %xmm1
addss %xmm2, %xmm1
leaq -0x30(%rbp), %rdi
callq 0xbf4c0
testb $0x1, -0x11(%rbp)
je 0x15842e
movq -0x20(%rbp), %rax
movss 0x1598(%rax), %xmm0
movq -0x20(%rbp), %rax
movss 0x15b0(%rax), %xmm1
movq -0x20(%rbp), %rax
addss 0x1980(%rax), %xmm1
addss %xmm1, %xmm0
addss -0x30(%rbp), %xmm0
movss %xmm0, -0x30(%rbp)
jmp 0x15844c
movq -0x20(%rbp), %rax
movss 0x18802(%rip), %xmm0    # 0x170c3c
addss 0x1598(%rax), %xmm0
addss -0x30(%rbp), %xmm0
movss %xmm0, -0x30(%rbp)
movss -0x30(%rbp), %xmm0
movss %xmm0, -0x34(%rbp)
callq 0x158d00
movaps %xmm0, %xmm1
movss -0x34(%rbp), %xmm0
callq 0x13c690
movss -0x2c(%rbp), %xmm1
leaq -0x8(%rbp), %rdi
callq 0xbf4c0
movsd -0x8(%rbp), %xmm0
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::SetTabItemClosed(char const*)
void    ImGui::SetTabItemClosed(const char* label)
{
    ImGuiContext& g = *GImGui;
    bool is_within_manual_tab_bar = g.CurrentTabBar && !(g.CurrentTabBar->Flags & ImGuiTabBarFlags_DockNode);
    if (is_within_manual_tab_bar)
    {
        ImGuiTabBar* tab_bar = g.CurrentTabBar;
        ImGuiID tab_id = TabBarCalcTabID(tab_bar, label);
        if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id))
            tab->WantClose = true; // Will be processed by next call to TabBarLayout()
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
leaq 0xba2cd(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rcx
xorl %eax, %eax
cmpq $0x0, 0x2108(%rcx)
movb %al, -0x31(%rbp)
je 0x158cab
movq -0x10(%rbp), %rax
movq 0x2108(%rax), %rax
movl 0x10(%rax), %eax
andl $0x100000, %eax         # imm = 0x100000
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
andb $0x1, %al
movb %al, -0x11(%rbp)
testb $0x1, -0x11(%rbp)
je 0x158cf9
movq -0x10(%rbp), %rax
movq 0x2108(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x158300
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x157030
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x158cf7
movq -0x30(%rbp), %rax
movb $0x1, 0x22(%rax)
jmp 0x158cf9
addq $0x40, %rsp
popq %rbp
retq
nop
// File: Ciaxur[P]yagb-emu/include/imgui/imstb_textedit.h
// Function: ImStb::stb_text_makeundo_replace(ImGuiInputTextState*, ImStb::STB_TexteditState*, int, int, int)
static void stb_text_makeundo_replace(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int old_length, int new_length)
{
   int i;
   STB_TEXTEDIT_CHARTYPE *p = stb_text_createundo(&state->undostate, where, old_length, new_length);
   if (p) {
      for (i=0; i < old_length; ++i)
         p[i] = STB_TEXTEDIT_GETCHAR(str, where+i);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
callq 0x159c10
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x158df5
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x158df3
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %esi
addl -0x20(%rbp), %esi
callq 0x159a30
movw %ax, %dx
movq -0x28(%rbp), %rax
movslq -0x20(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x158dc2
jmp 0x158df5
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImStb::STB_TEXTEDIT_DELETECHARS(ImGuiInputTextState*, int, int)
static void STB_TEXTEDIT_DELETECHARS(STB_TEXTEDIT_STRING* obj, int pos, int n)
{
    ImWchar* dst = obj->TextW.Data + pos;

    // We maintain our buffer length in both UTF-8 and wchar formats
    obj->Edited = true;
    obj->CurLenA -= ImTextCountUtf8BytesFromStr(dst, dst + n);
    obj->CurLenW -= n;

    // Offset remaining text (FIXME-OPT: Use memmove)
    const ImWchar* src = obj->TextW.Data + pos + n;
    while (ImWchar c = *src++)
        *dst++ = c;
    *dst = '\0';
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0xc(%rbp), %rcx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movb $0x1, 0xe7e(%rax)
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rsi
movslq -0x10(%rbp), %rax
shlq %rax
addq %rax, %rsi
callq 0xc5760
movl %eax, %edx
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x8(%rax)
movl -0x10(%rbp), %edx
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0xc(%rbp), %rcx
shlq %rcx
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x2, %rcx
movq %rcx, -0x20(%rbp)
movw (%rax), %ax
movw %ax, -0x22(%rbp)
cmpw $0x0, -0x22(%rbp)
je 0x158ebc
movw -0x22(%rbp), %cx
movq -0x18(%rbp), %rax
movq %rax, %rdx
addq $0x2, %rdx
movq %rdx, -0x18(%rbp)
movw %cx, (%rax)
jmp 0x158e87
movq -0x18(%rbp), %rax
movw $0x0, (%rax)
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imstb_textedit.h
// Function: ImStb::stb_textedit_delete_selection(ImGuiInputTextState*, ImStb::STB_TexteditState*)
static void stb_textedit_delete_selection(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
{
   stb_textedit_clamp(str, state);
   if (STB_TEXT_HAS_SELECTION(state)) {
      if (state->select_start < state->select_end) {
         stb_textedit_delete(str, state, state->select_start, state->select_end - state->select_start);
         state->select_end = state->cursor = state->select_start;
      } else {
         stb_textedit_delete(str, state, state->select_end, state->select_start - state->select_end);
         state->select_start = state->cursor = state->select_end;
      }
      state->has_preferred_x = 0;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x159680
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
je 0x159187
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x159149
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x10(%rbp), %rax
subl 0x4(%rax), %ecx
callq 0x159bc0
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
jmp 0x15917f
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x10(%rbp), %rax
subl 0x8(%rax), %ecx
callq 0x159bc0
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x16(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imstb_textedit.h
// Function: ImStb::stb_textedit_move_to_first(ImStb::STB_TexteditState*)
static void stb_textedit_move_to_first(STB_TexteditState *state)
{
   if (STB_TEXT_HAS_SELECTION(state)) {
      stb_textedit_sortselection(state);
      state->cursor = state->select_start;
      state->select_end = state->select_start;
      state->has_preferred_x = 0;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
je 0x159618
movq -0x8(%rbp), %rdi
callq 0x15a120
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
movb $0x0, 0x16(%rax)
addq $0x10, %rsp
popq %rbp
retq
nop
// File: Ciaxur[P]yagb-emu/include/imgui/imstb_textedit.h
// Function: ImStb::stb_textedit_move_to_last(ImGuiInputTextState*, ImStb::STB_TexteditState*)
static void stb_textedit_move_to_last(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
{
   if (STB_TEXT_HAS_SELECTION(state)) {
      stb_textedit_sortselection(state);
      stb_textedit_clamp(str, state);
      state->cursor = state->select_end;
      state->select_start = state->select_end;
      state->has_preferred_x = 0;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
je 0x159679
movq -0x10(%rbp), %rdi
callq 0x15a120
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x159680
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x16(%rax)
addq $0x10, %rsp
popq %rbp
retq
nop
// File: Ciaxur[P]yagb-emu/include/imgui/imstb_textedit.h
// Function: ImStb::stb_textedit_clamp(ImGuiInputTextState*, ImStb::STB_TexteditState*)
static void stb_textedit_clamp(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
{
   int n = STB_TEXTEDIT_STRINGLEN(str);
   if (STB_TEXT_HAS_SELECTION(state)) {
      if (state->select_start > n) state->select_start = n;
      if (state->select_end   > n) state->select_end = n;
      // if clamping forced them to be equal, move the cursor to match
      if (state->select_start == state->select_end)
         state->cursor = state->select_start;
   }
   if (state->cursor > n) state->cursor = n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x158d60
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
je 0x1596f7
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
cmpl -0x14(%rbp), %eax
jle 0x1596c2
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0x14(%rbp), %eax
jle 0x1596d8
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x1596f5
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1596f7
movq -0x10(%rbp), %rax
movl (%rax), %eax
cmpl -0x14(%rbp), %eax
jle 0x15970b
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImStb::STB_TEXTEDIT_LAYOUTROW(ImStb::StbTexteditRow*, ImGuiInputTextState*, int)
static void    STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, STB_TEXTEDIT_STRING* obj, int line_start_idx)
{
    const ImWchar* text = obj->TextW.Data;
    const ImWchar* text_remaining = NULL;
    const ImVec2 size = InputTextCalcTextSizeW(text + line_start_idx, text + obj->CurLenW, &text_remaining, NULL, true);
    r->x0 = 0.0f;
    r->x1 = size.x;
    r->baseline_y_delta = size.y;
    r->ymin = 0.0f;
    r->ymax = size.y;
    r->num_chars = (int)(text_remaining - (text + line_start_idx));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rcx
leaq (%rax,%rcx,2), %rdi
movq -0x10(%rbp), %rcx
movslq 0x4(%rcx), %rcx
leaq (%rax,%rcx,2), %rsi
xorl %eax, %eax
movl %eax, %ecx
leaq -0x28(%rbp), %rdx
movl $0x1, %r8d
callq 0x14bc40
movlpd %xmm0, -0x30(%rbp)
movq -0x8(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, (%rax)
movss -0x30(%rbp), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x4(%rax)
movss -0x2c(%rbp), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x8(%rax)
movq -0x8(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0xc(%rax)
movss -0x2c(%rbp), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x10(%rax)
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x14(%rbp), %rdx
shlq %rdx
addq %rdx, %rcx
subq %rcx, %rax
sarq %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x14(%rax)
addq $0x30, %rsp
popq %rbp
retq
nop
// File: Ciaxur[P]yagb-emu/include/imgui/imstb_textedit.h
// Function: ImStb::stb_text_createundo(ImStb::StbUndoState*, int, int, int)
static STB_TEXTEDIT_CHARTYPE *stb_text_createundo(StbUndoState *state, int pos, int insert_len, int delete_len)
{
   StbUndoRecord *r = stb_text_create_undo_record(state, insert_len);
   if (r == NULL)
      return NULL;

   r->where = pos;
   r->insert_length = (STB_TEXTEDIT_POSITIONTYPE) insert_len;
   r->delete_length = (STB_TEXTEDIT_POSITIONTYPE) delete_len;

   if (insert_len == 0) {
      r->char_storage = -1;
      return NULL;
   } else {
      r->char_storage = state->undo_char_point;
      state->undo_char_point += insert_len;
      return &state->undo_char[r->char_storage];
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x159cd0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x159c46
movq $0x0, -0x8(%rbp)
jmp 0x159cbe
movl -0x14(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl -0x18(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x1c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x8(%rax)
cmpl $0x0, -0x18(%rbp)
jne 0x159c7e
movq -0x28(%rbp), %rax
movl $0xffffffff, 0xc(%rax)  # imm = 0xFFFFFFFF
movq $0x0, -0x8(%rbp)
jmp 0x159cbe
movq -0x10(%rbp), %rax
movl 0xe04(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0xc(%rax)
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
addl 0xe04(%rax), %ecx
movl %ecx, 0xe04(%rax)
movq -0x10(%rbp), %rax
addq $0x630, %rax            # imm = 0x630
movq -0x28(%rbp), %rcx
movslq 0xc(%rcx), %rcx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imstb_textedit.h
// Function: ImStb::stb_text_create_undo_record(ImStb::StbUndoState*, int)
static StbUndoRecord *stb_text_create_undo_record(StbUndoState *state, int numchars)
{
   // any time we create a new undo record, we discard redo
   stb_textedit_flush_redo(state);

   // if we have no free records, we have to make room, by sliding the
   // existing records down
   if (state->undo_point == STB_TEXTEDIT_UNDOSTATECOUNT)
      stb_textedit_discard_undo(state);

   // if the characters to store won't possibly fit in the buffer, we can't undo
   if (numchars > STB_TEXTEDIT_UNDOCHARCOUNT) {
      state->undo_point = 0;
      state->undo_char_point = 0;
      return NULL;
   }

   // if we don't have enough free characters in the buffer, we have to make room
   while (state->undo_char_point + numchars > STB_TEXTEDIT_UNDOCHARCOUNT)
      stb_textedit_discard_undo(state);

   return &state->undo_rec[state->undo_point++];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rdi
callq 0x159d90
movq -0x10(%rbp), %rax
movswl 0xdfe(%rax), %eax
cmpl $0x63, %eax
jne 0x159d01
movq -0x10(%rbp), %rdi
callq 0x159dc0
cmpl $0x3e7, -0x14(%rbp)     # imm = 0x3E7
jle 0x159d2f
movq -0x10(%rbp), %rax
movw $0x0, 0xdfe(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0xe04(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x159d7c
jmp 0x159d31
movq -0x10(%rbp), %rax
movl 0xe04(%rax), %eax
addl -0x14(%rbp), %eax
cmpl $0x3e7, %eax            # imm = 0x3E7
jle 0x159d50
movq -0x10(%rbp), %rdi
callq 0x159dc0
jmp 0x159d31
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rdx
movw 0xdfe(%rdx), %cx
movw %cx, %si
addw $0x1, %si
movw %si, 0xdfe(%rdx)
movswq %cx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imstb_textedit.h
// Function: ImStb::stb_textedit_discard_undo(ImStb::StbUndoState*)
static void stb_textedit_discard_undo(StbUndoState *state)
{
   if (state->undo_point > 0) {
      // if the 0th undo state has characters, clean those up
      if (state->undo_rec[0].char_storage >= 0) {
         int n = state->undo_rec[0].insert_length, i;
         // delete n characters from all other records
         state->undo_char_point -= n;
         STB_TEXTEDIT_memmove(state->undo_char, state->undo_char + n, (size_t) (state->undo_char_point*sizeof(STB_TEXTEDIT_CHARTYPE)));
         for (i=0; i < state->undo_point; ++i)
            if (state->undo_rec[i].char_storage >= 0)
               state->undo_rec[i].char_storage -= n; // @OPTIMIZE: get rid of char_storage and infer it
      }
      --state->undo_point;
      STB_TEXTEDIT_memmove(state->undo_rec, state->undo_rec+1, (size_t) (state->undo_point*sizeof(state->undo_rec[0])));
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movswl 0xdfe(%rax), %eax
cmpl $0x0, %eax
jle 0x159ece
movq -0x8(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jl 0x159e97
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %edx
movq -0x8(%rbp), %rax
movl 0xe04(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0xe04(%rax)
movq -0x8(%rbp), %rdi
addq $0x630, %rdi            # imm = 0x630
movq -0x8(%rbp), %rsi
addq $0x630, %rsi            # imm = 0x630
movslq -0xc(%rbp), %rax
shlq %rax
addq %rax, %rsi
movq -0x8(%rbp), %rax
movslq 0xe04(%rax), %rdx
shlq %rdx
callq 0xd170
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
movswl 0xdfe(%rcx), %ecx
cmpl %ecx, %eax
jge 0x159e95
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpl $0x0, 0xc(%rax)
jl 0x159e88
movl -0xc(%rbp), %edx
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0xc(%rax)
jmp 0x159e8a
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x159e47
jmp 0x159e97
movq -0x8(%rbp), %rax
movw 0xdfe(%rax), %cx
addw $-0x1, %cx
movw %cx, 0xdfe(%rax)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x10, %rsi
movq -0x8(%rbp), %rax
movswq 0xdfe(%rax), %rdx
shlq $0x4, %rdx
callq 0xd170
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imstb_textedit.h
// Function: ImStb::stb_textedit_sortselection(ImStb::STB_TexteditState*)
static void stb_textedit_sortselection(STB_TexteditState *state)
{
   if (state->select_end < state->select_start) {
      int temp = state->select_end;
      state->select_end = state->select_start;
      state->select_start = temp;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x15a15a
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0xc(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x4(%rax)
popq %rbp
retq
nopl (%rax)
// File: Ciaxur[P]yagb-emu/include/imgui/imstb_textedit.h
// Function: ImStb::stb_text_makeundo_delete(ImGuiInputTextState*, ImStb::STB_TexteditState*, int, int)
static void stb_text_makeundo_delete(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int length)
{
   int i;
   STB_TEXTEDIT_CHARTYPE *p = stb_text_createundo(&state->undostate, where, length, 0);
   if (p) {
      for (i=0; i < length; ++i)
         p[i] = STB_TEXTEDIT_GETCHAR(str, where+i);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
xorl %ecx, %ecx
callq 0x159c10
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x15a320
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x15a31e
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %esi
addl -0x1c(%rbp), %esi
callq 0x159a30
movw %ax, %dx
movq -0x28(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x15a2ed
jmp 0x15a320
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)