kit

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

ctl_for_long.c (358B)


      1 /* A 64-bit counted loop: the induction variable and bound are `long`, so the
      2  * loop compare/branch operate on x-registers (64-bit cmp). volatile bound keeps
      3  * the loop real. Sums 0..8 = 36, +6 = 42. Exit code 42. */
      4 int test_main(void) {
      5   volatile long n = 9;
      6   long sum = 0;
      7   for (long i = 0; i < n; i++) {
      8     sum += i;
      9   }
     10   return (int)(sum + 6);
     11 }