#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(unsigned char *);
unsigned char *malloc(int);
int /*<<< orphan*/ memset(unsigned char *, int, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int strlen(char *);
int usage();
int main(int argc, char **argv) {
  FILE *f;
  FILE *fo;
  unsigned char *buffer;
  char *filename, *filename2;
  int i, size, offset;
  int argfail = 0;
  int w = 0;
  int fill = 0;
  int argidx = 1;
  if (argc <= argidx) {
    return usage();
  }
  if (argv[argidx][0] == '-') {
    for (i = strlen(argv[argidx]) - 1; i > 0; i--) {
      if (argv[argidx][i] == 'w')
        w = 1;
      else if (argv[argidx][i] == 'f')
        fill = 1;
    }
    argidx++;
  }
  if (argc <= argidx) {
    return usage();
  }
  filename = argv[argidx++];
  if (argc <= argidx) {
    return usage();
  }
  filename2 = argv[argidx++];
  if (argc <= argidx) {
    return usage();
  }
  sscanf(argv[argidx++], "%d", &size);
  if (argc > argidx) {
    sscanf(argv[argidx++], "%d", &offset);
  } else {
    offset = 0;
  }
  buffer = malloc(size);
  memset(buffer, 0xAA, size);
  f = fopen(filename, "rb");
  if (!f) {
    printf("Can't open file %s.\n", filename);
    free(buffer);
    return 1;
  }
  fo = fopen(filename2, "w");
  if (!fo) {
    printf("Can't open file %s.\n", filename2);
    free(buffer);
    return 1;
  }
  int read = fread((char *)buffer, 1, size, f);
  fclose(f);
  if (!fill)
    size = read;
  if (w) {
    for (i = 0; i < size; i++) {
      if ((i % 4) == 0)
        fprintf(fo, "\n@%08X ", (i + offset) >> 2);
      fprintf(fo, "%02X", buffer[i]);
    }
  } else {
    for (i = 0; i < size; i++) {
      if ((i % 16) == 0)
        fprintf(fo, "\n@%08X ", i + offset);
      fprintf(fo, "%02X ", buffer[i]);
    }
  }
  fprintf(fo, "\n");
  free(buffer);
  fclose(fo);
  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   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movl   $0x1,-0x54(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x54(%rbp),%eax
jg     11fd <main+0x4d>
mov    $0x0,%al
call   10c0 <usage@plt>
mov    %eax,-0x4(%rbp)
jmp    157b <main+0x3cb>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    12a4 <main+0xf4>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jle    129b <main+0xeb>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x77,%eax
jne    125f <main+0xaf>
movl   $0x1,-0x4c(%rbp)
jmp    1288 <main+0xd8>
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x66,%eax
jne    1283 <main+0xd3>
movl   $0x1,-0x50(%rbp)
jmp    1288 <main+0xd8>
jmp    128d <main+0xdd>
mov    -0x3c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3c(%rbp)
jmp    122c <main+0x7c>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x54(%rbp),%eax
jg     12bf <main+0x10f>
mov    $0x0,%al
call   10c0 <usage@plt>
mov    %eax,-0x4(%rbp)
jmp    157b <main+0x3cb>
mov    -0x10(%rbp),%rax
mov    -0x54(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x54(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x54(%rbp),%eax
jg     12f4 <main+0x144>
mov    $0x0,%al
call   10c0 <usage@plt>
mov    %eax,-0x4(%rbp)
jmp    157b <main+0x3cb>
mov    -0x10(%rbp),%rax
mov    -0x54(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x54(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x54(%rbp),%eax
jg     1329 <main+0x179>
mov    $0x0,%al
call   10c0 <usage@plt>
mov    %eax,-0x4(%rbp)
jmp    157b <main+0x3cb>
mov    -0x10(%rbp),%rax
mov    -0x54(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x54(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xcba(%rip),%rsi
lea    -0x40(%rbp),%rdx
call   10b0 <sscanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x54(%rbp),%eax
jle    1386 <main+0x1d6>
mov    -0x10(%rbp),%rax
mov    -0x54(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x54(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xc88(%rip),%rsi
lea    -0x44(%rbp),%rdx
call   10b0 <sscanf@plt>
jmp    138d <main+0x1dd>
movl   $0x0,-0x44(%rbp)
mov    -0x40(%rbp),%edi
call   10a0 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%edx
mov    $0xaa,%esi
call   1080 <memset@plt>
mov    -0x30(%rbp),%rdi
lea    0xc4e(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    13ee <main+0x23e>
mov    -0x30(%rbp),%rsi
lea    0xc32(%rip),%rdi
call   1070 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    157b <main+0x3cb>
mov    -0x38(%rbp),%rdi
lea    0xc22(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1432 <main+0x282>
mov    -0x38(%rbp),%rsi
lea    0xbee(%rip),%rdi
call   1070 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    157b <main+0x3cb>
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    %eax,-0x58(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
cmpl   $0x0,-0x50(%rbp)
jne    1463 <main+0x2b3>
mov    -0x58(%rbp),%eax
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x4c(%rbp)
je     14e0 <main+0x330>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x40(%rbp),%eax
jge    14db <main+0x32b>
mov    -0x3c(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    14af <main+0x2ff>
mov    -0x20(%rbp),%rdi
mov    -0x3c(%rbp),%edx
add    -0x44(%rbp),%edx
sar    $0x2,%edx
lea    0xb75(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
lea    0xb5f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1474 <main+0x2c4>
jmp    1550 <main+0x3a0>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x40(%rbp),%eax
jge    154b <main+0x39b>
mov    -0x3c(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    151f <main+0x36f>
mov    -0x20(%rbp),%rdi
mov    -0x3c(%rbp),%edx
add    -0x44(%rbp),%edx
lea    0xb05(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
lea    0xaf4(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    14e7 <main+0x337>
jmp    1550 <main+0x3a0>
mov    -0x20(%rbp),%rdi
lea    0xabe(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x1,%edi
jle    129f <main+0xdf>
mov    %rsi,%r14
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
mov    $0x1,%ebx
xor    %r13d,%r13d
cmpb   $0x2d,(%rdi)
jne    1239 <main+0x79>
call   1060 <strlen@plt>
mov    $0x2,%ebx
cmp    $0x2,%eax
jl     1242 <main+0x82>
mov    0x8(%r14),%rcx
mov    %eax,%eax
add    $0x1,%rax
xor    %r15d,%r15d
xor    %r13d,%r13d
jmp    1220 <main+0x60>
xchg   %ax,%ax
mov    $0x1,%r13d
add    $0xffffffffffffffff,%rax
cmp    $0x2,%rax
jbe    123c <main+0x7c>
lea    -0x2(%rax),%edx
movzbl (%rcx,%rdx,1),%edx
cmp    $0x77,%dl
je     1210 <main+0x50>
cmp    $0x66,%dl
jne    1216 <main+0x56>
mov    $0x1,%r15d
jmp    1216 <main+0x56>
xor    %r15d,%r15d
cmp    %ebp,%ebx
jl     1249 <main+0x89>
jmp    129f <main+0xdf>
xor    %r15d,%r15d
cmp    %ebp,%ebx
jge    129f <main+0xdf>
lea    0x1(%rbx),%eax
cmp    %ebp,%eax
jge    129f <main+0xdf>
lea    0x2(%rbx),%ecx
cmp    %ebp,%ecx
jge    129f <main+0xdf>
mov    %ebx,%edx
mov    (%r14,%rdx,8),%r12
mov    %eax,%eax
mov    (%r14,%rax,8),%rax
mov    %rax,0x10(%rsp)
add    $0x3,%ebx
mov    %ecx,%eax
mov    (%r14,%rax,8),%rdi
lea    0xd88(%rip),%rsi
lea    0x8(%rsp),%rdx
call   10c0 <sscanf@plt>
cmp    %ebp,%ebx
jge    12b4 <main+0xf4>
mov    %ebx,%eax
mov    (%r14,%rax,8),%rdi
lea    0xd6d(%rip),%rsi
lea    0xc(%rsp),%rdx
call   10c0 <sscanf@plt>
jmp    12bc <main+0xfc>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10d0 <usage@plt>
movl   $0x0,0xc(%rsp)
mov    0x8(%rsp),%ebx
mov    %ebx,%edi
call   10b0 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    $0xaa,%esi
mov    %ebx,%edx
call   1080 <memset@plt>
lea    0xd23(%rip),%rsi
mov    %r12,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
je     13b2 <main+0x1f2>
mov    %rax,%rbp
lea    0xd20(%rip),%rsi
mov    0x10(%rsp),%r12
mov    %r12,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
je     13b2 <main+0x1f2>
mov    %rax,%rbx
mov    0x8(%rsp),%edx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %rbp,%rcx
call   1040 <fread@plt>
mov    %eax,%r12d
mov    %rbp,%rdi
call   1050 <fclose@plt>
test   %r15d,%r15d
jne    133d <main+0x17d>
mov    %r12d,0x8(%rsp)
mov    0x8(%rsp),%eax
test   %r13d,%r13d
je     13d0 <main+0x210>
test   %eax,%eax
jle    1421 <main+0x261>
lea    0xcc4(%rip),%r15
lea    0xcc5(%rip),%r12
xor    %ebp,%ebp
jmp    1394 <main+0x1d4>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%r14,%rbp,1),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
add    $0x1,%rbp
movslq 0x8(%rsp),%rax
cmp    %rax,%rbp
jge    1421 <main+0x261>
test   $0x3,%bpl
jne    1370 <main+0x1b0>
mov    0xc(%rsp),%edx
add    %ebp,%edx
sar    $0x2,%edx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
jmp    1370 <main+0x1b0>
lea    0xc4d(%rip),%rdi
mov    %r12,%rsi
call   1070 <printf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    $0x1,%eax
jmp    1440 <main+0x280>
test   %eax,%eax
jle    1421 <main+0x261>
lea    0xc42(%rip),%r15
lea    0xc48(%rip),%r12
xor    %ebp,%ebp
jmp    1406 <main+0x246>
movzbl (%r14,%rbp,1),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
add    $0x1,%rbp
movslq 0x8(%rsp),%rax
cmp    %rax,%rbp
jge    1421 <main+0x261>
test   $0xf,%bpl
jne    13e6 <main+0x226>
mov    0xc(%rsp),%edx
add    %ebp,%edx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
jmp    13e6 <main+0x226>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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