// File: /workspace/github_cpp_makefile_star2_O3/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:
cmpl %edx, %esi
jge 0x7ae7a
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 0x3a283(%rip), %xmm4    # 0xb4fe4
movaps %xmm4, %xmm5
divss %xmm6, %xmm5
movq 0x28(%rdi), %rdi
movslq %edx, %rax
leaq (%rax,%rax,4), %rax
leaq (%rdi,%rax,4), %rax
movslq %esi, %rdx
leaq (%rdx,%rdx,4), %rdx
leaq (%rdi,%rdx,4), %rdx
movl %r8d, %esi
shrl $0x10, %esi
movl $0xff, %r9d
andl %r9d, %esi
movl %ecx, %edi
shrl $0x10, %edi
andl %r9d, %edi
movl %r8d, %r10d
shrl $0x8, %r10d
andl %r9d, %r10d
movl %ecx, %r11d
shrl $0x8, %r11d
andl %r9d, %r8d
andl %r9d, %ecx
xorps %xmm6, %xmm6
cvtsi2ss %ecx, %xmm6
subl %ecx, %r8d
cvtsi2ss %r8d, %xmm7
andl %r9d, %r11d
cvtsi2ss %r11d, %xmm8
subl %r11d, %r10d
cvtsi2ss %r10d, %xmm9
subl %edi, %esi
cvtsi2ss %edi, %xmm10
cvtsi2ss %esi, %xmm11
xorps %xmm12, %xmm12
movss (%rdx), %xmm13
movss 0x4(%rdx), %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(%rdx), %r8d
shll $0x18, %r8d
orl %ecx, %r8d
orl %esi, %r8d
orl %edi, %r8d
movl %r8d, 0x10(%rdx)
addq $0x14, %rdx
cmpq %rax, %rdx
jb 0x7addf
popq %rbp
retq
nop