#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
unsigned char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
size_t ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, unsigned int);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strnident(int /*<<< orphan*/, char *);
int strtoul(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char **argv) {
  FILE *fin;
  size_t filelen;
  int linelen;
  int arg;
  int alignment = 4;
  if (argc < 2) {
    fputs("bin2s - convert binary files to assembly language\n"
          "typical usage: bin2s foo.bin bar.bin baz.bin > foo.s\n",
          stderr);
    return 1;
  }
  for (arg = 1; arg < argc; arg++) {
    if (argv[arg][0] == '-') {
      switch (argv[arg][1]) {
      case 'a':
        alignment = (argc > arg) ? strtoul(argv[++arg], 0, 0) : 0;
        if (alignment == 0)
          alignment = 4;
        break;
      }
      continue;
    }
    fin = fopen(argv[arg], "rb");
    if (!fin) {
      fputs("bin2s: could not open ", stderr);
      perror(argv[arg]);
      return 1;
    }
    fseek(fin, 0, SEEK_END);
    filelen = ftell(fin);
    rewind(fin);
    if (filelen == 0) {
      fclose(fin);
      fprintf(stderr, "bin2s: warning: skipping empty file %s\n", argv[arg]);
      continue;
    }
    char *ptr = argv[arg];
    char chr;
    char *filename = NULL;
    while ((chr = *ptr)) {
      if (chr == '\\' || chr == '/') {
        filename = ptr;
      }
      ptr++;
    }
    if (NULL != filename) {
      filename++;
    } else {
      filename = argv[arg];
    }
    fprintf(stdout,
            "/* Generated by BIN2S - please don't edit directly */\n"
            "\t.section .rodata\n"
            "\t.balign %d\n"
            "\t.global ",
            alignment);
    strnident(stdout, filename);
    fputs("_size\n", stdout);
    fputs("\t.global ", stdout);
    strnident(stdout, filename);
    fputs("\n", stdout);
    strnident(stdout, filename);
    fputs(":\n\t.byte ", stdout);
    linelen = 0;
    int count = filelen;
    while (count > 0) {
      unsigned char c = fgetc(fin);
      printf("%3u", (unsigned int)c);
      count--;
      if (count) {
        if (++linelen >= 16) {
          linelen = 0;
          fputs("\n\t.byte ", stdout);
        } else {
          fputc(',', stdout);
        }
      }
    }
    fputs("\n\n\t.global ", stdout);
    strnident(stdout, filename);
    fputs("_end\n", stdout);
    strnident(stdout, filename);
    fputs("_end:\n\n", stdout);
    fputs("\t.align\n", stdout);
    strnident(stdout, filename);
    fprintf(stdout, "_size: .int %lu\n", (unsigned long)filelen);
    fclose(fin);
  }
  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)
movl   $0x4,-0x2c(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1218 <main+0x48>
mov    0x2dda(%rip),%rax
mov    (%rax),%esi
lea    0xdf9(%rip),%rdi
call   1060 <fputs@plt>
movl   $0x1,-0x4(%rbp)
jmp    1601 <main+0x431>
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    15fa <main+0x42a>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    12bb <main+0xeb>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x1(%rax),%al
sub    $0x61,%al
jne    12b6 <main+0xe6>
jmp    125f <main+0x8f>
mov    -0x8(%rbp),%eax
cmp    -0x28(%rbp),%eax
jle    1290 <main+0xc0>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x28(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   10f0 <strtoul@plt>
mov    %eax,-0x54(%rbp)
jmp    129a <main+0xca>
xor    %eax,%eax
mov    %eax,-0x54(%rbp)
jmp    129a <main+0xca>
mov    -0x54(%rbp),%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    12b1 <main+0xe1>
movl   $0x4,-0x2c(%rbp)
jmp    12b6 <main+0xe6>
jmp    15ec <main+0x41c>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd9a(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1314 <main+0x144>
mov    0x2cef(%rip),%rax
mov    (%rax),%esi
lea    0xd79(%rip),%rdi
call   1060 <fputs@plt>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10e0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1601 <main+0x431>
mov    -0x18(%rbp),%rdi
mov    0x2cc9(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10c0 <fseek@plt>
mov    -0x18(%rbp),%rdi
call   10b0 <ftell@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <rewind@plt>
cmpq   $0x0,-0x20(%rbp)
jne    137a <main+0x1aa>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x2c7f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd14(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
jmp    15ec <main+0x41c>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x38(%rbp)
movq   $0x0,-0x48(%rbp)
mov    -0x38(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x39(%rbp)
cmp    $0x0,%al
je     13d6 <main+0x206>
movsbl -0x39(%rbp),%eax
cmp    $0x5c,%eax
je     13bd <main+0x1ed>
movsbl -0x39(%rbp),%eax
cmp    $0x2f,%eax
jne    13c5 <main+0x1f5>
mov    -0x38(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1392 <main+0x1c2>
xor    %eax,%eax
cmp    -0x48(%rbp),%rax
je     13f3 <main+0x223>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    1403 <main+0x233>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x48(%rbp)
mov    0x2bc6(%rip),%rax
mov    (%rax),%edi
mov    -0x2c(%rbp),%edx
lea    0xc94(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2bac(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%rsi
call   1090 <strnident@plt>
mov    0x2b9a(%rip),%rax
mov    (%rax),%esi
lea    0xcc9(%rip),%rdi
call   1060 <fputs@plt>
mov    0x2b85(%rip),%rax
mov    (%rax),%esi
lea    0xccb(%rip),%rdi
call   1060 <fputs@plt>
mov    0x2b70(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%rsi
call   1090 <strnident@plt>
mov    0x2b5e(%rip),%rax
mov    (%rax),%esi
lea    0xcba(%rip),%rdi
call   1060 <fputs@plt>
mov    0x2b49(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%rsi
call   1090 <strnident@plt>
mov    0x2b37(%rip),%rax
mov    (%rax),%esi
lea    0xc6d(%rip),%rdi
call   1060 <fputs@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
jle    153e <main+0x36e>
mov    -0x18(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %al,-0x4d(%rbp)
movzbl -0x4d(%rbp),%esi
lea    0xc43(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
je     1539 <main+0x369>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmp    $0x10,%eax
jl     1521 <main+0x351>
movl   $0x0,-0x24(%rbp)
mov    0x2ac2(%rip),%rax
mov    (%rax),%esi
lea    0xbf9(%rip),%rdi
call   1060 <fputs@plt>
jmp    1534 <main+0x364>
mov    0x2aa8(%rip),%rax
mov    (%rax),%esi
mov    $0x2c,%edi
call   1080 <fputc@plt>
jmp    1539 <main+0x369>
jmp    14b5 <main+0x2e5>
mov    0x2a8b(%rip),%rax
mov    (%rax),%esi
lea    0xbcf(%rip),%rdi
call   1060 <fputs@plt>
mov    0x2a76(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%rsi
call   1090 <strnident@plt>
mov    0x2a64(%rip),%rax
mov    (%rax),%esi
lea    0xbb4(%rip),%rdi
call   1060 <fputs@plt>
mov    0x2a4f(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%rsi
call   1090 <strnident@plt>
mov    0x2a3d(%rip),%rax
mov    (%rax),%esi
lea    0xb93(%rip),%rdi
call   1060 <fputs@plt>
mov    0x2a28(%rip),%rax
mov    (%rax),%esi
lea    0xb86(%rip),%rdi
call   1060 <fputs@plt>
mov    0x2a13(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%rsi
call   1090 <strnident@plt>
mov    0x2a01(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xb64(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    121f <main+0x4f>
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    $0x18,%rsp
cmp    $0x2,%edi
jge    1202 <main+0x32>
mov    0x2dee(%rip),%rax
mov    (%rax),%esi
lea    0xe0d(%rip),%rdi
call   1060 <fputs@plt>
mov    $0x1,%eax
jmp    1494 <main+0x2c4>
mov    %rsi,%rbx
mov    %edi,%r15d
mov    $0x1,%r13d
movl   $0x4,(%rsp)
mov    %edi,0x4(%rsp)
mov    %rsi,0x10(%rsp)
jmp    12ba <main+0xea>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rbx),%esi
lea    0xee4(%rip),%rdi
call   1060 <fputs@plt>
mov    (%rbx),%edi
mov    %rbp,%rsi
call   1090 <strnident@plt>
mov    (%rbx),%esi
lea    0xed8(%rip),%rdi
call   1060 <fputs@plt>
mov    (%rbx),%edi
mov    %rbp,%rsi
call   1090 <strnident@plt>
mov    (%rbx),%esi
lea    0xec6(%rip),%rdi
call   1060 <fputs@plt>
mov    (%rbx),%esi
lea    0xec0(%rip),%rdi
call   1060 <fputs@plt>
mov    (%rbx),%edi
mov    %rbp,%rsi
call   1090 <strnident@plt>
mov    (%rbx),%edi
lea    0xeb1(%rip),%rsi
mov    0x8(%rsp),%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    0x4(%rsp),%r15d
mov    0x10(%rsp),%rbx
add    $0x1,%r13d
cmp    %r15d,%r13d
jge    1492 <main+0x2c2>
movslq %r13d,%rbp
mov    (%rbx,%rbp,8),%rdi
cmpb   $0x2d,(%rdi)
jne    12f0 <main+0x120>
cmpb   $0x61,0x1(%rdi)
jne    12ad <main+0xdd>
lea    0x1(%rbp),%r13d
mov    0x8(%rbx,%rbp,8),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10f0 <strtoul@plt>
mov    %eax,%ecx
test   %eax,%eax
mov    $0x4,%eax
cmove  %eax,%ecx
mov    %ecx,(%rsp)
jmp    12ad <main+0xdd>
nop
lea    0xd71(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     14a3 <main+0x2d3>
mov    %rax,%r14
mov    0x2cd9(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
xor    %esi,%esi
call   10c0 <fseek@plt>
mov    %r14,%rdi
call   10b0 <ftell@plt>
mov    %rax,%r12
mov    %r14,%rdi
call   1050 <rewind@plt>
test   %r12,%r12
je     146a <main+0x29a>
mov    (%rbx,%rbp,8),%rax
mov    %rax,%rcx
xor    %edx,%edx
jmp    1357 <main+0x187>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rcx,%rdx
add    $0x1,%rcx
movzbl (%rcx),%ebx
cmp    $0x2f,%bl
je     1350 <main+0x180>
cmp    $0x5c,%bl
je     1350 <main+0x180>
test   %bl,%bl
jne    1353 <main+0x183>
lea    0x1(%rdx),%rbp
test   %rdx,%rdx
cmove  %rax,%rbp
mov    0x2c56(%rip),%rbx
mov    (%rbx),%edi
lea    0xd27(%rip),%rsi
mov    (%rsp),%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    (%rbx),%edi
mov    %rbp,%rsi
call   1090 <strnident@plt>
mov    (%rbx),%esi
lea    0xd68(%rip),%rdi
call   1060 <fputs@plt>
mov    (%rbx),%esi
lea    0xd71(%rip),%rdi
call   1060 <fputs@plt>
mov    (%rbx),%edi
mov    %rbp,%rsi
call   1090 <strnident@plt>
mov    (%rbx),%esi
lea    0xd6f(%rip),%rdi
call   1060 <fputs@plt>
mov    (%rbx),%edi
mov    %rbp,%rsi
call   1090 <strnident@plt>
mov    (%rbx),%esi
lea    0xd31(%rip),%rdi
call   1060 <fputs@plt>
mov    %r12,0x8(%rsp)
test   %r12d,%r12d
jle    1230 <main+0x60>
mov    %r14,%rdi
call   1070 <fgetc@plt>
movzbl %al,%esi
lea    0xd16(%rip),%rdi
call   1040 <printf@plt>
mov    0x8(%rsp),%rax
mov    %eax,%r15d
add    $0xffffffff,%r15d
je     1230 <main+0x60>
xor    %r12d,%r12d
jmp    1451 <main+0x281>
nop
add    $0x1,%r12d
mov    (%rbx),%esi
mov    $0x2c,%edi
call   1080 <fputc@plt>
mov    %r14,%rdi
call   1070 <fgetc@plt>
movzbl %al,%esi
lea    0xcd7(%rip),%rdi
call   1040 <printf@plt>
add    $0xffffffff,%r15d
je     1230 <main+0x60>
cmp    $0xf,%r12d
jl     1420 <main+0x250>
mov    (%rbx),%esi
lea    0xcb0(%rip),%rdi
call   1060 <fputs@plt>
xor    %r12d,%r12d
jmp    1430 <main+0x260>
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    0x2b5f(%rip),%rax
mov    (%rax),%edi
mov    (%rbx,%rbp,8),%rdx
lea    0xbfc(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
jmp    12ad <main+0xdd>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b2e(%rip),%rax
mov    (%rax),%esi
lea    0xbb8(%rip),%rdi
call   1060 <fputs@plt>
mov    (%rbx,%rbp,8),%rdi
call   10e0 <perror@plt>
mov    $0x1,%eax
jmp    1494 <main+0x2c4>

LLVM IR (-O0):
@.str = [104 x i8] c"bin2s - convert binary files to assembly language\0Atypical usage: bin2s foo.bin bar.bin baz.bin > foo.s\0A\00"
@stderr = global i32 0
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [23 x i8] c"bin2s: could not open \00"
@SEEK_END = global i32 0
@.str.3 = [40 x i8] c"bin2s: warning: skipping empty file %s\0A\00"
@stdout = global i32 0
@.str.4 = [94 x i8] c"/* Generated by BIN2S - please don't edit directly */\0A\09.section .rodata\0A\09.balign %d\0A\09.global \00"
@.str.5 = [7 x i8] c"_size\0A\00"
@.str.6 = [10 x i8] c"\09.global \00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [10 x i8] c":\0A\09.byte \00"
@.str.9 = [4 x i8] c"%3u\00"
@.str.10 = [9 x i8] c"\0A\09.byte \00"
@.str.11 = [12 x i8] c"\0A\0A\09.global \00"
@.str.12 = [6 x i8] c"_end\0A\00"
@.str.13 = [8 x i8] c"_end:\0A\0A\00"
@.str.14 = [9 x i8] c"\09.align\0A\00"
@.str.15 = [17 x i8] c"_size: .int %lu\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 4, i32* %10
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 2
br i1 %17, label %18, label %21
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = call i32 @fputs(i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0), i32 %19)
store i32 1, i32* %3
br label %213
21: ; preds = %2
store i32 1, i32* %9
br label %22
22: ; preds = %209, %21
%23 = load i32, i32* %9
%24 = load i32, i32* %4
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %212
26: ; preds = %22
%27 = load i8**, i8*** %5
%28 = load i32, i32* %9
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
%32 = getelementptr inbounds i8, i8* %31, i64 0
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 45
br i1 %35, label %36, label %65
36: ; preds = %26
%37 = load i8**, i8*** %5
%38 = load i32, i32* %9
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %37, i64 %39
%41 = load i8*, i8** %40
%42 = getelementptr inbounds i8, i8* %41, i64 1
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
switch i32 %44, label %64 [
i32 97, label %45
]
45: ; preds = %36
%46 = load i32, i32* %4
%47 = load i32, i32* %9
%48 = icmp sgt i32 %46, %47
br i1 %48, label %49, label %57
49: ; preds = %45
%50 = load i8**, i8*** %5
%51 = load i32, i32* %9
%52 = add nsw i32 %51, 1
store i32 %52, i32* %9
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8*, i8** %50, i64 %53
%55 = load i8*, i8** %54
%56 = call i32 @strtoul(i8* %55, i32 0, i32 0)
br label %58
57: ; preds = %45
br label %58
58: ; preds = %57, %49
%59 = phi i32 [ %56, %49 ], [ 0, %57 ]
store i32 %59, i32* %10
%60 = load i32, i32* %10
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %63
62: ; preds = %58
store i32 4, i32* %10
br label %63
63: ; preds = %62, %58
br label %64
64: ; preds = %36, %63
br label %209
65: ; preds = %26
%66 = load i8**, i8*** %5
%67 = load i32, i32* %9
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8*, i8** %66, i64 %68
%70 = load i8*, i8** %69
%71 = call i32* @fopen(i8* %70, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %71, i32** %6
%72 = load i32*, i32** %6
%73 = icmp ne i32* %72, null
br i1 %73, label %83, label %74
74: ; preds = %65
%75 = load i32, i32* @stderr
%76 = call i32 @fputs(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %75)
%77 = load i8**, i8*** %5
%78 = load i32, i32* %9
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8*, i8** %77, i64 %79
%81 = load i8*, i8** %80
%82 = call i32 @perror(i8* %81)
store i32 1, i32* %3
br label %213
83: ; preds = %65
%84 = load i32*, i32** %6
%85 = load i32, i32* @SEEK_END
%86 = call i32 @fseek(i32* %84, i32 0, i32 %85)
%87 = load i32*, i32** %6
%88 = call i64 @ftell(i32* %87)
store i64 %88, i64* %7
%89 = load i32*, i32** %6
%90 = call i32 @rewind(i32* %89)
%91 = load i64, i64* %7
%92 = icmp eq i64 %91, 0
br i1 %92, label %93, label %103
93: ; preds = %83
%94 = load i32*, i32** %6
%95 = call i32 @fclose(i32* %94)
%96 = load i32, i32* @stderr
%97 = load i8**, i8*** %5
%98 = load i32, i32* %9
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i8*, i8** %97, i64 %99
%101 = load i8*, i8** %100
%102 = call i32 (i32, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8* %101)
br label %209
103: ; preds = %83
%104 = load i8**, i8*** %5
%105 = load i32, i32* %9
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i8*, i8** %104, i64 %106
%108 = load i8*, i8** %107
store i8* %108, i8** %11
store i8* null, i8** %13
br label %109
109: ; preds = %123, %103
%110 = load i8*, i8** %11
%111 = load i8, i8* %110
store i8 %111, i8* %12
%112 = icmp ne i8 %111, 0
br i1 %112, label %113, label %126
113: ; preds = %109
%114 = load i8, i8* %12
%115 = sext i8 %114 to i32
%116 = icmp eq i32 %115, 92
br i1 %116, label %121, label %117
117: ; preds = %113
%118 = load i8, i8* %12
%119 = sext i8 %118 to i32
%120 = icmp eq i32 %119, 47
br i1 %120, label %121, label %123
121: ; preds = %117, %113
%122 = load i8*, i8** %11
store i8* %122, i8** %13
br label %123
123: ; preds = %121, %117
%124 = load i8*, i8** %11
%125 = getelementptr inbounds i8, i8* %124, i32 1
store i8* %125, i8** %11
br label %109
126: ; preds = %109
%127 = load i8*, i8** %13
%128 = icmp ne i8* null, %127
br i1 %128, label %129, label %132
129: ; preds = %126
%130 = load i8*, i8** %13
%131 = getelementptr inbounds i8, i8* %130, i32 1
store i8* %131, i8** %13
br label %138
132: ; preds = %126
%133 = load i8**, i8*** %5
%134 = load i32, i32* %9
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds i8*, i8** %133, i64 %135
%137 = load i8*, i8** %136
store i8* %137, i8** %13
br label %138
138: ; preds = %132, %129
%139 = load i32, i32* @stdout
%140 = load i32, i32* %10
%141 = call i32 (i32, i8*, ...) @fprintf(i32 %139, i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.4, i64 0, i64 0), i32 %140)
%142 = load i32, i32* @stdout
%143 = load i8*, i8** %13
%144 = call i32 @strnident(i32 %142, i8* %143)
%145 = load i32, i32* @stdout
%146 = call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %145)
%147 = load i32, i32* @stdout
%148 = call i32 @fputs(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %147)
%149 = load i32, i32* @stdout
%150 = load i8*, i8** %13
%151 = call i32 @strnident(i32 %149, i8* %150)
%152 = load i32, i32* @stdout
%153 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 %152)
%154 = load i32, i32* @stdout
%155 = load i8*, i8** %13
%156 = call i32 @strnident(i32 %154, i8* %155)
%157 = load i32, i32* @stdout
%158 = call i32 @fputs(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 %157)
store i32 0, i32* %8
%159 = load i64, i64* %7
%160 = trunc i64 %159 to i32
store i32 %160, i32* %14
br label %161
161: ; preds = %185, %138
%162 = load i32, i32* %14
%163 = icmp sgt i32 %162, 0
br i1 %163, label %164, label %186
164: ; preds = %161
%165 = load i32*, i32** %6
%166 = call zeroext i8 @fgetc(i32* %165)
store i8 %166, i8* %15
%167 = load i8, i8* %15
%168 = zext i8 %167 to i32
%169 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %168)
%170 = load i32, i32* %14
%171 = add nsw i32 %170, -1
store i32 %171, i32* %14
%172 = load i32, i32* %14
%173 = icmp ne i32 %172, 0
br i1 %173, label %174, label %185
174: ; preds = %164
%175 = load i32, i32* %8
%176 = add nsw i32 %175, 1
store i32 %176, i32* %8
%177 = icmp sge i32 %176, 16
br i1 %177, label %178, label %181
178: ; preds = %174
store i32 0, i32* %8
%179 = load i32, i32* @stdout
%180 = call i32 @fputs(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 %179)
br label %184
181: ; preds = %174
%182 = load i32, i32* @stdout
%183 = call i32 @fputc(i8 signext 44, i32 %182)
br label %184
184: ; preds = %181, %178
br label %185
185: ; preds = %184, %164
br label %161
186: ; preds = %161
%187 = load i32, i32* @stdout
%188 = call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i32 %187)
%189 = load i32, i32* @stdout
%190 = load i8*, i8** %13
%191 = call i32 @strnident(i32 %189, i8* %190)
%192 = load i32, i32* @stdout
%193 = call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 %192)
%194 = load i32, i32* @stdout
%195 = load i8*, i8** %13
%196 = call i32 @strnident(i32 %194, i8* %195)
%197 = load i32, i32* @stdout
%198 = call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i32 %197)
%199 = load i32, i32* @stdout
%200 = call i32 @fputs(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), i32 %199)
%201 = load i32, i32* @stdout
%202 = load i8*, i8** %13
%203 = call i32 @strnident(i32 %201, i8* %202)
%204 = load i32, i32* @stdout
%205 = load i64, i64* %7
%206 = call i32 (i32, i8*, ...) @fprintf(i32 %204, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0), i64 %205)
%207 = load i32*, i32** %6
%208 = call i32 @fclose(i32* %207)
br label %209
209: ; preds = %186, %93, %64
%210 = load i32, i32* %9
%211 = add nsw i32 %210, 1
store i32 %211, i32* %9
br label %22
212: ; preds = %22
store i32 0, i32* %3
br label %213
213: ; preds = %212, %74, %18
%214 = load i32, i32* %3
ret i32 %214
}

LLVM IR (-O2):
@.str = [104 x i8] c"bin2s - convert binary files to assembly language\0Atypical usage: bin2s foo.bin bar.bin baz.bin > foo.s\0A\00"
@stderr = global i32 0
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [23 x i8] c"bin2s: could not open \00"
@SEEK_END = global i32 0
@.str.3 = [40 x i8] c"bin2s: warning: skipping empty file %s\0A\00"
@stdout = global i32 0
@.str.4 = [94 x i8] c"/* Generated by BIN2S - please don't edit directly */\0A\09.section .rodata\0A\09.balign %d\0A\09.global \00"
@.str.5 = [7 x i8] c"_size\0A\00"
@.str.6 = [10 x i8] c"\09.global \00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [10 x i8] c":\0A\09.byte \00"
@.str.9 = [4 x i8] c"%3u\00"
@.str.10 = [9 x i8] c"\0A\09.byte \00"
@.str.11 = [12 x i8] c"\0A\0A\09.global \00"
@.str.12 = [6 x i8] c"_end\0A\00"
@.str.13 = [8 x i8] c"_end:\0A\0A\00"
@.str.14 = [9 x i8] c"\09.align\0A\00"
@.str.15 = [17 x i8] c"_size: .int %lu\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fputs(i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %125
7: ; preds = %2, %120
%8 = phi i32 [ %122, %120 ], [ 4, %2 ]
%9 = phi i32 [ %123, %120 ], [ 1, %2 ]
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 45
br i1 %14, label %15, label %27
15: ; preds = %7
%16 = getelementptr inbounds i8, i8* %12, i64 1
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 97
br i1 %18, label %19, label %120
19: ; preds = %15
%20 = add nsw i32 %9, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %1, i64 %21
%23 = load i8*, i8** %22
%24 = tail call i32 @strtoul(i8* %23, i32 0, i32 0)
%25 = icmp eq i32 %24, 0
%26 = select i1 %25, i32 4, i32 %24
br label %120
27: ; preds = %7
%28 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %35
30: ; preds = %27
%31 = load i32, i32* @stderr
%32 = tail call i32 @fputs(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %31)
%33 = load i8*, i8** %11
%34 = tail call i32 @perror(i8* %33)
br label %125
35: ; preds = %27
%36 = load i32, i32* @SEEK_END
%37 = tail call i32 @fseek(i32* %28, i32 0, i32 %36)
%38 = tail call i64 @ftell(i32* %28)
%39 = tail call i32 @rewind(i32* %28)
%40 = icmp eq i64 %38, 0
br i1 %40, label %41, label %46
41: ; preds = %35
%42 = tail call i32 @fclose(i32* %28)
%43 = load i32, i32* @stderr
%44 = load i8*, i8** %11
%45 = tail call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8* %44)
br label %120
46: ; preds = %35
%47 = load i8*, i8** %11
br label %48
48: ; preds = %53, %46
%49 = phi i8* [ %47, %46 ], [ %55, %53 ]
%50 = phi i8* [ null, %46 ], [ %54, %53 ]
%51 = load i8, i8* %49
switch i8 %51, label %53 [
i8 0, label %56
i8 92, label %52
i8 47, label %52
]
52: ; preds = %48, %48
br label %53
53: ; preds = %48, %52
%54 = phi i8* [ %49, %52 ], [ %50, %48 ]
%55 = getelementptr inbounds i8, i8* %49, i64 1
br label %48
56: ; preds = %48
%57 = icmp eq i8* %50, null
%58 = getelementptr inbounds i8, i8* %50, i64 1
%59 = select i1 %57, i8* %47, i8* %58
%60 = load i32, i32* @stdout
%61 = tail call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.4, i64 0, i64 0), i32 %8)
%62 = load i32, i32* @stdout
%63 = tail call i32 @strnident(i32 %62, i8* %59)
%64 = load i32, i32* @stdout
%65 = tail call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %64)
%66 = load i32, i32* @stdout
%67 = tail call i32 @fputs(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %66)
%68 = load i32, i32* @stdout
%69 = tail call i32 @strnident(i32 %68, i8* %59)
%70 = load i32, i32* @stdout
%71 = tail call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 %70)
%72 = load i32, i32* @stdout
%73 = tail call i32 @strnident(i32 %72, i8* %59)
%74 = load i32, i32* @stdout
%75 = tail call i32 @fputs(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 %74)
%76 = trunc i64 %38 to i32
%77 = icmp sgt i32 %76, 0
br i1 %77, label %78, label %102
78: ; preds = %56
%79 = tail call zeroext i8 @fgetc(i32* %28)
%80 = zext i8 %79 to i32
%81 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %80)
%82 = add nsw i32 %76, -1
%83 = icmp eq i32 %82, 0
br i1 %83, label %102, label %84
84: ; preds = %78, %95
%85 = phi i32 [ %100, %95 ], [ %82, %78 ]
%86 = phi i32 [ %96, %95 ], [ 0, %78 ]
%87 = icmp sgt i32 %86, 14
br i1 %87, label %88, label %91
88: ; preds = %84
%89 = load i32, i32* @stdout
%90 = tail call i32 @fputs(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 %89)
br label %95
91: ; preds = %84
%92 = add nsw i32 %86, 1
%93 = load i32, i32* @stdout
%94 = tail call i32 @fputc(i8 signext 44, i32 %93)
br label %95
95: ; preds = %88, %91
%96 = phi i32 [ 0, %88 ], [ %92, %91 ]
%97 = tail call zeroext i8 @fgetc(i32* %28)
%98 = zext i8 %97 to i32
%99 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %98)
%100 = add nsw i32 %85, -1
%101 = icmp eq i32 %100, 0
br i1 %101, label %102, label %84
102: ; preds = %95, %78, %56
%103 = load i32, i32* @stdout
%104 = tail call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i32 %103)
%105 = load i32, i32* @stdout
%106 = tail call i32 @strnident(i32 %105, i8* %59)
%107 = load i32, i32* @stdout
%108 = tail call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 %107)
%109 = load i32, i32* @stdout
%110 = tail call i32 @strnident(i32 %109, i8* %59)
%111 = load i32, i32* @stdout
%112 = tail call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i32 %111)
%113 = load i32, i32* @stdout
%114 = tail call i32 @fputs(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), i32 %113)
%115 = load i32, i32* @stdout
%116 = tail call i32 @strnident(i32 %115, i8* %59)
%117 = load i32, i32* @stdout
%118 = tail call i32 (i32, i8*, ...) @fprintf(i32 %117, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0), i64 %38)
%119 = tail call i32 @fclose(i32* %28)
br label %120
120: ; preds = %19, %15, %102, %41
%121 = phi i32 [ %20, %19 ], [ %9, %15 ], [ %9, %41 ], [ %9, %102 ]
%122 = phi i32 [ %26, %19 ], [ %8, %15 ], [ %8, %41 ], [ %8, %102 ]
%123 = add nsw i32 %121, 1
%124 = icmp slt i32 %123, %0
br i1 %124, label %7, label %125
125: ; preds = %120, %30, %4
%126 = phi i32 [ 1, %4 ], [ 1, %30 ], [ 0, %120 ]
ret i32 %126
}