#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 /*<<< orphan*/ SIGABRT;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  fprintf(stderr, "starting ...\n");
  if (argc > 1) {
    if (strcmp(argv[1], "exit") == 0) {
      fprintf(stderr, "exiting ...\n");
      exit(1);
    }
    if (strcmp(argv[1], "abort") == 0) {
      fprintf(stderr, "aborting ...\n");
      kill(getpid(), SIGABRT);
    }
  }
  fprintf(stderr, "returning ...\n");
  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    0x2e73(%rip),%rax
mov    (%rax),%edi
lea    0xe8a(%rip),%rsi
call   1050 <fprintf@plt>
cmpl   $0x1,-0x8(%rbp)
jle    1211 <main+0xc1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe7a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11c2 <main+0x72>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
lea    0xe60(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe4f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    120c <main+0xbc>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
lea    0xe36(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
mov    0x2dd3(%rip),%rax
mov    (%rax),%esi
call   1060 <kill@plt>
jmp    1211 <main+0xc1>
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
lea    0xe13(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e80(%rip),%r14
mov    (%r14),%edi
lea    0xe96(%rip),%rsi
call   1050 <fprintf@plt>
cmp    $0x2,%ebp
jl     11c4 <main+0x74>
mov    0x8(%rbx),%rdi
lea    0xe8f(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11da <main+0x8a>
mov    0x8(%rbx),%rdi
lea    0xe8c(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11c4 <main+0x74>
mov    (%r14),%edi
lea    0xe7e(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
call   1030 <getpid@plt>
mov    0x2e1d(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1060 <kill@plt>
mov    (%r14),%edi
lea    0xe66(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    (%r14),%edi
lea    0xe2f(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [14 x i8] c"starting ...\0A\00"
@.str.1 = [5 x i8] c"exit\00"
@.str.2 = [13 x i8] c"exiting ...\0A\00"
@.str.3 = [6 x i8] c"abort\00"
@.str.4 = [14 x i8] c"aborting ...\0A\00"
@SIGABRT = global i32 0
@.str.5 = [15 x i8] c"returning ...\0A\00"
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 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %33
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %10
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %10
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %32
26: ; preds = %20
%27 = load i32, i32* @stderr
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%29 = call i32 (...) @getpid()
%30 = load i32, i32* @SIGABRT
%31 = call i32 @kill(i32 %29, i32 %30)
br label %32
32: ; preds = %26, %20
br label %33
33: ; preds = %32, %2
%34 = load i32, i32* @stderr
%35 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [14 x i8] c"starting ...\0A\00"
@.str.1 = [5 x i8] c"exit\00"
@.str.2 = [13 x i8] c"exiting ...\0A\00"
@.str.3 = [6 x i8] c"abort\00"
@.str.4 = [14 x i8] c"aborting ...\0A\00"
@SIGABRT = global i32 0
@.str.5 = [15 x i8] c"returning ...\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %25
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %6
%16 = load i8*, i8** %7
%17 = tail call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %15
%20 = load i32, i32* @stderr
%21 = tail call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%22 = tail call i32 (...) @getpid()
%23 = load i32, i32* @SIGABRT
%24 = tail call i32 @kill(i32 %22, i32 %23)
br label %25
25: ; preds = %15, %19, %2
%26 = load i32, i32* @stderr
%27 = tail call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}