// File: /workspace/github_c_makefile_star2_O1/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 $0x98, %rsp
movl %r8d, %ebp
movl %ecx, %r12d
movl %edx, %ebx
movq %rsi, %r14
testq %rdi, %rdi
movq %rdi, (%rsp)
jne 0x2a0ac
movq 0x5df6d(%rip), %r15     # 0x87ff0
movq (%r15), %rdi
leaq 0x47cff(%rip), %rsi     # 0x71d8c
leaq 0x47d16(%rip), %rdx     # 0x71daa
movl $0x27ad, %ecx           # imm = 0x27AD
xorl %eax, %eax
callq 0x12d80
movq (%r15), %rdi
callq 0x13780
movq (%rsp), %rdi
testq %rdi, %rdi
sete %al
cmpl $0x3, %ebx
setb %cl
orb %al, %cl
je 0x2a0ce
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r12d, %eax
shrl $0x18, %eax
movzbl %al, %eax
cvtsi2ss %eax, %xmm0
leaq 0x70(%rdi), %rax
movq %rax, 0x8(%rsp)
mulss 0x70(%rdi), %xmm0
cvttss2si %xmm0, %eax
movd %r12d, %xmm0
shrl $0x10, %r12d
pxor %xmm2, %xmm2
punpcklbw %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3],xmm0[4],xmm2[4],xmm0[5],xmm2[5],xmm0[6],xmm2[6],xmm0[7],xmm2[7]
punpcklwd %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3]
cvtdq2ps %xmm0, %xmm1
movaps 0x444b4(%rip), %xmm0    # 0x6e5c0
mulps %xmm0, %xmm1
movaps %xmm1, 0x30(%rsp)
shll $0x8, %eax
movzbl %r12b, %ecx
orl %eax, %ecx
movd %ecx, %xmm1
punpcklbw %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3],xmm1[4],xmm2[4],xmm1[5],xmm2[5],xmm1[6],xmm2[6],xmm1[7],xmm2[7]
punpcklwd %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
cvtdq2ps %xmm1, %xmm1
mulps %xmm0, %xmm1
movaps %xmm1, 0x20(%rsp)
movl 0xcc(%rdi), %eax
movq %rax, 0x10(%rsp)
cmpl $0x1, %ebp
jne 0x2a21f
leal (%rbx,%rbx,8), %r12d
addl $-0x6, %r12d
leal (%rbx,%rbx), %esi
movq (%rsp), %rdi
callq 0x29b9c
movq %rax, %r15
movq (%rsp), %rdi
movq %r12, %rsi
callq 0x29c1f
movq %rax, %r13
testq %r15, %r15
setne %al
testq %r13, %r13
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x2a0bc
movq %r15, %rdx
movq (%rsp), %rax
movq 0xb8(%rax), %rdi
movq 0x40(%rdi), %r15
xorl %esi, %esi
movq %rdx, %r12
callq 0x13e70
movl %ebx, %ebp
leaq (,%rbp,8), %rdx
movq (%rsp), %rax
movq 0xb8(%rax), %rdi
movl $0x4, %ecx
xorl %esi, %esi
callq 0x25548
movq %r12, %r9
movq 0x10(%rsp), %r12
movq (%rsp), %rcx
testq %rax, %rax
je 0x2a0bc
subq %r15, %r9
movq 0xb8(%rcx), %rcx
addq 0x40(%rcx), %r9
cmpl $0x3, %ebx
movq %r14, 0x18(%rsp)
jb 0x2a2f8
leaq -0x2(%rbp), %rdx
leal 0x2(%r12), %ecx
xorps %xmm1, %xmm1
movw %r12w, (%r13)
movw %cx, 0x2(%r13)
addl $0x2, %ecx
movw %cx, 0x4(%r13)
addq $0x6, %r13
decq %rdx
jne 0x2a1ff
jmp 0x2a2fb
leal (%rbx,%rbx,2), %r12d
addl $-0x6, %r12d
movl %ebx, %r13d
movq (%rsp), %rdi
movq %r13, %rsi
callq 0x29b9c
movq %rax, %rbp
movq (%rsp), %rdi
movq %r12, %rsi
callq 0x29c1f
movq (%rsp), %rdx
movq %rax, %r12
testq %rbp, %rbp
setne %al
testq %r12, %r12
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x2a0bc
movq %rbx, 0x40(%rsp)
testl %ebx, %ebx
movq %r14, %rbx
movq 0x8(%rsp), %r14
je 0x2a2aa
xorl %r15d, %r15d
movsd (%rbx,%r15,8), %xmm0
movsd 0x90(%rdx), %xmm1
movq %rbp, %rdi
movq %r14, %rsi
movdqa 0x30(%rsp), %xmm2
movaps 0x20(%rsp), %xmm3
callq 0x29c72
movq (%rsp), %rdx
movq %rax, %rbp
incq %r15
cmpq %r15, %r13
jne 0x2a277
cmpl $0x3, 0x40(%rsp)
movq 0x10(%rsp), %rdi
jb 0x2a0bc
leaq (,%r13,2), %rax
addq %r13, %rax
leaq -0xc(,%rax,2), %rax
movl %edi, %ecx
addl $0x2, %ecx
xorl %edx, %edx
movw %di, (%r12,%rdx)
leal -0x1(%rcx), %esi
movw %si, 0x2(%r12,%rdx)
movw %cx, 0x4(%r12,%rdx)
addq $0x6, %rdx
incl %ecx
cmpq %rdx, %rax
jne 0x2a2d4
jmp 0x2a0bc
xorps %xmm1, %xmm1
subl $0x1, %ebx
jb 0x2a50b
movaps 0x20(%rsp), %xmm0
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movaps %xmm0, 0x70(%rsp)
leal 0x1(%r12), %r10d
xorl %ecx, %ecx
movss 0x44594(%rip), %xmm0    # 0x6e8b4
xorps %xmm1, %xmm1
movss 0x445b5(%rip), %xmm2    # 0x6e8e0
movss 0x445b1(%rip), %xmm3    # 0x6e8e4
movaps 0x44236(%rip), %xmm4    # 0x6e570
movq %rbx, %rdx
movq 0x18(%rsp), %r8
movss (%r8,%rcx,8), %xmm6
movss 0x4(%r8,%rcx,8), %xmm5
subss (%r8,%rdx,8), %xmm6
subss 0x4(%r8,%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 0x2a37c
jnp 0x2a3a9
movd %xmm7, %esi
shrl %esi
movl $0x5f375a84, %edi       # imm = 0x5F375A84
subl %esi, %edi
movd %edi, %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, (%rax,%rdx,8)
movq %rcx, %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, %rcx
cmpq %rsi, %rbp
jne 0x2a342
movl %r10d, %ecx
movq %rcx, 0x58(%rsp)
xorl %r15d, %r15d
movaps 0x441ef(%rip), %xmm4    # 0x6e5d0
movq %rax, 0x60(%rsp)
movq %rbp, 0x68(%rsp)
movsd (%rax,%rbx,8), %xmm0
movsd (%rax,%r15,8), %xmm5
addps %xmm0, %xmm5
mulps %xmm4, %xmm5
movaps %xmm5, %xmm1
mulps %xmm5, %xmm1
shufps $0x55, %xmm1, %xmm1     # xmm1 = xmm1[1,1,1,1]
movaps %xmm5, %xmm0
mulss %xmm5, %xmm0
addss %xmm1, %xmm0
ucomiss 0x444d0(%rip), %xmm0    # 0x6e8e8
jbe 0x2a43a
movq %rbx, %rbp
movss 0x4448f(%rip), %xmm1    # 0x6e8b4
divss %xmm0, %xmm1
minss 0x444bb(%rip), %xmm1    # 0x6e8ec
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
mulps %xmm1, %xmm5
jmp 0x2a43d
movq %rbx, %rbp
movq (%rsp), %rax
movq 0x8(%rsp), %r14
movaps 0x30(%rsp), %xmm2
movaps 0x20(%rsp), %xmm3
movsd 0x90(%rax), %xmm1
movaps %xmm1, 0x40(%rsp)
mulps %xmm4, %xmm5
movaps %xmm5, 0x80(%rsp)
movq 0x18(%rsp), %rbx
movsd (%rbx,%r15,8), %xmm0
subps %xmm5, %xmm0
movq %r9, %rdi
movq %r14, %rsi
callq 0x29c72
movsd (%rbx,%r15,8), %xmm0
addps 0x80(%rsp), %xmm0
movq %rax, %rdi
movq %r14, %rsi
movaps 0x40(%rsp), %xmm1
movaps 0x30(%rsp), %xmm2
movaps 0x70(%rsp), %xmm3
callq 0x29c72
movaps 0x44120(%rip), %xmm4    # 0x6e5d0
movq %rax, %r9
movw %r12w, (%r13)
movq 0x10(%rsp), %rax
leal (%rax,%rbp,2), %eax
movw %ax, 0x2(%r13)
movq 0x58(%rsp), %rax
leal (%rax,%rbp,2), %eax
movw %ax, 0x4(%r13)
movw %ax, 0x6(%r13)
leal 0x1(%r12), %eax
movw %ax, 0x8(%r13)
movw %r12w, 0xa(%r13)
addq $0xc, %r13
movq %r15, %rbx
leaq 0x1(%r15), %rax
addl $0x2, %r12d
movq %rax, %r15
movq 0x68(%rsp), %rbp
cmpq %rax, %rbp
movq 0x60(%rsp), %rax
jne 0x2a3eb
movq (%rsp), %rax
movq 0xb8(%rax), %rdi
xorl %esi, %esi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x127a0