#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 */

/* Variables and functions */
unsigned long atol(char *);
int /*<<< orphan*/ display_byte(unsigned long, unsigned long, unsigned long);
int /*<<< orphan*/ display_char(unsigned long, unsigned long, unsigned long);
int /*<<< orphan*/ display_full(unsigned long, unsigned long);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
unsigned long readhex(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  int index;
  int gotstart = 0;
  int gotend = 0;
  int gotwidth = 0;
  char *cp;
  int full = 0;
  int ascii = 0;
  unsigned long width = 16;
  unsigned long start = 0x00000000;
  unsigned long endaddr = 0x03FFFFFF;
  for (index = 1; (index < argc); index++) {
    if (argv[index][0] == '-') {
      switch (argv[index][1]) {
      case 'f':
        if (gotwidth || ascii) {
          fprintf(stderr, "%s: -%c specified (cannot use -f)\n", "mex",
                  (gotwidth ? 'w' : 'a'));
          exit(1);
        }
        full = -1;
        break;
      case 'w':
        if (full) {
          fprintf(stderr, "%s: -f flag specified (cannot use -w)\n", "mex");
          exit(1);
        }
        if (argv[index][2] == '\0')
          cp = argv[++index];
        else
          cp = &argv[index][2];
        if ((cp == NULL) || (!cp[0])) {
          fprintf(stderr, "%s: NULL length number given\n", "mex");
          exit(1);
        }
        {
          int loop;
          for (loop = 0; cp[loop]; loop++)
            if ((cp[loop] < '0') || (cp[loop] > '9')) {
              fprintf(stderr, "%s: bad number %s\n", "mex", argv[index]);
              exit(1);
            }
        }
        width = atol(cp);
        if (ascii) {
          if (width > 64)
            width = 64;
        } else {
          if (width > 16)
            width = 16;
        }
        if (width == 0)
          width = 1;
        gotwidth = -1;
        break;
      case 'a':
        if (full) {
          fprintf(stderr, "%s: -f flag specified (cannot use -a)\n", "mex");
          exit(1);
        }
        if (!gotwidth)
          width = 64;
        ascii = -1;
        break;
      case 'h':
        usage();
        exit(1);
      default:
        fprintf(stderr, "%s: unrecognised option \"%s\"\n", "mex", argv[index]);
        exit(1);
      }
    } else {
      if (!gotstart) {
        start = readhex(argv[index]);
        gotstart = -1;
      } else {
        if (!gotend) {
          endaddr = readhex(argv[index]);
          gotend = -1;
        } else {
          fprintf(stderr, "%s: unrecognised option \"%s\"\n", "mex",
                  argv[index]);
          exit(1);
        }
      }
    }
  }
  if (!full) {
    start = (start & ~(width - 1));
    if (ascii)
      display_char(start, endaddr, width);
    else
      display_byte(start, endaddr, width);
  } else {
    start = start & ~(sizeof(unsigned long) - 1);
    display_full(start, endaddr);
  }
  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,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movq   $0x10,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x3ffffff,-0x48(%rbp)
03
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    157a <main+0x3fa>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    14d3 <main+0x353>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl 0x1(%rax),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x58(%rbp)
sub    $0x16,%eax
ja     149a <main+0x31a>
mov    -0x58(%rbp),%rax
lea    0xdd7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmpl   $0x0,-0x20(%rbp)
jne    1246 <main+0xc6>
cmpl   $0x0,-0x30(%rbp)
je     1281 <main+0x101>
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%edx
mov    $0x61,%ecx
mov    $0x77,%eax
cmp    $0x0,%edx
cmovne %eax,%ecx
lea    0xdf3(%rip),%rsi
lea    0xe0f(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
movl   $0xffffffff,-0x2c(%rbp)
jmp    14ce <main+0x34e>
cmpl   $0x0,-0x2c(%rbp)
je     12bf <main+0x13f>
mov    0x2d42(%rip),%rax
mov    (%rax),%edi
lea    0xddc(%rip),%rsi
lea    0xdd1(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl 0x2(%rax),%eax
cmp    $0x0,%eax
jne    12f5 <main+0x175>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
jmp    1309 <main+0x189>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
add    $0x2,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1321 <main+0x1a1>
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1349 <main+0x1c9>
mov    0x2cb8(%rip),%rax
mov    (%rax),%edi
lea    0xd79(%rip),%rsi
lea    0xd47(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     13d3 <main+0x253>
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jl     138c <main+0x20c>
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jle    13c0 <main+0x240>
mov    0x2c4d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xd20(%rip),%rsi
lea    0xcd0(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    13c5 <main+0x245>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1350 <main+0x1d0>
mov    -0x28(%rbp),%rdi
call   1080 <atol@plt>
mov    %rax,-0x38(%rbp)
cmpl   $0x0,-0x30(%rbp)
je     1402 <main+0x282>
cmpq   $0x40,-0x38(%rbp)
jbe    13fd <main+0x27d>
movq   $0x40,-0x38(%rbp)
jmp    141a <main+0x29a>
cmpq   $0x10,-0x38(%rbp)
jbe    1415 <main+0x295>
movq   $0x10,-0x38(%rbp)
jmp    141a <main+0x29a>
cmpq   $0x0,-0x38(%rbp)
jne    142d <main+0x2ad>
movq   $0x1,-0x38(%rbp)
movl   $0xffffffff,-0x20(%rbp)
jmp    14ce <main+0x34e>
cmpl   $0x0,-0x2c(%rbp)
je     146b <main+0x2eb>
mov    0x2b96(%rip),%rax
mov    (%rax),%edi
lea    0xc88(%rip),%rsi
lea    0xc25(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
cmpl   $0x0,-0x20(%rbp)
jne    147d <main+0x2fd>
movq   $0x40,-0x38(%rbp)
movl   $0xffffffff,-0x30(%rbp)
jmp    14ce <main+0x34e>
mov    $0x0,%al
call   1060 <usage@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    0x2b3f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xc4c(%rip),%rsi
lea    0xbc2(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    1567 <main+0x3e7>
cmpl   $0x0,-0x18(%rbp)
jne    14fe <main+0x37e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <readhex@plt>
mov    %rax,-0x40(%rbp)
movl   $0xffffffff,-0x18(%rbp)
jmp    1562 <main+0x3e2>
cmpl   $0x0,-0x1c(%rbp)
jne    1529 <main+0x3a9>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <readhex@plt>
mov    %rax,-0x48(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
jmp    155d <main+0x3dd>
mov    0x2ab0(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xbbd(%rip),%rsi
lea    0xb33(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    1562 <main+0x3e2>
jmp    1567 <main+0x3e7>
jmp    156c <main+0x3ec>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d8 <main+0x58>
cmpl   $0x0,-0x2c(%rbp)
jne    15d1 <main+0x451>
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rcx
sub    $0x1,%rcx
xor    $0xffffffffffffffff,%rcx
and    %rcx,%rax
mov    %rax,-0x40(%rbp)
cmpl   $0x0,-0x30(%rbp)
je     15bb <main+0x43b>
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   1030 <display_char@plt>
jmp    15cc <main+0x44c>
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   1050 <display_byte@plt>
jmp    15ea <main+0x46a>
mov    -0x40(%rbp),%rax
and    $0xfffffffffffffff8,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   10a0 <display_full@plt>
xor    %eax,%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    $0x28,%rsp
xor    %eax,%eax
mov    %rax,0x8(%rsp)
cmp    $0x2,%edi
jl     1361 <main+0x1e1>
mov    %rsi,%rbx
mov    %edi,%r13d
mov    $0x1,%ebp
mov    $0x3ffffff,%eax
mov    %rax,0x18(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
mov    $0x10,%r12d
xor    %r15d,%r15d
movl   $0x0,0x4(%rsp)
xor    %r8d,%r8d
xor    %r14d,%r14d
jmp    120c <main+0x8c>
mov    %rcx,%rdi
mov    %rbx,%r14
mov    %r8d,%ebx
call   1070 <readhex@plt>
mov    %ebx,%r8d
mov    %r14,%rbx
mov    %rax,0x10(%rsp)
mov    $0xffffffff,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebp
cmp    %r13d,%ebp
jge    1378 <main+0x1f8>
movslq %ebp,%rdx
mov    (%rbx,%rdx,8),%rcx
cmpb   $0x2d,(%rcx)
jne    1260 <main+0xe0>
movsbl 0x1(%rcx),%eax
add    $0xffffff9f,%eax
cmp    $0x16,%eax
ja     13ed <main+0x26d>
lea    0xdd1(%rip),%rsi
movslq (%rsi,%rax,4),%rax
add    %rsi,%rax
jmp    *%rax
test   %r15d,%r15d
jne    1410 <main+0x290>
cmpl   $0x0,0x4(%rsp)
mov    $0x40,%eax
cmove  %rax,%r12
mov    $0xffffffff,%eax
mov    %rax,0x8(%rsp)
xor    %r15d,%r15d
jmp    1200 <main+0x80>
xchg   %ax,%ax
test   %r14d,%r14d
je     11d3 <main+0x53>
test   %r8d,%r8d
jne    13ed <main+0x26d>
mov    %rcx,%rdi
call   1070 <readhex@plt>
mov    %rax,0x18(%rsp)
mov    $0xffffffff,%r14d
mov    $0xffffffff,%r8d
jmp    1200 <main+0x80>
mov    0x8(%rsp),%rax
mov    0x4(%rsp),%ecx
or     %ecx,%eax
jne    1422 <main+0x2a2>
mov    $0xffffffff,%r15d
movl   $0x0,0x4(%rsp)
xor    %eax,%eax
mov    %rax,0x8(%rsp)
jmp    1200 <main+0x80>
test   %r15d,%r15d
jne    1459 <main+0x2d9>
mov    0x2(%rcx),%al
test   %al,%al
je     12d1 <main+0x151>
lea    0x2(%rcx),%rdi
jmp    12ef <main+0x16f>
mov    0x8(%rbx,%rdx,8),%rdi
test   %rdi,%rdi
je     146b <main+0x2eb>
mov    (%rdi),%al
test   %al,%al
je     146b <main+0x2eb>
add    $0x1,%ebp
mov    %rdi,%rcx
mov    %r8d,0x24(%rsp)
lea    0x1(%rdi),%rdx
nopl   0x0(%rax,%rax,1)
add    $0xc6,%al
cmp    $0xf5,%al
jbe    13c5 <main+0x245>
movzbl (%rdx),%eax
add    $0x1,%rdx
test   %al,%al
jne    1300 <main+0x180>
call   1080 <atol@plt>
mov    %rax,%r12
cmp    $0x40,%rax
mov    $0x40,%eax
cmovb  %r12,%rax
cmp    $0x10,%r12
mov    $0x10,%ecx
cmovae %rcx,%r12
cmpl   $0x0,0x8(%rsp)
cmovne %rax,%r12
test   %r12,%r12
mov    $0x1,%eax
cmove  %rax,%r12
xor    %r15d,%r15d
movl   $0xffffffff,0x4(%rsp)
ff
mov    0x24(%rsp),%r8d
jmp    1200 <main+0x80>
mov    $0x3ffffff,%esi
mov    $0x10,%r12d
xor    %edi,%edi
mov    %r12,%rdx
call   1050 <display_byte@plt>
jmp    13b4 <main+0x234>
test   %r15d,%r15d
je     1392 <main+0x212>
mov    0x10(%rsp),%rdi
and    $0xfffffffffffffff8,%rdi
mov    0x18(%rsp),%rsi
call   10a0 <display_full@plt>
jmp    13b4 <main+0x234>
mov    %r12,%rax
neg    %rax
mov    0x10(%rsp),%rdi
and    %rax,%rdi
cmpl   $0x0,0x8(%rsp)
mov    0x18(%rsp),%rsi
je     136e <main+0x1ee>
mov    %r12,%rdx
call   1030 <display_char@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c14(%rip),%rax
mov    (%rax),%edi
lea    0xcf3(%rip),%rsi
lea    0xca3(%rip),%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    0x2bec(%rip),%rax
mov    (%rax),%edi
lea    0xd05(%rip),%rsi
jmp    13d5 <main+0x255>
xor    %eax,%eax
call   1060 <usage@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    0x2bc9(%rip),%rax
mov    (%rax),%edi
lea    0xcbb(%rip),%rsi
jmp    147b <main+0x2fb>
test   %ecx,%ecx
mov    0x2bb5(%rip),%rax
mov    (%rax),%edi
mov    $0x77,%eax
mov    $0x61,%ecx
cmovne %eax,%ecx
lea    0xc1b(%rip),%rsi
lea    0xc37(%rip),%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    0x2b80(%rip),%rax
mov    (%rax),%edi
lea    0xc1a(%rip),%rsi
jmp    147b <main+0x2fb>
mov    0x2b6e(%rip),%rax
mov    (%rax),%edi
lea    0xc2f(%rip),%rsi
lea    0xbfd(%rip),%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"%s: -%c specified (cannot use -f)\0A\00"
@.str.1 = [4 x i8] c"mex\00"
@.str.2 = [39 x i8] c"%s: -f flag specified (cannot use -w)\0A\00"
@.str.3 = [30 x i8] c"%s: NULL length number given\0A\00"
@.str.4 = [19 x i8] c"%s: bad number %s\0A\00"
@.str.5 = [39 x i8] c"%s: -f flag specified (cannot use -a)\0A\00"
@.str.6 = [30 x i8] c"%s: unrecognised option \22%s\22\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %132
4: ; preds = %2, %112
%5 = phi i64 [ %121, %112 ], [ 67108863, %2 ]
%6 = phi i64 [ %120, %112 ], [ 0, %2 ]
%7 = phi i64 [ %119, %112 ], [ 16, %2 ]
%8 = phi i32 [ %118, %112 ], [ 0, %2 ]
%9 = phi i32 [ %117, %112 ], [ 0, %2 ]
%10 = phi i32 [ %116, %112 ], [ 0, %2 ]
%11 = phi i32 [ %115, %112 ], [ 0, %2 ]
%12 = phi i32 [ %114, %112 ], [ 0, %2 ]
%13 = phi i32 [ %122, %112 ], [ 1, %2 ]
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %1, i64 %14
%16 = load i8*, i8** %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 45
br i1 %18, label %19, label %100
19: ; preds = %4
%20 = getelementptr inbounds i8, i8* %16, i64 1
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
switch i32 %22, label %96 [
i32 102, label %23
i32 119, label %32
i32 97, label %84
i32 104, label %93
]
23: ; preds = %19
%24 = icmp ne i32 %10, 0
%25 = icmp ne i32 %8, 0
%26 = select i1 %24, i1 true, i1 %25
br i1 %26, label %27, label %112
27: ; preds = %23
%28 = load i32, i32* @stderr
%29 = select i1 %24, i32 119, i32 97
%30 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = tail call i32 @exit(i32 1)
unreachable
32: ; preds = %19
%33 = icmp eq i32 %9, 0
br i1 %33, label %38, label %34
34: ; preds = %32
%35 = load i32, i32* @stderr
%36 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%37 = tail call i32 @exit(i32 1)
unreachable
38: ; preds = %32
%39 = getelementptr inbounds i8, i8* %16, i64 2
%40 = load i8, i8* %39
%41 = icmp eq i8 %40, 0
br i1 %41, label %42, label %51
42: ; preds = %38
%43 = add nsw i32 %13, 1
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %1, i64 %44
%46 = load i8*, i8** %45
%47 = icmp eq i8* %46, null
br i1 %47, label %56, label %48
48: ; preds = %42
%49 = load i8, i8* %46
%50 = icmp eq i8 %49, 0
br i1 %50, label %56, label %51
51: ; preds = %38, %48
%52 = phi i32 [ %43, %48 ], [ %13, %38 ]
%53 = phi i8* [ %46, %48 ], [ %39, %38 ]
%54 = phi i8 [ %49, %48 ], [ %40, %38 ]
%55 = phi i8* [ %46, %48 ], [ %16, %38 ]
br label %64
56: ; preds = %48, %42
%57 = load i32, i32* @stderr
%58 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%59 = tail call i32 @exit(i32 1)
unreachable
60: ; preds = %64
%61 = getelementptr inbounds i8, i8* %53, i64 %69
%62 = load i8, i8* %61
%63 = icmp eq i8 %62, 0
br i1 %63, label %74, label %64
64: ; preds = %51, %60
%65 = phi i64 [ 0, %51 ], [ %69, %60 ]
%66 = phi i8 [ %54, %51 ], [ %62, %60 ]
%67 = add i8 %66, -58
%68 = icmp ult i8 %67, -10
%69 = add nuw i64 %65, 1
br i1 %68, label %70, label %60
70: ; preds = %64
%71 = load i32, i32* @stderr
%72 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %55)
%73 = tail call i32 @exit(i32 1)
unreachable
74: ; preds = %60
%75 = tail call i64 @atol(i8* %53)
%76 = icmp eq i32 %8, 0
%77 = icmp ult i64 %75, 64
%78 = select i1 %77, i64 %75, i64 64
%79 = icmp ult i64 %75, 16
%80 = select i1 %79, i64 %75, i64 16
%81 = select i1 %76, i64 %80, i64 %78
%82 = icmp eq i64 %81, 0
%83 = select i1 %82, i64 1, i64 %81
br label %112
84: ; preds = %19
%85 = icmp eq i32 %9, 0
br i1 %85, label %90, label %86
86: ; preds = %84
%87 = load i32, i32* @stderr
%88 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%89 = tail call i32 @exit(i32 1)
unreachable
90: ; preds = %84
%91 = icmp eq i32 %10, 0
%92 = select i1 %91, i64 64, i64 %7
br label %112
93: ; preds = %19
%94 = tail call i32 (...) @usage()
%95 = tail call i32 @exit(i32 1)
unreachable
96: ; preds = %19
%97 = load i32, i32* @stderr
%98 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %97, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%99 = tail call i32 @exit(i32 1)
unreachable
100: ; preds = %4
%101 = icmp eq i32 %12, 0
br i1 %101, label %102, label %104
102: ; preds = %100
%103 = tail call i64 @readhex(i8* %16)
br label %112
104: ; preds = %100
%105 = icmp eq i32 %11, 0
br i1 %105, label %106, label %108
106: ; preds = %104
%107 = tail call i64 @readhex(i8* %16)
br label %112
108: ; preds = %104
%109 = load i32, i32* @stderr
%110 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %109, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%111 = tail call i32 @exit(i32 1)
unreachable
112: ; preds = %23, %90, %74, %106, %102
%113 = phi i32 [ %13, %90 ], [ %52, %74 ], [ %13, %106 ], [ %13, %102 ], [ %13, %23 ]
%114 = phi i32 [ %12, %90 ], [ %12, %74 ], [ -1, %106 ], [ -1, %102 ], [ %12, %23 ]
%115 = phi i32 [ %11, %90 ], [ %11, %74 ], [ -1, %106 ], [ %11, %102 ], [ %11, %23 ]
%116 = phi i32 [ %10, %90 ], [ -1, %74 ], [ %10, %106 ], [ %10, %102 ], [ 0, %23 ]
%117 = phi i32 [ 0, %90 ], [ 0, %74 ], [ %9, %106 ], [ %9, %102 ], [ -1, %23 ]
%118 = phi i32 [ -1, %90 ], [ %8, %74 ], [ %8, %106 ], [ %8, %102 ], [ 0, %23 ]
%119 = phi i64 [ %92, %90 ], [ %83, %74 ], [ %7, %106 ], [ %7, %102 ], [ %7, %23 ]
%120 = phi i64 [ %6, %90 ], [ %6, %74 ], [ %6, %106 ], [ %103, %102 ], [ %6, %23 ]
%121 = phi i64 [ %5, %90 ], [ %5, %74 ], [ %107, %106 ], [ %5, %102 ], [ %5, %23 ]
%122 = add nsw i32 %113, 1
%123 = icmp slt i32 %122, %0
br i1 %123, label %4, label %124
124: ; preds = %112
%125 = icmp eq i32 %117, 0
br i1 %125, label %126, label %137
126: ; preds = %124
%127 = sub i64 0, %119
%128 = and i64 %120, %127
%129 = icmp eq i32 %118, 0
br i1 %129, label %132, label %130
130: ; preds = %126
%131 = tail call i32 @display_char(i64 %128, i64 %121, i64 %119)
br label %140
132: ; preds = %2, %126
%133 = phi i64 [ %128, %126 ], [ 0, %2 ]
%134 = phi i64 [ %119, %126 ], [ 16, %2 ]
%135 = phi i64 [ %121, %126 ], [ 67108863, %2 ]
%136 = tail call i32 @display_byte(i64 %133, i64 %135, i64 %134)
br label %140
137: ; preds = %124
%138 = and i64 %120, -8
%139 = tail call i32 @display_full(i64 %138, i64 %121)
br label %140
140: ; preds = %130, %132, %137
ret i32 0
}