// File: donfreiday[P]gb/./imgui/imgui.cpp
// Function: ImGui::ImageButton(void*, ImVec2 const&, ImVec2 const&, ImVec2 const&, int, ImVec4 const&, ImVec4 const&)
bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, int frame_padding, const ImVec4& bg_col, const ImVec4& tint_col)
{
    ImGuiWindow* window = GetCurrentWindow();
    if (window->SkipItems)
        return false;

    ImGuiState& g = *GImGui;
    const ImGuiStyle& style = g.Style;

    // Default to using texture ID as ID. User can still push string/integer prefixes.
    // We could hash the size/uv to create a unique ID but that would prevent the user from animating UV.
    ImGui::PushID((void *)user_texture_id);
    const ImGuiID id = window->GetID("#image");
    ImGui::PopID();

    const ImVec2 padding = (frame_padding >= 0) ? ImVec2((float)frame_padding, (float)frame_padding) : style.FramePadding;
    const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size + padding*2);
    const ImRect image_bb(window->DC.CursorPos + padding, window->DC.CursorPos + padding + size);
    ItemSize(bb);
    if (!ItemAdd(bb, &id))
        return false;

    bool hovered, held;
    bool pressed = ButtonBehavior(bb, id, &hovered, &held, true);

    // Render
    const ImU32 col = window->Color((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
    RenderFrame(bb.Min, bb.Max, col);
    if (bg_col.w > 0.0f)
        window->DrawList->AddRectFilled(image_bb.Min, image_bb.Max, window->Color(bg_col));
    window->DrawList->AddImage(user_texture_id, image_bb.Min, image_bb.Max, uv0, uv1, window->Color(tint_col));

    return pressed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movq %r9, -0x38(%rbp)
callq 0x2e220
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
testb $0x1, 0x74(%rax)
je 0x1b1a3
movb $0x0, -0x1(%rbp)
jmp 0x1b4e3
movq 0x5e316(%rip), %rax     # 0x794c0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
addq $0x13e8, %rax           # imm = 0x13E8
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1b500
movq -0x40(%rbp), %rdi
leaq 0x40bfc(%rip), %rsi     # 0x5bdcc
xorl %eax, %eax
movl %eax, %edx
callq 0xbc60
movl %eax, -0x54(%rbp)
callq 0x1b550
cmpl $0x0, -0x2c(%rbp)
jl 0x1b1fc
cvtsi2ssl -0x2c(%rbp), %xmm0
cvtsi2ssl -0x2c(%rbp), %xmm1
leaq -0x5c(%rbp), %rdi
callq 0x2d280
jmp 0x1b208
movq -0x50(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x5c(%rbp)
movq -0x40(%rbp), %rdi
addq $0xa8, %rdi
movq %rdi, -0xd8(%rbp)
movq -0x18(%rbp), %rsi
callq 0xc7e0
movlpd %xmm0, -0x7c(%rbp)
leaq -0x5c(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
movss 0x3fe7d(%rip), %xmm0    # 0x5b0b8
callq 0xe4b0
movlpd %xmm0, -0x84(%rbp)
leaq -0x7c(%rbp), %rdi
leaq -0x84(%rbp), %rsi
callq 0xc7e0
movq -0xd8(%rbp), %rsi
movlpd %xmm0, -0x74(%rbp)
leaq -0x6c(%rbp), %rdi
leaq -0x74(%rbp), %rdx
callq 0x2eb40
movq -0xd0(%rbp), %rsi
movq -0x40(%rbp), %rdi
addq $0xa8, %rdi
callq 0xc7e0
movq -0xd0(%rbp), %rsi
movlpd %xmm0, -0x9c(%rbp)
movq -0x40(%rbp), %rdi
addq $0xa8, %rdi
callq 0xc7e0
movlpd %xmm0, -0xac(%rbp)
movq -0x18(%rbp), %rsi
leaq -0xac(%rbp), %rdi
callq 0xc7e0
movlpd %xmm0, -0xa4(%rbp)
leaq -0x94(%rbp), %rdi
leaq -0x9c(%rbp), %rsi
leaq -0xa4(%rbp), %rdx
callq 0x2eb40
leaq -0x6c(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0xc060
leaq -0x6c(%rbp), %rdi
leaq -0x54(%rbp), %rsi
callq 0xc0a0
testb $0x1, %al
jne 0x1b307
movb $0x0, -0x1(%rbp)
jmp 0x1b4e3
movl -0x54(%rbp), %esi
leaq -0x6c(%rbp), %rdi
leaq -0xad(%rbp), %rdx
leaq -0xae(%rbp), %rcx
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x17010
andb $0x1, %al
movb %al, -0xaf(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0xe0(%rbp)
testb $0x1, -0xad(%rbp)
je 0x1b35c
testb $0x1, -0xae(%rbp)
je 0x1b35c
movl $0x17, %eax
movl %eax, -0xe4(%rbp)
jmp 0x1b378
movb -0xad(%rbp), %dl
movl $0x15, %eax
movl $0x16, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0xe4(%rbp)
movq -0xe0(%rbp), %rdi
movl -0xe4(%rbp), %esi
movss 0x3fc8b(%rip), %xmm0    # 0x5b018
callq 0x2ea40
movl %eax, -0xb4(%rbp)
movq -0x6c(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x64(%rbp), %rax
movq %rax, -0xc8(%rbp)
movl -0xb4(%rbp), %edi
movsd -0xc0(%rbp), %xmm0
movsd -0xc8(%rbp), %xmm1
movl $0x1, %esi
xorps %xmm2, %xmm2
callq 0x10a20
movq -0x38(%rbp), %rax
movss 0xc(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x1b446
movq -0x40(%rbp), %rax
movq 0x270(%rax), %rax
movq %rax, -0x100(%rbp)
leaq -0x94(%rbp), %rax
movq %rax, -0xf8(%rbp)
leaq -0x94(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xf0(%rbp)
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x2fd20
movq -0x100(%rbp), %rdi
movq -0xf8(%rbp), %rsi
movq -0xf0(%rbp), %rdx
movl %eax, %ecx
xorps %xmm0, %xmm0
movl $0xf, %r8d
callq 0x40670
movq -0x40(%rbp), %rax
movq 0x270(%rax), %rax
movq %rax, -0x130(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x128(%rbp)
leaq -0x94(%rbp), %rax
movq %rax, -0x120(%rbp)
leaq -0x94(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x118(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x40(%rbp), %rdi
movq 0x10(%rbp), %rsi
callq 0x2fd20
movq -0x130(%rbp), %rdi
movq -0x128(%rbp), %rsi
movq -0x120(%rbp), %rdx
movq -0x118(%rbp), %rcx
movq -0x110(%rbp), %r8
movq -0x108(%rbp), %r9
movl %eax, (%rsp)
callq 0x41720
movb -0xaf(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopw %cs:(%rax,%rax)