#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__ cloudvpn_boot(int, char **);
scalar_t__ cloudvpn_core_finish();
scalar_t__ cloudvpn_core_init();
scalar_t__ cloudvpn_run();
int main(int argc, char **argv) {
  if (cloudvpn_core_init())
    return 1;
  if (cloudvpn_boot(argc, argv))
    return 2;
  if (cloudvpn_run())
    return 3;
  if (cloudvpn_core_finish())
    return 4;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <cloudvpn_core_init@plt>
cmp    $0x0,%rax
je     1173 <main+0x33>
movl   $0x1,-0x4(%rbp)
jmp    11d6 <main+0x96>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <cloudvpn_boot@plt>
cmp    $0x0,%rax
je     1195 <main+0x55>
movl   $0x2,-0x4(%rbp)
jmp    11d6 <main+0x96>
mov    $0x0,%al
call   1060 <cloudvpn_run@plt>
cmp    $0x0,%rax
je     11b2 <main+0x72>
movl   $0x3,-0x4(%rbp)
jmp    11d6 <main+0x96>
mov    $0x0,%al
call   1050 <cloudvpn_core_finish@plt>
cmp    $0x0,%rax
je     11cf <main+0x8f>
movl   $0x4,-0x4(%rbp)
jmp    11d6 <main+0x96>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <cloudvpn_core_init@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    119c <main+0x5c>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <cloudvpn_boot@plt>
mov    %rax,%rcx
mov    $0x2,%eax
test   %rcx,%rcx
jne    119c <main+0x5c>
xor    %eax,%eax
call   1060 <cloudvpn_run@plt>
mov    %rax,%rcx
mov    $0x3,%eax
test   %rcx,%rcx
jne    119c <main+0x5c>
xor    %eax,%eax
call   1050 <cloudvpn_core_finish@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
shl    $0x2,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i64 (...) @cloudvpn_core_init()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 1, i32* %3
br label %24
9: ; preds = %2
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i64 @cloudvpn_boot(i32 %10, i8** %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %9
store i32 2, i32* %3
br label %24
15: ; preds = %9
%16 = call i64 (...) @cloudvpn_run()
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 3, i32* %3
br label %24
19: ; preds = %15
%20 = call i64 (...) @cloudvpn_core_finish()
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 4, i32* %3
br label %24
23: ; preds = %19
store i32 0, i32* %3
br label %24
24: ; preds = %23, %22, %18, %14, %8
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i64 (...) @cloudvpn_core_init()
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %15
5: ; preds = %2
%6 = tail call i64 @cloudvpn_boot(i32 %0, i8** %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = tail call i64 (...) @cloudvpn_run()
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = tail call i64 (...) @cloudvpn_core_finish()
%13 = icmp eq i64 %12, 0
%14 = select i1 %13, i32 0, i32 4
br label %15
15: ; preds = %11, %8, %5, %2
%16 = phi i32 [ 1, %2 ], [ 2, %5 ], [ 3, %8 ], [ %14, %11 ]
ret i32 %16
}