#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 */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ cctools_debug_flags_print(int /*<<< orphan*/);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int parrot_debug(char const *, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  const char *flags = NULL;
  const char *file = NULL;
  off_t size = 0;
  if (!(2 <= argc && argc <= 4)) {
    fprintf(stderr, "Use: %s <flags> [file [size]]\n", argv[0]);
    fprintf(stderr, "Debug flags are: ");
    cctools_debug_flags_print(stderr);
    fprintf(stderr, "\n");
    exit(EXIT_FAILURE);
  }
  flags = argv[1];
  if (argc >= 3)
    file = argv[2];
  if (argc >= 4)
    size = strtol(argv[3], NULL, 10);
  int result = parrot_debug(flags, file, size);
  if (result == -1) {
    fprintf(stderr, "debug: %s\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    $0x2,%eax
cmp    -0x8(%rbp),%eax
jg     11a5 <main+0x45>
cmpl   $0x4,-0x8(%rbp)
jle    120d <main+0xad>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe44(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
lea    0xe4c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
call   1060 <cctools_debug_flags_print@plt>
mov    0x2df1(%rip),%rax
mov    (%rax),%edi
lea    0xe25(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     122f <main+0xcf>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x4,-0x8(%rbp)
jl     1252 <main+0xf2>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1040 <parrot_debug@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0xffffffff,-0x28(%rbp)
jne    12ab <main+0x14b>
mov    0x2d6a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2d56(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    -0x2c(%rbp),%edi
mov    %rax,%rdx
lea    0xd9b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2d2c(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    -0x2(%rdi),%eax
cmp    $0x3,%eax
jae    11ad <main+0x4d>
mov    0x8(%rsi),%r14
xor    %edx,%edx
cmp    $0x3,%edi
jb     1191 <main+0x31>
mov    0x10(%rsi),%rbx
je     1193 <main+0x33>
mov    0x18(%rsi),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,%edx
jmp    1193 <main+0x33>
xor    %ebx,%ebx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <parrot_debug@plt>
cmp    $0xffffffff,%eax
je     11f0 <main+0x90>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e2c(%rip),%rbx
mov    (%rbx),%edi
mov    (%rsi),%rdx
lea    0xe40(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe4f(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
call   1060 <cctools_debug_flags_print@plt>
mov    (%rbx),%edi
lea    0xe36(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    121a <main+0xba>
mov    0x2de9(%rip),%rax
mov    (%rax),%ebx
mov    0x2dd8(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
lea    0xe23(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x2daf(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"Use: %s <flags> [file [size]]\0A\00"
@.str.1 = [18 x i8] c"Debug flags are: \00"
@.str.2 = [2 x i8] c"\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [11 x i8] c"debug: %s\0A\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %7
store i32 0, i32* %8
%10 = load i32, i32* %4
%11 = icmp sle i32 2, %10
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* %4
%14 = icmp sle i32 %13, 4
br i1 %14, label %29, label %15
15: ; preds = %12, %2
%16 = load i32, i32* @stderr
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = load i32, i32* @stderr
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%23 = load i32, i32* @stderr
%24 = call i32 @cctools_debug_flags_print(i32 %23)
%25 = load i32, i32* @stderr
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%27 = load i32, i32* @EXIT_FAILURE
%28 = call i32 @exit(i32 %27)
unreachable
29: ; preds = %12
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
store i8* %32, i8** %6
%33 = load i32, i32* %4
%34 = icmp sge i32 %33, 3
br i1 %34, label %35, label %39
35: ; preds = %29
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
store i8* %38, i8** %7
br label %39
39: ; preds = %35, %29
%40 = load i32, i32* %4
%41 = icmp sge i32 %40, 4
br i1 %41, label %42, label %47
42: ; preds = %39
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 3
%45 = load i8*, i8** %44
%46 = call i32 @strtol(i8* %45, i32* null, i32 10)
store i32 %46, i32* %8
br label %47
47: ; preds = %42, %39
%48 = load i8*, i8** %6
%49 = load i8*, i8** %7
%50 = load i32, i32* %8
%51 = call i32 @parrot_debug(i8* %48, i8* %49, i32 %50)
store i32 %51, i32* %9
%52 = load i32, i32* %9
%53 = icmp eq i32 %52, -1
br i1 %53, label %54, label %61
54: ; preds = %47
%55 = load i32, i32* @stderr
%56 = load i32, i32* @errno
%57 = call i8* @strerror(i32 %56)
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %57)
%59 = load i32, i32* @EXIT_FAILURE
%60 = call i32 @exit(i32 %59)
unreachable
61: ; preds = %47
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"Use: %s <flags> [file [size]]\0A\00"
@.str.1 = [18 x i8] c"Debug flags are: \00"
@.str.2 = [2 x i8] c"\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [11 x i8] c"debug: %s\0A\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = add i32 %0, -2
%4 = icmp ult i32 %3, 3
br i1 %4, label %17, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %1
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = tail call i32 @cctools_debug_flags_print(i32 %11)
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
%16 = tail call i32 @exit(i32 %15)
unreachable
17: ; preds = %2
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = icmp ugt i32 %0, 2
br i1 %20, label %21, label %29
21: ; preds = %17
%22 = getelementptr inbounds i8*, i8** %1, i64 2
%23 = load i8*, i8** %22
%24 = icmp eq i32 %0, 3
br i1 %24, label %29, label %25
25: ; preds = %21
%26 = getelementptr inbounds i8*, i8** %1, i64 3
%27 = load i8*, i8** %26
%28 = tail call i32 @strtol(i8* nocapture %27, i32* null, i32 10)
br label %29
29: ; preds = %17, %25, %21
%30 = phi i8* [ %23, %25 ], [ %23, %21 ], [ null, %17 ]
%31 = phi i32 [ %28, %25 ], [ 0, %21 ], [ 0, %17 ]
%32 = tail call i32 @parrot_debug(i8* %19, i8* %30, i32 %31)
%33 = icmp eq i32 %32, -1
br i1 %33, label %34, label %41
34: ; preds = %29
%35 = load i32, i32* @stderr
%36 = load i32, i32* @errno
%37 = tail call i8* @strerror(i32 %36)
%38 = tail call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %37)
%39 = load i32, i32* @EXIT_FAILURE
%40 = tail call i32 @exit(i32 %39)
unreachable
41: ; preds = %29
ret i32 0
}