move-stackless-bytecode 0.3.2

Move stackless bytecode
Documentation
============ initial translation from Move ================

[variant baseline]
fun SecondaryIndex::call_two_secondary_indexes($t0|s: &SecondaryIndex::S): address {
     var $t1: &SecondaryIndex::S
     var $t2: bool
     var $t3: address
  0: $t1 := move($t0)
  1: $t2 := true
  2: $t3 := SecondaryIndex::two_secondary_indexes($t1, $t2)
  3: return $t3
}


[variant baseline]
fun SecondaryIndex::read_secondary_index_from_formal($t0|a: &SecondaryIndex::A): address {
     var $t1: &SecondaryIndex::A
     var $t2: &address
     var $t3: address
     var $t4: &SecondaryIndex::B
     var $t5: &address
     var $t6: address
  0: $t1 := move($t0)
  1: $t2 := borrow_field<SecondaryIndex::A>.a_addr($t1)
  2: $t3 := read_ref($t2)
  3: $t4 := borrow_global<SecondaryIndex::B>($t3)
  4: $t5 := borrow_field<SecondaryIndex::B>.b_addr($t4)
  5: $t6 := read_ref($t5)
  6: return $t6
}


[variant baseline]
fun SecondaryIndex::read_secondary_index_from_formal_interproc($t0|a_addr: address): address {
     var $t1|a: SecondaryIndex::A
     var $t2: address
     var $t3: SecondaryIndex::A
     var $t4: &SecondaryIndex::A
     var $t5: address
  0: $t2 := move($t0)
  1: $t3 := pack SecondaryIndex::A($t2)
  2: $t1 := $t3
  3: $t4 := borrow_local($t1)
  4: $t5 := SecondaryIndex::read_secondary_index_from_formal($t4)
  5: return $t5
}


[variant baseline]
fun SecondaryIndex::read_secondary_index_from_global($t0|a: address): address {
     var $t1|addr: address
     var $t2: address
     var $t3: &SecondaryIndex::A
     var $t4: &address
     var $t5: address
     var $t6: address
     var $t7: &SecondaryIndex::B
     var $t8: &address
     var $t9: address
  0: $t2 := move($t0)
  1: $t3 := borrow_global<SecondaryIndex::A>($t2)
  2: $t4 := borrow_field<SecondaryIndex::A>.a_addr($t3)
  3: $t5 := read_ref($t4)
  4: $t1 := $t5
  5: $t6 := move($t1)
  6: $t7 := borrow_global<SecondaryIndex::B>($t6)
  7: $t8 := borrow_field<SecondaryIndex::B>.b_addr($t7)
  8: $t9 := read_ref($t8)
  9: return $t9
}


[variant baseline]
fun SecondaryIndex::read_secondary_index_from_global_interproc($t0|a: address): address {
     var $t1: address
     var $t2: &SecondaryIndex::A
     var $t3: address
  0: $t1 := move($t0)
  1: $t2 := borrow_global<SecondaryIndex::A>($t1)
  2: $t3 := SecondaryIndex::read_secondary_index_from_formal($t2)
  3: return $t3
}


[variant baseline]
fun SecondaryIndex::two_secondary_indexes($t0|s: &SecondaryIndex::S, $t1|b: bool): address {
     var $t2|tmp#$2: address
     var $t3: bool
     var $t4: &SecondaryIndex::S
     var $t5: &address
     var $t6: address
     var $t7: &SecondaryIndex::A
     var $t8: &address
     var $t9: address
     var $t10: &SecondaryIndex::S
     var $t11: &address
     var $t12: address
     var $t13: &SecondaryIndex::A
     var $t14: &address
     var $t15: address
     var $t16: address
  0: $t3 := move($t1)
  1: if ($t3) goto 2 else goto 11
  2: label L0
  3: $t4 := move($t0)
  4: $t5 := borrow_field<SecondaryIndex::S>.f($t4)
  5: $t6 := read_ref($t5)
  6: $t7 := borrow_global<SecondaryIndex::A>($t6)
  7: $t8 := borrow_field<SecondaryIndex::A>.a_addr($t7)
  8: $t9 := read_ref($t8)
  9: $t2 := $t9
 10: goto 20
 11: label L2
 12: $t10 := move($t0)
 13: $t11 := borrow_field<SecondaryIndex::S>.g($t10)
 14: $t12 := read_ref($t11)
 15: $t13 := borrow_global<SecondaryIndex::A>($t12)
 16: $t14 := borrow_field<SecondaryIndex::A>.a_addr($t13)
 17: $t15 := read_ref($t14)
 18: $t2 := $t15
 19: goto 20
 20: label L3
 21: $t16 := move($t2)
 22: return $t16
}


[variant baseline]
fun SecondaryIndex::write_both_fields($t0|c: &mut SecondaryIndex::C, $t1|b: SecondaryIndex::B, $t2|addr: address, $t3|flag: bool) {
     var $t4: bool
     var $t5: SecondaryIndex::B
     var $t6: &mut SecondaryIndex::C
     var $t7: &mut SecondaryIndex::B
     var $t8: bool
     var $t9: address
     var $t10: &mut SecondaryIndex::C
     var $t11: &mut SecondaryIndex::B
     var $t12: &mut address
     var $t13: &mut SecondaryIndex::C
  0: $t4 := copy($t3)
  1: if ($t4) goto 2 else goto 8
  2: label L0
  3: $t5 := move($t1)
  4: $t6 := copy($t0)
  5: $t7 := borrow_field<SecondaryIndex::C>.b($t6)
  6: write_ref($t7, $t5)
  7: goto 8
  8: label L2
  9: $t8 := move($t3)
 10: if ($t8) goto 11 else goto 18
 11: label L3
 12: $t9 := move($t2)
 13: $t10 := move($t0)
 14: $t11 := borrow_field<SecondaryIndex::C>.b($t10)
 15: $t12 := borrow_field<SecondaryIndex::B>.b_addr($t11)
 16: write_ref($t12, $t9)
 17: goto 22
 18: label L5
 19: $t13 := move($t0)
 20: destroy($t13)
 21: goto 22
 22: label L6
 23: return ()
}

============ after pipeline `read_write_set` ================

[variant baseline]
fun SecondaryIndex::call_two_secondary_indexes($t0|s: &SecondaryIndex::S): address {
     var $t1: &SecondaryIndex::S
     var $t2: bool
     var $t3: address
     # Accesses:
     # Formal(0): Read
     # Formal(0)/f: Read
     # Formal(0)/f/0x1::SecondaryIndex::A/a_addr: Read
     # Formal(0)/g: Read
     # Formal(0)/g/0x1::SecondaryIndex::A/a_addr: Read
     #
     # Locals:
     # Ret(0): {Formal(0)/f/0x1::SecondaryIndex::A/a_addr, Formal(0)/g/0x1::SecondaryIndex::A/a_addr, }
     #
  0: $t1 := move($t0)
  1: $t2 := true
  2: $t3 := SecondaryIndex::two_secondary_indexes($t1, $t2)
  3: return $t3
}


[variant baseline]
fun SecondaryIndex::read_secondary_index_from_formal($t0|a: &SecondaryIndex::A): address {
     var $t1: &SecondaryIndex::A
     var $t2: &address
     var $t3: address
     var $t4: &SecondaryIndex::B
     var $t5: &address
     var $t6: address
     # Accesses:
     # Formal(0): Read
     # Formal(0)/a_addr: Read
     # Formal(0)/a_addr/0x1::SecondaryIndex::B/b_addr: Read
     #
     # Locals:
     # Ret(0): Formal(0)/a_addr/0x1::SecondaryIndex::B/b_addr
     #
  0: $t1 := move($t0)
  1: $t2 := borrow_field<SecondaryIndex::A>.a_addr($t1)
  2: $t3 := read_ref($t2)
  3: $t4 := borrow_global<SecondaryIndex::B>($t3)
  4: $t5 := borrow_field<SecondaryIndex::B>.b_addr($t4)
  5: $t6 := read_ref($t5)
  6: return $t6
}


[variant baseline]
fun SecondaryIndex::read_secondary_index_from_formal_interproc($t0|a_addr: address): address {
     var $t1|a: SecondaryIndex::A
     var $t2: address
     var $t3: SecondaryIndex::A
     var $t4: &SecondaryIndex::A
     var $t5: address
     # Accesses:
     # Formal(0): Read
     # Formal(0)/0x1::SecondaryIndex::B/b_addr: Read
     #
     # Locals:
     # Ret(0): Formal(0)/0x1::SecondaryIndex::B/b_addr
     #
  0: $t2 := move($t0)
  1: $t3 := pack SecondaryIndex::A($t2)
  2: $t1 := $t3
  3: $t4 := borrow_local($t1)
  4: $t5 := SecondaryIndex::read_secondary_index_from_formal($t4)
  5: return $t5
}


[variant baseline]
fun SecondaryIndex::read_secondary_index_from_global($t0|a: address): address {
     var $t1|addr: address
     var $t2: address
     var $t3: &SecondaryIndex::A
     var $t4: &address
     var $t5: address
     var $t6: address
     var $t7: &SecondaryIndex::B
     var $t8: &address
     var $t9: address
     # Accesses:
     # Formal(0): Read
     # Formal(0)/0x1::SecondaryIndex::A/a_addr: Read
     # Formal(0)/0x1::SecondaryIndex::A/a_addr/0x1::SecondaryIndex::B/b_addr: Read
     #
     # Locals:
     # Ret(0): Formal(0)/0x1::SecondaryIndex::A/a_addr/0x1::SecondaryIndex::B/b_addr
     #
  0: $t2 := move($t0)
  1: $t3 := borrow_global<SecondaryIndex::A>($t2)
  2: $t4 := borrow_field<SecondaryIndex::A>.a_addr($t3)
  3: $t5 := read_ref($t4)
  4: $t1 := $t5
  5: $t6 := move($t1)
  6: $t7 := borrow_global<SecondaryIndex::B>($t6)
  7: $t8 := borrow_field<SecondaryIndex::B>.b_addr($t7)
  8: $t9 := read_ref($t8)
  9: return $t9
}


[variant baseline]
fun SecondaryIndex::read_secondary_index_from_global_interproc($t0|a: address): address {
     var $t1: address
     var $t2: &SecondaryIndex::A
     var $t3: address
     # Accesses:
     # Formal(0): Read
     # Formal(0)/0x1::SecondaryIndex::A: Read
     # Formal(0)/0x1::SecondaryIndex::A/a_addr: Read
     # Formal(0)/0x1::SecondaryIndex::A/a_addr/0x1::SecondaryIndex::B/b_addr: Read
     #
     # Locals:
     # Ret(0): Formal(0)/0x1::SecondaryIndex::A/a_addr/0x1::SecondaryIndex::B/b_addr
     #
  0: $t1 := move($t0)
  1: $t2 := borrow_global<SecondaryIndex::A>($t1)
  2: $t3 := SecondaryIndex::read_secondary_index_from_formal($t2)
  3: return $t3
}


[variant baseline]
fun SecondaryIndex::two_secondary_indexes($t0|s: &SecondaryIndex::S, $t1|b: bool): address {
     var $t2|tmp#$2: address
     var $t3: bool
     var $t4: &SecondaryIndex::S
     var $t5: &address
     var $t6: address
     var $t7: &SecondaryIndex::A
     var $t8: &address
     var $t9: address
     var $t10: &SecondaryIndex::S
     var $t11: &address
     var $t12: address
     var $t13: &SecondaryIndex::A
     var $t14: &address
     var $t15: address
     var $t16: address
     # Accesses:
     # Formal(0): Read
     # Formal(0)/f: Read
     # Formal(0)/f/0x1::SecondaryIndex::A/a_addr: Read
     # Formal(0)/g: Read
     # Formal(0)/g/0x1::SecondaryIndex::A/a_addr: Read
     # Formal(1): Read
     #
     # Locals:
     # Ret(0): {Formal(0)/f/0x1::SecondaryIndex::A/a_addr, Formal(0)/g/0x1::SecondaryIndex::A/a_addr, }
     #
  0: $t3 := move($t1)
  1: if ($t3) goto 2 else goto 11
  2: label L0
  3: $t4 := move($t0)
  4: $t5 := borrow_field<SecondaryIndex::S>.f($t4)
  5: $t6 := read_ref($t5)
  6: $t7 := borrow_global<SecondaryIndex::A>($t6)
  7: $t8 := borrow_field<SecondaryIndex::A>.a_addr($t7)
  8: $t9 := read_ref($t8)
  9: $t2 := $t9
 10: goto 20
 11: label L2
 12: $t10 := move($t0)
 13: $t11 := borrow_field<SecondaryIndex::S>.g($t10)
 14: $t12 := read_ref($t11)
 15: $t13 := borrow_global<SecondaryIndex::A>($t12)
 16: $t14 := borrow_field<SecondaryIndex::A>.a_addr($t13)
 17: $t15 := read_ref($t14)
 18: $t2 := $t15
 19: goto 20
 20: label L3
 21: $t16 := move($t2)
 22: return $t16
}


[variant baseline]
fun SecondaryIndex::write_both_fields($t0|c: &mut SecondaryIndex::C, $t1|b: SecondaryIndex::B, $t2|addr: address, $t3|flag: bool) {
     var $t4: bool
     var $t5: SecondaryIndex::B
     var $t6: &mut SecondaryIndex::C
     var $t7: &mut SecondaryIndex::B
     var $t8: bool
     var $t9: address
     var $t10: &mut SecondaryIndex::C
     var $t11: &mut SecondaryIndex::B
     var $t12: &mut address
     var $t13: &mut SecondaryIndex::C
     # Accesses:
     # Formal(0): Read
     # Formal(0)/b: Write
     # Formal(0)/b/b_addr: Write
     # Formal(1): Read
     # Formal(2): Read
     # Formal(3): Read
     #
     # Locals:
     # Formal(0)/b: {Formal(0)/b, Formal(1), }
     # Formal(0)/b/b_addr: {Formal(0)/b/b_addr, Formal(2), }
     #
  0: $t4 := copy($t3)
  1: if ($t4) goto 2 else goto 8
  2: label L0
  3: $t5 := move($t1)
  4: $t6 := copy($t0)
  5: $t7 := borrow_field<SecondaryIndex::C>.b($t6)
  6: write_ref($t7, $t5)
  7: goto 8
  8: label L2
  9: $t8 := move($t3)
 10: if ($t8) goto 11 else goto 18
 11: label L3
 12: $t9 := move($t2)
 13: $t10 := move($t0)
 14: $t11 := borrow_field<SecondaryIndex::C>.b($t10)
 15: $t12 := borrow_field<SecondaryIndex::B>.b_addr($t11)
 16: write_ref($t12, $t9)
 17: goto 22
 18: label L5
 19: $t13 := move($t0)
 20: destroy($t13)
 21: goto 22
 22: label L6
 23: return ()
}