// File: /workspace/github_cpp_makefile_star2_O3/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), %r15
leaq -0x60(%rbp), %r14
xorl %r13d, %r13d
cmpl $0x18, %r13d
movl %r13d, %eax
movl $0x0, %ecx
cmovel %ecx, %eax
movss 0x4(%rbx,%rax,8), %xmm0
movss %xmm0, -0x2c(%rbp)
xorps %xmm0, %xmm0
cvtss2sd (%rbx,%rax,8), %xmm0
testl %r13d, %r13d
je 0x2623
movl $0x3a, %edx
leaq -0xb0(%rbp), %r12
movq %r12, %rdi
movq 0x3a0c(%rip), %rsi      # 0x5fd8
leaq 0x1c9d(%rip), %rcx      # 0x4270
movb $0x1, %al
callq 0x36b1
movl $0x2, %r8d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x1a72(%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 0x268d
movq %rdx, -0xd0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xc0(%rbp)
jmp 0x2693
movl $0x3a, %edx
leaq -0xd0(%rbp), %r12
movq %r12, %rdi
movq 0x399f(%rip), %rsi      # 0x5fd8
leaq 0x1c30(%rip), %rcx      # 0x4270
movb $0x1, %al
callq 0x36b1
movl $0xa, %r8d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x19f7(%rip), %rcx      # 0x4052
callq 0x2140
movq %r15, -0x90(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x28f0
movq %rdx, -0x90(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x80(%rbp)
jmp 0x28f7
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 0x1ab5(%rip), %rsi      # 0x4170
callq 0x21d0
movq %r15, -0x90(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x26e6
movq %rdx, -0x90(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x80(%rbp)
jmp 0x26ed
movups (%rcx), %xmm0
movups %xmm0, (%r15)
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 0x38b6(%rip), %rsi      # 0x5fd8
leaq 0x1b47(%rip), %rcx      # 0x4270
movb $0x1, %al
callq 0x36b1
movq -0x90(%rbp), %rcx
movl $0xf, %edi
cmpq %r15, %rcx
je 0x2745
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %r8
movq -0x118(%rbp), %rsi
movq -0x110(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
jbe 0x2780
movl $0xf, %edi
leaq -0x108(%rbp), %r9
cmpq %r9, %rsi
je 0x277b
movq -0x108(%rbp), %rdi
cmpq %rdi, %rax
jbe 0x278e
leaq -0x90(%rbp), %rdi
callq 0x2040
jmp 0x279e
leaq -0x118(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2140
movq %r14, -0x70(%rbp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x27bb
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x27c2
movups (%rcx), %xmm0
movups %xmm0, (%r14)
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 0x1987(%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 0x2812
movq %rdx, -0x50(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x40(%rbp)
jmp 0x2818
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 0x285c
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0x2871
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x2893
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
je 0x28ab
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x28cd
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x2ad1
movq -0xa0(%rbp), %rsi
jmp 0x2ac9
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, -0x88(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x90(%rbp), %rdi
leaq 0x173e(%rip), %rsi      # 0x405d
callq 0x21d0
movq %r14, -0x70(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2944
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x294b
movups (%rcx), %xmm0
movups %xmm0, (%r14)
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 0x365b(%rip), %rsi      # 0x5fd8
leaq 0x18ec(%rip), %rcx      # 0x4270
movb $0x1, %al
callq 0x36b1
movq -0x70(%rbp), %rcx
movl $0xf, %edi
cmpq %r14, %rcx
je 0x299d
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %r8
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
jbe 0x29d5
movl $0xf, %edi
leaq -0xa0(%rbp), %r9
cmpq %r9, %rsi
je 0x29d0
movq -0xa0(%rbp), %rdi
cmpq %rdi, %rax
jbe 0x29e0
leaq -0x70(%rbp), %rdi
callq 0x2040
jmp 0x29f0
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 0x2a11
movq %rdx, -0x50(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x40(%rbp)
jmp 0x2a17
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 0x2a60
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x2a82
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0x2a97
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
je 0x2aaf
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x2ad1
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2120
incl %r13d
cmpl $0x19, %r13d
jne 0x258f
leaq 0x157e(%rip), %rsi      # 0x4063
leaq -0xf0(%rbp), %rdi
callq 0x21d0
leaq 0x156e(%rip), %rsi      # 0x4066
leaq -0xf0(%rbp), %rdi
callq 0x21d0
movss -0x30(%rbp), %xmm1
divss 0x14ff(%rip), %xmm1     # 0x4010
mulss 0x14fb(%rip), %xmm1     # 0x4014
addss 0x14f7(%rip), %xmm1     # 0x4018
movss 0x14f3(%rip), %xmm0     # 0x401c
minss %xmm1, %xmm0
movq -0x120(%rbp), %rax
movq (%rax), %rdx
cvtss2sd %xmm0, %xmm0
leaq 0x1529(%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 0x1544(%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 0x2b9d
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 0x2c72
jmp 0x2c72
movq %rax, %r13
jmp 0x2c18
movq %rax, %r13
jmp 0x2c2d
movq %rax, %r13
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2bf6
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2120
jmp 0x2bf6
movq %rax, %r13
jmp 0x2c45
movq %rax, %r13
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x2c18
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0x2c2d
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
je 0x2c45
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x2d3b
movq -0xc0(%rbp), %rsi
jmp 0x2d33
movq %rax, %r13
jmp 0x2cda
movq %rax, %r13
jmp 0x2cb8
movq %rax, %r13
jmp 0x2d3b
movq %rax, %r13
jmp 0x2ca3
movq %rax, %r13
jmp 0x2d19
movq %rax, %r13
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2ca3
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0x2cb8
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x2cda
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
je 0x2cf7
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2120
jmp 0x2cf7
movq %rax, %r13
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x2d19
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2120
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x2d3b
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2120
leaq -0xe0(%rbp), %rax
movq -0xf0(%rbp), %rdi
cmpq %rax, %rdi
je 0x2d5d
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x2120
movl $0xc0, %esi
movq %rbx, %rdi
callq 0x2120
movq %r13, %rdi
callq 0x21b0