Psycho Paralysis: Spacey plays a comatose celebrity analyst.

Funny People, alas, isn’t terribly funny. That’s not a knock on the film, which is also long, twisting, and often real-world uncomfortable. It’s more a necessary tweak on the expectations we’ve come to have from Judd Apatow and his tribe, lest you miss out on the loveliness while wondering where the laughs went.

This is only the third movie both written and directed by Apatow, who since 2005 has put either his money or his brainpower behind a steady stream of touchy-raunchy comedies like Superbad and Pineapple Express. Those films nearly all follow the same formula, one that leans heavily on the laughs with a late-chapter sprinkle of emotion. In Funny People, the recipe’s reversed: The main characters are comedians, and they frequently talk in punch lines. The story, however, is about critical illness, and broken relationships, and everyone’s personal struggle toward happiness.

George Simmons (Adam Sandler, looking appropriately haggard) is an established comic who finds out he has a rare and likely fatal form of leukemia. He tells no one; instead he decides to perform an impromptu set at a club he‘d frequented as an amateur. George’s monologue turns out dark and awkward, eliciting mostly silence. So the comedian he’s bumped, Ira Wright (Seth Rogen), does what any enterprising, no-name entertainer would do: He mocks George and his WTF? rambling. Ira gets some laughs but also the wrath of his hero in the parking lot afterward.

At least until the next day, when George phones Ira and asks if he and another friend who performed that night, Leo (Jonah Hill), would be interested in writing some material for him. Ira jumps—and lies that Leo is unavailable—and soon is not only George’s joke writer but all-around assistant and only close friend. George then tells Ira about his terminal condition, swearing Ira to silence. Experimental treatment, mood swings, and soul-searching follow, with Ira eventually persuading George to tell others, if only because he’s too freaked out and immature to know how to deal with George on his own.

The most important person George reconnects with is his college sweetheart, Laura (Leslie Mann), who remains the love of his life despite the fact that she’s now long married with kids. This relationship and their possible reconciliation becomes the focus of the nearly two-and-a-half-hour film, but Apatow’s script weaves and bobs before it gets there, resulting in a story that’s infinitely richer than you might expect from the current king of dick jokes. Among the topics explored are ambition (at one point Ira is mocked by a deli co-worker for having some), intimacy issues (George’s territory), and the life-changing power of a near-death experience. Divorce and infidelity are thrown in as well, and pretty much everything is colored by the idea of humor as defense mechanism.

But fear not, Apatow fans: The dick jokes are here, too. (Though almost to a distracting degree—George is one penis-obsessed dude.) Funny People may have an ever-present sadness, but the title is apt and the laughs are often blue. Some of the funniest moments are glimpses of George’s terrible movies, whether it’s his crazed expression and fish tail in a poster for Merman or a clip of another of his characters participating in a hot-dog eating contest while his son yells, “Dad! This won’t bring Mom back!” When George performs for a MySpace convention, the site’s ubiquitous co-founder and everyone’s first friend, Tom Anderson, asks if he actually uses MySpace. “No, I fuck girls,” George replies. Apatow even takes ownership of a term that his films have inspired, having an agent pitch George a comedy using the word that starts with a “b” and rhymes with “romance.”

Throughout, Sandler is terrific. He keeps George’s depression and introspection subtle—even his angry moments aren’t over-the-top—accurately reflecting in his expression and demeanor a body that’s truly weary of this great world. (A highlight is George’s reaction to Warren Zevon’s “Keep Me in Your Heart,” an unexpected gut-punch on a playlist Ira made for him that he had hitherto mocked.) Mann, too, is finally given a chance at a meatier supporting role and makes Laura’s lingering affection toward George and her conflict over her choices feel very real. Funny People is a true departure for Apatow that works a bit better if you know as much going in. And though the material it addresses is messy, the film itself is anything but.