summary refs log tree commit diff
path: root/lisc/test
diff options
context:
space:
mode:
Diffstat (limited to 'lisc/test')
-rw-r--r--lisc/test/cprime.ssa35
1 files changed, 35 insertions, 0 deletions
diff --git a/lisc/test/cprime.ssa b/lisc/test/cprime.ssa
index dbc2f72..9b953c4 100644
--- a/lisc/test/cprime.ssa
+++ b/lisc/test/cprime.ssa
@@ -1,3 +1,7 @@
+# generated by Andrew Chambers'
+# compiler from the C program
+# following in comments
+
 @start
 	%v0 =l alloc8 4
 	%v1 =l alloc8 4
@@ -66,3 +70,34 @@
 	ret
 @end
 	ret
+
+# int
+# main()
+# {
+#         int i, n, p, next, isprime;
+#        
+#         n = 5;
+#         p = 11;
+#         next = 12;
+#         while(n != 10001) {
+#                 isprime = 1;
+#                 if(next % 2 == 0) {
+#                         isprime = 0;
+#                 } else {
+#                         for(i = 3; i < next; i = i + 2) {
+#                                 if(next % i == 0) {
+#                                         isprime = 0;
+#                                         break;
+#                                 }
+#                         }
+#                 }
+#                 if(isprime) {
+#                         p = next;
+#                         n = n + 1;
+#                 }
+#                 next = next + 1;
+#         }
+#         if(p != 104743)
+#                 return 1;
+#         return 0;
+# }