// File: donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: ImFontAtlas::Build()
bool    ImFontAtlas::Build()
{
    IM_ASSERT(ConfigData.Size > 0);

    TexID = NULL;
    TexWidth = TexHeight = 0;
    TexUvWhitePixel = ImVec2(0, 0);
    ClearTexData();

    struct ImFontTempBuildData
    {
        stbtt_fontinfo      FontInfo;
        stbrp_rect*         Rects;
        stbtt_pack_range*   Ranges;
        int                 RangesCount;
    };
    ImFontTempBuildData* tmp_array = (ImFontTempBuildData*)ImGui::MemAlloc((size_t)ConfigData.Size * sizeof(ImFontTempBuildData));

    // Initialize font information early (so we can error without any cleanup) + count glyphs
    int total_glyph_count = 0;
    int total_glyph_range_count = 0;
    for (int input_i = 0; input_i < ConfigData.Size; input_i++)
    {
        ImFontConfig& cfg = ConfigData[input_i];
        ImFontTempBuildData& tmp = tmp_array[input_i];

        IM_ASSERT(cfg.DstFont && (!cfg.DstFont->IsLoaded() || cfg.DstFont->ContainerAtlas == this));
        const int font_offset = stbtt_GetFontOffsetForIndex((unsigned char*)cfg.FontData, cfg.FontNo);
        IM_ASSERT(font_offset >= 0);
        if (!stbtt_InitFont(&tmp.FontInfo, (unsigned char*)cfg.FontData, font_offset))
            return false;

        // Count glyphs
        if (!cfg.GlyphRanges)
            cfg.GlyphRanges = GetGlyphRangesDefault();
        for (const ImWchar* in_range = cfg.GlyphRanges; in_range[0] && in_range[1]; in_range += 2)
        {
            total_glyph_count += (in_range[1] - in_range[0]) + 1;
            total_glyph_range_count++;
        }
    }

    // Start packing
    TexWidth = (TexDesiredWidth > 0) ? TexDesiredWidth : (total_glyph_count > 2000) ? 2048 : (total_glyph_count > 1000) ? 1024 : 512;  // Width doesn't actually matters much but some API/GPU have texture size limitations, and increasing width can decrease height.
    TexHeight = 0;
    const int max_tex_height = 1024*32;
    stbtt_pack_context spc;
    stbtt_PackBegin(&spc, NULL, TexWidth, max_tex_height, 0, 1, NULL);

    // Pack our extra data rectangles first, so it will be on the upper-left corner of our texture (UV will have small values).
    ImVector<stbrp_rect> extra_rects;
    RenderCustomTexData(0, &extra_rects);
    stbtt_PackSetOversampling(&spc, 1, 1);
    stbrp_pack_rects((stbrp_context*)spc.pack_info, &extra_rects[0], extra_rects.Size);
    for (int i = 0; i < extra_rects.Size; i++)
        if (extra_rects[i].was_packed)
            TexHeight = ImMax(TexHeight, extra_rects[i].y + extra_rects[i].h);

    // Allocate packing character data and flag packed characters buffer as non-packed (x0=y0=x1=y1=0)
    int buf_packedchars_n = 0, buf_rects_n = 0, buf_ranges_n = 0;
    stbtt_packedchar* buf_packedchars = (stbtt_packedchar*)ImGui::MemAlloc(total_glyph_count * sizeof(stbtt_packedchar));
    stbrp_rect* buf_rects = (stbrp_rect*)ImGui::MemAlloc(total_glyph_count * sizeof(stbrp_rect));
    stbtt_pack_range* buf_ranges = (stbtt_pack_range*)ImGui::MemAlloc(total_glyph_range_count * sizeof(stbtt_pack_range));
    memset(buf_packedchars, 0, total_glyph_count * sizeof(stbtt_packedchar));
    memset(buf_rects, 0, total_glyph_count * sizeof(stbrp_rect));              // Unnecessary but let's clear this for the sake of sanity.
    memset(buf_ranges, 0, total_glyph_range_count * sizeof(stbtt_pack_range));

    // First font pass: pack all glyphs (no rendering at this point, we are working with rectangles in an infinitely tall texture at this point)
    for (int input_i = 0; input_i < ConfigData.Size; input_i++)
    {
        ImFontConfig& cfg = ConfigData[input_i];
        ImFontTempBuildData& tmp = tmp_array[input_i];

        // Setup ranges
        int glyph_count = 0;
        int glyph_ranges_count = 0;
        for (const ImWchar* in_range = cfg.GlyphRanges; in_range[0] && in_range[1]; in_range += 2)
        {
            glyph_count += (in_range[1] - in_range[0]) + 1;
            glyph_ranges_count++;
        }
        tmp.Ranges = buf_ranges + buf_ranges_n;
        tmp.RangesCount = glyph_ranges_count;
        buf_ranges_n += glyph_ranges_count;
        for (int i = 0; i < glyph_ranges_count; i++)
        {
            const ImWchar* in_range = &cfg.GlyphRanges[i * 2];
            stbtt_pack_range& range = tmp.Ranges[i];
            range.font_size = cfg.SizePixels;
            range.first_unicode_codepoint_in_range = in_range[0];
            range.num_chars = (in_range[1] - in_range[0]) + 1;
            range.chardata_for_range = buf_packedchars + buf_packedchars_n;
            buf_packedchars_n += range.num_chars;
        }

        // Pack
        tmp.Rects = buf_rects + buf_rects_n;
        buf_rects_n += glyph_count;
        stbtt_PackSetOversampling(&spc, cfg.OversampleH, cfg.OversampleV);
        int n = stbtt_PackFontRangesGatherRects(&spc, &tmp.FontInfo, tmp.Ranges, tmp.RangesCount, tmp.Rects);
        stbrp_pack_rects((stbrp_context*)spc.pack_info, tmp.Rects, n);

        // Extend texture height
        for (int i = 0; i < n; i++)
            if (tmp.Rects[i].was_packed)
                TexHeight = ImMax(TexHeight, tmp.Rects[i].y + tmp.Rects[i].h);
    }
    IM_ASSERT(buf_rects_n == total_glyph_count);
    IM_ASSERT(buf_packedchars_n == total_glyph_count);
    IM_ASSERT(buf_ranges_n == total_glyph_range_count);

    // Create texture
    TexHeight = ImUpperPowerOfTwo(TexHeight);
    TexPixelsAlpha8 = (unsigned char*)ImGui::MemAlloc(TexWidth * TexHeight);
    memset(TexPixelsAlpha8, 0, TexWidth * TexHeight);
    spc.pixels = TexPixelsAlpha8;
    spc.height = TexHeight;

    // Second pass: render characters
    for (int input_i = 0; input_i < ConfigData.Size; input_i++)
    {
        ImFontConfig& cfg = ConfigData[input_i];
        ImFontTempBuildData& tmp = tmp_array[input_i];
        stbtt_PackSetOversampling(&spc, cfg.OversampleH, cfg.OversampleV);
        stbtt_PackFontRangesRenderIntoRects(&spc, &tmp.FontInfo, tmp.Ranges, tmp.RangesCount, tmp.Rects);
        tmp.Rects = NULL;
    }

    // End packing
    stbtt_PackEnd(&spc);
    ImGui::MemFree(buf_rects);
    buf_rects = NULL;

    // Third pass: setup ImFont and glyphs for runtime
    for (int input_i = 0; input_i < ConfigData.Size; input_i++)
    {
        ImFontConfig& cfg = ConfigData[input_i];
        ImFontTempBuildData& tmp = tmp_array[input_i];
        ImFont* dst_font = cfg.DstFont;

        float font_scale = stbtt_ScaleForPixelHeight(&tmp.FontInfo, cfg.SizePixels);
        int unscaled_ascent, unscaled_descent, unscaled_line_gap;
        stbtt_GetFontVMetrics(&tmp.FontInfo, &unscaled_ascent, &unscaled_descent, &unscaled_line_gap);

        float ascent = unscaled_ascent * font_scale;
        float descent = unscaled_descent * font_scale;
        if (!cfg.MergeMode)
        {
            dst_font->ContainerAtlas = this;
            dst_font->ConfigData = &cfg;
            dst_font->ConfigDataCount = 0;
            dst_font->FontSize = cfg.SizePixels;
            dst_font->Ascent = ascent;
            dst_font->Descent = descent;
            dst_font->Glyphs.resize(0);
        }
        dst_font->ConfigDataCount++;
        float off_y = (cfg.MergeMode && cfg.MergeGlyphCenterV) ? (ascent - dst_font->Ascent) * 0.5f : 0.0f;

        dst_font->FallbackGlyph = NULL; // Always clear fallback so FindGlyph can return NULL. It will be set again in BuildLookupTable()
        for (int i = 0; i < tmp.RangesCount; i++)
        {
            stbtt_pack_range& range = tmp.Ranges[i];
            for (int char_idx = 0; char_idx < range.num_chars; char_idx += 1)
            {
                const stbtt_packedchar& pc = range.chardata_for_range[char_idx];
                if (!pc.x0 && !pc.x1 && !pc.y0 && !pc.y1)
                    continue;

                const int codepoint = range.first_unicode_codepoint_in_range + char_idx;
                if (cfg.MergeMode && dst_font->FindGlyph((unsigned short)codepoint))
                    continue;

                stbtt_aligned_quad q;
                float dummy_x = 0.0f, dummy_y = 0.0f;
                stbtt_GetPackedQuad(range.chardata_for_range, TexWidth, TexHeight, char_idx, &dummy_x, &dummy_y, &q, 0);

                dst_font->Glyphs.resize(dst_font->Glyphs.Size + 1);
                ImFont::Glyph& glyph = dst_font->Glyphs.back();
                glyph.Codepoint = (ImWchar)codepoint;
                glyph.X0 = q.x0; glyph.Y0 = q.y0; glyph.X1 = q.x1; glyph.Y1 = q.y1;
                glyph.U0 = q.s0; glyph.V0 = q.t0; glyph.U1 = q.s1; glyph.V1 = q.t1;
                glyph.Y0 += (float)(int)(dst_font->Ascent + off_y + 0.5f);
                glyph.Y1 += (float)(int)(dst_font->Ascent + off_y + 0.5f);
                glyph.XAdvance = (pc.xadvance + cfg.GlyphExtraSpacing.x);  // Bake spacing into XAdvance
                if (cfg.PixelSnapH)
                    glyph.XAdvance = (float)(int)(glyph.XAdvance + 0.5f);
            }
        }
        cfg.DstFont->BuildLookupTable();
    }

    // Cleanup temporaries
    ImGui::MemFree(buf_packedchars);
    ImGui::MemFree(buf_ranges);
    ImGui::MemFree(tmp_array);

    // Render into our custom data block
    RenderCustomTexData(1, &extra_rects);

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2a0, %rsp            # imm = 0x2A0
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1d0(%rbp)
cmpl $0x0, 0x40(%rax)
jle 0x42062
jmp 0x42081
leaq 0x22821(%rip), %rdi     # 0x6488a
leaq 0x22486(%rip), %rsi     # 0x644f6
movl $0x485, %edx            # imm = 0x485
leaq 0x22822(%rip), %rcx     # 0x6489e
callq 0x7160
movq -0x1d0(%rbp), %rax
movq $0x0, (%rax)
movl $0x0, 0x1c(%rax)
movl $0x0, 0x18(%rax)
leaq -0x18(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x2d280
movq -0x1d0(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, 0x24(%rdi)
callq 0x41dd0
movq -0x1d0(%rbp), %rax
movslq 0x40(%rax), %rax
imulq $0x50, %rax, %rdi
callq 0x93d0
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x1d0(%rbp), %rcx
movl -0x2c(%rbp), %eax
cmpl 0x40(%rcx), %eax
jge 0x422ad
movq -0x1d0(%rbp), %rdi
addq $0x40, %rdi
movl -0x2c(%rbp), %esi
callq 0x4c7a0
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rcx
xorl %eax, %eax
cmpq $0x0, 0x60(%rcx)
movb %al, -0x1d1(%rbp)
je 0x42183
movq -0x38(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x2e390
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x1d2(%rbp)
jne 0x4215b
jmp 0x42177
movq -0x1d0(%rbp), %rcx
movq -0x38(%rbp), %rax
movq 0x60(%rax), %rax
cmpq %rcx, 0x30(%rax)
sete %al
movb %al, -0x1d2(%rbp)
movb -0x1d2(%rbp), %al
movb %al, -0x1d1(%rbp)
movb -0x1d1(%rbp), %al
testb $0x1, %al
jne 0x4218f
jmp 0x42191
jmp 0x421b0
leaq 0x22720(%rip), %rdi     # 0x648b8
leaq 0x22357(%rip), %rsi     # 0x644f6
movl $0x49d, %edx            # imm = 0x49D
leaq 0x226f3(%rip), %rcx     # 0x6489e
callq 0x7160
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rax
movl 0x10(%rax), %esi
callq 0x43b30
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jl 0x421ce
jmp 0x421ed
leaq 0x22734(%rip), %rdi     # 0x64909
leaq 0x2231a(%rip), %rsi     # 0x644f6
movl $0x49f, %edx            # imm = 0x49F
leaq 0x226b6(%rip), %rcx     # 0x6489e
callq 0x7160
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rsi
movl -0x44(%rbp), %edx
callq 0x43c30
cmpl $0x0, %eax
jne 0x4220e
movb $0x0, -0x1(%rbp)
jmp 0x43129
movq -0x38(%rbp), %rax
cmpq $0x0, 0x30(%rax)
jne 0x42230
movq -0x1d0(%rbp), %rdi
callq 0x43460
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rcx
xorl %eax, %eax
cmpw $0x0, (%rcx)
movb %al, -0x1d3(%rbp)
je 0x42260
movq -0x50(%rbp), %rax
cmpw $0x0, 0x2(%rax)
setne %al
movb %al, -0x1d3(%rbp)
movb -0x1d3(%rbp), %al
testb $0x1, %al
jne 0x4226c
jmp 0x4229d
movq -0x50(%rbp), %rax
movzwl 0x2(%rax), %eax
movq -0x50(%rbp), %rcx
movzwl (%rcx), %ecx
subl %ecx, %eax
addl $0x1, %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
movq -0x50(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x50(%rbp)
jmp 0x4223c
jmp 0x4229f
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x420ed
movq -0x1d0(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jle 0x422cc
movq -0x1d0(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x1d8(%rbp)
jmp 0x4230a
cmpl $0x7d0, -0x24(%rbp)     # imm = 0x7D0
jle 0x422e2
movl $0x800, %eax            # imm = 0x800
movl %eax, -0x1dc(%rbp)
jmp 0x422fe
movl -0x24(%rbp), %edx
movl $0x200, %eax            # imm = 0x200
movl $0x400, %ecx            # imm = 0x400
cmpl $0x3e8, %edx            # imm = 0x3E8
cmovgl %ecx, %eax
movl %eax, -0x1dc(%rbp)
movl -0x1dc(%rbp), %eax
movl %eax, -0x1d8(%rbp)
movq -0x1d0(%rbp), %rax
movl -0x1d8(%rbp), %ecx
movl %ecx, 0x18(%rax)
movl $0x0, 0x1c(%rax)
movl $0x8000, -0x54(%rbp)    # imm = 0x8000
movl 0x18(%rax), %edx
movq %rsp, %rax
movq $0x0, (%rax)
xorl %r8d, %r8d
movl %r8d, -0x1ec(%rbp)
movl %r8d, %esi
leaq -0x90(%rbp), %rdi
movl $0x8000, %ecx           # imm = 0x8000
movl $0x1, %r9d
callq 0x43ef0
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x1e8(%rbp)
callq 0x4c940
movq -0x1d0(%rbp), %rdi
movl -0x1ec(%rbp), %esi
movq -0x1e8(%rbp), %rdx
callq 0x44040
jmp 0x42387
leaq -0x90(%rbp), %rdi
movl $0x1, %edx
movl %edx, %esi
callq 0x44760
jmp 0x4239c
movq -0x88(%rbp), %rax
movq %rax, -0x200(%rbp)
leaq -0xa0(%rbp), %rdi
xorl %esi, %esi
callq 0x4c970
movq %rax, -0x1f8(%rbp)
jmp 0x423c1
movq -0x1f8(%rbp), %rsi
movq -0x200(%rbp), %rdi
movl -0xa0(%rbp), %edx
callq 0x447f0
jmp 0x423dc
movl $0x0, -0xb0(%rbp)
movl -0xb0(%rbp), %eax
cmpl -0xa0(%rbp), %eax
jge 0x424ec
movl -0xb0(%rbp), %esi
leaq -0xa0(%rbp), %rdi
callq 0x4c970
movq %rax, -0x208(%rbp)
jmp 0x42413
movq -0x208(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x424d6
movq -0x1d0(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x214(%rbp)
movl -0xb0(%rbp), %esi
leaq -0xa0(%rbp), %rdi
callq 0x4c970
movq %rax, -0x210(%rbp)
jmp 0x4244f
movq -0x210(%rbp), %rax
movzwl 0xa(%rax), %eax
movl %eax, -0x224(%rbp)
movl -0xb0(%rbp), %esi
leaq -0xa0(%rbp), %rdi
callq 0x4c970
movq %rax, -0x220(%rbp)
jmp 0x4247b
movl -0x214(%rbp), %edi
movl -0x224(%rbp), %esi
movq -0x220(%rbp), %rax
movzwl 0x6(%rax), %eax
addl %eax, %esi
callq 0x44a10
movl %eax, -0x228(%rbp)
jmp 0x424a1
movq -0x1d0(%rbp), %rax
movl -0x228(%rbp), %ecx
movl %ecx, 0x1c(%rax)
jmp 0x424d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x4ca80
jmp 0x43137
jmp 0x424d8
movl -0xb0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb0(%rbp)
jmp 0x423e6
movl $0x0, -0xb4(%rbp)
movl $0x0, -0xb8(%rbp)
movl $0x0, -0xbc(%rbp)
movslq -0x24(%rbp), %rax
leaq (%rax,%rax,8), %rcx
leaq (%rcx,%rcx,2), %rdi
addq %rax, %rdi
callq 0x93d0
movq %rax, -0x230(%rbp)
jmp 0x42527
movq -0x230(%rbp), %rax
movq %rax, -0xc8(%rbp)
movslq -0x24(%rbp), %rdi
shlq $0x4, %rdi
callq 0x93d0
movq %rax, -0x238(%rbp)
jmp 0x4254b
movq -0x238(%rbp), %rax
movq %rax, -0xd0(%rbp)
movslq -0x28(%rbp), %rax
shlq $0x3, %rax
leaq (%rax,%rax,4), %rdi
callq 0x93d0
movq %rax, -0x240(%rbp)
jmp 0x42573
movq -0x240(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0xc8(%rbp), %rdi
movslq -0x24(%rbp), %rax
imulq $0x1c, %rax, %rdx
xorl %esi, %esi
callq 0x7240
movq -0xd0(%rbp), %rdi
movslq -0x24(%rbp), %rdx
shlq $0x4, %rdx
xorl %esi, %esi
callq 0x7240
movq -0xd8(%rbp), %rdi
movslq -0x28(%rbp), %rax
imulq $0x28, %rax, %rdx
xorl %esi, %esi
callq 0x7240
movl $0x0, -0xdc(%rbp)
movq -0x1d0(%rbp), %rcx
movl -0xdc(%rbp), %eax
cmpl 0x40(%rcx), %eax
jge 0x42954
movq -0x1d0(%rbp), %rdi
addq $0x40, %rdi
movl -0xdc(%rbp), %esi
callq 0x4c7a0
movq %rax, -0x248(%rbp)
jmp 0x42602
movq -0x248(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x20(%rbp), %rax
movslq -0xdc(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xf0(%rbp)
movl $0x0, -0xf4(%rbp)
movl $0x0, -0xf8(%rbp)
movq -0xe8(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rcx
xorl %eax, %eax
cmpw $0x0, (%rcx)
movb %al, -0x249(%rbp)
je 0x42679
movq -0x100(%rbp), %rax
cmpw $0x0, 0x2(%rax)
setne %al
movb %al, -0x249(%rbp)
movb -0x249(%rbp), %al
testb $0x1, %al
jne 0x42685
jmp 0x426ce
movq -0x100(%rbp), %rax
movzwl 0x2(%rax), %eax
movq -0x100(%rbp), %rcx
movzwl (%rcx), %ecx
subl %ecx, %eax
addl $0x1, %eax
addl -0xf4(%rbp), %eax
movl %eax, -0xf4(%rbp)
movl -0xf8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf8(%rbp)
movq -0x100(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x100(%rbp)
jmp 0x4264f
movq -0xd8(%rbp), %rcx
movslq -0xbc(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rcx
movq -0xf0(%rbp), %rax
movq %rcx, 0x40(%rax)
movl -0xf8(%rbp), %ecx
movq -0xf0(%rbp), %rax
movl %ecx, 0x48(%rax)
movl -0xf8(%rbp), %eax
addl -0xbc(%rbp), %eax
movl %eax, -0xbc(%rbp)
movl $0x0, -0x104(%rbp)
movl -0x104(%rbp), %eax
cmpl -0xf8(%rbp), %eax
jge 0x42808
movq -0xe8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x104(%rbp), %ecx
shll %ecx
movslq %ecx, %rcx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x110(%rbp)
movq -0xf0(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x104(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x118(%rbp)
movq -0xe8(%rbp), %rax
movss 0x14(%rax), %xmm0
movq -0x118(%rbp), %rax
movss %xmm0, (%rax)
movq -0x110(%rbp), %rax
movzwl (%rax), %ecx
movq -0x118(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x110(%rbp), %rax
movzwl 0x2(%rax), %ecx
movq -0x110(%rbp), %rax
movzwl (%rax), %eax
subl %eax, %ecx
addl $0x1, %ecx
movq -0x118(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0xc8(%rbp), %rcx
movslq -0xb4(%rbp), %rax
imulq $0x1c, %rax, %rax
addq %rax, %rcx
movq -0x118(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x118(%rbp), %rax
movl 0x10(%rax), %eax
addl -0xb4(%rbp), %eax
movl %eax, -0xb4(%rbp)
movl -0x104(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x104(%rbp)
jmp 0x4271a
movq -0xd0(%rbp), %rcx
movslq -0xb8(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rcx
movq -0xf0(%rbp), %rax
movq %rcx, 0x38(%rax)
movl -0xf4(%rbp), %ecx
movl -0xb8(%rbp), %eax
addl %ecx, %eax
movl %eax, -0xb8(%rbp)
movq -0xe8(%rbp), %rax
movl 0x18(%rax), %esi
movl 0x1c(%rax), %edx
leaq -0x90(%rbp), %rdi
callq 0x44760
jmp 0x42857
movq -0xf0(%rbp), %rsi
movq 0x38(%rsi), %r8
movq 0x40(%rsi), %rdx
movl 0x48(%rsi), %ecx
leaq -0x90(%rbp), %rdi
callq 0x44a40
movl %eax, -0x250(%rbp)
jmp 0x4287d
movl -0x250(%rbp), %eax
movl %eax, -0x11c(%rbp)
movq -0x88(%rbp), %rdi
movq -0xf0(%rbp), %rax
movq 0x38(%rax), %rsi
movl -0x11c(%rbp), %edx
callq 0x447f0
jmp 0x428a8
movl $0x0, -0x120(%rbp)
movl -0x120(%rbp), %eax
cmpl -0x11c(%rbp), %eax
jge 0x4293e
movq -0xf0(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x120(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpl $0x0, 0xc(%rax)
je 0x42928
movq -0x1d0(%rbp), %rax
movl 0x1c(%rax), %edi
movq -0xf0(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x120(%rbp), %rcx
shlq $0x4, %rcx
movzwl 0xa(%rax,%rcx), %esi
movzwl 0x6(%rax,%rcx), %eax
addl %eax, %esi
callq 0x44a10
movl %eax, -0x254(%rbp)
jmp 0x42918
movq -0x1d0(%rbp), %rax
movl -0x254(%rbp), %ecx
movl %ecx, 0x1c(%rax)
jmp 0x4292a
movl -0x120(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x120(%rbp)
jmp 0x428b2
jmp 0x42940
movl -0xdc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xdc(%rbp)
jmp 0x425cd
movl -0xb8(%rbp), %eax
cmpl -0x24(%rbp), %eax
jne 0x42961
jmp 0x42980
leaq 0x21fb2(%rip), %rdi     # 0x6491a
leaq 0x21b87(%rip), %rsi     # 0x644f6
movl $0x4ee, %edx            # imm = 0x4EE
leaq 0x21f23(%rip), %rcx     # 0x6489e
callq 0x7160
movl -0xb4(%rbp), %eax
cmpl -0x24(%rbp), %eax
jne 0x4298d
jmp 0x429ac
leaq 0x21fa7(%rip), %rdi     # 0x6493b
leaq 0x21b5b(%rip), %rsi     # 0x644f6
movl $0x4ef, %edx            # imm = 0x4EF
leaq 0x21ef7(%rip), %rcx     # 0x6489e
callq 0x7160
movl -0xbc(%rbp), %eax
cmpl -0x28(%rbp), %eax
jne 0x429b9
jmp 0x429d8
leaq 0x21fa2(%rip), %rdi     # 0x64962
leaq 0x21b2f(%rip), %rsi     # 0x644f6
movl $0x4f0, %edx            # imm = 0x4F0
leaq 0x21ecb(%rip), %rcx     # 0x6489e
callq 0x7160
movq -0x1d0(%rbp), %rax
movl 0x1c(%rax), %edi
callq 0x44c70
movl %eax, -0x258(%rbp)
jmp 0x429ef
movq -0x1d0(%rbp), %rcx
movl -0x258(%rbp), %eax
movl %eax, 0x1c(%rcx)
movl 0x18(%rcx), %eax
movl 0x1c(%rcx), %ecx
imull %ecx, %eax
movslq %eax, %rdi
callq 0x93d0
movq %rax, -0x260(%rbp)
jmp 0x42a19
movq -0x1d0(%rbp), %rcx
movq -0x260(%rbp), %rax
movq %rax, 0x8(%rcx)
movq 0x8(%rcx), %rdi
movl 0x18(%rcx), %eax
imull 0x1c(%rcx), %eax
movslq %eax, %rdx
xorl %esi, %esi
callq 0x7240
movq -0x1d0(%rbp), %rax
movq 0x8(%rax), %rcx
movq %rcx, -0x68(%rbp)
movl 0x1c(%rax), %eax
movl %eax, -0x7c(%rbp)
movl $0x0, -0x124(%rbp)
movq -0x1d0(%rbp), %rcx
movl -0x124(%rbp), %eax
cmpl 0x40(%rcx), %eax
jge 0x42b1d
movq -0x1d0(%rbp), %rdi
addq $0x40, %rdi
movl -0x124(%rbp), %esi
callq 0x4c7a0
movq %rax, -0x268(%rbp)
jmp 0x42a94
movq -0x268(%rbp), %rax
movq %rax, -0x130(%rbp)
movq -0x20(%rbp), %rax
movslq -0x124(%rbp), %rcx
leaq (%rcx,%rcx,4), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x138(%rbp)
movq -0x130(%rbp), %rax
movl 0x18(%rax), %esi
movl 0x1c(%rax), %edx
leaq -0x90(%rbp), %rdi
callq 0x44760
jmp 0x42ada
movq -0x138(%rbp), %rsi
movq 0x38(%rsi), %r8
movq 0x40(%rsi), %rdx
movl 0x48(%rsi), %ecx
leaq -0x90(%rbp), %rdi
callq 0x44cd0
jmp 0x42afa
movq -0x138(%rbp), %rax
movq $0x0, 0x38(%rax)
movl -0x124(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x124(%rbp)
jmp 0x42a5f
leaq -0x90(%rbp), %rdi
callq 0x45230
jmp 0x42b2b
movq -0xd0(%rbp), %rdi
callq 0xa760
jmp 0x42b39
movq $0x0, -0xd0(%rbp)
movl $0x0, -0x13c(%rbp)
movq -0x1d0(%rbp), %rcx
movl -0x13c(%rbp), %eax
cmpl 0x40(%rcx), %eax
jge 0x430d8
movq -0x1d0(%rbp), %rdi
addq $0x40, %rdi
movl -0x13c(%rbp), %esi
callq 0x4c7a0
movq %rax, -0x270(%rbp)
jmp 0x42b83
movq -0x270(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x20(%rbp), %rax
movslq -0x13c(%rbp), %rcx
leaq (%rcx,%rcx,4), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x150(%rbp)
movq -0x148(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x158(%rbp)
movq -0x150(%rbp), %rdi
movq -0x148(%rbp), %rax
movss 0x14(%rax), %xmm0
callq 0x45260
movss %xmm0, -0x274(%rbp)
jmp 0x42be2
movss -0x274(%rbp), %xmm0
movss %xmm0, -0x15c(%rbp)
movq -0x150(%rbp), %rdi
leaq -0x160(%rbp), %rsi
leaq -0x164(%rbp), %rdx
leaq -0x168(%rbp), %rcx
callq 0x452d0
jmp 0x42c15
cvtsi2ssl -0x160(%rbp), %xmm0
mulss -0x15c(%rbp), %xmm0
movss %xmm0, -0x16c(%rbp)
cvtsi2ssl -0x164(%rbp), %xmm0
mulss -0x15c(%rbp), %xmm0
movss %xmm0, -0x170(%rbp)
movq -0x148(%rbp), %rax
testb $0x1, 0x38(%rax)
jne 0x42cdd
movq -0x1d0(%rbp), %rcx
movq -0x158(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x148(%rbp), %rcx
movq -0x158(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x158(%rbp), %rax
movl $0x0, 0x20(%rax)
movq -0x148(%rbp), %rax
movss 0x14(%rax), %xmm0
movq -0x158(%rbp), %rax
movss %xmm0, (%rax)
movss -0x16c(%rbp), %xmm0
movq -0x158(%rbp), %rax
movss %xmm0, 0x24(%rax)
movss -0x170(%rbp), %xmm0
movq -0x158(%rbp), %rax
movss %xmm0, 0x28(%rax)
movq -0x158(%rbp), %rdi
addq $0x38, %rdi
xorl %esi, %esi
callq 0x4c9d0
jmp 0x42cdb
jmp 0x42cdd
movq -0x158(%rbp), %rax
movl 0x20(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x20(%rax)
movq -0x148(%rbp), %rax
testb $0x1, 0x38(%rax)
je 0x42d31
movq -0x148(%rbp), %rax
testb $0x1, 0x39(%rax)
je 0x42d31
movss -0x16c(%rbp), %xmm0
movq -0x158(%rbp), %rax
subss 0x24(%rax), %xmm0
movss 0x18301(%rip), %xmm1    # 0x5b024
mulss %xmm1, %xmm0
movss %xmm0, -0x278(%rbp)
jmp 0x42d3e
xorps %xmm0, %xmm0
movss %xmm0, -0x278(%rbp)
jmp 0x42d3e
movss -0x278(%rbp), %xmm0
movss %xmm0, -0x174(%rbp)
movq -0x158(%rbp), %rax
movq $0x0, 0x48(%rax)
movl $0x0, -0x178(%rbp)
movl -0x178(%rbp), %eax
movq -0x150(%rbp), %rcx
cmpl 0x48(%rcx), %eax
jge 0x430b0
movq -0x150(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x178(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x180(%rbp)
movl $0x0, -0x184(%rbp)
movl -0x184(%rbp), %eax
movq -0x180(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x4309a
movq -0x180(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x184(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x190(%rbp)
movq -0x190(%rbp), %rax
cmpw $0x0, (%rax)
jne 0x42e19
movq -0x190(%rbp), %rax
cmpw $0x0, 0x4(%rax)
jne 0x42e19
movq -0x190(%rbp), %rax
cmpw $0x0, 0x2(%rax)
jne 0x42e19
movq -0x190(%rbp), %rax
cmpw $0x0, 0x6(%rax)
jne 0x42e19
jmp 0x43086
movq -0x180(%rbp), %rax
movl 0x4(%rax), %eax
addl -0x184(%rbp), %eax
movl %eax, -0x194(%rbp)
movq -0x148(%rbp), %rax
testb $0x1, 0x38(%rax)
je 0x42e6a
movq -0x158(%rbp), %rdi
movzwl -0x194(%rbp), %esi
callq 0x45380
movq %rax, -0x280(%rbp)
jmp 0x42e58
movq -0x280(%rbp), %rax
cmpq $0x0, %rax
je 0x42e6a
jmp 0x43086
movq -0x1d0(%rbp), %rax
movl $0x0, -0x1b8(%rbp)
movl $0x0, -0x1bc(%rbp)
movq -0x180(%rbp), %rcx
movq 0x18(%rcx), %rdi
movl 0x18(%rax), %esi
movl 0x1c(%rax), %edx
movl -0x184(%rbp), %ecx
movq %rsp, %rax
leaq -0x1b4(%rbp), %r8
movq %r8, (%rax)
movl $0x0, 0x8(%rax)
leaq -0x1b8(%rbp), %r8
leaq -0x1bc(%rbp), %r9
callq 0x453f0
jmp 0x42ec5
movq -0x158(%rbp), %rax
movq %rax, %rdi
addq $0x38, %rdi
movl 0x38(%rax), %esi
incl %esi
callq 0x4c9d0
jmp 0x42edf
movq -0x158(%rbp), %rdi
addq $0x38, %rdi
callq 0x4ca20
movq %rax, -0x288(%rbp)
jmp 0x42ef8
movq -0x288(%rbp), %rax
movq %rax, -0x1c8(%rbp)
movl -0x194(%rbp), %eax
movw %ax, %cx
movq -0x1c8(%rbp), %rax
movw %cx, (%rax)
movss -0x1b4(%rbp), %xmm0
movq -0x1c8(%rbp), %rax
movss %xmm0, 0x8(%rax)
movss -0x1b0(%rbp), %xmm0
movq -0x1c8(%rbp), %rax
movss %xmm0, 0xc(%rax)
movss -0x1a4(%rbp), %xmm0
movq -0x1c8(%rbp), %rax
movss %xmm0, 0x10(%rax)
movss -0x1a0(%rbp), %xmm0
movq -0x1c8(%rbp), %rax
movss %xmm0, 0x14(%rax)
movss -0x1ac(%rbp), %xmm0
movq -0x1c8(%rbp), %rax
movss %xmm0, 0x18(%rax)
movss -0x1a8(%rbp), %xmm0
movq -0x1c8(%rbp), %rax
movss %xmm0, 0x1c(%rax)
movss -0x19c(%rbp), %xmm0
movq -0x1c8(%rbp), %rax
movss %xmm0, 0x20(%rax)
movss -0x198(%rbp), %xmm0
movq -0x1c8(%rbp), %rax
movss %xmm0, 0x24(%rax)
movq -0x158(%rbp), %rax
movss 0x24(%rax), %xmm0
addss -0x174(%rbp), %xmm0
movss 0x1804f(%rip), %xmm1    # 0x5b024
addss %xmm1, %xmm0
cvttss2si %xmm0, %eax
cvtsi2ss %eax, %xmm0
movq -0x1c8(%rbp), %rax
addss 0xc(%rax), %xmm0
movss %xmm0, 0xc(%rax)
movq -0x158(%rbp), %rax
movss 0x24(%rax), %xmm0
addss -0x174(%rbp), %xmm0
movss 0x18016(%rip), %xmm1    # 0x5b024
addss %xmm1, %xmm0
cvttss2si %xmm0, %eax
cvtsi2ss %eax, %xmm0
movq -0x1c8(%rbp), %rax
addss 0x14(%rax), %xmm0
movss %xmm0, 0x14(%rax)
movq -0x190(%rbp), %rax
movss 0x10(%rax), %xmm0
movq -0x148(%rbp), %rax
addss 0x24(%rax), %xmm0
movq -0x1c8(%rbp), %rax
movss %xmm0, 0x4(%rax)
movq -0x148(%rbp), %rax
testb $0x1, 0x20(%rax)
je 0x43084
movq -0x1c8(%rbp), %rax
movss 0x17fb9(%rip), %xmm0    # 0x5b024
addss 0x4(%rax), %xmm0
cvttss2si %xmm0, %eax
cvtsi2ss %eax, %xmm0
movq -0x1c8(%rbp), %rax
movss %xmm0, 0x4(%rax)
jmp 0x43086
movl -0x184(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x184(%rbp)
jmp 0x42da7
jmp 0x4309c
movl -0x178(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x178(%rbp)
jmp 0x42d67
movq -0x148(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x45610
jmp 0x430c2
jmp 0x430c4
movl -0x13c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13c(%rbp)
jmp 0x42b4e
movq -0xc8(%rbp), %rdi
callq 0xa760
jmp 0x430e6
movq -0xd8(%rbp), %rdi
callq 0xa760
jmp 0x430f4
movq -0x20(%rbp), %rdi
callq 0xa760
jmp 0x430ff
movq -0x1d0(%rbp), %rdi
movl $0x1, %esi
leaq -0xa0(%rbp), %rdx
callq 0x44040
jmp 0x43119
movb $0x1, -0x1(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x4ca80
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbp
retq
movq -0xa8(%rbp), %rdi
callq 0x74f0
nopw %cs:(%rax,%rax)