#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*/ addr;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int atol(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
size_t fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
scalar_t__ isprint(unsigned char);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, unsigned long);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcmp(char *, char *);
unsigned long strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int main(int argc, char **argv) {
  unsigned long i = 0;
  unsigned int j;
  unsigned char data[17];
  FILE *in;
  size_t length;
  int pg = 0;
  char addr[10];
  int jet4 = 0;
  int pg_size = 2048;
  if (argc < 2) {
    fprintf(stderr, "Usage: mdb-dump <filename> [<page number>]\n\n");
    exit(1);
  }
  if (argc > 2) {
    if (!strncmp(argv[2], "0x", 2)) {
      for (i = 2; i < strlen(argv[2]); i++) {
        pg *= 16;
        printf("char %c\n", (int)argv[2][i]);
        pg += argv[2][i] > '9' ? argv[2][i] - 'a' + 10 : argv[2][i] - '0';
      }
    } else {
      pg = atol(argv[2]);
    }
  }
  printf("page num %d\n", pg);
  if ((in = fopen(argv[1], "r")) == NULL) {
    fprintf(stderr, "Couldn't open file %s\n", argv[1]);
    exit(1);
  }
  fseek(in, 0x14, SEEK_SET);
  length = fread(data, 1, 1, in);
  if (!length) {
    fprintf(stderr, "fread failed at position 0x14\n");
    exit(1);
  }
  if (data[0]) {
    jet4 = 1;
    pg_size = 4096;
  }
  fseek(in, (pg * pg_size), SEEK_SET);
  i = 0;
  while ((length = fread(data, 1, 16, in))) {
    snprintf(addr, sizeof(addr), "%06lx", i);
    if (!strcmp(&addr[3], "000") || (!jet4 && !strcmp(&addr[3], "800"))) {
      fprintf(stdout, "-- Page 0x%04x (%d) --\n", pg, pg);
      pg++;
    }
    fprintf(stdout, "%s  ", addr);
    i += length;
    for (j = 0; j < length; j++) {
      fprintf(stdout, "%02x ", data[j]);
    }
    fprintf(stdout, "  |");
    for (j = 0; j < length; j++) {
      fprintf(stdout, "%c", (isprint(data[j])) ? data[j] : '.');
    }
    fprintf(stdout, "|\n");
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x800,-0x58(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    121e <main+0x5e>
mov    0x2ddc(%rip),%rax
mov    (%rax),%edi
lea    0xdf3(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
cmpl   $0x2,-0x8(%rbp)
jle    131d <main+0x15d>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdf6(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1308 <main+0x148>
movq   $0x2,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x60(%rbp),%rax
cmp    %rcx,%rax
jae    1303 <main+0x143>
mov    -0x44(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xd99(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jle    12d3 <main+0x113>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x64(%rbp)
jmp    12e9 <main+0x129>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x30,%eax
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1252 <main+0x92>
jmp    1318 <main+0x158>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10c0 <atol@plt>
mov    %eax,-0x44(%rbp)
jmp    131d <main+0x15d>
mov    -0x44(%rbp),%esi
lea    0xd12(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd0b(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    1377 <main+0x1b7>
mov    0x2c8b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xce2(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x38(%rbp),%rdi
mov    0x2c56(%rip),%rax
mov    (%rax),%edx
mov    $0x14,%esi
call   10a0 <fseek@plt>
lea    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <fread@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    13d2 <main+0x212>
mov    0x2c28(%rip),%rax
mov    (%rax),%edi
lea    0xc9e(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
cmpb   $0x0,-0x30(%rbp)
je     13ea <main+0x22a>
movl   $0x1,-0x54(%rbp)
movl   $0x1000,-0x58(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x44(%rbp),%esi
imul   -0x58(%rbp),%esi
mov    0x2bdc(%rip),%rax
mov    (%rax),%edx
call   10a0 <fseek@plt>
movq   $0x0,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rcx
mov    $0x1,%esi
mov    $0x10,%edx
call   1040 <fread@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
je     15c4 <main+0x404>
lea    -0x4e(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0xa,%esi
lea    0xc3a(%rip),%rdx
call   1070 <snprintf@plt>
lea    -0x4e(%rbp),%rdi
add    $0x3,%rdi
lea    0xc2c(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
je     148d <main+0x2cd>
cmpl   $0x0,-0x54(%rbp)
jne    14b3 <main+0x2f3>
lea    -0x4e(%rbp),%rdi
add    $0x3,%rdi
lea    0xc09(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    14b3 <main+0x2f3>
mov    0x2b3c(%rip),%rax
mov    (%rax),%edi
mov    -0x44(%rbp),%edx
mov    -0x44(%rbp),%ecx
lea    0xbe9(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    0x2b16(%rip),%rax
mov    (%rax),%edi
lea    -0x4e(%rbp),%rdx
lea    0xbdd(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x40(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x40(%rbp),%rax
jae    151b <main+0x35b>
mov    0x2adb(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%eax
movzbl -0x30(%rbp,%rax,1),%edx
lea    0xba3(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    14e1 <main+0x321>
mov    0x2aae(%rip),%rax
mov    (%rax),%edi
lea    0xb84(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x40(%rbp),%rax
jae    15a8 <main+0x3e8>
mov    0x2a83(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x68(%rbp)
mov    -0x1c(%rbp),%eax
movzbl -0x30(%rbp,%rax,1),%edi
call   10b0 <isprint@plt>
cmp    $0x0,%rax
je     1579 <main+0x3b9>
mov    -0x1c(%rbp),%eax
movzbl -0x30(%rbp,%rax,1),%eax
mov    %eax,-0x6c(%rbp)
jmp    1586 <main+0x3c6>
mov    $0x2e,%eax
mov    %eax,-0x6c(%rbp)
jmp    1586 <main+0x3c6>
mov    -0x68(%rbp),%edi
mov    -0x6c(%rbp),%edx
lea    0xb20(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1539 <main+0x379>
mov    0x2a21(%rip),%rax
mov    (%rax),%edi
lea    0xafe(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    140b <main+0x24b>
xor    %edi,%edi
call   10e0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
cmp    $0x1,%edi
jg     11d8 <main+0x28>
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
lea    0xe2d(%rip),%rsi
jmp    1308 <main+0x158>
mov    %rsi,%r14
xor    %r12d,%r12d
cmp    $0x2,%edi
je     1279 <main+0xc9>
mov    0x10(%r14),%rdi
lea    0xe3b(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
mov    0x10(%r14),%rbp
test   %eax,%eax
jne    126e <main+0xbe>
mov    %rbp,%rdi
call   1050 <strlen@plt>
cmp    $0x3,%rax
jb     1279 <main+0xc9>
mov    $0x2,%ebx
xor    %r12d,%r12d
lea    0xe0f(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
shl    $0x4,%r12d
movsbl 0x0(%rbp,%rbx,1),%esi
mov    %r15,%rdi
call   1060 <printf@plt>
mov    0x10(%r14),%rbp
movsbl 0x0(%rbp,%rbx,1),%eax
cmp    $0x3a,%eax
lea    -0x57(%r12,%rax,1),%ecx
lea    -0x30(%r12,%rax,1),%r12d
cmovge %ecx,%r12d
add    $0x1,%rbx
mov    %rbp,%rdi
call   1050 <strlen@plt>
cmp    %rax,%rbx
jb     1230 <main+0x80>
jmp    1279 <main+0xc9>
mov    %rbp,%rdi
call   10b0 <atol@plt>
mov    %eax,%r12d
lea    0xdb9(%rip),%rdi
mov    %r12d,%esi
call   1060 <printf@plt>
mov    0x8(%r14),%rdi
lea    0xdb3(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
jne    12c2 <main+0x112>
mov    0x2d3c(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r14),%rdx
lea    0xd97(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    %rax,%r13
mov    0x2d0c(%rip),%rbp
mov    0x0(%rbp),%edx
mov    %rax,%rdi
mov    $0x14,%esi
call   1090 <fseek@plt>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   1040 <fread@plt>
test   %rax,%rax
jne    1319 <main+0x169>
mov    0x2ce1(%rip),%rax
mov    (%rax),%edi
lea    0xd57(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x30(%rsp),%al
xor    %esi,%esi
mov    %al,0xf(%rsp)
test   %al,%al
setne  %sil
shl    $0xb,%esi
add    $0x800,%esi
imul   %r12d,%esi
mov    0x0(%rbp),%edx
mov    %r13,%rdi
call   1090 <fseek@plt>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x10,%edx
mov    %r13,%rcx
call   1040 <fread@plt>
mov    %rax,0x10(%rsp)
test   %rax,%rax
je     14d2 <main+0x322>
lea    0x1e(%rsp),%rbx
mov    0x2c5e(%rip),%r15
lea    0xd30(%rip),%r14
xor    %ebp,%ebp
mov    %r13,0x48(%rsp)
mov    %rbx,%rdi
mov    $0xa,%esi
lea    0xcef(%rip),%rdx
mov    %rbp,%rcx
call   1070 <snprintf@plt>
cmpl   $0x303030,0x21(%rsp)
mov    %rbp,0x28(%rsp)
je     13c0 <main+0x210>
cmpb   $0x0,0xf(%rsp)
jne    13db <main+0x22b>
cmpl   $0x303038,0x21(%rsp)
jne    13db <main+0x22b>
nopw   0x0(%rax,%rax,1)
mov    (%r15),%edi
lea    0xcc2(%rip),%rsi
mov    %r12d,%edx
mov    %r12d,%ecx
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0x1,%r12d
mov    %r12,0x50(%rsp)
mov    (%r15),%edi
lea    0xcba(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %ebx,%ebx
mov    0x10(%rsp),%rbp
nopl   0x0(%rax,%rax,1)
mov    (%r15),%edi
movzbl 0x30(%rsp,%rbx,1),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0x1,%ebx
cmp    %rbx,%rbp
ja     1400 <main+0x250>
mov    (%r15),%edi
lea    0xc8b(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %r13d,%r13d
mov    %r15,%rbp
lea    0xc7b(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp),%r12d
movzbl 0x30(%rsp,%r13,1),%r14d
mov    %r14d,%edi
call   10a0 <isprint@plt>
test   %rax,%rax
mov    $0x2e,%eax
cmove  %eax,%r14d
mov    %r12d,%edi
mov    0x10(%rsp),%rbx
mov    %r15,%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0x1,%r13d
cmp    %r13,%rbx
ja     1440 <main+0x290>
add    %rbx,0x28(%rsp)
mov    0x0(%rbp),%edi
lea    0xc2b(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x10,%edx
mov    0x48(%rsp),%rcx
call   1040 <fread@plt>
mov    %rax,0x10(%rsp)
test   %rax,%rax
mov    0x50(%rsp),%r12
lea    0x1e(%rsp),%rbx
lea    0xbe5(%rip),%r14
mov    %rbp,%r15
mov    0x28(%rsp),%rbp
jne    1380 <main+0x1d0>
xor    %edi,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [45 x i8] c"Usage: mdb-dump <filename> [<page number>]\0A\0A\00"
@.str.1 = [3 x i8] c"0x\00"
@.str.2 = [9 x i8] c"char %c\0A\00"
@.str.3 = [13 x i8] c"page num %d\0A\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [23 x i8] c"Couldn't open file %s\0A\00"
@SEEK_SET = global i32 0
@.str.6 = [31 x i8] c"fread failed at position 0x14\0A\00"
@.str.7 = [6 x i8] c"%06lx\00"
@.str.8 = [4 x i8] c"000\00"
@.str.9 = [4 x i8] c"800\00"
@stdout = global i32 0
@.str.10 = [24 x i8] c"-- Page 0x%04x (%d) --\0A\00"
@.str.11 = [5 x i8] c"%s \00"
@.str.12 = [6 x i8] c"%02x \00"
@.str.13 = [4 x i8] c" |\00"
@.str.14 = [3 x i8] c"%c\00"
@.str.15 = [3 x i8] c"|\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32
%8 = alloca [17 x i8]
%9 = alloca i32*
%10 = alloca i64
%11 = alloca i32
%12 = alloca [10 x i8]
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %6
store i32 0, i32* %11
store i32 0, i32* %13
store i32 2048, i32* %14
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 2
br i1 %16, label %17, label %21
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %2
%22 = load i32, i32* %4
%23 = icmp sgt i32 %22, 2
br i1 %23, label %24, label %90
24: ; preds = %21
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call i32 @strncmp(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%29 = icmp ne i32 %28, 0
br i1 %29, label %84, label %30
30: ; preds = %24
store i64 2, i64* %6
br label %31
31: ; preds = %80, %30
%32 = load i64, i64* %6
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 2
%35 = load i8*, i8** %34
%36 = call i64 @strlen(i8* %35)
%37 = icmp ult i64 %32, %36
br i1 %37, label %38, label %83
38: ; preds = %31
%39 = load i32, i32* %11
%40 = mul nsw i32 %39, 16
store i32 %40, i32* %11
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 2
%43 = load i8*, i8** %42
%44 = load i64, i64* %6
%45 = getelementptr inbounds i8, i8* %43, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %47)
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 2
%51 = load i8*, i8** %50
%52 = load i64, i64* %6
%53 = getelementptr inbounds i8, i8* %51, i64 %52
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = icmp sgt i32 %55, 57
br i1 %56, label %57, label %67
57: ; preds = %38
%58 = load i8**, i8*** %5
%59 = getelementptr inbounds i8*, i8** %58, i64 2
%60 = load i8*, i8** %59
%61 = load i64, i64* %6
%62 = getelementptr inbounds i8, i8* %60, i64 %61
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = sub nsw i32 %64, 97
%66 = add nsw i32 %65, 10
br label %76
67: ; preds = %38
%68 = load i8**, i8*** %5
%69 = getelementptr inbounds i8*, i8** %68, i64 2
%70 = load i8*, i8** %69
%71 = load i64, i64* %6
%72 = getelementptr inbounds i8, i8* %70, i64 %71
%73 = load i8, i8* %72
%74 = sext i8 %73 to i32
%75 = sub nsw i32 %74, 48
br label %76
76: ; preds = %67, %57
%77 = phi i32 [ %66, %57 ], [ %75, %67 ]
%78 = load i32, i32* %11
%79 = add nsw i32 %78, %77
store i32 %79, i32* %11
br label %80
80: ; preds = %76
%81 = load i64, i64* %6
%82 = add i64 %81, 1
store i64 %82, i64* %6
br label %31
83: ; preds = %31
br label %89
84: ; preds = %24
%85 = load i8**, i8*** %5
%86 = getelementptr inbounds i8*, i8** %85, i64 2
%87 = load i8*, i8** %86
%88 = call i32 @atol(i8* %87)
store i32 %88, i32* %11
br label %89
89: ; preds = %84, %83
br label %90
90: ; preds = %89, %21
%91 = load i32, i32* %11
%92 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %91)
%93 = load i8**, i8*** %5
%94 = getelementptr inbounds i8*, i8** %93, i64 1
%95 = load i8*, i8** %94
%96 = call i32* @fopen(i8* %95, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %96, i32** %9
%97 = icmp eq i32* %96, null
br i1 %97, label %98, label %105
98: ; preds = %90
%99 = load i32, i32* @stderr
%100 = load i8**, i8*** %5
%101 = getelementptr inbounds i8*, i8** %100, i64 1
%102 = load i8*, i8** %101
%103 = call i32 (i32, i8*, ...) @fprintf(i32 %99, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %102)
%104 = call i32 @exit(i32 1)
unreachable
105: ; preds = %90
%106 = load i32*, i32** %9
%107 = load i32, i32* @SEEK_SET
%108 = call i32 @fseek(i32* %106, i32 20, i32 %107)
%109 = getelementptr inbounds [17 x i8], [17 x i8]* %8, i64 0, i64 0
%110 = load i32*, i32** %9
%111 = call i64 @fread(i8* %109, i32 1, i32 1, i32* %110)
store i64 %111, i64* %10
%112 = load i64, i64* %10
%113 = icmp ne i64 %112, 0
br i1 %113, label %118, label %114
114: ; preds = %105
%115 = load i32, i32* @stderr
%116 = call i32 (i32, i8*, ...) @fprintf(i32 %115, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%117 = call i32 @exit(i32 1)
unreachable
118: ; preds = %105
%119 = getelementptr inbounds [17 x i8], [17 x i8]* %8, i64 0, i64 0
%120 = load i8, i8* %119
%121 = icmp ne i8 %120, 0
br i1 %121, label %122, label %123
122: ; preds = %118
store i32 1, i32* %13
store i32 4096, i32* %14
br label %123
123: ; preds = %122, %118
%124 = load i32*, i32** %9
%125 = load i32, i32* %11
%126 = load i32, i32* %14
%127 = mul nsw i32 %125, %126
%128 = load i32, i32* @SEEK_SET
%129 = call i32 @fseek(i32* %124, i32 %127, i32 %128)
store i64 0, i64* %6
br label %130
130: ; preds = %208, %123
%131 = getelementptr inbounds [17 x i8], [17 x i8]* %8, i64 0, i64 0
%132 = load i32*, i32** %9
%133 = call i64 @fread(i8* %131, i32 1, i32 16, i32* %132)
store i64 %133, i64* %10
%134 = icmp ne i64 %133, 0
br i1 %134, label %135, label %211
135: ; preds = %130
%136 = getelementptr inbounds [10 x i8], [10 x i8]* %12, i64 0, i64 0
%137 = load i64, i64* %6
%138 = call i32 @snprintf(i8* %136, i32 10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i64 %137)
%139 = getelementptr inbounds [10 x i8], [10 x i8]* %12, i64 0, i64 3
%140 = call i32 @strcmp(i8* %139, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%141 = icmp ne i32 %140, 0
br i1 %141, label %142, label %149
142: ; preds = %135
%143 = load i32, i32* %13
%144 = icmp ne i32 %143, 0
br i1 %144, label %156, label %145
145: ; preds = %142
%146 = getelementptr inbounds [10 x i8], [10 x i8]* %12, i64 0, i64 3
%147 = call i32 @strcmp(i8* %146, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%148 = icmp ne i32 %147, 0
br i1 %148, label %156, label %149
149: ; preds = %145, %135
%150 = load i32, i32* @stdout
%151 = load i32, i32* %11
%152 = load i32, i32* %11
%153 = call i32 (i32, i8*, ...) @fprintf(i32 %150, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0), i32 %151, i32 %152)
%154 = load i32, i32* %11
%155 = add nsw i32 %154, 1
store i32 %155, i32* %11
br label %156
156: ; preds = %149, %145, %142
%157 = load i32, i32* @stdout
%158 = getelementptr inbounds [10 x i8], [10 x i8]* %12, i64 0, i64 0
%159 = call i32 (i32, i8*, ...) @fprintf(i32 %157, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8* %158)
%160 = load i64, i64* %10
%161 = load i64, i64* %6
%162 = add i64 %161, %160
store i64 %162, i64* %6
store i32 0, i32* %7
br label %163
163: ; preds = %176, %156
%164 = load i32, i32* %7
%165 = zext i32 %164 to i64
%166 = load i64, i64* %10
%167 = icmp ult i64 %165, %166
br i1 %167, label %168, label %179
168: ; preds = %163
%169 = load i32, i32* @stdout
%170 = load i32, i32* %7
%171 = zext i32 %170 to i64
%172 = getelementptr inbounds [17 x i8], [17 x i8]* %8, i64 0, i64 %171
%173 = load i8, i8* %172
%174 = zext i8 %173 to i32
%175 = call i32 (i32, i8*, ...) @fprintf(i32 %169, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 %174)
br label %176
176: ; preds = %168
%177 = load i32, i32* %7
%178 = add i32 %177, 1
store i32 %178, i32* %7
br label %163
179: ; preds = %163
%180 = load i32, i32* @stdout
%181 = call i32 (i32, i8*, ...) @fprintf(i32 %180, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0))
store i32 0, i32* %7
br label %182
182: ; preds = %205, %179
%183 = load i32, i32* %7
%184 = zext i32 %183 to i64
%185 = load i64, i64* %10
%186 = icmp ult i64 %184, %185
br i1 %186, label %187, label %208
187: ; preds = %182
%188 = load i32, i32* @stdout
%189 = load i32, i32* %7
%190 = zext i32 %189 to i64
%191 = getelementptr inbounds [17 x i8], [17 x i8]* %8, i64 0, i64 %190
%192 = load i8, i8* %191
%193 = call i64 @isprint(i8 zeroext %192)
%194 = icmp ne i64 %193, 0
br i1 %194, label %195, label %201
195: ; preds = %187
%196 = load i32, i32* %7
%197 = zext i32 %196 to i64
%198 = getelementptr inbounds [17 x i8], [17 x i8]* %8, i64 0, i64 %197
%199 = load i8, i8* %198
%200 = zext i8 %199 to i32
br label %202
201: ; preds = %187
br label %202
202: ; preds = %201, %195
%203 = phi i32 [ %200, %195 ], [ 46, %201 ]
%204 = call i32 (i32, i8*, ...) @fprintf(i32 %188, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0), i32 %203)
br label %205
205: ; preds = %202
%206 = load i32, i32* %7
%207 = add i32 %206, 1
store i32 %207, i32* %7
br label %182
208: ; preds = %182
%209 = load i32, i32* @stdout
%210 = call i32 (i32, i8*, ...) @fprintf(i32 %209, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0))
br label %130
211: ; preds = %130
%212 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [45 x i8] c"Usage: mdb-dump <filename> [<page number>]\0A\0A\00"
@.str.1 = [3 x i8] c"0x\00"
@.str.2 = [9 x i8] c"char %c\0A\00"
@.str.3 = [13 x i8] c"page num %d\0A\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [23 x i8] c"Couldn't open file %s\0A\00"
@SEEK_SET = global i32 0
@.str.6 = [31 x i8] c"fread failed at position 0x14\0A\00"
@.str.7 = [6 x i8] c"%06lx\00"
@.str.8 = [4 x i8] c"000\00"
@.str.9 = [4 x i8] c"800\00"
@stdout = global i32 0
@.str.10 = [24 x i8] c"-- Page 0x%04x (%d) --\0A\00"
@.str.11 = [5 x i8] c"%s \00"
@.str.12 = [6 x i8] c"%02x \00"
@.str.13 = [4 x i8] c" |\00"
@.str.14 = [3 x i8] c"%c\00"
@.str.15 = [3 x i8] c"|\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [17 x i8]
%4 = alloca [10 x i8]
%5 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 2
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = icmp eq i32 %0, 2
br i1 %13, label %45, label %14
14: ; preds = %12
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = tail call i32 @strncmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%18 = icmp eq i32 %17, 0
%19 = load i8*, i8** %15
br i1 %18, label %20, label %43
20: ; preds = %14
%21 = tail call i64 @strlen(i8* dereferenceable(1) %19)
%22 = icmp ugt i64 %21, 2
br i1 %22, label %23, label %45
23: ; preds = %20, %23
%24 = phi i8* [ %32, %23 ], [ %19, %20 ]
%25 = phi i32 [ %39, %23 ], [ 0, %20 ]
%26 = phi i64 [ %40, %23 ], [ 2, %20 ]
%27 = shl nsw i32 %25, 4
%28 = getelementptr inbounds i8, i8* %24, i64 %26
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = load i8*, i8** %15
%33 = getelementptr inbounds i8, i8* %32, i64 %26
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp sgt i8 %34, 57
%37 = select i1 %36, i32 -87, i32 -48
%38 = add i32 %27, %35
%39 = add i32 %38, %37
%40 = add nuw i64 %26, 1
%41 = tail call i64 @strlen(i8* dereferenceable(1) %32)
%42 = icmp ult i64 %40, %41
br i1 %42, label %23, label %45
43: ; preds = %14
%44 = tail call i32 @atol(i8* %19)
br label %45
45: ; preds = %23, %20, %43, %12
%46 = phi i32 [ %44, %43 ], [ 0, %12 ], [ 0, %20 ], [ %39, %23 ]
%47 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %46)
%48 = getelementptr inbounds i8*, i8** %1, i64 1
%49 = load i8*, i8** %48
%50 = tail call i32* @fopen(i8* %49, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%51 = icmp eq i32* %50, null
br i1 %51, label %52, label %57
52: ; preds = %45
%53 = load i32, i32* @stderr
%54 = load i8*, i8** %48
%55 = tail call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %54)
%56 = tail call i32 @exit(i32 1)
unreachable
57: ; preds = %45
%58 = load i32, i32* @SEEK_SET
%59 = tail call i32 @fseek(i32* %50, i32 20, i32 %58)
%60 = call i64 @fread(i8* %5, i32 1, i32 1, i32* %50)
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %66
62: ; preds = %57
%63 = load i32, i32* @stderr
%64 = tail call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%65 = tail call i32 @exit(i32 1)
unreachable
66: ; preds = %57
%67 = load i8, i8* %5
%68 = icmp eq i8 %67, 0
%69 = select i1 %68, i32 2048, i32 4096
%70 = mul nsw i32 %69, %46
%71 = load i32, i32* @SEEK_SET
%72 = tail call i32 @fseek(i32* %50, i32 %70, i32 %71)
%73 = call i64 @fread(i8* %5, i32 1, i32 16, i32* %50)
%74 = icmp eq i64 %73, 0
br i1 %74, label %128, label %75
75: ; preds = %66
%76 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 3
br label %77
77: ; preds = %75, %122
%78 = phi i64 [ %73, %75 ], [ %126, %122 ]
%79 = phi i32 [ %46, %75 ], [ %93, %122 ]
%80 = phi i64 [ 0, %75 ], [ %123, %122 ]
%81 = call i32 @snprintf(i8* %6, i32 10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i64 %80)
%82 = call i32 @bcmp(i8* dereferenceable(4) %76, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i64 4)
%83 = icmp eq i32 %82, 0
br i1 %83, label %88, label %84
84: ; preds = %77
br i1 %68, label %85, label %92
85: ; preds = %84
%86 = call i32 @bcmp(i8* dereferenceable(4) %76, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i64 4)
%87 = icmp eq i32 %86, 0
br i1 %87, label %88, label %92
88: ; preds = %85, %77
%89 = load i32, i32* @stdout
%90 = call i32 (i32, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0), i32 %79, i32 %79)
%91 = add nsw i32 %79, 1
br label %92
92: ; preds = %88, %85, %84
%93 = phi i32 [ %79, %84 ], [ %79, %85 ], [ %91, %88 ]
%94 = load i32, i32* @stdout
%95 = call i32 (i32, i8*, ...) @fprintf(i32 %94, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8* %6)
br label %96
96: ; preds = %92, %96
%97 = phi i64 [ 0, %92 ], [ %104, %96 ]
%98 = load i32, i32* @stdout
%99 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 %97
%100 = load i8, i8* %99
%101 = zext i8 %100 to i32
%102 = call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 %101)
%103 = add nuw nsw i64 %97, 1
%104 = and i64 %103, 4294967295
%105 = icmp ugt i64 %78, %104
br i1 %105, label %96, label %106
106: ; preds = %96
%107 = load i32, i32* @stdout
%108 = call i32 (i32, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0))
br label %109
109: ; preds = %106, %109
%110 = phi i64 [ 0, %106 ], [ %120, %109 ]
%111 = load i32, i32* @stdout
%112 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 %110
%113 = load i8, i8* %112
%114 = call i64 @isprint(i8 zeroext %113)
%115 = icmp eq i64 %114, 0
%116 = zext i8 %113 to i32
%117 = select i1 %115, i32 46, i32 %116
%118 = call i32 (i32, i8*, ...) @fprintf(i32 %111, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0), i32 %117)
%119 = add nuw nsw i64 %110, 1
%120 = and i64 %119, 4294967295
%121 = icmp ugt i64 %78, %120
br i1 %121, label %109, label %122
122: ; preds = %109
%123 = add i64 %78, %80
%124 = load i32, i32* @stdout
%125 = call i32 (i32, i8*, ...) @fprintf(i32 %124, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0))
%126 = call i64 @fread(i8* %5, i32 1, i32 16, i32* %50)
%127 = icmp eq i64 %126, 0
br i1 %127, label %128, label %77
128: ; preds = %122, %66
%129 = call i32 @exit(i32 0)
unreachable
}