// File: hzeller[P]gcode-multi-shell-extrude/third_party/clipper.cpp
// Function: ClipperLib::Clipper::ExecuteInternal()
bool Clipper::ExecuteInternal()
{
  bool succeeded = true;
  try {
    Reset();
    if (!m_CurrentLM) return false;
    cInt botY = PopScanbeam();
    do {
      InsertLocalMinimaIntoAEL(botY);
      ClearGhostJoins();
      ProcessHorizontals(false);
      if (m_Scanbeam.empty()) break;
      cInt topY = PopScanbeam();
      succeeded = ProcessIntersections(botY, topY);
      if (!succeeded) break;
      ProcessEdgesAtTopOfScanbeam(topY);
      botY = topY;
    } while (!m_Scanbeam.empty() || m_CurrentLM);
  }
  catch(...) 
  {
    succeeded = false;
  }

  if (succeeded)
  {
    //fix orientations ...
    for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i)
    {
      OutRec *outRec = m_PolyOuts[i];
      if (!outRec->Pts || outRec->IsOpen) continue;
      if ((outRec->IsHole ^ m_ReverseOutput) == (Area(*outRec) > 0))
        ReversePolyPtLinks(outRec->Pts);
    }

    if (!m_Joins.empty()) JoinCommonEdges();

    //unfortunately FixupOutPolygon() must be done after JoinCommonEdges()
    for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i)
    {
      OutRec *outRec = m_PolyOuts[i];
      if (outRec->Pts && !outRec->IsOpen)
        FixupOutPolygon(*outRec);
    }

    if (m_StrictSimple) DoSimplePolygons();
  }

  ClearJoins();
  ClearGhostJoins();
  return succeeded;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x60(%rbp)
movb $0x1, -0x11(%rbp)
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
jmp 0x15246
movq -0x60(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
cmpq $0x0, 0x8(%rax,%rcx)
jne 0x152f1
movb $0x0, -0x1(%rbp)
jmp 0x15503
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rdi
callq 0x30d0
movb $0x0, -0x11(%rbp)
callq 0x3400
testb $0x1, -0x11(%rbp)
je 0x154e9
movq $0x0, -0x40(%rbp)
movq -0x60(%rbp), %rdi
movq -0x40(%rbp), %rax
movq %rax, -0x68(%rbp)
addq $0x8, %rdi
callq 0x20d70
movq %rax, %rcx
movq -0x68(%rbp), %rax
cmpq %rcx, %rax
jae 0x1543e
movq -0x60(%rbp), %rdi
addq $0x8, %rdi
movq -0x40(%rbp), %rsi
callq 0x20d90
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x152ec
movq -0x48(%rbp), %rax
testb $0x1, 0x5(%rax)
je 0x153dd
jmp 0x1542d
movq -0x60(%rbp), %rdi
callq 0x15520
movq %rax, -0x70(%rbp)
jmp 0x15300
movq -0x70(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x60(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x15590
jmp 0x15317
movq -0x60(%rbp), %rdi
callq 0x15b20
jmp 0x15322
movq -0x60(%rbp), %rdi
xorl %esi, %esi
callq 0x15bb0
jmp 0x1532f
movq -0x60(%rbp), %rdi
addq $0x70, %rdi
callq 0x20d50
testb $0x1, %al
jne 0x15342
jmp 0x15347
jmp 0x153d8
movq -0x60(%rbp), %rdi
callq 0x15520
movq %rax, -0x78(%rbp)
jmp 0x15356
movq -0x60(%rbp), %rdi
movq -0x78(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x15c20
movb %al, -0x79(%rbp)
jmp 0x15374
movb -0x79(%rbp), %al
andb $0x1, %al
movb %al, -0x11(%rbp)
testb $0x1, -0x11(%rbp)
jne 0x15384
jmp 0x153d8
movq -0x60(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x15d80
jmp 0x15393
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x60(%rbp), %rdi
addq $0x70, %rdi
callq 0x20d50
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x7a(%rbp)
jne 0x153b6
jmp 0x153cd
movq -0x60(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
cmpq $0x0, 0x8(%rax,%rcx)
setne %al
movb %al, -0x7a(%rbp)
movb -0x7a(%rbp), %al
testb $0x1, %al
jne 0x15308
jmp 0x15284
movq -0x60(%rbp), %rcx
movq -0x48(%rbp), %rax
movb 0x4(%rax), %al
andb $0x1, %al
movzbl %al, %eax
movb 0xbc(%rcx), %cl
andb $0x1, %cl
movzbl %cl, %ecx
xorl %ecx, %eax
movl %eax, -0x80(%rbp)
movq -0x48(%rbp), %rdi
callq 0x110f0
movl -0x80(%rbp), %eax
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
seta %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
jne 0x1542b
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x11ec0
jmp 0x1542d
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x15296
movq -0x60(%rbp), %rdi
addq $0x20, %rdi
callq 0x20db0
testb $0x1, %al
jne 0x15458
movq -0x60(%rbp), %rdi
callq 0x16280
movq $0x0, -0x50(%rbp)
movq -0x60(%rbp), %rdi
movq -0x50(%rbp), %rax
movq %rax, -0x88(%rbp)
addq $0x8, %rdi
callq 0x20d70
movq %rax, %rcx
movq -0x88(%rbp), %rax
cmpq %rcx, %rax
jae 0x154d1
movq -0x60(%rbp), %rdi
addq $0x8, %rdi
movq -0x50(%rbp), %rsi
callq 0x20d90
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x154c1
movq -0x58(%rbp), %rax
testb $0x1, 0x5(%rax)
jne 0x154c1
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x16720
jmp 0x154c3
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x15460
movq -0x60(%rbp), %rax
testb $0x1, 0xbe(%rax)
je 0x154e7
movq -0x60(%rbp), %rdi
callq 0x16990
jmp 0x154e9
movq -0x60(%rbp), %rdi
callq 0x16bf0
movq -0x60(%rbp), %rdi
callq 0x15b20
movb -0x11(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)