// File: /workspace/github_cpp_makefile_star2_O3/hzeller[P]gcode-multi-shell-extrude/multi-shell-extrude.cc
// Function: ReadPolygon(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, double)
Polygon ReadPolygon(const std::string &filename, double factor) {
  Polygon polygon;
  FILE *in = fopen(filename.c_str(), "r");
  if (!in) {
    fprintf(stderr, "Can't open %s\n", filename.c_str());
    return polygon;
  }
  char buffer[256];
  int line = 0;
  while (fgets(buffer, sizeof(buffer), in)) {
    ++line;
    const char *start = buffer;
    while (*start && isspace(*start))
      start++;
    if (*start == '\0' || *start == '#')
      continue;
    Vector2D p;
    if (sscanf(start, "%lf %lf", &p.x, &p.y) == 2) {
      p.x *= factor;
      p.y *= factor;
      polygon.push_back(p);
    } else {
      for (char *end = buffer + strlen(buffer) - 1; isspace(*end); end--) {
        *end = '\0';
      }
      fprintf(stderr, "%s:%d not a comment and not coordinates: '%s'\n",
              filename.c_str(), line, start);
    }
  }
  fclose(in);
  return polygon;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movapd %xmm0, 0x20(%rsp)
movq %rdi, %rbx
xorpd %xmm0, %xmm0
movupd %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq %rsi, 0x18(%rsp)
movq (%rsi), %rdi
leaq 0x109d5(%rip), %rsi     # 0x1442e
callq 0x3280
testq %rax, %rax
je 0x3bc1
movq %rax, %r15
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movl $0x100, %esi            # imm = 0x100
movq %rax, %rdx
callq 0x3320
testq %rax, %rax
je 0x3ba4
movapd 0x20(%rsp), %xmm0
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
movapd %xmm0, 0x20(%rsp)
xorl %ebp, %ebp
incl %ebp
movb 0x30(%rsp), %r13b
testb %r13b, %r13b
je 0x3b2b
movq %r14, %r12
movsbl %r13b, %edi
callq 0x3050
testl %eax, %eax
je 0x3ac9
movb 0x1(%r12), %r13b
incq %r12
testb %r13b, %r13b
jne 0x3aad
jmp 0x3b2b
cmpb $0x23, %r13b
je 0x3b2b
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
movq %r12, %rdi
leaq 0x10651(%rip), %rsi     # 0x14133
movq %rsp, %rdx
leaq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x31f0
cmpl $0x2, %eax
jne 0x3b46
movapd (%rsp), %xmm0
mulpd 0x20(%rsp), %xmm0
movapd %xmm0, (%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x3b20
movapd (%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, 0x8(%rbx)
jmp 0x3b2b
movq %rbx, %rdi
movq %rsp, %rdx
callq 0x662e
movq %r14, %rdi
movl $0x100, %esi            # imm = 0x100
movq %r15, %rdx
callq 0x3320
testq %rax, %rax
jne 0x3a9a
jmp 0x3ba4
movq %r14, %rdi
callq 0x30e0
movq %rax, %r13
movsbl 0x2f(%rsp,%rax), %edi
callq 0x3050
testl %eax, %eax
je 0x3b7d
leaq 0x2f(%rsp), %rax
addq %rax, %r13
movb $0x0, (%r13)
movsbl -0x1(%r13), %edi
decq %r13
callq 0x3050
testl %eax, %eax
jne 0x3b67
movq 0x18454(%rip), %rax     # 0x1bfd8
movq (%rax), %rdi
movq 0x18(%rsp), %rax
movq (%rax), %rdx
leaq 0x105a5(%rip), %rsi     # 0x1413b
movl %ebp, %ecx
movq %r12, %r8
xorl %eax, %eax
callq 0x32c0
jmp 0x3b2b
movq %r15, %rdi
callq 0x3200
movq %rbx, %rax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%rsp), %rdi
callq 0x33f0
jmp 0x3bac
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x3be4
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x3220
movq %r14, %rdi
callq 0x3380