// File: /workspace/github_cpp_makefile_star2_O2/hzeller[P]gcode-multi-shell-extrude/third_party/clipper.cpp
// Function: ClipperLib::ClipperOffset::DoSquare(int, int)
void ClipperOffset::DoSquare(int j, int k)
{
  double dx = std::tan(std::atan2(m_sinA,
      m_normals[k].X * m_normals[j].X + m_normals[k].Y * m_normals[j].Y) / 4);
  m_destPoly.push_back(IntPoint(
      Round(m_srcPoly[j].X + m_delta * (m_normals[k].X - m_normals[k].Y * dx)),
      Round(m_srcPoly[j].Y + m_delta * (m_normals[k].Y + m_normals[k].X * dx))));
  m_destPoly.push_back(IntPoint(
      Round(m_srcPoly[j].X + m_delta * (m_normals[j].X + m_normals[j].Y * dx)),
      Round(m_srcPoly[j].Y + m_delta * (m_normals[j].Y - m_normals[j].X * dx))));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
movsd 0x78(%rdi), %xmm0
movslq %edx, %r15
movq 0x58(%rdi), %rax
shlq $0x4, %r15
movslq %esi, %r12
shlq $0x4, %r12
movsd 0x8(%rax,%r15), %xmm2
mulsd 0x8(%rax,%r12), %xmm2
movsd (%rax,%r15), %xmm1
mulsd (%rax,%r12), %xmm1
addsd %xmm2, %xmm1
callq 0x3060
mulsd 0x53b8(%rip), %xmm0     # 0x136e0
callq 0x3140
leaq 0x40(%r14), %rbx
movupd 0x70(%r14), %xmm5
movq 0x28(%r14), %rax
movq 0x58(%r14), %rcx
movupd (%rcx,%r15), %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
xorpd 0x3cfb(%rip), %xmm2     # 0x12050
cvtsi2sdq 0x8(%rax,%r12), %xmm3
cvtsi2sdq (%rax,%r12), %xmm4
unpcklpd %xmm3, %xmm4            # xmm4 = xmm4[0],xmm3[0]
unpcklpd %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
movapd %xmm0, (%rsp)
mulpd %xmm0, %xmm2
addpd %xmm1, %xmm2
unpcklpd %xmm5, %xmm5            # xmm5 = xmm5[0,0]
mulpd %xmm2, %xmm5
addpd %xmm4, %xmm5
xorpd %xmm0, %xmm0
movapd %xmm5, %xmm1
cmpltpd %xmm0, %xmm1
movapd 0x5364(%rip), %xmm2     # 0x13700
andpd %xmm1, %xmm2
andnpd 0x3c78(%rip), %xmm1     # 0x12020
orpd %xmm2, %xmm1
addpd %xmm5, %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]
leaq 0x10(%rsp), %r15
movdqa %xmm0, (%r15)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6770
movupd 0x70(%r14), %xmm0
movq 0x28(%r14), %rax
movq 0x58(%r14), %rcx
cvtsi2sdq 0x8(%rax,%r12), %xmm1
movupd (%rcx,%r12), %xmm2
cvtsi2sdq (%rax,%r12), %xmm3
unpcklpd %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0]
movapd 0x3c42(%rip), %xmm4     # 0x12050
xorpd %xmm2, %xmm4
movapd %xmm2, %xmm1
shufpd $0x1, %xmm4, %xmm1      # xmm1 = xmm1[1],xmm4[0]
mulpd (%rsp), %xmm1
addpd %xmm2, %xmm1
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
mulpd %xmm1, %xmm0
addpd %xmm3, %xmm0
movapd %xmm0, %xmm1
cmpltpd 0x3bd3(%rip), %xmm1     # 0x12010
movapd 0x52bb(%rip), %xmm2     # 0x13700
andpd %xmm1, %xmm2
andnpd 0x3bcf(%rip), %xmm1     # 0x12020
orpd %xmm2, %xmm1
addpd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
cvttsd2si %xmm1, %rcx
movq %rax, %xmm0
movq %rcx, %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movdqa %xmm0, (%r15)
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x6770
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop