Jonah Hill was sitting in a restaurant recently when two young men approached him, introduced themselves as South African arms dealers, and said, “We can’t wait to see your movie.”

“They gave me a fist bump,” Hill recalled, slightly chagrined. “I didn’t want a fist bump. I got this a lot with ‘The Wolf of Wall Street,’ too, a lot of kind of bro-ey stock market people. They don’t see that I’m not displaying full support, you know what I mean?”

In other words, just because something is the subject of a movie doesn’t mean it’s OK, which is certainly true of “War Dogs,” opening Aug. 19 and starring Hill and Miles Teller. The fact-based dramatic comedy is about two young Miami Beach entrepreneurs and their multimillion-dollar career as proxy gun runners for the U.S. government. It really happened, as first recounted by Guy Lawson in a 2011 Rolling Stone story. Which naturally makes it a much better film.

“Sometimes you read an article and say ‘This feels like a movie,’ ” said director Todd Phillips. “And then you unwind it a little and say, ‘This was meant to be an article.’ The more we looked at Guy’s article, it just became more and more of a movie.”

In the early 2000s, using a shell company called AEY, Efraim Diveroli (Hill) and David Packouz (Teller) used a Bush-administration procurement loophole to sell weapons to foreign governments, eventually landing a $300 million contract to help arm the Afghan military. What happens to them, ultimately, is the stuff of John LeCarre, broken bromance and Buster Keaton.

Movies about eager underdogs making illicit fortunes are delicious, of course. “I love those kinds of movies, too,” said Phillips, though he agreed that there’s always going to be some kind of payback — though not always via the U.S. government.

advertisement | advertise on newsday

“They did do something illegal: They repackaged the ammo and sold it as something else,” Phillips said of Diveroli and Packouz: As part of their weapons business, the partners locate 100 million rounds of ammunition in Romania, but then find out it was all made in China — which renders it illegal to send to Afghanistan as U.S. aid. So they unwisely improvise. Which makes them, among other things, fodder for Phillips.

“I like making movies about guys making bad decisions,” he said, “because bad decisions usually lead to mayhem and I like documenting mayhem. Even in ‘The Hangover,’ they make bad decisions, but in those movies it brings them together. In ‘Old School,’ which I did, it also brings them together. In this movie, it pulls them apart, primarily because of greed. But it’s interesting, the effect that has on people.”

“This is really a millennial story in a lot of ways,” said Lawson, whose 2015 book, “Arms and the Dudes: How Three Stoners from Miami Beach Became the Most Unlikely Gunrunners in History,” expanded on his magazine article. The internet, he said, gave the young men access to information in a way that would have been unheard of years ago. “They got themselves into places that a generation before they never would gotten. . . . [And] they don’t respect boundaries in the way prior generations did.”

“They didn’t have as much to lose,” said Teller, whose character is the conscience of the movie. He said their youth gave the pair an edge. “They had bravado . . . and ignorance.”

Lawson added that he was pleased at how much journalism is in the movie.

“There are a lot of important issues being brought to the world about America’s role in proliferating weapons, the lack of responsibility of people in authority in this country: The torture program is, of course, the fault of Abu Ghraib prison guards; the NSA surveillance is Edward Snowden’s fault; and the proliferation of weapons is these kids’ fault. It’s ridiculous. There are never any consequences, never any lessons learned.”

Phillips, whose forte is, of course, comedy, said that to leave politics out of the film would not only have been hard to do but “probably a disservice to this story.” A reporter had asked him whether he was concerned that the movie would “spawn copycats” — inspire young people to go into the arms trade. He said she misread the message.

“It’s an indictment of the government and the lack of checks and balances at the Pentagon,” Phillips said. “Bradley Cooper [playing a longtime arms dealer] says in the movie, ‘The government wants to look the other way. Don’t give them a reason not to.’ That’s the whole movie.”

advertisement | advertise on newsday

There’s also acting, of course, and a good deal of comedy, much of it courtesy of Hill, who must have gained 60 pounds to play Diveroli, but has since dropped it.

“He was going for a Jewish Tony Soprano and by that I mean swagger and confidence,” said Phillips. “I’ve never met Efraim; I’m not sure he has the swagger Jonah has, certainly not that laugh. Certain actors find their characters through wardrobe or hair or the way a character walks. Jonah came to me and said, ‘I think I figured out this guy’s laugh.’ And it was dead on.”