A Scanner Darkly 2006
In the future "seven years from now," America has lost the war on drugs. A highly addictive and debilitating illegal drug called Substance D, made from a small blue flower, has swept across the country. In response, the government develops an invasive, high-tech surveillance system and puts in place a network of informants and undercover agents.
Bob Arctor (Reeves) is an undercover agent assigned to immerse himself in the drug underworld and infiltrate the drug supply chain. Arctor and his housemates, Ernie Luckman (Harrelson) and James Barris (Downey Jr.), live in a suburban tract house in a poor Anaheim, California neighborhood.
They are heavy drug users, and they pass their days by taking drugs and having long, drug-inspired conversations. When Arctor is at the police station, he is codenamed Fred, and hides his identity from his fellow police officers by wearing a high-tech scramble suit that changes every aspect of the wearer's appearance.
Arctor's superior officer, Hank, like all other undercover officers at the station, also wears a scramble suit. While posing as a drug user, Arctor becomes addicted to Substance D, a powerful psychoactive drug which causes a dreamy state of intoxication and bizarre hallucinations; chronic users may develop a split personality, cognitive problems, and severe paranoia.
Arctor befriends an attractive young woman named Donna Hawthorne (Ryder), a user of cocaine, Arctor's supplier of Substance D, and part of the drug scene. Arctor hopes to buy so much Substance D from Hawthorne that she is forced to introduce him to her supplier, but Arctor develops romantic feelings for her.
However, Hawthorne refuses Arctor's sexual advances and Arctor's housemates question the true nature of their relationship. Barris implies to longtime friend and near-insane Substance D addict Charles Freck (Cochrane) that he has made advances toward Donna only to be refused, and suggests that Freck supply her with cocaine in order to attract her attention away from Arctor and convince her to lower her drug prices.
Hank orders Fred to step up surveillance on the members of the Arctor household. Hank assumes Fred is one of the drug users in the Arctor household, but does not know which one, and actually orders Fred to focus the surveillance on Arctor. In the meantime, the household members are extremely paranoid that the police have bugged their home and are watching their every move.
The paranoia reaches extreme levels, and Arctor seems to become wrapped up in the concern of his housemates, even forgetting that he is the undercover agent spying on his justifiably paranoid friends. Meanwhile, Arctor's housemate Barris (Downey Jr.) secretly contacts the police and tells them he suspects Hawthorne and Arctor are part of a terrorist organization.
Barris unknowingly tells this to Arctor himself at the police station while Arctor is wearing his scramble suit (i.e. in his job as Fred). Due to Arctor's heavy use of Substance D, he develops cognitive problems which stop the two hemispheres of his brain from communicating with each other, and as a result he is receiving two different sets of information that are in conflict.
As a result, Arctor is no longer able to distinguish between his roles as a drug user and undercover policeman, which makes him incapable of performing his job. Hank reprimands Arctor for becoming addicted to Substance D while undercover, and warns him that he will be disciplined.
After Barris supplies information to the police on the terrorist organization that Hawthorne and Arctor supposedly belong to--including a recording that Hank immediately recognizes as fake, synthesized on a computer--Hank orders Barris held on charges of providing false information to the police, which he assures Barris is "merely a cover" to protect him while the information is evaluated.
After Barris' arrest, Hank reveals to Fred that he has figured out, through the process of elimination, his true identity, and that his identity is indeed Arctor. Arctor is surprised to learn his own true identity and he begins to act extremely confused and disoriented.
Hank then informs Arctor that the whole point of the surveillance was to catch Barris, not Arctor himself; the police suspected Barris of being involved in the Substance D ring, and they were setting him up by driving up his paranoia level until Barris cracked and tried to cover his tracks with the false info.
While a disturbed Arctor begins to break down, Hank phones Donna and asks her to take Arctor to New Path, a corporation that runs a series of rehabilitation clinics. After Arctor leaves the office, Hank heads to the lockers to remove his scramble suit, and his true identity is revealed: Donna Hawthorne.
At New Path, Arctor experiences the severe symptoms of Substance D withdrawal. As part of the rehabilitation program, Arctor is renamed Bruce and put through psychological reconditioning treatments. Arctor has serious brain damage from his withdrawal from Substance D.
Sometime later Donna, using the name Audrey, has a conversation with another officer named Mike (seen undercover as an orderly at New Path), in which both reveal that New Path is responsible for the manufacture and distribution of Substance D. Donna/Audrey was part of a greater police operation to infiltrate New Path, and Arctor had been selected, without his knowledge or consent, to carry out the sting.
It is revealed that the police had intended for Arctor to become addicted to Substance D; his well-being was sacrificed so that he might enter a rehabilitation center unnoticed as a real addict in order to find conclusive proof of New Path's crimes. They are dubious if there is still enough of Arctor left to find the evidence.
To continue his rehabilitation, New Path sends Arctor to work at an isolated New Path corn farming prison. Arctor spots rows of blue flowers hidden between rows of corn. These flowers, referenced throughout the film, are the source of Substance D. As the film ends, Arctor hides one of the blue flowers in his boot, so that when he returns to the New Path clinic during Thanksgiving he can give it to his "friends" - undercover police agents