// File: /workspace/github_cpp_makefile_star2_O3/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, %xmm0
movsd 0x390e(%rip), %xmm1     # 0x7030
movapd %xmm1, %xmm2
divsd %xmm0, %xmm2
mulsd %xmm2, %xmm3
mulsd %xmm2, %xmm4
mulsd %xmm5, %xmm2
movapd 0x3c11(%rip), %xmm10    # 0x7350
movapd %xmm2, %xmm0
xorpd %xmm10, %xmm0
movapd %xmm2, %xmm8
mulsd %xmm7, %xmm8
movapd %xmm4, %xmm5
mulsd %xmm9, %xmm5
subsd %xmm8, %xmm5
mulsd %xmm3, %xmm9
movapd %xmm2, %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, %xmm1
mulsd %xmm1, %xmm5
mulsd %xmm1, %xmm8
mulsd %xmm7, %xmm1
movapd %xmm3, %xmm6
mulsd %xmm8, %xmm6
leaq -0x140(%rbp), %rsi
movsd %xmm5, (%rsi)
movsd %xmm8, 0x8(%rsi)
mulsd %xmm2, %xmm8
mulsd %xmm5, %xmm2
movapd %xmm1, %xmm7
mulsd %xmm3, %xmm7
mulsd %xmm4, %xmm5
unpcklpd %xmm4, %xmm3            # xmm3 = xmm3[0],xmm4[0]
mulsd %xmm1, %xmm4
subsd %xmm4, %xmm8
subsd %xmm2, %xmm7
subsd %xmm6, %xmm5
movsd %xmm1, 0x10(%rsi)
xorl %r14d, %r14d
movq %r14, 0x18(%rsi)
movsd %xmm8, 0x20(%rsi)
movsd %xmm7, 0x28(%rsi)
movsd %xmm5, 0x30(%rsi)
movq %r14, 0x38(%rsi)
xorpd %xmm10, %xmm3
movapd %xmm3, 0x40(%rsi)
movlpd %xmm0, 0x50(%rsi)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x58(%rsi)
movupd %xmm0, 0x68(%rsi)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x78(%rsi)
leaq 0x690f(%rip), %rbx      # 0xa160
leaq -0xc0(%rbp), %rdx
movq %rbx, %rdi
callq 0x4bd0
movapd -0xc0(%rbp,%r14), %xmm0
movapd -0xb0(%rbp,%r14), %xmm1
movapd %xmm1, 0x10(%rbx,%r14)
movapd %xmm0, (%rbx,%r14)
addq $0x20, %r14
cmpq $0x80, %r14
jne 0x3860
movaps -0x20(%rbp), %xmm0
movaps 0x3ab7(%rip), %xmm3     # 0x7350
xorps %xmm3, %xmm0
movaps -0x30(%rbp), %xmm1
xorps %xmm3, %xmm1
movaps -0x40(%rbp), %xmm2
xorps %xmm3, %xmm2
callq 0x38bb
addq $0x130, %rsp            # imm = 0x130
popq %rbx
popq %r14
popq %rbp
retq