// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
cmpl $0x3, -0x14(%rbp)
jge 0x11177f
jmp 0x111d90
movq -0xb0(%rbp), %rax
movq 0x38(%rax), %rcx
movq (%rcx), %rcx
movq %rcx, -0x20(%rbp)
movl 0x30(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x111c71
movq -0xb0(%rbp), %rdi
movss 0xc0(%rdi), %xmm0
movss %xmm0, -0x24(%rbp)
movl -0x18(%rbp), %eax
andl $0xffffff, %eax         # imm = 0xFFFFFF
movl %eax, -0x28(%rbp)
movl -0x14(%rbp), %eax
subl $0x2, %eax
imull $0x3, %eax, %eax
imull $0x6, -0x14(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x2c(%rbp)
movl -0x14(%rbp), %eax
shll %eax
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %esi
movl -0x30(%rbp), %edx
callq 0x10f7f0
movq -0xb0(%rbp), %rax
movl 0x34(%rax), %ecx
movl %ecx, -0x34(%rbp)
movl 0x34(%rax), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movl $0x2, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x111861
movq -0xb0(%rbp), %rax
movl -0x34(%rbp), %ecx
movw %cx, %dx
movq 0x50(%rax), %rcx
movw %dx, (%rcx)
movl -0x34(%rbp), %ecx
movl -0x3c(%rbp), %edx
subl $0x1, %edx
shll %edx
addl %edx, %ecx
movw %cx, %dx
movq 0x50(%rax), %rcx
movw %dx, 0x2(%rcx)
movl -0x34(%rbp), %ecx
movl -0x3c(%rbp), %edx
shll %edx
addl %edx, %ecx
movw %cx, %dx
movq 0x50(%rax), %rcx
movw %dx, 0x4(%rcx)
movq 0x50(%rax), %rcx
addq $0x6, %rcx
movq %rcx, 0x50(%rax)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x111801
movslq -0x14(%rbp), %rax
leaq 0xf(,%rax,8), %rcx
andq $-0x10, %rcx
movq %rsp, %rax
subq %rcx, %rax
movq %rax, %rsp
movq %rax, -0x48(%rbp)
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x4c(%rbp)
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x11199d
movq -0x10(%rbp), %rax
movslq -0x4c(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movslq -0x50(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movss (%rax), %xmm0
movq -0x58(%rbp), %rax
subss (%rax), %xmm0
movss %xmm0, -0x64(%rbp)
movq -0x60(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x58(%rbp), %rax
subss 0x4(%rax), %xmm0
movss %xmm0, -0x68(%rbp)
movss -0x64(%rbp), %xmm0
movss -0x64(%rbp), %xmm2
movss -0x68(%rbp), %xmm1
mulss -0x68(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x6c(%rbp)
movss -0x6c(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x111956
movss -0x6c(%rbp), %xmm0
callq 0xd960
movaps %xmm0, %xmm1
movss 0x5f30d(%rip), %xmm0    # 0x170c3c
divss %xmm1, %xmm0
movss %xmm0, -0x70(%rbp)
movss -0x70(%rbp), %xmm0
mulss -0x64(%rbp), %xmm0
movss %xmm0, -0x64(%rbp)
movss -0x70(%rbp), %xmm0
mulss -0x68(%rbp), %xmm0
movss %xmm0, -0x68(%rbp)
jmp 0x111958
movss -0x68(%rbp), %xmm0
movq -0x48(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movss %xmm0, (%rax,%rcx,8)
movss -0x64(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movq -0x48(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movss %xmm0, 0x4(%rax,%rcx,8)
movl -0x50(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x50(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x11188e
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x74(%rbp)
movl $0x0, -0x78(%rbp)
movl -0x78(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x111c59
movq -0x48(%rbp), %rax
movslq -0x74(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
movq -0x48(%rbp), %rax
movslq -0x78(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rax
movss (%rax), %xmm0
movq -0x88(%rbp), %rax
addss (%rax), %xmm0
movss 0x605db(%rip), %xmm1    # 0x171fd8
mulss %xmm1, %xmm0
movss %xmm0, -0x8c(%rbp)
movq -0x80(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x88(%rbp), %rax
addss 0x4(%rax), %xmm0
movss 0x605b2(%rip), %xmm1    # 0x171fd8
mulss %xmm1, %xmm0
movss %xmm0, -0x90(%rbp)
movss -0x8c(%rbp), %xmm0
movss -0x8c(%rbp), %xmm2
movss -0x90(%rbp), %xmm1
mulss -0x90(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x94(%rbp)
movss 0x6056e(%rip), %xmm0    # 0x171fd8
ucomiss -0x94(%rbp), %xmm0
jbe 0x111a83
movss 0x6055d(%rip), %xmm0    # 0x171fd8
movss %xmm0, -0x94(%rbp)
movss 0x5f1b1(%rip), %xmm0    # 0x170c3c
divss -0x94(%rbp), %xmm0
movss %xmm0, -0x98(%rbp)
movss -0x98(%rbp), %xmm0
mulss -0x8c(%rbp), %xmm0
movss %xmm0, -0x8c(%rbp)
movss -0x98(%rbp), %xmm0
mulss -0x90(%rbp), %xmm0
movss %xmm0, -0x90(%rbp)
movq -0xb0(%rbp), %rax
movss 0x604fe(%rip), %xmm0    # 0x171fd8
mulss -0x24(%rbp), %xmm0
mulss -0x8c(%rbp), %xmm0
movss %xmm0, -0x8c(%rbp)
movss 0x604e1(%rip), %xmm0    # 0x171fd8
mulss -0x24(%rbp), %xmm0
mulss -0x90(%rbp), %xmm0
movss %xmm0, -0x90(%rbp)
movq -0x10(%rbp), %rcx
movslq -0x78(%rbp), %rdx
movss (%rcx,%rdx,8), %xmm0
subss -0x8c(%rbp), %xmm0
movq 0x48(%rax), %rcx
movss %xmm0, (%rcx)
movq -0x10(%rbp), %rcx
movslq -0x78(%rbp), %rdx
movss 0x4(%rcx,%rdx,8), %xmm0
subss -0x90(%rbp), %xmm0
movq 0x48(%rax), %rcx
movss %xmm0, 0x4(%rcx)
movq 0x48(%rax), %rcx
movq -0x20(%rbp), %rdx
movq %rdx, 0x8(%rcx)
movl -0x18(%rbp), %edx
movq 0x48(%rax), %rcx
movl %edx, 0x10(%rcx)
movq -0x10(%rbp), %rcx
movslq -0x78(%rbp), %rdx
movss (%rcx,%rdx,8), %xmm0
addss -0x8c(%rbp), %xmm0
movq 0x48(%rax), %rcx
movss %xmm0, 0x14(%rcx)
movq -0x10(%rbp), %rcx
movslq -0x78(%rbp), %rdx
movss 0x4(%rcx,%rdx,8), %xmm0
addss -0x90(%rbp), %xmm0
movq 0x48(%rax), %rcx
movss %xmm0, 0x18(%rcx)
movq 0x48(%rax), %rcx
movq -0x20(%rbp), %rdx
movq %rdx, 0x1c(%rcx)
movl -0x28(%rbp), %edx
movq 0x48(%rax), %rcx
movl %edx, 0x24(%rcx)
movq 0x48(%rax), %rcx
addq $0x28, %rcx
movq %rcx, 0x48(%rax)
movl -0x34(%rbp), %ecx
movl -0x78(%rbp), %edx
shll %edx
addl %edx, %ecx
movw %cx, %dx
movq 0x50(%rax), %rcx
movw %dx, (%rcx)
movl -0x34(%rbp), %ecx
movl -0x74(%rbp), %edx
shll %edx
addl %edx, %ecx
movw %cx, %dx
movq 0x50(%rax), %rcx
movw %dx, 0x2(%rcx)
movl -0x38(%rbp), %ecx
movl -0x74(%rbp), %edx
shll %edx
addl %edx, %ecx
movw %cx, %dx
movq 0x50(%rax), %rcx
movw %dx, 0x4(%rcx)
movl -0x38(%rbp), %ecx
movl -0x74(%rbp), %edx
shll %edx
addl %edx, %ecx
movw %cx, %dx
movq 0x50(%rax), %rcx
movw %dx, 0x6(%rcx)
movl -0x38(%rbp), %ecx
movl -0x78(%rbp), %edx
shll %edx
addl %edx, %ecx
movw %cx, %dx
movq 0x50(%rax), %rcx
movw %dx, 0x8(%rcx)
movl -0x34(%rbp), %ecx
movl -0x78(%rbp), %edx
shll %edx
addl %edx, %ecx
movw %cx, %dx
movq 0x50(%rax), %rcx
movw %dx, 0xa(%rcx)
movq 0x50(%rax), %rcx
addq $0xc, %rcx
movq %rcx, 0x50(%rax)
movl -0x78(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x78(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x1119ad
movq -0xb0(%rbp), %rax
movl -0x30(%rbp), %ecx
movzwl %cx, %ecx
addl 0x34(%rax), %ecx
movl %ecx, 0x34(%rax)
jmp 0x111d90
movq -0xb0(%rbp), %rdi
movl -0x14(%rbp), %eax
subl $0x2, %eax
imull $0x3, %eax, %eax
movl %eax, -0x9c(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0xa0(%rbp)
movl -0x9c(%rbp), %esi
movl -0xa0(%rbp), %edx
callq 0x10f7f0
movl $0x0, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
cmpl -0xa0(%rbp), %eax
jge 0x111d09
movq -0xb0(%rbp), %rax
movq -0x10(%rbp), %rdx
movslq -0xa4(%rbp), %rsi
movq 0x48(%rax), %rcx
movq (%rdx,%rsi,8), %rdx
movq %rdx, (%rcx)
movq 0x48(%rax), %rcx
movq -0x20(%rbp), %rdx
movq %rdx, 0x8(%rcx)
movl -0x18(%rbp), %edx
movq 0x48(%rax), %rcx
movl %edx, 0x10(%rcx)
movq 0x48(%rax), %rcx
addq $0x14, %rcx
movq %rcx, 0x48(%rax)
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x111cab
movl $0x2, -0xa8(%rbp)
movl -0xa8(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x111d7a
movq -0xb0(%rbp), %rax
movl 0x34(%rax), %ecx
movw %cx, %dx
movq 0x50(%rax), %rcx
movw %dx, (%rcx)
movl 0x34(%rax), %ecx
addl -0xa8(%rbp), %ecx
subl $0x1, %ecx
movw %cx, %dx
movq 0x50(%rax), %rcx
movw %dx, 0x2(%rcx)
movl 0x34(%rax), %ecx
addl -0xa8(%rbp), %ecx
movw %cx, %dx
movq 0x50(%rax), %rcx
movw %dx, 0x4(%rcx)
movq 0x50(%rax), %rcx
addq $0x6, %rcx
movq %rcx, 0x50(%rax)
movl -0xa8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa8(%rbp)
jmp 0x111d13
movq -0xb0(%rbp), %rax
movl -0xa0(%rbp), %ecx
movzwl %cx, %ecx
addl 0x34(%rax), %ecx
movl %ecx, 0x34(%rax)
movq %rbp, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)