// regex: VAR=v\d+ // regex: ID=[[:alpha:]0-9_]+ script { fn main() -> bool, !1 { local u64 counter local u64 counter_2 local u64 counter_3 local u64 counter_4 local u64 counter_5 local () result // check: entry() entry(): // check: $(v0=$VAR) = get_local ptr u64, counter v0 = get_local ptr u64, counter, !2 v1 = const u64 0, !3 // not: store $VAR to $v0 store v1 to v0, !2 br while() // check: while($(v3=$VAR): u64): while(): // check: $(v2=$VAR) = get_local ptr u64, counter v2 = get_local ptr u64, counter, !4 // not: load $v2 v3 = load v2, !4 v4 = const u64 10, !5 // check: call lt_1($v3, $VAR) v5 = call lt_1(v3, v4), !6 cbr v5, while_body(), end_while() // check: while_body(): while_body(): v6 = get_local ptr u64, counter, !7 // check: $(v7=$VAR) = get_local ptr u64, counter v7 = get_local ptr u64, counter, !8 // not: load $v7 v8 = load v7, !8 v9 = const u64 1, !9 // check: call add_0($v3, $VAR) v10 = call add_0(v8, v9), !10 store v10 to v6, !7 br while() // check: end_while(): end_while(): // check: $(v11=$VAR) = get_local ptr u64, counter v11 = get_local ptr u64, counter, !11 // not: load $v11 v12 = load v11, !11 // check: $(v13=$VAR) = const u64 10 v13 = const u64 10, !12 // check: call eq_5($v3, $v13) v14 = call eq_5(v12, v13), !13 v15 = call assert_2(v14), !15 // check: $(v16=$VAR) = get_local ptr u64, counter_2 v16 = get_local ptr u64, counter_2, !16 v17 = const u64 0, !17 // not: store $VAR to $v16 store v17 to v16, !16 // check: $(v18=$VAR) = get_local ptr u64, counter_3 v18 = get_local ptr u64, counter_3, !18 v19 = const u64 0, !19 // not: store $VAR to $v18 store v19 to v18, !18 br while0() // check: while0($(p1=$VAR): u64, $(p2=$VAR): u64): while0(): // check: $(v20=$VAR) = get_local ptr u64, counter_2 v20 = get_local ptr u64, counter_2, !20 // not: load $v20 v21 = load v20, !20 // check: $(v22=$VAR) = const u64 10 v22 = const u64 10, !21 // check: call lt_1($p1, $v22) v23 = call lt_1(v21, v22), !22 cbr v23, while_body1(), end_while2() // check while_body1(): while_body1(): // check: $(v24=$VAR) = get_local ptr u64, counter_2 v24 = get_local ptr u64, counter_2, !23 // not: load $v24 v25 = load v24, !23 // check: $(v26=$VAR) = const u64 3 v26 = const u64 3, !24 // call eq_5($p1, $v26) v27 = call eq_5(v25, v26), !25 cbr v27, block3(), block4(), !25 // check: end_while2(): end_while2(): // check: $(v28=$VAR) = get_local ptr u64, counter_2 v28 = get_local ptr u64, counter_2, !26 // not: load $v28 v29 = load v28, !26 // check: $(v30=$VAR) = const u64 10 v30 = const u64 10, !27 // call eq_5($p1, $v30) v31 = call eq_5(v29, v30), !28 cbr v31, block6(), block7(v31), !29 // check: block3(): block3(): // check: $(v32=$VAR) = get_local ptr u64, counter_2 v32 = get_local ptr u64, counter_2, !30 v33 = const u64 10, !31 // not: store $VAR to $v32 store v33 to v32, !30 v34 = const unit () br block5(v34) block4(): v35 = get_local ptr u64, counter_2, !32 v36 = get_local ptr u64, counter_2, !33 v37 = load v36, !33 v38 = const u64 1, !34 v39 = call add_0(v37, v38), !35 store v39 to v35, !32 v40 = get_local ptr u64, counter_3, !36 v41 = get_local ptr u64, counter_3, !37 v42 = load v41, !37 v43 = const u64 1, !38 v44 = call add_0(v42, v43), !39 store v44 to v40, !36 v45 = const unit () br block5(v45) block5(v46: ()): br while0() block6(): v47 = get_local ptr u64, counter_3, !40 v48 = load v47, !40 v49 = const u64 3, !41 v50 = call eq_5(v48, v49), !42 br block7(v50), !29 block7(v51: bool): v52 = call assert_2(v51), !15 v53 = get_local ptr u64, counter_4, !43 v54 = const u64 0, !44 store v54 to v53, !43 v55 = get_local ptr u64, counter_5, !45 v56 = const u64 0, !46 store v56 to v55, !45 br while8() while8(): v57 = get_local ptr u64, counter_4, !47 v58 = load v57, !47 v59 = const u64 7, !48 v60 = call lt_1(v58, v59), !49 cbr v60, while_body9(), end_while10() while_body9(): br while11() end_while10(): v61 = get_local ptr u64, counter_5, !50 v62 = load v61, !50 v63 = const u64 11, !51 v64 = call eq_5(v62, v63), !52 v65 = call assert_2(v64), !15 v66 = get_local ptr u64, counter_4, !53 v67 = load v66, !53 v68 = const u64 7, !54 v69 = call eq_5(v67, v68), !55 v70 = call assert_2(v69), !15 br while14() while11(): v71 = get_local ptr u64, counter_5, !56 v72 = load v71, !56 v73 = const u64 11, !57 v74 = call lt_1(v72, v73), !58 cbr v74, while_body12(), end_while13() while_body12(): v75 = get_local ptr u64, counter_5, !59 v76 = get_local ptr u64, counter_5, !60 v77 = load v76, !60 v78 = const u64 1, !61 v79 = call add_0(v77, v78), !62 store v79 to v75, !59 br while11() end_while13(): v80 = get_local ptr u64, counter_4, !63 v81 = get_local ptr u64, counter_4, !64 v82 = load v81, !64 v83 = const u64 1, !65 v84 = call add_0(v82, v83), !66 store v84 to v80, !63 br while8() while14(): v85 = const bool true, !67 cbr v85, while_body15(), end_while16() while_body15(): br end_while16() end_while16(): v86 = get_local ptr (), result, !68 v87 = const unit (), !69 store v87 to v86, !68 v88 = const bool true, !70 ret bool v88 } fn add_0(self !72: u64, other !73: u64) -> u64, !74 { entry(self: u64, other: u64): v0 = add self, other ret u64 v0 } fn lt_1(self !75: u64, other !76: u64) -> bool, !77 { entry(self: u64, other: u64): v0 = asm(r1: self, r2: other, r3) -> bool r3, !78 { lt r3 r1 r2, !79 } ret bool v0 } fn assert_2(condition !80: bool) -> (), !15 { entry(condition: bool): v0 = call not_3(condition), !81 cbr v0, block0(), block1(), !81 block0(): v1 = const u64 0, !82 v2 = call revert_4(v1), !84 v3 = const unit () br block2(v3) block1(): v4 = const unit () br block2(v4) block2(v5: ()): v6 = const unit () ret () v6 } fn not_3(self !85: bool) -> bool, !86 { entry(self: bool): v0 = const bool false, !87 v1 = cmp eq self v0 ret bool v1 } fn revert_4(code !88: u64) -> (), !84 { entry(code: u64): revert code, !89 } fn eq_5(self !90: u64, other !91: u64) -> bool, !92 { entry(self: u64, other: u64): v0 = cmp eq self other ret bool v0 } } !0 = "sway/test/src/e2e_vm_tests/test_programs/should_pass/language/while_loops/src/main.sw" !1 = span !0 35 1010 !2 = span !0 59 79 !3 = span !0 77 78 !4 = span !0 123 130 !5 = span !0 133 135 !6 = span !0 123 135 !7 = span !0 146 167 !8 = span !0 156 163 !9 = span !0 166 167 !10 = span !0 156 167 !11 = span !0 186 193 !12 = span !0 197 199 !13 = span !0 186 199 !14 = "sway/sway-lib-std/src/assert.sw" !15 = span !14 308 387 !16 = span !0 293 315 !17 = span !0 313 314 !18 = span !0 320 342 !19 = span !0 340 341 !20 = span !0 353 362 !21 = span !0 365 367 !22 = span !0 353 367 !23 = span !0 381 390 !24 = span !0 394 395 !25 = span !0 381 395 !26 = span !0 602 611 !27 = span !0 615 617 !28 = span !0 602 617 !29 = span !0 602 635 !30 = span !0 463 477 !31 = span !0 475 477 !32 = span !0 508 533 !33 = span !0 520 529 !34 = span !0 532 533 !35 = span !0 520 533 !36 = span !0 547 572 !37 = span !0 559 568 !38 = span !0 571 572 !39 = span !0 559 572 !40 = span !0 621 630 !41 = span !0 634 635 !42 = span !0 621 635 !43 = span !0 669 691 !44 = span !0 689 690 !45 = span !0 696 718 !46 = span !0 716 717 !47 = span !0 730 739 !48 = span !0 742 743 !49 = span !0 730 743 !50 = span !0 878 887 !51 = span !0 891 893 !52 = span !0 878 893 !53 = span !0 907 916 !54 = span !0 920 921 !55 = span !0 907 921 !56 = span !0 760 769 !57 = span !0 772 774 !58 = span !0 760 774 !59 = span !0 789 814 !60 = span !0 801 810 !61 = span !0 813 814 !62 = span !0 801 814 !63 = span !0 834 859 !64 = span !0 846 855 !65 = span !0 858 859 !66 = span !0 846 859 !67 = span !0 982 986 !68 = span !0 963 998 !69 = span !0 976 997 !70 = span !0 1004 1008 !71 = "sway/sway-lib-core/src/ops.sw" !72 = span !71 117 121 !73 = span !71 123 128 !74 = span !71 110 178 !75 = span !71 3993 3997 !76 = span !71 3999 4004 !77 = span !71 3987 4122 !78 = span !71 4030 4116 !79 = span !71 4073 4084 !80 = span !14 322 331 !81 = span !14 348 358 !82 = span !14 376 377 !83 = "sway/sway-lib-std/src/revert.sw" !84 = span !83 172 219 !85 = span !71 2706 2710 !86 = span !71 2699 2753 !87 = span !71 2741 2746 !88 = span !83 186 190 !89 = span !83 203 217 !90 = span !71 3015 3019 !91 = span !71 3021 3026 !92 = span !71 3009 3075