// File: /workspace/github_cpp_makefile_star2_O3/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 0x4930(%rip), %xmm0     # 0x14ed0
mulsd 0x98(%rbx), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x5134(%rip), %rcx      # 0x156f0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %r13
testl %r13d, %r13d
jle 0x106ee
movq 0x58(%rbx), %rax
movupd (%rax,%r14), %xmm3
leaq 0x40(%rbx), %r14
xorpd %xmm4, %xmm4
movapd 0x3a67(%rip), %xmm5     # 0x14050
movapd 0x510f(%rip), %xmm6     # 0x15700
movq %rsp, %r15
movapd 0x3a84(%rip), %xmm7     # 0x14080
movq 0x28(%rbx), %rax
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%rax,%r12), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq (%rax,%r12), %xmm1
movupd 0x70(%rbx), %xmm2
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
mulpd %xmm3, %xmm2
addpd %xmm1, %xmm2
movapd %xmm2, %xmm0
cmpltpd %xmm4, %xmm0
movapd %xmm0, %xmm1
andnpd %xmm5, %xmm1
andpd %xmm6, %xmm0
orpd %xmm1, %xmm0
addpd %xmm2, %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
cvttsd2si %xmm0, %rax
movq %rax, %xmm0
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movdqa %xmm1, (%rsp)
movq 0x48(%rbx), %rsi
cmpq 0x50(%rbx), %rsi
je 0x10680
movdqa (%rsp), %xmm0
movdqu %xmm0, (%rsi)
addq $0x10, 0x48(%rbx)
jmp 0x106b3
movq %r14, %rdi
movq %r15, %rdx
movapd %xmm3, 0x10(%rsp)
callq 0x72ce
movapd 0x39e7(%rip), %xmm7     # 0x14080
movapd 0x505f(%rip), %xmm6     # 0x15700
movapd 0x39a7(%rip), %xmm5     # 0x14050
xorpd %xmm4, %xmm4
movapd 0x10(%rsp), %xmm3
movupd 0x80(%rbx), %xmm0
movapd %xmm0, %xmm1
xorpd %xmm7, %xmm1
shufpd $0x2, %xmm0, %xmm1      # xmm1 = xmm1[0],xmm0[1]
shufpd $0x1, %xmm0, %xmm0      # xmm0 = xmm0[1,0]
movapd %xmm3, %xmm2
unpckhpd %xmm3, %xmm2            # xmm2 = xmm2[1],xmm3[1]
mulpd %xmm2, %xmm1
unpcklpd %xmm3, %xmm3            # xmm3 = xmm3[0,0]
mulpd %xmm0, %xmm3
addpd %xmm1, %xmm3
decl %r13d
jne 0x105fc
movq 0x28(%rbx), %rax
movq 0x58(%rbx), %rcx
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%rax,%r12), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq (%rax,%r12), %xmm1
movupd 0x70(%rbx), %xmm2
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movupd (%rcx,%r12), %xmm0
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
mulpd %xmm0, %xmm2
addpd %xmm1, %xmm2
xorpd %xmm0, %xmm0
movapd %xmm2, %xmm1
cmpltpd %xmm0, %xmm1
movapd %xmm1, %xmm0
andnpd 0x3913(%rip), %xmm0     # 0x14050
andpd 0x4fbb(%rip), %xmm1     # 0x15700
orpd %xmm0, %xmm1
addpd %xmm2, %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]
movdqa %xmm0, (%rsp)
movq 0x48(%rbx), %rsi
cmpq 0x50(%rbx), %rsi
je 0x10788
movdqa (%rsp), %xmm0
movdqu %xmm0, (%rsi)
addq $0x10, 0x48(%rbx)
jmp 0x10797
addq $0x40, %rbx
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x72ce
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop