---
# System prepended metadata

title: Untitled

---

function f(a, b, c) -> r { // R c b a
  let x := add(a, b)
  sstore(c, x)
  r := mul(a, x)
} // R r



function g(a, b, c) -> r {
    let x := mul(c, a)
    let * = let(a, 42)
    // true needs x b on stack; false needs x on stack
    if * {
        x := b
    }
    // needs x on stack
    
    r := x    // needs x on stack
}

r := f()

g(a1, ..., a16)
h(b1, ..., b16)

i(r, r)


stack top on left

function entry(b1, ..., b10, a1...a10) {

let a1,...,a10 := x()
let b1,...,b10 := y()
// FW: have: b1...b10 a1...a10


// BW: wants b1...b10 a1...a10
let r := f()
// FW: have r X1...X15 X16...Xn
// FW: have X15 X1...X14 r X16...Xn

a10 := 42

// BW: wants b1...b10 a1...a10 r
g(b1, ..., b10)

// BW: wants a1...a10 r
h(a1, ..., a10)

// BW: wants r
i(r, r)

}





function entry(b1, ..., b10, a1...a10) {

let a1,...,a10 := x()



// BW: wants a2...a10 a1

let r := f()
// r X1...X10
// X10 X1...X9 r

// BW: wants a1...a10 r
g(a1, ..., a10)

a2 := f(a10)

// BW: wants a1...a10 r
h(a1, ..., a10)

// BW: wants r
i(r, r)

}

[x b] [x]
=> [x]

[x *]


b cond
{
    b
    x
}
b x


x


a b c d
a b c d

a b c d [R] b 0
a b c d r

a b d c r
a b s

b a s
b x

=> b

------

a b c d
a b c d

. b c d [R] a 0
. b c d r

. b d c r
. b s

. b s
. x

=> b

------

a b c d
a b c d

d b c a 0
d b c

b c d
b

x b
=> b

------
