#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 errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  if (argc != 3) {
    fputs(
        "Converts binary file into compileable C file. \n"
        "\n"
        "The MIT License (MIT)\n"
        "\n"
        "Copyright (c) 2015 Ondrej Novak\n"
        "\n"
        "Permission is hereby granted, free of charge, to any person obtaining "
        "a copy\n"
        "of this software and associated documentation files (the "
        "\"Software\"), to deal\n"
        "in the Software without restriction, including without limitation the "
        "rights\n"
        "to use, copy, modify, merge, publish, distribute, sublicense, and/or "
        "sell\n"
        "copies of the Software, and to permit persons to whom the Software "
        "is\n"
        "furnished to do so, subject to the following conditions:\n"
        "\n"
        "The above copyright notice and this permission notice shall be "
        "included in all\n"
        "copies or substantial portions of the Software.\n"
        "\n"
        "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, "
        "EXPRESS OR\n"
        "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF "
        "MERCHANTABILITY,\n"
        "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT "
        "SHALL THE\n"
        "AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR "
        "OTHER\n"
        "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, "
        "ARISING FROM,\n"
        "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER "
        "DEALINGS IN THE\n"
        "SOFTWARE.\n"
        "\n"
        "Usage:\n"
        "        bin2c <file> <identifier>\n"
        "\n"
        "<file>       - source (binary) file. Use \"-\" to read standard "
        "input\n"
        "<identifier> - name of global identifier that will be used to access\n"
        "                the file from the code. It must be standrad C "
        "identifier.\n"
        "                Program also creates <identifier>_length variable "
        "cointaining\n"
        "                length of the file in bytes\n"
        "\n"
        "Result is sent to the standard output\n"
        "\n",
        stderr);
    return 1;
  } else {
    FILE *f = strcmp(argv[1], "-") == 0 ? stdin : fopen(argv[1], "rb");
    if (f == NULL) {
      fprintf(stderr, "Can't open input file '%s'", argv[1]);
      return errno;
    }
    printf("const char *%s=\"", argv[2]);
    int i = fgetc(f);
    int cnt = 0;
    unsigned int size = 0;
    while (i != -1) {
      size++;
      if (i >= 32 && i != '"' && i != '\\' && i < 128) {
        putchar(i);
        cnt++;
      } else if (i == '"') {
        putchar('\\');
        putchar('"');
        cnt += 2;
      } else if (i == '\\') {
        putchar('\\');
        putchar('\\');
        cnt += 2;
      } else if (i == '\n') {
        putchar('\\');
        putchar('n');
        cnt += 2;
      } else if (i == '\r') {
        putchar('\\');
        putchar('r');
        cnt += 2;
      } else if (i == '\t') {
        putchar('\\');
        putchar('t');
        cnt += 2;
      } else {
        printf("\\%03o", i);
        cnt += 4;
      }
      if (cnt >= 80) {
        printf("\"\n\"");
        cnt = 0;
      }
      i = fgetc(f);
    }
    fclose(f);
    printf("\";\n");
    printf("unsigned int %s_length=%u;\n", argv[2], size);
  }
}


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   $0x3,-0x8(%rbp)
je     11c1 <main+0x41>
mov    0x2e31(%rip),%rax
mov    (%rax),%esi
lea    0xe50(%rip),%rdi
call   1060 <fputs@plt>
movl   $0x1,-0x4(%rbp)
jmp    1441 <main+0x2c1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0x1438(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    11f2 <main+0x72>
mov    0x2e02(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    120a <main+0x8a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0x1409(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    124b <main+0xcb>
mov    0x2db4(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0x13d8(%rip),%rsi
call   1090 <fprintf@plt>
mov    0x2d8f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1441 <main+0x2c1>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0x13ce(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
je     1411 <main+0x291>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x20,-0x1c(%rbp)
jl     12d2 <main+0x152>
cmpl   $0x22,-0x1c(%rbp)
je     12d2 <main+0x152>
cmpl   $0x5c,-0x1c(%rbp)
je     12d2 <main+0x152>
cmpl   $0x80,-0x1c(%rbp)
jge    12d2 <main+0x152>
mov    -0x1c(%rbp),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    13e1 <main+0x261>
cmpl   $0x22,-0x1c(%rbp)
jne    12fe <main+0x17e>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x22,%edi
call   1030 <putchar@plt>
mov    -0x20(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x20(%rbp)
jmp    13dc <main+0x25c>
cmpl   $0x5c,-0x1c(%rbp)
jne    132a <main+0x1aa>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    -0x20(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x20(%rbp)
jmp    13d7 <main+0x257>
cmpl   $0xa,-0x1c(%rbp)
jne    1356 <main+0x1d6>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x6e,%edi
call   1030 <putchar@plt>
mov    -0x20(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x20(%rbp)
jmp    13d2 <main+0x252>
cmpl   $0xd,-0x1c(%rbp)
jne    1382 <main+0x202>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x72,%edi
call   1030 <putchar@plt>
mov    -0x20(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x20(%rbp)
jmp    13cd <main+0x24d>
cmpl   $0x9,-0x1c(%rbp)
jne    13ae <main+0x22e>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x74,%edi
call   1030 <putchar@plt>
mov    -0x20(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x20(%rbp)
jmp    13c8 <main+0x248>
mov    -0x1c(%rbp),%esi
lea    0x1281(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x20(%rbp)
jmp    13cd <main+0x24d>
jmp    13d2 <main+0x252>
jmp    13d7 <main+0x257>
jmp    13dc <main+0x25c>
jmp    13e1 <main+0x261>
cmpl   $0x50,-0x20(%rbp)
jl     1400 <main+0x280>
lea    0x124d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %eax,-0x1c(%rbp)
jmp    127b <main+0xfb>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
lea    0x1222(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x24(%rbp),%edx
lea    0x120d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
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
cmp    $0x3,%edi
jne    130a <main+0x17a>
mov    %rsi,%r15
mov    0x8(%rsi),%rdi
lea    0x14be(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1352 <main+0x1c2>
mov    0x8(%r15),%rdi
lea    0x14a7(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%rbp
test   %rbp,%rbp
je     1365 <main+0x1d5>
mov    0x10(%r15),%rsi
lea    0x14a9(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
call   1080 <fgetc@plt>
mov    $0x0,%ebx
cmp    $0xffffffff,%eax
je     1326 <main+0x196>
lea    0x149c(%rip),%r12
lea    0xdee(%rip),%r13
xor    %ebx,%ebx
xor    %r14d,%r14d
jmp    1234 <main+0xa4>
nopl   0x0(%rax)
mov    %rbp,%rdi
call   1080 <fgetc@plt>
add    $0x1,%ebx
cmp    $0xffffffff,%eax
je     1326 <main+0x196>
cmp    $0x7f,%eax
jg     1260 <main+0xd0>
cmp    $0x5c,%eax
je     1260 <main+0xd0>
cmp    $0x20,%eax
jl     1260 <main+0xd0>
cmp    $0x22,%eax
je     1260 <main+0xd0>
movsbl %al,%edi
call   1030 <putchar@plt>
mov    $0x1,%eax
jmp    12eb <main+0x15b>
nopw   0x0(%rax,%rax,1)
lea    -0x9(%rax),%ecx
cmp    $0x19,%ecx
ja     1283 <main+0xf3>
movslq 0x0(%r13,%rcx,4),%rcx
add    %r13,%rcx
jmp    *%rcx
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x74,%edi
jmp    12e1 <main+0x151>
cmp    $0x5c,%eax
jne    1299 <main+0x109>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x5c,%edi
jmp    12e1 <main+0x151>
lea    0x1401(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x4,%eax
jmp    12eb <main+0x15b>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x6e,%edi
jmp    12e1 <main+0x151>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x72,%edi
jmp    12e1 <main+0x151>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x22,%edi
call   1030 <putchar@plt>
mov    $0x2,%eax
add    %eax,%r14d
cmp    $0x50,%r14d
jl     1220 <main+0x90>
xor    %r14d,%r14d
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1220 <main+0x90>
mov    0x2cc7(%rip),%rax
mov    (%rax),%esi
lea    0xd4e(%rip),%rdi
call   1070 <fputs@plt>
mov    $0x1,%eax
jmp    1387 <main+0x1f7>
mov    %rbp,%rdi
call   1050 <fclose@plt>
lea    0x1392(%rip),%rdi
call   1040 <puts@plt>
mov    0x10(%r15),%rsi
lea    0x1366(%rip),%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
jmp    1387 <main+0x1f7>
mov    0x2c8f(%rip),%rax
mov    (%rax),%rbp
test   %rbp,%rbp
jne    11dc <main+0x4c>
mov    0x2c6c(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r15),%rdx
lea    0x12fc(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2c4b(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1544 x i8] c"Converts binary file into compileable C file. \0A\0AThe MIT License (MIT)\0A\0ACopyright (c) 2015 Ondrej Novak\0A\0APermission is hereby granted, free of charge, to any person obtaining a copy\0Aof this software and associated documentation files (the \22Software\22), to deal\0Ain the Software without restriction, including without limitation the rights\0Ato use, copy, modify, merge, publish, distribute, sublicense, and/or sell\0Acopies of the Software, and to permit persons to whom the Software is\0Afurnished to do so, subject to the following conditions:\0A\0AThe above copyright notice and this permission notice shall be included in all\0Acopies or substantial portions of the Software.\0A\0ATHE SOFTWARE IS PROVIDED \22AS IS\22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\0AIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\0AFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\0AAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\0ALIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\0AOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\0ASOFTWARE.\0A\0AUsage:\0A bin2c <file> <identifier>\0A\0A<file> - source (binary) file. Use \22-\22 to read standard input\0A<identifier> - name of global identifier that will be used to access\0A the file from the code. It must be standrad C identifier.\0A Program also creates <identifier>_length variable cointaining\0A length of the file in bytes\0A\0AResult is sent to the standard output\0A\0A\00"
@stderr = global i32 0
@.str.1 = [2 x i8] c"-\00"
@stdin = global i32* null
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [27 x i8] c"Can't open input file '%s'\00"
@errno = global i32 0
@.str.4 = [17 x i8] c"const char *%s=\22\00"
@.str.5 = [6 x i8] c"\\%03o\00"
@.str.6 = [4 x i8] c"\22\0A\22\00"
@.str.7 = [4 x i8] c"\22;\0A\00"
@.str.8 = [28 x i8] c"unsigned int %s_length=%u;\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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 3
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = call i32 @fputs(i8* getelementptr inbounds ([1544 x i8], [1544 x i8]* @.str, i64 0, i64 0), i32 %13)
store i32 1, i32* %3
br label %136
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %15
%22 = load i32*, i32** @stdin
br label %28
23: ; preds = %15
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %23, %21
%29 = phi i32* [ %22, %21 ], [ %27, %23 ]
store i32* %29, i32** %6
%30 = load i32*, i32** %6
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %39
32: ; preds = %28
%33 = load i32, i32* @stderr
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %36)
%38 = load i32, i32* @errno
store i32 %38, i32* %3
br label %136
39: ; preds = %28
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 2
%42 = load i8*, i8** %41
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %42)
%44 = load i32*, i32** %6
%45 = call i32 @fgetc(i32* %44)
store i32 %45, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
br label %46
46: ; preds = %124, %39
%47 = load i32, i32* %7
%48 = icmp ne i32 %47, -1
br i1 %48, label %49, label %127
49: ; preds = %46
%50 = load i32, i32* %9
%51 = add i32 %50, 1
store i32 %51, i32* %9
%52 = load i32, i32* %7
%53 = icmp sge i32 %52, 32
br i1 %53, label %54, label %69
54: ; preds = %49
%55 = load i32, i32* %7
%56 = icmp ne i32 %55, 34
br i1 %56, label %57, label %69
57: ; preds = %54
%58 = load i32, i32* %7
%59 = icmp ne i32 %58, 92
br i1 %59, label %60, label %69
60: ; preds = %57
%61 = load i32, i32* %7
%62 = icmp slt i32 %61, 128
br i1 %62, label %63, label %69
63: ; preds = %60
%64 = load i32, i32* %7
%65 = trunc i32 %64 to i8
%66 = call i32 @putchar(i8 signext %65)
%67 = load i32, i32* %8
%68 = add nsw i32 %67, 1
store i32 %68, i32* %8
br label %119
69: ; preds = %60, %57, %54, %49
%70 = load i32, i32* %7
%71 = icmp eq i32 %70, 34
br i1 %71, label %72, label %77
72: ; preds = %69
%73 = call i32 @putchar(i8 signext 92)
%74 = call i32 @putchar(i8 signext 34)
%75 = load i32, i32* %8
%76 = add nsw i32 %75, 2
store i32 %76, i32* %8
br label %118
77: ; preds = %69
%78 = load i32, i32* %7
%79 = icmp eq i32 %78, 92
br i1 %79, label %80, label %85
80: ; preds = %77
%81 = call i32 @putchar(i8 signext 92)
%82 = call i32 @putchar(i8 signext 92)
%83 = load i32, i32* %8
%84 = add nsw i32 %83, 2
store i32 %84, i32* %8
br label %117
85: ; preds = %77
%86 = load i32, i32* %7
%87 = icmp eq i32 %86, 10
br i1 %87, label %88, label %93
88: ; preds = %85
%89 = call i32 @putchar(i8 signext 92)
%90 = call i32 @putchar(i8 signext 110)
%91 = load i32, i32* %8
%92 = add nsw i32 %91, 2
store i32 %92, i32* %8
br label %116
93: ; preds = %85
%94 = load i32, i32* %7
%95 = icmp eq i32 %94, 13
br i1 %95, label %96, label %101
96: ; preds = %93
%97 = call i32 @putchar(i8 signext 92)
%98 = call i32 @putchar(i8 signext 114)
%99 = load i32, i32* %8
%100 = add nsw i32 %99, 2
store i32 %100, i32* %8
br label %115
101: ; preds = %93
%102 = load i32, i32* %7
%103 = icmp eq i32 %102, 9
br i1 %103, label %104, label %109
104: ; preds = %101
%105 = call i32 @putchar(i8 signext 92)
%106 = call i32 @putchar(i8 signext 116)
%107 = load i32, i32* %8
%108 = add nsw i32 %107, 2
store i32 %108, i32* %8
br label %114
109: ; preds = %101
%110 = load i32, i32* %7
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %110)
%112 = load i32, i32* %8
%113 = add nsw i32 %112, 4
store i32 %113, i32* %8
br label %114
114: ; preds = %109, %104
br label %115
115: ; preds = %114, %96
br label %116
116: ; preds = %115, %88
br label %117
117: ; preds = %116, %80
br label %118
118: ; preds = %117, %72
br label %119
119: ; preds = %118, %63
%120 = load i32, i32* %8
%121 = icmp sge i32 %120, 80
br i1 %121, label %122, label %124
122: ; preds = %119
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %8
br label %124
124: ; preds = %122, %119
%125 = load i32*, i32** %6
%126 = call i32 @fgetc(i32* %125)
store i32 %126, i32* %7
br label %46
127: ; preds = %46
%128 = load i32*, i32** %6
%129 = call i32 @fclose(i32* %128)
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%131 = load i8**, i8*** %5
%132 = getelementptr inbounds i8*, i8** %131, i64 2
%133 = load i8*, i8** %132
%134 = load i32, i32* %9
%135 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i8* %133, i32 %134)
br label %136
136: ; preds = %12, %32, %127
%137 = load i32, i32* %3
ret i32 %137
}

LLVM IR (-O2):
@.str = [1544 x i8] c"Converts binary file into compileable C file. \0A\0AThe MIT License (MIT)\0A\0ACopyright (c) 2015 Ondrej Novak\0A\0APermission is hereby granted, free of charge, to any person obtaining a copy\0Aof this software and associated documentation files (the \22Software\22), to deal\0Ain the Software without restriction, including without limitation the rights\0Ato use, copy, modify, merge, publish, distribute, sublicense, and/or sell\0Acopies of the Software, and to permit persons to whom the Software is\0Afurnished to do so, subject to the following conditions:\0A\0AThe above copyright notice and this permission notice shall be included in all\0Acopies or substantial portions of the Software.\0A\0ATHE SOFTWARE IS PROVIDED \22AS IS\22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\0AIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\0AFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\0AAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\0ALIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\0AOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\0ASOFTWARE.\0A\0AUsage:\0A bin2c <file> <identifier>\0A\0A<file> - source (binary) file. Use \22-\22 to read standard input\0A<identifier> - name of global identifier that will be used to access\0A the file from the code. It must be standrad C identifier.\0A Program also creates <identifier>_length variable cointaining\0A length of the file in bytes\0A\0AResult is sent to the standard output\0A\0A\00"
@stderr = global i32 0
@.str.1 = [2 x i8] c"-\00"
@stdin = global i32* null
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [27 x i8] c"Can't open input file '%s'\00"
@errno = global i32 0
@.str.4 = [17 x i8] c"const char *%s=\22\00"
@.str.5 = [6 x i8] c"\\%03o\00"
@.str.6 = [4 x i8] c"\22\0A\22\00"
@.str.8 = [28 x i8] c"unsigned int %s_length=%u;\0A\00"
@str = [3 x i8] c"\22;\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fputs(i8* getelementptr inbounds ([1544 x i8], [1544 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %80
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = load i32*, i32** @stdin
br label %17
14: ; preds = %7
%15 = load i8*, i8** %8
%16 = tail call i32* @fopen(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %14, %12
%18 = phi i32* [ %13, %12 ], [ %16, %14 ]
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i32, i32* @stderr
%22 = load i8*, i8** %8
%23 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %22)
%24 = load i32, i32* @errno
br label %80
25: ; preds = %17
%26 = getelementptr inbounds i8*, i8** %1, i64 2
%27 = load i8*, i8** %26
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %27)
%29 = tail call i32 @fgetc(i32* %18)
%30 = icmp eq i32 %29, -1
br i1 %30, label %74, label %31
31: ; preds = %25, %70
%32 = phi i32 [ %35, %70 ], [ 0, %25 ]
%33 = phi i32 [ %71, %70 ], [ 0, %25 ]
%34 = phi i32 [ %72, %70 ], [ %29, %25 ]
%35 = add i32 %32, 1
%36 = icmp sgt i32 %34, 31
%37 = icmp ne i32 %34, 34
%38 = and i1 %36, %37
%39 = icmp ne i32 %34, 92
%40 = and i1 %39, %38
%41 = icmp slt i32 %34, 128
%42 = and i1 %41, %40
br i1 %42, label %43, label %46
43: ; preds = %31
%44 = trunc i32 %34 to i8
%45 = tail call i32 @putchar(i8 signext %44)
br label %64
46: ; preds = %31
switch i32 %34, label %62 [
i32 34, label %47
i32 92, label %50
i32 10, label %53
i32 13, label %56
i32 9, label %59
]
47: ; preds = %46
%48 = tail call i32 @putchar(i8 signext 92)
%49 = tail call i32 @putchar(i8 signext 34)
br label %64
50: ; preds = %46
%51 = tail call i32 @putchar(i8 signext 92)
%52 = tail call i32 @putchar(i8 signext 92)
br label %64
53: ; preds = %46
%54 = tail call i32 @putchar(i8 signext 92)
%55 = tail call i32 @putchar(i8 signext 110)
br label %64
56: ; preds = %46
%57 = tail call i32 @putchar(i8 signext 92)
%58 = tail call i32 @putchar(i8 signext 114)
br label %64
59: ; preds = %46
%60 = tail call i32 @putchar(i8 signext 92)
%61 = tail call i32 @putchar(i8 signext 116)
br label %64
62: ; preds = %46
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %34)
br label %64
64: ; preds = %47, %53, %59, %62, %56, %50, %43
%65 = phi i32 [ 2, %47 ], [ 2, %53 ], [ 2, %59 ], [ 4, %62 ], [ 2, %56 ], [ 2, %50 ], [ 1, %43 ]
%66 = add nsw i32 %33, %65
%67 = icmp sgt i32 %66, 79
br i1 %67, label %68, label %70
68: ; preds = %64
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %70
70: ; preds = %68, %64
%71 = phi i32 [ 0, %68 ], [ %66, %64 ]
%72 = tail call i32 @fgetc(i32* %18)
%73 = icmp eq i32 %72, -1
br i1 %73, label %74, label %31
74: ; preds = %70, %25
%75 = phi i32 [ 0, %25 ], [ %35, %70 ]
%76 = tail call i32 @fclose(i32* %18)
%77 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%78 = load i8*, i8** %26
%79 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i8* %78, i32 %75)
br label %80
80: ; preds = %20, %74, %4
%81 = phi i32 [ 1, %4 ], [ %24, %20 ], [ 0, %74 ]
ret i32 %81
}