kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

ctl_ifelse.c (414B)


      1 /* if/else chain compiled to intra-function conditional branches. volatile
      2  * input defeats constant folding so the comparisons + branches are really
      3  * emitted; the branch labels round-trip through `as`. Exit code 42. */
      4 int test_main(void) {
      5   volatile int x = 2;
      6   int r;
      7   if (x == 0) {
      8     r = 10;
      9   } else if (x == 1) {
     10     r = 20;
     11   } else if (x == 2) {
     12     r = 42;
     13   } else {
     14     r = 99;
     15   }
     16   return r;
     17 }