#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*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
unsigned int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ *stderr;
char *strdup(scalar_t__);
unsigned int strlen(char *);
scalar_t__ strrchr(char *, char);
char tolower(char);
int main(int argc, char **argv) {
  FILE *f_c, *f_h, *f_i;
  unsigned int i, j, count, size;
  unsigned char buf[12];
  if (argc < 3) {
    fprintf(
        stderr,
        "Syntax: bin2c <C file> <H file> [Input file 1] [Input file 2] ..\n");
    return -1;
  }
  f_c = fopen(argv[1], "w");
  if (!f_c) {
    fprintf(stderr, "Error opening %s\n", argv[1]);
    return -1;
  }
  f_h = fopen(argv[2], "w");
  if (!f_h) {
    fprintf(stderr, "Error opening %s\n", argv[2]);
    return -1;
  }
  fprintf(f_c, "/* Autogenerated by bin2c */\n\n");
  fprintf(f_c, "#include <stdint.h>\n\n");
  fprintf(f_h, "#if !defined(__RESOURCES_H)\n");
  fprintf(f_h, "#define __RESOURCES_H\n\n");
  fprintf(f_h, "/* Autogenerated by bin2c */\n\n");
  fprintf(f_h, "#include <stdint.h>\n\n");
  for (i = 3; i < argc; ++i) {
    char *name = strdup(strrchr(argv[i], '/') + 1);
    for (j = 0; j < strlen(name); ++j) {
      if (name[j] == '.' || name[j] == '-')
        name[j] = '_';
      else
        name[j] = tolower(name[j]);
    }
    f_i = fopen(argv[i], "rb");
    if (!f_i) {
      fprintf(stderr, "Error opening %s\n", argv[i]);
      return -1;
    }
    fprintf(f_c, "uint8_t %s[] = {\n", name);
    fprintf(f_h, "extern uint8_t %s[];\n", name);
    size = 0;
    while ((count = fread(buf, 1, sizeof(buf), f_i)) > 0) {
      fprintf(f_c, "\t");
      for (j = 0; j < count; j++) {
        fprintf(f_c, "0x%02x, ", (unsigned int)buf[j]);
        size++;
      }
      fprintf(f_c, "\n");
    }
    fprintf(f_c, "\t0x00\n");
    fprintf(f_c, "};\n\n");
    fprintf(f_h, "extern uint32_t %s_size;\n\n", name);
    fprintf(f_c, "uint32_t %s_size = %i;\n\n", name, size);
    fclose(f_i);
    free(name);
  }
  fprintf(f_h, "#endif /* __RESOURCES_H */\n");
  fclose(f_c);
  fclose(f_h);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11d4 <main+0x44>
mov    0x2e29(%rip),%rax
mov    (%rax),%rdi
lea    0xe3f(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1556 <main+0x3c6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe5f(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1223 <main+0x93>
mov    0x2de2(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe34(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1556 <main+0x3c6>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe10(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1272 <main+0xe2>
mov    0x2d93(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xde5(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1556 <main+0x3c6>
mov    -0x18(%rbp),%rdi
lea    0xdd9(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xde6(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xdea(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xdf5(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xd91(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xd9e(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x3,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    152b <main+0x39b>
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    (%rax,%rcx,8),%rdi
mov    $0x2f,%esi
call   1070 <strrchr@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   10b0 <strdup@plt>
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x50(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
cmp    %ecx,%eax
jae    13a0 <main+0x210>
mov    -0x50(%rbp),%rax
mov    -0x30(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
je     1361 <main+0x1d1>
mov    -0x50(%rbp),%rax
mov    -0x30(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2d,%eax
jne    1371 <main+0x1e1>
mov    -0x50(%rbp),%rax
mov    -0x30(%rbp),%ecx
movb   $0x5f,(%rax,%rcx,1)
jmp    138d <main+0x1fd>
mov    -0x50(%rbp),%rax
mov    -0x30(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   1090 <tolower@plt>
mov    %al,%dl
mov    -0x50(%rbp),%rax
mov    -0x30(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
jmp    1392 <main+0x202>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    131d <main+0x18d>
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    (%rax,%rcx,8),%rdi
lea    0xd0e(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    13f5 <main+0x265>
mov    0x2c13(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    (%rax,%rcx,8),%rdx
lea    0xc62(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1556 <main+0x3c6>
mov    -0x18(%rbp),%rdi
mov    -0x50(%rbp),%rdx
lea    0xcbf(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x50(%rbp),%rdx
lea    0xcbb(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x38(%rbp)
lea    -0x44(%rbp),%rdi
mov    -0x28(%rbp),%rcx
mov    $0x1,%esi
mov    $0xc,%edx
call   1040 <fread@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
jbe    14b8 <main+0x328>
mov    -0x18(%rbp),%rdi
lea    0xc95(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x34(%rbp),%eax
jae    14a1 <main+0x311>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%eax
movzbl -0x44(%rbp,%rax,1),%edx
lea    0xc6a(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1464 <main+0x2d4>
mov    -0x18(%rbp),%rdi
lea    0xbc7(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    1428 <main+0x298>
mov    -0x18(%rbp),%rdi
lea    0xc33(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xc28(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x50(%rbp),%rdx
lea    0xc17(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x50(%rbp),%rdx
mov    -0x38(%rbp),%ecx
lea    0xc19(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12e5 <main+0x155>
mov    -0x20(%rbp),%rdi
lea    0xc00(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
cmp    $0x2,%edi
jg     11e8 <main+0x38>
mov    0x2e16(%rip),%rax
mov    (%rax),%rcx
lea    0xe2c(%rip),%rdi
mov    $0x41,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
jmp    1559 <main+0x3a9>
mov    %rsi,%r14
mov    %edi,%ebx
mov    0x8(%rsi),%rdi
lea    0xe4a(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     14f0 <main+0x340>
mov    %rax,%r15
mov    0x10(%r14),%rdi
lea    0xe2e(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     152d <main+0x37d>
mov    %rax,%rbp
lea    0xe2a(%rip),%r13
mov    $0x1e,%esi
mov    $0x1,%edx
mov    %r13,%rdi
mov    %r15,%rcx
call   10c0 <fwrite@plt>
lea    0xe2d(%rip),%r12
mov    $0x15,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %r15,%rcx
call   10c0 <fwrite@plt>
lea    0xe27(%rip),%rdi
mov    $0x1c,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10c0 <fwrite@plt>
lea    0xe2b(%rip),%rdi
mov    $0x17,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10c0 <fwrite@plt>
mov    $0x1e,%esi
mov    $0x1,%edx
mov    %r13,%rdi
mov    %rbp,%rcx
call   10c0 <fwrite@plt>
mov    $0x15,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %rbp,%rcx
call   10c0 <fwrite@plt>
cmp    $0x4,%ebx
jb     1500 <main+0x350>
mov    %ebx,%eax
mov    %rax,0x20(%rsp)
mov    $0x3,%ebx
lea    0xe16(%rip),%r12
mov    %r14,0x28(%rsp)
mov    %rbp,0x10(%rsp)
jmp    1382 <main+0x1d2>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x6,%esi
mov    $0x1,%edx
lea    0xdf3(%rip),%rdi
mov    %r15,%rcx
call   10c0 <fwrite@plt>
mov    $0x4,%esi
mov    $0x1,%edx
lea    0xde1(%rip),%rdi
mov    %r15,%rcx
call   10c0 <fwrite@plt>
mov    0x10(%rsp),%rbp
mov    %rbp,%rdi
lea    0xdcf(%rip),%rsi
mov    0x8(%rsp),%rbx
mov    %rbx,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %r15,%rdi
lea    0xdd1(%rip),%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x18(%rsp),%rdi
call   1050 <fclose@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x30(%rsp),%rbx
add    $0x1,%rbx
cmp    0x20(%rsp),%rbx
mov    0x28(%rsp),%r14
je     1500 <main+0x350>
mov    (%r14,%rbx,8),%rdi
mov    $0x2f,%esi
call   1070 <strrchr@plt>
lea    0x1(%rax),%rdi
call   10d0 <strdup@plt>
mov    %rax,%r13
mov    %rax,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
mov    %r13,0x8(%rsp)
je     1400 <main+0x250>
xor    %ebp,%ebp
jmp    13d8 <main+0x228>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %al,0x0(%r13,%rbp,1)
add    $0x1,%rbp
mov    %r13,%rdi
call   1060 <strlen@plt>
mov    %eax,%eax
cmp    %rax,%rbp
jae    1400 <main+0x250>
movzbl 0x0(%r13,%rbp,1),%ecx
lea    -0x2d(%rcx),%edx
mov    $0x5f,%al
cmp    $0x2,%dl
jb     13c0 <main+0x210>
movsbl %cl,%edi
call   10a0 <tolower@plt>
mov    0x8(%rsp),%r13
jmp    13c0 <main+0x210>
nopw   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
lea    0xcb5(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     153d <main+0x38d>
mov    %rax,%rbp
mov    %rbx,0x30(%rsp)
xor    %r14d,%r14d
mov    %r15,%rdi
lea    0xc95(%rip),%rsi
mov    0x8(%rsp),%rbx
mov    %rbx,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x10(%rsp),%rdi
lea    0xc8c(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
lea    0x3c(%rsp),%rdi
mov    $0x1,%esi
mov    $0xc,%edx
mov    %rbp,0x18(%rsp)
mov    %rbp,%rcx
call   1040 <fread@plt>
test   %eax,%eax
je     12f0 <main+0x140>
mov    %eax,%r13d
xor    %r14d,%r14d
nopl   (%rax)
mov    $0x9,%edi
mov    %r15,%rsi
call   1080 <fputc@plt>
mov    %r13d,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl 0x3c(%rsp,%rbx,1),%edx
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    14a0 <main+0x2f0>
add    %ebp,%r14d
mov    $0xa,%edi
mov    %r15,%rsi
call   1080 <fputc@plt>
lea    0x3c(%rsp),%rdi
mov    $0x1,%esi
mov    $0xc,%edx
mov    0x18(%rsp),%rcx
call   1040 <fread@plt>
mov    %eax,%r13d
test   %eax,%eax
jne    1480 <main+0x2d0>
jmp    12f0 <main+0x140>
mov    0x2ae9(%rip),%rax
mov    (%rax),%rdi
mov    0x8(%r14),%rdx
jmp    154b <main+0x39b>
lea    0xc2d(%rip),%rdi
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10c0 <fwrite@plt>
mov    %r15,%rdi
call   1050 <fclose@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
jmp    155e <main+0x3ae>
mov    0x2aac(%rip),%rax
mov    (%rax),%rdi
mov    0x10(%r14),%rdx
jmp    154b <main+0x39b>
mov    0x2a9c(%rip),%rax
mov    (%rax),%rdi
mov    (%r14,%rbx,8),%rdx
lea    0xaf2(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32* null
@.str = [66 x i8] c"Syntax: bin2c <C file> <H file> [Input file 1] [Input file 2] ..\0A\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [18 x i8] c"Error opening %s\0A\00"
@.str.3 = [31 x i8] c"/* Autogenerated by bin2c */\0A\0A\00"
@.str.4 = [22 x i8] c"#include <stdint.h>\0A\0A\00"
@.str.5 = [29 x i8] c"#if !defined(__RESOURCES_H)\0A\00"
@.str.6 = [24 x i8] c"#define __RESOURCES_H\0A\0A\00"
@.str.7 = [3 x i8] c"rb\00"
@.str.8 = [18 x i8] c"uint8_t %s[] = {\0A\00"
@.str.9 = [22 x i8] c"extern uint8_t %s[];\0A\00"
@.str.10 = [2 x i8] c"\09\00"
@.str.11 = [9 x i8] c"0x%02x, \00"
@.str.12 = [2 x i8] c"\0A\00"
@.str.13 = [7 x i8] c"\090x00\0A\00"
@.str.14 = [5 x i8] c"};\0A\0A\00"
@.str.15 = [27 x i8] c"extern uint32_t %s_size;\0A\0A\00"
@.str.16 = [25 x i8] c"uint32_t %s_size = %i;\0A\0A\00"
@.str.17 = [28 x i8] c"#endif /* __RESOURCES_H */\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 i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [12 x i8]
%14 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 3
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = load i32*, i32** @stderr
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %191
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %24, i32** %6
%25 = load i32*, i32** %6
%26 = icmp ne i32* %25, null
br i1 %26, label %33, label %27
27: ; preds = %20
%28 = load i32*, i32** @stderr
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %28, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %31)
store i32 -1, i32* %3
br label %191
33: ; preds = %20
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = call i32* @fopen(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %37, i32** %7
%38 = load i32*, i32** %7
%39 = icmp ne i32* %38, null
br i1 %39, label %46, label %40
40: ; preds = %33
%41 = load i32*, i32** @stderr
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 2
%44 = load i8*, i8** %43
%45 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %44)
store i32 -1, i32* %3
br label %191
46: ; preds = %33
%47 = load i32*, i32** %6
%48 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%49 = load i32*, i32** %6
%50 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%51 = load i32*, i32** %7
%52 = call i32 (i32*, i8*, ...) @fprintf(i32* %51, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%53 = load i32*, i32** %7
%54 = call i32 (i32*, i8*, ...) @fprintf(i32* %53, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%55 = load i32*, i32** %7
%56 = call i32 (i32*, i8*, ...) @fprintf(i32* %55, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%57 = load i32*, i32** %7
%58 = call i32 (i32*, i8*, ...) @fprintf(i32* %57, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
store i32 3, i32* %9
br label %59
59: ; preds = %181, %46
%60 = load i32, i32* %9
%61 = load i32, i32* %4
%62 = icmp ult i32 %60, %61
br i1 %62, label %63, label %184
63: ; preds = %59
%64 = load i8**, i8*** %5
%65 = load i32, i32* %9
%66 = zext i32 %65 to i64
%67 = getelementptr inbounds i8*, i8** %64, i64 %66
%68 = load i8*, i8** %67
%69 = call i64 @strrchr(i8* %68, i8 signext 47)
%70 = add nsw i64 %69, 1
%71 = call i8* @strdup(i64 %70)
store i8* %71, i8** %14
store i32 0, i32* %10
br label %72
72: ; preds = %110, %63
%73 = load i32, i32* %10
%74 = load i8*, i8** %14
%75 = call i32 @strlen(i8* %74)
%76 = icmp ult i32 %73, %75
br i1 %76, label %77, label %113
77: ; preds = %72
%78 = load i8*, i8** %14
%79 = load i32, i32* %10
%80 = zext i32 %79 to i64
%81 = getelementptr inbounds i8, i8* %78, i64 %80
%82 = load i8, i8* %81
%83 = sext i8 %82 to i32
%84 = icmp eq i32 %83, 46
br i1 %84, label %93, label %85
85: ; preds = %77
%86 = load i8*, i8** %14
%87 = load i32, i32* %10
%88 = zext i32 %87 to i64
%89 = getelementptr inbounds i8, i8* %86, i64 %88
%90 = load i8, i8* %89
%91 = sext i8 %90 to i32
%92 = icmp eq i32 %91, 45
br i1 %92, label %93, label %98
93: ; preds = %85, %77
%94 = load i8*, i8** %14
%95 = load i32, i32* %10
%96 = zext i32 %95 to i64
%97 = getelementptr inbounds i8, i8* %94, i64 %96
store i8 95, i8* %97
br label %109
98: ; preds = %85
%99 = load i8*, i8** %14
%100 = load i32, i32* %10
%101 = zext i32 %100 to i64
%102 = getelementptr inbounds i8, i8* %99, i64 %101
%103 = load i8, i8* %102
%104 = call signext i8 @tolower(i8 signext %103)
%105 = load i8*, i8** %14
%106 = load i32, i32* %10
%107 = zext i32 %106 to i64
%108 = getelementptr inbounds i8, i8* %105, i64 %107
store i8 %104, i8* %108
br label %109
109: ; preds = %98, %93
br label %110
110: ; preds = %109
%111 = load i32, i32* %10
%112 = add i32 %111, 1
store i32 %112, i32* %10
br label %72
113: ; preds = %72
%114 = load i8**, i8*** %5
%115 = load i32, i32* %9
%116 = zext i32 %115 to i64
%117 = getelementptr inbounds i8*, i8** %114, i64 %116
%118 = load i8*, i8** %117
%119 = call i32* @fopen(i8* %118, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
store i32* %119, i32** %8
%120 = load i32*, i32** %8
%121 = icmp ne i32* %120, null
br i1 %121, label %130, label %122
122: ; preds = %113
%123 = load i32*, i32** @stderr
%124 = load i8**, i8*** %5
%125 = load i32, i32* %9
%126 = zext i32 %125 to i64
%127 = getelementptr inbounds i8*, i8** %124, i64 %126
%128 = load i8*, i8** %127
%129 = call i32 (i32*, i8*, ...) @fprintf(i32* %123, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %128)
store i32 -1, i32* %3
br label %191
130: ; preds = %113
%131 = load i32*, i32** %6
%132 = load i8*, i8** %14
%133 = call i32 (i32*, i8*, ...) @fprintf(i32* %131, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i8* %132)
%134 = load i32*, i32** %7
%135 = load i8*, i8** %14
%136 = call i32 (i32*, i8*, ...) @fprintf(i32* %134, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i8* %135)
store i32 0, i32* %12
br label %137
137: ; preds = %162, %130
%138 = getelementptr inbounds [12 x i8], [12 x i8]* %13, i64 0, i64 0
%139 = load i32*, i32** %8
%140 = call i32 @fread(i8* %138, i32 1, i32 12, i32* %139)
store i32 %140, i32* %11
%141 = icmp ugt i32 %140, 0
br i1 %141, label %142, label %165
142: ; preds = %137
%143 = load i32*, i32** %6
%144 = call i32 (i32*, i8*, ...) @fprintf(i32* %143, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %10
br label %145
145: ; preds = %159, %142
%146 = load i32, i32* %10
%147 = load i32, i32* %11
%148 = icmp ult i32 %146, %147
br i1 %148, label %149, label %162
149: ; preds = %145
%150 = load i32*, i32** %6
%151 = load i32, i32* %10
%152 = zext i32 %151 to i64
%153 = getelementptr inbounds [12 x i8], [12 x i8]* %13, i64 0, i64 %152
%154 = load i8, i8* %153
%155 = zext i8 %154 to i32
%156 = call i32 (i32*, i8*, ...) @fprintf(i32* %150, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i32 %155)
%157 = load i32, i32* %12
%158 = add i32 %157, 1
store i32 %158, i32* %12
br label %159
159: ; preds = %149
%160 = load i32, i32* %10
%161 = add i32 %160, 1
store i32 %161, i32* %10
br label %145
162: ; preds = %145
%163 = load i32*, i32** %6
%164 = call i32 (i32*, i8*, ...) @fprintf(i32* %163, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
br label %137
165: ; preds = %137
%166 = load i32*, i32** %6
%167 = call i32 (i32*, i8*, ...) @fprintf(i32* %166, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0))
%168 = load i32*, i32** %6
%169 = call i32 (i32*, i8*, ...) @fprintf(i32* %168, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
%170 = load i32*, i32** %7
%171 = load i8*, i8** %14
%172 = call i32 (i32*, i8*, ...) @fprintf(i32* %170, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.15, i64 0, i64 0), i8* %171)
%173 = load i32*, i32** %6
%174 = load i8*, i8** %14
%175 = load i32, i32* %12
%176 = call i32 (i32*, i8*, ...) @fprintf(i32* %173, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.16, i64 0, i64 0), i8* %174, i32 %175)
%177 = load i32*, i32** %8
%178 = call i32 @fclose(i32* %177)
%179 = load i8*, i8** %14
%180 = call i32 @free(i8* %179)
br label %181
181: ; preds = %165
%182 = load i32, i32* %9
%183 = add i32 %182, 1
store i32 %183, i32* %9
br label %59
184: ; preds = %59
%185 = load i32*, i32** %7
%186 = call i32 (i32*, i8*, ...) @fprintf(i32* %185, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.17, i64 0, i64 0))
%187 = load i32*, i32** %6
%188 = call i32 @fclose(i32* %187)
%189 = load i32*, i32** %7
%190 = call i32 @fclose(i32* %189)
store i32 0, i32* %3
br label %191
191: ; preds = %184, %122, %40, %27, %17
%192 = load i32, i32* %3
ret i32 %192
}

LLVM IR (-O2):
@stderr = global i32* null
@.str = [66 x i8] c"Syntax: bin2c <C file> <H file> [Input file 1] [Input file 2] ..\0A\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [18 x i8] c"Error opening %s\0A\00"
@.str.3 = [31 x i8] c"/* Autogenerated by bin2c */\0A\0A\00"
@.str.4 = [22 x i8] c"#include <stdint.h>\0A\0A\00"
@.str.5 = [29 x i8] c"#if !defined(__RESOURCES_H)\0A\00"
@.str.6 = [24 x i8] c"#define __RESOURCES_H\0A\0A\00"
@.str.7 = [3 x i8] c"rb\00"
@.str.8 = [18 x i8] c"uint8_t %s[] = {\0A\00"
@.str.9 = [22 x i8] c"extern uint8_t %s[];\0A\00"
@.str.11 = [9 x i8] c"0x%02x, \00"
@.str.13 = [7 x i8] c"\090x00\0A\00"
@.str.14 = [5 x i8] c"};\0A\0A\00"
@.str.15 = [27 x i8] c"extern uint32_t %s_size;\0A\0A\00"
@.str.16 = [25 x i8] c"uint32_t %s_size = %i;\0A\0A\00"
@.str.17 = [28 x i8] c"#endif /* __RESOURCES_H */\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [12 x i8]
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 3
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i32*, i32** @stderr
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i64 65, i64 1, i32* %7)
br label %105
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = load i32*, i32** @stderr
%16 = load i8*, i8** %10
%17 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %16)
br label %105
18: ; preds = %9
%19 = getelementptr inbounds i8*, i8** %1, i64 2
%20 = load i8*, i8** %19
%21 = tail call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %27
23: ; preds = %18
%24 = load i32*, i32** @stderr
%25 = load i8*, i8** %19
%26 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %25)
br label %105
27: ; preds = %18
%28 = tail call i64 @fwrite(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i64 30, i64 1, i32* %12)
%29 = tail call i64 @fwrite(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i64 21, i64 1, i32* %12)
%30 = tail call i64 @fwrite(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i64 28, i64 1, i32* %21)
%31 = tail call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i64 23, i64 1, i32* %21)
%32 = tail call i64 @fwrite(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i64 30, i64 1, i32* %21)
%33 = tail call i64 @fwrite(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i64 21, i64 1, i32* %21)
%34 = icmp ugt i32 %0, 3
br i1 %34, label %35, label %101
35: ; preds = %27
%36 = zext i32 %0 to i64
br label %47
37: ; preds = %96, %78
%38 = phi i32 [ 0, %78 ], [ %97, %96 ]
%39 = tail call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i64 6, i64 1, i32* %12)
%40 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i64 4, i64 1, i32* %12)
%41 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.15, i64 0, i64 0), i8* %53)
%42 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.16, i64 0, i64 0), i8* %53, i32 %38)
%43 = tail call i32 @fclose(i32* %72)
%44 = tail call i32 @free(i8* %53)
%45 = add nuw nsw i64 %48, 1
%46 = icmp eq i64 %45, %36
br i1 %46, label %101, label %47
47: ; preds = %35, %37
%48 = phi i64 [ 3, %35 ], [ %45, %37 ]
%49 = getelementptr inbounds i8*, i8** %1, i64 %48
%50 = load i8*, i8** %49
%51 = tail call i64 @strrchr(i8* %50, i8 signext 47)
%52 = add nsw i64 %51, 1
%53 = tail call i8* @strdup(i64 %52)
%54 = tail call i32 @strlen(i8* %53)
%55 = icmp eq i32 %54, 0
br i1 %55, label %70, label %56
56: ; preds = %47, %64
%57 = phi i64 [ %66, %64 ], [ 0, %47 ]
%58 = getelementptr inbounds i8, i8* %53, i64 %57
%59 = load i8, i8* %58
%60 = add i8 %59, -45
%61 = icmp ult i8 %60, 2
br i1 %61, label %64, label %62
62: ; preds = %56
%63 = tail call signext i8 @tolower(i8 signext %59)
br label %64
64: ; preds = %56, %62
%65 = phi i8 [ %63, %62 ], [ 95, %56 ]
store i8 %65, i8* %58
%66 = add nuw nsw i64 %57, 1
%67 = tail call i32 @strlen(i8* %53)
%68 = zext i32 %67 to i64
%69 = icmp ult i64 %66, %68
br i1 %69, label %56, label %70
70: ; preds = %64, %47
%71 = load i8*, i8** %49
%72 = tail call i32* @fopen(i8* %71, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%73 = icmp eq i32* %72, null
br i1 %73, label %74, label %78
74: ; preds = %70
%75 = load i32*, i32** @stderr
%76 = load i8*, i8** %49
%77 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %75, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %76)
br label %105
78: ; preds = %70
%79 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i8* %53)
%80 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i8* %53)
%81 = call i32 @fread(i8* %4, i32 1, i32 12, i32* %72)
%82 = icmp eq i32 %81, 0
br i1 %82, label %37, label %83
83: ; preds = %78, %96
%84 = phi i32 [ %99, %96 ], [ %81, %78 ]
%85 = phi i32 [ %97, %96 ], [ 0, %78 ]
%86 = tail call i32 @fputc(i32 9, i32* %12)
%87 = zext i32 %84 to i64
br label %88
88: ; preds = %83, %88
%89 = phi i64 [ 0, %83 ], [ %94, %88 ]
%90 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 %89
%91 = load i8, i8* %90
%92 = zext i8 %91 to i32
%93 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i32 %92)
%94 = add nuw nsw i64 %89, 1
%95 = icmp eq i64 %94, %87
br i1 %95, label %96, label %88
96: ; preds = %88
%97 = add i32 %85, %84
%98 = tail call i32 @fputc(i32 10, i32* %12)
%99 = call i32 @fread(i8* %4, i32 1, i32 12, i32* %72)
%100 = icmp eq i32 %99, 0
br i1 %100, label %37, label %83
101: ; preds = %37, %27
%102 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.17, i64 0, i64 0), i64 27, i64 1, i32* %21)
%103 = tail call i32 @fclose(i32* %12)
%104 = tail call i32 @fclose(i32* %21)
br label %105
105: ; preds = %74, %101, %23, %14, %6
%106 = phi i32 [ -1, %6 ], [ 0, %101 ], [ -1, %23 ], [ -1, %14 ], [ -1, %74 ]
ret i32 %106
}