#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 */
size_t dumpHex(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
size_t dumpStr(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ stderr;
scalar_t__ strcasecmp(char *, char *);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  FILE *inFile;
  FILE *outCFile;
  FILE *outHFile;
  size_t bufLen;
  if (argc < 6) {
    usage(argv[0]);
    return -1;
  }
  if (strcasecmp(argv[4], "BIN") != 0 && strcasecmp(argv[4], "BINSTR") != 0 &&
      strcasecmp(argv[4], "STR") != 0) {
    usage(argv[0]);
    return -1;
  }
  inFile = fopen(argv[1], "rb");
  if (!inFile) {
    fprintf(stderr, "ERROR: Couldn't open data file '%s'.\n", argv[1]);
    return -1;
  }
  outCFile = fopen(argv[2], "w");
  if (!outCFile) {
    fclose(inFile);
    fprintf(stderr, "ERROR: Couldn't create output source file '%s'.\n",
            argv[2]);
    return -1;
  }
  outHFile = fopen(argv[3], "w");
  if (!outHFile) {
    fclose(outCFile);
    fclose(inFile);
    fprintf(stderr, "ERROR: Couldn't create output header file '%s'.\n",
            argv[3]);
    return -1;
  }
  fprintf(outCFile, "/* This file is autogenerated, do not edit. */\n\n");
  if (argc >= 8) {
    fprintf(outCFile, "#include \"%s\"\n", argv[7]);
  }
  fprintf(outCFile, "#include \"%s\"\n\n", argv[3]);
  if (argc >= 7) {
    fprintf(outCFile, "%s ", argv[6]);
  }
  fprintf(outCFile, "unsigned char %s[] =", argv[5]);
  if (strcasecmp(argv[4], "BIN") == 0)
    bufLen = dumpHex(inFile, outCFile, 0);
  else if (strcasecmp(argv[4], "BINSTR") == 0)
    bufLen = dumpHex(inFile, outCFile, 1);
  else
    bufLen = dumpStr(inFile, outCFile);
  fprintf(outCFile, ";\n");
  fclose(outCFile);
  fprintf(outHFile, "/* This file is autogenerated, do not edit. */\n\n");
  fprintf(outHFile, "#define %s_SIZE %lu\n", argv[5], bufLen);
  fprintf(outHFile, "extern unsigned char %s[%lu];\n", argv[5], bufLen);
  fclose(outHFile);
  fclose(inFile);
  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)
cmpl   $0x6,-0x8(%rbp)
jge    11a8 <main+0x38>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1080 <usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14b7 <main+0x347>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0xe49(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     121a <main+0xaa>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0xe2f(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     121a <main+0xaa>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0xe14(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     121a <main+0xaa>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1080 <usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14b7 <main+0x347>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xde2(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1269 <main+0xf9>
mov    0x2d9c(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdb8(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14b7 <main+0x347>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdbc(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    12c1 <main+0x151>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2d44(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xd88(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14b7 <main+0x347>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xd64(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1322 <main+0x1b2>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2ce3(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
lea    0xd58(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14b7 <main+0x347>
mov    -0x20(%rbp),%rdi
lea    0xd6b(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
cmpl   $0x8,-0x8(%rbp)
jl     1358 <main+0x1e8>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rdx
lea    0xd78(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
lea    0xd6d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
cmpl   $0x7,-0x8(%rbp)
jl     1396 <main+0x226>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rdx
lea    0xd59(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdx
lea    0xd43(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0xc41(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    13e6 <main+0x276>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
xor    %edx,%edx
call   1070 <dumpHex@plt>
mov    %rax,-0x30(%rbp)
jmp    1435 <main+0x2c5>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0xc0f(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    141f <main+0x2af>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x1,%edx
call   1070 <dumpHex@plt>
mov    %rax,-0x30(%rbp)
jmp    1430 <main+0x2c0>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <dumpStr@plt>
mov    %rax,-0x30(%rbp)
jmp    1435 <main+0x2c5>
mov    -0x20(%rbp),%rdi
lea    0xcf2(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x28(%rbp),%rdi
lea    0xc3d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdx
mov    -0x30(%rbp),%rcx
lea    0xc88(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdx
mov    -0x30(%rbp),%rcx
lea    0xc7f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
cmp    $0x5,%edi
jg     11a5 <main+0x25>
mov    (%r15),%rdi
call   1080 <usage@plt>
mov    $0xffffffff,%ebp
jmp    1408 <main+0x288>
mov    %edi,%ebp
mov    0x20(%r15),%rbx
lea    0xe4e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     11e7 <main+0x67>
lea    0xe3e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     11e7 <main+0x67>
lea    0xe2d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
jne    1193 <main+0x13>
mov    0x8(%r15),%rdi
lea    0xe19(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     128c <main+0x10c>
mov    %rax,%r14
mov    0x10(%r15),%rdi
lea    0xe26(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     12a3 <main+0x123>
mov    %rax,%r12
mov    0x18(%r15),%rdi
lea    0xe0a(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     12c2 <main+0x142>
mov    %rax,%rbx
lea    0xe56(%rip),%rdi
mov    $0x30,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   10a0 <fwrite@plt>
cmp    $0x8,%ebp
jb     12f8 <main+0x178>
mov    0x38(%r15),%rdx
lea    0xe61(%rip),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x18(%r15),%rdx
lea    0xe5b(%rip),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    1312 <main+0x192>
mov    0x2d4d(%rip),%rax
movslq (%rax),%rdi
mov    0x8(%r15),%rdx
lea    0xd6d(%rip),%rsi
jmp    12e7 <main+0x167>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    0x2d2e(%rip),%rax
movslq (%rax),%rdi
mov    0x10(%r15),%rdx
lea    0xd76(%rip),%rsi
jmp    12e7 <main+0x167>
mov    %r12,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    0x2d07(%rip),%rax
movslq (%rax),%rdi
mov    0x18(%r15),%rdx
lea    0xd80(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xffffffff,%ebp
jmp    1408 <main+0x288>
mov    0x18(%r15),%rdx
lea    0xdd5(%rip),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <fprintf@plt>
cmp    $0x7,%ebp
jne    1327 <main+0x1a7>
mov    0x30(%r15),%rdx
lea    0xdcb(%rip),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x28(%r15),%rdx
lea    0xdba(%rip),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x20(%r15),%rbp
lea    0xcb9(%rip),%rsi
mov    %rbp,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1375 <main+0x1f5>
lea    0xca9(%rip),%rsi
mov    %rbp,%rdi
call   1030 <strcasecmp@plt>
mov    %r14,%rdi
mov    %r12,%rsi
test   %rax,%rax
je     137f <main+0x1ff>
call   1050 <dumpStr@plt>
jmp    1389 <main+0x209>
mov    %r14,%rdi
mov    %r12,%rsi
xor    %edx,%edx
jmp    1384 <main+0x204>
mov    $0x1,%edx
call   1070 <dumpHex@plt>
mov    %rax,%r13
lea    0xd9f(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   10a0 <fwrite@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
lea    0xce4(%rip),%rdi
mov    $0x30,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
mov    0x28(%r15),%rdx
lea    0xd30(%rip),%rsi
xor    %ebp,%ebp
mov    %rbx,%rdi
mov    %r13,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x28(%r15),%rdx
lea    0xd2b(%rip),%rsi
mov    %rbx,%rdi
mov    %r13,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"BIN\00"
@.str.1 = [7 x i8] c"BINSTR\00"
@.str.2 = [4 x i8] c"STR\00"
@.str.3 = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.4 = [38 x i8] c"ERROR: Couldn't open data file '%s'.\0A\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [49 x i8] c"ERROR: Couldn't create output source file '%s'.\0A\00"
@.str.7 = [49 x i8] c"ERROR: Couldn't create output header file '%s'.\0A\00"
@.str.8 = [49 x i8] c"/* This file is autogenerated, do not edit. */\0A\0A\00"
@.str.9 = [15 x i8] c"#include \22%s\22\0A\00"
@.str.10 = [16 x i8] c"#include \22%s\22\0A\0A\00"
@.str.11 = [4 x i8] c"%s \00"
@.str.12 = [21 x i8] c"unsigned char %s[] =\00"
@.str.13 = [3 x i8] c";\0A\00"
@.str.14 = [21 x i8] c"#define %s_SIZE %lu\0A\00"
@.str.15 = [31 x i8] c"extern unsigned char %s[%lu];\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i64
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, 6
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @usage(i8* %15)
store i32 -1, i32* %3
br label %169
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 4
%20 = load i8*, i8** %19
%21 = call i64 @strcasecmp(i8* %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %40
23: ; preds = %17
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 4
%26 = load i8*, i8** %25
%27 = call i64 @strcasecmp(i8* %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %40
29: ; preds = %23
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 4
%32 = load i8*, i8** %31
%33 = call i64 @strcasecmp(i8* %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %40
35: ; preds = %29
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 0
%38 = load i8*, i8** %37
%39 = call i32 @usage(i8* %38)
store i32 -1, i32* %3
br label %169
40: ; preds = %29, %23, %17
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = load i8*, i8** %42
%44 = call i32* @fopen(i8* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %44, i32** %6
%45 = load i32*, i32** %6
%46 = icmp ne i32* %45, null
br i1 %46, label %55, label %47
47: ; preds = %40
%48 = load i32, i32* @stderr
%49 = sext i32 %48 to i64
%50 = inttoptr i64 %49 to i32*
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 1
%53 = load i8*, i8** %52
%54 = call i32 (i32*, i8*, ...) @fprintf(i32* %50, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i8* %53)
store i32 -1, i32* %3
br label %169
55: ; preds = %40
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 2
%58 = load i8*, i8** %57
%59 = call i32* @fopen(i8* %58, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %59, i32** %7
%60 = load i32*, i32** %7
%61 = icmp ne i32* %60, null
br i1 %61, label %72, label %62
62: ; preds = %55
%63 = load i32*, i32** %6
%64 = call i32 @fclose(i32* %63)
%65 = load i32, i32* @stderr
%66 = sext i32 %65 to i64
%67 = inttoptr i64 %66 to i32*
%68 = load i8**, i8*** %5
%69 = getelementptr inbounds i8*, i8** %68, i64 2
%70 = load i8*, i8** %69
%71 = call i32 (i32*, i8*, ...) @fprintf(i32* %67, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0), i8* %70)
store i32 -1, i32* %3
br label %169
72: ; preds = %55
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 3
%75 = load i8*, i8** %74
%76 = call i32* @fopen(i8* %75, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %76, i32** %8
%77 = load i32*, i32** %8
%78 = icmp ne i32* %77, null
br i1 %78, label %91, label %79
79: ; preds = %72
%80 = load i32*, i32** %7
%81 = call i32 @fclose(i32* %80)
%82 = load i32*, i32** %6
%83 = call i32 @fclose(i32* %82)
%84 = load i32, i32* @stderr
%85 = sext i32 %84 to i64
%86 = inttoptr i64 %85 to i32*
%87 = load i8**, i8*** %5
%88 = getelementptr inbounds i8*, i8** %87, i64 3
%89 = load i8*, i8** %88
%90 = call i32 (i32*, i8*, ...) @fprintf(i32* %86, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0), i8* %89)
store i32 -1, i32* %3
br label %169
91: ; preds = %72
%92 = load i32*, i32** %7
%93 = call i32 (i32*, i8*, ...) @fprintf(i32* %92, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0))
%94 = load i32, i32* %4
%95 = icmp sge i32 %94, 8
br i1 %95, label %96, label %102
96: ; preds = %91
%97 = load i32*, i32** %7
%98 = load i8**, i8*** %5
%99 = getelementptr inbounds i8*, i8** %98, i64 7
%100 = load i8*, i8** %99
%101 = call i32 (i32*, i8*, ...) @fprintf(i32* %97, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* %100)
br label %102
102: ; preds = %96, %91
%103 = load i32*, i32** %7
%104 = load i8**, i8*** %5
%105 = getelementptr inbounds i8*, i8** %104, i64 3
%106 = load i8*, i8** %105
%107 = call i32 (i32*, i8*, ...) @fprintf(i32* %103, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8* %106)
%108 = load i32, i32* %4
%109 = icmp sge i32 %108, 7
br i1 %109, label %110, label %116
110: ; preds = %102
%111 = load i32*, i32** %7
%112 = load i8**, i8*** %5
%113 = getelementptr inbounds i8*, i8** %112, i64 6
%114 = load i8*, i8** %113
%115 = call i32 (i32*, i8*, ...) @fprintf(i32* %111, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i8* %114)
br label %116
116: ; preds = %110, %102
%117 = load i32*, i32** %7
%118 = load i8**, i8*** %5
%119 = getelementptr inbounds i8*, i8** %118, i64 5
%120 = load i8*, i8** %119
%121 = call i32 (i32*, i8*, ...) @fprintf(i32* %117, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0), i8* %120)
%122 = load i8**, i8*** %5
%123 = getelementptr inbounds i8*, i8** %122, i64 4
%124 = load i8*, i8** %123
%125 = call i64 @strcasecmp(i8* %124, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%126 = icmp eq i64 %125, 0
br i1 %126, label %127, label %131
127: ; preds = %116
%128 = load i32*, i32** %6
%129 = load i32*, i32** %7
%130 = call i64 @dumpHex(i32* %128, i32* %129, i32 0)
store i64 %130, i64* %9
br label %146
131: ; preds = %116
%132 = load i8**, i8*** %5
%133 = getelementptr inbounds i8*, i8** %132, i64 4
%134 = load i8*, i8** %133
%135 = call i64 @strcasecmp(i8* %134, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%136 = icmp eq i64 %135, 0
br i1 %136, label %137, label %141
137: ; preds = %131
%138 = load i32*, i32** %6
%139 = load i32*, i32** %7
%140 = call i64 @dumpHex(i32* %138, i32* %139, i32 1)
store i64 %140, i64* %9
br label %145
141: ; preds = %131
%142 = load i32*, i32** %6
%143 = load i32*, i32** %7
%144 = call i64 @dumpStr(i32* %142, i32* %143)
store i64 %144, i64* %9
br label %145
145: ; preds = %141, %137
br label %146
146: ; preds = %145, %127
%147 = load i32*, i32** %7
%148 = call i32 (i32*, i8*, ...) @fprintf(i32* %147, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%149 = load i32*, i32** %7
%150 = call i32 @fclose(i32* %149)
%151 = load i32*, i32** %8
%152 = call i32 (i32*, i8*, ...) @fprintf(i32* %151, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0))
%153 = load i32*, i32** %8
%154 = load i8**, i8*** %5
%155 = getelementptr inbounds i8*, i8** %154, i64 5
%156 = load i8*, i8** %155
%157 = load i64, i64* %9
%158 = call i32 (i32*, i8*, ...) @fprintf(i32* %153, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0), i8* %156, i64 %157)
%159 = load i32*, i32** %8
%160 = load i8**, i8*** %5
%161 = getelementptr inbounds i8*, i8** %160, i64 5
%162 = load i8*, i8** %161
%163 = load i64, i64* %9
%164 = call i32 (i32*, i8*, ...) @fprintf(i32* %159, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.15, i64 0, i64 0), i8* %162, i64 %163)
%165 = load i32*, i32** %8
%166 = call i32 @fclose(i32* %165)
%167 = load i32*, i32** %6
%168 = call i32 @fclose(i32* %167)
store i32 0, i32* %3
br label %169
169: ; preds = %146, %79, %62, %47, %35, %12
%170 = load i32, i32* %3
ret i32 %170
}

LLVM IR (-O2):
@.str = [4 x i8] c"BIN\00"
@.str.1 = [7 x i8] c"BINSTR\00"
@.str.2 = [4 x i8] c"STR\00"
@.str.3 = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.4 = [38 x i8] c"ERROR: Couldn't open data file '%s'.\0A\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [49 x i8] c"ERROR: Couldn't create output source file '%s'.\0A\00"
@.str.7 = [49 x i8] c"ERROR: Couldn't create output header file '%s'.\0A\00"
@.str.8 = [49 x i8] c"/* This file is autogenerated, do not edit. */\0A\0A\00"
@.str.9 = [15 x i8] c"#include \22%s\22\0A\00"
@.str.10 = [16 x i8] c"#include \22%s\22\0A\0A\00"
@.str.11 = [4 x i8] c"%s \00"
@.str.12 = [21 x i8] c"unsigned char %s[] =\00"
@.str.13 = [3 x i8] c";\0A\00"
@.str.14 = [21 x i8] c"#define %s_SIZE %lu\0A\00"
@.str.15 = [31 x i8] c"extern unsigned char %s[%lu];\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 6
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @usage(i8* %5)
br label %101
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 4
%9 = load i8*, i8** %8
%10 = tail call i64 @strcasecmp(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %21, label %12
12: ; preds = %7
%13 = tail call i64 @strcasecmp(i8* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %21, label %15
15: ; preds = %12
%16 = tail call i64 @strcasecmp(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i8*, i8** %1
%20 = tail call i32 @usage(i8* %19)
br label %101
21: ; preds = %15, %12, %7
%22 = getelementptr inbounds i8*, i8** %1, i64 1
%23 = load i8*, i8** %22
%24 = tail call i32* @fopen(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %32
26: ; preds = %21
%27 = load i32, i32* @stderr
%28 = sext i32 %27 to i64
%29 = inttoptr i64 %28 to i32*
%30 = load i8*, i8** %22
%31 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i8* %30)
br label %101
32: ; preds = %21
%33 = getelementptr inbounds i8*, i8** %1, i64 2
%34 = load i8*, i8** %33
%35 = tail call i32* @fopen(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %44
37: ; preds = %32
%38 = tail call i32 @fclose(i32* %24)
%39 = load i32, i32* @stderr
%40 = sext i32 %39 to i64
%41 = inttoptr i64 %40 to i32*
%42 = load i8*, i8** %33
%43 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0), i8* %42)
br label %101
44: ; preds = %32
%45 = getelementptr inbounds i8*, i8** %1, i64 3
%46 = load i8*, i8** %45
%47 = tail call i32* @fopen(i8* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%48 = icmp eq i32* %47, null
br i1 %48, label %49, label %57
49: ; preds = %44
%50 = tail call i32 @fclose(i32* %35)
%51 = tail call i32 @fclose(i32* %24)
%52 = load i32, i32* @stderr
%53 = sext i32 %52 to i64
%54 = inttoptr i64 %53 to i32*
%55 = load i8*, i8** %45
%56 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %54, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0), i8* %55)
br label %101
57: ; preds = %44
%58 = tail call i64 @fwrite(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0), i64 48, i64 1, i32* %35)
%59 = icmp ugt i32 %0, 7
br i1 %59, label %60, label %66
60: ; preds = %57
%61 = getelementptr inbounds i8*, i8** %1, i64 7
%62 = load i8*, i8** %61
%63 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* %62)
%64 = load i8*, i8** %45
%65 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8* %64)
br label %70
66: ; preds = %57
%67 = load i8*, i8** %45
%68 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8* %67)
%69 = icmp eq i32 %0, 7
br i1 %69, label %70, label %74
70: ; preds = %60, %66
%71 = getelementptr inbounds i8*, i8** %1, i64 6
%72 = load i8*, i8** %71
%73 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i8* %72)
br label %74
74: ; preds = %70, %66
%75 = getelementptr inbounds i8*, i8** %1, i64 5
%76 = load i8*, i8** %75
%77 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0), i8* %76)
%78 = load i8*, i8** %8
%79 = tail call i64 @strcasecmp(i8* %78, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%80 = icmp eq i64 %79, 0
br i1 %80, label %81, label %83
81: ; preds = %74
%82 = tail call i64 @dumpHex(i32* %24, i32* %35, i32 0)
br label %90
83: ; preds = %74
%84 = tail call i64 @strcasecmp(i8* %78, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %88
86: ; preds = %83
%87 = tail call i64 @dumpHex(i32* %24, i32* %35, i32 1)
br label %90
88: ; preds = %83
%89 = tail call i64 @dumpStr(i32* %24, i32* %35)
br label %90
90: ; preds = %86, %88, %81
%91 = phi i64 [ %82, %81 ], [ %87, %86 ], [ %89, %88 ]
%92 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i64 2, i64 1, i32* %35)
%93 = tail call i32 @fclose(i32* %35)
%94 = tail call i64 @fwrite(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0), i64 48, i64 1, i32* %47)
%95 = load i8*, i8** %75
%96 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0), i8* %95, i64 %91)
%97 = load i8*, i8** %75
%98 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.15, i64 0, i64 0), i8* %97, i64 %91)
%99 = tail call i32 @fclose(i32* %47)
%100 = tail call i32 @fclose(i32* %24)
br label %101
101: ; preds = %90, %49, %37, %26, %18, %4
%102 = phi i32 [ -1, %4 ], [ -1, %18 ], [ 0, %90 ], [ -1, %49 ], [ -1, %37 ], [ -1, %26 ]
ret i32 %102
}