// File: /workspace/github_cpp_makefile_star2_O1/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, %rbx
movq %rdi, %r15
movq %rsi, %rdi
callq 0xd577
testq %rax, %rax
je 0xe078
movq %rax, %r14
movq 0x78(%rbx), %r12
testq %r12, %r12
setne %al
sete %cl
cmpq %r14, %r12
sete %dl
orb %cl, %dl
jne 0xe034
leaq 0x20(%rbx), %r13
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %r13, %rcx
movl $0x1, %r8d
callq 0xc94e
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0xd5d8
movq 0x78(%rbx), %r12
testq %r12, %r12
setne %al
je 0xe034
cmpq %r14, %r12
jne 0xdffe
movl 0x5c(%rbx), %ecx
cmpl $-0x1, %ecx
jne 0xe047
cmpl $-0x1, 0x5c(%r14)
je 0xe0e0
testl %ecx, %ecx
js 0xe16e
cmpl $0x0, 0x5c(%r14)
js 0xe16e
leaq 0x20(%rbx), %rcx
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
xorl %r8d, %r8d
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xc94e
cmpl $0x0, 0x5c(%rbx)
js 0xe08d
leaq 0x20(%rbx), %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0xc328
movq 0x78(%rbx), %rax
movq 0x80(%rbx), %rcx
testq %rcx, %rcx
jne 0xe0ab
testq %rax, %rax
jne 0xe0ab
cmpq %rbx, 0xa0(%r15)
jne 0xe0d6
addq $0x78, %rbx
addq $0xa0, %r15
leaq 0x78(%rcx), %rdx
testq %rcx, %rcx
cmoveq %r15, %rdx
movq %rax, (%rdx)
testq %rax, %rax
je 0xe0d0
movq %rcx, 0x80(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x80(%rbx), %rdx
testq %rdx, %rdx
setne %sil
orb %al, %sil
leaq 0xa0(%r15), %rcx
testb %sil, %sil
jne 0xe106
cmpq %rbx, 0xa0(%r15)
jne 0xe12a
addq $0x78, %rbx
leaq 0x78(%rdx), %rsi
testq %rdx, %rdx
cmoveq %rcx, %rsi
movq %r12, (%rsi)
testb %al, %al
je 0xe124
movq %rdx, 0x80(%r12)
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq 0x78(%r14), %rax
movq 0x80(%r14), %rdx
testq %rdx, %rdx
jne 0xe144
testq %rax, %rax
jne 0xe144
cmpq %r14, (%rcx)
jne 0xe0d6
addq $0x78, %r14
leaq 0x78(%rdx), %rsi
testq %rdx, %rdx
cmovneq %rsi, %rcx
movq %rax, (%rcx)
testq %rax, %rax
je 0xe162
movq %rdx, 0x80(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
jmp 0xe0d6
movl $0x28, %edi
callq 0x30f0
movq %rax, %rbx
leaq 0x7661(%rip), %rsi      # 0x157e3
movq %rax, %rdi
callq 0x1225c
leaq 0xdbd7(%rip), %rsi      # 0x1bd68
leaq 0x40fe(%rip), %rdx      # 0x12296
movq %rbx, %rdi
callq 0x3370
movq %rax, %r14
movq %rbx, %rdi
callq 0x3170
movq %r14, %rdi
callq 0x3380