// File: /workspace/github_cpp_makefile_star2_O1/SpiritLooper[P]RDV_OBJRender/camera.cpp
// Function: Camera::lookat()
Matrix Camera::lookat() {
    Vec3f z = (eye-center).normalize();
    Vec3f x = (up^z).normalize();
    Vec3f y = (z^x).normalize();
    Matrix res = Matrix::identity(4);
    for (int i=0; i<3; i++) {
        res[0][i] = x[i];
        res[1][i] = y[i];
        res[2][i] = z[i];
        res[i][3] = -center[i];
    }
    return res;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %rbx
movss (%rsi), %xmm4
movss 0x4(%rsi), %xmm5
subss 0xc(%rsi), %xmm4
subss 0x10(%rsi), %xmm5
movss 0x8(%rsi), %xmm2
subss 0x14(%rsi), %xmm2
movq %rdi, %r14
movaps %xmm5, %xmm0
mulss %xmm5, %xmm0
movaps %xmm4, %xmm1
mulss %xmm4, %xmm1
addss %xmm0, %xmm1
movaps %xmm2, %xmm0
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
xorps %xmm7, %xmm7
ucomiss %xmm7, %xmm0
jb 0x357e
sqrtss %xmm0, %xmm0
jmp 0x35a2
movaps %xmm2, (%rsp)
movaps %xmm4, 0x50(%rsp)
movaps %xmm5, 0x40(%rsp)
callq 0x22f0
movaps 0x40(%rsp), %xmm5
movaps 0x50(%rsp), %xmm4
xorps %xmm7, %xmm7
movaps (%rsp), %xmm2
movss 0x3a5a(%rip), %xmm3     # 0x7004
movaps %xmm3, %xmm1
divss %xmm0, %xmm1
mulss %xmm1, %xmm4
mulss %xmm1, %xmm5
unpcklps %xmm5, %xmm4            # xmm4 = xmm4[0],xmm5[0],xmm4[1],xmm5[1]
mulss %xmm1, %xmm2
movlps %xmm4, 0x30(%rsp)
movss %xmm2, 0x38(%rsp)
movss 0x18(%rbx), %xmm5
movss 0x1c(%rbx), %xmm8
movss 0x20(%rbx), %xmm9
movss 0x30(%rsp), %xmm4
movss 0x34(%rsp), %xmm6
movaps %xmm6, %xmm0
mulss %xmm9, %xmm0
movaps %xmm4, %xmm1
mulss %xmm8, %xmm1
mulss %xmm2, %xmm8
subss %xmm0, %xmm8
movaps %xmm2, %xmm0
mulss %xmm5, %xmm0
mulss %xmm4, %xmm9
subss %xmm0, %xmm9
mulss %xmm6, %xmm5
subss %xmm1, %xmm5
movaps %xmm9, %xmm0
mulss %xmm9, %xmm0
movaps %xmm8, %xmm1
mulss %xmm8, %xmm1
addss %xmm0, %xmm1
movaps %xmm5, %xmm0
mulss %xmm5, %xmm0
addss %xmm1, %xmm0
ucomiss %xmm7, %xmm0
jb 0x3647
sqrtss %xmm0, %xmm0
jmp 0x369e
movaps %xmm2, (%rsp)
movss %xmm4, 0x50(%rsp)
movss %xmm5, 0x40(%rsp)
movss %xmm6, 0x1c(%rsp)
movaps %xmm8, 0x80(%rsp)
movaps %xmm9, 0x70(%rsp)
callq 0x22f0
movaps 0x70(%rsp), %xmm9
movaps 0x80(%rsp), %xmm8
movss 0x1c(%rsp), %xmm6
movss 0x40(%rsp), %xmm5
movss 0x50(%rsp), %xmm4
movss 0x396a(%rip), %xmm3     # 0x7004
movaps (%rsp), %xmm2
movaps %xmm3, %xmm1
divss %xmm0, %xmm1
mulss %xmm1, %xmm8
mulss %xmm1, %xmm9
unpcklps %xmm9, %xmm8            # xmm8 = xmm8[0],xmm9[0],xmm8[1],xmm9[1]
mulss %xmm1, %xmm5
movlps %xmm8, 0x20(%rsp)
movss %xmm5, 0x28(%rsp)
movss 0x20(%rsp), %xmm0
movss 0x24(%rsp), %xmm1
movaps %xmm6, %xmm7
mulss %xmm5, %xmm7
mulss %xmm4, %xmm5
mulss %xmm1, %xmm4
mulss %xmm2, %xmm1
subss %xmm1, %xmm7
mulss %xmm0, %xmm2
subss %xmm5, %xmm2
mulss %xmm6, %xmm0
subss %xmm0, %xmm4
movaps %xmm2, %xmm0
mulss %xmm2, %xmm0
movaps %xmm7, %xmm1
mulss %xmm7, %xmm1
addss %xmm0, %xmm1
movaps %xmm4, %xmm0
mulss %xmm4, %xmm0
addss %xmm1, %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0x3721
sqrtss %xmm0, %xmm0
jmp 0x374c
movaps %xmm2, (%rsp)
movss %xmm4, 0x50(%rsp)
movaps %xmm7, 0x40(%rsp)
callq 0x22f0
movaps 0x40(%rsp), %xmm7
movss 0x50(%rsp), %xmm4
movss 0x38bc(%rip), %xmm3     # 0x7004
movaps (%rsp), %xmm2
divss %xmm0, %xmm3
mulss %xmm3, %xmm7
mulss %xmm3, %xmm2
unpcklps %xmm2, %xmm7            # xmm7 = xmm7[0],xmm2[0],xmm7[1],xmm2[1]
mulss %xmm4, %xmm3
movlps %xmm7, 0x60(%rsp)
movss %xmm3, 0x68(%rsp)
movq %r14, %rdi
movl $0x4, %esi
callq 0x267c
xorl %r15d, %r15d
xorl %eax, %eax
cmpq $0x1, %r15
setne %al
testq %r15, %r15
leaq 0x4(,%rax,4), %r12
cmoveq %r15, %r12
movss 0x20(%rsp,%r12), %xmm0
movss %xmm0, (%rsp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x26fe
movq (%rax), %rax
movss (%rsp), %xmm0
movss %xmm0, (%rax,%r15,4)
movss 0x60(%rsp,%r12), %xmm0
movss %xmm0, (%rsp)
movq %r14, %rdi
movl $0x1, %esi
callq 0x26fe
movq (%rax), %rax
movss (%rsp), %xmm0
movss %xmm0, (%rax,%r15,4)
movss 0x30(%rsp,%r12), %xmm0
movss %xmm0, (%rsp)
movq %r14, %rdi
movl $0x2, %esi
callq 0x26fe
movq (%rax), %rax
movss (%rsp), %xmm0
movss %xmm0, (%rax,%r15,4)
movss 0xc(%rbx,%r12), %xmm0
movaps %xmm0, (%rsp)
movq %r14, %rdi
movl %r15d, %esi
callq 0x26fe
movaps (%rsp), %xmm0
xorps 0x38eb(%rip), %xmm0     # 0x7110
movq (%rax), %rax
movss %xmm0, 0xc(%rax)
incq %r15
cmpq $0x3, %r15
jne 0x377a
movq %r14, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x2e46
movq %rbx, %rdi
callq 0x22d0
nop