// File: /workspace/github_c_makefile_star2_O3/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 $0x88, %rsp
testq %rdi, %rdi
je 0x2a122
movl %edx, %ebp
cmpl $0x3, %edx
jae 0x2a15f
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x5cec7(%rip), %rbx     # 0x86ff0
movq (%rbx), %rdi
leaq 0x46c69(%rip), %rsi     # 0x70d9c
leaq 0x46c80(%rip), %rdx     # 0x70dba
movl $0x27ad, %ecx           # imm = 0x27AD
xorl %eax, %eax
callq 0x12d80
movq (%rbx), %rdi
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x13780
movq %rsi, %r14
movq %rdi, %rbx
movl %ecx, %eax
shrl $0x18, %eax
movzbl %al, %eax
cvtsi2ss %eax, %xmm0
mulss 0x70(%rdi), %xmm0
cvttss2si %xmm0, %eax
movd %ecx, %xmm0
shrl $0x10, %ecx
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 0x43429(%rip), %xmm0    # 0x6d5c0
mulps %xmm0, %xmm1
movaps %xmm1, 0x20(%rsp)
shll $0x8, %eax
movzbl %cl, %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, 0x10(%rsp)
movl 0xcc(%rdi), %eax
movq %rax, 0x8(%rsp)
cmpl $0x1, %r8d
jne 0x2a4b1
leal -0x6(%rbp,%rbp,8), %r12d
leal (,%rbp,2), %esi
movq %rbx, %rdi
callq 0x29cac
movq %rax, %r15
movq %rbx, %rdi
movq %r12, %rsi
callq 0x29d2b
movq %rax, %r12
testq %r15, %r15
setne %al
testq %r12, %r12
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x2a110
movq 0xb8(%rbx), %rdi
movq 0x40(%rdi), %rax
movq %rax, 0x30(%rsp)
xorl %esi, %esi
movq %r15, %r13
callq 0x13e70
movl %ebp, %r15d
leaq (,%r15,8), %rdx
movq 0xb8(%rbx), %rdi
movl $0x4, %ecx
xorl %esi, %esi
callq 0x256b9
movq %r13, %r9
movq 0x8(%rsp), %r13
testq %rax, %rax
je 0x2a110
movaps 0x10(%rsp), %xmm0
unpcklps 0x4334c(%rip), %xmm0    # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
movaps %xmm0, 0x60(%rsp)
leal 0x1(%r13), %r10d
subq 0x30(%rsp), %r9
movq 0xb8(%rbx), %rcx
addq 0x40(%rcx), %r9
leaq -0x2(%r15), %rcx
leal 0x2(%r13), %edx
movq %r15, %r8
movw %r13w, (%r12)
movw %dx, 0x2(%r12)
addl $0x2, %edx
movw %dx, 0x4(%r12)
addq $0x6, %r12
decq %rcx
jne 0x2a288
decl %ebp
xorl %ecx, %ecx
movss 0x435f3(%rip), %xmm0    # 0x6d8a4
xorps %xmm1, %xmm1
movss 0x43614(%rip), %xmm2    # 0x6d8d0
movss 0x43610(%rip), %xmm3    # 0x6d8d4
movaps 0x432a5(%rip), %xmm4    # 0x6d570
movq %rbp, %rdx
movss (%r14,%rcx,8), %xmm6
movss 0x4(%r14,%rcx,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 0x2a308
jnp 0x2a335
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, %r8
jne 0x2a2ce
movl %r10d, %ecx
movq %rcx, 0x48(%rsp)
xorl %r15d, %r15d
movaps 0x43263(%rip), %xmm4    # 0x6d5d0
movq %r8, 0x58(%rsp)
movq %rax, 0x50(%rsp)
movsd (%rax,%rbp,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 0x43534(%rip), %xmm0    # 0x6d8d8
jbe 0x2a3c1
movss 0x434f6(%rip), %xmm1    # 0x6d8a4
divss %xmm0, %xmm1
minss 0x43522(%rip), %xmm1    # 0x6d8dc
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
mulps %xmm1, %xmm5
movaps 0x20(%rsp), %xmm2
movaps 0x10(%rsp), %xmm3
movsd 0x90(%rbx), %xmm1
movaps %xmm1, 0x30(%rsp)
movq 0x98(%rbx), %rsi
movq 0xa0(%rbx), %rdx
mulps %xmm4, %xmm5
movaps %xmm5, 0x70(%rsp)
movsd (%r14,%r15,8), %xmm0
subps %xmm5, %xmm0
movq %r9, %rdi
callq 0x29d6f
movsd (%r14,%r15,8), %xmm0
addps 0x70(%rsp), %xmm0
movq 0x98(%rbx), %rsi
movq 0xa0(%rbx), %rdx
movq %rax, %rdi
movaps 0x30(%rsp), %xmm1
movaps 0x20(%rsp), %xmm2
movaps 0x60(%rsp), %xmm3
callq 0x29d6f
movaps 0x4319a(%rip), %xmm4    # 0x6d5d0
movq %rax, %r9
movw %r13w, (%r12)
movq 0x8(%rsp), %rax
leal (%rax,%rbp,2), %eax
movw %ax, 0x2(%r12)
movq 0x48(%rsp), %rax
leal (%rax,%rbp,2), %eax
movw %ax, 0x4(%r12)
movw %ax, 0x6(%r12)
leal 0x1(%r13), %eax
movw %ax, 0x8(%r12)
movw %r13w, 0xa(%r12)
addq $0xc, %r12
movq %r15, %rbp
leaq 0x1(%r15), %rax
addl $0x2, %r13d
movq %rax, %r15
cmpq %rax, 0x58(%rsp)
movq 0x50(%rsp), %rax
jne 0x2a377
movq 0xb8(%rbx), %rdi
xorl %esi, %esi
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x127a0
leal -0x6(%rbp,%rbp,2), %r15d
movl %ebp, %r12d
movq %rbx, %rdi
movq %r12, %rsi
callq 0x29cac
movq %rax, %r13
movq %rbx, %rdi
movq %r15, %rsi
callq 0x29d2b
movq %rax, %r15
testq %r13, %r13
setne %al
testq %r15, %r15
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x2a110
xorl %ebp, %ebp
movsd (%r14,%rbp,8), %xmm0
movsd 0x90(%rbx), %xmm1
movq 0x98(%rbx), %rsi
movq 0xa0(%rbx), %rdx
movq %r13, %rdi
movdqa 0x20(%rsp), %xmm2
movaps 0x10(%rsp), %xmm3
callq 0x29d6f
movq %rax, %r13
incq %rbp
cmpq %rbp, %r12
jne 0x2a4ee
leaq (%r12,%r12,2), %rax
leaq -0xc(,%rax,2), %rax
movq 0x8(%rsp), %rdi
movl %edi, %ecx
addl $0x2, %ecx
xorl %edx, %edx
movw %di, (%r15,%rdx)
leal -0x1(%rcx), %esi
movw %si, 0x2(%r15,%rdx)
movw %cx, 0x4(%r15,%rdx)
addq $0x6, %rdx
incl %ecx
cmpq %rdx, %rax
jne 0x2a540
jmp 0x2a110