// File: /workspace/github_cpp_makefile_star2_O3/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
xorpd %xmm0, %xmm0
xorps %xmm1, %xmm1
xorpd %xmm2, %xmm2
callq 0x8bb90
cmpb $0x1, 0x123471(%rip)    # 0x1499ec
jne 0x26622
movq 0x1233f8(%rip), %rax    # 0x149980
movslq 0x70(%r14), %rcx
movq 0x410(%rax), %rax
movsd (%rax,%rcx,8), %xmm0
addsd 0xb8a98(%rip), %xmm0    # 0xdf038
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 0xb8a91(%rip), %xmm0    # 0xdf068
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 0xb8a6b(%rip), %xmm1    # 0xdf070
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 0x266d6
movslq 0x70(%r14), %rax
movq 0x123353(%rip), %rcx    # 0x149980
movq 0x410(%rcx), %rcx
movsd (%rcx,%rax,8), %xmm1
movsd 0x1232d7(%rip), %xmm2   # 0x149918
movsd 0x1232c7(%rip), %xmm3   # 0x149910
subsd %xmm3, %xmm2
xorpd %xmm0, %xmm0
cmpltsd %xmm2, %xmm0
movapd %xmm0, %xmm4
andnpd %xmm1, %xmm4
subsd %xmm3, %xmm1
divsd %xmm2, %xmm1
andpd %xmm1, %xmm0
orpd %xmm4, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
xorpd %xmm2, %xmm2
ja 0x26692
ucomisd 0xb899c(%rip), %xmm0    # 0xdf020
movapd %xmm0, %xmm2
jbe 0x26692
movsd 0xb898e(%rip), %xmm2    # 0xdf020
movsd 0xb8986(%rip), %xmm0    # 0xdf020
cmpb $0x0, 0x123347(%rip)    # 0x1499e8
je 0x266af
movapd %xmm0, %xmm1
subsd %xmm2, %xmm1
movapd %xmm1, %xmm2
cmpb $0x1, 0x1232ae(%rip)    # 0x149964
jne 0x266dd
movabsq $0x3fe999999999999a, %rax # imm = 0x3FE999999999999A
movq %rax, (%rbx)
subsd %xmm2, %xmm0
mulsd 0xb893f(%rip), %xmm0    # 0xdf010
movsd %xmm0, 0x8(%rbx)
movl $0x10, %eax
jmp 0x2671c
movsd 0xb8953(%rip), %xmm1    # 0xdf038
ucomisd %xmm2, %xmm1
jbe 0x266fe
addsd %xmm2, %xmm2
subsd %xmm2, %xmm0
movsd %xmm0, (%rbx)
movl $0x8, %eax
jmp 0x26718
addsd 0xb895a(%rip), %xmm2    # 0xdf060
addsd %xmm2, %xmm2
subsd %xmm2, %xmm0
movsd %xmm0, 0x8(%rbx)
movl $0x10, %eax
movapd %xmm2, %xmm0
movsd %xmm0, (%rbx,%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq