Stack Exchange
How to simply this nested code the best ? Note: need to call two different default cases here
if( auto id:{k_b0,k_b1}){
auto baseIndex = 0;
auto count = false;
if(!rmt){
switch(src){
case a: {if(slow) {count = Getconfig(); baseindex =0;} 
         else {count = GetslowConfig(); baseindex =4;}}break;
case b:  {if(slow) {count = Getconfig(); baseindex =0;} 
         else {count = GetslowConfig(); baseindex =4;}}break;
case c: {if(slow) {count = Getconfig(); baseindex =0;} 
         else {count = GetslowConfig(); baseindex =4;}}break;
default : count = GetdefaultConfigone(); break;
}}
else{
switch(src){
case a: {if(slow) {count = Getconfigrmt(); baseindex =1;} 
         else {count = GetslowConfigrmt(); baseindex =5;}}break;
case b:  {if(slow) {count = Getconfigrmt(); baseindex =1;} 
         else {count = GetslowConfigrmt(); baseindex =5;}}break;
case c: {if(slow) {count = Getconfigrmt(); baseindex =1;} 
         else {count = GetslowConfigrmt(); baseindex =5;}}break;
default : count = GetdefaultConfigtwo(); break;
}}
sample(baseindex, count, id);
}

Note: need to call two different default cases here
I have so far tried to use the fall-through switch statement to make this better. Still, this looks terrible. Open to any ideas on how to make this better. P:S I didn't write this code.

Is the shown code actually working? Then you should post on the codereview SE.

It's not my code. I am trying to improve readability here. So I cant post on code review

"Still, this looks terrible." -- Yes, the lack of indentation looks bad. That is what you meant, right?

What is this code supposed to do? Calling it "call two different default cases" does not tell me much, and it does not seem to match your code. (I'd say that your code has two different switch statements.)

Start by using proper variable names that are not single (or few) letters or acronyms - that'll help readability.

If it's not your code, then you need to talk to the original author, because it's actually wrong. It should not even build. Of you made a typo when rewriting it here, instead of copy-pasting a proper [mre]

As for readability, don't try to cram too much onto a single line. One statement per line, one bracket, or brace per line. At most. Figure out a style that fits you best, and configure a tool to automatically reformat it to your personal style.

Without seeing or modifying any of the other code, assuming what you had works, you could do something like:
if (auto id: {k_b0,k_b1}) {
  auto baseIndex = 0;
  auto count = false;
  if (src != a && src != b && src != c) {
    if (!rmt) count = GetdefaultConfigone();
    else count = GetdefaultConfigtwo();
  }
  else {
    if (!rmt) {
      if (slow) { count = Getconfig(); baseindex = 0; }
      else { count = GetslowConfig(); baseindex = 4; }
    }
    else {
      if (slow) { count = Getconfigrmt(); baseindex = 1; }
      else { count = GetslowConfigrmt(); baseindex = 5; }
    }
  }
  sample(baseindex, count, id);
}

Switch statements are great, but they don't seem appropriate here. There is a lot of duplication for which function to call and what to set the baseindex to when it really came down to a few conditions.
The default case is if src is not a, b, or c, and just sets count depending on rmt. You can separate the default at the top.
Then, the case a, b, or c are within the first else. The differences between these were rmt and then slow.
The next improvement I could suggest would be to combine some of these 6 config functions, as I'm sure they have a lot of overlapping similarity. You could then just pass the rmt/slow values in as arguments. To get multiple return values, you can pass baseIndex/count by reference, or use a class/struct.
Finally, I don't see why you use the auto type for something so simple as an int or bool, I think you should explicitly use the actual type. Also, I'm not sure the outer if, if (auto id: {k_b0,k_b1}) is correct.
