// File: /workspace/github_cpp_makefile_star2_O2/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
subps %xmm0, %xmm1
movaps %xmm0, %xmm2
shufps $0x55, %xmm0, %xmm2     # xmm2 = xmm2[1,1],xmm0[1,1]
movaps %xmm1, %xmm3
shufps $0x55, %xmm1, %xmm3     # xmm3 = xmm3[1,1],xmm1[1,1]
movaps %xmm3, %xmm4
mulss %xmm3, %xmm4
movaps %xmm1, %xmm6
mulss %xmm1, %xmm6
addss %xmm4, %xmm6
movss 0x36676(%rip), %xmm4    # 0x9bff8
movaps %xmm4, %xmm5
divss %xmm6, %xmm5
movq 0x28(%rdi), %rdi
movslq %esi, %rax
imulq $0x14, %rax, %rax
addq %rdi, %rax
movslq %edx, %rdx
imulq $0x14, %rdx, %rdx
addq %rdi, %rdx
movl $0xff, %esi
movl %ecx, %edi
andl %esi, %edi
movl %ecx, %r9d
shrl $0x8, %r9d
andl %esi, %r9d
shrl $0x10, %ecx
andl %esi, %ecx
movl %r8d, %r10d
andl %esi, %r10d
subl %edi, %r10d
movl %r8d, %r11d
shrl $0x8, %r11d
andl %esi, %r11d
cvtsi2ss %edi, %xmm6
subl %r9d, %r11d
cvtsi2ss %r10d, %xmm7
shrl $0x10, %r8d
cvtsi2ss %r9d, %xmm8
andl %esi, %r8d
cvtsi2ss %r11d, %xmm9
subl %ecx, %r8d
cvtsi2ss %ecx, %xmm10
cvtsi2ss %r8d, %xmm11
xorps %xmm12, %xmm12
cmpq %rdx, %rax
jae 0x65a99
movss (%rax), %xmm13
movss 0x4(%rax), %xmm14
subss %xmm0, %xmm13
subss %xmm2, %xmm14
mulss %xmm3, %xmm14
mulss %xmm1, %xmm13
addss %xmm14, %xmm13
mulss %xmm5, %xmm13
movaps %xmm4, %xmm14
minss %xmm13, %xmm14
cmpltss %xmm12, %xmm13
andnps %xmm14, %xmm13
movaps %xmm7, %xmm14
mulss %xmm13, %xmm14
addss %xmm6, %xmm14
cvttss2si %xmm14, %ecx
movaps %xmm9, %xmm14
mulss %xmm13, %xmm14
addss %xmm8, %xmm14
cvttss2si %xmm14, %esi
mulss %xmm11, %xmm13
addss %xmm10, %xmm13
cvttss2si %xmm13, %edi
shll $0x8, %esi
shll $0x10, %edi
movzbl 0x13(%rax), %r8d
shll $0x18, %r8d
orl %ecx, %r8d
orl %esi, %r8d
orl %edi, %r8d
movl %r8d, 0x10(%rax)
addq $0x14, %rax
jmp 0x659fa
popq %rbp
retq
nop