// File: /workspace/github_c_makefile_star2_O2/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_draw_list_fill_poly_convex
NK_API void
nk_draw_list_fill_poly_convex(struct nk_draw_list *list,
    const struct nk_vec2 *points, const unsigned int points_count,
    struct nk_color color, enum nk_anti_aliasing aliasing)
{
    struct nk_colorf col;
    struct nk_colorf col_trans;

    NK_STORAGE const nk_size pnt_align = NK_ALIGNOF(struct nk_vec2);
    NK_STORAGE const nk_size pnt_size = sizeof(struct nk_vec2);
    NK_ASSERT(list);
    if (!list || points_count < 3) return;

#ifdef NK_INCLUDE_COMMAND_USERDATA
    nk_draw_list_push_userdata(list, list->userdata);
#endif

    color.a = (nk_byte)((float)color.a * list->config.global_alpha);
    nk_color_fv(&col.r, color);
    col_trans = col;
    col_trans.a = 0;

    if (aliasing == NK_ANTI_ALIASING_ON) {
        nk_size i = 0;
        nk_size i0 = 0;
        nk_size i1 = 0;

        const float AA_SIZE = 1.0f;
        nk_size vertex_offset = 0;
        nk_size index = list->vertex_count;

        const nk_size idx_count = (points_count-2)*3 + points_count*6;
        const nk_size vtx_count = (points_count*2);

        void *vtx = nk_draw_list_alloc_vertices(list, vtx_count);
        nk_draw_index *ids = nk_draw_list_alloc_elements(list, idx_count);

        nk_size size = 0;
        struct nk_vec2 *normals = 0;
        unsigned int vtx_inner_idx = (unsigned int)(index + 0);
        unsigned int vtx_outer_idx = (unsigned int)(index + 1);
        if (!vtx || !ids) return;

        /* temporary allocate normals */
        vertex_offset = (nk_size)((nk_byte*)vtx - (nk_byte*)list->vertices->memory.ptr);
        nk_buffer_mark(list->vertices, NK_BUFFER_FRONT);
        size = pnt_size * points_count;
        normals = (struct nk_vec2*) nk_buffer_alloc(list->vertices, NK_BUFFER_FRONT, size, pnt_align);
        if (!normals) return;
        vtx = (void*)((nk_byte*)list->vertices->memory.ptr + vertex_offset);

        /* add elements */
        for (i = 2; i < points_count; i++) {
            ids[0] = (nk_draw_index)(vtx_inner_idx);
            ids[1] = (nk_draw_index)(vtx_inner_idx + ((i-1) << 1));
            ids[2] = (nk_draw_index)(vtx_inner_idx + (i << 1));
            ids += 3;
        }

        /* compute normals */
        for (i0 = points_count-1, i1 = 0; i1 < points_count; i0 = i1++) {
            struct nk_vec2 p0 = points[i0];
            struct nk_vec2 p1 = points[i1];
            struct nk_vec2 diff = nk_vec2_sub(p1, p0);

            /* vec2 inverted length  */
            float len = nk_vec2_len_sqr(diff);
            if (len != 0.0f)
                len = NK_INV_SQRT(len);
            else len = 1.0f;
            diff = nk_vec2_muls(diff, len);

            normals[i0].x = diff.y;
            normals[i0].y = -diff.x;
        }

        /* add vertices + indexes */
        for (i0 = points_count-1, i1 = 0; i1 < points_count; i0 = i1++) {
            const struct nk_vec2 uv = list->config.tex_null.uv;
            struct nk_vec2 n0 = normals[i0];
            struct nk_vec2 n1 = normals[i1];
            struct nk_vec2 dm = nk_vec2_muls(nk_vec2_add(n0, n1), 0.5f);
            float dmr2 = dm.x*dm.x + dm.y*dm.y;
            if (dmr2 > 0.000001f) {
                float scale = 1.0f / dmr2;
                scale = NK_MIN(scale, 100.0f);
                dm = nk_vec2_muls(dm, scale);
            }
            dm = nk_vec2_muls(dm, AA_SIZE * 0.5f);

            /* add vertices */
            vtx = nk_draw_vertex(vtx, &list->config, nk_vec2_sub(points[i1], dm), uv, col);
            vtx = nk_draw_vertex(vtx, &list->config, nk_vec2_add(points[i1], dm), uv, col_trans);

            /* add indexes */
            ids[0] = (nk_draw_index)(vtx_inner_idx+(i1<<1));
            ids[1] = (nk_draw_index)(vtx_inner_idx+(i0<<1));
            ids[2] = (nk_draw_index)(vtx_outer_idx+(i0<<1));
            ids[3] = (nk_draw_index)(vtx_outer_idx+(i0<<1));
            ids[4] = (nk_draw_index)(vtx_outer_idx+(i1<<1));
            ids[5] = (nk_draw_index)(vtx_inner_idx+(i1<<1));
            ids += 6;
        }
        /* free temporary normals + points */
        nk_buffer_reset(list->vertices, NK_BUFFER_FRONT);
    } else {
        nk_size i = 0;
        nk_size index = list->vertex_count;
        const nk_size idx_count = (points_count-2)*3;
        const nk_size vtx_count = points_count;
        void *vtx = nk_draw_list_alloc_vertices(list, vtx_count);
        nk_draw_index *ids = nk_draw_list_alloc_elements(list, idx_count);

        if (!vtx || !ids) return;
        for (i = 0; i < vtx_count; ++i)
            vtx = nk_draw_vertex(vtx, &list->config, points[i], list->config.tex_null.uv, col);
        for (i = 2; i < points_count; ++i) {
            ids[0] = (nk_draw_index)index;
            ids[1] = (nk_draw_index)(index+ i - 1);
            ids[2] = (nk_draw_index)(index+i);
            ids += 3;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
testq %rdi, %rdi
je 0x287b3
movl %edx, %ebx
movq %rdi, 0x8(%rsp)
cmpl $0x3, %edx
jae 0x287f0
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x5c836(%rip), %rbx     # 0x84ff0
movq (%rbx), %rdi
leaq 0x41548(%rip), %rsi     # 0x69d0c
leaq 0x4155f(%rip), %rdx     # 0x69d2a
movl $0x27ad, %ecx           # imm = 0x27AD
xorl %eax, %eax
callq 0x12ea0
movq (%rbx), %rdi
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x13960
movl %r8d, %ebp
movq %rsi, %r14
movl %ecx, %eax
shrl $0x18, %eax
movzbl %al, %eax
cvtsi2ss %eax, %xmm0
movq 0x8(%rsp), %r15
mulss 0x70(%r15), %xmm0
cvttss2si %xmm0, %eax
leaq 0x70(%r15), %rdx
movq %rdx, 0x18(%rsp)
shll $0x18, %eax
andl $0xffffff, %ecx         # imm = 0xFFFFFF
orl %eax, %ecx
leaq 0x98(%rsp), %r13
movq %r13, %rdi
movl %ecx, %esi
callq 0x12830
movsd (%r13), %xmm0
movaps %xmm0, 0x40(%rsp)
movsd 0x8(%r13), %xmm0
movaps %xmm0, 0x30(%rsp)
movl 0xcc(%r15), %eax
movq %rax, 0x10(%rsp)
cmpl $0x1, %ebp
jne 0x2893b
leal (%rbx,%rbx,8), %r13d
addl $-0x6, %r13d
leal (%rbx,%rbx), %esi
movq %r15, %rdi
callq 0x283af
movq %rax, %r12
movq %r15, %rdi
movq %r13, %rsi
callq 0x2842e
movq %rax, %r13
testq %r12, %r12
setne %al
testq %r13, %r13
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x287a1
movq %r12, %r15
movq 0x8(%rsp), %r12
movq 0xb8(%r12), %rdi
movq 0x40(%rdi), %rax
movq %rax, 0x20(%rsp)
xorl %esi, %esi
callq 0x140b0
movl %ebx, %ebp
leaq (,%rbp,8), %rdx
movq 0xb8(%r12), %rdi
pushq $0x4
popq %rcx
xorl %esi, %esi
callq 0x2403e
testq %rax, %rax
je 0x287a1
movq %rax, %r9
xorps %xmm0, %xmm0
movaps 0x30(%rsp), %xmm1
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movaps %xmm1, 0x70(%rsp)
movq 0x10(%rsp), %rsi
leal 0x1(%rsi), %ecx
movq 0x8(%rsp), %rax
movq 0xb8(%rax), %rax
movq 0x40(%rax), %rax
leaq -0x2(%rbp), %rdx
addl $0x2, %esi
movq 0x10(%rsp), %rdi
subq $0x1, %rdx
jb 0x289ef
movw %di, (%r13)
movw %si, 0x2(%r13)
addl $0x2, %esi
movw %si, 0x4(%r13)
addq $0x6, %r13
jmp 0x28919
leal (%rbx,%rbx,2), %r12d
addl $-0x6, %r12d
movl %ebx, %r13d
movq %r15, %rdi
movq %r13, %rsi
callq 0x283af
movq %rax, %rbp
movq %r15, %rdi
movq %r12, %rsi
callq 0x2842e
movq %rax, %r12
testq %rbp, %rbp
setne %al
testq %r12, %r12
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x287a1
xorl %ebx, %ebx
movq 0x8(%rsp), %r15
cmpq %rbx, %r13
je 0x289b3
movsd (%r14,%rbx,8), %xmm0
movsd 0x90(%r15), %xmm1
movq %rbp, %rdi
movq 0x18(%rsp), %rsi
movaps 0x40(%rsp), %xmm2
movaps 0x30(%rsp), %xmm3
callq 0x28470
movq %rax, %rbp
incq %rbx
jmp 0x28980
imulq $0x6, %r13, %rax
addq $-0xc, %rax
movq 0x10(%rsp), %rcx
addl $0x2, %ecx
xorl %edx, %edx
cmpq %rdx, %rax
je 0x287a1
movq 0x10(%rsp), %rsi
movw %si, (%r12,%rdx)
leal -0x1(%rcx), %esi
movw %si, 0x2(%r12,%rdx)
movw %cx, 0x4(%r12,%rdx)
addq $0x6, %rdx
incl %ecx
jmp 0x289c5
subq 0x20(%rsp), %r15
decl %ebx
xorl %edi, %edi
movss 0x3de34(%rip), %xmm0    # 0x66834
xorps %xmm1, %xmm1
movss 0x3de55(%rip), %xmm2    # 0x66860
movss 0x3de51(%rip), %xmm3    # 0x66864
movaps 0x3db56(%rip), %xmm4    # 0x66570
movq %rbx, %rdx
cmpq %rdi, %rbp
je 0x28ab1
movq %rdi, %rsi
movss (%r14,%rdi,8), %xmm6
movss 0x4(%r14,%rdi,8), %xmm5
subss (%r14,%rdx,8), %xmm6
subss 0x4(%r14,%rdx,8), %xmm5
movaps %xmm5, %xmm8
mulss %xmm5, %xmm8
movaps %xmm6, %xmm7
mulss %xmm6, %xmm7
addss %xmm8, %xmm7
ucomiss %xmm1, %xmm7
movaps %xmm0, %xmm8
jne 0x28a63
jnp 0x28a92
movd %xmm7, %edi
shrl %edi
movl $0x5f375a84, %r8d       # imm = 0x5F375A84
subl %edi, %r8d
movd %r8d, %xmm8
mulss %xmm2, %xmm7
mulss %xmm8, %xmm7
mulss %xmm8, %xmm7
addss %xmm3, %xmm7
mulss %xmm8, %xmm7
movaps %xmm7, %xmm8
xorps %xmm4, %xmm6
unpcklps %xmm6, %xmm5            # xmm5 = xmm5[0],xmm6[0],xmm5[1],xmm6[1]
unpcklps %xmm8, %xmm8            # xmm8 = xmm8[0,0,1,1]
mulps %xmm5, %xmm8
movlps %xmm8, (%r9,%rdx,8)
leaq 0x1(%rsi), %rdi
movq %rsi, %rdx
jmp 0x28a1d
addq %r15, %rax
movl %ecx, %ecx
movq %rcx, 0x58(%rsp)
xorl %ecx, %ecx
movq 0x10(%rsp), %r15
movq %rbp, 0x68(%rsp)
movq %r9, 0x60(%rsp)
cmpq %rcx, %rbp
je 0x28be4
movq %rcx, %r12
movsd (%r9,%rbx,8), %xmm0
movsd (%r9,%rcx,8), %xmm2
addps %xmm0, %xmm2
mulps 0x3dad2(%rip), %xmm2    # 0x665c0
movaps %xmm2, %xmm1
mulps %xmm2, %xmm1
shufps $0x55, %xmm1, %xmm1     # xmm1 = xmm1[1,1,1,1]
movaps %xmm2, %xmm0
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
ucomiss 0x3dd5e(%rip), %xmm0    # 0x66868
jbe 0x28b27
movss 0x3dd20(%rip), %xmm1    # 0x66834
divss %xmm0, %xmm1
minss 0x3dd4c(%rip), %xmm1    # 0x6686c
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
mulps %xmm1, %xmm2
movq 0x8(%rsp), %rcx
movsd 0x90(%rcx), %xmm1
movaps %xmm1, 0x20(%rsp)
mulps 0x3da80(%rip), %xmm2    # 0x665c0
movaps %xmm2, 0x80(%rsp)
movsd (%r14,%r12,8), %xmm0
subps %xmm2, %xmm0
movq %rax, %rdi
movq 0x18(%rsp), %rbp
movq %rbp, %rsi
movaps 0x40(%rsp), %xmm2
movaps 0x30(%rsp), %xmm3
callq 0x28470
movsd (%r14,%r12,8), %xmm0
addps 0x80(%rsp), %xmm0
movq %rax, %rdi
movq %rbp, %rsi
movaps 0x20(%rsp), %xmm1
movaps 0x40(%rsp), %xmm2
movaps 0x70(%rsp), %xmm3
callq 0x28470
movw %r15w, (%r13)
movq 0x10(%rsp), %rcx
leal (%rcx,%rbx,2), %ecx
movw %cx, 0x2(%r13)
movq 0x58(%rsp), %rcx
leal (%rcx,%rbx,2), %ecx
movw %cx, 0x4(%r13)
movw %cx, 0x6(%r13)
leal 0x1(%r15), %ecx
movw %cx, 0x8(%r13)
movw %r15w, 0xa(%r13)
addq $0xc, %r13
leaq 0x1(%r12), %rcx
addl $0x2, %r15d
movq %r12, %rbx
movq 0x68(%rsp), %rbp
movq 0x60(%rsp), %r9
jmp 0x28acc
movq 0x8(%rsp), %rax
movq 0xb8(%rax), %rdi
xorl %esi, %esi
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x12850