omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / seed / semhash / cases / inv_alpha.om
| 1 | om2 |
| 2 | note semhash fixture: the base unit every case is diffed against |
| 3 | const lim ulong 7 |
| 4 | global buf uchar 16 |
| 5 | struct pt px uint py uint end |
| 6 | layout lay 8 |
| 7 | field fa uchar at 0 little |
| 8 | field fb ushort at 1 little |
| 9 | end |
| 10 | fn leaf m ulong k ulong to ulong |
| 11 | ret add m k |
| 12 | end |
| 13 | fn mid xx ulong to ulong |
| 14 | yy = leaf xx 3 |
| 15 | ret mul yy 2 |
| 16 | end |
| 17 | fn top k ulong to ulong |
| 18 | z = mid k |
| 19 | ret add z 1 |
| 20 | end |
| 21 | fn other w ulong to ulong |
| 22 | ret xor w 5 |
| 23 | end |
| 24 | fn psub lhs ulong rhs ulong to ulong |
| 25 | ret sub lhs rhs |
| 26 | end |
| 27 | fn useconst val ulong to ulong |
| 28 | ret add val lim |
| 29 | end |
| 30 | fn useglob j ulong to ulong |
| 31 | put buf 0 uchar j |
| 32 | ret len buf |
| 33 | end |
| 34 | fn callargs uu ulong to ulong |
| 35 | ret psub uu 2 |
| 36 | end |
| 37 | fn rdlay cc view lay ii ulong to ulong |
| 38 | ret ulong get cc ii |
| 39 | end |
| 40 | fn sumpt s view pt to ulong |
| 41 | w = ulong get s px |
| 42 | ret add w ulong get s py |
| 43 | end |
| 44 | fn iseven m ulong to bool |
| 45 | if eq m 0 |
| 46 | ret true |
| 47 | end |
| 48 | ret isodd sub m 1 |
| 49 | end |
| 50 | fn isodd k ulong to bool |
| 51 | if eq k 0 |
| 52 | ret false |
| 53 | end |
| 54 | ret iseven sub k 1 |
| 55 | end |
| 56 | fn main to int |
| 57 | arr = new uchar 8 0 |
| 58 | put arr 1 9 |
| 59 | pp = new pt 3 4 |
| 60 | acc = add top 1 other 2 |
| 61 | acc = add acc psub 9 4 |
| 62 | acc = add acc useconst 1 |
| 63 | acc = add acc useglob 2 |
| 64 | acc = add acc callargs 5 |
| 65 | acc = add acc rdlay arr 1 |
| 66 | acc = add acc sumpt pp |
| 67 | if iseven acc |
| 68 | acc = add acc 64 |
| 69 | end |
| 70 | ret int rem acc 251 |
| 71 | end |