// File: tomfunkhouser[P]gaps/apps/scn2img/scn2img.cpp
// Function: RenderImagesWithRaycasting(gaps::R3Camera const&, gaps::R3Scene*, char const*, int)
static int
RenderImagesWithRaycasting(const R3Camera& camera, R3Scene *scene, const char *output_image_directory, int image_index)
{
  // Print debug message
  if (print_debug) {
    printf("  Raycasting %06d ...\n", image_index);
    fflush(stdout);
  }
 
  // Some useful variables
  RNScalar ground_y = EstimateGroundY(camera, scene);
  R2Viewport viewport(0, 0, width, height);
  R3Viewer viewer(camera, viewport);
  char output_image_filename[1024];
  R3SceneNode *node = NULL;
  R3Material *material = NULL;
  R3Shape *shape = NULL;
  R3Point position;
  R3Vector normal;
  RNScalar t;

  // Create images
  R2Grid depth_image(width, height);
  R2Grid height_image(width, height);
  R2Grid angle_image(width, height);
  R2Grid xnormal_image(width, height);
  R2Grid ynormal_image(width, height);
  R2Grid znormal_image(width, height);
  R2Grid ndotv_image(width, height);
  R2Image albedo_image(width, height, 3);
  R2Image brdf_image(width, height, 3);
  R2Grid material_image(width, height);
  R2Grid node_image(width, height);
  R2Grid category_image(width, height);
  
  // Cast ray for every pixel
  for (int iy = 0; iy < height; iy++) {
    for (int ix = 0; ix < width; ix++) {
      R3Ray ray = viewer.WorldRay(ix, iy);
      if (scene->Intersects(ray, &node, &material, &shape, &position, &normal, &t)) {
        if (capture_depth_images) {
          RNScalar depth = (position - camera.Origin()).Dot(camera.Towards());
          depth_image.SetGridValue(ix, iy, 1000 * depth);
        }
        if (capture_height_images) {
          RNScalar height = position.Y() - ground_y;
          height_image.SetGridValue(ix, iy, 1000.0 * height);
        }
        if (capture_angle_images) {
          RNScalar value = (RN_PI - acos(normal.Z())) / RN_PI;
          angle_image.SetGridValue(ix, iy, 65535.0 * value);
        }
        if (capture_normal_images) {
          RNScalar xvalue = 0.5*normal.X() + 0.5;
          RNScalar yvalue = 0.5*normal.Y() + 0.5;
          RNScalar zvalue = 0.5*normal.Z() + 0.5;
          xnormal_image.SetGridValue(ix, iy, 65535.0 * xvalue);
          ynormal_image.SetGridValue(ix, iy, 65535.0 * yvalue);
          znormal_image.SetGridValue(ix, iy, 65535.0 * zvalue);
        }
        if (capture_ndotv_images) {
          RNScalar ndotv = fabs(normal.Dot(camera.Towards()));
          xnormal_image.SetGridValue(ix, iy, 65535.0 * ndotv);
        }
        if (capture_brdf_images) {
          const R3Brdf *brdf = (material) ? material->Brdf() : NULL;
          if (!brdf) brdf = &R3default_brdf;
          RNScalar kd = brdf->Diffuse().Luminance();
          RNScalar ks = brdf->Specular().Luminance();
          RNScalar kt = brdf->Transmission().Luminance();
          brdf_image.SetPixelRGB(ix, iy, RNRgb(kd, ks, kt));
        }
        if (capture_material_images) {
          int material_index = (material) ? material->SceneIndex() + 1 : 0;
          material_image.SetGridValue(ix, iy, material_index);
        }
        if (capture_node_images) {
          int node_index = node->SceneIndex() + 1;
          node_image.SetGridValue(ix, iy, node_index);
        }
        if (capture_category_images) {
          const char *model_index = NULL;
          R3SceneNode *ancestor = node;
          while (!model_index && ancestor) { model_index = ancestor->Info("index"); ancestor = ancestor->Parent(); }
          if (model_index) category_image.SetGridValue(ix, iy, atoi(model_index));
          else category_image.SetGridValue(ix, iy, 0);
                                                       
        }
      }
    }
  }
  
  // Write images
  if (capture_depth_images) {
    sprintf(output_image_filename, "%s/%06d_depth.png", output_image_directory, image_index);
    depth_image.WriteFile(output_image_filename);
  }
  if (capture_height_images) {
    sprintf(output_image_filename, "%s/%06d_height.png", output_image_directory, image_index);
    height_image.WriteFile(output_image_filename);
  }
  if (capture_angle_images) {
    sprintf(output_image_filename, "%s/%06d_angle.png", output_image_directory, image_index);
    angle_image.WriteFile(output_image_filename);
  }
  if (capture_normal_images) {
    sprintf(output_image_filename, "%s/%06d_xnormal.png", output_image_directory, image_index);
    xnormal_image.WriteFile(output_image_filename);
    sprintf(output_image_filename, "%s/%06d_ynormal.png", output_image_directory, image_index);
    ynormal_image.WriteFile(output_image_filename);
    sprintf(output_image_filename, "%s/%06d_znormal.png", output_image_directory, image_index);
    znormal_image.WriteFile(output_image_filename);
  }
  if (capture_ndotv_images) {
    sprintf(output_image_filename, "%s/%06d_ndotv.png", output_image_directory, image_index);
    ndotv_image.WriteFile(output_image_filename);
  }
  if (capture_brdf_images) {
    sprintf(output_image_filename, "%s/%06d_brdf.jpg", output_image_directory, image_index);
    brdf_image.Write(output_image_filename);
  }
  if (capture_material_images) {
    sprintf(output_image_filename, "%s/%06d_material.png", output_image_directory, image_index);
    material_image.WriteFile(output_image_filename);
  }
  if (capture_node_images) {
    sprintf(output_image_filename, "%s/%06d_node.png", output_image_directory, image_index);
    node_image.WriteFile(output_image_filename);
  }
  if (capture_category_images) {
    sprintf(output_image_filename, "%s/%06d_category.png", output_image_directory, image_index);
    node_image.WriteFile(output_image_filename);
  }

  // Return success
  return 1;
}

// Assembly:
subq $0xf88, %rsp            # imm = 0xF88
movq %rdi, 0xf80(%rsp)
movq %rsi, 0xf78(%rsp)
movq %rdx, 0xf70(%rsp)
movl %ecx, 0xf6c(%rsp)
cmpl $0x0, 0x1f0e07(%rip)    # 0x21ebe4
je 0x2de03
movl 0xf6c(%rsp), %esi
leaq 0x17fa89(%rip), %rdi    # 0x1ad876
movb $0x0, %al
callq 0x23090
movq 0x1ea195(%rip), %rax    # 0x217f90
movq (%rax), %rdi
callq 0x23bd0
movq 0xf80(%rsp), %rdi
movq 0xf78(%rsp), %rsi
callq 0x2d980
movsd %xmm0, 0xf60(%rsp)
movl 0x1eac89(%rip), %ecx    # 0x218ab0
movl 0x1eac86(%rip), %r8d    # 0x218ab4
leaq 0xf50(%rsp), %rdi
movq %rdi, 0xe0(%rsp)
xorl %edx, %edx
movl %edx, %esi
callq 0x627b0
movq 0xe0(%rsp), %rdx
movq 0xf80(%rsp), %rsi
leaq 0xea8(%rsp), %rdi
callq 0x5da10
movq $0x0, 0xa98(%rsp)
movq $0x0, 0xa90(%rsp)
movq $0x0, 0xa88(%rsp)
leaq 0xa70(%rsp), %rdi
callq 0xd0020
jmp 0x2de97
leaq 0xa48(%rsp), %rdi
callq 0xd1180
jmp 0x2dea6
movl 0x1eac04(%rip), %esi    # 0x218ab0
movl 0x1eac02(%rip), %edx    # 0x218ab4
leaq 0x970(%rsp), %rdi
callq 0xe36e0
jmp 0x2dec1
movl 0x1eabe9(%rip), %esi    # 0x218ab0
movl 0x1eabe7(%rip), %edx    # 0x218ab4
leaq 0x8a0(%rsp), %rdi
callq 0xe36e0
jmp 0x2dedc
movl 0x1eabce(%rip), %esi    # 0x218ab0
movl 0x1eabcc(%rip), %edx    # 0x218ab4
leaq 0x7d0(%rsp), %rdi
callq 0xe36e0
jmp 0x2def7
movl 0x1eabb3(%rip), %esi    # 0x218ab0
movl 0x1eabb1(%rip), %edx    # 0x218ab4
leaq 0x700(%rsp), %rdi
callq 0xe36e0
jmp 0x2df12
movl 0x1eab98(%rip), %esi    # 0x218ab0
movl 0x1eab96(%rip), %edx    # 0x218ab4
leaq 0x630(%rsp), %rdi
callq 0xe36e0
jmp 0x2df2d
movl 0x1eab7d(%rip), %esi    # 0x218ab0
movl 0x1eab7b(%rip), %edx    # 0x218ab4
leaq 0x560(%rsp), %rdi
callq 0xe36e0
jmp 0x2df48
movl 0x1eab62(%rip), %esi    # 0x218ab0
movl 0x1eab60(%rip), %edx    # 0x218ab4
leaq 0x490(%rsp), %rdi
callq 0xe36e0
jmp 0x2df63
movl 0x1eab47(%rip), %esi    # 0x218ab0
movl 0x1eab45(%rip), %edx    # 0x218ab4
leaq 0x478(%rsp), %rdi
movl $0x3, %ecx
callq 0x1029a0
jmp 0x2df83
movl 0x1eab27(%rip), %esi    # 0x218ab0
movl 0x1eab25(%rip), %edx    # 0x218ab4
leaq 0x460(%rsp), %rdi
movl $0x3, %ecx
callq 0x1029a0
jmp 0x2dfa3
movl 0x1eab07(%rip), %esi    # 0x218ab0
movl 0x1eab05(%rip), %edx    # 0x218ab4
leaq 0x390(%rsp), %rdi
callq 0xe36e0
jmp 0x2dfbe
movl 0x1eaaec(%rip), %esi    # 0x218ab0
movl 0x1eaaea(%rip), %edx    # 0x218ab4
leaq 0x2c0(%rsp), %rdi
callq 0xe36e0
jmp 0x2dfd9
movl 0x1eaad1(%rip), %esi    # 0x218ab0
movl 0x1eaacf(%rip), %edx    # 0x218ab4
leaq 0x1f0(%rsp), %rdi
callq 0xe36e0
jmp 0x2dff4
movl $0x0, 0x1ec(%rsp)
movl 0x1ec(%rsp), %eax
cmpl 0x1eaaa8(%rip), %eax    # 0x218ab4
jge 0x2e8d9
movl $0x0, 0x1e8(%rsp)
movl 0x1e8(%rsp), %eax
cmpl 0x1eaa86(%rip), %eax    # 0x218ab0
jge 0x2e8c1
cvtsi2sdl 0x1e8(%rsp), %xmm0
cvtsi2sdl 0x1ec(%rsp), %xmm1
leaq 0x1b8(%rsp), %rdi
leaq 0xea8(%rsp), %rsi
callq 0x5f390
jmp 0x2e059
movq 0xf78(%rsp), %rdi
leaq 0x1eb240(%rip), %rax    # 0x2192a8
movsd (%rax), %xmm1
movq %rsp, %rax
leaq 0xa40(%rsp), %rcx
movq %rcx, 0x8(%rax)
leaq 0xa48(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x1b8(%rsp), %rsi
leaq 0xa98(%rsp), %rdx
leaq 0xa90(%rsp), %rcx
leaq 0xa88(%rsp), %r8
leaq 0xa70(%rsp), %r9
xorps %xmm0, %xmm0
callq 0x32000
movl %eax, 0xdc(%rsp)
jmp 0x2e0bf
movl 0xdc(%rsp), %eax
cmpl $0x0, %eax
je 0x2e8a9
cmpl $0x0, 0x1f0b12(%rip)    # 0x21ebe8
je 0x2e2e4
movq 0xf80(%rsp), %rdi
callq 0x2f380
movq %rax, 0xd0(%rsp)
jmp 0x2e0f3
movq 0xd0(%rsp), %rdx
leaq 0x198(%rsp), %rdi
leaq 0xa70(%rsp), %rsi
callq 0xd0390
jmp 0x2e112
movq 0xf80(%rsp), %rsi
leaq 0x180(%rsp), %rdi
callq 0x2f420
jmp 0x2e129
leaq 0x198(%rsp), %rdi
leaq 0x180(%rsp), %rsi
callq 0xd17a0
movsd %xmm0, 0xc8(%rsp)
jmp 0x2e149
movsd 0xc8(%rsp), %xmm0
movsd %xmm0, 0x1b0(%rsp)
movl 0x1e8(%rsp), %esi
movl 0x1ec(%rsp), %edx
movsd 0x1b0(%rsp), %xmm0
movsd 0x17ee8e(%rip), %xmm1   # 0x1ad008
mulsd %xmm1, %xmm0
leaq 0x970(%rsp), %rdi
callq 0x2ef50
jmp 0x2e18d
jmp 0x2e2e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa68(%rsp)
movl %eax, 0xa64(%rsp)
jmp 0x2ed2f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa68(%rsp)
movl %eax, 0xa64(%rsp)
jmp 0x2ed22
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa68(%rsp)
movl %eax, 0xa64(%rsp)
jmp 0x2ed15
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa68(%rsp)
movl %eax, 0xa64(%rsp)
jmp 0x2ed08
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa68(%rsp)
movl %eax, 0xa64(%rsp)
jmp 0x2ecfb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa68(%rsp)
movl %eax, 0xa64(%rsp)
jmp 0x2ecee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa68(%rsp)
movl %eax, 0xa64(%rsp)
jmp 0x2ece1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa68(%rsp)
movl %eax, 0xa64(%rsp)
jmp 0x2ecd4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa68(%rsp)
movl %eax, 0xa64(%rsp)
jmp 0x2ecc7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa68(%rsp)
movl %eax, 0xa64(%rsp)
jmp 0x2ecba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa68(%rsp)
movl %eax, 0xa64(%rsp)
jmp 0x2ecad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa68(%rsp)
movl %eax, 0xa64(%rsp)
jmp 0x2eca0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa68(%rsp)
movl %eax, 0xa64(%rsp)
leaq 0x1f0(%rsp), %rdi
callq 0xe4b90
jmp 0x2eca0
cmpl $0x0, 0x1f090d(%rip)    # 0x21ebf8
je 0x2e344
leaq 0xa70(%rsp), %rdi
callq 0x2f410
movsd 0xf60(%rsp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x178(%rsp)
movl 0x1e8(%rsp), %esi
movl 0x1ec(%rsp), %edx
movsd 0x178(%rsp), %xmm0
movsd 0x17ecd9(%rip), %xmm1   # 0x1ad008
mulsd %xmm1, %xmm0
leaq 0x8a0(%rsp), %rdi
callq 0x2ef50
jmp 0x2e342
jmp 0x2e344
cmpl $0x0, 0x1f08b1(%rip)    # 0x21ebfc
je 0x2e3e7
leaq 0x183130(%rip), %rax    # 0x1b1488
movsd (%rax), %xmm0
movsd %xmm0, 0xb8(%rsp)
leaq 0xa48(%rsp), %rdi
callq 0x30490
movsd %xmm0, 0xc0(%rsp)
jmp 0x2e37d
movsd 0xc0(%rsp), %xmm0
callq 0x23910
movaps %xmm0, %xmm1
movsd 0xb8(%rsp), %xmm0
subsd %xmm1, %xmm0
leaq 0x1830e6(%rip), %rax    # 0x1b1488
movsd (%rax), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x170(%rsp)
movl 0x1e8(%rsp), %esi
movl 0x1ec(%rsp), %edx
movsd 0x170(%rsp), %xmm0
movsd 0x17ec3e(%rip), %xmm1   # 0x1ad010
mulsd %xmm1, %xmm0
leaq 0x7d0(%rsp), %rdi
callq 0x2ef50
jmp 0x2e3e5
jmp 0x2e3e7
cmpl $0x0, 0x1f0836(%rip)    # 0x21ec24
je 0x2e538
leaq 0xa48(%rsp), %rdi
callq 0x304a0
movsd %xmm0, 0xb0(%rsp)
jmp 0x2e40c
movsd 0xb0(%rsp), %xmm0
movsd 0x17ec13(%rip), %xmm1   # 0x1ad030
movsd %xmm1, 0x98(%rsp)
mulsd %xmm1, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x168(%rsp)
leaq 0xa48(%rsp), %rdi
movq %rdi, 0xa0(%rsp)
callq 0x2f390
movsd 0x98(%rsp), %xmm1
movq 0xa0(%rsp), %rdi
mulsd %xmm1, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x160(%rsp)
callq 0x30490
movsd %xmm0, 0xa8(%rsp)
jmp 0x2e47e
movsd 0xa8(%rsp), %xmm0
movsd 0x17eba1(%rip), %xmm1   # 0x1ad030
mulsd %xmm1, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x158(%rsp)
movl 0x1e8(%rsp), %esi
movl 0x1ec(%rsp), %edx
movsd 0x168(%rsp), %xmm0
movsd 0x17eb51(%rip), %xmm1   # 0x1ad010
mulsd %xmm1, %xmm0
leaq 0x700(%rsp), %rdi
callq 0x2ef50
jmp 0x2e4d2
movl 0x1e8(%rsp), %esi
movl 0x1ec(%rsp), %edx
movsd 0x160(%rsp), %xmm0
movsd 0x17eb1f(%rip), %xmm1   # 0x1ad010
mulsd %xmm1, %xmm0
leaq 0x630(%rsp), %rdi
callq 0x2ef50
jmp 0x2e504
movl 0x1e8(%rsp), %esi
movl 0x1ec(%rsp), %edx
movsd 0x158(%rsp), %xmm0
movsd 0x17eaed(%rip), %xmm1   # 0x1ad010
mulsd %xmm1, %xmm0
leaq 0x560(%rsp), %rdi
callq 0x2ef50
jmp 0x2e536
jmp 0x2e538
cmpl $0x0, 0x1f06c1(%rip)    # 0x21ec00
je 0x2e5cd
movq 0xf80(%rsp), %rsi
leaq 0x138(%rsp), %rdi
callq 0x2f420
jmp 0x2e55c
leaq 0xa48(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0xd17a0
movsd %xmm0, 0x90(%rsp)
jmp 0x2e57c
movsd 0x90(%rsp), %xmm0
movaps 0x17eb34(%rip), %xmm1   # 0x1ad0c0
pand %xmm1, %xmm0
movlpd %xmm0, 0x150(%rsp)
movl 0x1e8(%rsp), %esi
movl 0x1ec(%rsp), %edx
movsd 0x150(%rsp), %xmm0
movsd 0x17ea58(%rip), %xmm1   # 0x1ad010
mulsd %xmm1, %xmm0
leaq 0x700(%rsp), %rdi
callq 0x2ef50
jmp 0x2e5cb
jmp 0x2e5cd
cmpl $0x0, 0x1f0634(%rip)    # 0x21ec08
je 0x2e6f9
cmpq $0x0, 0xa90(%rsp)
je 0x2e5fc
movq 0xa90(%rsp), %rdi
callq 0x2ee90
movq %rax, 0x88(%rsp)
jmp 0x2e608
xorl %eax, %eax
movq %rax, 0x88(%rsp)
jmp 0x2e608
movq 0x88(%rsp), %rax
movq %rax, 0x130(%rsp)
cmpq $0x0, 0x130(%rsp)
jne 0x2e632
leaq 0x1f0f96(%rip), %rax    # 0x21f5c0
movq %rax, 0x130(%rsp)
movq 0x130(%rsp), %rdi
callq 0x2eea0
movq %rax, %rdi
callq 0x2eeb0
movsd %xmm0, 0x128(%rsp)
movq 0x130(%rsp), %rdi
callq 0x2ef00
movq %rax, %rdi
callq 0x2eeb0
movsd %xmm0, 0x120(%rsp)
movq 0x130(%rsp), %rdi
callq 0x2ef10
movq %rax, %rdi
callq 0x2eeb0
movsd %xmm0, 0x118(%rsp)
movl 0x1e8(%rsp), %eax
movl %eax, 0x80(%rsp)
movl 0x1ec(%rsp), %eax
movl %eax, 0x84(%rsp)
movsd 0x128(%rsp), %xmm0
movsd 0x120(%rsp), %xmm1
movsd 0x118(%rsp), %xmm2
leaq 0x100(%rsp), %rdi
callq 0x10e8e0
jmp 0x2e6d2
movl 0x84(%rsp), %edx
movl 0x80(%rsp), %esi
leaq 0x460(%rsp), %rdi
leaq 0x100(%rsp), %rcx
callq 0x1031f0
jmp 0x2e6f7
jmp 0x2e6f9
cmpl $0x0, 0x1f050c(%rip)    # 0x21ec0c
je 0x2e75e
cmpq $0x0, 0xa90(%rsp)
je 0x2e723
movq 0xa90(%rsp), %rdi
callq 0x2f2a0
addl $0x1, %eax
movl %eax, 0x7c(%rsp)
jmp 0x2e72b
xorl %eax, %eax
movl %eax, 0x7c(%rsp)
jmp 0x2e72b
movl 0x7c(%rsp), %eax
movl %eax, 0xfc(%rsp)
movl 0x1e8(%rsp), %esi
movl 0x1ec(%rsp), %edx
cvtsi2sdl 0xfc(%rsp), %xmm0
leaq 0x390(%rsp), %rdi
callq 0x2ef50
jmp 0x2e75c
jmp 0x2e75e
cmpl $0x0, 0x1f04af(%rip)    # 0x21ec14
je 0x2e7a5
movq 0xa98(%rsp), %rdi
callq 0x2f120
incl %eax
movl %eax, 0xf8(%rsp)
movl 0x1e8(%rsp), %esi
movl 0x1ec(%rsp), %edx
cvtsi2sdl 0xf8(%rsp), %xmm0
leaq 0x2c0(%rsp), %rdi
callq 0x2ef50
jmp 0x2e7a3
jmp 0x2e7a5
cmpl $0x0, 0x1f046c(%rip)    # 0x21ec18
je 0x2e8a7
movq $0x0, 0xf0(%rsp)
movq 0xa98(%rsp), %rax
movq %rax, 0xe8(%rsp)
xorl %eax, %eax
cmpq $0x0, 0xf0(%rsp)
movb %al, 0x7b(%rsp)
jne 0x2e7ef
cmpq $0x0, 0xe8(%rsp)
setne %al
movb %al, 0x7b(%rsp)
movb 0x7b(%rsp), %al
testb $0x1, %al
jne 0x2e7f9
jmp 0x2e838
movq 0xe8(%rsp), %rdi
leaq 0x18e62d(%rip), %rsi    # 0x1bce35
callq 0x2f130
movq %rax, 0x70(%rsp)
jmp 0x2e814
movq 0x70(%rsp), %rax
movq %rax, 0xf0(%rsp)
movq 0xe8(%rsp), %rdi
callq 0x2f230
movq %rax, 0xe8(%rsp)
jmp 0x2e7ce
cmpq $0x0, 0xf0(%rsp)
je 0x2e883
movl 0x1e8(%rsp), %eax
movl %eax, 0x68(%rsp)
movl 0x1ec(%rsp), %eax
movl %eax, 0x6c(%rsp)
movq 0xf0(%rsp), %rdi
callq 0x24070
movl 0x68(%rsp), %esi
movl 0x6c(%rsp), %edx
cvtsi2sd %eax, %xmm0
leaq 0x1f0(%rsp), %rdi
callq 0x2ef50
jmp 0x2e881
jmp 0x2e8a5
movl 0x1e8(%rsp), %esi
movl 0x1ec(%rsp), %edx
leaq 0x1f0(%rsp), %rdi
xorps %xmm0, %xmm0
callq 0x2ef50
jmp 0x2e8a3
jmp 0x2e8a5
jmp 0x2e8a7
jmp 0x2e8a9
jmp 0x2e8ab
movl 0x1e8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1e8(%rsp)
jmp 0x2e01d
jmp 0x2e8c3
movl 0x1ec(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1ec(%rsp)
jmp 0x2dfff
cmpl $0x0, 0x1f0308(%rip)    # 0x21ebe8
je 0x2e922
movq 0xf70(%rsp), %rdx
movl 0xf6c(%rsp), %ecx
leaq 0x17ef95(%rip), %rsi    # 0x1ad88d
xorl %eax, %eax
leaq 0xaa0(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0x23150
movq 0x60(%rsp), %rsi
leaq 0x970(%rsp), %rdi
callq 0xf4ba0
jmp 0x2e920
jmp 0x2e922
cmpl $0x0, 0x1f02cf(%rip)    # 0x21ebf8
je 0x2e96b
movq 0xf70(%rsp), %rdx
movl 0xf6c(%rsp), %ecx
leaq 0x17ef5e(%rip), %rsi    # 0x1ad89f
xorl %eax, %eax
leaq 0xaa0(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x23150
movq 0x58(%rsp), %rsi
leaq 0x8a0(%rsp), %rdi
callq 0xf4ba0
jmp 0x2e969
jmp 0x2e96b
cmpl $0x0, 0x1f028a(%rip)    # 0x21ebfc
je 0x2e9b4
movq 0xf70(%rsp), %rdx
movl 0xf6c(%rsp), %ecx
leaq 0x17ef28(%rip), %rsi    # 0x1ad8b2
xorl %eax, %eax
leaq 0xaa0(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x23150
movq 0x50(%rsp), %rsi
leaq 0x7d0(%rsp), %rdi
callq 0xf4ba0
jmp 0x2e9b2
jmp 0x2e9b4
cmpl $0x0, 0x1f0269(%rip)    # 0x21ec24
je 0x2ea7d
movq 0xf70(%rsp), %rdx
movl 0xf6c(%rsp), %ecx
leaq 0x17eeed(%rip), %rsi    # 0x1ad8c4
xorl %eax, %eax
leaq 0xaa0(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x23150
movq 0x48(%rsp), %rsi
leaq 0x700(%rsp), %rdi
callq 0xf4ba0
jmp 0x2e9ff
movq 0xf70(%rsp), %rdx
movl 0xf6c(%rsp), %ecx
leaq 0x17eec3(%rip), %rsi    # 0x1ad8d8
xorl %eax, %eax
leaq 0xaa0(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x23150
movq 0x40(%rsp), %rsi
leaq 0x630(%rsp), %rdi
callq 0xf4ba0
jmp 0x2ea3d
movq 0xf70(%rsp), %rdx
movl 0xf6c(%rsp), %ecx
leaq 0x17ee99(%rip), %rsi    # 0x1ad8ec
xorl %eax, %eax
leaq 0xaa0(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x23150
movq 0x38(%rsp), %rsi
leaq 0x560(%rsp), %rdi
callq 0xf4ba0
jmp 0x2ea7b
jmp 0x2ea7d
cmpl $0x0, 0x1f017c(%rip)    # 0x21ec00
je 0x2eac6
movq 0xf70(%rsp), %rdx
movl 0xf6c(%rsp), %ecx
leaq 0x17ee64(%rip), %rsi    # 0x1ad900
xorl %eax, %eax
leaq 0xaa0(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x23150
movq 0x30(%rsp), %rsi
leaq 0x490(%rsp), %rdi
callq 0xf4ba0
jmp 0x2eac4
jmp 0x2eac6
cmpl $0x0, 0x1f013b(%rip)    # 0x21ec08
je 0x2eb0f
movq 0xf70(%rsp), %rdx
movl 0xf6c(%rsp), %ecx
leaq 0x17ee2d(%rip), %rsi    # 0x1ad912
xorl %eax, %eax
leaq 0xaa0(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x23150
movq 0x28(%rsp), %rsi
leaq 0x460(%rsp), %rdi
callq 0x2edc0
jmp 0x2eb0d
jmp 0x2eb0f
cmpl $0x0, 0x1f00f6(%rip)    # 0x21ec0c
je 0x2eb58
movq 0xf70(%rsp), %rdx
movl 0xf6c(%rsp), %ecx
leaq 0x17edf5(%rip), %rsi    # 0x1ad923
xorl %eax, %eax
leaq 0xaa0(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x23150
movq 0x20(%rsp), %rsi
leaq 0x390(%rsp), %rdi
callq 0xf4ba0
jmp 0x2eb56
jmp 0x2eb58
cmpl $0x0, 0x1f00b5(%rip)    # 0x21ec14
je 0x2eba1
movq 0xf70(%rsp), %rdx
movl 0xf6c(%rsp), %ecx
leaq 0x17edc1(%rip), %rsi    # 0x1ad938
xorl %eax, %eax
leaq 0xaa0(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x23150
movq 0x18(%rsp), %rsi
leaq 0x2c0(%rsp), %rdi
callq 0xf4ba0
jmp 0x2eb9f
jmp 0x2eba1
cmpl $0x0, 0x1f0070(%rip)    # 0x21ec18
je 0x2ebea
movq 0xf70(%rsp), %rdx
movl 0xf6c(%rsp), %ecx
leaq 0x17ed89(%rip), %rsi    # 0x1ad949
xorl %eax, %eax
leaq 0xaa0(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x23150
movq 0x10(%rsp), %rsi
leaq 0x2c0(%rsp), %rdi
callq 0xf4ba0
jmp 0x2ebe8
jmp 0x2ebea
leaq 0x1f0(%rsp), %rdi
callq 0xe4b90
leaq 0x2c0(%rsp), %rdi
callq 0xe4b90
leaq 0x390(%rsp), %rdi
callq 0xe4b90
leaq 0x460(%rsp), %rdi
callq 0x102ec0
leaq 0x478(%rsp), %rdi
callq 0x102ec0
leaq 0x490(%rsp), %rdi
callq 0xe4b90
leaq 0x560(%rsp), %rdi
callq 0xe4b90
leaq 0x630(%rsp), %rdi
callq 0xe4b90
leaq 0x700(%rsp), %rdi
callq 0xe4b90
leaq 0x7d0(%rsp), %rdi
callq 0xe4b90
leaq 0x8a0(%rsp), %rdi
callq 0xe4b90
leaq 0x970(%rsp), %rdi
callq 0xe4b90
leaq 0xea8(%rsp), %rdi
callq 0x5daf0
movl $0x1, %eax
addq $0xf88, %rsp            # imm = 0xF88
retq
leaq 0x2c0(%rsp), %rdi
callq 0xe4b90
leaq 0x390(%rsp), %rdi
callq 0xe4b90
leaq 0x460(%rsp), %rdi
callq 0x102ec0
leaq 0x478(%rsp), %rdi
callq 0x102ec0
leaq 0x490(%rsp), %rdi
callq 0xe4b90
leaq 0x560(%rsp), %rdi
callq 0xe4b90
leaq 0x630(%rsp), %rdi
callq 0xe4b90
leaq 0x700(%rsp), %rdi
callq 0xe4b90
leaq 0x7d0(%rsp), %rdi
callq 0xe4b90
leaq 0x8a0(%rsp), %rdi
callq 0xe4b90
leaq 0x970(%rsp), %rdi
callq 0xe4b90
leaq 0xea8(%rsp), %rdi
callq 0x5daf0
movq 0xa68(%rsp), %rdi
callq 0x24270
nopl (%rax)