#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 */
scalar_t__ none();
scalar_t__ one(int);
scalar_t__ three(int, int, int);
scalar_t__ two(int, int);
int main() {
  if (none())
    return 1;
  if (one(1))
    return 2;
  if (two(1, 2))
    return 3;
  if (three(1, 2, 3))
    return 4;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <none@plt>
cmp    $0x0,%rax
je     116c <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    11e2 <main+0xa2>
mov    $0x1,%edi
call   1040 <one@plt>
cmp    $0x0,%rax
je     118c <main+0x4c>
movl   $0x2,-0x4(%rbp)
jmp    11e2 <main+0xa2>
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <two@plt>
cmp    $0x0,%rax
je     11b1 <main+0x71>
movl   $0x3,-0x4(%rbp)
jmp    11e2 <main+0xa2>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1050 <three@plt>
cmp    $0x0,%rax
je     11db <main+0x9b>
movl   $0x4,-0x4(%rbp)
jmp    11e2 <main+0xa2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <none@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1157 <main+0x17>
pop    %rcx
ret
mov    $0x1,%edi
call   1040 <one@plt>
mov    %rax,%rcx
mov    $0x2,%eax
test   %rcx,%rcx
jne    1155 <main+0x15>
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <two@plt>
mov    %rax,%rcx
mov    $0x3,%eax
test   %rcx,%rcx
jne    1155 <main+0x15>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1050 <three@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
shl    $0x2,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 (...) @none()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 1, i32* %1
br label %18
5: ; preds = %0
%6 = call i64 @one(i32 1)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %5
store i32 2, i32* %1
br label %18
9: ; preds = %5
%10 = call i64 @two(i32 1, i32 2)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 3, i32* %1
br label %18
13: ; preds = %9
%14 = call i64 @three(i32 1, i32 2, i32 3)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 4, i32* %1
br label %18
17: ; preds = %13
store i32 0, i32* %1
br label %18
18: ; preds = %17, %16, %12, %8, %4
%19 = load i32, i32* %1
ret i32 %19
}

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