// File: 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 %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x68(%rbp)
movsd 0x78(%rdi), %xmm0
movsd %xmm0, -0xc8(%rbp)
addq $0x58, %rdi
movslq -0x10(%rbp), %rsi
callq 0x21da0
movq -0x68(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0xd8(%rbp)
addq $0x58, %rdi
movslq -0xc(%rbp), %rsi
callq 0x21da0
movq -0x68(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0xd0(%rbp)
addq $0x58, %rdi
movslq -0x10(%rbp), %rsi
callq 0x21da0
movq -0x68(%rbp), %rdi
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0xe0(%rbp)
addq $0x58, %rdi
movslq -0xc(%rbp), %rsi
callq 0x21da0
movsd -0xe0(%rbp), %xmm2
movsd -0xd8(%rbp), %xmm1
movsd -0xd0(%rbp), %xmm3
movsd -0xc8(%rbp), %xmm0
mulsd 0x8(%rax), %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
callq 0x3060
movsd 0xcc9f(%rip), %xmm1     # 0x2b058
divsd %xmm1, %xmm0
callq 0x3160
movq -0x68(%rbp), %rdi
movsd %xmm0, -0x18(%rbp)
movq %rdi, %rax
addq $0x40, %rax
movq %rax, -0x88(%rbp)
addq $0x28, %rdi
movslq -0xc(%rbp), %rsi
callq 0x21aa0
movq -0x68(%rbp), %rdi
cvtsi2sdq (%rax), %xmm0
movsd %xmm0, -0xb0(%rbp)
movsd 0x70(%rdi), %xmm0
movsd %xmm0, -0xb8(%rbp)
addq $0x58, %rdi
movslq -0x10(%rbp), %rsi
callq 0x21da0
movq -0x68(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0xc0(%rbp)
addq $0x58, %rdi
movslq -0x10(%rbp), %rsi
callq 0x21da0
movsd -0xc0(%rbp), %xmm3
movsd -0xb8(%rbp), %xmm0
movsd -0xb0(%rbp), %xmm1
movsd 0x8(%rax), %xmm2
movsd -0x18(%rbp), %xmm4
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm4, %xmm2
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0x68(%rbp), %rdi
movq %rax, -0x90(%rbp)
addq $0x28, %rdi
movslq -0xc(%rbp), %rsi
callq 0x21aa0
movq -0x68(%rbp), %rdi
cvtsi2sdq 0x8(%rax), %xmm0
movsd %xmm0, -0x98(%rbp)
movsd 0x70(%rdi), %xmm0
movsd %xmm0, -0xa0(%rbp)
addq $0x58, %rdi
movslq -0x10(%rbp), %rsi
callq 0x21da0
movq -0x68(%rbp), %rdi
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0xa8(%rbp)
addq $0x58, %rdi
movslq -0x10(%rbp), %rsi
callq 0x21da0
movsd -0xa8(%rbp), %xmm3
movsd -0xa0(%rbp), %xmm0
movsd -0x98(%rbp), %xmm1
movsd (%rax), %xmm2
movsd -0x18(%rbp), %xmm4
mulsd %xmm4, %xmm2
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0x90(%rbp), %rsi
movq %rax, %rdx
leaq -0x28(%rbp), %rdi
callq 0xcae0
movq -0x88(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0xcab0
movq -0x68(%rbp), %rdi
movq %rdi, %rax
addq $0x40, %rax
movq %rax, -0x40(%rbp)
addq $0x28, %rdi
movslq -0xc(%rbp), %rsi
callq 0x21aa0
movq -0x68(%rbp), %rdi
cvtsi2sdq (%rax), %xmm0
movsd %xmm0, -0x70(%rbp)
movsd 0x70(%rdi), %xmm0
movsd %xmm0, -0x78(%rbp)
addq $0x58, %rdi
movslq -0xc(%rbp), %rsi
callq 0x21da0
movq -0x68(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x80(%rbp)
addq $0x58, %rdi
movslq -0xc(%rbp), %rsi
callq 0x21da0
movsd -0x80(%rbp), %xmm3
movsd -0x78(%rbp), %xmm0
movsd -0x70(%rbp), %xmm1
movsd 0x8(%rax), %xmm2
movsd -0x18(%rbp), %xmm4
mulsd %xmm4, %xmm2
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0x68(%rbp), %rdi
movq %rax, -0x48(%rbp)
addq $0x28, %rdi
movslq -0xc(%rbp), %rsi
callq 0x21aa0
movq -0x68(%rbp), %rdi
cvtsi2sdq 0x8(%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd 0x70(%rdi), %xmm0
movsd %xmm0, -0x58(%rbp)
addq $0x58, %rdi
movslq -0xc(%rbp), %rsi
callq 0x21da0
movq -0x68(%rbp), %rdi
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x60(%rbp)
addq $0x58, %rdi
movslq -0xc(%rbp), %rsi
callq 0x21da0
movsd -0x60(%rbp), %xmm3
movsd -0x58(%rbp), %xmm0
movsd -0x50(%rbp), %xmm1
movsd (%rax), %xmm2
movsd -0x18(%rbp), %xmm4
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm4, %xmm2
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0x48(%rbp), %rsi
movq %rax, %rdx
leaq -0x38(%rbp), %rdi
callq 0xcae0
movq -0x40(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xcab0
addq $0xe0, %rsp
popq %rbp
retq