#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 */
struct stat {
  unsigned int st_mtim;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ assert(char *);
unsigned int atoi(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fread(char *, unsigned int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
unsigned int ftell(int /*<<< orphan*/ *);
scalar_t__ malloc(unsigned int);
int /*<<< orphan*/ stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  char *buf;
  char *ident;
  unsigned int i, file_size, need_comma, n, pad;
  struct stat st;
  FILE *f_input, *f_output;
  if (argc < 4) {
    fprintf(stderr, "Usage: %s binary_file output_file array_name [pad]\n",
            argv[0]);
    return -1;
  }
  f_input = fopen(argv[1], "rb");
  if (f_input == NULL) {
    fprintf(stderr, "%s: can't open %s for reading\n", argv[0], argv[1]);
    return -1;
  }
  fseek(f_input, 0, SEEK_END);
  file_size = ftell(f_input);
  fseek(f_input, 0, SEEK_SET);
  buf = (char *)malloc(file_size);
  assert(buf);
  fread(buf, file_size, 1, f_input);
  fclose(f_input);
  f_output = fopen(argv[2], "w");
  if (f_output == NULL) {
    fprintf(stderr, "%s: can't open %s for writing\n", argv[0], argv[1]);
    return -1;
  }
  ident = argv[3];
  need_comma = 0;
  fprintf(f_output, "unsigned char %s[] = {", ident);
  for (i = 0; i < file_size; ++i) {
    if (need_comma)
      fprintf(f_output, ",");
    else
      need_comma = 1;
    if ((i % 8) == 0)
      fprintf(f_output, "\n\t");
    else
      fprintf(f_output, " ");
    fprintf(f_output, "0x%.2x", buf[i] & 0xff);
  }
  if (argc > 4)
    pad = atoi(argv[4]);
  else
    pad = 1;
  if (pad > 1) {
    n = file_size % pad;
    file_size += pad - n;
    for (; i < file_size; ++i) {
      if (need_comma)
        fprintf(f_output, ",");
      else
        need_comma = 1;
      if ((i % 8) == 0)
        fprintf(f_output, "\n\t");
      else
        fprintf(f_output, " ");
      fprintf(f_output, "0x00");
    }
  }
  fprintf(f_output, "\n};\n\n");
  fprintf(f_output, "const unsigned int %s_len = %i;\n\n", ident, file_size);
  stat(argv[1], &st);
  fprintf(f_output, "const int %s_mtime = %i;\n", ident, st.st_mtim);
  fclose(f_output);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11eb <main+0x4b>
mov    0x2e11(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe28(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1508 <main+0x368>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe3a(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1241 <main+0xa1>
mov    0x2dc3(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xe09(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1508 <main+0x368>
mov    -0x40(%rbp),%rdi
mov    0x2d9c(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    -0x40(%rbp),%rdi
call   1070 <ftell@plt>
mov    %eax,-0x28(%rbp)
mov    -0x40(%rbp),%rdi
mov    0x2d64(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    -0x28(%rbp),%edi
call   1090 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x40(%rbp),%rcx
mov    $0x1,%edx
call   1030 <fread@plt>
mov    -0x40(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd9f(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    12fe <main+0x15e>
mov    0x2d06(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xd6d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1508 <main+0x368>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xd57(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jae    13cb <main+0x22b>
cmpl   $0x0,-0x2c(%rbp)
je     135b <main+0x1bb>
mov    -0x48(%rbp),%rdi
lea    0xd3f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1362 <main+0x1c2>
movl   $0x1,-0x2c(%rbp)
mov    -0x24(%rbp),%eax
and    $0x7,%eax
cmp    $0x0,%eax
jne    1388 <main+0x1e8>
mov    -0x48(%rbp),%rdi
lea    0xd14(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    139a <main+0x1fa>
mov    -0x48(%rbp),%rdi
lea    0xd00(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x48(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
movsbl (%rax,%rcx,1),%edx
and    $0xff,%edx
lea    0xcdf(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    132e <main+0x18e>
cmpl   $0x4,-0x8(%rbp)
jle    13ea <main+0x24a>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x34(%rbp)
jmp    13f1 <main+0x251>
movl   $0x1,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
jbe    14a3 <main+0x303>
mov    -0x28(%rbp),%eax
xor    %edx,%edx
divl   -0x34(%rbp)
mov    %edx,-0x30(%rbp)
mov    -0x34(%rbp),%eax
sub    -0x30(%rbp),%eax
add    -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jae    149e <main+0x2fe>
cmpl   $0x0,-0x2c(%rbp)
je     143f <main+0x29f>
mov    -0x48(%rbp),%rdi
lea    0xc5b(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1446 <main+0x2a6>
movl   $0x1,-0x2c(%rbp)
mov    -0x24(%rbp),%eax
and    $0x7,%eax
cmp    $0x0,%eax
jne    146c <main+0x2cc>
mov    -0x48(%rbp),%rdi
lea    0xc30(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    147e <main+0x2de>
mov    -0x48(%rbp),%rdi
lea    0xc1c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x48(%rbp),%rdi
lea    0xc13(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1412 <main+0x272>
jmp    14a3 <main+0x303>
mov    -0x48(%rbp),%rdi
lea    0xbf3(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x48(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%ecx
lea    0xbe0(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x38(%rbp),%rsi
call   1080 <stat@plt>
mov    -0x48(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x38(%rbp),%ecx
lea    0xbd8(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x48(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%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,%rbp
cmp    $0x3,%edi
jg     11fc <main+0x3c>
mov    0x2dfb(%rip),%rax
movslq (%rax),%rdi
mov    0x0(%rbp),%rdx
lea    0xe15(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0xffffffff,%ebp
jmp    14b8 <main+0x2f8>
mov    %edi,%r14d
mov    0x8(%rbp),%rdi
lea    0xe2a(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1365 <main+0x1a5>
mov    %rax,%rbx
mov    0x2dc6(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    %rbx,%rdi
call   1080 <ftell@plt>
mov    %eax,%r15d
mov    0x2d90(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    %r15d,%edi
call   10a0 <malloc@plt>
mov    %rax,%r12
mov    %rax,%rdi
call   1060 <assert@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0x10(%rbp),%rdi
lea    0xdd1(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1380 <main+0x1c0>
mov    %rax,%rbx
mov    %r14d,0xc(%rsp)
mov    %rbp,0x10(%rsp)
mov    0x18(%rbp),%rdx
lea    0xdcc(%rip),%rsi
mov    %rax,%rdi
mov    %rdx,(%rsp)
xor    %eax,%eax
call   1070 <fprintf@plt>
test   %r15d,%r15d
je     12fd <main+0x13d>
lea    0xdc9(%rip),%rdi
mov    $0x1,%r14d
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10e0 <fwrite@plt>
movzbl (%r12),%edx
lea    0xda8(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <fprintf@plt>
cmp    $0x1,%r15d
jne    13b4 <main+0x1f4>
cmpl   $0x5,0xc(%rsp)
jl     13aa <main+0x1ea>
mov    0x10(%rsp),%r14
mov    0x20(%r14),%rdi
call   10d0 <atoi@plt>
cmp    $0x2,%eax
jb     1454 <main+0x294>
mov    %eax,%ebp
mov    %r15d,%eax
xor    %edx,%edx
div    %ebp
sub    %edx,%ebp
lea    (%r15,%rbp,1),%r13d
cmp    %r13d,%r15d
jae    1451 <main+0x291>
test   %r15d,%r15d
je     1349 <main+0x189>
mov    $0x2c,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
test   $0x7,%r15b
je     141a <main+0x25a>
mov    $0x20,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
jmp    1433 <main+0x273>
mov    0x2c6c(%rip),%rax
movslq (%rax),%rdi
mov    0x0(%rbp),%rdx
mov    0x8(%rbp),%rcx
lea    0xcb9(%rip),%rsi
jmp    1399 <main+0x1d9>
mov    0x2c51(%rip),%rax
movslq (%rax),%rdi
mov    0x0(%rbp),%rdx
mov    0x8(%rbp),%rcx
lea    0xcbf(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0xffffffff,%ebp
jmp    14b8 <main+0x2f8>
mov    0x10(%rsp),%r14
jmp    1454 <main+0x294>
mov    %r15d,%r13d
lea    0xcd3(%rip),%rbp
jmp    13ec <main+0x22c>
mov    $0x20,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
movzbl (%r12,%r14,1),%edx
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
add    $0x1,%r14
cmp    %r14,%r13
je     12fd <main+0x13d>
mov    $0x2c,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
test   $0x7,%r14b
jne    13c0 <main+0x200>
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xc7e(%rip),%rdi
mov    %rbx,%rcx
call   10e0 <fwrite@plt>
jmp    13cd <main+0x20d>
lea    0xc6d(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10e0 <fwrite@plt>
lea    0xc5e(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10e0 <fwrite@plt>
cmp    $0x1,%ebp
jne    14c9 <main+0x309>
mov    %r13d,%r15d
mov    (%rsp),%r12
lea    0xc3e(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10e0 <fwrite@plt>
lea    0xc2b(%rip),%rsi
xor    %ebp,%ebp
mov    %rbx,%rdi
mov    %r12,%rdx
mov    %r15d,%ecx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x8(%r14),%rdi
lea    0x8(%rsp),%rsi
call   1090 <stat@plt>
mov    0x8(%rsp),%ecx
lea    0xc22(%rip),%rsi
mov    %rbx,%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
add    $0x1,%r15d
lea    0xbba(%rip),%r12
lea    0xbbd(%rip),%rbp
jmp    150f <main+0x34f>
nopl   (%rax)
mov    $0x20,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbp,%rdi
mov    %rbx,%rcx
call   10e0 <fwrite@plt>
add    $0x1,%r15d
cmp    %r13d,%r15d
je     1451 <main+0x291>
mov    $0x2c,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
test   $0x7,%r15b
jne    14e0 <main+0x320>
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %rbx,%rcx
call   10e0 <fwrite@plt>
jmp    14ed <main+0x32d>

LLVM IR (-O0):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [52 x i8] c"Usage: %s binary_file output_file array_name [pad]\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [31 x i8] c"%s: can't open %s for reading\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [31 x i8] c"%s: can't open %s for writing\0A\00"
@.str.5 = [23 x i8] c"unsigned char %s[] = {\00"
@.str.6 = [2 x i8] c",\00"
@.str.7 = [3 x i8] c"\0A\09\00"
@.str.8 = [2 x i8] c" \00"
@.str.9 = [7 x i8] c"0x%.2x\00"
@.str.10 = [5 x i8] c"0x00\00"
@.str.11 = [6 x i8] c"\0A};\0A\0A\00"
@.str.12 = [34 x i8] c"const unsigned int %s_len = %i;\0A\0A\00"
@.str.13 = [26 x i8] c"const int %s_mtime = %i;\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
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca %struct.stat
%14 = alloca i32*
%15 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 4
br i1 %17, label %18, label %26
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = sext i32 %19 to i64
%21 = inttoptr i64 %20 to i32*
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 0
%24 = load i8*, i8** %23
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %24)
store i32 -1, i32* %3
br label %189
26: ; preds = %2
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32* @fopen(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %30, i32** %14
%31 = load i32*, i32** %14
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %44
33: ; preds = %26
%34 = load i32, i32* @stderr
%35 = sext i32 %34 to i64
%36 = inttoptr i64 %35 to i32*
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 0
%39 = load i8*, i8** %38
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = call i32 (i32*, i8*, ...) @fprintf(i32* %36, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %39, i8* %42)
store i32 -1, i32* %3
br label %189
44: ; preds = %26
%45 = load i32*, i32** %14
%46 = load i32, i32* @SEEK_END
%47 = call i32 @fseek(i32* %45, i32 0, i32 %46)
%48 = load i32*, i32** %14
%49 = call i32 @ftell(i32* %48)
store i32 %49, i32* %9
%50 = load i32*, i32** %14
%51 = load i32, i32* @SEEK_SET
%52 = call i32 @fseek(i32* %50, i32 0, i32 %51)
%53 = load i32, i32* %9
%54 = call i64 @malloc(i32 %53)
%55 = inttoptr i64 %54 to i8*
store i8* %55, i8** %6
%56 = load i8*, i8** %6
%57 = call i32 @assert(i8* %56)
%58 = load i8*, i8** %6
%59 = load i32, i32* %9
%60 = load i32*, i32** %14
%61 = call i32 @fread(i8* %58, i32 %59, i32 1, i32* %60)
%62 = load i32*, i32** %14
%63 = call i32 @fclose(i32* %62)
%64 = load i8**, i8*** %5
%65 = getelementptr inbounds i8*, i8** %64, i64 2
%66 = load i8*, i8** %65
%67 = call i32* @fopen(i8* %66, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %67, i32** %15
%68 = load i32*, i32** %15
%69 = icmp eq i32* %68, null
br i1 %69, label %70, label %81
70: ; preds = %44
%71 = load i32, i32* @stderr
%72 = sext i32 %71 to i64
%73 = inttoptr i64 %72 to i32*
%74 = load i8**, i8*** %5
%75 = getelementptr inbounds i8*, i8** %74, i64 0
%76 = load i8*, i8** %75
%77 = load i8**, i8*** %5
%78 = getelementptr inbounds i8*, i8** %77, i64 1
%79 = load i8*, i8** %78
%80 = call i32 (i32*, i8*, ...) @fprintf(i32* %73, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %76, i8* %79)
store i32 -1, i32* %3
br label %189
81: ; preds = %44
%82 = load i8**, i8*** %5
%83 = getelementptr inbounds i8*, i8** %82, i64 3
%84 = load i8*, i8** %83
store i8* %84, i8** %7
store i32 0, i32* %10
%85 = load i32*, i32** %15
%86 = load i8*, i8** %7
%87 = call i32 (i32*, i8*, ...) @fprintf(i32* %85, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %86)
store i32 0, i32* %8
br label %88
88: ; preds = %119, %81
%89 = load i32, i32* %8
%90 = load i32, i32* %9
%91 = icmp ult i32 %89, %90
br i1 %91, label %92, label %122
92: ; preds = %88
%93 = load i32, i32* %10
%94 = icmp ne i32 %93, 0
br i1 %94, label %95, label %98
95: ; preds = %92
%96 = load i32*, i32** %15
%97 = call i32 (i32*, i8*, ...) @fprintf(i32* %96, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %99
98: ; preds = %92
store i32 1, i32* %10
br label %99
99: ; preds = %98, %95
%100 = load i32, i32* %8
%101 = urem i32 %100, 8
%102 = icmp eq i32 %101, 0
br i1 %102, label %103, label %106
103: ; preds = %99
%104 = load i32*, i32** %15
%105 = call i32 (i32*, i8*, ...) @fprintf(i32* %104, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %109
106: ; preds = %99
%107 = load i32*, i32** %15
%108 = call i32 (i32*, i8*, ...) @fprintf(i32* %107, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %109
109: ; preds = %106, %103
%110 = load i32*, i32** %15
%111 = load i8*, i8** %6
%112 = load i32, i32* %8
%113 = zext i32 %112 to i64
%114 = getelementptr inbounds i8, i8* %111, i64 %113
%115 = load i8, i8* %114
%116 = sext i8 %115 to i32
%117 = and i32 %116, 255
%118 = call i32 (i32*, i8*, ...) @fprintf(i32* %110, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32 %117)
br label %119
119: ; preds = %109
%120 = load i32, i32* %8
%121 = add i32 %120, 1
store i32 %121, i32* %8
br label %88
122: ; preds = %88
%123 = load i32, i32* %4
%124 = icmp sgt i32 %123, 4
br i1 %124, label %125, label %130
125: ; preds = %122
%126 = load i8**, i8*** %5
%127 = getelementptr inbounds i8*, i8** %126, i64 4
%128 = load i8*, i8** %127
%129 = call i32 @atoi(i8* %128)
store i32 %129, i32* %12
br label %131
130: ; preds = %122
store i32 1, i32* %12
br label %131
131: ; preds = %130, %125
%132 = load i32, i32* %12
%133 = icmp ugt i32 %132, 1
br i1 %133, label %134, label %171
134: ; preds = %131
%135 = load i32, i32* %9
%136 = load i32, i32* %12
%137 = urem i32 %135, %136
store i32 %137, i32* %11
%138 = load i32, i32* %12
%139 = load i32, i32* %11
%140 = sub i32 %138, %139
%141 = load i32, i32* %9
%142 = add i32 %141, %140
store i32 %142, i32* %9
br label %143
143: ; preds = %167, %134
%144 = load i32, i32* %8
%145 = load i32, i32* %9
%146 = icmp ult i32 %144, %145
br i1 %146, label %147, label %170
147: ; preds = %143
%148 = load i32, i32* %10
%149 = icmp ne i32 %148, 0
br i1 %149, label %150, label %153
150: ; preds = %147
%151 = load i32*, i32** %15
%152 = call i32 (i32*, i8*, ...) @fprintf(i32* %151, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %154
153: ; preds = %147
store i32 1, i32* %10
br label %154
154: ; preds = %153, %150
%155 = load i32, i32* %8
%156 = urem i32 %155, 8
%157 = icmp eq i32 %156, 0
br i1 %157, label %158, label %161
158: ; preds = %154
%159 = load i32*, i32** %15
%160 = call i32 (i32*, i8*, ...) @fprintf(i32* %159, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %164
161: ; preds = %154
%162 = load i32*, i32** %15
%163 = call i32 (i32*, i8*, ...) @fprintf(i32* %162, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %164
164: ; preds = %161, %158
%165 = load i32*, i32** %15
%166 = call i32 (i32*, i8*, ...) @fprintf(i32* %165, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br label %167
167: ; preds = %164
%168 = load i32, i32* %8
%169 = add i32 %168, 1
store i32 %169, i32* %8
br label %143
170: ; preds = %143
br label %171
171: ; preds = %170, %131
%172 = load i32*, i32** %15
%173 = call i32 (i32*, i8*, ...) @fprintf(i32* %172, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%174 = load i32*, i32** %15
%175 = load i8*, i8** %7
%176 = load i32, i32* %9
%177 = call i32 (i32*, i8*, ...) @fprintf(i32* %174, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0), i8* %175, i32 %176)
%178 = load i8**, i8*** %5
%179 = getelementptr inbounds i8*, i8** %178, i64 1
%180 = load i8*, i8** %179
%181 = call i32 @stat(i8* %180, %struct.stat* %13)
%182 = load i32*, i32** %15
%183 = load i8*, i8** %7
%184 = getelementptr inbounds %struct.stat, %struct.stat* %13, i32 0, i32 0
%185 = load i32, i32* %184
%186 = call i32 (i32*, i8*, ...) @fprintf(i32* %182, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0), i8* %183, i32 %185)
%187 = load i32*, i32** %15
%188 = call i32 @fclose(i32* %187)
store i32 0, i32* %3
br label %189
189: ; preds = %171, %70, %33, %18
%190 = load i32, i32* %3
ret i32 %190
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [52 x i8] c"Usage: %s binary_file output_file array_name [pad]\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [31 x i8] c"%s: can't open %s for reading\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [31 x i8] c"%s: can't open %s for writing\0A\00"
@.str.5 = [23 x i8] c"unsigned char %s[] = {\00"
@.str.7 = [3 x i8] c"\0A\09\00"
@.str.9 = [7 x i8] c"0x%.2x\00"
@.str.10 = [5 x i8] c"0x00\00"
@.str.11 = [6 x i8] c"\0A};\0A\0A\00"
@.str.12 = [34 x i8] c"const unsigned int %s_len = %i;\0A\0A\00"
@.str.13 = [26 x i8] c"const int %s_mtime = %i;\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = icmp slt i32 %0, 4
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
%10 = load i8*, i8** %1
%11 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %124
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %24
17: ; preds = %12
%18 = load i32, i32* @stderr
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i32*
%21 = load i8*, i8** %1
%22 = load i8*, i8** %13
%23 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %21, i8* %22)
br label %124
24: ; preds = %12
%25 = load i32, i32* @SEEK_END
%26 = tail call i32 @fseek(i32* %15, i32 0, i32 %25)
%27 = tail call i32 @ftell(i32* %15)
%28 = load i32, i32* @SEEK_SET
%29 = tail call i32 @fseek(i32* %15, i32 0, i32 %28)
%30 = tail call i64 @malloc(i32 %27)
%31 = inttoptr i64 %30 to i8*
%32 = tail call i32 @assert(i8* %31)
%33 = tail call i32 @fread(i8* %31, i32 %27, i32 1, i32* %15)
%34 = tail call i32 @fclose(i32* %15)
%35 = getelementptr inbounds i8*, i8** %1, i64 2
%36 = load i8*, i8** %35
%37 = tail call i32* @fopen(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %46
39: ; preds = %24
%40 = load i32, i32* @stderr
%41 = sext i32 %40 to i64
%42 = inttoptr i64 %41 to i32*
%43 = load i8*, i8** %1
%44 = load i8*, i8** %13
%45 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %42, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %43, i8* %44)
br label %124
46: ; preds = %24
%47 = getelementptr inbounds i8*, i8** %1, i64 3
%48 = load i8*, i8** %47
%49 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %48)
%50 = icmp eq i32 %27, 0
br i1 %50, label %74, label %51
51: ; preds = %46
%52 = zext i32 %27 to i64
%53 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i64 2, i64 1, i32* %37)
%54 = load i8, i8* %31
%55 = zext i8 %54 to i32
%56 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32 %55)
%57 = icmp eq i32 %27, 1
br i1 %57, label %74, label %58
58: ; preds = %51, %67
%59 = phi i64 [ %72, %67 ], [ 1, %51 ]
%60 = tail call i32 @fputc(i32 44, i32* %37)
%61 = and i64 %59, 7
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %58
%64 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i64 2, i64 1, i32* %37)
br label %67
65: ; preds = %58
%66 = tail call i32 @fputc(i32 32, i32* %37)
br label %67
67: ; preds = %65, %63
%68 = getelementptr inbounds i8, i8* %31, i64 %59
%69 = load i8, i8* %68
%70 = zext i8 %69 to i32
%71 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32 %70)
%72 = add nuw nsw i64 %59, 1
%73 = icmp eq i64 %72, %52
br i1 %73, label %74, label %58
74: ; preds = %67, %51, %46
%75 = icmp sgt i32 %0, 4
br i1 %75, label %76, label %114
76: ; preds = %74
%77 = getelementptr inbounds i8*, i8** %1, i64 4
%78 = load i8*, i8** %77
%79 = tail call i32 @atoi(i8* %78)
%80 = icmp ugt i32 %79, 1
br i1 %80, label %81, label %114
81: ; preds = %76
%82 = urem i32 %27, %79
%83 = sub i32 %79, %82
%84 = add i32 %83, %27
%85 = icmp ult i32 %27, %84
br i1 %85, label %86, label %114
86: ; preds = %81
br i1 %50, label %89, label %87
87: ; preds = %86
%88 = tail call i32 @fputc(i32 44, i32* %37)
br label %89
89: ; preds = %87, %86
%90 = and i32 %27, 7
%91 = icmp eq i32 %90, 0
br i1 %91, label %94, label %92
92: ; preds = %89
%93 = tail call i32 @fputc(i32 32, i32* %37)
br label %96
94: ; preds = %89
%95 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i64 2, i64 1, i32* %37)
br label %96
96: ; preds = %94, %92
%97 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i64 4, i64 1, i32* %37)
%98 = icmp eq i32 %83, 1
br i1 %98, label %114, label %99
99: ; preds = %96
%100 = add nuw i32 %27, 1
br label %101
101: ; preds = %99, %110
%102 = phi i32 [ %112, %110 ], [ %100, %99 ]
%103 = tail call i32 @fputc(i32 44, i32* %37)
%104 = and i32 %102, 7
%105 = icmp eq i32 %104, 0
br i1 %105, label %106, label %108
106: ; preds = %101
%107 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i64 2, i64 1, i32* %37)
br label %110
108: ; preds = %101
%109 = tail call i32 @fputc(i32 32, i32* %37)
br label %110
110: ; preds = %108, %106
%111 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i64 4, i64 1, i32* %37)
%112 = add i32 %102, 1
%113 = icmp eq i32 %112, %84
br i1 %113, label %114, label %101
114: ; preds = %110, %96, %81, %74, %76
%115 = phi i32 [ %27, %76 ], [ %27, %74 ], [ %84, %81 ], [ %84, %96 ], [ %84, %110 ]
%116 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i64 5, i64 1, i32* %37)
%117 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0), i8* %48, i32 %115)
%118 = load i8*, i8** %13
%119 = call i32 @stat(i8* %118, %struct.stat* %3)
%120 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%121 = load i32, i32* %120
%122 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0), i8* %48, i32 %121)
%123 = tail call i32 @fclose(i32* %37)
br label %124
124: ; preds = %114, %39, %17, %6
%125 = phi i32 [ -1, %6 ], [ -1, %17 ], [ -1, %39 ], [ 0, %114 ]
ret i32 %125
}