// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/GSV/GSVScanline.cpp
// Function: gaps::GSVScanline::LoadPoints(gaps::RNFlags) const
void GSVScanline::
LoadPoints(RNFlags flags) const
{
  // Just checking
  if (NPoints() == 0) return;
  assert(points);

  // Draw points with different color schemes
  if (flags & GSV_DRAW_POINTS_WITH_VIEWPOINT_DISTANCE_COLOR) {
    // Get viewpoint
    R3Point v = Pose().Viewpoint();

    // Load points
    for (int i = 0; i < NPoints(); i++) {
      const R3Point& p = PointPosition(i);
      double dx = v[0] - p[0];
      double dy = v[1] - p[1];
      double dz = v[2] - p[2];
      double d2 = dx*dx + dy*dy + dz*dz;
      // double value = 0.0025 * d2;
      double value = 0.001 * d2;
      LoadColor(value);
      R3LoadPoint(PointPosition(i));
    }
  }
  else if (flags & GSV_DRAW_POINTS_WITH_HEIGHT_COLOR) {
    // Get height
    RNCoord ground_z = EstimatedGroundZ();

    // Load points
    for (int i = 0; i < NPoints(); i++) {
      const R3Point& p = PointPosition(i);
      double dz = p[2] - ground_z;
      double value = 0.25 * dz;
      LoadColor(value);
      R3LoadPoint(PointPosition(i));
    }
  }
  else if (flags & GSV_DRAW_POINTS_WITH_ELEVATION_COLOR) {
    // Load points
    for (int i = 0; i < NPoints(); i++) {
      LoadColor(0.5 * sqrt(PointElevation(i)));
      R3LoadPoint(PointPosition(i));
    }
  }
  else if (flags & GSV_DRAW_POINTS_WITH_REFLECTIVITY_COLOR) {
    // Load points
    for (int i = 0; i < NPoints(); i++) {
      LoadColor(sqrt(PointReflectivity(i)/255.0));
      R3LoadPoint(PointPosition(i));
    }
  }
  else if (flags & GSV_DRAW_POINTS_WITH_GROUND_COLOR) {
    // Load points
    for (int i = 0; i < NPoints(); i++) {
      if (PointFlags(i) & GSV_POINT_ON_GROUND_FLAG) RNLoadRgb(1, 0, 0);
      else RNLoadRgb(0, 0, 1);
      R3LoadPoint(PointPosition(i));
    }
  }
  else if (flags & GSV_DRAW_POINTS_WITH_RGB_COLOR) {
    // Load points
    for (int i = 0; i < NPoints(); i++) {
      RNLoadRgb(PointColor(i));
      R3LoadPoint(PointPosition(i));
    }
  }
  else if (flags & GSV_DRAW_POINTS_WITH_NORMAL_COLOR) {
    // Load points
    for (int i = 0; i < NPoints(); i++) {
      R3Vector vector = 0.5 * (PointNormal(i) + R3ones_vector);
      RNLoadRgb(vector.Coords());
      R3LoadPoint(PointPosition(i));
    }
  }
  else if (flags & GSV_DRAW_POINTS_WITH_POINT_IDENTIFIER_COLOR) {
    // Load points
    for (int i = 0; i < NPoints(); i++) {
      LoadColor(PointIdentifier(i));
      R3LoadPoint(PointPosition(i));
    }
  }
  else if (flags & GSV_DRAW_POINTS_WITH_CLUSTER_IDENTIFIER_COLOR) {
    // Load points
    for (int i = 0; i < NPoints(); i++) {
      LoadColor(PointClusterIdentifier(i));
      R3LoadPoint(PointPosition(i));
    }
  }
  else if (flags & GSV_DRAW_POINTS_WITH_CATEGORY_IDENTIFIER_COLOR) {
    // Load points
    for (int i = 0; i < NPoints(); i++) {
      LoadColor(PointCategoryIdentifier(i));
      R3LoadPoint(PointPosition(i));
    }
  }
  else if (flags & GSV_DRAW_POINTS_WITH_CATEGORY_CONFIDENCE_COLOR) {
    // Load points
    for (int i = 0; i < NPoints(); i++) {
      LoadColor(PointCategoryConfidence(i));
      R3LoadPoint(PointPosition(i));
    }
  }
  else {
    // Load points
    for (int i = 0; i < NPoints(); i++) {
      R3LoadPoint(PointPosition(i));
    }
  }
}

// Assembly:
cmpl $0x0, 0x30(%rdi)
je 0x4215c
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
testb $0x2, %sil
jne 0x41b62
testb $0x4, %sil
jne 0x41c33
btl $0x9, %esi
jb 0x41cd4
btl $0xb, %esi
jb 0x41d61
btl $0xa, %esi
jb 0x41de6
testb $0x8, %sil
jne 0x41e67
testb $0x10, %sil
jne 0x41f1b
testb $0x20, %sil
jne 0x41fcb
testb $0x40, %sil
jne 0x4202b
testb %sil, %sil
js 0x4208b
btl $0x8, %esi
movl 0x30(%rbx), %eax
jb 0x420e9
testl %eax, %eax
jle 0x4214e
movl $0x10, %r15d
xorl %r12d, %r12d
leaq 0x8(%rsp), %r14
movq 0x28(%rbx), %rax
movsd -0x10(%rax,%r15), %xmm0
movsd -0x8(%rax,%r15), %xmm1
movsd (%rax,%r15), %xmm2
movq %r14, %rdi
callq 0xd5e2e
movq %r14, %rdi
callq 0x271c0
incq %r12
movslq 0x30(%rbx), %rax
addq $0x50, %r15
cmpq %rax, %r12
jl 0x41b25
jmp 0x4214e
leaq 0x40(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0xd5e3e
cmpl $0x0, 0x30(%rbx)
jle 0x4214e
movl $0x10, %r12d
xorl %r13d, %r13d
leaq 0x28(%rsp), %r14
leaq 0x40(%rsp), %r15
movq 0x28(%rbx), %rax
movsd -0x10(%rax,%r12), %xmm0
movsd -0x8(%rax,%r12), %xmm1
movsd (%rax,%r12), %xmm2
movq %r14, %rdi
callq 0xd5e2e
movsd 0x8(%rsp), %xmm1
subsd 0x28(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
subsd 0x30(%rsp), %xmm2
movsd 0x18(%rsp), %xmm0
subsd 0x38(%rsp), %xmm0
mulsd %xmm2, %xmm2
mulsd %xmm1, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
mulsd 0x10d2bb(%rip), %xmm0   # 0x14eea8
callq 0x4215d
movq 0x28(%rbx), %rax
movsd -0x10(%rax,%r12), %xmm0
movsd -0x8(%rax,%r12), %xmm1
movsd (%rax,%r12), %xmm2
movq %r15, %rdi
callq 0xd5e2e
movq %r15, %rdi
callq 0x271c0
incq %r13
movslq 0x30(%rbx), %rax
addq $0x50, %r12
cmpq %rax, %r13
jl 0x41b8d
jmp 0x4214e
movq %rbx, %rdi
callq 0x412bc
movsd %xmm0, 0x20(%rsp)
cmpl $0x0, 0x30(%rbx)
jle 0x4214e
movl $0x10, %r12d
xorl %r13d, %r13d
leaq 0x8(%rsp), %r14
leaq 0x28(%rsp), %r15
movq 0x28(%rbx), %rax
movsd -0x10(%rax,%r12), %xmm0
movsd -0x8(%rax,%r12), %xmm1
movsd (%rax,%r12), %xmm2
movq %r14, %rdi
callq 0xd5e2e
movsd 0x18(%rsp), %xmm0
subsd 0x20(%rsp), %xmm0
mulsd 0x10c42e(%rip), %xmm0   # 0x14e0c0
callq 0x4215d
movq 0x28(%rbx), %rax
movsd -0x10(%rax,%r12), %xmm0
movsd -0x8(%rax,%r12), %xmm1
movsd (%rax,%r12), %xmm2
movq %r15, %rdi
callq 0xd5e2e
movq %r15, %rdi
callq 0x271c0
incq %r13
movslq 0x30(%rbx), %rax
addq $0x50, %r12
cmpq %rax, %r13
jl 0x41c5e
jmp 0x4214e
cmpl $0x0, 0x30(%rbx)
jle 0x4214e
xorl %r15d, %r15d
leaq 0x8(%rsp), %r14
xorl %r12d, %r12d
movq 0x28(%rbx), %rax
movswl 0x44(%rax,%r15), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x10c3ae(%rip), %xmm0   # 0x14e0b0
ucomisd 0x10c336(%rip), %xmm0   # 0x14e040
jb 0x41d12
sqrtsd %xmm0, %xmm0
jmp 0x41d17
callq 0x27710
mulsd 0x10c2f1(%rip), %xmm0   # 0x14e010
callq 0x4215d
movq 0x28(%rbx), %rax
movsd (%rax,%r15), %xmm0
movsd 0x8(%rax,%r15), %xmm1
movsd 0x10(%rax,%r15), %xmm2
movq %r14, %rdi
callq 0xd5e2e
movq %r14, %rdi
callq 0x271c0
incq %r12
movslq 0x30(%rbx), %rax
addq $0x50, %r15
cmpq %rax, %r12
jl 0x41ce9
jmp 0x4214e
cmpl $0x0, 0x30(%rbx)
jle 0x4214e
xorl %r15d, %r15d
leaq 0x8(%rsp), %r14
xorl %r12d, %r12d
movq 0x28(%rbx), %rax
movzbl 0x47(%rax,%r15), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x10c339(%rip), %xmm0   # 0x14e0c8
ucomisd 0x10c2a9(%rip), %xmm0   # 0x14e040
jb 0x41d9f
sqrtsd %xmm0, %xmm0
jmp 0x41da4
callq 0x27710
callq 0x4215d
movq 0x28(%rbx), %rax
movsd (%rax,%r15), %xmm0
movsd 0x8(%rax,%r15), %xmm1
movsd 0x10(%rax,%r15), %xmm2
movq %r14, %rdi
callq 0xd5e2e
movq %r14, %rdi
callq 0x271c0
incq %r12
movslq 0x30(%rbx), %rax
addq $0x50, %r15
cmpq %rax, %r12
jl 0x41d76
jmp 0x4214e
cmpl $0x0, 0x30(%rbx)
jle 0x4214e
xorl %r15d, %r15d
leaq 0x8(%rsp), %r14
xorl %r12d, %r12d
movq 0x28(%rbx), %rax
testb $0x4, 0x4d(%rax,%r15)
jne 0x41e17
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
movss 0x10c31f(%rip), %xmm2   # 0x14e134
jmp 0x41e25
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movss 0x10c30f(%rip), %xmm0   # 0x14e134
callq 0x28390
movq 0x28(%rbx), %rax
movsd (%rax,%r15), %xmm0
movsd 0x8(%rax,%r15), %xmm1
movsd 0x10(%rax,%r15), %xmm2
movq %r14, %rdi
callq 0xd5e2e
movq %r14, %rdi
callq 0x271c0
incq %r12
movslq 0x30(%rbx), %rax
addq $0x50, %r15
cmpq %rax, %r12
jl 0x41dfb
jmp 0x4214e
cmpl $0x0, 0x30(%rbx)
jle 0x4214e
xorl %r15d, %r15d
leaq 0x8(%rsp), %r14
xorl %r12d, %r12d
movq 0x28(%rbx), %rax
movzbl 0x48(%rax,%r15), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movsd 0x10c233(%rip), %xmm3   # 0x14e0c8
divsd %xmm3, %xmm0
movzbl 0x49(%rax,%r15), %ecx
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
divsd %xmm3, %xmm1
movzbl 0x4a(%rax,%r15), %eax
xorps %xmm2, %xmm2
cvtsi2sd %eax, %xmm2
divsd %xmm3, %xmm2
movq %r14, %rdi
callq 0xfa640
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
callq 0x27f00
movq 0x28(%rbx), %rax
movsd (%rax,%r15), %xmm0
movsd 0x8(%rax,%r15), %xmm1
movsd 0x10(%rax,%r15), %xmm2
movq %r14, %rdi
callq 0xd5e2e
movq %r14, %rdi
callq 0x271c0
incq %r12
movslq 0x30(%rbx), %rax
addq $0x50, %r15
cmpq %rax, %r12
jl 0x41e7c
jmp 0x4214e
cmpl $0x0, 0x30(%rbx)
jle 0x4214e
xorl %ebp, %ebp
leaq 0x40(%rsp), %r14
leaq 0x28(%rsp), %r12
leaq 0x8(%rsp), %r13
xorl %r15d, %r15d
movq 0x28(%rbx), %rax
xorps %xmm0, %xmm0
cvtss2sd 0x20(%rax,%rbp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x24(%rax,%rbp), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x28(%rax,%rbp), %xmm2
movq %r14, %rdi
callq 0xd68c6
movq %r12, %rdi
movq %r14, %rsi
leaq 0x116deb(%rip), %rdx    # 0x158d58
callq 0xd757c
movq %r13, %rdi
movq %r12, %rsi
movsd 0x10c090(%rip), %xmm0   # 0x14e010
callq 0xd7296
movq %r13, %rdi
callq 0x28100
movq 0x28(%rbx), %rax
movsd (%rax,%rbp), %xmm0
movsd 0x8(%rax,%rbp), %xmm1
movsd 0x10(%rax,%rbp), %xmm2
movq %r12, %rdi
callq 0xd5e2e
movq %r12, %rdi
callq 0x271c0
incq %r15
movslq 0x30(%rbx), %rax
addq $0x50, %rbp
cmpq %rax, %r15
jl 0x41f39
jmp 0x4214e
cmpl $0x0, 0x30(%rbx)
jle 0x4214e
xorl %r15d, %r15d
leaq 0x8(%rsp), %r14
xorl %r12d, %r12d
movq 0x28(%rbx), %rax
movl 0x38(%rax,%r15), %edi
callq 0x42230
movq 0x28(%rbx), %rax
movsd (%rax,%r15), %xmm0
movsd 0x8(%rax,%r15), %xmm1
movsd 0x10(%rax,%r15), %xmm2
movq %r14, %rdi
callq 0xd5e2e
movq %r14, %rdi
callq 0x271c0
incq %r12
movslq 0x30(%rbx), %rax
addq $0x50, %r15
cmpq %rax, %r12
jl 0x41fe0
jmp 0x4214e
cmpl $0x0, 0x30(%rbx)
jle 0x4214e
xorl %r15d, %r15d
leaq 0x8(%rsp), %r14
xorl %r12d, %r12d
movq 0x28(%rbx), %rax
movl 0x3c(%rax,%r15), %edi
callq 0x42230
movq 0x28(%rbx), %rax
movsd (%rax,%r15), %xmm0
movsd 0x8(%rax,%r15), %xmm1
movsd 0x10(%rax,%r15), %xmm2
movq %r14, %rdi
callq 0xd5e2e
movq %r14, %rdi
callq 0x271c0
incq %r12
movslq 0x30(%rbx), %rax
addq $0x50, %r15
cmpq %rax, %r12
jl 0x42040
jmp 0x4214e
cmpl $0x0, 0x30(%rbx)
jle 0x4214e
xorl %r15d, %r15d
leaq 0x8(%rsp), %r14
xorl %r12d, %r12d
movq 0x28(%rbx), %rax
movzbl 0x4b(%rax,%r15), %edi
callq 0x42230
movq 0x28(%rbx), %rax
movsd (%rax,%r15), %xmm0
movsd 0x8(%rax,%r15), %xmm1
movsd 0x10(%rax,%r15), %xmm2
movq %r14, %rdi
callq 0xd5e2e
movq %r14, %rdi
callq 0x271c0
incq %r12
movslq 0x30(%rbx), %rax
addq $0x50, %r15
cmpq %rax, %r12
jl 0x420a0
jmp 0x4214e
testl %eax, %eax
jle 0x4214e
xorl %r15d, %r15d
leaq 0x8(%rsp), %r14
xorl %r12d, %r12d
movq 0x28(%rbx), %rax
movzbl 0x4c(%rax,%r15), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x10bfb7(%rip), %xmm0   # 0x14e0c8
callq 0x4215d
movq 0x28(%rbx), %rax
movsd (%rax,%r15), %xmm0
movsd 0x8(%rax,%r15), %xmm1
movsd 0x10(%rax,%r15), %xmm2
movq %r14, %rdi
callq 0xd5e2e
movq %r14, %rdi
callq 0x271c0
incq %r12
movslq 0x30(%rbx), %rax
addq $0x50, %r15
cmpq %rax, %r12
jl 0x420f8
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq