// File: 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
movq %rsp, %rbp
subq $0x3a0, %rsp            # imm = 0x3A0
movq %rdi, -0x350(%rbp)
movq %rdi, %rax
movq %rax, -0x348(%rbp)
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x10(%rbp), %rsi
movq %rsi, -0x340(%rbp)
addq $0x8, %rsi
leaq -0x50(%rbp), %rdi
callq 0x2ef0
movq -0x340(%rbp), %rax
addq $0x70, %rax
movq %rax, -0x338(%rbp)
movq -0x20(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x2ef0
jmp 0x72b3
movq -0x338(%rbp), %rsi
leaq -0x90(%rbp), %rdi
leaq -0xb0(%rbp), %rdx
callq 0x3480
jmp 0x72cf
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x3c50
jmp 0x72e1
leaq -0x90(%rbp), %rdi
callq 0x2fd0
leaq -0xb0(%rbp), %rdi
callq 0x2fd0
movq -0x28(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x2ef0
jmp 0x730b
leaq -0x70(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x32f0
movss %xmm0, -0x354(%rbp)
jmp 0x7325
leaq -0xe0(%rbp), %rdi
callq 0x2fd0
movss -0x354(%rbp), %xmm0
movss %xmm0, -0xc0(%rbp)
movss -0xc0(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x3ce3(%rip), %xmm1     # 0xb038
ucomisd %xmm1, %xmm0
jbe 0x74f4
movq -0x340(%rbp), %rsi
movq %rsi, %rax
addq $0x28, %rax
movq %rax, -0x360(%rbp)
addq $0x90, %rsi
leaq -0x140(%rbp), %rdi
callq 0x2ef0
jmp 0x7389
movq -0x360(%rbp), %rsi
leaq -0x120(%rbp), %rdi
leaq -0x140(%rbp), %rdx
callq 0x3a50
jmp 0x73a5
movss -0xc0(%rbp), %xmm0
leaq -0x100(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x3760
jmp 0x73c2
leaq -0x50(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x35e0
jmp 0x73d4
leaq -0x100(%rbp), %rdi
callq 0x2fd0
leaq -0x120(%rbp), %rdi
callq 0x2fd0
leaq -0x140(%rbp), %rdi
callq 0x2fd0
jmp 0x74f4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x7a4e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x7446
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x2fd0
leaq -0xb0(%rbp), %rdi
callq 0x2fd0
jmp 0x7a4e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x7a45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x2fd0
jmp 0x7a45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x74e3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x74d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x2fd0
leaq -0x120(%rbp), %rdi
callq 0x2fd0
leaq -0x140(%rbp), %rdi
callq 0x2fd0
jmp 0x7a45
movq -0x340(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x368(%rbp)
addq $0xb0, %rsi
leaq -0x1a0(%rbp), %rdi
callq 0x2ef0
jmp 0x751b
movq -0x368(%rbp), %rsi
movq (%rsi), %rax
movq 0x50(%rax), %rax
leaq -0x180(%rbp), %rdi
leaq -0x1a0(%rbp), %rdx
callq *%rax
jmp 0x753b
leaq -0x160(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x3c50
jmp 0x7550
leaq -0x180(%rbp), %rdi
callq 0x2fd0
leaq -0x1a0(%rbp), %rdi
callq 0x2fd0
movq -0x28(%rbp), %rsi
movq %rsi, -0x370(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x2ef0
jmp 0x7581
leaq -0x160(%rbp), %rdi
leaq -0x200(%rbp), %rsi
callq 0x32f0
movss %xmm0, -0x374(%rbp)
jmp 0x759e
movq -0x370(%rbp), %rsi
movss -0x374(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
addsd %xmm0, %xmm0
cvtsd2ss %xmm0, %xmm0
movq (%rsi), %rax
movq 0x78(%rax), %rax
leaq -0x1e0(%rbp), %rdi
callq *%rax
jmp 0x75cb
leaq -0x1c0(%rbp), %rdi
leaq -0x160(%rbp), %rsi
leaq -0x1e0(%rbp), %rdx
callq 0x3480
jmp 0x75e7
leaq -0x1e0(%rbp), %rdi
callq 0x2fd0
leaq -0x200(%rbp), %rdi
callq 0x2fd0
leaq -0x228(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2ef0
jmp 0x7611
leaq -0x1c0(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0x32f0
movss %xmm0, -0x378(%rbp)
jmp 0x762e
leaq -0x228(%rbp), %rdi
callq 0x2fd0
movss -0x378(%rbp), %xmm0
movss %xmm0, -0x204(%rbp)
movss -0x204(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x78b4
movq -0x340(%rbp), %rax
movss 0x68(%rax), %xmm0
movss %xmm0, -0x380(%rbp)
movss -0x204(%rbp), %xmm0
callq 0x7a90
movss %xmm0, -0x37c(%rbp)
jmp 0x7689
movss -0x37c(%rbp), %xmm1
movss -0x380(%rbp), %xmm0
mulss %xmm1, %xmm0
callq 0x7a70
movss %xmm0, -0x384(%rbp)
jmp 0x76ac
movss -0x384(%rbp), %xmm0
movss %xmm0, -0x204(%rbp)
movss -0x204(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x3968(%rip), %xmm1     # 0xb038
ucomisd %xmm1, %xmm0
jbe 0x78b2
movq -0x340(%rbp), %rsi
movq %rsi, %rax
addq $0x48, %rax
movq %rax, -0x390(%rbp)
addq $0x90, %rsi
leaq -0x288(%rbp), %rdi
callq 0x2ef0
jmp 0x7704
movq -0x390(%rbp), %rsi
leaq -0x268(%rbp), %rdi
leaq -0x288(%rbp), %rdx
callq 0x3a50
jmp 0x7720
movss -0x204(%rbp), %xmm0
leaq -0x248(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x3760
jmp 0x773d
leaq -0x50(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x35e0
jmp 0x774f
leaq -0x248(%rbp), %rdi
callq 0x2fd0
leaq -0x268(%rbp), %rdi
callq 0x2fd0
leaq -0x288(%rbp), %rdi
callq 0x2fd0
jmp 0x78b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x77aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x2fd0
leaq -0x1a0(%rbp), %rdi
callq 0x2fd0
jmp 0x7a45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x7a39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x7804
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x2fd0
leaq -0x200(%rbp), %rdi
callq 0x2fd0
jmp 0x7a39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x7a2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x2fd0
jmp 0x7a2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x78a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x7895
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x2fd0
leaq -0x268(%rbp), %rdi
callq 0x2fd0
leaq -0x288(%rbp), %rdi
callq 0x2fd0
jmp 0x7a2d
jmp 0x78b4
movq -0x340(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x398(%rbp)
movq -0x20(%rbp), %rsi
leaq -0x330(%rbp), %rdi
leaq -0x1c0(%rbp), %rdx
callq 0x4120
jmp 0x78df
movq -0x30(%rbp), %rdx
movl 0x10(%rbp), %ecx
leaq -0x2e8(%rbp), %rdi
leaq -0x330(%rbp), %rsi
callq 0x2310
jmp 0x78fb
leaq -0x2c8(%rbp), %rdi
leaq -0x2e8(%rbp), %rsi
callq 0x3e70
jmp 0x7910
movq -0x398(%rbp), %rsi
leaq -0x2a8(%rbp), %rdi
leaq -0x2c8(%rbp), %rdx
callq 0x3a50
jmp 0x792c
movq -0x350(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x2a8(%rbp), %rdx
callq 0x3530
jmp 0x7945
leaq -0x2a8(%rbp), %rdi
callq 0x2fd0
leaq -0x2c8(%rbp), %rdi
callq 0x2fd0
leaq -0x2e8(%rbp), %rdi
callq 0x2fd0
leaq -0x330(%rbp), %rdi
callq 0x3060
leaq -0x1c0(%rbp), %rdi
callq 0x2fd0
leaq -0x160(%rbp), %rdi
callq 0x2fd0
leaq -0x70(%rbp), %rdi
callq 0x2fd0
leaq -0x50(%rbp), %rdi
callq 0x2fd0
movq -0x348(%rbp), %rax
addq $0x3a0, %rsp            # imm = 0x3A0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x7a21
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x7a15
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x7a09
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x2a8(%rbp), %rdi
callq 0x2fd0
leaq -0x2c8(%rbp), %rdi
callq 0x2fd0
leaq -0x2e8(%rbp), %rdi
callq 0x2fd0
leaq -0x330(%rbp), %rdi
callq 0x3060
leaq -0x1c0(%rbp), %rdi
callq 0x2fd0
leaq -0x160(%rbp), %rdi
callq 0x2fd0
leaq -0x70(%rbp), %rdi
callq 0x2fd0
leaq -0x50(%rbp), %rdi
callq 0x2fd0
movq -0xb8(%rbp), %rdi
callq 0x21c0
nopw %cs:(%rax,%rax)
nopl (%rax)