From all the movies and what I have been reading on HP wikia, it is clear that Snape was in love with Lily but did not share the same affection with Harry. He only tried to save him during his years at Hogwarts because Harry had Lily's eyes and he promised Dumbeldore to do so. But he was also with Voldemort and was a death eater. What I dont understand is where did Snape's allegiance lie?
From wikia page it is evident that when the prophecy was made Snape was eavesdropping and he was the one to tell it to Voldemort, so clearly he was at that time loyal follower of Voldemort but once he got to know that the suitable candidates to complete prophecy was Lily's son (or neville longbottom but Voldemort decided to go for harry) and Voldemort has decided to kill Harry, that will result in death of Lily too thus he went to Dumbeldore and asked him to save Lily in return of "anything". Dumbeldore fulfilled his promise but still Voldemort managed to get lily so Snape now had to follow Dumbeldore's order and save Harry. So at that time was he cheating and lying with Voldemort to save Harry but was still in favour of Voldemort on any other matter except Harry?
His character was very complex I feel and I cant figure out what his mind and intentions were at various times, especially before and after Voldemort decided to kill harry (and thus indirectly harming Lily)?