diff options
Diffstat (limited to 'c/squares/squares.c')
| -rw-r--r-- | c/squares/squares.c | 169 |
1 files changed, 169 insertions, 0 deletions
diff --git a/c/squares/squares.c b/c/squares/squares.c new file mode 100644 index 0000000..435ddff --- /dev/null +++ b/c/squares/squares.c @@ -0,0 +1,169 @@ +/* This is a translation of squares.b, generated by bftoc.py (by Paul Kaefer) + * It was generated on Friday, May 15, 2026 at 07:20PM + */ + +#include "rvcontroller-ecalls.h" + +void main(void) +{ + int size = 1000; + int tape[size]; + int i = 0; + + /* Clearing the tape (array) */ + for (i=0; i<size; i++) + tape[i] = 0; + + int ptr = 0; + + tape[ptr] += 4; + while (tape[ptr] != 0) + { + ptr += 1; + tape[ptr] += 5; + ptr -= 1; + tape[ptr] -= 1; + } + ptr += 1; + while (tape[ptr] != 0) + { + ptr -= 1; + tape[ptr] += 5; + ptr += 1; + tape[ptr] -= 1; + } + tape[ptr] += 1; + ptr -= 1; + tape[ptr] += 1; + while (tape[ptr] != 0) + { + ptr += 1; + while (tape[ptr] != 0) + { + ptr += 1; + tape[ptr] += 1; + ptr += 1; + tape[ptr] += 1; + ptr -= 2; + tape[ptr] -= 1; + } + tape[ptr] += 2; + ptr += 2; + while (tape[ptr] != 0) + { + ptr -= 2; + tape[ptr] += 1; + ptr += 2; + tape[ptr] -= 1; + } + ptr += 3; + while (tape[ptr] != 0) + { + tape[ptr] -= 1; + } + tape[ptr] += 2; + ptr += 1; + while (tape[ptr] != 0) + { + tape[ptr] -= 1; + } + tape[ptr] += 1; + ptr += 3; + tape[ptr] += 1; + while (tape[ptr] != 0) + { + while (tape[ptr] != 0) + { + tape[ptr] -= 1; + } + tape[ptr] += 6; + ptr += 3; + } + ptr -= 3; + while (tape[ptr] != 0) + { + while (tape[ptr] != 0) + { + ptr -= 1; + tape[ptr] += 8; + ptr -= 1; + tape[ptr] += 2; + ptr += 2; + tape[ptr] -= 1; + } + tape[ptr] += 1; + ptr -= 1; + printchar(tape[ptr]); + ptr -= 1; + while (tape[ptr] != 0) + { + ptr += 1; + tape[ptr] -= 4; + ptr -= 1; + tape[ptr] -= 1; + } + ptr -= 1; + } + ptr -= 2; + while (tape[ptr] != 0) + { + ptr += 5; + while (tape[ptr] != 0) + { + ptr += 3; + while (tape[ptr] != 0) + { + tape[ptr] -= 1; + } + tape[ptr] += 9; + ptr -= 1; + while (tape[ptr] != 0) + { + ptr += 1; + tape[ptr] -= 1; + ptr -= 1; + tape[ptr] -= 1; + } + tape[ptr] += 9; + ptr += 1; + while (tape[ptr] != 0) + { + tape[ptr] -= 1; + while (tape[ptr] != 0) + { + ptr -= 1; + tape[ptr] -= 1; + ptr += 1; + tape[ptr] -= 1; + } + tape[ptr] += 1; + while (tape[ptr] != 0) + { + ptr -= 3; + } + } + ptr -= 1; + while (tape[ptr] != 0) + { + ptr += 1; + tape[ptr] += 1; + ptr -= 1; + tape[ptr] -= 1; + } + ptr += 1; + } + ptr -= 2; + tape[ptr] -= 1; + } + ptr -= 2; + tape[ptr] -= 1; + } + while (tape[ptr] != 0) + { + printchar(tape[ptr]); + printchar(tape[ptr]); + printchar(tape[ptr]); + } + +} + |
