// File: /workspace/github_cpp_makefile_star2_O1/hzeller[P]gcode-multi-shell-extrude/third_party/clipper.cpp
// Function: ClipperLib::ClipperOffset::OffsetPoint(int, int&, ClipperLib::JoinType)
void ClipperOffset::OffsetPoint(int j, int& k, JoinType jointype)
{
  m_sinA = (m_normals[k].X * m_normals[j].Y - m_normals[j].X * m_normals[k].Y);
  if (m_sinA < 0.00005 && m_sinA > -0.00005) return;
  else if (m_sinA > 1.0) m_sinA = 1.0;
  else if (m_sinA < -1.0) m_sinA = -1.0;

  if (m_sinA * m_delta < 0)
  {
    m_destPoly.push_back(IntPoint(Round(m_srcPoly[j].X + m_normals[k].X * m_delta),
      Round(m_srcPoly[j].Y + m_normals[k].Y * m_delta)));
    m_destPoly.push_back(m_srcPoly[j]);
    m_destPoly.push_back(IntPoint(Round(m_srcPoly[j].X + m_normals[j].X * m_delta),
      Round(m_srcPoly[j].Y + m_normals[j].Y * m_delta)));
  }
  else
    switch (jointype)
    {
      case jtMiter:
        {
          double r = 1 + (m_normals[j].X * m_normals[k].X +
            m_normals[j].Y * m_normals[k].Y);
          if (r >= m_miterLim) DoMiter(j, k, r); else DoSquare(j, k);
          break;
        }
      case jtSquare: DoSquare(j, k); break;
      case jtRound: DoRound(j, k); break;
    }
  k = j;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movl %esi, %ebp
movslq (%rdx), %rdx
movq 0x58(%rdi), %rax
movq %rdx, %rsi
shlq $0x4, %rsi
movsd (%rax,%rsi), %xmm1
movsd 0x8(%rax,%rsi), %xmm2
movslq %ebp, %r12
shlq $0x4, %r12
movsd (%rax,%r12), %xmm0
movsd 0x8(%rax,%r12), %xmm3
movapd %xmm2, %xmm5
mulsd %xmm0, %xmm5
movapd %xmm1, %xmm4
mulsd %xmm3, %xmm4
subsd %xmm5, %xmm4
movsd %xmm4, 0x78(%rdi)
movapd 0x4895(%rip), %xmm5     # 0x14e90
andpd %xmm4, %xmm5
movsd 0x5079(%rip), %xmm6     # 0x15680
ucomisd %xmm5, %xmm6
ja 0x1085f
movq %rdi, %r14
movsd 0x3a0c(%rip), %xmm5     # 0x14028
ucomisd %xmm5, %xmm4
ja 0x10630
movsd 0x39e6(%rip), %xmm5     # 0x14010
ucomisd %xmm4, %xmm5
jbe 0x10636
movsd %xmm5, 0x78(%r14)
movsd 0x70(%r14), %xmm4
movsd 0x78(%r14), %xmm6
mulsd %xmm4, %xmm6
xorpd %xmm5, %xmm5
ucomisd %xmm6, %xmm5
jbe 0x106fe
addq %rsi, %rax
movq 0x28(%r14), %rcx
xorps %xmm0, %xmm0
cvtsi2sdq (%rcx,%r12), %xmm0
movsd (%rax), %xmm1
mulsd %xmm4, %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
cmpltsd %xmm5, %xmm0
movsd 0x4fdf(%rip), %xmm6     # 0x15660
movapd %xmm0, %xmm2
andpd %xmm6, %xmm2
movsd 0x3987(%rip), %xmm7     # 0x14018
andnpd %xmm7, %xmm0
orpd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %rdx
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%rcx,%r12), %xmm0
mulsd 0x8(%rax), %xmm4
leaq 0x40(%r14), %r15
addsd %xmm0, %xmm4
movapd %xmm4, %xmm0
cmpltsd %xmm5, %xmm0
movapd %xmm0, %xmm1
andpd %xmm6, %xmm1
andnpd %xmm7, %xmm0
orpd %xmm1, %xmm0
addsd %xmm4, %xmm0
cvttsd2si %xmm0, %rax
movq %rdx, (%rsp)
movq %rax, 0x8(%rsp)
movq 0x48(%r14), %rsi
cmpq 0x50(%r14), %rsi
je 0x10746
movupd (%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, 0x48(%r14)
jmp 0x10761
testl %ecx, %ecx
je 0x10737
cmpl $0x1, %ecx
je 0x10847
cmpl $0x2, %ecx
jne 0x1085d
mulsd %xmm2, %xmm3
mulsd %xmm1, %xmm0
addsd %xmm3, %xmm0
addsd 0x3900(%rip), %xmm0     # 0x14028
ucomisd 0x90(%r14), %xmm0
jae 0x10853
movq %r14, %rdi
movl %ebp, %esi
callq 0x1086c
jmp 0x1085d
movq %rsp, %rdx
movq %r15, %rdi
callq 0x75d4
movsd 0x38bf(%rip), %xmm7     # 0x14018
movsd 0x4eff(%rip), %xmm6     # 0x15660
movq 0x28(%r14), %rdx
addq %r12, %rdx
movq 0x48(%r14), %rsi
cmpq 0x50(%r14), %rsi
je 0x10781
movupd (%rdx), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, 0x48(%r14)
jmp 0x10799
movq %r15, %rdi
callq 0x1270c
movsd 0x3887(%rip), %xmm7     # 0x14018
movsd 0x4ec7(%rip), %xmm6     # 0x15660
movq 0x28(%r14), %rax
movq 0x58(%r14), %rcx
xorps %xmm0, %xmm0
cvtsi2sdq (%rax,%r12), %xmm0
movsd 0x70(%r14), %xmm1
movsd (%rcx,%r12), %xmm2
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
xorpd %xmm0, %xmm0
movapd %xmm2, %xmm3
cmpltsd %xmm0, %xmm3
movapd %xmm3, %xmm4
andpd %xmm6, %xmm4
andnpd %xmm7, %xmm3
orpd %xmm4, %xmm3
addsd %xmm2, %xmm3
cvttsd2si %xmm3, %rdx
xorps %xmm2, %xmm2
cvtsi2sdq 0x8(%rax,%r12), %xmm2
mulsd 0x8(%rcx,%r12), %xmm1
addsd %xmm2, %xmm1
movapd %xmm1, %xmm2
cmpltsd %xmm0, %xmm2
andpd %xmm2, %xmm6
andnpd %xmm7, %xmm2
orpd %xmm6, %xmm2
addsd %xmm1, %xmm2
cvttsd2si %xmm2, %rax
movq %rdx, (%rsp)
movq %rax, 0x8(%rsp)
movq 0x48(%r14), %rsi
cmpq 0x50(%r14), %rsi
je 0x1083a
movupd (%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, 0x48(%r14)
jmp 0x1085d
movq %rsp, %rdx
movq %r15, %rdi
callq 0x75d4
jmp 0x1085d
movq %r14, %rdi
movl %ebp, %esi
callq 0x10a92
jmp 0x1085d
movq %r14, %rdi
movl %ebp, %esi
callq 0x10d16
movl %ebp, (%rbx)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq