// File: Ciaxur[P]yagb-emu/include/imgui/imgui_draw.cpp
// Function: ImGui::ShadeVertsLinearColorGradientKeepAlpha(ImDrawList*, int, int, ImVec2, ImVec2, unsigned int, unsigned int)
void ImGui::ShadeVertsLinearColorGradientKeepAlpha(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1)
{
    ImVec2 gradient_extent = gradient_p1 - gradient_p0;
    float gradient_inv_length2 = 1.0f / ImLengthSqr(gradient_extent);
    ImDrawVert* vert_start = draw_list->VtxBuffer.Data + vert_start_idx;
    ImDrawVert* vert_end = draw_list->VtxBuffer.Data + vert_end_idx;
    const int col0_r = (int)(col0 >> IM_COL32_R_SHIFT) & 0xFF;
    const int col0_g = (int)(col0 >> IM_COL32_G_SHIFT) & 0xFF;
    const int col0_b = (int)(col0 >> IM_COL32_B_SHIFT) & 0xFF;
    const int col_delta_r = ((int)(col1 >> IM_COL32_R_SHIFT) & 0xFF) - col0_r;
    const int col_delta_g = ((int)(col1 >> IM_COL32_G_SHIFT) & 0xFF) - col0_g;
    const int col_delta_b = ((int)(col1 >> IM_COL32_B_SHIFT) & 0xFF) - col0_b;
    for (ImDrawVert* vert = vert_start; vert < vert_end; vert++)
    {
        float d = ImDot(vert->pos - gradient_p0, gradient_extent);
        float t = ImClamp(d * gradient_inv_length2, 0.0f, 1.0f);
        int r = (int)(col0_r + col_delta_r * t);
        int g = (int)(col0_g + col_delta_g * t);
        int b = (int)(col0_b + col_delta_b * t);
        vert->col = (r << IM_COL32_R_SHIFT) | (g << IM_COL32_G_SHIFT) | (b << IM_COL32_B_SHIFT) | (vert->col & IM_COL32_A_MASK);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movlpd %xmm0, -0x8(%rbp)
movlpd %xmm1, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movl %esi, -0x1c(%rbp)
movl %edx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
leaq -0x10(%rbp), %rdi
leaq -0x8(%rbp), %rsi
callq 0x111700
movlpd %xmm0, -0x30(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x115860
movaps %xmm0, %xmm1
movss 0x5b570(%rip), %xmm0    # 0x170c3c
divss %xmm1, %xmm0
movss %xmm0, -0x34(%rbp)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x20(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movl -0x24(%rbp), %eax
shrl $0x0, %eax
andl $0xff, %eax
movl %eax, -0x4c(%rbp)
movl -0x24(%rbp), %eax
shrl $0x8, %eax
andl $0xff, %eax
movl %eax, -0x50(%rbp)
movl -0x24(%rbp), %eax
shrl $0x10, %eax
andl $0xff, %eax
movl %eax, -0x54(%rbp)
movl -0x28(%rbp), %eax
shrl $0x0, %eax
andl $0xff, %eax
subl -0x4c(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x28(%rbp), %eax
shrl $0x8, %eax
andl $0xff, %eax
subl -0x50(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x28(%rbp), %eax
shrl $0x10, %eax
andl $0xff, %eax
subl -0x54(%rbp), %eax
movl %eax, -0x60(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0x115855
movq -0x68(%rbp), %rdi
leaq -0x8(%rbp), %rsi
callq 0x111700
movlpd %xmm0, -0x74(%rbp)
leaq -0x74(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1158a0
movss %xmm0, -0x6c(%rbp)
movss -0x6c(%rbp), %xmm0
mulss -0x34(%rbp), %xmm0
xorps %xmm1, %xmm1
movss 0x5b48d(%rip), %xmm2    # 0x170c3c
callq 0x1158e0
movss %xmm0, -0x78(%rbp)
cvtsi2ssl -0x4c(%rbp), %xmm1
cvtsi2ssl -0x58(%rbp), %xmm0
movss -0x78(%rbp), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x7c(%rbp)
cvtsi2ssl -0x50(%rbp), %xmm1
cvtsi2ssl -0x5c(%rbp), %xmm0
movss -0x78(%rbp), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x80(%rbp)
cvtsi2ssl -0x54(%rbp), %xmm1
cvtsi2ssl -0x60(%rbp), %xmm0
movss -0x78(%rbp), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x84(%rbp)
movl -0x7c(%rbp), %ecx
shll $0x0, %ecx
movl -0x80(%rbp), %eax
shll $0x8, %eax
orl %eax, %ecx
movl -0x84(%rbp), %eax
shll $0x10, %eax
orl %eax, %ecx
movq -0x68(%rbp), %rax
movl 0x10(%rax), %eax
andl $0xff000000, %eax       # imm = 0xFF000000
orl %eax, %ecx
movq -0x68(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x68(%rbp), %rax
addq $0x14, %rax
movq %rax, -0x68(%rbp)
jmp 0x115768
addq $0x90, %rsp
popq %rbp
retq
nop