// File: Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGui::AcceptDragDropPayload(char const*, int)
const ImGuiPayload* ImGui::AcceptDragDropPayload(const char* type, ImGuiDragDropFlags flags)
{
    ImGuiContext& g = *GImGui;
    ImGuiWindow* window = g.CurrentWindow;
    ImGuiPayload& payload = g.DragDropPayload;
    IM_ASSERT(g.DragDropActive);                        // Not called between BeginDragDropTarget() and EndDragDropTarget() ?
    IM_ASSERT(payload.DataFrameCount != -1);            // Forgot to call EndDragDropTarget() ?
    if (type != NULL && !payload.IsDataType(type))
        return NULL;

    // Accept smallest drag target bounding box, this allows us to nest drag targets conveniently without ordering constraints.
    // NB: We currently accept NULL id as target. However, overlapping targets requires a unique ID to function!
    const bool was_accepted_previously = (g.DragDropAcceptIdPrev == g.DragDropTargetId);
    ImRect r = g.DragDropTargetRect;
    float r_surface = r.GetWidth() * r.GetHeight();
    if (r_surface <= g.DragDropAcceptIdCurrRectSurface)
    {
        g.DragDropAcceptFlags = flags;
        g.DragDropAcceptIdCurr = g.DragDropTargetId;
        g.DragDropAcceptIdCurrRectSurface = r_surface;
    }

    // Render default drop visuals
    payload.Preview = was_accepted_previously;
    flags |= (g.DragDropSourceFlags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect); // Source can also inhibit the preview (useful for external sources that lives for 1 frame)
    if (!(flags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect) && payload.Preview)
    {
        // FIXME-DRAG: Settle on a proper default visuals for drop target.
        r.Expand(3.5f);
        bool push_clip_rect = !window->ClipRect.Contains(r);
        if (push_clip_rect) window->DrawList->PushClipRect(r.Min - ImVec2(1, 1), r.Max + ImVec2(1, 1));
        window->DrawList->AddRect(r.Min, r.Max, GetColorU32(ImGuiCol_DragDropTarget), 0.0f, ~0, 2.0f);
        if (push_clip_rect) window->DrawList->PopClipRect();
    }

    g.DragDropAcceptFrameCount = g.FrameCount;
    payload.Delivery = was_accepted_previously && !IsMouseDown(g.DragDropMouseButton); // For extern drag sources affecting os window focus, it's easier to just test !IsMouseDown() instead of IsMouseReleased()
    if (!payload.Delivery && !(flags & ImGuiDragDropFlags_AcceptBeforeDelivery))
        return NULL;

    return &payload;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq 0x132927(%rip), %rax    # 0x212f40
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x1ae0(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
addq $0x2018, %rax           # imm = 0x2018
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
testb $0x1, 0x2004(%rax)
je 0xe0649
jmp 0xe0668
leaq 0x930dd(%rip), %rdi     # 0x17372d
leaq 0x928b2(%rip), %rsi     # 0x172f09
movl $0x2616, %edx           # imm = 0x2616
leaq 0x950db(%rip), %rcx     # 0x17573e
callq 0xd180
movq -0x30(%rbp), %rax
cmpl $-0x1, 0x14(%rax)
je 0xe0674
jmp 0xe0693
leaq 0x95116(%rip), %rdi     # 0x175791
leaq 0x92887(%rip), %rsi     # 0x172f09
movl $0x2617, %edx           # imm = 0x2617
leaq 0x950b0(%rip), %rcx     # 0x17573e
callq 0xd180
cmpq $0x0, -0x10(%rbp)
je 0xe06b8
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xec220
testb $0x1, %al
jne 0xe06b8
movq $0x0, -0x8(%rbp)
jmp 0xe095e
movq -0x20(%rbp), %rax
movl 0x2078(%rax), %eax
movq -0x20(%rbp), %rcx
cmpl 0x2068(%rcx), %eax
sete %al
andb $0x1, %al
movb %al, -0x31(%rbp)
movq -0x20(%rbp), %rax
movq 0x2058(%rax), %rcx
movq %rcx, -0x44(%rbp)
movq 0x2060(%rax), %rax
movq %rax, -0x3c(%rbp)
leaq -0x44(%rbp), %rdi
callq 0xeb840
movss %xmm0, -0x70(%rbp)
leaq -0x44(%rbp), %rdi
callq 0xeb860
movaps %xmm0, %xmm1
movss -0x70(%rbp), %xmm0
mulss %xmm1, %xmm0
movss %xmm0, -0x48(%rbp)
movss -0x48(%rbp), %xmm1
movq -0x20(%rbp), %rax
movss 0x2070(%rax), %xmm0
ucomiss %xmm1, %xmm0
jb 0xe075e
movl -0x14(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x206c(%rax)
movq -0x20(%rbp), %rax
movl 0x2068(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x2074(%rax)
movss -0x48(%rbp), %xmm0
movq -0x20(%rbp), %rax
movss %xmm0, 0x2070(%rax)
movb -0x31(%rbp), %cl
movq -0x30(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x39(%rax)
movq -0x20(%rbp), %rax
movl 0x2008(%rax), %eax
andl $0x800, %eax            # imm = 0x800
orl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0xe08ec
movq -0x30(%rbp), %rax
testb $0x1, 0x39(%rax)
je 0xe08ec
leaq -0x44(%rbp), %rdi
movss 0x92021(%rip), %xmm0    # 0x1727cc
callq 0xeb9c0
movq -0x28(%rbp), %rdi
addq $0x258, %rdi            # imm = 0x258
leaq -0x44(%rbp), %rsi
callq 0xe8a40
xorb $-0x1, %al
andb $0x1, %al
movb %al, -0x49(%rbp)
testb $0x1, -0x49(%rbp)
je 0xe0869
movq -0x28(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0x78(%rbp)
leaq -0x5c(%rbp), %rdi
movq %rdi, -0x98(%rbp)
movss 0x90445(%rip), %xmm1    # 0x170c3c
movss %xmm1, -0x8c(%rbp)
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0x98(%rbp), %rsi
leaq -0x44(%rbp), %rdi
callq 0xc3c00
movss -0x8c(%rbp), %xmm1
movlpd %xmm0, -0x54(%rbp)
leaq -0x3c(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x6c(%rbp), %rdi
movq %rdi, -0x80(%rbp)
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0x88(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0xc41b0
movq -0x78(%rbp), %rdi
movlpd %xmm0, -0x64(%rbp)
movsd -0x54(%rbp), %xmm0
movsd -0x64(%rbp), %xmm1
xorl %esi, %esi
callq 0x10f4f0
movq -0x28(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0xb0(%rbp)
leaq -0x44(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0x44(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xa0(%rbp)
movl $0x30, %edi
movss 0x9039a(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq -0xa0(%rbp), %rdx
movl %eax, %ecx
xorps %xmm0, %xmm0
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movss 0x916fd(%rip), %xmm1    # 0x171fcc
callq 0x112ef0
testb $0x1, -0x49(%rbp)
je 0xe08ea
movq -0x28(%rbp), %rax
movq 0x2b8(%rax), %rdi
callq 0x10f6c0
jmp 0xe08ec
movq -0x20(%rbp), %rax
movl 0x1a68(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x207c(%rax)
xorl %eax, %eax
testb $0x1, -0x31(%rbp)
movb %al, -0xb1(%rbp)
je 0xe0925
movq -0x20(%rbp), %rax
movl 0x2010(%rax), %edi
callq 0xd4050
xorb $-0x1, %al
movb %al, -0xb1(%rbp)
movb -0xb1(%rbp), %cl
movq -0x30(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x3a(%rax)
movq -0x30(%rbp), %rax
testb $0x1, 0x3a(%rax)
jne 0xe0956
movl -0x14(%rbp), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
jne 0xe0956
movq $0x0, -0x8(%rbp)
jmp 0xe095e
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax,%rax)