If comedy filmmakers weren’t already jealous of their television brethren, they will be after they watch HBO’s 7 Days in Hell, which uses the cable network’s permissive attitude toward adult material to tell envelope-pushing jokes that no mainstream movie could ever hope to get past the MPAA. 7 Days in Hell is funny enough to play in a multiplex (even if, at 50 minutes, it’s not quite feature length), but its hilariously vulgar jokes would definitely saddle it with a box-office poisoning NC-17 rating. On HBO, though, anything goes, and thank goodness because director Jake Syzmanski and writer Murray Miller were able to produce a mockumentary that giddily pulses with a sense of absolute freedom — freedom from content restrictions and freedom to experiment with weird strains of comedy that would never fly in a mainstream Hollywood film.

The subject is a fictional tennis match, supposedly the longest in the history of the sport (very loosely inspired by the famous three-day Isner-Mahut match at Wimbledon 2010), between a brash, Andre Agassi-esque party boy named Aaron Williams (Andy Samberg) and a dim-witted prodigy named Charles Poole (Kit Harington) who’s been bullied into a tennis career by an overbearing stage mother (Stadium mother?) played by Mary Steenburgen. At Wimbledon, the final set of a match can’t end until one player wins by two games; matches can hypothetically go on forever until someone breaks the other person’s serve. So, for one full week in 2001, these two titans of the sport faced off in an endless battle of wills. And dick jokes. But mostly wills. (And also dick jokes.)

The film, a Christopher Guest-style fake documentary with a very generous portion of raunch, blends supposed archival footage of this match with talking head interviews; real tennis pros like John McEnroe and Serena Williams play themselves, while comedians like Fred Armisen and Will Forte pop up as historians who lend context (and improvised riffs) to the story. The success of this sort of film depends on how well it apes reality, and Syzmanski does a fine job of copying the look and feel of an HBO Sports production, and many actual HBO personalities including Jim Lampley and Soledad O’Brien prove to be surprisingly good sports as they cheerfully mock themselves and the tropes of stodgy tennis coverage.

The main conflict is hilariously performed by Samberg and Harington, but even with runtime in short supply, 7 Days in Hell finds space for some wonderful digressions. Before Williams met Poole he spent some time away from the sport, which leads to an awe-inspiringly bizarre tangent about his clothing line, whose centerpiece was a pair of ... well let’s just call them extremely well-ventilated men’s briefs. That business plan’s inevitable failure spawns to an even stranger and funnier departure involving a legendary courtroom sketch artist from Sweden — who all of the mock-doc’s tennis pros and experts are inexplicably knowledgeable about as well. The whole sequence has no business being in the movie, which is precisely what makes it so funny. The random detours soon become exhilarating; it’s impossible to predict where things will go from one moment to the next (except that they will probably involve some kind of genital humor).

HBO helps 7 Days in Hell in another way: Aping the style of a TV sports documentary, the film is allowed to wrap things up after less than hour. The Hollywood version of this movie would linger for 90 minutes and probably run out of steam somewhere around day five of Williams and Poole’s epic showdown. The brief runtime is perfect because it doesn’t allow anyone or anything to wear out its welcome. Not every joke lands (Lena Dunham’s brief appearance as a misguided Jordache executive mostly falls flat), but the vast majority do, and the supporting cast is deep with heavy-hitters: Michael Sheen gives great creepy as a lascivious talk-show host and June Squibb absolutely kills a wonderful cameo as a sadistic version of Queen Elizabeth. The humor is not for the faint of heart, or the sensitive of taste; for that you can head to the movie theater.