// File: /workspace/github_cpp_makefile_star2_O3/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 0x40198
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r13
movl %r9d, -0x48(%rbp)
movl %r8d, -0x44(%rbp)
movl %r8d, %edx
leaq 0x75a22(%rip), %rax     # 0xb56e0
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 0x3fd0b
testl %edx, %edx
jle 0x3fd1a
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 0x3fcf2
jmp 0x3fd1a
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 0x3fda0
movb $0x0, (%r14)
cmpl $0x9, -0x44(%rbp)
ja 0x401b7
leaq 0x752d2(%rip), %rax     # 0xb5010
movq -0x50(%rbp), %rcx
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movb $0x0, -0x30(%rbp)
movq 0xbbf1a(%rip), %rax     # 0xfbc70
testq %rax, %rax
jne 0x3fd69
leaq 0x528(%rip), %rax       # 0x4028a
movq %rax, 0xbbf07(%rip)     # 0xfbc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *%rax
cmpl $0x2, %ebx
je 0x40149
cmpl $0x1, %ebx
jne 0x401b7
movsbl -0x30(%rbp), %ecx
leaq 0x75802(%rip), %rdx     # 0xb559d
jmp 0x40161
movq 0xbbec9(%rip), %rax     # 0xfbc70
testq %rax, %rax
jne 0x3fdba
leaq 0x4d7(%rip), %rax       # 0x4028a
movq %rax, 0xbbeb6(%rip)     # 0xfbc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rbx
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
movq -0x38(%rbp), %r12
movq %r12, %rdx
callq *%rax
shll $0x3, %r12d
movq %r13, %rdi
movq %rbx, %rsi
movl %r12d, %edx
callq 0x401d6
leaq 0x78d69(%rip), %rdx     # 0xb8b57
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rcx
jmp 0x40118
movl $0x0, -0x30(%rbp)
movq 0xbbe66(%rip), %rax     # 0xfbc70
testq %rax, %rax
jne 0x3fe1d
leaq 0x474(%rip), %rax       # 0x4028a
movq %rax, 0xbbe53(%rip)     # 0xfbc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *%rax
cmpl $0x2, %ebx
je 0x400fb
cmpl $0x1, %ebx
jne 0x401b7
movl -0x30(%rbp), %ecx
leaq 0x7c604(%rip), %rdx     # 0xbc452
jmp 0x40161
movq $0x0, -0x30(%rbp)
movq 0xbbe0e(%rip), %rax     # 0xfbc70
testq %rax, %rax
jne 0x3fe75
leaq 0x41c(%rip), %rax       # 0x4028a
movq %rax, 0xbbdfb(%rip)     # 0xfbc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *%rax
cmpl $0x2, %ebx
je 0x40121
cmpl $0x1, %ebx
jne 0x401b7
movsd -0x30(%rbp), %xmm0
leaq 0x7f641(%rip), %rdx     # 0xbf4e9
jmp 0x4017c
movw $0x0, -0x30(%rbp)
movq 0xbbdb6(%rip), %rax     # 0xfbc70
testq %rax, %rax
jne 0x3fecd
leaq 0x3c4(%rip), %rax       # 0x4028a
movq %rax, 0xbbda3(%rip)     # 0xfbc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *%rax
cmpl $0x2, %ebx
je 0x4012f
cmpl $0x1, %ebx
jne 0x401b7
movswl -0x30(%rbp), %ecx
leaq 0x756af(%rip), %rdx     # 0xb55ae
jmp 0x40161
movw $0x0, -0x30(%rbp)
movq 0xbbd5f(%rip), %rax     # 0xfbc70
testq %rax, %rax
jne 0x3ff24
leaq 0x36d(%rip), %rax       # 0x4028a
movq %rax, 0xbbd4c(%rip)     # 0xfbc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *%rax
cmpl $0x1, %ebx
je 0x4013c
cmpl $0x2, %ebx
jne 0x401b7
leaq 0x75660(%rip), %rdx     # 0xb55b2
jmp 0x40143
movq $0x0, -0x30(%rbp)
movq 0xbbd0a(%rip), %rax     # 0xfbc70
testq %rax, %rax
jne 0x3ff79
leaq 0x318(%rip), %rax       # 0x4028a
movq %rax, 0xbbcf7(%rip)     # 0xfbc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *%rax
cmpl $0x2, %ebx
je 0x40107
cmpl $0x1, %ebx
jne 0x401b7
movq -0x30(%rbp), %rcx
leaq 0x75628(%rip), %rdx     # 0xb55d3
jmp 0x40112
movb $0x0, -0x30(%rbp)
movq 0xbbcb5(%rip), %rax     # 0xfbc70
testq %rax, %rax
jne 0x3ffce
leaq 0x2c3(%rip), %rax       # 0x4028a
movq %rax, 0xbbca2(%rip)     # 0xfbc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *%rax
cmpl $0x1, %ebx
je 0x40156
cmpl $0x2, %ebx
jne 0x401b7
leaq 0x755a6(%rip), %rdx     # 0xb55a2
jmp 0x4015d
movl $0x0, -0x30(%rbp)
movq 0xbbc61(%rip), %rax     # 0xfbc70
testq %rax, %rax
jne 0x40022
leaq 0x26f(%rip), %rax       # 0x4028a
movq %rax, 0xbbc4e(%rip)     # 0xfbc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *%rax
cmpl $0x2, %ebx
je 0x400fb
cmpl $0x1, %ebx
jne 0x401b7
movl -0x30(%rbp), %ecx
leaq 0x858eb(%rip), %rdx     # 0xc593e
jmp 0x40161
movq $0x0, -0x30(%rbp)
movq 0xbbc09(%rip), %rax     # 0xfbc70
testq %rax, %rax
jne 0x4007a
leaq 0x217(%rip), %rax       # 0x4028a
movq %rax, 0xbbbf6(%rip)     # 0xfbc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *%rax
cmpl $0x2, %ebx
je 0x40107
cmpl $0x1, %ebx
jne 0x401b7
movq -0x30(%rbp), %rcx
leaq 0x7551c(%rip), %rdx     # 0xb55c4
jmp 0x40112
movl $0x0, -0x30(%rbp)
movq 0xbbbb8(%rip), %rax     # 0xfbc70
testq %rax, %rax
jne 0x400cb
leaq 0x1c6(%rip), %rax       # 0x4028a
movq %rax, 0xbbba5(%rip)     # 0xfbc70
movl 0xb0(%r13), %ecx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq *%rax
cmpl $0x1, %ebx
je 0x40170
cmpl $0x2, %ebx
jne 0x401b7
leaq 0x754df(%rip), %rdx     # 0xb55d8
jmp 0x40177
movl -0x30(%rbp), %ecx
leaq 0x754b8(%rip), %rdx     # 0xb55bd
jmp 0x40161
movq -0x30(%rbp), %rcx
leaq 0x754b7(%rip), %rdx     # 0xb55c9
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0xc470
jmp 0x40189
movsd -0x30(%rbp), %xmm0
leaq 0x754ab(%rip), %rdx     # 0xb55d8
jmp 0x4017c
movzwl -0x30(%rbp), %ecx
leaq 0x75478(%rip), %rdx     # 0xb55b2
jmp 0x40161
leaq 0x75476(%rip), %rdx     # 0xb55b9
movzwl -0x30(%rbp), %ecx
jmp 0x40161
movzbl -0x30(%rbp), %ecx
leaq 0x7544e(%rip), %rdx     # 0xb55a2
jmp 0x40161
leaq 0x7544c(%rip), %rdx     # 0xb55a9
movzbl -0x30(%rbp), %ecx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0xc470
jmp 0x40189
leaq 0x7f372(%rip), %rdx     # 0xbf4e9
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 0x75255(%rip), %rdi     # 0xb53f4
leaq 0x751d2(%rip), %rsi     # 0xb5378
leaq 0x75279(%rip), %rcx     # 0xb5426
movl $0x22c, %edx            # imm = 0x22C
callq 0xc140
leaq 0x77f2e(%rip), %rdi     # 0xb80ec
leaq 0x751b3(%rip), %rsi     # 0xb5378
leaq 0x7540f(%rip), %rcx     # 0xb55db
movl $0x2e2, %edx            # imm = 0x2E2
callq 0xc140