int main() {
  int i;
  int x = ({ f(); });
  assert(x == 1);
  int y = ({ i = f(); });
  assert(y == 1);
  assert(i == 1);
  int z = ({
    i = 1;
    i++;
  });
  assert(z == 1);
  assert(i == 2);
  ({
    i = 1;
    i++;
  });
  assert(i == 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <f@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1040 <assert@plt>
mov    $0x0,%al
call   1030 <f@plt>
mov    %eax,-0x8(%rbp)
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1040 <assert@plt>
cmpl   $0x1,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1040 <assert@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1040 <assert@plt>
cmpl   $0x2,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1040 <assert@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
mov    %eax,-0x24(%rbp)
cmpl   $0x2,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <f@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
xor    %eax,%eax
call   1040 <assert@plt>
xor    %eax,%eax
call   1030 <f@plt>
xor    %ebx,%ebx
cmp    $0x1,%eax
sete   %bl
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <assert@plt>
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <assert@plt>
mov    $0x1,%edi
xor    %eax,%eax
call   1040 <assert@plt>
mov    $0x1,%edi
xor    %eax,%eax
call   1040 <assert@plt>
mov    $0x1,%edi
xor    %eax,%eax
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32 (...) @f()
store i32 %10, i32* %4
%11 = load i32, i32* %4
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 1
%14 = zext i1 %13 to i32
%15 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %14)
%16 = call i32 (...) @f()
store i32 %16, i32* %2
store i32 %16, i32* %6
%17 = load i32, i32* %6
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = icmp eq i32 %18, 1
%20 = zext i1 %19 to i32
%21 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %20)
%22 = load i32, i32* %2
%23 = icmp eq i32 %22, 1
%24 = zext i1 %23 to i32
%25 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %24)
store i32 1, i32* %2
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
store i32 %26, i32* %8
%28 = load i32, i32* %8
store i32 %28, i32* %7
%29 = load i32, i32* %7
%30 = icmp eq i32 %29, 1
%31 = zext i1 %30 to i32
%32 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %31)
%33 = load i32, i32* %2
%34 = icmp eq i32 %33, 2
%35 = zext i1 %34 to i32
%36 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %35)
store i32 1, i32* %2
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 1
store i32 %38, i32* %2
store i32 %37, i32* %9
%39 = load i32, i32* %9
%40 = load i32, i32* %2
%41 = icmp eq i32 %40, 2
%42 = zext i1 %41 to i32
%43 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %42)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @f()
%2 = icmp eq i32 %1, 1
%3 = zext i1 %2 to i32
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %3)
%5 = tail call i32 (...) @f()
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %7)
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %7)
%10 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 1)
%11 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 1)
%12 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 1)
ret i32 0
}