#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*/ get32(unsigned char **);
unsigned char *parsePacket(unsigned char *);
int /*<<< orphan*/ printf(char *, char *);
unsigned char *readFile(char *, long *);
int main(int argc, char **argv) {
  if (argc == 1) {
    printf("Usage:%s fileName [fileName[..]]\n", argv[0]);
    return 0;
  } else {
    unsigned char *buffer;
    long bufferLength;
    buffer = readFile(argv[1], &bufferLength);
    int i;
    for (i = 0; i < 6; i++) {
      get32(&buffer);
    }
    for (i = 0; i < 5; i++)
      buffer = parsePacket(buffer);
    return 1;
  }
}


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)
cmpl   $0x1,-0x8(%rbp)
jne    117f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ef <main+0xaf>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <readFile@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x6,-0x24(%rbp)
jge    11bc <main+0x7c>
lea    -0x18(%rbp),%rdi
call   1050 <get32@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    119b <main+0x5b>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    11e8 <main+0xa8>
mov    -0x18(%rbp),%rdi
call   1030 <parsePacket@plt>
mov    %rax,-0x18(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11c3 <main+0x83>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
cmp    $0x1,%edi
jne    1160 <main+0x20>
mov    (%rsi),%rsi
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
jmp    11e3 <main+0xa3>
mov    0x8(%rsi),%rdi
lea    0x8(%rsp),%rsi
call   1060 <readFile@plt>
mov    %rax,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <get32@plt>
mov    %rbx,%rdi
call   1050 <get32@plt>
mov    %rbx,%rdi
call   1050 <get32@plt>
mov    %rbx,%rdi
call   1050 <get32@plt>
mov    %rbx,%rdi
call   1050 <get32@plt>
mov    %rbx,%rdi
call   1050 <get32@plt>
mov    (%rsp),%rdi
call   1030 <parsePacket@plt>
mov    %rax,(%rsp)
mov    %rax,%rdi
call   1030 <parsePacket@plt>
mov    %rax,(%rsp)
mov    %rax,%rdi
call   1030 <parsePacket@plt>
mov    %rax,(%rsp)
mov    %rax,%rdi
call   1030 <parsePacket@plt>
mov    %rax,(%rsp)
mov    %rax,%rdi
call   1030 <parsePacket@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Usage:%s fileName [fileName[..]]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 0, i32* %3
br label %40
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i8* @readFile(i8* %19, i64* %7)
store i8* %20, i8** %6
store i32 0, i32* %8
br label %21
21: ; preds = %26, %16
%22 = load i32, i32* %8
%23 = icmp slt i32 %22, 6
br i1 %23, label %24, label %29
24: ; preds = %21
%25 = call i32 @get32(i8** %6)
br label %26
26: ; preds = %24
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
br label %21
29: ; preds = %21
store i32 0, i32* %8
br label %30
30: ; preds = %36, %29
%31 = load i32, i32* %8
%32 = icmp slt i32 %31, 5
br i1 %32, label %33, label %39
33: ; preds = %30
%34 = load i8*, i8** %6
%35 = call i8* @parsePacket(i8* %34)
store i8* %35, i8** %6
br label %36
36: ; preds = %33
%37 = load i32, i32* %8
%38 = add nsw i32 %37, 1
store i32 %38, i32* %8
br label %30
39: ; preds = %30
store i32 1, i32* %3
br label %40
40: ; preds = %39, %11
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@.str = [34 x i8] c"Usage:%s fileName [fileName[..]]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = icmp eq i32 %0, 1
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %27
9: ; preds = %2
%10 = bitcast i8** %3 to i8*
%11 = bitcast i64* %4 to i8*
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = call i8* @readFile(i8* %13, i64* %4)
store i8* %14, i8** %3
%15 = call i32 @get32(i8** %3)
%16 = call i32 @get32(i8** %3)
%17 = call i32 @get32(i8** %3)
%18 = call i32 @get32(i8** %3)
%19 = call i32 @get32(i8** %3)
%20 = call i32 @get32(i8** %3)
%21 = load i8*, i8** %3
%22 = call i8* @parsePacket(i8* %21)
store i8* %22, i8** %3
%23 = call i8* @parsePacket(i8* %22)
store i8* %23, i8** %3
%24 = call i8* @parsePacket(i8* %23)
store i8* %24, i8** %3
%25 = call i8* @parsePacket(i8* %24)
store i8* %25, i8** %3
%26 = call i8* @parsePacket(i8* %25)
br label %27
27: ; preds = %9, %6
%28 = phi i32 [ 0, %6 ], [ 1, %9 ]
ret i32 %28
}