#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ DumpEidData(int /*<<< orphan*/ *, int, int, char *);
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  FILE *pFile;
  char *pPrefix;
  pFile = fopen(argv[1], "rb");
  if (pFile == NULL) {
  usage:
    printf("usage: %s <eEID> <EID name prefix>\n", argv[0]);
    exit(1);
  }
  if (argc == 2 && argv[2] != NULL) {
    pPrefix = argv[2];
    goto usage;
  }
  fseek(pFile, 0x70, SEEK_SET);
  if (pPrefix != NULL) {
    DumpEidData(pFile, 2144, 0, pPrefix);
    DumpEidData(pFile, 672, 1, pPrefix);
    DumpEidData(pFile, 1840, 2, pPrefix);
    DumpEidData(pFile, 256, 3, pPrefix);
    DumpEidData(pFile, 48, 4, pPrefix);
    DumpEidData(pFile, 2560, 5, pPrefix);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe8b(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11ab <main+0x5b>
jmp    118e <main+0x3e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
cmpl   $0x2,-0x8(%rbp)
jne    11d5 <main+0x85>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x10(%rax)
je     11d5 <main+0x85>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    118e <main+0x3e>
mov    -0x18(%rbp),%rdi
mov    0x2e00(%rip),%rax
mov    (%rax),%edx
mov    $0x70,%esi
call   1050 <fseek@plt>
cmpq   $0x0,-0x20(%rbp)
je     127e <main+0x12e>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x860,%esi
xor    %edx,%edx
call   1040 <DumpEidData@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x2a0,%esi
mov    $0x1,%edx
call   1040 <DumpEidData@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x730,%esi
mov    $0x2,%edx
call   1040 <DumpEidData@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x100,%esi
mov    $0x3,%edx
call   1040 <DumpEidData@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x30,%esi
mov    $0x4,%edx
call   1040 <DumpEidData@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0xa00,%esi
mov    $0x5,%edx
call   1040 <DumpEidData@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
lea    0xead(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1188 <main+0x48>
cmp    $0x2,%ebp
jne    1169 <main+0x29>
cmpq   $0x0,0x10(%rbx)
jne    1188 <main+0x48>
mov    0x2e70(%rip),%rcx
mov    (%rcx),%edx
mov    %rax,%rdi
mov    $0x70,%esi
call   1040 <fseek@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    (%rbx),%rsi
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@.str.1 = [36 x i8] c"usage: %s <eEID> <EID name prefix>\0A\00"
@SEEK_SET = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %11, i32** %6
%12 = load i32*, i32** %6
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %21
14: ; preds = %2
br label %15
15: ; preds = %29, %14
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %2
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 2
br i1 %23, label %24, label %33
24: ; preds = %21
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = icmp ne i8* %27, null
br i1 %28, label %29, label %33
29: ; preds = %24
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
store i8* %32, i8** %7
br label %15
33: ; preds = %24, %21
%34 = load i32*, i32** %6
%35 = load i32, i32* @SEEK_SET
%36 = call i32 @fseek(i32* %34, i32 112, i32 %35)
%37 = load i8*, i8** %7
%38 = icmp ne i8* %37, null
br i1 %38, label %39, label %58
39: ; preds = %33
%40 = load i32*, i32** %6
%41 = load i8*, i8** %7
%42 = call i32 @DumpEidData(i32* %40, i32 2144, i32 0, i8* %41)
%43 = load i32*, i32** %6
%44 = load i8*, i8** %7
%45 = call i32 @DumpEidData(i32* %43, i32 672, i32 1, i8* %44)
%46 = load i32*, i32** %6
%47 = load i8*, i8** %7
%48 = call i32 @DumpEidData(i32* %46, i32 1840, i32 2, i8* %47)
%49 = load i32*, i32** %6
%50 = load i8*, i8** %7
%51 = call i32 @DumpEidData(i32* %49, i32 256, i32 3, i8* %50)
%52 = load i32*, i32** %6
%53 = load i8*, i8** %7
%54 = call i32 @DumpEidData(i32* %52, i32 48, i32 4, i8* %53)
%55 = load i32*, i32** %6
%56 = load i8*, i8** %7
%57 = call i32 @DumpEidData(i32* %55, i32 2560, i32 5, i8* %56)
br label %58
58: ; preds = %39, %33
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@.str.1 = [36 x i8] c"usage: %s <eEID> <EID name prefix>\0A\00"
@SEEK_SET = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32* @fopen(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %11
7: ; preds = %13, %2
%8 = load i8*, i8** %1
%9 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = icmp eq i32 %0, 2
br i1 %12, label %13, label %17
13: ; preds = %11
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %7
17: ; preds = %13, %11
%18 = load i32, i32* @SEEK_SET
%19 = tail call i32 @fseek(i32* %5, i32 112, i32 %18)
ret i32 0
}