// File: carlos-urena[P]svg-gen/svgobjects.cpp
// Function: CamRefSys::initialize(VectorTempl3<float> const&, VectorTempl3<float> const&, VectorTempl3<float> const&)
void CamRefSys::initialize( const vec3 & look_at, const vec3 & observer, const vec3 & p_vup )
{
  constexpr real epsilon = 1e-5 ;

  assert( epsilon <= (observer-look_at).length() ) ;

  origin = observer ;
  zAxis = (observer-look_at).normalized();
  xAxis = (p_vup.cross(zAxis)).normalized();  assert( fabs(xAxis.length()-1.0) < epsilon );
  yAxis = (zAxis.cross(xAxis)).normalized() ; assert( fabs(yAxis.length()-1.0) < epsilon );

  assert( xAxis.dot(yAxis) < epsilon );
  assert( yAxis.dot(zAxis) < epsilon );
  assert( zAxis.dot(xAxis) < epsilon );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movl $0x3727c5ac, -0x24(%rbp) # imm = 0x3727C5AC
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x8d60
movss %xmm1, -0x38(%rbp)
movlpd %xmm0, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x30(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x28(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x9570
movss 0xcd35(%rip), %xmm1     # 0x17218
ucomiss %xmm1, %xmm0
jb 0xa4ea
jmp 0xa509
leaq 0xcf58(%rip), %rdi      # 0x17449
leaq 0xcf78(%rip), %rsi      # 0x17470
movl $0x68, %edx
leaq 0xcf7b(%rip), %rcx      # 0x1747f
callq 0x3100
movq -0xf8(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x8(%rcx), %edx
movl %edx, 0x8(%rax)
movq (%rcx), %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x8d60
movss %xmm1, -0x68(%rbp)
movlpd %xmm0, -0x70(%rbp)
movl -0x68(%rbp), %eax
movl %eax, -0x58(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x8ea0
movq -0xf8(%rbp), %rdi
movss %xmm1, -0x78(%rbp)
movlpd %xmm0, -0x80(%rbp)
movl -0x78(%rbp), %eax
movl %eax, -0x48(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x50(%rbp)
addq $0x24, %rdi
movq %rdi, -0x100(%rbp)
leaq -0x50(%rbp), %rsi
callq 0x13310
movq -0x100(%rbp), %rsi
movq -0x20(%rbp), %rdi
callq 0x8f70
movss %xmm1, -0xa0(%rbp)
movlpd %xmm0, -0xa8(%rbp)
movl -0xa0(%rbp), %eax
movl %eax, -0x90(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x8ea0
movq -0xf8(%rbp), %rdi
movss %xmm1, -0xb0(%rbp)
movlpd %xmm0, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x8c(%rbp)
movl -0xb0(%rbp), %eax
movl %eax, -0x84(%rbp)
addq $0xc, %rdi
leaq -0x8c(%rbp), %rsi
callq 0x13310
movq -0xf8(%rbp), %rdi
addq $0xc, %rdi
callq 0x9570
cvtss2sd %xmm0, %xmm1
movsd 0xcbb4(%rip), %xmm0     # 0x171d8
subsd %xmm0, %xmm1
movaps 0xcc11(%rip), %xmm0     # 0x17240
pand %xmm0, %xmm1
movsd 0xcb95(%rip), %xmm0     # 0x171d0
ucomisd %xmm1, %xmm0
jbe 0xa643
jmp 0xa662
leaq 0xce7a(%rip), %rdi      # 0x174c4
leaq 0xce1f(%rip), %rsi      # 0x17470
movl $0x6c, %edx
leaq 0xce22(%rip), %rcx      # 0x1747f
callq 0x3100
movq -0xf8(%rbp), %rsi
movq %rsi, %rdi
addq $0x24, %rdi
addq $0xc, %rsi
callq 0x8f70
movss %xmm1, -0xd8(%rbp)
movlpd %xmm0, -0xe0(%rbp)
movl -0xd8(%rbp), %eax
movl %eax, -0xc8(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x8ea0
movq -0xf8(%rbp), %rdi
movss %xmm1, -0xe8(%rbp)
movlpd %xmm0, -0xf0(%rbp)
movq -0xf0(%rbp), %rax
movq %rax, -0xc4(%rbp)
movl -0xe8(%rbp), %eax
movl %eax, -0xbc(%rbp)
addq $0x18, %rdi
leaq -0xc4(%rbp), %rsi
callq 0x13310
movq -0xf8(%rbp), %rdi
addq $0x18, %rdi
callq 0x9570
cvtss2sd %xmm0, %xmm1
movsd 0xcacc(%rip), %xmm0     # 0x171d8
subsd %xmm0, %xmm1
movaps 0xcb29(%rip), %xmm0     # 0x17240
pand %xmm0, %xmm1
movsd 0xcaad(%rip), %xmm0     # 0x171d0
ucomisd %xmm1, %xmm0
jbe 0xa72b
jmp 0xa74a
leaq 0xcdb5(%rip), %rdi      # 0x174e7
leaq 0xcd37(%rip), %rsi      # 0x17470
movl $0x6d, %edx
leaq 0xcd3a(%rip), %rcx      # 0x1747f
callq 0x3100
movq -0xf8(%rbp), %rsi
movq %rsi, %rdi
addq $0xc, %rdi
addq $0x18, %rsi
callq 0x95c0
movaps %xmm0, %xmm1
movss 0xcaac(%rip), %xmm0     # 0x17218
ucomiss %xmm1, %xmm0
jbe 0xa773
jmp 0xa792
leaq 0xcd90(%rip), %rdi      # 0x1750a
leaq 0xccef(%rip), %rsi      # 0x17470
movl $0x6f, %edx
leaq 0xccf2(%rip), %rcx      # 0x1747f
callq 0x3100
movq -0xf8(%rbp), %rsi
movq %rsi, %rdi
addq $0x18, %rdi
addq $0x24, %rsi
callq 0x95c0
movaps %xmm0, %xmm1
movss 0xca64(%rip), %xmm0     # 0x17218
ucomiss %xmm1, %xmm0
jbe 0xa7bb
jmp 0xa7da
leaq 0xcd63(%rip), %rdi      # 0x17525
leaq 0xcca7(%rip), %rsi      # 0x17470
movl $0x70, %edx
leaq 0xccaa(%rip), %rcx      # 0x1747f
callq 0x3100
movq -0xf8(%rbp), %rsi
movq %rsi, %rdi
addq $0x24, %rdi
addq $0xc, %rsi
callq 0x95c0
movaps %xmm0, %xmm1
movss 0xca1c(%rip), %xmm0     # 0x17218
ucomiss %xmm1, %xmm0
jbe 0xa803
jmp 0xa822
leaq 0xcd36(%rip), %rdi      # 0x17540
leaq 0xcc5f(%rip), %rsi      # 0x17470
movl $0x71, %edx
leaq 0xcc62(%rip), %rcx      # 0x1747f
callq 0x3100
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopl (%rax,%rax)