// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
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 0x49fb(%rip), %xmm0     # 0x12ee0
mulsd 0x98(%rbx), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x51ef(%rip), %rcx      # 0x136f0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
movq 0x58(%rbx), %rcx
movupd (%rcx,%r14), %xmm3
leaq 0x40(%rbx), %r14
xorl %ebp, %ebp
testl %eax, %eax
cmovgl %eax, %ebp
movq %rsp, %r15
subl $0x1, %ebp
jb 0xe5ee
movq 0x28(%rbx), %rax
cvtsi2sdq 0x8(%rax,%r12), %xmm0
movupd 0x70(%rbx), %xmm1
cvtsi2sdq (%rax,%r12), %xmm2
unpcklpd %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm3, %xmm1
addpd %xmm2, %xmm1
movapd %xmm1, %xmm0
cmpltpd 0x3ab1(%rip), %xmm0     # 0x12010
movapd %xmm0, %xmm2
andnpd 0x3ab5(%rip), %xmm2     # 0x12020
andpd 0x518d(%rip), %xmm0     # 0x13700
orpd %xmm2, %xmm0
addpd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
cvttsd2si %xmm0, %rcx
movq %rax, %xmm0
movq %rcx, %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movdqa %xmm0, (%rsp)
movq %r14, %rdi
movq %r15, %rsi
movapd %xmm3, 0x10(%rsp)
callq 0x6770
movapd 0x10(%rsp), %xmm3
movupd 0x80(%rbx), %xmm0
movapd %xmm0, %xmm1
xorpd 0x3a89(%rip), %xmm1     # 0x12050
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
jmp 0xe523
movq 0x28(%rbx), %rax
movq 0x58(%rbx), %rcx
cvtsi2sdq 0x8(%rax,%r12), %xmm0
movupd 0x70(%rbx), %xmm1
cvtsi2sdq (%rax,%r12), %xmm2
unpcklpd %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
movupd (%rcx,%r12), %xmm0
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm0, %xmm1
addpd %xmm2, %xmm1
xorpd %xmm0, %xmm0
movapd %xmm1, %xmm2
cmpltpd %xmm0, %xmm2
movapd %xmm2, %xmm0
andnpd 0x39e9(%rip), %xmm0     # 0x12020
andpd 0x50c1(%rip), %xmm2     # 0x13700
orpd %xmm0, %xmm2
addpd %xmm1, %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]
movq %rsp, %rsi
movdqa %xmm0, (%rsi)
movq %r14, %rdi
callq 0x6770
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop