#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);
int foo(int);
int main() {
  return foo(0) != 0 || foo(1) != 1 || bar(0) != 0 || bar(1) != 2 ||
         bar(2) != 5;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1040 <foo@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x5(%rbp)
jne    11a4 <main+0x84>
mov    $0x1,%edi
call   1040 <foo@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x1,%ecx
mov    %al,-0x5(%rbp)
jne    11a4 <main+0x84>
xor    %edi,%edi
call   1030 <bar@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x5(%rbp)
jne    11a4 <main+0x84>
mov    $0x1,%edi
call   1030 <bar@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x2,%ecx
mov    %al,-0x5(%rbp)
jne    11a4 <main+0x84>
mov    $0x2,%edi
call   1030 <bar@plt>
cmp    $0x5,%eax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1040 <foo@plt>
mov    $0x1,%ebx
test   %eax,%eax
jne    1176 <main+0x56>
mov    $0x1,%ebx
mov    $0x1,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    1176 <main+0x56>
xor    %edi,%edi
call   1030 <bar@plt>
test   %eax,%eax
jne    1176 <main+0x56>
mov    $0x1,%ebx
mov    $0x1,%edi
call   1030 <bar@plt>
cmp    $0x2,%eax
jne    1176 <main+0x56>
mov    $0x2,%edi
call   1030 <bar@plt>
xor    %ebx,%ebx
cmp    $0x5,%eax
setne  %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @foo(i32 0)
%3 = icmp ne i32 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %0
%5 = call i32 @foo(i32 1)
%6 = icmp ne i32 %5, 1
br i1 %6, label %16, label %7
7: ; preds = %4
%8 = call i32 @bar(i32 0)
%9 = icmp ne i32 %8, 0
br i1 %9, label %16, label %10
10: ; preds = %7
%11 = call i32 @bar(i32 1)
%12 = icmp ne i32 %11, 2
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = call i32 @bar(i32 2)
%15 = icmp ne i32 %14, 5
br label %16
16: ; preds = %13, %10, %7, %4, %0
%17 = phi i1 [ true, %10 ], [ true, %7 ], [ true, %4 ], [ true, %0 ], [ %15, %13 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 0)
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %16
3: ; preds = %0
%4 = tail call i32 @foo(i32 1)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = tail call i32 @bar(i32 0)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = tail call i32 @bar(i32 1)
%11 = icmp eq i32 %10, 2
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = tail call i32 @bar(i32 2)
%14 = icmp ne i32 %13, 5
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %12, %9, %6, %3, %0
%17 = phi i32 [ 1, %9 ], [ 1, %6 ], [ 1, %3 ], [ 1, %0 ], [ %15, %12 ]
ret i32 %17
}