cprime.ssa (1899B)
1 # generated by Andrew Chambers' 2 # compiler from the C program 3 # following in comments 4 5 export 6 function w $main() { 7 @start 8 %v0 =l alloc8 4 9 %v1 =l alloc8 4 10 %v2 =l alloc8 4 11 %v3 =l alloc8 4 12 %v4 =l alloc8 4 13 storew 5, %v1 14 storew 11, %v2 15 storew 12, %v3 16 @L0 17 %v5 =w loadw %v1 18 %v6 =w cnew %v5, 201 19 jnz %v6, @L8, @L1 20 @L8 21 storew 1, %v4 22 %v7 =w loadw %v3 23 %v8 =w rem %v7, 2 24 %v9 =w ceqw %v8, 0 25 jnz %v9, @L9, @L5 26 @L9 27 storew 0, %v4 28 @L5 29 storew 3, %v0 30 @L2 31 %v10 =w loadw %v0 32 %v11 =w loadw %v3 33 %v12 =w csltw %v10, %v11 34 jnz %v12, @L10, @L3 35 @L10 36 %v13 =w loadw %v3 37 %v14 =w loadw %v0 38 %v15 =w rem %v13, %v14 39 %v16 =w ceqw %v15, 0 40 jnz %v16, @L11, @L4 41 @L11 42 storew 0, %v4 43 jmp @L3 44 @L4 45 %v17 =w loadw %v0 46 %v18 =w add %v17, 2 47 storew %v18, %v0 48 jmp @L2 49 @L3 50 %v19 =w loadw %v4 51 jnz %v19, @L12, @L6 52 @L12 53 %v20 =w loadw %v3 54 storew %v20, %v2 55 %v21 =w loadw %v1 56 %v22 =w add %v21, 1 57 storew %v22, %v1 58 @L6 59 %v23 =w loadw %v3 60 %v24 =w add %v23, 1 61 storew %v24, %v3 62 jmp @L0 63 @L1 64 %v25 =w loadw %v2 65 %v26 =w cnew %v25, 1229 66 jnz %v26, @L13, @L7 67 @L13 68 ret 1 69 @L7 70 ret 0 71 @end 72 ret 0 73 } 74 75 # int 76 # main() 77 # { 78 # int i, n, p, next, isprime; 79 # 80 # n = 5; 81 # p = 11; 82 # next = 12; 83 # while(n != 201) { 84 # isprime = 1; 85 # if(next % 2 == 0) { 86 # isprime = 0; 87 # } else { 88 # for(i = 3; i < next; i = i + 2) { 89 # if(next % i == 0) { 90 # isprime = 0; 91 # break; 92 # } 93 # } 94 # } 95 # if(isprime) { 96 # p = next; 97 # n = n + 1; 98 # } 99 # next = next + 1; 100 # } 101 # if(p != 1229) 102 # return 1; 103 # return 0; 104 # }