// File: /workspace/github_cpp_makefile_star2_O1/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 $0x1c0, %rsp            # imm = 0x1C0
movsd 0x10(%rbp), %xmm12
movapd %xmm0, -0xb0(%rbp)
subsd %xmm0, %xmm3
movapd %xmm1, -0xc0(%rbp)
subsd %xmm1, %xmm4
movapd %xmm2, -0xd0(%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
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
jb 0x36ff
sqrtsd %xmm0, %xmm0
jmp 0x3740
movapd %xmm3, -0x60(%rbp)
movapd %xmm5, -0x50(%rbp)
movapd %xmm4, -0x40(%rbp)
movsd %xmm7, -0x18(%rbp)
movsd %xmm6, -0x30(%rbp)
callq 0x10d0
movsd 0x10(%rbp), %xmm12
xorpd %xmm2, %xmm2
movsd -0x30(%rbp), %xmm6
movsd -0x18(%rbp), %xmm7
movapd -0x40(%rbp), %xmm4
movapd -0x50(%rbp), %xmm5
movapd -0x60(%rbp), %xmm3
movsd 0x38e7(%rip), %xmm8     # 0x7030
movapd %xmm8, %xmm1
divsd %xmm0, %xmm1
mulsd %xmm1, %xmm3
mulsd %xmm1, %xmm4
mulsd %xmm1, %xmm5
movapd 0x3bea(%rip), %xmm1     # 0x7350
movapd %xmm5, %xmm10
xorpd %xmm1, %xmm10
movapd %xmm5, %xmm0
mulsd %xmm7, %xmm0
movapd %xmm4, %xmm11
mulsd %xmm12, %xmm11
subsd %xmm0, %xmm11
movapd %xmm3, %xmm9
xorpd %xmm1, %xmm9
mulsd %xmm3, %xmm12
movapd %xmm5, %xmm13
mulsd %xmm6, %xmm13
subsd %xmm12, %xmm13
movapd %xmm4, %xmm12
xorpd %xmm1, %xmm12
mulsd %xmm4, %xmm6
mulsd %xmm3, %xmm7
subsd %xmm6, %xmm7
movapd %xmm13, %xmm0
mulsd %xmm13, %xmm0
movapd %xmm11, %xmm1
mulsd %xmm11, %xmm1
addsd %xmm0, %xmm1
movapd %xmm7, %xmm0
mulsd %xmm7, %xmm0
addsd %xmm1, %xmm0
ucomisd %xmm2, %xmm0
jb 0x37eb
sqrtsd %xmm0, %xmm0
jmp 0x3869
movapd %xmm3, -0x60(%rbp)
movapd %xmm5, -0x50(%rbp)
movapd %xmm4, -0x40(%rbp)
movsd %xmm7, -0x18(%rbp)
movapd %xmm10, -0x30(%rbp)
movapd %xmm9, -0xa0(%rbp)
movapd %xmm11, -0x90(%rbp)
movapd %xmm12, -0x80(%rbp)
movapd %xmm13, -0x70(%rbp)
callq 0x10d0
movapd -0x70(%rbp), %xmm13
movapd -0x80(%rbp), %xmm12
movapd -0x90(%rbp), %xmm11
movapd -0xa0(%rbp), %xmm9
movsd 0x37e1(%rip), %xmm8     # 0x7030
movapd -0x30(%rbp), %xmm10
movsd -0x18(%rbp), %xmm7
movapd -0x40(%rbp), %xmm4
movapd -0x50(%rbp), %xmm5
movapd -0x60(%rbp), %xmm3
divsd %xmm0, %xmm8
mulsd %xmm8, %xmm11
mulsd %xmm8, %xmm13
mulsd %xmm7, %xmm8
movapd %xmm11, %xmm0
mulsd %xmm4, %xmm0
mulsd %xmm8, %xmm4
movapd %xmm13, %xmm1
mulsd %xmm5, %xmm1
subsd %xmm4, %xmm1
mulsd %xmm11, %xmm5
movapd %xmm8, %xmm2
mulsd %xmm3, %xmm2
subsd %xmm5, %xmm2
mulsd %xmm13, %xmm3
subsd %xmm3, %xmm0
leaq -0x1d0(%rbp), %rsi
movsd %xmm11, (%rsi)
movsd %xmm13, 0x8(%rsi)
movsd %xmm8, 0x10(%rsi)
xorl %r14d, %r14d
movq %r14, 0x18(%rsi)
movsd %xmm1, 0x20(%rsi)
movsd %xmm2, 0x28(%rsi)
movsd %xmm0, 0x30(%rsi)
movq %r14, 0x38(%rsi)
movsd %xmm9, 0x40(%rsi)
movsd %xmm12, 0x48(%rsi)
movsd %xmm10, 0x50(%rsi)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x58(%rsi)
movupd %xmm0, 0x68(%rsi)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x78(%rsi)
leaq 0x6846(%rip), %rbx      # 0xa160
leaq -0x150(%rbp), %rdx
movq %rbx, %rdi
callq 0x4cdc
movapd -0x150(%rbp,%r14), %xmm0
movapd -0x140(%rbp,%r14), %xmm1
movapd %xmm1, 0x10(%rbx,%r14)
movapd %xmm0, (%rbx,%r14)
addq $0x20, %r14
cmpq $0x80, %r14
jne 0x3929
movaps -0xb0(%rbp), %xmm0
movaps 0x39eb(%rip), %xmm3     # 0x7350
xorps %xmm3, %xmm0
movaps -0xc0(%rbp), %xmm1
xorps %xmm3, %xmm1
movaps -0xd0(%rbp), %xmm2
xorps %xmm3, %xmm2
callq 0x398d
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbx
popq %r14
popq %rbp
retq