#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*/ uint8_t;
typedef int ssize_t;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int expand(int /*<<< orphan*/ **, int, size_t, int);
char fgetc(int /*<<< orphan*/);
int find_frag(int /*<<< orphan*/ *, size_t, size_t, int /*<<< orphan*/ *,
              size_t);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ printhex(int /*<<< orphan*/ *, size_t, size_t);
int read_fragment(int /*<<< orphan*/ *, size_t);
int /*<<< orphan*/ readnum(size_t *);
int shift_by(int /*<<< orphan*/ *, size_t);
int /*<<< orphan*/ stdin;
scalar_t__ stdin_nobuf();
int /*<<< orphan*/ writehex(int /*<<< orphan*/ *, size_t);
int processor(uint8_t *f, int fd, size_t l) {
  uint8_t frag[33];
  size_t start, off;
  ssize_t scan;
  int rc = EXIT_SUCCESS;
  int stop = 0;
  char ch = 0;
  if (stdin_nobuf()) {
    return EXIT_FAILURE;
  }
  while (1) {
    if (0xa != ch) {
      printf("\n> ");
    }
    ch = fgetc(stdin);
    printf("%c", ch);
    switch (ch) {
    case '+':
      if (readnum(&start)) {
        printf("\nINVALID START\n");
        break;
      }
      if (readnum(&off)) {
        printf("\nINVALID LENGTH\n");
        break;
      }
      printf("%lx\n", off + start);
      break;
    case '-':
      if (readnum(&start)) {
        printf("\nINVALID START\n");
        break;
      }
      if (readnum(&off)) {
        printf("\nINVALID LENGTH\n");
        break;
      }
      printf("%lx\n", start - off);
      break;
    case 'e':
      if (readnum(&off)) {
        printf("\nINVALID OFFSET\n");
        break;
      }
      if (-1 == expand(&f, fd, l, off)) {
        stop = 1;
        rc = EXIT_FAILURE;
        break;
      }
      l += off;
      printf("\nEXTENDED %lu BYTES\n", (long unsigned)off);
      break;
    case 'f':
      if (readnum(&start) || (start >= l)) {
        printf("\nINVALID START\n");
        break;
      }
      if (readnum(&off)) {
        printf("\nINVALID LENGTH\n");
        break;
      }
      if (-1 == read_fragment(frag, off)) {
        printf("\nINVALID FRAGMENT\n");
        break;
      }
      printf("\nFIND FRAG FROM %lx SIZE %lu\n", start, off);
      find_frag(f + start, l - start, start, frag, off);
      break;
    case 'i':
      if (readnum(&start) || (start >= l)) {
        printf("\nINVALID START\n");
        break;
      }
      if (-1 == expand(&f, fd, l, 1)) {
        stop = 1;
        rc = EXIT_FAILURE;
        break;
      }
      l++;
      if (-1 == shift_by(f + start, l - start)) {
        stop = 1;
        rc = EXIT_FAILURE;
        break;
      }
      break;
    case 'l':
      printf(" %lx\n", l);
      break;
    case 0x4:
    case 'q':
      printf("\nQUIT\n");
      stop++;
      break;
    case 'r':
      if (readnum(&start) || (start >= l)) {
        printf("\nINVALID START\n");
        break;
      }
      if (readnum(&off) || ((start + off) > l)) {
        printf("\nINVALID OFFSET\n");
        rc = EXIT_FAILURE;
        break;
      }
      if (0 == off) {
        off = (l - start);
      }
      printhex(f + start, off, start);
      break;
    case 's':
      if (readnum(&start) || (start >= l)) {
        printf("\nINVALID START\n");
        break;
      }
      if (readnum(&off)) {
        printf("\nINVALID LENGTH\n");
        break;
      }
      if (-1 == read_fragment(frag, off)) {
        printf("\nINVALID FRAGMENT\n");
        break;
      }
      printf("\nSCAN FRAG FROM %lx SIZE %lu\n", start, off);
      while (-1 != (scan = find_frag(f + start, l - start, start, frag, off))) {
        start += scan + 1;
      }
      break;
    case 'w':
      if (readnum(&start) || (start >= l)) {
        printf("\nINVALID START\n");
        break;
      }
      writehex(f + start, l - start);
      break;
    }
    if (stop) {
      break;
    }
  }
  return rc;
}


x86 assembly (clang, -O0):
<processor>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    0x2e13(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc8(%rbp)
movl   $0x0,-0xcc(%rbp)
movb   $0x0,-0xcd(%rbp)
mov    $0x0,%al
call   1070 <stdin_nobuf@plt>
cmp    $0x0,%rax
je     11f8 <processor+0x58>
mov    0x2dea(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1915 <processor+0x775>
jmp    11fd <processor+0x5d>
movsbl -0xcd(%rbp),%ecx
mov    $0xa,%eax
cmp    %ecx,%eax
je     121f <processor+0x7f>
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2dc2(%rip),%rax
mov    (%rax),%edi
call   1080 <fgetc@plt>
mov    %al,-0xcd(%rbp)
movsbl -0xcd(%rbp),%esi
lea    0xdc3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl -0xcd(%rbp),%eax
mov    %eax,-0xd4(%rbp)
sub    $0x4,%eax
je     1684 <processor+0x4e4>
jmp    1263 <processor+0xc3>
mov    -0xd4(%rbp),%eax
sub    $0x2b,%eax
je     132b <processor+0x18b>
jmp    1277 <processor+0xd7>
mov    -0xd4(%rbp),%eax
sub    $0x2d,%eax
je     139c <processor+0x1fc>
jmp    128b <processor+0xeb>
mov    -0xd4(%rbp),%eax
sub    $0x65,%eax
je     140d <processor+0x26d>
jmp    129f <processor+0xff>
mov    -0xd4(%rbp),%eax
sub    $0x66,%eax
je     14a4 <processor+0x304>
jmp    12b3 <processor+0x113>
mov    -0xd4(%rbp),%eax
sub    $0x69,%eax
je     1592 <processor+0x3f2>
jmp    12c7 <processor+0x127>
mov    -0xd4(%rbp),%eax
sub    $0x6c,%eax
je     166d <processor+0x4cd>
jmp    12db <processor+0x13b>
mov    -0xd4(%rbp),%eax
sub    $0x71,%eax
je     1684 <processor+0x4e4>
jmp    12ef <processor+0x14f>
mov    -0xd4(%rbp),%eax
sub    $0x72,%eax
je     16a6 <processor+0x506>
jmp    1303 <processor+0x163>
mov    -0xd4(%rbp),%eax
sub    $0x73,%eax
je     1779 <processor+0x5d9>
jmp    1317 <processor+0x177>
mov    -0xd4(%rbp),%eax
sub    $0x77,%eax
je     189a <processor+0x6fa>
jmp    18f5 <processor+0x755>
lea    -0xb8(%rbp),%rdi
call   1030 <readnum@plt>
cmp    $0x0,%eax
je     1353 <processor+0x1b3>
lea    0xcc0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18f5 <processor+0x755>
lea    -0xc0(%rbp),%rdi
call   1030 <readnum@plt>
cmp    $0x0,%eax
je     137b <processor+0x1db>
lea    0xca8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18f5 <processor+0x755>
mov    -0xc0(%rbp),%rsi
add    -0xb8(%rbp),%rsi
lea    0xcf0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18f5 <processor+0x755>
lea    -0xb8(%rbp),%rdi
call   1030 <readnum@plt>
cmp    $0x0,%eax
je     13c4 <processor+0x224>
lea    0xc4f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18f5 <processor+0x755>
lea    -0xc0(%rbp),%rdi
call   1030 <readnum@plt>
cmp    $0x0,%eax
je     13ec <processor+0x24c>
lea    0xc37(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18f5 <processor+0x755>
mov    -0xb8(%rbp),%rsi
sub    -0xc0(%rbp),%rsi
lea    0xc7f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18f5 <processor+0x755>
lea    -0xc0(%rbp),%rdi
call   1030 <readnum@plt>
cmp    $0x0,%eax
je     1435 <processor+0x295>
lea    0xbff(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18f5 <processor+0x755>
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0xc0(%rbp),%rax
mov    %eax,%ecx
lea    -0x10(%rbp),%rdi
call   10b0 <expand@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    147b <processor+0x2db>
movl   $0x1,-0xcc(%rbp)
mov    0x2b6a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc8(%rbp)
jmp    18f5 <processor+0x755>
mov    -0xc0(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc0(%rbp),%rsi
lea    0xba1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18f5 <processor+0x755>
lea    -0xb8(%rbp),%rdi
call   1030 <readnum@plt>
cmp    $0x0,%eax
jne    14ca <processor+0x32a>
mov    -0xb8(%rbp),%rax
cmp    -0x20(%rbp),%rax
jb     14dd <processor+0x33d>
lea    0xb36(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18f5 <processor+0x755>
lea    -0xc0(%rbp),%rdi
call   1030 <readnum@plt>
cmp    $0x0,%eax
je     1505 <processor+0x365>
lea    0xb1e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18f5 <processor+0x755>
lea    -0xb0(%rbp),%rdi
mov    -0xc0(%rbp),%rsi
call   1040 <read_fragment@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    153a <processor+0x39a>
lea    0xb20(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18f5 <processor+0x755>
mov    -0xb8(%rbp),%rsi
mov    -0xc0(%rbp),%rdx
lea    0xb12(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0xb8(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x20(%rbp),%rsi
sub    -0xb8(%rbp),%rsi
mov    -0xb8(%rbp),%rdx
lea    -0xb0(%rbp),%rcx
mov    -0xc0(%rbp),%r8
call   1090 <find_frag@plt>
jmp    18f5 <processor+0x755>
lea    -0xb8(%rbp),%rdi
call   1030 <readnum@plt>
cmp    $0x0,%eax
jne    15b8 <processor+0x418>
mov    -0xb8(%rbp),%rax
cmp    -0x20(%rbp),%rax
jb     15cb <processor+0x42b>
lea    0xa48(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18f5 <processor+0x755>
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
lea    -0x10(%rbp),%rdi
mov    $0x1,%ecx
call   10b0 <expand@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    160d <processor+0x46d>
movl   $0x1,-0xcc(%rbp)
mov    0x29d8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc8(%rbp)
jmp    18f5 <processor+0x755>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0xb8(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x20(%rbp),%rsi
sub    -0xb8(%rbp),%rsi
call   10c0 <shift_by@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    1668 <processor+0x4c8>
movl   $0x1,-0xcc(%rbp)
mov    0x297d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc8(%rbp)
jmp    18f5 <processor+0x755>
jmp    18f5 <processor+0x755>
mov    -0x20(%rbp),%rsi
lea    0xa07(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18f5 <processor+0x755>
lea    0x9fa(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    18f5 <processor+0x755>
lea    -0xb8(%rbp),%rdi
call   1030 <readnum@plt>
cmp    $0x0,%eax
jne    16cc <processor+0x52c>
mov    -0xb8(%rbp),%rax
cmp    -0x20(%rbp),%rax
jb     16df <processor+0x53f>
lea    0x934(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18f5 <processor+0x755>
lea    -0xc0(%rbp),%rdi
call   1030 <readnum@plt>
cmp    $0x0,%eax
jne    170c <processor+0x56c>
mov    -0xb8(%rbp),%rax
add    -0xc0(%rbp),%rax
cmp    -0x20(%rbp),%rax
jbe    172e <processor+0x58e>
lea    0x915(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x28b7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc8(%rbp)
jmp    18f5 <processor+0x755>
xor    %eax,%eax
cmp    -0xc0(%rbp),%rax
jne    174f <processor+0x5af>
mov    -0x20(%rbp),%rax
sub    -0xb8(%rbp),%rax
mov    %rax,-0xc0(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0xb8(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0xc0(%rbp),%rsi
mov    -0xb8(%rbp),%rdx
call   10a0 <printhex@plt>
jmp    18f5 <processor+0x755>
lea    -0xb8(%rbp),%rdi
call   1030 <readnum@plt>
cmp    $0x0,%eax
jne    179f <processor+0x5ff>
mov    -0xb8(%rbp),%rax
cmp    -0x20(%rbp),%rax
jb     17b2 <processor+0x612>
lea    0x861(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18f5 <processor+0x755>
lea    -0xc0(%rbp),%rdi
call   1030 <readnum@plt>
cmp    $0x0,%eax
je     17da <processor+0x63a>
lea    0x849(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18f5 <processor+0x755>
lea    -0xb0(%rbp),%rdi
mov    -0xc0(%rbp),%rsi
call   1040 <read_fragment@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    180f <processor+0x66f>
lea    0x84b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18f5 <processor+0x755>
mov    -0xb8(%rbp),%rsi
mov    -0xc0(%rbp),%rdx
lea    0x868(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0xb8(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x20(%rbp),%rsi
sub    -0xb8(%rbp),%rsi
mov    -0xb8(%rbp),%rdx
lea    -0xb0(%rbp),%rcx
mov    -0xc0(%rbp),%r8
call   1090 <find_frag@plt>
mov    %eax,%ecx
mov    %ecx,-0xc4(%rbp)
mov    $0xffffffff,%eax
cmp    %ecx,%eax
je     1895 <processor+0x6f5>
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
cltq
add    -0xb8(%rbp),%rax
mov    %rax,-0xb8(%rbp)
jmp    182b <processor+0x68b>
jmp    18f5 <processor+0x755>
lea    -0xb8(%rbp),%rdi
call   1030 <readnum@plt>
cmp    $0x0,%eax
jne    18c0 <processor+0x720>
mov    -0xb8(%rbp),%rax
cmp    -0x20(%rbp),%rax
jb     18d3 <processor+0x733>
lea    0x740(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18f5 <processor+0x755>
mov    -0x10(%rbp),%rdi
mov    -0xb8(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x20(%rbp),%rsi
sub    -0xb8(%rbp),%rsi
call   1060 <writehex@plt>
cmpl   $0x0,-0xcc(%rbp)
je     1907 <processor+0x767>
jmp    190c <processor+0x76c>
jmp    11fd <processor+0x5d>
mov    -0xc8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processor>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %rdi,0x10(%rsp)
mov    0x2ded(%rip),%rax
mov    (%rax),%ebp
xor    %eax,%eax
call   1090 <stdin_nobuf@plt>
test   %rax,%rax
je     11ff <processor+0x3f>
mov    0x2de0(%rip),%rax
mov    (%rax),%eax
jmp    15c5 <processor+0x405>
mov    %r14d,0x1c(%rsp)
mov    %ebp,0x18(%rsp)
mov    0x2dd9(%rip),%r13
lea    0xdea(%rip),%r15
lea    0x20(%rsp),%rbp
xor    %r14d,%r14d
jmp    123c <processor+0x7c>
mov    %rsp,%rdi
call   1050 <readnum@plt>
test   %eax,%eax
je     1513 <processor+0x353>
lea    0xf90(%rip),%rdi
call   1040 <puts@plt>
cmp    $0xa,%r14b
je     1250 <processor+0x90>
lea    0xeeb(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%r13),%edi
call   10a0 <fgetc@plt>
mov    %eax,%r14d
movsbl %al,%r12d
mov    %r12d,%edi
call   1030 <putchar@plt>
lea    -0x2b(%r12),%eax
cmp    $0x4c,%eax
ja     1504 <processor+0x344>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
mov    %rsp,%rdi
call   1050 <readnum@plt>
test   %eax,%eax
jne    1230 <processor+0x70>
lea    0x8(%rsp),%rdi
call   1050 <readnum@plt>
test   %eax,%eax
jne    1521 <processor+0x361>
mov    (%rsp),%rsi
sub    0x8(%rsp),%rsi
jmp    157b <processor+0x3bb>
lea    0x8(%rsp),%rdi
call   1050 <readnum@plt>
test   %eax,%eax
je     1532 <processor+0x372>
lea    0xee3(%rip),%rdi
call   1040 <puts@plt>
jmp    123c <processor+0x7c>
mov    %rsp,%rdi
call   1050 <readnum@plt>
test   %eax,%eax
jne    1230 <processor+0x70>
cmp    %rbx,(%rsp)
jae    1230 <processor+0x70>
lea    0x8(%rsp),%rdi
call   1050 <readnum@plt>
test   %eax,%eax
jne    1521 <processor+0x361>
mov    0x8(%rsp),%rsi
mov    %rbp,%rdi
call   1060 <read_fragment@plt>
cmp    $0xffffffff,%eax
je     1561 <processor+0x3a1>
mov    (%rsp),%rsi
mov    0x8(%rsp),%rdx
lea    0xe2d(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%rsp),%rdx
lea    0x0(,%rdx,4),%rdi
add    0x10(%rsp),%rdi
mov    %rbx,%rsi
sub    %rdx,%rsi
mov    0x8(%rsp),%r8
mov    %rbp,%rcx
call   10b0 <find_frag@plt>
jmp    123c <processor+0x7c>
mov    %rsp,%rdi
call   1050 <readnum@plt>
test   %eax,%eax
jne    1230 <processor+0x70>
cmp    %rbx,(%rsp)
jae    1230 <processor+0x70>
lea    0x10(%rsp),%rdi
mov    0x1c(%rsp),%esi
mov    %rbx,%rdx
mov    $0x1,%ecx
call   10d0 <expand@plt>
cmp    $0xffffffff,%eax
je     11f1 <processor+0x31>
add    $0x1,%rbx
mov    (%rsp),%rax
lea    0x0(,%rax,4),%rdi
add    0x10(%rsp),%rdi
mov    %rbx,%rsi
sub    %rax,%rsi
call   10e0 <shift_by@plt>
cmp    $0xffffffff,%eax
jne    123c <processor+0x7c>
jmp    11f1 <processor+0x31>
lea    0xdad(%rip),%rdi
mov    %rbx,%rsi
jmp    1582 <processor+0x3c2>
mov    %rsp,%rdi
call   1050 <readnum@plt>
test   %eax,%eax
jne    1230 <processor+0x70>
cmp    %rbx,(%rsp)
jae    1230 <processor+0x70>
lea    0x8(%rsp),%rdi
call   1050 <readnum@plt>
test   %eax,%eax
jne    1404 <processor+0x244>
mov    (%rsp),%rdx
mov    0x8(%rsp),%rsi
lea    (%rsi,%rdx,1),%rax
cmp    %rbx,%rax
jbe    158e <processor+0x3ce>
lea    0xd9c(%rip),%rdi
call   1040 <puts@plt>
mov    0x2bc1(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
jmp    123c <processor+0x7c>
mov    %rsp,%rdi
call   1050 <readnum@plt>
test   %eax,%eax
jne    1230 <processor+0x70>
cmp    %rbx,(%rsp)
jae    1230 <processor+0x70>
lea    0x8(%rsp),%rdi
call   1050 <readnum@plt>
test   %eax,%eax
jne    1521 <processor+0x361>
mov    0x8(%rsp),%rsi
mov    %rbp,%rdi
call   1060 <read_fragment@plt>
cmp    $0xffffffff,%eax
je     1561 <processor+0x3a1>
mov    (%rsp),%rsi
mov    0x8(%rsp),%rdx
lea    0xcfd(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%rsp),%rdx
lea    0x0(,%rdx,4),%rdi
nopw   0x0(%rax,%rax,1)
add    0x10(%rsp),%rdi
mov    %rbx,%rsi
sub    %rdx,%rsi
mov    0x8(%rsp),%r8
mov    %rbp,%rcx
call   10b0 <find_frag@plt>
cmp    $0xffffffff,%eax
je     123c <processor+0x7c>
cltq
mov    (%rsp),%rcx
lea    (%rax,%rcx,1),%rsi
lea    (%rax,%rcx,1),%rdx
add    $0x1,%rdx
mov    %rdx,(%rsp)
lea    0x4(,%rsi,4),%rdi
jmp    1490 <processor+0x2d0>
mov    %rsp,%rdi
call   1050 <readnum@plt>
test   %eax,%eax
jne    1230 <processor+0x70>
mov    (%rsp),%rdi
mov    %rbx,%rsi
sub    %rdi,%rsi
jbe    1230 <processor+0x70>
shl    $0x2,%rdi
add    0x10(%rsp),%rdi
call   1080 <writehex@plt>
jmp    123c <processor+0x7c>
cmp    $0x4,%r12d
jne    123c <processor+0x7c>
jmp    15b5 <processor+0x3f5>
lea    0x8(%rsp),%rdi
call   1050 <readnum@plt>
test   %eax,%eax
je     1572 <processor+0x3b2>
lea    0xc8f(%rip),%rdi
call   1040 <puts@plt>
jmp    123c <processor+0x7c>
mov    0x8(%rsp),%ecx
lea    0x10(%rsp),%rdi
mov    0x1c(%rsp),%esi
mov    %rbx,%rdx
call   10d0 <expand@plt>
cmp    $0xffffffff,%eax
je     11f1 <processor+0x31>
mov    0x8(%rsp),%rsi
add    %rsi,%rbx
lea    0xbd9(%rip),%rdi
jmp    1582 <processor+0x3c2>
lea    0xc2d(%rip),%rdi
call   1040 <puts@plt>
jmp    123c <processor+0x7c>
mov    (%rsp),%rsi
add    0x8(%rsp),%rsi
lea    0xbea(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    123c <processor+0x7c>
test   %rsi,%rsi
jne    159e <processor+0x3de>
mov    %rbx,%rsi
sub    %rdx,%rsi
mov    %rsi,0x8(%rsp)
lea    0x0(,%rdx,4),%rdi
add    0x10(%rsp),%rdi
call   10c0 <printhex@plt>
jmp    123c <processor+0x7c>
lea    0xbd3(%rip),%rdi
call   1040 <puts@plt>
mov    0x18(%rsp),%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
@.str = [4 x i8] c"\0A> \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [16 x i8] c"\0AINVALID START\0A\00"
@.str.3 = [17 x i8] c"\0AINVALID LENGTH\0A\00"
@.str.4 = [5 x i8] c"%lx\0A\00"
@.str.5 = [17 x i8] c"\0AINVALID OFFSET\0A\00"
@.str.6 = [21 x i8] c"\0AEXTENDED %lu BYTES\0A\00"
@.str.7 = [19 x i8] c"\0AINVALID FRAGMENT\0A\00"
@.str.8 = [30 x i8] c"\0AFIND FRAG FROM %lx SIZE %lu\0A\00"
@.str.9 = [6 x i8] c" %lx\0A\00"
@.str.10 = [7 x i8] c"\0AQUIT\0A\00"
@.str.11 = [30 x i8] c"\0ASCAN FRAG FROM %lx SIZE %lu\0A\00"
define i32 @processor(i32* %0, i32 %1, i64 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i64
%8 = alloca [33 x i32]
%9 = alloca i64
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i8
store i32* %0, i32** %5
store i32 %1, i32* %6
store i64 %2, i64* %7
%15 = load i32, i32* @EXIT_SUCCESS
store i32 %15, i32* %12
store i32 0, i32* %13
store i8 0, i8* %14
%16 = call i64 (...) @stdin_nobuf()
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %3
%19 = load i32, i32* @EXIT_FAILURE
store i32 %19, i32* %4
br label %260
20: ; preds = %3
br label %21
21: ; preds = %20, %257
%22 = load i8, i8* %14
%23 = sext i8 %22 to i32
%24 = icmp ne i32 10, %23
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %27
27: ; preds = %25, %21
%28 = load i32, i32* @stdin
%29 = call signext i8 @fgetc(i32 %28)
store i8 %29, i8* %14
%30 = load i8, i8* %14
%31 = sext i8 %30 to i32
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = load i8, i8* %14
%34 = sext i8 %33 to i32
switch i32 %34, label %253 [
i32 43, label %35
i32 45, label %50
i32 101, label %65
i32 102, label %85
i32 105, label %120
i32 108, label %150
i32 4, label %153
i32 113, label %153
i32 114, label %157
i32 115, label %192
i32 119, label %236
]
35: ; preds = %27
%36 = call i32 @readnum(i64* %9)
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %253
40: ; preds = %35
%41 = call i32 @readnum(i64* %10)
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %253
45: ; preds = %40
%46 = load i64, i64* %10
%47 = load i64, i64* %9
%48 = add i64 %46, %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 %48)
br label %253
50: ; preds = %27
%51 = call i32 @readnum(i64* %9)
%52 = icmp ne i32 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %50
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %253
55: ; preds = %50
%56 = call i32 @readnum(i64* %10)
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %60
58: ; preds = %55
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %253
60: ; preds = %55
%61 = load i64, i64* %9
%62 = load i64, i64* %10
%63 = sub i64 %61, %62
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 %63)
br label %253
65: ; preds = %27
%66 = call i32 @readnum(i64* %10)
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %70
68: ; preds = %65
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
br label %253
70: ; preds = %65
%71 = load i32, i32* %6
%72 = load i64, i64* %7
%73 = load i64, i64* %10
%74 = trunc i64 %73 to i32
%75 = call i32 @expand(i32** %5, i32 %71, i64 %72, i32 %74)
%76 = icmp eq i32 -1, %75
br i1 %76, label %77, label %79
77: ; preds = %70
store i32 1, i32* %13
%78 = load i32, i32* @EXIT_FAILURE
store i32 %78, i32* %12
br label %253
79: ; preds = %70
%80 = load i64, i64* %10
%81 = load i64, i64* %7
%82 = add i64 %81, %80
store i64 %82, i64* %7
%83 = load i64, i64* %10
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i64 %83)
br label %253
85: ; preds = %27
%86 = call i32 @readnum(i64* %9)
%87 = icmp ne i32 %86, 0
br i1 %87, label %92, label %88
88: ; preds = %85
%89 = load i64, i64* %9
%90 = load i64, i64* %7
%91 = icmp uge i64 %89, %90
br i1 %91, label %92, label %94
92: ; preds = %88, %85
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %253
94: ; preds = %88
%95 = call i32 @readnum(i64* %10)
%96 = icmp ne i32 %95, 0
br i1 %96, label %97, label %99
97: ; preds = %94
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %253
99: ; preds = %94
%100 = getelementptr inbounds [33 x i32], [33 x i32]* %8, i64 0, i64 0
%101 = load i64, i64* %10
%102 = call i32 @read_fragment(i32* %100, i64 %101)
%103 = icmp eq i32 -1, %102
br i1 %103, label %104, label %106
104: ; preds = %99
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
br label %253
106: ; preds = %99
%107 = load i64, i64* %9
%108 = load i64, i64* %10
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i64 %107, i64 %108)
%110 = load i32*, i32** %5
%111 = load i64, i64* %9
%112 = getelementptr inbounds i32, i32* %110, i64 %111
%113 = load i64, i64* %7
%114 = load i64, i64* %9
%115 = sub i64 %113, %114
%116 = load i64, i64* %9
%117 = getelementptr inbounds [33 x i32], [33 x i32]* %8, i64 0, i64 0
%118 = load i64, i64* %10
%119 = call i32 @find_frag(i32* %112, i64 %115, i64 %116, i32* %117, i64 %118)
br label %253
120: ; preds = %27
%121 = call i32 @readnum(i64* %9)
%122 = icmp ne i32 %121, 0
br i1 %122, label %127, label %123
123: ; preds = %120
%124 = load i64, i64* %9
%125 = load i64, i64* %7
%126 = icmp uge i64 %124, %125
br i1 %126, label %127, label %129
127: ; preds = %123, %120
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %253
129: ; preds = %123
%130 = load i32, i32* %6
%131 = load i64, i64* %7
%132 = call i32 @expand(i32** %5, i32 %130, i64 %131, i32 1)
%133 = icmp eq i32 -1, %132
br i1 %133, label %134, label %136
134: ; preds = %129
store i32 1, i32* %13
%135 = load i32, i32* @EXIT_FAILURE
store i32 %135, i32* %12
br label %253
136: ; preds = %129
%137 = load i64, i64* %7
%138 = add i64 %137, 1
store i64 %138, i64* %7
%139 = load i32*, i32** %5
%140 = load i64, i64* %9
%141 = getelementptr inbounds i32, i32* %139, i64 %140
%142 = load i64, i64* %7
%143 = load i64, i64* %9
%144 = sub i64 %142, %143
%145 = call i32 @shift_by(i32* %141, i64 %144)
%146 = icmp eq i32 -1, %145
br i1 %146, label %147, label %149
147: ; preds = %136
store i32 1, i32* %13
%148 = load i32, i32* @EXIT_FAILURE
store i32 %148, i32* %12
br label %253
149: ; preds = %136
br label %253
150: ; preds = %27
%151 = load i64, i64* %7
%152 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i64 %151)
br label %253
153: ; preds = %27, %27
%154 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%155 = load i32, i32* %13
%156 = add nsw i32 %155, 1
store i32 %156, i32* %13
br label %253
157: ; preds = %27
%158 = call i32 @readnum(i64* %9)
%159 = icmp ne i32 %158, 0
br i1 %159, label %164, label %160
160: ; preds = %157
%161 = load i64, i64* %9
%162 = load i64, i64* %7
%163 = icmp uge i64 %161, %162
br i1 %163, label %164, label %166
164: ; preds = %160, %157
%165 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %253
166: ; preds = %160
%167 = call i32 @readnum(i64* %10)
%168 = icmp ne i32 %167, 0
br i1 %168, label %175, label %169
169: ; preds = %166
%170 = load i64, i64* %9
%171 = load i64, i64* %10
%172 = add i64 %170, %171
%173 = load i64, i64* %7
%174 = icmp ugt i64 %172, %173
br i1 %174, label %175, label %178
175: ; preds = %169, %166
%176 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%177 = load i32, i32* @EXIT_FAILURE
store i32 %177, i32* %12
br label %253
178: ; preds = %169
%179 = load i64, i64* %10
%180 = icmp eq i64 0, %179
br i1 %180, label %181, label %185
181: ; preds = %178
%182 = load i64, i64* %7
%183 = load i64, i64* %9
%184 = sub i64 %182, %183
store i64 %184, i64* %10
br label %185
185: ; preds = %181, %178
%186 = load i32*, i32** %5
%187 = load i64, i64* %9
%188 = getelementptr inbounds i32, i32* %186, i64 %187
%189 = load i64, i64* %10
%190 = load i64, i64* %9
%191 = call i32 @printhex(i32* %188, i64 %189, i64 %190)
br label %253
192: ; preds = %27
%193 = call i32 @readnum(i64* %9)
%194 = icmp ne i32 %193, 0
br i1 %194, label %199, label %195
195: ; preds = %192
%196 = load i64, i64* %9
%197 = load i64, i64* %7
%198 = icmp uge i64 %196, %197
br i1 %198, label %199, label %201
199: ; preds = %195, %192
%200 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %253
201: ; preds = %195
%202 = call i32 @readnum(i64* %10)
%203 = icmp ne i32 %202, 0
br i1 %203, label %204, label %206
204: ; preds = %201
%205 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %253
206: ; preds = %201
%207 = getelementptr inbounds [33 x i32], [33 x i32]* %8, i64 0, i64 0
%208 = load i64, i64* %10
%209 = call i32 @read_fragment(i32* %207, i64 %208)
%210 = icmp eq i32 -1, %209
br i1 %210, label %211, label %213
211: ; preds = %206
%212 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
br label %253
213: ; preds = %206
%214 = load i64, i64* %9
%215 = load i64, i64* %10
%216 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0), i64 %214, i64 %215)
br label %217
217: ; preds = %229, %213
%218 = load i32*, i32** %5
%219 = load i64, i64* %9
%220 = getelementptr inbounds i32, i32* %218, i64 %219
%221 = load i64, i64* %7
%222 = load i64, i64* %9
%223 = sub i64 %221, %222
%224 = load i64, i64* %9
%225 = getelementptr inbounds [33 x i32], [33 x i32]* %8, i64 0, i64 0
%226 = load i64, i64* %10
%227 = call i32 @find_frag(i32* %220, i64 %223, i64 %224, i32* %225, i64 %226)
store i32 %227, i32* %11
%228 = icmp ne i32 -1, %227
br i1 %228, label %229, label %235
229: ; preds = %217
%230 = load i32, i32* %11
%231 = add nsw i32 %230, 1
%232 = sext i32 %231 to i64
%233 = load i64, i64* %9
%234 = add i64 %233, %232
store i64 %234, i64* %9
br label %217
235: ; preds = %217
br label %253
236: ; preds = %27
%237 = call i32 @readnum(i64* %9)
%238 = icmp ne i32 %237, 0
br i1 %238, label %243, label %239
239: ; preds = %236
%240 = load i64, i64* %9
%241 = load i64, i64* %7
%242 = icmp uge i64 %240, %241
br i1 %242, label %243, label %245
243: ; preds = %239, %236
%244 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %253
245: ; preds = %239
%246 = load i32*, i32** %5
%247 = load i64, i64* %9
%248 = getelementptr inbounds i32, i32* %246, i64 %247
%249 = load i64, i64* %7
%250 = load i64, i64* %9
%251 = sub i64 %249, %250
%252 = call i32 @writehex(i32* %248, i64 %251)
br label %253
253: ; preds = %27, %245, %243, %235, %211, %204, %199, %185, %175, %164, %153, %150, %149, %147, %134, %127, %106, %104, %97, %92, %79, %77, %68, %60, %58, %53, %45, %43, %38
%254 = load i32, i32* %13
%255 = icmp ne i32 %254, 0
br i1 %255, label %256, label %257
256: ; preds = %253
br label %258
257: ; preds = %253
br label %21
258: ; preds = %256
%259 = load i32, i32* %12
store i32 %259, i32* %4
br label %260
260: ; preds = %258, %18
%261 = load i32, i32* %4
ret i32 %261
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
@.str = [4 x i8] c"\0A> \00"
@stdin = global i32 0
@.str.4 = [5 x i8] c"%lx\0A\00"
@.str.6 = [21 x i8] c"\0AEXTENDED %lu BYTES\0A\00"
@.str.8 = [30 x i8] c"\0AFIND FRAG FROM %lx SIZE %lu\0A\00"
@.str.9 = [6 x i8] c" %lx\0A\00"
@.str.11 = [30 x i8] c"\0ASCAN FRAG FROM %lx SIZE %lu\0A\00"
@str.17 = [6 x i8] c"\0AQUIT\00"
@str.19 = [18 x i8] c"\0AINVALID FRAGMENT\00"
@str.22 = [16 x i8] c"\0AINVALID OFFSET\00"
@str.25 = [16 x i8] c"\0AINVALID LENGTH\00"
@str.26 = [15 x i8] c"\0AINVALID START\00"
define i32 @processor(i32* %0, i32 %1, i64 %2) {
%4 = alloca i32*
%5 = alloca [33 x i32]
%6 = alloca i64
%7 = alloca i64
store i32* %0, i32** %4
%8 = bitcast [33 x i32]* %5 to i8*
%9 = bitcast i64* %6 to i8*
%10 = bitcast i64* %7 to i8*
%11 = load i32, i32* @EXIT_SUCCESS
%12 = tail call i64 (...) @stdin_nobuf()
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = getelementptr inbounds [33 x i32], [33 x i32]* %5, i64 0, i64 0
br label %18
16: ; preds = %3
%17 = load i32, i32* @EXIT_FAILURE
br label %218
18: ; preds = %30, %14
%19 = phi i64 [ %2, %14 ], [ %31, %30 ]
%20 = phi i32 [ %11, %14 ], [ %32, %30 ]
%21 = phi i8 [ 0, %14 ], [ %27, %30 ]
%22 = icmp eq i8 %21, 10
br i1 %22, label %25, label %23
23: ; preds = %18
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %25
25: ; preds = %23, %18
%26 = load i32, i32* @stdin
%27 = call signext i8 @fgetc(i32 %26)
%28 = sext i8 %27 to i32
%29 = call i32 @putchar(i32 %28)
switch i32 %28, label %30 [
i32 43, label %33
i32 45, label %48
i32 101, label %63
i32 102, label %79
i32 105, label %108
i32 108, label %129
i32 4, label %131
i32 113, label %131
i32 114, label %133
i32 115, label %161
i32 119, label %203
]
30: ; preds = %191, %25, %180, %121, %36, %41, %43, %51, %56, %58, %66, %75, %85, %90, %96, %98, %114, %129, %139, %149, %156, %167, %172, %178, %209, %211
%31 = phi i64 [ %19, %209 ], [ %19, %211 ], [ %19, %167 ], [ %19, %172 ], [ %19, %178 ], [ %19, %139 ], [ %19, %149 ], [ %19, %156 ], [ %19, %129 ], [ %19, %114 ], [ %19, %85 ], [ %19, %90 ], [ %19, %96 ], [ %19, %98 ], [ %19, %66 ], [ %77, %75 ], [ %19, %51 ], [ %19, %56 ], [ %19, %58 ], [ %19, %36 ], [ %19, %41 ], [ %19, %43 ], [ %122, %121 ], [ %19, %180 ], [ %19, %25 ], [ %19, %191 ]
%32 = phi i32 [ %20, %209 ], [ %20, %211 ], [ %20, %167 ], [ %20, %172 ], [ %20, %178 ], [ %20, %139 ], [ %151, %149 ], [ %20, %156 ], [ %20, %129 ], [ %20, %114 ], [ %20, %85 ], [ %20, %90 ], [ %20, %96 ], [ %20, %98 ], [ %20, %66 ], [ %20, %75 ], [ %20, %51 ], [ %20, %56 ], [ %20, %58 ], [ %20, %36 ], [ %20, %41 ], [ %20, %43 ], [ %20, %121 ], [ %20, %180 ], [ %20, %25 ], [ %20, %191 ]
br label %18
33: ; preds = %25
%34 = call i32 @readnum(i64* %6)
%35 = icmp eq i32 %34, 0
br i1 %35, label %38, label %36
36: ; preds = %33
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.26, i64 0, i64 0))
br label %30
38: ; preds = %33
%39 = call i32 @readnum(i64* %7)
%40 = icmp eq i32 %39, 0
br i1 %40, label %43, label %41
41: ; preds = %38
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.25, i64 0, i64 0))
br label %30
43: ; preds = %38
%44 = load i64, i64* %7
%45 = load i64, i64* %6
%46 = add i64 %45, %44
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 %46)
br label %30
48: ; preds = %25
%49 = call i32 @readnum(i64* %6)
%50 = icmp eq i32 %49, 0
br i1 %50, label %53, label %51
51: ; preds = %48
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.26, i64 0, i64 0))
br label %30
53: ; preds = %48
%54 = call i32 @readnum(i64* %7)
%55 = icmp eq i32 %54, 0
br i1 %55, label %58, label %56
56: ; preds = %53
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.25, i64 0, i64 0))
br label %30
58: ; preds = %53
%59 = load i64, i64* %6
%60 = load i64, i64* %7
%61 = sub i64 %59, %60
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 %61)
br label %30
63: ; preds = %25
%64 = call i32 @readnum(i64* %7)
%65 = icmp eq i32 %64, 0
br i1 %65, label %68, label %66
66: ; preds = %63
%67 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.22, i64 0, i64 0))
br label %30
68: ; preds = %63
%69 = load i64, i64* %7
%70 = trunc i64 %69 to i32
%71 = call i32 @expand(i32** %4, i32 %1, i64 %19, i32 %70)
%72 = icmp eq i32 %71, -1
br i1 %72, label %73, label %75
73: ; preds = %68
%74 = load i32, i32* @EXIT_FAILURE
br label %218
75: ; preds = %68
%76 = load i64, i64* %7
%77 = add i64 %76, %19
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i64 %76)
br label %30
79: ; preds = %25
%80 = call i32 @readnum(i64* %6)
%81 = icmp eq i32 %80, 0
%82 = load i64, i64* %6
%83 = icmp ult i64 %82, %19
%84 = select i1 %81, i1 %83, i1 false
br i1 %84, label %87, label %85
85: ; preds = %79
%86 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.26, i64 0, i64 0))
br label %30
87: ; preds = %79
%88 = call i32 @readnum(i64* %7)
%89 = icmp eq i32 %88, 0
br i1 %89, label %92, label %90
90: ; preds = %87
%91 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.25, i64 0, i64 0))
br label %30
92: ; preds = %87
%93 = load i64, i64* %7
%94 = call i32 @read_fragment(i32* %15, i64 %93)
%95 = icmp eq i32 %94, -1
br i1 %95, label %96, label %98
96: ; preds = %92
%97 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.19, i64 0, i64 0))
br label %30
98: ; preds = %92
%99 = load i64, i64* %6
%100 = load i64, i64* %7
%101 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i64 %99, i64 %100)
%102 = load i32*, i32** %4
%103 = load i64, i64* %6
%104 = getelementptr inbounds i32, i32* %102, i64 %103
%105 = sub i64 %19, %103
%106 = load i64, i64* %7
%107 = call i32 @find_frag(i32* %104, i64 %105, i64 %103, i32* %15, i64 %106)
br label %30
108: ; preds = %25
%109 = call i32 @readnum(i64* %6)
%110 = icmp eq i32 %109, 0
%111 = load i64, i64* %6
%112 = icmp ult i64 %111, %19
%113 = select i1 %110, i1 %112, i1 false
br i1 %113, label %116, label %114
114: ; preds = %108
%115 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.26, i64 0, i64 0))
br label %30
116: ; preds = %108
%117 = call i32 @expand(i32** %4, i32 %1, i64 %19, i32 1)
%118 = icmp eq i32 %117, -1
br i1 %118, label %119, label %121
119: ; preds = %116
%120 = load i32, i32* @EXIT_FAILURE
br label %218
121: ; preds = %116
%122 = add i64 %19, 1
%123 = load i32*, i32** %4
%124 = load i64, i64* %6
%125 = getelementptr inbounds i32, i32* %123, i64 %124
%126 = sub i64 %122, %124
%127 = call i32 @shift_by(i32* %125, i64 %126)
%128 = icmp eq i32 %127, -1
br i1 %128, label %216, label %30
129: ; preds = %25
%130 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i64 %19)
br label %30
131: ; preds = %25, %25
%132 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.17, i64 0, i64 0))
br label %218
133: ; preds = %25
%134 = call i32 @readnum(i64* %6)
%135 = icmp eq i32 %134, 0
%136 = load i64, i64* %6
%137 = icmp ult i64 %136, %19
%138 = select i1 %135, i1 %137, i1 false
br i1 %138, label %141, label %139
139: ; preds = %133
%140 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.26, i64 0, i64 0))
br label %30
141: ; preds = %133
%142 = call i32 @readnum(i64* %7)
%143 = icmp eq i32 %142, 0
br i1 %143, label %144, label %149
144: ; preds = %141
%145 = load i64, i64* %6
%146 = load i64, i64* %7
%147 = add i64 %146, %145
%148 = icmp ugt i64 %147, %19
br i1 %148, label %149, label %152
149: ; preds = %144, %141
%150 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.22, i64 0, i64 0))
%151 = load i32, i32* @EXIT_FAILURE
br label %30
152: ; preds = %144
%153 = icmp eq i64 %146, 0
br i1 %153, label %154, label %156
154: ; preds = %152
%155 = sub i64 %19, %145
store i64 %155, i64* %7
br label %156
156: ; preds = %154, %152
%157 = phi i64 [ %155, %154 ], [ %146, %152 ]
%158 = load i32*, i32** %4
%159 = getelementptr inbounds i32, i32* %158, i64 %145
%160 = call i32 @printhex(i32* %159, i64 %157, i64 %145)
br label %30
161: ; preds = %25
%162 = call i32 @readnum(i64* %6)
%163 = icmp eq i32 %162, 0
%164 = load i64, i64* %6
%165 = icmp ult i64 %164, %19
%166 = select i1 %163, i1 %165, i1 false
br i1 %166, label %169, label %167
167: ; preds = %161
%168 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.26, i64 0, i64 0))
br label %30
169: ; preds = %161
%170 = call i32 @readnum(i64* %7)
%171 = icmp eq i32 %170, 0
br i1 %171, label %174, label %172
172: ; preds = %169
%173 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.25, i64 0, i64 0))
br label %30
174: ; preds = %169
%175 = load i64, i64* %7
%176 = call i32 @read_fragment(i32* %15, i64 %175)
%177 = icmp eq i32 %176, -1
br i1 %177, label %178, label %180
178: ; preds = %174
%179 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.19, i64 0, i64 0))
br label %30
180: ; preds = %174
%181 = load i64, i64* %6
%182 = load i64, i64* %7
%183 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0), i64 %181, i64 %182)
%184 = load i32*, i32** %4
%185 = load i64, i64* %6
%186 = getelementptr inbounds i32, i32* %184, i64 %185
%187 = sub i64 %19, %185
%188 = load i64, i64* %7
%189 = call i32 @find_frag(i32* %186, i64 %187, i64 %185, i32* %15, i64 %188)
%190 = icmp eq i32 %189, -1
br i1 %190, label %30, label %191
191: ; preds = %180, %191
%192 = phi i32 [ %201, %191 ], [ %189, %180 ]
%193 = add nuw nsw i32 %192, 1
%194 = sext i32 %193 to i64
%195 = load i64, i64* %6
%196 = add i64 %195, %194
store i64 %196, i64* %6
%197 = load i32*, i32** %4
%198 = getelementptr inbounds i32, i32* %197, i64 %196
%199 = sub i64 %19, %196
%200 = load i64, i64* %7
%201 = call i32 @find_frag(i32* %198, i64 %199, i64 %196, i32* %15, i64 %200)
%202 = icmp eq i32 %201, -1
br i1 %202, label %30, label %191
203: ; preds = %25
%204 = call i32 @readnum(i64* %6)
%205 = icmp eq i32 %204, 0
br i1 %205, label %206, label %209
206: ; preds = %203
%207 = load i64, i64* %6
%208 = icmp ugt i64 %19, %207
br i1 %208, label %211, label %209
209: ; preds = %206, %203
%210 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.26, i64 0, i64 0))
br label %30
211: ; preds = %206
%212 = load i32*, i32** %4
%213 = getelementptr inbounds i32, i32* %212, i64 %207
%214 = sub i64 %19, %207
%215 = call i32 @writehex(i32* %213, i64 %214)
br label %30
216: ; preds = %121
%217 = load i32, i32* @EXIT_FAILURE
br label %218
218: ; preds = %216, %73, %119, %131, %16
%219 = phi i32 [ %17, %16 ], [ %74, %73 ], [ %120, %119 ], [ %20, %131 ], [ %217, %216 ]
ret i32 %219
}