// File: Ciaxur[P]yagb-emu/include/imgui/imgui_draw.cpp
// Function: ImFontAtlasBuildPackCustomRects(ImFontAtlas*, void*)
void ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* stbrp_context_opaque)
{
    stbrp_context* pack_context = (stbrp_context*)stbrp_context_opaque;
    IM_ASSERT(pack_context != NULL);

    ImVector<ImFontAtlasCustomRect>& user_rects = atlas->CustomRects;
    IM_ASSERT(user_rects.Size >= 1); // We expect at least the default custom rects to be registered, else something went wrong.

    ImVector<stbrp_rect> pack_rects;
    pack_rects.resize(user_rects.Size);
    memset(pack_rects.Data, 0, (size_t)pack_rects.size_in_bytes());
    for (int i = 0; i < user_rects.Size; i++)
    {
        pack_rects[i].w = user_rects[i].Width;
        pack_rects[i].h = user_rects[i].Height;
    }
    stbrp_pack_rects(pack_context, &pack_rects[0], pack_rects.Size);
    for (int i = 0; i < pack_rects.Size; i++)
        if (pack_rects[i].was_packed)
        {
            user_rects[i].X = pack_rects[i].x;
            user_rects[i].Y = pack_rects[i].y;
            IM_ASSERT(pack_rects[i].w == user_rects[i].Width && pack_rects[i].h == user_rects[i].Height);
            atlas->TexHeight = ImMax(atlas->TexHeight, pack_rects[i].y + pack_rects[i].h);
        }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x1199d4
jmp 0x1199f3
leaq 0x711dc(%rip), %rdi     # 0x18abb7
leaq 0x70794(%rip), %rsi     # 0x18a176
movl $0x96c, %edx            # imm = 0x96C
leaq 0x711e0(%rip), %rcx     # 0x18abce
callq 0xd180
movq -0x8(%rbp), %rax
addq $0x50, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x1, (%rax)
jl 0x119a0a
jmp 0x119a29
leaq 0x711f9(%rip), %rdi     # 0x18ac0a
leaq 0x7075e(%rip), %rsi     # 0x18a176
movl $0x96f, %edx            # imm = 0x96F
leaq 0x711aa(%rip), %rcx     # 0x18abce
callq 0xd180
leaq -0x30(%rbp), %rdi
movq %rdi, -0x50(%rbp)
callq 0x128040
movq -0x50(%rbp), %rdi
movq -0x20(%rbp), %rax
movl (%rax), %esi
callq 0x1280a0
jmp 0x119a47
movq -0x28(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x128140
movl %eax, -0x54(%rbp)
jmp 0x119a5d
movq -0x60(%rbp), %rdi
movl -0x54(%rbp), %eax
movslq %eax, %rdx
xorl %esi, %esi
callq 0xd2f0
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x119b2f
movq -0x20(%rbp), %rdi
movl -0x40(%rbp), %esi
callq 0x128410
movq %rax, -0x68(%rbp)
jmp 0x119a96
movq -0x68(%rbp), %rax
movw (%rax), %ax
movw %ax, -0x72(%rbp)
movl -0x40(%rbp), %esi
leaq -0x30(%rbp), %rdi
callq 0x128180
movq %rax, -0x70(%rbp)
jmp 0x119ab3
movq -0x70(%rbp), %rax
movw -0x72(%rbp), %cx
movw %cx, 0x4(%rax)
movq -0x20(%rbp), %rdi
movl -0x40(%rbp), %esi
callq 0x128410
movq %rax, -0x80(%rbp)
jmp 0x119ad1
movq -0x80(%rbp), %rax
movw 0x2(%rax), %ax
movw %ax, -0x8a(%rbp)
movl -0x40(%rbp), %esi
leaq -0x30(%rbp), %rdi
callq 0x128180
movq %rax, -0x88(%rbp)
jmp 0x119af5
movq -0x88(%rbp), %rax
movw -0x8a(%rbp), %cx
movw %cx, 0x6(%rax)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x119a75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x128350
jmp 0x119db3
movq -0x18(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x128180
movq %rax, -0x98(%rbp)
jmp 0x119b4e
movq -0x98(%rbp), %rsi
movq -0xa0(%rbp), %rdi
movl -0x30(%rbp), %edx
callq 0x119dc0
jmp 0x119b66
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x119da1
movl -0x44(%rbp), %esi
leaq -0x30(%rbp), %rdi
callq 0x128180
movq %rax, -0xa8(%rbp)
jmp 0x119b8e
movq -0xa8(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x119d91
movl -0x44(%rbp), %esi
leaq -0x30(%rbp), %rdi
callq 0x128180
movq %rax, -0xb0(%rbp)
jmp 0x119bb4
movq -0xb0(%rbp), %rax
movw 0x8(%rax), %ax
movw %ax, -0xba(%rbp)
movq -0x20(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x128410
movq %rax, -0xb8(%rbp)
jmp 0x119bdb
movq -0xb8(%rbp), %rax
movw -0xba(%rbp), %cx
movw %cx, 0x4(%rax)
movl -0x44(%rbp), %esi
leaq -0x30(%rbp), %rdi
callq 0x128180
movq %rax, -0xc8(%rbp)
jmp 0x119c02
movq -0xc8(%rbp), %rax
movw 0xa(%rax), %ax
movw %ax, -0xd2(%rbp)
movq -0x20(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x128410
movq %rax, -0xd0(%rbp)
jmp 0x119c29
movq -0xd0(%rbp), %rax
movw -0xd2(%rbp), %cx
movw %cx, 0x6(%rax)
movl -0x44(%rbp), %esi
leaq -0x30(%rbp), %rdi
callq 0x128180
movq %rax, -0xe0(%rbp)
jmp 0x119c50
movq -0xe0(%rbp), %rax
movzwl 0x4(%rax), %eax
movl %eax, -0xec(%rbp)
movq -0x20(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x128410
movq %rax, -0xe8(%rbp)
jmp 0x119c76
movl -0xec(%rbp), %ecx
movq -0xe8(%rbp), %rax
movzwl (%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0xed(%rbp)
jne 0x119ce9
movl -0x44(%rbp), %esi
leaq -0x30(%rbp), %rdi
callq 0x128180
movq %rax, -0xf8(%rbp)
jmp 0x119ca7
movq -0xf8(%rbp), %rax
movzwl 0x6(%rax), %eax
movl %eax, -0x104(%rbp)
movq -0x20(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x128410
movq %rax, -0x100(%rbp)
jmp 0x119ccd
movl -0x104(%rbp), %eax
movq -0x100(%rbp), %rcx
movzwl 0x2(%rcx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0xed(%rbp)
movb -0xed(%rbp), %al
testb $0x1, %al
jne 0x119cf5
jmp 0x119cf7
jmp 0x119d16
leaq 0x70f21(%rip), %rdi     # 0x18ac1f
leaq 0x70471(%rip), %rsi     # 0x18a176
movl $0x97f, %edx            # imm = 0x97F
leaq 0x70ebd(%rip), %rcx     # 0x18abce
callq 0xd180
movq -0x8(%rbp), %rax
movl 0x2c(%rax), %eax
movl %eax, -0x114(%rbp)
movl -0x44(%rbp), %esi
leaq -0x30(%rbp), %rdi
callq 0x128180
movq %rax, -0x110(%rbp)
jmp 0x119d38
movq -0x110(%rbp), %rax
movzwl 0xa(%rax), %eax
movl %eax, -0x124(%rbp)
movl -0x44(%rbp), %esi
leaq -0x30(%rbp), %rdi
callq 0x128180
movq %rax, -0x120(%rbp)
jmp 0x119d5e
movl -0x114(%rbp), %edi
movl -0x124(%rbp), %esi
movq -0x120(%rbp), %rax
movzwl 0x6(%rax), %eax
addl %eax, %esi
callq 0x118ff0
movl %eax, -0x128(%rbp)
jmp 0x119d84
movl -0x128(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x2c(%rax)
jmp 0x119d93
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x119b6d
leaq -0x30(%rbp), %rdi
callq 0x128350
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0xd620
nopl (%rax)