Try as he might, Woody Allen can't not be funny. The 79-year-old director is holding court with a group of European journalists at the Cannes Film Festival, and though his thoughts couldn't be darker, the mood is cartoon-bright.
"The religions, the philosophers, the artists, they're all trying to sell you a bill of goods," he says - an observation that's met with bubbling amusement.
"And none of it helps. No matter how intellectual your conversations, life just tramples right over you. In the end, whether you've invested in Plato" - his adenoidal New York twang turns the Greek philosopher's name into "Play-Doh" - "or Nietzsche, or Wittgenstein, you're going to die."
The laughter builds. "You know," he continues, eyes as wetly morose as a sausage dog's, "the poet Auden called death - I forget the exact phrase but I'm close - 'the distant sound of thunder at a picnic'. Well, I've heard that thunder almost constantly since I was five years old. It's ruined my life completely." Peals of hilarity.
There are two possible reasons why Allen's audience are cackling so enthusiastically: either they have no idea what he's actually saying, or they do. My own experiences of the film festival press corps lead me to suspect the former, but the latter's equally possible. It's hard to think of another film-maker who has used the knelling enormity of death so nimbly and uproariously against it - like a ju-jitsu-fighting midget flipping his giant opponent over a casually outstretched foot.
For Allen, death is the big banana skin - the shepherd's crook reaching out from off-stage and curling itself around your neck. It's mortifying in every sense, and the sheer humiliation of kicking the bucket has been a major theme in his work since his early days on the New York stand-up circuit. But there's no question that, 52 years and 46 films later, the subject seems a little more - how to put it gently? - immediately relevant.
In his hotel suite later that afternoon, Allen is a wispy presence: the Ghost of Movies Past, perhaps, come to remind us of a time when films could drop names like Kant and Kierkegaard and trust the audience not to trip over them. He's jet-lagged from last night's trans-Atlantic flight, but prefaces every yawn with an apology, and his mind zigzags from Camus to coupledom and the clarinet (all three, he says, remain welcome diversions from the inevitable) faster than you can multiply 12 by eight.
Allen has come to Cannes for the world premiere of his latest film, Irrational Man, a sherbetty murder-mystery which arrives in UK cinemas next month. It returns to a favourite Allen premise - the possibility of the perfect murder - and ponders the various logistical and spiritual impediments to getting away with it.
Joaquin Phoenix stars as Abe Lucas, a paunchy philosophy professor in an existential funk. This Rhode Island Raskolnikov becomes convinced that the only way he'll ever feel truly alive again is by killing someone - and through a quirk of fate, he's presented with an ideal target.
While having lunch one day with Jill (Emma Stone), his perky student, Abe overhears a recently divorced woman talking tearfully to her friends about her forthcoming child custody hearing. The judge assigned to the case is friends with her ex-husband, and the two have secretly conspired against her. Since Abe has no connection to the judge, he decides this demonstrably awful man should be his victim. In theory, killing him should be the perfect crime. In theory.
Allen has ventured deep into these moral caverns before - most brilliantly in his 1989 masterpiece Crimes and Misdemeanours, and also later, in Match Point and Cassandra's Dream - so the subject clearly grips him. But here, it seems to be served up with a personal, lemony twist.
The choice of a family court judge as Abe's deserving victim recalls Allen's own bitter custody battle with Mia Farrow, which was sparked by the director's relationship with Soon-Yi Previn, Farrow's daughter from another relationship, and ended with Allen being denied access to the couple's three children. (Allen married Soon-Yi in 1997, and the couple are still happily together.) Even when Allen doesn't play the role himself, his screen persona surfaces in almost all of his films: in Midnight in Paris it's Owen Wilson's bluff Hollywood screenwriter, while in Scoop, it's Scarlett Johansson's gawky journalism student. Perhaps in Irrational Man, the kindred spirit isn't the philosopher but the parent.
Playing dumb, I ask where the idea for murdering a family court judge came from, and Allen tells an in-depth story of a friend who struggled to sue a dodgy building contractor. "Which was unfair and frustrating, but so feeble compared to losing your children," he says. Changing the story to involve a custody battle, he says, was a decision borne of dramatic expediency, rather than a personal grudge. "If a judge condemns someone to the electric chair, or sends them to jail, there's nothing you can do," he continues. "But if it's family-related and you could help - you know, that seemed to me the very best thing."
By this account, the plot of Irrational Man turns on an uncanny coincidence - particularly as the film went into production only a few months after Allen and Farrow's adopted daughter Dylan spoke for the first time about the unproven claims of molestation that swirled around the 1992 custody hearing. Surely the subject was on Allen's mind?
But he won't budge. "This is the story of my life," he shrugs - by which he means it isn't. "I spend my whole life saying 'This is not me', but audiences don't like to hear it. When I made Annie Hall, people thought it was an autobiographical film. And I said, 'Well look, it's not. I made it up, I wrote it with Marshall Brickman. Many of the jokes and ideas didn't even come from me'. But they don't want to know that. There's something comforting - not because it's me, but with certain people - in thinking that the films are giving them the real story."
He says all of the above not even slightly defensively, but with a blunt conviction that makes me feel a little silly for asking. I don't buy for a second that the parallel is coincidental, but it's possible - and, while we're speaking, it seems reasonably likely - that he simply hasn't reflected on it.
Later, I remember his similar disavowals that Blue Jasmine, the undisputed high point in Allen's recent run of fatalistic dramas, had anything to do with either the Bernie Madoff investment scandal or A Streetcar Named Desire, despite the film turning on a pyramid scheme and starring Cate Blanchett as a composite of Blanche Dubois and Madoff's wife. Again, he insisted it was inspired by the experiences of a friend of a friend. Perhaps he just has a particularly unfortunate social circle.
What Allen clearly has reflected on at some length, however, are the ideas about free will and guilt that underpin his latest film. Its title comes from a philosophy manual from the Fifties - a kind of Nihilism for Dummies - which he describes as "a very, very enjoyable reading experience of my youth".
Woody Allen says he discovered existentialism via his first wife, which sounds like the set-up to a Woody Allen joke. He married Harlene Rosen, his teenage sweetheart, when he was a 19-year-old freelance gag writer and she a 16-year-old philosophy student: she would spread her textbooks across the dinner table in their tiny apartment.
Allen, a two-time college dropout, was "recruited to help out" with her essays, and noticed the same ideas he read with Harlene in Nietzsche's Beyond Good and Evil and Kierkegaard's Fear and Trembling were cropping up in the films of Ingmar Bergman and the great Russian novels he was devouring at the time. "It was always life or death crises, murder, suicide, assault. So it was seductive. I got very interested in it."
Did he live by the existentialists' principles, boldly hewing a maverick's path through a meaningless universe?
"You think you do," he winces. "I liked to imagine that my decisions were all decisions made, you know, in line with Fear and Trembling. But I'm sure they were very prosaic, middle-class decisions made on a practical basis. The truth of the matter is all you wind up being, as I wound up, is a fan - just a fan who would ask for an autograph."
He recalls visiting Paris for the first time in 1965 during the production of What's New Pussycat?, his first film as screenwriter, and spending most of the trip trying fruitlessly to engineer a meeting with
Jean-Paul Sartre. "Finally I met one man who said for a very good price he could bring the two of us together, but I couldn't afford it," he says with a straight face.
At that time or since, has he ever contemplated carrying out a perfect murder himself? "I'm telling you, if I started by killing one person, soon there would be no one left in the world but me," he shoots back. Would it worry him if his teenage adopted daughters with Soon-Yi, Bechet and Manzie, started dating existentialists? His face droops into a familiar look of mock despair. "I'd feel it was appropriate."
Allen's own parents weren't exactly the existentialist type. As his documentary-maker quips in Crimes and Misdemeanours: "Where I grew up in Brooklyn, everybody was too unhappy to commit suicide." His mother Nettie, he remembers, said he turned into "a nasty, sour, rotten kid" at the age of five, when he first became aware of his own mortality. His father Martin worked as a taxi driver, a bartender and a waiter. "And if I hadn't been able to write jokes," he says, "I'd be doing the same." But write jokes he could, and by the age of 16, the gags he'd been sending to comedians were making him more money than his father had ever earned.
Humour, he says, is "a genetic thing. I was always amusing for some reason ... I don't know why, it's just the way it was." He describes his early success as "luck, pure luck - an accident, in the same way someone has an ear for music".
He concedes that he wrote his early material with himself in mind - first the one-liners and then entire scripts, like Bananas, Sleeper and Love and Death, in which motor-mouthed nebbishes have varying degrees of success with women well out of their leagues. "The jokes were always for guys, about how to get girls." The change came, he says, with Diane Keaton, with whom he shared a brief romance in 1970, after casting her in his Broadway production of Play It Again, Sam.
"She was so funny and so intelligent that I saw things from her perspective and started to write for her," he says. "And I wrote for her for years." The results included Annie Hall, perhaps the finest romantic comedy ever made.
Emma Stone, who comes as close to providing the voice of reason in Irrational Man as the film allows, made Allen think of Keaton when he first saw her in the high school comedy Easy A, which he discovered accidentally while channel-surfing on his treadmill. "She reminds me of Diane in this sense: I think they're both kind of limitless in their talent," he says.
Allen's peculiar mix of fiercely analytical drama and anxious laughs suits Stone almost as well as it did Keaton, Dianne Wiest, Gena Rowlands and Mia Farrow, and Allen describes his attempts to write roles she'd accept as a "welcome distraction" as he approaches the inevitable point at which no more Woody Allen films will be forthcoming.
Does it matter to him, this mad movie-a-year regime he's maintained since A Midsummer Night's Sex Comedy in 1982, with a further as-yet-untitled film and Amazon Prime series ("the worst decision of my life") due in 2016?
"Who cares, really, in the end?" he groans. "It's a distraction, like practising my clarinet, or going to the movies and watching Fred Astaire dance for an hour-and-a-half."
And love? "And love is a distraction as well. You meet somebody and they're all you can think about, then if you're lucky you can be happily married for 25 or 30 years. Then suddenly you see something in your X-ray here" - he points to his chest - "and your wife can give you some kind of comfort. But the comfort is a Band-Aid. It doesn't do the trick. It can't save you. It just makes things a little less horrible." His words aren't funny in the slightest, but I find myself laughing.
Irrational Man opens in UK cinemas on September 11