LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: ImDrawList::AddImage(void*, ImVec2 const&, ImVec2 const&, ImVec2 const&, ImVec2 const&, unsigned int)
void ImDrawList::AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv0, const ImVec2& uv1, ImU32 col)
{
    if ((col >> 24) == 0)
        return;

    // FIXME-OPT: This is wasting draw calls.
    const bool push_texture_id = _TextureIdStack.empty() || user_texture_id != _TextureIdStack.back();
    if (push_texture_id)
        PushTextureID(user_texture_id);

    PrimReserve(6, 4);
    PrimRectUV(a, b, uv0, uv1, col);

    if (push_texture_id)
        PopTextureID();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl 0x10(%rbp), %r12d
movq %rsi, -0x40(%rbp)
cmpl $0x1000000, %r12d       # imm = 0x1000000
jb 0x2a595
movq %rcx, %r13
movq %rdx, %rbx
movq %rdi, %r15
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
cmpl $0x0, 0x60(%rdi)
je 0x2a55a
movq %rsi, %r14
leaq 0x60(%r15), %rdi
callq 0x300c6
cmpq %r14, (%rax)
je 0x2a5a4
leaq -0x40(%rbp), %rsi
movq %r15, %rdi
callq 0x27e64
pushq $0x6
popq %rsi
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0x2820c
movq %r15, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %r8
movl %r12d, %r9d
callq 0x2833e
movq %r15, %rdi
callq 0x27e84
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x6
popq %rsi
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0x2820c
movq %r15, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %r8
movl %r12d, %r9d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2833e
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: ImDrawData::ScaleClipRects(ImVec2 const&)
void ImDrawData::ScaleClipRects(const ImVec2& scale)
{
    for (int i = 0; i < CmdListsCount; i++)
    {
        ImDrawList* cmd_list = CmdLists[i];
        for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
        {
            ImDrawCmd* cmd = &cmd_list->CmdBuffer[cmd_i];
            cmd->ClipRect = ImVec4(cmd->ClipRect.x * scale.x, cmd->ClipRect.y * scale.y, cmd->ClipRect.z * scale.x, cmd->ClipRect.w * scale.y);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
xorl %r13d, %r13d
movslq 0x10(%r14), %rax
cmpq %rax, %r13
jge 0x2a76e
movq 0x8(%r14), %rax
movq (%rax,%r13,8), %r15
xorl %r12d, %r12d
cmpl (%r15), %r12d
jge 0x2a769
movq %r15, %rdi
movl %r12d, %esi
callq 0x30312
movss (%rbx), %xmm0
movss 0x4(%rbx), %xmm1
movss 0x4(%rax), %xmm2
mulss %xmm0, %xmm2
movss 0x8(%rax), %xmm3
mulss 0xc(%rax), %xmm0
mulss %xmm1, %xmm3
mulss 0x10(%rax), %xmm1
movss %xmm2, 0x4(%rax)
movss %xmm3, 0x8(%rax)
movss %xmm0, 0xc(%rax)
movss %xmm1, 0x10(%rax)
incl %r12d
jmp 0x2a71b
incq %r13
jmp 0x2a707
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: ImFontConfig::ImFontConfig()
ImFontConfig::ImFontConfig()
{
    FontData = NULL;
    FontDataSize = 0;
    FontDataOwnedByAtlas = true;
    FontNo = 0;
    SizePixels = 0.0f;
    OversampleH = 3;
    OversampleV = 1;
    PixelSnapH = false;
    GlyphExtraSpacing = ImVec2(0.0f, 0.0f);
    GlyphRanges = NULL;
    MergeMode = false;
    MergeGlyphCenterV = false;
    DstFont = NULL;
    memset(Name, 0, sizeof(Name));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
andq $0x0, (%rdi)
andl $0x0, 0x8(%rdi)
movb $0x1, 0xc(%rdi)
movaps 0x1125b(%rip), %xmm0    # 0x3b9f0
movups %xmm0, 0x10(%rdi)
movb $0x0, 0x20(%rdi)
andq $0x0, 0x24(%rdi)
andq $0x0, 0x60(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rdi)
movups %xmm0, 0x40(%rdi)
movups %xmm0, 0x4a(%rdi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: ImFontAtlas::ClearInputData()
void    ImFontAtlas::ClearInputData()
{
    for (int i = 0; i < ConfigData.Size; i++)
        if (ConfigData[i].FontData && ConfigData[i].FontDataOwnedByAtlas)
        {
            ImGui::MemFree(ConfigData[i].FontData);
            ConfigData[i].FontData = NULL;
        }

    // When clearing this we lose access to the font name and other information used to build the font.
    for (int i = 0; i < Fonts.Size; i++)
        if (Fonts[i]->ConfigData >= ConfigData.Data && Fonts[i]->ConfigData < ConfigData.Data + ConfigData.Size)
        {
            Fonts[i]->ConfigData = NULL;
            Fonts[i]->ConfigDataCount = 0;
        }
    ConfigData.clear();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r14
leaq 0x40(%rdi), %rbx
xorl %r15d, %r15d
cmpl (%rbx), %r15d
jge 0x2a88d
movq %rbx, %rdi
movl %r15d, %esi
callq 0x30362
cmpq $0x0, (%rax)
je 0x2a888
movq %rbx, %rdi
movl %r15d, %esi
callq 0x30362
cmpb $0x1, 0xc(%rax)
jne 0x2a888
movq %rbx, %rdi
movl %r15d, %esi
callq 0x30362
movq (%rax), %rdi
callq 0x8d0c
movq %rbx, %rdi
movl %r15d, %esi
callq 0x30362
andq $0x0, (%rax)
incl %r15d
jmp 0x2a83f
leaq 0x30(%r14), %r15
xorl %r12d, %r12d
cmpl (%r15), %r12d
jge 0x2a8fb
movq %r15, %rdi
movl %r12d, %esi
callq 0x1e75e
movq (%rax), %rax
movq 0x18(%rax), %rax
cmpq 0x48(%r14), %rax
jb 0x2a8f6
movq %r15, %rdi
movl %r12d, %esi
callq 0x1e75e
movq (%rax), %rax
movslq 0x40(%r14), %rcx
imulq $0x68, %rcx, %rcx
addq 0x48(%r14), %rcx
cmpq %rcx, 0x18(%rax)
jae 0x2a8f6
movq %r15, %rdi
movl %r12d, %esi
callq 0x1e75e
movq (%rax), %rax
andq $0x0, 0x18(%rax)
movq %r15, %rdi
movl %r12d, %esi
callq 0x1e75e
movq (%rax), %rax
andl $0x0, 0x20(%rax)
incl %r12d
jmp 0x2a894
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x30396
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: ImFontAtlas::ClearTexData()
void    ImFontAtlas::ClearTexData()
{
    if (TexPixelsAlpha8)
        ImGui::MemFree(TexPixelsAlpha8);
    if (TexPixelsRGBA32)
        ImGui::MemFree(TexPixelsRGBA32);
    TexPixelsAlpha8 = NULL;
    TexPixelsRGBA32 = NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x2a923
callq 0x8d0c
movq 0x10(%rbx), %rdi
addq $0x8, %rbx
testq %rdi, %rdi
je 0x2a935
callq 0x8d0c
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: ImFontAtlas::ClearFonts()
void    ImFontAtlas::ClearFonts()
{
    for (int i = 0; i < Fonts.Size; i++)
    {
        Fonts[i]->~ImFont();
        ImGui::MemFree(Fonts[i]);
    }
    Fonts.clear();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
addq $0x30, %rbx
xorl %r14d, %r14d
cmpl (%rbx), %r14d
jge 0x2a983
movq %rbx, %rdi
movl %r14d, %esi
callq 0x1e75e
movq (%rax), %rdi
callq 0x2e58a
movq %rbx, %rdi
movl %r14d, %esi
callq 0x1e75e
movq (%rax), %rdi
callq 0x8d0c
incl %r14d
jmp 0x2a953
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x1e91e
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: ImFontAtlas::AddFontDefault(ImFontConfig const*)
ImFont* ImFontAtlas::AddFontDefault(const ImFontConfig* font_cfg_template)
{
    ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();
    if (!font_cfg_template)
    {
        font_cfg.OversampleH = font_cfg.OversampleV = 1;
        font_cfg.PixelSnapH = true;
    }
    if (font_cfg.Name[0] == '\0') strcpy(font_cfg.Name, "<default>");

    const char* ttf_compressed_base85 = GetDefaultCompressedFontDataTTFBase85();
    ImFont* font = AddFontFromMemoryCompressedBase85TTF(ttf_compressed_base85, 13.0f, &font_cfg, GetGlyphRangesDefault());
    return font;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, %rax
testq %rsi, %rsi
je 0x2aa2f
pushq $0xd
popq %rcx
leaq -0x68(%rbp), %rdx
movq %rdx, %rdi
rep  movsq (%rsi), %es:(%rdi)
cmpb $0x0, 0x3a(%rdx)
jne 0x2aa80
jmp 0x2aa6c
andq $0x0, -0x68(%rbp)
andl $0x0, -0x60(%rbp)
movb $0x1, %cl
movb %cl, -0x5c(%rbp)
andq $0x0, -0x58(%rbp)
andq $0x0, -0x44(%rbp)
andq $0x0, -0x8(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, -0x38(%rbp)
movups %xmm0, -0x28(%rbp)
movups %xmm0, -0x1e(%rbp)
movabsq $0x100000001, %rdx      # imm = 0x100000001
movq %rdx, -0x50(%rbp)
movb %cl, -0x48(%rbp)
movabsq $0x746c75616665643c, %rcx # imm = 0x746C75616665643C
movq %rcx, -0x2e(%rbp)
movw $0x3e, -0x26(%rbp)
leaq 0x11ff9(%rip), %rsi     # 0x3ca80
leaq 0x1105e(%rip), %rcx     # 0x3baec
movss 0x10f46(%rip), %xmm0    # 0x3b9dc
leaq -0x68(%rbp), %rdx
movq %rax, %rdi
callq 0x2d530
addq $0x70, %rsp
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: ImFontAtlas::GetTexDataAsRGBA32(unsigned char**, int*, int*, int*)
void    ImFontAtlas::GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel)
{
    // Convert to RGBA32 format on demand
    // Although it is likely to be the most commonly used format, our font rendering is 1 channel / 8 bpp
    if (!TexPixelsRGBA32)
    {
        unsigned char* pixels;
        GetTexDataAsAlpha8(&pixels, NULL, NULL);
        TexPixelsRGBA32 = (unsigned int*)ImGui::MemAlloc((size_t)(TexWidth * TexHeight * 4));
        const unsigned char* src = pixels;
        unsigned int* dst = TexPixelsRGBA32;
        for (int n = TexWidth * TexHeight; n > 0; n--)
            *dst++ = ((unsigned int)(*src++) << 24) | 0x00FFFFFF;
    }

    *out_pixels = (unsigned char*)TexPixelsRGBA32;
    if (out_width) *out_width = TexWidth;
    if (out_height) *out_height = TexHeight;
    if (out_bytes_per_pixel) *out_bytes_per_pixel = 4;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r12
movq %rdi, %r15
movq 0x10(%rdi), %rax
testq %rax, %rax
jne 0x2d3db
movq %rsi, -0x30(%rbp)
xorl %r13d, %r13d
leaq -0x38(%rbp), %rsi
movq %r15, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x2a990
movl 0x18(%r15), %eax
imull 0x1c(%r15), %eax
shll $0x2, %eax
movslq %eax, %rdi
callq 0x82c4
movq %rax, 0x10(%r15)
leaq -0x38(%rbp), %rcx
movq (%rcx), %rcx
movl 0x1c(%r15), %edx
imull 0x18(%r15), %edx
testl %edx, %edx
jle 0x2d3d7
movzbl (%rcx,%r13), %esi
shll $0x18, %esi
orl $0xffffff, %esi         # imm = 0xFFFFFF
movl %esi, (%rax,%r13,4)
decl %edx
incq %r13
jmp 0x2d3ba
movq -0x30(%rbp), %rsi
movq %rax, (%rsi)
testq %r12, %r12
je 0x2d3eb
movl 0x18(%r15), %eax
movl %eax, (%r12)
testq %r14, %r14
je 0x2d3f7
movl 0x1c(%r15), %eax
movl %eax, (%r14)
testq %rbx, %rbx
je 0x2d402
movl $0x4, (%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: ImFontAtlas::AddFont(ImFontConfig const*)
ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg)
{
    IM_ASSERT(font_cfg->FontData != NULL && font_cfg->FontDataSize > 0);
    IM_ASSERT(font_cfg->SizePixels > 0.0f);

    // Create new font
    if (!font_cfg->MergeMode)
    {
        ImFont* font = (ImFont*)ImGui::MemAlloc(sizeof(ImFont));
        new (font) ImFont();
        Fonts.push_back(font);
    }

    ConfigData.push_back(*font_cfg);
    ImFontConfig& new_font_cfg = ConfigData.back();
    new_font_cfg.DstFont = Fonts.back();
    if (!new_font_cfg.FontDataOwnedByAtlas)
    {
        new_font_cfg.FontData = ImGui::MemAlloc(new_font_cfg.FontDataSize);
        new_font_cfg.FontDataOwnedByAtlas = true;
        memcpy(new_font_cfg.FontData, font_cfg->FontData, (size_t)new_font_cfg.FontDataSize);
    }

    // Invalidate texture
    ClearTexData();
    return Fonts.back();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
cmpq $0x0, (%rsi)
je 0x2d4f1
movq %rsi, %r14
cmpl $0x0, 0x8(%rsi)
jle 0x2d4f1
movss 0x14(%r14), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x2d510
movq %rdi, %rbx
cmpb $0x0, 0x38(%r14)
jne 0x2d477
pushq $0x78
popq %rdi
callq 0x82c4
leaq -0x28(%rbp), %r15
movq %rax, (%r15)
movq %rax, %rdi
callq 0x2e4c6
leaq 0x30(%rbx), %rdi
movq %r15, %rsi
callq 0x1f140
leaq 0x40(%rbx), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x303be
movq %r15, %rdi
callq 0x30418
movq %rax, %r12
leaq 0x30(%rbx), %r15
movq %r15, %rdi
callq 0x1f1c0
movq (%rax), %rax
movq %rax, 0x60(%r12)
cmpb $0x0, 0xc(%r12)
jne 0x2d4d1
movslq 0x8(%r12), %rdi
callq 0x82c4
movq %rax, (%r12)
movb $0x1, 0xc(%r12)
movq (%r14), %rsi
movslq 0x8(%r12), %rdx
movq %rax, %rdi
callq 0x7080
movq %rbx, %rdi
callq 0x2a90c
movq %r15, %rdi
callq 0x1f1c0
movq (%rax), %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x12654(%rip), %rdi     # 0x3fb4c
leaq 0x124a7(%rip), %rsi     # 0x3f9a6
leaq 0x12681(%rip), %rcx     # 0x3fb87
movl $0x41b, %edx            # imm = 0x41B
callq 0x7140
leaq 0x126a3(%rip), %rdi     # 0x3fbba
leaq 0x12488(%rip), %rsi     # 0x3f9a6
leaq 0x12662(%rip), %rcx     # 0x3fb87
movl $0x41c, %edx            # imm = 0x41C
callq 0x7140
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: ImFontAtlas::AddFontFromMemoryCompressedBase85TTF(char const*, float, ImFontConfig const*, unsigned short const*)
ImFont* ImFontAtlas::AddFontFromMemoryCompressedBase85TTF(const char* compressed_ttf_data_base85, float size_pixels, const ImFontConfig* font_cfg, const ImWchar* glyph_ranges)
{
    int compressed_ttf_size = (((int)strlen(compressed_ttf_data_base85) + 4) / 5) * 4;
    void* compressed_ttf = ImGui::MemAlloc(compressed_ttf_size);
    Decode85((const unsigned char*)compressed_ttf_data_base85, (unsigned int*)compressed_ttf);
    ImFont* font = AddFontFromMemoryCompressedTTF(compressed_ttf, compressed_ttf_size, size_pixels, font_cfg, glyph_ranges);
    ImGui::MemFree(compressed_ttf);
    return font;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, -0x38(%rbp)
movq %rdx, %r14
movss %xmm0, -0x2c(%rbp)
movq %rsi, %r12
movq %rdi, %r15
movq %rsi, %rdi
callq 0x7300
addl $0x4, %eax
pushq $0x5
popq %rcx
cltd
idivl %ecx
movl %eax, %r13d
shll $0x2, %r13d
movslq %r13d, %rdi
callq 0x82c4
movq %rax, %rbx
movsbl (%r12), %edx
testl %edx, %edx
je 0x2d60a
xorl %ecx, %ecx
cmpb $0x5c, %dl
setge %cl
xorl $-0x23, %ecx
addl %edx, %ecx
movsbl 0x1(%r12), %esi
xorl %edx, %edx
cmpl $0x5c, %esi
setge %dl
xorl $-0x23, %edx
addl %esi, %edx
movsbl 0x2(%r12), %edi
xorl %esi, %esi
cmpl $0x5c, %edi
setge %sil
xorl $-0x23, %esi
addl %edi, %esi
movsbl 0x3(%r12), %edi
xorl %r8d, %r8d
cmpl $0x5c, %edi
setge %r8b
xorl $-0x23, %r8d
addl %edi, %r8d
movsbl 0x4(%r12), %edi
xorl %r9d, %r9d
cmpl $0x5c, %edi
setge %r9b
xorl $-0x23, %r9d
addl %edi, %r9d
imull $0x55, %r9d, %edi
addl %r8d, %edi
imull $0x55, %edi, %edi
addl %esi, %edi
imull $0x55, %edi, %esi
addl %edx, %esi
imull $0x55, %esi, %edx
addl %ecx, %edx
movl %edx, (%rax)
addq $0x4, %rax
addq $0x5, %r12
jmp 0x2d576
movq %r15, %rdi
movq %rbx, %rsi
movl %r13d, %edx
movss -0x2c(%rbp), %xmm0
movq %r14, %rcx
movq -0x38(%rbp), %r8
callq 0x2d824
movq %rax, %r14
movq %rbx, %rdi
callq 0x8d0c
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: ImFontAtlas::AddFontFromFileTTF(char const*, float, ImFontConfig const*, unsigned short const*)
ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges)
{
    int data_size = 0;
    void* data = ImLoadFileToMemory(filename, "rb", &data_size, 0);
    if (!data)
    {
        IM_ASSERT(0); // Could not load file.
        return NULL;
    }
    ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();
    if (font_cfg.Name[0] == '\0')
    {
        // Store a short copy of filename into into the font name for convenience
        const char* p;
        for (p = filename + strlen(filename); p > filename && p[-1] != '/' && p[-1] != '\\'; p--) {}
        snprintf(font_cfg.Name, IM_ARRAYSIZE(font_cfg.Name), "%s", p);
    }
    return AddFontFromMemoryTTF(data, data_size, size_pixels, &font_cfg, glyph_ranges);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, %rbx
movq %rdx, %r13
movss %xmm0, -0x2c(%rbp)
movq %rsi, %r12
movq %rdi, %r14
leaq -0x30(%rbp), %rdx
andl $0x0, (%rdx)
leaq 0xa3d6(%rip), %rsi      # 0x37a56
movq %r12, %rdi
xorl %ecx, %ecx
callq 0x8bd2
testq %rax, %rax
je 0x2d75f
movq %rax, %r15
testq %r13, %r13
je 0x2d6ba
pushq $0xd
popq %rcx
leaq -0x98(%rbp), %rax
movq %rax, %rdi
movq %r13, %rsi
rep  movsq (%rsi), %es:(%rdi)
cmpb $0x0, 0x3a(%rax)
jne 0x2d733
leaq -0x5e(%rbp), %r13
jmp 0x2d6fa
leaq -0x5e(%rbp), %r13
andq $0x0, -0x3a(%r13)
andl $0x0, -0x32(%r13)
movb $0x1, -0x2e(%r13)
movaps 0xe31c(%rip), %xmm0     # 0x3b9f0
movups %xmm0, -0x2a(%r13)
movb $0x0, -0x1a(%r13)
andq $0x0, -0x16(%r13)
andq $0x0, 0x26(%r13)
xorps %xmm0, %xmm0
movups %xmm0, -0xa(%r13)
movups %xmm0, 0x6(%r13)
movups %xmm0, 0x10(%r13)
movq %r12, %rdi
callq 0x7300
addq %r12, %rax
movq %rax, %rcx
cmpq %r12, %rax
jbe 0x2d71f
movzbl -0x1(%rcx), %edx
cmpl $0x5c, %edx
je 0x2d71f
leaq -0x1(%rcx), %rax
cmpl $0x2f, %edx
jne 0x2d705
leaq 0xdef7(%rip), %rdx      # 0x3b61d
pushq $0x20
popq %rsi
movq %r13, %rdi
xorl %eax, %eax
callq 0x73d0
movl -0x30(%rbp), %edx
leaq -0x98(%rbp), %rcx
movq %r14, %rdi
movq %r15, %rsi
movss -0x2c(%rbp), %xmm0
movq %rbx, %r8
callq 0x2d77e
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa4c9(%rip), %rdi      # 0x37c2f
leaq 0x12239(%rip), %rsi     # 0x3f9a6
leaq 0x1246c(%rip), %rcx     # 0x3fbe0
movl $0x452, %edx            # imm = 0x452
callq 0x7140
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: ImFontAtlas::AddFontFromMemoryTTF(void*, int, float, ImFontConfig const*, unsigned short const*)
ImFont* ImFontAtlas::AddFontFromMemoryTTF(void* ttf_data, int ttf_size, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges)
{
    ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();
    IM_ASSERT(font_cfg.FontData == NULL);
    font_cfg.FontData = ttf_data;
    font_cfg.FontDataSize = ttf_size;
    font_cfg.SizePixels = size_pixels;
    if (glyph_ranges)
        font_cfg.GlyphRanges = glyph_ranges;
    return AddFont(&font_cfg);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rsi, %r9
movq %rdi, %rax
testq %rcx, %rcx
je 0x2d7c9
movq %rcx, %r10
pushq $0xd
popq %rcx
leaq -0x68(%rbp), %r11
movq %r11, %rdi
movq %r10, %rsi
rep  movsq (%rsi), %es:(%rdi)
cmpq $0x0, (%r11)
je 0x2d7fc
leaq 0x12493(%rip), %rdi     # 0x3fc44
leaq 0x121ee(%rip), %rsi     # 0x3f9a6
leaq 0x124a1(%rip), %rcx     # 0x3fc60
movl $0x464, %edx            # imm = 0x464
callq 0x7140
movb $0x1, -0x5c(%rbp)
andl $0x0, -0x58(%rbp)
movabsq $0x100000003, %rcx      # imm = 0x100000003
movq %rcx, -0x50(%rbp)
movb $0x0, -0x48(%rbp)
andq $0x0, -0x44(%rbp)
andq $0x0, -0x8(%rbp)
xorps %xmm1, %xmm1
movups %xmm1, -0x38(%rbp)
movups %xmm1, -0x28(%rbp)
movups %xmm1, -0x1e(%rbp)
movq %r9, -0x68(%rbp)
movl %edx, -0x60(%rbp)
movss %xmm0, -0x54(%rbp)
testq %r8, %r8
je 0x2d811
movq %r8, -0x38(%rbp)
leaq -0x68(%rbp), %rsi
movq %rax, %rdi
callq 0x2d412
addq $0x70, %rsp
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/stb_truetype.h
// Function: stbtt_PackSetOversampling(stbtt_pack_context*, unsigned int, unsigned int)
STBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context *spc, unsigned int h_oversample, unsigned int v_oversample)
{
   STBTT_assert(h_oversample <= STBTT_MAX_OVERSAMPLE);
   STBTT_assert(v_oversample <= STBTT_MAX_OVERSAMPLE);
   if (h_oversample <= STBTT_MAX_OVERSAMPLE)
      spc->h_oversample = h_oversample;
   if (v_oversample <= STBTT_MAX_OVERSAMPLE)
      spc->v_oversample = v_oversample;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x9, %esi
jae 0x2ddf4
cmpl $0x9, %edx
jae 0x2de13
movl %esi, 0x20(%rdi)
movl %edx, 0x24(%rdi)
popq %rbp
retq
leaq 0x120e8(%rip), %rdi     # 0x3fee3
leaq 0x120f3(%rip), %rsi     # 0x3fef5
leaq 0x12103(%rip), %rcx     # 0x3ff0c
movl $0xa79, %edx            # imm = 0xA79
callq 0x7140
leaq 0x12143(%rip), %rdi     # 0x3ff5d
leaq 0x120d4(%rip), %rsi     # 0x3fef5
leaq 0x120e4(%rip), %rcx     # 0x3ff0c
movl $0xa7a, %edx            # imm = 0xA7A
callq 0x7140
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: ImFont::FindGlyph(unsigned short) const
const ImFont::Glyph* ImFont::FindGlyph(unsigned short c) const
{
    if (c < IndexLookup.Size)
    {
        const int i = IndexLookup[c];
        if (i != -1)
            return &Glyphs[i];
    }
    return FallbackGlyph;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl %esi, 0x68(%rdi)
jle 0x2e23c
leaq 0x68(%rbx), %rdi
callq 0x30654
movl (%rax), %esi
cmpl $-0x1, %esi
je 0x2e23c
addq $0x38, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x30688
movq 0x48(%rbx), %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: ImFont::Clear()
void    ImFont::Clear()
{
    FontSize = 0.0f;
    DisplayOffset = ImVec2(0.0f, 1.0f);
    ConfigData = NULL;
    ConfigDataCount = 0;
    Ascent = Descent = 0.0f;
    ContainerAtlas = NULL;
    Glyphs.clear();
    FallbackGlyph = NULL;
    FallbackXAdvance = 0.0f;
    IndexXAdvance.clear();
    IndexLookup.clear();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
andl $0x0, (%rdi)
movabsq $0x3f80000000000000, %rax # imm = 0x3F80000000000000
movq %rax, 0x8(%rdi)
andq $0x0, 0x30(%rdi)
addq $0x38, %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rbx)
andl $0x0, 0x28(%rbx)
callq 0x30592
andq $0x0, 0x48(%rbx)
andl $0x0, 0x50(%rbx)
leaq 0x58(%rbx), %rdi
callq 0x305ba
addq $0x68, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x27a2a
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/stb_rect_pack.h
// Function: rect_height_compare(void const*, void const*)
static int rect_height_compare(const void *a, const void *b)
{
   stbrp_rect *p = (stbrp_rect *) a;
   stbrp_rect *q = (stbrp_rect *) b;
   if (p->h > q->h)
      return -1;
   if (p->h < q->h)
      return  1;
   return (p->w > q->w) ? -1 : (p->w < q->w);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movzwl 0x6(%rsi), %eax
cmpw %ax, 0x6(%rdi)
jbe 0x2ea34
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x2ea52
jae 0x2ea3d
movl $0x1, %eax
jmp 0x2ea52
movzwl 0x4(%rdi), %eax
xorl %ecx, %ecx
cmpw 0x4(%rsi), %ax
setb %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovbel %ecx, %eax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: stb__match(unsigned char*, unsigned int)
static void stb__match(unsigned char *data, unsigned int length)
{
    // INVERSE of memmove... write each byte before copying the next...
    IM_ASSERT (stb__dout + length <= stb__barrier);
    if (stb__dout + length > stb__barrier) { stb__dout += length; return; }
    if (data < stb__barrier4) { stb__dout = stb__barrier+1; return; }
    while (length--) *stb__dout++ = *data++;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x2af9c(%rip), %rax     # 0x5ada0
movl %esi, %ecx
leaq (%rax,%rcx), %rsi
movq 0x2af7f(%rip), %rdx     # 0x5ad90
cmpq %rdx, %rsi
ja 0x2fe4b
cmpq %rdi, 0x2af7b(%rip)     # 0x5ad98
jbe 0x2fe2b
incq %rdx
movq %rdx, 0x2af77(%rip)     # 0x5ada0
popq %rbp
retq
incq %rax
xorl %edx, %edx
cmpl %edx, %ecx
je 0x2fe29
movb (%rdi,%rdx), %sil
movq %rax, 0x2af61(%rip)     # 0x5ada0
movb %sil, -0x1(%rax)
incq %rax
incq %rdx
jmp 0x2fe30
leaq 0x105ed(%rip), %rdi     # 0x4043f
leaq 0xfb4d(%rip), %rsi      # 0x3f9a6
leaq 0x10602(%rip), %rcx     # 0x40462
movl $0x7e3, %edx            # imm = 0x7E3
callq 0x7140
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: stb__lit(unsigned char*, unsigned int)
static void stb__lit(unsigned char *data, unsigned int length)
{
    IM_ASSERT (stb__dout + length <= stb__barrier);
    if (stb__dout + length > stb__barrier) { stb__dout += length; return; }
    if (data < stb__barrier2) { stb__dout = stb__barrier+1; return; }
    memcpy(stb__dout, data, length);
    stb__dout += length;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rax
movq 0x2af26(%rip), %rdi     # 0x5ada0
movl %esi, %edx
leaq (%rdi,%rdx), %rbx
movq 0x2af09(%rip), %rcx     # 0x5ad90
cmpq %rcx, %rbx
ja 0x2feb3
cmpq %rax, 0x2aeed(%rip)     # 0x5ad80
jbe 0x2fe9d
incq %rcx
movq %rcx, %rbx
jmp 0x2fea5
movq %rax, %rsi
callq 0x7080
movq %rbx, 0x2aef4(%rip)     # 0x5ada0
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x10585(%rip), %rdi     # 0x4043f
leaq 0xfae5(%rip), %rsi      # 0x3f9a6
leaq 0x105c9(%rip), %rcx     # 0x40491
movl $0x7eb, %edx            # imm = 0x7EB
callq 0x7140
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui_impl_sdl.cpp
// Function: ImGui_ImplSdl_ProcessEvent(SDL_Event*)
bool ImGui_ImplSdl_ProcessEvent(SDL_Event* event)
{
    ImGuiIO& io = ImGui::GetIO();
    switch (event->type)
    {
    case SDL_MOUSEWHEEL:
        {
            if (event->wheel.y > 0)
                g_MouseWheel = 1;
            if (event->wheel.y < 0)
                g_MouseWheel = -1;
            return true;
        }
    case SDL_MOUSEBUTTONDOWN:
        {
            if (event->button.button == SDL_BUTTON_LEFT) g_MousePressed[0] = true;
            if (event->button.button == SDL_BUTTON_RIGHT) g_MousePressed[1] = true;
            if (event->button.button == SDL_BUTTON_MIDDLE) g_MousePressed[2] = true;
            return true;
        }
    case SDL_TEXTINPUT:
        {
            ImGuiIO& io = ImGui::GetIO();
            io.AddInputCharactersUTF8(event->text.text);
            return true;
        }
    case SDL_KEYDOWN:
    case SDL_KEYUP:
        {
            int key = event->key.keysym.sym & ~SDLK_SCANCODE_MASK;
            io.KeysDown[key] = (event->type == SDL_KEYDOWN);
            io.KeyShift = ((SDL_GetModState() & KMOD_SHIFT) != 0);
            io.KeyCtrl = ((SDL_GetModState() & KMOD_CTRL) != 0);
            io.KeyAlt = ((SDL_GetModState() & KMOD_ALT) != 0);
            return true;
        }
    }
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0xa0f5
movq %rax, %r14
movl (%rbx), %eax
leal -0x300(%rax), %ecx
cmpl $0x2, %ecx
jb 0x30d0e
cmpl $0x303, %eax            # imm = 0x303
je 0x30d76
cmpl $0x401, %eax            # imm = 0x401
je 0x30d58
cmpl $0x403, %eax            # imm = 0x403
jne 0x30d8e
cmpl $0x0, 0x14(%rbx)
jle 0x30d95
movl $0x3f800000, 0x2a0bc(%rip) # imm = 0x3F800000
jmp 0x30d8a
movslq 0x14(%rbx), %rcx
andq $-0x40000001, %rcx      # imm = 0xBFFFFFFF
cmpl $0x300, %eax            # imm = 0x300
sete 0x100(%r14,%rcx)
callq 0x76b0
testb $0x3, %al
setne 0xfe(%r14)
callq 0x76b0
testb $-0x40, %al
setne 0xfd(%r14)
callq 0x76b0
testw $0x300, %ax             # imm = 0x300
setne 0xff(%r14)
jmp 0x30d8a
movzbl 0x10(%rbx), %ecx
movb $0x1, %al
cmpl $0x3, %ecx
je 0x30dae
cmpl $0x2, %ecx
je 0x30da5
cmpl $0x1, %ecx
jne 0x30d90
movb $0x1, 0x2a058(%rip)     # 0x5adcc
jmp 0x30d90
callq 0xa0f5
addq $0xc, %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x7ffc
movb $0x1, %al
jmp 0x30d90
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
movb $0x1, %al
jns 0x30d90
movl $0xbf800000, 0x2a025(%rip) # imm = 0xBF800000
jmp 0x30d90
movb $0x1, 0x2a022(%rip)     # 0x5adce
jmp 0x30d90
movb $0x1, 0x2a018(%rip)     # 0x5adcd
jmp 0x30d90
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui_impl_sdl.cpp
// Function: ImGui_ImplSdl_InvalidateDeviceObjects()
void ImGui_ImplSdl_InvalidateDeviceObjects()
{
    if (g_VboHandle) glDeleteBuffers(1, &g_VboHandle);
    if (g_ElementsHandle) glDeleteBuffers(1, &g_ElementsHandle);

    glDetachShader(g_ShaderHandle, g_VertHandle);
    glDeleteShader(g_VertHandle);
    g_VertHandle = 0;

    glDetachShader(g_ShaderHandle, g_FragHandle);
    glDeleteShader(g_FragHandle);
    g_FragHandle = 0;

    glDeleteProgram(g_ShaderHandle);
    g_ShaderHandle = 0;

    if (g_FontTexture)
    {
        glDeleteTextures(1, &g_FontTexture);
        ImGui::GetIO().Fonts->TexID = 0;
        g_FontTexture = 0;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x0, 0x29d85(%rip)     # 0x5adb4
je 0x31040
leaq 0x29d7c(%rip), %rsi     # 0x5adb4
pushq $0x1
popq %rdi
callq 0x7810
cmpl $0x0, 0x29d7d(%rip)     # 0x5adc4
je 0x31058
leaq 0x29d74(%rip), %rsi     # 0x5adc4
pushq $0x1
popq %rdi
callq 0x7810
movl 0x29d4a(%rip), %edi     # 0x5ada8
movl 0x29d6c(%rip), %esi     # 0x5add0
callq 0x73b0
movl 0x29d61(%rip), %edi     # 0x5add0
callq 0x7800
andl $0x0, 0x29d55(%rip)     # 0x5add0
movl 0x29d27(%rip), %edi     # 0x5ada8
movl 0x29d4d(%rip), %esi     # 0x5add4
callq 0x73b0
movl 0x29d42(%rip), %edi     # 0x5add4
callq 0x7800
andl $0x0, 0x29d36(%rip)     # 0x5add4
movl 0x29d04(%rip), %edi     # 0x5ada8
callq 0x75e0
andl $0x0, 0x29cf8(%rip)     # 0x5ada8
xorl %eax, %eax
cmpl %eax, 0x29d20(%rip)     # 0x5add8
je 0x310e0
leaq 0x29d17(%rip), %rsi     # 0x5add8
pushq $0x1
popq %rdi
callq 0x7780
callq 0xa0f5
movq 0x88(%rax), %rax
andq $0x0, (%rax)
andl $0x0, 0x29cf8(%rip)     # 0x5add8
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/joypad.cpp
// Function: Joypad::read(unsigned char)
u8 Joypad::read(u8 request) {
  // Directions
  if (!bitTest(request, 5)) {
    return directions;
  }

  // Buttons
  else if (!bitTest(request, 4)) {
    return buttons;
  }

  return 0xFF;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testb $0x20, %sil
jne 0x314af
movb 0x1(%rdi), %al
jmp 0x314ba
andl $0x10, %esi
xorl %eax, %eax
negl %esi
sbbl %eax, %eax
orb (%rdi), %al
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/mmu.cpp
// Function: MMU::reset()
void MMU::reset() {
  memory.resize(0x10000, 0);
  ram.resize(0x2000, 0);  // external RAM

  // Setup MBC info
  mbc.romOffset = 0x4000;
  mbc.romBank = 0;
  mbc.mode = 0;
  mbc.ramOffset = 0;
  mbc.type = 0;  // this will be determined in load()
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
addq $0x8, %rdi
xorl %r14d, %r14d
leaq -0x12(%rbp), %rdx
movb %r14b, (%rdx)
movl $0x10000, %esi          # imm = 0x10000
callq 0x31942
leaq 0x50(%rbx), %rdi
leaq -0x11(%rbp), %rdx
movb %r14b, (%rdx)
movl $0x2000, %esi           # imm = 0x2000
callq 0x31942
movl $0x4000, 0x2(%rbx)      # imm = 0x4000
movb %r14b, 0x6(%rbx)
andw $0x0, (%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/mmu.cpp
// Function: MMU::load(char*)
bool MMU::load(char *filename) {
  romFilename = filename;

  std::ifstream file;
  file.open(filename, std::ios::binary);
  if (!file.is_open()) {
    return false;
  }

  // Get file size and read ROM into vector
  file.seekg(0, file.end);
  u32 romSize = file.tellg();
  rom.resize(romSize, 0);
  file.seekg(0, file.beg);
  file.read((char *)(&rom[0]), romSize);
  file.close();

  // Map ROM to memory
  memory.assign(rom.begin(),
                rom.begin() + (0x7FFF > rom.size() ? rom.size() : 0x7FFF));

  // Get MBC type from ROM header
  mbc.type = rom[0x147];

  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, 0x68(%rdi)
leaq -0x230(%rbp), %r15
movq %r15, %rdi
callq 0x72b0
pushq $0x4
popq %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x7540
leaq -0x1b8(%rbp), %rdi
callq 0x7750
movl %eax, %r14d
testb %al, %al
je 0x31664
leaq -0x230(%rbp), %rdi
pushq $0x2
popq %rdx
xorl %esi, %esi
callq 0x7260
leaq -0x230(%rbp), %rdi
callq 0x7100
leaq 0x38(%rbx), %r12
movl %eax, %r15d
leaq -0x21(%rbp), %rdx
movb $0x0, (%rdx)
movq %r12, %rdi
movq %r15, %rsi
callq 0x31942
leaq -0x230(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x7260
movq (%r12), %rsi
leaq -0x230(%rbp), %rdi
movq %r15, %rdx
callq 0x7390
leaq -0x230(%rbp), %rdi
callq 0x74a0
leaq 0x8(%rbx), %rdi
movq 0x38(%rbx), %rsi
movq 0x40(%rbx), %rdx
subq %rsi, %rdx
movl $0x7fff, %eax           # imm = 0x7FFF
cmpq %rax, %rdx
cmovaeq %rax, %rdx
addq %rsi, %rdx
callq 0x31bbe
movq 0x38(%rbx), %rax
movb 0x147(%rax), %al
movb %al, (%rbx)
leaq -0x230(%rbp), %rdi
callq 0x7040
movl %r14d, %eax
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3168b
jmp 0x3168b
jmp 0x3168b
jmp 0x3168b
movq %rax, %rbx
leaq -0x230(%rbp), %rdi
callq 0x7040
movq %rbx, %rdi
callq 0x74b0
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/mmu.cpp
// Function: MMU::read8(unsigned short)
u8 MMU::read8(u16 addr) {
  // ROM, switched bank
  if (addr >= 0x4000 && addr <= 0x7FFF) {
    return rom[mbc.romOffset + (addr & 0x3FFF)];
  }

  // RAM, switched bank
  else if (addr >= 0xA000 && addr <= 0x8FFF) {
    return ram[mbc.ramOffset + (addr & 0x1FFF)];
  }

  // Shadow of working RAM, less final 512 bytes
  else if (addr >= 0xE000 && addr <= 0xFDFF) {
    return memory[addr - 0x1000];
  }

  // Joypad
  else if (addr == 0xFF00) {
    return joypad->read(memory[0xFF00]);
  }

  // Default
  else {
    return memory[addr];
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpw $0x4000, %si            # imm = 0x4000
jl 0x316c3
movzwl 0x2(%rdi), %eax
movzwl %si, %ecx
andl $0x3fff, %ecx           # imm = 0x3FFF
addq 0x38(%rdi), %rcx
movb (%rax,%rcx), %al
jmp 0x31705
leal 0x2000(%rsi), %eax
cmpw $0x1dff, %ax            # imm = 0x1DFF
ja 0x316df
movq 0x8(%rdi), %rax
movzwl %si, %ecx
movb -0x1000(%rax,%rcx), %al
jmp 0x31705
cmpw $0xff00, %si            # imm = 0xFF00
jne 0x316fb
movq 0x8(%rdi), %rax
movq 0x70(%rdi), %rdi
movzbl 0xff00(%rax), %esi
popq %rbp
jmp 0x314a0
movzwl %si, %eax
movq 0x8(%rdi), %rcx
movb (%rcx,%rax), %al
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/gpu.cpp
// Function: GPU::reset()
void GPU::reset() {
  width = 160;
  height = 144;
  scanline = 0;
  mmu->memory[LY] = scanline;
  mmu->memory[STAT] = 0x84;
  modeclock = 0;
  memset(screenData, 0xFF, sizeof(screenData));
  vsync = false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movabsq $0x90000000a0, %rax     # imm = 0x90000000A0
movq %rax, 0x14(%rdi)
xorl %r14d, %r14d
movb %r14b, 0x10(%rdi)
movq (%rdi), %rax
movq 0x8(%rax), %rax
movb %r14b, 0xff44(%rax)
movq (%rdi), %rax
movq 0x8(%rax), %rax
movb $-0x7c, 0xff41(%rax)
andl $0x0, 0x8(%rdi)
addq $0x1d, %rdi
movl $0x10e00, %edx          # imm = 0x10E00
movl $0xff, %esi
callq 0x7210
movb %r14b, 0x1c(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/gpu.cpp
// Function: GPU::renderScanline()
void GPU::renderScanline() {
  u8 control = mmu->memory[LCDC];
  if (bitTest(control, LCDC_BG_ENABLE)) {
    renderBackground();
  }
  if (bitTest(control, LCDC_OBJ_ENABLE)) {
    renderSprites();
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rax
movq 0x8(%rax), %rax
movzbl 0xff40(%rax), %r14d
testb $0x1, %r14b
je 0x31f33
movq %rbx, %rdi
callq 0x31f7c
testb $0x2, %r14b
jne 0x31f3e
popq %rbx
popq %r14
popq %rbp
retq
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x320ac
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/cpu.cpp
// Function: CPU::updateDivider(unsigned char)
void CPU::updateDivider(u8 cycles) {
  timerCounter += cycles;
  if (timerCounter >= 256) {
    timerCounter = 0;
    mmu.memory[DIV] = 0;
  } else {
    mmu.memory[DIV]++;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
addl 0x2a4(%rdi), %esi
movl %esi, 0x2a4(%rdi)
cmpl $0x100, %esi            # imm = 0x100
jl 0x34046
andl $0x0, 0x2a4(%rdi)
movq 0x20(%rdi), %rax
movb $0x0, 0xff04(%rax)
jmp 0x34050
movq 0x20(%rdi), %rax
incb 0xff04(%rax)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/cpu.cpp
// Function: CPU::updateTimer(unsigned char)
void CPU::updateTimer(u8 cycles) {
  // Return if timer disabled
  if (!bitTest(mmu.memory[TAC], 2)) {
    return;
  }

  // Handle timer input clock selection changes
  if (timerMode != (mmu.memory[TAC] & 0x3)) {
    timerMode = mmu.memory[TAC] & 0x3;
    switch (timerMode) {
      case 0:
        timerCycles = 1024;  // clock / inc rate == 4194304÷4096 == 1024 cycles
        break;
      case 1:
        timerCycles = 16;
        break;
      case 2:
        timerCycles = 64;
        break;
      case 3:
        timerCycles = 256;
        break;
      default:
        break;
    }
  }

  timerCounter += cycles;

  if (timerCounter >= timerCycles) {
    timerCounter = 0;
    // Check for timer overflow
    if (mmu.memory[TIMA] >= 0xFF) {
      mmu.memory[TIMA] = 0;
      // Request interrupt
      // todo: I think there is a 4 cycle delay here
      bitSet(mmu.memory[IF], 2);
    } else {
      mmu.memory[TIMA]++;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x20(%rdi), %rax
movzbl 0xff07(%rax), %ecx
testb $0x4, %cl
je 0x340e3
andl $0x3, %ecx
cmpl %ecx, 0x29c(%rdi)
jne 0x340a7
movl 0x2a0(%rdi), %ecx
movzbl %sil, %edx
addl 0x2a4(%rdi), %edx
movl %edx, 0x2a4(%rdi)
cmpl %ecx, %edx
jl 0x340e3
andl $0x0, 0x2a4(%rdi)
movb 0xff05(%rax), %cl
cmpb $-0x1, %cl
je 0x340d1
incb %cl
movb %cl, 0xff05(%rax)
jmp 0x340e3
movl %ecx, 0x29c(%rdi)
movzbl %cl, %ecx
leaq 0xdc5d(%rip), %rdx      # 0x41d14
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl $0x400, 0x2a0(%rdi)     # imm = 0x400
movl $0x400, %ecx            # imm = 0x400
jmp 0x34077
movb $0x0, 0xff05(%rax)
movq 0x20(%rdi), %rax
orb $0x4, 0xff0f(%rax)
popq %rbp
retq
movl $0x40, 0x2a0(%rdi)
movl $0x40, %ecx
jmp 0x34077
movl $0x100, 0x2a0(%rdi)     # imm = 0x100
movl $0x100, %ecx            # imm = 0x100
jmp 0x34077
movl $0x10, 0x2a0(%rdi)
movl $0x10, %ecx
jmp 0x34077
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/cpu.cpp
// Function: CPU::checkInterrupts()
void CPU::checkInterrupts() {
  if (!ime || eiDelay) {  // IME disabled or the last instruction was EI
    eiDelay = false;
    return;
  }
  u8 requested = mmu.read8(IF);
  if (requested > 0) {
    u8 enabled = mmu.read8(IE);
    for (u8 i = 0; i < 5; i++) {
      if (bitTest(requested, i)) {
        if (bitTest(enabled, i)) {
          doInterrupt(i);
        }
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x1, 0x10(%rdi)
jne 0x3413b
cmpb $0x1, 0x11(%rbx)
jne 0x3414e
movb $0x0, 0x11(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18(%rbx), %r14
movq %r14, %rdi
movl $0xff0f, %esi           # imm = 0xFF0F
callq 0x316a2
testb %al, %al
je 0x3413f
movl %eax, %r15d
movq %r14, %rdi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x316a2
movzbl %r15b, %r15d
movzbl %al, %r12d
xorl %r14d, %r14d
pushq $0x1
popq %r13
cmpl $0x5, %r14d
je 0x3413f
movl %r13d, %eax
movl %r14d, %ecx
shll %cl, %eax
btl %r14d, %r15d
jae 0x341a7
andl %r12d, %eax
je 0x341a7
movzbl %r14b, %esi
movq %rbx, %rdi
callq 0x341ac
incl %r14d
jmp 0x34182
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/cpu.cpp
// Function: CPU::doInterrupt(unsigned char)
void CPU::doInterrupt(u8 interrupt) {
  ime = false;  // IME = disabled

  // Reset bit in Interrupt Request Register
  u8 flags = mmu.memory[IF];
  bitClear(flags, interrupt);
  mmu.memory[IF] = flags;

  reg.sp -= 2;
  mmu.write16(reg.sp, reg.pc);  // Push PC to the stack

  // Interrupts have specific service routines at defined memory locations
  switch (interrupt) {
    case 0:
      reg.pc = 0x40;
      break;

    case 1:
      reg.pc = 0x48;
      break;

    case 2:
      reg.pc = 0x50;
      break;

    case 4:
      reg.pc = 0x60;
      break;

    default:
      break;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
movb $0x0, 0x10(%rdi)
addq $0x18, %rdi
movq 0x20(%rbx), %rax
pushq $0x1
popq %rdx
movl %r14d, %ecx
shll %cl, %edx
notb %dl
andb %dl, 0xff0f(%rax)
movzwl 0xa(%rbx), %eax
addl $-0x2, %eax
movw %ax, 0xa(%rbx)
movzwl 0x8(%rbx), %edx
movzwl %ax, %esi
callq 0x3190a
cmpb $0x4, %r14b
ja 0x3420d
movzbl %r14b, %eax
pushq $0x17
popq %rcx
btl %eax, %ecx
jae 0x3420d
leaq 0xdb1f(%rip), %rcx      # 0x41d24
movzwl (%rcx,%rax,2), %eax
movw %ax, 0x8(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/cpu.cpp
// Function: void CPU::incrementReg<unsigned char>(unsigned char&)
void CPU::incrementReg(t &reg1) {
  reg1++;
  bool carry = bitTest(reg.f, FLAG_CARRY);
  reg.f = 0;
  if (carry) {
    bitSet(reg.f, FLAG_CARRY);
  }
  if (reg1 == 0) {
    bitSet(reg.f, FLAG_ZERO);
  }
  if ((reg1 & 0xF) == 0) {
    bitSet(reg.f, FLAG_HALF_CARRY);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
incb (%rsi)
movb (%rdi), %al
andb $0x10, %al
movb %al, (%rdi)
movb (%rsi), %cl
testb %cl, %cl
jne 0x34260
orb $-0x80, %al
movb %al, (%rdi)
movb (%rsi), %cl
testb $0xf, %cl
jne 0x34269
orb $0x20, %al
movb %al, (%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/cpu.cpp
// Function: void CPU::decrementReg<unsigned char>(unsigned char&)
void CPU::decrementReg(t &reg1) {
  reg1--;
  bool carry = bitTest(reg.f, FLAG_CARRY);
  reg.f = 0;
  bitSet(reg.f, FLAG_SUBTRACT);
  if (carry) {
    bitSet(reg.f, FLAG_CARRY);
  }
  if (reg1 == 0) {
    bitSet(reg.f, FLAG_ZERO);
  }
  if ((reg1 & 0xF) == 0xF) {
    bitSet(reg.f, FLAG_HALF_CARRY);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
decb (%rsi)
movb (%rdi), %cl
andb $0x10, %cl
leal 0x40(%rcx), %eax
movb %al, (%rdi)
movb (%rsi), %dl
testb %dl, %dl
jne 0x3428b
orb $-0x40, %cl
movb %cl, (%rdi)
movb (%rsi), %dl
movl %ecx, %eax
notb %dl
testb $0xf, %dl
jne 0x34296
orb $0x20, %al
movb %al, (%rdi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/cpu.cpp
// Function: void CPU::rotateLeftCarry<unsigned short>(unsigned short&)
void CPU::rotateLeftCarry(t &reg1) {
  reg.f = 0;
  // High bit is shifted into carry flag
  if (bitTest(reg1, 7)) {
    bitSet(reg.f, FLAG_CARRY);
  }
  reg.a <<= 1;  // Shift register left, low bit becomes 0
  if (bitTest(reg.f, FLAG_CARRY)) {
    reg1++;
  }
  if (reg1 == 0) {
    bitSet(reg.f, FLAG_ZERO);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb $0x0, (%rdi)
movb (%rsi), %cl
movl %ecx, %eax
shrb $0x3, %al
andb $0x10, %al
movb %al, (%rdi)
shlb 0x1(%rdi)
movzwl (%rsi), %eax
testb %cl, %cl
jns 0x342b9
incl %eax
movw %ax, (%rsi)
testw %ax, %ax
jne 0x342c1
orb $-0x80, (%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/cpu.cpp
// Function: void CPU::add16<unsigned short>(unsigned short&, unsigned short)
void CPU::add16(t &reg1, t n) {
  bool zero = bitTest(reg.f, FLAG_ZERO);
  reg.f = 0;
  if ((reg1 + n) > 0xFFFF) {
    bitSet(reg.f, FLAG_CARRY);
  }
  if ((reg1 & 0x0FFF) + (n & 0x0FFF) > 0x0FFF) {
    bitSet(reg.f, FLAG_HALF_CARRY);
  }
  bitClear(reg.f, FLAG_SUBTRACT);
  reg1 += n;
  if (zero) {
    bitSet(reg.f, FLAG_ZERO);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb (%rdi), %al
movb $0x0, (%rdi)
movzwl (%rsi), %ecx
addl %edx, %ecx
cmpl $0x10000, %ecx          # imm = 0x10000
setae %cl
shlb $0x4, %cl
movb %cl, (%rdi)
movzwl (%rsi), %r8d
movl $0xfff, %r9d            # imm = 0xFFF
andl %r9d, %r8d
movl %edx, %r10d
andl %r9d, %r10d
addl %r8d, %r10d
leal 0x20(%rcx), %r8d
cmpl $0x1000, %r10d          # imm = 0x1000
movzbl %cl, %ecx
movzbl %r8b, %r8d
cmovbl %ecx, %r8d
movb %r8b, (%rdi)
addw %dx, (%rsi)
testb %al, %al
jns 0x34319
orb $-0x80, (%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/cpu.cpp
// Function: void CPU::rotateRightCarry<unsigned char>(unsigned char&)
void CPU::rotateRightCarry(t &reg1) {
  reg.f = 0;
  // Low bit of register is shifted into carry flag
  if (bitTest(reg1, 1)) {
    bitSet(reg.f, FLAG_CARRY);
  }
  reg1 >>= 1;  // Shift register right, high bit becomes 0
  if (bitTest(reg.f, FLAG_CARRY)) {
    bitSet(reg1, 7);  // Carry flag shifts into high bit of register
  }
  if (reg1 == 0) {
    bitSet(reg.f, FLAG_ZERO);
  }
}

// Assembly:
movb $0x0, (%rdi)
movb (%rsi), %al
shlb $0x3, %al
andb $0x10, %al
movb %al, (%rdi)
movb (%rsi), %cl
movl %ecx, %eax
shrb %al
movb %al, (%rsi)
movb (%rdi), %dl
testb $0x10, %dl
jne 0x34341
movl %edx, %eax
movq %rdi, %rsi
cmpb $0x1, %cl
ja 0x3434a
pushq %rbp
movq %rsp, %rbp
orb $-0x80, %al
movb %al, (%rsi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/cpu.cpp
// Function: void CPU::rotateLeft<unsigned char>(unsigned char&)
void CPU::rotateLeft(t &reg1) {
  bool prevCarry = bitTest(reg.f, FLAG_CARRY);
  reg.f = 0;
  bool carry = bitTest(reg1, 7);
  reg1 <<= 1;
  reg1 += prevCarry;
  if (carry) {
    bitSet(reg.f, FLAG_CARRY);
  }
  if (reg1 == 0) {
    bitSet(reg.f, FLAG_ZERO);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb (%rdi), %al
movb $0x0, (%rdi)
movb (%rsi), %cl
leal (%rcx,%rcx), %edx
shrb $0x4, %al
andb $0x1, %al
orb %dl, %al
movb %al, (%rsi)
testb %cl, %cl
jns 0x3436c
orb $0x10, (%rdi)
movb (%rsi), %al
testb %al, %al
jne 0x34373
orb $-0x80, (%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/cpu.cpp
// Function: void CPU::rotateRight<unsigned char>(unsigned char&)
void CPU::rotateRight(t &reg1) {
  bool prevCarry = bitTest(reg.f, FLAG_CARRY);
  reg.f = 0;
  bool carry = bitTest(reg1, 0);
  reg1 >>= 1;
  reg1 += (prevCarry << 7);
  if (carry) {
    bitSet(reg.f, FLAG_CARRY);
  }
  if (reg1 == 0) {
    bitSet(reg.f, FLAG_ZERO);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb (%rdi), %al
movb $0x0, (%rdi)
movb (%rsi), %cl
movl %ecx, %edx
shrb %dl
shlb $0x3, %al
andb $-0x80, %al
orb %dl, %al
movb %al, (%rsi)
testb $0x1, %cl
je 0x34398
orb $0x10, (%rdi)
movb (%rsi), %al
testb %al, %al
jne 0x3439f
orb $-0x80, (%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/cpu.cpp
// Function: void CPU::add<unsigned char>(unsigned char)
void CPU::add(t n) {
  reg.f = 0;
  if ((reg.a + n) > 0xFF) {
    bitSet(reg.f, FLAG_CARRY);
  }
  if ((reg.a & 0xF) + (n & 0xF) > 0xF) {
    bitSet(reg.f, FLAG_HALF_CARRY);
  }
  bitClear(reg.f, FLAG_SUBTRACT);
  reg.a += n;
  if (reg.a == 0) {
    bitSet(reg.f, FLAG_ZERO);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movzbl 0x1(%rdi), %ecx
leal (%rcx,%rsi), %eax
cmpl $0x100, %eax            # imm = 0x100
setae %al
shlb $0x4, %al
movl %ecx, %edx
andl $0xf, %edx
movl %esi, %r8d
andl $0xf, %r8d
addl %edx, %r8d
leal 0x20(%rax), %edx
cmpl $0x10, %r8d
movzbl %al, %r8d
movzbl %dl, %eax
cmovbl %r8d, %eax
movb %al, (%rdi)
addb %sil, %cl
movb %cl, 0x1(%rdi)
jne 0x343e7
orb $-0x80, %al
movb %al, (%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/cpu.cpp
// Function: void CPU::addCarry<unsigned char>(unsigned char)
void CPU::addCarry(t n) {
  u8 prevCarry = bitTest(reg.f, FLAG_CARRY);
  reg.f = 0;

  if (reg.a + n + prevCarry > 0xFF) {
    bitSet(reg.f, FLAG_CARRY);
  }

  if ((reg.a & 0x0F) + (n & 0x0F) + prevCarry > 0x0F) {
    bitSet(reg.f, FLAG_HALF_CARRY);
  }

  reg.a += n + prevCarry;

  if (reg.a == 0) {
    bitSet(reg.f, FLAG_ZERO);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl (%rdi), %ecx
movb $0x0, (%rdi)
movzbl 0x1(%rdi), %eax
leal (%rax,%rsi), %edx
shrl $0x4, %ecx
andl $0x1, %ecx
addl %ecx, %edx
cmpl $0x100, %edx            # imm = 0x100
setae %r8b
shlb $0x4, %r8b
movl %eax, %r10d
andl $0xf, %r10d
movl %esi, %r9d
andl $0xf, %r9d
addl %r10d, %r9d
addl %ecx, %r9d
leal 0x20(%r8), %r10d
cmpl $0x10, %r9d
movzbl %r8b, %r11d
movzbl %r10b, %r8d
cmovbl %r11d, %r8d
cmpl $0xff, %edx
ja 0x34446
cmpl $0x10, %r9d
jb 0x34449
movb %r8b, (%rdi)
addl %esi, %ecx
addb %al, %cl
movb %cl, 0x1(%rdi)
jne 0x34459
orb $-0x80, %r8b
movb %r8b, (%rdi)
popq %rbp
retq
nop