When Jamie Masada was a young kid, growing up poor and Jewish in Iran, his father told him that, because he had been a good boy, he would take the son to see a moving picture.

Masada didn’t know what that meant, but he went with his father to the shopping district at night. They they sat in front of a store after it had closed, but its window was full of small black-and-white television sets. And it was there, perched on his dad’s lap, that Masada was introduced to “The Three Stooges” on TV.

He couldn’t hear the jokes’ set-ups and punchlines, so his dad made up the story for him. He also knew immediately that what he was watching was funny — so funny that he wet his pants from laughter.

As he celebrates the 40th anniversary of the Laugh Factory, founder Masada still remembers what his dad said to him that night: “The greatest thing you could do for any man is to bring a smile to their faces.”

Masada immigrated to the United States by himself as a teenager with dreams of becoming a comedian.

It turns out that Masada’s love of comedy was better served behind the scenes. With the help of a loan from a friend, he launched the Laugh Factory in 1979 when he was 16. It was originally called Joke on Yolk. One night, Masada was walking in the rain and had an epiphany: “Oh my God. This building’s a factory. We’re making people laugh. That’s a laugh factory.”

A strong business sense has allowed that iconic Sunset Boulevard comedy house to endure for 40 years.

Still, Masada doesn’t want to suggest that he built his empire overnight. In the early years, he and his friends would sleep on the club’s chairs after closing, rising the next day to meander to a nearby YMCA for a shower.

Nor was it all on his own. “A lot of people helped me through it, from early comedians, from managers, everybody came in,” he says.

He also joined the industry at a fortuitous time. During that era, the only other major players in town were Mitzi Shore’s the Comedy Store and Budd Friedman’s L.A. chapter of The Improv. Neither paid comedians, and in 1979 boycotts and a strike ensued (since the latter was closed for repairs in 1979, most of the aggression was directed toward the Comedy Store).

Masada, the fresh-faced kid on the block, offered to pay stand-ups a portion of his cover charges. “Jamie was a particularly young standup comic wannabe back in the middle-to-late ’70s when the Comedy Store was at its then-peak and he was like a little brother to the Robin Williams and Jay Leno and David Letterman group of people,” says journalist William Knoedelseder, who covered the strike. He wrote “I’m Dying Up Here: Heartbreak and High Times in Stand-Up Comedy’s Golden Era,” which served as a source for the Showtime drama.

“He didn’t know anything about running a place, but from what he’d seen going on and what everybody was upset about, he knew how not to run it.”

Knoedelseder says this move was “ultimately revolutionary” because Masada found himself “facing off against the premier comedy club in the country.”

The strategy worked and soon the Laugh Factory’s stage was booked. Paul Mooney emceed on opening night, bringing out a surprise guest: Richard Pryor who, pursuant to his own guidelines, Masada tried to pay. The comedy legend, however, wouldn’t take Masada’s payment and instead opened his wallet to show that it was full of $100 bills — such a high number that Masada assumed they were forged.

As the years rolled on, the Laugh Factory expanded into other markets including Las Vegas and Scottsdale, Ariz., and became home to many major names in the comedy circuit.

Dane Cook and Dave Chappelle are regulars at the main location and each is known for hours-long sets. Cook currently holds the record, offering up seven hours and 34 minutes of material in January 2008.

Part of the club’s allure is the space itself. “The Laugh Factory is the best comedy room in L.A., without a doubt, for reasons of logistics,” says veteran comedian Tom Dreesen. “It has a low ceiling and comedians love a low ceiling. It’s intimate and they’re all in front of you. And the laughter hits the ceiling when it comes at you. So it’s a real good room to break in new material.”

The Laugh Factory is also known for its diversity both on stage, where themed nights featuring Latinx and Asian or Asian-American performers are common.

“The energy is just brighter,” says comedian-actress Tiffany Haddish, whose relationship with Masada and the Laugh Factory dates back to when she was a member of Comedy Camp, the summer program geared toward helping underprivileged kids find their voices.

Masada’s empire may have also persevered because it seemingly never lost that outsider mentality. Tim Allen was a road comic and largely unknown in Los Angeles when he began performing at the Sunset Boulevard location in the 1980s.

Even though the Laugh Factory was in Hollywood, Allen says it felt as much as if it were on the outskirts of entertainment as the Ice House in Pasadena.

“Jamie’s [place] felt pretty much like I felt. I was outside the system here because I was a road comic and it was very challenging to adjust your comedy to three-to six-minute sets as opposed to [when] I had to fill up sometimes as much as 45 minutes early on in my career on the road.”

This isn’t to say that the Laugh Factory has been immune to scandals. Most notably, the Sunset Boulevard location was where Michael Richards had a racially charged outburst while he was on stage in November 2006.

Masada, who was in the club that night, went into crisis management mode and offered to refund audience members’ cover charges. After the incident, he attempted to fine and ban comics who used the n-word in their routines.

(Damon Wayans used it in a 20-minute set that December, arguing, “I’ll be damned if the white man uses that word last.” He paid the club $320, which was then donated to charity, and was forbidden from performing there for three months. He came back a month later).

“The stage is a sanctuary for comedians,” says Masada. “We have to respect that. If we start telling people what they can do and what they cannot do, that’s where we go wrong and that’s where we’re going to have a problem with creative people.”

Masada plans to expand his clubs in the U.S. and abroad, including Israel. He has a show in development with Warner Bros. Television subsidiary Telepictures, although the company was mum on specifics.

So what does Masada find funny? Turns out it’s still the Three Stooges. “Sometimes if I’m depressed or something, I put the same Three Stooges on and I’ll put it on mute,” Masada says. “I’ll hear the story my dad made up.

“My dad’s story was much funnier, actually, to me at that point.”