// File: /workspace/github_cpp_makefile_star2_O1/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 0x598a0
movl %ecx, %r12d
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0xa468b(%rip), %r13     # 0xfdcd0
callq 0xc350
cmpq $0x21, %rax
jae 0x598bf
testq %r14, %r14
setne %al
testq %rbx, %rbx
setne %cl
testb %cl, %al
jne 0x59676
testq %r14, %r14
jne 0x5991c
testq %rbx, %rbx
jne 0x5991c
cmpl $0x3, %r12d
jae 0x598de
cmpl $0x0, 0x2024(%r13)
je 0x598fd
cmpl $0x2, %r12d
jb 0x596a2
cmpl $-0x1, 0x202c(%r13)
jne 0x5986e
leaq 0x2030(%r13), %rdi
movl $0x20, %edx
movq %r15, %rsi
callq 0xc110
movb $0x0, 0x2050(%r13)
movl 0x208c(%r13), %eax
testl %eax, %eax
jns 0x5975a
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
addl %eax, %ecx
xorl %r15d, %r15d
testl %ecx, %ecx
cmovgl %ecx, %r15d
movq 0xa45e8(%rip), %rax     # 0xfdcd0
testq %rax, %rax
je 0x596f3
incl 0x3b4(%rax)
movq 0xa45e6(%rip), %rsi     # 0xfdce0
movq %r15, %rdi
callq *0x9fe0d(%rip)          # 0xf9510
movq %rax, %r12
movq 0x2090(%r13), %rsi
testq %rsi, %rsi
je 0x5974c
movslq 0x2088(%r13), %rdx
movq %r12, %rdi
callq 0xc080
movq 0x2090(%r13), %rdi
testq %rdi, %rdi
je 0x5973f
movq 0xa459c(%rip), %rax     # 0xfdcd0
testq %rax, %rax
je 0x5973f
decl 0x3b4(%rax)
movq 0xa459a(%rip), %rsi     # 0xfdce0
callq *0x9fdcc(%rip)          # 0xf9518
movq %r12, 0x2090(%r13)
movl %r15d, 0x208c(%r13)
movl $0x0, 0x2088(%r13)
cmpq $0x11, %rbx
jb 0x59790
movl 0x208c(%r13), %eax
cmpl %ebx, %eax
jge 0x59847
testl %eax, %eax
je 0x597bc
movl %eax, %r12d
shrl $0x1f, %r12d
addl %eax, %r12d
sarl %r12d
addl %eax, %r12d
jmp 0x597c2
testq %rbx, %rbx
je 0x597ac
leaq 0x2098(%r13), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x2098(%r13)
jmp 0x59855
movq $0x0, 0x2018(%r13)
jmp 0x59867
movl $0x8, %r12d
cmpl %ebx, %r12d
cmovlel %ebx, %r12d
cmpl %r12d, %eax
jge 0x59847
movslq %r12d, %rdi
movq 0xa44f8(%rip), %rax     # 0xfdcd0
testq %rax, %rax
je 0x597e3
incl 0x3b4(%rax)
movq 0xa44f6(%rip), %rsi     # 0xfdce0
callq *0x9fd20(%rip)          # 0xf9510
movq %rax, %r15
movq 0x2090(%r13), %rsi
testq %rsi, %rsi
je 0x59839
movslq 0x2088(%r13), %rdx
movq %r15, %rdi
callq 0xc080
movq 0x2090(%r13), %rdi
testq %rdi, %rdi
je 0x5982c
movq 0xa44af(%rip), %rax     # 0xfdcd0
testq %rax, %rax
je 0x5982c
decl 0x3b4(%rax)
movq 0xa44ad(%rip), %rsi     # 0xfdce0
callq *0x9fcdf(%rip)          # 0xf9518
movq %r15, 0x2090(%r13)
movl %r12d, 0x208c(%r13)
movl %ebx, 0x2088(%r13)
movq 0x2090(%r13), %rdi
movq %rdi, 0x2018(%r13)
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
leaq 0x60c35(%rip), %rdi     # 0xba4dc
leaq 0x5e8b7(%rip), %rsi     # 0xb8165
leaq 0x60c36(%rip), %rcx     # 0xba4eb
movl $0x25b1, %edx           # imm = 0x25B1
callq 0xc140
leaq 0x60c73(%rip), %rdi     # 0xba539
leaq 0x5e898(%rip), %rsi     # 0xb8165
leaq 0x60c17(%rip), %rcx     # 0xba4eb
movl $0x25b2, %edx           # imm = 0x25B2
callq 0xc140
leaq 0x60d1f(%rip), %rdi     # 0xba604
leaq 0x5e879(%rip), %rsi     # 0xb8165
leaq 0x60bf8(%rip), %rcx     # 0xba4eb
movl $0x25b4, %edx           # imm = 0x25B4
callq 0xc140
leaq 0x60d33(%rip), %rdi     # 0xba637
leaq 0x5e85a(%rip), %rsi     # 0xb8165
leaq 0x60bd9(%rip), %rcx     # 0xba4eb
movl $0x25b5, %edx           # imm = 0x25B5
callq 0xc140
leaq 0x60c99(%rip), %rdi     # 0xba5bc
leaq 0x5e83b(%rip), %rsi     # 0xb8165
leaq 0x60bba(%rip), %rcx     # 0xba4eb
movl $0x25b3, %edx           # imm = 0x25B3
callq 0xc140