// File: alan0201tw[P]RayTracer/include/tiny_obj_loader.h
// Function: tinyobj::exportGroupsToShape(tinyobj::shape_t*, tinyobj::PrimGroup const&, std::vector<tinyobj::tag_t, std::allocator<tinyobj::tag_t>> const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool, std::vector<float, std::allocator<float>> const&)
static bool exportGroupsToShape(shape_t *shape, const PrimGroup &prim_group,
                                const std::vector<tag_t> &tags,
                                const int material_id, const std::string &name,
                                bool triangulate,
                                const std::vector<real_t> &v) {
  if (prim_group.IsEmpty()) {
    return false;
  }

  shape->name = name;

  // polygon
  if (!prim_group.faceGroup.empty()) {
    // Flatten vertices and indices
    for (size_t i = 0; i < prim_group.faceGroup.size(); i++) {
      const face_t &face = prim_group.faceGroup[i];

      size_t npolys = face.vertex_indices.size();

      if (npolys < 3) {
        // Face must have 3+ vertices.
        continue;
      }

      vertex_index_t i0 = face.vertex_indices[0];
      vertex_index_t i1(-1);
      vertex_index_t i2 = face.vertex_indices[1];

      if (triangulate) {
        // find the two axes to work in
        size_t axes[2] = {1, 2};
        for (size_t k = 0; k < npolys; ++k) {
          i0 = face.vertex_indices[(k + 0) % npolys];
          i1 = face.vertex_indices[(k + 1) % npolys];
          i2 = face.vertex_indices[(k + 2) % npolys];
          size_t vi0 = size_t(i0.v_idx);
          size_t vi1 = size_t(i1.v_idx);
          size_t vi2 = size_t(i2.v_idx);

          if (((3 * vi0 + 2) >= v.size()) || ((3 * vi1 + 2) >= v.size()) ||
              ((3 * vi2 + 2) >= v.size())) {
            // Invalid triangle.
            // FIXME(syoyo): Is it ok to simply skip this invalid triangle?
            continue;
          }
          real_t v0x = v[vi0 * 3 + 0];
          real_t v0y = v[vi0 * 3 + 1];
          real_t v0z = v[vi0 * 3 + 2];
          real_t v1x = v[vi1 * 3 + 0];
          real_t v1y = v[vi1 * 3 + 1];
          real_t v1z = v[vi1 * 3 + 2];
          real_t v2x = v[vi2 * 3 + 0];
          real_t v2y = v[vi2 * 3 + 1];
          real_t v2z = v[vi2 * 3 + 2];
          real_t e0x = v1x - v0x;
          real_t e0y = v1y - v0y;
          real_t e0z = v1z - v0z;
          real_t e1x = v2x - v1x;
          real_t e1y = v2y - v1y;
          real_t e1z = v2z - v1z;
          real_t cx = std::fabs(e0y * e1z - e0z * e1y);
          real_t cy = std::fabs(e0z * e1x - e0x * e1z);
          real_t cz = std::fabs(e0x * e1y - e0y * e1x);
          const real_t epsilon = std::numeric_limits<real_t>::epsilon();
          if (cx > epsilon || cy > epsilon || cz > epsilon) {
            // found a corner
            if (cx > cy && cx > cz) {
            } else {
              axes[0] = 0;
              if (cz > cx && cz > cy) axes[1] = 1;
            }
            break;
          }
        }

        real_t area = 0;
        for (size_t k = 0; k < npolys; ++k) {
          i0 = face.vertex_indices[(k + 0) % npolys];
          i1 = face.vertex_indices[(k + 1) % npolys];
          size_t vi0 = size_t(i0.v_idx);
          size_t vi1 = size_t(i1.v_idx);
          if (((vi0 * 3 + axes[0]) >= v.size()) ||
              ((vi0 * 3 + axes[1]) >= v.size()) ||
              ((vi1 * 3 + axes[0]) >= v.size()) ||
              ((vi1 * 3 + axes[1]) >= v.size())) {
            // Invalid index.
            continue;
          }
          real_t v0x = v[vi0 * 3 + axes[0]];
          real_t v0y = v[vi0 * 3 + axes[1]];
          real_t v1x = v[vi1 * 3 + axes[0]];
          real_t v1y = v[vi1 * 3 + axes[1]];
          area += (v0x * v1y - v0y * v1x) * static_cast<real_t>(0.5);
        }

        face_t remainingFace = face;  // copy
        size_t guess_vert = 0;
        vertex_index_t ind[3];
        real_t vx[3];
        real_t vy[3];

        // How many iterations can we do without decreasing the remaining
        // vertices.
        size_t remainingIterations = face.vertex_indices.size();
        size_t previousRemainingVertices = remainingFace.vertex_indices.size();

        while (remainingFace.vertex_indices.size() > 3 &&
               remainingIterations > 0) {
          npolys = remainingFace.vertex_indices.size();
          if (guess_vert >= npolys) {
            guess_vert -= npolys;
          }

          if (previousRemainingVertices != npolys) {
            // The number of remaining vertices decreased. Reset counters.
            previousRemainingVertices = npolys;
            remainingIterations = npolys;
          } else {
            // We didn't consume a vertex on previous iteration, reduce the
            // available iterations.
            remainingIterations--;
          }

          for (size_t k = 0; k < 3; k++) {
            ind[k] = remainingFace.vertex_indices[(guess_vert + k) % npolys];
            size_t vi = size_t(ind[k].v_idx);
            if (((vi * 3 + axes[0]) >= v.size()) ||
                ((vi * 3 + axes[1]) >= v.size())) {
              // ???
              vx[k] = static_cast<real_t>(0.0);
              vy[k] = static_cast<real_t>(0.0);
            } else {
              vx[k] = v[vi * 3 + axes[0]];
              vy[k] = v[vi * 3 + axes[1]];
            }
          }
          real_t e0x = vx[1] - vx[0];
          real_t e0y = vy[1] - vy[0];
          real_t e1x = vx[2] - vx[1];
          real_t e1y = vy[2] - vy[1];
          real_t cross = e0x * e1y - e0y * e1x;
          // if an internal angle
          if (cross * area < static_cast<real_t>(0.0)) {
            guess_vert += 1;
            continue;
          }

          // check all other verts in case they are inside this triangle
          bool overlap = false;
          for (size_t otherVert = 3; otherVert < npolys; ++otherVert) {
            size_t idx = (guess_vert + otherVert) % npolys;

            if (idx >= remainingFace.vertex_indices.size()) {
              // ???
              continue;
            }

            size_t ovi = size_t(remainingFace.vertex_indices[idx].v_idx);

            if (((ovi * 3 + axes[0]) >= v.size()) ||
                ((ovi * 3 + axes[1]) >= v.size())) {
              // ???
              continue;
            }
            real_t tx = v[ovi * 3 + axes[0]];
            real_t ty = v[ovi * 3 + axes[1]];
            if (pnpoly(3, vx, vy, tx, ty)) {
              overlap = true;
              break;
            }
          }

          if (overlap) {
            guess_vert += 1;
            continue;
          }

          // this triangle is an ear
          {
            index_t idx0, idx1, idx2;
            idx0.vertex_index = ind[0].v_idx;
            idx0.normal_index = ind[0].vn_idx;
            idx0.texcoord_index = ind[0].vt_idx;
            idx1.vertex_index = ind[1].v_idx;
            idx1.normal_index = ind[1].vn_idx;
            idx1.texcoord_index = ind[1].vt_idx;
            idx2.vertex_index = ind[2].v_idx;
            idx2.normal_index = ind[2].vn_idx;
            idx2.texcoord_index = ind[2].vt_idx;

            shape->mesh.indices.push_back(idx0);
            shape->mesh.indices.push_back(idx1);
            shape->mesh.indices.push_back(idx2);

            shape->mesh.num_face_vertices.push_back(3);
            shape->mesh.material_ids.push_back(material_id);
            shape->mesh.smoothing_group_ids.push_back(face.smoothing_group_id);
          }

          // remove v1 from the list
          size_t removed_vert_index = (guess_vert + 1) % npolys;
          while (removed_vert_index + 1 < npolys) {
            remainingFace.vertex_indices[removed_vert_index] =
                remainingFace.vertex_indices[removed_vert_index + 1];
            removed_vert_index += 1;
          }
          remainingFace.vertex_indices.pop_back();
        }

        if (remainingFace.vertex_indices.size() == 3) {
          i0 = remainingFace.vertex_indices[0];
          i1 = remainingFace.vertex_indices[1];
          i2 = remainingFace.vertex_indices[2];
          {
            index_t idx0, idx1, idx2;
            idx0.vertex_index = i0.v_idx;
            idx0.normal_index = i0.vn_idx;
            idx0.texcoord_index = i0.vt_idx;
            idx1.vertex_index = i1.v_idx;
            idx1.normal_index = i1.vn_idx;
            idx1.texcoord_index = i1.vt_idx;
            idx2.vertex_index = i2.v_idx;
            idx2.normal_index = i2.vn_idx;
            idx2.texcoord_index = i2.vt_idx;

            shape->mesh.indices.push_back(idx0);
            shape->mesh.indices.push_back(idx1);
            shape->mesh.indices.push_back(idx2);

            shape->mesh.num_face_vertices.push_back(3);
            shape->mesh.material_ids.push_back(material_id);
            shape->mesh.smoothing_group_ids.push_back(face.smoothing_group_id);
          }
        }
      } else {
        for (size_t k = 0; k < npolys; k++) {
          index_t idx;
          idx.vertex_index = face.vertex_indices[k].v_idx;
          idx.normal_index = face.vertex_indices[k].vn_idx;
          idx.texcoord_index = face.vertex_indices[k].vt_idx;
          shape->mesh.indices.push_back(idx);
        }

        shape->mesh.num_face_vertices.push_back(
            static_cast<unsigned char>(npolys));
        shape->mesh.material_ids.push_back(material_id);  // per face
        shape->mesh.smoothing_group_ids.push_back(
            face.smoothing_group_id);  // per face
      }
    }

    shape->mesh.tags = tags;
  }

  // line
  if (!prim_group.lineGroup.empty()) {
    // Flatten indices
    for (size_t i = 0; i < prim_group.lineGroup.size(); i++) {
      for (size_t j = 0; j < prim_group.lineGroup[i].vertex_indices.size();
           j++) {
        const vertex_index_t &vi = prim_group.lineGroup[i].vertex_indices[j];

        index_t idx;
        idx.vertex_index = vi.v_idx;
        idx.normal_index = vi.vn_idx;
        idx.texcoord_index = vi.vt_idx;

        shape->lines.indices.push_back(idx);
      }

      shape->lines.num_line_vertices.push_back(
          int(prim_group.lineGroup[i].vertex_indices.size()));
    }
  }

  // points
  if (!prim_group.pointsGroup.empty()) {
    // Flatten & convert indices
    for (size_t i = 0; i < prim_group.pointsGroup.size(); i++) {
      for (size_t j = 0; j < prim_group.pointsGroup[i].vertex_indices.size();
           j++) {
        const vertex_index_t &vi = prim_group.pointsGroup[i].vertex_indices[j];

        index_t idx;
        idx.vertex_index = vi.v_idx;
        idx.normal_index = vi.vn_idx;
        idx.texcoord_index = vi.vt_idx;

        shape->points.indices.push_back(idx);
      }
    }
  }

  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x390, %rsp            # imm = 0x390
movb %r9b, %al
movq 0x10(%rbp), %r9
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
andb $0x1, %al
movb %al, -0x31(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2f820
testb $0x1, %al
jne 0x21479
jmp 0x21482
movb $0x0, -0x1(%rbp)
jmp 0x2288d
movq -0x30(%rbp), %rsi
movq -0x10(%rbp), %rdi
callq 0x7050
movq -0x18(%rbp), %rdi
callq 0x2f880
testb $0x1, %al
jne 0x225d1
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x2c8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2f8c0
movq %rax, %rcx
movq -0x2c8(%rbp), %rax
cmpq %rcx, %rax
jae 0x225bc
movq -0x18(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x2f8e0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
addq $0x8, %rdi
callq 0x2f900
movq %rax, -0x50(%rbp)
cmpq $0x3, -0x50(%rbp)
jae 0x214fd
jmp 0x225ab
movq -0x48(%rbp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2f930
movq (%rax), %rcx
movq %rcx, -0x60(%rbp)
movl 0x8(%rax), %eax
movl %eax, -0x58(%rbp)
leaq -0x70(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x2f5f0
movq -0x48(%rbp), %rdi
addq $0x8, %rdi
movl $0x1, %esi
callq 0x2f930
movq (%rax), %rcx
movq %rcx, -0x80(%rbp)
movl 0x8(%rax), %eax
movl %eax, -0x78(%rbp)
testb $0x1, -0x31(%rbp)
je 0x224c0
movq 0x5d037(%rip), %rax     # 0x7e590
movq %rax, -0x90(%rbp)
movq 0x5d031(%rip), %rax     # 0x7e598
movq %rax, -0x88(%rbp)
movq $0x0, -0x98(%rbp)
movq -0x98(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0x21a05
movq -0x48(%rbp), %rdi
addq $0x8, %rdi
movq -0x98(%rbp), %rax
addq $0x0, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x50(%rbp)
movq %rdx, %rsi
callq 0x2f930
movq (%rax), %rcx
movq %rcx, -0x60(%rbp)
movl 0x8(%rax), %eax
movl %eax, -0x58(%rbp)
movq -0x48(%rbp), %rdi
addq $0x8, %rdi
movq -0x98(%rbp), %rax
addq $0x1, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x50(%rbp)
movq %rdx, %rsi
callq 0x2f930
movq (%rax), %rcx
movq %rcx, -0x70(%rbp)
movl 0x8(%rax), %eax
movl %eax, -0x68(%rbp)
movq -0x48(%rbp), %rdi
addq $0x8, %rdi
movq -0x98(%rbp), %rax
addq $0x2, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x50(%rbp)
movq %rdx, %rsi
callq 0x2f930
movq (%rax), %rcx
movq %rcx, -0x80(%rbp)
movl 0x8(%rax), %eax
movl %eax, -0x78(%rbp)
movslq -0x60(%rbp), %rax
movq %rax, -0xa0(%rbp)
movslq -0x70(%rbp), %rax
movq %rax, -0xa8(%rbp)
movslq -0x80(%rbp), %rax
movq %rax, -0xb0(%rbp)
imulq $0x3, -0xa0(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x2d0(%rbp)
movq 0x10(%rbp), %rdi
callq 0x2b960
movq %rax, %rcx
movq -0x2d0(%rbp), %rax
cmpq %rcx, %rax
jae 0x216bc
imulq $0x3, -0xa8(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x2d8(%rbp)
movq 0x10(%rbp), %rdi
callq 0x2b960
movq %rax, %rcx
movq -0x2d8(%rbp), %rax
cmpq %rcx, %rax
jae 0x216bc
imulq $0x3, -0xb0(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x2e0(%rbp)
movq 0x10(%rbp), %rdi
callq 0x2b960
movq %rax, %rcx
movq -0x2e0(%rbp), %rax
cmpq %rcx, %rax
jb 0x216c1
jmp 0x219ee
movq 0x10(%rbp), %rdi
imulq $0x3, -0xa0(%rbp), %rsi
addq $0x0, %rsi
callq 0x2f950
movss (%rax), %xmm0
movss %xmm0, -0xb4(%rbp)
movq 0x10(%rbp), %rdi
imulq $0x3, -0xa0(%rbp), %rsi
addq $0x1, %rsi
callq 0x2f950
movss (%rax), %xmm0
movss %xmm0, -0xb8(%rbp)
movq 0x10(%rbp), %rdi
imulq $0x3, -0xa0(%rbp), %rsi
addq $0x2, %rsi
callq 0x2f950
movss (%rax), %xmm0
movss %xmm0, -0xbc(%rbp)
movq 0x10(%rbp), %rdi
imulq $0x3, -0xa8(%rbp), %rsi
addq $0x0, %rsi
callq 0x2f950
movss (%rax), %xmm0
movss %xmm0, -0xc0(%rbp)
movq 0x10(%rbp), %rdi
imulq $0x3, -0xa8(%rbp), %rsi
addq $0x1, %rsi
callq 0x2f950
movss (%rax), %xmm0
movss %xmm0, -0xc4(%rbp)
movq 0x10(%rbp), %rdi
imulq $0x3, -0xa8(%rbp), %rsi
addq $0x2, %rsi
callq 0x2f950
movss (%rax), %xmm0
movss %xmm0, -0xc8(%rbp)
movq 0x10(%rbp), %rdi
imulq $0x3, -0xb0(%rbp), %rsi
addq $0x0, %rsi
callq 0x2f950
movss (%rax), %xmm0
movss %xmm0, -0xcc(%rbp)
movq 0x10(%rbp), %rdi
imulq $0x3, -0xb0(%rbp), %rsi
addq $0x1, %rsi
callq 0x2f950
movss (%rax), %xmm0
movss %xmm0, -0xd0(%rbp)
movq 0x10(%rbp), %rdi
imulq $0x3, -0xb0(%rbp), %rsi
addq $0x2, %rsi
callq 0x2f950
movss (%rax), %xmm0
movss %xmm0, -0xd4(%rbp)
movss -0xc0(%rbp), %xmm0
subss -0xb4(%rbp), %xmm0
movss %xmm0, -0xd8(%rbp)
movss -0xc4(%rbp), %xmm0
subss -0xb8(%rbp), %xmm0
movss %xmm0, -0xdc(%rbp)
movss -0xc8(%rbp), %xmm0
subss -0xbc(%rbp), %xmm0
movss %xmm0, -0xe0(%rbp)
movss -0xcc(%rbp), %xmm0
subss -0xc0(%rbp), %xmm0
movss %xmm0, -0xe4(%rbp)
movss -0xd0(%rbp), %xmm0
subss -0xc4(%rbp), %xmm0
movss %xmm0, -0xe8(%rbp)
movss -0xd4(%rbp), %xmm0
subss -0xc8(%rbp), %xmm0
movss %xmm0, -0xec(%rbp)
movss -0xdc(%rbp), %xmm0
movss -0xec(%rbp), %xmm2
movss -0xe0(%rbp), %xmm1
mulss -0xe8(%rbp), %xmm1
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
callq 0x18c40
movss %xmm0, -0xf0(%rbp)
movss -0xe0(%rbp), %xmm0
movss -0xe4(%rbp), %xmm2
movss -0xd8(%rbp), %xmm1
mulss -0xec(%rbp), %xmm1
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
callq 0x18c40
movss %xmm0, -0xf4(%rbp)
movss -0xd8(%rbp), %xmm0
movss -0xe8(%rbp), %xmm2
movss -0xdc(%rbp), %xmm1
mulss -0xe4(%rbp), %xmm1
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
callq 0x18c40
movss %xmm0, -0xf8(%rbp)
callq 0x2f970
movss %xmm0, -0xfc(%rbp)
movss -0xf0(%rbp), %xmm0
movss 0x5caf3(%rip), %xmm1    # 0x7e450
ucomiss %xmm1, %xmm0
ja 0x2198c
movss -0xf4(%rbp), %xmm0
movss 0x5cade(%rip), %xmm1    # 0x7e450
ucomiss %xmm1, %xmm0
ja 0x2198c
movss -0xf8(%rbp), %xmm0
movss 0x5cac9(%rip), %xmm1    # 0x7e450
ucomiss %xmm1, %xmm0
jbe 0x219ec
movss -0xf0(%rbp), %xmm0
ucomiss -0xf4(%rbp), %xmm0
jbe 0x219b0
movss -0xf0(%rbp), %xmm0
ucomiss -0xf8(%rbp), %xmm0
jbe 0x219b0
jmp 0x219ea
movq $0x0, -0x90(%rbp)
movss -0xf8(%rbp), %xmm0
ucomiss -0xf0(%rbp), %xmm0
jbe 0x219e8
movss -0xf8(%rbp), %xmm0
ucomiss -0xf4(%rbp), %xmm0
jbe 0x219e8
movq $0x1, -0x88(%rbp)
jmp 0x219ea
jmp 0x21a05
jmp 0x219ee
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
jmp 0x21579
xorps %xmm0, %xmm0
movss %xmm0, -0x100(%rbp)
movq $0x0, -0x108(%rbp)
movq -0x108(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0x21c5f
movq -0x48(%rbp), %rdi
addq $0x8, %rdi
movq -0x108(%rbp), %rax
addq $0x0, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x50(%rbp)
movq %rdx, %rsi
callq 0x2f930
movq (%rax), %rcx
movq %rcx, -0x60(%rbp)
movl 0x8(%rax), %eax
movl %eax, -0x58(%rbp)
movq -0x48(%rbp), %rdi
addq $0x8, %rdi
movq -0x108(%rbp), %rax
addq $0x1, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x50(%rbp)
movq %rdx, %rsi
callq 0x2f930
movq (%rax), %rcx
movq %rcx, -0x70(%rbp)
movl 0x8(%rax), %eax
movl %eax, -0x68(%rbp)
movslq -0x60(%rbp), %rax
movq %rax, -0x110(%rbp)
movslq -0x70(%rbp), %rax
movq %rax, -0x118(%rbp)
imulq $0x3, -0x110(%rbp), %rax
addq -0x90(%rbp), %rax
movq %rax, -0x2e8(%rbp)
movq 0x10(%rbp), %rdi
callq 0x2b960
movq %rax, %rcx
movq -0x2e8(%rbp), %rax
cmpq %rcx, %rax
jae 0x21b5e
imulq $0x3, -0x110(%rbp), %rax
addq -0x88(%rbp), %rax
movq %rax, -0x2f0(%rbp)
movq 0x10(%rbp), %rdi
callq 0x2b960
movq %rax, %rcx
movq -0x2f0(%rbp), %rax
cmpq %rcx, %rax
jae 0x21b5e
imulq $0x3, -0x118(%rbp), %rax
addq -0x90(%rbp), %rax
movq %rax, -0x2f8(%rbp)
movq 0x10(%rbp), %rdi
callq 0x2b960
movq %rax, %rcx
movq -0x2f8(%rbp), %rax
cmpq %rcx, %rax
jae 0x21b5e
imulq $0x3, -0x118(%rbp), %rax
addq -0x88(%rbp), %rax
movq %rax, -0x300(%rbp)
movq 0x10(%rbp), %rdi
callq 0x2b960
movq %rax, %rcx
movq -0x300(%rbp), %rax
cmpq %rcx, %rax
jb 0x21b63
jmp 0x21c48
movq 0x10(%rbp), %rdi
imulq $0x3, -0x110(%rbp), %rsi
addq -0x90(%rbp), %rsi
callq 0x2f950
movss (%rax), %xmm0
movss %xmm0, -0x11c(%rbp)
movq 0x10(%rbp), %rdi
imulq $0x3, -0x110(%rbp), %rsi
addq -0x88(%rbp), %rsi
callq 0x2f950
movss (%rax), %xmm0
movss %xmm0, -0x120(%rbp)
movq 0x10(%rbp), %rdi
imulq $0x3, -0x118(%rbp), %rsi
addq -0x90(%rbp), %rsi
callq 0x2f950
movss (%rax), %xmm0
movss %xmm0, -0x124(%rbp)
movq 0x10(%rbp), %rdi
imulq $0x3, -0x118(%rbp), %rsi
addq -0x88(%rbp), %rsi
callq 0x2f950
movss (%rax), %xmm0
movss %xmm0, -0x128(%rbp)
movss -0x11c(%rbp), %xmm0
movss -0x128(%rbp), %xmm2
movss -0x120(%rbp), %xmm1
mulss -0x124(%rbp), %xmm1
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss -0x100(%rbp), %xmm1
movss 0x5c5ec(%rip), %xmm2    # 0x7e224
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x100(%rbp)
movq -0x108(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x108(%rbp)
jmp 0x21a1b
movq -0x48(%rbp), %rsi
leaq -0x148(%rbp), %rdi
callq 0x2f980
movq $0x0, -0x150(%rbp)
leaq -0x180(%rbp), %rax
movq %rax, %rcx
addq $0x24, %rcx
movq %rcx, -0x310(%rbp)
movq %rax, -0x308(%rbp)
movq -0x308(%rbp), %rdi
movq %rdi, -0x318(%rbp)
callq 0x2b930
jmp 0x21cab
movq -0x310(%rbp), %rcx
movq -0x318(%rbp), %rax
addq $0xc, %rax
cmpq %rcx, %rax
movq %rax, -0x308(%rbp)
jne 0x21c96
movq -0x48(%rbp), %rdi
addq $0x8, %rdi
callq 0x2f900
movq %rax, -0x1b0(%rbp)
leaq -0x148(%rbp), %rdi
addq $0x8, %rdi
callq 0x2f900
movq %rax, -0x1b8(%rbp)
leaq -0x148(%rbp), %rdi
addq $0x8, %rdi
callq 0x2f900
movq %rax, %rcx
xorl %eax, %eax
cmpq $0x3, %rcx
movb %al, -0x319(%rbp)
jbe 0x21d26
cmpq $0x0, -0x1b0(%rbp)
seta %al
movb %al, -0x319(%rbp)
movb -0x319(%rbp), %al
testb $0x1, %al
jne 0x21d35
jmp 0x2235d
leaq -0x148(%rbp), %rdi
addq $0x8, %rdi
callq 0x2f900
movq %rax, -0x50(%rbp)
movq -0x150(%rbp), %rax
cmpq -0x50(%rbp), %rax
jb 0x21d90
movq -0x50(%rbp), %rcx
movq -0x150(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x150(%rbp)
jmp 0x21d90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x188(%rbp)
movl %eax, -0x18c(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x2bcd0
jmp 0x2289b
movq -0x1b8(%rbp), %rax
cmpq -0x50(%rbp), %rax
je 0x21db5
movq -0x50(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x1b0(%rbp)
jmp 0x21dc7
movq -0x1b0(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x1b0(%rbp)
movq $0x0, -0x1c0(%rbp)
cmpq $0x3, -0x1c0(%rbp)
jae 0x21f3b
leaq -0x148(%rbp), %rdi
addq $0x8, %rdi
movq -0x150(%rbp), %rax
addq -0x1c0(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x50(%rbp)
movq %rdx, %rsi
callq 0x2f9c0
movq %rax, %rcx
leaq -0x180(%rbp), %rax
imulq $0xc, -0x1c0(%rbp), %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movl 0x8(%rcx), %ecx
movl %ecx, 0x8(%rax)
leaq -0x180(%rbp), %rax
imulq $0xc, -0x1c0(%rbp), %rcx
addq %rcx, %rax
movslq (%rax), %rax
movq %rax, -0x1c8(%rbp)
imulq $0x3, -0x1c8(%rbp), %rax
addq -0x90(%rbp), %rax
movq %rax, -0x328(%rbp)
movq 0x10(%rbp), %rdi
callq 0x2b960
movq %rax, %rcx
movq -0x328(%rbp), %rax
cmpq %rcx, %rax
jae 0x21ea2
imulq $0x3, -0x1c8(%rbp), %rax
addq -0x88(%rbp), %rax
movq %rax, -0x330(%rbp)
movq 0x10(%rbp), %rdi
callq 0x2b960
movq %rax, %rcx
movq -0x330(%rbp), %rax
cmpq %rcx, %rax
jb 0x21eca
movq -0x1c0(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, -0x198(%rbp,%rax,4)
movq -0x1c0(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, -0x1a4(%rbp,%rax,4)
jmp 0x21f22
movq 0x10(%rbp), %rdi
imulq $0x3, -0x1c8(%rbp), %rsi
addq -0x90(%rbp), %rsi
callq 0x2f950
movss (%rax), %xmm0
movq -0x1c0(%rbp), %rax
movss %xmm0, -0x198(%rbp,%rax,4)
movq 0x10(%rbp), %rdi
imulq $0x3, -0x1c8(%rbp), %rsi
addq -0x88(%rbp), %rsi
callq 0x2f950
movss (%rax), %xmm0
movq -0x1c0(%rbp), %rax
movss %xmm0, -0x1a4(%rbp,%rax,4)
jmp 0x21f24
movq -0x1c0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1c0(%rbp)
jmp 0x21dd2
movss -0x194(%rbp), %xmm0
subss -0x198(%rbp), %xmm0
movss %xmm0, -0x1cc(%rbp)
movss -0x1a0(%rbp), %xmm0
subss -0x1a4(%rbp), %xmm0
movss %xmm0, -0x1d0(%rbp)
movss -0x190(%rbp), %xmm0
subss -0x194(%rbp), %xmm0
movss %xmm0, -0x1d4(%rbp)
movss -0x19c(%rbp), %xmm0
subss -0x1a0(%rbp), %xmm0
movss %xmm0, -0x1d8(%rbp)
movss -0x1cc(%rbp), %xmm0
movss -0x1d8(%rbp), %xmm2
movss -0x1d0(%rbp), %xmm1
mulss -0x1d4(%rbp), %xmm1
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x1dc(%rbp)
movss -0x1dc(%rbp), %xmm1
mulss -0x100(%rbp), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm1, %xmm0
jbe 0x22007
movq -0x150(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x150(%rbp)
jmp 0x21cf4
movb $0x0, -0x1dd(%rbp)
movq $0x3, -0x1e8(%rbp)
movq -0x1e8(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0x221ac
movq -0x150(%rbp), %rax
addq -0x1e8(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x50(%rbp)
movq %rdx, -0x1f0(%rbp)
movq -0x1f0(%rbp), %rax
movq %rax, -0x338(%rbp)
leaq -0x148(%rbp), %rdi
addq $0x8, %rdi
callq 0x2f900
movq %rax, %rcx
movq -0x338(%rbp), %rax
cmpq %rcx, %rax
jb 0x22079
jmp 0x22195
leaq -0x148(%rbp), %rdi
addq $0x8, %rdi
movq -0x1f0(%rbp), %rsi
callq 0x2f9c0
movslq (%rax), %rax
movq %rax, -0x1f8(%rbp)
imulq $0x3, -0x1f8(%rbp), %rax
addq -0x90(%rbp), %rax
movq %rax, -0x340(%rbp)
movq 0x10(%rbp), %rdi
callq 0x2b960
movq %rax, %rcx
movq -0x340(%rbp), %rax
cmpq %rcx, %rax
jae 0x220f6
imulq $0x3, -0x1f8(%rbp), %rax
addq -0x88(%rbp), %rax
movq %rax, -0x348(%rbp)
movq 0x10(%rbp), %rdi
callq 0x2b960
movq %rax, %rcx
movq -0x348(%rbp), %rax
cmpq %rcx, %rax
jb 0x220fb
jmp 0x22195
movq 0x10(%rbp), %rdi
movq -0x1f8(%rbp), %rax
leaq (%rax,%rax,2), %rsi
movq -0x90(%rbp), %rax
addq %rax, %rsi
callq 0x2f950
movss (%rax), %xmm0
movss %xmm0, -0x1fc(%rbp)
movq 0x10(%rbp), %rdi
movq -0x1f8(%rbp), %rax
leaq (%rax,%rax,2), %rsi
movq -0x88(%rbp), %rax
addq %rax, %rsi
callq 0x2f950
movss (%rax), %xmm0
movss %xmm0, -0x200(%rbp)
movss -0x1fc(%rbp), %xmm0
movss -0x200(%rbp), %xmm1
movl $0x3, %edi
leaq -0x198(%rbp), %rsi
leaq -0x1a4(%rbp), %rdx
callq 0x2af10
movl %eax, -0x34c(%rbp)
jmp 0x2217f
movl -0x34c(%rbp), %eax
cmpl $0x0, %eax
je 0x22193
movb $0x1, -0x1dd(%rbp)
jmp 0x221ac
jmp 0x22195
movq -0x1e8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1e8(%rbp)
jmp 0x22019
testb $0x1, -0x1dd(%rbp)
je 0x221cc
movq -0x150(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x150(%rbp)
jmp 0x21cf4
movl -0x180(%rbp), %eax
movl %eax, -0x20c(%rbp)
movl -0x178(%rbp), %eax
movl %eax, -0x208(%rbp)
movl -0x17c(%rbp), %eax
movl %eax, -0x204(%rbp)
movl -0x174(%rbp), %eax
movl %eax, -0x218(%rbp)
movl -0x16c(%rbp), %eax
movl %eax, -0x214(%rbp)
movl -0x170(%rbp), %eax
movl %eax, -0x210(%rbp)
movl -0x168(%rbp), %eax
movl %eax, -0x224(%rbp)
movl -0x160(%rbp), %eax
movl %eax, -0x220(%rbp)
movl -0x164(%rbp), %eax
movl %eax, -0x21c(%rbp)
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
leaq -0x20c(%rbp), %rsi
callq 0x2c780
jmp 0x2224e
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
leaq -0x218(%rbp), %rsi
callq 0x2c780
jmp 0x22264
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
leaq -0x224(%rbp), %rsi
callq 0x2c780
jmp 0x2227a
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
movb $0x3, -0x225(%rbp)
leaq -0x225(%rbp), %rsi
callq 0x2f9e0
jmp 0x22297
movq -0x10(%rbp), %rdi
addq $0x50, %rdi
leaq -0x24(%rbp), %rsi
callq 0x196b0
jmp 0x222aa
movq -0x10(%rbp), %rdi
addq $0x68, %rdi
movq -0x48(%rbp), %rsi
callq 0x2fa10
jmp 0x222bd
movq -0x150(%rbp), %rax
addq $0x1, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x50(%rbp)
movq %rdx, -0x230(%rbp)
movq -0x230(%rbp), %rax
addq $0x1, %rax
cmpq -0x50(%rbp), %rax
jae 0x22348
leaq -0x148(%rbp), %rdi
addq $0x8, %rdi
movq -0x230(%rbp), %rsi
addq $0x1, %rsi
callq 0x2f9c0
movq %rax, -0x358(%rbp)
leaq -0x148(%rbp), %rdi
addq $0x8, %rdi
movq -0x230(%rbp), %rsi
callq 0x2f9c0
movq -0x358(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movl 0x8(%rcx), %ecx
movl %ecx, 0x8(%rax)
movq -0x230(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x230(%rbp)
jmp 0x222d7
leaq -0x148(%rbp), %rdi
addq $0x8, %rdi
callq 0x2fa80
jmp 0x21cf4
leaq -0x148(%rbp), %rdi
addq $0x8, %rdi
callq 0x2f900
cmpq $0x3, %rax
jne 0x224af
leaq -0x140(%rbp), %rdi
movq %rdi, -0x360(%rbp)
xorl %eax, %eax
movl %eax, %esi
callq 0x2f9c0
movq -0x360(%rbp), %rdi
movl 0x8(%rax), %ecx
movl %ecx, -0x58(%rbp)
movq (%rax), %rax
movq %rax, -0x60(%rbp)
movl $0x1, %esi
callq 0x2f9c0
movq -0x360(%rbp), %rdi
movl 0x8(%rax), %ecx
movl %ecx, -0x68(%rbp)
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movl $0x2, %esi
callq 0x2f9c0
movl 0x8(%rax), %ecx
movl %ecx, -0x78(%rbp)
movq (%rax), %rax
movq %rax, -0x80(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x23c(%rbp)
movl -0x58(%rbp), %eax
movl %eax, -0x238(%rbp)
movl -0x5c(%rbp), %eax
movl %eax, -0x234(%rbp)
movl -0x70(%rbp), %eax
movl %eax, -0x248(%rbp)
movl -0x68(%rbp), %eax
movl %eax, -0x244(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x240(%rbp)
movl -0x80(%rbp), %eax
movl %eax, -0x254(%rbp)
movl -0x78(%rbp), %eax
movl %eax, -0x250(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, -0x24c(%rbp)
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
leaq -0x23c(%rbp), %rsi
callq 0x2c780
jmp 0x2243e
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
leaq -0x248(%rbp), %rsi
callq 0x2c780
jmp 0x22454
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
leaq -0x254(%rbp), %rsi
callq 0x2c780
jmp 0x2246a
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
movb $0x3, -0x255(%rbp)
leaq -0x255(%rbp), %rsi
callq 0x2f9e0
jmp 0x22487
movq -0x10(%rbp), %rdi
addq $0x50, %rdi
leaq -0x24(%rbp), %rsi
callq 0x196b0
jmp 0x2249a
movq -0x10(%rbp), %rdi
addq $0x68, %rdi
movq -0x48(%rbp), %rsi
callq 0x2fa10
jmp 0x224ad
jmp 0x224af
leaq -0x148(%rbp), %rdi
callq 0x2bcd0
jmp 0x225a9
movq $0x0, -0x260(%rbp)
movq -0x260(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0x2255d
movq -0x48(%rbp), %rdi
addq $0x8, %rdi
movq -0x260(%rbp), %rsi
callq 0x2f930
movl (%rax), %eax
movl %eax, -0x26c(%rbp)
movq -0x48(%rbp), %rdi
addq $0x8, %rdi
movq -0x260(%rbp), %rsi
callq 0x2f930
movl 0x8(%rax), %eax
movl %eax, -0x268(%rbp)
movq -0x48(%rbp), %rdi
addq $0x8, %rdi
movq -0x260(%rbp), %rsi
callq 0x2f930
movl 0x4(%rax), %eax
movl %eax, -0x264(%rbp)
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
leaq -0x26c(%rbp), %rsi
callq 0x2c780
movq -0x260(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x260(%rbp)
jmp 0x224cb
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
addq $0x18, %rdi
movq -0x50(%rbp), %rax
movb %al, -0x26d(%rbp)
leaq -0x26d(%rbp), %rsi
callq 0x2f9e0
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
addq $0x30, %rdi
leaq -0x24(%rbp), %rsi
callq 0x196b0
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
addq $0x48, %rdi
movq -0x48(%rbp), %rsi
callq 0x2fa10
jmp 0x225ab
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x214a8
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
addq $0x60, %rdi
callq 0x2fab0
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
callq 0x2fd00
testb $0x1, %al
jne 0x22751
movq $0x0, -0x278(%rbp)
movq -0x278(%rbp), %rax
movq %rax, -0x368(%rbp)
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
callq 0x2fd40
movq %rax, %rcx
movq -0x368(%rbp), %rax
cmpq %rcx, %rax
jae 0x2274f
movq $0x0, -0x280(%rbp)
movq -0x280(%rbp), %rax
movq %rax, -0x370(%rbp)
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
movq -0x278(%rbp), %rsi
callq 0x2fd70
movq %rax, %rdi
callq 0x2f900
movq %rax, %rcx
movq -0x370(%rbp), %rax
cmpq %rcx, %rax
jae 0x226ee
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
movq -0x278(%rbp), %rsi
callq 0x2fd70
movq %rax, %rdi
movq -0x280(%rbp), %rsi
callq 0x2f930
movq %rax, -0x288(%rbp)
movq -0x288(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x294(%rbp)
movq -0x288(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x290(%rbp)
movq -0x288(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x28c(%rbp)
movq -0x10(%rbp), %rdi
addq $0x98, %rdi
leaq -0x294(%rbp), %rsi
callq 0x2c780
movq -0x280(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x280(%rbp)
jmp 0x2262a
movq -0x10(%rbp), %rax
addq $0x98, %rax
addq $0x18, %rax
movq %rax, -0x378(%rbp)
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
movq -0x278(%rbp), %rsi
callq 0x2fd70
movq %rax, %rdi
callq 0x2f900
movq -0x378(%rbp), %rdi
movl %eax, -0x298(%rbp)
leaq -0x298(%rbp), %rsi
callq 0x2fd90
movq -0x278(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x278(%rbp)
jmp 0x225f1
jmp 0x22751
movq -0x18(%rbp), %rdi
addq $0x30, %rdi
callq 0x2fdc0
testb $0x1, %al
jne 0x22889
movq $0x0, -0x2a0(%rbp)
movq -0x2a0(%rbp), %rax
movq %rax, -0x380(%rbp)
movq -0x18(%rbp), %rdi
addq $0x30, %rdi
callq 0x2fe00
movq %rax, %rcx
movq -0x380(%rbp), %rax
cmpq %rcx, %rax
jae 0x22887
movq $0x0, -0x2a8(%rbp)
movq -0x2a8(%rbp), %rax
movq %rax, -0x388(%rbp)
movq -0x18(%rbp), %rdi
addq $0x30, %rdi
movq -0x2a0(%rbp), %rsi
callq 0x2fe30
movq %rax, %rdi
callq 0x2f900
movq %rax, %rcx
movq -0x388(%rbp), %rax
cmpq %rcx, %rax
jae 0x2286e
movq -0x18(%rbp), %rdi
addq $0x30, %rdi
movq -0x2a0(%rbp), %rsi
callq 0x2fe30
movq %rax, %rdi
movq -0x2a8(%rbp), %rsi
callq 0x2f930
movq %rax, -0x2b0(%rbp)
movq -0x2b0(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2bc(%rbp)
movq -0x2b0(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x2b8(%rbp)
movq -0x2b0(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x2b4(%rbp)
movq -0x10(%rbp), %rdi
addq $0xc8, %rdi
leaq -0x2bc(%rbp), %rsi
callq 0x2c780
movq -0x2a8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2a8(%rbp)
jmp 0x227aa
jmp 0x22870
movq -0x2a0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2a0(%rbp)
jmp 0x22771
jmp 0x22889
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x390, %rsp            # imm = 0x390
popq %rbp
retq
movq -0x188(%rbp), %rdi
callq 0x7860
nopw (%rax,%rax)