#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int optind;
int /*<<< orphan*/ parseInputFile(char *);
scalar_t__ parseOptions(int, char **);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ writeTrace(char *);
int main(int argc, char **argv) {
  char *inputFile;
  char *traceFileName = NULL;
  int len;
  if (parseOptions(argc, argv) || argc - optind != 2) {
    fprintf(stderr, "Usage: %s [-v version] [-d] input_file trace_prefix\n",
            argv[0]);
    exit(1);
  }
  inputFile = argv[optind++];
  parseInputFile(inputFile);
  traceFileName = argv[optind++];
  writeTrace(traceFileName);
  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,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <parseOptions@plt>
cmp    $0x0,%rax
jne    1199 <main+0x49>
mov    -0x8(%rbp),%eax
mov    0x2e5a(%rip),%rcx
sub    (%rcx),%eax
cmp    $0x2,%eax
je     11bf <main+0x6f>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe50(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x2e1e(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    0x2e10(%rip),%rdx
mov    %esi,(%rdx)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <parseInputFile@plt>
mov    -0x10(%rbp),%rax
mov    0x2def(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    0x2de1(%rip),%rdx
mov    %esi,(%rdx)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <writeTrace@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
call   1040 <parseOptions@plt>
test   %rax,%rax
jne    119c <main+0x4c>
mov    0x2e7e(%rip),%r14
movslq (%r14),%rax
sub    %eax,%ebp
cmp    $0x2,%ebp
jne    119c <main+0x4c>
lea    0x1(%rax),%ecx
mov    %ecx,(%r14)
mov    (%rbx,%rax,8),%rdi
call   1070 <parseInputFile@plt>
movslq (%r14),%rax
lea    0x1(%rax),%ecx
mov    %ecx,(%r14)
mov    (%rbx,%rax,8),%rdi
call   1050 <writeTrace@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe51(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@optind = global i32 0
@stderr = global i32 0
@.str = [53 x i8] c"Usage: %s [-v version] [-d] input_file trace_prefix\0A\00"
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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %7
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i64 @parseOptions(i32 %9, i8** %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %2
%14 = load i32, i32* %4
%15 = load i32, i32* @optind
%16 = sub nsw i32 %14, %15
%17 = icmp ne i32 %16, 2
br i1 %17, label %18, label %25
18: ; preds = %13, %2
%19 = load i32, i32* @stderr
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %13
%26 = load i8**, i8*** %5
%27 = load i32, i32* @optind
%28 = add nsw i32 %27, 1
store i32 %28, i32* @optind
%29 = sext i32 %27 to i64
%30 = getelementptr inbounds i8*, i8** %26, i64 %29
%31 = load i8*, i8** %30
store i8* %31, i8** %6
%32 = load i8*, i8** %6
%33 = call i32 @parseInputFile(i8* %32)
%34 = load i8**, i8*** %5
%35 = load i32, i32* @optind
%36 = add nsw i32 %35, 1
store i32 %36, i32* @optind
%37 = sext i32 %35 to i64
%38 = getelementptr inbounds i8*, i8** %34, i64 %37
%39 = load i8*, i8** %38
store i8* %39, i8** %7
%40 = load i8*, i8** %7
%41 = call i32 @writeTrace(i8* %40)
ret i32 0
}

LLVM IR (-O2):
@optind = global i32 0
@stderr = global i32 0
@.str = [53 x i8] c"Usage: %s [-v version] [-d] input_file trace_prefix\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i64 @parseOptions(i32 %0, i8** %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @optind
%7 = sub nsw i32 %0, %6
%8 = icmp eq i32 %7, 2
br i1 %8, label %14, label %9
9: ; preds = %5, %2
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %1
%12 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %5
%15 = add nsw i32 %6, 1
store i32 %15, i32* @optind
%16 = sext i32 %6 to i64
%17 = getelementptr inbounds i8*, i8** %1, i64 %16
%18 = load i8*, i8** %17
%19 = tail call i32 @parseInputFile(i8* %18)
%20 = load i32, i32* @optind
%21 = add nsw i32 %20, 1
store i32 %21, i32* @optind
%22 = sext i32 %20 to i64
%23 = getelementptr inbounds i8*, i8** %1, i64 %22
%24 = load i8*, i8** %23
%25 = tail call i32 @writeTrace(i8* %24)
ret i32 0
}