#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 const *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getpid();
int /*<<< orphan*/ stderr;
int do_exit(int argc, const char **argv) {
  int r = 0;
  if (getpid() == 1) {
    fprintf(stderr, "You are the INIT process!\n");
    return 1;
  }
  if (argc == 2) {
    r = atoi(argv[1]);
  }
  exit(r);
  return 1;
}


x86 assembly (clang, -O0):
<do_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
cmp    $0x1,%eax
jne    1186 <do_exit+0x46>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
lea    0xe8a(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret
cmpl   $0x2,-0x4(%rbp)
jne    11a0 <do_exit+0x60>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<do_exit>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %r14d,%r14d
xor    %eax,%eax
call   1030 <getpid@plt>
cmp    $0x1,%eax
jne    1177 <do_exit+0x37>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
lea    0xe98(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
cmp    $0x2,%ebp
jne    1188 <do_exit+0x48>
mov    0x8(%rbx),%rdi
call   1050 <atoi@plt>
mov    %eax,%r14d
mov    %r14d,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"You are the INIT process!\0A\00"
define i32 @do_exit(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %5
%6 = call i32 (...) @getpid()
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret i32 1
11: ; preds = %2
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 2
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = load i8**, i8*** %4
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
store i32 %18, i32* %5
br label %19
19: ; preds = %14, %11
%20 = load i32, i32* %5
%21 = call i32 @exit(i32 %20)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"You are the INIT process!\0A\00"
define i32 @do_exit(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @getpid()
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret i32 1
8: ; preds = %2
%9 = icmp eq i32 %0, 2
br i1 %9, label %10, label %14
10: ; preds = %8
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
br label %14
14: ; preds = %10, %8
%15 = phi i32 [ %13, %10 ], [ 0, %8 ]
%16 = tail call i32 @exit(i32 %15)
unreachable
}