kit

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

ctl_for.c (351B)


      1 /* A simple counted for loop. The volatile bound keeps the loop real (no
      2  * unrolling to a constant) so the loop back-edge branch and the loop-exit
      3  * compare/branch round-trip through `as`. Sum 0+1+..+8 = 36, +6 = 42. */
      4 int test_main(void) {
      5   volatile int n = 9;
      6   int sum = 0;
      7   for (int i = 0; i < n; i++) {
      8     sum += i;
      9   }
     10   return sum + 6;
     11 }