#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*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ free(char *);
char *getReadFileDataErrorDescription(int);
int /*<<< orphan*/ parse(char *, long);
int /*<<< orphan*/ portal_status();
int readFileData(char *, char **, long *);
int /*<<< orphan*/ stderr;
int main(int nArgc, char *szArgv[]) {
  int i;
  if (nArgc < 2) {
    fprintf(stderr, "usage: %s { file }\n", szArgv[0]);
    return 1;
  }
  for (i = 1; i < nArgc; i++) {
    char *sData;
    long nDataLen;
    int nResult = readFileData(szArgv[i], &sData, &nDataLen);
    if (nResult != 0) {
      fprintf(stderr, "couldn't read %s (%s).\n", szArgv[i],
              getReadFileDataErrorDescription(nResult));
    } else {
      parse(sData, nDataLen);
      free(sData);
    }
  }
  portal_status();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11aa <main+0x4a>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe69(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    125b <main+0xfb>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    124d <main+0xed>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1050 <readFileData@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     1224 <main+0xc4>
mov    0x2df6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x38(%rbp)
mov    -0x2c(%rbp),%edi
call   1040 <getReadFileDataErrorDescription@plt>
mov    -0x3c(%rbp),%edi
mov    -0x38(%rbp),%rdx
mov    %rax,%rcx
lea    0xdfc(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    123a <main+0xda>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1080 <parse@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
jmp    123f <main+0xdf>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b1 <main+0x51>
mov    $0x0,%al
call   1070 <portal_status@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r13
cmp    $0x2,%edi
jge    119b <main+0x3b>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xe76(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%ebx
jmp    121e <main+0xbe>
mov    %edi,%r12d
mov    $0x1,%r14d
lea    0x10(%rsp),%r15
jmp    11d2 <main+0x72>
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rdi
mov    0x10(%rsp),%rsi
call   1080 <parse@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
add    $0x1,%r14
cmp    %r14,%r12
je     1215 <main+0xb5>
mov    0x0(%r13,%r14,8),%rdi
lea    0x8(%rsp),%rsi
mov    %r15,%rdx
call   1050 <readFileData@plt>
test   %eax,%eax
je     11b0 <main+0x50>
mov    0x2df1(%rip),%rcx
mov    (%rcx),%ebp
mov    0x0(%r13,%r14,8),%rbx
mov    %eax,%edi
call   1040 <getReadFileDataErrorDescription@plt>
mov    %ebp,%edi
lea    0xe0e(%rip),%rsi
mov    %rbx,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    11c9 <main+0x69>
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <portal_status@plt>
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"usage: %s { file }\0A\00"
@.str.1 = [24 x i8] c"couldn't read %s (%s).\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 1, i32* %3
br label %54
18: ; preds = %2
store i32 1, i32* %6
br label %19
19: ; preds = %49, %18
%20 = load i32, i32* %6
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %52
23: ; preds = %19
%24 = load i8**, i8*** %5
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @readFileData(i8* %28, i8** %7, i64* %8)
store i32 %29, i32* %9
%30 = load i32, i32* %9
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %42
32: ; preds = %23
%33 = load i32, i32* @stderr
%34 = load i8**, i8*** %5
%35 = load i32, i32* %6
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = load i32, i32* %9
%40 = call i8* @getReadFileDataErrorDescription(i32 %39)
%41 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %38, i8* %40)
br label %48
42: ; preds = %23
%43 = load i8*, i8** %7
%44 = load i64, i64* %8
%45 = call i32 @parse(i8* %43, i64 %44)
%46 = load i8*, i8** %7
%47 = call i32 @free(i8* %46)
br label %48
48: ; preds = %42, %32
br label %49
49: ; preds = %48
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
br label %19
52: ; preds = %19
%53 = call i32 (...) @portal_status()
store i32 0, i32* %3
br label %54
54: ; preds = %52, %12
%55 = load i32, i32* %3
ret i32 %55
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"usage: %s { file }\0A\00"
@.str.1 = [24 x i8] c"couldn't read %s (%s).\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = icmp slt i32 %0, 2
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = bitcast i8** %3 to i8*
%8 = bitcast i64* %4 to i8*
%9 = zext i32 %0 to i64
br label %14
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %1
%13 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %36
14: ; preds = %6, %31
%15 = phi i64 [ 1, %6 ], [ %32, %31 ]
%16 = getelementptr inbounds i8*, i8** %1, i64 %15
%17 = load i8*, i8** %16
%18 = call i32 @readFileData(i8* %17, i8** %3, i64* %4)
%19 = icmp eq i32 %18, 0
br i1 %19, label %25, label %20
20: ; preds = %14
%21 = load i32, i32* @stderr
%22 = load i8*, i8** %16
%23 = call i8* @getReadFileDataErrorDescription(i32 %18)
%24 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %22, i8* %23)
br label %31
25: ; preds = %14
%26 = load i8*, i8** %3
%27 = load i64, i64* %4
%28 = call i32 @parse(i8* %26, i64 %27)
%29 = load i8*, i8** %3
%30 = call i32 @free(i8* %29)
br label %31
31: ; preds = %25, %20
%32 = add nuw nsw i64 %15, 1
%33 = icmp eq i64 %32, %9
br i1 %33, label %34, label %14
34: ; preds = %31
%35 = call i32 (...) @portal_status()
br label %36
36: ; preds = %34, %10
%37 = phi i32 [ 1, %10 ], [ 0, %34 ]
ret i32 %37
}