// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::DrawSurfels(int) const
void R3SurfelViewer::
DrawSurfels(int color_scheme) const
{
  // Check surfel visibility
  if (!SurfelVisibility()) return;

  // Set default lighting
  glDisable(GL_LIGHTING);

  // Set point size
  if (color_scheme != R3_SURFEL_VIEWER_COLOR_BY_PICK_INDEX) glPointSize(surfel_size);
  else glPointSize(0.01 * Viewport().Width() + 1);

#if (R3_SURFEL_VIEWER_DRAW_METHOD == R3_SURFEL_VIEWER_DRAW_WITH_VBO)
  if (!shape_draw_flags[R3_SURFEL_DISC_DRAW_FLAG]) {
    // Draw with VBO
    DrawVBO(color_scheme);
    glPointSize(1);    
    return;
  }
#endif

  // Draw resident nodes
  switch (color_scheme) {
  case R3_SURFEL_VIEWER_COLOR_BY_PICK_INDEX:
    for (int i = 0; i < resident_nodes.NNodes(); i++) {
      R3SurfelNode *node = resident_nodes.Node(i);
      LoadColor(color_scheme, NULL, NULL, node, NULL, NULL);
      DrawSurfels(node);
    }
    break;

  case R3_SURFEL_VIEWER_COLOR_BY_CURRENT_LABEL:
    for (int i = 0; i < resident_nodes.NNodes(); i++) {
      R3SurfelNode *node = resident_nodes.Node(i);
      R3SurfelObject *object = node->Object(TRUE, TRUE);
      while (object && object->Parent() && (object->Parent() != scene->RootObject())) object = object->Parent();
      R3SurfelLabel *label = (object) ? object->CurrentLabel() : NULL;
      const RNRgb& rgb = (label) ? label->Color() : RNwhite_rgb;
      RNLoadRgb(rgb);
      DrawSurfels(node);
    }
    break;

  case R3_SURFEL_VIEWER_COLOR_BY_GROUND_TRUTH_LABEL:
    for (int i = 0; i < resident_nodes.NNodes(); i++) {
      R3SurfelNode *node = resident_nodes.Node(i);
      R3SurfelObject *object = node->Object(TRUE, TRUE);
      while (object && object->Parent() && (object->Parent() != scene->RootObject())) object = object->Parent();
      R3SurfelLabel *label = (object) ? object->GroundTruthLabel() : NULL;
      const RNRgb& rgb = (label) ? label->Color() : RNwhite_rgb;
      RNLoadRgb(rgb);
      DrawSurfels(node);
    }
    break;

  case R3_SURFEL_VIEWER_COLOR_BY_SCAN:
    // Draw with colors based on nodes
    for (int i = 0; i < resident_nodes.NNodes(); i++) {
      R3SurfelNode *node = resident_nodes.Node(i);
      R3SurfelScan *scan = node->Scan();
      int scan_index = (scan) ? scan->SceneIndex() : 0;
      LoadColor(scan_index);
      DrawSurfels(node);
    }
    break;
    
  case R3_SURFEL_VIEWER_COLOR_BY_OBJECT:
    // Draw with colors based on nodes
    for (int i = 0; i < resident_nodes.NNodes(); i++) {
      R3SurfelNode *node = resident_nodes.Node(i);
      R3SurfelObject *object = node->Object(TRUE, TRUE);
      while (object && object->Parent() && (object->Parent() != scene->RootObject())) object = object->Parent();
      int object_index = (object) ? object->SceneIndex() : 0;
      LoadColor(object_index);
      DrawSurfels(node);
    }
    break;
    
  case R3_SURFEL_VIEWER_COLOR_BY_NODE:
    // Draw with colors based on nodes
    for (int i = 0; i < resident_nodes.NNodes(); i++) {
      R3SurfelNode *node = resident_nodes.Node(i);
      LoadColor(i);
      DrawSurfels(node);
    }
    break;
    
  case R3_SURFEL_VIEWER_COLOR_BY_BLOCK:
    // Draw with colors based on blocks
    for (int i = 0; i < resident_nodes.NNodes(); i++) {
      R3SurfelNode *node = resident_nodes.Node(i);
      if (!NodeVisibility(node)) continue;
      for (int j = 0; j < node->NBlocks(); j++) {
        R3SurfelBlock *block = node->Block(j);
        LoadColor(block->DatabaseIndex());
        block->Draw(shape_draw_flags, subsampling_factor);
      }
    }
    break;
    
  case R3_SURFEL_VIEWER_COLOR_BY_OBJECT_ATTRIBUTES:
    // Draw with colors based on flags encoding object attributes
    for (int i = 0; i < resident_nodes.NNodes(); i++) {
      R3SurfelNode *node = resident_nodes.Node(i);
      if (!NodeVisibility(node)) continue;
      R3SurfelObject *object = node->Object(TRUE, TRUE);
      while (object && object->Parent() && (object->Parent() != scene->RootObject())) object = object->Parent();
      RNFlags flags = (object) ? object->Flags() : RNFlags(0);
      LoadColor((int) flags);
      DrawSurfels(node);
    }
    break;
    
  case R3_SURFEL_VIEWER_COLOR_BY_SHADING:
    // Draw with colors based on shading
    glEnable(GL_LIGHTING);
    RNLoadRgb(0.8, 0.8, 0.8);
    for (int i = 0; i < resident_nodes.NNodes(); i++) {
      R3SurfelNode *node = resident_nodes.Node(i);
      DrawSurfels(node, R3_SURFEL_NORMAL_DRAW_FLAG);
    }
    glDisable(GL_LIGHTING);
    break;
    
  case R3_SURFEL_VIEWER_COLOR_BY_NORMAL:
    // Draw with colors based on normals
    for (int i = 0; i < resident_nodes.NNodes(); i++) {
      R3SurfelNode *node = resident_nodes.Node(i);
      if (!NodeVisibility(node)) continue;
      for (int j = 0; j < node->NBlocks(); j++) {
        R3SurfelBlock *block = node->Block(j);
        const R3Point& block_origin = block->PositionOrigin();
        glPushMatrix();
        glTranslated(block_origin.X(), block_origin.Y(), block_origin.Z());
        RNGrfxBegin(RN_GRFX_POINTS);
        for (int k = 0; k < block->NSurfels(); k += subsampling_factor) {
          const R3Surfel *surfel = block->Surfel(k);
          float r = 0.5F + 0.5F * surfel->NX();
          float g = 0.5F + 0.5F * surfel->NY();
          float b = 0.5F + 0.5F * surfel->NZ();
          RNLoadRgb(r, g, b);
          R3LoadPoint(surfel->PositionPtr());
        }
        RNGrfxEnd();
        glPopMatrix();
      }
    }
    break;
    
  case R3_SURFEL_VIEWER_COLOR_BY_Z:
  case R3_SURFEL_VIEWER_COLOR_BY_ELEVATION:
  case R3_SURFEL_VIEWER_COLOR_BY_SURFEL_LABEL:
  case R3_SURFEL_VIEWER_COLOR_BY_CONFIDENCE:
    // Draw with colors based on surfel attributes
    for (int i = 0; i < resident_nodes.NNodes(); i++) {
      R3SurfelNode *node = resident_nodes.Node(i);
      if (!NodeVisibility(node)) continue;
      for (int j = 0; j < node->NBlocks(); j++) {
        R3SurfelBlock *block = node->Block(j);
        const R3Point& block_origin = block->PositionOrigin();
        glPushMatrix();
        glTranslated(block_origin.X(), block_origin.Y(), block_origin.Z());
        RNGrfxBegin(RN_GRFX_POINTS);
        for (int k = 0; k < block->NSurfels(); k += subsampling_factor) {
          const R3Surfel *surfel = block->Surfel(k);
          if (color_scheme == R3_SURFEL_VIEWER_COLOR_BY_Z) {
            double z = block_origin.Z() + surfel->Z();
            double dz = (z > center_point.Z()) ? z - center_point.Z() : 0;
            double value = 0.5 * sqrt(dz);
            LoadColor(value);
          }
          else if (color_scheme == R3_SURFEL_VIEWER_COLOR_BY_ELEVATION) {
            double elevation = surfel->Elevation();
            double value = (elevation > 0) ? 0.5 * sqrt(elevation) : 0;
            LoadColor(value);
          }
          else if (color_scheme == R3_SURFEL_VIEWER_COLOR_BY_SURFEL_LABEL) {
            int label_identifier = surfel->Attribute() & 0xFF;
            LoadColor(label_identifier);
          }
          else if (color_scheme == R3_SURFEL_VIEWER_COLOR_BY_CONFIDENCE) {
            double confidence = ((surfel->Attribute() >> 8) & 0xFF) / 255.0;
            LoadColor(confidence);
          }
          R3LoadPoint(surfel->PositionPtr());
        }
        RNGrfxEnd();
        glPopMatrix();
      }
    }
    break;
    
  default:
    // Draw with RGB surfel colors
    for (int i = 0; i < resident_nodes.NNodes(); i++) {
      R3SurfelNode *node = resident_nodes.Node(i);
      if (!NodeVisibility(node)) continue;
      DrawSurfels(node, R3_SURFEL_COLOR_DRAW_FLAG);
    }
    break;
  }

  // Reset point size
  glPointSize(1);    
}

// Assembly:
cmpl $0x0, 0x2f0(%rdi)
je 0x2e25d
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %r14d
movq %rdi, %rbx
movl $0xb50, %edi            # imm = 0xB50
callq 0x27200
cmpl $0xe, %r14d
jne 0x2e25e
cvtsi2sdl 0x118(%rbx), %xmm0
mulsd 0x109dd5(%rip), %xmm0   # 0x138028
addsd 0x109dad(%rip), %xmm0   # 0x138008
jmp 0x2e266
retq
movsd 0x2e8(%rbx), %xmm0
cvtsd2ss %xmm0, %xmm0
callq 0x270a0
testb $0x10, 0x458(%rbx)
jne 0x2e2a2
movq (%rbx), %rax
movq %rbx, %rdi
movl %r14d, %esi
callq *0x370(%rax)
movss 0x109db1(%rip), %xmm0   # 0x138040
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x270a0
leal -0x1(%r14), %eax
cmpl $0xd, %eax
ja 0x2e9a7
leaq 0x10a2ce(%rip), %rcx    # 0x138584
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, 0x24(%rbx)
jle 0x2e287
xorl %ecx, %ecx
movq 0x18(%rbx), %rax
movq %rcx, 0x10(%rsp)
movq (%rax,%rcx,8), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2ce66
testl %eax, %eax
je 0x2e451
cmpl $0x0, 0x4c(%r15)
jle 0x2e451
xorl %ebp, %ebp
movq %r15, 0x8(%rsp)
movq 0x40(%r15), %rax
movq (%rax,%rbp,8), %r13
callq 0x27fc0
movsd 0x10(%r13), %xmm0
movsd 0x18(%r13), %xmm1
movsd 0x20(%r13), %xmm2
callq 0x279c0
xorl %edi, %edi
callq 0x271a0
cmpl $0x0, 0x8(%r13)
jle 0x2e432
xorl %r15d, %r15d
movslq %r15d, %rax
leaq (%rax,%rax,2), %r12
shlq $0x4, %r12
addq (%r13), %r12
cmpl $0xa, %r14d
jg 0x2e36e
cmpl $0x2, %r14d
je 0x2e3b0
cmpl $0xa, %r14d
jne 0x2e419
movzbl 0x24(%r12), %esi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x218(%rax)
jmp 0x2e419
cmpl $0xb, %r14d
je 0x2e3e9
cmpl $0xc, %r14d
jne 0x2e419
movswl 0x2a(%r12), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x10a00d(%rip), %xmm0   # 0x1383a0
xorps %xmm1, %xmm1
cvtsd2ss %xmm0, %xmm1
xorpd %xmm0, %xmm0
ucomiss 0x10a19b(%rip), %xmm1   # 0x138540
jbe 0x2e40d
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
jmp 0x2e3d9
xorps %xmm1, %xmm1
cvtss2sd 0x8(%r12), %xmm1
addsd 0x20(%r13), %xmm1
movsd 0x2c0(%rbx), %xmm0
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
cmpltsd %xmm1, %xmm0
andpd %xmm2, %xmm0
ucomisd 0x109fff(%rip), %xmm0   # 0x1383e0
jb 0x2e400
sqrtsd %xmm0, %xmm0
jmp 0x2e405
movzbl 0x25(%r12), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x109f72(%rip), %xmm0   # 0x138370
jmp 0x2e40d
callq 0x27700
mulsd 0x109c03(%rip), %xmm0   # 0x138010
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x220(%rax)
movq %r12, %rdi
callq 0x27650
addl 0x48c(%rbx), %r15d
cmpl 0x8(%r13), %r15d
jl 0x2e332
callq 0x27cb0
callq 0x28220
incq %rbp
movq 0x8(%rsp), %r15
movslq 0x4c(%r15), %rax
cmpq %rax, %rbp
jl 0x2e2f9
movq 0x10(%rsp), %rcx
incq %rcx
movslq 0x24(%rbx), %rax
cmpq %rax, %rcx
jl 0x2e2c7
jmp 0x2e287
cmpl $0x0, 0x24(%rbx)
jle 0x2e287
xorl %r15d, %r15d
leaq 0x18ece9(%rip), %r12    # 0x1bd168
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %r14
movq %r14, %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0x401d4
movq 0x8(%rbx), %rcx
testq %rax, %rax
je 0x2e4c1
movq %rax, %rdi
movq 0x18(%rax), %rax
testq %rax, %rax
je 0x2e4b7
movq 0x10(%rcx), %rdx
cmpq (%rdx), %rax
jne 0x2e49d
callq 0x47054
testq %rax, %rax
jne 0x2e4c6
movq %r12, %rax
jmp 0x2e4ca
addq $0x70, %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
callq 0x27ed0
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x278(%rax)
incq %r15
movslq 0x24(%rbx), %rax
cmpq %rax, %r15
jl 0x2e47f
jmp 0x2e287
cmpl $0x0, 0x24(%rbx)
jle 0x2e287
xorl %r15d, %r15d
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2ce66
testl %eax, %eax
je 0x2e57a
movq %r14, %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0x401d4
movq 0x8(%rbx), %rcx
testq %rax, %rax
je 0x2e55b
movq %rax, %rdx
movq 0x18(%rax), %rax
testq %rax, %rax
je 0x2e553
movq 0x10(%rcx), %rsi
cmpq (%rsi), %rax
jne 0x2e539
movl 0xe8(%rdx), %esi
jmp 0x2e55d
xorl %esi, %esi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x218(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x278(%rax)
incq %r15
movslq 0x24(%rbx), %rax
cmpq %rax, %r15
jl 0x2e50c
jmp 0x2e287
cmpl $0x0, 0x24(%rbx)
jle 0x2e287
xorl %r12d, %r12d
movq 0x18(%rbx), %rax
movq (%rax,%r12,8), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2ce66
testl %eax, %eax
je 0x2e5f5
cmpl $0x0, 0x4c(%r14)
jle 0x2e5f5
xorl %r13d, %r13d
movq 0x40(%r14), %rax
movq (%rax,%r13,8), %r15
movl 0xa0(%r15), %esi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x218(%rax)
movq 0x458(%rbx), %rsi
movl 0x48c(%rbx), %edx
movq %r15, %rdi
callq 0x37b40
incq %r13
movslq 0x4c(%r14), %rax
cmpq %rax, %r13
jl 0x2e5b9
incq %r12
movslq 0x24(%rbx), %rax
cmpq %rax, %r12
jl 0x2e598
jmp 0x2e287
cmpl $0x0, 0x24(%rbx)
jle 0x2e287
xorl %r15d, %r15d
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %r14
movq %r14, %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0x401d4
movq 0x8(%rbx), %rcx
testq %rax, %rax
je 0x2e650
movq %rax, %rdx
movq 0x18(%rax), %rax
testq %rax, %rax
je 0x2e64b
movq 0x10(%rcx), %rsi
cmpq (%rsi), %rax
jne 0x2e631
movl 0x10(%rdx), %esi
jmp 0x2e652
xorl %esi, %esi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x218(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x278(%rax)
incq %r15
movslq 0x24(%rbx), %rax
cmpq %rax, %r15
jl 0x2e613
jmp 0x2e287
cmpl $0x0, 0x24(%rbx)
jle 0x2e287
xorl %ecx, %ecx
movq 0x18(%rbx), %rax
movq %rcx, 0x8(%rsp)
movq (%rax,%rcx,8), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2ce66
testl %eax, %eax
je 0x2e7a2
cmpl $0x0, 0x4c(%r14)
jle 0x2e7a2
xorl %r13d, %r13d
movq 0x40(%r14), %rax
movq (%rax,%r13,8), %rbp
callq 0x27fc0
movsd 0x10(%rbp), %xmm0
movsd 0x18(%rbp), %xmm1
movsd 0x20(%rbp), %xmm2
callq 0x279c0
xorl %edi, %edi
callq 0x271a0
cmpl $0x0, 0x8(%rbp)
movss 0x109e42(%rip), %xmm3   # 0x138530
movss 0x109e46(%rip), %xmm4   # 0x13853c
jle 0x2e788
xorl %r12d, %r12d
movq (%rbp), %rax
movslq %r12d, %r12
leaq (%r12,%r12,2), %rcx
shlq $0x4, %rcx
leaq (%rax,%rcx), %r15
movswl 0x10(%rax,%rcx), %edx
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
mulss %xmm3, %xmm0
movswl 0x12(%rax,%rcx), %edx
xorps %xmm1, %xmm1
cvtsi2ss %edx, %xmm1
mulss %xmm4, %xmm0
addss %xmm4, %xmm0
mulss %xmm3, %xmm1
mulss %xmm4, %xmm1
movswl 0x14(%rax,%rcx), %eax
xorps %xmm2, %xmm2
cvtsi2ss %eax, %xmm2
addss %xmm4, %xmm1
mulss %xmm3, %xmm2
mulss %xmm4, %xmm2
addss %xmm4, %xmm2
callq 0x28350
movq %r15, %rdi
callq 0x27650
movss 0x109dcd(%rip), %xmm4   # 0x13853c
movss 0x109db9(%rip), %xmm3   # 0x138530
addl 0x48c(%rbx), %r12d
cmpl 0x8(%rbp), %r12d
jl 0x2e6ff
callq 0x27cb0
callq 0x28220
incq %r13
movslq 0x4c(%r14), %rax
cmpq %rax, %r13
jl 0x2e6ba
movq 0x8(%rsp), %rcx
incq %rcx
movslq 0x24(%rbx), %rax
cmpq %rax, %rcx
jl 0x2e68c
jmp 0x2e287
cmpl $0x0, 0x24(%rbx)
jle 0x2e287
xorl %r15d, %r15d
movq (%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%r15,8), %r14
movq $0x0, (%rsp)
movq %rbx, %rdi
movl $0xe, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r14, %r8
xorl %r9d, %r9d
callq *0x228(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x278(%rax)
incq %r15
movslq 0x24(%rbx), %rax
cmpq %rax, %r15
jl 0x2e7c9
jmp 0x2e287
cmpl $0x0, 0x24(%rbx)
jle 0x2e287
xorl %r15d, %r15d
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %r14
movq %r14, %rdi
movl $0x1, %esi
callq 0x40278
movl $0x0, %esi
testq %rax, %rax
je 0x2e845
movl 0x10(%rax), %esi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x218(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x278(%rax)
incq %r15
movslq 0x24(%rbx), %rax
cmpq %rax, %r15
jl 0x2e823
jmp 0x2e287
cmpl $0x0, 0x24(%rbx)
jle 0x2e287
xorl %r15d, %r15d
leaq 0x18e8e1(%rip), %r12    # 0x1bd168
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %r14
movq %r14, %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0x401d4
movq 0x8(%rbx), %rcx
testq %rax, %rax
je 0x2e8c9
movq %rax, %rdi
movq 0x18(%rax), %rax
testq %rax, %rax
je 0x2e8bf
movq 0x10(%rcx), %rdx
cmpq (%rdx), %rax
jne 0x2e8a5
callq 0x4713e
testq %rax, %rax
jne 0x2e8ce
movq %r12, %rax
jmp 0x2e8d2
addq $0x70, %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
callq 0x27ed0
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x278(%rax)
incq %r15
movslq 0x24(%rbx), %rax
cmpq %rax, %r15
jl 0x2e887
jmp 0x2e287
cmpl $0x0, 0x24(%rbx)
jle 0x2e287
xorl %r14d, %r14d
movq (%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%r14,8), %r15
movq %rbx, %rdi
movl %r14d, %esi
callq *0x218(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq *0x278(%rax)
incq %r14
movslq 0x24(%rbx), %rax
cmpq %rax, %r14
jl 0x2e914
jmp 0x2e287
movl $0xb50, %edi            # imm = 0xB50
callq 0x27860
movsd 0x109a79(%rip), %xmm0   # 0x1383d8
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
callq 0x27ed0
cmpl $0x0, 0x24(%rbx)
jle 0x2e998
xorl %r14d, %r14d
movq (%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%r14,8), %rsi
movl $0x2, %edx
movq %rbx, %rdi
callq *0x278(%rax)
incq %r14
movslq 0x24(%rbx), %rax
cmpq %rax, %r14
jl 0x2e973
movl $0xb50, %edi            # imm = 0xB50
callq 0x27200
jmp 0x2e287
cmpl $0x0, 0x24(%rbx)
jle 0x2e287
xorl %r15d, %r15d
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2ce66
testl %eax, %eax
je 0x2e9df
movq (%rbx), %rax
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq *0x278(%rax)
incq %r15
movslq 0x24(%rbx), %rax
cmpq %rax, %r15
jl 0x2e9b4
jmp 0x2e287