CUDApp
CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.
Brought by drakestapleton
CUDApp / evidence / LEARN53-L777-CONTINUATION / review / upstream185-review.om
| 1 | note LEARN653 v1 consumer checks. No compiler, judge, signer or process supervisor. |
| 2 | note Task slots are 32 ulongs; see docs/learning/benchmark-v1.md. |
| 3 | global LT ulong 2048 |
| 4 | global LS ulong 24 |
| 5 | global LSeen ulong 64 |
| 6 | global LWon ulong 64 |
| 7 | global LPin ulong 16 |
| 8 | global LWant uchar 256 |
| 9 | global LGot uchar 256 |
| 10 | |
| 11 | fn lequal a ulong b ulong n ulong to bool |
| 12 | for k ulong n |
| 13 | if ne get LT add a k get LT add b k |
| 14 | ret false |
| 15 | end |
| 16 | end |
| 17 | ret true |
| 18 | end |
| 19 | |
| 20 | fn lnonzero a ulong to bool |
| 21 | x = ulong 0 |
| 22 | for k ulong 4 |
| 23 | x = or x get LT add a k |
| 24 | end |
| 25 | ret ne x 0 |
| 26 | end |
| 27 | |
| 28 | fn lrecord a ulong to ulong |
| 29 | split = get LT add a 1 |
| 30 | if or eq get LT a 0 or lt split 1 gt split 4 |
| 31 | ret 2 |
| 32 | end |
| 33 | if or ne get LT add a 5 1 ne get LT add a 4 1 |
| 34 | ret 3 |
| 35 | end |
| 36 | if eq get LT add a 3 0 |
| 37 | ret 4 |
| 38 | end |
| 39 | if eq get LT add a 6 0 |
| 40 | ret 4 |
| 41 | end |
| 42 | if eq get LT add a 7 0 |
| 43 | ret 4 |
| 44 | end |
| 45 | note Only public train/dev records are admissible to this builder-side API. |
| 46 | note Adaptive/final custody stays with the existing independent owner. |
| 47 | if or gt split 2 ne get LT add a 2 1 |
| 48 | ret 5 |
| 49 | end |
| 50 | for h ulong 5 |
| 51 | if eq lnonzero add a add 8 mul h 4 false |
| 52 | ret 6 |
| 53 | end |
| 54 | end |
| 55 | if or eq get LT add a 28 0 gt get LT add a 28 256 |
| 56 | ret 7 |
| 57 | end |
| 58 | if or eq get LT add a 29 0 gt get LT add a 29 256 |
| 59 | ret 7 |
| 60 | end |
| 61 | if or eq get LT add a 30 0 gt get LT add a 30 1000000 |
| 62 | ret 7 |
| 63 | end |
| 64 | if ne get LT add a 31 0 |
| 65 | ret 7 |
| 66 | end |
| 67 | ret 0 |
| 68 | end |
| 69 | |
| 70 | fn lpair a ulong b ulong to ulong |
| 71 | if eq get LT a get LT b |
| 72 | ret 8 |
| 73 | end |
| 74 | if lequal add a 8 add b 8 4 |
| 75 | ret 9 |
| 76 | end |
| 77 | if lequal add a 12 add b 12 4 |
| 78 | ret 10 |
| 79 | end |
| 80 | if ne get LT add a 1 get LT add b 1 |
| 81 | if eq get LT add a 3 get LT add b 3 |
| 82 | ret 15 |
| 83 | end |
| 84 | if eq get LT add a 7 get LT add b 7 |
| 85 | ret 11 |
| 86 | end |
| 87 | if lequal add a 16 add b 16 4 |
| 88 | ret 12 |
| 89 | end |
| 90 | if lequal add a 20 add b 20 4 |
| 91 | ret 13 |
| 92 | end |
| 93 | if lequal add a 24 add b 24 4 |
| 94 | ret 14 |
| 95 | end |
| 96 | end |
| 97 | ret 0 |
| 98 | end |
| 99 | |
| 100 | fn lmanifest n ulong to ulong |
| 101 | if or eq n 0 gt n 64 |
| 102 | ret 1 |
| 103 | end |
| 104 | for i ulong n |
| 105 | a = mul i 32 |
| 106 | code = lrecord a |
| 107 | if ne code 0 |
| 108 | ret code |
| 109 | end |
| 110 | for j ulong i |
| 111 | b = mul j 32 |
| 112 | code = lpair a b |
| 113 | if ne code 0 |
| 114 | ret code |
| 115 | end |
| 116 | end |
| 117 | end |
| 118 | ret 0 |
| 119 | end |
| 120 | |
| 121 | note Caller supplies independent expected bytes and actual executor observations. |
| 122 | note Status 0=completed, 1=syntax,2=type,3=unsupported,4=timeout,5=resource,6=operational. |
| 123 | note Result 0=correct,1..6 as above,7=wrong value,8=trap mismatch,9=empty output,10=malformed. |
| 124 | fn lobserve status ulong wantcode ulong gotcode ulong wantn ulong gotn ulong to ulong |
| 125 | if gt status 6 |
| 126 | ret 10 |
| 127 | end |
| 128 | if ne status 0 |
| 129 | ret status |
| 130 | end |
| 131 | if or gt wantn 256 gt gotn 256 |
| 132 | ret 10 |
| 133 | end |
| 134 | if ne wantcode gotcode |
| 135 | ret 8 |
| 136 | end |
| 137 | if ne wantcode 0 |
| 138 | note Only declared runtime traps 101..107; arbitrary exit failures never pass. |
| 139 | if or lt wantcode 101 or gt wantcode 107 ne wantn 0 |
| 140 | ret 10 |
| 141 | end |
| 142 | if ne gotn 0 |
| 143 | ret 8 |
| 144 | end |
| 145 | ret 0 |
| 146 | end |
| 147 | if eq wantn 0 |
| 148 | ret 10 |
| 149 | end |
| 150 | if eq gotn 0 |
| 151 | ret 9 |
| 152 | end |
| 153 | if ne wantn gotn |
| 154 | ret 7 |
| 155 | end |
| 156 | for i ulong wantn |
| 157 | if ne get LWant i get LGot i |
| 158 | ret 7 |
| 159 | end |
| 160 | end |
| 161 | ret 0 |
| 162 | end |
| 163 | |
| 164 | note Full 256-bit compiler and executable identities, expected then observed. |
| 165 | note LPin[0..3] expected compiler, [4..7] observed, [8..11] expected ELF, [12..15] observed. |
| 166 | fn lpins to bool |
| 167 | ca = ulong 0 |
| 168 | ba = ulong 0 |
| 169 | for i ulong 4 |
| 170 | ca = or ca get LPin i |
| 171 | ba = or ba get LPin add i 8 |
| 172 | if ne get LPin i get LPin add i 4 |
| 173 | ret false |
| 174 | end |
| 175 | if ne get LPin add i 8 get LPin add i 12 |
| 176 | ret false |
| 177 | end |
| 178 | end |
| 179 | ret and ne ca 0 ne ba 0 |
| 180 | end |
| 181 | |
| 182 | note Each begin is one explicit fresh development run; no durable resume API exists. |
| 183 | note LS: active,tasks,maxattempts,attempts,pass1,passbudget,invalid,closed, |
| 184 | note generation_us,compile_us,judge_us,other_us,input_tokens,output_tokens,peak_bytes, |
| 185 | note energy_uj,energy_unknown,budget_us,completed,abstained,reserved... |
| 186 | fn lbegin n ulong maxtries ulong budget ulong to ulong |
| 187 | if eq get LS 0 1 |
| 188 | ret 20 |
| 189 | end |
| 190 | for i ulong 24 |
| 191 | put LS i 0 |
| 192 | end |
| 193 | for i ulong 64 |
| 194 | put LSeen i 0 |
| 195 | put LWon i 0 |
| 196 | end |
| 197 | code = lmanifest n |
| 198 | if ne code 0 |
| 199 | put LS 6 code |
| 200 | ret code |
| 201 | end |
| 202 | if or eq maxtries 0 or gt maxtries 64 or eq budget 0 gt budget 1000000000000 |
| 203 | put LS 6 21 |
| 204 | ret 21 |
| 205 | end |
| 206 | put LS 0 1 |
| 207 | put LS 1 n |
| 208 | put LS 2 maxtries |
| 209 | put LS 17 budget |
| 210 | ret 0 |
| 211 | end |
| 212 | |
| 213 | note Charge before classifying. Costs are exact integer caller measurements, never estimates. |
| 214 | note Missing cost values use all-ones and invalidate the run, never become free. |
| 215 | fn lcost slot ulong value ulong to ulong |
| 216 | if or lt slot 8 gt slot 15 |
| 217 | put LS 6 22 |
| 218 | ret 22 |
| 219 | end |
| 220 | if gt value 1000000000000 |
| 221 | put LS 6 23 |
| 222 | ret 23 |
| 223 | end |
| 224 | if eq slot 14 |
| 225 | if gt value get LS slot |
| 226 | put LS slot value |
| 227 | end |
| 228 | else |
| 229 | if gt get LS slot sub ulong 1000000000000 value |
| 230 | put LS 6 23 |
| 231 | ret 23 |
| 232 | end |
| 233 | put LS slot add get LS slot value |
| 234 | end |
| 235 | ret 0 |
| 236 | end |
| 237 | |
| 238 | note Attempt outcomes come from lobserve or explicit abstention 11, never compiler acceptance. |
| 239 | note Mandatory cost vector is supplied per attempt in LC; energy unknown is explicit. |
| 240 | global LC ulong 9 |
| 241 | |
| 242 | fn lattempt task ulong ordinal ulong outcome ulong to ulong |
| 243 | if ne get LS 0 1 |
| 244 | ret 24 |
| 245 | end |
| 246 | for k ulong 8 |
| 247 | r = lcost add k 8 get LC k |
| 248 | end |
| 249 | if eq get LC 8 0 |
| 250 | put LS 16 add get LS 16 1 |
| 251 | if ne get LC 7 0 |
| 252 | put LS 6 25 |
| 253 | end |
| 254 | else |
| 255 | if ne get LC 8 1 |
| 256 | put LS 6 25 |
| 257 | end |
| 258 | end |
| 259 | put LS 3 add get LS 3 1 |
| 260 | note At most 64 attempts across a public development run, including failed attempts. |
| 261 | if gt get LS 3 64 |
| 262 | put LS 6 31 |
| 263 | ret 31 |
| 264 | end |
| 265 | if eq lpins false |
| 266 | put LS 6 26 |
| 267 | end |
| 268 | note Invalid costs or identities can never add successful tasks. |
| 269 | if ne get LS 6 0 |
| 270 | ret get LS 6 |
| 271 | end |
| 272 | if or ge task get LS 1 gt outcome 11 |
| 273 | put LS 6 27 |
| 274 | ret 27 |
| 275 | end |
| 276 | if or ne ordinal add get LSeen task 1 gt ordinal get LS 2 |
| 277 | put LS 6 28 |
| 278 | ret 28 |
| 279 | end |
| 280 | put LSeen task ordinal |
| 281 | if eq outcome 0 |
| 282 | if eq ordinal 1 |
| 283 | put LS 4 add get LS 4 1 |
| 284 | end |
| 285 | if eq get LWon task 0 |
| 286 | put LWon task 1 |
| 287 | put LS 5 add get LS 5 1 |
| 288 | end |
| 289 | end |
| 290 | if eq outcome 11 |
| 291 | put LS 19 add get LS 19 1 |
| 292 | end |
| 293 | elapsed = add get LS 8 get LS 9 |
| 294 | elapsed = add elapsed get LS 10 |
| 295 | elapsed = add elapsed get LS 11 |
| 296 | if gt elapsed get LS 17 |
| 297 | put LS 6 29 |
| 298 | end |
| 299 | ret get LS 6 |
| 300 | end |
| 301 | |
| 302 | fn lfinish to ulong |
| 303 | if ne get LS 0 1 |
| 304 | ret 24 |
| 305 | end |
| 306 | put LS 0 0 |
| 307 | for i ulong get LS 1 |
| 308 | if eq get LSeen i 0 |
| 309 | if eq get LS 6 0 |
| 310 | put LS 6 30 |
| 311 | end |
| 312 | end |
| 313 | end |
| 314 | if ne get LS 6 0 |
| 315 | ret get LS 6 |
| 316 | end |
| 317 | put LS 18 1 |
| 318 | ret 0 |
| 319 | end |
| 320 | |
| 321 | note GEN-1 genjac rule reused: lowercase ASCII word-triple SET Jaccard strictly above 1/2. |
| 322 | note Input contains two public prompts only; never load final or sealed text here. |
| 323 | global LText uchar 512 |
| 324 | global LStart ulong 128 |
| 325 | global LLength ulong 128 |
| 326 | global LCount ulong 2 |
| 327 | |
| 328 | fn llower c uchar to uchar |
| 329 | if and ge c 65 le c 90 |
| 330 | ret add c 32 |
| 331 | end |
| 332 | ret c |
| 333 | end |
| 334 | |
| 335 | fn lword c uchar to bool |
| 336 | d = llower c |
| 337 | ret or and ge d 97 le d 122 and ge d 48 le d 57 |
| 338 | end |
| 339 | |
| 340 | fn ltokens side ulong size ulong to bool |
| 341 | if or gt side 1 gt size 256 |
| 342 | ret false |
| 343 | end |
| 344 | base = mul side 256 |
| 345 | slots = mul side 64 |
| 346 | count = ulong 0 |
| 347 | pos = ulong 0 |
| 348 | while lt pos size |
| 349 | if gt get LText add base pos 127 |
| 350 | ret false |
| 351 | end |
| 352 | if lword get LText add base pos |
| 353 | start = pos |
| 354 | scanning = true |
| 355 | while and lt pos size scanning |
| 356 | if lword get LText add base pos |
| 357 | pos = add pos 1 |
| 358 | else |
| 359 | scanning = false |
| 360 | end |
| 361 | end |
| 362 | if ge count 64 |
| 363 | ret false |
| 364 | end |
| 365 | put LStart add slots count add base start |
| 366 | put LLength add slots count sub pos start |
| 367 | count = add count 1 |
| 368 | else |
| 369 | pos = add pos 1 |
| 370 | end |
| 371 | end |
| 372 | put LCount side count |
| 373 | ret true |
| 374 | end |
| 375 | |
| 376 | fn lwordeq a ulong b ulong to bool |
| 377 | n = get LLength a |
| 378 | if ne n get LLength b |
| 379 | ret false |
| 380 | end |
| 381 | for k ulong n |
| 382 | if ne llower get LText add get LStart a k llower get LText add get LStart b k |
| 383 | ret false |
| 384 | end |
| 385 | end |
| 386 | ret true |
| 387 | end |
| 388 | |
| 389 | fn ltriple a ulong b ulong to bool |
| 390 | for k ulong 3 |
| 391 | if eq lwordeq add a k add b k false |
| 392 | ret false |
| 393 | end |
| 394 | end |
| 395 | ret true |
| 396 | end |
| 397 | |
| 398 | fn lunique at ulong base ulong to bool |
| 399 | j = base |
| 400 | while lt j at |
| 401 | if ltriple at j |
| 402 | ret false |
| 403 | end |
| 404 | j = add j 1 |
| 405 | end |
| 406 | ret true |
| 407 | end |
| 408 | |
| 409 | note 0=no near match,1=above threshold,2=insufficient words,3=unsupported input. |
| 410 | fn lnear an ulong bn ulong to ulong |
| 411 | if eq ltokens 0 an false |
| 412 | ret 3 |
| 413 | end |
| 414 | if eq ltokens 1 bn false |
| 415 | ret 3 |
| 416 | end |
| 417 | a = get LCount 0 |
| 418 | b = get LCount 1 |
| 419 | if or lt a 3 lt b 3 |
| 420 | ret 2 |
| 421 | end |
| 422 | ua = ulong 0 |
| 423 | ub = ulong 0 |
| 424 | overlap = ulong 0 |
| 425 | for i ulong sub a 2 |
| 426 | if lunique i 0 |
| 427 | ua = add ua 1 |
| 428 | hit = false |
| 429 | for j ulong sub b 2 |
| 430 | if ltriple i add 64 j |
| 431 | hit = true |
| 432 | end |
| 433 | end |
| 434 | if hit |
| 435 | overlap = add overlap 1 |
| 436 | end |
| 437 | end |
| 438 | end |
| 439 | for j ulong sub b 2 |
| 440 | if lunique add 64 j 64 |
| 441 | ub = add ub 1 |
| 442 | end |
| 443 | end |
| 444 | if gt mul overlap 3 add ua ub |
| 445 | ret 1 |
| 446 | end |
| 447 | ret 0 |
| 448 | end |
| 449 | note Handwritten component acceptance tests; public task oracle belongs to L776. |
| 450 | global Checks ulong 1 |
| 451 | global Digits uchar 16 |
| 452 | text Good "BENCHMARK_CORE_PASS\n" |
| 453 | text PhraseA "Add the two input numbers and return their sum" |
| 454 | text PhraseB "ADD the TWO input numbers, and return their sum." |
| 455 | text PhraseC "Find a maximum element in a sorted collection" |
| 456 | text HalfA "a b c" |
| 457 | text HalfB "a b c d" |
| 458 | text Repeat "a a a a a a" |
| 459 | |
| 460 | fn check actual ulong expected ulong to void |
| 461 | put Checks 0 add get Checks 0 1 |
| 462 | if ne actual expected |
| 463 | exit int add get Checks 0 40 |
| 464 | end |
| 465 | end |
| 466 | |
| 467 | fn fixture to void |
| 468 | for i ulong 2048 |
| 469 | put LT i 0 |
| 470 | end |
| 471 | for i ulong 4 |
| 472 | a = mul i 32 |
| 473 | put LT a add i 1 |
| 474 | put LT add a 1 add div i 2 1 |
| 475 | put LT add a 2 1 |
| 476 | put LT add a 3 add i 1 |
| 477 | put LT add a 4 1 |
| 478 | put LT add a 5 1 |
| 479 | put LT add a 6 776 |
| 480 | put LT add a 7 add i 1 |
| 481 | for j ulong 20 |
| 482 | put LT add a add j 8 add add mul i 100 j 1 |
| 483 | end |
| 484 | put LT add a 28 16 |
| 485 | put LT add a 29 16 |
| 486 | put LT add a 30 1000 |
| 487 | end |
| 488 | for i ulong 4 |
| 489 | put LPin i add i 1 |
| 490 | put LPin add i 4 add i 1 |
| 491 | put LPin add i 8 add i 5 |
| 492 | put LPin add i 12 add i 5 |
| 493 | end |
| 494 | for i ulong 9 |
| 495 | put LC i 0 |
| 496 | end |
| 497 | put LC 0 10 |
| 498 | put LC 1 20 |
| 499 | put LC 2 30 |
| 500 | put LC 3 40 |
| 501 | put LC 4 50 |
| 502 | put LC 5 60 |
| 503 | put LC 6 4096 |
| 504 | for i ulong 24 |
| 505 | put LS i 0 |
| 506 | end |
| 507 | end |
| 508 | |
| 509 | fn manifesttests to void |
| 510 | fixture |
| 511 | check lmanifest 4 0 |
| 512 | check lmanifest 0 1 |
| 513 | check lmanifest 65 1 |
| 514 | put LT 0 0 |
| 515 | check lmanifest 4 2 |
| 516 | fixture |
| 517 | put LT 5 2 |
| 518 | check lmanifest 4 3 |
| 519 | fixture |
| 520 | put LT 4 0 |
| 521 | check lmanifest 4 3 |
| 522 | fixture |
| 523 | put LT 6 0 |
| 524 | check lmanifest 4 4 |
| 525 | fixture |
| 526 | put LT 1 4 |
| 527 | check lmanifest 4 5 |
| 528 | fixture |
| 529 | put LT 1 3 |
| 530 | check lmanifest 4 5 |
| 531 | fixture |
| 532 | put LT 2 2 |
| 533 | check lmanifest 4 5 |
| 534 | fixture |
| 535 | for j ulong 4 |
| 536 | put LT add 8 j 0 |
| 537 | end |
| 538 | check lmanifest 4 6 |
| 539 | fixture |
| 540 | put LT 29 257 |
| 541 | check lmanifest 4 7 |
| 542 | fixture |
| 543 | put LT 32 1 |
| 544 | check lmanifest 4 8 |
| 545 | fixture |
| 546 | for j ulong 4 |
| 547 | put LT add 40 j get LT add 8 j |
| 548 | end |
| 549 | check lmanifest 4 9 |
| 550 | fixture |
| 551 | for j ulong 4 |
| 552 | put LT add 44 j get LT add 12 j |
| 553 | end |
| 554 | check lmanifest 4 10 |
| 555 | fixture |
| 556 | put LT 71 1 |
| 557 | check lmanifest 4 11 |
| 558 | fixture |
| 559 | for j ulong 4 |
| 560 | put LT add 80 j get LT add 16 j |
| 561 | end |
| 562 | check lmanifest 4 12 |
| 563 | fixture |
| 564 | for j ulong 4 |
| 565 | put LT add 84 j get LT add 20 j |
| 566 | end |
| 567 | check lmanifest 4 13 |
| 568 | fixture |
| 569 | for j ulong 4 |
| 570 | put LT add 88 j get LT add 24 j |
| 571 | end |
| 572 | check lmanifest 4 14 |
| 573 | fixture |
| 574 | put LT 67 1 |
| 575 | check lmanifest 4 15 |
| 576 | fixture |
| 577 | put LT 31 1 |
| 578 | check lmanifest 4 7 |
| 579 | fixture |
| 580 | put LT 28 0 |
| 581 | check lmanifest 4 7 |
| 582 | fixture |
| 583 | put LT 30 1000001 |
| 584 | check lmanifest 4 7 |
| 585 | end |
| 586 | |
| 587 | fn observationtests to void |
| 588 | for i ulong 256 |
| 589 | put LWant i uchar and i 255 |
| 590 | put LGot i uchar and i 255 |
| 591 | end |
| 592 | check lobserve 0 0 0 8 8 0 |
| 593 | put LGot 7 99 |
| 594 | check lobserve 0 0 0 8 8 7 |
| 595 | check lobserve 0 0 0 8 0 9 |
| 596 | check lobserve 0 0 0 8 7 7 |
| 597 | check lobserve 0 0 0 0 0 10 |
| 598 | check lobserve 0 102 102 0 0 0 |
| 599 | check lobserve 0 102 103 0 0 8 |
| 600 | check lobserve 0 102 102 0 1 8 |
| 601 | check lobserve 0 9 9 0 0 10 |
| 602 | check lobserve 0 0 102 8 0 8 |
| 603 | check lobserve 0 0 0 257 257 10 |
| 604 | for i ulong 6 |
| 605 | check lobserve add i 1 0 0 8 8 add i 1 |
| 606 | end |
| 607 | check lobserve 7 0 0 8 8 10 |
| 608 | end |
| 609 | |
| 610 | fn accountingtests to void |
| 611 | fixture |
| 612 | check lbegin 4 2 1000 0 |
| 613 | check lbegin 4 2 1000 20 |
| 614 | check lattempt 0 1 7 0 |
| 615 | check lattempt 0 2 0 0 |
| 616 | check lattempt 1 1 0 0 |
| 617 | check lattempt 2 1 4 0 |
| 618 | check lattempt 3 1 11 0 |
| 619 | check lfinish 0 |
| 620 | check get LS 3 5 |
| 621 | check get LS 4 1 |
| 622 | check get LS 5 2 |
| 623 | check get LS 8 50 |
| 624 | check get LS 9 100 |
| 625 | check get LS 10 150 |
| 626 | check get LS 11 200 |
| 627 | check get LS 12 250 |
| 628 | check get LS 13 300 |
| 629 | check get LS 14 4096 |
| 630 | check get LS 16 5 |
| 631 | check get LS 19 1 |
| 632 | check lattempt 0 3 0 24 |
| 633 | check lfinish 24 |
| 634 | fixture |
| 635 | check lbegin 4 2 1000 0 |
| 636 | check lattempt 0 1 0 0 |
| 637 | check lfinish 30 |
| 638 | check get LS 18 0 |
| 639 | fixture |
| 640 | check lbegin 4 2 1000 0 |
| 641 | check lattempt 0 2 0 28 |
| 642 | check get LS 8 10 |
| 643 | check lfinish 28 |
| 644 | fixture |
| 645 | check lbegin 4 1 1000 0 |
| 646 | check lattempt 0 1 7 0 |
| 647 | check lattempt 0 2 0 28 |
| 648 | check get LS 5 0 |
| 649 | fixture |
| 650 | check lbegin 4 2 99 0 |
| 651 | check lattempt 0 1 0 29 |
| 652 | check get LS 18 0 |
| 653 | fixture |
| 654 | check lbegin 4 2 1000 0 |
| 655 | put LPin 7 999 |
| 656 | check lattempt 0 1 0 26 |
| 657 | check get LS 8 10 |
| 658 | check get LS 5 0 |
| 659 | fixture |
| 660 | check lbegin 4 2 1000 0 |
| 661 | put LPin 15 999 |
| 662 | check lattempt 0 1 0 26 |
| 663 | fixture |
| 664 | check lbegin 4 2 1000 0 |
| 665 | put LC 0 18446744073709551615 |
| 666 | check lattempt 0 1 0 23 |
| 667 | fixture |
| 668 | check lbegin 4 2 1000 0 |
| 669 | put LC 7 1 |
| 670 | check lattempt 0 1 0 25 |
| 671 | fixture |
| 672 | check lbegin 4 2 1000 0 |
| 673 | put LC 7 13 |
| 674 | put LC 8 1 |
| 675 | check lattempt 0 1 0 0 |
| 676 | check get LS 15 13 |
| 677 | check get LS 16 0 |
| 678 | fixture |
| 679 | check lbegin 4 2 1000 0 |
| 680 | check lattempt 64 1 0 27 |
| 681 | check get LS 8 10 |
| 682 | fixture |
| 683 | check lbegin 4 0 1000 21 |
| 684 | fixture |
| 685 | check lbegin 4 65 1000 21 |
| 686 | fixture |
| 687 | check lbegin 4 2 0 21 |
| 688 | fixture |
| 689 | check lbegin 4 2 1000 0 |
| 690 | put LC 8 2 |
| 691 | check lattempt 0 1 0 25 |
| 692 | fixture |
| 693 | check lbegin 4 2 1000 0 |
| 694 | put LS 8 1000000000000 |
| 695 | check lattempt 0 1 0 23 |
| 696 | check get LS 18 0 |
| 697 | fixture |
| 698 | check lbegin 1 64 100000 0 |
| 699 | for i ulong 64 |
| 700 | check lattempt 0 add i 1 7 0 |
| 701 | end |
| 702 | check lattempt 0 65 0 31 |
| 703 | check get LS 3 65 |
| 704 | check get LS 8 650 |
| 705 | check get LS 5 0 |
| 706 | check lfinish 31 |
| 707 | fixture |
| 708 | check lbegin 1 1 1000 0 |
| 709 | put LC 6 8192 |
| 710 | check lattempt 0 1 0 0 |
| 711 | check get LS 14 8192 |
| 712 | check lfinish 0 |
| 713 | end |
| 714 | |
| 715 | fn neartests to void |
| 716 | for i ulong len PhraseA |
| 717 | put LText i get PhraseA i |
| 718 | end |
| 719 | for i ulong len PhraseB |
| 720 | put LText add 256 i get PhraseB i |
| 721 | end |
| 722 | check lnear len PhraseA len PhraseB 1 |
| 723 | for i ulong len PhraseC |
| 724 | put LText add 256 i get PhraseC i |
| 725 | end |
| 726 | check lnear len PhraseA len PhraseC 0 |
| 727 | check lnear 0 0 2 |
| 728 | check lnear 257 1 3 |
| 729 | put LText 0 255 |
| 730 | check lnear len PhraseA len PhraseC 3 |
| 731 | for i ulong len HalfA |
| 732 | put LText i get HalfA i |
| 733 | end |
| 734 | for i ulong len HalfB |
| 735 | put LText add 256 i get HalfB i |
| 736 | end |
| 737 | check lnear len HalfA len HalfB 0 |
| 738 | for i ulong len Repeat |
| 739 | put LText i get Repeat i |
| 740 | put LText add 256 i get Repeat i |
| 741 | end |
| 742 | check lnear len Repeat len Repeat 1 |
| 743 | for i ulong 128 |
| 744 | put LText mul i 2 97 |
| 745 | put LText add mul i 2 1 32 |
| 746 | end |
| 747 | check lnear 256 5 3 |
| 748 | end |
| 749 | |
| 750 | fn countout to void |
| 751 | n = get Checks 0 |
| 752 | put Digits 0 uchar add div n 100 48 |
| 753 | put Digits 1 uchar add rem div n 10 10 48 |
| 754 | put Digits 2 uchar add rem n 10 48 |
| 755 | put Digits 3 10 |
| 756 | w = write 1 Digits 0 4 |
| 757 | if ne w 4 |
| 758 | exit 36 |
| 759 | end |
| 760 | end |
| 761 | |
| 762 | fn main to int |
| 763 | manifesttests |
| 764 | observationtests |
| 765 | accountingtests |
| 766 | neartests |
| 767 | w = write 1 Good 0 len Good |
| 768 | if ne w long len Good |
| 769 | ret 35 |
| 770 | end |
| 771 | countout |
| 772 | ret 0 |
| 773 | end |