// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelObjectProperty.cpp
// Function: gaps::R3SurfelObjectProperty::Draw(gaps::RNFlags) const
void R3SurfelObjectProperty::
Draw(RNFlags flags) const
{
  // Draw property based on type
  switch (type) {
  case R3_SURFEL_OBJECT_PCA_PROPERTY: 
    if (noperands == 21) {
      R3Point centroid(operands[0], operands[1], operands[2]);
      R3Vector axis1(operands[3], operands[4], operands[5]);
      R3Vector axis2(operands[6], operands[7], operands[8]);
      R3Vector axis3(operands[9], operands[10], operands[11]);
      RNScalar stddev1 = sqrt(operands[12]);
      RNScalar stddev2 = sqrt(operands[13]);
      RNScalar stddev3 = sqrt(operands[14]);
      RNScalar extent01 = operands[15];
      RNScalar extent02 = operands[16];
      RNScalar extent03 = operands[17];
      RNScalar extent11 = operands[18];
      RNScalar extent12 = operands[19];
      RNScalar extent13 = operands[20];

      // Draw normal
      glLineWidth(5);
      RNGrfxBegin(RN_GRFX_LINES);
      if (flags[R3_SURFEL_COLOR_DRAW_FLAG]) RNLoadRgb(0, 0, 1);
      R3LoadPoint(centroid);
      R3LoadPoint(centroid + extent13*axis3);
      RNGrfxEnd();

      // Draw stddevs
      glLineWidth(2);
      RNGrfxBegin(RN_GRFX_LINES);
      if (flags[R3_SURFEL_COLOR_DRAW_FLAG]) RNLoadRgb(1, 0, 0);
      R3LoadPoint(centroid - stddev1 * axis1);
      R3LoadPoint(centroid + stddev1 * axis1);
      if (flags[R3_SURFEL_COLOR_DRAW_FLAG]) RNLoadRgb(0, 1, 0);
      R3LoadPoint(centroid - stddev2 * axis2);
      R3LoadPoint(centroid + stddev2 * axis2);
      if (flags[R3_SURFEL_COLOR_DRAW_FLAG]) RNLoadRgb(0, 0, 1);
      R3LoadPoint(centroid - stddev3 * axis3);
      R3LoadPoint(centroid + stddev3 * axis3);
      RNGrfxEnd();

      // Draw extents
      glLineWidth(1);
      RNGrfxBegin(RN_GRFX_LINES);
      if (flags[R3_SURFEL_COLOR_DRAW_FLAG]) RNLoadRgb(1, 0, 0);
      R3LoadPoint(centroid + extent01 * axis1);
      R3LoadPoint(centroid + extent11 * axis1);
      if (flags[R3_SURFEL_COLOR_DRAW_FLAG]) RNLoadRgb(0, 1, 0);
      R3LoadPoint(centroid + extent02 * axis2);
      R3LoadPoint(centroid + extent12 * axis2);
      if (flags[R3_SURFEL_COLOR_DRAW_FLAG]) RNLoadRgb(0, 0, 1);
      R3LoadPoint(centroid + extent03 * axis3);
      R3LoadPoint(centroid + extent13 * axis3);
      RNGrfxEnd();
    }
    break; 

  case R3_SURFEL_OBJECT_AMODAL_OBB_PROPERTY: 
    if (noperands == 20) {
      // Parse operands
      R3Point centroid(operands[0], operands[1], operands[2]);
      R3Vector axis1(operands[3], operands[4], operands[5]);
      R3Vector axis2(operands[6], operands[7], operands[8]);
      R3Vector axis3(operands[9], operands[10], operands[11]);
      RNScalar radius1 = operands[12];
      RNScalar radius2 = operands[13];
      RNScalar radius3 = operands[14];
      // RNScalar confidence = operands[15];
      // int originator = (int) (operands[16] + 0.5);

      // Check if should draw nose
      RNBoolean draw_nose = TRUE;
      R3SurfelLabel *label = (object) ? object->CurrentLabel() : NULL;
      if (label && label->Flags()[R3_SURFEL_LABEL_UNORIENTABLE_FLAG]) draw_nose = FALSE;

      // Draw obb
      R3OrientedBox obb(centroid, axis1, axis2, radius1, radius2, radius3);
      obb.Outline();

      // Draw nose
      if (draw_nose) {
        double min_nose_vector_length = 0.5;
        double nose_vector_length = 0.25 * radius1;
        if (nose_vector_length < min_nose_vector_length)
          nose_vector_length = min_nose_vector_length;
        R3Point start = centroid + radius1 * axis1;
        R3Point end = start + nose_vector_length * axis1;
        R3Span(start, end).Draw();
      }
    }
    break; 
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdi, %r14
movl 0x2c(%rdi), %eax
cmpl $0x2, %eax
je 0x3fa99
cmpl $0x1, %eax
jne 0x4010a
cmpl $0x15, 0x28(%r14)
jne 0x4010a
movq %rsi, %rbx
movq 0x20(%r14), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
leaq 0x110(%rsp), %rdi
callq 0x84d7e
movq 0x20(%r14), %rax
movsd 0x18(%rax), %xmm0
movsd 0x20(%rax), %xmm1
movsd 0x28(%rax), %xmm2
leaq 0xc0(%rsp), %rdi
callq 0x85816
movq 0x20(%r14), %rax
movsd 0x30(%rax), %xmm0
movsd 0x38(%rax), %xmm1
movsd 0x40(%rax), %xmm2
leaq 0x90(%rsp), %rdi
callq 0x85816
movq 0x20(%r14), %rax
movsd 0x48(%rax), %xmm0
movsd 0x50(%rax), %xmm1
movsd 0x58(%rax), %xmm2
leaq 0x50(%rsp), %rdi
callq 0x85816
movq 0x20(%r14), %rax
movsd 0x60(%rax), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x3fb55
sqrtsd %xmm0, %xmm0
jmp 0x3fb5e
cmpl $0x14, 0x28(%r14)
jne 0x4010a
movq 0x20(%r14), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
leaq 0x90(%rsp), %rdi
callq 0x84d7e
movq 0x20(%r14), %rax
movsd 0x18(%rax), %xmm0
movsd 0x20(%rax), %xmm1
movsd 0x28(%rax), %xmm2
leaq 0x50(%rsp), %rdi
callq 0x85816
movq 0x20(%r14), %rax
movsd 0x30(%rax), %xmm0
movsd 0x38(%rax), %xmm1
movsd 0x40(%rax), %xmm2
leaq 0x18(%rsp), %rdi
callq 0x85816
movq 0x20(%r14), %rax
movsd 0x48(%rax), %xmm0
movsd 0x50(%rax), %xmm1
movsd 0x58(%rax), %xmm2
leaq 0x30(%rsp), %rdi
callq 0x85816
movq 0x18(%r14), %rdi
movq 0x20(%r14), %rax
movsd 0x60(%rax), %xmm0
movsd %xmm0, (%rsp)
movsd 0x68(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x70(%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
testq %rdi, %rdi
je 0x3fff5
callq 0x1791a
jmp 0x3fff7
callq 0x133c0
xorpd %xmm1, %xmm1
movsd %xmm0, 0x48(%rsp)
movq 0x20(%r14), %rax
movsd 0x68(%rax), %xmm0
ucomisd %xmm1, %xmm0
jb 0x3fb79
sqrtsd %xmm0, %xmm0
jmp 0x3fb7e
callq 0x133c0
movsd %xmm0, 0x8(%rsp)
movq 0x20(%r14), %rax
movsd 0x70(%rax), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x3fb9d
sqrtsd %xmm0, %xmm0
jmp 0x3fba2
callq 0x133c0
movsd %xmm0, 0x10(%rsp)
movq 0x20(%r14), %rax
movsd 0x78(%rax), %xmm0
movsd %xmm0, 0x68(%rsp)
movsd 0x80(%rax), %xmm0
movsd %xmm0, 0x78(%rsp)
movsd 0x88(%rax), %xmm0
movsd %xmm0, 0x88(%rsp)
movsd 0x90(%rax), %xmm0
movsd %xmm0, 0x70(%rsp)
movsd 0x98(%rax), %xmm0
movsd %xmm0, 0x80(%rsp)
movsd 0xa0(%rax), %xmm0
movsd %xmm0, (%rsp)
movss 0x9fc06(%rip), %xmm0    # 0xdf810
callq 0x138f0
movl $0x1, %edi
callq 0x13130
testb $0x1, %bl
je 0x3fc32
movss 0x9fbee(%rip), %xmm2    # 0xdf814
xorps %xmm0, %xmm0
xorpd %xmm1, %xmm1
callq 0x139e0
leaq 0x110(%rsp), %r14
movq %r14, %rdi
callq 0x13150
leaq 0x30(%rsp), %r15
leaq 0x50(%rsp), %rsi
movq %r15, %rdi
movsd (%rsp), %xmm0
callq 0x861e6
leaq 0x18(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x850c9
movq %r12, %rdi
callq 0x13150
callq 0x136a0
movss 0x9fb97(%rip), %xmm0    # 0xdf818
callq 0x138f0
movl $0x1, %edi
callq 0x13130
testb $0x1, %bl
je 0x3fca9
movss 0x9fb77(%rip), %xmm0    # 0xdf814
xorpd %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x139e0
leaq 0x30(%rsp), %r14
leaq 0xc0(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movsd 0x48(%rsp), %xmm0
callq 0x861e6
leaq 0x18(%rsp), %r12
leaq 0x110(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x857a5
movq %r12, %rdi
callq 0x13150
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movsd 0x48(%rsp), %xmm0
callq 0x861e6
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x850c9
movq %r15, %rdi
callq 0x13150
testb $0x1, %bl
je 0x3fd33
movss 0x9faec(%rip), %xmm1    # 0xdf814
xorps %xmm0, %xmm0
xorps %xmm2, %xmm2
callq 0x139e0
leaq 0x30(%rsp), %r14
leaq 0x90(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movsd 0x8(%rsp), %xmm0
callq 0x861e6
leaq 0x18(%rsp), %r12
leaq 0x110(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x857a5
movq %r12, %rdi
callq 0x13150
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movsd 0x8(%rsp), %xmm0
callq 0x861e6
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x850c9
movq %r15, %rdi
callq 0x13150
testb $0x1, %bl
je 0x3fdbe
movss 0x9fa62(%rip), %xmm2    # 0xdf814
xorps %xmm0, %xmm0
xorpd %xmm1, %xmm1
callq 0x139e0
leaq 0x30(%rsp), %r14
leaq 0x50(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movsd 0x10(%rsp), %xmm0
callq 0x861e6
leaq 0x18(%rsp), %r12
leaq 0x110(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x857a5
movq %r12, %rdi
callq 0x13150
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movsd 0x10(%rsp), %xmm0
callq 0x861e6
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x850c9
movq %r15, %rdi
callq 0x13150
callq 0x136a0
movss 0x9f9da(%rip), %xmm0    # 0xdf814
callq 0x138f0
movl $0x1, %edi
callq 0x13130
testb $0x1, %bl
je 0x3fe62
movss 0x9f9be(%rip), %xmm0    # 0xdf814
xorpd %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x139e0
leaq 0x30(%rsp), %r14
leaq 0xc0(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movsd 0x68(%rsp), %xmm0
callq 0x861e6
leaq 0x18(%rsp), %r12
leaq 0x110(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x850c9
movq %r12, %rdi
callq 0x13150
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movsd 0x70(%rsp), %xmm0
callq 0x861e6
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x850c9
movq %r15, %rdi
callq 0x13150
testb $0x1, %bl
je 0x3feec
movss 0x9f933(%rip), %xmm1    # 0xdf814
xorps %xmm0, %xmm0
xorps %xmm2, %xmm2
callq 0x139e0
leaq 0x30(%rsp), %r14
leaq 0x90(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movsd 0x78(%rsp), %xmm0
callq 0x861e6
leaq 0x18(%rsp), %r12
leaq 0x110(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x850c9
movq %r12, %rdi
callq 0x13150
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movsd 0x80(%rsp), %xmm0
callq 0x861e6
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x850c9
movq %r15, %rdi
callq 0x13150
testb $0x1, %bl
je 0x3ff7a
movss 0x9f8a6(%rip), %xmm2    # 0xdf814
xorps %xmm0, %xmm0
xorpd %xmm1, %xmm1
callq 0x139e0
leaq 0x30(%rsp), %rbx
leaq 0x50(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movsd 0x88(%rsp), %xmm0
callq 0x861e6
leaq 0x18(%rsp), %r15
leaq 0x110(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x850c9
movq %r15, %rdi
callq 0x13150
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movsd (%rsp), %xmm0
callq 0x861e6
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x850c9
movq %r14, %rdi
callq 0x13150
callq 0x136a0
jmp 0x4010a
xorl %eax, %eax
testq %rax, %rax
je 0x4000c
movb 0x88(%rax), %bpl
andb $0x2, %bpl
shrb %bpl
jmp 0x4000e
xorl %ebp, %ebp
leaq 0x110(%rsp), %rbx
leaq 0x90(%rsp), %rsi
leaq 0x50(%rsp), %rdx
leaq 0x18(%rsp), %rcx
movq %rbx, %rdi
movsd (%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x8(%rsp), %xmm2
callq 0x6cc2c
movl $0x1, %esi
movq %rbx, %rdi
callq 0x6f2cc
testb %bpl, %bpl
jne 0x400fd
leaq 0xc0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movsd (%rsp), %xmm0
callq 0x861e6
leaq 0xa8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x850c9
movsd (%rsp), %xmm1
mulsd 0x9ea50(%rip), %xmm1    # 0xdeae8
movsd 0x9e0a0(%rip), %xmm0    # 0xde140
maxsd %xmm1, %xmm0
leaq 0xc0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x861e6
leaq 0x190(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x850c9
leaq 0xc0(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0x190(%rsp), %rdx
callq 0x84202
leaq 0xc0(%rsp), %rdi
callq 0x43fbe
leaq 0x110(%rsp), %rdi
callq 0x6ede0
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x40122
jmp 0x40122
jmp 0x40122
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
callq 0x6ede0
movq %rbx, %rdi
callq 0x138b0