In “The Accountant” director Gavin O'Connor mixes fighting, family and crime. Ben Affleck plays Christian Wolff, a bean-counting killing machine.

Ben Affleck has a lot of numbers and bad guys to crunch in his new thriller “The Accountant.” He plays Christian Wolff, a bean-counting killing machine whose mix of brains and brawn rival those of Jason Bourne, the amnesiac assassin played by Affleck’s BFF, Matt Damon. Both kick butt and take names later. It’s a fun barroom debate: Who would win a fight between the two characters?

“I think it’s a no-brainer,” said “Accountant” director Gavin O’Connor. “If I was Bourne, I wouldn’t want to get in the ring with Christian Wolff.”

So, how about Wolff versus Affleck’s Spandexed alter-ego Batman? After all, the Caped Crusader did (*spoiler alert*) kill the Man of Steel.

“Ben was asked this the other day,” O’Connor said laughing, while discussing the film Wednesday morning in a lounge at the Ritz-Carlton in Boston. “He gave a good non-answer about Batman, but Jason Bourne was getting squashed like a bug.”

“The Accountant,” which opens Friday, casts Affleck as a highly functioning autistic CPA armed with a pocket protector, spreadsheets and an arsenal of assault weapons. He’s not just any old accountant. Wolff is the go-to guy to cook the books for major criminal outfits (think: Gambino family). When he gets wind that a treasury agent (J.K. Simmons) is hot on his heels, Wolff cleans up his act and lands a legitimate client at a robotics company where an accounting clerk (Anna Kendrick) discovers a discrepancy involving millions of dollars.

O’Connor directs the film from a screenplay by Bill Dubuque (“The Judge”) that is full of twists and turns. Every character (it also stars Jeffrey Tambor, Jon Bernthal, John Lithgow and Cynthia Addai-Robinson) has something to hide.

“It’s a roller-coaster ride,” O’Connor said. “There is a lot to figure out.”

The movie is definitely a puzzle, but O’Connor said he knew his marching orders from the start: “I told myself I wanted to make a fun movie.”

And that started with Affleck.

“There were two trains running for Ben in this film. One track was the spectrum part and the other track was the physical,” O’Connor said.

Affleck started on “The Accountant” as soon as he wrapped “Batman v. Superman” last year.

“Ben came in bigger than I wanted him to be,” O’Connor said. “He lost a little bit of weight, but was in good shape. The first thing I said to Ben was, ‘You just can’t show up on day one and play somebody that’s on the spectrum. It’s going to require a lot of work, research, investigation and exploration, and I just need to know you are willing to do that.’ He was like ‘I’ll do whatever you want me to do.’”

Affleck and O’Connor were diligent in their prep work, meeting with educators and specialists. They also spent hours at Exceptional Minds, a school in Los Angeles for young adults with autism.

“They opened up their lives to us,” O’Connor said. “All the nuance and behavioral details in Ben’s character was built off them. We approached the character with accuracy, honesty and authenticity.”

Affleck, like Damon in the Bourne films, does most of his own stunts. He spent months training in pencak silat, an Indonesian style of fighting.

“It is very efficient, and flashy,” O’Connor said. “I kept thinking Christian is going to approach every obstacle mathematically, and think, ‘What’s the fastest way to eliminate someone?’ He’s going to do the math on it like that. I wanted Christian to have a fighting style that’s very specific to him and the way his father raised him.”

You might not expect it, but there is a strong parenting theme in “The Accountant.” Early in the film, Christian’s parents visit a bucolic neuroscience residence in New Hampshire that Mom wants to enroll her son in. Dad (Robert C. Treveiler), a strict military man, believes Christian shouldn’t hide from the world because it’s not “a sensory-friendly place.”

“Parenting is not for perfectionists,” said O’Connor, who has a stepdaughter in addition to a baby on the way. “I was driving toward this idea that every decision his father makes comes from a place of love. Back then, no one knew a lot about the spectrum. He thought a lot of this sounded like hocus-pocus. He was doing what he thought was best. It could be a cold cruel world for a kid like Christian Wolff, so his father was strict, tough and taught him to fight.”

With its mix of fighting, family and crime, “The Accountant” fits firmly in O’Connor’s wheelhouse. His first wide release was the charming and touching mother-and-daughter road picture “Tumbleweeds,” which earned British stage vet Janet McTeer an Oscar nomination. O’Connor, 52, also directed the sports flick “Miracle,” about the underdog 1980 U.S. Olympic hockey team that knocked off the mighty Soviet Union. In 2011, O’Connor directed Nick Nolte to a supporting actor Oscar nomination in “Warrior,” the well-received mixed-martial arts drama that co-starred Tom Hardy and Joel Edgerton. Other credits include “Pride and Glory,” about crooked cops, and the recent Western “Jane Got a Gun,” starring Edgerton and Natalie Portman.

O’Connor also directed the first episode of the acclaimed FX drama “The Americans,” and he’s set to direct a Netflix series with Veena Sud, the creator of “The Killing.” But on this day, his next stop is Philadelphia to host a screening for college students before heading to Washington, D.C., and back to Los Angeles for the red-carpet premiere of “The Accountant.”

Dana Barbuto may be reached at dbarbuto@ledger.com or follow her on Twitter @dbarbuto_Ledger.