#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 atoi(char *);
int /*<<< orphan*/ empty();
scalar_t__ forkme();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ write_stderr();
int /*<<< orphan*/ write_stdout();
int main(int argc, char *argv[]) {
  int exit_status = 99;
  if (argc > 1)
    exit_status = atoi(argv[1]);
  empty();
  write_stdout();
  write_stderr();
  if (forkme()) {
    fprintf(stdout, "return %i\n", exit_status);
  }
  return exit_status;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x63,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1197 <main+0x37>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <empty@plt>
mov    $0x0,%al
call   1060 <write_stdout@plt>
mov    $0x0,%al
call   1070 <write_stderr@plt>
mov    $0x0,%al
call   1030 <forkme@plt>
cmp    $0x0,%rax
je     11d5 <main+0x75>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xe30(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x63,%ebx
cmp    $0x2,%edi
jl     1176 <main+0x16>
mov    0x8(%rsi),%rdi
call   1080 <atoi@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <empty@plt>
xor    %eax,%eax
call   1060 <write_stdout@plt>
xor    %eax,%eax
call   1070 <write_stderr@plt>
xor    %eax,%eax
call   1030 <forkme@plt>
test   %rax,%rax
je     11ae <main+0x4e>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
lea    0xe59(%rip),%rsi
mov    %ebx,%edx
call   1050 <fprintf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [11 x i8] c"return %i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 99, i32* %6
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @atoi(i8* %12)
store i32 %13, i32* %6
br label %14
14: ; preds = %9, %2
%15 = call i32 (...) @empty()
%16 = call i32 (...) @write_stdout()
%17 = call i32 (...) @write_stderr()
%18 = call i64 (...) @forkme()
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %14
%21 = load i32, i32* @stdout
%22 = load i32, i32* %6
%23 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %20, %14
%25 = load i32, i32* %6
ret i32 %25
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [11 x i8] c"return %i\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
br label %8
8: ; preds = %4, %2
%9 = phi i32 [ %7, %4 ], [ 99, %2 ]
%10 = tail call i32 (...) @empty()
%11 = tail call i32 (...) @write_stdout()
%12 = tail call i32 (...) @write_stderr()
%13 = tail call i64 (...) @forkme()
%14 = icmp eq i64 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %8
%16 = load i32, i32* @stdout
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %18
18: ; preds = %15, %8
ret i32 %9
}