// File: tomfunkhouser[P]gaps/apps/confview/confview.cpp
// Function: ReadOverlapFile(gaps::RGBDConfiguration&, char const*)
static int
ReadOverlapFile(RGBDConfiguration& configuration, const char *filename)
{
  // Start statistics
  RNTime start_time;
  start_time.Read();
  int count = 0;

  // Check configuration
  if (configuration.NSurfaces() == 0) {
    RNFail("Must have mesh to read overlaps\n");
    return 0;
  }

  // Get mesh from configuration
  RGBDSurface *surface = configuration.Surface(0);
  R3Mesh *mesh = surface->mesh;
  if (!mesh || (mesh->NVertices() == 0)) {
    RNFail("Must have mesh to read overlaps\n");
    return 0;
  }

  // Allocate arrays of vertex image overlaps
  vertex_image_overlaps = new RNArray<RGBDImage *> [ mesh->NVertices() ];
  if (!vertex_image_overlaps) {
    RNFail("Unable to allocate vertex image overlaps for %s\n", filename);
    return 0;
  }

  // Allocate arrays of image vertex overlaps
  image_vertex_overlaps = new RNArray<R3MeshVertex *> [ configuration.NImages() ];
  if (!image_vertex_overlaps) {
    RNFail("Unable to allocate image vertex overlaps for %s\n", filename);
    return 0;
  }

  // Allocate matrix of image image overlaps
  if (!image_image_overlaps) {
    image_image_overlaps = new R2Grid(configuration.NImages(), configuration.NImages());
    if (!image_image_overlaps) {
      RNFail("Unable to allocate image image overlap matrix\n");
      return 0;
    }
  }

  // Open file
  FILE *fp = fopen(filename, "r");
  if (!fp) {
    RNFail("Unable to open overlap file %s\n", filename);
    return 0;
  }
  
  // Read file
  char cmd[1024];
  while (fscanf(fp, "%s", cmd) == (unsigned int) 1) {
    // Check cmd
    if (!strcmp(cmd, "C")) {
      // Read configuration filename
      char configuration_filename[1024];
      if (fscanf(fp, "%s", configuration_filename) != (unsigned int) 1) {
        RNFail("Unable to read configuration filename in %s\n", filename);
        return 0;
      }
    }
    else if (!strcmp(cmd, "M")) {
      // Read mesh filename
      char mesh_filename[1024];
      if (fscanf(fp, "%s", mesh_filename) != (unsigned int) 1) {
        RNFail("Unable to read mesh filename in %s\n", filename);
        return 0;
      }
    }
    else if (!strcmp(cmd, "VI")) {
      // Read vertex to image overlaps
      int vertex_index, noverlaps;
      double px, py, pz, nx, ny, nz;
      if (fscanf(fp, "%d%lf%lf%lf%lf%lf%lf%d", &vertex_index,
        &px, &py, &pz, &nx, &ny, &nz, &noverlaps) != (unsigned int) 8) {
        RNFail("Unable to read vertex in %s\n", filename);
        return 0;
      }
        
      // Check vertex index
      if ((vertex_index < 0) || (vertex_index >= mesh->NVertices())) {
        RNFail("Invalid vertex index %d in %s\n", vertex_index, filename);
        return 0;
      }

      // Find vertex
      R3MeshVertex *vertex = mesh->Vertex(vertex_index);
      if (R3SquaredDistance(mesh->VertexPosition(vertex), R3Point(px, py, pz)) > RN_EPSILON) {
        RNFail("Mismatching position for vertex index %d in %s\n", vertex_index, filename);
        return 0;
      }

      // Read overlaps
      for (int i = 0; i < noverlaps; i++) {
        // Read image index and position
        int image_index;
        double image_x, image_y;
        if (fscanf(fp, "%d%lf%lf", &image_index, &image_x, &image_y) != (unsigned int) 3) {
          RNFail("Unable to read image index in %s\n", filename);
          return 0;
        }

        // Check image index
        if ((image_index < 0) || (image_index >= mesh->NVertices())) {
          RNFail("Invalid image index %d in %s\n", image_index, filename);
          return 0;
        }
         
        // Find image
        RGBDImage *image = configuration.Image(image_index);
        if (!image) {
          RNFail("This should never happen\n");
          return 0;
        }

        // Add overlap
        vertex_image_overlaps[vertex_index].Insert(image);

        // Increment count
        count++;
      }
    }
    else if (!strcmp(cmd, "IV")) {
      // Read image to vertex overlaps
      int image_index, noverlaps;
      if (fscanf(fp, "%d%d", &image_index, &noverlaps) != (unsigned int) 2) {
        RNFail("Unable to read image in %s\n", filename);
        return 0;
      }
        
      // Check image index
      if ((image_index < 0) || (image_index >= configuration.NImages())) {
        RNFail("Invalid image index %d in %s\n", image_index, filename);
        return 0;
      }

      // Find image
      RGBDImage *image = configuration.Image(image_index);
      if (!image) {
        RNFail("This should never happen\n");
        return 0;
      }

      // Read overlaps
      for (int i = 0; i < noverlaps; i++) {
        // Read vertex index
        int vertex_index;
        if (fscanf(fp, "%d", &vertex_index) != (unsigned int) 1) {
          RNFail("Unable to read vertex index in %s\n", filename);
          return 0;
        }

        // Check vertex index
        if ((vertex_index < 0) || (vertex_index >= mesh->NVertices())) {
          RNFail("Invalid vertex index %d in %s\n", vertex_index, filename);
          return 0;
        }

        // Find vertex
        R3MeshVertex *vertex = mesh->Vertex(vertex_index);
        if (!vertex) {
          RNFail("This should never happen\n");
          return 0;
        }

        // Add overlap
        image_vertex_overlaps[image_index].Insert(vertex);

        // Increment count
        count++;
      }
    }
    else if (!strcmp(cmd, "II")) {
      // Read image to image overlap
      RNScalar fraction;
      int image_index1, image_index2, noverlaps;
      if (fscanf(fp, "%d%d%d%lf", &image_index1, &image_index2, &noverlaps, &fraction) != (unsigned int) 4) {
        RNFail("Unable to read line in %s\n", filename);
        return 0;
      }

      // Assign entry in image image overlap matrix
      image_image_overlaps->SetGridValue(image_index1, image_index2, fraction);

      // Increment count
      count++;
    }        
  }

  // Close file
  fclose(fp);

  // Print statistics
  if (print_verbose) {
    printf("Read overlaps from %s ...\n", filename);
    printf("  # Images = %d\n", configuration.NImages());
    printf("  # Overlaps = %d\n", count);
    fflush(stdout);
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbx
subq $0xe00, %rsp            # imm = 0xE00
movq %rdi, 0xdf0(%rsp)
movq %rsi, 0xde8(%rsp)
leaq 0xdd8(%rsp), %rdi
callq 0x127730
leaq 0xdd8(%rsp), %rdi
callq 0x2e970
movl $0x0, 0xdd4(%rsp)
movq 0xdf0(%rsp), %rdi
callq 0x2ecd0
cmpl $0x0, %eax
jne 0x2da2d
leaq 0x199dcc(%rip), %rdi    # 0x1c77e2
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
movq 0xdf0(%rsp), %rdi
xorl %esi, %esi
callq 0x2f050
movq %rax, 0xdc8(%rsp)
movq 0xdc8(%rsp), %rax
movq 0x88(%rax), %rax
movq %rax, 0xdc0(%rsp)
cmpq $0x0, 0xdc0(%rsp)
je 0x2da78
movq 0xdc0(%rsp), %rdi
callq 0x2f0a0
cmpl $0x0, %eax
jne 0x2da96
leaq 0x199d63(%rip), %rdi    # 0x1c77e2
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
movq 0xdc0(%rsp), %rdi
callq 0x2f0a0
cltq
movq %rax, 0xd8(%rsp)
movl $0x10, %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, 0xd0(%rsp)
callq 0x24040
movq %rax, %rcx
movq 0xd8(%rsp), %rax
movq %rcx, 0xe0(%rsp)
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, 0xe8(%rsp)
cmpq $0x0, %rax
je 0x2db69
movq 0xe8(%rsp), %rax
movq 0xd8(%rsp), %rdx
shlq $0x4, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, 0xc0(%rsp)
movq %rax, 0xc8(%rsp)
movq 0xc8(%rsp), %rdi
movq %rdi, 0xb8(%rsp)
callq 0x2f810
jmp 0x2db48
movq 0xc0(%rsp), %rcx
movq 0xb8(%rsp), %rax
addq $0x10, %rax
cmpq %rcx, %rax
movq %rax, 0xc8(%rsp)
jne 0x2db31
movq 0xe8(%rsp), %rax
movq %rax, 0x20e308(%rip)    # 0x23be80
cmpq $0x0, 0x20e300(%rip)    # 0x23be80
jne 0x2dc2b
movq 0xde8(%rsp), %rsi
leaq 0x199c6e(%rip), %rdi    # 0x1c7803
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
movq 0xe8(%rsp), %rcx
movq %rax, %rsi
movq 0xb8(%rsp), %rax
movq %rsi, 0xdb8(%rsp)
movl %edx, 0xdb4(%rsp)
cmpq %rax, %rcx
movq %rax, 0xb0(%rsp)
je 0x2dc11
movq 0xb0(%rsp), %rdi
addq $-0x10, %rdi
movq %rdi, 0xa8(%rsp)
callq 0x2f820
movq 0xe8(%rsp), %rcx
movq 0xa8(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0xb0(%rsp)
jne 0x2dbdb
movq 0xd0(%rsp), %rsi
movq 0xe0(%rsp), %rdi
callq 0x254b0
jmp 0x2e657
movq 0xdf0(%rsp), %rdi
callq 0x2ea00
cltq
movq %rax, 0x90(%rsp)
movl $0x10, %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, 0x88(%rsp)
callq 0x24040
movq %rax, %rcx
movq 0x90(%rsp), %rax
movq %rcx, 0x98(%rsp)
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, 0xa0(%rsp)
cmpq $0x0, %rax
je 0x2dcf2
movq 0xa0(%rsp), %rax
movq 0x90(%rsp), %rdx
shlq $0x4, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, 0x78(%rsp)
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x2f830
jmp 0x2dcd7
movq 0x78(%rsp), %rcx
movq 0x70(%rsp), %rax
addq $0x10, %rax
cmpq %rcx, %rax
movq %rax, 0x80(%rsp)
jne 0x2dcc3
movq 0xa0(%rsp), %rax
movq %rax, 0x20e19f(%rip)    # 0x23bea0
cmpq $0x0, 0x20e197(%rip)    # 0x23bea0
jne 0x2dda2
movq 0xde8(%rsp), %rsi
leaq 0x199b16(%rip), %rdi    # 0x1c7834
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
movq 0xa0(%rsp), %rcx
movq %rax, %rsi
movq 0x70(%rsp), %rax
movq %rsi, 0xdb8(%rsp)
movl %edx, 0xdb4(%rsp)
cmpq %rax, %rcx
movq %rax, 0x68(%rsp)
je 0x2dd88
movq 0x68(%rsp), %rdi
addq $-0x10, %rdi
movq %rdi, 0x60(%rsp)
callq 0x2f840
movq 0xa0(%rsp), %rcx
movq 0x60(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x68(%rsp)
jne 0x2dd5e
movq 0x88(%rsp), %rsi
movq 0x98(%rsp), %rdi
callq 0x254b0
jmp 0x2e657
cmpq $0x0, 0x20e0ee(%rip)    # 0x23be98
jne 0x2de52
movl $0xd0, %edi
callq 0x24a00
movq %rax, 0x50(%rsp)
movq %rax, 0x48(%rsp)
movq 0xdf0(%rsp), %rdi
callq 0x2ea00
movl %eax, 0x5c(%rsp)
movq 0xdf0(%rsp), %rdi
callq 0x2ea00
movq 0x50(%rsp), %rdi
movl 0x5c(%rsp), %esi
movl %eax, %edx
callq 0xff7e0
jmp 0x2ddf4
movq 0x48(%rsp), %rax
movq %rax, 0x20e098(%rip)    # 0x23be98
cmpq $0x0, 0x20e090(%rip)    # 0x23be98
jne 0x2de50
leaq 0x199a54(%rip), %rdi    # 0x1c7865
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
movq 0x48(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xdb8(%rsp)
movl %eax, 0xdb4(%rsp)
movl $0xd0, %esi
callq 0x24a20
jmp 0x2e657
jmp 0x2de52
movq 0xde8(%rsp), %rdi
leaq 0x1a1882(%rip), %rsi    # 0x1cf6e3
callq 0x24c30
movq %rax, 0xda8(%rsp)
cmpq $0x0, 0xda8(%rsp)
jne 0x2de9f
movq 0xde8(%rsp), %rsi
leaq 0x199a0c(%rip), %rdi    # 0x1c7894
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
jmp 0x2dea1
movq 0xda8(%rsp), %rdi
leaq 0x9a0(%rsp), %rdx
leaq 0x1ba7bf(%rip), %rsi    # 0x1e8677
movb $0x0, %al
callq 0x25390
cmpl $0x1, %eax
jne 0x2e5cf
leaq 0x9a0(%rsp), %rdi
leaq 0x1999dd(%rip), %rsi    # 0x1c78b4
callq 0x24ef0
cmpl $0x0, %eax
jne 0x2df2f
movq 0xda8(%rsp), %rdi
leaq 0x5a0(%rsp), %rdx
leaq 0x1ba77f(%rip), %rsi    # 0x1e8677
movb $0x0, %al
callq 0x25390
cmpl $0x1, %eax
je 0x2df2a
movq 0xde8(%rsp), %rsi
leaq 0x1999a3(%rip), %rdi    # 0x1c78b6
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
jmp 0x2e5ca
leaq 0x9a0(%rsp), %rdi
leaq 0x1a19a8(%rip), %rsi    # 0x1cf8e6
callq 0x24ef0
cmpl $0x0, %eax
jne 0x2df96
movq 0xda8(%rsp), %rdi
leaq 0x1a0(%rsp), %rdx
leaq 0x1ba718(%rip), %rsi    # 0x1e8677
movb $0x0, %al
callq 0x25390
cmpl $0x1, %eax
je 0x2df91
movq 0xde8(%rsp), %rsi
leaq 0x199969(%rip), %rdi    # 0x1c78e3
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
jmp 0x2e5c8
leaq 0x9a0(%rsp), %rdi
leaq 0x199962(%rip), %rsi    # 0x1c7907
callq 0x24ef0
cmpl $0x0, %eax
jne 0x2e2af
movq 0xda8(%rsp), %rdi
leaq 0x199948(%rip), %rsi    # 0x1c790a
leaq 0x19c(%rsp), %rdx
leaq 0x190(%rsp), %rcx
leaq 0x188(%rsp), %r8
leaq 0x180(%rsp), %r9
leaq 0x178(%rsp), %rbx
leaq 0x170(%rsp), %r11
leaq 0x168(%rsp), %r10
leaq 0x198(%rsp), %rax
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movb $0x0, %al
callq 0x25390
cmpl $0x8, %eax
je 0x2e047
movq 0xde8(%rsp), %rsi
leaq 0x1998f1(%rip), %rdi    # 0x1c7921
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
cmpl $0x0, 0x19c(%rsp)
jl 0x2e073
movl 0x19c(%rsp), %eax
movl %eax, 0x44(%rsp)
movq 0xdc0(%rsp), %rdi
callq 0x2f0a0
movl %eax, %ecx
movl 0x44(%rsp), %eax
cmpl %ecx, %eax
jl 0x2e0a0
movl 0x19c(%rsp), %esi
movq 0xde8(%rsp), %rdx
leaq 0x1998b5(%rip), %rdi    # 0x1c793e
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
movq 0xdc0(%rsp), %rdi
movl 0x19c(%rsp), %esi
callq 0x2f0c0
movq %rax, 0x160(%rsp)
movq 0xdc0(%rsp), %rdi
movq 0x160(%rsp), %rsi
callq 0x2f0f0
movq %rax, 0x38(%rsp)
movsd 0x190(%rsp), %xmm0
movsd 0x188(%rsp), %xmm1
movsd 0x180(%rsp), %xmm2
leaq 0x148(%rsp), %rdi
callq 0xed1b0
movq 0x38(%rsp), %rdi
leaq 0x148(%rsp), %rsi
callq 0x94a60
leaq 0x2081d1(%rip), %rax    # 0x2362e8
ucomisd (%rax), %xmm0
jbe 0x2e14a
movl 0x19c(%rsp), %esi
movq 0xde8(%rsp), %rdx
leaq 0x19982a(%rip), %rdi    # 0x1c795d
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
movl $0x0, 0x144(%rsp)
movl 0x144(%rsp), %eax
cmpl 0x198(%rsp), %eax
jge 0x2e2aa
movq 0xda8(%rsp), %rdi
leaq 0x199815(%rip), %rsi    # 0x1c798d
leaq 0x140(%rsp), %rdx
leaq 0x138(%rsp), %rcx
leaq 0x130(%rsp), %r8
movb $0x0, %al
callq 0x25390
cmpl $0x3, %eax
je 0x2e1c2
movq 0xde8(%rsp), %rsi
leaq 0x1997eb(%rip), %rdi    # 0x1c7996
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
cmpl $0x0, 0x140(%rsp)
jl 0x2e1ee
movl 0x140(%rsp), %eax
movl %eax, 0x34(%rsp)
movq 0xdc0(%rsp), %rdi
callq 0x2f0a0
movl %eax, %ecx
movl 0x34(%rsp), %eax
cmpl %ecx, %eax
jl 0x2e21b
movl 0x140(%rsp), %esi
movq 0xde8(%rsp), %rdx
leaq 0x1997b4(%rip), %rdi    # 0x1c79b8
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
movq 0xdf0(%rsp), %rdi
movl 0x140(%rsp), %esi
callq 0x2ea20
movq %rax, 0x128(%rsp)
cmpq $0x0, 0x128(%rsp)
jne 0x2e260
leaq 0x19978d(%rip), %rdi    # 0x1c79d6
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
movq 0x20dc19(%rip), %rdi    # 0x23be80
movslq 0x19c(%rsp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq 0x128(%rsp), %rsi
callq 0x2f850
movl 0xdd4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xdd4(%rsp)
movl 0x144(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x144(%rsp)
jmp 0x2e155
jmp 0x2e5c6
leaq 0x9a0(%rsp), %rdi
leaq 0x199732(%rip), %rsi    # 0x1c79f0
callq 0x24ef0
cmpl $0x0, %eax
jne 0x2e510
movq 0xda8(%rsp), %rdi
leaq 0x19af0d(%rip), %rsi    # 0x1c91e8
leaq 0x124(%rsp), %rdx
leaq 0x120(%rsp), %rcx
movb $0x0, %al
callq 0x25390
cmpl $0x2, %eax
je 0x2e31d
movq 0xde8(%rsp), %rsi
leaq 0x1996ed(%rip), %rdi    # 0x1c79f3
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
cmpl $0x0, 0x124(%rsp)
jl 0x2e349
movl 0x124(%rsp), %eax
movl %eax, 0x30(%rsp)
movq 0xdf0(%rsp), %rdi
callq 0x2ea00
movl %eax, %ecx
movl 0x30(%rsp), %eax
cmpl %ecx, %eax
jl 0x2e376
movl 0x124(%rsp), %esi
movq 0xde8(%rsp), %rdx
leaq 0x199659(%rip), %rdi    # 0x1c79b8
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
movq 0xdf0(%rsp), %rdi
movl 0x124(%rsp), %esi
callq 0x2ea20
movq %rax, 0x118(%rsp)
cmpq $0x0, 0x118(%rsp)
jne 0x2e3bb
leaq 0x199632(%rip), %rdi    # 0x1c79d6
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
movl $0x0, 0x114(%rsp)
movl 0x114(%rsp), %eax
cmpl 0x120(%rsp), %eax
jge 0x2e50b
movq 0xda8(%rsp), %rdi
leaq 0x1a0f71(%rip), %rsi    # 0x1cf35a
leaq 0x110(%rsp), %rdx
movb $0x0, %al
callq 0x25390
cmpl $0x1, %eax
je 0x2e423
movq 0xde8(%rsp), %rsi
leaq 0x199603(%rip), %rdi    # 0x1c7a0f
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
cmpl $0x0, 0x110(%rsp)
jl 0x2e44f
movl 0x110(%rsp), %eax
movl %eax, 0x2c(%rsp)
movq 0xdc0(%rsp), %rdi
callq 0x2f0a0
movl %eax, %ecx
movl 0x2c(%rsp), %eax
cmpl %ecx, %eax
jl 0x2e47c
movl 0x110(%rsp), %esi
movq 0xde8(%rsp), %rdx
leaq 0x1994d9(%rip), %rdi    # 0x1c793e
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
movq 0xdc0(%rsp), %rdi
movl 0x110(%rsp), %esi
callq 0x2f0c0
movq %rax, 0x108(%rsp)
cmpq $0x0, 0x108(%rsp)
jne 0x2e4c1
leaq 0x19952c(%rip), %rdi    # 0x1c79d6
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
movq 0x20d9d8(%rip), %rdi    # 0x23bea0
movslq 0x124(%rsp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq 0x108(%rsp), %rsi
callq 0x2f880
movl 0xdd4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xdd4(%rsp)
movl 0x114(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x114(%rsp)
jmp 0x2e3c6
jmp 0x2e5c4
leaq 0x9a0(%rsp), %rdi
leaq 0x199513(%rip), %rsi    # 0x1c7a32
callq 0x24ef0
cmpl $0x0, %eax
jne 0x2e5c2
movq 0xda8(%rsp), %rdi
leaq 0x1994f9(%rip), %rsi    # 0x1c7a35
leaq 0xfc(%rsp), %rdx
leaq 0xf8(%rsp), %rcx
leaq 0xf4(%rsp), %r8
leaq 0x100(%rsp), %r9
movb $0x0, %al
callq 0x25390
cmpl $0x4, %eax
je 0x2e58e
movq 0xde8(%rsp), %rsi
leaq 0x1994c8(%rip), %rdi    # 0x1c7a3f
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0xdfc(%rsp)
jmp 0x2e647
movq 0x20d903(%rip), %rdi    # 0x23be98
movl 0xfc(%rsp), %esi
movl 0xf8(%rsp), %edx
movsd 0x100(%rsp), %xmm0
callq 0x2f8b0
movl 0xdd4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xdd4(%rsp)
jmp 0x2e5c4
jmp 0x2e5c6
jmp 0x2e5c8
jmp 0x2e5ca
jmp 0x2dea1
movq 0xda8(%rsp), %rdi
callq 0x249f0
cmpl $0x0, 0x20d7ed(%rip)    # 0x23bdd0
je 0x2e63c
movq 0xde8(%rsp), %rsi
leaq 0x1991b3(%rip), %rdi    # 0x1c77a7
movb $0x0, %al
callq 0x24090
movq 0xdf0(%rsp), %rdi
callq 0x2ea00
movl %eax, %esi
leaq 0x198d93(%rip), %rdi    # 0x1c73a4
movb $0x0, %al
callq 0x24090
movl 0xdd4(%rsp), %esi
leaq 0x19919c(%rip), %rdi    # 0x1c77c2
movb $0x0, %al
callq 0x24090
movq 0x20695c(%rip), %rax    # 0x234f90
movq (%rax), %rdi
callq 0x24c20
movl $0x1, 0xdfc(%rsp)
movl 0xdfc(%rsp), %eax
addq $0xe00, %rsp            # imm = 0xE00
popq %rbx
retq
movq 0xdb8(%rsp), %rdi
callq 0x252b0
nopw %cs:(%rax,%rax)