Shadows and Fog

Kleinman (Allen) is awakened from a deep sleep by a vigilante mob. They claim to be looking for a serial killer who strangles his victims and to need his help. Before he leaves, his landlady, who wants to marry him, gives him a small paper bag with pepper in it.
Irmy (Farrow) and her boyfriend Paul (Malkovich), performers at a circus, are having a dispute about getting married and having a baby. Paul leaves and goes to another tent where Marie, a tightrope artist (Madonna), waits for him. They begin to have sex, but Irmy catches them and runs away to the city. There, she meets a prostitute (Lily Tomlin) who brings her to a house of ill-repute, where she is comforted by other prostitutes (Jodie Foster and Kathy Bates). Then, a student named Jack (John Cusack) comes into the whorehouse and is immediately bewitched by Irmy; he insists on having sex with her, paying $700.
On the street, Kleinman walks aimlessly around the city. He stops at a coroner's house, where the doctor (Donald Pleasence) explains that his role in the hunt is purely scientific. They each have a glass of sherry. After Kleinman leaves, the doctor is murdered by the Strangler.
Kleinman, seeing a local family being evicted as 'undesirables', goes to the police station to try to stop the eviction. Whilst there, a police officer arrives with news of the coroner's death, saying that there is a clue â a glass with fingerprints on it. Kleinman panics, realizing that his fingerprints are on the glass. Irmy is there as well, because she had been taken to the police station when the police raided the whorehouse. Insisting she is a whore and needs a license, they fine her and allow her to leave. Irmy protests her innocence and, in the confusion, Kleinman is able to steal the glass with his fingerprints on it. Kleinman leaves and, startled by Irmy, engages her in conversation, during which they walk into the night together. A vigilante shows Kleinman an alley where they think the killer might be. Irmy and Kleinman enter the alley warily, and find that the person is Kleinman's boss, Mr. Paulsen, peeping into a window at a woman. Mr. Paulsen angrily accuses him of incompetence. Ashamed, Kleinman and Irmy move on into the night.
Paul arrives in the city, looking for Irmy. He goes into a bar where Jack, the student who had sex with Irmy, is having a drink. The student reflects on the wonderful experience he had with "a sword-swallower". Paul is shocked, although Jack does not know why.
Back on the street, Irmy tells Kleinman that she doesn't want the money and asks him to give the $650 to charity in a church. He does, finding two men compiling a list of names. When he gives them the money, they gratefully erase his name from the list. Outside, on the steps of the church, they see a starving mother with a child, and the two run away from parent and child. After some thought, Irmy decides she wants to give half of the money to the woman and asks Kleinman to go back to the church to get it back. Reluctantly, he returns and asks for half the money; the two men reinstate his name to the list.
Kleinman tries to get Irmy a place to stay by asking his fiancÃ©e, but she refuses to let them in. At a pier, they look out at the night and the feeling is very romantic, until the vigilante mob ambushes them. It turns out that everyone has a "plan." Then, Spiro the Clairvoyant, a man who smells people like a psychic bloodhound, starts to sniff Kleinman. He says that Kleinman "has something in his pocket," and the sherry glass is revealed. Angry and believing he is the killer, the mob prepares to lynch him. Kleinman blows pepper in their faces and escapes. He tries to find a safe haven in the house of his first ex-fiancÃ©e, Alma (Julie Kavner), whom he left standing at the altar while he had a dalliance with her sister. He apologizes, but she throws him out, shouting "Get out and die!"
Meanwhile, Irmy and Paul meet, and at first Paul is ready to kill Irmy for sleeping with another man. They break off their fight when they find the starving woman whom Irmy and Kleinman had met earlier, murdered, and the baby lying on the ground. They decide to keep the child and return to the circus, which is preparing to leave the city.
Ahead of the mob, Kleinman arrives at the whorehouse, where he meets and has an existential conversation with Jack. When he is unable to express his views, a whore (Foster) coaxes him into a back room where he fails to perform, blaming existential angst. The mob arrives, asking after Kleinman. He escapes via the roof, after which he meets and is taunted by his rival (Wallace Shawn) for promotion at work, and who also reveals Irmy has gone back to the circus. Kleinman follows her there.
At the circus, Kleinman meets the magician Armstead (Kenneth Mars), whom he greatly admires. The Strangler arrives and is about to kill both of them when the magician mesmerizes him with a mirror trick and chains him up. While Kleinman and Armstead are congratulating each other, the Strangler somehow escapes. The angry mob arrives on the scene and, thwarted, gives up for the night. The movie ends with Kleinman accepting Armstead's invitation to become his assistant, and Irmy and Paul continuing their careers as circus performers while raising their newfound child. As Armstead and Kleinman prepare to leave, the magician sums it all up by saying, "They need illusions like they need the air." And with a gesture, the two disappear in a mirror and a puff of smoke.

Question: Who had sex with Irmy?
Answer: Jack.