Kumail Nanjiani, the Pakistani-American comic best known for “Silicon Valley,” revisits one of the most painful chapters of his personal life in “The Big Sick.” The comedy has its premiere Friday night at Sundance, and sight unseen, the buzz is so loud that it is expected to inspire one of the biggest bidding wars of the festival.

“The Big Sick” was written by Nanjiani and his wife, Emily V. Gordon. It recounts their romance and the challenges it faced when Gordon suffered a medical crisis. It also deals with the cultural differences between the pair, as Nanjiani’s conservative Muslim family expected him to enter into an arranged marriage.

Nanjiani was mentored throughout the process by Judd Apatow, the “Knocked Up” director who produces alongside Barry Mendel. It marks his first leading role, one that forced the standup comic to take acting classes. Ahead of the film’s premiere, Nanjiani spoke to Variety about working with Apatow, the movies that inspired him, and Hollywood’s portrayal of Muslims.

How much of the film is autobiographical?

I can’t really put a percentage on it, but it’s definitely very, very heavily based on stuff that really happened.

How did you get the idea to turn this personal story into a film?

Once it was done and a little bit of time had passed both Emily and I realized this is a very big important story to our lives, but it’s also is an actual story. It naturally lends itself to a film or some format like that. We always knew that this was a story we were going to tell at some point in our lives. You have to find that sweet spot where it’s been enough time where it’s not crippling to think about, but also not so much time that you don’t feel the feelings.

When you were shooting scenes did all the emotions you felt from the experience come back to you?

I was surprised by how much it did feel like reliving it.

What advice did Judd Apatow give you?

He said if there are scenes that you’re putting off writing it means that those are scenes that you feel a lot of emotions about and you’re afraid to revisit. He was like, that means there’s all the more reason to do it. When you hit those walls, you kind of just have to bust through them.

A big reason my parents weren’t super open to Emily being my girlfriend was religion, and I just was avoiding it because I was scared to think about it. I also just didn’t know what I had to say about religion. I’m not a guy who has a grand statement to make about religion. He was the one who said, “You don’t have to make a grand statement, you just have to talk about how you feel about it. It can be confused and it can be messy. You don’t have to have answers. It’s just important that the questions are asked.”

You’ve faulted Hollywood for its narrow portrayal of Muslims. Do you hope this film shows a different type of Muslim character?

I wouldn’t say that I made this movie to get a different portrayal of a Muslim family, but I knew that if the movie was successful in doing what we wanted it to do, people would see a Muslim family from a perspective that we don’t usually see it.

Emily had this idea where she wanted to start a blog called “Muslims having fun.” A Tumblr where you go to a theme park and you see like Muslims riding roller coasters or Muslims eating popsicles or Muslims hula hooping and stuff. I feel like we’ve got to the point where there really is one visual that people get in their heads when they think of Muslims, so it wasn’t like I made this movie to change the way people think about Muslims, but for the movie to be good as a movie it would have to portray a Muslim family in a way that doesn’t sort of jive with the visual that I think most people have in their heads when they think about a Muslim family.

Many people in this country fear Muslims and President Donald Trump has pushed for a Muslim travel ban. Do you hope this film will counteract prejudices and change minds?

I don’t know. When I try to think about that I get a little overwhelmed because the context in which we made the movie and the context in which we’ve shown the movie to audiences has changed. I think people will now see the movie in a different context. So I don’t know what changes people’s minds and hearts about certain things. I don’t assume to know where prejudices come from and I don’t assume to know how you can combat those prejudices. I do hope that many different types of people watch this movie and like it. It’s not a message movie. This is not a movie where the point is: Look at Muslims, they’re just like you. That’s not the point of it. You can hope all kinds of things, but it seems premature to be like — this is the movie that finally turns people around on Muslims.

Were there films that inspired “The Big Sick”?

I watched a lot of movies that you don’t see as much anymore. Movies like “Tootsie” or “Broadcast News,” movies that are very, very funny, but also very emotional and very dramatic. Instead of finding middle ground between comedy and drama, they hit peaks on both of those areas. We drew a lot on movies that don’t sit between genres, they occupy both genres at the same time. A lot of times comedy-dramas mean that it’s not as funny as a comedy and they’re sort of in the middle without being both extremes.

Why don’t we see movies like “Tootsie” or “Broadcast News” anymore?

Now it’s become more and more about [labeling movies]. It’s definitely like — this is a comedy, this is a horror movie, this is a drama. It feels like those movies that defy genres, you just don’t see them as much anymore. I don’t know if it’s an advertising thing or if it’s a thing of how people receive movies where they want to go into a movie knowing what type of movie it is. You go into a movie now knowing what it is, knowing the whole plot, almost knowing whether you’re going to like it or not. There’s so much information right now that walking into a movie as a virgin is very, very rare.

When we did test screenings it was interesting to watch with a crowd and see the crowd try to figure out what kind of movie it is and, at some point, going with the movie rather than trying to label it.

Michael Showalter directs the film, but did you ever think about moving behind the camera on this given your knowledge of the material?

For me, directing this would have been too hard because I’ve never been the lead in a movie and so for me writing this with Emily and acting and making sure I could hit everything was enough. Directing yourself has to be so difficult. I wanted to have someone I could trust to take the reins, so I could focus on my performance.

How did you approach this performance differently?

Until this movie I’d really only done comedic performances. I hadn’t done scenes that were anything different than comedic. I knew, for me, the challenge would be doing more dramatic work. I prepped for this movie for close to a year. I’d never taken any acting classes, but about a year and a half before it seemed like we were getting to the point where we were going to make this movie, I started taking acting classes. I worked with an acting coach going through every single scene and mapping out the arc of each scene and the entire movie.

Do you have any sense of what kind of distributor you want for this movie? Do you want it to be seen theatrically or do you mind if it goes on-demand?

I would personally love to see the movie get a theatrical release. I really think that it’s a movie that a lot of different types of people can like. I want it to get a chance to get in front of a lot of different kinds of audiences.

Have you shown the movie to your families?

Emily’s parents have seen it. They saw it four times in one day. My brother has seen it, but my parents have not yet seen it. I want it to show at Sundance and then I’m going to have them watch it.

I’m a little nervous just in the sense that whenever you show something that you’re very proud of to someone that you’re very close to, you want them to love it. I don’t think that I’m nervous in terms of content or their portrayal or anything. I hope they agree that we did a pretty good job of representing all sides of this. I just hope they like it.

FilmNation Entertainment fully financed “The Big Sick” and is selling rights along with UTA.