// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/include/imgui/imgui_draw.cpp
// Function: ImDrawList::AddConvexPolyFilled(ImVec2 const*, int, unsigned int)
void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_count, ImU32 col)
{
    if (points_count < 3)
        return;

    const ImVec2 uv = _Data->TexUvWhitePixel;

    if (Flags & ImDrawListFlags_AntiAliasedFill)
    {
        // Anti-aliased Fill
        const float AA_SIZE = _FringeScale;
        const ImU32 col_trans = col & ~IM_COL32_A_MASK;
        const int idx_count = (points_count - 2)*3 + points_count * 6;
        const int vtx_count = (points_count * 2);
        PrimReserve(idx_count, vtx_count);

        // Add indexes for fill
        unsigned int vtx_inner_idx = _VtxCurrentIdx;
        unsigned int vtx_outer_idx = _VtxCurrentIdx + 1;
        for (int i = 2; i < points_count; i++)
        {
            _IdxWritePtr[0] = (ImDrawIdx)(vtx_inner_idx); _IdxWritePtr[1] = (ImDrawIdx)(vtx_inner_idx + ((i - 1) << 1)); _IdxWritePtr[2] = (ImDrawIdx)(vtx_inner_idx + (i << 1));
            _IdxWritePtr += 3;
        }

        // Compute normals
        ImVec2* temp_normals = (ImVec2*)alloca(points_count * sizeof(ImVec2)); //-V630
        for (int i0 = points_count - 1, i1 = 0; i1 < points_count; i0 = i1++)
        {
            const ImVec2& p0 = points[i0];
            const ImVec2& p1 = points[i1];
            float dx = p1.x - p0.x;
            float dy = p1.y - p0.y;
            IM_NORMALIZE2F_OVER_ZERO(dx, dy);
            temp_normals[i0].x = dy;
            temp_normals[i0].y = -dx;
        }

        for (int i0 = points_count - 1, i1 = 0; i1 < points_count; i0 = i1++)
        {
            // Average normals
            const ImVec2& n0 = temp_normals[i0];
            const ImVec2& n1 = temp_normals[i1];
            float dm_x = (n0.x + n1.x) * 0.5f;
            float dm_y = (n0.y + n1.y) * 0.5f;
            IM_FIXNORMAL2F(dm_x, dm_y);
            dm_x *= AA_SIZE * 0.5f;
            dm_y *= AA_SIZE * 0.5f;

            // Add vertices
            _VtxWritePtr[0].pos.x = (points[i1].x - dm_x); _VtxWritePtr[0].pos.y = (points[i1].y - dm_y); _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col;        // Inner
            _VtxWritePtr[1].pos.x = (points[i1].x + dm_x); _VtxWritePtr[1].pos.y = (points[i1].y + dm_y); _VtxWritePtr[1].uv = uv; _VtxWritePtr[1].col = col_trans;  // Outer
            _VtxWritePtr += 2;

            // Add indexes for fringes
            _IdxWritePtr[0] = (ImDrawIdx)(vtx_inner_idx + (i1 << 1)); _IdxWritePtr[1] = (ImDrawIdx)(vtx_inner_idx + (i0 << 1)); _IdxWritePtr[2] = (ImDrawIdx)(vtx_outer_idx + (i0 << 1));
            _IdxWritePtr[3] = (ImDrawIdx)(vtx_outer_idx + (i0 << 1)); _IdxWritePtr[4] = (ImDrawIdx)(vtx_outer_idx + (i1 << 1)); _IdxWritePtr[5] = (ImDrawIdx)(vtx_inner_idx + (i1 << 1));
            _IdxWritePtr += 6;
        }
        _VtxCurrentIdx += (ImDrawIdx)vtx_count;
    }
    else
    {
        // Non Anti-aliased Fill
        const int idx_count = (points_count - 2)*3;
        const int vtx_count = points_count;
        PrimReserve(idx_count, vtx_count);
        for (int i = 0; i < vtx_count; i++)
        {
            _VtxWritePtr[0].pos = points[i]; _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col;
            _VtxWritePtr++;
        }
        for (int i = 2; i < points_count; i++)
        {
            _IdxWritePtr[0] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[1] = (ImDrawIdx)(_VtxCurrentIdx + i - 1); _IdxWritePtr[2] = (ImDrawIdx)(_VtxCurrentIdx + i);
            _IdxWritePtr += 3;
        }
        _VtxCurrentIdx += (ImDrawIdx)vtx_count;
    }
}

// Assembly:
cmpl $0x3, %edx
jl 0x63482
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r14d
movl %edx, %r12d
movq %rsi, %r15
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq (%rax), %r13
testb $0x4, 0x30(%rdi)
jne 0x6321e
leal (%r12,%r12,2), %esi
addl $-0x6, %esi
movq %rbx, %rdi
movl %r12d, %edx
callq 0x623b8
movl %r12d, %eax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x6326d
movq 0x48(%rbx), %rdx
movq (%r15,%rcx,8), %rsi
movq %rsi, (%rdx)
movq 0x48(%rbx), %rdx
movq %r13, 0x8(%rdx)
movq 0x48(%rbx), %rdx
movl %r14d, 0x10(%rdx)
addq $0x14, %rdx
movq %rdx, 0x48(%rbx)
incq %rcx
jmp 0x631f1
movss 0xc0(%rbx), %xmm0
movss %xmm0, -0x30(%rbp)
leal (%r12,%r12,8), %esi
addl $-0x6, %esi
leal (%r12,%r12), %edx
movq %rbx, %rdi
movl %edx, -0x2c(%rbp)
callq 0x623b8
movl 0x34(%rbx), %eax
movq 0x50(%rbx), %rcx
leal -0x2(%r12), %edx
leal 0x2(%rax), %esi
subl $0x1, %edx
jb 0x6329f
movw %ax, (%rcx)
movw %si, 0x2(%rcx)
addl $0x2, %esi
movw %si, 0x4(%rcx)
addq $0x6, %rcx
movq %rcx, 0x50(%rbx)
jmp 0x63250
movl 0x34(%rbx), %eax
movq 0x50(%rbx), %rcx
leal -0x2(%r12), %edx
leal 0x2(%rax), %esi
subl $0x1, %edx
jb 0x63343
movw %ax, (%rcx)
leal -0x1(%rsi), %edi
movw %di, 0x2(%rcx)
movw %si, 0x4(%rcx)
addq $0x6, %rcx
movq %rcx, 0x50(%rbx)
incl %esi
jmp 0x6327c
movl %r14d, %ecx
andl $0xffffff, %ecx         # imm = 0xFFFFFF
movl %r12d, %edx
movq %rsp, %rsi
leaq 0xf(,%rdx,8), %rdi
andq $-0x10, %rdi
subq %rdi, %rsi
movq %rsi, %rsp
decl %r12d
xorl %edi, %edi
xorps %xmm1, %xmm1
movss 0x38d28(%rip), %xmm0    # 0x9bff8
movaps 0x38d09(%rip), %xmm2    # 0x9bfe0
movl %r12d, %r8d
movss -0x30(%rbp), %xmm7
cmpq %rdi, %rdx
je 0x63351
movslq %r8d, %r8
movss (%r15,%rdi,8), %xmm3
movss 0x4(%r15,%rdi,8), %xmm4
subss (%r15,%r8,8), %xmm3
subss 0x4(%r15,%r8,8), %xmm4
movaps %xmm4, %xmm6
mulss %xmm4, %xmm6
movaps %xmm3, %xmm5
mulss %xmm3, %xmm5
addss %xmm6, %xmm5
ucomiss %xmm1, %xmm5
jbe 0x6332b
sqrtss %xmm5, %xmm5
movaps %xmm0, %xmm6
divss %xmm5, %xmm6
mulss %xmm6, %xmm3
mulss %xmm6, %xmm4
xorps %xmm2, %xmm3
movss %xmm4, (%rsi,%r8,8)
movss %xmm3, 0x4(%rsi,%r8,8)
movl %edi, %r8d
incq %rdi
jmp 0x632df
movzwl %r12w, %ecx
addl %ecx, %eax
movl %eax, 0x34(%rbx)
jmp 0x63474
mulss 0x38cbf(%rip), %xmm7    # 0x9c018
leal 0x1(%rax), %edi
xorl %r8d, %r8d
movss 0x38cb1(%rip), %xmm1    # 0x9c018
movl %eax, %r9d
cmpq %r8, %rdx
je 0x63469
movslq %r12d, %r10
movss (%rsi,%r10,8), %xmm2
movss 0x4(%rsi,%r10,8), %xmm3
addss (%rsi,%r8,8), %xmm2
addss 0x4(%rsi,%r8,8), %xmm3
mulss %xmm1, %xmm2
mulss %xmm1, %xmm3
movaps %xmm3, %xmm4
mulss %xmm3, %xmm4
movaps %xmm2, %xmm5
mulss %xmm2, %xmm5
addss %xmm4, %xmm5
movaps %xmm1, %xmm4
maxss %xmm5, %xmm4
movaps %xmm0, %xmm5
divss %xmm4, %xmm5
mulss %xmm5, %xmm2
mulss %xmm3, %xmm5
mulss %xmm7, %xmm2
mulss %xmm7, %xmm5
movss (%r15,%r8,8), %xmm3
subss %xmm2, %xmm3
movq 0x48(%rbx), %r11
movss %xmm3, (%r11)
movss 0x4(%r15,%r8,8), %xmm3
subss %xmm5, %xmm3
movss %xmm3, 0x4(%r11)
movq %r13, 0x8(%r11)
movq 0x48(%rbx), %r11
movl %r14d, 0x10(%r11)
addss (%r15,%r8,8), %xmm2
movss %xmm2, 0x14(%r11)
addss 0x4(%r15,%r8,8), %xmm5
movss %xmm5, 0x18(%r11)
movq %r13, 0x1c(%r11)
movq 0x48(%rbx), %r11
movl %ecx, 0x24(%r11)
addq $0x28, %r11
movq %r11, 0x48(%rbx)
movq 0x50(%rbx), %r11
movw %r9w, (%r11)
leal (%rax,%r10,2), %r12d
movw %r12w, 0x2(%r11)
leal (%rdi,%r10,2), %r10d
movw %r10w, 0x4(%r11)
movw %r10w, 0x6(%r11)
leal 0x1(%r9), %r10d
movw %r10w, 0x8(%r11)
movw %r9w, 0xa(%r11)
addq $0xc, %r11
movq %r11, 0x50(%rbx)
movl %r8d, %r12d
incq %r8
addl $0x2, %r9d
jmp 0x6336a
movl -0x2c(%rbp), %eax
andl $0xfffe, %eax           # imm = 0xFFFE
addl %eax, 0x34(%rbx)
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop