// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/apps/prpview/prpview.cpp
// Function: NormalizedColor(gaps::R3MeshVertex*)
static RNRgb 
NormalizedColor(R3MeshVertex *vertex)
{
  // Check color scheme
  RNRgb c(0, 0, 0);
  if (color_with_labels) {
    // Color with deterministic value based on int label
    int ivalue = (current_property->VertexValue(vertex) + 0.5);
    c[0] = (ivalue % 7) / 6.0;
    c[1] = (ivalue % 5) / 4.0;
    c[2] = (ivalue % 2) / 1.0;
  }
  else {
    // Compute normalized value
    RNScalar value = NormalizedValue(vertex);
    if (flip_color_range) value = 1.0 - value;
    
    // Compute color
    if (color_with_redness) {
      c[0] = 0.8;
      c[1] = 0.8 * (1 - value);
      c[2] = 0.8 * (1 - value);
    }
    else {
      if (value < 0.5) {
        c[0] = 1 - 2 * value;
        c[1] = 2 * value;
      }
      else {
        c[1] = 1 - 2 * (value - 0.5);
        c[2] = 2 * (value - 0.5);
      }
    }
  }
  
  // Return color
  return c;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorpd %xmm2, %xmm2
callq 0x8cd70
movq 0x1253b2(%rip), %rax    # 0x14b980
movslq 0x70(%r14), %rcx
movq 0x410(%rax), %rax
movsd (%rax,%rcx,8), %xmm0
cmpb $0x1, 0x125407(%rip)    # 0x14b9ec
jne 0x26675
addsd 0xbaa45(%rip), %xmm0    # 0xe1038
cvttsd2si %xmm0, %eax
cltq
imulq $-0x6db6db6d, %rax, %rcx # imm = 0x92492493
shrq $0x20, %rcx
addl %eax, %ecx
movl %ecx, %edx
shrl $0x1f, %edx
sarl $0x2, %ecx
addl %edx, %ecx
leal (,%rcx,8), %edx
subl %edx, %ecx
addl %eax, %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
divsd 0xbaa3e(%rip), %xmm0    # 0xe1068
imulq $0x66666667, %rax, %rcx # imm = 0x66666667
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x21, %rcx
addl %edx, %ecx
leal (%rcx,%rcx,4), %ecx
movl %eax, %edx
subl %ecx, %edx
xorps %xmm1, %xmm1
cvtsi2sd %edx, %xmm1
movsd %xmm0, (%rbx)
mulsd 0xbaa18(%rip), %xmm1    # 0xe1070
movsd %xmm1, 0x8(%rbx)
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
andl $-0x2, %ecx
subl %ecx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
jmp 0x26712
movsd 0x12529b(%rip), %xmm2   # 0x14b918
movsd 0x12528b(%rip), %xmm1   # 0x14b910
subsd %xmm1, %xmm2
movapd %xmm0, %xmm3
subsd %xmm1, %xmm3
divsd %xmm2, %xmm3
xorpd %xmm1, %xmm1
cmpltsd %xmm2, %xmm1
andpd %xmm1, %xmm3
andnpd %xmm0, %xmm1
orpd %xmm3, %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
xorpd %xmm2, %xmm2
ja 0x266ce
ucomisd 0xba960(%rip), %xmm1    # 0xe1020
movapd %xmm1, %xmm2
jbe 0x266ce
movsd 0xba952(%rip), %xmm2    # 0xe1020
movsd 0xba94a(%rip), %xmm0    # 0xe1020
cmpb $0x0, 0x12530b(%rip)    # 0x14b9e8
je 0x266eb
movapd %xmm0, %xmm1
subsd %xmm2, %xmm1
movapd %xmm1, %xmm2
cmpb $0x1, 0x125272(%rip)    # 0x14b964
jne 0x26719
movabsq $0x3fe999999999999a, %rax # imm = 0x3FE999999999999A
movq %rax, (%rbx)
subsd %xmm2, %xmm0
mulsd 0xba903(%rip), %xmm0    # 0xe1010
movsd %xmm0, 0x8(%rbx)
movl $0x10, %eax
jmp 0x26758
movsd 0xba917(%rip), %xmm1    # 0xe1038
ucomisd %xmm2, %xmm1
jbe 0x2673a
addsd %xmm2, %xmm2
subsd %xmm2, %xmm0
movsd %xmm0, (%rbx)
movl $0x8, %eax
jmp 0x26754
addsd 0xba91e(%rip), %xmm2    # 0xe1060
addsd %xmm2, %xmm2
subsd %xmm2, %xmm0
movsd %xmm0, 0x8(%rbx)
movl $0x10, %eax
movapd %xmm2, %xmm0
movsd %xmm0, (%rbx,%rax)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq