// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
cmpl $0xa, %r8d
jae 0x409ca
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r13
movl %r9d, -0x48(%rbp)
movl %r8d, -0x44(%rbp)
movl %r8d, %edx
leaq 0x77206(%rip), %rax     # 0xb76e0
movq %rdx, -0x50(%rbp)
movq (%rax,%rdx,8), %rax
addq %rax, %rsi
movq %rcx, %rdx
subq %r15, %rdx
cmpq %rcx, %rsi
cmovbeq %rax, %rdx
cmpq $0x0, 0x20(%rdi)
movq %rdx, -0x38(%rbp)
je 0x40527
testl %edx, %edx
jle 0x40536
movq -0x38(%rbp), %r12
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
xorl %ebx, %ebx
leaq (%r15,%rbx), %rsi
movq %r14, %rdi
callq *0x20(%r13)
movb %al, -0x40(%rbp,%rbx)
incq %rbx
cmpq %r12, %rbx
jb 0x4050e
jmp 0x40536
addq %r15, %r14
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0xc080
movq 0x18(%rbp), %r15
movq 0x10(%rbp), %r14
movl -0x48(%rbp), %ebx
testl %ebx, %ebx
je 0x405be
movb $0x0, (%r14)
cmpl $0x9, -0x44(%rbp)
ja 0x409e9
leaq 0x76ab6(%rip), %rax     # 0xb7010
movq -0x50(%rbp), %rcx
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movb $0x0, -0x30(%rbp)
cmpq $0x0, 0xbd6fd(%rip)     # 0xfdc70
jne 0x40583
leaq 0x53c(%rip), %rax       # 0x40ab8
movq %rax, 0xbd6ed(%rip)     # 0xfdc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *0xbd6d4(%rip)          # 0xfdc70
cmpl $0x2, %ebx
je 0x4097b
cmpl $0x1, %ebx
jne 0x409e9
movsbl -0x30(%rbp), %ecx
leaq 0x76fe4(%rip), %rdx     # 0xb759d
jmp 0x40993
cmpq $0x0, 0xbd6aa(%rip)     # 0xfdc70
jne 0x405d6
leaq 0x4e9(%rip), %rax       # 0x40ab8
movq %rax, 0xbd69a(%rip)     # 0xfdc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rbx
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
movq -0x38(%rbp), %r12
movq %r12, %rdx
callq *0xbd67b(%rip)          # 0xfdc70
shll $0x3, %r12d
movq %r13, %rdi
movq %rbx, %rsi
movl %r12d, %edx
callq 0x40a08
leaq 0x7a549(%rip), %rdx     # 0xbab57
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rcx
jmp 0x4094a
movl $0x0, -0x30(%rbp)
cmpq $0x0, 0xbd645(%rip)     # 0xfdc70
jne 0x4063b
leaq 0x484(%rip), %rax       # 0x40ab8
movq %rax, 0xbd635(%rip)     # 0xfdc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *0xbd61c(%rip)          # 0xfdc70
cmpl $0x2, %ebx
je 0x4092d
cmpl $0x1, %ebx
jne 0x409e9
movl -0x30(%rbp), %ecx
leaq 0x7de12(%rip), %rdx     # 0xbe482
jmp 0x40993
movq $0x0, -0x30(%rbp)
cmpq $0x0, 0xbd5eb(%rip)     # 0xfdc70
jne 0x40695
leaq 0x42a(%rip), %rax       # 0x40ab8
movq %rax, 0xbd5db(%rip)     # 0xfdc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *0xbd5c2(%rip)          # 0xfdc70
cmpl $0x2, %ebx
je 0x40953
cmpl $0x1, %ebx
jne 0x409e9
movsd -0x30(%rbp), %xmm0
leaq 0x80e4d(%rip), %rdx     # 0xc1519
jmp 0x409ae
movw $0x0, -0x30(%rbp)
cmpq $0x0, 0xbd591(%rip)     # 0xfdc70
jne 0x406ef
leaq 0x3d0(%rip), %rax       # 0x40ab8
movq %rax, 0xbd581(%rip)     # 0xfdc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *0xbd568(%rip)          # 0xfdc70
cmpl $0x2, %ebx
je 0x40961
cmpl $0x1, %ebx
jne 0x409e9
movswl -0x30(%rbp), %ecx
leaq 0x76e89(%rip), %rdx     # 0xb75ae
jmp 0x40993
movw $0x0, -0x30(%rbp)
cmpq $0x0, 0xbd538(%rip)     # 0xfdc70
jne 0x40748
leaq 0x377(%rip), %rax       # 0x40ab8
movq %rax, 0xbd528(%rip)     # 0xfdc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *0xbd50f(%rip)          # 0xfdc70
cmpl $0x1, %ebx
je 0x4096e
cmpl $0x2, %ebx
jne 0x409e9
leaq 0x76e38(%rip), %rdx     # 0xb75b2
jmp 0x40975
movq $0x0, -0x30(%rbp)
cmpq $0x0, 0xbd4e1(%rip)     # 0xfdc70
jne 0x4079f
leaq 0x320(%rip), %rax       # 0x40ab8
movq %rax, 0xbd4d1(%rip)     # 0xfdc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *0xbd4b8(%rip)          # 0xfdc70
cmpl $0x2, %ebx
je 0x40939
cmpl $0x1, %ebx
jne 0x409e9
movq -0x30(%rbp), %rcx
leaq 0x76dfe(%rip), %rdx     # 0xb75d3
jmp 0x40944
movb $0x0, -0x30(%rbp)
cmpq $0x0, 0xbd48a(%rip)     # 0xfdc70
jne 0x407f6
leaq 0x2c9(%rip), %rax       # 0x40ab8
movq %rax, 0xbd47a(%rip)     # 0xfdc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *0xbd461(%rip)          # 0xfdc70
cmpl $0x1, %ebx
je 0x40988
cmpl $0x2, %ebx
jne 0x409e9
leaq 0x76d7a(%rip), %rdx     # 0xb75a2
jmp 0x4098f
movl $0x0, -0x30(%rbp)
cmpq $0x0, 0xbd434(%rip)     # 0xfdc70
jne 0x4084c
leaq 0x273(%rip), %rax       # 0x40ab8
movq %rax, 0xbd424(%rip)     # 0xfdc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *0xbd40b(%rip)          # 0xfdc70
cmpl $0x2, %ebx
je 0x4092d
cmpl $0x1, %ebx
jne 0x409e9
movl -0x30(%rbp), %ecx
leaq 0x8711e(%rip), %rdx     # 0xc799f
jmp 0x40993
movq $0x0, -0x30(%rbp)
cmpq $0x0, 0xbd3da(%rip)     # 0xfdc70
jne 0x408a6
leaq 0x219(%rip), %rax       # 0x40ab8
movq %rax, 0xbd3ca(%rip)     # 0xfdc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *0xbd3b1(%rip)          # 0xfdc70
cmpl $0x2, %ebx
je 0x40939
cmpl $0x1, %ebx
jne 0x409e9
movq -0x30(%rbp), %rcx
leaq 0x76cec(%rip), %rdx     # 0xb75c4
jmp 0x40944
movl $0x0, -0x30(%rbp)
cmpq $0x0, 0xbd387(%rip)     # 0xfdc70
jne 0x408f9
leaq 0x1c6(%rip), %rax       # 0x40ab8
movq %rax, 0xbd377(%rip)     # 0xfdc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *0xbd35e(%rip)          # 0xfdc70
cmpl $0x1, %ebx
je 0x409a2
cmpl $0x2, %ebx
jne 0x409e9
leaq 0x76cad(%rip), %rdx     # 0xb75d8
jmp 0x409a9
movl -0x30(%rbp), %ecx
leaq 0x76c86(%rip), %rdx     # 0xb75bd
jmp 0x40993
movq -0x30(%rbp), %rcx
leaq 0x76c85(%rip), %rdx     # 0xb75c9
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0xc470
jmp 0x409bb
movsd -0x30(%rbp), %xmm0
leaq 0x76c79(%rip), %rdx     # 0xb75d8
jmp 0x409ae
movzwl -0x30(%rbp), %ecx
leaq 0x76c46(%rip), %rdx     # 0xb75b2
jmp 0x40993
leaq 0x76c44(%rip), %rdx     # 0xb75b9
movzwl -0x30(%rbp), %ecx
jmp 0x40993
movzbl -0x30(%rbp), %ecx
leaq 0x76c1c(%rip), %rdx     # 0xb75a2
jmp 0x40993
leaq 0x76c1a(%rip), %rdx     # 0xb75a9
movzbl -0x30(%rbp), %ecx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0xc470
jmp 0x409bb
leaq 0x80b70(%rip), %rdx     # 0xc1519
cvtss2sd -0x30(%rbp), %xmm0
movq %r14, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0xc470
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x76a23(%rip), %rdi     # 0xb73f4
leaq 0x769a0(%rip), %rsi     # 0xb7378
leaq 0x76a47(%rip), %rcx     # 0xb7426
movl $0x22c, %edx            # imm = 0x22C
callq 0xc140
leaq 0x796fc(%rip), %rdi     # 0xba0ec
leaq 0x76981(%rip), %rsi     # 0xb7378
leaq 0x76bdd(%rip), %rcx     # 0xb75db
movl $0x2e2, %edx            # imm = 0x2E2
callq 0xc140