// File: /workspace/github_cpp_makefile_star2_O3/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 $0x2a8, %rsp            # imm = 0x2A8
movq %r9, 0x60(%rsp)
movq %r8, (%rsp)
movq %rcx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x5fa6(%rip), %r13      # 0xb848
movq %r13, 0x88(%rsp)
movslq 0x10(%rsi), %r12
movl %r12d, 0x90(%rsp)
testq %r12, %r12
jle 0x58d4
leaq 0x14(%r14), %rsi
leaq 0x94(%rsp), %rdi
leaq (,%r12,4), %rdx
callq 0x20a0
movslq 0x8(%r15), %rbp
testq %rbp, %rbp
jle 0x58f6
leaq 0xc(%r15), %rsi
leaq (,%rbp,4), %rdx
leaq 0x1f4(%rsp), %rdi
callq 0x20a0
movq %r15, 0x38(%rsp)
movq %r13, 0x40(%rsp)
movslq 0x78(%r14), %r15
movl %r15d, 0x48(%rsp)
testq %r15, %r15
jle 0x5924
leaq 0x7c(%r14), %rsi
leaq 0x4c(%rsp), %rdi
leaq (,%r15,4), %rdx
callq 0x20a0
testl %ebp, %ebp
movq %r15, 0x8(%rsp)
jle 0x598c
leaq (,%rbp,4), %r13
leaq 0x24(%rsp), %r15
leaq 0x1f4(%rsp), %rsi
movq %r15, %rdi
movq %r13, %rdx
callq 0x20a0
xorl %eax, %eax
movaps 0x26ea(%rip), %xmm0     # 0x8040
movss 0x24(%rsp,%rax,4), %xmm1
xorps %xmm0, %xmm1
movss %xmm1, 0x24(%rsp,%rax,4)
incq %rax
cmpq %rax, %rbp
jne 0x5956
leaq 0xb4(%rsp), %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x20a0
leaq 0x5ec1(%rip), %r13      # 0xb848
movq 0x8(%rsp), %r15
cmpl %ebp, %r15d
jne 0x615c
testl %r15d, %r15d
jle 0x59f4
leaq 0x4c(%rsp), %rsi
xorl %eax, %eax
movss 0xb4(%rsp,%rax,4), %xmm0
addss 0x4c(%rsp,%rax,4), %xmm0
movss %xmm0, 0x4c(%rsp,%rax,4)
incq %rax
cmpq %rax, %rbp
jne 0x59a1
leaq 0x74(%rsp), %rdi
movq %r13, -0xc(%rdi)
movl %ebp, -0x4(%rdi)
leaq (,%rbp,4), %rdx
callq 0x20a0
xorps %xmm0, %xmm0
xorl %eax, %eax
movss 0x74(%rsp,%rax,4), %xmm1
mulss %xmm1, %xmm1
addss %xmm1, %xmm0
incq %rax
cmpq %rax, %rbp
jne 0x59dc
jmp 0x5a00
movq %r13, 0x68(%rsp)
movl %ebp, 0x70(%rsp)
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0x5a0e
sqrtss %xmm0, %xmm0
jmp 0x5a13
callq 0x21c0
movq (%rsp), %rcx
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
ucomisd 0x264a(%rip), %xmm1     # 0x8070
jbe 0x617b
testl %r15d, %r15d
jle 0x5a57
movss 0x261f(%rip), %xmm1     # 0x8058
divss %xmm0, %xmm1
xorl %eax, %eax
movss 0x74(%rsp,%rax,4), %xmm0
mulss %xmm1, %xmm0
movss %xmm0, 0x74(%rsp,%rax,4)
incq %rax
cmpq %rax, %rbp
jne 0x5a3f
movq %r13, 0x1d0(%rsp)
movslq 0x8(%rcx), %r15
movl %r15d, 0x1d8(%rsp)
testq %r15, %r15
jle 0x5a89
leaq 0xc(%rcx), %rsi
leaq 0x1dc(%rsp), %rdi
leaq (,%r15,4), %rdx
callq 0x20a0
cmpl %r15d, %ebp
jne 0x619a
cmpl $0x0, 0x8(%rsp)
jle 0x5abb
xorps %xmm1, %xmm1
xorl %eax, %eax
movss 0x74(%rsp,%rax,4), %xmm0
mulss 0x1dc(%rsp,%rax,4), %xmm0
addss %xmm0, %xmm1
incq %rax
cmpq %rax, %rbp
jne 0x5a9e
jmp 0x5abe
xorps %xmm1, %xmm1
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
ucomisd 0x25a3(%rip), %xmm0     # 0x8070
jbe 0x5bc2
movq %r13, 0x190(%rsp)
movslq 0x98(%r14), %r15
movl %r15d, 0x198(%rsp)
testq %r15, %r15
movss %xmm1, 0x14(%rsp)
jle 0x5b11
leaq 0x9c(%r14), %rsi
leaq 0x19c(%rsp), %rdi
leaq (,%r15,4), %rdx
callq 0x20a0
movl 0x30(%r14), %eax
leal -0x1(%rax), %ecx
cmpl $0x4, %ecx
jae 0x61b9
cmpl %r15d, %eax
jne 0x61d8
leaq 0x24(%rsp), %rsi
xorl %eax, %eax
movss 0x34(%r14,%rax,4), %xmm0
mulss 0x19c(%rsp,%rax,4), %xmm0
movss %xmm0, 0x24(%rsp,%rax,4)
incq %rax
cmpq %rax, %r15
jne 0x5b31
testl %r15d, %r15d
jle 0x5b8f
leaq 0x1bc(%rsp), %rdi
leaq (,%r15,4), %rdx
callq 0x20a0
movss 0x14(%rsp), %xmm1
xorl %eax, %eax
movss 0x1bc(%rsp,%rax,4), %xmm0
mulss %xmm1, %xmm0
movss %xmm0, 0x1bc(%rsp,%rax,4)
incq %rax
cmpq %rax, %r15
jne 0x5b71
cmpl %r15d, %r12d
jne 0x615c
testl %r12d, %r12d
jle 0x5bc2
xorl %eax, %eax
movss 0x1bc(%rsp,%rax,4), %xmm0
addss 0x94(%rsp,%rax,4), %xmm0
movss %xmm0, 0x94(%rsp,%rax,4)
incq %rax
cmpq %rax, %r12
jne 0x5b9f
movq %r13, 0x170(%rsp)
movslq 0xb8(%r14), %rdx
movl %edx, 0x178(%rsp)
testq %rdx, %rdx
jle 0x5bf5
leaq 0xbc(%r14), %rsi
leaq 0x17c(%rsp), %rdi
shlq $0x2, %rdx
callq 0x20a0
movq 0x38(%rsp), %rsi
movq (%rsi), %rax
leaq 0x18(%rsp), %r15
leaq 0x170(%rsp), %rdx
movq %r15, %rdi
callq *0x50(%rax)
movslq 0x8(%r15), %r15
xorps %xmm2, %xmm2
xorps %xmm0, %xmm0
testq %r15, %r15
jle 0x5c54
leaq 0x24(%rsp), %rsi
leaq 0x4c(%rsp), %rdi
leaq (,%r15,4), %rdx
callq 0x20a0
xorps %xmm2, %xmm2
xorps %xmm0, %xmm0
xorl %eax, %eax
movss 0x4c(%rsp,%rax,4), %xmm1
mulss %xmm1, %xmm1
addss %xmm1, %xmm0
incq %rax
cmpq %rax, %r15
jne 0x5c3e
ucomiss %xmm2, %xmm0
jb 0x5c5f
sqrtss %xmm0, %xmm0
jmp 0x5c64
callq 0x21c0
movq (%rsp), %rsi
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
ucomisd 0x23f9(%rip), %xmm1     # 0x8070
jbe 0x617b
testl %r15d, %r15d
jle 0x5ca8
movss 0x23ce(%rip), %xmm1     # 0x8058
divss %xmm0, %xmm1
xorl %eax, %eax
movss 0x4c(%rsp,%rax,4), %xmm0
mulss %xmm1, %xmm0
movss %xmm0, 0x4c(%rsp,%rax,4)
incq %rax
cmpq %rax, %r15
jne 0x5c90
movslq 0x8(%rsi), %r13
testq %r13, %r13
jle 0x5cce
addq $0xc, %rsi
leaq 0x294(%rsp), %rdi
leaq (,%r13,4), %rdx
callq 0x20a0
movq (%rsp), %rsi
cmpl %r13d, %r15d
jne 0x619a
testl %r15d, %r15d
jle 0x5d2d
xorps %xmm0, %xmm0
leaq 0x4c(%rsp), %r13
xorl %eax, %eax
movss 0x4c(%rsp,%rax,4), %xmm1
mulss 0x294(%rsp,%rax,4), %xmm1
addss %xmm1, %xmm0
incq %rax
cmpq %rax, %r15
jne 0x5ce6
addss %xmm0, %xmm0
movq (%rsi), %rax
leaq 0x150(%rsp), %rdi
callq *0x78(%rax)
leaq 0xd4(%rsp), %rdi
leaq (,%r15,4), %rdx
movq %r13, %rsi
callq 0x20a0
jmp 0x5d3e
movq (%rsi), %rax
leaq 0x150(%rsp), %rdi
xorps %xmm0, %xmm0
callq *0x78(%rax)
movslq 0x158(%rsp), %r13
testq %r13, %r13
jle 0x5d9f
leaq 0x15c(%rsp), %rsi
leaq (,%r13,4), %rdx
leaq 0x24(%rsp), %rdi
movq %rdx, (%rsp)
callq 0x20a0
xorl %eax, %eax
movaps 0x22ce(%rip), %xmm0     # 0x8040
movss 0x24(%rsp,%rax,4), %xmm1
xorps %xmm0, %xmm1
movss %xmm1, 0x24(%rsp,%rax,4)
incq %rax
cmpq %rax, %r13
jne 0x5d72
leaq 0xb4(%rsp), %rdi
leaq 0x24(%rsp), %rsi
movq (%rsp), %rdx
callq 0x20a0
cmpl %r13d, %r15d
jne 0x615c
testl %r15d, %r15d
leaq 0x5a96(%rip), %r13      # 0xb848
jle 0x5dd9
xorl %eax, %eax
movss 0xb4(%rsp,%rax,4), %xmm0
addss 0xd4(%rsp,%rax,4), %xmm0
movss %xmm0, 0xd4(%rsp,%rax,4)
incq %rax
cmpq %rax, %r15
jne 0x5db6
cmpl $0x0, 0x8(%rsp)
jle 0x5dfa
leaq 0x74(%rsp), %rsi
leaq 0x274(%rsp), %rdi
leaq (,%rbp,4), %rdx
callq 0x20a0
cmpl %ebp, %r15d
jne 0x619a
testl %r15d, %r15d
jle 0x5f4e
xorps %xmm0, %xmm0
xorl %eax, %eax
movss 0xd4(%rsp,%rax,4), %xmm1
mulss 0x274(%rsp,%rax,4), %xmm1
addss %xmm1, %xmm0
incq %rax
cmpq %rax, %rbp
jne 0x5e11
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x5f4e
movss 0x68(%r14), %xmm1
movss %xmm1, (%rsp)
callq 0x21d0
mulss (%rsp), %xmm0
callq 0x2170
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
ucomisd 0x220c(%rip), %xmm1     # 0x8070
jbe 0x5f4e
movslq 0x98(%r14), %r13
testq %r13, %r13
movss %xmm0, (%rsp)
jle 0x5e97
leaq 0x9c(%r14), %rsi
leaq 0x254(%rsp), %rdi
leaq (,%r13,4), %rdx
callq 0x20a0
movl 0x50(%r14), %eax
leal -0x1(%rax), %ecx
cmpl $0x4, %ecx
jae 0x61b9
cmpl %r13d, %eax
jne 0x61d8
leaq 0x24(%rsp), %rsi
xorl %eax, %eax
movss 0x54(%r14,%rax,4), %xmm1
mulss 0x254(%rsp,%rax,4), %xmm1
movss %xmm1, 0x24(%rsp,%rax,4)
incq %rax
cmpq %rax, %r13
jne 0x5eb7
testl %r13d, %r13d
jle 0x5f14
leaq 0x13c(%rsp), %rdi
leaq (,%r13,4), %rdx
callq 0x20a0
movss (%rsp), %xmm1
xorl %eax, %eax
movss 0x13c(%rsp,%rax,4), %xmm0
mulss %xmm1, %xmm0
movss %xmm0, 0x13c(%rsp,%rax,4)
incq %rax
cmpq %rax, %r13
jne 0x5ef6
cmpl %r13d, %r12d
jne 0x615c
testl %r12d, %r12d
leaq 0x5921(%rip), %r13      # 0xb848
jle 0x5f4e
xorl %eax, %eax
movss 0x13c(%rsp,%rax,4), %xmm0
addss 0x94(%rsp,%rax,4), %xmm0
movss %xmm0, 0x94(%rsp,%rax,4)
incq %rax
cmpq %rax, %r12
jne 0x5f2b
leaq 0x5bd3(%rip), %rax      # 0xbb28
addq $0x10, %rax
movq %rax, 0xe8(%rsp)
movq %r13, 0xf0(%rsp)
movq 0x38(%rsp), %rsi
movslq 0x8(%rsi), %rdx
movl %edx, 0xf8(%rsp)
testq %rdx, %rdx
jle 0x5f93
addq $0xc, %rsi
leaq 0xfc(%rsp), %rdi
shlq $0x2, %rdx
callq 0x20a0
movq %r13, 0x110(%rsp)
movl %ebp, 0x118(%rsp)
xorps %xmm2, %xmm2
xorps %xmm0, %xmm0
testl %r15d, %r15d
jle 0x5feb
leaq 0xd4(%rsp), %rsi
leaq 0x11c(%rsp), %rdi
leaq (,%rbp,4), %rdx
callq 0x20a0
xorps %xmm2, %xmm2
xorps %xmm0, %xmm0
xorl %eax, %eax
movss 0x11c(%rsp,%rax,4), %xmm1
mulss %xmm1, %xmm1
addss %xmm1, %xmm0
incq %rax
cmpq %rax, %rbp
jne 0x5fd2
ucomiss %xmm2, %xmm0
jb 0x5ff6
sqrtss %xmm0, %xmm0
jmp 0x5ffb
callq 0x21c0
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
ucomisd 0x2066(%rip), %xmm1     # 0x8070
jbe 0x617b
movl 0x2e0(%rsp), %ecx
testl %ebp, %ebp
movss 0x2037(%rip), %xmm1     # 0x8058
jle 0x6047
divss %xmm0, %xmm1
xorl %eax, %eax
movss 0x11c(%rsp,%rax,4), %xmm0
mulss %xmm1, %xmm0
movss %xmm0, 0x11c(%rsp,%rax,4)
incq %rax
cmpq %rax, %rbp
jne 0x6029
leaq 0xa8(%rsp), %r15
leaq 0xe8(%rsp), %rsi
movq %r15, %rdi
movq 0x60(%rsp), %rdx
callq 0x233c
movl 0x8(%r15), %r13d
leal -0x2(%r13), %eax
cmpl $0x4, %eax
jae 0x61b9
leal -0x1(%r13), %ebp
leaq 0xb4(%rsp), %rsi
leaq 0x214(%rsp), %rdi
leaq (,%rbp,4), %r15
movq %r15, %rdx
callq 0x20a0
movl 0x50(%r14), %eax
leal -0x1(%rax), %ecx
cmpl $0x4, %ecx
jae 0x61b9
cmpl %ebp, %eax
jne 0x61d8
leaq 0x234(%rsp), %rsi
xorl %eax, %eax
movss 0x54(%r14,%rax,4), %xmm0
mulss 0x214(%rsp,%rax,4), %xmm0
movss %xmm0, 0x234(%rsp,%rax,4)
incq %rax
cmpq %rax, %rbp
jne 0x60bb
leaq 0x5765(%rip), %rax      # 0xb848
movq %rax, (%rbx)
movl %r12d, 0x8(%rbx)
testl %r12d, %r12d
jle 0x610e
movq %rsi, %r14
leaq 0x94(%rsp), %rsi
leaq 0xc(%rbx), %rdi
leaq (,%r12,4), %rdx
callq 0x20a0
movq %r14, %rsi
cmpl $0x2, %r13d
jl 0x6121
leaq 0x24(%rsp), %rdi
movq %r15, %rdx
callq 0x20a0
cmpl %ebp, %r12d
jne 0x615c
testl %r12d, %r12d
jle 0x6147
xorl %eax, %eax
movss 0x24(%rsp,%rax,4), %xmm0
addss 0xc(%rbx,%rax,4), %xmm0
movss %xmm0, 0xc(%rbx,%rax,4)
incq %rax
cmpq %rax, %r12
jne 0x612d
movq %rbx, %rax
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1f6d(%rip), %rdi      # 0x80d0
leaq 0x1f3c(%rip), %rsi      # 0x80a6
leaq 0x1f90(%rip), %rcx      # 0x8101
movl $0x66, %edx
callq 0x2080
leaq 0x2059(%rip), %rdi      # 0x81db
leaq 0x1f1d(%rip), %rsi      # 0x80a6
leaq 0x2054(%rip), %rcx      # 0x81e4
movl $0xc9, %edx
callq 0x2080
leaq 0x1f2f(%rip), %rdi      # 0x80d0
leaq 0x1efe(%rip), %rsi      # 0x80a6
leaq 0x1f2c(%rip), %rcx      # 0x80db
movl $0x4f, %edx
callq 0x2080
leaq 0x1fd0(%rip), %rdi      # 0x8190
leaq 0x1edf(%rip), %rsi      # 0x80a6
leaq 0x1fd6(%rip), %rcx      # 0x81a4
movl $0x1a, %edx
callq 0x2080
leaq 0x1ef1(%rip), %rdi      # 0x80d0
leaq 0x1ec0(%rip), %rsi      # 0x80a6
leaq 0x1fc9(%rip), %rcx      # 0x81b6
movl $0xb2, %edx
callq 0x2080
nop