aien-train
AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished.
Brought by drakestapleton
aien-train / evidence / ECOSYSTEM6 / attempt-3 / mutate.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-only |
| 2 | note Native source fault injector. Read one ASCII mode byte then affine.om. |
| 3 | note Exactly one match required; write a full modified source for actual compilation. |
| 4 | global Input uchar 65536 |
| 5 | global Mode ulong 1 |
| 6 | text SignNeedle "g = mul32 1073741824 r" |
| 7 | text SignReplace "g = mul32 3221225472 r" |
| 8 | text ShapeNeedle "if or ne get ED 2 rank ne get ED 8 rows\nret -21\nend\nif ne get ED 16 cols\nret -21\nend\nif eq rank 2\nif or ne get ED 9 cols ne get ED 17 1\nret -21\nend\nend" |
| 9 | text ShapeReplace "note MUTANT omits the dimension admission checks" |
| 10 | text UpdateNeedle "afput 1 i add32 afget 1 i xor delta 2147483648" |
| 11 | text UpdateReplace "afput 1 i add32 afget 1 i delta" |
| 12 | |
| 13 | fn size to ulong |
| 14 | if eq get Mode 0 0 |
| 15 | ret len SignNeedle |
| 16 | end |
| 17 | if eq get Mode 0 1 |
| 18 | ret len ShapeNeedle |
| 19 | end |
| 20 | ret len UpdateNeedle |
| 21 | end |
| 22 | |
| 23 | fn patternbyte i ulong to uchar |
| 24 | if eq get Mode 0 0 |
| 25 | ret get SignNeedle i |
| 26 | end |
| 27 | if eq get Mode 0 1 |
| 28 | ret get ShapeNeedle i |
| 29 | end |
| 30 | ret get UpdateNeedle i |
| 31 | end |
| 32 | |
| 33 | fn replacement to void |
| 34 | if eq get Mode 0 0 |
| 35 | n = write 1 SignReplace 0 len SignReplace |
| 36 | if ne n long len SignReplace |
| 37 | exit 74 |
| 38 | end |
| 39 | ret |
| 40 | end |
| 41 | if eq get Mode 0 1 |
| 42 | n = write 1 ShapeReplace 0 len ShapeReplace |
| 43 | if ne n long len ShapeReplace |
| 44 | exit 74 |
| 45 | end |
| 46 | ret |
| 47 | end |
| 48 | n = write 1 UpdateReplace 0 len UpdateReplace |
| 49 | if ne n long len UpdateReplace |
| 50 | exit 74 |
| 51 | end |
| 52 | end |
| 53 | |
| 54 | fn main to int |
| 55 | p = ulong 0 |
| 56 | reading = true |
| 57 | while reading |
| 58 | if eq p 65536 |
| 59 | ret 75 |
| 60 | end |
| 61 | n = read 0 Input p sub 65536 p |
| 62 | if eq n 0 |
| 63 | reading = false |
| 64 | else |
| 65 | if lt n 0 |
| 66 | ret 74 |
| 67 | end |
| 68 | p = add p ulong n |
| 69 | end |
| 70 | end |
| 71 | if lt p 2 |
| 72 | ret 75 |
| 73 | end |
| 74 | m = get Input 0 |
| 75 | if or lt m 48 gt m 50 |
| 76 | ret 75 |
| 77 | end |
| 78 | put Mode 0 ulong sub m 48 |
| 79 | length = size |
| 80 | found = ulong 0 |
| 81 | where = ulong 0 |
| 82 | if le p length |
| 83 | ret 75 |
| 84 | end |
| 85 | for start ulong sub p length |
| 86 | pos = add start 1 |
| 87 | same = true |
| 88 | for i ulong length |
| 89 | if ne get Input add pos i patternbyte i |
| 90 | same = false |
| 91 | end |
| 92 | end |
| 93 | if same |
| 94 | found = add found 1 |
| 95 | where = pos |
| 96 | end |
| 97 | end |
| 98 | if ne found 1 |
| 99 | ret 76 |
| 100 | end |
| 101 | n = write 1 Input 1 sub where 1 |
| 102 | if ne n long sub where 1 |
| 103 | ret 74 |
| 104 | end |
| 105 | replacement |
| 106 | tail = add where length |
| 107 | n = write 1 Input tail sub p tail |
| 108 | if ne n long sub p tail |
| 109 | ret 74 |
| 110 | end |
| 111 | ret 0 |
| 112 | end |