// File: /workspace/github_cpp_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movsd %xmm0, 0x8(%rsp)
movq %rsi, %r14
movq %rdi, %r15
movq %rsi, %rdi
callq 0x8730
movq %r15, %rdi
callq 0xf10c
movq %r15, %rdi
movsd 0x8(%rsp), %xmm0
callq 0xf57c
leaq 0x118(%rsp), %rbx
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rbx)
xorl %eax, %eax
movq %rax, 0x30(%rbx)
movupd %xmm0, 0x8(%rbx)
leaq 0xba02(%rip), %rcx      # 0x1bcb8
movq %rcx, -0xc0(%rbx)
leaq 0xba3c(%rip), %rcx      # 0x1bd00
movq %rcx, (%rbx)
leaq 0xd0(%rsp), %rcx
movl $0x0, (%rcx)
movq %rax, 0x8(%rcx)
movupd %xmm0, -0x70(%rcx)
movupd %xmm0, -0x60(%rcx)
movupd %xmm0, -0x50(%rcx)
movupd %xmm0, -0x40(%rcx)
movupd %xmm0, -0x30(%rcx)
movupd %xmm0, -0x20(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movb %al, 0x60(%rcx)
movupd %xmm0, 0x29(%rcx)
movupd %xmm0, 0x20(%rcx)
movb %al, 0x44(%rcx)
movb %al, 0x46(%rcx)
movw $0x0, 0x38(%rbx)
addq $0x10, %r15
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
movl $0x1, %ecx
callq 0xa19a
xorpd %xmm0, %xmm0
movsd 0x8(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x10360
leaq 0x58(%rsp), %rdi
movl $0x1, %esi
movq %r14, %rdx
movl $0x2, %ecx
movl $0x2, %r8d
callq 0xa982
jmp 0x1052d
leaq 0x58(%rsp), %r12
movq (%r12), %rax
movq -0x18(%rax), %rsi
addq %r12, %rsi
leaq 0x20(%rsp), %rdi
callq 0xa346
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movl $0x40, %edi
callq 0x3210
leaq 0x40(%rsp), %rsi
movq %rax, (%rsi)
movq %rax, 0x8(%rsi)
movq %rax, %rcx
addq $0x40, %rcx
movq %rcx, 0x10(%rsi)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x30(%rax)
movupd %xmm0, 0x20(%rax)
movupd %xmm0, 0x10(%rax)
movupd %xmm0, (%rax)
movq %rcx, 0x8(%rsi)
movq 0x20(%rsp), %rdi
movq 0x38(%rsp), %rcx
addq $-0xa, %rdi
addq $0xa, %rcx
movq %rdi, (%rax)
movq %rcx, 0x8(%rax)
movq 0x30(%rsp), %rdx
addq $0xa, %rdx
movq %rdx, 0x10(%rax)
movq %rcx, 0x18(%rax)
movq 0x28(%rsp), %rcx
addq $-0xa, %rcx
movq %rdx, 0x20(%rax)
movq %rcx, 0x28(%rax)
movq %rdi, 0x30(%rax)
movq %rax, 0x10(%rsp)
movq %rcx, 0x38(%rax)
movq 0x58(%rsp), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x9b74
leaq 0x58(%rsp), %rdi
movb $0x1, 0xbc(%rdi)
movl $0x1, %esi
movq %r14, %rdx
movl $0x3, %ecx
movl $0x3, %r8d
callq 0xa982
movq 0x18(%r14), %rax
movq 0x20(%r14), %rcx
subq %rax, %rcx
movabsq $0x7fffffff8, %rdx      # imm = 0x7FFFFFFF8
andq %rcx, %rdx
cmpq $0x8, %rdx
jne 0x1050e
movq (%rax), %rbp
movq 0x20(%rbp), %rsi
subq 0x18(%rbp), %rsi
shrq $0x3, %rsi
testl %esi, %esi
jle 0x1050e
leaq 0x18(%r14), %rbx
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movq %rbx, %rdi
callq 0x124ee
movq 0x18(%rbp), %rax
movq (%rax), %rax
movq %rbx, 0x8(%rsp)
movq (%rbx), %rcx
movq %rax, (%rcx)
movq 0x18(%rbp), %rax
movq 0x20(%rbp), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
cmpl $0x2, %ecx
jl 0x10516
movl $0x1, %ebx
movq (%rax,%rbx,8), %r13
movq 0x18(%r14), %r15
movq 0x20(%r14), %r12
movq %r13, 0x18(%rsp)
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x12bd0
subq %r15, %r12
shrq $0x3, %r12
movq %r14, 0x30(%r13)
movl %r12d, 0x38(%r13)
incq %rbx
movq 0x18(%rbp), %rax
movq 0x20(%rbp), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
movslq %ecx, %rcx
cmpq %rcx, %rbx
jl 0x104c3
jmp 0x10516
movq %r14, %rdi
callq 0x8730
movl $0x40, %esi
movq 0x10(%rsp), %rdi
callq 0x3220
leaq 0x118(%rsp), %rbx
leaq 0xb7ec(%rip), %rsi      # 0x1bd20
leaq 0x58(%rsp), %rdi
callq 0xa574
movq %rbx, %rdi
callq 0x9760
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x10563
jmp 0x1055e
jmp 0x10563
movq %rax, %r14
jmp 0x10575
movq %rax, %r14
movl $0x40, %esi
movq 0x10(%rsp), %rdi
callq 0x3220
leaq 0xb7a4(%rip), %rsi      # 0x1bd20
leaq 0x58(%rsp), %rdi
callq 0xa574
leaq 0x118(%rsp), %rdi
callq 0x9760
movq %r14, %rdi
callq 0x3380
nop