// File: /workspace/github_cpp_makefile_star2_O2/XuhuiSun95[P]My-OpenGL/myGL.cpp
// Function: myLookAt(double, double, double, double, double, double, double, double, double)
void myLookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ){
    double fx, fy, fz;
    double rlf, rls;
    double sx, sy, sz;
    double ux, uy, uz;
    fx = centerX - eyeX;
    fy = centerY - eyeY;
    fz = centerZ - eyeZ;
    
    rlf = 1.0f / sqrt(fx * fx + fy * fy + fz * fz);
    fx *= rlf;
    fy *= rlf;
    fz *= rlf;
    
    sx = fy * upZ - fz * upY;
    sy = fz * upX - fx * upZ;
    sz = fx * upY - fy * upX;
    
    rls = 1.0f / sqrt(sx * sx + sy * sy + sz * sz);
    sx *= rls;
    sy *= rls;
    sz *= rls;
    
    ux = sy * fz - sz * fy;
    uy = sz * fx - sx * fz;
    uz = sx * fy - sy * fx;
    
    double matrix[4][4], omatrix[4][4];
    matrix[0][0] = sx; matrix[0][1] = sy; matrix[0][2] = sz; matrix[0][3] = 0;
    matrix[1][0] = ux; matrix[1][1] = uy; matrix[1][2] = uz; matrix[1][3] = 0;
    matrix[2][0] = -fx; matrix[2][1] = -fy; matrix[2][2] = -fz; matrix[2][3] = 0;
    matrix[3][0] = 0; matrix[3][1] = 0; matrix[3][2] = 0; matrix[3][3] = 1;
    multiMatrix(modelMatrix, matrix, omatrix);
    for(int i = 0; i < 4; i ++){
        for(int j = 0; j < 4; j ++)
            modelMatrix[i][j] = omatrix[i][j];
    }
    myTranslated(-eyeX, -eyeY, -eyeZ);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x130, %rsp            # imm = 0x130
movsd 0x10(%rbp), %xmm9
movapd %xmm0, -0x20(%rbp)
subsd %xmm0, %xmm3
movapd %xmm1, -0x30(%rbp)
subsd %xmm1, %xmm4
movapd %xmm2, -0x40(%rbp)
subsd %xmm2, %xmm5
movapd %xmm4, %xmm0
mulsd %xmm4, %xmm0
movapd %xmm3, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm0, %xmm1
movapd %xmm5, %xmm0
mulsd %xmm5, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm1
movsd 0x2c09(%rip), %xmm2     # 0x6030
movapd %xmm2, %xmm0
divsd %xmm1, %xmm0
mulsd %xmm0, %xmm3
mulsd %xmm0, %xmm4
mulsd %xmm5, %xmm0
movapd 0x2f0c(%rip), %xmm10    # 0x6350
movapd %xmm0, %xmm1
xorpd %xmm10, %xmm1
movapd %xmm0, %xmm8
mulsd %xmm7, %xmm8
movapd %xmm4, %xmm5
mulsd %xmm9, %xmm5
subsd %xmm8, %xmm5
mulsd %xmm3, %xmm9
movapd %xmm0, %xmm8
mulsd %xmm6, %xmm8
subsd %xmm9, %xmm8
mulsd %xmm4, %xmm6
mulsd %xmm3, %xmm7
subsd %xmm6, %xmm7
movapd %xmm8, %xmm6
mulsd %xmm8, %xmm6
movapd %xmm5, %xmm9
mulsd %xmm5, %xmm9
addsd %xmm6, %xmm9
movapd %xmm7, %xmm6
mulsd %xmm7, %xmm6
addsd %xmm9, %xmm6
sqrtsd %xmm6, %xmm6
divsd %xmm6, %xmm2
mulsd %xmm2, %xmm5
mulsd %xmm2, %xmm8
mulsd %xmm7, %xmm2
movapd %xmm3, %xmm6
mulsd %xmm8, %xmm6
leaq -0x140(%rbp), %rsi
movsd %xmm5, (%rsi)
movsd %xmm8, 0x8(%rsi)
mulsd %xmm0, %xmm8
mulsd %xmm5, %xmm0
movapd %xmm2, %xmm7
mulsd %xmm3, %xmm7
mulsd %xmm4, %xmm5
unpcklpd %xmm4, %xmm3            # xmm3 = xmm3[0],xmm4[0]
mulsd %xmm2, %xmm4
subsd %xmm4, %xmm8
movsd %xmm2, 0x10(%rsi)
andq $0x0, 0x18(%rsi)
subsd %xmm0, %xmm7
subsd %xmm6, %xmm5
movsd %xmm8, 0x20(%rsi)
movsd %xmm7, 0x28(%rsi)
movsd %xmm5, 0x30(%rsi)
andq $0x0, 0x38(%rsi)
xorpd %xmm10, %xmm3
movapd %xmm3, 0x40(%rsi)
movlpd %xmm1, 0x50(%rsi)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x58(%rsi)
movupd %xmm0, 0x68(%rsi)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x78(%rsi)
leaq 0x5c0b(%rip), %rbx      # 0x9160
leaq -0xc0(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rdx
callq 0x490c
xorl %eax, %eax
cmpq $0x4, %rax
je 0x3594
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0x3587
movsd (%r14,%rcx,8), %xmm0
movsd %xmm0, (%rbx,%rcx,8)
incq %rcx
jmp 0x3571
incq %rax
addq $0x20, %r14
addq $0x20, %rbx
jmp 0x3569
movaps -0x20(%rbp), %xmm0
movaps 0x2db1(%rip), %xmm3     # 0x6350
xorps %xmm3, %xmm0
movaps -0x30(%rbp), %xmm1
xorps %xmm3, %xmm1
movaps -0x40(%rbp), %xmm2
xorps %xmm3, %xmm2
callq 0x35c1
addq $0x130, %rsp            # imm = 0x130
popq %rbx
popq %r14
popq %rbp
retq