// File: /workspace/github_cpp_makefile_star2_O3/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
movslq %ebp, %r12
shlq $0x4, %r12
movsd (%rax,%r12), %xmm0
movsd 0x8(%rax,%r12), %xmm2
movupd (%rax,%rsi), %xmm1
movapd %xmm1, %xmm3
unpckhpd %xmm1, %xmm3            # xmm3 = xmm3[1],xmm1[1]
movapd %xmm3, %xmm5
mulsd %xmm0, %xmm5
movapd %xmm1, %xmm4
mulsd %xmm2, %xmm4
subsd %xmm5, %xmm4
movsd %xmm4, 0x78(%rdi)
movapd 0x4db9(%rip), %xmm5     # 0x14ed0
andpd %xmm4, %xmm5
movsd 0x55c5(%rip), %xmm6     # 0x156e8
ucomisd %xmm5, %xmm6
ja 0x10346
movq %rdi, %r14
movsd 0x3f68(%rip), %xmm5     # 0x140a0
ucomisd %xmm5, %xmm4
ja 0x1014c
movsd 0x3f4a(%rip), %xmm5     # 0x14090
ucomisd %xmm4, %xmm5
jbe 0x10156
movsd %xmm5, 0x78(%r14)
movapd %xmm5, %xmm4
movsd 0x70(%r14), %xmm5
mulsd %xmm5, %xmm4
xorpd %xmm6, %xmm6
ucomisd %xmm4, %xmm6
jbe 0x10204
leaq 0x40(%r14), %r15
movq 0x28(%r14), %rax
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%rax,%r12), %xmm0
xorps %xmm2, %xmm2
cvtsi2sdq (%rax,%r12), %xmm2
unpcklpd %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
unpcklpd %xmm5, %xmm5            # xmm5 = xmm5[0,0]
mulpd %xmm5, %xmm1
addpd %xmm2, %xmm1
xorpd %xmm0, %xmm0
movapd %xmm1, %xmm2
cmpltpd %xmm0, %xmm2
movapd %xmm2, %xmm0
andnpd 0x3e9e(%rip), %xmm0     # 0x14050
andpd 0x5546(%rip), %xmm2     # 0x15700
orpd %xmm0, %xmm2
addpd %xmm1, %xmm2
cvttsd2si %xmm2, %rax
movq %rax, %xmm0
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
cvttsd2si %xmm2, %rax
movq %rax, %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movdqa %xmm0, (%rsp)
movq 0x48(%r14), %rsi
cmpq 0x50(%r14), %rsi
je 0x1024c
movdqa (%rsp), %xmm0
movdqu %xmm0, (%rsi)
movq 0x48(%r14), %rsi
addq $0x10, %rsi
movq %rsi, 0x48(%r14)
jmp 0x1025b
testl %ecx, %ecx
je 0x1023d
cmpl $0x1, %ecx
je 0x1032e
cmpl $0x2, %ecx
jne 0x10344
mulsd %xmm3, %xmm2
mulsd %xmm1, %xmm0
addsd %xmm2, %xmm0
addsd 0x3e72(%rip), %xmm0     # 0x140a0
ucomisd 0x90(%r14), %xmm0
jae 0x1033a
movq %r14, %rdi
movl %ebp, %esi
callq 0x10354
jmp 0x10344
movq %rsp, %rdx
movq %r15, %rdi
callq 0x72ce
movq 0x48(%r14), %rsi
movq 0x28(%r14), %rdx
addq %r12, %rdx
cmpq 0x50(%r14), %rsi
je 0x1027e
movdqu (%rdx), %xmm0
movdqu %xmm0, (%rsi)
movq 0x48(%r14), %rsi
addq $0x10, %rsi
movq %rsi, 0x48(%r14)
jmp 0x1028a
movq %r15, %rdi
callq 0x12168
movq 0x48(%r14), %rsi
movq 0x28(%r14), %rax
movq 0x58(%r14), %rcx
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%rax,%r12), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq (%rax,%r12), %xmm1
movupd 0x70(%r14), %xmm2
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movupd (%rcx,%r12), %xmm0
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
mulpd %xmm0, %xmm2
addpd %xmm1, %xmm2
xorpd %xmm0, %xmm0
movapd %xmm2, %xmm1
cmpltpd %xmm0, %xmm1
movapd %xmm1, %xmm0
andnpd 0x3d76(%rip), %xmm0     # 0x14050
andpd 0x541e(%rip), %xmm1     # 0x15700
orpd %xmm0, %xmm1
addpd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
cvttsd2si %xmm1, %rax
movq %rax, %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movdqa %xmm0, (%rsp)
cmpq 0x50(%r14), %rsi
je 0x10321
movapd (%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, 0x48(%r14)
jmp 0x10344
movq %rsp, %rdx
movq %r15, %rdi
callq 0x72ce
jmp 0x10344
movq %r14, %rdi
movl %ebp, %esi
callq 0x1054e
jmp 0x10344
movq %r14, %rdi
movl %ebp, %esi
callq 0x107a6
movl %ebp, (%rbx)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop