// File: 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
movq %rsp, %rbp
subq $0x2c0, %rsp            # imm = 0x2C0
movq %rdi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x1d8(%rbp)
addq $0x10, %rdi
callq 0x21ac0
movq -0x1d8(%rbp), %rax
movsd -0x10(%rbp), %xmm0
movsd %xmm0, 0x70(%rax)
movsd -0x10(%rbp), %xmm0
movsd 0xfffa(%rip), %xmm1     # 0x2c6b0
ucomisd %xmm1, %xmm0
jbe 0x1c784
movsd 0xfff0(%rip), %xmm0     # 0x2c6b8
ucomisd -0x10(%rbp), %xmm0
jbe 0x1c784
movq -0x1d8(%rbp), %rdi
movq %rdi, %rax
addq $0x10, %rax
movq %rax, -0x1e0(%rbp)
addq $0xb0, %rdi
callq 0x10c70
movq -0x1e0(%rbp), %rdi
movslq %eax, %rsi
callq 0x21400
movl $0x0, -0x14(%rbp)
movq -0x1d8(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, -0x1e4(%rbp)
addq $0xb0, %rdi
callq 0x10c70
movl %eax, %ecx
movl -0x1e4(%rbp), %eax
cmpl %ecx, %eax
jge 0x1c77f
movq -0x1d8(%rbp), %rdi
addq $0xb0, %rdi
addq $0x18, %rdi
movslq -0x14(%rbp), %rsi
callq 0x20200
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x44(%rax)
jne 0x1c772
movq -0x1d8(%rbp), %rdi
addq $0x10, %rdi
movq -0x20(%rbp), %rsi
callq 0x21670
jmp 0x1c774
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1c70a
jmp 0x1d9fd
movq -0x1d8(%rbp), %rax
movsd (%rax), %xmm0
movsd 0xe8a9(%rip), %xmm1     # 0x2b040
ucomisd %xmm1, %xmm0
jbe 0x1c7c2
movq -0x1d8(%rbp), %rax
movsd (%rax), %xmm1
mulsd (%rax), %xmm1
movsd 0xe88c(%rip), %xmm0     # 0x2b040
divsd %xmm1, %xmm0
movsd %xmm0, 0x90(%rax)
jmp 0x1c7d9
movq -0x1d8(%rbp), %rax
movsd 0xf7c7(%rip), %xmm0     # 0x2bf98
movsd %xmm0, 0x90(%rax)
movq -0x1d8(%rbp), %rax
xorps %xmm0, %xmm0
ucomisd 0x8(%rax), %xmm0
jb 0x1c7f9
movsd 0xfece(%rip), %xmm0     # 0x2c6c0
movsd %xmm0, -0x28(%rbp)
jmp 0x1c85d
movq -0x1d8(%rbp), %rax
movsd 0x8(%rax), %xmm0
movsd -0x10(%rbp), %xmm1
movaps 0xf69f(%rip), %xmm2     # 0x2beb0
pand %xmm2, %xmm1
movsd 0xfea3(%rip), %xmm2     # 0x2c6c0
mulsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x1c84a
movsd -0x10(%rbp), %xmm0
movaps 0xf67d(%rip), %xmm1     # 0x2beb0
pand %xmm1, %xmm0
movsd 0xfe81(%rip), %xmm1     # 0x2c6c0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x1c85b
movq -0x1d8(%rbp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x1c85d
movsd -0x28(%rbp), %xmm1
movsd -0x10(%rbp), %xmm0
movaps 0xf642(%rip), %xmm2     # 0x2beb0
pand %xmm2, %xmm0
divsd %xmm0, %xmm1
movsd 0xe7b2(%rip), %xmm0     # 0x2b030
subsd %xmm1, %xmm0
callq 0x3240
movaps %xmm0, %xmm1
movsd 0xe7b6(%rip), %xmm0     # 0x2b048
divsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x30(%rbp), %xmm0
movsd -0x10(%rbp), %xmm1
movaps 0xf604(%rip), %xmm2     # 0x2beb0
pand %xmm2, %xmm1
movsd 0xe790(%rip), %xmm2     # 0x2b048
mulsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x1c8e3
movsd -0x10(%rbp), %xmm0
movaps 0xf5e2(%rip), %xmm1     # 0x2beb0
pand %xmm1, %xmm0
movsd 0xe76e(%rip), %xmm1     # 0x2b048
mulsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd 0xe77d(%rip), %xmm0     # 0x2b068
divsd -0x30(%rbp), %xmm0
callq 0x30a0
movq -0x1d8(%rbp), %rax
movsd %xmm0, 0x80(%rax)
movsd 0xe75c(%rip), %xmm0     # 0x2b068
divsd -0x30(%rbp), %xmm0
callq 0x3480
movq -0x1d8(%rbp), %rax
movsd %xmm0, 0x88(%rax)
movsd -0x30(%rbp), %xmm0
movsd 0xe736(%rip), %xmm1     # 0x2b068
divsd %xmm1, %xmm0
movsd %xmm0, 0x98(%rax)
xorps %xmm0, %xmm0
ucomisd -0x10(%rbp), %xmm0
jbe 0x1c976
movq -0x1d8(%rbp), %rax
movsd 0x80(%rax), %xmm0
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
movsd %xmm0, 0x80(%rax)
movq -0x1d8(%rbp), %rdi
movq %rdi, %rax
addq $0x10, %rax
movq %rax, -0x1f0(%rbp)
addq $0xb0, %rdi
callq 0x10c70
movq -0x1f0(%rbp), %rdi
shll %eax
movslq %eax, %rsi
callq 0x21400
movl $0x0, -0x34(%rbp)
movq -0x1d8(%rbp), %rdi
movl -0x34(%rbp), %eax
movl %eax, -0x1f4(%rbp)
addq $0xb0, %rdi
callq 0x10c70
movl %eax, %ecx
movl -0x1f4(%rbp), %eax
cmpl %ecx, %eax
jge 0x1d9fd
movq -0x1d8(%rbp), %rdi
addq $0xb0, %rdi
addq $0x18, %rdi
movslq -0x34(%rbp), %rsi
callq 0x20200
movq -0x1d8(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rsi
addq $0x28, %rdi
callq 0xcc40
movq -0x1d8(%rbp), %rdi
addq $0x28, %rdi
callq 0xd900
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
je 0x1ca44
xorps %xmm0, %xmm0
ucomisd -0x10(%rbp), %xmm0
jb 0x1ca49
cmpl $0x3, -0x44(%rbp)
jl 0x1ca44
movq -0x40(%rbp), %rax
cmpl $0x0, 0x44(%rax)
je 0x1ca49
jmp 0x1d9ef
movq -0x1d8(%rbp), %rdi
addq $0x40, %rdi
callq 0x21c30
cmpl $0x1, -0x44(%rbp)
jne 0x1cd19
movq -0x40(%rbp), %rax
cmpl $0x1, 0x40(%rax)
jne 0x1cbc8
movsd 0xe5b7(%rip), %xmm0     # 0x2b030
movsd %xmm0, -0x50(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
movq $0x1, -0x60(%rbp)
cvtsi2sdq -0x60(%rbp), %xmm1
movsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x1cbc3
movq -0x1d8(%rbp), %rdi
movq %rdi, %rax
addq $0x40, %rax
movq %rax, -0x200(%rbp)
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21aa0
cvtsi2sdq (%rax), %xmm1
movsd -0x50(%rbp), %xmm0
movsd -0x10(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0x1d8(%rbp), %rdi
movq %rax, -0x208(%rbp)
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21aa0
cvtsi2sdq 0x8(%rax), %xmm1
movsd -0x58(%rbp), %xmm0
movsd -0x10(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0x208(%rbp), %rsi
movq %rax, %rdx
leaq -0x70(%rbp), %rdi
callq 0xcae0
movq -0x200(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0xcab0
movq -0x1d8(%rbp), %rax
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x50(%rbp), %xmm0
movsd 0x88(%rax), %xmm2
movsd 0x80(%rax), %xmm1
mulsd -0x58(%rbp), %xmm1
movq %xmm1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x78(%rbp), %xmm0
movsd 0x80(%rax), %xmm2
movsd -0x58(%rbp), %xmm1
mulsd 0x88(%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x1ca8e
jmp 0x1ccfd
movsd 0xe438(%rip), %xmm0     # 0x2b008
movsd %xmm0, -0x80(%rbp)
movsd 0xe42b(%rip), %xmm0     # 0x2b008
movsd %xmm0, -0x88(%rbp)
movl $0x0, -0x8c(%rbp)
cmpl $0x4, -0x8c(%rbp)
jge 0x1ccfb
movq -0x1d8(%rbp), %rdi
movq %rdi, %rax
addq $0x40, %rax
movq %rax, -0x210(%rbp)
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21aa0
cvtsi2sdq (%rax), %xmm1
movsd -0x80(%rbp), %xmm0
movsd -0x10(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0x1d8(%rbp), %rdi
movq %rax, -0x218(%rbp)
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21aa0
cvtsi2sdq 0x8(%rax), %xmm1
movsd -0x88(%rbp), %xmm0
movsd -0x10(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0x218(%rbp), %rsi
movq %rax, %rdx
leaq -0xa0(%rbp), %rdi
callq 0xcae0
movq -0x210(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0xcab0
xorps %xmm0, %xmm0
ucomisd -0x80(%rbp), %xmm0
jbe 0x1ccb7
movsd 0xe380(%rip), %xmm0     # 0x2b030
movsd %xmm0, -0x80(%rbp)
jmp 0x1cce5
xorps %xmm0, %xmm0
ucomisd -0x88(%rbp), %xmm0
jbe 0x1ccd6
movsd 0xe364(%rip), %xmm0     # 0x2b030
movsd %xmm0, -0x88(%rbp)
jmp 0x1cce3
movsd 0xe32a(%rip), %xmm0     # 0x2b008
movsd %xmm0, -0x80(%rbp)
jmp 0x1cce5
jmp 0x1cce7
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x1cbef
jmp 0x1ccfd
movq -0x1d8(%rbp), %rsi
movq %rsi, %rdi
addq $0x10, %rdi
addq $0x40, %rsi
callq 0x21670
jmp 0x1d9ef
movq -0x1d8(%rbp), %rdi
addq $0x58, %rdi
callq 0x21c50
movq -0x1d8(%rbp), %rdi
addq $0x58, %rdi
movslq -0x44(%rbp), %rsi
callq 0x21c70
movl $0x0, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
movl -0x44(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x1cde9
movq -0x1d8(%rbp), %rdi
movq %rdi, %rax
addq $0x58, %rax
movq %rax, -0x220(%rbp)
addq $0x28, %rdi
movslq -0xa4(%rbp), %rsi
callq 0x21aa0
movq -0x1d8(%rbp), %rdi
movq %rax, -0x228(%rbp)
addq $0x28, %rdi
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x21aa0
movq -0x228(%rbp), %rdi
movq %rax, %rsi
callq 0x1b9d0
movq -0x220(%rbp), %rdi
movsd %xmm0, -0xb8(%rbp)
movsd %xmm1, -0xb0(%rbp)
leaq -0xb8(%rbp), %rsi
callq 0x21d70
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x1cd47
movq -0x40(%rbp), %rax
cmpl $0x1, 0x44(%rax)
je 0x1cdfd
movq -0x40(%rbp), %rax
cmpl $0x0, 0x44(%rax)
jne 0x1ce73
movq -0x1d8(%rbp), %rdi
movq %rdi, %rax
addq $0x58, %rax
movq %rax, -0x230(%rbp)
addq $0x28, %rdi
movl -0x44(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x21aa0
movq -0x1d8(%rbp), %rdi
movq %rax, -0x238(%rbp)
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21aa0
movq -0x238(%rbp), %rdi
movq %rax, %rsi
callq 0x1b9d0
movq -0x230(%rbp), %rdi
movsd %xmm0, -0xc8(%rbp)
movsd %xmm1, -0xc0(%rbp)
leaq -0xc8(%rbp), %rsi
callq 0x21d70
jmp 0x1cec2
movq -0x1d8(%rbp), %rdi
movq %rdi, %rax
addq $0x58, %rax
movq %rax, -0x240(%rbp)
addq $0x58, %rdi
movl -0x44(%rbp), %eax
subl $0x2, %eax
movslq %eax, %rsi
callq 0x21da0
movq -0x240(%rbp), %rdi
movq (%rax), %rcx
movq %rcx, -0xd8(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0xd0(%rbp)
leaq -0xd8(%rbp), %rsi
callq 0x21d70
movq -0x40(%rbp), %rax
cmpl $0x0, 0x44(%rax)
jne 0x1cf3a
movl -0x44(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xdc(%rbp)
movl $0x0, -0xe0(%rbp)
movl -0xe0(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x1cf1e
movq -0x1d8(%rbp), %rdi
movl -0xe0(%rbp), %esi
movq -0x40(%rbp), %rax
movl 0x40(%rax), %ecx
leaq -0xdc(%rbp), %rdx
callq 0x1de50
movl -0xe0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe0(%rbp)
jmp 0x1cee2
movq -0x1d8(%rbp), %rsi
movq %rsi, %rdi
addq $0x10, %rdi
addq $0x40, %rsi
callq 0x21670
jmp 0x1d9ed
movq -0x40(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x1d1b2
movl -0x44(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xe4(%rbp)
movl $0x0, -0xe8(%rbp)
movl -0xe8(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x1cf9a
movq -0x1d8(%rbp), %rdi
movl -0xe8(%rbp), %esi
movq -0x40(%rbp), %rax
movl 0x40(%rax), %ecx
leaq -0xe4(%rbp), %rdx
callq 0x1de50
movl -0xe8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe8(%rbp)
jmp 0x1cf5e
movq -0x1d8(%rbp), %rsi
movq %rsi, %rdi
addq $0x10, %rdi
addq $0x40, %rsi
callq 0x21670
movq -0x1d8(%rbp), %rdi
addq $0x40, %rdi
callq 0x21c30
movq -0x1d8(%rbp), %rdi
addq $0x58, %rdi
movl -0x44(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x21da0
movq (%rax), %rcx
movq %rcx, -0xf8(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0xf0(%rbp)
movl -0x44(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xfc(%rbp)
cmpl $0x0, -0xfc(%rbp)
jle 0x1d0d3
movq -0x1d8(%rbp), %rdi
addq $0x58, %rdi
movl -0xfc(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x21da0
movq -0x1d8(%rbp), %rdi
movsd (%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x248(%rbp)
addq $0x58, %rdi
movl -0xfc(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x21da0
movsd -0x248(%rbp), %xmm0
movsd 0x8(%rax), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
leaq -0x110(%rbp), %rdi
callq 0x219d0
movq -0x1d8(%rbp), %rdi
addq $0x58, %rdi
movslq -0xfc(%rbp), %rsi
callq 0x21da0
movq -0x110(%rbp), %rcx
movq %rcx, (%rax)
movq -0x108(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl -0xfc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xfc(%rbp)
jmp 0x1cffb
movsd -0xf8(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd -0xf0(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
leaq -0x120(%rbp), %rdi
callq 0x219d0
movq -0x1d8(%rbp), %rdi
addq $0x58, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21da0
movq -0x120(%rbp), %rcx
movq %rcx, (%rax)
movq -0x118(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x0, -0xe4(%rbp)
movl -0x44(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x124(%rbp)
cmpl $0x0, -0x124(%rbp)
jl 0x1d196
movq -0x1d8(%rbp), %rdi
movl -0x124(%rbp), %esi
movq -0x40(%rbp), %rax
movl 0x40(%rax), %ecx
leaq -0xe4(%rbp), %rdx
callq 0x1de50
movl -0x124(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x124(%rbp)
jmp 0x1d15c
movq -0x1d8(%rbp), %rsi
movq %rsi, %rdi
addq $0x10, %rdi
addq $0x40, %rsi
callq 0x21670
jmp 0x1d9eb
movl $0x0, -0x128(%rbp)
movl $0x1, -0x12c(%rbp)
movl -0x12c(%rbp), %eax
movl -0x44(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x1d207
movq -0x1d8(%rbp), %rdi
movl -0x12c(%rbp), %esi
movq -0x40(%rbp), %rax
movl 0x40(%rax), %ecx
leaq -0x128(%rbp), %rdx
callq 0x1de50
movl -0x12c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x12c(%rbp)
jmp 0x1d1c6
leaq -0x140(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0xcae0
movq -0x40(%rbp), %rax
cmpl $0x2, 0x44(%rax)
jne 0x1d46f
movq -0x1d8(%rbp), %rdi
movl -0x44(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x144(%rbp)
addq $0x28, %rdi
movslq -0x144(%rbp), %rsi
callq 0x21aa0
movq -0x1d8(%rbp), %rdi
cvtsi2sdq (%rax), %xmm0
movsd %xmm0, -0x278(%rbp)
addq $0x58, %rdi
movslq -0x144(%rbp), %rsi
callq 0x21da0
movsd -0x278(%rbp), %xmm1
movsd (%rax), %xmm0
movsd -0x10(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0x1d8(%rbp), %rdi
movq %rax, -0x268(%rbp)
addq $0x28, %rdi
movslq -0x144(%rbp), %rsi
callq 0x21aa0
movq -0x1d8(%rbp), %rdi
cvtsi2sdq 0x8(%rax), %xmm0
movsd %xmm0, -0x270(%rbp)
addq $0x58, %rdi
movslq -0x144(%rbp), %rsi
callq 0x21da0
movsd -0x270(%rbp), %xmm1
movsd 0x8(%rax), %xmm0
movsd -0x10(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0x268(%rbp), %rsi
movq %rax, %rdx
leaq -0x158(%rbp), %rdi
callq 0xcae0
movq -0x1d8(%rbp), %rdi
movq -0x158(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x150(%rbp), %rax
movq %rax, -0x138(%rbp)
addq $0x40, %rdi
leaq -0x140(%rbp), %rsi
callq 0x21600
movq -0x1d8(%rbp), %rdi
addq $0x28, %rdi
movslq -0x144(%rbp), %rsi
callq 0x21aa0
movq -0x1d8(%rbp), %rdi
cvtsi2sdq (%rax), %xmm0
movsd %xmm0, -0x260(%rbp)
addq $0x58, %rdi
movslq -0x144(%rbp), %rsi
callq 0x21da0
movsd -0x260(%rbp), %xmm1
movsd (%rax), %xmm0
movsd -0x10(%rbp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0x1d8(%rbp), %rdi
movq %rax, -0x250(%rbp)
addq $0x28, %rdi
movslq -0x144(%rbp), %rsi
callq 0x21aa0
movq -0x1d8(%rbp), %rdi
cvtsi2sdq 0x8(%rax), %xmm0
movsd %xmm0, -0x258(%rbp)
addq $0x58, %rdi
movslq -0x144(%rbp), %rsi
callq 0x21da0
movsd -0x258(%rbp), %xmm1
movsd 0x8(%rax), %xmm0
movsd -0x10(%rbp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0x250(%rbp), %rsi
movq %rax, %rdx
leaq -0x168(%rbp), %rdi
callq 0xcae0
movq -0x1d8(%rbp), %rdi
movq -0x168(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x160(%rbp), %rax
movq %rax, -0x138(%rbp)
addq $0x40, %rdi
leaq -0x140(%rbp), %rsi
callq 0x21600
jmp 0x1d57a
movq -0x1d8(%rbp), %rdi
movl -0x44(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x16c(%rbp)
movl -0x44(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x128(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x78(%rdi)
addq $0x58, %rdi
movslq -0x16c(%rbp), %rsi
callq 0x21da0
movq -0x1d8(%rbp), %rdi
movsd (%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x280(%rbp)
addq $0x58, %rdi
movslq -0x16c(%rbp), %rsi
callq 0x21da0
movsd -0x280(%rbp), %xmm0
movsd 0x8(%rax), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
leaq -0x180(%rbp), %rdi
callq 0x219d0
movq -0x1d8(%rbp), %rdi
addq $0x58, %rdi
movslq -0x16c(%rbp), %rsi
callq 0x21da0
movq -0x180(%rbp), %rcx
movq %rcx, (%rax)
movq -0x178(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x40(%rbp), %rax
cmpl $0x3, 0x44(%rax)
jne 0x1d560
movq -0x1d8(%rbp), %rdi
movl -0x16c(%rbp), %esi
movl -0x128(%rbp), %edx
callq 0x1e2f0
jmp 0x1d578
movq -0x1d8(%rbp), %rdi
movl -0x16c(%rbp), %esi
movl -0x128(%rbp), %edx
callq 0x1e680
jmp 0x1d57a
movl -0x44(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x184(%rbp)
cmpl $0x0, -0x184(%rbp)
jle 0x1d65e
movq -0x1d8(%rbp), %rdi
addq $0x58, %rdi
movl -0x184(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x21da0
movq -0x1d8(%rbp), %rdi
movsd (%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x288(%rbp)
addq $0x58, %rdi
movl -0x184(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x21da0
movsd -0x288(%rbp), %xmm0
movsd 0x8(%rax), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
leaq -0x198(%rbp), %rdi
callq 0x219d0
movq -0x1d8(%rbp), %rdi
addq $0x58, %rdi
movslq -0x184(%rbp), %rsi
callq 0x21da0
movq -0x198(%rbp), %rcx
movq %rcx, (%rax)
movq -0x190(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl -0x184(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x184(%rbp)
jmp 0x1d586
movq -0x1d8(%rbp), %rdi
addq $0x58, %rdi
movl $0x1, %esi
callq 0x21da0
movq -0x1d8(%rbp), %rdi
movsd (%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x290(%rbp)
addq $0x58, %rdi
movl $0x1, %esi
callq 0x21da0
movsd -0x290(%rbp), %xmm0
movsd 0x8(%rax), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
leaq -0x1a8(%rbp), %rdi
callq 0x219d0
movq -0x1d8(%rbp), %rdi
addq $0x58, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21da0
movq -0x1a8(%rbp), %rcx
movq %rcx, (%rax)
movq -0x1a0(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl -0x44(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x128(%rbp)
movl -0x128(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x1ac(%rbp)
cmpl $0x0, -0x1ac(%rbp)
jle 0x1d759
movq -0x1d8(%rbp), %rdi
movl -0x1ac(%rbp), %esi
movq -0x40(%rbp), %rax
movl 0x40(%rax), %ecx
leaq -0x128(%rbp), %rdx
callq 0x1de50
movl -0x1ac(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1ac(%rbp)
jmp 0x1d71f
movq -0x40(%rbp), %rax
cmpl $0x2, 0x44(%rax)
jne 0x1d987
movq -0x1d8(%rbp), %rdi
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21aa0
movq -0x1d8(%rbp), %rdi
cvtsi2sdq (%rax), %xmm0
movsd %xmm0, -0x2c0(%rbp)
addq $0x58, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21da0
movsd -0x2c0(%rbp), %xmm1
movsd (%rax), %xmm0
movsd -0x10(%rbp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0x1d8(%rbp), %rdi
movq %rax, -0x2b0(%rbp)
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21aa0
movq -0x1d8(%rbp), %rdi
cvtsi2sdq 0x8(%rax), %xmm0
movsd %xmm0, -0x2b8(%rbp)
addq $0x58, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21da0
movsd -0x2b8(%rbp), %xmm1
movsd 0x8(%rax), %xmm0
movsd -0x10(%rbp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0x2b0(%rbp), %rsi
movq %rax, %rdx
leaq -0x1c0(%rbp), %rdi
callq 0xcae0
movq -0x1d8(%rbp), %rdi
movq -0x1c0(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x1b8(%rbp), %rax
movq %rax, -0x138(%rbp)
addq $0x40, %rdi
leaq -0x140(%rbp), %rsi
callq 0x21600
movq -0x1d8(%rbp), %rdi
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21aa0
movq -0x1d8(%rbp), %rdi
cvtsi2sdq (%rax), %xmm0
movsd %xmm0, -0x2a8(%rbp)
addq $0x58, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21da0
movsd -0x2a8(%rbp), %xmm1
movsd (%rax), %xmm0
movsd -0x10(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0x1d8(%rbp), %rdi
movq %rax, -0x298(%rbp)
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21aa0
movq -0x1d8(%rbp), %rdi
cvtsi2sdq 0x8(%rax), %xmm0
movsd %xmm0, -0x2a0(%rbp)
addq $0x58, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21da0
movsd -0x2a0(%rbp), %xmm1
movsd 0x8(%rax), %xmm0
movsd -0x10(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x20530
movq -0x298(%rbp), %rsi
movq %rax, %rdx
leaq -0x1d0(%rbp), %rdi
callq 0xcae0
movq -0x1d8(%rbp), %rdi
movq -0x1d0(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x1c8(%rbp), %rax
movq %rax, -0x138(%rbp)
addq $0x40, %rdi
leaq -0x140(%rbp), %rsi
callq 0x21600
jmp 0x1d9d4
movq -0x1d8(%rbp), %rax
movl $0x1, -0x128(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x78(%rax)
movq -0x40(%rbp), %rax
cmpl $0x3, 0x44(%rax)
jne 0x1d9bf
movq -0x1d8(%rbp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x1e2f0
jmp 0x1d9d2
movq -0x1d8(%rbp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x1e680
jmp 0x1d9d4
movq -0x1d8(%rbp), %rsi
movq %rsi, %rdi
addq $0x10, %rdi
addq $0x40, %rsi
callq 0x21670
jmp 0x1d9ed
jmp 0x1d9ef
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1c9af
addq $0x2c0, %rsp            # imm = 0x2C0
popq %rbp
retq
nopw %cs:(%rax,%rax)