// File: Ciaxur[P]yagb-emu/src/../include/imgui_club/imgui_memory_editor/imgui_memory_editor.h
// Function: MemoryEditor::CalcSizes(MemoryEditor::Sizes&, unsigned long, unsigned long)
void CalcSizes(Sizes& s, size_t mem_size, size_t base_display_addr)
    {
        ImGuiStyle& style = ImGui::GetStyle();
        s.AddrDigitsCount = OptAddrDigitsCount;
        if (s.AddrDigitsCount == 0)
            for (size_t n = base_display_addr + mem_size - 1; n > 0; n >>= 4)
                s.AddrDigitsCount++;
        s.LineHeight = ImGui::GetTextLineHeight();
        s.GlyphWidth = ImGui::CalcTextSize("F").x + 1;                  // We assume the font is mono-space
        s.HexCellWidth = (float)(int)(s.GlyphWidth * 2.5f);             // "FF " we include trailing space in the width to easily catch clicks everywhere
        s.SpacingBetweenMidCols = (float)(int)(s.HexCellWidth * 0.25f); // Every OptMidColsCount columns we add a bit of extra spacing
        s.PosHexStart = (s.AddrDigitsCount + 2) * s.GlyphWidth;
        s.PosHexEnd = s.PosHexStart + (s.HexCellWidth * Cols);
        s.PosAsciiStart = s.PosAsciiEnd = s.PosHexEnd;
        if (OptShowAscii)
        {
            s.PosAsciiStart = s.PosHexEnd + s.GlyphWidth * 1;
            if (OptMidColsCount > 0)
                s.PosAsciiStart += (float)((Cols + OptMidColsCount - 1) / OptMidColsCount) * s.SpacingBetweenMidCols;
            s.PosAsciiEnd = s.PosAsciiStart + Cols * s.GlyphWidth;
        }
        s.WindowWidth = s.PosAsciiEnd + style.ScrollbarSize + style.WindowPadding.x * 2 + s.GlyphWidth;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
callq 0xc7680
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, -0x28(%rbp)
movl 0x14(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
jne 0xbf8b4
movq -0x20(%rbp), %rax
addq -0x18(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jbe 0xbf8b2
movq -0x10(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
shrq $0x4, %rax
movq %rax, -0x30(%rbp)
jmp 0xbf892
jmp 0xbf8b4
callq 0xdd000
movq -0x10(%rbp), %rax
movss %xmm0, 0x4(%rax)
leaq 0xbca5c(%rip), %rdi     # 0x17c325
xorl %edx, %edx
movl %edx, %esi
movss 0xb26ab(%rip), %xmm0    # 0x171f80
callq 0xc87e0
movq -0x40(%rbp), %rax
movlpd %xmm0, -0x38(%rbp)
movss 0xb1351(%rip), %xmm0    # 0x170c3c
addss -0x38(%rbp), %xmm0
movq -0x10(%rbp), %rcx
movss %xmm0, 0x8(%rcx)
movq -0x10(%rbp), %rcx
movss 0xb26b7(%rip), %xmm0    # 0x171fbc
mulss 0x8(%rcx), %xmm0
cvttss2si %xmm0, %ecx
cvtsi2ss %ecx, %xmm0
movq -0x10(%rbp), %rcx
movss %xmm0, 0xc(%rcx)
movq -0x10(%rbp), %rcx
movss 0xb2691(%rip), %xmm0    # 0x171fb8
mulss 0xc(%rcx), %xmm0
cvttss2si %xmm0, %ecx
cvtsi2ss %ecx, %xmm0
movq -0x10(%rbp), %rcx
movss %xmm0, 0x10(%rcx)
movq -0x10(%rbp), %rcx
movl (%rcx), %ecx
addl $0x2, %ecx
cvtsi2ss %ecx, %xmm0
movq -0x10(%rbp), %rcx
mulss 0x8(%rcx), %xmm0
movq -0x10(%rbp), %rcx
movss %xmm0, 0x14(%rcx)
movq -0x10(%rbp), %rcx
movss 0x14(%rcx), %xmm1
movq -0x10(%rbp), %rcx
movss 0xc(%rcx), %xmm0
cvtsi2ssl 0x4(%rax), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movq -0x10(%rbp), %rcx
movss %xmm0, 0x18(%rcx)
movq -0x10(%rbp), %rcx
movss 0x18(%rcx), %xmm0
movq -0x10(%rbp), %rcx
movss %xmm0, 0x20(%rcx)
movq -0x10(%rbp), %rcx
movss %xmm0, 0x1c(%rcx)
testb $0x1, 0xb(%rax)
je 0xbfa32
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rcx
movss 0x18(%rcx), %xmm1
movq -0x10(%rbp), %rcx
movss 0x8(%rcx), %xmm0
addss %xmm1, %xmm0
movq -0x10(%rbp), %rcx
movss %xmm0, 0x1c(%rcx)
cmpl $0x0, 0x10(%rax)
jle 0xbfa06
movq -0x40(%rbp), %rcx
movl 0x4(%rcx), %eax
addl 0x10(%rcx), %eax
subl $0x1, %eax
cltd
idivl 0x10(%rcx)
cvtsi2ss %eax, %xmm0
movq -0x10(%rbp), %rax
movss 0x10(%rax), %xmm2
movq -0x10(%rbp), %rax
movss 0x1c(%rax), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x1c(%rax)
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rcx
movss 0x1c(%rcx), %xmm1
cvtsi2ssl 0x4(%rax), %xmm0
movq -0x10(%rbp), %rax
movss 0x8(%rax), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x20(%rax)
movq -0x10(%rbp), %rax
movss 0x20(%rax), %xmm1
movq -0x28(%rbp), %rax
addss 0x70(%rax), %xmm1
movq -0x28(%rbp), %rax
movss 0x4(%rax), %xmm0
addss %xmm0, %xmm0
addss %xmm1, %xmm0
movq -0x10(%rbp), %rax
addss 0x8(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x24(%rax)
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)