// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::ReadPlyFile(char const*, gaps::R3SceneNode*)
int R3Scene::
ReadPlyFile(const char *filename, R3SceneNode *parent_node)
{
  // Check/set parent node
  if (!parent_node) parent_node = root;

  // Read ply file
  R3Mesh mesh;
  if (!mesh.ReadFile(filename)) {
    RNFail("Unable to read mesh %s\n", filename);
    return 0;
  }
  
  // Create array of vertices
  RNArray<R3TriangleVertex *> vertices;
  for (int i = 0; i < mesh.NVertices(); i++) {
    R3MeshVertex *mesh_vertex = mesh.Vertex(i);
    const R3Point& position = mesh.VertexPosition(mesh_vertex);
    R3TriangleVertex *triangle_vertex = new R3TriangleVertex(position);
    if (!mesh.VertexColor(mesh_vertex).IsBlack()) triangle_vertex->SetColor(mesh.VertexColor(mesh_vertex));
    triangle_vertex->SetTextureCoords(mesh.VertexTextureCoords(mesh_vertex));
    triangle_vertex->SetSharedFlag();
    vertices.Insert(triangle_vertex);
  }

  // Check face segments and materials
  int max_face_segment = 0;
  int max_face_material = 0;
  for (int i = 0; i < mesh.NFaces(); i++) {
    R3MeshFace *face = mesh.Face(i);
    int face_segment = mesh.FaceSegment(face);
    int face_material = mesh.FaceMaterial(face);
    if (face_segment > max_face_segment) max_face_segment = face_segment;
    if (face_material > max_face_material) max_face_material = face_material;
  }

  // Create arrays of triangles
  char node_name[1024];
  RNArray<R3Triangle *> *tris_0_0 = NULL;
  RNSymbolTable<RNArray<R3Triangle *> *> triangles;
  for (int i = 0; i < mesh.NFaces(); i++) {
    R3MeshFace *mesh_face = mesh.Face(i);
    int face_segment = mesh.FaceSegment(mesh_face);
    if (face_segment < 0) face_segment = 0;
    int face_category = mesh.FaceCategory(mesh_face);
    if (face_category < 0) face_category = 0;
    int i0 = mesh.VertexID(mesh.VertexOnFace(mesh_face, 0));
    int i1 = mesh.VertexID(mesh.VertexOnFace(mesh_face, 1));
    int i2 = mesh.VertexID(mesh.VertexOnFace(mesh_face, 2));
    R3TriangleVertex *v0 = vertices.Kth(i0);
    R3TriangleVertex *v1 = vertices.Kth(i1);
    R3TriangleVertex *v2 = vertices.Kth(i2);
    R3Triangle *triangle = new R3Triangle(v0, v1, v2);
    RNArray<R3Triangle *> *tris = ((face_segment == 0) && (face_category == 0)) ? tris_0_0 : NULL; 
    if (!tris) {
      sprintf(node_name, "%d_%d", face_category, face_segment);
      if (!triangles.Find(node_name, &tris)) {
        tris = new RNArray<R3Triangle *>();
        if ((face_segment == 0) && (face_category == 0)) tris_0_0 = tris;
        triangles.Insert(node_name, tris);
      }
    }
    tris->Insert(triangle);
  }

  // Create node for each set of triangles
  std::map<std::string, RNArray<R3Triangle *> *, RNMapComparator< std::string > >::iterator it;
  for (it = triangles.m->begin(); it != triangles.m->end(); it++) {
    std::string node_name = it->first;
    RNArray<R3Triangle *> *tris = it->second;
    if (tris->IsEmpty()) { delete tris; continue; }
    R3SceneNode *node = new R3SceneNode(this);
    if (!InsertSceneElement(this, node, NULL, vertices, *tris)) return 0;
    node->SetName(node_name.c_str());
    const char *category_separator = strchr(node_name.c_str(), '_');
    if (category_separator) node->InsertInfo("index", RNStrdup(category_separator+1));
    parent_node->InsertChild(node);
    for (int i = 0; i < tris->NEntries(); i++) delete tris->Kth(i);
    delete tris;
  }

  // Delete vertices 
  for (int i = 0; i < vertices.NEntries(); i++) delete vertices[i];
  
  // Return success
  return 1;
}

// Assembly:
subq $0x858, %rsp            # imm = 0x858
movq %rdi, 0x848(%rsp)
movq %rsi, 0x840(%rsp)
movq %rdx, 0x838(%rsp)
movq 0x848(%rsp), %rax
movq %rax, 0x180(%rsp)
cmpq $0x0, 0x838(%rsp)
jne 0x347ad
movq 0x180(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x838(%rsp)
leaq 0x700(%rsp), %rdi
movq %rdi, 0x170(%rsp)
callq 0x7dac0
movq 0x170(%rsp), %rdi
movq 0x840(%rsp), %rsi
callq 0x95b20
movl %eax, 0x17c(%rsp)
jmp 0x347e0
movl 0x17c(%rsp), %eax
cmpl $0x0, %eax
jne 0x34838
movq 0x840(%rsp), %rsi
leaq 0x15a09c(%rip), %rdi    # 0x18e897
xorl %eax, %eax
callq 0xf3b00
jmp 0x34804
movl $0x0, 0x854(%rsp)
movl $0x1, 0x6f0(%rsp)
jmp 0x355d5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x6f8(%rsp)
movl %eax, 0x6f4(%rsp)
jmp 0x355f1
leaq 0x6e0(%rsp), %rdi
callq 0x48d30
jmp 0x34847
movl $0x0, 0x6dc(%rsp)
movl 0x6dc(%rsp), %eax
movl %eax, 0x168(%rsp)
leaq 0x700(%rsp), %rdi
callq 0x48d40
movl %eax, 0x16c(%rsp)
jmp 0x34876
movl 0x168(%rsp), %eax
movl 0x16c(%rsp), %ecx
cmpl %ecx, %eax
jge 0x34a79
movl 0x6dc(%rsp), %esi
leaq 0x700(%rsp), %rdi
callq 0x48d60
movq %rax, 0x160(%rsp)
jmp 0x348aa
movq 0x160(%rsp), %rax
movq %rax, 0x6d0(%rsp)
movq 0x6d0(%rsp), %rsi
leaq 0x700(%rsp), %rdi
callq 0x48d90
movq %rax, 0x158(%rsp)
jmp 0x348d9
movq 0x158(%rsp), %rax
movq %rax, 0x6c8(%rsp)
movl $0x68, %edi
callq 0x229e0
movq %rax, 0x150(%rsp)
jmp 0x348fd
movq 0x150(%rsp), %rdi
movq 0x6c8(%rsp), %rsi
callq 0xb06c0
jmp 0x34914
movq 0x150(%rsp), %rax
movq %rax, 0x6c0(%rsp)
movq 0x6d0(%rsp), %rsi
leaq 0x700(%rsp), %rdi
callq 0x48db0
movq %rax, 0x148(%rsp)
jmp 0x34943
movq 0x148(%rsp), %rdi
callq 0x48dd0
movl %eax, 0x144(%rsp)
jmp 0x34959
movl 0x144(%rsp), %eax
cmpl $0x0, %eax
jne 0x349f5
movq 0x6c0(%rsp), %rax
movq %rax, 0x130(%rsp)
movq 0x6d0(%rsp), %rsi
leaq 0x700(%rsp), %rdi
callq 0x48db0
movq %rax, 0x138(%rsp)
jmp 0x34998
movq 0x138(%rsp), %rsi
movq 0x130(%rsp), %rdi
callq 0x48e40
jmp 0x349af
jmp 0x349f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x6f8(%rsp)
movl %eax, 0x6f4(%rsp)
jmp 0x355c6
movq 0x150(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x6f8(%rsp)
movl %eax, 0x6f4(%rsp)
movl $0x68, %esi
callq 0x22a00
jmp 0x355c6
movq 0x6c0(%rsp), %rax
movq %rax, 0x120(%rsp)
movq 0x6d0(%rsp), %rsi
leaq 0x700(%rsp), %rdi
callq 0x48f00
movq %rax, 0x128(%rsp)
jmp 0x34a24
movq 0x128(%rsp), %rsi
movq 0x120(%rsp), %rdi
callq 0x48ea0
jmp 0x34a3b
movq 0x6c0(%rsp), %rdi
callq 0x48f20
jmp 0x34a4a
movq 0x6c0(%rsp), %rsi
leaq 0x6e0(%rsp), %rdi
callq 0x48f60
jmp 0x34a61
jmp 0x34a63
movl 0x6dc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x6dc(%rsp)
jmp 0x34852
movl $0x0, 0x6bc(%rsp)
movl $0x0, 0x6b8(%rsp)
movl $0x0, 0x6b4(%rsp)
movl 0x6b4(%rsp), %eax
movl %eax, 0x118(%rsp)
leaq 0x700(%rsp), %rdi
callq 0x48f90
movl %eax, 0x11c(%rsp)
jmp 0x34abe
movl 0x118(%rsp), %eax
movl 0x11c(%rsp), %ecx
cmpl %ecx, %eax
jge 0x34bae
movl 0x6b4(%rsp), %esi
leaq 0x700(%rsp), %rdi
callq 0x48fb0
movq %rax, 0x110(%rsp)
jmp 0x34af2
movq 0x110(%rsp), %rax
movq %rax, 0x6a8(%rsp)
movq 0x6a8(%rsp), %rsi
leaq 0x700(%rsp), %rdi
callq 0x48fe0
movl %eax, 0x10c(%rsp)
jmp 0x34b20
movl 0x10c(%rsp), %eax
movl %eax, 0x6a4(%rsp)
movq 0x6a8(%rsp), %rsi
leaq 0x700(%rsp), %rdi
callq 0x49000
movl %eax, 0x108(%rsp)
jmp 0x34b4c
movl 0x108(%rsp), %eax
movl %eax, 0x6a0(%rsp)
movl 0x6a4(%rsp), %eax
cmpl 0x6bc(%rsp), %eax
jle 0x34b78
movl 0x6a4(%rsp), %eax
movl %eax, 0x6bc(%rsp)
movl 0x6a0(%rsp), %eax
cmpl 0x6b8(%rsp), %eax
jle 0x34b96
movl 0x6a0(%rsp), %eax
movl %eax, 0x6b8(%rsp)
jmp 0x34b98
movl 0x6b4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x6b4(%rsp)
jmp 0x34a9a
movq $0x0, 0x298(%rsp)
leaq 0x290(%rsp), %rdi
callq 0x49020
jmp 0x34bc9
movl $0x0, 0x28c(%rsp)
movl 0x28c(%rsp), %eax
movl %eax, 0x100(%rsp)
leaq 0x700(%rsp), %rdi
callq 0x48f90
movl %eax, 0x104(%rsp)
jmp 0x34bf8
movl 0x100(%rsp), %eax
movl 0x104(%rsp), %ecx
cmpl %ecx, %eax
jge 0x3518c
movl 0x28c(%rsp), %esi
leaq 0x700(%rsp), %rdi
callq 0x48fb0
movq %rax, 0xf8(%rsp)
jmp 0x34c2c
movq 0xf8(%rsp), %rax
movq %rax, 0x280(%rsp)
movq 0x280(%rsp), %rsi
leaq 0x700(%rsp), %rdi
callq 0x48fe0
movl %eax, 0xf4(%rsp)
jmp 0x34c5a
movl 0xf4(%rsp), %eax
movl %eax, 0x27c(%rsp)
cmpl $0x0, 0x27c(%rsp)
jge 0x34c98
movl $0x0, 0x27c(%rsp)
jmp 0x34c98
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x6f8(%rsp)
movl %eax, 0x6f4(%rsp)
jmp 0x355b9
movq 0x280(%rsp), %rsi
leaq 0x700(%rsp), %rdi
callq 0x49030
movl %eax, 0xf0(%rsp)
jmp 0x34cb6
movl 0xf0(%rsp), %eax
movl %eax, 0x278(%rsp)
cmpl $0x0, 0x278(%rsp)
jge 0x34cd9
movl $0x0, 0x278(%rsp)
movq 0x280(%rsp), %rsi
leaq 0x700(%rsp), %rdi
xorl %edx, %edx
callq 0x49070
movq %rax, 0xe8(%rsp)
jmp 0x34cfa
movq 0xe8(%rsp), %rsi
leaq 0x700(%rsp), %rdi
callq 0x49050
movl %eax, 0xe4(%rsp)
jmp 0x34d18
movl 0xe4(%rsp), %eax
movl %eax, 0x274(%rsp)
movq 0x280(%rsp), %rsi
leaq 0x700(%rsp), %rdi
movl $0x1, %edx
callq 0x49070
movq %rax, 0xd8(%rsp)
jmp 0x34d4a
movq 0xd8(%rsp), %rsi
leaq 0x700(%rsp), %rdi
callq 0x49050
movl %eax, 0xd4(%rsp)
jmp 0x34d68
movl 0xd4(%rsp), %eax
movl %eax, 0x270(%rsp)
movq 0x280(%rsp), %rsi
leaq 0x700(%rsp), %rdi
movl $0x2, %edx
callq 0x49070
movq %rax, 0xc8(%rsp)
jmp 0x34d9a
movq 0xc8(%rsp), %rsi
leaq 0x700(%rsp), %rdi
callq 0x49050
movl %eax, 0xc4(%rsp)
jmp 0x34db8
movl 0xc4(%rsp), %eax
movl %eax, 0x26c(%rsp)
movl 0x274(%rsp), %esi
leaq 0x6e0(%rsp), %rdi
callq 0x49090
movq %rax, 0xb8(%rsp)
jmp 0x34de4
movq 0xb8(%rsp), %rax
movq %rax, 0x260(%rsp)
movl 0x270(%rsp), %esi
leaq 0x6e0(%rsp), %rdi
callq 0x49090
movq %rax, 0xb0(%rsp)
jmp 0x34e12
movq 0xb0(%rsp), %rax
movq %rax, 0x258(%rsp)
movl 0x26c(%rsp), %esi
leaq 0x6e0(%rsp), %rdi
callq 0x49090
movq %rax, 0xa8(%rsp)
jmp 0x34e40
movq 0xa8(%rsp), %rax
movq %rax, 0x250(%rsp)
movl $0x88, %edi
callq 0x229e0
movq %rax, 0xa0(%rsp)
jmp 0x34e64
movq 0xa0(%rsp), %rdi
movq 0x260(%rsp), %rsi
movq 0x258(%rsp), %rdx
movq 0x250(%rsp), %rcx
callq 0xb1110
jmp 0x34e8b
movq 0xa0(%rsp), %rax
movq %rax, 0x248(%rsp)
cmpl $0x0, 0x27c(%rsp)
jne 0x34ec1
cmpl $0x0, 0x278(%rsp)
jne 0x34ec1
movq 0x298(%rsp), %rax
movq %rax, 0x98(%rsp)
jmp 0x34ecd
xorl %eax, %eax
movq %rax, 0x98(%rsp)
jmp 0x34ecd
movq 0x98(%rsp), %rax
movq %rax, 0x240(%rsp)
cmpq $0x0, 0x240(%rsp)
jne 0x3515d
movl 0x278(%rsp), %edx
movl 0x27c(%rsp), %ecx
leaq 0x1599ae(%rip), %rsi    # 0x18e8af
xorl %eax, %eax
leaq 0x2a0(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0x22160
leaq 0x21f(%rsp), %rdi
movq %rdi, 0x90(%rsp)
callq 0x232a0
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rdx
leaq 0x220(%rsp), %rdi
callq 0x485b0
jmp 0x34f4c
leaq 0x290(%rsp), %rdi
leaq 0x220(%rsp), %rsi
leaq 0x240(%rsp), %rdx
callq 0x490b0
movl %eax, 0x84(%rsp)
jmp 0x34f72
movl 0x84(%rsp), %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, 0x83(%rsp)
leaq 0x220(%rsp), %rdi
callq 0x22610
leaq 0x21f(%rsp), %rdi
callq 0x22ab0
movb 0x83(%rsp), %al
testb $0x1, %al
jne 0x34fb2
jmp 0x3515b
movl $0x10, %edi
callq 0x229e0
movq %rax, 0x78(%rsp)
jmp 0x34fc3
movq 0x78(%rsp), %rdi
callq 0x49140
jmp 0x34fcf
movq 0x78(%rsp), %rax
movq %rax, 0x240(%rsp)
cmpl $0x0, 0x27c(%rsp)
jne 0x350a9
cmpl $0x0, 0x278(%rsp)
jne 0x350a9
movq 0x240(%rsp), %rax
movq %rax, 0x298(%rsp)
jmp 0x350a9
movq 0xa0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x6f8(%rsp)
movl %eax, 0x6f4(%rsp)
movl $0x88, %esi
callq 0x22a00
jmp 0x355b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x6f8(%rsp)
movl %eax, 0x6f4(%rsp)
jmp 0x3506f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x6f8(%rsp)
movl %eax, 0x6f4(%rsp)
leaq 0x220(%rsp), %rdi
callq 0x22610
leaq 0x21f(%rsp), %rdi
callq 0x22ab0
jmp 0x355b9
movq 0x78(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x6f8(%rsp)
movl %eax, 0x6f4(%rsp)
movl $0x10, %esi
callq 0x22a00
jmp 0x355b9
leaq 0x1f7(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x232a0
movq 0x70(%rsp), %rdx
leaq 0x1f8(%rsp), %rdi
leaq 0x2a0(%rsp), %rsi
callq 0x485b0
jmp 0x350d7
movq 0x240(%rsp), %rdx
leaq 0x290(%rsp), %rdi
leaq 0x1f8(%rsp), %rsi
callq 0x49150
jmp 0x350f6
leaq 0x1f8(%rsp), %rdi
callq 0x22610
leaq 0x1f7(%rsp), %rdi
callq 0x22ab0
jmp 0x3515b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x6f8(%rsp)
movl %eax, 0x6f4(%rsp)
jmp 0x35149
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x6f8(%rsp)
movl %eax, 0x6f4(%rsp)
leaq 0x1f8(%rsp), %rdi
callq 0x22610
leaq 0x1f7(%rsp), %rdi
callq 0x22ab0
jmp 0x355b9
jmp 0x3515d
movq 0x240(%rsp), %rdi
movq 0x248(%rsp), %rsi
callq 0x49190
jmp 0x35174
jmp 0x35176
movl 0x28c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28c(%rsp)
jmp 0x34bd4
leaq 0x1e8(%rsp), %rdi
callq 0x491c0
movq 0x290(%rsp), %rdi
callq 0x491e0
movq %rax, 0x1e0(%rsp)
movq 0x1e0(%rsp), %rax
movq %rax, 0x1e8(%rsp)
movq 0x290(%rsp), %rdi
callq 0x49230
movq %rax, 0x1d8(%rsp)
leaq 0x1e8(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
callq 0x49210
testb $0x1, %al
jne 0x351f1
jmp 0x35502
leaq 0x1e8(%rsp), %rdi
callq 0x49260
movq %rax, %rsi
leaq 0x1b8(%rsp), %rdi
callq 0x223c0
jmp 0x35210
leaq 0x1e8(%rsp), %rdi
callq 0x49260
movq 0x20(%rax), %rax
movq %rax, 0x1b0(%rsp)
movq 0x1b0(%rsp), %rdi
callq 0x49280
movl %eax, 0x6c(%rsp)
jmp 0x3523c
movl 0x6c(%rsp), %eax
cmpl $0x0, %eax
je 0x3529a
movq 0x1b0(%rsp), %rax
movq %rax, 0x60(%rsp)
cmpq $0x0, %rax
je 0x35271
movq 0x60(%rsp), %rdi
callq 0x492a0
movq 0x60(%rsp), %rdi
movl $0x10, %esi
callq 0x22a00
movl $0xd, 0x6f0(%rsp)
jmp 0x354a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x6f8(%rsp)
movl %eax, 0x6f4(%rsp)
jmp 0x354f0
movl $0x1b0, %edi            # imm = 0x1B0
callq 0x229e0
movq %rax, 0x58(%rsp)
jmp 0x352ab
movq 0x180(%rsp), %rsi
movq 0x58(%rsp), %rdi
callq 0x555e0
jmp 0x352bf
movq 0x180(%rsp), %rdi
movq 0x58(%rsp), %rax
movq %rax, 0x1a8(%rsp)
movq 0x1a8(%rsp), %rsi
movq 0x1b0(%rsp), %r8
xorl %r9d, %r9d
movl %r9d, %edx
leaq 0x6e0(%rsp), %rcx
callq 0x3c760
movl %eax, 0x54(%rsp)
jmp 0x352fd
movl 0x54(%rsp), %eax
cmpl $0x0, %eax
jne 0x35349
movl $0x0, 0x854(%rsp)
movl $0x1, 0x6f0(%rsp)
jmp 0x354a6
movq 0x58(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x6f8(%rsp)
movl %eax, 0x6f4(%rsp)
movl $0x1b0, %esi            # imm = 0x1B0
callq 0x22a00
jmp 0x354f0
movq 0x1a8(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0x1b8(%rsp), %rdi
callq 0x223a0
movq 0x48(%rsp), %rdi
movq %rax, %rsi
callq 0x57850
jmp 0x35372
leaq 0x1b8(%rsp), %rdi
callq 0x223a0
movq %rax, %rdi
movl $0x5f, %esi
callq 0x22350
movq %rax, 0x1a0(%rsp)
cmpq $0x0, 0x1a0(%rsp)
je 0x353dd
movq 0x1a8(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x1a0(%rsp), %rdi
incq %rdi
callq 0xf3800
movq %rax, 0x40(%rsp)
jmp 0x353c3
movq 0x40(%rsp), %rdx
movq 0x38(%rsp), %rdi
leaq 0x1681f1(%rip), %rsi    # 0x19d5c5
callq 0x57590
jmp 0x353db
jmp 0x353dd
movq 0x838(%rsp), %rdi
movq 0x1a8(%rsp), %rsi
callq 0x57450
jmp 0x353f4
movl $0x0, 0x19c(%rsp)
movl 0x19c(%rsp), %eax
movl %eax, 0x30(%rsp)
movq 0x1b0(%rsp), %rdi
callq 0x2b8b0
movl %eax, 0x34(%rsp)
jmp 0x3541d
movl 0x30(%rsp), %eax
movl 0x34(%rsp), %ecx
cmpl %ecx, %eax
jge 0x3546f
movq 0x1b0(%rsp), %rdi
movl 0x19c(%rsp), %esi
callq 0x492b0
movq %rax, 0x28(%rsp)
jmp 0x35444
movq 0x28(%rsp), %rax
cmpq $0x0, %rax
je 0x3545a
movq 0x28(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x3545c
movl 0x19c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x19c(%rsp)
jmp 0x353ff
movq 0x1b0(%rsp), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, %rax
je 0x3549b
movq 0x20(%rsp), %rdi
callq 0x492a0
movq 0x20(%rsp), %rdi
movl $0x10, %esi
callq 0x22a00
movl $0x0, 0x6f0(%rsp)
leaq 0x1b8(%rsp), %rdi
callq 0x22610
movl 0x6f0(%rsp), %eax
movl %eax, 0x1c(%rsp)
testl %eax, %eax
je 0x354d2
jmp 0x354c4
movl 0x1c(%rsp), %eax
subl $0xd, %eax
je 0x354d4
jmp 0x3559d
jmp 0x354d4
leaq 0x1e8(%rsp), %rdi
xorl %esi, %esi
callq 0x492d0
movq %rax, 0x190(%rsp)
jmp 0x351be
leaq 0x1b8(%rsp), %rdi
callq 0x22610
jmp 0x355b9
movl $0x0, 0x18c(%rsp)
movl 0x18c(%rsp), %eax
movl %eax, 0x14(%rsp)
leaq 0x6e0(%rsp), %rdi
callq 0x2b8b0
movl %eax, 0x18(%rsp)
jmp 0x3552b
movl 0x14(%rsp), %eax
movl 0x18(%rsp), %ecx
cmpl %ecx, %eax
jge 0x35587
movl 0x18c(%rsp), %esi
leaq 0x6e0(%rsp), %rdi
callq 0x49310
movq %rax, 0x8(%rsp)
jmp 0x35552
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x35572
movq (%rsp), %rdi
movl $0x68, %esi
callq 0x22a00
jmp 0x35574
movl 0x18c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18c(%rsp)
jmp 0x3550d
movl $0x1, 0x854(%rsp)
movl $0x1, 0x6f0(%rsp)
leaq 0x290(%rsp), %rdi
callq 0x49330
leaq 0x6e0(%rsp), %rdi
callq 0x49340
jmp 0x355d5
leaq 0x290(%rsp), %rdi
callq 0x49330
leaq 0x6e0(%rsp), %rdi
callq 0x49340
jmp 0x355f1
leaq 0x700(%rsp), %rdi
callq 0x7e9c0
movl 0x854(%rsp), %eax
addq $0x858, %rsp            # imm = 0x858
retq
leaq 0x700(%rsp), %rdi
callq 0x7e9c0
movq 0x6f8(%rsp), %rdi
callq 0x23290
nopl (%rax,%rax)