// File: /workspace/github_cpp_makefile_star2_O2/hzeller[P]gcode-multi-shell-extrude/third_party/clipper.cpp
// Function: ClipperLib::ClipperOffset::Execute(ClipperLib::PolyTree&, double)
void ClipperOffset::Execute(PolyTree& solution, double delta)
{
  solution.Clear();
  FixOrientations();
  DoOffset(delta);

  //now clean up 'corners' ...
  Clipper clpr;
  clpr.AddPaths(m_destPolys, ptSubject, true);
  if (delta > 0)
  {
    clpr.Execute(ctUnion, solution, pftPositive, pftPositive);
  }
  else
  {
    IntRect r = clpr.GetBounds();
    Path outer(4);
    outer[0] = IntPoint(r.left - 10, r.bottom + 10);
    outer[1] = IntPoint(r.right + 10, r.bottom + 10);
    outer[2] = IntPoint(r.right + 10, r.top - 10);
    outer[3] = IntPoint(r.left - 10, r.top - 10);

    clpr.AddPath(outer, ptSubject, true);
    clpr.ReverseSolution(true);
    clpr.Execute(ctUnion, solution, pftNegative, pftNegative);
    //remove the outer PolyNode rectangle ...
    if (solution.ChildCount() == 1 && solution.Childs[0]->ChildCount() > 0)
    {
      PolyNode* outerNode = solution.Childs[0];
      solution.Childs.reserve(outerNode->ChildCount());
      solution.Childs[0] = outerNode->Childs[0];
      for (int i = 1; i < outerNode->ChildCount(); ++i)
        solution.AddChild(*outerNode->Childs[i]);
    }
    else
      solution.Clear();
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x150, %rsp            # imm = 0x150
movsd %xmm0, 0x10(%rsp)
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x79c0
movq %r14, %rdi
callq 0xd132
movq %r14, %rdi
movsd 0x10(%rsp), %xmm0
callq 0xd3fc
leaq 0x110(%rsp), %rdi
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rdi)
andq $0x0, 0x30(%rdi)
movupd %xmm0, 0x8(%rdi)
leaq 0xce26(%rip), %rax      # 0x1acb8
movq %rax, -0xc0(%rdi)
leaq 0xce60(%rip), %rax      # 0x1ad00
movq %rax, (%rdi)
leaq 0xc8(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movupd %xmm0, -0x70(%rax)
movupd %xmm0, -0x60(%rax)
movupd %xmm0, -0x50(%rax)
movupd %xmm0, -0x40(%rax)
movupd %xmm0, -0x30(%rax)
movupd %xmm0, -0x20(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
xorl %ecx, %ecx
movb %cl, 0x60(%rax)
movupd %xmm0, 0x20(%rax)
movupd %xmm0, 0x29(%rax)
movb %cl, 0x44(%rax)
movb %cl, 0x46(%rax)
andw $0x0, 0x38(%rdi)
addq $0x10, %r14
pushq $0x1
popq %rcx
movq %r14, %rsi
xorl %edx, %edx
callq 0x9260
xorpd %xmm0, %xmm0
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xdf2f
leaq 0x50(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x2
popq %rcx
movq %rbx, %rdx
movl %ecx, %r8d
callq 0x98d4
jmp 0xe066
leaq 0x50(%rsp), %r14
movq (%r14), %rax
movq -0x18(%rax), %rsi
addq %r14, %rsi
leaq 0x30(%rsp), %rdi
callq 0x93b4
leaq 0x18(%rsp), %rdi
pushq $0x4
popq %rsi
leaq 0xf(%rsp), %rdx
callq 0xfa60
movq 0x30(%rsp), %rax
movq 0x48(%rsp), %rcx
addq $-0xa, %rax
addq $0xa, %rcx
leaq 0x18(%rsp), %rsi
movq (%rsi), %rdx
movq %rax, (%rdx)
movq %rcx, 0x8(%rdx)
movq 0x40(%rsp), %rdi
addq $0xa, %rdi
movq %rdi, 0x10(%rdx)
movq %rcx, 0x18(%rdx)
movq 0x38(%rsp), %rcx
addq $-0xa, %rcx
movq %rdi, 0x20(%rdx)
movq %rcx, 0x28(%rdx)
movq %rax, 0x30(%rdx)
movq %rcx, 0x38(%rdx)
movq 0x50(%rsp), %rax
addq -0x18(%rax), %r14
pushq $0x1
popq %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x8cd0
leaq 0x50(%rsp), %rdi
movb $0x1, 0xbc(%rdi)
pushq $0x1
popq %rsi
pushq $0x3
popq %rcx
movq %rbx, %rdx
movl %ecx, %r8d
callq 0x98d4
movq 0x18(%rbx), %rax
movq 0x20(%rbx), %rcx
subq %rax, %rcx
movabsq $0x7fffffff8, %rdx      # imm = 0x7FFFFFFF8
andq %rcx, %rdx
cmpq $0x8, %rdx
jne 0xe054
movq (%rax), %r15
movq 0x20(%r15), %rsi
subq 0x18(%r15), %rsi
shrq $0x3, %rsi
testl %esi, %esi
jle 0xe054
leaq 0x18(%rbx), %r14
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movq %r14, %rdi
callq 0xf948
movq 0x18(%r15), %rax
movq (%rax), %rax
movq (%r14), %rcx
movq %rax, (%rcx)
pushq $0x1
popq %r14
movq 0x18(%r15), %rax
movq 0x20(%r15), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
movslq %ecx, %rcx
cmpq %rcx, %r14
jge 0xe05c
movq (%rax,%r14,8), %rsi
movq %rbx, %rdi
callq 0x7a70
incq %r14
jmp 0xe02c
movq %rbx, %rdi
callq 0x79c0
leaq 0x18(%rsp), %rdi
callq 0x673c
leaq 0x50(%rsp), %rdi
callq 0x961c
addq $0x150, %rsp            # imm = 0x150
popq %rbx
popq %r14
popq %r15
retq
jmp 0xe088
jmp 0xe083
jmp 0xe088
movq %rax, %rbx
jmp 0xe095
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x673c
leaq 0x50(%rsp), %rdi
callq 0x961c
movq %rbx, %rdi
callq 0x33a0
nop