// File: /workspace/github_cpp_makefile_star2_O1/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 $0x128, %rsp            # imm = 0x128
movsd %xmm0, 0x18(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
xorpd %xmm0, %xmm0
movupd %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq (%rsi), %rdi
leaq 0x10950(%rip), %rsi     # 0x143f6
callq 0x3280
testq %rax, %rax
je 0x3c1e
movq %rax, %r15
movq %r14, 0x10(%rsp)
leaq 0x20(%rsp), %r13
movq %r13, %rdi
movl $0x100, %esi            # imm = 0x100
movq %rax, %rdx
callq 0x3320
testq %rax, %rax
je 0x3c01
xorl %ebp, %ebp
incl %ebp
movb 0x20(%rsp), %r14b
testb %r14b, %r14b
je 0x3b89
movq %r13, %r12
movsbl %r14b, %edi
callq 0x3050
testl %eax, %eax
je 0x3b0b
movb 0x1(%r12), %r14b
incq %r12
testb %r14b, %r14b
jne 0x3aef
jmp 0x3b89
testb %r14b, %r14b
je 0x3b89
movzbl %r14b, %eax
cmpl $0x23, %eax
je 0x3b89
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
movq %r12, %rdi
leaq 0x105cf(%rip), %rsi     # 0x140fb
movq %rsp, %rdx
leaq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x31f0
cmpl $0x2, %eax
jne 0x3ba4
movsd (%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, (%rsp)
movsd 0x8(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x3b7e
movapd (%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, 0x8(%rbx)
jmp 0x3b89
movq %rbx, %rdi
movq %rsp, %rdx
callq 0x68ba
movq %r13, %rdi
movl $0x100, %esi            # imm = 0x100
movq %r15, %rdx
callq 0x3320
testq %rax, %rax
jne 0x3adc
jmp 0x3c01
movq %r13, %rdi
callq 0x30e0
movq %rax, %r14
movsbl 0x1f(%rsp,%rax), %edi
callq 0x3050
testl %eax, %eax
je 0x3bda
leaq 0x1f(%rsp), %rax
addq %rax, %r14
movb $0x0, (%r14)
movsbl -0x1(%r14), %edi
decq %r14
callq 0x3050
testl %eax, %eax
jne 0x3bc5
movq 0x183f7(%rip), %rax     # 0x1bfd8
movq (%rax), %rdi
movq 0x10(%rsp), %rax
movq (%rax), %rdx
leaq 0x10510(%rip), %rsi     # 0x14103
movl %ebp, %ecx
movq %r12, %r8
xorl %eax, %eax
callq 0x32c0
jmp 0x3b89
movq %r15, %rdi
callq 0x3200
movq %rbx, %rax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x33f0
jmp 0x3c09
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x3c3f
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x3220
movq %r14, %rdi
callq 0x3380