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 / qualification / security673 / relational / evidence / run4 / bindings / 12.src
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note Mechanical whole-artifact byte containment, not translation or policy validation. |
| 3 | text good "PASS exact raw function occurs once in native ELF\n" |
| 4 | fn load b edit uchar 1048576 k ulong to ulong |
| 5 | p = new uchar 4096 0 |
| 6 | z = argread k p 0 4096 |
| 7 | if le z 0 |
| 8 | exit 90 |
| 9 | end |
| 10 | fd = fopen p 0 ulong z 0 0 |
| 11 | if lt fd 0 |
| 12 | exit 91 |
| 13 | end |
| 14 | n = ulong 0 |
| 15 | while lt n 1048576 bound 100000 |
| 16 | z = read int fd b n sub 1048576 n |
| 17 | if lt z 0 |
| 18 | exit 92 |
| 19 | end |
| 20 | if eq z 0 |
| 21 | break |
| 22 | end |
| 23 | n = add n ulong z |
| 24 | end |
| 25 | z = fclose int fd |
| 26 | if or ne z 0 eq n 1048576 |
| 27 | exit 93 |
| 28 | end |
| 29 | ret n |
| 30 | end |
| 31 | fn same a view uchar 1048576 b view uchar 1048576 p ulong n ulong to bool |
| 32 | for i ulong n |
| 33 | if ne get a i get b add p i |
| 34 | ret eq ulong 0 1 |
| 35 | end |
| 36 | end |
| 37 | ret eq ulong 0 0 |
| 38 | end |
| 39 | fn main to int |
| 40 | if ne argcnt 3 |
| 41 | ret 90 |
| 42 | end |
| 43 | a = new uchar 1048576 0 |
| 44 | b = new uchar 1048576 0 |
| 45 | an = load a 1 |
| 46 | bn = load b 2 |
| 47 | if or eq an 0 gt an bn |
| 48 | ret 61 |
| 49 | end |
| 50 | hits = ulong 0 |
| 51 | for p ulong add div sub bn an 4 1 |
| 52 | if same a b mul p 4 an |
| 53 | hits = add hits 1 |
| 54 | end |
| 55 | end |
| 56 | if ne hits 1 |
| 57 | ret 61 |
| 58 | end |
| 59 | z = write 1 good 0 len good |
| 60 | if ne z long len good |
| 61 | ret 94 |
| 62 | end |
| 63 | ret 0 |
| 64 | end |