#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int bar();
int baz();
int foo();
int main(void) {
  char a = 1, b = 2;
  int t1 = (a == 0 && (b = 0));
  int t2 = a || 1 || (b = 1);
  return b + foo() + bar() + baz();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x1,-0x5(%rbp)
movb   $0x2,-0x6(%rbp)
movsbl -0x5(%rbp),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
jne    1162 <main+0x32>
movb   $0x0,-0x6(%rbp)
xor    %eax,%eax
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
movsbl -0x5(%rbp),%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x12(%rbp)
jne    119a <main+0x6a>
mov    $0x1,%al
test   $0x1,%al
mov    %al,-0x12(%rbp)
jne    119a <main+0x6a>
jmp    1191 <main+0x61>
movb   $0x1,-0x6(%rbp)
mov    $0x1,%al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
movsbl -0x6(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    $0x0,%al
call   1050 <foo@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1040 <bar@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <baz@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <foo@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <bar@plt>
mov    %eax,%ebx
add    %ebp,%ebx
xor    %eax,%eax
call   1030 <baz@plt>
add    %ebx,%eax
add    $0x2,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i8 1, i8* %2
store i8 2, i8* %3
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %0
store i8 0, i8* %3
br label %10
10: ; preds = %9, %0
%11 = phi i1 [ false, %0 ], [ false, %9 ]
%12 = zext i1 %11 to i32
store i32 %12, i32* %4
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %10
br i1 true, label %18, label %17
17: ; preds = %16
store i8 1, i8* %3
br label %18
18: ; preds = %17, %16, %10
%19 = phi i1 [ true, %16 ], [ true, %10 ], [ true, %17 ]
%20 = zext i1 %19 to i32
store i32 %20, i32* %5
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = call i32 (...) @foo()
%24 = add nsw i32 %22, %23
%25 = call i32 (...) @bar()
%26 = add nsw i32 %24, %25
%27 = call i32 (...) @baz()
%28 = add nsw i32 %26, %27
ret i32 %28
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foo()
%2 = add nsw i32 %1, 2
%3 = tail call i32 (...) @bar()
%4 = add nsw i32 %2, %3
%5 = tail call i32 (...) @baz()
%6 = add nsw i32 %4, %5
ret i32 %6
}