Conversation so far:
who sang as time goes by in casablanca
As Time Goes By became famous when it was featured in the 1942 Warner Bros. film Casablanca performed by Dooley Wilson as Sam.
who wrote the song as time goes on
As Time Goes By is a song written by Herman Hupfeld in 1931.

Question: was the song written for the film
Self-contained rewrite: was the song as time goes by written for casablanca