#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*/ exit(int);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ *stdout;
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  const char hex[] = "0123456789ABCDEF";
  char buf[16];
  char line[80];
  int i, j, k;
  unsigned addr = 0;
  FILE *fi = stdin, *fo = stdout;
  errno = 0;
  for (i = 0; i < 80; i++)
    line[i] = ' ';
  if (argc > 1 && (!strcmp(argv[1], "-?") || !strcmp(argv[1], "-h") ||
                   !strcmp(argv[1], "--help"))) {
    fprintf(stderr, "Usage: tobit [infile [outfile]]\n\n"
                    "  'infile' and 'outfile' default to stdin and stdout.\n\n"
                    "  Use 'tobit - outfile' to use stdin for infile while\n"
                    "  still specifying an output file.\n\n");
    exit(1);
  }
  if (argc > 1 && argv[1][0] != '-') {
    fi = fopen(argv[1], "rb");
    if (!fi) {
      perror("fopen()");
      fprintf(stderr, "Couldn't open '%s' for reading.\n", argv[1]);
      exit(1);
    }
  }
  if (argc > 2) {
    fo = fopen(argv[2], "w");
    if (!fo) {
      perror("fopen()");
      fprintf(stderr, "Couldn't open '%s' for reading.\n", argv[2]);
      exit(1);
    }
  }
  while (!feof(fi)) {
    if (!(i = fread(buf, 1, 4, fi)))
      break;
    memset(line, ' ', 79);
    line[52] = '#';
    line[79] = '\n';
    for (j = 0; j < i; j++) {
      for (k = 0; k < 8; k++)
        line[2 + j * 12 + k + (k > 3)] = '0' + ((buf[j] >> (7 - k)) & 1);
      line[54 + j * 3] = hex[0xF & (buf[j] >> 4)];
      line[55 + j * 3] = hex[0xF & (buf[j])];
      line[66 + j] = (buf[j] >= 32) && (buf[j] < 127) ? buf[j] : '.';
    }
    for (j = 0; j < 8; j++)
      line[78 - j] = hex[(addr >> (j * 4)) & 0xF];
    fwrite(line, 1, 80, fo);
    addr += 4;
  }
  return errno;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe50(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe4d(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe4b(%rip),%al
mov    %al,-0x20(%rbp)
movl   $0x0,-0xa0(%rbp)
mov    0x2e0f(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0xa8(%rbp)
mov    0x2dde(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0xb0(%rbp)
mov    0x2dd5(%rip),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x94(%rbp)
cmpl   $0x50,-0x94(%rbp)
jge    123b <main+0xab>
movslq -0x94(%rbp),%rax
movb   $0x20,-0x90(%rbp,%rax,1)
20
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    120b <main+0x7b>
cmpl   $0x1,-0x8(%rbp)
jle    12bd <main+0x12d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdbd(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
je     129c <main+0x10c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xda3(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
je     129c <main+0x10c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd89(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    12bd <main+0x12d>
mov    0x2d35(%rip),%rax
mov    (%rax),%edi
lea    0xd72(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
cmpl   $0x1,-0x8(%rbp)
jle    133e <main+0x1ae>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     133e <main+0x1ae>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xde7(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0xa8(%rbp)
cmpq   $0x0,-0xa8(%rbp)
jne    1339 <main+0x1a9>
lea    0xdc9(%rip),%rdi
call   1090 <perror@plt>
mov    0x2cc1(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdb4(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
jmp    133e <main+0x1ae>
cmpl   $0x2,-0x8(%rbp)
jle    13ab <main+0x21b>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xda6(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0xb0(%rbp)
cmpq   $0x0,-0xb0(%rbp)
jne    13a6 <main+0x216>
lea    0xd5c(%rip),%rdi
call   1090 <perror@plt>
mov    0x2c54(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xd47(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
jmp    13ab <main+0x21b>
jmp    13b0 <main+0x220>
mov    -0xa8(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    13d1 <main+0x241>
jmp    160c <main+0x47c>
lea    -0x40(%rbp),%rdi
mov    -0xa8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
mov    %eax,-0x94(%rbp)
cmp    $0x0,%eax
jne    13ff <main+0x26f>
jmp    160c <main+0x47c>
lea    -0x90(%rbp),%rdi
mov    $0x20,%esi
mov    $0x4f,%edx
call   1040 <memset@plt>
movb   $0x23,-0x5c(%rbp)
movb   $0xa,-0x41(%rbp)
movl   $0x0,-0x98(%rbp)
mov    -0x98(%rbp),%eax
cmp    -0x94(%rbp),%eax
jge    1582 <main+0x3f2>
movl   $0x0,-0x9c(%rbp)
cmpl   $0x8,-0x9c(%rbp)
jge    14b0 <main+0x320>
movslq -0x98(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
mov    $0x7,%ecx
sub    -0x9c(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
add    $0x30,%eax
mov    %al,%cl
imul   $0xc,-0x98(%rbp),%eax
add    $0x2,%eax
add    -0x9c(%rbp),%eax
cmpl   $0x3,-0x9c(%rbp)
setg   %dl
and    $0x1,%dl
movzbl %dl,%edx
add    %edx,%eax
cltq
mov    %cl,-0x90(%rbp,%rax,1)
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
jmp    1443 <main+0x2b3>
movslq -0x98(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
sar    $0x4,%eax
and    $0xf,%eax
cltq
mov    -0x30(%rbp,%rax,1),%cl
imul   $0x3,-0x98(%rbp),%eax
add    $0x36,%eax
cltq
mov    %cl,-0x90(%rbp,%rax,1)
movslq -0x98(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
and    $0xf,%eax
cltq
mov    -0x30(%rbp,%rax,1),%cl
imul   $0x3,-0x98(%rbp),%eax
add    $0x37,%eax
cltq
mov    %cl,-0x90(%rbp,%rax,1)
movslq -0x98(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
cmp    $0x20,%eax
jl     1544 <main+0x3b4>
movslq -0x98(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
cmp    $0x7f,%eax
jge    1544 <main+0x3b4>
movslq -0x98(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
mov    %eax,-0xb4(%rbp)
jmp    1554 <main+0x3c4>
mov    $0x2e,%eax
mov    %eax,-0xb4(%rbp)
jmp    1554 <main+0x3c4>
mov    -0xb4(%rbp),%eax
mov    %al,%cl
mov    -0x98(%rbp),%eax
add    $0x42,%eax
cltq
mov    %cl,-0x90(%rbp,%rax,1)
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    1427 <main+0x297>
movl   $0x0,-0x98(%rbp)
cmpl   $0x8,-0x98(%rbp)
jge    15db <main+0x44b>
mov    -0xa0(%rbp),%eax
mov    -0x98(%rbp),%ecx
shl    $0x2,%ecx
shr    %cl,%eax
and    $0xf,%eax
mov    %eax,%eax
mov    -0x30(%rbp,%rax,1),%cl
mov    $0x4e,%eax
sub    -0x98(%rbp),%eax
cltq
mov    %cl,-0x90(%rbp,%rax,1)
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    158c <main+0x3fc>
lea    -0x90(%rbp),%rdi
mov    -0xb0(%rbp),%rcx
mov    $0x1,%esi
mov    $0x50,%edx
call   10b0 <fwrite@plt>
mov    -0xa0(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0xa0(%rbp)
jmp    13b0 <main+0x220>
mov    0x29bd(%rip),%rax
mov    (%rax),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    0x2e40(%rip),%rax
mov    (%rax),%r12
mov    0x2e16(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x8(%rsp)
mov    0x2e0f(%rip),%rax
movl   $0x0,(%rax)
movaps 0xe32(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
cmp    $0x2,%edi
jl     1282 <main+0xf2>
mov    %rsi,%r15
mov    %edi,%ebx
mov    0x8(%rsi),%rbp
lea    0xe21(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     14d2 <main+0x342>
lea    0xe0d(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     14d2 <main+0x342>
lea    0xdf9(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     14d2 <main+0x342>
cmpb   $0x2d,0x0(%rbp)
je     125f <main+0xcf>
lea    0xe96(%rip),%rsi
mov    %rbp,%rdi
call   1080 <fopen@plt>
mov    %rax,%r12
test   %rax,%rax
je     14f3 <main+0x363>
cmp    $0x3,%ebx
jb     1282 <main+0xf2>
mov    0x10(%r15),%rdi
lea    0xe9e(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     150e <main+0x37e>
mov    %r12,%rdi
call   1070 <feof@plt>
test   %eax,%eax
je     12a9 <main+0x119>
mov    0x2d3b(%rip),%rax
mov    (%rax),%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r13d,%r13d
lea    0x10(%rsp),%rbx
lea    0xd58(%rip),%r15
mov    $0x2e,%r14d
mov    %r12,0x68(%rsp)
jmp    1385 <main+0x1f5>
nopl   0x0(%rax,%rax,1)
mov    %r13d,%eax
mov    %eax,%ecx
and    $0xc,%ecx
mov    (%rcx,%r15,1),%cl
mov    %cl,0x5e(%rsp)
mov    %r13d,%ecx
shr    $0x4,%ecx
and    $0xf,%ecx
mov    (%rcx,%r15,1),%cl
mov    %cl,0x5d(%rsp)
mov    %r13d,%ecx
shr    $0x8,%ecx
and    $0xf,%ecx
mov    (%rcx,%r15,1),%cl
mov    %cl,0x5c(%rsp)
mov    %r13d,%ecx
shr    $0xc,%ecx
and    $0xf,%ecx
mov    (%rcx,%r15,1),%cl
mov    %cl,0x5b(%rsp)
mov    %r13d,%ecx
shr    $0x10,%ecx
and    $0xf,%ecx
mov    (%rcx,%r15,1),%cl
mov    %cl,0x5a(%rsp)
mov    %r13d,%ecx
shr    $0x14,%ecx
and    $0xf,%ecx
mov    (%rcx,%r15,1),%cl
mov    %cl,0x59(%rsp)
mov    %r13d,%ecx
shr    $0x18,%ecx
and    $0xf,%ecx
mov    (%rcx,%r15,1),%cl
mov    %cl,0x58(%rsp)
shr    $0x1c,%rax
mov    (%rax,%r15,1),%al
mov    %al,0x57(%rsp)
mov    %r12,%rbx
mov    %r12,%rdi
mov    $0x1,%esi
mov    $0x50,%edx
mov    0x8(%rsp),%rcx
call   10b0 <fwrite@plt>
add    $0x4,%r13d
mov    0x68(%rsp),%r12
mov    %r12,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    128e <main+0xfe>
lea    0x70(%rsp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r12,%rcx
call   1030 <fread@plt>
test   %eax,%eax
je     128e <main+0xfe>
mov    %eax,%ebp
mov    %rbx,%r12
mov    %rbx,%rdi
mov    $0x20,%esi
mov    $0x4f,%edx
call   1040 <memset@plt>
movb   $0x23,0x44(%rsp)
movb   $0xa,0x5f(%rsp)
test   %ebp,%ebp
jle    12d0 <main+0x140>
mov    %ebp,%eax
shl    $0x2,%rax
lea    (%rax,%rax,2),%r8
mov    $0x42,%ecx
mov    $0x37,%edx
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl 0x2e(%rsp,%rcx,1),%eax
mov    %eax,%ebx
shr    $0x7,%bl
or     $0x30,%bl
mov    %bl,0x12(%rsp,%rsi,1)
mov    %eax,%ebx
shr    $0x6,%bl
and    $0x1,%bl
or     $0x30,%bl
mov    %bl,0x13(%rsp,%rsi,1)
mov    %eax,%ebx
shr    $0x5,%bl
and    $0x1,%bl
or     $0x30,%bl
lea    0x4(%rsi),%ebp
and    $0xfffffffc,%ebp
mov    %bl,0x10(%rsp,%rbp,1)
mov    %eax,%ebx
shr    $0x4,%bl
and    $0x1,%bl
or     $0x30,%bl
lea    0x5(%rsi),%ebp
and    $0xfffffffd,%ebp
mov    %bl,0x10(%rsp,%rbp,1)
mov    %eax,%ebx
shr    $0x3,%bl
and    $0x1,%bl
or     $0x30,%bl
lea    0x7(%rsi),%ebp
mov    %bl,0x10(%rsp,%rbp,1)
mov    %eax,%ebx
shr    $0x2,%bl
and    $0x1,%bl
or     $0x30,%bl
lea    0x8(%rsi),%ebp
and    $0xfffffffc,%ebp
mov    %bl,0x10(%rsp,%rbp,1)
mov    %eax,%ebx
shr    %bl
and    $0x1,%bl
or     $0x30,%bl
lea    0x9(%rsi),%ebp
and    $0xfffffffd,%ebp
mov    %bl,0x10(%rsp,%rbp,1)
mov    %eax,%ebx
and    $0x1,%bl
or     $0x30,%bl
lea    0xa(%rsi),%ebp
and    $0xfffffffe,%ebp
mov    %bl,0x10(%rsp,%rbp,1)
mov    %rax,%rdi
shr    $0x4,%rdi
movzbl (%rdi,%r15,1),%ebx
lea    -0x1(%rdx),%edi
mov    %bl,0x10(%rsp,%rdi,1)
mov    %eax,%edi
and    $0xf,%edi
movzbl (%rdi,%r15,1),%ebx
mov    %edx,%edi
mov    %bl,0x10(%rsp,%rdi,1)
lea    -0x7f(%rax),%edi
cmp    $0xa1,%dil
cmovb  %r14d,%eax
mov    %al,0x10(%rsp,%rcx,1)
add    $0x1,%rcx
add    $0x3,%edx
add    $0xc,%rsi
cmp    %rsi,%r8
jne    13f0 <main+0x260>
jmp    12d0 <main+0x140>
mov    0x2aff(%rip),%rax
mov    (%rax),%edi
lea    0xb4c(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
lea    0xbea(%rip),%rdi
call   1090 <perror@plt>
mov    0x2ad2(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r15),%rdx
jmp    1527 <main+0x397>
lea    0xbcf(%rip),%rdi
call   1090 <perror@plt>
mov    0x2ab7(%rip),%rax
mov    (%rax),%edi
mov    0x10(%r15),%rdx
lea    0xbbe(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@__const.main.hex = [17 x i8] c"0123456789ABCDEF\00"
@stdin = global i32* null
@stdout = global i32* null
@errno = global i32 0
@.str = [3 x i8] c"-?\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [7 x i8] c"--help\00"
@stderr = global i32 0
@.str.3 = [179 x i8] c"Usage: tobit [infile [outfile]]\0A\0A 'infile' and 'outfile' default to stdin and stdout.\0A\0A Use 'tobit - outfile' to use stdin for infile while\0A still specifying an output file.\0A\0A\00"
@.str.4 = [3 x i8] c"rb\00"
@.str.5 = [8 x i8] c"fopen()\00"
@.str.6 = [33 x i8] c"Couldn't open '%s' for reading.\0A\00"
@.str.7 = [2 x i8] c"w\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [17 x i8]
%7 = alloca [16 x i8]
%8 = alloca [80 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = bitcast [17 x i8]* %6 to i8*
store i32 0, i32* %12
%16 = load i32*, i32** @stdin
store i32* %16, i32** %13
%17 = load i32*, i32** @stdout
store i32* %17, i32** %14
store i32 0, i32* @errno
store i32 0, i32* %9
br label %18
18: ; preds = %25, %2
%19 = load i32, i32* %9
%20 = icmp slt i32 %19, 80
br i1 %20, label %21, label %28
21: ; preds = %18
%22 = load i32, i32* %9
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 %23
store i8 32, i8* %24
br label %25
25: ; preds = %21
%26 = load i32, i32* %9
%27 = add nsw i32 %26, 1
store i32 %27, i32* %9
br label %18
28: ; preds = %18
%29 = load i32, i32* %4
%30 = icmp sgt i32 %29, 1
br i1 %30, label %31, label %53
31: ; preds = %28
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i32 @strcmp(i8* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %49
37: ; preds = %31
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i8*, i8** %39
%41 = call i32 @strcmp(i8* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %49
43: ; preds = %37
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = load i8*, i8** %45
%47 = call i32 @strcmp(i8* %46, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%48 = icmp ne i32 %47, 0
br i1 %48, label %53, label %49
49: ; preds = %43, %37, %31
%50 = load i32, i32* @stderr
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([179 x i8], [179 x i8]* @.str.3, i64 0, i64 0))
%52 = call i32 @exit(i32 1)
unreachable
53: ; preds = %43, %28
%54 = load i32, i32* %4
%55 = icmp sgt i32 %54, 1
br i1 %55, label %56, label %80
56: ; preds = %53
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 1
%59 = load i8*, i8** %58
%60 = getelementptr inbounds i8, i8* %59, i64 0
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = icmp ne i32 %62, 45
br i1 %63, label %64, label %80
64: ; preds = %56
%65 = load i8**, i8*** %5
%66 = getelementptr inbounds i8*, i8** %65, i64 1
%67 = load i8*, i8** %66
%68 = call i32* @fopen(i8* %67, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %68, i32** %13
%69 = load i32*, i32** %13
%70 = icmp ne i32* %69, null
br i1 %70, label %79, label %71
71: ; preds = %64
%72 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%73 = load i32, i32* @stderr
%74 = load i8**, i8*** %5
%75 = getelementptr inbounds i8*, i8** %74, i64 1
%76 = load i8*, i8** %75
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* %76)
%78 = call i32 @exit(i32 1)
unreachable
79: ; preds = %64
br label %80
80: ; preds = %79, %56, %53
%81 = load i32, i32* %4
%82 = icmp sgt i32 %81, 2
br i1 %82, label %83, label %99
83: ; preds = %80
%84 = load i8**, i8*** %5
%85 = getelementptr inbounds i8*, i8** %84, i64 2
%86 = load i8*, i8** %85
%87 = call i32* @fopen(i8* %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %87, i32** %14
%88 = load i32*, i32** %14
%89 = icmp ne i32* %88, null
br i1 %89, label %98, label %90
90: ; preds = %83
%91 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%92 = load i32, i32* @stderr
%93 = load i8**, i8*** %5
%94 = getelementptr inbounds i8*, i8** %93, i64 2
%95 = load i8*, i8** %94
%96 = call i32 (i32, i8*, ...) @fprintf(i32 %92, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* %95)
%97 = call i32 @exit(i32 1)
unreachable
98: ; preds = %83
br label %99
99: ; preds = %98, %80
br label %100
100: ; preds = %230, %99
%101 = load i32*, i32** %13
%102 = call i32 @feof(i32* %101)
%103 = icmp ne i32 %102, 0
%104 = xor i1 %103, true
br i1 %104, label %105, label %236
105: ; preds = %100
%106 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%107 = load i32*, i32** %13
%108 = call i32 @fread(i8* %106, i32 1, i32 4, i32* %107)
store i32 %108, i32* %9
%109 = icmp ne i32 %108, 0
br i1 %109, label %111, label %110
110: ; preds = %105
br label %236
111: ; preds = %105
%112 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%113 = call i32 @memset(i8* %112, i8 signext 32, i32 79)
%114 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 52
store i8 35, i8* %114
%115 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 79
store i8 10, i8* %115
store i32 0, i32* %10
br label %116
116: ; preds = %207, %111
%117 = load i32, i32* %10
%118 = load i32, i32* %9
%119 = icmp slt i32 %117, %118
br i1 %119, label %120, label %210
120: ; preds = %116
store i32 0, i32* %11
br label %121
121: ; preds = %147, %120
%122 = load i32, i32* %11
%123 = icmp slt i32 %122, 8
br i1 %123, label %124, label %150
124: ; preds = %121
%125 = load i32, i32* %10
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 %126
%128 = load i8, i8* %127
%129 = sext i8 %128 to i32
%130 = load i32, i32* %11
%131 = sub nsw i32 7, %130
%132 = ashr i32 %129, %131
%133 = and i32 %132, 1
%134 = add nsw i32 48, %133
%135 = trunc i32 %134 to i8
%136 = load i32, i32* %10
%137 = mul nsw i32 %136, 12
%138 = add nsw i32 2, %137
%139 = load i32, i32* %11
%140 = add nsw i32 %138, %139
%141 = load i32, i32* %11
%142 = icmp sgt i32 %141, 3
%143 = zext i1 %142 to i32
%144 = add nsw i32 %140, %143
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 %145
store i8 %135, i8* %146
br label %147
147: ; preds = %124
%148 = load i32, i32* %11
%149 = add nsw i32 %148, 1
store i32 %149, i32* %11
br label %121
150: ; preds = %121
%151 = load i32, i32* %10
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 %152
%154 = load i8, i8* %153
%155 = sext i8 %154 to i32
%156 = ashr i32 %155, 4
%157 = and i32 15, %156
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds [17 x i8], [17 x i8]* %6, i64 0, i64 %158
%160 = load i8, i8* %159
%161 = load i32, i32* %10
%162 = mul nsw i32 %161, 3
%163 = add nsw i32 54, %162
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 %164
store i8 %160, i8* %165
%166 = load i32, i32* %10
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 %167
%169 = load i8, i8* %168
%170 = sext i8 %169 to i32
%171 = and i32 15, %170
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds [17 x i8], [17 x i8]* %6, i64 0, i64 %172
%174 = load i8, i8* %173
%175 = load i32, i32* %10
%176 = mul nsw i32 %175, 3
%177 = add nsw i32 55, %176
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 %178
store i8 %174, i8* %179
%180 = load i32, i32* %10
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 %181
%183 = load i8, i8* %182
%184 = sext i8 %183 to i32
%185 = icmp sge i32 %184, 32
br i1 %185, label %186, label %199
186: ; preds = %150
%187 = load i32, i32* %10
%188 = sext i32 %187 to i64
%189 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 %188
%190 = load i8, i8* %189
%191 = sext i8 %190 to i32
%192 = icmp slt i32 %191, 127
br i1 %192, label %193, label %199
193: ; preds = %186
%194 = load i32, i32* %10
%195 = sext i32 %194 to i64
%196 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 %195
%197 = load i8, i8* %196
%198 = sext i8 %197 to i32
br label %200
199: ; preds = %186, %150
br label %200
200: ; preds = %199, %193
%201 = phi i32 [ %198, %193 ], [ 46, %199 ]
%202 = trunc i32 %201 to i8
%203 = load i32, i32* %10
%204 = add nsw i32 66, %203
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 %205
store i8 %202, i8* %206
br label %207
207: ; preds = %200
%208 = load i32, i32* %10
%209 = add nsw i32 %208, 1
store i32 %209, i32* %10
br label %116
210: ; preds = %116
store i32 0, i32* %10
br label %211
211: ; preds = %227, %210
%212 = load i32, i32* %10
%213 = icmp slt i32 %212, 8
br i1 %213, label %214, label %230
214: ; preds = %211
%215 = load i32, i32* %12
%216 = load i32, i32* %10
%217 = mul nsw i32 %216, 4
%218 = lshr i32 %215, %217
%219 = and i32 %218, 15
%220 = zext i32 %219 to i64
%221 = getelementptr inbounds [17 x i8], [17 x i8]* %6, i64 0, i64 %220
%222 = load i8, i8* %221
%223 = load i32, i32* %10
%224 = sub nsw i32 78, %223
%225 = sext i32 %224 to i64
%226 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 %225
store i8 %222, i8* %226
br label %227
227: ; preds = %214
%228 = load i32, i32* %10
%229 = add nsw i32 %228, 1
store i32 %229, i32* %10
br label %211
230: ; preds = %211
%231 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%232 = load i32*, i32** %14
%233 = call i32 @fwrite(i8* %231, i32 1, i32 80, i32* %232)
%234 = load i32, i32* %12
%235 = add i32 %234, 4
store i32 %235, i32* %12
br label %100
236: ; preds = %110, %100
%237 = load i32, i32* @errno
ret i32 %237
}

LLVM IR (-O2):
@__const.main.hex = [17 x i8] c"0123456789ABCDEF\00"
@stdin = global i32* null
@stdout = global i32* null
@errno = global i32 0
@.str = [3 x i8] c"-?\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [7 x i8] c"--help\00"
@stderr = global i32 0
@.str.3 = [179 x i8] c"Usage: tobit [infile [outfile]]\0A\0A 'infile' and 'outfile' default to stdin and stdout.\0A\0A Use 'tobit - outfile' to use stdin for infile while\0A still specifying an output file.\0A\0A\00"
@.str.4 = [3 x i8] c"rb\00"
@.str.5 = [8 x i8] c"fopen()\00"
@.str.6 = [33 x i8] c"Couldn't open '%s' for reading.\0A\00"
@.str.7 = [2 x i8] c"w\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [16 x i8]
%4 = alloca [80 x i8]
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%8 = load i32*, i32** @stdin
%9 = load i32*, i32** @stdout
store i32 0, i32* @errno
%10 = icmp sgt i32 %0, 1
br i1 %10, label %11, label %52
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @strcmp(i8* dereferenceable(1) %13, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %22, label %16
16: ; preds = %11
%17 = tail call i32 @strcmp(i8* dereferenceable(1) %13, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = tail call i32 @strcmp(i8* dereferenceable(1) %13, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %19, %16, %11
%23 = load i32, i32* @stderr
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([179 x i8], [179 x i8]* @.str.3, i64 0, i64 0))
%25 = tail call i32 @exit(i32 1)
unreachable
26: ; preds = %19
%27 = load i8, i8* %13
%28 = icmp eq i8 %27, 45
br i1 %28, label %38, label %29
29: ; preds = %26
%30 = tail call i32* @fopen(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %38
32: ; preds = %29
%33 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%34 = load i32, i32* @stderr
%35 = load i8*, i8** %12
%36 = tail call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* %35)
%37 = tail call i32 @exit(i32 1)
unreachable
38: ; preds = %29, %26
%39 = phi i32* [ %30, %29 ], [ %8, %26 ]
%40 = icmp ugt i32 %0, 2
br i1 %40, label %41, label %52
41: ; preds = %38
%42 = getelementptr inbounds i8*, i8** %1, i64 2
%43 = load i8*, i8** %42
%44 = tail call i32* @fopen(i8* %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%45 = icmp eq i32* %44, null
br i1 %45, label %46, label %52
46: ; preds = %41
%47 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%48 = load i32, i32* @stderr
%49 = load i8*, i8** %42
%50 = tail call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* %49)
%51 = tail call i32 @exit(i32 1)
unreachable
52: ; preds = %2, %41, %38
%53 = phi i32* [ %39, %41 ], [ %39, %38 ], [ %8, %2 ]
%54 = phi i32* [ %44, %41 ], [ %9, %38 ], [ %9, %2 ]
%55 = call i32 @feof(i32* %53)
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %192
57: ; preds = %52
%58 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 52
%59 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 79
%60 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 78
%61 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 77
%62 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 76
%63 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 75
%64 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 74
%65 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 73
%66 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 72
%67 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 71
br label %68
68: ; preds = %57, %77
%69 = phi i32 [ 0, %57 ], [ %117, %77 ]
%70 = call i32 @fread(i8* %6, i32 1, i32 4, i32* %53)
%71 = icmp eq i32 %70, 0
br i1 %71, label %192, label %72
72: ; preds = %68
%73 = call i32 @memset(i8* %7, i8 signext 32, i32 79)
store i8 35, i8* %58
store i8 10, i8* %59
%74 = icmp sgt i32 %70, 0
br i1 %74, label %75, label %77
75: ; preds = %72
%76 = zext i32 %70 to i64
br label %120
77: ; preds = %120, %72
%78 = and i32 %69, 12
%79 = zext i32 %78 to i64
%80 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.main.hex, i64 0, i64 %79
%81 = load i8, i8* %80
store i8 %81, i8* %60
%82 = lshr i32 %69, 4
%83 = and i32 %82, 15
%84 = zext i32 %83 to i64
%85 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.main.hex, i64 0, i64 %84
%86 = load i8, i8* %85
store i8 %86, i8* %61
%87 = lshr i32 %69, 8
%88 = and i32 %87, 15
%89 = zext i32 %88 to i64
%90 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.main.hex, i64 0, i64 %89
%91 = load i8, i8* %90
store i8 %91, i8* %62
%92 = lshr i32 %69, 12
%93 = and i32 %92, 15
%94 = zext i32 %93 to i64
%95 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.main.hex, i64 0, i64 %94
%96 = load i8, i8* %95
store i8 %96, i8* %63
%97 = lshr i32 %69, 16
%98 = and i32 %97, 15
%99 = zext i32 %98 to i64
%100 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.main.hex, i64 0, i64 %99
%101 = load i8, i8* %100
store i8 %101, i8* %64
%102 = lshr i32 %69, 20
%103 = and i32 %102, 15
%104 = zext i32 %103 to i64
%105 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.main.hex, i64 0, i64 %104
%106 = load i8, i8* %105
store i8 %106, i8* %65
%107 = lshr i32 %69, 24
%108 = and i32 %107, 15
%109 = zext i32 %108 to i64
%110 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.main.hex, i64 0, i64 %109
%111 = load i8, i8* %110
store i8 %111, i8* %66
%112 = lshr i32 %69, 28
%113 = zext i32 %112 to i64
%114 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.main.hex, i64 0, i64 %113
%115 = load i8, i8* %114
store i8 %115, i8* %67
%116 = call i32 @fwrite(i8* %7, i32 1, i32 80, i32* %54)
%117 = add i32 %69, 4
%118 = call i32 @feof(i32* %53)
%119 = icmp eq i32 %118, 0
br i1 %119, label %68, label %192
120: ; preds = %75, %120
%121 = phi i64 [ 0, %75 ], [ %190, %120 ]
%122 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 %121
%123 = load i8, i8* %122
%124 = mul nuw nsw i64 %121, 12
%125 = or i64 %124, 2
%126 = lshr i8 %123, 7
%127 = or i8 %126, 48
%128 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %125
store i8 %127, i8* %128
%129 = lshr i8 %123, 6
%130 = and i8 %129, 1
%131 = or i8 %130, 48
%132 = or i64 %124, 3
%133 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %132
store i8 %131, i8* %133
%134 = lshr i8 %123, 5
%135 = and i8 %134, 1
%136 = or i8 %135, 48
%137 = add nuw i64 %124, 4
%138 = and i64 %137, 4294967292
%139 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %138
store i8 %136, i8* %139
%140 = lshr i8 %123, 4
%141 = and i8 %140, 1
%142 = or i8 %141, 48
%143 = add nuw i64 %124, 5
%144 = and i64 %143, 4294967293
%145 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %144
store i8 %142, i8* %145
%146 = lshr i8 %123, 3
%147 = and i8 %146, 1
%148 = or i8 %147, 48
%149 = add nuw i64 %124, 7
%150 = and i64 %149, 4294967295
%151 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %150
store i8 %148, i8* %151
%152 = lshr i8 %123, 2
%153 = and i8 %152, 1
%154 = or i8 %153, 48
%155 = add nuw i64 %124, 8
%156 = and i64 %155, 4294967292
%157 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %156
store i8 %154, i8* %157
%158 = lshr i8 %123, 1
%159 = and i8 %158, 1
%160 = or i8 %159, 48
%161 = add nuw i64 %124, 9
%162 = and i64 %161, 4294967293
%163 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %162
store i8 %160, i8* %163
%164 = and i8 %123, 1
%165 = or i8 %164, 48
%166 = add nuw i64 %124, 10
%167 = and i64 %166, 4294967294
%168 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %167
store i8 %165, i8* %168
%169 = lshr i8 %123, 4
%170 = zext i8 %169 to i64
%171 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.main.hex, i64 0, i64 %170
%172 = load i8, i8* %171
%173 = trunc i64 %121 to i32
%174 = mul nsw i32 %173, 3
%175 = add nuw nsw i32 %174, 54
%176 = zext i32 %175 to i64
%177 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %176
store i8 %172, i8* %177
%178 = and i8 %123, 15
%179 = zext i8 %178 to i64
%180 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.main.hex, i64 0, i64 %179
%181 = load i8, i8* %180
%182 = add nuw nsw i32 %174, 55
%183 = zext i32 %182 to i64
%184 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %183
store i8 %181, i8* %184
%185 = add i8 %123, -127
%186 = icmp ult i8 %185, -95
%187 = select i1 %186, i8 46, i8 %123
%188 = add nuw nsw i64 %121, 66
%189 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %188
store i8 %187, i8* %189
%190 = add nuw nsw i64 %121, 1
%191 = icmp eq i64 %190, %76
br i1 %191, label %77, label %120
192: ; preds = %77, %68, %52
%193 = load i32, i32* @errno
ret i32 %193
}