// File: /workspace/github_cpp_makefile_star2_O3/Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGui::SetDragDropPayload(char const*, void const*, unsigned long, int)
bool ImGui::SetDragDropPayload(const char* type, const void* data, size_t data_size, ImGuiCond cond)
{
    ImGuiContext& g = *GImGui;
    ImGuiPayload& payload = g.DragDropPayload;
    if (cond == 0)
        cond = ImGuiCond_Always;

    IM_ASSERT(type != NULL);
    IM_ASSERT(strlen(type) < IM_ARRAYSIZE(payload.DataType) && "Payload type can be at most 32 characters long");
    IM_ASSERT((data != NULL && data_size > 0) || (data == NULL && data_size == 0));
    IM_ASSERT(cond == ImGuiCond_Always || cond == ImGuiCond_Once);
    IM_ASSERT(payload.SourceId != 0);                               // Not called between BeginDragDropSource() and EndDragDropSource()

    if (cond == ImGuiCond_Always || payload.DataFrameCount == -1)
    {
        // Copy payload
        ImStrncpy(payload.DataType, type, IM_ARRAYSIZE(payload.DataType));
        g.DragDropPayloadBufHeap.resize(0);
        if (data_size > sizeof(g.DragDropPayloadBufLocal))
        {
            // Store in heap
            g.DragDropPayloadBufHeap.resize((int)data_size);
            payload.Data = g.DragDropPayloadBufHeap.Data;
            memcpy(payload.Data, data, data_size);
        }
        else if (data_size > 0)
        {
            // Store locally
            memset(&g.DragDropPayloadBufLocal, 0, sizeof(g.DragDropPayloadBufLocal));
            payload.Data = g.DragDropPayloadBufLocal;
            memcpy(payload.Data, data, data_size);
        }
        else
        {
            payload.Data = NULL;
        }
        payload.DataSize = (int)data_size;
    }
    payload.DataFrameCount = g.FrameCount;

    return (g.DragDropAcceptFrameCount == g.FrameCount) || (g.DragDropAcceptFrameCount == g.FrameCount - 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x5871c
movl %ecx, %r12d
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0xa37f6(%rip), %r13     # 0xfbcd0
callq 0xc350
cmpq $0x21, %rax
jae 0x5873b
testq %r14, %r14
setne %al
testq %rbx, %rbx
setne %cl
testb %cl, %al
jne 0x5850b
testq %r14, %r14
jne 0x58798
testq %rbx, %rbx
jne 0x58798
cmpl $0x3, %r12d
jae 0x5875a
cmpl $0x0, 0x2024(%r13)
je 0x58779
cmpl $0x2, %r12d
jb 0x58537
cmpl $-0x1, 0x202c(%r13)
jne 0x586dd
leaq 0x2030(%r13), %rdi
movl $0x20, %edx
movq %r15, %rsi
callq 0xc110
movb $0x0, 0x2050(%r13)
movl 0x208c(%r13), %r12d
testl %r12d, %r12d
jns 0x585de
movq 0xa376a(%rip), %rax     # 0xfbcd0
testq %rax, %rax
je 0x58571
incl 0x3b4(%rax)
movq 0xa3768(%rip), %rsi     # 0xfbce0
xorl %r12d, %r12d
xorl %edi, %edi
callq *0x9ef8d(%rip)          # 0xf7510
movq %rax, %r15
movq 0x2090(%r13), %rsi
testq %rsi, %rsi
je 0x585cc
movslq 0x2088(%r13), %rdx
movq %r15, %rdi
callq 0xc080
movq 0x2090(%r13), %rdi
testq %rdi, %rdi
je 0x585bf
movq 0xa371c(%rip), %rax     # 0xfbcd0
testq %rax, %rax
je 0x585bf
decl 0x3b4(%rax)
movq 0xa371a(%rip), %rsi     # 0xfbce0
callq *0x9ef4c(%rip)          # 0xf7518
movq %r15, 0x2090(%r13)
movl $0x0, 0x208c(%r13)
movl $0x0, 0x2088(%r13)
cmpq $0x11, %rbx
jb 0x58693
cmpl %ebx, %r12d
jge 0x586b3
movl %r12d, %eax
shrl %eax
addl %r12d, %eax
testl %r12d, %r12d
movl $0x8, %r15d
cmovnel %eax, %r15d
cmpl %ebx, %r15d
cmovbel %ebx, %r15d
movq 0xa36b1(%rip), %rax     # 0xfbcd0
testq %rax, %rax
je 0x5862a
incl 0x3b4(%rax)
movq 0xa36af(%rip), %rsi     # 0xfbce0
movq %r15, %rdi
callq *0x9eed6(%rip)          # 0xf7510
movq %rax, %r12
movq 0x2090(%r13), %rsi
testq %rsi, %rsi
je 0x58683
movslq 0x2088(%r13), %rdx
movq %r12, %rdi
callq 0xc080
movq 0x2090(%r13), %rdi
testq %rdi, %rdi
je 0x58676
movq 0xa3665(%rip), %rax     # 0xfbcd0
testq %rax, %rax
je 0x58676
decl 0x3b4(%rax)
movq 0xa3663(%rip), %rsi     # 0xfbce0
callq *0x9ee95(%rip)          # 0xf7518
movq %r12, 0x2090(%r13)
movl %r15d, 0x208c(%r13)
jmp 0x586ba
testq %rbx, %rbx
je 0x5870f
leaq 0x2098(%r13), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x2098(%r13)
movq %rdi, 0x2018(%r13)
jmp 0x586cb
movq 0x2090(%r13), %r12
movl %ebx, 0x2088(%r13)
movq %r12, 0x2018(%r13)
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xc080
movl %ebx, 0x2020(%r13)
movl 0x1a68(%r13), %eax
movl %eax, 0x202c(%r13)
movl 0x207c(%r13), %ecx
cmpl %eax, %ecx
sete %dl
decl %eax
cmpl %eax, %ecx
sete %al
orb %dl, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $0x0, 0x2018(%r13)
jmp 0x586d6
leaq 0x5fdb9(%rip), %rdi     # 0xb84dc
leaq 0x5da3b(%rip), %rsi     # 0xb6165
leaq 0x5fdba(%rip), %rcx     # 0xb84eb
movl $0x25b1, %edx           # imm = 0x25B1
callq 0xc140
leaq 0x5fdf7(%rip), %rdi     # 0xb8539
leaq 0x5da1c(%rip), %rsi     # 0xb6165
leaq 0x5fd9b(%rip), %rcx     # 0xb84eb
movl $0x25b2, %edx           # imm = 0x25B2
callq 0xc140
leaq 0x5fea3(%rip), %rdi     # 0xb8604
leaq 0x5d9fd(%rip), %rsi     # 0xb6165
leaq 0x5fd7c(%rip), %rcx     # 0xb84eb
movl $0x25b4, %edx           # imm = 0x25B4
callq 0xc140
leaq 0x5feb7(%rip), %rdi     # 0xb8637
leaq 0x5d9de(%rip), %rsi     # 0xb6165
leaq 0x5fd5d(%rip), %rcx     # 0xb84eb
movl $0x25b5, %edx           # imm = 0x25B5
callq 0xc140
leaq 0x5fe1d(%rip), %rdi     # 0xb85bc
leaq 0x5d9bf(%rip), %rsi     # 0xb6165
leaq 0x5fd3e(%rip), %rcx     # 0xb84eb
movl $0x25b3, %edx           # imm = 0x25B3
callq 0xc140