// File: tomfunkhouser[P]gaps/apps/gapsview/gapsview.cpp
// Function: DrawSFL(gaps::R3SurfelScene*, int, int)
static void
DrawSFL(R3SurfelScene *scene,
  int model_index, int color_scheme)
{
  // Check if should draw sfl scene
  if (!show_sfls) return;

  // Get convenient variables
  R3SurfelTree *tree = scene->Tree();
  if (!tree) return;

  // Draw points
  if (show_points) {
    glDisable(GL_LIGHTING);
    RNGrfxBegin(RN_GRFX_POINTS);
    int sfl_count = 0;
    for (int i = 0; i < tree->NNodes(); i++) {
      R3SurfelNode *node = tree->Node(i);
      if (node->NParts() > 0) continue;
      R3SurfelObject *object = node->Object(TRUE);
      while (object && object->Parent() && (object->Parent() != scene->RootObject()))
        object = object->Parent();
      int instance_identifier = (object) ? object->SceneIndex()  : -1;
      R3SurfelLabel *label = (object) ? object->CurrentLabel() : NULL;
      int category_identifier = (label) ? label->Identifier() : -1;
      for (int j = 0; j < node->NBlocks(); j++) {
        R3SurfelBlock *block = node->Block(j);
        for (int k = 0; k < block->NSurfels(); k++) {
          if (color_scheme == PICK_COLOR_SCHEME)
            LoadColorIndex(model_index, SFL_POINT_ELEMENT_TYPE, sfl_count);
          else if (color_scheme == RGB_COLOR_SCHEME)
            RNLoadRgb(block->SurfelColor(k));
          else if (color_scheme == CATEGORY_COLOR_SCHEME)
            LoadColorIdentifier(category_identifier);
          else if (color_scheme == INSTANCE_COLOR_SCHEME)
            LoadColorIdentifier(instance_identifier);
          else LoadColorValue(block->SurfelElevation(k) / 2.0);
          R3LoadPoint(block->SurfelPosition(k));
          sfl_count++;
        }
      }
    }
    RNGrfxEnd();
  }

  // Draw normals
  if (show_normals && (color_scheme != PICK_COLOR_SCHEME)) {
    glDisable(GL_LIGHTING);
    RNLoadRgb(0.0, 1.0, 0.0); 
    RNGrfxBegin(RN_GRFX_LINES);
    RNScalar d = 0.0025 * world_bbox.DiagonalRadius();
    for (int i = 0; i < tree->NNodes(); i++) {
      R3SurfelNode *node = tree->Node(i);
      if (node->NParts() > 0) continue;
      for (int j = 0; j < node->NBlocks(); j++) {
        R3SurfelBlock *block = node->Block(j);
        for (int k = 0; k < block->NSurfels(); k++) {
          R3Point position = block->SurfelPosition(k);
          R3Vector normal = block->SurfelNormal(k);
          R3LoadPoint(position);
          R3LoadPoint(position + d * normal);
        }
      }
    }
    RNGrfxEnd();
  }

  // Draw cameras
  if (show_cameras) {
    glDisable(GL_LIGHTING);
    RNLoadRgb(0, 1, 0);
    for (int i = 0; i < scene->NImages(); i++) {
      R3SurfelImage *image = scene->Image(i);
      if (color_scheme == PICK_COLOR_SCHEME)
        LoadColorIndex(model_index, SFL_CAMERA_ELEMENT_TYPE, i);
      R3Sphere(image->Viewpoint(), 0.1).Draw();
      R3Span(image->Viewpoint(), image->Viewpoint() + image->Towards()).Draw();
      R3Span(image->Viewpoint(), image->Viewpoint() + 0.5 * image->Up()).Draw();
      R3Span(image->Viewpoint(), image->Viewpoint() + 0.25 * image->Right()).Draw();
    }
  }

  // Draw images
  if (show_image_insets || show_image_billboards || show_image_depths || show_image_rays) {
    glDisable(GL_LIGHTING);
    RNLoadRgb(1, 1, 1);
    int image_count = 0;
    for (int i = 0; i < scene->NImages(); i++) {
      R3SurfelImage *image = scene->Image(i);
      ImageData *data = (ImageData *) image->Data();
      if (!data) continue;

      // Set color
      if (color_scheme == PICK_COLOR_SCHEME)
        LoadColorIndex(model_index, SFL_CAMERA_ELEMENT_TYPE, i);

      // Compute projection of selected 3D position
      R2Point image_position = image->TransformFromWorldToImage(selected_position);
      if (image_position.X() < 0) continue;
      if (image_position.Y() < 0) continue;
      if (image_position.X() >= image->ImageWidth()) continue;
      if (image_position.Y() >= image->ImageHeight()) continue;

      // Draw image inset
      if (show_image_insets) {
        double x = image_count * image_inset_scale * data->image_width;
        DrawImageInset(data, x, 0, image_inset_scale);
        DrawDotOnImageInset(data, x, 0, image_inset_scale, image_position);
      }
      
      // Draw image billboard
      if (show_image_billboards) {
        DrawImageBillboard(data, image->Viewpoint(),
          image->Towards(), image->Right(), image->Up(),
          image->XFOV(), image->YFOV(), image_billboard_depth);
        DrawDotOnImageBillboard(data, image->Viewpoint(),
          image->Towards(), image->Right(), image->Up(),
          image->XFOV(), image->YFOV(), image_billboard_depth,
          image_position, 0.025);
      }

      // Draw image depths
      if (show_image_depths) {
        DrawImageDepths(data, image->Viewpoint(),
          image->Towards(), image->Right(), image->Up(),
          image->XFOV(), image->YFOV(), image_billboard_depth);
      }

      // Draw image ray
      if (show_image_rays) {
        DrawImageRay(data, image_position);
      }

      // Increment image counter
      image_count++;
    }
  }
}

// Assembly:
subq $0x468, %rsp            # imm = 0x468
movq %rdi, 0x460(%rsp)
movl %esi, 0x45c(%rsp)
movl %edx, 0x458(%rsp)
cmpl $0x0, 0x2bdbe4(%rip)    # 0x2efb88
jne 0x31fab
jmp 0x32d4d
movq 0x460(%rsp), %rdi
callq 0x394e0
movq %rax, 0x450(%rsp)
cmpq $0x0, 0x450(%rsp)
jne 0x31fd0
jmp 0x32d4d
cmpl $0x0, 0x2bdba1(%rip)    # 0x2efb78
je 0x32391
movl $0xb50, %edi            # imm = 0xB50
callq 0x2a130
xorl %edi, %edi
callq 0x38d90
movl $0x0, 0x44c(%rsp)
movl $0x0, 0x448(%rsp)
movl 0x448(%rsp), %eax
movl %eax, 0x104(%rsp)
movq 0x450(%rsp), %rdi
callq 0x394f0
movl %eax, %ecx
movl 0x104(%rsp), %eax
cmpl %ecx, %eax
jge 0x3238c
movq 0x450(%rsp), %rdi
movl 0x448(%rsp), %esi
callq 0x39510
movq %rax, 0x440(%rsp)
movq 0x440(%rsp), %rdi
callq 0x39540
cmpl $0x0, %eax
jle 0x32063
jmp 0x32376
movq 0x440(%rsp), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x5fa70
movq %rax, 0x438(%rsp)
xorl %eax, %eax
cmpq $0x0, 0x438(%rsp)
movb %al, 0x103(%rsp)
je 0x320ec
movq 0x438(%rsp), %rdi
callq 0x39560
movq %rax, %rcx
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, 0x103(%rsp)
je 0x320ec
movq 0x438(%rsp), %rdi
callq 0x39560
movq %rax, 0xf8(%rsp)
movq 0x460(%rsp), %rdi
callq 0x39570
movq %rax, %rcx
movq 0xf8(%rsp), %rax
cmpq %rcx, %rax
setne %al
movb %al, 0x103(%rsp)
movb 0x103(%rsp), %al
testb $0x1, %al
jne 0x320f9
jmp 0x32113
movq 0x438(%rsp), %rdi
callq 0x39560
movq %rax, 0x438(%rsp)
jmp 0x3207f
cmpq $0x0, 0x438(%rsp)
je 0x32134
movq 0x438(%rsp), %rdi
callq 0x39590
movl %eax, 0xf4(%rsp)
jmp 0x32142
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, 0xf4(%rsp)
jmp 0x32142
movl 0xf4(%rsp), %eax
movl %eax, 0x434(%rsp)
cmpq $0x0, 0x438(%rsp)
je 0x32172
movq 0x438(%rsp), %rdi
callq 0x6c560
movq %rax, 0xe8(%rsp)
jmp 0x3217e
xorl %eax, %eax
movq %rax, 0xe8(%rsp)
jmp 0x3217e
movq 0xe8(%rsp), %rax
movq %rax, 0x428(%rsp)
cmpq $0x0, 0x428(%rsp)
je 0x321af
movq 0x428(%rsp), %rdi
callq 0x6eb40
movl %eax, 0xe4(%rsp)
jmp 0x321bd
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, 0xe4(%rsp)
jmp 0x321bd
movl 0xe4(%rsp), %eax
movl %eax, 0x424(%rsp)
movl $0x0, 0x420(%rsp)
movl 0x420(%rsp), %eax
movl %eax, 0xe0(%rsp)
movq 0x440(%rsp), %rdi
callq 0x395a0
movl %eax, %ecx
movl 0xe0(%rsp), %eax
cmpl %ecx, %eax
jge 0x32374
movq 0x440(%rsp), %rdi
movl 0x420(%rsp), %esi
callq 0x395c0
movq %rax, 0x418(%rsp)
movl $0x0, 0x414(%rsp)
movl 0x414(%rsp), %eax
movl %eax, 0xdc(%rsp)
movq 0x418(%rsp), %rdi
callq 0x395f0
movl %eax, %ecx
movl 0xdc(%rsp), %eax
cmpl %ecx, %eax
jge 0x3235c
cmpl $0x5, 0x458(%rsp)
jne 0x3227c
movl 0x45c(%rsp), %edi
movl 0x44c(%rsp), %edx
movl $0x7, %esi
callq 0x340b0
jmp 0x3230c
cmpl $0x1, 0x458(%rsp)
jne 0x322b1
movq 0x418(%rsp), %rsi
movl 0x414(%rsp), %edx
leaq 0x3f8(%rsp), %rdi
callq 0x39600
leaq 0x3f8(%rsp), %rdi
callq 0x39130
jmp 0x3230a
cmpl $0x3, 0x458(%rsp)
jne 0x322c9
movl 0x424(%rsp), %edi
callq 0x34130
jmp 0x32308
cmpl $0x4, 0x458(%rsp)
jne 0x322e1
movl 0x434(%rsp), %edi
callq 0x34130
jmp 0x32306
movq 0x418(%rsp), %rdi
movl 0x414(%rsp), %esi
callq 0x39640
movsd 0x233db3(%rip), %xmm1   # 0x2660b0
divsd %xmm1, %xmm0
callq 0x34af0
jmp 0x32308
jmp 0x3230a
jmp 0x3230c
movq 0x418(%rsp), %rsi
movl 0x414(%rsp), %edx
leaq 0x3e0(%rsp), %rdi
callq 0x39680
leaq 0x3e0(%rsp), %rdi
callq 0x38e20
movl 0x44c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x44c(%rsp)
movl 0x414(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x414(%rsp)
jmp 0x32229
jmp 0x3235e
movl 0x420(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x420(%rsp)
jmp 0x321d6
jmp 0x32376
movl 0x448(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x448(%rsp)
jmp 0x32004
callq 0x38e40
cmpl $0x0, 0x2cc930(%rip)    # 0x2fecc8
je 0x325c3
cmpl $0x5, 0x458(%rsp)
je 0x325c3
movl $0xb50, %edi            # imm = 0xB50
callq 0x2a130
xorps %xmm2, %xmm2
movsd 0x233c4f(%rip), %xmm1   # 0x266010
movaps %xmm2, %xmm0
callq 0x38d60
movl $0x1, %edi
callq 0x38d90
leaq 0x2cc45e(%rip), %rdi    # 0x2fe838
callq 0x38be0
movaps %xmm0, %xmm1
movsd 0x233c9e(%rip), %xmm0   # 0x266088
mulsd %xmm1, %xmm0
movsd %xmm0, 0x3d8(%rsp)
movl $0x0, 0x3d4(%rsp)
movl 0x3d4(%rsp), %eax
movl %eax, 0xd8(%rsp)
movq 0x450(%rsp), %rdi
callq 0x394f0
movl %eax, %ecx
movl 0xd8(%rsp), %eax
cmpl %ecx, %eax
jge 0x325be
movq 0x450(%rsp), %rdi
movl 0x3d4(%rsp), %esi
callq 0x39510
movq %rax, 0x3c8(%rsp)
movq 0x3c8(%rsp), %rdi
callq 0x39540
cmpl $0x0, %eax
jle 0x32461
jmp 0x325a8
movl $0x0, 0x3c4(%rsp)
movl 0x3c4(%rsp), %eax
movl %eax, 0xd4(%rsp)
movq 0x3c8(%rsp), %rdi
callq 0x395a0
movl %eax, %ecx
movl 0xd4(%rsp), %eax
cmpl %ecx, %eax
jge 0x325a6
movq 0x3c8(%rsp), %rdi
movl 0x3c4(%rsp), %esi
callq 0x395c0
movq %rax, 0x3b8(%rsp)
movl $0x0, 0x3b4(%rsp)
movl 0x3b4(%rsp), %eax
movl %eax, 0xd0(%rsp)
movq 0x3b8(%rsp), %rdi
callq 0x395f0
movl %eax, %ecx
movl 0xd0(%rsp), %eax
cmpl %ecx, %eax
jge 0x3258e
movq 0x3b8(%rsp), %rsi
movl 0x3b4(%rsp), %edx
leaq 0x398(%rsp), %rdi
callq 0x39680
movq 0x3b8(%rsp), %rsi
movl 0x3b4(%rsp), %edx
leaq 0x380(%rsp), %rdi
callq 0x39780
leaq 0x398(%rsp), %rdi
callq 0x38e20
movsd 0x3d8(%rsp), %xmm0
leaq 0x350(%rsp), %rdi
leaq 0x380(%rsp), %rsi
callq 0x38f20
leaq 0x368(%rsp), %rdi
leaq 0x398(%rsp), %rsi
leaq 0x350(%rsp), %rdx
callq 0x180350
leaq 0x368(%rsp), %rdi
callq 0x38e20
movl 0x3b4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3b4(%rsp)
jmp 0x324bf
jmp 0x32590
movl 0x3c4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c4(%rsp)
jmp 0x3246c
jmp 0x325a8
movl 0x3d4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3d4(%rsp)
jmp 0x32402
callq 0x38e40
cmpl $0x0, 0x2bd5c2(%rip)    # 0x2efb8c
je 0x328aa
movl $0xb50, %edi            # imm = 0xB50
callq 0x2a130
xorl %edx, %edx
movl $0x1, %esi
movl %edx, %edi
callq 0x39820
movl $0x0, 0x34c(%rsp)
movl 0x34c(%rsp), %eax
movl %eax, 0xcc(%rsp)
movq 0x460(%rsp), %rdi
callq 0x39850
movl %eax, %ecx
movl 0xcc(%rsp), %eax
cmpl %ecx, %eax
jge 0x328a8
movq 0x460(%rsp), %rdi
movl 0x34c(%rsp), %esi
callq 0x39870
movq %rax, 0x340(%rsp)
cmpl $0x5, 0x458(%rsp)
jne 0x3265d
movl 0x45c(%rsp), %edi
movl 0x34c(%rsp), %edx
movl $0x8, %esi
callq 0x340b0
movq 0x340(%rsp), %rdi
callq 0x398a0
movq %rax, %rsi
leaq 0x318(%rsp), %rdi
movsd 0x233a23(%rip), %xmm0   # 0x2660a0
callq 0x14d530
leaq 0x310(%rsp), %rdi
movl $0x772, %esi            # imm = 0x772
callq 0x38e50
jmp 0x32696
movq 0x310(%rsp), %rsi
leaq 0x318(%rsp), %rdi
callq 0xf8e00
jmp 0x326ad
leaq 0x318(%rsp), %rdi
callq 0x398c0
movq 0x340(%rsp), %rdi
callq 0x398a0
movq %rax, 0xa0(%rsp)
movq 0x340(%rsp), %rdi
callq 0x398a0
movq %rax, 0x98(%rsp)
movq 0x340(%rsp), %rsi
leaq 0x280(%rsp), %rdi
callq 0x398d0
movq 0x98(%rsp), %rsi
leaq 0x298(%rsp), %rdi
leaq 0x280(%rsp), %rdx
callq 0x180350
movq 0xa0(%rsp), %rsi
leaq 0x2b0(%rsp), %rdi
leaq 0x298(%rsp), %rdx
callq 0x17e7c0
leaq 0x2b0(%rsp), %rdi
callq 0xf6860
movq 0x340(%rsp), %rdi
callq 0x398a0
movq %rax, 0xb0(%rsp)
movq 0x340(%rsp), %rdi
callq 0x398a0
movq %rax, 0xa8(%rsp)
movq 0x340(%rsp), %rdi
callq 0x39920
movq %rax, %rsi
leaq 0x200(%rsp), %rdi
movsd 0x2338c6(%rip), %xmm0   # 0x266050
callq 0x38f20
movq 0xa8(%rsp), %rsi
leaq 0x218(%rsp), %rdi
leaq 0x200(%rsp), %rdx
callq 0x180350
movq 0xb0(%rsp), %rsi
leaq 0x230(%rsp), %rdi
leaq 0x218(%rsp), %rdx
callq 0x17e7c0
leaq 0x230(%rsp), %rdi
callq 0xf6860
movq 0x340(%rsp), %rdi
callq 0x398a0
movq %rax, 0xc0(%rsp)
movq 0x340(%rsp), %rdi
callq 0x398a0
movq %rax, 0xb8(%rsp)
movq 0x340(%rsp), %rdi
callq 0x39950
movq %rax, %rsi
leaq 0x180(%rsp), %rdi
movsd 0x233888(%rip), %xmm0   # 0x2660a8
callq 0x38f20
movq 0xb8(%rsp), %rsi
leaq 0x198(%rsp), %rdi
leaq 0x180(%rsp), %rdx
callq 0x180350
movq 0xc0(%rsp), %rsi
leaq 0x1b0(%rsp), %rdi
leaq 0x198(%rsp), %rdx
callq 0x17e7c0
leaq 0x1b0(%rsp), %rdi
callq 0xf6860
movl 0x34c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34c(%rsp)
jmp 0x325f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x308(%rsp)
movl %eax, 0x304(%rsp)
leaq 0x318(%rsp), %rdi
callq 0x398c0
jmp 0x32d55
jmp 0x328aa
cmpl $0x0, 0x2cc63b(%rip)    # 0x2feeec
jne 0x328d2
cmpl $0x0, 0x2cc636(%rip)    # 0x2feef0
jne 0x328d2
cmpl $0x0, 0x2cc631(%rip)    # 0x2feef4
jne 0x328d2
cmpl $0x0, 0x2cc62c(%rip)    # 0x2feef8
je 0x32d4d
movl $0xb50, %edi            # imm = 0xB50
callq 0x2a130
movl $0x1, %edx
movl %edx, %edi
movl %edx, %esi
callq 0x39820
movl $0x0, 0x17c(%rsp)
movl $0x0, 0x178(%rsp)
movl 0x178(%rsp), %eax
movl %eax, 0x94(%rsp)
movq 0x460(%rsp), %rdi
callq 0x39850
movl %eax, %ecx
movl 0x94(%rsp), %eax
cmpl %ecx, %eax
jge 0x32d4b
movq 0x460(%rsp), %rdi
movl 0x178(%rsp), %esi
callq 0x39870
movq %rax, 0x170(%rsp)
movq 0x170(%rsp), %rdi
callq 0x39970
movq %rax, 0x168(%rsp)
cmpq $0x0, 0x168(%rsp)
jne 0x3296d
jmp 0x32d35
cmpl $0x5, 0x458(%rsp)
jne 0x3298f
movl 0x45c(%rsp), %edi
movl 0x178(%rsp), %edx
movl $0x8, %esi
callq 0x340b0
movq 0x170(%rsp), %rsi
leaq 0x158(%rsp), %rdi
leaq 0x2cbee2(%rip), %rdx    # 0x2fe888
callq 0x689d0
leaq 0x158(%rsp), %rdi
callq 0x39990
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x329c9
jmp 0x32d35
leaq 0x158(%rsp), %rdi
callq 0x399a0
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x329e7
jmp 0x32d35
leaq 0x158(%rsp), %rdi
callq 0x39990
movsd %xmm0, 0x88(%rsp)
movq 0x170(%rsp), %rdi
callq 0x399b0
movsd 0x88(%rsp), %xmm0
cvtsi2sd %eax, %xmm1
ucomisd %xmm1, %xmm0
jb 0x32a22
jmp 0x32d35
leaq 0x158(%rsp), %rdi
callq 0x399a0
movsd %xmm0, 0x80(%rsp)
movq 0x170(%rsp), %rdi
callq 0x399d0
movsd 0x80(%rsp), %xmm0
cvtsi2sd %eax, %xmm1
ucomisd %xmm1, %xmm0
jb 0x32a5d
jmp 0x32d35
cmpl $0x0, 0x2cc488(%rip)    # 0x2feeec
je 0x32ade
cvtsi2sdl 0x17c(%rsp), %xmm0
mulsd 0x2bd119(%rip), %xmm0   # 0x2efb90
movq 0x168(%rsp), %rax
cvtsi2sdl 0x768(%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x150(%rsp)
movq 0x168(%rsp), %rdi
movsd 0x150(%rsp), %xmm0
movsd 0x2bd0e3(%rip), %xmm2   # 0x2efb90
xorps %xmm1, %xmm1
callq 0x34ca0
movq 0x168(%rsp), %rdi
movsd 0x150(%rsp), %xmm0
movsd 0x2bd0c2(%rip), %xmm2   # 0x2efb90
xorps %xmm1, %xmm1
leaq 0x158(%rsp), %rsi
callq 0x34eb0
cmpl $0x0, 0x2cc40b(%rip)    # 0x2feef0
je 0x32c4f
movq 0x168(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x170(%rsp), %rdi
callq 0x398a0
movq %rax, 0x38(%rsp)
movq 0x170(%rsp), %rsi
leaq 0x138(%rsp), %rdi
callq 0x398d0
movq 0x170(%rsp), %rdi
callq 0x39950
movq %rax, 0x40(%rsp)
movq 0x170(%rsp), %rdi
callq 0x39920
movq %rax, 0x48(%rsp)
movq 0x170(%rsp), %rdi
callq 0x399f0
movsd %xmm0, 0x50(%rsp)
movq 0x170(%rsp), %rdi
callq 0x39a50
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %r8
movaps %xmm0, %xmm1
movsd 0x50(%rsp), %xmm0
movsd 0x2bd010(%rip), %xmm2   # 0x2efb98
leaq 0x138(%rsp), %rdx
callq 0x35060
movq 0x168(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x170(%rsp), %rdi
callq 0x398a0
movq %rax, 0x60(%rsp)
movq 0x170(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x398d0
movq 0x170(%rsp), %rdi
callq 0x39950
movq %rax, 0x68(%rsp)
movq 0x170(%rsp), %rdi
callq 0x39920
movq %rax, 0x70(%rsp)
movq 0x170(%rsp), %rdi
callq 0x399f0
movsd %xmm0, 0x78(%rsp)
movq 0x170(%rsp), %rdi
callq 0x39a50
movq 0x58(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rcx
movq 0x70(%rsp), %r8
movaps %xmm0, %xmm1
movsd 0x78(%rsp), %xmm0
movsd 0x2bcf66(%rip), %xmm2   # 0x2efb98
leaq 0x120(%rsp), %rdx
leaq 0x158(%rsp), %r9
movsd 0x233416(%rip), %xmm3   # 0x266060
callq 0x35320
cmpl $0x0, 0x2cc29e(%rip)    # 0x2feef4
je 0x32d06
movq 0x168(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x170(%rsp), %rdi
callq 0x398a0
movq %rax, 0x10(%rsp)
movq 0x170(%rsp), %rsi
leaq 0x108(%rsp), %rdi
callq 0x398d0
movq 0x170(%rsp), %rdi
callq 0x39950
movq %rax, 0x18(%rsp)
movq 0x170(%rsp), %rdi
callq 0x39920
movq %rax, 0x20(%rsp)
movq 0x170(%rsp), %rdi
callq 0x399f0
movsd %xmm0, 0x28(%rsp)
movq 0x170(%rsp), %rdi
callq 0x39a50
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rcx
movq 0x20(%rsp), %r8
movaps %xmm0, %xmm1
movsd 0x28(%rsp), %xmm0
movsd 0x2bce9f(%rip), %xmm2   # 0x2efb98
leaq 0x108(%rsp), %rdx
callq 0x35660
cmpl $0x0, 0x2cc1eb(%rip)    # 0x2feef8
je 0x32d24
movq 0x168(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x36050
movl 0x17c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x17c(%rsp)
movl 0x178(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x178(%rsp)
jmp 0x32900
jmp 0x32d4d
addq $0x468, %rsp            # imm = 0x468
retq
movq 0x308(%rsp), %rdi
callq 0x29c10
nopw %cs:(%rax,%rax)