// File: Ciaxur[P]yagb-emu/src/../include/imgui_club/imgui_memory_editor/imgui_memory_editor.h
// Function: MemoryEditor::DrawPreviewData(unsigned long, unsigned char const*, unsigned long, int, MemoryEditor::DataFormat, char*, unsigned long) const
void DrawPreviewData(size_t addr, const ImU8* mem_data, size_t mem_size, ImGuiDataType data_type, DataFormat data_format, char* out_buf, size_t out_buf_size) const
    {
        uint8_t buf[8];
        size_t elem_size = DataTypeGetSize(data_type);
        size_t size = addr + elem_size > mem_size ? mem_size - addr : elem_size;
        if (ReadFn)
            for (int i = 0, n = (int)size; i < n; ++i)
                buf[i] = ReadFn(mem_data, addr + i);
        else
            memcpy(buf, mem_data + addr, size);

        if (data_format == DataFormat_Bin)
        {
            uint8_t binbuf[8];
            EndianessCopy(binbuf, buf, size);
            ImSnprintf(out_buf, out_buf_size, "%s", FormatBinary(binbuf, (int)size * 8));
            return;
        }

        out_buf[0] = 0;
        switch (data_type)
        {
        case ImGuiDataType_S8:
        {
            int8_t int8 = 0;
            EndianessCopy(&int8, buf, size);
            if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%hhd", int8); return; }
            if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%02x", int8 & 0xFF); return; }
            break;
        }
        case ImGuiDataType_U8:
        {
            uint8_t uint8 = 0;
            EndianessCopy(&uint8, buf, size);
            if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%hhu", uint8); return; }
            if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%02x", uint8 & 0XFF); return; }
            break;
        }
        case ImGuiDataType_S16:
        {
            int16_t int16 = 0;
            EndianessCopy(&int16, buf, size);
            if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%hd", int16); return; }
            if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%04x", int16 & 0xFFFF); return; }
            break;
        }
        case ImGuiDataType_U16:
        {
            uint16_t uint16 = 0;
            EndianessCopy(&uint16, buf, size);
            if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%hu", uint16); return; }
            if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%04x", uint16 & 0xFFFF); return; }
            break;
        }
        case ImGuiDataType_S32:
        {
            int32_t int32 = 0;
            EndianessCopy(&int32, buf, size);
            if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%d", int32); return; }
            if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%08x", int32); return; }
            break;
        }
        case ImGuiDataType_U32:
        {
            uint32_t uint32 = 0;
            EndianessCopy(&uint32, buf, size);
            if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%u", uint32); return; }
            if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%08x", uint32); return; }
            break;
        }
        case ImGuiDataType_S64:
        {
            int64_t int64 = 0;
            EndianessCopy(&int64, buf, size);
            if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%lld", (long long)int64); return; }
            if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%016llx", (long long)int64); return; }
            break;
        }
        case ImGuiDataType_U64:
        {
            uint64_t uint64 = 0;
            EndianessCopy(&uint64, buf, size);
            if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%llu", (long long)uint64); return; }
            if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%016llx", (long long)uint64); return; }
            break;
        }
        case ImGuiDataType_Float:
        {
            float float32 = 0.0f;
            EndianessCopy(&float32, buf, size);
            if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%f", float32); return; }
            if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "%a", float32); return; }
            break;
        }
        case ImGuiDataType_Double:
        {
            double float64 = 0.0;
            EndianessCopy(&float64, buf, size);
            if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%f", float64); return; }
            if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "%a", float64); return; }
            break;
        }
        case ImGuiDataType_COUNT:
            break;
        } // Switch
        IM_ASSERT(0); // Shouldn't reach
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x88(%rbp)
movl -0x24(%rbp), %esi
callq 0xc1140
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
addq -0x38(%rbp), %rax
cmpq -0x20(%rbp), %rax
jbe 0xc1b01
movq -0x20(%rbp), %rax
subq -0x10(%rbp), %rax
movq %rax, -0x90(%rbp)
jmp 0xc1b0c
movq -0x38(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rax
movq -0x90(%rbp), %rcx
movq %rcx, -0x40(%rbp)
cmpq $0x0, 0x20(%rax)
je 0xc1b6e
movl $0x0, -0x44(%rbp)
movq -0x40(%rbp), %rax
movl %eax, -0x48(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0xc1b6c
movq -0x88(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
movslq -0x44(%rbp), %rcx
addq %rcx, %rsi
callq *%rax
movb %al, %cl
movslq -0x44(%rbp), %rax
movb %cl, -0x30(%rbp,%rax)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xc1b33
jmp 0xc1b83
leaq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0xd0a0
cmpl $0x0, -0x28(%rbp)
jne 0xc1bf4
movq -0x88(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rcx
callq 0xc20b0
movq -0x88(%rbp), %rdi
movq 0x10(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq 0x18(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq -0x50(%rbp), %rsi
movq -0x40(%rbp), %rax
movl %eax, %edx
shll $0x3, %edx
callq 0xc2140
movq -0xa0(%rbp), %rdi
movq -0x98(%rbp), %rsi
movq %rax, %rcx
leaq 0xb3fdf(%rip), %rdx     # 0x175bc7
movb $0x0, %al
callq 0xd520
jmp 0xc20a3
movq 0x10(%rbp), %rax
movb $0x0, (%rax)
movl -0x24(%rbp), %eax
movq %rax, -0xa8(%rbp)
subq $0xa, %rax
ja 0xc2084
movq -0xa8(%rbp), %rax
leaq 0xb03e3(%rip), %rcx     # 0x172000
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x88(%rbp), %rdi
movb $0x0, -0x51(%rbp)
leaq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rcx
leaq -0x51(%rbp), %rsi
callq 0xc20b0
cmpl $0x1, -0x28(%rbp)
jne 0xc1c67
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movsbl -0x51(%rbp), %ecx
leaq 0xb0936(%rip), %rdx     # 0x172591
movb $0x0, %al
callq 0xd520
jmp 0xc20a3
cmpl $0x2, -0x28(%rbp)
jne 0xc1c92
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movsbl -0x51(%rbp), %ecx
andl $0xff, %ecx
leaq 0xb0910(%rip), %rdx     # 0x172596
movb $0x0, %al
callq 0xd520
jmp 0xc20a3
jmp 0xc2084
movq -0x88(%rbp), %rdi
movb $0x0, -0x52(%rbp)
leaq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rcx
leaq -0x52(%rbp), %rsi
callq 0xc20b0
cmpl $0x1, -0x28(%rbp)
jne 0xc1cd8
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movzbl -0x52(%rbp), %ecx
leaq 0xb08d1(%rip), %rdx     # 0x17259d
movb $0x0, %al
callq 0xd520
jmp 0xc20a3
cmpl $0x2, -0x28(%rbp)
jne 0xc1d03
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movzbl -0x52(%rbp), %ecx
andl $0xff, %ecx
leaq 0xb089f(%rip), %rdx     # 0x172596
movb $0x0, %al
callq 0xd520
jmp 0xc20a3
jmp 0xc2084
movq -0x88(%rbp), %rdi
movw $0x0, -0x54(%rbp)
leaq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rcx
leaq -0x54(%rbp), %rsi
callq 0xc20b0
cmpl $0x1, -0x28(%rbp)
jne 0xc1d4b
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movswl -0x54(%rbp), %ecx
leaq 0xb0863(%rip), %rdx     # 0x1725a2
movb $0x0, %al
callq 0xd520
jmp 0xc20a3
cmpl $0x2, -0x28(%rbp)
jne 0xc1d76
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movswl -0x54(%rbp), %ecx
andl $0xffff, %ecx           # imm = 0xFFFF
leaq 0xb083c(%rip), %rdx     # 0x1725a6
movb $0x0, %al
callq 0xd520
jmp 0xc20a3
jmp 0xc2084
movq -0x88(%rbp), %rdi
movw $0x0, -0x56(%rbp)
leaq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rcx
leaq -0x56(%rbp), %rsi
callq 0xc20b0
cmpl $0x1, -0x28(%rbp)
jne 0xc1dbe
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movzwl -0x56(%rbp), %ecx
leaq 0xb07fb(%rip), %rdx     # 0x1725ad
movb $0x0, %al
callq 0xd520
jmp 0xc20a3
cmpl $0x2, -0x28(%rbp)
jne 0xc1de9
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movzwl -0x56(%rbp), %ecx
andl $0xffff, %ecx           # imm = 0xFFFF
leaq 0xb07c9(%rip), %rdx     # 0x1725a6
movb $0x0, %al
callq 0xd520
jmp 0xc20a3
jmp 0xc2084
movq -0x88(%rbp), %rdi
movl $0x0, -0x5c(%rbp)
leaq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rcx
leaq -0x5c(%rbp), %rsi
callq 0xc20b0
cmpl $0x1, -0x28(%rbp)
jne 0xc1e31
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movl -0x5c(%rbp), %ecx
leaq 0xb7ba2(%rip), %rdx     # 0x1799c7
movb $0x0, %al
callq 0xd520
jmp 0xc20a3
cmpl $0x2, -0x28(%rbp)
jne 0xc1e55
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movl -0x5c(%rbp), %ecx
leaq 0xb0768(%rip), %rdx     # 0x1725b1
movb $0x0, %al
callq 0xd520
jmp 0xc20a3
jmp 0xc2084
movq -0x88(%rbp), %rdi
movl $0x0, -0x60(%rbp)
leaq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rcx
leaq -0x60(%rbp), %rsi
callq 0xc20b0
cmpl $0x1, -0x28(%rbp)
jne 0xc1e9d
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movl -0x60(%rbp), %ecx
leaq 0xc111e(%rip), %rdx     # 0x182faf
movb $0x0, %al
callq 0xd520
jmp 0xc20a3
cmpl $0x2, -0x28(%rbp)
jne 0xc1ec1
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movl -0x60(%rbp), %ecx
leaq 0xb06fc(%rip), %rdx     # 0x1725b1
movb $0x0, %al
callq 0xd520
jmp 0xc20a3
jmp 0xc2084
movq -0x88(%rbp), %rdi
movq $0x0, -0x68(%rbp)
leaq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rcx
leaq -0x68(%rbp), %rsi
callq 0xc20b0
cmpl $0x1, -0x28(%rbp)
jne 0xc1f0b
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movq -0x68(%rbp), %rcx
leaq 0xb06b9(%rip), %rdx     # 0x1725b8
movb $0x0, %al
callq 0xd520
jmp 0xc20a3
cmpl $0x2, -0x28(%rbp)
jne 0xc1f30
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movq -0x68(%rbp), %rcx
leaq 0xb0699(%rip), %rdx     # 0x1725bd
movb $0x0, %al
callq 0xd520
jmp 0xc20a3
jmp 0xc2084
movq -0x88(%rbp), %rdi
movq $0x0, -0x70(%rbp)
leaq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rcx
leaq -0x70(%rbp), %rsi
callq 0xc20b0
cmpl $0x1, -0x28(%rbp)
jne 0xc1f7a
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movq -0x70(%rbp), %rcx
leaq 0xb0659(%rip), %rdx     # 0x1725c7
movb $0x0, %al
callq 0xd520
jmp 0xc20a3
cmpl $0x2, -0x28(%rbp)
jne 0xc1f9f
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movq -0x70(%rbp), %rcx
leaq 0xb062a(%rip), %rdx     # 0x1725bd
movb $0x0, %al
callq 0xd520
jmp 0xc20a3
jmp 0xc2084
movq -0x88(%rbp), %rdi
xorps %xmm0, %xmm0
movss %xmm0, -0x74(%rbp)
leaq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rcx
leaq -0x74(%rbp), %rsi
callq 0xc20b0
cmpl $0x1, -0x28(%rbp)
jne 0xc1fee
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movss -0x74(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0xbaa7c(%rip), %rdx     # 0x17ca5e
movb $0x1, %al
callq 0xd520
jmp 0xc20a3
cmpl $0x2, -0x28(%rbp)
jne 0xc2018
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movss -0x74(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0xb05c0(%rip), %rdx     # 0x1725cc
movb $0x1, %al
callq 0xd520
jmp 0xc20a3
jmp 0xc2084
movq -0x88(%rbp), %rdi
xorps %xmm0, %xmm0
movsd %xmm0, -0x80(%rbp)
leaq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rcx
leaq -0x80(%rbp), %rsi
callq 0xc20b0
cmpl $0x1, -0x28(%rbp)
jne 0xc205d
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movsd -0x80(%rbp), %xmm0
leaq 0xbaa0a(%rip), %rdx     # 0x17ca5e
movb $0x1, %al
callq 0xd520
jmp 0xc20a3
cmpl $0x2, -0x28(%rbp)
jne 0xc2080
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movsd -0x80(%rbp), %xmm0
leaq 0xb0555(%rip), %rdx     # 0x1725cc
movb $0x1, %al
callq 0xd520
jmp 0xc20a3
jmp 0xc2084
jmp 0xc2084
leaq 0xb307f(%rip), %rdi     # 0x17510a
leaq 0xb02da(%rip), %rsi     # 0x17236c
movl $0x2e2, %edx            # imm = 0x2E2
leaq 0xb0531(%rip), %rcx     # 0x1725cf
callq 0xd180
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)