#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 one();
int zero();
int main() {
  int x;
  int y;
  x = zero();
  y = ++x;
  if (x != 1)
    return 1;
  if (y != 1)
    return 1;
  x = one();
  y = --x;
  if (x != 0)
    return 1;
  if (y != 0)
    return 1;
  x = zero();
  y = x++;
  if (x != 1)
    return 1;
  if (y != 0)
    return 1;
  x = one();
  y = x--;
  if (x != 0)
    return 1;
  if (y != 1)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <zero@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     115b <main+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    1242 <main+0x122>
cmpl   $0x1,-0xc(%rbp)
je     1171 <main+0x51>
movl   $0x1,-0x4(%rbp)
jmp    1242 <main+0x122>
mov    $0x0,%al
call   1040 <one@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     119d <main+0x7d>
movl   $0x1,-0x4(%rbp)
jmp    1242 <main+0x122>
cmpl   $0x0,-0xc(%rbp)
je     11b3 <main+0x93>
movl   $0x1,-0x4(%rbp)
jmp    1242 <main+0x122>
mov    $0x0,%al
call   1030 <zero@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     11e1 <main+0xc1>
movl   $0x1,-0x4(%rbp)
jmp    1242 <main+0x122>
cmpl   $0x0,-0xc(%rbp)
je     11f7 <main+0xd7>
movl   $0x1,-0x4(%rbp)
jmp    1242 <main+0x122>
mov    $0x0,%al
call   1040 <one@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1225 <main+0x105>
movl   $0x1,-0x4(%rbp)
jmp    1242 <main+0x122>
cmpl   $0x1,-0xc(%rbp)
je     123b <main+0x11b>
movl   $0x1,-0x4(%rbp)
jmp    1242 <main+0x122>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <zero@plt>
mov    $0x1,%ebx
test   %eax,%eax
jne    1157 <main+0x37>
xor    %eax,%eax
call   1040 <one@plt>
cmp    $0x1,%eax
jne    1157 <main+0x37>
xor    %eax,%eax
call   1030 <zero@plt>
test   %eax,%eax
jne    1157 <main+0x37>
xor    %eax,%eax
call   1040 <one@plt>
xor    %ebx,%ebx
cmp    $0x1,%eax
setne  %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @zero()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
store i32 %6, i32* %2
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 1
br i1 %8, label %9, label %10
9: ; preds = %0
store i32 1, i32* %1
br label %48
10: ; preds = %0
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, 1
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 1, i32* %1
br label %48
14: ; preds = %10
%15 = call i32 (...) @one()
store i32 %15, i32* %2
%16 = load i32, i32* %2
%17 = add nsw i32 %16, -1
store i32 %17, i32* %2
store i32 %17, i32* %3
%18 = load i32, i32* %2
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %14
store i32 1, i32* %1
br label %48
21: ; preds = %14
%22 = load i32, i32* %3
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %21
store i32 1, i32* %1
br label %48
25: ; preds = %21
%26 = call i32 (...) @zero()
store i32 %26, i32* %2
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
store i32 %27, i32* %3
%29 = load i32, i32* %2
%30 = icmp ne i32 %29, 1
br i1 %30, label %31, label %32
31: ; preds = %25
store i32 1, i32* %1
br label %48
32: ; preds = %25
%33 = load i32, i32* %3
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %32
store i32 1, i32* %1
br label %48
36: ; preds = %32
%37 = call i32 (...) @one()
store i32 %37, i32* %2
%38 = load i32, i32* %2
%39 = add nsw i32 %38, -1
store i32 %39, i32* %2
store i32 %38, i32* %3
%40 = load i32, i32* %2
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %36
store i32 1, i32* %1
br label %48
43: ; preds = %36
%44 = load i32, i32* %3
%45 = icmp ne i32 %44, 1
br i1 %45, label %46, label %47
46: ; preds = %43
store i32 1, i32* %1
br label %48
47: ; preds = %43
store i32 0, i32* %1
br label %48
48: ; preds = %47, %46, %42, %35, %31, %24, %20, %13, %9
%49 = load i32, i32* %1
ret i32 %49
}

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