// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::ReadConfigurationStream(_IO_FILE*, int)
int RGBDConfiguration::
ReadConfigurationStream(FILE *fp, int read_every_kth_image)
{
  // Initialize stuff
  int image_count = 0;
  R3Matrix intrinsics_matrix = R3identity_matrix;
  int image_width = 0;
  int image_height = 0;
  
  // Parse file
  char buffer[4096];
  int line_number = 0;
  while (fgets(buffer, 4096, fp)) {
    char cmd[1024];
    line_number++;
    if (sscanf(buffer, "%s", cmd) != (unsigned int) 1) continue;
    if (cmd[0] == '#') continue;

    // Check cmd
    if (!strcmp(cmd, "dataset")) {
      // Parse dataset format
      char name[1024] = { '\0' };
      if (sscanf(buffer, "%s%s", cmd, name) != (unsigned int) 2) {
        RNFail("Error parsing line %d of configuration file\n", line_number);
        return 0;
      }

      // Set dataset format
      SetDatasetFormat(name);
    }
    else if (!strcmp(cmd, "sequence") || !strcmp(cmd, "name")) {
      // Parse name
      char name[1024] = { '\0' };
      if (sscanf(buffer, "%s%s", cmd, name) != (unsigned int) 2) {
        RNFail("Error parsing line %d of configuration file\n", line_number);
        return 0;
      }

      // Set dataset format
      SetName(name);
    }
    else if (!strcmp(cmd, "depth_resolution")) {
      // Parse dimensions
      if (sscanf(buffer, "%s%d%d", cmd, &image_width, &image_height) != (unsigned int) 3) {
        RNFail("Error parsing line %d of configuration file\n", line_number);
        return 0;
      }
    }
    else if (!strcmp(cmd, "color_resolution")) {
      // Parse dimensions
      if ((image_width == 0) || (image_height == 0)) {
        if (sscanf(buffer, "%s%d%d", cmd, &image_width, &image_height) != (unsigned int) 3) {
          RNFail("Error parsing line %d of configuration file\n", line_number);
          return 0;
        }
      }
    }
    else if (!strcmp(cmd, "depth_directory") || !strcmp(cmd, "color_directory") ||
             !strcmp(cmd, "category_directory") || !strcmp(cmd, "instance_directory") ||
             !strcmp(cmd, "texture_directory") || !strcmp(cmd, "image_directory")) {
      // Parse directory name
      char dirname[1024];
      if (sscanf(buffer, "%s%s", cmd, dirname) != (unsigned int) 2) {
        RNFail("Error parsing line %d of configuration file\n", line_number);
        return 0;
      }

      // Assign directory name (this leaks memory, but who cares)
      if (!strcmp(cmd, "color_directory")) SetColorDirectory(dirname);
      else if (!strcmp(cmd, "depth_directory")) SetDepthDirectory(dirname);
      else if (!strcmp(cmd, "category_directory")) SetCategoryDirectory(dirname);
      else if (!strcmp(cmd, "instance_directory")) SetInstanceDirectory(dirname);
      else if (!strcmp(cmd, "image_directory")) SetColorDirectory(dirname);
      else if (!strcmp(cmd, "texture_directory")) SetTextureDirectory(dirname);
    }
    else if (!strcmp(cmd, "intrinsics") || !strcmp(cmd, "depth_intrinsics")) { // || !strcmp(cmd, "color_intrinsics")) {
      // Parse intrinsics filename
      char intrinsics_filename[2048];
      if (sscanf(buffer, "%s%s", cmd, intrinsics_filename) != (unsigned int) 2) {
        RNFail("Error parsing line %d of configuration file\n", line_number);
        return 0;
      }

      // Open intrinsics file
      FILE *intrinsics_fp = fopen(intrinsics_filename, "r");
      if (!intrinsics_fp) {
        RNFail("Unable to open intrinsics file %s\n", intrinsics_filename);
        return 0;
      }

      // Read intrinsics file
      if (dataset_format && !strcmp(dataset_format, "matterport")) {
        // Read matterport intrinsics
        double width, height, fx, fy, cx, cy, k1, k2, p1, p2, k3;
        if (fscanf(intrinsics_fp, "%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf", &width, &height,
          &fx, &fy, &cx, &cy, &k1, &k2, &p1, &p2, &k3) != (unsigned int) 11) {
          RNFail("Unable to read Matterport intrinsics matrix.\n");
          return 0;
        }

        // Assign intrinsics matrix
        intrinsics_matrix = R3Matrix(fx, 0, cx,   0, fy, cy,   0, 0, 1);
      }
      else {
        // Read matrix
        RNScalar m[9];
        if (fscanf(intrinsics_fp, "%lf%lf%lf%lf%lf%lf%lf%lf%lf", &m[0], &m[1], &m[2], &m[3], &m[4], &m[5], &m[6], &m[7], &m[8]) != (unsigned int) 9) {
          RNFail("Unable to read intrinsics file %s\n", intrinsics_filename);
          return 0;
        }

        // Assign intrinsics matrix
        intrinsics_matrix = R3Matrix(m);
      }

      // Close intrinsics file
      fclose(intrinsics_fp);
    }
    else if (!strcmp(cmd, "intrinsics_matrix") || !strcmp(cmd, "depth_intrinsics_matrix")) { // || !strcmp(cmd, "color_intrinsics_matrix")) {
      // Parse matrix
      double m[9];
      if (sscanf(buffer, "%s%lf%lf%lf%lf%lf%lf%lf%lf%lf", cmd, &m[0], &m[1], &m[2], &m[3], &m[4], &m[5], &m[6], &m[7], &m[8]) != (unsigned int) 10) {
        RNFail("Error parsing line %d of configuration file\n", line_number);
        return 0;
      }

      // Assign intrinsics matrix
      intrinsics_matrix = R3Matrix(m);
    }
    else if (!strcmp(cmd, "scan") || !strcmp(cmd, "image")) {
      // Update/check image count
      if ((read_every_kth_image > 1) && ((++image_count % read_every_kth_image) != 1)) continue;

      // Check intrinsics matrix
      if (intrinsics_matrix.IsIdentity()) {
        RNFail("Unable to process scan without prior setting of intrinsics matrix in configuration file\n");
        return 0;
      }
      
      // Parse image names and alignment transformation
      RNScalar m[16];
      char depth_filename[2048], color_filename[2048];
      if (sscanf(buffer, "%s%s%s%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf", cmd, 
         depth_filename, color_filename,
         &m[0], &m[1], &m[2], &m[3], &m[4], &m[5], &m[6], &m[7], 
         &m[8], &m[9], &m[10], &m[11], &m[12], &m[13], &m[14], &m[15]) != (unsigned int) 19) {
        RNFail("Error parsing line %d of configuration file\n", line_number);
        return 0;
      }

      // Create RGBD image
      // RGBDImage *image = new RGBDImage(color_filename, depth_filename, intrinsics_matrix, R4Matrix(m), image_width, image_height);
      RGBDImage *image = AllocateImage();
      image->SetNPixels(image_width, image_height);
      image->SetColorFilename(color_filename);
      image->SetDepthFilename(depth_filename);
      image->SetIntrinsics(intrinsics_matrix);
      image->SetCameraToWorld(R3Affine(R4Matrix(m), 0));
      InsertImage(image);
    }
    else if (!strcmp(cmd, "labeled_image")) {
      // Update/check image count
      if ((read_every_kth_image > 1) && ((++image_count % read_every_kth_image) != 1)) continue;

      // Check intrinsics matrix
      if (intrinsics_matrix.IsIdentity()) {
        RNFail("Unable to process scan without prior setting of intrinsics matrix in configuration file\n");
        return 0;
      }
      
      // Parse image names and alignment transformation
      RNScalar m[16];
      char depth_filename[2048], color_filename[2048], category_filename[2048], instance_filename[2048];
      if (sscanf(buffer, "%s%s%s%s%s%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf", cmd, 
         depth_filename, color_filename, category_filename, instance_filename,
         &m[0], &m[1], &m[2], &m[3], &m[4], &m[5], &m[6], &m[7], 
         &m[8], &m[9], &m[10], &m[11], &m[12], &m[13], &m[14], &m[15]) != (unsigned int) 21) {
        RNFail("Error parsing line %d of configuration file\n", line_number);
        return 0;
      }

      // Create RGBD image
      // RGBDImage *image = new RGBDImage(color_filename, depth_filename, intrinsics_matrix, R4Matrix(m), image_width, image_height);
      RGBDImage *image = AllocateImage();
      image->SetNPixels(image_width, image_height);
      image->SetColorFilename(color_filename);
      image->SetDepthFilename(depth_filename);
      image->SetCategoryFilename(category_filename);
      image->SetInstanceFilename(instance_filename);
      image->SetIntrinsics(intrinsics_matrix);
      image->SetCameraToWorld(R3Affine(R4Matrix(m), 0));
      InsertImage(image);
    }
    else if (!strcmp(cmd, "frame")) {
      // Update/check image count
      if ((read_every_kth_image > 1) && ((++image_count % read_every_kth_image) != 1)) continue;

      // Check intrinsics matrix
      if (intrinsics_matrix.IsIdentity()) {
        RNFail("Unable to process scan without prior setting of intrinsics matrix in configuration file\n");
        return 0;
      }
      
      // Parse image names and alignment transformation
      RNScalar m[16];
      double depth_timestamp, color_timestamp;
      char depth_filename[2048], color_filename[2048];
      if (sscanf(buffer, "%s%s%lf%s%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf", cmd, 
         depth_filename, &depth_timestamp, color_filename, &color_timestamp,
         &m[0], &m[1], &m[2], &m[3], &m[4], &m[5], &m[6], &m[7], 
         &m[8], &m[9], &m[10], &m[11], &m[12], &m[13], &m[14], &m[15]) != (unsigned int) 21) {
        RNFail("Error parsing line %d of configuration file\n", line_number);
        return 0;
      }

      // Create RGBD image
      // RGBDImage *image = new RGBDImage(color_filename, depth_filename, intrinsics_matrix, R4Matrix(m), image_width, image_height);
      RGBDImage *image = AllocateImage();
      image->SetNPixels(image_width, image_height);
      image->SetColorFilename(color_filename);
      image->SetDepthFilename(depth_filename);
      image->SetIntrinsics(intrinsics_matrix);
      image->SetCameraToWorld(R3Affine(R4Matrix(m), 0));
      InsertImage(image);
    }
    else if (!strcmp(cmd, "rectangle")) {
      // Parse surface
      char texture_filename[2048];
      RNScalar pixel_spacing, c[3], n[3], u[3], r[3];
      if (sscanf(buffer, "%s%s%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf", cmd, texture_filename, &pixel_spacing, 
        &c[0], &c[1], &c[2], &n[0], &n[1], &n[2], &u[0], &u[1], &u[2], &r[0], &r[1], &r[2]) != (unsigned int) 15) {
        RNFail("Error parsing line %d of configuration file\n", line_number);
        return 0;
      }

      // Create RGBD surface
      R3Point center(c);
      R3Vector axis1(u); axis1.Normalize();
      R3Vector normal(n); normal.Normalize();
      R3Vector axis0 = axis1 % normal; axis0.Normalize();
      // R3Mesh *mesh = new R3Mesh();
      // R3MeshVertex *v00 = mesh->CreateVertex(center - r[0]*axis0 - r[1]*axis1, normal, RNblack_rgb, R2Point(0,0));
      // R3MeshVertex *v10 = mesh->CreateVertex(center + r[0]*axis0 - r[1]*axis1, normal, RNblack_rgb, R2Point(r[0],0));
      // R3MeshVertex *v01 = mesh->CreateVertex(center - r[0]*axis0 + r[1]*axis1, normal, RNblack_rgb, R2Point(0,r[1]));
      // R3MeshVertex *v11 = mesh->CreateVertex(center + r[0]*axis0 + r[1]*axis1, normal, RNblack_rgb, R2Point(r[0],r[1]));
      // mesh->CreateFace(v00, v10, v11);
      // mesh->CreateFace(v00, v11, v01);
      // RGBDSurface *surface = new RGBDSurface(texture_filename, mesh, pixel_spacing);
      R3Rectangle *rectangle = new R3Rectangle(center, axis0, axis1, r[0], r[1]);
      RGBDSurface *surface = new RGBDSurface(texture_filename, rectangle, pixel_spacing);
      surface->thickness = r[2];
      InsertSurface(surface);
    }
    else if (!strcmp(cmd, "mesh")) {
      // Parse surface
      char texture_filename[2048], mesh_filename[2048];
      RNScalar pixel_spacing;
      if (sscanf(buffer, "%s%s%s%lf", cmd, texture_filename, mesh_filename, &pixel_spacing) != (unsigned int) 4) {
        RNFail("Error parsing line %d of configuration file\n", line_number);
        return 0;
      }

      // Read mesh
      R3Mesh *mesh = new R3Mesh();
      if (!mesh->ReadFile(mesh_filename)) {
        RNFail("Unable to read mesh file %s at line %d of configuration file\n", mesh_filename, line_number);
        return 0;
      }

      // Create surface      
      RGBDSurface *surface = new RGBDSurface(texture_filename, mesh, pixel_spacing);
      surface->SetMeshFilename(mesh_filename);
      InsertSurface(surface);
    }
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x36d8, %rsp           # imm = 0x36D8
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
leaq 0xa74a0(%rip), %rsi     # 0xbe2c0
leaq 0xe0(%rsp), %rdi
callq 0x6d1a2
xorl %eax, %eax
movl %eax, 0x10(%rsp)
movl %eax, 0xc(%rsp)
leaq 0x26d0(%rsp), %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %r14, %rdx
callq 0x11960
testq %rax, %rax
je 0x17ee7
movl %ebx, 0x14(%rsp)
movl $0x1, %ebp
leaq 0x26d0(%rsp), %r12
leaq 0x2d0(%rsp), %rbx
leaq 0x1ed0(%rsp), %r13
movl $0x0, 0x8(%rsp)
movq %r12, %rdi
leaq 0xa7688(%rip), %rsi     # 0xbe510
movq %rbx, %rdx
xorl %eax, %eax
callq 0x11590
cmpl $0x1, %eax
jne 0x17389
cmpb $0x23, 0x2d0(%rsp)
je 0x17389
movabsq $0x74657361746164, %rax # imm = 0x74657361746164
cmpq %rax, 0x2d0(%rsp)
jne 0x16efd
movl $0x400, %edx            # imm = 0x400
movq %r13, %rdi
xorl %esi, %esi
callq 0x11310
movq %r12, %rdi
leaq 0xa5781(%rip), %rsi     # 0xbc657
movq %rbx, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x11590
cmpl $0x2, %eax
jne 0x17eee
movq (%r15), %rax
movq %r15, %rdi
movq %r13, %rsi
callq *0x68(%rax)
jmp 0x17389
movq 0x2d0(%rsp), %rax
movabsq $0x65636e6575716573, %rcx # imm = 0x65636E6575716573
xorq %rcx, %rax
movzbl 0x2d8(%rsp), %ecx
orq %rax, %rcx
je 0x1734e
movl 0x2d0(%rsp), %eax
movl $0x656d616e, %ecx       # imm = 0x656D616E
xorl %ecx, %eax
movzbl 0x2d4(%rsp), %ecx
orl %eax, %ecx
je 0x1734e
movq 0x2d8(%rsp), %rax
movabsq $0x6e6f6974756c6f73, %rsi # imm = 0x6E6F6974756C6F73
xorq %rsi, %rax
movq 0x2d0(%rsp), %rcx
movabsq $0x65725f6874706564, %rdx # imm = 0x65725F6874706564
xorq %rdx, %rcx
movzbl 0x2e0(%rsp), %edx
orq %rcx, %rdx
orq %rax, %rdx
je 0x173a9
movq 0x2d8(%rsp), %rax
xorq %rsi, %rax
movq 0x2d0(%rsp), %rcx
movabsq $0x65725f726f6c6f63, %rdx # imm = 0x65725F726F6C6F63
xorq %rdx, %rcx
movzbl 0x2e0(%rsp), %edx
orq %rcx, %rdx
orq %rax, %rdx
je 0x1751e
movdqa 0x2d0(%rsp), %xmm0
pcmpeqb 0xa44fc(%rip), %xmm0    # 0xbb4c0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x173d1
movq 0x2d0(%rsp), %rax
movabsq $0x69645f726f6c6f63, %rcx # imm = 0x69645F726F6C6F63
xorq %rcx, %rax
movq 0x2d8(%rsp), %rcx
movabsq $0x79726f74636572, %rdx # imm = 0x79726F74636572
xorq %rdx, %rcx
orq %rax, %rcx
je 0x173d1
movdqu 0x2d3(%rsp), %xmm0
pcmpeqb 0xa44b9(%rip), %xmm0    # 0xbb4d0
movdqa 0x2d0(%rsp), %xmm1
pcmpeqb 0xa44b8(%rip), %xmm1    # 0xbb4e0
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x173d1
movdqu 0x2d3(%rsp), %xmm0
pcmpeqb 0xa44a4(%rip), %xmm0    # 0xbb4f0
movdqa 0x2d0(%rsp), %xmm1
pcmpeqb 0xa44a3(%rip), %xmm1    # 0xbb500
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x173d1
movzwl 0x2e0(%rsp), %eax
movd %eax, %xmm0
movdqa 0x2d0(%rsp), %xmm1
pcmpeqb 0xa4483(%rip), %xmm1    # 0xbb510
pcmpeqb 0xa448b(%rip), %xmm0    # 0xbb520
pand %xmm1, %xmm0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x173d1
movdqa 0x2d0(%rsp), %xmm0
pcmpeqb 0xa4477(%rip), %xmm0    # 0xbb530
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x173d1
movq 0x2d0(%rsp), %rax
movabsq $0x69736e6972746e69, %rcx # imm = 0x69736E6972746E69
xorq %rcx, %rax
movq 0x2d3(%rsp), %rcx
movabsq $0x736369736e6972, %rdx # imm = 0x736369736E6972
xorq %rdx, %rcx
orq %rax, %rcx
je 0x17580
movq 0x2d8(%rsp), %rax
movabsq $0x736369736e697274, %rcx # imm = 0x736369736E697274
xorq %rcx, %rax
movq 0x2d0(%rsp), %rcx
movabsq $0x6e695f6874706564, %rdx # imm = 0x6E695F6874706564
xorq %rdx, %rcx
movzbl 0x2e0(%rsp), %edx
orq %rcx, %rdx
orq %rax, %rdx
je 0x17580
movzwl 0x2e0(%rsp), %eax
movd %eax, %xmm0
pcmpeqb 0xa4403(%rip), %xmm0    # 0xbb550
movdqa 0x2d0(%rsp), %xmm1
pcmpeqb 0xa43e2(%rip), %xmm1    # 0xbb540
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x17679
movabsq $0x6e695f6874706564, %rax # imm = 0x6E695F6874706564
movq %rax, %xmm0
movabsq $0x736369736e697274, %rax # imm = 0x736369736E697274
movq %rax, %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movq 0x2e0(%rsp), %xmm1
pcmpeqb 0x2d0(%rsp), %xmm0
pcmpeqb 0xa43b3(%rip), %xmm1    # 0xbb560
pand %xmm1, %xmm0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x17679
movl 0x2d0(%rsp), %eax
movl $0x6e616373, %ecx       # imm = 0x6E616373
xorl %ecx, %eax
movzbl 0x2d4(%rsp), %ecx
orl %eax, %ecx
je 0x17802
movl 0x2d0(%rsp), %eax
movl $0x67616d69, %ecx       # imm = 0x67616D69
xorl %ecx, %eax
movzwl 0x2d4(%rsp), %ecx
xorl $0x65, %ecx
orl %eax, %ecx
je 0x17802
movq 0x2d0(%rsp), %rax
movabsq $0x5f64656c6562616c, %rcx # imm = 0x5F64656C6562616C
xorq %rcx, %rax
movq 0x2d6(%rsp), %rcx
movabsq $0x6567616d695f64, %rdx # imm = 0x6567616D695F64
xorq %rdx, %rcx
orq %rax, %rcx
leaq 0xed0(%rsp), %r9
je 0x179bc
movl 0x2d0(%rsp), %eax
movl $0x6d617266, %ecx       # imm = 0x6D617266
xorl %ecx, %eax
movzwl 0x2d4(%rsp), %ecx
xorl $0x65, %ecx
orl %eax, %ecx
je 0x17b9f
movq 0x2d0(%rsp), %rax
movabsq $0x6c676e6174636572, %rcx # imm = 0x6C676E6174636572
xorq %rcx, %rax
movzwl 0x2d8(%rsp), %ecx
xorq $0x65, %rcx
orq %rax, %rcx
je 0x17d50
movl 0x2d0(%rsp), %eax
movl $0x6873656d, %ecx       # imm = 0x6873656D
xorl %ecx, %eax
movzbl 0x2d4(%rsp), %ecx
orl %eax, %ecx
jne 0x17389
movq %r12, %rdi
leaq 0xa4656(%rip), %rsi     # 0xbb903
movq %rbx, %rdx
movq %r13, %rcx
movq %r9, %r8
leaq 0x16d0(%rsp), %r9
xorl %eax, %eax
callq 0x11590
cmpl $0x4, %eax
jne 0x17f64
movl $0x138, %edi            # imm = 0x138
callq 0x115b0
movq %rax, (%rsp)
movq %rax, %rdi
callq 0x2b364
movq (%rsp), %rdi
movq (%rdi), %rax
leaq 0xed0(%rsp), %rsi
callq *0x180(%rax)
testl %eax, %eax
je 0x17f66
movl $0xa0, %edi
callq 0x115b0
movq 0x16d0(%rsp), %xmm0
movq %rax, 0x18(%rsp)
movq %rax, %rdi
movq %r13, %rsi
movq (%rsp), %rdx
callq 0x1ab3e
movq 0x18(%rsp), %rdi
movq (%rdi), %rax
leaq 0xed0(%rsp), %rsi
callq *0xc8(%rax)
movq (%r15), %rax
movq %r15, %rdi
movq 0x18(%rsp), %rsi
jmp 0x17edf
movl $0x400, %edx            # imm = 0x400
movq %r13, %rdi
xorl %esi, %esi
callq 0x11310
movq %r12, %rdi
leaq 0xa52f0(%rip), %rsi     # 0xbc657
movq %rbx, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x11590
cmpl $0x2, %eax
jne 0x17ef0
movq (%r15), %rax
movq %r15, %rdi
movq %r13, %rsi
callq *0x38(%rax)
movq %r12, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %r14, %rdx
callq 0x11960
incl %ebp
testq %rax, %rax
jne 0x16e7e
jmp 0x17ee7
movq %r12, %rdi
leaq 0xa4321(%rip), %rsi     # 0xbb6d4
movq %rbx, %rdx
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
xorl %eax, %eax
callq 0x11590
cmpl $0x3, %eax
je 0x17389
jmp 0x17f14
movq %r12, %rdi
leaq 0xa527c(%rip), %rsi     # 0xbc657
movq %rbx, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x11590
cmpl $0x2, %eax
jne 0x17f16
movq 0x2d0(%rsp), %rcx
movabsq $0x69645f726f6c6f63, %rax # imm = 0x69645F726F6C6F63
xorq %rax, %rcx
movq 0x2d8(%rsp), %rdx
movabsq $0x79726f74636572, %rsi # imm = 0x79726F74636572
xorq %rsi, %rdx
movl $0x40, %eax
orq %rcx, %rdx
je 0x1756f
movq 0x2d0(%rsp), %rcx
movabsq $0x69645f6874706564, %rdx # imm = 0x69645F6874706564
xorq %rdx, %rcx
movq 0x2d8(%rsp), %rdx
xorq %rsi, %rdx
orq %rcx, %rdx
je 0x1755c
movdqu 0x2d3(%rsp), %xmm0
pcmpeqb 0xa406d(%rip), %xmm0    # 0xbb4d0
movdqa 0x2d0(%rsp), %xmm1
pcmpeqb 0xa406c(%rip), %xmm1    # 0xbb4e0
pand %xmm0, %xmm1
pmovmskb %xmm1, %ecx
cmpl $0xffff, %ecx           # imm = 0xFFFF
je 0x17563
movdqu 0x2d3(%rsp), %xmm0
pcmpeqb 0xa4057(%rip), %xmm0    # 0xbb4f0
movdqa 0x2d0(%rsp), %xmm1
pcmpeqb 0xa4056(%rip), %xmm1    # 0xbb500
pand %xmm0, %xmm1
pmovmskb %xmm1, %ecx
cmpl $0xffff, %ecx           # imm = 0xFFFF
je 0x1756a
movdqa 0x2d0(%rsp), %xmm0
pcmpeqb 0xa4061(%rip), %xmm0    # 0xbb530
pmovmskb %xmm0, %ecx
cmpl $0xffff, %ecx           # imm = 0xFFFF
je 0x1756f
movzwl 0x2e0(%rsp), %eax
movd %eax, %xmm0
movdqa 0x2d0(%rsp), %xmm1
pcmpeqb 0xa4014(%rip), %xmm1    # 0xbb510
pcmpeqb 0xa401c(%rip), %xmm0    # 0xbb520
pand %xmm1, %xmm0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0x17389
movl $0x60, %eax
jmp 0x1756f
cmpl $0x0, 0x10(%rsp)
je 0x17530
cmpl $0x0, 0xc(%rsp)
jne 0x17389
movq %r12, %rdi
leaq 0xa419a(%rip), %rsi     # 0xbb6d4
movq %rbx, %rdx
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
xorl %eax, %eax
callq 0x11590
cmpl $0x3, %eax
je 0x17389
jmp 0x17f18
movl $0x48, %eax
jmp 0x1756f
movl $0x50, %eax
jmp 0x1756f
movl $0x58, %eax
movq (%r15), %rcx
movq %r15, %rdi
movq %r13, %rsi
callq *(%rcx,%rax)
jmp 0x17389
movq %r12, %rdi
leaq 0xa50cd(%rip), %rsi     # 0xbc657
movq %rbx, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x11590
cmpl $0x2, %eax
jne 0x17f1a
movq %r13, %rdi
leaq 0xaa4b9(%rip), %rsi     # 0xc1a63
callq 0x11700
movq %rax, (%rsp)
testq %rax, %rax
je 0x17f1c
movq 0x58(%r15), %rdi
testq %rdi, %rdi
je 0x175d9
leaq 0xa418a(%rip), %rsi     # 0xbb756
callq 0x11840
testl %eax, %eax
je 0x17713
subq $0x8, %rsp
movq 0x8(%rsp), %rdi
leaq 0xa4548(%rip), %rsi     # 0xbbb31
leaq 0xed8(%rsp), %rdx
leaq 0xee0(%rsp), %rcx
leaq 0xee8(%rsp), %r8
leaq 0xef0(%rsp), %r9
xorl %eax, %eax
leaq 0xf18(%rsp), %r10
pushq %r10
leaq 0xf18(%rsp), %r10
pushq %r10
leaq 0xf18(%rsp), %r10
pushq %r10
leaq 0xf18(%rsp), %r10
pushq %r10
leaq 0xf18(%rsp), %r10
pushq %r10
callq 0x11ad0
addq $0x30, %rsp
cmpl $0x9, %eax
jne 0x17f25
leaq 0x16d0(%rsp), %rdi
leaq 0xed0(%rsp), %rsi
callq 0x6d232
leaq 0xe0(%rsp), %rdi
leaq 0x16d0(%rsp), %rsi
jmp 0x177ef
movq %r12, %rdi
leaq 0xa4147(%rip), %rsi     # 0xbb7ca
movq %rbx, %rdx
movq %r13, %rcx
leaq 0x1ed8(%rsp), %r8
leaq 0x1ee0(%rsp), %r9
xorl %eax, %eax
leaq 0x1f10(%rsp), %r10
pushq %r10
leaq 0x1f10(%rsp), %r10
pushq %r10
leaq 0x1f10(%rsp), %r10
pushq %r10
leaq 0x1f10(%rsp), %r10
pushq %r10
leaq 0x1f10(%rsp), %r10
pushq %r10
leaq 0x1f10(%rsp), %r10
pushq %r10
callq 0x11590
addq $0x30, %rsp
cmpl $0xa, %eax
jne 0x17f3d
leaq 0xed0(%rsp), %rdi
movq %r13, %rsi
callq 0x6d232
leaq 0xe0(%rsp), %rdi
leaq 0xed0(%rsp), %rsi
callq 0x6dbec
jmp 0x17389
subq $0x8, %rsp
movq 0x8(%rsp), %rdi
leaq 0xa4408(%rip), %rsi     # 0xbbb2b
leaq 0x16d8(%rsp), %rdx
leaq 0x6d8(%rsp), %rcx
leaq 0x1c8(%rsp), %r8
leaq 0x48(%rsp), %r9
xorl %eax, %eax
leaq 0x130(%rsp), %r10
pushq %r10
leaq 0x140(%rsp), %r10
pushq %r10
leaq 0x150(%rsp), %r10
pushq %r10
leaq 0x40(%rsp), %r10
pushq %r10
leaq 0xf0(%rsp), %r10
pushq %r10
leaq 0x58(%rsp), %r10
pushq %r10
leaq 0x178(%rsp), %r10
pushq %r10
callq 0x11ad0
addq $0x40, %rsp
cmpl $0xb, %eax
jne 0x17f3f
movq 0x1c0(%rsp), %xmm0
movsd 0x140(%rsp), %xmm2
movsd 0x40(%rsp), %xmm4
movsd 0x28(%rsp), %xmm5
subq $0x8, %rsp
pxor %xmm1, %xmm1
xorps %xmm3, %xmm3
xorps %xmm6, %xmm6
xorps %xmm7, %xmm7
leaq 0xed8(%rsp), %rdi
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
pushq %rax
callq 0x6d1fc
addq $0x10, %rsp
leaq 0xe0(%rsp), %rdi
leaq 0xed0(%rsp), %rsi
callq 0x6dbec
movq (%rsp), %rdi
callq 0x115a0
jmp 0x17389
movl 0x14(%rsp), %ecx
cmpl $0x2, %ecx
jl 0x17821
movl 0x8(%rsp), %eax
incl %eax
movl %eax, 0x8(%rsp)
cltd
idivl %ecx
cmpl $0x1, %edx
jne 0x17389
leaq 0xe0(%rsp), %rdi
callq 0x6d2aa
testl %eax, %eax
jne 0x17f48
subq $0x8, %rsp
movq %r12, %rdi
leaq 0xa400f(%rip), %rsi     # 0xbb853
movq %rbx, %rdx
movq %r13, %rcx
leaq 0xed8(%rsp), %r8
leaq 0x6d8(%rsp), %r9
xorl %eax, %eax
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
callq 0x11590
addq $0x80, %rsp
cmpl $0x13, %eax
jne 0x17f58
movq (%r15), %rax
movq %r15, %rdi
callq *0xd0(%rax)
movq %rax, %rdi
movq %rax, (%rsp)
movl 0x10(%rsp), %esi
movl 0xc(%rsp), %edx
movq (%rax), %rax
callq *0x10(%rax)
movq (%rsp), %rdi
movq (%rdi), %rax
leaq 0xed0(%rsp), %rsi
callq *0x1a0(%rax)
movq (%rsp), %rdi
movq (%rdi), %rax
movq %r13, %rsi
callq *0x1a8(%rax)
movq (%rsp), %rdi
movq (%rdi), %rax
leaq 0xe0(%rsp), %rsi
callq *0x78(%rax)
leaq 0x1c0(%rsp), %rdi
leaq 0x6d0(%rsp), %rsi
callq 0x47ff2
leaq 0x16d0(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
xorl %edx, %edx
callq 0x45c1a
movq (%rsp), %rdi
movq (%rdi), %rax
leaq 0x16d0(%rsp), %rsi
callq *0x68(%rax)
leaq 0x16d0(%rsp), %rdi
callq 0x45c68
movq (%r15), %rax
movq %r15, %rdi
movq (%rsp), %rsi
callq *0x10(%rax)
jmp 0x17389
movl 0x14(%rsp), %ecx
cmpl $0x2, %ecx
jl 0x179db
movl 0x8(%rsp), %eax
incl %eax
movl %eax, 0x8(%rsp)
cltd
idivl %ecx
cmpl $0x1, %edx
jne 0x17389
leaq 0xe0(%rsp), %rdi
callq 0x6d2aa
testl %eax, %eax
jne 0x17f5a
subq $0x8, %rsp
movq %r12, %rdi
leaq 0xa3e51(%rip), %rsi     # 0xbb84f
movq %rbx, %rdx
movq %r13, %rcx
leaq 0xed8(%rsp), %r8
leaq 0x16d8(%rsp), %r9
xorl %eax, %eax
leaq 0xc0(%rsp), %r10
pushq %r10
leaq 0xc0(%rsp), %r10
pushq %r10
leaq 0xc0(%rsp), %r10
pushq %r10
leaq 0xc0(%rsp), %r10
pushq %r10
leaq 0xc0(%rsp), %r10
pushq %r10
leaq 0xc0(%rsp), %r10
pushq %r10
leaq 0xc0(%rsp), %r10
pushq %r10
leaq 0xc0(%rsp), %r10
pushq %r10
leaq 0xc0(%rsp), %r10
pushq %r10
leaq 0xc0(%rsp), %r10
pushq %r10
leaq 0xc0(%rsp), %r10
pushq %r10
leaq 0xc0(%rsp), %r10
pushq %r10
leaq 0xc0(%rsp), %r10
pushq %r10
leaq 0xc0(%rsp), %r10
pushq %r10
leaq 0xc0(%rsp), %r10
pushq %r10
leaq 0xc0(%rsp), %r10
pushq %r10
leaq 0x758(%rsp), %r10
pushq %r10
callq 0x11590
addq $0x90, %rsp
cmpl $0x15, %eax
jne 0x17f5c
movq (%r15), %rax
movq %r15, %rdi
callq *0xd0(%rax)
movq %rax, %rdi
movq %rax, (%rsp)
movl 0x10(%rsp), %esi
movl 0xc(%rsp), %edx
movq (%rax), %rax
callq *0x10(%rax)
movq (%rsp), %rdi
movq (%rdi), %rax
leaq 0xed0(%rsp), %rsi
callq *0x1a0(%rax)
movq (%rsp), %rdi
movq (%rdi), %rax
movq %r13, %rsi
callq *0x1a8(%rax)
movq (%rsp), %rdi
movq (%rdi), %rax
leaq 0x16d0(%rsp), %rsi
callq *0x1b0(%rax)
movq (%rsp), %rdi
movq (%rdi), %rax
leaq 0x6d0(%rsp), %rsi
callq *0x1b8(%rax)
movq (%rsp), %rdi
movq (%rdi), %rax
leaq 0xe0(%rsp), %rsi
callq *0x78(%rax)
leaq 0x140(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x47ff2
leaq 0x1c0(%rsp), %rdi
leaq 0x140(%rsp), %rsi
xorl %edx, %edx
callq 0x45c1a
movq (%rsp), %rdi
movq (%rdi), %rax
leaq 0x1c0(%rsp), %rsi
callq *0x68(%rax)
leaq 0x1c0(%rsp), %rdi
jmp 0x179a5
movl 0x14(%rsp), %ecx
cmpl $0x2, %ecx
jl 0x17bbe
movl 0x8(%rsp), %eax
incl %eax
movl %eax, 0x8(%rsp)
cltd
idivl %ecx
cmpl $0x1, %edx
jne 0x17389
leaq 0xe0(%rsp), %rdi
callq 0x6d2aa
testl %eax, %eax
jne 0x17f5e
subq $0x8, %rsp
movq %r12, %rdi
leaq 0xa3caf(%rip), %rsi     # 0xbb890
movq %rbx, %rdx
movq %r13, %rcx
leaq 0x48(%rsp), %r8
leaq 0xed8(%rsp), %r9
xorl %eax, %eax
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x750(%rsp), %r10
pushq %r10
leaq 0x1c8(%rsp), %r10
pushq %r10
callq 0x11590
addq $0x90, %rsp
cmpl $0x15, %eax
jne 0x17f60
movq (%r15), %rax
movq %r15, %rdi
callq *0xd0(%rax)
movq %rax, %rdi
movq %rax, (%rsp)
movl 0x10(%rsp), %esi
movl 0xc(%rsp), %edx
movq (%rax), %rax
callq *0x10(%rax)
movq (%rsp), %rdi
movq (%rdi), %rax
leaq 0xed0(%rsp), %rsi
callq *0x1a0(%rax)
movq (%rsp), %rdi
movq (%rdi), %rax
movq %r13, %rsi
callq *0x1a8(%rax)
movq (%rsp), %rdi
movq (%rdi), %rax
leaq 0xe0(%rsp), %rsi
callq *0x78(%rax)
leaq 0x1c0(%rsp), %rdi
leaq 0x6d0(%rsp), %rsi
callq 0x47ff2
leaq 0x16d0(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
xorl %edx, %edx
callq 0x45c1a
movq (%rsp), %rdi
movq (%rdi), %rax
leaq 0x16d0(%rsp), %rsi
callq *0x68(%rax)
jmp 0x1799d
subq $0x8, %rsp
movq %r12, %rdi
leaq 0xa3b79(%rip), %rsi     # 0xbb8d7
movq %rbx, %rdx
movq %r13, %rcx
leaq 0x28(%rsp), %r8
xorl %eax, %eax
leaq 0x1d8(%rsp), %r10
pushq %r10
leaq 0x1d8(%rsp), %r10
pushq %r10
leaq 0x1d8(%rsp), %r10
pushq %r10
leaq 0x700(%rsp), %r10
pushq %r10
leaq 0x700(%rsp), %r10
pushq %r10
leaq 0x700(%rsp), %r10
pushq %r10
leaq 0x1718(%rsp), %r10
pushq %r10
leaq 0x1718(%rsp), %r10
pushq %r10
leaq 0x1718(%rsp), %r10
pushq %r10
leaq 0xf30(%rsp), %r10
pushq %r10
leaq 0xf30(%rsp), %r10
pushq %r10
callq 0x11590
addq $0x60, %rsp
cmpl $0xf, %eax
jne 0x17f62
leaq 0x40(%rsp), %rdi
leaq 0xed0(%rsp), %rsi
callq 0x4b630
leaq 0x140(%rsp), %rdi
leaq 0x6d0(%rsp), %rsi
callq 0x4c128
leaq 0x140(%rsp), %rdi
callq 0x4c3ac
leaq 0x28(%rsp), %rdi
leaq 0x16d0(%rsp), %rsi
callq 0x4c128
leaq 0x28(%rsp), %rdi
callq 0x4c3ac
leaq 0xc8(%rsp), %rdi
leaq 0x140(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x4c9ca
leaq 0xc8(%rsp), %rdi
callq 0x4c3ac
movl $0x78, %edi
callq 0x115b0
movq 0x1c0(%rsp), %xmm0
movq 0x1c8(%rsp), %xmm1
movq %rax, (%rsp)
movq %rax, %rdi
leaq 0x40(%rsp), %rsi
leaq 0xc8(%rsp), %rdx
leaq 0x140(%rsp), %rcx
callq 0x40bf4
movl $0xa0, %edi
callq 0x115b0
movq 0x20(%rsp), %xmm0
movq %rax, 0x18(%rsp)
movq %rax, %rdi
movq %r13, %rsi
movq (%rsp), %rdx
callq 0x1a9be
movq 0x1d0(%rsp), %xmm0
movq 0x18(%rsp), %rsi
movq %xmm0, 0x98(%rsi)
movq (%r15), %rax
movq %r15, %rdi
callq *0x20(%rax)
jmp 0x17389
movl $0x1, %eax
jmp 0x17f02
jmp 0x17ef0
leaq 0xa3796(%rip), %rdi     # 0xbb68d
movl %ebp, %esi
xorl %eax, %eax
callq 0x77f42
xorl %eax, %eax
addq $0x36d8, %rsp           # imm = 0x36D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x17ef0
jmp 0x17ef0
jmp 0x17ef0
jmp 0x17ef0
leaq 0xa3810(%rip), %rdi     # 0xbb733
jmp 0x17f2c
leaq 0xa3863(%rip), %rdi     # 0xbb78f
leaq 0x1ed0(%rsp), %rsi
xorl %eax, %eax
callq 0x77f42
jmp 0x17f00
jmp 0x17ef0
leaq 0xa381b(%rip), %rdi     # 0xbb761
jmp 0x17f4f
leaq 0xa3899(%rip), %rdi     # 0xbb7e8
xorl %eax, %eax
callq 0x77f42
jmp 0x17f00
jmp 0x17ef0
jmp 0x17f48
jmp 0x17ef0
jmp 0x17f48
jmp 0x17ef0
jmp 0x17ef0
jmp 0x17ef0
leaq 0xa39a0(%rip), %rdi     # 0xbb90d
leaq 0xed0(%rsp), %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x77f42
jmp 0x17f00
movq %rax, %rbx
leaq 0x1c0(%rsp), %rdi
jmp 0x17fc8
jmp 0x17fbd
jmp 0x17f9b
movq %rax, %rbx
movl $0x78, %esi
jmp 0x17fb2
movq %rax, %rbx
movl $0xa0, %esi
movq 0x18(%rsp), %rdi
jmp 0x17fb6
movq %rax, %rbx
movl $0x138, %esi            # imm = 0x138
movq (%rsp), %rdi
callq 0x115c0
jmp 0x17fcd
movq %rax, %rbx
leaq 0x16d0(%rsp), %rdi
callq 0x45c68
movq %rbx, %rdi
callq 0x11a60
nop