(module
 (type $0 (func (param i32)))
 (type $1 (func (result i32)))
 (type $2 (func))
 (global $global$0 (mut i32) (i32.const 1))
 (func $basics (param $x i32)
  (local $y i32)
  (local $z f32)
  (local $w i64)
  (local $t f64)
  (local $5 i32)
  (local $6 f64)
  (local $7 f64)
  (drop
   (local.get $x)
  )
  (drop
   (i32.const 0)
  )
  (drop
   (f32.const 0)
  )
  (drop
   (i64.const 0)
  )
  (drop
   (f64.const 0)
  )
  (local.set $5
   (i32.const 100)
  )
  (drop
   (local.get $5)
  )
  (local.set $6
   (f64.const 2)
  )
  (drop
   (local.get $6)
  )
  (local.set $7
   (f64.const 33)
  )
  (drop
   (local.get $7)
  )
  (drop
   (local.get $7)
  )
 )
 (func $if (param $p i32)
  (local $x i32)
  (local $y i32)
  (local $3 i32)
  (local $4 i32)
  (local $5 i32)
  (local $6 i32)
  (local $7 i32)
  (local $8 i32)
  (local $9 i32)
  (local $10 i32)
  (local $11 i32)
  (local $12 i32)
  (local $13 i32)
  (local $14 i32)
  (local $15 i32)
  (local $16 i32)
  (local $17 i32)
  (local.set $13
   (local.get $p)
  )
  (block
   (drop
    (if (result i32)
     (i32.const 1)
     (then
      (i32.const 0)
     )
     (else
      (i32.const 0)
     )
    )
   )
   (if
    (i32.const 1)
    (then
     (local.set $3
      (local.tee $15
       (local.tee $14
        (local.tee $12
         (i32.const 1)
        )
       )
      )
     )
    )
   )
   (drop
    (local.get $12)
   )
   (if
    (i32.const 1)
    (then
     (local.set $4
      (local.tee $13
       (i32.const 1)
      )
     )
    )
   )
   (drop
    (local.get $13)
   )
   (if
    (i32.const 1)
    (then
     (local.set $5
      (local.tee $15
       (local.tee $14
        (i32.const 2)
       )
      )
     )
    )
    (else
     (nop)
    )
   )
   (drop
    (local.get $14)
   )
   (if
    (i32.const 1)
    (then
     (nop)
    )
    (else
     (local.set $6
      (local.tee $15
       (i32.const 3)
      )
     )
    )
   )
   (drop
    (local.get $15)
   )
   (if
    (i32.const 1)
    (then
     (local.set $7
      (local.tee $16
       (i32.const 4)
      )
     )
    )
    (else
     (local.set $8
      (local.tee $16
       (i32.const 5)
      )
     )
    )
   )
   (drop
    (local.get $16)
   )
   (if
    (i32.const 1)
    (then
     (local.set $9
      (local.tee $17
       (i32.const 6)
      )
     )
    )
    (else
     (local.set $10
      (i32.const 7)
     )
     (local.set $11
      (local.tee $17
       (i32.const 8)
      )
     )
    )
   )
   (drop
    (local.get $17)
   )
  )
 )
 (func $if2 (param $x i32)
  (local $1 i32)
  (local $2 i32)
  (local.set $2
   (local.get $x)
  )
  (block
   (if
    (i32.const 1)
    (then
     (local.set $1
      (local.tee $2
       (i32.const 1)
      )
     )
     (drop
      (local.get $1)
     )
    )
   )
   (drop
    (local.get $2)
   )
  )
 )
 (func $block (param $x i32)
  (local $1 i32)
  (local $2 i32)
  (local.set $2
   (local.get $x)
  )
  (block
   (block $out
    (br_if $out
     (i32.const 2)
    )
    (local.set $1
     (local.tee $2
      (i32.const 1)
     )
    )
   )
   (drop
    (local.get $2)
   )
  )
 )
 (func $block2 (param $x i32)
  (local $1 i32)
  (local $2 i32)
  (local $3 i32)
  (local $4 i32)
  (local $5 i32)
  (local $6 i32)
  (block $out
   (local.set $1
    (local.tee $6
     (i32.const 1)
    )
   )
   (drop
    (local.get $1)
   )
   (br_if $out
    (i32.const 2)
   )
   (drop
    (local.get $1)
   )
   (if
    (i32.const 3)
    (then
     (local.set $2
      (local.tee $6
       (i32.const 1)
      )
     )
     (drop
      (local.get $2)
     )
     (br $out)
    )
   )
   (drop
    (local.get $1)
   )
   (local.set $3
    (local.tee $6
     (i32.const 4)
    )
   )
   (drop
    (local.get $3)
   )
   (if
    (i32.const 5)
    (then
     (br $out)
    )
   )
   (drop
    (local.get $3)
   )
   (if
    (i32.const 6)
    (then
     (nop)
    )
   )
   (if
    (i32.const 7)
    (then
     (nop)
    )
    (else
     (nop)
    )
   )
   (block $in
    (local.set $4
     (local.tee $6
      (i32.const 8)
     )
    )
    (drop
     (local.get $4)
    )
    (br_table $in $out
     (i32.const 9)
    )
   )
   (drop
    (local.get $4)
   )
   (block $in2
    (local.set $5
     (local.tee $6
      (i32.const 10)
     )
    )
    (drop
     (local.get $5)
    )
    (br_table $out $in2
     (i32.const 11)
    )
   )
   (drop
    (local.get $5)
   )
  )
  (drop
   (local.get $6)
  )
 )
 (func $loop (param $x i32)
  (local $1 i32)
  (local $2 i32)
  (local.set $2
   (local.get $x)
  )
  (block
   (drop
    (local.get $x)
   )
   (loop $moar
    (drop
     (local.get $2)
    )
    (local.set $1
     (local.tee $2
      (i32.const 1)
     )
    )
    (br_if $moar
     (i32.const 2)
    )
   )
   (drop
    (local.get $1)
   )
  )
 )
 (func $loop2 (param $x i32)
  (local $1 i32)
  (local $2 i32)
  (local $3 i32)
  (local $4 i32)
  (local.set $4
   (local.get $x)
  )
  (block
   (drop
    (local.get $x)
   )
   (loop $moar
    (drop
     (local.get $4)
    )
    (local.set $1
     (i32.const 1)
    )
    (drop
     (local.get $1)
    )
    (local.set $2
     (local.tee $4
      (i32.const 123)
     )
    )
    (drop
     (local.get $2)
    )
    (br_if $moar
     (i32.const 2)
    )
    (drop
     (local.get $2)
    )
    (local.set $3
     (i32.const 3)
    )
    (drop
     (local.get $3)
    )
   )
   (drop
    (local.get $3)
   )
  )
 )
 (func $loop2-zeroinit
  (local $x i32)
  (local $1 i32)
  (local $2 i32)
  (local $3 i32)
  (local $4 i32)
  (drop
   (i32.const 0)
  )
  (loop $moar
   (drop
    (local.get $4)
   )
   (local.set $1
    (i32.const 1)
   )
   (drop
    (local.get $1)
   )
   (local.set $2
    (local.tee $4
     (i32.const 123)
    )
   )
   (drop
    (local.get $2)
   )
   (br_if $moar
    (i32.const 2)
   )
   (drop
    (local.get $2)
   )
   (local.set $3
    (i32.const 3)
   )
   (drop
    (local.get $3)
   )
  )
  (drop
   (local.get $3)
  )
 )
 (func $real-loop (param $param i32)
  (local $loopvar i32)
  (local $inc i32)
  (local $3 i32)
  (local $4 i32)
  (local $5 i32)
  (local $6 i32)
  (local.set $3
   (local.tee $6
    (local.tee $5
     (local.get $param)
    )
   )
  )
  (loop $more
   (block $stop
    (if
     (i32.const 1)
     (then
      (br $stop)
     )
    )
    (local.set $inc
     (i32.add
      (local.get $5)
      (i32.const 1)
     )
    )
    (local.set $4
     (local.tee $6
      (local.tee $5
       (local.get $inc)
      )
     )
    )
    (br $more)
   )
  )
  (drop
   (local.get $6)
  )
 )
 (func $real-loop-outblock (param $param i32)
  (local $loopvar i32)
  (local $inc i32)
  (local $3 i32)
  (local $4 i32)
  (local $5 i32)
  (local $6 i32)
  (local.set $3
   (local.tee $6
    (local.tee $5
     (local.get $param)
    )
   )
  )
  (block $stop
   (loop $more
    (if
     (i32.const 1)
     (then
      (br $stop)
     )
    )
    (local.set $inc
     (i32.add
      (local.get $5)
      (i32.const 1)
     )
    )
    (local.set $4
     (local.tee $6
      (local.tee $5
       (local.get $inc)
      )
     )
    )
    (br $more)
   )
  )
  (drop
   (local.get $6)
  )
 )
 (func $loop-loop-param (param $param i32)
  (local $1 i32)
  (local $2 i32)
  (local $3 i32)
  (local $4 i32)
  (local.set $3
   (local.get $param)
  )
  (local.set $4
   (local.get $param)
  )
  (block
   (loop $loop1
    (block $out1
     (if
      (local.get $3)
      (then
       (br $out1)
      )
     )
     (local.set $1
      (local.tee $4
       (local.tee $3
        (i32.const 1)
       )
      )
     )
     (br $loop1)
    )
   )
   (loop $loop2
    (block $out2
     (if
      (local.get $4)
      (then
       (br $out2)
      )
     )
     (local.set $2
      (local.tee $4
       (i32.const 2)
      )
     )
     (br $loop2)
    )
   )
  )
 )
 (func $loop-loop-param-nomerge (param $param i32)
  (local $1 i32)
  (local $2 i32)
  (local $3 i32)
  (loop $loop1
   (block $out1
    (local.set $1
     (local.tee $3
      (i32.const 1)
     )
    )
    (if
     (local.get $1)
     (then
      (br $out1)
     )
    )
    (br $loop1)
   )
  )
  (loop $loop2
   (block $out2
    (if
     (local.get $3)
     (then
      (br $out2)
     )
    )
    (local.set $2
     (local.tee $3
      (i32.const 2)
     )
    )
    (br $loop2)
   )
  )
 )
 (func $loop-nesting (param $x i32)
  (local $1 i32)
  (local $2 i32)
  (local $3 i32)
  (local $4 i32)
  (local $5 i32)
  (local.set $3
   (local.get $x)
  )
  (local.set $4
   (local.get $x)
  )
  (local.set $5
   (local.get $x)
  )
  (block
   (block $out
    (loop $loop1
     (if
      (local.get $3)
      (then
       (br $out)
      )
     )
     (loop $loop2
      (if
       (local.get $4)
       (then
        (br $out)
       )
      )
      (local.set $1
       (local.tee $5
        (local.tee $4
         (i32.const 1)
        )
       )
      )
      (br $loop2)
     )
     (local.set $2
      (local.tee $5
       (local.tee $4
        (local.tee $3
         (i32.const 2)
        )
       )
      )
     )
     (br $loop1)
    )
   )
   (drop
    (local.get $5)
   )
  )
 )
 (func $loop-nesting-2 (param $x i32)
  (local $1 i32)
  (local $2 i32)
  (local $3 i32)
  (local $4 i32)
  (local $5 i32)
  (local.set $3
   (local.get $x)
  )
  (local.set $4
   (local.get $x)
  )
  (local.set $5
   (local.get $x)
  )
  (block
   (block $out
    (loop $loop1
     (if
      (local.get $3)
      (then
       (br $out)
      )
     )
     (loop $loop2
      (if
       (local.get $4)
       (then
        (br $out)
       )
      )
      (local.set $1
       (local.tee $5
        (local.tee $4
         (i32.const 1)
        )
       )
      )
      (br_if $loop2
       (i32.const 3)
      )
     )
     (local.set $2
      (local.tee $5
       (local.tee $4
        (local.tee $3
         (i32.const 2)
        )
       )
      )
     )
     (br $loop1)
    )
   )
   (drop
    (local.get $5)
   )
  )
 )
 (func $func_6 (result i32)
  (local $result i32)
  (local $zero i32)
  (local $2 i32)
  (local $3 i32)
  (local $4 i32)
  (loop $label$1
   (if
    (i32.eqz
     (global.get $global$0)
    )
    (then
     (return
      (local.get $4)
     )
    )
   )
   (global.set $global$0
    (i32.const 0)
   )
   (local.set $2
    (local.tee $4
     (i32.const 1)
    )
   )
   (br_if $label$1
    (i32.const 0)
   )
   (local.set $3
    (local.tee $4
     (i32.const 0)
    )
   )
   (br $label$1)
  )
 )
 (func $ssa-merge-tricky (result i32)
  (local $var$0 i32)
  (local $var$1 i32)
  (local $2 i32)
  (local $3 i32)
  (local $4 i32)
  (local $5 i32)
  (local $6 i32)
  (local $7 i32)
  (local $8 i32)
  (local.set $3
   (local.tee $8
    (local.tee $2
     (local.tee $7
      (i32.const 0)
     )
    )
   )
  )
  (loop $label$1
   (if
    (i32.eqz
     (global.get $global$0)
    )
    (then
     (return
      (i32.const 12345)
     )
    )
   )
   (global.set $global$0
    (i32.const 0)
   )
   (if
    (i32.eqz
     (local.get $7)
    )
    (then
     (br_if $label$1
      (i32.eqz
       (local.tee $4
        (local.tee $7
         (i32.const 1)
        )
       )
      )
     )
    )
   )
   (br_if $label$1
    (i32.eqz
     (local.tee $6
      (local.tee $8
       (local.tee $5
        (local.tee $7
         (local.get $8)
        )
       )
      )
     )
    )
   )
  )
  (i32.const -54)
 )
)
