Say what you will about Ben Affleck as Batman, or Jack Ryan, or any number of other action heroes that have seemed to be a stretch for the boy-next-door star, but Affleck is a terrific fit for “The Accountant,” in which he plays an autistic assassin. Though his choice in material is strong, the actor has always been a strange kind of thespian, one who seems so normal and non-actorly that most of his performances feel like watching one of your buddies up on screen, pretending to be someone he’s not. Here, Affleck, who formerly drew the short end of the stick playing the dumb townie to Matt Damon’s math savant, finally gets to embody the numbers whiz, and also to run around shooting some heavy-duty guns: It’s like Will Hunting and Jason Bourne rolled into one, brains and bullets. What’s not to love?

Based on a deliciously pulpy Black List screenplay by Bill Dubuque, “The Accountant” was one of those projects that admirers imagined would never get made — and maybe they had a point, seeing as how the script casually assumes that someone with Asperger’s Syndrome is potentially wired to become a ruthless killing machine. In the wrong hands, the screenplay could have been as controversial as Brian De Palma’s “Dressed to Kill” was with the trans community. But here, director Gavin O’Connor (“Warrior”) demonstrates the right way to handle such material, elevating what is essentially an exploitation movie into a zen character study, one that takes its pound-of-flesh antihero seriously.

As Christian Wolff (just one of this character’s many aliases), Affleck plays a CPA who crunches numbers as efficiently as he crunches bones, and capturing that odd combination is all about tone. O’Connor has a close friend who is the parent of an autistic child, which makes him unusually sensitive to the film’s trickiest ingredient: Instead of presenting Affleck’s Christian Wolff as some kind of freak, he treats the guy as special, blessed with an ability that makes him almost superhuman. (As if speaking to a junior X-Man, his father says, “You’re different. Sooner or later, difference scares people,” before sending his son into a Silat fighting match with three adults.) By extension, “The Accountant” is a hair’s breadth removed from being a superhero movie, unfolding with the kind of fun, comic-book energy all but absent from “Batman v Superman: Dawn of Justice” earlier this year, while maintaining the requisite degree of gravitas.

A suitable analogy might be the film that remains M. Night Shyamalan’s best, 2000’s all-but-forgotten superhero prologue “Unbreakable.” Like that film, “The Accountant” is built almost entirely upon exposition as Dubuque juggles no fewer than four separate story threads: He gives us Wolff’s current assignment, which involves “uncooking” the books at a company called Living Robotics whose founder (John Lithgow) uses the company’s benefits to justify the most heinous kind of behavior. At the same time, from the sidelines, Treasury Dept. investigator Ray King (J.K. Simmons) enlists a young analyst, Marybeth Medina (Cynthia Addai-Robinson) to identify the shady figure who’s been managing the finances of arms dealers, mobsters, and the world’s other most-wanted criminals. And then he incorporates two separate flashback tracks via which the audience slowly comes to understand how Wolff got to be the way he is, one revealing his extremely complicated childhood (tough love doesn’t come any tougher than the boot camp Wolff’s dad puts him through) and the other, a life-changing stint in Leavenworth, where a disgraced mob accountant (Jeffrey Tambor) teaches his autistic young protégé the secrets of money laundering.

Actually, there’s a fifth track woven in for good measure, one involving another equally ruthless assassin, Brax (Jon Bernthal), moving in parallel with Wolff, and seemingly one step ahead of him the whole way. To call this structure complex would be an understatement. Instead, King offers another analogy: “Do you like puzzles?” he asks agent Medina, a woman with her own secrets (secrets that, frankly, aren’t so interesting or relevant, but represent the script’s commitment to creating surprising and multi-faceted characters, even as they spout dialogue that sounds like it ought to be contained in comic-book talk bubbles). “The Accountant” is nothing if not a puzzle — not so much a jigsaw as a three-dimensional brain teaser that gets deeper and stranger with each new revelation.

In the middle of it all is Affleck, an actor whose ultra-low-key demeanor works to the role’s advantage. Here, instead of being asked to emote, he plays an expressionless math prodigy who can multiply big numbers in his head; does his computing with dry-erase markers, “A Beautiful Mind”-style, on big glass windows (the most cinematographic way to do math); and occasionally shoots people point-blank in the temple without even the slightest change in pulse. This cold-blooded latter tendency really seems to satisfy a certain segment of the audience these days, drawing impressed “ooohs” during an advance screening hosted by Beyond Fest in L.A., and yet it represents a troubling new trend in action movies — one in which lethal efficiency is something to be celebrated. It’s the way Daniel Craig’s 007 does business, disposing of life as if … well, as if life were disposable.

The already-plausibility-straining movie offers Wolff a chance at redemption: Dana Cummings (Anna Kendrick), Living Robotics’ in-house accountant, a chipper finance enthusiast who has no idea that her discovery will make her a target for elimination. Wolff, who seems entirely incapable of romance, thaws just enough to reorganize his plans in order to protect her.

Kendrick (following this year’s “Mr. Right”) finds herself once again making excuses for a sociopathic would-be boyfriend. She’s not terribly convincing as an accountant, but she’s certainly adorable, and she brings a much-needed dose of humanity to a film in which everyone else could be described as “living robotics.”

Even the score boasts a strangely mathematical dimension (but then, most music does), building ominous, electronic momentum beneath the increasingly tense proceedings, which lead to the sort of “he’s coming for you” showdown that makes movies like “John Wick” so guiltlessly satisfying. O’Connor lends a mysterious, ’70s-movie edge to the proceedings, enlisting DP Seamus McGarvey to shoot on 35mm, which, coupled with filters that bathe everything in bronze and blue tones, provide deep, inky shadows in which the characters’ secrets seem to hide.

None of it seems all that far removed from world of Batman, at least not the one envisioned by Christopher Nolan, and we can hope that, when Affleck gets around to directing his own chapter of the Dark Knight saga, it will be as well-constructed and focused as this film. In the meantime, there should be enough common DNA here to appease fans: Simmons may as well be this movie’s Commissioner Gordon, while Wolff’s backstory reveals a tortured vigilante who may as well be wearing a cape and costume, but instead feels most comfortable in his wireframe glasses and pocket protector.