It's a moment of darkness and doom: A doctor sits opposite Adam Sandler's Funny People character, the big star George Simmons, and tells him, "I can't predict how this will play out, but I feel we have a rough road ahead."

The famous funnyman - played by the famous funnyman - has a rare type of leukemia. There are experimental drugs, but the odds are not in George's favor.

And so Judd Apatow's long and winding, often wildly funny and sometimes mawkish movie begins. For a while, it's hard to predict how things will play out, and there's the feeling - especially deep in that second hour - that the rough road ahead is right under foot.

But by the end of its almost 21/2 hours - after more phallus-centric jokery than you can shake a, um, stick at - Funny People turns out to be fairly predictable, and not so rough. In a thoroughly satisfying way.

A comedy about showbiz celebrity (it's lonely at the top), about male bonding, men and women, sex and selfishness, and the fraternity (with a few females included) of stand-up, Funny People is sappy, loopy, inspired, hysterical.

For Apatow - writer/director of The 40-Year-Old Virgin and Knocked Up and producer of a veritable slew of raunchy comic meditations on adolescence and addled adulthood - Funny People represents an ambitious summing up of his pet themes. He grapples with issues like marriage, family, infidelity, and, yes, death. But the juvenile nincompoopery, and the poop jokes, are there, too. And did we mention the obsession with male genitalia?

And so, armed with his grim prognosis, George retreats to his beachfront manse to wallow in self-pity. He gets misty-eyed watching his hits (Re-do, Mer-man, My Best Friend Is a Robot). He does a club gig - and runs into a young, struggling comic, Ira Wright (Seth Rogen), there. George hires Ira to write gags, and to be his personal assistant. This is a step up from the supermarket deli counter where he works, and Ira - who shares a Hollywood apartment with a sitcom star (an amusingly vain Jason Schwartzman) and a fellow struggling comic (Jonah Hill) - takes the job.

And then he takes a private jet with George for his big-paycheck performance at MySpace headquarters. In its details and depiction of the life of a Hollywood star - pampered, protected - Funny People feels very real.

In that same verisimilitudinous vein, the movie has real funny people in it, too: Paul Reiser, Ray Romano, George Wallace, and other punch-line pros show up as themselves. Sarah Silverman is there, doing incredibly strange stuff with her mouth. And rapper Eminem delivers a lofty, loony rant.

Leslie Mann, Apatow's real-life wife, is goofily luminous as George's ex - now living in the Bay Area with a dashing Aussie (Eric Bana) and their two cute-as-buttons daughters (Apatow and Mann's real-life daughters). It's this second half of the film, with its scenes of domestic incertitude, that threatens to implode in a narrative muddle. But thanks to Mann's and Bana's fine comic turns, to Rogen's shaggy drollery and Sandler's Sandleresqueness, it never does.

There's almost too much good stuff in Funny People. Aubrey Plaza, as a brainy comedienne Ira falls for, has a dismissive scowl to die for. And will it ever be possible to watch David Beckham, Tom Cruise and Will Smith again without thinking of the wild monologue that Ira works them - or a key part of their respective anatomies - into?

Time will tell, but Apatow's Funny People is some kind of legacy, anyway.EndText

Contact movie critic Steven Rea at 215-854-5629 or srea@phillynews.com. Read his blog, "On Movies Online," at http://www.philly.com/philly/blogs/onmovies/