// File: /workspace/github_cpp_makefile_star2_O3/hzeller[P]gcode-multi-shell-extrude/third_party/clipper.cpp
// Function: ClipperLib::Clipper::DoMaxima(ClipperLib::TEdge*)
void Clipper::DoMaxima(TEdge *e)
{
  TEdge* eMaxPair = GetMaximaPair(e);
  if (!eMaxPair)
  {
    if (e->OutIdx >= 0)
      AddOutPt(e, e->Top);
    DeleteFromAEL(e);
    return;
  }

  TEdge* eNext = e->NextInAEL;
  while(eNext && eNext != eMaxPair)
  {
    IntersectEdges(e, eNext, e->Top, true);
    SwapPositionsInAEL(e, eNext);
    eNext = e->NextInAEL;
  }

  if(e->OutIdx == Unassigned && eMaxPair->OutIdx == Unassigned)
  {
    DeleteFromAEL(e);
    DeleteFromAEL(eMaxPair);
  }
  else if( e->OutIdx >= 0 && eMaxPair->OutIdx >= 0 )
  {
    IntersectEdges( e, eMaxPair, e->Top);
  }
#ifdef use_lines
  else if (e->WindDelta == 0)
  {
    if (e->OutIdx >= 0) 
    {
      AddOutPt(e, e->Top);
      e->OutIdx = Unassigned;
    }
    DeleteFromAEL(e);

    if (eMaxPair->OutIdx >= 0)
    {
      AddOutPt(eMaxPair, e->Top);
      eMaxPair->OutIdx = Unassigned;
    }
    DeleteFromAEL(eMaxPair);
  } 
#endif
  else throw clipperException("DoMaxima error");
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0xd138
testq %rax, %rax
je 0xdc46
movq %rax, %r15
movq 0x78(%r14), %r12
testq %r12, %r12
setne %al
sete %cl
cmpq %r15, %r12
sete %dl
orb %cl, %dl
jne 0xdc08
leaq 0x20(%r14), %r13
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
movl $0x1, %r8d
callq 0xc5a2
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xd196
movq 0x78(%r14), %r12
testq %r12, %r12
setne %al
je 0xdc08
cmpq %r15, %r12
jne 0xdbd2
movl 0x5c(%r14), %ecx
cmpl $-0x1, %ecx
je 0xdcaf
testl %ecx, %ecx
js 0xdd5a
cmpl $0x0, 0x5c(%r15)
js 0xdd5a
leaq 0x20(%r14), %rcx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %r8d, %r8d
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xc5a2
cmpl $0x0, 0x5c(%r14)
js 0xdc5c
leaq 0x20(%r14), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xbfae
movq 0x78(%r14), %rax
movq 0x80(%r14), %rcx
testq %rcx, %rcx
jne 0xdc7e
testq %rax, %rax
jne 0xdc7e
cmpq %r14, 0xa0(%rbx)
jne 0xdd50
addq $0x78, %r14
addq $0xa0, %rbx
leaq 0x78(%rcx), %rdx
testq %rcx, %rcx
cmoveq %rbx, %rdx
movq %rax, (%rdx)
testq %rax, %rax
je 0xdca3
movq %rcx, 0x80(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
jmp 0xdd50
cmpl $-0x1, 0x5c(%r15)
jne 0xdd5a
movq 0x80(%r14), %rcx
testq %rcx, %rcx
setne %sil
orb %al, %sil
movq 0xa0(%rbx), %rdx
addq $0xa0, %rbx
cmpq %r14, %rdx
sete %dil
orb %sil, %dil
cmpb $0x1, %dil
jne 0xdd11
addq $0x78, %r14
leaq 0x78(%rcx), %rdx
testq %rcx, %rcx
cmoveq %rbx, %rdx
movq %r12, (%rdx)
testb %al, %al
je 0xdd07
movq %rcx, 0x80(%r12)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq (%rbx), %rdx
movq 0x78(%r15), %rax
movq 0x80(%r15), %rcx
testq %rcx, %rcx
jne 0xdd2b
testq %rax, %rax
jne 0xdd2b
cmpq %r15, %rdx
jne 0xdd50
addq $0x78, %r15
leaq 0x78(%rcx), %rdx
testq %rcx, %rcx
cmovneq %rdx, %rbx
movq %rax, (%rbx)
testq %rax, %rax
je 0xdd49
movq %rcx, 0x80(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movl $0x28, %edi
callq 0x30f0
movq %rax, %rbx
leaq 0x7ae5(%rip), %rsi      # 0x15853
movq %rax, %rdi
callq 0x11cba
leaq 0xdfeb(%rip), %rsi      # 0x1bd68
leaq 0x3f70(%rip), %rdx      # 0x11cf4
movq %rbx, %rdi
callq 0x3370
movq %rax, %r14
movq %rbx, %rdi
callq 0x3170
movq %r14, %rdi
callq 0x3380