// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::ReadPlyStream(_IO_FILE*)
int R3Mesh::
ReadPlyStream(FILE *fp)
{
  int i,j;
  PlyFile *ply;
  int nelems;
  PlyProperty **plist;
  char **elist;
  int file_type;
  int nprops;
  int num_elems;
  char *elem_name;
  float version;
  int num_rows = 0;
  int num_cols = 0;

  typedef struct PlyVertex {
    float x, y, z;
    float nx, ny, nz;
    float tx, ty;
    unsigned char red, green, blue;
  } PlyVertex;

  typedef struct PlyFace {
    unsigned char nverts;
    int *verts;
    int material;
    int segment;
    int category;
  } PlyFace;

  typedef struct PlyRangeGrid {
    unsigned char nverts;
    int *verts;
  } PlyRangeGrid;

  // List of property information for a vertex 
  static PlyProperty vert_props[] = { 
    {(char *) "x", PLY_FLOAT, PLY_FLOAT, offsetof(PlyVertex,x), 0, 0, 0, 0},
    {(char *) "y", PLY_FLOAT, PLY_FLOAT, offsetof(PlyVertex,y), 0, 0, 0, 0},
    {(char *) "z", PLY_FLOAT, PLY_FLOAT, offsetof(PlyVertex,z), 0, 0, 0, 0},
    {(char *) "nx", PLY_FLOAT, PLY_FLOAT, offsetof(PlyVertex,nx), 0, 0, 0, 0},
    {(char *) "ny", PLY_FLOAT, PLY_FLOAT, offsetof(PlyVertex,ny), 0, 0, 0, 0},
    {(char *) "nz", PLY_FLOAT, PLY_FLOAT, offsetof(PlyVertex,nz), 0, 0, 0, 0},
    {(char *) "tx", PLY_FLOAT, PLY_FLOAT, offsetof(PlyVertex,tx), 0, 0, 0, 0},
    {(char *) "ty", PLY_FLOAT, PLY_FLOAT, offsetof(PlyVertex,ty), 0, 0, 0, 0},
    {(char *) "red", PLY_UCHAR, PLY_UCHAR, offsetof(PlyVertex,red), 0, 0, 0, 0},
    {(char *) "green", PLY_UCHAR, PLY_UCHAR, offsetof(PlyVertex,green), 0, 0, 0, 0},
    {(char *) "blue", PLY_UCHAR, PLY_UCHAR, offsetof(PlyVertex,blue), 0, 0, 0, 0}
  };

  // List of property information for a face 
  static PlyProperty face_props[] = { 
    {(char *) "vertex_indices", PLY_INT, PLY_INT, offsetof(PlyFace,verts), 1, PLY_UCHAR, PLY_UCHAR, offsetof(PlyFace,nverts)},
    {(char *) "vertex_index", PLY_INT, PLY_INT, offsetof(PlyFace,verts), 1, PLY_UCHAR, PLY_UCHAR, offsetof(PlyFace,nverts)},
    {(char *) "material_id", PLY_INT, PLY_INT, offsetof(PlyFace,material), 0, 0, 0, 0},
    {(char *) "segment_id", PLY_INT, PLY_INT, offsetof(PlyFace,segment), 0, 0, 0, 0},
    {(char *) "category_id", PLY_INT, PLY_INT, offsetof(PlyFace,category), 0, 0, 0, 0}
  };

  // List of property information for a range_grid
  static PlyProperty range_grid_props[] = { 
    {(char *) "vertex_indices", PLY_INT, PLY_INT, offsetof(PlyFace,verts), 1, PLY_UCHAR, PLY_UCHAR, offsetof(PlyFace,nverts)},
  };

  // Read PLY header
  ply = ply_read (fp, &nelems, &elist);
  if (!ply) {
    RNFail("Unable to read ply file header");
    fclose(fp);
    return 0;
  }
  
  // Get header info
  ply_get_info (ply, &version, &file_type);

  // Read all elements
  for (i = 0; i < nelems; i++) {
    // Get the description of the element 
    elem_name = elist[i];
    plist = ply_get_element_description (ply, elem_name, &num_elems, &nprops);

    // Check element type
    if (equal_strings ("vertex", elem_name)) {
      // Allocate block of vertices
      vertex_block = new R3MeshVertex [num_elems];

      // Resize array of vertices
      vertices.Resize(num_elems);

      // set up for getting vertex elements 
      RNBoolean has_normals = 0;
      RNBoolean has_texcoords = 0;
      RNBoolean has_colors = 0;
      for (j = 0; j < nprops; j++) {
	if (equal_strings("x", plist[j]->name)) ply_get_property (ply, elem_name, &vert_props[0]);
	else if (equal_strings("y", plist[j]->name)) ply_get_property (ply, elem_name, &vert_props[1]);
	else if (equal_strings("z", plist[j]->name)) ply_get_property (ply, elem_name, &vert_props[2]);
	else if (equal_strings("nx", plist[j]->name)) ply_get_property (ply, elem_name, &vert_props[3]); 
	else if (equal_strings("ny", plist[j]->name)) ply_get_property (ply, elem_name, &vert_props[4]); 
	else if (equal_strings("nz", plist[j]->name)) ply_get_property (ply, elem_name, &vert_props[5]);
	else if (equal_strings("tx", plist[j]->name)) ply_get_property (ply, elem_name, &vert_props[6]); 
	else if (equal_strings("ty", plist[j]->name)) ply_get_property (ply, elem_name, &vert_props[7]); 
	else if (equal_strings("red", plist[j]->name)) ply_get_property (ply, elem_name, &vert_props[8]); 
	else if (equal_strings("green", plist[j]->name)) ply_get_property (ply, elem_name, &vert_props[9]); 
	else if (equal_strings("blue", plist[j]->name)) ply_get_property (ply, elem_name, &vert_props[10]);
	if (equal_strings("nx", plist[j]->name)) has_normals = 1;
	else if (equal_strings("tx", plist[j]->name)) has_texcoords = 1;
	else if (equal_strings("red", plist[j]->name)) has_colors = 1;
      }

      // grab all the vertex elements 
      for (j = 0; j < num_elems; j++) {
        // Read vertex into local struct
        PlyVertex plyvertex;
        ply_get_element(ply, (void *) &plyvertex);

        // Create mesh vertex
        R3Point position(plyvertex.x, plyvertex.y, plyvertex.z);
        R3MeshVertex *v = CreateVertex(position, &vertex_block[j]);
        if (has_normals) {
          R3Vector normal(plyvertex.nx, plyvertex.ny, plyvertex.nz);
          SetVertexNormal(v, normal);
        }
        if (has_texcoords) {
          R2Point texcoords(plyvertex.tx, plyvertex.ty);
          SetVertexTextureCoords(v, texcoords);
        }
        if (has_colors) {
          RNRgb color(plyvertex.red/255.0, plyvertex.green/255.0, plyvertex.blue/255.0);
          SetVertexColor(v, color);
        }
      }
    }
    else if (equal_strings ("face", elem_name)) {
      // Resize array of faces
      faces.Resize(num_elems);

      // set up for getting face elements 
      for (j = 0; j < nprops; j++) {
	if (equal_strings("vertex_indices", plist[j]->name)) ply_get_property (ply, elem_name, &face_props[0]);
	else if (equal_strings("vertex_index", plist[j]->name)) ply_get_property (ply, elem_name, &face_props[1]);
	else if (equal_strings("material_id", plist[j]->name)) ply_get_property (ply, elem_name, &face_props[2]);
	else if (equal_strings("segment_id", plist[j]->name)) ply_get_property (ply, elem_name, &face_props[3]);
	else if (equal_strings("category_id", plist[j]->name)) ply_get_property (ply, elem_name, &face_props[4]);
      }

      // Create stuff for degenerate triangles
      RNArray<R3MeshVertex *> degenerate_triangle_vertices;
      int *degenerate_triangle_materials = new int [ num_elems ];
      int *degenerate_triangle_segments = new int [ num_elems ];
      int *degenerate_triangle_categories = new int [ num_elems ];
      int num_degenerate_triangles = 0;

      // grab all the face elements 
      for (j = 0; j < num_elems; j++) {
        // Read face into local struct
        PlyFace plyface;
        plyface.nverts = 0;
        plyface.verts = NULL;
        plyface.material = -1;
        plyface.segment = -1;
        plyface.category = -1;
        ply_get_element(ply, (void *) &plyface);

        // Create mesh face(s)
        R3MeshVertex *v1 = vertices[plyface.verts[0]];
        for (int k = 2; k < plyface.nverts; k++) {
          // Get vertices
          R3MeshVertex *v2 = vertices[plyface.verts[k-1]];
          R3MeshVertex *v3 = vertices[plyface.verts[k]];

          // Check plyface
          assert(plyface.verts[0] >= 0);
          assert(plyface.verts[k-1] >= 0);
          assert(plyface.verts[k] >= 0);
          assert(plyface.verts[0] < vertices.NEntries());
          assert(plyface.verts[k-1] < vertices.NEntries());
          assert(plyface.verts[k] < vertices.NEntries());

          // Check vertices
          if ((v1 == v2) || (v2 == v3) || (v1 == v3)) continue;

          // Create face
          R3MeshFace *f = CreateFace(v1, v2, v3);
          if (f) {
            // Set material/segment/category
            SetFaceMaterial(f, plyface.material);
            SetFaceSegment(f, plyface.segment);
            SetFaceCategory(f, plyface.category);
          }
          else {
            // Must have been degeneracy (e.g., three faces sharing an edge)
            // Remember for later processing (to preserve vertex indices)
            degenerate_triangle_vertices.Insert(v1);
            degenerate_triangle_vertices.Insert(v2);
            degenerate_triangle_vertices.Insert(v3);
            degenerate_triangle_materials[num_degenerate_triangles] = plyface.material;
            degenerate_triangle_segments[num_degenerate_triangles] = plyface.segment;
            degenerate_triangle_categories[num_degenerate_triangles] = plyface.category;
            num_degenerate_triangles++;
          }
        }

        // Free face data allocated by ply
        if (plyface.verts) free(plyface.verts);
      }
      
      // Create degenerate triangles (do this at end to preserve face ordering)
      for (int i = 0; i < num_degenerate_triangles; i++) {
        R3MeshVertex *v1 = degenerate_triangle_vertices.Kth(3*i + 0);
        R3MeshVertex *v2 = degenerate_triangle_vertices.Kth(3*i + 1);
        R3MeshVertex *v3 = degenerate_triangle_vertices.Kth(3*i + 2);
        R3MeshFace *f = CreateFace(v1, v2, v3);
        if (!f) {
          f = CreateFace(v1, v3, v2);
          if (!f) {
            // Note: these vertices are allocated separately, and so they will not be deleted (memory leak)
            R3MeshVertex *v1a = CreateVertex(VertexPosition(v1));
            R3MeshVertex *v2a = CreateVertex(VertexPosition(v2));
            R3MeshVertex *v3a = CreateVertex(VertexPosition(v3));
            f = CreateFace(v1a, v2a, v3a);
          }
        }
        if (f) {
          SetFaceMaterial(f, degenerate_triangle_materials[i]);
          SetFaceSegment(f, degenerate_triangle_segments[i]);
          SetFaceCategory(f, degenerate_triangle_categories[i]);
        }
      }

      // Delete memory for degenerate triangles
      delete [] degenerate_triangle_materials;
      delete [] degenerate_triangle_segments;
      delete [] degenerate_triangle_categories;
    }
    else if (equal_strings ("range_grid", elem_name)) {
      // Get num_cols and num_rows for range_grid
      int ninfo = 0;
      char **info = ply_get_obj_info(ply, &ninfo);
      for (int i = 0; i < ninfo; i++) {
        char *str = RNStrdup(info[i]);
        char *strp = strtok(str, " \n\t");
        if (strp) {
          if (!strcmp(strp, "num_rows")) {
            strp = strtok(NULL, " \n\t");
            if (strp) num_rows = atoi(strp);
          }
          else if (!strcmp(strp, "num_cols")) {
            strp = strtok(NULL, " \n\t");
            if (strp) num_cols = atoi(strp);
          }
        }
        free(str);
      }

      // check num_cols and num_rows
      if ((num_cols > 0) && (num_rows > 0) && (num_cols * num_rows == num_elems)) {
        // Allocate vertex grid
        R3MeshVertex **vertex_grid = new R3MeshVertex * [num_elems];
        for (j = 0; j < num_elems; j++) vertex_grid[j] = NULL;

        // set up for getting range grid elements 
        for (j = 0; j < nprops; j++) {
          if (equal_strings("vertex_indices", plist[j]->name)) ply_get_property (ply, elem_name, &range_grid_props[0]);
        }

        // grab all the range grid vertices
        for (j = 0; j < num_elems; j++) {
          // Read face into local struct
          PlyRangeGrid ply_range_grid;
          ply_range_grid.nverts = 0;
          ply_range_grid.verts = NULL;
          ply_get_element(ply, (void *) &ply_range_grid);
          if (!ply_range_grid.verts) continue;
          if (ply_range_grid.nverts == 0) continue;
          vertex_grid[j] = vertices[ply_range_grid.verts[0]];
          free(ply_range_grid.verts);
        }

        // create faces
        for (int row = 0; row < num_rows-1; row++) {
          for (int col = 0; col < num_cols-1; col++) {
            R3MeshVertex *v00 = vertex_grid[(row)*num_cols + (col)];
            R3MeshVertex *v01 = vertex_grid[(row+1)*num_cols + (col)];
            R3MeshVertex *v10 = vertex_grid[(row)*num_cols + (col+1)];
            R3MeshVertex *v11 = vertex_grid[(row+1)*num_cols + (col+1)];
            if (v00) {
              if (v01) {
                if (v10) {
                  if (v11) {
                    CreatePlyRangeGridFace(this, v00, v10, v11);
                    CreatePlyRangeGridFace(this, v00, v11, v01);
                  }
                  else {
                    CreatePlyRangeGridFace(this, v00, v10, v01);
                  }
                }
                else {
                  if (v11) {
                    CreatePlyRangeGridFace(this, v00, v11, v01);
                  }
                }
              }
              else {
                if (v10) {
                  if (v11) {
                    CreatePlyRangeGridFace(this, v00, v10, v11);
                  }
                }
              }
            }
            else {
              if (v01) {
                if (v10) {
                  if (v11) {
                    CreatePlyRangeGridFace(this, v10, v11, v01);
                  }
                }
              }
            }
          }
        }

        // Delete vertex grid
        delete [] vertex_grid;
      }
    }
    else {
      ply_get_other_element (ply, elem_name, num_elems);
    }
  }

  // Free the memory
  free(ply);

  // Return success
  return 1;
}

// Assembly:
subq $0x338, %rsp            # imm = 0x338
movq %rdi, 0x328(%rsp)
movq %rsi, 0x320(%rsp)
movq 0x328(%rsp), %rax
movq %rax, 0x108(%rsp)
movl $0x0, 0x2d8(%rsp)
movl $0x0, 0x2d4(%rsp)
movq 0x320(%rsp), %rdi
leaq 0x30c(%rsp), %rsi
leaq 0x2f8(%rsp), %rdx
callq 0x72cc0
movq %rax, 0x310(%rsp)
cmpq $0x0, 0x310(%rsp)
jne 0x2ed08
leaq 0x10496a(%rip), %rdi    # 0x13364e
movb $0x0, %al
callq 0xd4f30
movq 0x320(%rsp), %rdi
callq 0xf4b0
movl $0x0, 0x334(%rsp)
jmp 0x30587
movq 0x310(%rsp), %rdi
leaq 0x2dc(%rsp), %rsi
leaq 0x2f4(%rsp), %rdx
callq 0x74ec0
movl $0x0, 0x31c(%rsp)
movl 0x31c(%rsp), %eax
cmpl 0x30c(%rsp), %eax
jge 0x3056f
movq 0x2f8(%rsp), %rax
movslq 0x31c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x2e0(%rsp)
movq 0x310(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
leaq 0x2ec(%rsp), %rdx
leaq 0x2f0(%rsp), %rcx
callq 0x739e0
movq %rax, 0x300(%rsp)
movq 0x2e0(%rsp), %rsi
leaq 0x1047c6(%rip), %rdi    # 0x133562
callq 0x734b0
cmpl $0x0, %eax
je 0x2f568
movslq 0x2ec(%rsp), %rax
movq %rax, 0xf0(%rsp)
movl $0x98, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
addq $0x8, %rdi
setb %al
orb %al, %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
movq %rdi, 0xe8(%rsp)
callq 0xf030
movq %rax, %rcx
movq 0xf0(%rsp), %rax
movq %rcx, 0xf8(%rsp)
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, 0x100(%rsp)
cmpq $0x0, %rax
je 0x2ee7b
movq 0x100(%rsp), %rax
movq 0xf0(%rsp), %rcx
imulq $0x98, %rcx, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, 0xd8(%rsp)
movq %rax, 0xe0(%rsp)
movq 0xe0(%rsp), %rdi
movq %rdi, 0xd0(%rsp)
callq 0x36460
jmp 0x2ee58
movq 0xd8(%rsp), %rcx
movq 0xd0(%rsp), %rax
addq $0x98, %rax
cmpq %rcx, %rax
movq %rax, 0xe0(%rsp)
jne 0x2ee41
movq 0x108(%rsp), %rdi
movq 0x100(%rsp), %rax
movq %rax, 0x38(%rdi)
addq $0x8, %rdi
movl 0x2ec(%rsp), %esi
callq 0xd1a80
movl $0x0, 0x2c0(%rsp)
movl $0x0, 0x2bc(%rsp)
movl $0x0, 0x2b8(%rsp)
movl $0x0, 0x318(%rsp)
movl 0x318(%rsp), %eax
cmpl 0x2f0(%rsp), %eax
jge 0x2f38a
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x108bd5(%rip), %rdi    # 0x137ad2
callq 0x734b0
cmpl $0x0, %eax
je 0x2efae
movq 0x310(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
leaq 0x14060e(%rip), %rdx    # 0x16f530
callq 0x73ce0
jmp 0x2f2d1
movq 0x100(%rsp), %rcx
movq %rax, %rsi
movq 0xd0(%rsp), %rax
movq %rsi, 0x2c8(%rsp)
movl %edx, 0x2c4(%rsp)
cmpq %rax, %rcx
movq %rax, 0xc8(%rsp)
je 0x2ef94
movq 0xc8(%rsp), %rdi
addq $-0x98, %rdi
movq %rdi, 0xc0(%rsp)
callq 0x36560
movq 0x100(%rsp), %rcx
movq 0xc0(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0xc8(%rsp)
jne 0x2ef5b
movq 0xe8(%rsp), %rsi
movq 0xf8(%rsp), %rdi
callq 0xf990
jmp 0x30596
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x1043c1(%rip), %rdi    # 0x13338d
callq 0x734b0
cmpl $0x0, %eax
je 0x2effb
movq 0x310(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
leaq 0x140543(%rip), %rdx    # 0x16f530
addq $0x28, %rdx
callq 0x73ce0
jmp 0x2f2cf
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x1045e2(%rip), %rdi    # 0x1335fb
callq 0x734b0
cmpl $0x0, %eax
je 0x2f048
movq 0x310(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
leaq 0x1404f6(%rip), %rdx    # 0x16f530
addq $0x50, %rdx
callq 0x73ce0
jmp 0x2f2cd
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x10458e(%rip), %rdi    # 0x1335f4
callq 0x734b0
cmpl $0x0, %eax
je 0x2f095
movq 0x310(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
leaq 0x1404a9(%rip), %rdx    # 0x16f530
addq $0x78, %rdx
callq 0x73ce0
jmp 0x2f2cb
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x104544(%rip), %rdi    # 0x1335f7
callq 0x734b0
cmpl $0x0, %eax
je 0x2f0e5
movq 0x310(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
leaq 0x14045c(%rip), %rdx    # 0x16f530
addq $0xa0, %rdx
callq 0x73ce0
jmp 0x2f2c9
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x1044f7(%rip), %rdi    # 0x1335fa
callq 0x734b0
cmpl $0x0, %eax
je 0x2f135
movq 0x310(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
leaq 0x14040c(%rip), %rdx    # 0x16f530
addq $0xc8, %rdx
callq 0x73ce0
jmp 0x2f2c7
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x1044aa(%rip), %rdi    # 0x1335fd
callq 0x734b0
cmpl $0x0, %eax
je 0x2f185
movq 0x310(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
leaq 0x1403bc(%rip), %rdx    # 0x16f530
addq $0xf0, %rdx
callq 0x73ce0
jmp 0x2f2c5
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x106452(%rip), %rdi    # 0x1355f5
callq 0x734b0
cmpl $0x0, %eax
je 0x2f1d5
movq 0x310(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
leaq 0x14036c(%rip), %rdx    # 0x16f530
addq $0x118, %rdx            # imm = 0x118
callq 0x73ce0
jmp 0x2f2c3
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x10440d(%rip), %rdi    # 0x133600
callq 0x734b0
cmpl $0x0, %eax
je 0x2f225
movq 0x310(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
leaq 0x14031c(%rip), %rdx    # 0x16f530
addq $0x140, %rdx            # imm = 0x140
callq 0x73ce0
jmp 0x2f2c1
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x1043c1(%rip), %rdi    # 0x133604
callq 0x734b0
cmpl $0x0, %eax
je 0x2f272
movq 0x310(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
leaq 0x1402cc(%rip), %rdx    # 0x16f530
addq $0x168, %rdx            # imm = 0x168
callq 0x73ce0
jmp 0x2f2bf
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x10437a(%rip), %rdi    # 0x13360a
callq 0x734b0
cmpl $0x0, %eax
je 0x2f2bd
movq 0x310(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
leaq 0x14027f(%rip), %rdx    # 0x16f530
addq $0x190, %rdx            # imm = 0x190
callq 0x73ce0
jmp 0x2f2bf
jmp 0x2f2c1
jmp 0x2f2c3
jmp 0x2f2c5
jmp 0x2f2c7
jmp 0x2f2c9
jmp 0x2f2cb
jmp 0x2f2cd
jmp 0x2f2cf
jmp 0x2f2d1
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x104305(%rip), %rdi    # 0x1335f4
callq 0x734b0
cmpl $0x0, %eax
je 0x2f306
movl $0x1, 0x2c0(%rsp)
jmp 0x2f372
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x1042d9(%rip), %rdi    # 0x1335fd
callq 0x734b0
cmpl $0x0, %eax
je 0x2f33b
movl $0x1, 0x2bc(%rsp)
jmp 0x2f370
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x1042a7(%rip), %rdi    # 0x133600
callq 0x734b0
cmpl $0x0, %eax
je 0x2f36e
movl $0x1, 0x2b8(%rsp)
jmp 0x2f370
jmp 0x2f372
jmp 0x2f374
movl 0x318(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x318(%rsp)
jmp 0x2eecb
movl $0x0, 0x318(%rsp)
movl 0x318(%rsp), %eax
cmpl 0x2ec(%rsp), %eax
jge 0x2f563
movq 0x310(%rsp), %rdi
leaq 0x294(%rsp), %rsi
callq 0x73dc0
movss 0x294(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
movss 0x298(%rsp), %xmm1
cvtss2sd %xmm1, %xmm1
movss 0x29c(%rsp), %xmm2
cvtss2sd %xmm2, %xmm2
leaq 0x278(%rsp), %rdi
callq 0x6eb50
movq 0x108(%rsp), %rdi
movq 0x38(%rdi), %rdx
movslq 0x318(%rsp), %rax
imulq $0x98, %rax, %rax
addq %rax, %rdx
movq (%rdi), %rax
leaq 0x278(%rsp), %rsi
callq *0x20(%rax)
movq %rax, 0x270(%rsp)
cmpl $0x0, 0x2c0(%rsp)
je 0x2f481
movss 0x2a0(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
movss 0x2a4(%rsp), %xmm1
cvtss2sd %xmm1, %xmm1
movss 0x2a8(%rsp), %xmm2
cvtss2sd %xmm2, %xmm2
leaq 0x258(%rsp), %rdi
callq 0x6fcb0
movq 0x108(%rsp), %rdi
movq 0x270(%rsp), %rsi
leaq 0x258(%rsp), %rdx
callq 0x37610
cmpl $0x0, 0x2bc(%rsp)
je 0x2f4cf
movss 0x2ac(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
movss 0x2b0(%rsp), %xmm1
cvtss2sd %xmm1, %xmm1
leaq 0x248(%rsp), %rdi
callq 0xc3140
movq 0x108(%rsp), %rdi
movq 0x270(%rsp), %rsi
leaq 0x248(%rsp), %rdx
callq 0x376a0
cmpl $0x0, 0x2b8(%rsp)
je 0x2f54b
movzbl 0x2b4(%rsp), %eax
cvtsi2sd %eax, %xmm0
movsd 0x103d33(%rip), %xmm1   # 0x133220
divsd %xmm1, %xmm0
movzbl 0x2b5(%rsp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x103d1b(%rip), %xmm2   # 0x133220
divsd %xmm2, %xmm1
movzbl 0x2b6(%rsp), %eax
cvtsi2sd %eax, %xmm2
movsd 0x103d03(%rip), %xmm3   # 0x133220
divsd %xmm3, %xmm2
leaq 0x230(%rsp), %rdi
callq 0xd14d0
movq 0x108(%rsp), %rdi
movq 0x270(%rsp), %rsi
leaq 0x230(%rsp), %rdx
callq 0x37670
jmp 0x2f54d
movl 0x318(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x318(%rsp)
jmp 0x2f395
jmp 0x30557
movq 0x2e0(%rsp), %rsi
leaq 0x1040f6(%rip), %rdi    # 0x13366d
callq 0x734b0
cmpl $0x0, %eax
je 0x2fee7
movq 0x108(%rsp), %rdi
addq $0x28, %rdi
movl 0x2ec(%rsp), %esi
callq 0xd1a80
movl $0x0, 0x318(%rsp)
movl 0x318(%rsp), %eax
cmpl 0x2f0(%rsp), %eax
jge 0x2f754
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x104035(%rip), %rdi    # 0x13360f
callq 0x734b0
cmpl $0x0, %eax
je 0x2f605
movq 0x310(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
leaq 0x1400f5(%rip), %rdx    # 0x16f6f0
callq 0x73ce0
jmp 0x2f73c
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x103ffb(%rip), %rdi    # 0x13361e
callq 0x734b0
cmpl $0x0, %eax
je 0x2f652
movq 0x310(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
leaq 0x1400ac(%rip), %rdx    # 0x16f6f0
addq $0x28, %rdx
callq 0x73ce0
jmp 0x2f73a
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x103fbb(%rip), %rdi    # 0x13362b
callq 0x734b0
cmpl $0x0, %eax
je 0x2f69f
movq 0x310(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
leaq 0x14005f(%rip), %rdx    # 0x16f6f0
addq $0x50, %rdx
callq 0x73ce0
jmp 0x2f738
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x103f7a(%rip), %rdi    # 0x133637
callq 0x734b0
cmpl $0x0, %eax
je 0x2f6e9
movq 0x310(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
leaq 0x140012(%rip), %rdx    # 0x16f6f0
addq $0x78, %rdx
callq 0x73ce0
jmp 0x2f736
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x103f3b(%rip), %rdi    # 0x133642
callq 0x734b0
cmpl $0x0, %eax
je 0x2f734
movq 0x310(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
leaq 0x13ffc8(%rip), %rdx    # 0x16f6f0
addq $0xa0, %rdx
callq 0x73ce0
jmp 0x2f736
jmp 0x2f738
jmp 0x2f73a
jmp 0x2f73c
jmp 0x2f73e
movl 0x318(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x318(%rsp)
jmp 0x2f5a8
leaq 0x220(%rsp), %rdi
callq 0x36800
movslq 0x2ec(%rsp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0xf030
movq %rax, 0xb8(%rsp)
jmp 0x2f78e
movq 0xb8(%rsp), %rax
movq %rax, 0x218(%rsp)
movslq 0x2ec(%rsp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0xf030
movq %rax, 0xb0(%rsp)
jmp 0x2f7cb
movq 0xb0(%rsp), %rax
movq %rax, 0x210(%rsp)
movslq 0x2ec(%rsp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0xf030
movq %rax, 0xa8(%rsp)
jmp 0x2f808
movq 0xa8(%rsp), %rax
movq %rax, 0x208(%rsp)
movl $0x0, 0x204(%rsp)
movl $0x0, 0x318(%rsp)
movl 0x318(%rsp), %eax
cmpl 0x2ec(%rsp), %eax
jge 0x2fb6b
movb $0x0, 0x1e0(%rsp)
movq $0x0, 0x1e8(%rsp)
movl $0xffffffff, 0x1f0(%rsp) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x1f4(%rsp) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x1f8(%rsp) # imm = 0xFFFFFFFF
movq 0x310(%rsp), %rdi
leaq 0x1e0(%rsp), %rsi
callq 0x73dc0
jmp 0x2f88e
movq 0x108(%rsp), %rdi
addq $0x8, %rdi
movq 0x1e8(%rsp), %rax
movl (%rax), %esi
callq 0x37800
movq %rax, 0xa0(%rsp)
jmp 0x2f8b3
movq 0xa0(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x1d8(%rsp)
movl $0x2, 0x1d4(%rsp)
movl 0x1d4(%rsp), %eax
movzbl 0x1e0(%rsp), %ecx
cmpl %ecx, %eax
jge 0x2fb3b
movq 0x108(%rsp), %rdi
addq $0x8, %rdi
movq 0x1e8(%rsp), %rax
movl 0x1d4(%rsp), %ecx
decl %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %esi
callq 0x37800
movq %rax, 0x98(%rsp)
jmp 0x2f91a
movq 0x108(%rsp), %rdi
movq 0x98(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x1c8(%rsp)
addq $0x8, %rdi
movq 0x1e8(%rsp), %rax
movslq 0x1d4(%rsp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x37800
movq %rax, 0x90(%rsp)
jmp 0x2f95b
movq 0x90(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x1c0(%rsp)
movq 0x1d8(%rsp), %rax
cmpq 0x1c8(%rsp), %rax
je 0x2f9a4
movq 0x1c8(%rsp), %rax
cmpq 0x1c0(%rsp), %rax
je 0x2f9a4
movq 0x1d8(%rsp), %rax
cmpq 0x1c0(%rsp), %rax
jne 0x2f9cf
jmp 0x2fb25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c8(%rsp)
movl %eax, 0x2c4(%rsp)
leaq 0x220(%rsp), %rdi
callq 0x36850
jmp 0x30596
movq 0x108(%rsp), %rdi
movq 0x1d8(%rsp), %rsi
movq 0x1c8(%rsp), %rdx
movq 0x1c0(%rsp), %rcx
movq (%rdi), %rax
movq 0x48(%rax), %rax
xorl %r8d, %r8d
callq *%rax
movq %rax, 0x88(%rsp)
jmp 0x2fa05
movq 0x88(%rsp), %rax
movq %rax, 0x1b8(%rsp)
cmpq $0x0, 0x1b8(%rsp)
je 0x2fa7f
movq 0x108(%rsp), %rdi
movq 0x1b8(%rsp), %rsi
movl 0x1f0(%rsp), %edx
callq 0x369c0
jmp 0x2fa3e
movq 0x108(%rsp), %rdi
movq 0x1b8(%rsp), %rsi
movl 0x1f4(%rsp), %edx
callq 0x36a00
jmp 0x2fa5c
movq 0x108(%rsp), %rdi
movq 0x1b8(%rsp), %rsi
movl 0x1f8(%rsp), %edx
callq 0x36a40
jmp 0x2fa7a
jmp 0x2fb23
movq 0x1d8(%rsp), %rsi
leaq 0x220(%rsp), %rdi
callq 0x37410
jmp 0x2fa96
movq 0x1c8(%rsp), %rsi
leaq 0x220(%rsp), %rdi
callq 0x37410
jmp 0x2faad
movq 0x1c0(%rsp), %rsi
leaq 0x220(%rsp), %rdi
callq 0x37410
jmp 0x2fac4
movl 0x1f0(%rsp), %edx
movq 0x218(%rsp), %rax
movslq 0x204(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x1f4(%rsp), %edx
movq 0x210(%rsp), %rax
movslq 0x204(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x1f8(%rsp), %edx
movq 0x208(%rsp), %rax
movslq 0x204(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x204(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x204(%rsp)
jmp 0x2fb25
movl 0x1d4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1d4(%rsp)
jmp 0x2f8d1
cmpq $0x0, 0x1e8(%rsp)
je 0x2fb53
movq 0x1e8(%rsp), %rdi
callq 0xf5f0
jmp 0x2fb55
movl 0x318(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x318(%rsp)
jmp 0x2f82e
movl $0x0, 0x1b4(%rsp)
movl 0x1b4(%rsp), %eax
cmpl 0x204(%rsp), %eax
jge 0x2fe7e
movl 0x1b4(%rsp), %ecx
movl %ecx, %eax
leal (%rax,%rax,2), %esi
leaq 0x220(%rsp), %rdi
callq 0x377e0
movq %rax, 0x80(%rsp)
jmp 0x2fbad
movq 0x80(%rsp), %rax
movq %rax, 0x1a8(%rsp)
movl 0x1b4(%rsp), %ecx
movl %ecx, %eax
leal 0x1(%rax,%rax,2), %esi
leaq 0x220(%rsp), %rdi
callq 0x377e0
movq %rax, 0x78(%rsp)
jmp 0x2fbde
movq 0x78(%rsp), %rax
movq %rax, 0x1a0(%rsp)
movl 0x1b4(%rsp), %ecx
movl %ecx, %eax
leal 0x2(%rax,%rax,2), %esi
leaq 0x220(%rsp), %rdi
callq 0x377e0
movq %rax, 0x70(%rsp)
jmp 0x2fc0c
movq 0x108(%rsp), %rdi
movq 0x70(%rsp), %rax
movq %rax, 0x198(%rsp)
movq 0x1a8(%rsp), %rsi
movq 0x1a0(%rsp), %rdx
movq 0x198(%rsp), %rcx
movq (%rdi), %rax
movq 0x48(%rax), %rax
xorl %r8d, %r8d
callq *%rax
movq %rax, 0x68(%rsp)
jmp 0x2fc4c
movq 0x68(%rsp), %rax
movq %rax, 0x190(%rsp)
cmpq $0x0, 0x190(%rsp)
jne 0x2fdd7
movq 0x108(%rsp), %rdi
movq 0x1a8(%rsp), %rsi
movq 0x198(%rsp), %rdx
movq 0x1a0(%rsp), %rcx
movq (%rdi), %rax
movq 0x48(%rax), %rax
xorl %r8d, %r8d
callq *%rax
movq %rax, 0x60(%rsp)
jmp 0x2fc9b
movq 0x60(%rsp), %rax
movq %rax, 0x190(%rsp)
cmpq $0x0, 0x190(%rsp)
jne 0x2fdd5
movq 0x108(%rsp), %rdi
movq 0x1a8(%rsp), %rsi
callq 0x13660
movq %rax, 0x58(%rsp)
jmp 0x2fcd3
movq 0x58(%rsp), %rsi
movq 0x108(%rsp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
xorl %ecx, %ecx
movl %ecx, %edx
callq *%rax
movq %rax, 0x50(%rsp)
jmp 0x2fcf4
movq 0x108(%rsp), %rdi
movq 0x50(%rsp), %rax
movq %rax, 0x188(%rsp)
movq 0x1a0(%rsp), %rsi
callq 0x13660
movq %rax, 0x48(%rsp)
jmp 0x2fd1d
movq 0x48(%rsp), %rsi
movq 0x108(%rsp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
xorl %ecx, %ecx
movl %ecx, %edx
callq *%rax
movq %rax, 0x40(%rsp)
jmp 0x2fd3e
movq 0x108(%rsp), %rdi
movq 0x40(%rsp), %rax
movq %rax, 0x180(%rsp)
movq 0x198(%rsp), %rsi
callq 0x13660
movq %rax, 0x38(%rsp)
jmp 0x2fd67
movq 0x38(%rsp), %rsi
movq 0x108(%rsp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
xorl %ecx, %ecx
movl %ecx, %edx
callq *%rax
movq %rax, 0x30(%rsp)
jmp 0x2fd88
movq 0x108(%rsp), %rdi
movq 0x30(%rsp), %rax
movq %rax, 0x178(%rsp)
movq 0x188(%rsp), %rsi
movq 0x180(%rsp), %rdx
movq 0x178(%rsp), %rcx
movq (%rdi), %rax
movq 0x48(%rax), %rax
xorl %r8d, %r8d
callq *%rax
movq %rax, 0x28(%rsp)
jmp 0x2fdc8
movq 0x28(%rsp), %rax
movq %rax, 0x190(%rsp)
jmp 0x2fdd7
cmpq $0x0, 0x190(%rsp)
je 0x2fe66
movq 0x108(%rsp), %rdi
movq 0x190(%rsp), %rsi
movq 0x218(%rsp), %rax
movslq 0x1b4(%rsp), %rcx
movl (%rax,%rcx,4), %edx
callq 0x369c0
jmp 0x2fe10
movq 0x108(%rsp), %rdi
movq 0x190(%rsp), %rsi
movq 0x210(%rsp), %rax
movslq 0x1b4(%rsp), %rcx
movl (%rax,%rcx,4), %edx
callq 0x36a00
jmp 0x2fe3a
movq 0x108(%rsp), %rdi
movq 0x190(%rsp), %rsi
movq 0x208(%rsp), %rax
movslq 0x1b4(%rsp), %rcx
movl (%rax,%rcx,4), %edx
callq 0x36a40
jmp 0x2fe64
jmp 0x2fe66
jmp 0x2fe68
movl 0x1b4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1b4(%rsp)
jmp 0x2fb76
movq 0x218(%rsp), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, %rax
je 0x2fe9b
movq 0x20(%rsp), %rdi
callq 0xf670
movq 0x210(%rsp), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, %rax
je 0x2feb8
movq 0x18(%rsp), %rdi
callq 0xf670
movq 0x208(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x2fed5
movq 0x10(%rsp), %rdi
callq 0xf670
leaq 0x220(%rsp), %rdi
callq 0x36850
jmp 0x30555
movq 0x2e0(%rsp), %rsi
leaq 0x10377c(%rip), %rdi    # 0x133672
callq 0x734b0
cmpl $0x0, %eax
je 0x30537
movl $0x0, 0x174(%rsp)
movq 0x310(%rsp), %rdi
leaq 0x174(%rsp), %rsi
callq 0x745e0
movq %rax, 0x168(%rsp)
movl $0x0, 0x164(%rsp)
movl 0x164(%rsp), %eax
cmpl 0x174(%rsp), %eax
jge 0x30062
movq 0x168(%rsp), %rax
movslq 0x164(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0xd4c30
movq %rax, 0x158(%rsp)
movq 0x158(%rsp), %rdi
leaq 0x103702(%rip), %rsi    # 0x13367d
callq 0xf7c0
movq %rax, 0x150(%rsp)
cmpq $0x0, 0x150(%rsp)
je 0x3003f
movq 0x150(%rsp), %rdi
leaq 0x1036db(%rip), %rsi    # 0x133681
callq 0xf700
cmpl $0x0, %eax
jne 0x2ffe9
xorl %eax, %eax
movl %eax, %edi
leaq 0x1036c2(%rip), %rsi    # 0x13367d
callq 0xf7c0
movq %rax, 0x150(%rsp)
cmpq $0x0, 0x150(%rsp)
je 0x2ffe7
movq 0x150(%rsp), %rdi
callq 0xf7b0
movl %eax, 0x2d8(%rsp)
jmp 0x3003d
movq 0x150(%rsp), %rdi
leaq 0x103692(%rip), %rsi    # 0x13368a
callq 0xf700
cmpl $0x0, %eax
jne 0x3003b
xorl %eax, %eax
movl %eax, %edi
leaq 0x103670(%rip), %rsi    # 0x13367d
callq 0xf7c0
movq %rax, 0x150(%rsp)
cmpq $0x0, 0x150(%rsp)
je 0x30039
movq 0x150(%rsp), %rdi
callq 0xf7b0
movl %eax, 0x2d4(%rsp)
jmp 0x3003b
jmp 0x3003d
jmp 0x3003f
movq 0x158(%rsp), %rdi
callq 0xf5f0
movl 0x164(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x164(%rsp)
jmp 0x2ff37
cmpl $0x0, 0x2d4(%rsp)
jle 0x30535
cmpl $0x0, 0x2d8(%rsp)
jle 0x30535
movl 0x2d4(%rsp), %eax
imull 0x2d8(%rsp), %eax
cmpl 0x2ec(%rsp), %eax
jne 0x30535
movslq 0x2ec(%rsp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0xf030
movq %rax, 0x148(%rsp)
movl $0x0, 0x318(%rsp)
movl 0x318(%rsp), %eax
cmpl 0x2ec(%rsp), %eax
jge 0x30111
movq 0x148(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq $0x0, (%rax,%rcx,8)
movl 0x318(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x318(%rsp)
jmp 0x300d6
movl $0x0, 0x318(%rsp)
movl 0x318(%rsp), %eax
cmpl 0x2f0(%rsp), %eax
jge 0x30185
movq 0x300(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
leaq 0x1034c5(%rip), %rdi    # 0x13360f
callq 0x734b0
cmpl $0x0, %eax
je 0x30170
movq 0x310(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
leaq 0x13f655(%rip), %rdx    # 0x16f7c0
callq 0x73ce0
jmp 0x30172
movl 0x318(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x318(%rsp)
jmp 0x3011c
movl $0x0, 0x318(%rsp)
movl 0x318(%rsp), %eax
cmpl 0x2ec(%rsp), %eax
jge 0x3023e
movb $0x0, 0x138(%rsp)
movq $0x0, 0x140(%rsp)
movq 0x310(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x73dc0
cmpq $0x0, 0x140(%rsp)
jne 0x301da
jmp 0x30228
movzbl 0x138(%rsp), %eax
cmpl $0x0, %eax
jne 0x301e9
jmp 0x30228
movq 0x108(%rsp), %rdi
addq $0x8, %rdi
movq 0x140(%rsp), %rax
movl (%rax), %esi
callq 0x37800
movq (%rax), %rdx
movq 0x148(%rsp), %rax
movslq 0x318(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x140(%rsp), %rdi
callq 0xf5f0
movl 0x318(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x318(%rsp)
jmp 0x30190
movl $0x0, 0x134(%rsp)
movl 0x134(%rsp), %eax
movl 0x2d8(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x30516
movl $0x0, 0x130(%rsp)
movl 0x130(%rsp), %eax
movl 0x2d4(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x304fe
movq 0x148(%rsp), %rax
movl 0x134(%rsp), %ecx
imull 0x2d4(%rsp), %ecx
addl 0x130(%rsp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x128(%rsp)
movq 0x148(%rsp), %rax
movl 0x134(%rsp), %ecx
addl $0x1, %ecx
imull 0x2d4(%rsp), %ecx
addl 0x130(%rsp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x120(%rsp)
movq 0x148(%rsp), %rax
movl 0x134(%rsp), %ecx
imull 0x2d4(%rsp), %ecx
movl 0x130(%rsp), %edx
addl $0x1, %edx
addl %edx, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x118(%rsp)
movq 0x148(%rsp), %rax
movl 0x134(%rsp), %ecx
addl $0x1, %ecx
imull 0x2d4(%rsp), %ecx
movl 0x130(%rsp), %edx
addl $0x1, %edx
addl %edx, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x110(%rsp)
cmpq $0x0, 0x128(%rsp)
je 0x30492
cmpq $0x0, 0x120(%rsp)
je 0x30449
cmpq $0x0, 0x118(%rsp)
je 0x3040d
cmpq $0x0, 0x110(%rsp)
je 0x303de
movq 0x108(%rsp), %rdi
movq 0x128(%rsp), %rsi
movq 0x118(%rsp), %rdx
movq 0x110(%rsp), %rcx
movsd 0x102e4e(%rip), %xmm0   # 0x1331f8
callq 0x305b0
movq 0x108(%rsp), %rdi
movq 0x128(%rsp), %rsi
movq 0x110(%rsp), %rdx
movq 0x120(%rsp), %rcx
movsd 0x102e21(%rip), %xmm0   # 0x1331f8
callq 0x305b0
jmp 0x3040b
movq 0x108(%rsp), %rdi
movq 0x128(%rsp), %rsi
movq 0x118(%rsp), %rdx
movq 0x120(%rsp), %rcx
movsd 0x102df2(%rip), %xmm0   # 0x1331f8
callq 0x305b0
jmp 0x30447
cmpq $0x0, 0x110(%rsp)
je 0x30445
movq 0x108(%rsp), %rdi
movq 0x128(%rsp), %rsi
movq 0x110(%rsp), %rdx
movq 0x120(%rsp), %rcx
movsd 0x102db8(%rip), %xmm0   # 0x1331f8
callq 0x305b0
jmp 0x30447
jmp 0x30490
cmpq $0x0, 0x118(%rsp)
je 0x3048e
cmpq $0x0, 0x110(%rsp)
je 0x3048c
movq 0x108(%rsp), %rdi
movq 0x128(%rsp), %rsi
movq 0x118(%rsp), %rdx
movq 0x110(%rsp), %rcx
movsd 0x102d71(%rip), %xmm0   # 0x1331f8
callq 0x305b0
jmp 0x3048e
jmp 0x30490
jmp 0x304e6
cmpq $0x0, 0x120(%rsp)
je 0x304e4
cmpq $0x0, 0x118(%rsp)
je 0x304e2
cmpq $0x0, 0x110(%rsp)
je 0x304e0
movq 0x108(%rsp), %rdi
movq 0x118(%rsp), %rsi
movq 0x110(%rsp), %rdx
movq 0x120(%rsp), %rcx
movsd 0x102d1d(%rip), %xmm0   # 0x1331f8
callq 0x305b0
jmp 0x304e2
jmp 0x304e4
jmp 0x304e6
jmp 0x304e8
movl 0x130(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x130(%rsp)
jmp 0x3026d
jmp 0x30500
movl 0x134(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x134(%rsp)
jmp 0x30249
movq 0x148(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0x30533
movq 0x8(%rsp), %rdi
callq 0xf670
jmp 0x30535
jmp 0x30553
movq 0x310(%rsp), %rdi
movq 0x2e0(%rsp), %rsi
movl 0x2ec(%rsp), %edx
callq 0x74950
jmp 0x30555
jmp 0x30557
jmp 0x30559
movl 0x31c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x31c(%rsp)
jmp 0x2ed30
movq 0x310(%rsp), %rdi
callq 0xf5f0
movl $0x1, 0x334(%rsp)
movl 0x334(%rsp), %eax
addq $0x338, %rsp            # imm = 0x338
retq
movq 0x2c8(%rsp), %rdi
callq 0xf890
nopw %cs:(%rax,%rax)