I'm a faculty in CMU's School of Computer Science, and wanted to share a few quick things. Please note that these are my solely my personal opinions.

First, as you note, CMU is incredibly competitive. Here are some stats for students admitted to CompSci last year (taken from https://admission.enrollment.cmu.edu/pages/school-of-compute...).

Average Unweighted GPA:3.96
SAT Middle 50% for Evidence-Based Reading & Writing: 750-800
SAT Middle 50% for Math: 790-800

We have applicants with perfect SAT scores that aren't admitted. The problem is that, past a certain level, there are so many qualified applicants, and no university can accept all of them.

Second, as an Asian-American myself, I have some mixed feelings about affirmative action, but over the years have leaned more towards it. One reason is that grades are a useful predictor but only one of many of how well people will do in university and in life. Take a look at Terman's Termites, and how his testing of young students missed future Nobel Prize winners, and how many of the termites just ended up being average. Another is equity issues. There really are underrepresented minorities that have overcome a lot given where they started, but don't have as high test scores. There are also cohort issues, where dropout rates of underrepresented minorities is higher if they don't have as many peers or role models. There are also pragmatic issues, with young men (mostly Caucasian and Asian-American) dominating in Silicon Valley, leading to real blindspots in product design (basically, people tend to design things for others like themselves) as well as the gender issues at large tech companies that have been in the news (I'd recommend reading what Teresa Meng had to say about this at a conference keynote, especially since she's a superstar in her field https://www.eetimes.com/an-engineers-guide-to-sexism/). Also, pragmatically, if there is a difference in grades and test scores between men and women admitted to our CS program, I haven't seen it in students' actual performance once they are here, and I've taught 1000+ students over the past 15+ years.

Third, this is just N=1, but I was not accepted to my preferred undergrad colleges (possibly because of some affirmative action issues), and was only accepted to two PhD programs (Georgia Tech and Berkeley). I'm now a top scholar in my area of research, along with having founded a successful startup. And I still get rejections all the time, for research papers, grant proposals, and awards. In fact, talking to a lot of my fellow professors, they all have stories about significant past failures. One even has his letter of rejection from CMU's PhD program posted on his door.

Yeah, your situation bites. Give yourself a few days to process things, then dust yourself off and get back up to figure out what you're going to do next. You're going to get knocked down a lot in life, and (systemic issues aside) a big difference between people who can really make it and those who don't is being able to deal with that failure and keep moving forward. Also, keep in mind that really good scholars will still succeed regardless of where they go for undergrad. Take a look at the undergrad schools of various successful folks in CompSci, you might be surprised. And if PL is what you're really into, grad school will matter far more than undergrad.

And last, I'd also recommend this article (below) from New York Magazine, asking about why success for Asian-Americans tends to end after school. There's a lot of raw anger in the writing, but I think it will resonate with you, and hopefully give you some good food for thought.
https://nymag.com/news/features/asian-americans-2011-5/

Good luck!