Prepare to lose your appetite.

Never before has this country been in such urgent need of common-sense pun control. Like a dare between stoners that went too far and took on a sporadically funny life of its own, “Sausage Party” unfolds as though “Cloudy With a Chance of Meatballs” and “The Book of Mormon” were stuffed into a blender and fused together into an unholy smoothie of heresy, hedonism, and hot dogs. And puns. So many puns.

Do all hot dogs go to heaven? What about their buns — can leaven be for real? Forget spoiler alerts: All of this food is already foul as can be.

Set inside a sterile American supermarket and starring several different aisles worth of anthropomorphized groceries, this is an R-rated cartoon in which the hero is a weenie named “Frank,” a Twinkie is an actual twink, and the villain is literally a douche. This is a movie so ugly it makes “South Park: Bigger, Longer & Uncut” look like one of Studio Ghibli’s exquisitely drawn masterpieces by comparison. This is a movie that begins with a singularly foul-mouthed singalong about the divine beauty of The Great Beyond — the various products have been indoctrinated to believe that the human customers are colossal deities, and that being placed in their shopping carts is a ticket to heaven — and ends with the most nauseating food-related sex scene since “In the Realm of the Senses.” This is a movie that sincerely tries to solve the Israeli-Palestinian conflict by showing a lavash fuck a bagel from behind (why didn’t Yitzhak Rabin think of that?).

“Sausage Party,” for better or worse, is a movie that actually exists. And, at some point along the way, that fact will actually shock you.

What “Psycho” did for showers, “Sausage Party” does for food — not only will you lose your appetite, you may never want to eat again. If it were even half as good of a comedy as it is a crash diet, we’d be reckoning with an all-time classic. As it stands, we’re left with a movie that’s funniest joke is that it got made in the first place, a feature-length Sunday school lesson for budding atheists that’s ultimately justified by its most demented moments, even if they’re few and far between.

It begins, as daily life does for a sealed package of wieners, when the supermarket opens for business. Of course, it’s immediately clear that Shopwells is less of a supermarket than it is a broad, florescent-lit metaphor for the segregated world beyond its doors. Every food has its own fixed place in the store (though some of those spots are more contested than others), and they all have their own beliefs about what’s waiting for them once they check out. Each morning begins with a ritualistic song through which all of the perishable items reaffirm their religious credos, but the most important line is saved for Frank (star, producer, and co-writer Seth Rogen), who joyously belts out: “Everyone is fucking stupid except those who think like me!”

Yes, much of the movie’s first 15 minutes are spent detailing the ways in which Frank wants to stick himself into a fluffy hot dog bun named Brenda (Kristen Wiig), but it’s clear from the start that “Sausage Party” has more on its mind than the love story between a processed piece of bread and the googly-eyed wiener who wants to stick himself into the slit that runs down her dough. The crucial detail about the romance between Frank and Brenda — the Romeo and Juliet of Shopwells’ Fourth of July display — is that it’s forbidden. Those crazy kids could slip out of their plastic and consummate the meal at any time (after all, they do grow nightmare-inducing stick limbs, complete with little Mickey Mouse gloves on their hands, whenever humans aren’t looking), but both parties are afraid that exposure might make them less desirable for purchase, less palatable to the gods.

That fear is the one thing that unites everything with an expiration date — they’re all waiting to be bought and bagged away from this mortal coil, and they’re all perpetuating elaborate stories in order to make peace with their imminent passing. Sound familiar? Celeries: They’re just like us.

Co-directed by Conrad Vernon and Greg Tiernan (whose previous credits respectively include the likes of “Shrek 2” and a zillion different “Thomas the Tank Engine” videos), “Sausage Party” is at its best when arguing the virtues of godlessness. The film’s theological thesis is simple enough for a child to understand, but the go-for-broke enthusiasm with which its rotting characters rise up and embrace the hard truth of their existence is genuinely transgressive.

Unlike so many comedies, “Sausage Party” only gets funnier as it goes along — there are dozens of duffed jokes along the way (watching a potato say “fuck” is only funny for so long), but the script mines its demented premise for its full potential, and the plot crescendos to an ending so good that you’re likely to forgive many of the dull moments that came before it.

Still, those dull moments come in droves, a symptom of the movie’s complete failure to balance its snack-sized servings of Nietzschean philosophy with the adventure plot that’s used to feed them to us. While each of the major players is amusing in their own right (especially Sammy Bagel, Jr., who Edward Norton voices with a spot-on Woody Allen impression), it’s a chore to follow Frank, Brenda, and a lesbian taco voiced by Salma Hayek as they wander from aisle to aisle in search of a way out. Nick Kroll is hilarious as the steroidal douche on their tail, but his shtick is wasted on his stock villainy. For the most part, these characters are defined by nothing more than the cosmic joke of their cartoon existence, and it only gets easier to grow sick of them after the late game introduction of a Stephen Hawking-like wad of gum, a comic creation so brilliant and inspired that it retroactively highlights all of the film’s wasted opportunities.

It’s hard to shake the feeling that story masterminds Rogen, Evan Goldberg, and Jonah Hill would have been better served by a more free-form narrative, something closer to “A Scanner Darkly” than “A Bug’s Life,” but “Sausage Party” was surely hard enough to get financed as it is. And, not for nothing, but it resolves with the best sequel set-up in recent memory. Maybe the end isn’t really the end, after all.