// File: /workspace/github_cpp_makefile_star2_O2/BartMassey[P]ancient-raytracer/fast_texture.cc
// Function: fast_texture::value(point&, point&, point&, model&, int)
point fast_texture::value( point &at, point &gc, point &normal,
 model &m, int depth ) {
  point result( ka );  // ambient term
  point lv( (pl - gc).unit() );  // unit vector from target toward light
  
  // diffuse term
  float fd = lv * normal;
  if( fd > TINY )
    result += kd.vproduct( pli ) * fd;
    
  // specular terms
  point pt = (gc - pe).unit();  // unit vector from eye toward target
  point ps = pt - normal * ( ( pt * normal ) * 2.0 );  // specular direction

  // specular diffusion term
  float fs = ps * lv;
  if( fs > 0 ) {
    fs = exp( ns * log( fs ) );
    if( fs > TINY )
        result += ks.vproduct( pli ) * fs;
  }
  
  // ray tracing term
  return result + ks.vproduct( trace( ray( gc, ps ), m, depth ).contraction() );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movq %r9, 0x8(%rsp)
movq %r8, %r13
movq %rcx, %r12
movq %rsi, %r14
movq %rdi, %rbx
addq $0x8, %rsi
leaq 0x70(%rsp), %rdi
callq 0x2808
leaq 0x70(%r14), %rbp
leaq 0x210(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x2808
leaq 0x10(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x2a22
leaq 0x90(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2de0
leaq 0x1f0(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x2808
leaq 0x90(%rsp), %rdi
movq %r15, %rsi
callq 0x2998
cvtss2sd %xmm0, %xmm1
ucomisd 0x1972(%rip), %xmm1     # 0x6060
jbe 0x474b
movss %xmm0, 0x4(%rsp)
leaq 0x28(%r14), %r15
leaq 0x90(%r14), %rsi
leaq 0x1d0(%rsp), %rbp
movq %rbp, %rdi
callq 0x2808
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x2cda
leaq 0x130(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movss 0x4(%rsp), %xmm0
callq 0x2b4c
leaq 0x70(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x2a96
leaq 0xb0(%r14), %rsi
leaq 0x1b0(%rsp), %r15
movq %r15, %rdi
callq 0x2808
movq (%r12), %rax
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq *0x50(%rax)
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x2de0
leaq 0x190(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x2808
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x2998
addss %xmm0, %xmm0
movq (%r13), %rax
leaq 0x110(%rsp), %rdi
movq %r13, %rsi
callq *0x78(%rax)
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x110(%rsp), %rdx
callq 0x2a22
leaq 0x170(%rsp), %r15
leaq 0x90(%rsp), %rsi
movq %r15, %rdi
callq 0x2808
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x2998
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x4886
movss 0x68(%r14), %xmm1
movss %xmm1, 0x4(%rsp)
callq 0x21b0
mulss 0x4(%rsp), %xmm0
callq 0x2150
cvtss2sd %xmm0, %xmm1
ucomisd 0x1837(%rip), %xmm1     # 0x6060
jbe 0x4886
movss %xmm0, 0x4(%rsp)
leaq 0x48(%r14), %r15
leaq 0x90(%r14), %rsi
leaq 0x150(%rsp), %r13
movq %r13, %rdi
callq 0x2808
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x2cda
leaq 0xf0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movss 0x4(%rsp), %xmm0
callq 0x2b4c
leaq 0x70(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x2a96
leaq 0x230(%rsp), %rdi
leaq 0x30(%rsp), %rdx
movq %r12, %rsi
callq 0x2f96
movl 0x2b0(%rsp), %ecx
leaq 0x50(%rsp), %rdi
leaq 0x230(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x22cc
leaq 0xb0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x2ea0
addq $0x48, %r14
leaq 0xd0(%rsp), %rdi
leaq 0xb0(%rsp), %rdx
movq %r14, %rsi
callq 0x2cda
leaq 0x70(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
movq %rbx, %rdi
callq 0x2a5c
movq %rbx, %rax
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x492d
jmp 0x492d
jmp 0x492d
jmp 0x492d
jmp 0x492d
jmp 0x492d
jmp 0x492d
jmp 0x492d
jmp 0x492d
jmp 0x492d
jmp 0x492d
jmp 0x492d
jmp 0x492d
jmp 0x492d
movq %rax, %rdi
callq 0x2180
nop