// File: tomfunkhouser[P]gaps/apps/mshparam/mshparam.cpp
// Function: CreateSegments(gaps::R3Mesh*, gaps::RNArray<Segment*>&)
static int 
CreateSegments(R3Mesh *mesh, RNArray<Segment *>& segments)
{
  // Remember original vertices
  RNArray<R3MeshVertex *> original_vertices;
  for (int i = 0; i < mesh->NVertices(); i++) {
    R3MeshVertex *original_vertex = mesh->Vertex(i);
    original_vertices.Insert(original_vertex);
  }

  // Remember original faces
  RNArray<R3MeshFace *> original_faces;
  for (int i = 0; i < mesh->NFaces(); i++) {
    R3MeshFace *original_face = mesh->Face(i);
    original_faces.Insert(original_face);
  }
  
  // Create segments
  RNMap<int, Segment *> segment_map;
  R3MeshVertex *segment_face_vertices[3];
  for (int i = 0; i < original_faces.NEntries(); i++) {
    R3MeshFace *original_face = original_faces.Kth(i);
    int id = 0;
    if (separate_face_segments) id = mesh->FaceSegment(original_face);
    else if (separate_face_materials) id = mesh->FaceMaterial(original_face);

    // Find segment
    Segment *segment = NULL;
    if (!segment_map.Find(id, &segment)) {
      segment = new Segment();
      segment->mesh = mesh;
      segment->matrix = R4identity_matrix;
      segment->bbox = R2null_box;
      segment->id = id;
      segment->index = segments.NEntries();
      segment_map.Insert(id, segment);
      segments.Insert(segment);
    }

    // Find/insert copy of vertices into segment
    for (int j = 0; j < 3; j++) {
      R3MeshVertex *original_vertex = mesh->VertexOnFace(original_face, j);

      // Find/insert vertex in segment
      R3MeshVertex *segment_vertex = NULL;
      if (!segment->vertex_map.Find(original_vertex, &segment_vertex)) {
        segment_vertex = mesh->CreateVertex(*original_vertex);
        assert(segment_vertex);
        segment->vertex_map.Insert(original_vertex, segment_vertex);
        segment->vertices.Insert(segment_vertex);
      }

      // Remember vertex for face
      segment_face_vertices[j] = segment_vertex;
    }
      
    // Insert copy of face into segment
    R3MeshFace *segment_face = mesh->CreateFace(segment_face_vertices[0], segment_face_vertices[1], segment_face_vertices[2]);
    assert(segment_face);
    mesh->SetFaceCategory(segment_face, mesh->FaceCategory(original_face));
    mesh->SetFaceSegment(segment_face, mesh->FaceSegment(original_face));
    mesh->SetFaceMaterial(segment_face, mesh->FaceMaterial(original_face));
    segment->faces.Insert(segment_face);
  }

  // Empty segment vertex maps (because will delete original vertices next)
  for (int i = 0; i < segments.NEntries(); i++) {
    Segment *segment = segments.Kth(i);
    segment->vertex_map.Empty();
  }

  // Delete original faces
  for (int i = 0; i < original_faces.NEntries(); i++) {
    R3MeshFace *original_face = original_faces.Kth(i);
    mesh->DeleteFace(original_face);
  }

  // Delete original vertices
  for (int i = 0; i < original_vertices.NEntries(); i++) {
    R3MeshVertex *original_vertex = original_vertices.Kth(i);
    mesh->DeleteVertex(original_vertex);
  }

  // Process segments
  for (int i = 0; i < segments.NEntries(); i++) {
    Segment *segment = segments.Kth(i);

    // Gather info for vertices of segment
    RNArray<R3Point *> points;
    R3Vector sum_of_normals = R3zero_vector;
    for (int i = 0; i < segment->vertices.NEntries(); i++) {
      R3MeshVertex *vertex = segment->vertices.Kth(i);
      sum_of_normals += mesh->VertexNormal(vertex);
      points.Insert((R3Point *) &(mesh->VertexPosition(vertex)));
    }

    // Create a coordinate system for segment
    R3Point centroid = R3Centroid(points);
    R3Triad triad = R3PrincipleAxes(centroid, points);
    if (triad[2].Dot(sum_of_normals) < 0) triad.Rotate(triad[0], RN_PI);
    R3CoordSystem cs(centroid, triad);
    segment->matrix = cs.InverseMatrix();

    // SOMEHOW THE PARAMETERIZATION FOR 1/2 OF SEGMENTS IS FLIPPED BACKWARDS

    // Determine extent of segment in texture coordinates
    segment->bbox = R2null_box;
    for (int j = 0; j < segment->vertices.NEntries(); j++) {
      R3MeshVertex *vertex = segment->vertices.Kth(j);
      R3Point position = mesh->VertexPosition(vertex);
      position = segment->matrix * position;
      R2Point texcoords(position.X(), position.Y());
      segment->bbox.Union(texcoords);
    }
  }

  // Sort segments by ylength
  segments.Sort(CompareSegments);
  
  // Return success
  return 1;
}

// Assembly:
subq $0x438, %rsp            # imm = 0x438
movq %rdi, 0x430(%rsp)
movq %rsi, 0x428(%rsp)
leaq 0x418(%rsp), %rdi
callq 0x162f0
movl $0x0, 0x414(%rsp)
movl 0x414(%rsp), %eax
movl %eax, 0x164(%rsp)
movq 0x430(%rsp), %rdi
callq 0x162a0
movl %eax, %ecx
movl 0x164(%rsp), %eax
cmpl %ecx, %eax
jge 0x1511d
movq 0x430(%rsp), %rdi
movl 0x414(%rsp), %esi
callq 0x16300
movq %rax, 0x158(%rsp)
jmp 0x150c5
movq 0x158(%rsp), %rax
movq %rax, 0x408(%rsp)
movq 0x408(%rsp), %rsi
leaq 0x418(%rsp), %rdi
callq 0x16330
jmp 0x150ec
jmp 0x150ee
movl 0x414(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x414(%rsp)
jmp 0x1507f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x400(%rsp)
movl %eax, 0x3fc(%rsp)
jmp 0x15d55
leaq 0x3e8(%rsp), %rdi
callq 0x16360
jmp 0x1512c
movl $0x0, 0x3e4(%rsp)
movl 0x3e4(%rsp), %eax
movl %eax, 0x150(%rsp)
movq 0x430(%rsp), %rdi
callq 0x16260
movl %eax, 0x154(%rsp)
jmp 0x1515b
movl 0x150(%rsp), %eax
movl 0x154(%rsp), %ecx
cmpl %ecx, %eax
jge 0x151e3
movq 0x430(%rsp), %rdi
movl 0x3e4(%rsp), %esi
callq 0x16370
movq %rax, 0x148(%rsp)
jmp 0x1518b
movq 0x148(%rsp), %rax
movq %rax, 0x3d8(%rsp)
movq 0x3d8(%rsp), %rsi
leaq 0x3e8(%rsp), %rdi
callq 0x163a0
jmp 0x151b2
jmp 0x151b4
movl 0x3e4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3e4(%rsp)
jmp 0x15137
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x400(%rsp)
movl %eax, 0x3fc(%rsp)
jmp 0x15d48
leaq 0x3d0(%rsp), %rdi
callq 0x163d0
jmp 0x151f2
movl $0x0, 0x3ac(%rsp)
movl 0x3ac(%rsp), %eax
movl %eax, 0x144(%rsp)
leaq 0x3e8(%rsp), %rdi
callq 0x162c0
movl %eax, %ecx
movl 0x144(%rsp), %eax
cmpl %ecx, %eax
jge 0x1573a
movl 0x3ac(%rsp), %esi
leaq 0x3e8(%rsp), %rdi
callq 0x16450
movq %rax, 0x138(%rsp)
jmp 0x15247
movq 0x138(%rsp), %rax
movq %rax, 0x3a0(%rsp)
movl $0x0, 0x39c(%rsp)
cmpl $0x0, 0x148ac3(%rip)    # 0x15dd2c
je 0x152b2
movq 0x430(%rsp), %rdi
movq 0x3a0(%rsp), %rsi
callq 0x16470
movl %eax, 0x134(%rsp)
jmp 0x15289
movl 0x134(%rsp), %eax
movl %eax, 0x39c(%rsp)
jmp 0x152e9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x400(%rsp)
movl %eax, 0x3fc(%rsp)
jmp 0x15d3b
cmpl $0x0, 0x148a77(%rip)    # 0x15dd30
je 0x152e7
movq 0x430(%rsp), %rdi
movq 0x3a0(%rsp), %rsi
callq 0x16490
movl %eax, 0x130(%rsp)
jmp 0x152d9
movl 0x130(%rsp), %eax
movl %eax, 0x39c(%rsp)
jmp 0x152e9
movq $0x0, 0x390(%rsp)
movl 0x39c(%rsp), %esi
leaq 0x3d0(%rsp), %rdi
leaq 0x390(%rsp), %rdx
callq 0x164b0
movl %eax, 0x12c(%rsp)
jmp 0x1531a
movl 0x12c(%rsp), %eax
cmpl $0x0, %eax
jne 0x1548f
movl $0xe0, %edi
callq 0xf4b0
movq %rax, 0x120(%rsp)
jmp 0x1533e
movq 0x120(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0x110(%rsp)
movaps %xmm0, 0xd0(%rdi)
movaps %xmm0, 0xc0(%rdi)
movaps %xmm0, 0xb0(%rdi)
movaps %xmm0, 0xa0(%rdi)
movaps %xmm0, 0x90(%rdi)
movaps %xmm0, 0x80(%rdi)
movaps %xmm0, 0x70(%rdi)
movaps %xmm0, 0x60(%rdi)
movaps %xmm0, 0x50(%rdi)
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
callq 0x16540
jmp 0x153a1
movq 0x120(%rsp), %rax
movq %rax, 0x390(%rsp)
movq 0x430(%rsp), %rcx
movq 0x390(%rsp), %rax
movq %rcx, (%rax)
movq 0x390(%rsp), %rdi
addq $0x30, %rdi
leaq 0x149019(%rip), %rsi    # 0x15e3f0
callq 0x5d990
jmp 0x153de
movq 0x390(%rsp), %rdi
addq $0xb0, %rdi
leaq 0x14a984(%rip), %rsi    # 0x15fd78
callq 0x16610
jmp 0x153fb
movl 0x39c(%rsp), %ecx
movq 0x390(%rsp), %rax
movl %ecx, 0xd8(%rax)
movq 0x428(%rsp), %rdi
callq 0x162c0
movl %eax, %ecx
movq 0x390(%rsp), %rax
movl %ecx, 0xdc(%rax)
movl 0x39c(%rsp), %esi
movq 0x390(%rsp), %rdx
leaq 0x3d0(%rsp), %rdi
callq 0x16670
jmp 0x1544b
movq 0x428(%rsp), %rdi
movq 0x390(%rsp), %rsi
callq 0x166b0
jmp 0x15462
jmp 0x1548f
movq 0x120(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x400(%rsp)
movl %eax, 0x3fc(%rsp)
movl $0xe0, %esi
callq 0xf4c0
jmp 0x15d3b
movl $0x0, 0x38c(%rsp)
cmpl $0x3, 0x38c(%rsp)
jge 0x155c5
movq 0x430(%rsp), %rdi
movq 0x3a0(%rsp), %rsi
movl 0x38c(%rsp), %edx
callq 0x166e0
movq %rax, 0x108(%rsp)
jmp 0x154ce
movq 0x108(%rsp), %rax
movq %rax, 0x380(%rsp)
movq $0x0, 0x378(%rsp)
movq 0x390(%rsp), %rdi
addq $0x28, %rdi
movq 0x380(%rsp), %rsi
leaq 0x378(%rsp), %rdx
callq 0x16700
movl %eax, 0x104(%rsp)
jmp 0x15514
movl 0x104(%rsp), %eax
cmpl $0x0, %eax
jne 0x15597
movq 0x430(%rsp), %rdi
movq 0x380(%rsp), %rsi
movq (%rdi), %rax
movq 0x18(%rax), %rax
xorl %ecx, %ecx
movl %ecx, %edx
callq *%rax
movq %rax, 0xf8(%rsp)
jmp 0x15547
movq 0xf8(%rsp), %rax
movq %rax, 0x378(%rsp)
movq 0x390(%rsp), %rdi
addq $0x28, %rdi
movq 0x380(%rsp), %rsi
movq 0x378(%rsp), %rdx
callq 0x16790
jmp 0x1557a
movq 0x390(%rsp), %rdi
addq $0x18, %rdi
movq 0x378(%rsp), %rsi
callq 0x16330
jmp 0x15595
jmp 0x15597
movq 0x378(%rsp), %rcx
movslq 0x38c(%rsp), %rax
movq %rcx, 0x3b0(%rsp,%rax,8)
movl 0x38c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x38c(%rsp)
jmp 0x1549a
movq 0x430(%rsp), %rdi
movq 0x3b0(%rsp), %rsi
movq 0x3b8(%rsp), %rdx
movq 0x3c0(%rsp), %rcx
movq (%rdi), %rax
movq 0x48(%rax), %rax
xorl %r8d, %r8d
callq *%rax
movq %rax, 0xf0(%rsp)
jmp 0x155fb
movq 0xf0(%rsp), %rax
movq %rax, 0x370(%rsp)
movq 0x430(%rsp), %rdi
movq %rdi, 0xd8(%rsp)
movq 0x370(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq 0x3a0(%rsp), %rsi
callq 0x167f0
movl %eax, 0xec(%rsp)
jmp 0x15641
movl 0xec(%rsp), %edx
movq 0xe0(%rsp), %rsi
movq 0xd8(%rsp), %rdi
callq 0x167d0
jmp 0x1565f
movq 0x430(%rsp), %rdi
movq %rdi, 0xc0(%rsp)
movq 0x370(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq 0x3a0(%rsp), %rsi
callq 0x16470
movl %eax, 0xd4(%rsp)
jmp 0x15695
movl 0xd4(%rsp), %edx
movq 0xc8(%rsp), %rsi
movq 0xc0(%rsp), %rdi
callq 0x16810
jmp 0x156b3
movq 0x430(%rsp), %rdi
movq %rdi, 0xa8(%rsp)
movq 0x370(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0x3a0(%rsp), %rsi
callq 0x16490
movl %eax, 0xbc(%rsp)
jmp 0x156e9
movl 0xbc(%rsp), %edx
movq 0xb0(%rsp), %rsi
movq 0xa8(%rsp), %rdi
callq 0x16830
jmp 0x15707
movq 0x390(%rsp), %rdi
addq $0x8, %rdi
movq 0x370(%rsp), %rsi
callq 0x163a0
jmp 0x15722
jmp 0x15724
movl 0x3ac(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3ac(%rsp)
jmp 0x151fd
movl $0x0, 0x36c(%rsp)
movl 0x36c(%rsp), %eax
movl %eax, 0xa4(%rsp)
movq 0x428(%rsp), %rdi
callq 0x162c0
movl %eax, %ecx
movl 0xa4(%rsp), %eax
cmpl %ecx, %eax
jge 0x157c3
movq 0x428(%rsp), %rdi
movl 0x36c(%rsp), %esi
callq 0x16850
movq %rax, 0x98(%rsp)
jmp 0x1578b
movq 0x98(%rsp), %rax
movq %rax, 0x360(%rsp)
movq 0x360(%rsp), %rdi
addq $0x28, %rdi
callq 0x16870
jmp 0x157ae
jmp 0x157b0
movl 0x36c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x36c(%rsp)
jmp 0x15745
movl $0x0, 0x35c(%rsp)
movl 0x35c(%rsp), %eax
movl %eax, 0x94(%rsp)
leaq 0x3e8(%rsp), %rdi
callq 0x162c0
movl %eax, %ecx
movl 0x94(%rsp), %eax
cmpl %ecx, %eax
jge 0x15857
movl 0x35c(%rsp), %esi
leaq 0x3e8(%rsp), %rdi
callq 0x16450
movq %rax, 0x88(%rsp)
jmp 0x15814
movq 0x88(%rsp), %rax
movq %rax, 0x350(%rsp)
movq 0x430(%rsp), %rdi
movq 0x350(%rsp), %rsi
movq (%rdi), %rax
movq 0x70(%rax), %rax
callq *%rax
jmp 0x1583f
jmp 0x15841
movl 0x35c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x35c(%rsp)
jmp 0x157ce
movl $0x0, 0x34c(%rsp)
movl 0x34c(%rsp), %eax
movl %eax, 0x84(%rsp)
leaq 0x418(%rsp), %rdi
callq 0x162c0
movl %eax, %ecx
movl 0x84(%rsp), %eax
cmpl %ecx, %eax
jge 0x158e2
movl 0x34c(%rsp), %esi
leaq 0x418(%rsp), %rdi
callq 0x16890
movq %rax, 0x78(%rsp)
jmp 0x158a5
movq 0x78(%rsp), %rax
movq %rax, 0x340(%rsp)
movq 0x430(%rsp), %rdi
movq 0x340(%rsp), %rsi
movq (%rdi), %rax
movq 0x60(%rax), %rax
callq *%rax
jmp 0x158cd
jmp 0x158cf
movl 0x34c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34c(%rsp)
jmp 0x15862
movl $0x0, 0x33c(%rsp)
movl 0x33c(%rsp), %eax
movl %eax, 0x74(%rsp)
movq 0x428(%rsp), %rdi
callq 0x162c0
movl %eax, %ecx
movl 0x74(%rsp), %eax
cmpl %ecx, %eax
jge 0x15cf1
movq 0x428(%rsp), %rdi
movl 0x33c(%rsp), %esi
callq 0x16850
movq %rax, 0x68(%rsp)
jmp 0x1592e
movq 0x68(%rsp), %rax
movq %rax, 0x330(%rsp)
leaq 0x320(%rsp), %rdi
callq 0x168b0
jmp 0x1594a
leaq 0x148fdf(%rip), %rsi    # 0x15e930
leaq 0x308(%rsp), %rdi
callq 0x62970
jmp 0x15960
movl $0x0, 0x304(%rsp)
movl 0x304(%rsp), %eax
movl %eax, 0x64(%rsp)
movq 0x330(%rsp), %rdi
addq $0x18, %rdi
callq 0x162c0
movl %eax, %ecx
movl 0x64(%rsp), %eax
cmpl %ecx, %eax
jge 0x15a5f
movq 0x330(%rsp), %rdi
addq $0x18, %rdi
movl 0x304(%rsp), %esi
callq 0x16890
movq %rax, 0x58(%rsp)
jmp 0x159b4
movq 0x58(%rsp), %rax
movq %rax, 0x2f8(%rsp)
movq 0x430(%rsp), %rdi
movq 0x2f8(%rsp), %rsi
callq 0x168c0
movq %rax, 0x50(%rsp)
jmp 0x159dd
movq 0x50(%rsp), %rsi
leaq 0x308(%rsp), %rdi
callq 0x63860
jmp 0x159f1
movq 0x430(%rsp), %rdi
movq 0x2f8(%rsp), %rsi
callq 0x16960
movq %rax, 0x48(%rsp)
jmp 0x15a0d
movq 0x48(%rsp), %rsi
leaq 0x320(%rsp), %rdi
callq 0x16930
jmp 0x15a21
jmp 0x15a23
movl 0x304(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x304(%rsp)
jmp 0x1596b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x400(%rsp)
movl %eax, 0x3fc(%rsp)
leaq 0x320(%rsp), %rdi
callq 0x169c0
jmp 0x15d3b
xorl %eax, %eax
movl %eax, %edx
leaq 0x2e0(%rsp), %rdi
leaq 0x320(%rsp), %rsi
callq 0x1a0b0
jmp 0x15a7a
xorl %eax, %eax
movl %eax, %r8d
leaq 0x298(%rsp), %rdi
leaq 0x2e0(%rsp), %rsi
leaq 0x320(%rsp), %rdx
movq %r8, %rcx
callq 0x1a1d0
jmp 0x15aa1
leaq 0x298(%rsp), %rdi
movl $0x2, %esi
callq 0x16980
movq %rax, 0x40(%rsp)
jmp 0x15aba
movq 0x40(%rsp), %rdi
leaq 0x308(%rsp), %rsi
callq 0x62f40
movsd %xmm0, 0x38(%rsp)
jmp 0x15ad4
movsd 0x38(%rsp), %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x15b1a
leaq 0x298(%rsp), %rdi
xorl %esi, %esi
callq 0x16980
movq %rax, 0x30(%rsp)
jmp 0x15af9
movq 0x30(%rsp), %rsi
leaq 0x10ebd3(%rip), %rax    # 0x1246d8
movsd (%rax), %xmm0
leaq 0x298(%rsp), %rdi
callq 0x58990
jmp 0x15b18
jmp 0x15b1a
leaq 0x238(%rsp), %rdi
leaq 0x2e0(%rsp), %rsi
leaq 0x298(%rsp), %rdx
callq 0x57c60
jmp 0x15b39
leaq 0x1b8(%rsp), %rdi
leaq 0x238(%rsp), %rsi
callq 0x57d30
jmp 0x15b50
movq 0x330(%rsp), %rdi
addq $0x30, %rdi
leaq 0x1b8(%rsp), %rsi
callq 0x5d990
jmp 0x15b6b
movq 0x330(%rsp), %rdi
addq $0xb0, %rdi
leaq 0x14a1f7(%rip), %rsi    # 0x15fd78
callq 0x16610
jmp 0x15b88
movl $0x0, 0x1b4(%rsp)
movl 0x1b4(%rsp), %eax
movl %eax, 0x2c(%rsp)
movq 0x330(%rsp), %rdi
addq $0x18, %rdi
callq 0x162c0
movl %eax, %ecx
movl 0x2c(%rsp), %eax
cmpl %ecx, %eax
jge 0x15cce
movq 0x330(%rsp), %rdi
addq $0x18, %rdi
movl 0x1b4(%rsp), %esi
callq 0x16890
movq %rax, 0x20(%rsp)
jmp 0x15bdc
movq 0x20(%rsp), %rax
movq %rax, 0x1a8(%rsp)
movq 0x430(%rsp), %rdi
movq 0x1a8(%rsp), %rsi
callq 0x16960
movq %rax, 0x18(%rsp)
jmp 0x15c05
movq 0x18(%rsp), %rsi
leaq 0x190(%rsp), %rdi
callq 0x61810
jmp 0x15c19
movq 0x330(%rsp), %rsi
addq $0x30, %rsi
leaq 0x178(%rsp), %rdi
leaq 0x190(%rsp), %rdx
callq 0x5e980
jmp 0x15c3c
leaq 0x190(%rsp), %rdi
leaq 0x178(%rsp), %rsi
callq 0x61e60
jmp 0x15c53
leaq 0x190(%rsp), %rdi
callq 0x169a0
movsd %xmm0, 0x10(%rsp)
jmp 0x15c68
leaq 0x190(%rsp), %rdi
callq 0x169b0
movsd %xmm0, 0x8(%rsp)
jmp 0x15c7d
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
leaq 0x168(%rsp), %rdi
callq 0xb2260
jmp 0x15c98
movq 0x330(%rsp), %rdi
addq $0xb0, %rdi
leaq 0x168(%rsp), %rsi
callq 0xad5d0
jmp 0x15cb6
jmp 0x15cb8
movl 0x1b4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1b4(%rsp)
jmp 0x15b93
leaq 0x320(%rsp), %rdi
callq 0x169c0
movl 0x33c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x33c(%rsp)
jmp 0x158ed
movq 0x428(%rsp), %rdi
leaq 0x480(%rip), %rsi       # 0x16180
callq 0xc10c0
jmp 0x15d07
leaq 0x3d0(%rsp), %rdi
callq 0x169d0
leaq 0x3e8(%rsp), %rdi
callq 0x16a10
leaq 0x418(%rsp), %rdi
callq 0x16a20
movl $0x1, %eax
addq $0x438, %rsp            # imm = 0x438
retq
leaq 0x3d0(%rsp), %rdi
callq 0x169d0
leaq 0x3e8(%rsp), %rdi
callq 0x16a10
leaq 0x418(%rsp), %rdi
callq 0x16a20
movq 0x400(%rsp), %rdi
callq 0xf830
nop