// File: /workspace/github_cpp_makefile_star2_O3/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, %rbx
movsd 0x78(%rdi), %xmm0
movslq %edx, %r12
movq 0x58(%rdi), %rax
shlq $0x4, %r12
movslq %esi, %r15
shlq $0x4, %r15
movsd 0x8(%rax,%r12), %xmm2
mulsd 0x8(%rax,%r15), %xmm2
movsd (%rax,%r12), %xmm1
mulsd (%rax,%r15), %xmm1
addsd %xmm2, %xmm1
callq 0x3060
mulsd 0x533c(%rip), %xmm0     # 0x156e0
callq 0x3130
leaq 0x40(%rbx), %r14
movupd 0x70(%rbx), %xmm5
movq 0x28(%rbx), %rax
movq 0x58(%rbx), %rcx
movupd (%rcx,%r12), %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
xorpd 0x3cb0(%rip), %xmm2     # 0x14080
cvtsi2sdq 0x8(%rax,%r15), %xmm3
cvtsi2sdq (%rax,%r15), %xmm4
unpcklpd %xmm3, %xmm4            # xmm4 = xmm4[0],xmm3[0]
unpcklpd %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
mulpd %xmm0, %xmm2
addpd %xmm1, %xmm2
unpcklpd %xmm5, %xmm5            # xmm5 = xmm5[0,0]
mulpd %xmm2, %xmm5
addpd %xmm4, %xmm5
xorpd %xmm1, %xmm1
movapd %xmm5, %xmm2
cmpltpd %xmm1, %xmm2
movapd %xmm2, %xmm1
andnpd 0x3c3a(%rip), %xmm1     # 0x14050
andpd 0x52e2(%rip), %xmm2     # 0x15700
orpd %xmm1, %xmm2
addpd %xmm5, %xmm2
cvttsd2si %xmm2, %rax
movq %rax, %xmm3
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
cvttsd2si %xmm2, %rax
movq %rax, %xmm1
punpcklqdq %xmm1, %xmm3    # xmm3 = xmm3[0],xmm1[0]
movdqa %xmm3, (%rsp)
movq 0x48(%rbx), %rsi
cmpq 0x50(%rbx), %rsi
je 0x10468
movdqa (%rsp), %xmm1
movdqu %xmm1, (%rsi)
movq 0x48(%rbx), %rsi
addq $0x10, %rsi
movq %rsi, 0x48(%rbx)
jmp 0x10483
movq %rsp, %rdx
movq %r14, %rdi
movapd %xmm0, 0x10(%rsp)
callq 0x72ce
movapd 0x10(%rsp), %xmm0
movq 0x48(%rbx), %rsi
movupd 0x70(%rbx), %xmm5
movq 0x28(%rbx), %rax
movq 0x58(%rbx), %rcx
movupd (%rcx,%r15), %xmm1
xorps %xmm2, %xmm2
cvtsi2sdq 0x8(%rax,%r15), %xmm2
xorps %xmm3, %xmm3
cvtsi2sdq (%rax,%r15), %xmm3
unpcklpd %xmm2, %xmm3            # xmm3 = xmm3[0],xmm2[0]
movapd 0x3bcb(%rip), %xmm2     # 0x14080
xorpd %xmm1, %xmm2
movapd %xmm1, %xmm4
shufpd $0x1, %xmm2, %xmm4      # xmm4 = xmm4[1],xmm2[0]
mulpd %xmm0, %xmm4
addpd %xmm1, %xmm4
unpcklpd %xmm5, %xmm5            # xmm5 = xmm5[0,0]
mulpd %xmm4, %xmm5
addpd %xmm3, %xmm5
xorpd %xmm1, %xmm1
movapd %xmm5, %xmm2
cmpltpd %xmm1, %xmm2
movapd %xmm2, %xmm1
andnpd 0x3b61(%rip), %xmm1     # 0x14050
andpd 0x5209(%rip), %xmm2     # 0x15700
orpd %xmm1, %xmm2
addpd %xmm5, %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)
cmpq 0x50(%rbx), %rsi
je 0x10536
movdqa (%rsp), %xmm0
movdqu %xmm0, (%rsi)
addq $0x10, 0x48(%rbx)
jmp 0x10541
movq %rsp, %rdx
movq %r14, %rdi
callq 0x72ce
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop