When Mike Flanagan signed on to write, direct, and edit “Doctor Sleep,” he took on a complicated legacy. How do you adapt a best-selling novel (Stephen King’s 2013 book) that is the sequel to another celebrated novel (“The Shining”) for the screen when the film adaptation of that first novel is a) one of the greatest icons of mainstream cinephilia and also b) wantonly ignorant of the actual plot of its source material? That is to say: How does one make a “Doctor Sleep” film that encourages both Stephen King and Stanley Kubrick fanboys to bury the, er, hatchet?

The answer is simple: Make a mediocre film. Pay homage to Kubrick’s “The Shining” with obsequious clip-show moments and knock-off Shelley Duvall while weaving in King’s most bizarre monster lore. Cast someone highly competent, like Ewan McGregor, to play the lead. Have a little fun with special effects and camerawork, refuse to cut half an hour in the post, and – presto – you’ve got “Doctor Sleep,” a Marvel-meets-Kubrick Hollywood Frankenstein that is, despite its soullessness, entertaining enough not to leave its audience unconscious.

The titular doctor is Dan Torrance (McGregor), all grown up and sweating whiskey in 2011. After he hits rock bottom by leaving a one-night-stand for dead, Dan ends up in New Hampshire and Alcoholics Anonymous. One eight-year sobriety chip later, Dan has become a beloved hospice orderly, teaming up with the cutest cat ever to usher old folks to their deaths. He has learned to lock the horrors of the Overlook away in tiny boxes inside his mind (definitely not a metaphor for anything!), and he’s even made a new friend – Abra (Kyleigh Curran), a teenage girl who can Shine spoons onto the ceiling and messages onto Dan’s wall.

Things go quite literally sideways for Dan and Abra when Abra discovers a traveling band of soul-eating humanoids who feast on the lives of children who Shine. The child murderers, led by Rose the Hat (a catlike Rebecca Ferguson), set their sights on Abra when she telekinetically spies them murdering a little leaguer (Jacob Tremblay). Though Dan is determined to keep his Shine dulled, he finds himself pulled into a showdown against evil that inevitably ends at that prototypically evil place, the Overlook Hotel.

Much like “It: Chapter Two,” “Doctor Sleep” is an odd generic blend. Part horror, part fantasy, part “The Shining” Oscars tribute, it engenders confusion more often than delight. (Though occasionally the twain shall meet, as when Ferguson tries to pin down an accent and ends up going bizarro-Pennywise.) At 152 minutes and laden with special effects and multiple climaxes, it is about as bloated as the dead, naked old woman hiding in your bathtub. But some of its indulgences are genuinely wonderful: an extended Rebecca Ferguson flying scene unexpectedly dazzles, and Zackary Momoh steals scenes as Abra’s father. But by the time Flanagan finally gets us to the Overlook, fatigue has set in. After watching poor Henry Thomas and Alex Essoe, who look nothing like Jack Nicholson or Shelley Duvall, try to recreate two of the most beloved horror performances of all time (a doubly thankless job, since Flanagan shoehorns actual footage of Nicholson and Duvall into the film), rehashed bloody elevators and evil twins induce more cringing than nostalgia-induced euphoria.

When all is maimed and burned, “Doctor Sleep” reads more like fan service than a standalone film. The trouble is – fan service to who? Watching a cookie-cutter studio blockbuster attempt to pay homage to Kubrick feels about as natural as seeing a “Twin Peaks” clip show in the middle of an episode of “Friends.” In these franchise-happy times, it makes sense that Warner Bros. would want to revive one of cinema’s critical hits. But when Dan wraps the film by telling Abra to “Shine on,” the bleak truth becomes apparent: Doctor Sleep isn’t here to peacefully help things die. He’s here to administer one serious beating to a very much dead horse. [C-]