Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/seed/qualification/ddc650/ddc.om # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / qualification / ddc650 / ddc.om` 1102 lines ยท 19708 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note seed/qualification/ddc650/ddc.om: diverse double compilation conductor for issue #650. 3 note Handwritten seeded Omega, program mode, Linux AArch64, modelled on security673/gate669.om and 4 note om2/gate.om. README.md in this directory states the trust argument, scope and limitations. 5 note 6 note Run from the repository root: 7 note ddc OM4 OM4_SHA256 CC ORACLE_SRC ORACLE_SRC_SHA256 SRC BIN SCRATCH [CONTROL] 8 note OM4 seed-born om4 compiler (route S trusted compiler); refused unless its SHA-256 is OM4_SHA256 9 note CC host C compiler, absolute path; it builds the oracle (route I) with fixed flags 10 note ORACLE_SRC interpreter source written from the spec; refused unless its SHA-256 is ORACLE_SRC_SHA256 11 note SRC the claimed compiler source (seed/omc/omc.om) 12 note BIN the compiler binary under test (seed/out/omc) 13 note SCRATCH evidence directory; must not exist (exit 91), created 0700, never overwritten 14 note CONTROL optional injected difference; a control run never passes: 15 note stage1 route S stage 1 is built from SRC with one codegen mutation (expected FAIL) 16 note oracle route I oracle is built from ORACLE_SRC with one semantic mutation (expected FAIL) 17 note source SRC is replaced by the codegen-mutated source for every step (expected FAIL) 18 note binary BIN is replaced by a copy with byte 1000 xor 1 (expected FAIL) 19 note comparator the byte comparator answers "equal" for everything (expected INVALID) 20 note 21 note Route S: stage1 = OM4 < SRC, stage2 = stage1 < SRC (each built twice, copies must be equal). 22 note Route I: oracle = CC -B/usr/bin/ -O2 -std=gnu11 -Wall -Wextra -Werror -o oracle ORACLE_SRC 23 note -lpthread; ref = oracle run SRC < SRC (run twice, outputs must be equal). 24 note Subject: self = BIN < SRC must equal BIN (self-regeneration precondition). 25 note DDC: stage2 == BIN, ref == BIN and stage2 == ref, byte for byte. stage1 == BIN is printed and 26 note not required. Sensitivity: stage 1 built from SRC with an extra NOP before each zero or 27 note minus-one constant must give a stage 2 that differs from BIN; if it does not, the run is INVALID. 28 note Exit: PASS 0, FAIL 1 (a comparison or the subject failed), INVALID 3 (no evidence: identity 29 note mismatch, comparator self-test, trusted route refused, nondeterminism, signal, deadline, I/O), 30 note CONTROL SURVIVED 4, usage 90, existing scratch 91. Children run with the caller's permissions 31 note and an empty environment; this is not a sandbox and only trusted inputs belong here. 32 text words "stage1\nstage1.b\nstage2\nstage2.b\noracle\nref\nref.b\nself\nmutant.om\nmstage1\nmstage2\ncmp.a\ncmp.b\ncmp.c\ncmp.d\nseed/qualification/om2/fixtures/sha256-k.dec\nseed/qualification/om2/fixtures/sha256-iv.dec\nrun\n-B/usr/bin/\n-O2\n-std=gnu11\n-Wall\n-Wextra\n-Werror\n-o\n-lpthread\n.err\nbin\nmutant.c\nstage1\noracle\nsource\nbinary\ncomparator\n/dev/null\ncc.out\n" 33 text msg "DDC650 diverse double compilation: does BIN equal what two independent routes build from SRC\ninput OM4 \ninput CC \ninput ORACLE_SRC \ninput SRC \ninput BIN \n sha256 \n pin \n match\n MISMATCH\n $\n < \n > \n 2> \n exit=\n unreadable\nartifact \n bytes \ncheck \n PASS\n FAIL\n INVALID\ncomparator self-test (equal files, one differing byte, differing length):\nroute S stage1 = OM4(SRC), two builds, exit 0, ELF:\nroute S stage1 deterministic (two builds identical):\nroute S stage2 = stage1(SRC), two builds, exit 0, ELF:\nroute S stage2 deterministic (two builds identical):\nroute I oracle = CC(ORACLE_SRC), exit 0, ELF:\nroute I ref = oracle run SRC < SRC, two runs, exit 0:\nroute I deterministic (two runs identical):\nsubject self = BIN(SRC), exit 0:\nself-regeneration BIN(SRC) == BIN:\nDDC route S: stage2 == BIN:\nDDC route I: ref == BIN:\nroutes agree: stage2 == ref:\nsensitivity: mstage1 = OM4(SRC with an extra NOP per zero/minus-one constant), mstage2 = mstage1(SRC) != BIN:\ninfo stage1 == BIN (not required): \nyes\nno\ncontrol \ncontrol site found exactly once in \nVERDICT DDC650 PASS: BIN equals what route S (seed om4) and route I (CC-built spec interpreter) build from SRC; scope: these SRC, BIN, OM4, ORACLE_SRC, CC and this host only; not a proof that SRC is correct or safe and not a trusting-trust cure\nVERDICT DDC650 FAIL: correspondence between SRC and BIN is not shown\nVERDICT DDC650 INVALID: no evidence either way\nCONTROL SURVIVED: the injected difference was not detected\nCONTROL CAUGHT: the injected difference stopped a PASS\nusage: ddc OM4 OM4_SHA256 CC ORACLE_SRC ORACLE_SRC_SHA256 SRC BIN SCRATCH [stage1|oracle|source|binary|comparator]\nscratch exists or cannot be created\nSHA-256 constants unreadable\n child signal or deadline exceeded; wait low byte=\n child exec or redirect failed (exit 127)\nINVALID scratch I/O, argument or capacity failure\ncontrol site not found exactly once in \n (route not run)\n" 34 text site1 "\nemit or mop r\n" 35 text rep1 "\nemit `3573751839`\nemit or mop r\n" 36 text site2 "return canon(t, x << s);" 37 text rep2 "return canon(t, (x << s) ^ (s == 3));" 38 global pb uchar 4096 39 global pn ulong 1 40 global scr uchar 4096 41 global scn ulong 1 42 global av uchar 4096 43 global ap ulong 2 44 global big uchar * 45 global bgn ulong 1 46 global buf uchar 65536 47 global oth uchar 65536 48 global dig uchar 32 49 global stb uchar 4 50 global gst ulong 2 51 global rok ulong 2 52 global ctl ulong 1 53 global srcp ulong 1 54 global binp ulong 1 55 global osp ulong 1 56 global spos ulong 2 57 global pin uchar 64 58 global hexd uchar 64 59 global nums ulong 64 60 global kk uint 64 61 global ivs uint 8 62 global hv uint 8 63 global ws uint 64 64 global st uint 8 65 global blk uchar 64 66 global bk ulong 2 67 global hsz ulong 1 68 note ---- output ------------------------------------------------------------------------------- 69 fn say id ulong to void 70 k = ulong 1 71 s = ulong 0 72 for i ulong len msg 73 if eq get msg i 10 74 if eq k id 75 r = write 1 msg s sub i s 76 ret 77 end 78 k = add k 1 79 s = add i 1 80 end 81 end 82 exit 99 83 end 84 fn newline to void 85 put dig 0 10 86 r = write 1 dig 0 1 87 end 88 fn space to void 89 put dig 0 32 90 r = write 1 dig 0 1 91 end 92 fn decimal v ulong to ulong 93 x = v 94 n = ulong 0 95 while ge x 10 96 put dig n uchar add 48 rem x 10 97 x = div x 10 98 n = add n 1 99 end 100 put dig n uchar add 48 x 101 ret add n 1 102 end 103 fn num v ulong to void 104 n = decimal v 105 for i ulong n 106 r = write 1 dig sub sub n i 1 1 107 end 108 end 109 fn abort to void 110 newline 111 say 52 112 newline 113 exit 3 114 end 115 note ---- paths: code 1..99 is SCRATCH/, 101..109 is argument code-100, 201.. is 116 fn pclear to void 117 put pn 0 0 118 end 119 fn pbyte b uchar to void 120 n = get pn 0 121 if ge n 4095 122 abort 123 end 124 put pb n b 125 put pn 0 add n 1 126 end 127 fn pword id ulong to void 128 k = ulong 1 129 s = ulong 0 130 for i ulong len words 131 if eq get words i 10 132 if eq k id 133 for j ulong sub i s 134 pbyte get words add s j 135 end 136 ret 137 end 138 k = add k 1 139 s = add i 1 140 end 141 end 142 exit 99 143 end 144 fn setp c ulong to void 145 pclear 146 if ge c 200 147 pword sub c 200 148 ret 149 end 150 if ge c 100 151 r = argread sub c 100 pb 0 4095 152 if lt r 1 153 abort 154 end 155 put pn 0 ulong r 156 ret 157 end 158 for i ulong get scn 0 159 pbyte get scr i 160 end 161 pword c 162 end 163 fn showpb to void 164 r = write 1 pb 0 get pn 0 165 end 166 fn popen fl int to int 167 r = fopen pb 0 get pn 0 fl 384 168 if lt r 0 169 abort 170 end 171 ret int r 172 end 173 fn fclo fd int to void 174 if ge fd 0 175 r = fclose fd 176 end 177 end 178 note ---- children ---------------------------------------------------------------------------- 179 fn apb to void 180 n = get pn 0 181 p = get ap 0 182 if or gt add add p n 2 len av ge get ap 1 64 183 abort 184 end 185 put av p uchar and n 255 186 put av add p 1 uchar shr n 8 187 p = add p 2 188 for i ulong n 189 put av add p i get pb i 190 end 191 put ap 0 add p n 192 put ap 1 add get ap 1 1 193 space 194 showpb 195 end 196 fn cmd c ulong to void 197 put ap 0 2 198 put ap 1 0 199 say 11 200 setp c 201 apb 202 end 203 fn arg c ulong to void 204 setp c 205 apb 206 end 207 fn redir s int d int to void 208 if ne s d 209 if ne dupfd s d 0 long d 210 exit 127 211 end 212 end 213 end 214 fn reap pid int to ulong 215 t0 = monons 216 while true 217 r = waitpid pid stb 0 len stb 1 218 if eq r long pid 219 if ne get stb 0 0 220 say 50 221 num ulong get stb 0 222 newline 223 ret 256 224 end 225 x = ulong get stb 1 226 if eq x 127 227 say 51 228 newline 229 end 230 ret x 231 end 232 if lt r 0 233 abort 234 end 235 now = monons 236 if or lt now t0 gt sub now t0 `300000000000` 237 r = killpid pid 9 238 r = waitpid pid stb 0 len stb 0 239 say 50 240 num ulong get stb 0 241 newline 242 ret 257 243 end 244 if ne sleepns `1000000` 0 245 abort 246 end 247 end 248 exit 99 249 end 250 note run the command in av with stdin from path code ic, stdout to SCRATCH/, stderr to .err 251 fn spawn ic ulong oc ulong to ulong 252 say 12 253 setp ic 254 showpb 255 fi = popen 524288 256 say 13 257 setp oc 258 showpb 259 fo = popen 524481 260 say 14 261 setp oc 262 pword 27 263 showpb 264 fe = popen 524481 265 newline 266 put av 0 uchar and get ap 1 255 267 put av 1 uchar shr get ap 1 8 268 pid = fork 269 if lt pid 0 270 abort 271 end 272 if eq pid 0 273 redir fi 0 274 redir fo 1 275 redir fe 2 276 r = execprog av 0 get ap 0 277 exit 127 278 end 279 fclo fi 280 fclo fo 281 fclo fe 282 x = reap int pid 283 say 15 284 num x 285 newline 286 ret x 287 end 288 note make SCRATCH/ or BIN executable after checking its ELF magic; false when it is not ELF 289 fn enable c ulong to bool 290 setp c 291 fd = popen 524288 292 r = read fd buf 0 4 293 ok = true 294 if ne r 4 295 ok = false 296 else 297 if or ne get buf 0 127 ne get buf 1 69 298 ok = false 299 end 300 if or ne get buf 2 76 ne get buf 3 70 301 ok = false 302 end 303 end 304 if ok 305 if ne fchmod fd 448 0 306 abort 307 end 308 end 309 fclo fd 310 ret ok 311 end 312 note ---- byte comparator --------------------------------------------------------------------- 313 fn rfa fd int to long 314 n = ulong 0 315 while lt n len buf 316 r = read fd buf n sub len buf n 317 if lt r 0 318 ret r 319 end 320 if eq r 0 321 ret long n 322 end 323 n = add n ulong r 324 end 325 ret long n 326 end 327 fn rfb fd int to long 328 n = ulong 0 329 while lt n len oth 330 r = read fd oth n sub len oth n 331 if lt r 0 332 ret r 333 end 334 if eq r 0 335 ret long n 336 end 337 n = add n ulong r 338 end 339 ret long n 340 end 341 fn cmpfd fa int fb int to bool 342 while true 343 ra = rfa fa 344 rb = rfb fb 345 if or lt ra 0 lt rb 0 346 abort 347 end 348 if ne ra rb 349 ret false 350 end 351 if eq ra 0 352 ret true 353 end 354 for i ulong ulong ra 355 if ne get buf i get oth i 356 ret false 357 end 358 end 359 end 360 ret false 361 end 362 fn same a ulong b ulong to bool 363 if eq get ctl 0 5 364 ret true 365 end 366 setp a 367 fa = popen 524288 368 setp b 369 fb = popen 524288 370 eqv = cmpfd fa fb 371 fclo fa 372 fclo fb 373 ret eqv 374 end 375 note ---- SHA-256 (FIPS 180-4), copied from seed/qualification/om2/gate.om; artifact identity only 376 fn rotr x uint n uint to uint 377 ret or shr x n shl x sub 32 n 378 end 379 fn shasched to void 380 for i ulong 16 381 b = mul i 4 382 v = shl uint get blk b 24 383 v = or v shl uint get blk add b 1 16 384 v = or v shl uint get blk add b 2 8 385 v = or v uint get blk add b 3 386 put ws i v 387 end 388 for j ulong 48 389 q = add j 16 390 x = get ws sub q 15 391 y = get ws sub q 2 392 s0 = xor xor rotr x 7 rotr x 18 shr x 3 393 s1 = xor xor rotr y 17 rotr y 19 shr y 10 394 put ws q add add add get ws sub q 16 s0 get ws sub q 7 s1 395 end 396 end 397 fn shat1 i ulong to uint 398 e = get st 4 399 s1 = xor xor rotr e 6 rotr e 11 rotr e 25 400 ch = xor and e get st 5 and not e get st 6 401 ret add add add add get st 7 s1 ch get kk i get ws i 402 end 403 fn shat2 to uint 404 a = get st 0 405 b = get st 1 406 c = get st 2 407 s0 = xor xor rotr a 2 rotr a 13 rotr a 22 408 mj = xor xor and a b and a c and b c 409 ret add s0 mj 410 end 411 fn shacomp to void 412 shasched 413 for i ulong 8 414 put st i get hv i 415 end 416 for i ulong 64 417 t1 = shat1 i 418 t2 = shat2 419 put st 7 get st 6 420 put st 6 get st 5 421 put st 5 get st 4 422 put st 4 add get st 3 t1 423 put st 3 get st 2 424 put st 2 get st 1 425 put st 1 get st 0 426 put st 0 add t1 t2 427 end 428 for i ulong 8 429 put hv i add get hv i get st i 430 end 431 end 432 fn shabyte b uchar to void 433 n = get bk 0 434 put blk n b 435 n = add n 1 436 if eq n 64 437 shacomp 438 n = ulong 0 439 end 440 put bk 0 n 441 put bk 1 add get bk 1 1 442 end 443 fn hexch v uint to uchar 444 if lt v 10 445 ret uchar add v 48 446 end 447 ret uchar add v 87 448 end 449 fn shafinal to void 450 bits = mul get bk 1 8 451 shabyte 128 452 while ne get bk 0 56 bound 64 453 shabyte 0 454 end 455 for i ulong 8 456 shabyte uchar and shr bits mul sub 7 i 8 255 457 end 458 for i ulong 8 459 v = get hv i 460 for j ulong 8 461 put hexd add mul i 8 j hexch and shr v mul sub 7 j 4 15 462 end 463 end 464 end 465 note hash the file named by path code c into hexd; false when it cannot be read; bk[1] = bytes 466 fn hashp c ulong to bool 467 setp c 468 r = fopen pb 0 get pn 0 524288 384 469 if lt r 0 470 ret false 471 end 472 fd = int r 473 for i ulong 8 474 put hv i get ivs i 475 end 476 put bk 0 0 477 put bk 1 0 478 while true 479 n = rfa fd 480 if lt n 0 481 fclo fd 482 ret false 483 end 484 if eq n 0 485 fclo fd 486 put hsz 0 get bk 1 487 shafinal 488 ret true 489 end 490 for i ulong ulong n 491 shabyte get buf i 492 end 493 end 494 ret false 495 end 496 fn parsenum n ulong want ulong to bool 497 m = ulong not uint 0 498 k = ulong 0 499 v = ulong 0 500 nd = ulong 0 501 for i ulong n 502 c = get buf i 503 if and ge c 48 le c 57 504 if ge nd 10 505 ret false 506 end 507 v = add mul v 10 ulong sub c 48 508 nd = add nd 1 509 else 510 if or ne c 10 eq nd 0 511 ret false 512 end 513 if ge k want 514 ret false 515 end 516 if gt v m 517 ret false 518 end 519 put nums k v 520 k = add k 1 521 v = ulong 0 522 nd = ulong 0 523 end 524 end 525 ret and eq nd 0 eq k want 526 end 527 fn loadnums c ulong want ulong to bool 528 setp c 529 r = fopen pb 0 get pn 0 524288 384 530 if lt r 0 531 ret false 532 end 533 fd = int r 534 n = rfa fd 535 fclo fd 536 if or le n 0 ge n long len buf 537 ret false 538 end 539 ret parsenum ulong n want 540 end 541 fn loadconst to bool 542 if not loadnums 216 64 543 ret false 544 end 545 for i ulong 64 546 put kk i uint get nums i 547 end 548 if not loadnums 217 8 549 ret false 550 end 551 for i ulong 8 552 put ivs i uint get nums i 553 end 554 ret true 555 end 556 note ---- checks and identities --------------------------------------------------------------- 557 note res 0 PASS, 1 FAIL, 2 INVALID 558 fn check m ulong res ulong to void 559 say 19 560 say m 561 if eq res 0 562 say 20 563 end 564 if eq res 1 565 say 21 566 put gst 0 1 567 end 568 if eq res 2 569 say 22 570 put gst 1 1 571 end 572 newline 573 end 574 fn notrun m ulong to void 575 say 19 576 say m 577 say 22 578 say 54 579 newline 580 put gst 1 1 581 end 582 fn showhash to void 583 say 7 584 r = write 1 hexd 0 64 585 say 18 586 num get hsz 0 587 end 588 fn art c ulong to void 589 say 17 590 setp c 591 showpb 592 if hashp c 593 showhash 594 else 595 say 16 596 put gst 1 1 597 end 598 newline 599 end 600 note print an input, its digest and, when pinarg is not 0, its pin; 0 when readable and pinned 601 fn ident m ulong c ulong pinarg ulong to ulong 602 say m 603 setp c 604 showpb 605 if not hashp c 606 say 16 607 newline 608 ret 2 609 end 610 showhash 611 if eq pinarg 0 612 newline 613 ret 0 614 end 615 say 8 616 r = argread sub pinarg 100 pin 0 64 617 if ne r 64 618 say 10 619 newline 620 ret 2 621 end 622 q = write 1 pin 0 64 623 for i ulong 64 624 if ne get hexd i get pin i 625 say 10 626 newline 627 ret 2 628 end 629 end 630 say 9 631 newline 632 ret 0 633 end 634 fn inputs to void 635 bad = ident 2 101 102 636 bad = or bad ident 3 103 0 637 bad = or bad ident 4 104 105 638 bad = or bad ident 5 106 0 639 bad = or bad ident 6 107 0 640 if ne bad 0 641 put gst 1 1 642 end 643 end 644 note ---- comparator self-test ---------------------------------------------------------------- 645 fn wfile c ulong n ulong b0 uchar b1 uchar to void 646 setp c 647 fd = popen 524481 648 put oth 0 b0 649 put oth 1 b1 650 r = write fd oth 0 n 651 if ne r long n 652 abort 653 end 654 fclo fd 655 end 656 fn selftest to void 657 wfile 12 1 120 0 658 wfile 13 1 120 0 659 wfile 14 1 121 0 660 wfile 15 2 120 121 661 ok = same 12 13 662 ok = and ok not same 12 14 663 ok = and ok not same 12 15 664 ok = and ok not same 15 12 665 res = ulong 2 666 if ok 667 res = ulong 0 668 end 669 check 23 res 670 end 671 note ---- mutants: exact-once byte substitution of site w in the file at path code c ---------- 672 fn loadbig c ulong to void 673 setp c 674 fd = popen 524288 675 n = ulong 0 676 while true 677 if eq n len big 678 next = mul len big 2 679 if eq next 0 680 next = ulong 65536 681 end 682 if le next n 683 abort 684 end 685 grown = enlarge big next 686 if ne grown 0 687 abort 688 end 689 end 690 r = read fd big n sub len big n 691 if lt r 0 692 abort 693 end 694 if eq r 0 695 fclo fd 696 put bgn 0 n 697 ret 698 end 699 n = add n ulong r 700 end 701 abort 702 end 703 fn sitelen w ulong to ulong 704 if eq w 1 705 ret len site1 706 end 707 ret len site2 708 end 709 fn siteb w ulong i ulong to uchar 710 if eq w 1 711 ret get site1 i 712 end 713 ret get site2 i 714 end 715 fn replen w ulong to ulong 716 if eq w 1 717 ret len rep1 718 end 719 ret len rep2 720 end 721 fn repb w ulong i ulong to uchar 722 if eq w 1 723 ret get rep1 i 724 end 725 ret get rep2 i 726 end 727 fn matchat w ulong p ulong to bool 728 n = sitelen w 729 if gt add p n get bgn 0 730 ret false 731 end 732 for i ulong n 733 if ne get big add p i siteb w i 734 ret false 735 end 736 end 737 ret true 738 end 739 note count occurrences of site w in big; spos[0] = count, spos[1] = last position 740 fn findsite w ulong to void 741 put spos 0 0 742 for p ulong get bgn 0 743 if matchat w p 744 put spos 0 add get spos 0 1 745 put spos 1 p 746 end 747 end 748 end 749 fn wbig fd int o ulong n ulong to void 750 if gt n 0 751 r = write fd big o n 752 if ne r long n 753 abort 754 end 755 end 756 end 757 fn mutate w ulong sc ulong dc ulong to bool 758 loadbig sc 759 findsite w 760 if ne get spos 0 1 761 say 53 762 setp sc 763 showpb 764 newline 765 ret false 766 end 767 say 41 768 setp sc 769 showpb 770 newline 771 setp dc 772 fd = popen 524481 773 p = get spos 1 774 wbig fd 0 p 775 for i ulong replen w 776 put oth i repb w i 777 end 778 r = write fd oth 0 replen w 779 if ne r long replen w 780 abort 781 end 782 e = add p sitelen w 783 wbig fd e sub get bgn 0 e 784 fclo fd 785 ret true 786 end 787 fn flipbin to bool 788 loadbig 107 789 if le get bgn 0 1000 790 ret false 791 end 792 put big 1000 xor get big 1000 1 793 setp 28 794 fd = popen 524481 795 wbig fd 0 get bgn 0 796 fclo fd 797 ret enable 28 798 end 799 fn prepare to void 800 if not mutate 1 106 9 801 put gst 1 1 802 ret 803 end 804 c = get ctl 0 805 if eq c 2 806 if not mutate 2 104 29 807 put gst 1 1 808 ret 809 end 810 put osp 0 29 811 end 812 if eq c 3 813 put srcp 0 9 814 end 815 if eq c 4 816 if not flipbin 817 put gst 1 1 818 ret 819 end 820 put binp 0 28 821 end 822 end 823 note ---- routes ------------------------------------------------------------------------------ 824 fn exe c ulong ic ulong oc ulong to ulong 825 cmd c 826 ret spawn ic oc 827 end 828 fn pair c ulong ic ulong o1 ulong o2 ulong to ulong 829 x = exe c ic o1 830 y = exe c ic o2 831 if or ne x 0 ne y 0 832 ret 2 833 end 834 ret 0 835 end 836 fn verdict2 ok bool to ulong 837 if ok 838 ret 0 839 end 840 ret 2 841 end 842 fn routes to void 843 s = get srcp 0 844 in1 = s 845 if eq get ctl 0 1 846 in1 = ulong 9 847 end 848 r = pair 101 in1 1 2 849 if eq r 0 850 r = verdict2 and enable 1 enable 2 851 end 852 check 24 r 853 if ne r 0 854 notrun 26 855 ret 856 end 857 d = verdict2 same 1 2 858 check 25 d 859 art 1 860 if ne d 0 861 notrun 26 862 ret 863 end 864 r = pair 1 s 3 4 865 if eq r 0 866 r = verdict2 and enable 3 enable 4 867 end 868 check 26 r 869 if ne r 0 870 ret 871 end 872 d = verdict2 same 3 4 873 check 27 d 874 art 3 875 if eq d 0 876 put rok 0 1 877 end 878 end 879 fn oracle to void 880 cmd 103 881 for i ulong 6 882 arg add 219 i 883 end 884 arg 225 885 arg 5 886 arg get osp 0 887 arg 226 888 x = spawn 235 36 889 r = ulong 2 890 if eq x 0 891 r = verdict2 enable 5 892 end 893 check 28 r 894 if ne r 0 895 notrun 29 896 ret 897 end 898 art 5 899 s = get srcp 0 900 cmd 5 901 arg 218 902 arg s 903 x = spawn s 6 904 cmd 5 905 arg 218 906 arg s 907 y = spawn s 7 908 r = ulong 0 909 if or ne x 0 ne y 0 910 r = ulong 2 911 end 912 check 29 r 913 if ne r 0 914 ret 915 end 916 d = verdict2 same 6 7 917 check 30 d 918 art 6 919 if eq d 0 920 put rok 1 1 921 end 922 end 923 fn fail1 eqv bool to ulong 924 if eqv 925 ret 0 926 end 927 ret 1 928 end 929 fn subject to void 930 b = get binp 0 931 x = exe b get srcp 0 8 932 r = ulong 0 933 if ne x 0 934 r = ulong 1 935 end 936 check 31 r 937 if eq r 0 938 check 32 fail1 same 8 b 939 art 8 940 else 941 check 32 1 942 end 943 end 944 fn ddc to void 945 b = get binp 0 946 if ne get rok 0 0 947 check 33 fail1 same 3 b 948 say 37 949 if same 1 b 950 say 38 951 else 952 say 39 953 end 954 newline 955 else 956 notrun 33 957 end 958 if ne get rok 1 0 959 check 34 fail1 same 6 b 960 else 961 notrun 34 962 end 963 if and ne get rok 0 0 ne get rok 1 0 964 check 35 fail1 same 3 6 965 else 966 notrun 35 967 end 968 end 969 fn sense to void 970 x = exe 101 9 10 971 r = ulong 2 972 if eq x 0 973 if enable 10 974 r = ulong 0 975 end 976 end 977 if eq r 0 978 y = exe 10 get srcp 0 11 979 if ne y 0 980 r = ulong 2 981 else 982 if same 11 get binp 0 983 r = ulong 2 984 end 985 end 986 end 987 check 36 r 988 art 10 989 art 11 990 end 991 fn verdict to int 992 code = int 0 993 if ne get gst 1 0 994 say 44 995 code = 3 996 else 997 if ne get gst 0 0 998 say 43 999 code = 1 1000 else 1001 say 42 1002 end 1003 end 1004 newline 1005 if ne get ctl 0 0 1006 if eq code 0 1007 say 45 1008 newline 1009 ret 4 1010 end 1011 say 46 1012 newline 1013 end 1014 ret code 1015 end 1016 note ---- main -------------------------------------------------------------------------------- 1017 fn control to bool 1018 r = argread 9 oth 0 4095 1019 if lt r 1 1020 ret false 1021 end 1022 n = ulong r 1023 for k ulong 5 1024 pclear 1025 pword add 30 k 1026 hit = eq get pn 0 n 1027 if hit 1028 for i ulong n 1029 if ne get pb i get oth i 1030 hit = false 1031 end 1032 end 1033 end 1034 if hit 1035 put ctl 0 add k 1 1036 ret true 1037 end 1038 end 1039 ret false 1040 end 1041 fn usage to int 1042 say 47 1043 newline 1044 ret 90 1045 end 1046 fn main to int 1047 if and ne argcnt 9 ne argcnt 10 1048 ret usage 1049 end 1050 r = argread 8 scr 0 4094 1051 if lt r 1 1052 ret usage 1053 end 1054 n = ulong r 1055 if eq argcnt 10 1056 if not control 1057 ret usage 1058 end 1059 end 1060 if ne makedir scr 0 n 448 0 1061 say 48 1062 newline 1063 ret 91 1064 end 1065 put scr n 47 1066 put scn 0 add n 1 1067 put srcp 0 106 1068 put binp 0 107 1069 put osp 0 104 1070 if not loadconst 1071 say 49 1072 newline 1073 ret 3 1074 end 1075 say 1 1076 newline 1077 if ne get ctl 0 0 1078 say 40 1079 pclear 1080 pword add 29 get ctl 0 1081 showpb 1082 newline 1083 end 1084 inputs 1085 if ne get gst 1 0 1086 ret verdict 1087 end 1088 selftest 1089 if ne get gst 1 0 1090 ret verdict 1091 end 1092 prepare 1093 if ne get gst 1 0 1094 ret verdict 1095 end 1096 routes 1097 oracle 1098 subject 1099 ddc 1100 sense 1101 ret verdict 1102 end