// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movsd 0x78(%rdi), %xmm0
movslq %edx, %r14
movq 0x58(%rdi), %rax
shlq $0x4, %r14
movslq %esi, %r12
shlq $0x4, %r12
movsd 0x8(%rax,%r14), %xmm2
mulsd 0x8(%rax,%r12), %xmm2
movsd (%rax,%r14), %xmm1
mulsd (%rax,%r12), %xmm1
addsd %xmm2, %xmm1
callq 0x3060
andpd 0x43ac(%rip), %xmm0     # 0x14e90
mulsd 0x98(%rbx), %xmm0
xorpd %xmm6, %xmm6
xorl %eax, %eax
ucomisd %xmm0, %xmm6
seta %al
leaq 0x4b90(%rip), %rcx      # 0x15690
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %r13
testl %r13d, %r13d
jle 0x10c4d
movq 0x58(%rbx), %rax
movsd (%rax,%r14), %xmm8
movsd 0x8(%rax,%r14), %xmm4
leaq 0x40(%rbx), %r14
movsd 0x4b30(%rip), %xmm5     # 0x15660
movsd 0x34e0(%rip), %xmm7     # 0x14018
movq %rsp, %r15
movq 0x28(%rbx), %rax
xorps %xmm0, %xmm0
cvtsi2sdq (%rax,%r12), %xmm0
movsd 0x70(%rbx), %xmm1
movapd %xmm8, %xmm2
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
movapd %xmm2, %xmm0
cmpltsd %xmm6, %xmm0
movapd %xmm0, %xmm3
andpd %xmm5, %xmm3
andnpd %xmm7, %xmm0
orpd %xmm3, %xmm0
addsd %xmm2, %xmm0
cvttsd2si %xmm0, %rcx
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%rax,%r12), %xmm0
mulsd %xmm4, %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
cmpltsd %xmm6, %xmm0
movapd %xmm0, %xmm2
andpd %xmm5, %xmm2
andnpd %xmm7, %xmm0
orpd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movq %rcx, (%rsp)
movq %rax, 0x8(%rsp)
movq 0x48(%rbx), %rsi
cmpq 0x50(%rbx), %rsi
je 0x10bd3
movupd (%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, 0x48(%rbx)
jmp 0x10c0c
movq %r14, %rdi
movq %r15, %rdx
movsd %xmm4, 0x18(%rsp)
movsd %xmm8, 0x10(%rsp)
callq 0x75d4
movsd 0x10(%rsp), %xmm8
movsd 0x341e(%rip), %xmm7     # 0x14018
movsd 0x4a5e(%rip), %xmm5     # 0x15660
movsd 0x18(%rsp), %xmm4
xorpd %xmm6, %xmm6
movsd 0x80(%rbx), %xmm0
movsd 0x88(%rbx), %xmm1
movapd %xmm4, %xmm2
mulsd %xmm0, %xmm2
movapd %xmm8, %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
mulsd %xmm1, %xmm4
mulsd %xmm0, %xmm8
addsd %xmm8, %xmm4
movapd %xmm3, %xmm8
decl %r13d
jne 0x10b3b
movq 0x28(%rbx), %rax
movq 0x58(%rbx), %rcx
xorps %xmm1, %xmm1
cvtsi2sdq (%rax,%r12), %xmm1
movsd 0x70(%rbx), %xmm0
movsd (%rcx,%r12), %xmm2
mulsd %xmm0, %xmm2
addsd %xmm1, %xmm2
movapd %xmm2, %xmm1
cmpltsd %xmm6, %xmm1
movsd 0x49de(%rip), %xmm3     # 0x15660
movapd %xmm1, %xmm4
andpd %xmm3, %xmm4
movsd 0x3386(%rip), %xmm5     # 0x14018
andnpd %xmm5, %xmm1
orpd %xmm4, %xmm1
addsd %xmm2, %xmm1
cvttsd2si %xmm1, %rdx
xorps %xmm1, %xmm1
cvtsi2sdq 0x8(%rax,%r12), %xmm1
mulsd 0x8(%rcx,%r12), %xmm0
addsd %xmm1, %xmm0
movapd %xmm0, %xmm1
cmpltsd %xmm6, %xmm1
andpd %xmm1, %xmm3
andnpd %xmm5, %xmm1
orpd %xmm3, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rdx, (%rsp)
movq %rax, 0x8(%rsp)
movq 0x48(%rbx), %rsi
cmpq 0x50(%rbx), %rsi
je 0x10cf9
movupd (%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, 0x48(%rbx)
jmp 0x10d08
addq $0x40, %rbx
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x75d4
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq