#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 /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int foo(int, int *);
int main() {
  int x;
  x = 0;
  if (foo(0, &x) != 0)
    abort();
  x = 1;
  if (foo(0, &x) != 1)
    abort();
  x = 0;
  if (foo(1, &x) != 0)
    abort();
  x = 1;
  if (foo(1, &x) != 0)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xor    %edi,%edi
lea    -0x8(%rbp),%rsi
call   1040 <foo@plt>
cmp    $0x0,%eax
je     1161 <main+0x31>
mov    $0x0,%al
call   1030 <abort@plt>
movl   $0x1,-0x8(%rbp)
xor    %edi,%edi
lea    -0x8(%rbp),%rsi
call   1040 <foo@plt>
cmp    $0x1,%eax
je     1183 <main+0x53>
mov    $0x0,%al
call   1030 <abort@plt>
movl   $0x0,-0x8(%rbp)
mov    $0x1,%edi
lea    -0x8(%rbp),%rsi
call   1040 <foo@plt>
cmp    $0x0,%eax
je     11a8 <main+0x78>
mov    $0x0,%al
call   1030 <abort@plt>
movl   $0x1,-0x8(%rbp)
mov    $0x1,%edi
lea    -0x8(%rbp),%rsi
call   1040 <foo@plt>
cmp    $0x0,%eax
je     11cd <main+0x9d>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
xor    %edi,%edi
call   1040 <foo@plt>
test   %eax,%eax
jne    119f <main+0x6f>
movl   $0x1,0x4(%rsp)
lea    0x4(%rsp),%rsi
xor    %edi,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    119f <main+0x6f>
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x1,%edi
call   1040 <foo@plt>
test   %eax,%eax
jne    119f <main+0x6f>
movl   $0x1,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x1,%edi
call   1040 <foo@plt>
test   %eax,%eax
jne    119f <main+0x6f>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 @foo(i32 0, i32* %2)
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %0
store i32 1, i32* %2
%8 = call i32 @foo(i32 0, i32* %2)
%9 = icmp ne i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %7
store i32 0, i32* %2
%13 = call i32 @foo(i32 1, i32* %2)
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 (...) @abort()
unreachable
17: ; preds = %12
store i32 1, i32* %2
%18 = call i32 @foo(i32 1, i32* %2)
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 (...) @abort()
unreachable
22: ; preds = %17
%23 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @foo(i32 0, i32* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %0
store i32 1, i32* %1
%8 = call i32 @foo(i32 0, i32* %1)
%9 = icmp eq i32 %8, 1
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %7
store i32 0, i32* %1
%13 = call i32 @foo(i32 1, i32* %1)
%14 = icmp eq i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = call i32 (...) @abort()
unreachable
17: ; preds = %12
store i32 1, i32* %1
%18 = call i32 @foo(i32 1, i32* %1)
%19 = icmp eq i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = call i32 (...) @abort()
unreachable
22: ; preds = %17
%23 = call i32 @exit(i32 0)
unreachable
}