export function w $f() {
@start
	%x0 =w loadsb $a
	# the extension must not be eliminated
	# even though the load already extended
	%x1 =l extsb %x0
	%c =w ceql %x1, -1
	ret %c
}

export function w $g(w %arg) {
@start
	%a0 =w extuh %arg                 # 1
	%a1 =w or 65536, %a0              # 65537
@loop
	%a2 =w phi @loop %a2, @start %a1  # 65537
	jnz %arg, @end, @loop
@end
	%a3 =w shr %a2, 1                 # 32768
	%a4 =w or %a2, 1                  # 65537
	%a5 =w or %a3, %a4                # 98305
	%ret =w extuh %a5                 # 32769
	ret %ret
}

# >>> driver
# char a = -1;
# extern int f(), g(int);
# int main() { return !(f() == 1 && g(1) == 32769); }
# <<<
