// File: /workspace/github_cpp_makefile_star2_O3/hzeller[P]gcode-multi-shell-extrude/third_party/clipper.cpp
// Function: ClipperLib::ClipperOffset::DoOffset(double)
void ClipperOffset::DoOffset(double delta)
{
  m_destPolys.clear();
  m_delta = delta;

  //if Zero offset, just copy any CLOSED polygons to m_p and return ...
  if (NEAR_ZERO(delta)) 
  {
    m_destPolys.reserve(m_polyNodes.ChildCount());
    for (int i = 0; i < m_polyNodes.ChildCount(); i++)
    {
      PolyNode& node = *m_polyNodes.Childs[i];
      if (node.m_endtype == etClosedPolygon)
        m_destPolys.push_back(node.Contour);
    }
    return;
  }

  //see offset_triginometry3.svg in the documentation folder ...
  if (MiterLimit > 2) m_miterLim = 2/(MiterLimit * MiterLimit);
  else m_miterLim = 0.5;

  double y;
  if (ArcTolerance <= 0.0) y = def_arc_tolerance;
  else if (ArcTolerance > std::fabs(delta) * def_arc_tolerance) 
    y = std::fabs(delta) * def_arc_tolerance;
  else y = ArcTolerance;
  //see offset_triginometry2.svg in the documentation folder ...
  double steps = pi / std::acos(1 - y / std::fabs(delta));
  if (steps > std::fabs(delta) * pi) 
    steps = std::fabs(delta) * pi;  //ie excessive precision check
  m_sin = std::sin(two_pi / steps);
  m_cos = std::cos(two_pi / steps);
  m_StepsPerRad = steps / two_pi;
  if (delta < 0.0) m_sin = -m_sin;

  m_destPolys.reserve(m_polyNodes.ChildCount() * 2);
  for (int i = 0; i < m_polyNodes.ChildCount(); i++)
  {
    PolyNode& node = *m_polyNodes.Childs[i];
    m_srcPoly = node.Contour;

    int len = (int)m_srcPoly.size();
    if (len == 0 || (delta <= 0 && (len < 3 || node.m_endtype != etClosedPolygon)))
        continue;

    m_destPoly.clear();
    if (len == 1)
    {
      if (node.m_jointype == jtRound)
      {
        double X = 1.0, Y = 0.0;
        for (cInt j = 1; j <= steps; j++)
        {
          m_destPoly.push_back(IntPoint(
            Round(m_srcPoly[0].X + X * delta),
            Round(m_srcPoly[0].Y + Y * delta)));
          double X2 = X;
          X = X * m_cos - m_sin * Y;
          Y = X2 * m_sin + Y * m_cos;
        }
      }
      else
      {
        double X = -1.0, Y = -1.0;
        for (int j = 0; j < 4; ++j)
        {
          m_destPoly.push_back(IntPoint(
            Round(m_srcPoly[0].X + X * delta),
            Round(m_srcPoly[0].Y + Y * delta)));
          if (X < 0) X = 1;
          else if (Y < 0) Y = 1;
          else X = -1;
        }
      }
      m_destPolys.push_back(m_destPoly);
      continue;
    }
    //build m_normals ...
    m_normals.clear();
    m_normals.reserve(len);
    for (int j = 0; j < len - 1; ++j)
      m_normals.push_back(GetUnitNormal(m_srcPoly[j], m_srcPoly[j + 1]));
    if (node.m_endtype == etClosedLine || node.m_endtype == etClosedPolygon)
      m_normals.push_back(GetUnitNormal(m_srcPoly[len - 1], m_srcPoly[0]));
    else
      m_normals.push_back(DoublePoint(m_normals[len - 2]));

    if (node.m_endtype == etClosedPolygon)
    {
      int k = len - 1;
      for (int j = 0; j < len; ++j)
        OffsetPoint(j, k, node.m_jointype);
      m_destPolys.push_back(m_destPoly);
    }
    else if (node.m_endtype == etClosedLine)
    {
      int k = len - 1;
      for (int j = 0; j < len; ++j)
        OffsetPoint(j, k, node.m_jointype);
      m_destPolys.push_back(m_destPoly);
      m_destPoly.clear();
      //re-build m_normals ...
      DoublePoint n = m_normals[len -1];
      for (int j = len - 1; j > 0; j--)
        m_normals[j] = DoublePoint(-m_normals[j - 1].X, -m_normals[j - 1].Y);
      m_normals[0] = DoublePoint(-n.X, -n.Y);
      k = 0;
      for (int j = len - 1; j >= 0; j--)
        OffsetPoint(j, k, node.m_jointype);
      m_destPolys.push_back(m_destPoly);
    }
    else
    {
      int k = 0;
      for (int j = 1; j < len - 1; ++j)
        OffsetPoint(j, k, node.m_jointype);

      IntPoint pt1;
      if (node.m_endtype == etOpenButt)
      {
        int j = len - 1;
        pt1 = IntPoint((cInt)Round(m_srcPoly[j].X + m_normals[j].X *
          delta), (cInt)Round(m_srcPoly[j].Y + m_normals[j].Y * delta));
        m_destPoly.push_back(pt1);
        pt1 = IntPoint((cInt)Round(m_srcPoly[j].X - m_normals[j].X *
          delta), (cInt)Round(m_srcPoly[j].Y - m_normals[j].Y * delta));
        m_destPoly.push_back(pt1);
      }
      else
      {
        int j = len - 1;
        k = len - 2;
        m_sinA = 0;
        m_normals[j] = DoublePoint(-m_normals[j].X, -m_normals[j].Y);
        if (node.m_endtype == etOpenSquare)
          DoSquare(j, k);
        else
          DoRound(j, k);
      }

      //re-build m_normals ...
      for (int j = len - 1; j > 0; j--)
        m_normals[j] = DoublePoint(-m_normals[j - 1].X, -m_normals[j - 1].Y);
      m_normals[0] = DoublePoint(-m_normals[1].X, -m_normals[1].Y);

      k = len - 1;
      for (int j = k - 1; j > 0; --j) OffsetPoint(j, k, node.m_jointype);

      if (node.m_endtype == etOpenButt)
      {
        pt1 = IntPoint((cInt)Round(m_srcPoly[0].X - m_normals[0].X * delta),
          (cInt)Round(m_srcPoly[0].Y - m_normals[0].Y * delta));
        m_destPoly.push_back(pt1);
        pt1 = IntPoint((cInt)Round(m_srcPoly[0].X + m_normals[0].X * delta),
          (cInt)Round(m_srcPoly[0].Y + m_normals[0].Y * delta));
        m_destPoly.push_back(pt1);
      }
      else
      {
        k = 1;
        m_sinA = 0;
        if (node.m_endtype == etOpenSquare)
          DoSquare(0, 1);
        else
          DoRound(0, 1);
      }
      m_destPolys.push_back(m_destPoly);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movaps %xmm0, 0x80(%rsp)
movq %rdi, %rbx
leaq 0x10(%rdi), %r14
movq 0x10(%rdi), %rsi
movq %r14, %rdi
callq 0x129cc
movapd 0x80(%rsp), %xmm0
movsd %xmm0, 0x70(%rbx)
movapd 0x5d0e(%rip), %xmm4     # 0x14ed0
andpd %xmm0, %xmm4
movsd 0x650a(%rip), %xmm0     # 0x156d8
ucomisd %xmm4, %xmm0
jbe 0xf251
movq 0xd0(%rbx), %rax
subq 0xc8(%rbx), %rax
shrq $0x3, %rax
movslq %eax, %rsi
movq %r14, %r15
movq %r14, %rdi
callq 0x11d92
movq 0xc8(%rbx), %rax
movq 0xd0(%rbx), %rcx
movq %rcx, %rdx
subq %rax, %rdx
shrq $0x3, %rdx
testl %edx, %edx
jle 0xfd8d
xorl %r14d, %r14d
movq (%rax,%r14,8), %rsi
cmpl $0x0, 0x44(%rsi)
jne 0xf237
movq %r15, %rdi
callq 0x11f18
movq 0xc8(%rbx), %rax
movq 0xd0(%rbx), %rcx
incq %r14
movq %rcx, %rdx
subq %rax, %rdx
shrq $0x3, %rdx
movslq %edx, %rdx
cmpq %rdx, %r14
jl 0xf217
jmp 0xfd8d
movsd (%rbx), %xmm1
movsd 0x8(%rbx), %xmm0
movsd 0x4e56(%rip), %xmm2     # 0x140b8
movapd %xmm2, %xmm3
cmpltsd %xmm1, %xmm2
mulsd %xmm1, %xmm1
divsd %xmm1, %xmm3
andpd %xmm2, %xmm3
movsd 0x5d41(%rip), %xmm1     # 0x14fc0
andnpd %xmm1, %xmm2
orpd %xmm3, %xmm2
movlpd %xmm2, 0x90(%rbx)
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jae 0xf2ab
movsd 0x643f(%rip), %xmm1     # 0x156e0
mulsd %xmm4, %xmm1
minsd %xmm0, %xmm1
jmp 0xf2b3
movsd 0x642d(%rip), %xmm1     # 0x156e0
movapd %xmm4, 0x70(%rsp)
divsd %xmm4, %xmm1
movsd 0x4ddb(%rip), %xmm0     # 0x140a0
subsd %xmm1, %xmm0
callq 0x31e0
movsd 0x4dea(%rip), %xmm1     # 0x140c0
movapd 0x70(%rsp), %xmm2
mulsd %xmm1, %xmm2
divsd %xmm0, %xmm1
minsd %xmm1, %xmm2
movapd %xmm2, 0x70(%rsp)
movsd 0x4dfa(%rip), %xmm0     # 0x140f0
divsd %xmm2, %xmm0
movsd %xmm0, 0x40(%rsp)
callq 0x3090
movsd %xmm0, 0x80(%rbx)
movsd 0x40(%rsp), %xmm0
callq 0x33c0
movsd %xmm0, 0x88(%rbx)
movapd 0x70(%rsp), %xmm0
divsd 0x4dc2(%rip), %xmm0     # 0x140f0
movsd %xmm0, 0x98(%rbx)
xorpd %xmm0, %xmm0
ucomisd 0x80(%rsp), %xmm0
jbe 0xf35d
movsd 0x80(%rbx), %xmm0
xorpd 0x4d2b(%rip), %xmm0     # 0x14080
movlpd %xmm0, 0x80(%rbx)
movq 0xd0(%rbx), %rax
subq 0xc8(%rbx), %rax
shrq $0x2, %rax
movslq %eax, %rsi
andq $-0x2, %rsi
movq %r14, 0x20(%rsp)
movq %r14, %rdi
callq 0x11d92
movq 0xc8(%rbx), %rax
movq 0xd0(%rbx), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
testl %ecx, %ecx
jle 0xfd8d
leaq 0x28(%rbx), %r15
leaq 0x40(%rbx), %rcx
movq %rcx, 0x10(%rsp)
leaq 0x58(%rbx), %rcx
movq %rcx, 0x28(%rsp)
movapd 0x80(%rsp), %xmm0
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
movapd %xmm0, 0x60(%rsp)
xorl %r12d, %r12d
movq %r15, 0x50(%rsp)
movq (%rax,%r12,8), %rsi
movq %r15, %rdi
movq %rsi, 0x40(%rsp)
callq 0x718a
xorpd %xmm5, %xmm5
movq 0x30(%rbx), %r13
subq 0x28(%rbx), %r13
movq %r13, %rbp
shrq $0x4, %rbp
testl %ebp, %ebp
je 0xfd69
ucomisd 0x80(%rsp), %xmm5
jae 0xf551
movq 0x40(%rbx), %rax
cmpq %rax, 0x48(%rbx)
je 0xf41a
movq %rax, 0x48(%rbx)
cmpl $0x1, %ebp
movapd 0x70(%rsp), %xmm0
jne 0xf56e
movq 0x40(%rsp), %rax
cmpl $0x1, 0x40(%rax)
jne 0xf64d
ucomisd 0x4c60(%rip), %xmm0     # 0x140a0
movq 0x10(%rsp), %r13
jb 0xf78e
movl $0x2, %r14d
movsd 0x4c47(%rip), %xmm3     # 0x140a0
movq 0x28(%rbx), %rax
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%rax), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq (%rax), %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movapd %xmm3, %xmm0
mulpd 0x60(%rsp), %xmm0
addpd %xmm1, %xmm0
movapd %xmm0, %xmm1
cmpltpd 0x4b83(%rip), %xmm1     # 0x14010
movapd %xmm1, %xmm2
andnpd 0x4bb7(%rip), %xmm2     # 0x14050
andpd 0x625f(%rip), %xmm1     # 0x15700
orpd %xmm2, %xmm1
addpd %xmm0, %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 0xf4e4
movdqa (%rsp), %xmm0
movdqu %xmm0, (%rsi)
addq $0x10, 0x48(%rbx)
jmp 0xf4fb
movq %r13, %rdi
movq %rsp, %rdx
movapd %xmm3, 0x40(%rsp)
callq 0x72ce
movapd 0x40(%rsp), %xmm3
movupd 0x80(%rbx), %xmm0
movapd %xmm0, %xmm1
xorpd 0x4b71(%rip), %xmm1     # 0x14080
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
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
addpd %xmm1, %xmm3
incq %r14
movapd 0x70(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jae 0xf459
jmp 0xf78e
cmpl $0x3, %ebp
jl 0xfd69
movq 0x40(%rsp), %rax
cmpl $0x0, 0x44(%rax)
jne 0xfd69
jmp 0xf40c
movq %r12, 0x58(%rsp)
movq 0x58(%rbx), %rax
cmpq %rax, 0x60(%rbx)
je 0xf581
movq %rax, 0x60(%rbx)
movslq %ebp, %rsi
movq 0x28(%rsp), %rdi
callq 0x11fe0
leal -0x1(%rbp), %r15d
cmpl $0x2, %ebp
jl 0xf5ec
movl %r15d, %r12d
xorl %r14d, %r14d
movq 0x28(%rbx), %rdi
leaq (%rdi,%r14), %rsi
addq $0x10, %rsi
addq %r14, %rdi
callq 0xe802
movsd %xmm0, (%rsp)
movsd %xmm1, 0x8(%rsp)
movq 0x60(%rbx), %rsi
cmpq 0x68(%rbx), %rsi
je 0xf5d6
movupd (%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, 0x60(%rbx)
jmp 0xf5e3
movq 0x28(%rsp), %rdi
movq %rsp, %rdx
callq 0x13550
addq $0x10, %r14
decq %r12
jne 0xf59d
movq %rbp, 0x30(%rsp)
movq 0x40(%rsp), %r12
cmpl $0x2, 0x44(%r12)
jae 0xf7a0
movslq %r15d, %rdi
movq 0x28(%rbx), %rsi
shlq $0x4, %rdi
addq %rsi, %rdi
callq 0xe802
movsd %xmm0, (%rsp)
movsd %xmm1, 0x8(%rsp)
movq 0x60(%rbx), %rsi
cmpq 0x68(%rbx), %rsi
movq 0x20(%rsp), %rbp
je 0xf7e8
movupd (%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, 0x60(%rbx)
xorpd %xmm3, %xmm3
movq %rsp, %r13
jmp 0xf7fc
movl $0x4, %ebp
movsd 0x4a36(%rip), %xmm0     # 0x14090
movapd %xmm0, %xmm8
movapd %xmm0, %xmm7
movq 0x10(%rsp), %r13
movq 0x28(%rbx), %rax
xorps %xmm0, %xmm0
cvtsi2sdq (%rax), %xmm0
movapd %xmm7, %xmm1
movapd 0x80(%rsp), %xmm3
mulsd %xmm3, %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
cmpltsd %xmm5, %xmm0
movapd %xmm0, %xmm2
movsd 0x6022(%rip), %xmm6     # 0x156c0
andpd %xmm6, %xmm2
movsd 0x5916(%rip), %xmm4     # 0x14fc0
andnpd %xmm4, %xmm0
orpd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%rax), %xmm0
movapd %xmm8, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
cmpltsd %xmm5, %xmm0
movapd %xmm0, %xmm2
andpd %xmm6, %xmm2
andnpd %xmm4, %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 0xf716
movupd (%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, 0x48(%rbx)
jmp 0xf73f
movq %r13, %rdi
movq %rsp, %rdx
movsd %xmm7, 0x40(%rsp)
movapd %xmm8, 0x30(%rsp)
callq 0x72ce
movapd 0x30(%rsp), %xmm8
movsd 0x40(%rsp), %xmm7
xorpd %xmm5, %xmm5
ucomisd %xmm7, %xmm5
jbe 0xf74f
movsd 0x4953(%rip), %xmm7     # 0x140a0
jmp 0xf786
ucomisd %xmm8, %xmm5
ja 0xf75e
movsd 0x4932(%rip), %xmm7     # 0x14090
movapd %xmm8, %xmm0
cmpltsd %xmm5, %xmm0
movapd %xmm0, %xmm1
movsd 0x492c(%rip), %xmm2     # 0x140a0
andpd %xmm2, %xmm1
andnpd %xmm8, %xmm0
orpd %xmm1, %xmm0
movapd %xmm0, %xmm8
decl %ebp
jne 0xf668
movq 0x20(%rsp), %rdi
movq %r13, %rsi
callq 0x11f18
jmp 0xfd69
shlq $0x1c, %r13
movabsq $-0x200000000, %rax     # imm = 0xFFFFFFFE00000000
addq %rax, %r13
movq 0x58(%rbx), %rax
sarq $0x1c, %r13
movupd (%rax,%r13), %xmm0
movapd %xmm0, (%rsp)
movq 0x60(%rbx), %rsi
cmpq 0x68(%rbx), %rsi
movq 0x20(%rsp), %rbp
je 0xf7e8
addq %r13, %rax
movupd (%rax), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, 0x60(%rbx)
movq %rsp, %r13
jmp 0xf7f8
movq 0x28(%rsp), %rdi
movq %rsp, %r13
movq %r13, %rdx
callq 0x13550
xorpd %xmm3, %xmm3
movdqa 0x487c(%rip), %xmm4     # 0x14080
movl 0x44(%r12), %eax
cmpl $0x1, %eax
je 0xf84f
testl %eax, %eax
jne 0xf932
movl %r15d, (%rsp)
movq 0x30(%rsp), %r14
testl %r14d, %r14d
jle 0xf842
xorl %r15d, %r15d
movl 0x40(%r12), %ecx
movq %rbx, %rdi
movl %r15d, %esi
movq %r13, %rdx
callq 0x100b6
incl %r15d
cmpl %r15d, %r14d
jne 0xf827
movq %rbp, %rdi
movq 0x10(%rsp), %rsi
jmp 0xf923
movl %r15d, (%rsp)
movq 0x30(%rsp), %rbp
testl %ebp, %ebp
jle 0xf87d
movq %r13, %r14
xorl %r13d, %r13d
movl 0x40(%r12), %ecx
movq %rbx, %rdi
movl %r13d, %esi
movq %r14, %rdx
callq 0x100b6
incl %r13d
cmpl %r13d, %ebp
jne 0xf862
movq 0x20(%rsp), %rbp
movq %rbp, %rdi
movq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0x11f18
movq 0x40(%rbx), %rax
cmpq %rax, 0x48(%rbx)
je 0xf8a0
movq %rax, 0x48(%rbx)
movslq %r15d, %rcx
shlq $0x4, %rcx
movq 0x28(%rsp), %rax
movq (%rax), %rax
movupd (%rax,%rcx), %xmm0
cmpl $0x2, 0x30(%rsp)
movq %rsp, %r13
movapd 0x47bc(%rip), %xmm2     # 0x14080
jl 0xf8ee
movl %r15d, %edx
leaq 0x1(%rdx), %rcx
shlq $0x4, %rdx
addq %rax, %rdx
movupd -0x10(%rdx), %xmm1
xorpd %xmm2, %xmm1
movupd %xmm1, (%rdx)
addq $-0x10, %rdx
decq %rcx
cmpq $0x1, %rcx
ja 0xf8d4
xorpd %xmm2, %xmm0
movupd %xmm0, (%rax)
movl $0x0, (%rsp)
cmpl $0x0, 0x30(%rsp)
jle 0xf91d
movl 0x40(%r12), %ecx
movq %rbx, %rdi
movl %r15d, %esi
movq %r13, %rdx
callq 0x100b6
addl $-0x1, %r15d
jb 0xf904
movq %rbp, %rdi
movq %r14, %rsi
callq 0x11f18
movq 0x50(%rsp), %r15
jmp 0xfd64
movl $0x0, 0x1c(%rsp)
cmpl $0x3, 0x30(%rsp)
jl 0xf98d
movl $0x2, %r14d
subl 0x30(%rsp), %r14d
movl $0x1, %r13d
movq %r12, %rbp
leaq 0x1c(%rsp), %r12
movl 0x40(%rbp), %ecx
movq %rbx, %rdi
movl %r13d, %esi
movq %r12, %rdx
callq 0x100b6
leal (%r14,%r13), %eax
incl %eax
movl %r13d, %ecx
incl %ecx
movl %ecx, %r13d
cmpl $0x1, %eax
jne 0xf95a
movl 0x44(%rbp), %eax
xorpd %xmm3, %xmm3
movdqa 0x46f3(%rip), %xmm4     # 0x14080
movapd %xmm3, (%rsp)
movslq %r15d, %r13
cmpl $0x2, %eax
jne 0xfa3d
shlq $0x4, %r13
movq 0x28(%rbx), %rax
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%rax,%r13), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq (%rax,%r13), %xmm1
movq 0x58(%rbx), %rax
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movupd (%rax,%r13), %xmm0
mulpd 0x60(%rsp), %xmm0
addpd %xmm1, %xmm0
movapd %xmm0, %xmm1
cmpltpd %xmm3, %xmm1
movapd %xmm1, %xmm2
andnpd 0x466a(%rip), %xmm2     # 0x14050
andpd 0x5d12(%rip), %xmm1     # 0x15700
orpd %xmm2, %xmm1
addpd %xmm0, %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
movq 0x30(%rsp), %r12
je 0xfa8f
movdqa (%rsp), %xmm0
movdqu %xmm0, (%rsi)
movq 0x48(%rbx), %rsi
addq $0x10, %rsi
movq %rsi, 0x48(%rbx)
jmp 0xfaac
movq 0x30(%rsp), %r12
leal -0x2(%r12), %edx
movl %edx, 0x1c(%rsp)
movq $0x0, 0x78(%rbx)
movq 0x58(%rbx), %rcx
shlq $0x4, %r13
movdqu (%rcx,%r13), %xmm0
pxor %xmm4, %xmm0
movdqu %xmm0, (%rcx,%r13)
movq %rbx, %rdi
movl %r15d, %esi
cmpl $0x3, %eax
jne 0xfa7d
callq 0x10354
jmp 0xfa82
callq 0x1054e
movq 0x10(%rsp), %r14
movq %rsp, %r13
jmp 0xfb52
movq 0x10(%rsp), %rdi
movq %rsp, %rdx
callq 0x12168
movdqa 0x45dc(%rip), %xmm4     # 0x14080
xorpd %xmm3, %xmm3
movq 0x48(%rbx), %rsi
movq 0x28(%rbx), %rax
movq 0x58(%rbx), %rcx
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%rax,%r13), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq (%rax,%r13), %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movupd (%rcx,%r13), %xmm0
mulpd 0x60(%rsp), %xmm0
subpd %xmm0, %xmm1
movapd %xmm1, %xmm0
cmpltpd %xmm3, %xmm0
movapd %xmm0, %xmm2
andnpd 0x4560(%rip), %xmm2     # 0x14050
andpd 0x5c08(%rip), %xmm0     # 0x15700
orpd %xmm2, %xmm0
addpd %xmm1, %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)
cmpq 0x50(%rbx), %rsi
je 0xfb3f
movdqa (%rsp), %xmm0
movdqu %xmm0, (%rsi)
addq $0x10, 0x48(%rbx)
movq 0x10(%rsp), %r14
movq %rsp, %r13
jmp 0xfb5a
movq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rsp, %r13
movq %r13, %rdx
callq 0x12168
movdqa 0x4526(%rip), %xmm4     # 0x14080
movq 0x28(%rsp), %rax
movq (%rax), %rax
cmpl $0x2, %r12d
jl 0xfb90
movl %r15d, %edx
leaq 0x1(%rdx), %rcx
shlq $0x4, %rdx
addq %rax, %rdx
movdqu -0x10(%rdx), %xmm0
pxor %xmm4, %xmm0
movdqu %xmm0, (%rdx)
addq $-0x10, %rdx
decq %rcx
cmpq $0x1, %rcx
ja 0xfb76
movdqu 0x10(%rax), %xmm0
pxor %xmm4, %xmm0
movdqu %xmm0, (%rax)
movl %r15d, 0x1c(%rsp)
cmpl $0x3, %r12d
leaq 0x1c(%rsp), %r12
movq 0x40(%rsp), %rbp
jl 0xfbcc
decl %r15d
movl 0x40(%rbp), %ecx
movq %rbx, %rdi
movl %r15d, %esi
movq %r12, %rdx
callq 0x100b6
cmpl $0x1, %r15d
ja 0xfbb2
movl 0x44(%rbp), %eax
cmpl $0x2, %eax
jne 0xfc78
movq 0x28(%rbx), %rax
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%rax), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq (%rax), %xmm1
movq 0x58(%rbx), %rax
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movupd (%rax), %xmm0
mulpd 0x60(%rsp), %xmm0
subpd %xmm0, %xmm1
movapd %xmm1, %xmm0
xorpd %xmm3, %xmm3
cmpltpd %xmm3, %xmm0
movapd %xmm0, %xmm2
andnpd 0x4434(%rip), %xmm2     # 0x14050
andpd 0x5adc(%rip), %xmm0     # 0x15700
orpd %xmm2, %xmm0
addpd %xmm1, %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
movq 0x50(%rsp), %r15
movq 0x20(%rsp), %r12
je 0xfcb4
movdqa (%rsp), %xmm0
movdqu %xmm0, (%rsi)
movq 0x48(%rbx), %rsi
addq $0x10, %rsi
movq %rsi, 0x48(%rbx)
jmp 0xfcc7
movq $0x0, 0x78(%rbx)
cmpl $0x3, %eax
movq 0x50(%rsp), %r15
movq 0x20(%rsp), %r12
movq %rbx, %rdi
jne 0xfca3
xorl %esi, %esi
movl $0x1, %edx
callq 0x10354
jmp 0xfd59
xorl %esi, %esi
movl $0x1, %edx
callq 0x1054e
jmp 0xfd59
movq %r14, %rdi
movq %r13, %rdx
callq 0x12168
xorpd %xmm3, %xmm3
movq 0x48(%rbx), %rsi
movq 0x28(%rbx), %rax
movq 0x58(%rbx), %rcx
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%rax), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq (%rax), %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movupd (%rcx), %xmm0
mulpd 0x60(%rsp), %xmm0
addpd %xmm1, %xmm0
movapd %xmm0, %xmm1
cmpltpd %xmm3, %xmm1
movapd %xmm1, %xmm2
andnpd 0x4349(%rip), %xmm2     # 0x14050
andpd 0x59f1(%rip), %xmm1     # 0x15700
orpd %xmm2, %xmm1
addpd %xmm0, %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)
cmpq 0x50(%rbx), %rsi
je 0xfd4e
movdqa (%rsp), %xmm0
movdqu %xmm0, (%rsi)
addq $0x10, 0x48(%rbx)
jmp 0xfd59
movq %r14, %rdi
movq %r13, %rdx
callq 0x12168
movq %r12, %rdi
movq %r14, %rsi
callq 0x11f18
movq 0x58(%rsp), %r12
incq %r12
movq 0xc8(%rbx), %rax
movq 0xd0(%rbx), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
movslq %ecx, %rcx
cmpq %rcx, %r12
jl 0xf3d1
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop