// File: hzeller[P]gcode-multi-shell-extrude/third_party/clipper.cpp
// Function: ClipperLib::ClipperOffset::DoRound(int, int)
void ClipperOffset::DoRound(int j, int k)
{
  double a = std::atan2(m_sinA,
  m_normals[k].X * m_normals[j].X + m_normals[k].Y * m_normals[j].Y);
  int steps = (int)Round(m_StepsPerRad * std::fabs(a));

  double X = m_normals[k].X, Y = m_normals[k].Y, X2;
  for (int i = 0; i < steps; ++i)
  {
    m_destPoly.push_back(IntPoint(
        Round(m_srcPoly[j].X + X * m_delta),
        Round(m_srcPoly[j].Y + Y * m_delta)));
    X2 = X;
    X = X * m_cos - m_sin * Y;
    Y = X2 * m_sin + Y * m_cos;
  }
  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)));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %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, -0x70(%rbp)
addq $0x58, %rdi
movslq -0x10(%rbp), %rsi
callq 0x21da0
movq -0x68(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x80(%rbp)
addq $0x58, %rdi
movslq -0xc(%rbp), %rsi
callq 0x21da0
movq -0x68(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x78(%rbp)
addq $0x58, %rdi
movslq -0x10(%rbp), %rsi
callq 0x21da0
movq -0x68(%rbp), %rdi
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x88(%rbp)
addq $0x58, %rdi
movslq -0xc(%rbp), %rsi
callq 0x21da0
movsd -0x88(%rbp), %xmm2
movsd -0x80(%rbp), %xmm1
movsd -0x78(%rbp), %xmm3
movsd -0x70(%rbp), %xmm0
mulsd 0x8(%rax), %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
callq 0x3060
movq -0x68(%rbp), %rax
movsd %xmm0, -0x18(%rbp)
movsd 0x98(%rax), %xmm0
movsd -0x18(%rbp), %xmm1
movaps 0xd764(%rip), %xmm2     # 0x2beb0
pand %xmm2, %xmm1
mulsd %xmm1, %xmm0
callq 0x20530
movq -0x68(%rbp), %rdi
movl %eax, -0x1c(%rbp)
addq $0x58, %rdi
movslq -0x10(%rbp), %rsi
callq 0x21da0
movq -0x68(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
addq $0x58, %rdi
movslq -0x10(%rbp), %rsi
callq 0x21da0
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x1e8c6
movq -0x68(%rbp), %rdi
movq %rdi, %rax
addq $0x40, %rax
movq %rax, -0x90(%rbp)
addq $0x28, %rdi
movslq -0xc(%rbp), %rsi
callq 0x21aa0
movq %rax, %rcx
movq -0x68(%rbp), %rax
cvtsi2sdq (%rcx), %xmm1
movsd -0x28(%rbp), %xmm0
movsd 0x70(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0x68(%rbp), %rdi
movq %rax, -0x98(%rbp)
addq $0x28, %rdi
movslq -0xc(%rbp), %rsi
callq 0x21aa0
movq %rax, %rcx
movq -0x68(%rbp), %rax
cvtsi2sdq 0x8(%rcx), %xmm1
movsd -0x30(%rbp), %xmm0
movsd 0x70(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0x98(%rbp), %rsi
movq %rax, %rdx
leaq -0x50(%rbp), %rdi
callq 0xcae0
movq -0x90(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0xcab0
movq -0x68(%rbp), %rax
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x28(%rbp), %xmm0
movsd 0x88(%rax), %xmm2
movsd 0x80(%rax), %xmm1
mulsd -0x30(%rbp), %xmm1
movq %xmm1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x38(%rbp), %xmm0
movsd 0x80(%rax), %xmm2
movsd -0x30(%rbp), %xmm1
mulsd 0x88(%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x1e798
movq -0x68(%rbp), %rdi
movq %rdi, %rax
addq $0x40, %rax
movq %rax, -0xa0(%rbp)
addq $0x28, %rdi
movslq -0xc(%rbp), %rsi
callq 0x21aa0
movq -0x68(%rbp), %rdi
cvtsi2sdq (%rax), %xmm0
movsd %xmm0, -0xb8(%rbp)
addq $0x58, %rdi
movslq -0xc(%rbp), %rsi
callq 0x21da0
movsd -0xb8(%rbp), %xmm1
movq %rax, %rcx
movq -0x68(%rbp), %rax
movsd (%rcx), %xmm0
movsd 0x70(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0x68(%rbp), %rdi
movq %rax, -0xa8(%rbp)
addq $0x28, %rdi
movslq -0xc(%rbp), %rsi
callq 0x21aa0
movq -0x68(%rbp), %rdi
cvtsi2sdq 0x8(%rax), %xmm0
movsd %xmm0, -0xb0(%rbp)
addq $0x58, %rdi
movslq -0xc(%rbp), %rsi
callq 0x21da0
movsd -0xb0(%rbp), %xmm1
movq %rax, %rcx
movq -0x68(%rbp), %rax
movsd 0x8(%rcx), %xmm0
movsd 0x70(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0xa8(%rbp), %rsi
movq %rax, %rdx
leaq -0x60(%rbp), %rdi
callq 0xcae0
movq -0xa0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0xcab0
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)