// File: /workspace/github_cpp_makefile_star2_O1/Erkaman[P]spiky-anim/main.cpp
// Function: makeSpiky(_IO_FILE*, float, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void makeSpiky(FILE* fp, float rad, string color) {
    int N = 24;

    // spiky center in image center.
    float PX = WIDTH/2;
    float PY = HEIGHT/2;

    vector<vec2> pos(N);

    float SMALLR = rad * 0.20f;
    float R1 = rad - SMALLR;
    float R2 = rad + SMALLR;

    // generate points on circle. But displace the points in direction of normal.
    // so that it becomes spiky.
    for(int i = 0; i < N; i++) {
        float theta = (i / (float)N) * 2.0 * PI;

        float R = i % 2 == 0 ? R1 : R2;

        pos[i].x = PX + R * cos(theta);
        pos[i].y = PY + R * sin(theta);
    }

    string str;

    // now make line paths between the generated points.
    for(int i = 0; i < (N+1); i++) {
        vec2 v = pos[(i) % N];

        if(i == 0) {
            // for first point, we just position the cursor.
            str += "<path d=\"M" + to_string(v.x) + ", " + to_string(v.y);
        } else {
            str += "L " +     to_string(v.x) + " " + to_string(v.y) + " ";
        }
    }

    str += "Z\n"; // close loop. path is now done.
    str += "\" />";

    float strokeWidth = 2.0f + 10.0f * (rad / 100.0f);
    if(strokeWidth > 8.0f) { // clamp stroke-width to max 8.0f
        strokeWidth = 8.0f;
    }

    fprintf(fp,"<g fill=\"none\" stroke=\"%s\"  stroke-width=\"%f\" fill-opacity=\"1.0\">", color.c_str(), strokeWidth);
    fprintf(fp,"%s", str.c_str() );

    fprintf(fp,"</g>");

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rsi, -0x120(%rbp)
movss %xmm0, -0x30(%rbp)
movq %rdi, -0x128(%rbp)
movl $0xc0, %edi
callq 0x2110
movq %rax, %rbx
xorl %r14d, %r14d
movl $0xc0, %edx
movq %rax, %rdi
xorl %esi, %esi
callq 0x2090
movss 0x1b47(%rip), %xmm0     # 0x4004
mulss -0x30(%rbp), %xmm0
movaps 0x1b67(%rip), %xmm1     # 0x4030
movaps %xmm0, -0x140(%rbp)
xorps %xmm0, %xmm1
movaps %xmm1, -0x150(%rbp)
xorps %xmm0, %xmm0
cvtsi2ss %r14d, %xmm0
divss 0x1b1e(%rip), %xmm0     # 0x4008
cvtss2sd %xmm0, %xmm0
addsd %xmm0, %xmm0
mulsd 0x1b46(%rip), %xmm0     # 0x4040
movaps -0x150(%rbp), %xmm1
testb $0x1, %r14b
je 0x250e
movaps -0x140(%rbp), %xmm1
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0xf4(%rbp)
addss -0x30(%rbp), %xmm1
movss %xmm1, -0x2c(%rbp)
callq 0x20b0
mulss -0x2c(%rbp), %xmm0
movss 0x1ad6(%rip), %xmm1     # 0x400c
addss %xmm1, %xmm0
movss %xmm0, (%rbx,%r14,8)
movss -0xf4(%rbp), %xmm0
callq 0x20e0
mulss -0x2c(%rbp), %xmm0
addss 0x1ab2(%rip), %xmm0     # 0x400c
movss %xmm0, 0x4(%rbx,%r14,8)
incq %r14
cmpq $0x18, %r14
jne 0x24da
leaq -0xe0(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x80(%rbp), %r14
leaq -0x60(%rbp), %r13
xorl %r12d, %r12d
movq %r12, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rcx
shlq $0x2, %rdx
andq $-0x40, %rdx
leaq (%rdx,%rdx,2), %rax
movq %rbx, %rcx
subq %rax, %rcx
movss 0x4(%rcx,%r12,8), %xmm0
movss %xmm0, -0x2c(%rbp)
xorps %xmm0, %xmm0
cvtss2sd (%rcx,%r12,8), %xmm0
testl %r12d, %r12d
je 0x2638
movl $0x3a, %edx
leaq -0xb0(%rbp), %r15
movq %r15, %rdi
movq 0x39f7(%rip), %rsi      # 0x5fd8
leaq 0x1c88(%rip), %rcx      # 0x4270
movb $0x1, %al
callq 0x36e4
movl $0x2, %r8d
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x1a5d(%rip), %rcx      # 0x4060
callq 0x2140
leaq -0xc0(%rbp), %rsi
movq %rsi, -0xd0(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x26a2
movq %rdx, -0xd0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xc0(%rbp)
jmp 0x26a8
movl $0x3a, %edx
leaq -0xd0(%rbp), %r15
movq %r15, %rdi
movq 0x398a(%rip), %rsi      # 0x5fd8
leaq 0x1c1b(%rip), %rcx      # 0x4270
movb $0x1, %al
callq 0x36e4
movl $0xa, %r8d
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x19e2(%rip), %rcx      # 0x4052
callq 0x2140
movq %r14, -0x90(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x290a
movq %rdx, -0x90(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x80(%rbp)
jmp 0x2911
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0xc8(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0xd0(%rbp), %rdi
leaq 0x1aa0(%rip), %rsi      # 0x4170
callq 0x21d0
movq %r14, -0x90(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x26fb
movq %rdx, -0x90(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x80(%rbp)
jmp 0x2702
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, -0x88(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
cvtss2sd -0x2c(%rbp), %xmm0
movl $0x3a, %edx
leaq -0x118(%rbp), %rdi
movq 0x38a1(%rip), %rsi      # 0x5fd8
leaq 0x1b32(%rip), %rcx      # 0x4270
movb $0x1, %al
callq 0x36e4
movq -0x90(%rbp), %rcx
movl $0xf, %esi
cmpq %r14, %rcx
je 0x275a
movq -0x80(%rbp), %rsi
movq -0x88(%rbp), %r8
movq -0x110(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0x2792
movl $0xf, %esi
leaq -0x108(%rbp), %rdi
cmpq %rdi, -0x118(%rbp)
je 0x278d
movq -0x108(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x27a7
movq -0x118(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x2040
jmp 0x27b7
leaq -0x118(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2140
movq %r13, -0x70(%rbp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x27d4
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x27dc
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x68(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq -0x70(%rbp), %rdi
leaq 0x196d(%rip), %rsi      # 0x4170
callq 0x21d0
leaq -0x40(%rbp), %rsi
movq %rsi, -0x50(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x282c
movq %rdx, -0x50(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x40(%rbp)
jmp 0x2832
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x48(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
leaq -0xf0(%rbp), %rdi
callq 0x2040
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2876
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0x288b
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x28ad
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
je 0x28c5
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x28e7
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x2af0
movq -0xa0(%rbp), %rsi
jmp 0x2ae8
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, -0x88(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x90(%rbp), %rdi
leaq 0x1724(%rip), %rsi      # 0x405d
callq 0x21d0
movq %r13, -0x70(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x295e
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x2966
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, -0x68(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
cvtss2sd -0x2c(%rbp), %xmm0
movl $0x3a, %edx
leaq -0xb0(%rbp), %rdi
movq 0x3640(%rip), %rsi      # 0x5fd8
leaq 0x18d1(%rip), %rcx      # 0x4270
movb $0x1, %al
callq 0x36e4
movq -0x70(%rbp), %rcx
movl $0xf, %esi
cmpq %r13, %rcx
je 0x29b8
movq -0x60(%rbp), %rsi
movq -0x68(%rbp), %r8
movq -0xa8(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0x29ed
movl $0xf, %esi
leaq -0xa0(%rbp), %rdi
cmpq %rdi, -0xb0(%rbp)
je 0x29e8
movq -0xa0(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x29ff
movq -0xb0(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x2040
jmp 0x2a0f
leaq -0xb0(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2140
leaq -0x40(%rbp), %rsi
movq %rsi, -0x50(%rbp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x2a30
movq %rdx, -0x50(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x40(%rbp)
jmp 0x2a36
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x48(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
leaq -0xf0(%rbp), %rdi
callq 0x2040
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2a7f
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x2aa1
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0x2ab6
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
je 0x2ace
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x2af0
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2120
incq %r12
cmpl $0x19, %r12d
jne 0x258f
leaq 0x155f(%rip), %rsi      # 0x4063
leaq -0xf0(%rbp), %rdi
callq 0x21d0
leaq 0x154f(%rip), %rsi      # 0x4066
leaq -0xf0(%rbp), %rdi
callq 0x21d0
movss -0x30(%rbp), %xmm1
divss 0x14e0(%rip), %xmm1     # 0x4010
mulss 0x14dc(%rip), %xmm1     # 0x4014
addss 0x14d8(%rip), %xmm1     # 0x4018
movss 0x14d4(%rip), %xmm0     # 0x401c
minss %xmm1, %xmm0
movq -0x120(%rbp), %rax
movq (%rax), %rdx
cvtss2sd %xmm0, %xmm0
leaq 0x150a(%rip), %rsi      # 0x406b
movq -0x128(%rbp), %r14
movq %r14, %rdi
movb $0x1, %al
callq 0x2180
movq -0xf0(%rbp), %rdi
movq %r14, %rsi
callq 0x2130
leaq 0x1525(%rip), %rdi      # 0x40ad
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x21e0
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x2bbc
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x2120
movl $0xc0, %esi
movq %rbx, %rdi
callq 0x2120
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2c91
jmp 0x2c91
movq %rax, %r12
jmp 0x2c37
movq %rax, %r12
jmp 0x2c4c
movq %rax, %r12
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2c15
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2120
jmp 0x2c15
movq %rax, %r12
jmp 0x2c64
movq %rax, %r12
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x2c37
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0x2c4c
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
je 0x2c64
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x2d5a
movq -0xc0(%rbp), %rsi
jmp 0x2d52
movq %rax, %r12
jmp 0x2cf9
movq %rax, %r12
jmp 0x2cd7
movq %rax, %r12
jmp 0x2d5a
movq %rax, %r12
jmp 0x2cc2
movq %rax, %r12
jmp 0x2d38
movq %rax, %r12
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2cc2
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0x2cd7
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x2cf9
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
je 0x2d16
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2120
jmp 0x2d16
movq %rax, %r12
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x2d38
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x2d5a
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2120
leaq -0xe0(%rbp), %rax
movq -0xf0(%rbp), %rdi
cmpq %rax, %rdi
je 0x2d7c
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x2120
movl $0xc0, %esi
movq %rbx, %rdi
callq 0x2120
movq %r12, %rdi
callq 0x21b0