#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 EOF;
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ putc(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ *stdout;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *strrchr(char *, char);
int main(int ac, char *av[]) {
  int ai;
  int opt_rev = 0;
  char *ifile = 0;
  char *ofile = 0;
  char ofileb[256];
  FILE *in, *out;
  for (ai = 1; ai < ac; ai++) {
    if (strcmp(av[ai], "-r") == 0) {
      opt_rev = 1;
      continue;
    }
    if (ifile == 0)
      ifile = av[ai];
    else
      ofile = av[ai];
  }
  if (ifile == 0 || strcmp(ifile, "-") == 0) {
    in = stdin;
    ifile = "-";
  } else {
    in = fopen(ifile, "r");
    if (in == NULL) {
      fprintf(stderr, "-- b2x: cannot open infile: %s\n", ifile);
      return -1;
    }
  }
  if (ofile != NULL && strcmp(ofile, "-") == 0) {
    out = stdout;
  } else {
    if (ofile == 0) {
      if (strcmp(ifile, "-") == 0) {
        ofile = "-";
      } else {
        char *op;
        strcpy(ofileb, ifile);
        if ((op = strrchr(ofileb, '.')) == 0)
          op = ofileb + strlen(ofileb);
        if (opt_rev)
          strcpy(op, ".o");
        else
          strcpy(op, ".ox");
        ofile = ofileb;
      }
    }
    if (strcmp(ofile, "-") == 0) {
      out = stdout;
    } else {
      out = fopen(ofile, "w");
      if (out == NULL) {
        fprintf(stderr, "-- b2x: cannot open outfile: %s\n", ofile);
        return -1;
      }
    }
  }
  fprintf(stderr, "-- b2x: '%s' -> '%s'\n", ifile, ofile);
  if (opt_rev) {
    char buf[3];
    int ch1, ch2, xch;
    buf[2] = 0;
    for (;;) {
      ch1 = getc(in);
      if (ch1 == '\n')
        ch1 = getc(in);
      ch2 = getc(in);
      if (ch1 == EOF || ch2 == EOF)
        break;
      buf[0] = ch1;
      buf[1] = ch2;
      xch = -1;
      sscanf(buf, "%X", &xch);
      if (xch < 0 || 0x100 <= xch) {
        fprintf(stderr, "-- b2x: broken input: %02X %02X %s\n", ch1, ch2,
                ifile);
        break;
      }
      putc(xch, out);
    }
  } else {
    int ch;
    int cols;
    cols = 0;
    while ((ch = getc(in)) != EOF) {
      fprintf(out, "%02X", ch);
      cols += 2;
      if (72 < cols) {
        fprintf(out, "\n");
        cols = 0;
      }
    }
    fprintf(out, "\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1244 <main+0xb4>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe1a(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1201 <main+0x71>
movl   $0x1,-0x18(%rbp)
jmp    1236 <main+0xa6>
cmpq   $0x0,-0x20(%rbp)
jne    1221 <main+0x91>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
jmp    1231 <main+0xa1>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
jmp    1236 <main+0xa6>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c7 <main+0x37>
cmpq   $0x0,-0x20(%rbp)
je     1269 <main+0xd9>
mov    -0x20(%rbp),%rdi
lea    0xda9(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    128a <main+0xfa>
mov    0x2d78(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x138(%rbp)
lea    0xd82(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    12dc <main+0x14c>
mov    -0x20(%rbp),%rdi
lea    0xd6c(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x138(%rbp)
cmpq   $0x0,-0x138(%rbp)
jne    12d7 <main+0x147>
mov    0x2d1a(%rip),%rax
movslq (%rax),%rdi
mov    -0x20(%rbp),%rdx
lea    0xd41(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1666 <main+0x4d6>
jmp    12dc <main+0x14c>
cmpq   $0x0,-0x28(%rbp)
je     1317 <main+0x187>
mov    -0x28(%rbp),%rdi
lea    0xd11(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1317 <main+0x187>
mov    0x2cc0(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x140(%rbp)
jmp    147a <main+0x2ea>
cmpq   $0x0,-0x28(%rbp)
jne    13f3 <main+0x263>
mov    -0x20(%rbp),%rdi
lea    0xcd6(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    134c <main+0x1bc>
lea    0xcc0(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    13ee <main+0x25e>
lea    -0x130(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x130(%rbp),%rdi
mov    $0x2e,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x148(%rbp)
cmp    $0x0,%rax
jne    13ae <main+0x21e>
lea    -0x130(%rbp),%rax
mov    %rax,-0x168(%rbp)
lea    -0x130(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x168(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x148(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     13d0 <main+0x240>
mov    -0x148(%rbp),%rdi
lea    0xc5f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    13e3 <main+0x253>
mov    -0x148(%rbp),%rdi
lea    0xc4a(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x130(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    13f3 <main+0x263>
mov    -0x28(%rbp),%rdi
lea    0xc05(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1423 <main+0x293>
mov    0x2bb4(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x140(%rbp)
jmp    1475 <main+0x2e5>
mov    -0x28(%rbp),%rdi
lea    0xbfe(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x140(%rbp)
cmpq   $0x0,-0x140(%rbp)
jne    1470 <main+0x2e0>
mov    0x2b81(%rip),%rax
movslq (%rax),%rdi
mov    -0x28(%rbp),%rdx
lea    0xbd1(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1666 <main+0x4d6>
jmp    1475 <main+0x2e5>
jmp    147a <main+0x2ea>
mov    0x2b4f(%rip),%rax
movslq (%rax),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0xbbc(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
cmpl   $0x0,-0x18(%rbp)
je     15c0 <main+0x430>
movb   $0x0,-0x149(%rbp)
mov    -0x138(%rbp),%rdi
call   10b0 <getc@plt>
mov    %eax,-0x150(%rbp)
cmpl   $0xa,-0x150(%rbp)
jne    14dc <main+0x34c>
mov    -0x138(%rbp),%rdi
call   10b0 <getc@plt>
mov    %eax,-0x150(%rbp)
mov    -0x138(%rbp),%rdi
call   10b0 <getc@plt>
mov    %eax,-0x154(%rbp)
mov    -0x150(%rbp),%eax
mov    0x2ae5(%rip),%rcx
cmp    (%rcx),%eax
je     1518 <main+0x388>
mov    -0x154(%rbp),%eax
mov    0x2ad0(%rip),%rcx
cmp    (%rcx),%eax
jne    151d <main+0x38d>
jmp    15bb <main+0x42b>
mov    -0x150(%rbp),%eax
mov    %al,-0x14b(%rbp)
mov    -0x154(%rbp),%eax
mov    %al,-0x14a(%rbp)
movl   $0xffffffff,-0x158(%rbp)
ff ff ff
lea    -0x14b(%rbp),%rdi
lea    0xb18(%rip),%rsi
lea    -0x158(%rbp),%rdx
call   1090 <sscanf@plt>
cmpl   $0x0,-0x158(%rbp)
jl     1577 <main+0x3e7>
mov    $0x100,%eax
cmp    -0x158(%rbp),%eax
jg     15a4 <main+0x414>
mov    0x2a52(%rip),%rax
movslq (%rax),%rdi
mov    -0x150(%rbp),%edx
mov    -0x154(%rbp),%ecx
mov    -0x20(%rbp),%r8
lea    0xad0(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    15bb <main+0x42b>
mov    -0x158(%rbp),%edi
mov    -0x140(%rbp),%rsi
call   1070 <putc@plt>
jmp    14ab <main+0x31b>
jmp    165f <main+0x4cf>
movl   $0x0,-0x160(%rbp)
mov    -0x138(%rbp),%rdi
call   10b0 <getc@plt>
mov    %eax,-0x15c(%rbp)
mov    0x29fd(%rip),%rcx
cmp    (%rcx),%eax
je     164a <main+0x4ba>
mov    -0x140(%rbp),%rdi
mov    -0x15c(%rbp),%edx
lea    0xa8d(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x160(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x160(%rbp)
mov    $0x48,%eax
cmp    -0x160(%rbp),%eax
jge    1645 <main+0x4b5>
mov    -0x140(%rbp),%rdi
lea    0xa2f(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x160(%rbp)
jmp    15ca <main+0x43a>
mov    -0x140(%rbp),%rdi
lea    0xa0b(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
cmp    $0x2,%edi
jl     1215 <main+0x75>
mov    %rsi,%rbp
mov    %edi,%r12d
xor    %r15d,%r15d
mov    $0x1,%ebx
lea    0xe35(%rip),%r14
xor    %r13d,%r13d
movl   $0x0,0x8(%rsp)
jmp    11f9 <main+0x59>
nopl   0x0(%rax,%rax,1)
test   %r13,%r13
mov    0x0(%rbp,%rbx,8),%rax
cmove  %rax,%r13
cmovne %rax,%r15
add    $0x1,%rbx
cmp    %rbx,%r12
je     121f <main+0x7f>
mov    0x0(%rbp,%rbx,8),%rdi
mov    %r14,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    11e0 <main+0x40>
movl   $0x1,0x8(%rsp)
jmp    11f0 <main+0x50>
xor    %r15d,%r15d
xor    %ebx,%ebx
jmp    12da <main+0x13a>
test   %r13,%r13
je     12d6 <main+0x136>
lea    0xdd4(%rip),%rsi
mov    %r13,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
mov    0x8(%rsp),%ebx
je     12da <main+0x13a>
lea    0xdb6(%rip),%rsi
mov    %r13,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
je     1495 <main+0x2f5>
mov    %rax,%r14
test   %r15,%r15
jne    12f4 <main+0x154>
lea    0xd94(%rip),%r15
mov    %r13,%rdi
mov    %r15,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1308 <main+0x168>
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
mov    %r15,%rdi
mov    $0x2e,%esi
call   1050 <strrchr@plt>
test   %rax,%rax
jne    12b8 <main+0x118>
lea    0x10(%rsp),%rdi
call   1040 <strlen@plt>
cltq
add    %rsp,%rax
add    $0x10,%rax
test   %ebx,%ebx
lea    0xd67(%rip),%rcx
lea    0xd5d(%rip),%rsi
cmove  %rcx,%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
jmp    1308 <main+0x168>
mov    0x8(%rsp),%ebx
mov    0x2d07(%rip),%rax
mov    (%rax),%r14
lea    0xd18(%rip),%r13
test   %r15,%r15
je     1268 <main+0xc8>
lea    0xd08(%rip),%rsi
mov    %r15,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1339 <main+0x199>
lea    0xcf4(%rip),%rsi
mov    %r15,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1339 <main+0x199>
lea    0xd09(%rip),%rsi
mov    %r15,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
je     143d <main+0x29d>
mov    %rax,%r12
jmp    1343 <main+0x1a3>
mov    0x2c88(%rip),%rax
mov    (%rax),%r12
mov    0x2c86(%rip),%rax
movslq (%rax),%rdi
lea    0xcfb(%rip),%rsi
mov    %r13,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
test   %ebx,%ebx
je     13f6 <main+0x256>
movb   $0x0,0x7(%rsp)
lea    0xc(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
call   10c0 <getc@plt>
mov    %eax,%r15d
cmp    $0xa,%eax
jne    139b <main+0x1fb>
mov    %r14,%rdi
call   10c0 <getc@plt>
mov    %eax,%r15d
mov    %r14,%rdi
call   10c0 <getc@plt>
mov    %eax,%ebx
mov    0x2c34(%rip),%rax
mov    (%rax),%eax
cmp    %eax,%r15d
je     1439 <main+0x299>
cmp    %eax,%ebx
je     1439 <main+0x299>
mov    %r15b,0x5(%rsp)
mov    %bl,0x6(%rsp)
movl   $0xffffffff,0xc(%rsp)
ff
lea    0x5(%rsp),%rdi
lea    0xc8d(%rip),%rsi
mov    %rbp,%rdx
call   10a0 <sscanf@plt>
mov    0xc(%rsp),%edi
cmp    $0x100,%edi
jae    1419 <main+0x279>
mov    %r12,%rsi
call   1080 <putc@plt>
jmp    1380 <main+0x1e0>
mov    %r14,%rdi
call   10c0 <getc@plt>
mov    0x2bdb(%rip),%r15
cmp    (%r15),%eax
jne    1453 <main+0x2b3>
mov    $0xa,%edi
mov    %r12,%rsi
call   1060 <fputc@plt>
jmp    1439 <main+0x299>
mov    0x2bb0(%rip),%rax
movslq (%rax),%rdi
lea    0xc3e(%rip),%rsi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %r13,%r8
xor    %eax,%eax
call   1090 <fprintf@plt>
xor    %eax,%eax
jmp    14b5 <main+0x315>
mov    0x2b8c(%rip),%rax
movslq (%rax),%rdi
lea    0xbe0(%rip),%rsi
mov    %r15,%rdx
jmp    14a9 <main+0x309>
lea    0xc32(%rip),%rbx
xor    %ebp,%ebp
jmp    147c <main+0x2dc>
xchg   %ax,%ax
mov    $0xa,%edi
mov    %r12,%rsi
call   1060 <fputc@plt>
xor    %ebp,%ebp
mov    %r14,%rdi
call   10c0 <getc@plt>
cmp    (%r15),%eax
je     140a <main+0x26a>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1090 <fprintf@plt>
cmp    $0x47,%ebp
jge    1460 <main+0x2c0>
add    $0x2,%ebp
jmp    146f <main+0x2cf>
mov    0x2b34(%rip),%rax
movslq (%rax),%rdi
lea    0xb5f(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-r\00"
@.str.1 = [2 x i8] c"-\00"
@stdin = global i32* null
@.str.2 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.3 = [32 x i8] c"-- b2x: cannot open infile: %s\0A\00"
@stdout = global i32* null
@.str.4 = [3 x i8] c".o\00"
@.str.5 = [4 x i8] c".ox\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [33 x i8] c"-- b2x: cannot open outfile: %s\0A\00"
@.str.8 = [22 x i8] c"-- b2x: '%s' -> '%s'\0A\00"
@EOF = global i32 0
@.str.9 = [3 x i8] c"%X\00"
@.str.10 = [36 x i8] c"-- b2x: broken input: %02X %02X %s\0A\00"
@.str.11 = [5 x i8] c"%02X\00"
@.str.12 = [2 x i8] c"\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 i8*
%9 = alloca i8*
%10 = alloca [256 x i8]
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i8*
%14 = alloca [3 x i8]
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i8* null, i8** %8
store i8* null, i8** %9
store i32 1, i32* %6
br label %20
20: ; preds = %49, %2
%21 = load i32, i32* %6
%22 = load i32, i32* %4
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %52
24: ; preds = %20
%25 = load i8**, i8*** %5
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
%29 = load i8*, i8** %28
%30 = call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %24
store i32 1, i32* %7
br label %49
33: ; preds = %24
%34 = load i8*, i8** %8
%35 = icmp eq i8* %34, null
br i1 %35, label %36, label %42
36: ; preds = %33
%37 = load i8**, i8*** %5
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %37, i64 %39
%41 = load i8*, i8** %40
store i8* %41, i8** %8
br label %48
42: ; preds = %33
%43 = load i8**, i8*** %5
%44 = load i32, i32* %6
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8*, i8** %43, i64 %45
%47 = load i8*, i8** %46
store i8* %47, i8** %9
br label %48
48: ; preds = %42, %36
br label %49
49: ; preds = %48, %32
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
br label %20
52: ; preds = %20
%53 = load i8*, i8** %8
%54 = icmp eq i8* %53, null
br i1 %54, label %59, label %55
55: ; preds = %52
%56 = load i8*, i8** %8
%57 = call i64 @strcmp(i8* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %55, %52
%60 = load i32*, i32** @stdin
store i32* %60, i32** %11
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %8
br label %73
61: ; preds = %55
%62 = load i8*, i8** %8
%63 = call i32* @fopen(i8* %62, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %63, i32** %11
%64 = load i32*, i32** %11
%65 = icmp eq i32* %64, null
br i1 %65, label %66, label %72
66: ; preds = %61
%67 = load i32, i32* @stderr
%68 = sext i32 %67 to i64
%69 = inttoptr i64 %68 to i32*
%70 = load i8*, i8** %8
%71 = call i32 (i32*, i8*, ...) @fprintf(i32* %69, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %70)
store i32 -1, i32* %3
br label %213
72: ; preds = %61
br label %73
73: ; preds = %72, %59
%74 = load i8*, i8** %9
%75 = icmp ne i8* %74, null
br i1 %75, label %76, label %82
76: ; preds = %73
%77 = load i8*, i8** %9
%78 = call i64 @strcmp(i8* %77, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%79 = icmp eq i64 %78, 0
br i1 %79, label %80, label %82
80: ; preds = %76
%81 = load i32*, i32** @stdout
store i32* %81, i32** %12
br label %134
82: ; preds = %76, %73
%83 = load i8*, i8** %9
%84 = icmp eq i8* %83, null
br i1 %84, label %85, label %115
85: ; preds = %82
%86 = load i8*, i8** %8
%87 = call i64 @strcmp(i8* %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%88 = icmp eq i64 %87, 0
br i1 %88, label %89, label %90
89: ; preds = %85
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %9
br label %114
90: ; preds = %85
%91 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%92 = load i8*, i8** %8
%93 = call i32 @strcpy(i8* %91, i8* %92)
%94 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%95 = call i8* @strrchr(i8* %94, i8 signext 46)
store i8* %95, i8** %13
%96 = icmp eq i8* %95, null
br i1 %96, label %97, label %103
97: ; preds = %90
%98 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%99 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%100 = call i32 @strlen(i8* %99)
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i8, i8* %98, i64 %101
store i8* %102, i8** %13
br label %103
103: ; preds = %97, %90
%104 = load i32, i32* %7
%105 = icmp ne i32 %104, 0
br i1 %105, label %106, label %109
106: ; preds = %103
%107 = load i8*, i8** %13
%108 = call i32 @strcpy(i8* %107, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %112
109: ; preds = %103
%110 = load i8*, i8** %13
%111 = call i32 @strcpy(i8* %110, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %112
112: ; preds = %109, %106
%113 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
store i8* %113, i8** %9
br label %114
114: ; preds = %112, %89
br label %115
115: ; preds = %114, %82
%116 = load i8*, i8** %9
%117 = call i64 @strcmp(i8* %116, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%118 = icmp eq i64 %117, 0
br i1 %118, label %119, label %121
119: ; preds = %115
%120 = load i32*, i32** @stdout
store i32* %120, i32** %12
br label %133
121: ; preds = %115
%122 = load i8*, i8** %9
%123 = call i32* @fopen(i8* %122, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %123, i32** %12
%124 = load i32*, i32** %12
%125 = icmp eq i32* %124, null
br i1 %125, label %126, label %132
126: ; preds = %121
%127 = load i32, i32* @stderr
%128 = sext i32 %127 to i64
%129 = inttoptr i64 %128 to i32*
%130 = load i8*, i8** %9
%131 = call i32 (i32*, i8*, ...) @fprintf(i32* %129, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i8* %130)
store i32 -1, i32* %3
br label %213
132: ; preds = %121
br label %133
133: ; preds = %132, %119
br label %134
134: ; preds = %133, %80
%135 = load i32, i32* @stderr
%136 = sext i32 %135 to i64
%137 = inttoptr i64 %136 to i32*
%138 = load i8*, i8** %8
%139 = load i8*, i8** %9
%140 = call i32 (i32*, i8*, ...) @fprintf(i32* %137, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i8* %138, i8* %139)
%141 = load i32, i32* %7
%142 = icmp ne i32 %141, 0
br i1 %142, label %143, label %191
143: ; preds = %134
%144 = getelementptr inbounds [3 x i8], [3 x i8]* %14, i64 0, i64 2
store i8 0, i8* %144
br label %145
145: ; preds = %186, %143
%146 = load i32*, i32** %11
%147 = call i32 @getc(i32* %146)
store i32 %147, i32* %15
%148 = load i32, i32* %15
%149 = icmp eq i32 %148, 10
br i1 %149, label %150, label %153
150: ; preds = %145
%151 = load i32*, i32** %11
%152 = call i32 @getc(i32* %151)
store i32 %152, i32* %15
br label %153
153: ; preds = %150, %145
%154 = load i32*, i32** %11
%155 = call i32 @getc(i32* %154)
store i32 %155, i32* %16
%156 = load i32, i32* %15
%157 = load i32, i32* @EOF
%158 = icmp eq i32 %156, %157
br i1 %158, label %163, label %159
159: ; preds = %153
%160 = load i32, i32* %16
%161 = load i32, i32* @EOF
%162 = icmp eq i32 %160, %161
br i1 %162, label %163, label %164
163: ; preds = %159, %153
br label %190
164: ; preds = %159
%165 = load i32, i32* %15
%166 = trunc i32 %165 to i8
%167 = getelementptr inbounds [3 x i8], [3 x i8]* %14, i64 0, i64 0
store i8 %166, i8* %167
%168 = load i32, i32* %16
%169 = trunc i32 %168 to i8
%170 = getelementptr inbounds [3 x i8], [3 x i8]* %14, i64 0, i64 1
store i8 %169, i8* %170
store i32 -1, i32* %17
%171 = getelementptr inbounds [3 x i8], [3 x i8]* %14, i64 0, i64 0
%172 = call i32 @sscanf(i8* %171, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %17)
%173 = load i32, i32* %17
%174 = icmp slt i32 %173, 0
br i1 %174, label %178, label %175
175: ; preds = %164
%176 = load i32, i32* %17
%177 = icmp sle i32 256, %176
br i1 %177, label %178, label %186
178: ; preds = %175, %164
%179 = load i32, i32* @stderr
%180 = sext i32 %179 to i64
%181 = inttoptr i64 %180 to i32*
%182 = load i32, i32* %15
%183 = load i32, i32* %16
%184 = load i8*, i8** %8
%185 = call i32 (i32*, i8*, ...) @fprintf(i32* %181, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0), i32 %182, i32 %183, i8* %184)
br label %190
186: ; preds = %175
%187 = load i32, i32* %17
%188 = load i32*, i32** %12
%189 = call i32 @putc(i32 %187, i32* %188)
br label %145
190: ; preds = %178, %163
br label %212
191: ; preds = %134
store i32 0, i32* %19
br label %192
192: ; preds = %208, %191
%193 = load i32*, i32** %11
%194 = call i32 @getc(i32* %193)
store i32 %194, i32* %18
%195 = load i32, i32* @EOF
%196 = icmp ne i32 %194, %195
br i1 %196, label %197, label %209
197: ; preds = %192
%198 = load i32*, i32** %12
%199 = load i32, i32* %18
%200 = call i32 (i32*, i8*, ...) @fprintf(i32* %198, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 %199)
%201 = load i32, i32* %19
%202 = add nsw i32 %201, 2
store i32 %202, i32* %19
%203 = load i32, i32* %19
%204 = icmp slt i32 72, %203
br i1 %204, label %205, label %208
205: ; preds = %197
%206 = load i32*, i32** %12
%207 = call i32 (i32*, i8*, ...) @fprintf(i32* %206, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
store i32 0, i32* %19
br label %208
208: ; preds = %205, %197
br label %192
209: ; preds = %192
%210 = load i32*, i32** %12
%211 = call i32 (i32*, i8*, ...) @fprintf(i32* %210, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
br label %212
212: ; preds = %209, %190
store i32 0, i32* %3
br label %213
213: ; preds = %212, %126, %66
%214 = load i32, i32* %3
ret i32 %214
}

LLVM IR (-O2):
@.str = [3 x i8] c"-r\00"
@.str.1 = [2 x i8] c"-\00"
@stdin = global i32* null
@.str.2 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.3 = [32 x i8] c"-- b2x: cannot open infile: %s\0A\00"
@stdout = global i32* null
@.str.4 = [3 x i8] c".o\00"
@.str.5 = [4 x i8] c".ox\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [33 x i8] c"-- b2x: cannot open outfile: %s\0A\00"
@.str.8 = [22 x i8] c"-- b2x: '%s' -> '%s'\0A\00"
@EOF = global i32 0
@.str.9 = [3 x i8] c"%X\00"
@.str.10 = [36 x i8] c"-- b2x: broken input: %02X %02X %s\0A\00"
@.str.11 = [5 x i8] c"%02X\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = alloca [3 x i8]
%5 = alloca i32
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %35
8: ; preds = %2
%9 = zext i32 %0 to i64
br label %10
10: ; preds = %8, %24
%11 = phi i64 [ 1, %8 ], [ %28, %24 ]
%12 = phi i8* [ null, %8 ], [ %27, %24 ]
%13 = phi i8* [ null, %8 ], [ %26, %24 ]
%14 = phi i32 [ 0, %8 ], [ %25, %24 ]
%15 = getelementptr inbounds i8*, i8** %1, i64 %11
%16 = load i8*, i8** %15
%17 = tail call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %24, label %19
19: ; preds = %10
%20 = icmp eq i8* %13, null
%21 = load i8*, i8** %15
%22 = select i1 %20, i8* %21, i8* %13
%23 = select i1 %20, i8* %12, i8* %21
br label %24
24: ; preds = %19, %10
%25 = phi i32 [ 1, %10 ], [ %14, %19 ]
%26 = phi i8* [ %13, %10 ], [ %22, %19 ]
%27 = phi i8* [ %12, %10 ], [ %23, %19 ]
%28 = add nuw nsw i64 %11, 1
%29 = icmp eq i64 %28, %9
br i1 %29, label %30, label %10
30: ; preds = %24
%31 = icmp eq i8* %26, null
br i1 %31, label %35, label %32
32: ; preds = %30
%33 = tail call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %2, %32, %30
%36 = phi i8* [ %27, %32 ], [ %27, %30 ], [ null, %2 ]
%37 = phi i32 [ %25, %32 ], [ %25, %30 ], [ 0, %2 ]
%38 = load i32*, i32** @stdin
br label %47
39: ; preds = %32
%40 = tail call i32* @fopen(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%41 = icmp eq i32* %40, null
br i1 %41, label %42, label %47
42: ; preds = %39
%43 = load i32, i32* @stderr
%44 = sext i32 %43 to i64
%45 = inttoptr i64 %44 to i32*
%46 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %45, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %26)
br label %146
47: ; preds = %39, %35
%48 = phi i8* [ %36, %35 ], [ %27, %39 ]
%49 = phi i32 [ %37, %35 ], [ %25, %39 ]
%50 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %35 ], [ %26, %39 ]
%51 = phi i32* [ %38, %35 ], [ %40, %39 ]
%52 = icmp eq i8* %48, null
br i1 %52, label %58, label %53
53: ; preds = %47
%54 = tail call i64 @strcmp(i8* %48, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %74
56: ; preds = %53
%57 = load i32*, i32** @stdout
br label %88
58: ; preds = %47
%59 = tail call i64 @strcmp(i8* %50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%60 = icmp eq i64 %59, 0
br i1 %60, label %74, label %61
61: ; preds = %58
%62 = call i32 @strcpy(i8* %6, i8* %50)
%63 = call i8* @strrchr(i8* %6, i8 signext 46)
%64 = icmp eq i8* %63, null
br i1 %64, label %65, label %69
65: ; preds = %61
%66 = call i32 @strlen(i8* %6)
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %67
br label %69
69: ; preds = %65, %61
%70 = phi i8* [ %68, %65 ], [ %63, %61 ]
%71 = icmp eq i32 %49, 0
%72 = select i1 %71, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0)
%73 = call i32 @strcpy(i8* %70, i8* %72)
br label %74
74: ; preds = %69, %53, %58
%75 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %58 ], [ %48, %53 ], [ %6, %69 ]
%76 = call i64 @strcmp(i8* %75, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %74
%79 = load i32*, i32** @stdout
br label %88
80: ; preds = %74
%81 = call i32* @fopen(i8* %75, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%82 = icmp eq i32* %81, null
br i1 %82, label %83, label %88
83: ; preds = %80
%84 = load i32, i32* @stderr
%85 = sext i32 %84 to i64
%86 = inttoptr i64 %85 to i32*
%87 = call i32 (i32*, i8*, ...) @fprintf(i32* %86, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i8* %75)
br label %146
88: ; preds = %78, %80, %56
%89 = phi i8* [ %48, %56 ], [ %75, %78 ], [ %75, %80 ]
%90 = phi i32* [ %57, %56 ], [ %79, %78 ], [ %81, %80 ]
%91 = load i32, i32* @stderr
%92 = sext i32 %91 to i64
%93 = inttoptr i64 %92 to i32*
%94 = call i32 (i32*, i8*, ...) @fprintf(i32* %93, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i8* %50, i8* %89)
%95 = icmp eq i32 %49, 0
br i1 %95, label %96, label %100
96: ; preds = %88
%97 = call i32 @getc(i32* %51)
%98 = load i32, i32* @EOF
%99 = icmp eq i32 %97, %98
br i1 %99, label %144, label %131
100: ; preds = %88
%101 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%102 = bitcast i32* %5 to i8*
%103 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 2
store i8 0, i8* %103
%104 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 1
br label %105
105: ; preds = %128, %100
%106 = call i32 @getc(i32* %51)
%107 = icmp eq i32 %106, 10
br i1 %107, label %108, label %110
108: ; preds = %105
%109 = call i32 @getc(i32* %51)
br label %110
110: ; preds = %108, %105
%111 = phi i32 [ %109, %108 ], [ %106, %105 ]
%112 = call i32 @getc(i32* %51)
%113 = load i32, i32* @EOF
%114 = icmp eq i32 %111, %113
%115 = icmp eq i32 %112, %113
%116 = or i1 %114, %115
br i1 %116, label %130, label %117
117: ; preds = %110
%118 = trunc i32 %111 to i8
store i8 %118, i8* %101
%119 = trunc i32 %112 to i8
store i8 %119, i8* %104
store i32 -1, i32* %5
%120 = call i32 @sscanf(i8* %101, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %5)
%121 = load i32, i32* %5
%122 = icmp ugt i32 %121, 255
br i1 %122, label %123, label %128
123: ; preds = %117
%124 = load i32, i32* @stderr
%125 = sext i32 %124 to i64
%126 = inttoptr i64 %125 to i32*
%127 = call i32 (i32*, i8*, ...) @fprintf(i32* %126, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0), i32 %111, i32 %112, i8* %50)
br label %130
128: ; preds = %117
%129 = call i32 @putc(i32 %121, i32* %90)
br label %105
130: ; preds = %110, %123
br label %146
131: ; preds = %96, %139
%132 = phi i32 [ %141, %139 ], [ %97, %96 ]
%133 = phi i32 [ %140, %139 ], [ 0, %96 ]
%134 = call i32 (i32*, i8*, ...) @fprintf(i32* %90, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 %132)
%135 = add nsw i32 %133, 2
%136 = icmp sgt i32 %133, 70
br i1 %136, label %137, label %139
137: ; preds = %131
%138 = call i32 @fputc(i32 10, i32* %90)
br label %139
139: ; preds = %137, %131
%140 = phi i32 [ 0, %137 ], [ %135, %131 ]
%141 = call i32 @getc(i32* %51)
%142 = load i32, i32* @EOF
%143 = icmp eq i32 %141, %142
br i1 %143, label %144, label %131
144: ; preds = %139, %96
%145 = call i32 @fputc(i32 10, i32* %90)
br label %146
146: ; preds = %130, %144, %83, %42
%147 = phi i32 [ -1, %83 ], [ -1, %42 ], [ 0, %144 ], [ 0, %130 ]
ret i32 %147
}