#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
unsigned int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
unsigned int ftell(int /*<<< orphan*/ *);
int fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  FILE *file1;
  char *fname1 = NULL, *progname = argv[0];
  unsigned char buffer1[32768];
  unsigned int flen1;
  unsigned int sum1, sum2;
  int swapped = -1;
  int readonly = 0;
  printf("CHKSUM64 V1.2   Copyright (C) 1997 Andreas Sterbenz "
         "(stan@sbox.tu-graz.ac.at)\n");
  printf("This program is released under the terms of the GNU public license. "
         "NO WARRANTY\n\n");
  {
    int i;
    for (i = 1; i < argc; i++) {
      if (argv[i][0] == '-') {
        char *c = argv[i] + 1;
        if (*(c + 1) != '\0')
          usage(progname);
        switch (*c) {
        case 'r':
          readonly = 1;
          break;
        case 'o':
          swapped = 0;
          break;
        case 's':
          swapped = 1;
          break;
        default:
          usage(progname);
        }
      } else {
        if (fname1 == NULL) {
          fname1 = argv[i];
        } else {
          usage(progname);
        }
      }
    }
  }
  if (fname1 == NULL)
    usage(progname);
  if ((readonly == 1) || (file1 = fopen(fname1, "r+b")) == NULL) {
    if ((file1 = fopen(fname1, "rb")) == NULL) {
      fprintf(stderr, "%s: Could not open file '%s' for reading.\n", progname,
              fname1);
      exit(1);
    } else {
      readonly = 1;
    }
  }
  if (fread(buffer1, 1, 12, file1) != 12) {
    fprintf(
        stderr,
        "%s: File is too short to be a N64 ROM Image, cannot checksum it.\n",
        progname);
    exit(1);
  }
  if (swapped == -1) {
    if (((((buffer1)[0 ^ (0)] & 0xffL) << 24) |
         (((buffer1)[1 ^ (0)] & 0xffL) << 16) |
         (((buffer1)[2 ^ (0)] & 0xffL) << 8) |
         (((buffer1)[3 ^ (0)] & 0xffL))) == 0x80371240) {
      swapped = 0;
    } else if (((((buffer1)[0 ^ (1)] & 0xffL) << 24) |
                (((buffer1)[1 ^ (1)] & 0xffL) << 16) |
                (((buffer1)[2 ^ (1)] & 0xffL) << 8) |
                (((buffer1)[3 ^ (1)] & 0xffL))) == 0x80371240) {
      swapped = 1;
    }
  }
  if (swapped != -1) {
    printf("The image '%s' is in %s format.\n", fname1,
           (swapped == 0) ? "original (not swapped)" : "V64 (byte-swapped)");
  } else {
    if ((buffer1[8] == 0x80) && (buffer1[9] != 0x80)) {
      swapped = 0;
    } else {
      if ((buffer1[8] != 0x80) && (buffer1[9] == 0x80)) {
        swapped = 1;
      }
    }
    if (swapped != -1) {
      printf("WARNING: I am not 100%% certain, but the image '%s' appears to "
             "be in %s format.\n",
             fname1,
             (swapped == 0) ? "original (not swapped)" : "V64 (byte-swapped)");
    } else {
      fprintf(stderr,
              "%s: Could not detect type of image '%s', use commandline to "
              "override.\n",
              progname, fname1);
      exit(1);
    }
  }
  fseek(file1, 0L, SEEK_END);
  flen1 = ftell(file1);
  if (flen1 < (0x1000 + 0x100000L)) {
    if (flen1 < 0x1000) {
      fprintf(
          stderr,
          "%s: File is too short to be a N64 ROM Image, cannot checksum it.\n",
          progname);
      exit(1);
    }
    if ((flen1 & 3) != 0) {
      fprintf(stderr,
              "%s: File length is not a multiple of four, cannot calculate "
              "checksum.\n",
              progname);
      exit(1);
    }
    printf("File is only %ld bytes long, remaining %ld to be checksummed will "
           "be assumed 0.\n",
           flen1, (0x1000 + 0x100000L) - flen1);
  }
  fseek(file1, 0x1000, SEEK_SET);
  {
    unsigned int i;
    unsigned int c1, k1, k2;
    unsigned int t1, t2, t3, t4;
    unsigned int t5, t6;
    unsigned int n;
    unsigned clen = 0x100000L;
    unsigned rlen = flen1 - 0x1000;
    t1 = 0xf8ca4ddc;
    t2 = 0xf8ca4ddc;
    t3 = 0xf8ca4ddc;
    t4 = 0xf8ca4ddc;
    t5 = 0xf8ca4ddc;
    t6 = 0xf8ca4ddc;
    for (;;) {
      if (rlen > 0) {
        n = fread(buffer1, 1, ((32768) < (clen) ? (32768) : (clen)), file1);
        if ((n & 0x03) != 0) {
          n += fread(buffer1 + n, 1, 4 - (n & 3), file1);
        }
      } else {
        n = ((32768) < (clen) ? (32768) : (clen));
      }
      if ((n == 0) || ((n & 3) != 0)) {
        if ((clen != 0) || (n != 0)) {
          fprintf(stderr, "WARNING: Short read, checksum may be incorrect.\n");
        }
        break;
      }
      for (i = 0; i < n; i += 4) {
        c1 = ((((&buffer1[i])[0 ^ (swapped)] & 0xffL) << 24) |
              (((&buffer1[i])[1 ^ (swapped)] & 0xffL) << 16) |
              (((&buffer1[i])[2 ^ (swapped)] & 0xffL) << 8) |
              (((&buffer1[i])[3 ^ (swapped)] & 0xffL)));
        k1 = t6 + c1;
        if (k1 < t6)
          t4++;
        t6 = k1;
        t3 ^= c1;
        k2 = c1 & 0x1f;
        k1 = (((c1) << (k2)) | ((c1) >> (32 - (k2))));
        t5 += k1;
        if (c1 < t2) {
          t2 ^= k1;
        } else {
          t2 ^= t6 ^ c1;
        }
        t1 += c1 ^ t5;
      }
      if (rlen > 0) {
        rlen -= n;
        if (rlen <= 0)
          memset(buffer1, 0, 32768);
      }
      clen -= n;
    }
    sum1 = t6 ^ t4 ^ t3;
    sum2 = t5 ^ t2 ^ t1;
  }
  (&buffer1[0])[0 ^ (0)] = ((sum1) >> 24) & 0xff;
  (&buffer1[0])[1 ^ (0)] = ((sum1) >> 16) & 0xff;
  (&buffer1[0])[2 ^ (0)] = ((sum1) >> 8) & 0xff;
  (&buffer1[0])[3 ^ (0)] = ((sum1)) & 0xff;
  ;
  (&buffer1[4])[0 ^ (0)] = ((sum2) >> 24) & 0xff;
  (&buffer1[4])[1 ^ (0)] = ((sum2) >> 16) & 0xff;
  (&buffer1[4])[2 ^ (0)] = ((sum2) >> 8) & 0xff;
  (&buffer1[4])[3 ^ (0)] = ((sum2)) & 0xff;
  ;
  fseek(file1, 0x10, SEEK_SET);
  fread(buffer1 + 8, 1, 8, file1);
  printf("Old Checksum:        ");
  printf("%02X %02X %02X %02X  ", buffer1[8 ^ swapped], buffer1[9 ^ swapped],
         buffer1[10 ^ swapped], buffer1[11 ^ swapped]);
  printf("%02X %02X %02X %02X\n", buffer1[12 ^ swapped], buffer1[13 ^ swapped],
         buffer1[14 ^ swapped], buffer1[15 ^ swapped]);
  printf("Calculated Checksum: ");
  printf("%02X %02X %02X %02X  ", buffer1[0], buffer1[1], buffer1[2],
         buffer1[3]);
  printf("%02X %02X %02X %02X\n", buffer1[4], buffer1[5], buffer1[6],
         buffer1[7]);
  if (readonly == 0) {
    fseek(file1, 0x10, SEEK_SET);
    (&buffer1[16])[0 ^ (swapped)] = ((sum1) >> 24) & 0xff;
    (&buffer1[16])[1 ^ (swapped)] = ((sum1) >> 16) & 0xff;
    (&buffer1[16])[2 ^ (swapped)] = ((sum1) >> 8) & 0xff;
    (&buffer1[16])[3 ^ (swapped)] = ((sum1)) & 0xff;
    ;
    (&buffer1[20])[0 ^ (swapped)] = ((sum2) >> 24) & 0xff;
    (&buffer1[20])[1 ^ (swapped)] = ((sum2) >> 16) & 0xff;
    (&buffer1[20])[2 ^ (swapped)] = ((sum2) >> 8) & 0xff;
    (&buffer1[20])[3 ^ (swapped)] = ((sum2)) & 0xff;
    ;
    if (fwrite(buffer1 + 16, 1, 8, file1) != 8) {
      fprintf(stderr, "%s: Could not write new checksum to file '%s'!\n",
              progname, fname1);
      exit(1);
    } else {
      printf("New checksum successfully written.\n");
    }
  } else {
    printf("File opened in read-only mode, new checksum not written.\n");
  }
  fclose(file1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
movl   $0xffffffff,-0x8040(%rbp)
ff ff ff
movl   $0x0,-0x8044(%rbp)
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x8048(%rbp)
mov    -0x8048(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1342 <main+0x192>
mov    -0x10(%rbp),%rax
movslq -0x8048(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    12f8 <main+0x148>
mov    -0x10(%rbp),%rax
movslq -0x8048(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
add    $0x1,%rax
mov    %rax,-0x8050(%rbp)
mov    -0x8050(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     1277 <main+0xc7>
mov    -0x28(%rbp),%rdi
call   10a0 <usage@plt>
mov    -0x8050(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x8088(%rbp)
sub    $0x6f,%eax
je     12cc <main+0x11c>
jmp    1295 <main+0xe5>
mov    -0x8088(%rbp),%eax
sub    $0x72,%eax
je     12bd <main+0x10d>
jmp    12a9 <main+0xf9>
mov    -0x8088(%rbp),%eax
sub    $0x73,%eax
je     12db <main+0x12b>
jmp    12ea <main+0x13a>
movl   $0x1,-0x8044(%rbp)
jmp    12f3 <main+0x143>
movl   $0x0,-0x8040(%rbp)
jmp    12f3 <main+0x143>
movl   $0x1,-0x8040(%rbp)
jmp    12f3 <main+0x143>
mov    -0x28(%rbp),%rdi
call   10a0 <usage@plt>
jmp    1329 <main+0x179>
cmpq   $0x0,-0x20(%rbp)
jne    131b <main+0x16b>
mov    -0x10(%rbp),%rax
movslq -0x8048(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
jmp    1324 <main+0x174>
mov    -0x28(%rbp),%rdi
call   10a0 <usage@plt>
jmp    1329 <main+0x179>
jmp    132e <main+0x17e>
mov    -0x8048(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8048(%rbp)
jmp    1216 <main+0x66>
cmpq   $0x0,-0x20(%rbp)
jne    1356 <main+0x1a6>
mov    -0x28(%rbp),%rdi
call   10a0 <usage@plt>
cmpl   $0x1,-0x8044(%rbp)
je     1381 <main+0x1d1>
mov    -0x20(%rbp),%rdi
lea    0xd33(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    13d7 <main+0x227>
mov    -0x20(%rbp),%rdi
lea    0xd19(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    13c8 <main+0x218>
mov    0x2c32(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xcf1(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
movl   $0x1,-0x8044(%rbp)
jmp    13d7 <main+0x227>
lea    -0x8030(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0xc,%edx
call   1030 <fread@plt>
cmp    $0xc,%eax
je     141f <main+0x26f>
mov    0x2bd7(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xcc5(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
cmpl   $0xffffffff,-0x8040(%rbp)
jne    1503 <main+0x353>
movzbl -0x8030(%rbp),%eax
and    $0xff,%rax
shl    $0x18,%rax
movzbl -0x802f(%rbp),%ecx
and    $0xff,%rcx
shl    $0x10,%rcx
or     %rcx,%rax
movzbl -0x802e(%rbp),%ecx
and    $0xff,%rcx
shl    $0x8,%rcx
or     %rcx,%rax
movzbl -0x802d(%rbp),%ecx
and    $0xff,%rcx
or     %rcx,%rax
mov    $0x80371240,%ecx
cmp    %rcx,%rax
jne    1495 <main+0x2e5>
movl   $0x0,-0x8040(%rbp)
jmp    14fe <main+0x34e>
movzbl -0x802f(%rbp),%eax
and    $0xff,%rax
shl    $0x18,%rax
movzbl -0x8030(%rbp),%ecx
and    $0xff,%rcx
shl    $0x10,%rcx
or     %rcx,%rax
movzbl -0x802d(%rbp),%ecx
and    $0xff,%rcx
shl    $0x8,%rcx
or     %rcx,%rax
movzbl -0x802e(%rbp),%ecx
and    $0xff,%rcx
or     %rcx,%rax
mov    $0x80371240,%ecx
cmp    %rcx,%rax
jne    14f9 <main+0x349>
movl   $0x1,-0x8040(%rbp)
jmp    14fe <main+0x34e>
jmp    1503 <main+0x353>
cmpl   $0xffffffff,-0x8040(%rbp)
je     1542 <main+0x392>
mov    -0x20(%rbp),%rsi
mov    -0x8040(%rbp),%ecx
lea    0xc2c(%rip),%rdx
lea    0xc0e(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rdx
lea    0xbdf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1615 <main+0x465>
movzbl -0x8028(%rbp),%eax
cmp    $0x80,%eax
jne    1575 <main+0x3c5>
movzbl -0x8027(%rbp),%eax
cmp    $0x80,%eax
je     1575 <main+0x3c5>
movl   $0x0,-0x8040(%rbp)
jmp    15a8 <main+0x3f8>
movzbl -0x8028(%rbp),%eax
cmp    $0x80,%eax
je     15a3 <main+0x3f3>
movzbl -0x8027(%rbp),%eax
cmp    $0x80,%eax
jne    15a3 <main+0x3f3>
movl   $0x1,-0x8040(%rbp)
jmp    15a8 <main+0x3f8>
cmpl   $0xffffffff,-0x8040(%rbp)
je     15e7 <main+0x437>
mov    -0x20(%rbp),%rsi
mov    -0x8040(%rbp),%ecx
lea    0xb87(%rip),%rdx
lea    0xb69(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rdx
lea    0xb85(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1610 <main+0x460>
mov    0x29ea(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xbb2(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
jmp    1615 <main+0x465>
mov    -0x18(%rbp),%rdi
mov    0x29c8(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <fseek@plt>
mov    -0x18(%rbp),%rdi
call   1080 <ftell@plt>
mov    %eax,-0x8034(%rbp)
mov    -0x8034(%rbp),%eax
cmp    $0x101000,%rax
jge    16d8 <main+0x528>
cmpl   $0x1000,-0x8034(%rbp)
jae    167f <main+0x4cf>
mov    0x2977(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xa65(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x8034(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     16b6 <main+0x506>
mov    0x2940(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xb53(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x8034(%rbp),%esi
mov    -0x8034(%rbp),%eax
mov    $0x101000,%edx
sub    %rax,%rdx
lea    0xb6e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    0x28ed(%rip),%rax
mov    (%rax),%edx
mov    $0x1000,%esi
call   1090 <fseek@plt>
movl   $0x100000,-0x8080(%rbp)
mov    -0x8034(%rbp),%eax
sub    $0x1000,%eax
mov    %eax,-0x8084(%rbp)
movl   $0xf8ca4ddc,-0x8064(%rbp)
4d ca f8
movl   $0xf8ca4ddc,-0x8068(%rbp)
4d ca f8
movl   $0xf8ca4ddc,-0x806c(%rbp)
4d ca f8
movl   $0xf8ca4ddc,-0x8070(%rbp)
4d ca f8
movl   $0xf8ca4ddc,-0x8074(%rbp)
4d ca f8
movl   $0xf8ca4ddc,-0x8078(%rbp)
4d ca f8
cmpl   $0x0,-0x8084(%rbp)
jbe    1800 <main+0x650>
lea    -0x8030(%rbp),%rax
mov    %rax,-0x8090(%rbp)
mov    $0x8000,%eax
cmp    -0x8080(%rbp),%eax
jae    1782 <main+0x5d2>
mov    $0x8000,%eax
mov    %eax,-0x8094(%rbp)
jmp    178e <main+0x5de>
mov    -0x8080(%rbp),%eax
mov    %eax,-0x8094(%rbp)
mov    -0x8090(%rbp),%rdi
mov    -0x8094(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %eax,-0x807c(%rbp)
mov    -0x807c(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     17fb <main+0x64b>
lea    -0x8030(%rbp),%rdi
mov    -0x807c(%rbp),%eax
add    %rax,%rdi
mov    -0x807c(%rbp),%eax
and    $0x3,%eax
mov    $0x4,%edx
sub    %eax,%edx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
add    -0x807c(%rbp),%eax
mov    %eax,-0x807c(%rbp)
jmp    1839 <main+0x689>
mov    $0x8000,%eax
cmp    -0x8080(%rbp),%eax
jae    1821 <main+0x671>
mov    $0x8000,%eax
mov    %eax,-0x8098(%rbp)
jmp    182d <main+0x67d>
mov    -0x8080(%rbp),%eax
mov    %eax,-0x8098(%rbp)
mov    -0x8098(%rbp),%eax
mov    %eax,-0x807c(%rbp)
cmpl   $0x0,-0x807c(%rbp)
je     1858 <main+0x6a8>
mov    -0x807c(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     188e <main+0x6de>
cmpl   $0x0,-0x8080(%rbp)
jne    1872 <main+0x6c2>
cmpl   $0x0,-0x807c(%rbp)
je     1889 <main+0x6d9>
mov    0x275f(%rip),%rax
mov    (%rax),%edi
lea    0xa0e(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1ad1 <main+0x921>
movl   $0x0,-0x8054(%rbp)
mov    -0x8054(%rbp),%eax
cmp    -0x807c(%rbp),%eax
jae    1a72 <main+0x8c2>
mov    -0x8054(%rbp),%eax
mov    %eax,%ecx
lea    -0x8030(%rbp),%rax
add    %rcx,%rax
mov    -0x8040(%rbp),%ecx
xor    $0x0,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
and    $0xff,%rax
shl    $0x18,%rax
mov    -0x8054(%rbp),%ecx
mov    %ecx,%edx
lea    -0x8030(%rbp),%rcx
add    %rdx,%rcx
mov    -0x8040(%rbp),%edx
xor    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
and    $0xff,%rcx
shl    $0x10,%rcx
or     %rcx,%rax
mov    -0x8054(%rbp),%ecx
mov    %ecx,%edx
lea    -0x8030(%rbp),%rcx
add    %rdx,%rcx
mov    -0x8040(%rbp),%edx
xor    $0x2,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
and    $0xff,%rcx
shl    $0x8,%rcx
or     %rcx,%rax
mov    -0x8054(%rbp),%ecx
mov    %ecx,%edx
lea    -0x8030(%rbp),%rcx
add    %rdx,%rcx
mov    -0x8040(%rbp),%edx
xor    $0x3,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
and    $0xff,%rcx
or     %rcx,%rax
mov    %eax,-0x8058(%rbp)
mov    -0x8078(%rbp),%eax
add    -0x8058(%rbp),%eax
mov    %eax,-0x805c(%rbp)
mov    -0x805c(%rbp),%eax
cmp    -0x8078(%rbp),%eax
jae    199b <main+0x7eb>
mov    -0x8070(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8070(%rbp)
mov    -0x805c(%rbp),%eax
mov    %eax,-0x8078(%rbp)
mov    -0x8058(%rbp),%eax
xor    -0x806c(%rbp),%eax
mov    %eax,-0x806c(%rbp)
mov    -0x8058(%rbp),%eax
and    $0x1f,%eax
mov    %eax,-0x8060(%rbp)
mov    -0x8058(%rbp),%eax
mov    -0x8060(%rbp),%ecx
shl    %cl,%eax
mov    -0x8058(%rbp),%edx
mov    $0x20,%ecx
sub    -0x8060(%rbp),%ecx
shr    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x805c(%rbp)
mov    -0x805c(%rbp),%eax
add    -0x8074(%rbp),%eax
mov    %eax,-0x8074(%rbp)
mov    -0x8058(%rbp),%eax
cmp    -0x8068(%rbp),%eax
jae    1a2e <main+0x87e>
mov    -0x805c(%rbp),%eax
xor    -0x8068(%rbp),%eax
mov    %eax,-0x8068(%rbp)
jmp    1a46 <main+0x896>
mov    -0x8078(%rbp),%eax
xor    -0x8058(%rbp),%eax
xor    -0x8068(%rbp),%eax
mov    %eax,-0x8068(%rbp)
mov    -0x8058(%rbp),%eax
xor    -0x8074(%rbp),%eax
add    -0x8064(%rbp),%eax
mov    %eax,-0x8064(%rbp)
mov    -0x8054(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x8054(%rbp)
jmp    1898 <main+0x6e8>
cmpl   $0x0,-0x8084(%rbp)
jbe    1ab8 <main+0x908>
mov    -0x807c(%rbp),%ecx
mov    -0x8084(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8084(%rbp)
cmpl   $0x0,-0x8084(%rbp)
ja     1ab3 <main+0x903>
lea    -0x8030(%rbp),%rdi
xor    %esi,%esi
mov    $0x8000,%edx
call   1060 <memset@plt>
jmp    1ab8 <main+0x908>
mov    -0x807c(%rbp),%ecx
mov    -0x8080(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8080(%rbp)
jmp    1746 <main+0x596>
mov    -0x8078(%rbp),%eax
xor    -0x8070(%rbp),%eax
xor    -0x806c(%rbp),%eax
mov    %eax,-0x8038(%rbp)
mov    -0x8074(%rbp),%eax
xor    -0x8068(%rbp),%eax
xor    -0x8064(%rbp),%eax
mov    %eax,-0x803c(%rbp)
mov    -0x8038(%rbp),%eax
shr    $0x18,%eax
and    $0xff,%eax
mov    %al,-0x8030(%rbp)
mov    -0x8038(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %al,-0x802f(%rbp)
mov    -0x8038(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,-0x802e(%rbp)
mov    -0x8038(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x802d(%rbp)
mov    -0x803c(%rbp),%eax
shr    $0x18,%eax
and    $0xff,%eax
mov    %al,-0x802c(%rbp)
mov    -0x803c(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %al,-0x802b(%rbp)
mov    -0x803c(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,-0x802a(%rbp)
mov    -0x803c(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x8029(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x242a(%rip),%rax
mov    (%rax),%edx
mov    $0x10,%esi
call   1090 <fseek@plt>
lea    -0x8030(%rbp),%rdi
add    $0x8,%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x8,%edx
call   1030 <fread@plt>
lea    0x6ea(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8040(%rbp),%eax
xor    $0x8,%eax
cltq
movzbl -0x8030(%rbp,%rax,1),%esi
ff
mov    -0x8040(%rbp),%eax
xor    $0x9,%eax
cltq
movzbl -0x8030(%rbp,%rax,1),%edx
ff
mov    -0x8040(%rbp),%eax
xor    $0xa,%eax
cltq
movzbl -0x8030(%rbp,%rax,1),%ecx
ff
mov    -0x8040(%rbp),%eax
xor    $0xb,%eax
cltq
movzbl -0x8030(%rbp,%rax,1),%r8d
ff ff
lea    0x6a5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8040(%rbp),%eax
xor    $0xc,%eax
cltq
movzbl -0x8030(%rbp,%rax,1),%esi
ff
mov    -0x8040(%rbp),%eax
xor    $0xd,%eax
cltq
movzbl -0x8030(%rbp,%rax,1),%edx
ff
mov    -0x8040(%rbp),%eax
xor    $0xe,%eax
cltq
movzbl -0x8030(%rbp,%rax,1),%ecx
ff
mov    -0x8040(%rbp),%eax
xor    $0xf,%eax
cltq
movzbl -0x8030(%rbp,%rax,1),%r8d
ff ff
lea    0x660(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0x667(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movzbl -0x8030(%rbp),%esi
movzbl -0x802f(%rbp),%edx
movzbl -0x802e(%rbp),%ecx
movzbl -0x802d(%rbp),%r8d
ff
lea    0x611(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movzbl -0x802c(%rbp),%esi
movzbl -0x802b(%rbp),%edx
movzbl -0x802a(%rbp),%ecx
movzbl -0x8029(%rbp),%r8d
ff
lea    0x5fc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x8044(%rbp)
jne    1e89 <main+0xcd9>
mov    -0x18(%rbp),%rdi
mov    0x22c0(%rip),%rax
mov    (%rax),%edx
mov    $0x10,%esi
call   1090 <fseek@plt>
mov    -0x8038(%rbp),%eax
shr    $0x18,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8040(%rbp),%eax
xor    $0x0,%eax
cltq
mov    %cl,-0x8020(%rbp,%rax,1)
mov    -0x8038(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8040(%rbp),%eax
xor    $0x1,%eax
cltq
mov    %cl,-0x8020(%rbp,%rax,1)
mov    -0x8038(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8040(%rbp),%eax
xor    $0x2,%eax
cltq
mov    %cl,-0x8020(%rbp,%rax,1)
mov    -0x8038(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8040(%rbp),%eax
xor    $0x3,%eax
cltq
mov    %cl,-0x8020(%rbp,%rax,1)
mov    -0x803c(%rbp),%eax
shr    $0x18,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8040(%rbp),%eax
xor    $0x0,%eax
cltq
mov    %cl,-0x801c(%rbp,%rax,1)
mov    -0x803c(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8040(%rbp),%eax
xor    $0x1,%eax
cltq
mov    %cl,-0x801c(%rbp,%rax,1)
mov    -0x803c(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8040(%rbp),%eax
xor    $0x2,%eax
cltq
mov    %cl,-0x801c(%rbp,%rax,1)
mov    -0x803c(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8040(%rbp),%eax
xor    $0x3,%eax
cltq
mov    %cl,-0x801c(%rbp,%rax,1)
lea    -0x8030(%rbp),%rdi
add    $0x10,%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x8,%edx
call   10d0 <fwrite@plt>
cmp    $0x8,%eax
je     1e76 <main+0xcc6>
mov    0x2184(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0x4b3(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
lea    0x4cb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1e97 <main+0xce7>
lea    0x4dc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x80a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x8078,%rsp
mov    %rsi,%r12
mov    %edi,%ebp
mov    (%rsi),%rax
mov    %rax,0x10(%rsp)
lea    0x10c2(%rip),%rdi
call   1030 <puts@plt>
lea    0x1104(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x2,%ebp
jl     1284 <main+0xc4>
mov    %ebp,%r13d
xor    %eax,%eax
mov    %rax,0x8(%rsp)
mov    $0xffffffff,%r14d
mov    $0x1,%ebx
xor    %r15d,%r15d
jmp    123b <main+0x7b>
nopl   0x0(%rax)
cmpq   $0x0,0x8(%rsp)
je     126d <main+0xad>
mov    0x10(%rsp),%rdi
call   10b0 <usage@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
je     128f <main+0xcf>
mov    (%r12,%rbx,8),%rbp
cmpb   $0x2d,0x0(%rbp)
jne    1220 <main+0x60>
cmpb   $0x0,0x2(%rbp)
je     1255 <main+0x95>
mov    0x10(%rsp),%rdi
call   10b0 <usage@plt>
movsbl 0x1(%rbp),%eax
cmp    $0x73,%eax
je     1274 <main+0xb4>
cmp    $0x72,%eax
je     127c <main+0xbc>
cmp    $0x6f,%eax
jne    1228 <main+0x68>
xor    %r14d,%r14d
jmp    1232 <main+0x72>
mov    %rbp,0x8(%rsp)
jmp    1232 <main+0x72>
mov    $0x1,%r14d
jmp    1232 <main+0x72>
mov    $0x1,%r15d
jmp    1232 <main+0x72>
xor    %r15d,%r15d
mov    $0xffffffff,%r14d
jmp    129f <main+0xdf>
cmpq   $0x0,0x8(%rsp)
je     129f <main+0xdf>
cmp    $0x1,%r15d
jne    12b6 <main+0xf6>
jmp    12d4 <main+0x114>
mov    0x10(%rsp),%rdi
call   10b0 <usage@plt>
xor    %eax,%eax
mov    %rax,0x8(%rsp)
cmp    $0x1,%r15d
je     12d4 <main+0x114>
lea    0xd43(%rip),%rsi
mov    0x8(%rsp),%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     12d4 <main+0x114>
mov    %rax,%r12
mov    $0x1,%r15b
jmp    12f4 <main+0x134>
lea    0xd29(%rip),%rsi
mov    0x8(%rsp),%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     18bf <main+0x6ff>
mov    %rax,%r12
xor    %r15d,%r15d
lea    0x70(%rsp),%rdi
mov    $0x1,%esi
mov    $0xc,%edx
mov    %r12,%rcx
call   1040 <fread@plt>
cmp    $0xc,%eax
jne    18ad <main+0x6ed>
test   %r14d,%r14d
je     135e <main+0x19e>
lea    0xd8c(%rip),%rdx
cmp    $0xffffffff,%r14d
jne    1368 <main+0x1a8>
mov    $0x80371240,%r8d
movzbl 0x70(%rsp),%ecx
mov    %ecx,%edi
shl    $0x18,%edi
movzbl 0x71(%rsp),%esi
mov    %esi,%ebp
shl    $0x10,%ebp
or     %edi,%ebp
movzbl 0x72(%rsp),%eax
mov    %eax,%edi
shl    $0x8,%edi
or     %ebp,%edi
movzbl 0x73(%rsp),%ebp
add    %ebp,%edi
cmp    %r8d,%edi
jne    1838 <main+0x678>
lea    0xd30(%rip),%rdx
xor    %r14d,%r14d
lea    0xd05(%rip),%rdi
mov    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2c66(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    %r12,%rdi
call   1090 <ftell@plt>
mov    %eax,%ebx
cmp    $0x100fff,%eax
ja     13d1 <main+0x211>
cmp    $0xfff,%ebx
jbe    18ad <main+0x6ed>
mov    %rbx,%rsi
test   $0x3,%sil
jne    18d1 <main+0x711>
mov    $0x101000,%edx
sub    %rsi,%rdx
lea    0xdd7(%rip),%rdi
xor    %eax,%eax
mov    %rsi,%rbx
call   1060 <printf@plt>
mov    %r15d,0x44(%rsp)
mov    0x2bf3(%rip),%rbp
mov    0x0(%rbp),%edx
mov    %r12,0x28(%rsp)
mov    %r12,%rdi
mov    $0x1000,%esi
call   10a0 <fseek@plt>
mov    %rbp,%r8
add    $0xfffff000,%ebx
movslq %r14d,%rax
mov    %rax,0x68(%rsp)
mov    %rax,%rcx
xor    $0x1,%rcx
mov    %rax,%rdx
xor    $0x2,%rdx
mov    %rax,%rsi
xor    $0x3,%rsi
mov    %rsi,0x50(%rsp)
lea    (%rsp,%rsi,1),%r10
add    $0x70,%r10
mov    %rdx,0x58(%rsp)
lea    0x70(%rsp,%rdx,1),%r11
mov    %rcx,0x60(%rsp)
lea    0x70(%rsp,%rcx,1),%rcx
mov    %rcx,0x38(%rsp)
lea    0x70(%rsp,%rax,1),%rax
mov    %rax,0x30(%rsp)
mov    $0x100000,%eax
mov    %rbx,%r9
mov    $0xf8ca4ddc,%r12d
mov    $0xf8ca4ddc,%r15d
mov    $0xf8ca4ddc,%ebx
mov    $0xf8ca4ddc,%r14d
mov    $0xf8ca4ddc,%r13d
mov    $0xf8ca4ddc,%ebp
mov    %r10,0x20(%rsp)
mov    %r11,0x18(%rsp)
jmp    1482 <main+0x2c2>
xchg   %ax,%ax
sub    %ecx,%eax
cmp    $0x8000,%eax
mov    $0x8000,%edx
mov    %eax,0x4(%rsp)
cmovb  %eax,%edx
test   %r9d,%r9d
je     14f6 <main+0x336>
mov    %r9,0x48(%rsp)
lea    0x70(%rsp),%rdi
mov    $0x1,%esi
mov    0x28(%rsp),%rcx
call   1040 <fread@plt>
mov    %eax,%edx
and    $0x3,%eax
je     14e0 <main+0x320>
mov    %edx,%ecx
lea    (%rsp,%rcx,1),%rdi
add    $0x70,%rdi
mov    %edx,(%rsp)
mov    $0x4,%edx
sub    %eax,%edx
mov    $0x1,%esi
mov    0x28(%rsp),%rcx
call   1040 <fread@plt>
mov    (%rsp),%edx
add    %eax,%edx
mov    0x2ae9(%rip),%r8
mov    0x48(%rsp),%r9
mov    0x20(%rsp),%r10
mov    0x18(%rsp),%r11
test   %edx,%edx
je     15d1 <main+0x411>
mov    %edx,%eax
and    $0x3,%eax
jne    15d1 <main+0x411>
mov    %edx,(%rsp)
mov    %edx,%eax
xor    %edx,%edx
mov    0x30(%rsp),%rcx
movzbl (%rcx,%rdx,1),%ecx
shl    $0x18,%ecx
mov    0x38(%rsp),%rsi
movzbl (%rsi,%rdx,1),%esi
shl    $0x10,%esi
or     %ecx,%esi
movzbl (%r11,%rdx,1),%edi
shl    $0x8,%edi
or     %esi,%edi
movzbl (%r10,%rdx,1),%ecx
or     %ecx,%edi
add    %edi,%ebp
adc    $0x0,%r14d
mov    %edi,%esi
rol    %cl,%esi
mov    %r15d,%ecx
xor    %edi,%ebx
add    %esi,%r13d
mov    %ebp,%r15d
xor    %edi,%r15d
cmp    %ecx,%edi
cmovb  %esi,%r15d
xor    %ecx,%r15d
xor    %r13d,%edi
add    %edi,%r12d
add    $0x4,%rdx
cmp    %rax,%rdx
jb     1510 <main+0x350>
test   %r9d,%r9d
je     15c0 <main+0x400>
mov    (%rsp),%ecx
sub    %ecx,%r9d
mov    0x4(%rsp),%eax
jne    1480 <main+0x2c0>
lea    0x70(%rsp),%rdi
xor    %esi,%esi
mov    $0x8000,%edx
call   1070 <memset@plt>
mov    (%rsp),%ecx
mov    0x4(%rsp),%eax
mov    0x18(%rsp),%r11
mov    0x20(%rsp),%r10
xor    %r9d,%r9d
mov    0x2a24(%rip),%r8
jmp    1480 <main+0x2c0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %r9d,%r9d
mov    0x4(%rsp),%eax
mov    (%rsp),%ecx
sub    %ecx,%eax
jmp    1482 <main+0x2c2>
or     %edx,0x4(%rsp)
je     15f5 <main+0x435>
mov    0x29fa(%rip),%rax
mov    (%rax),%edi
lea    0xc08(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x29db(%rip),%r8
xor    %ebx,%r14d
xor    %ebp,%r14d
xor    %r12d,%r15d
xor    %r13d,%r15d
mov    %r14d,%eax
shr    $0x18,%eax
mov    %eax,0x38(%rsp)
mov    %al,0x70(%rsp)
mov    %r14d,%eax
shr    $0x10,%eax
mov    %eax,0x30(%rsp)
mov    %al,0x71(%rsp)
mov    %r14d,%eax
shr    $0x8,%eax
mov    %eax,(%rsp)
mov    %al,0x72(%rsp)
mov    %r14b,0x73(%rsp)
mov    %r15d,%eax
shr    $0x18,%eax
mov    %eax,0x4(%rsp)
mov    %al,0x74(%rsp)
mov    %r15d,%ebx
shr    $0x10,%ebx
mov    %bl,0x75(%rsp)
mov    %r15d,%ebp
shr    $0x8,%ebp
mov    %bpl,0x76(%rsp)
mov    %r15b,0x77(%rsp)
mov    (%r8),%edx
mov    0x28(%rsp),%r12
mov    %r12,%rdi
mov    $0x10,%esi
call   10a0 <fseek@plt>
lea    0x78(%rsp),%rdi
mov    $0x1,%esi
mov    $0x8,%edx
mov    %r12,%rcx
call   1040 <fread@plt>
lea    0xb96(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x68(%rsp),%r13
mov    %r13,%rax
xor    $0x8,%rax
movzbl 0x70(%rsp,%rax,1),%esi
mov    %r13,%rax
xor    $0x9,%rax
movzbl 0x70(%rsp,%rax,1),%edx
mov    %r13,%rax
xor    $0xa,%rax
movzbl 0x70(%rsp,%rax,1),%ecx
mov    %r13,%rax
xor    $0xb,%rax
movzbl 0x70(%rsp,%rax,1),%r8d
lea    0xb68(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r13,%rax
xor    $0xc,%rax
movzbl 0x70(%rsp,%rax,1),%esi
mov    %r13,%rax
xor    $0xd,%rax
movzbl 0x70(%rsp,%rax,1),%edx
mov    %r13,%rax
xor    $0xe,%rax
movzbl 0x70(%rsp,%rax,1),%ecx
mov    %r13,%rax
xor    $0xf,%rax
movzbl 0x70(%rsp,%rax,1),%r8d
lea    0xb3f(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xb46(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movzbl 0x70(%rsp),%esi
movzbl 0x71(%rsp),%edx
movzbl 0x72(%rsp),%ecx
movzbl 0x73(%rsp),%r8d
lea    0xaf8(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movzbl 0x74(%rsp),%esi
movzbl 0x75(%rsp),%edx
movzbl 0x76(%rsp),%ecx
movzbl 0x77(%rsp),%r8d
lea    0xaeb(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpb   $0x0,0x44(%rsp)
je     1810 <main+0x650>
mov    0x2856(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
mov    $0x10,%esi
call   10a0 <fseek@plt>
lea    0x80(%rsp),%rdi
mov    0x38(%rsp),%eax
mov    %al,0x80(%rsp,%r13,1)
mov    0x60(%rsp),%rax
mov    0x30(%rsp),%ecx
mov    %cl,0x80(%rsp,%rax,1)
mov    0x58(%rsp),%rcx
mov    (%rsp),%edx
mov    %dl,0x80(%rsp,%rcx,1)
mov    0x50(%rsp),%rdx
mov    %r14b,0x80(%rsp,%rdx,1)
mov    0x4(%rsp),%esi
mov    %sil,0x84(%rsp,%r13,1)
mov    %bl,0x84(%rsp,%rax,1)
mov    %bpl,0x84(%rsp,%rcx,1)
mov    %r15b,0x84(%rsp,%rdx,1)
mov    $0x1,%esi
mov    $0x8,%edx
mov    %r12,%rcx
call   10e0 <fwrite@plt>
cmp    $0x8,%eax
jne    18f7 <main+0x737>
lea    0xb71(%rip),%rdi
jmp    1817 <main+0x657>
lea    0xb2f(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x8078,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
shl    $0x18,%rsi
shl    $0x10,%rcx
or     %rsi,%rcx
shl    $0x8,%rbp
or     %rax,%rcx
or     %rbp,%rcx
mov    $0x1,%r14d
cmp    %r8,%rcx
je     1368 <main+0x1a8>
mov    0x78(%rsp),%cl
mov    0x79(%rsp),%al
cmp    $0x80,%cl
jne    1883 <main+0x6c3>
cmp    $0x80,%al
je     1883 <main+0x6c3>
xor    %r14d,%r14d
lea    0x81e(%rip),%rdx
lea    0x841(%rip),%rdi
jmp    136f <main+0x1af>
cmp    $0x80,%cl
je     1922 <main+0x762>
cmp    $0x80,%al
jne    1922 <main+0x762>
lea    0x811(%rip),%rdx
mov    $0x1,%r14d
lea    0x817(%rip),%rdi
jmp    136f <main+0x1af>
mov    0x2724(%rip),%rax
mov    (%rax),%edi
lea    0x775(%rip),%rsi
jmp    18e1 <main+0x721>
mov    0x2712(%rip),%rax
mov    (%rax),%edi
lea    0x738(%rip),%rsi
jmp    1907 <main+0x747>
mov    0x2700(%rip),%rax
mov    (%rax),%edi
lea    0x876(%rip),%rsi
mov    0x10(%rsp),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x26da(%rip),%rax
mov    (%rax),%edi
lea    0x970(%rip),%rsi
mov    0x10(%rsp),%rdx
mov    0x8(%rsp),%rcx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x26af(%rip),%rax
mov    (%rax),%edi
lea    0x7de(%rip),%rsi
jmp    1907 <main+0x747>

LLVM IR (-O0):
@.str = [79 x i8] c"CHKSUM64 V1.2 Copyright (C) 1997 Andreas Sterbenz (stan@sbox.tu-graz.ac.at)\0A\00"
@.str.1 = [82 x i8] c"This program is released under the terms of the GNU public license. NO WARRANTY\0A\0A\00"
@.str.2 = [4 x i8] c"r+b\00"
@.str.3 = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.4 = [43 x i8] c"%s: Could not open file '%s' for reading.\0A\00"
@.str.5 = [66 x i8] c"%s: File is too short to be a N64 ROM Image, cannot checksum it.\0A\00"
@.str.6 = [33 x i8] c"The image '%s' is in %s format.\0A\00"
@.str.7 = [23 x i8] c"original (not swapped)\00"
@.str.8 = [19 x i8] c"V64 (byte-swapped)\00"
@.str.9 = [81 x i8] c"WARNING: I am not 100%% certain, but the image '%s' appears to be in %s format.\0A\00"
@.str.10 = [71 x i8] c"%s: Could not detect type of image '%s', use commandline to override.\0A\00"
@SEEK_END = global i32 0
@.str.11 = [71 x i8] c"%s: File length is not a multiple of four, cannot calculate checksum.\0A\00"
@.str.12 = [81 x i8] c"File is only %ld bytes long, remaining %ld to be checksummed will be assumed 0.\0A\00"
@SEEK_SET = global i32 0
@.str.13 = [49 x i8] c"WARNING: Short read, checksum may be incorrect.\0A\00"
@.str.14 = [22 x i8] c"Old Checksum: \00"
@.str.15 = [22 x i8] c"%02X %02X %02X %02X \00"
@.str.16 = [21 x i8] c"%02X %02X %02X %02X\0A\00"
@.str.17 = [22 x i8] c"Calculated Checksum: \00"
@.str.18 = [48 x i8] c"%s: Could not write new checksum to file '%s'!\0A\00"
@.str.19 = [36 x i8] c"New checksum successfully written.\0A\00"
@.str.20 = [58 x i8] c"File opened in read-only mode, new checksum not written.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [32768 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %7
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 0
%32 = load i8*, i8** %31
store i8* %32, i8** %8
store i32 -1, i32* %13
store i32 0, i32* %14
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %15
br label %35
35: ; preds = %89, %2
%36 = load i32, i32* %15
%37 = load i32, i32* %4
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %92
39: ; preds = %35
%40 = load i8**, i8*** %5
%41 = load i32, i32* %15
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %40, i64 %42
%44 = load i8*, i8** %43
%45 = getelementptr inbounds i8, i8* %44, i64 0
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 45
br i1 %48, label %49, label %75
49: ; preds = %39
%50 = load i8**, i8*** %5
%51 = load i32, i32* %15
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8*, i8** %50, i64 %52
%54 = load i8*, i8** %53
%55 = getelementptr inbounds i8, i8* %54, i64 1
store i8* %55, i8** %16
%56 = load i8*, i8** %16
%57 = getelementptr inbounds i8, i8* %56, i64 1
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %64
61: ; preds = %49
%62 = load i8*, i8** %8
%63 = call i32 @usage(i8* %62)
br label %64
64: ; preds = %61, %49
%65 = load i8*, i8** %16
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
switch i32 %67, label %71 [
i32 114, label %68
i32 111, label %69
i32 115, label %70
]
68: ; preds = %64
store i32 1, i32* %14
br label %74
69: ; preds = %64
store i32 0, i32* %13
br label %74
70: ; preds = %64
store i32 1, i32* %13
br label %74
71: ; preds = %64
%72 = load i8*, i8** %8
%73 = call i32 @usage(i8* %72)
br label %74
74: ; preds = %71, %70, %69, %68
br label %88
75: ; preds = %39
%76 = load i8*, i8** %7
%77 = icmp eq i8* %76, null
br i1 %77, label %78, label %84
78: ; preds = %75
%79 = load i8**, i8*** %5
%80 = load i32, i32* %15
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i8*, i8** %79, i64 %81
%83 = load i8*, i8** %82
store i8* %83, i8** %7
br label %87
84: ; preds = %75
%85 = load i8*, i8** %8
%86 = call i32 @usage(i8* %85)
br label %87
87: ; preds = %84, %78
br label %88
88: ; preds = %87, %74
br label %89
89: ; preds = %88
%90 = load i32, i32* %15
%91 = add nsw i32 %90, 1
store i32 %91, i32* %15
br label %35
92: ; preds = %35
%93 = load i8*, i8** %7
%94 = icmp eq i8* %93, null
br i1 %94, label %95, label %98
95: ; preds = %92
%96 = load i8*, i8** %8
%97 = call i32 @usage(i8* %96)
br label %98
98: ; preds = %95, %92
%99 = load i32, i32* %14
%100 = icmp eq i32 %99, 1
br i1 %100, label %105, label %101
101: ; preds = %98
%102 = load i8*, i8** %7
%103 = call i32* @fopen(i8* %102, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i32* %103, i32** %6
%104 = icmp eq i32* %103, null
br i1 %104, label %105, label %117
105: ; preds = %101, %98
%106 = load i8*, i8** %7
%107 = call i32* @fopen(i8* %106, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %107, i32** %6
%108 = icmp eq i32* %107, null
br i1 %108, label %109, label %115
109: ; preds = %105
%110 = load i32, i32* @stderr
%111 = load i8*, i8** %8
%112 = load i8*, i8** %7
%113 = call i32 (i32, i8*, ...) @fprintf(i32 %110, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %111, i8* %112)
%114 = call i32 @exit(i32 1)
unreachable
115: ; preds = %105
store i32 1, i32* %14
br label %116
116: ; preds = %115
br label %117
117: ; preds = %116, %101
%118 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%119 = load i32*, i32** %6
%120 = call i32 @fread(i8* %118, i32 1, i32 12, i32* %119)
%121 = icmp ne i32 %120, 12
br i1 %121, label %122, label %127
122: ; preds = %117
%123 = load i32, i32* @stderr
%124 = load i8*, i8** %8
%125 = call i32 (i32, i8*, ...) @fprintf(i32 %123, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.5, i64 0, i64 0), i8* %124)
%126 = call i32 @exit(i32 1)
unreachable
127: ; preds = %117
%128 = load i32, i32* %13
%129 = icmp eq i32 %128, -1
br i1 %129, label %130, label %182
130: ; preds = %127
%131 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%132 = load i8, i8* %131
%133 = zext i8 %132 to i64
%134 = and i64 %133, 255
%135 = shl i64 %134, 24
%136 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 1
%137 = load i8, i8* %136
%138 = zext i8 %137 to i64
%139 = and i64 %138, 255
%140 = shl i64 %139, 16
%141 = or i64 %135, %140
%142 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 2
%143 = load i8, i8* %142
%144 = zext i8 %143 to i64
%145 = and i64 %144, 255
%146 = shl i64 %145, 8
%147 = or i64 %141, %146
%148 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 3
%149 = load i8, i8* %148
%150 = zext i8 %149 to i64
%151 = and i64 %150, 255
%152 = or i64 %147, %151
%153 = icmp eq i64 %152, 2151092800
br i1 %153, label %154, label %155
154: ; preds = %130
store i32 0, i32* %13
br label %181
155: ; preds = %130
%156 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 1
%157 = load i8, i8* %156
%158 = zext i8 %157 to i64
%159 = and i64 %158, 255
%160 = shl i64 %159, 24
%161 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%162 = load i8, i8* %161
%163 = zext i8 %162 to i64
%164 = and i64 %163, 255
%165 = shl i64 %164, 16
%166 = or i64 %160, %165
%167 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 3
%168 = load i8, i8* %167
%169 = zext i8 %168 to i64
%170 = and i64 %169, 255
%171 = shl i64 %170, 8
%172 = or i64 %166, %171
%173 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 2
%174 = load i8, i8* %173
%175 = zext i8 %174 to i64
%176 = and i64 %175, 255
%177 = or i64 %172, %176
%178 = icmp eq i64 %177, 2151092800
br i1 %178, label %179, label %180
179: ; preds = %155
store i32 1, i32* %13
br label %180
180: ; preds = %179, %155
br label %181
181: ; preds = %180, %154
br label %182
182: ; preds = %181, %127
%183 = load i32, i32* %13
%184 = icmp ne i32 %183, -1
br i1 %184, label %185, label %192
185: ; preds = %182
%186 = load i8*, i8** %7
%187 = load i32, i32* %13
%188 = icmp eq i32 %187, 0
%189 = zext i1 %188 to i64
%190 = select i1 %188, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0)
%191 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* %186, i8* %190)
br label %232
192: ; preds = %182
%193 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 8
%194 = load i8, i8* %193
%195 = zext i8 %194 to i32
%196 = icmp eq i32 %195, 128
br i1 %196, label %197, label %203
197: ; preds = %192
%198 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 9
%199 = load i8, i8* %198
%200 = zext i8 %199 to i32
%201 = icmp ne i32 %200, 128
br i1 %201, label %202, label %203
202: ; preds = %197
store i32 0, i32* %13
br label %215
203: ; preds = %197, %192
%204 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 8
%205 = load i8, i8* %204
%206 = zext i8 %205 to i32
%207 = icmp ne i32 %206, 128
br i1 %207, label %208, label %214
208: ; preds = %203
%209 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 9
%210 = load i8, i8* %209
%211 = zext i8 %210 to i32
%212 = icmp eq i32 %211, 128
br i1 %212, label %213, label %214
213: ; preds = %208
store i32 1, i32* %13
br label %214
214: ; preds = %213, %208, %203
br label %215
215: ; preds = %214, %202
%216 = load i32, i32* %13
%217 = icmp ne i32 %216, -1
br i1 %217, label %218, label %225
218: ; preds = %215
%219 = load i8*, i8** %7
%220 = load i32, i32* %13
%221 = icmp eq i32 %220, 0
%222 = zext i1 %221 to i64
%223 = select i1 %221, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0)
%224 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.9, i64 0, i64 0), i8* %219, i8* %223)
br label %231
225: ; preds = %215
%226 = load i32, i32* @stderr
%227 = load i8*, i8** %8
%228 = load i8*, i8** %7
%229 = call i32 (i32, i8*, ...) @fprintf(i32 %226, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.10, i64 0, i64 0), i8* %227, i8* %228)
%230 = call i32 @exit(i32 1)
unreachable
231: ; preds = %218
br label %232
232: ; preds = %231, %185
%233 = load i32*, i32** %6
%234 = load i32, i32* @SEEK_END
%235 = call i32 @fseek(i32* %233, i32 0, i32 %234)
%236 = load i32*, i32** %6
%237 = call i32 @ftell(i32* %236)
store i32 %237, i32* %10
%238 = load i32, i32* %10
%239 = zext i32 %238 to i64
%240 = icmp slt i64 %239, 1052672
br i1 %240, label %241, label %264
241: ; preds = %232
%242 = load i32, i32* %10
%243 = icmp ult i32 %242, 4096
br i1 %243, label %244, label %249
244: ; preds = %241
%245 = load i32, i32* @stderr
%246 = load i8*, i8** %8
%247 = call i32 (i32, i8*, ...) @fprintf(i32 %245, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.5, i64 0, i64 0), i8* %246)
%248 = call i32 @exit(i32 1)
unreachable
249: ; preds = %241
%250 = load i32, i32* %10
%251 = and i32 %250, 3
%252 = icmp ne i32 %251, 0
br i1 %252, label %253, label %258
253: ; preds = %249
%254 = load i32, i32* @stderr
%255 = load i8*, i8** %8
%256 = call i32 (i32, i8*, ...) @fprintf(i32 %254, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.11, i64 0, i64 0), i8* %255)
%257 = call i32 @exit(i32 1)
unreachable
258: ; preds = %249
%259 = load i32, i32* %10
%260 = load i32, i32* %10
%261 = zext i32 %260 to i64
%262 = sub nsw i64 1052672, %261
%263 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.12, i64 0, i64 0), i32 %259, i64 %262)
br label %264
264: ; preds = %258, %232
%265 = load i32*, i32** %6
%266 = load i32, i32* @SEEK_SET
%267 = call i32 @fseek(i32* %265, i32 4096, i32 %266)
store i32 1048576, i32* %28
%268 = load i32, i32* %10
%269 = sub i32 %268, 4096
store i32 %269, i32* %29
store i32 -120959524, i32* %21
store i32 -120959524, i32* %22
store i32 -120959524, i32* %23
store i32 -120959524, i32* %24
store i32 -120959524, i32* %25
store i32 -120959524, i32* %26
br label %270
270: ; preds = %440, %264
%271 = load i32, i32* %29
%272 = icmp ugt i32 %271, 0
br i1 %272, label %273, label %300
273: ; preds = %270
%274 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%275 = load i32, i32* %28
%276 = icmp ult i32 32768, %275
br i1 %276, label %277, label %278
277: ; preds = %273
br label %280
278: ; preds = %273
%279 = load i32, i32* %28
br label %280
280: ; preds = %278, %277
%281 = phi i32 [ 32768, %277 ], [ %279, %278 ]
%282 = load i32*, i32** %6
%283 = call i32 @fread(i8* %274, i32 1, i32 %281, i32* %282)
store i32 %283, i32* %27
%284 = load i32, i32* %27
%285 = and i32 %284, 3
%286 = icmp ne i32 %285, 0
br i1 %286, label %287, label %299
287: ; preds = %280
%288 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%289 = load i32, i32* %27
%290 = zext i32 %289 to i64
%291 = getelementptr inbounds i8, i8* %288, i64 %290
%292 = load i32, i32* %27
%293 = and i32 %292, 3
%294 = sub i32 4, %293
%295 = load i32*, i32** %6
%296 = call i32 @fread(i8* %291, i32 1, i32 %294, i32* %295)
%297 = load i32, i32* %27
%298 = add i32 %297, %296
store i32 %298, i32* %27
br label %299
299: ; preds = %287, %280
br label %308
300: ; preds = %270
%301 = load i32, i32* %28
%302 = icmp ult i32 32768, %301
br i1 %302, label %303, label %304
303: ; preds = %300
br label %306
304: ; preds = %300
%305 = load i32, i32* %28
br label %306
306: ; preds = %304, %303
%307 = phi i32 [ 32768, %303 ], [ %305, %304 ]
store i32 %307, i32* %27
br label %308
308: ; preds = %306, %299
%309 = load i32, i32* %27
%310 = icmp eq i32 %309, 0
br i1 %310, label %315, label %311
311: ; preds = %308
%312 = load i32, i32* %27
%313 = and i32 %312, 3
%314 = icmp ne i32 %313, 0
br i1 %314, label %315, label %325
315: ; preds = %311, %308
%316 = load i32, i32* %28
%317 = icmp ne i32 %316, 0
br i1 %317, label %321, label %318
318: ; preds = %315
%319 = load i32, i32* %27
%320 = icmp ne i32 %319, 0
br i1 %320, label %321, label %324
321: ; preds = %318, %315
%322 = load i32, i32* @stderr
%323 = call i32 (i32, i8*, ...) @fprintf(i32 %322, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.13, i64 0, i64 0))
br label %324
324: ; preds = %321, %318
br label %444
325: ; preds = %311
store i32 0, i32* %17
br label %326
326: ; preds = %424, %325
%327 = load i32, i32* %17
%328 = load i32, i32* %27
%329 = icmp ult i32 %327, %328
br i1 %329, label %330, label %427
330: ; preds = %326
%331 = load i32, i32* %17
%332 = zext i32 %331 to i64
%333 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 %332
%334 = load i32, i32* %13
%335 = xor i32 0, %334
%336 = sext i32 %335 to i64
%337 = getelementptr inbounds i8, i8* %333, i64 %336
%338 = load i8, i8* %337
%339 = zext i8 %338 to i64
%340 = and i64 %339, 255
%341 = shl i64 %340, 24
%342 = load i32, i32* %17
%343 = zext i32 %342 to i64
%344 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 %343
%345 = load i32, i32* %13
%346 = xor i32 1, %345
%347 = sext i32 %346 to i64
%348 = getelementptr inbounds i8, i8* %344, i64 %347
%349 = load i8, i8* %348
%350 = zext i8 %349 to i64
%351 = and i64 %350, 255
%352 = shl i64 %351, 16
%353 = or i64 %341, %352
%354 = load i32, i32* %17
%355 = zext i32 %354 to i64
%356 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 %355
%357 = load i32, i32* %13
%358 = xor i32 2, %357
%359 = sext i32 %358 to i64
%360 = getelementptr inbounds i8, i8* %356, i64 %359
%361 = load i8, i8* %360
%362 = zext i8 %361 to i64
%363 = and i64 %362, 255
%364 = shl i64 %363, 8
%365 = or i64 %353, %364
%366 = load i32, i32* %17
%367 = zext i32 %366 to i64
%368 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 %367
%369 = load i32, i32* %13
%370 = xor i32 3, %369
%371 = sext i32 %370 to i64
%372 = getelementptr inbounds i8, i8* %368, i64 %371
%373 = load i8, i8* %372
%374 = zext i8 %373 to i64
%375 = and i64 %374, 255
%376 = or i64 %365, %375
%377 = trunc i64 %376 to i32
store i32 %377, i32* %18
%378 = load i32, i32* %26
%379 = load i32, i32* %18
%380 = add i32 %378, %379
store i32 %380, i32* %19
%381 = load i32, i32* %19
%382 = load i32, i32* %26
%383 = icmp ult i32 %381, %382
br i1 %383, label %384, label %387
384: ; preds = %330
%385 = load i32, i32* %24
%386 = add i32 %385, 1
store i32 %386, i32* %24
br label %387
387: ; preds = %384, %330
%388 = load i32, i32* %19
store i32 %388, i32* %26
%389 = load i32, i32* %18
%390 = load i32, i32* %23
%391 = xor i32 %390, %389
store i32 %391, i32* %23
%392 = load i32, i32* %18
%393 = and i32 %392, 31
store i32 %393, i32* %20
%394 = load i32, i32* %18
%395 = load i32, i32* %20
%396 = shl i32 %394, %395
%397 = load i32, i32* %18
%398 = load i32, i32* %20
%399 = sub i32 32, %398
%400 = lshr i32 %397, %399
%401 = or i32 %396, %400
store i32 %401, i32* %19
%402 = load i32, i32* %19
%403 = load i32, i32* %25
%404 = add i32 %403, %402
store i32 %404, i32* %25
%405 = load i32, i32* %18
%406 = load i32, i32* %22
%407 = icmp ult i32 %405, %406
br i1 %407, label %408, label %412
408: ; preds = %387
%409 = load i32, i32* %19
%410 = load i32, i32* %22
%411 = xor i32 %410, %409
store i32 %411, i32* %22
br label %418
412: ; preds = %387
%413 = load i32, i32* %26
%414 = load i32, i32* %18
%415 = xor i32 %413, %414
%416 = load i32, i32* %22
%417 = xor i32 %416, %415
store i32 %417, i32* %22
br label %418
418: ; preds = %412, %408
%419 = load i32, i32* %18
%420 = load i32, i32* %25
%421 = xor i32 %419, %420
%422 = load i32, i32* %21
%423 = add i32 %422, %421
store i32 %423, i32* %21
br label %424
424: ; preds = %418
%425 = load i32, i32* %17
%426 = add i32 %425, 4
store i32 %426, i32* %17
br label %326
427: ; preds = %326
%428 = load i32, i32* %29
%429 = icmp ugt i32 %428, 0
br i1 %429, label %430, label %440
430: ; preds = %427
%431 = load i32, i32* %27
%432 = load i32, i32* %29
%433 = sub i32 %432, %431
store i32 %433, i32* %29
%434 = load i32, i32* %29
%435 = icmp ule i32 %434, 0
br i1 %435, label %436, label %439
436: ; preds = %430
%437 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%438 = call i32 @memset(i8* %437, i32 0, i32 32768)
br label %439
439: ; preds = %436, %430
br label %440
440: ; preds = %439, %427
%441 = load i32, i32* %27
%442 = load i32, i32* %28
%443 = sub i32 %442, %441
store i32 %443, i32* %28
br label %270
444: ; preds = %324
%445 = load i32, i32* %26
%446 = load i32, i32* %24
%447 = xor i32 %445, %446
%448 = load i32, i32* %23
%449 = xor i32 %447, %448
store i32 %449, i32* %11
%450 = load i32, i32* %25
%451 = load i32, i32* %22
%452 = xor i32 %450, %451
%453 = load i32, i32* %21
%454 = xor i32 %452, %453
store i32 %454, i32* %12
%455 = load i32, i32* %11
%456 = lshr i32 %455, 24
%457 = and i32 %456, 255
%458 = trunc i32 %457 to i8
%459 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%460 = getelementptr inbounds i8, i8* %459, i64 0
store i8 %458, i8* %460
%461 = load i32, i32* %11
%462 = lshr i32 %461, 16
%463 = and i32 %462, 255
%464 = trunc i32 %463 to i8
%465 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%466 = getelementptr inbounds i8, i8* %465, i64 1
store i8 %464, i8* %466
%467 = load i32, i32* %11
%468 = lshr i32 %467, 8
%469 = and i32 %468, 255
%470 = trunc i32 %469 to i8
%471 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%472 = getelementptr inbounds i8, i8* %471, i64 2
store i8 %470, i8* %472
%473 = load i32, i32* %11
%474 = and i32 %473, 255
%475 = trunc i32 %474 to i8
%476 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%477 = getelementptr inbounds i8, i8* %476, i64 3
store i8 %475, i8* %477
%478 = load i32, i32* %12
%479 = lshr i32 %478, 24
%480 = and i32 %479, 255
%481 = trunc i32 %480 to i8
%482 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 4
%483 = getelementptr inbounds i8, i8* %482, i64 0
store i8 %481, i8* %483
%484 = load i32, i32* %12
%485 = lshr i32 %484, 16
%486 = and i32 %485, 255
%487 = trunc i32 %486 to i8
%488 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 4
%489 = getelementptr inbounds i8, i8* %488, i64 1
store i8 %487, i8* %489
%490 = load i32, i32* %12
%491 = lshr i32 %490, 8
%492 = and i32 %491, 255
%493 = trunc i32 %492 to i8
%494 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 4
%495 = getelementptr inbounds i8, i8* %494, i64 2
store i8 %493, i8* %495
%496 = load i32, i32* %12
%497 = and i32 %496, 255
%498 = trunc i32 %497 to i8
%499 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 4
%500 = getelementptr inbounds i8, i8* %499, i64 3
store i8 %498, i8* %500
%501 = load i32*, i32** %6
%502 = load i32, i32* @SEEK_SET
%503 = call i32 @fseek(i32* %501, i32 16, i32 %502)
%504 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%505 = getelementptr inbounds i8, i8* %504, i64 8
%506 = load i32*, i32** %6
%507 = call i32 @fread(i8* %505, i32 1, i32 8, i32* %506)
%508 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0))
%509 = load i32, i32* %13
%510 = xor i32 8, %509
%511 = sext i32 %510 to i64
%512 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 %511
%513 = load i8, i8* %512
%514 = zext i8 %513 to i32
%515 = load i32, i32* %13
%516 = xor i32 9, %515
%517 = sext i32 %516 to i64
%518 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 %517
%519 = load i8, i8* %518
%520 = zext i8 %519 to i32
%521 = load i32, i32* %13
%522 = xor i32 10, %521
%523 = sext i32 %522 to i64
%524 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 %523
%525 = load i8, i8* %524
%526 = zext i8 %525 to i32
%527 = load i32, i32* %13
%528 = xor i32 11, %527
%529 = sext i32 %528 to i64
%530 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 %529
%531 = load i8, i8* %530
%532 = zext i8 %531 to i32
%533 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.15, i64 0, i64 0), i32 %514, i32 %520, i32 %526, i32 %532)
%534 = load i32, i32* %13
%535 = xor i32 12, %534
%536 = sext i32 %535 to i64
%537 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 %536
%538 = load i8, i8* %537
%539 = zext i8 %538 to i32
%540 = load i32, i32* %13
%541 = xor i32 13, %540
%542 = sext i32 %541 to i64
%543 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 %542
%544 = load i8, i8* %543
%545 = zext i8 %544 to i32
%546 = load i32, i32* %13
%547 = xor i32 14, %546
%548 = sext i32 %547 to i64
%549 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 %548
%550 = load i8, i8* %549
%551 = zext i8 %550 to i32
%552 = load i32, i32* %13
%553 = xor i32 15, %552
%554 = sext i32 %553 to i64
%555 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 %554
%556 = load i8, i8* %555
%557 = zext i8 %556 to i32
%558 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.16, i64 0, i64 0), i32 %539, i32 %545, i32 %551, i32 %557)
%559 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.17, i64 0, i64 0))
%560 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%561 = load i8, i8* %560
%562 = zext i8 %561 to i32
%563 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 1
%564 = load i8, i8* %563
%565 = zext i8 %564 to i32
%566 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 2
%567 = load i8, i8* %566
%568 = zext i8 %567 to i32
%569 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 3
%570 = load i8, i8* %569
%571 = zext i8 %570 to i32
%572 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.15, i64 0, i64 0), i32 %562, i32 %565, i32 %568, i32 %571)
%573 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 4
%574 = load i8, i8* %573
%575 = zext i8 %574 to i32
%576 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 5
%577 = load i8, i8* %576
%578 = zext i8 %577 to i32
%579 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 6
%580 = load i8, i8* %579
%581 = zext i8 %580 to i32
%582 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 7
%583 = load i8, i8* %582
%584 = zext i8 %583 to i32
%585 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.16, i64 0, i64 0), i32 %575, i32 %578, i32 %581, i32 %584)
%586 = load i32, i32* %14
%587 = icmp eq i32 %586, 0
br i1 %587, label %588, label %676
588: ; preds = %444
%589 = load i32*, i32** %6
%590 = load i32, i32* @SEEK_SET
%591 = call i32 @fseek(i32* %589, i32 16, i32 %590)
%592 = load i32, i32* %11
%593 = lshr i32 %592, 24
%594 = and i32 %593, 255
%595 = trunc i32 %594 to i8
%596 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 16
%597 = load i32, i32* %13
%598 = xor i32 0, %597
%599 = sext i32 %598 to i64
%600 = getelementptr inbounds i8, i8* %596, i64 %599
store i8 %595, i8* %600
%601 = load i32, i32* %11
%602 = lshr i32 %601, 16
%603 = and i32 %602, 255
%604 = trunc i32 %603 to i8
%605 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 16
%606 = load i32, i32* %13
%607 = xor i32 1, %606
%608 = sext i32 %607 to i64
%609 = getelementptr inbounds i8, i8* %605, i64 %608
store i8 %604, i8* %609
%610 = load i32, i32* %11
%611 = lshr i32 %610, 8
%612 = and i32 %611, 255
%613 = trunc i32 %612 to i8
%614 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 16
%615 = load i32, i32* %13
%616 = xor i32 2, %615
%617 = sext i32 %616 to i64
%618 = getelementptr inbounds i8, i8* %614, i64 %617
store i8 %613, i8* %618
%619 = load i32, i32* %11
%620 = and i32 %619, 255
%621 = trunc i32 %620 to i8
%622 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 16
%623 = load i32, i32* %13
%624 = xor i32 3, %623
%625 = sext i32 %624 to i64
%626 = getelementptr inbounds i8, i8* %622, i64 %625
store i8 %621, i8* %626
%627 = load i32, i32* %12
%628 = lshr i32 %627, 24
%629 = and i32 %628, 255
%630 = trunc i32 %629 to i8
%631 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 20
%632 = load i32, i32* %13
%633 = xor i32 0, %632
%634 = sext i32 %633 to i64
%635 = getelementptr inbounds i8, i8* %631, i64 %634
store i8 %630, i8* %635
%636 = load i32, i32* %12
%637 = lshr i32 %636, 16
%638 = and i32 %637, 255
%639 = trunc i32 %638 to i8
%640 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 20
%641 = load i32, i32* %13
%642 = xor i32 1, %641
%643 = sext i32 %642 to i64
%644 = getelementptr inbounds i8, i8* %640, i64 %643
store i8 %639, i8* %644
%645 = load i32, i32* %12
%646 = lshr i32 %645, 8
%647 = and i32 %646, 255
%648 = trunc i32 %647 to i8
%649 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 20
%650 = load i32, i32* %13
%651 = xor i32 2, %650
%652 = sext i32 %651 to i64
%653 = getelementptr inbounds i8, i8* %649, i64 %652
store i8 %648, i8* %653
%654 = load i32, i32* %12
%655 = and i32 %654, 255
%656 = trunc i32 %655 to i8
%657 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 20
%658 = load i32, i32* %13
%659 = xor i32 3, %658
%660 = sext i32 %659 to i64
%661 = getelementptr inbounds i8, i8* %657, i64 %660
store i8 %656, i8* %661
%662 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%663 = getelementptr inbounds i8, i8* %662, i64 16
%664 = load i32*, i32** %6
%665 = call i32 @fwrite(i8* %663, i32 1, i32 8, i32* %664)
%666 = icmp ne i32 %665, 8
br i1 %666, label %667, label %673
667: ; preds = %588
%668 = load i32, i32* @stderr
%669 = load i8*, i8** %8
%670 = load i8*, i8** %7
%671 = call i32 (i32, i8*, ...) @fprintf(i32 %668, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.18, i64 0, i64 0), i8* %669, i8* %670)
%672 = call i32 @exit(i32 1)
unreachable
673: ; preds = %588
%674 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.19, i64 0, i64 0))
br label %675
675: ; preds = %673
br label %678
676: ; preds = %444
%677 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.20, i64 0, i64 0))
br label %678
678: ; preds = %676, %675
%679 = load i32*, i32** %6
%680 = call i32 @fclose(i32* %679)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [4 x i8] c"r+b\00"
@.str.3 = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.4 = [43 x i8] c"%s: Could not open file '%s' for reading.\0A\00"
@.str.5 = [66 x i8] c"%s: File is too short to be a N64 ROM Image, cannot checksum it.\0A\00"
@.str.6 = [33 x i8] c"The image '%s' is in %s format.\0A\00"
@.str.7 = [23 x i8] c"original (not swapped)\00"
@.str.8 = [19 x i8] c"V64 (byte-swapped)\00"
@.str.9 = [81 x i8] c"WARNING: I am not 100%% certain, but the image '%s' appears to be in %s format.\0A\00"
@.str.10 = [71 x i8] c"%s: Could not detect type of image '%s', use commandline to override.\0A\00"
@SEEK_END = global i32 0
@.str.11 = [71 x i8] c"%s: File length is not a multiple of four, cannot calculate checksum.\0A\00"
@.str.12 = [81 x i8] c"File is only %ld bytes long, remaining %ld to be checksummed will be assumed 0.\0A\00"
@SEEK_SET = global i32 0
@.str.13 = [49 x i8] c"WARNING: Short read, checksum may be incorrect.\0A\00"
@.str.14 = [22 x i8] c"Old Checksum: \00"
@.str.15 = [22 x i8] c"%02X %02X %02X %02X \00"
@.str.16 = [21 x i8] c"%02X %02X %02X %02X\0A\00"
@.str.17 = [22 x i8] c"Calculated Checksum: \00"
@.str.18 = [48 x i8] c"%s: Could not write new checksum to file '%s'!\0A\00"
@str = [78 x i8] c"CHKSUM64 V1.2 Copyright (C) 1997 Andreas Sterbenz (stan@sbox.tu-graz.ac.at)\00"
@str.21 = [81 x i8] c"This program is released under the terms of the GNU public license. NO WARRANTY\0A\00"
@str.22 = [57 x i8] c"File opened in read-only mode, new checksum not written.\00"
@str.23 = [35 x i8] c"New checksum successfully written.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [32768 x i8]
%4 = load i8*, i8** %1
%5 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str.21, i64 0, i64 0))
%8 = icmp sgt i32 %0, 1
br i1 %8, label %9, label %46
9: ; preds = %2
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %9, %38
%12 = phi i64 [ 1, %9 ], [ %42, %38 ]
%13 = phi i8* [ null, %9 ], [ %41, %38 ]
%14 = phi i32 [ -1, %9 ], [ %40, %38 ]
%15 = phi i32 [ 0, %9 ], [ %39, %38 ]
%16 = getelementptr inbounds i8*, i8** %1, i64 %12
%17 = load i8*, i8** %16
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 45
br i1 %19, label %20, label %34
20: ; preds = %11
%21 = getelementptr inbounds i8, i8* %17, i64 1
%22 = getelementptr inbounds i8, i8* %17, i64 2
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %20
%26 = tail call i32 @usage(i8* %4)
br label %27
27: ; preds = %25, %20
%28 = load i8, i8* %21
%29 = sext i8 %28 to i32
switch i32 %29, label %32 [
i32 114, label %38
i32 111, label %30
i32 115, label %31
]
30: ; preds = %27
br label %38
31: ; preds = %27
br label %38
32: ; preds = %27
%33 = tail call i32 @usage(i8* %4)
br label %38
34: ; preds = %11
%35 = icmp eq i8* %13, null
br i1 %35, label %38, label %36
36: ; preds = %34
%37 = tail call i32 @usage(i8* %4)
br label %38
38: ; preds = %34, %30, %31, %32, %27, %36
%39 = phi i32 [ %15, %36 ], [ %15, %32 ], [ %15, %31 ], [ %15, %30 ], [ 1, %27 ], [ %15, %34 ]
%40 = phi i32 [ %14, %36 ], [ %14, %32 ], [ 1, %31 ], [ 0, %30 ], [ %14, %27 ], [ %14, %34 ]
%41 = phi i8* [ %13, %36 ], [ %13, %32 ], [ %13, %31 ], [ %13, %30 ], [ %13, %27 ], [ %17, %34 ]
%42 = add nuw nsw i64 %12, 1
%43 = icmp eq i64 %42, %10
br i1 %43, label %44, label %11
44: ; preds = %38
%45 = icmp eq i8* %41, null
br i1 %45, label %46, label %50
46: ; preds = %2, %44
%47 = phi i32 [ %40, %44 ], [ -1, %2 ]
%48 = phi i32 [ %39, %44 ], [ 0, %2 ]
%49 = tail call i32 @usage(i8* %4)
br label %50
50: ; preds = %46, %44
%51 = phi i8* [ null, %46 ], [ %41, %44 ]
%52 = phi i32 [ %47, %46 ], [ %40, %44 ]
%53 = phi i32 [ %48, %46 ], [ %39, %44 ]
%54 = icmp eq i32 %53, 1
br i1 %54, label %58, label %55
55: ; preds = %50
%56 = tail call i32* @fopen(i8* %51, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%57 = icmp eq i32* %56, null
br i1 %57, label %58, label %65
58: ; preds = %55, %50
%59 = tail call i32* @fopen(i8* %51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%60 = icmp eq i32* %59, null
br i1 %60, label %61, label %65
61: ; preds = %58
%62 = load i32, i32* @stderr
%63 = tail call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %4, i8* %51)
%64 = tail call i32 @exit(i32 1)
unreachable
65: ; preds = %58, %55
%66 = phi i1 [ true, %55 ], [ false, %58 ]
%67 = phi i32* [ %56, %55 ], [ %59, %58 ]
%68 = call i32 @fread(i8* %5, i32 1, i32 12, i32* %67)
%69 = icmp eq i32 %68, 12
br i1 %69, label %74, label %70
70: ; preds = %65
%71 = load i32, i32* @stderr
%72 = tail call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%73 = tail call i32 @exit(i32 1)
unreachable
74: ; preds = %65
switch i32 %52, label %103 [
i32 -1, label %75
i32 0, label %102
]
75: ; preds = %74
%76 = load i8, i8* %5
%77 = zext i8 %76 to i64
%78 = shl nuw nsw i64 %77, 24
%79 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 1
%80 = load i8, i8* %79
%81 = zext i8 %80 to i64
%82 = shl nuw nsw i64 %81, 16
%83 = or i64 %82, %78
%84 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 2
%85 = load i8, i8* %84
%86 = zext i8 %85 to i64
%87 = shl nuw nsw i64 %86, 8
%88 = or i64 %83, %87
%89 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 3
%90 = load i8, i8* %89
%91 = zext i8 %90 to i64
%92 = or i64 %88, %91
%93 = icmp eq i64 %92, 2151092800
br i1 %93, label %102, label %94
94: ; preds = %75
%95 = shl nuw nsw i64 %81, 24
%96 = shl nuw nsw i64 %77, 16
%97 = or i64 %95, %96
%98 = shl nuw nsw i64 %91, 8
%99 = or i64 %97, %86
%100 = or i64 %99, %98
%101 = icmp eq i64 %100, 2151092800
br i1 %101, label %103, label %107
102: ; preds = %74, %75
br label %103
103: ; preds = %74, %94, %102
%104 = phi i32 [ 0, %102 ], [ 1, %94 ], [ %52, %74 ]
%105 = phi i8* [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), %102 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), %94 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), %74 ]
%106 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* %51, i8* %105)
br label %127
107: ; preds = %94
%108 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 8
%109 = load i8, i8* %108
%110 = icmp eq i8 %109, -128
%111 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 9
%112 = load i8, i8* %111
%113 = icmp ne i8 %112, -128
%114 = select i1 %110, i1 %113, i1 false
br i1 %114, label %119, label %115
115: ; preds = %107
%116 = icmp ne i8 %109, -128
%117 = icmp eq i8 %112, -128
%118 = select i1 %116, i1 %117, i1 false
br i1 %118, label %119, label %123
119: ; preds = %107, %115
%120 = phi i32 [ 1, %115 ], [ 0, %107 ]
%121 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), %115 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), %107 ]
%122 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @.str.9, i64 0, i64 0), i8* %51, i8* %121)
br label %127
123: ; preds = %115
%124 = load i32, i32* @stderr
%125 = tail call i32 (i32, i8*, ...) @fprintf(i32 %124, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.10, i64 0, i64 0), i8* %4, i8* %51)
%126 = tail call i32 @exit(i32 1)
unreachable
127: ; preds = %119, %103
%128 = phi i32 [ %104, %103 ], [ %120, %119 ]
%129 = load i32, i32* @SEEK_END
%130 = tail call i32 @fseek(i32* %67, i32 0, i32 %129)
%131 = tail call i32 @ftell(i32* %67)
%132 = zext i32 %131 to i64
%133 = icmp ult i32 %131, 1052672
br i1 %133, label %134, label %150
134: ; preds = %127
%135 = icmp ult i32 %131, 4096
br i1 %135, label %136, label %140
136: ; preds = %134
%137 = load i32, i32* @stderr
%138 = tail call i32 (i32, i8*, ...) @fprintf(i32 %137, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%139 = tail call i32 @exit(i32 1)
unreachable
140: ; preds = %134
%141 = and i32 %131, 3
%142 = icmp eq i32 %141, 0
br i1 %142, label %147, label %143
143: ; preds = %140
%144 = load i32, i32* @stderr
%145 = tail call i32 (i32, i8*, ...) @fprintf(i32 %144, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.11, i64 0, i64 0), i8* %4)
%146 = tail call i32 @exit(i32 1)
unreachable
147: ; preds = %140
%148 = sub nsw i64 1052672, %132
%149 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @.str.12, i64 0, i64 0), i32 %131, i64 %148)
br label %150
150: ; preds = %147, %127
%151 = load i32, i32* @SEEK_SET
%152 = tail call i32 @fseek(i32* %67, i32 4096, i32 %151)
%153 = add i32 %131, -4096
%154 = sext i32 %128 to i64
%155 = xor i32 %128, 1
%156 = sext i32 %155 to i64
%157 = xor i32 %128, 2
%158 = sext i32 %157 to i64
%159 = xor i32 %128, 3
%160 = sext i32 %159 to i64
br label %161
161: ; preds = %245, %150
%162 = phi i32 [ -120959524, %150 ], [ %236, %245 ]
%163 = phi i32 [ -120959524, %150 ], [ %234, %245 ]
%164 = phi i32 [ -120959524, %150 ], [ %228, %245 ]
%165 = phi i32 [ -120959524, %150 ], [ %227, %245 ]
%166 = phi i32 [ -120959524, %150 ], [ %230, %245 ]
%167 = phi i32 [ -120959524, %150 ], [ %224, %245 ]
%168 = phi i32 [ 1048576, %150 ], [ %247, %245 ]
%169 = phi i32 [ %153, %150 ], [ %246, %245 ]
%170 = icmp eq i32 %169, 0
%171 = icmp ult i32 %168, 32768
%172 = select i1 %171, i32 %168, i32 32768
br i1 %170, label %183, label %173
173: ; preds = %161
%174 = call i32 @fread(i8* %5, i32 1, i32 %172, i32* %67)
%175 = and i32 %174, 3
%176 = icmp eq i32 %175, 0
br i1 %176, label %183, label %177
177: ; preds = %173
%178 = zext i32 %174 to i64
%179 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 %178
%180 = sub nuw nsw i32 4, %175
%181 = call i32 @fread(i8* %179, i32 1, i32 %180, i32* %67)
%182 = add i32 %181, %174
br label %183
183: ; preds = %161, %173, %177
%184 = phi i32 [ %182, %177 ], [ %174, %173 ], [ %172, %161 ]
%185 = icmp ne i32 %184, 0
%186 = and i32 %184, 3
%187 = icmp eq i32 %186, 0
%188 = and i1 %185, %187
br i1 %188, label %189, label %191
189: ; preds = %183
%190 = zext i32 %184 to i64
br label %197
191: ; preds = %183
%192 = icmp ne i32 %168, 0
%193 = select i1 %192, i1 true, i1 %185
br i1 %193, label %194, label %248
194: ; preds = %191
%195 = load i32, i32* @stderr
%196 = call i32 (i32, i8*, ...) @fprintf(i32 %195, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.13, i64 0, i64 0))
br label %248
197: ; preds = %189, %197
%198 = phi i64 [ 0, %189 ], [ %237, %197 ]
%199 = phi i32 [ %167, %189 ], [ %224, %197 ]
%200 = phi i32 [ %166, %189 ], [ %230, %197 ]
%201 = phi i32 [ %165, %189 ], [ %227, %197 ]
%202 = phi i32 [ %164, %189 ], [ %228, %197 ]
%203 = phi i32 [ %163, %189 ], [ %234, %197 ]
%204 = phi i32 [ %162, %189 ], [ %236, %197 ]
%205 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 %198
%206 = getelementptr inbounds i8, i8* %205, i64 %154
%207 = load i8, i8* %206
%208 = zext i8 %207 to i32
%209 = shl nuw i32 %208, 24
%210 = getelementptr inbounds i8, i8* %205, i64 %156
%211 = load i8, i8* %210
%212 = zext i8 %211 to i32
%213 = shl nuw nsw i32 %212, 16
%214 = or i32 %213, %209
%215 = getelementptr inbounds i8, i8* %205, i64 %158
%216 = load i8, i8* %215
%217 = zext i8 %216 to i32
%218 = shl nuw nsw i32 %217, 8
%219 = or i32 %214, %218
%220 = getelementptr inbounds i8, i8* %205, i64 %160
%221 = load i8, i8* %220
%222 = zext i8 %221 to i32
%223 = or i32 %219, %222
%224 = add i32 %223, %199
%225 = icmp ult i32 %224, %199
%226 = zext i1 %225 to i32
%227 = add i32 %201, %226
%228 = xor i32 %223, %202
%229 = call i32 @llvm.fshl.i32(i32 %223, i32 %223, i32 %222)
%230 = add i32 %229, %200
%231 = icmp ult i32 %223, %203
%232 = xor i32 %224, %223
%233 = select i1 %231, i32 %229, i32 %232
%234 = xor i32 %233, %203
%235 = xor i32 %230, %223
%236 = add i32 %235, %204
%237 = add nuw nsw i64 %198, 4
%238 = icmp ult i64 %237, %190
br i1 %238, label %197, label %239
239: ; preds = %197
br i1 %170, label %245, label %240
240: ; preds = %239
%241 = sub i32 %169, %184
%242 = icmp eq i32 %241, 0
br i1 %242, label %243, label %245
243: ; preds = %240
%244 = call i32 @memset(i8* %5, i32 0, i32 32768)
br label %245
245: ; preds = %240, %243, %239
%246 = phi i32 [ 0, %243 ], [ %241, %240 ], [ 0, %239 ]
%247 = sub i32 %168, %184
br label %161
248: ; preds = %194, %191
%249 = xor i32 %165, %164
%250 = xor i32 %249, %167
%251 = xor i32 %163, %162
%252 = xor i32 %251, %166
%253 = lshr i32 %250, 24
%254 = trunc i32 %253 to i8
store i8 %254, i8* %5
%255 = lshr i32 %250, 16
%256 = trunc i32 %255 to i8
%257 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 1
store i8 %256, i8* %257
%258 = lshr i32 %250, 8
%259 = trunc i32 %258 to i8
%260 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 2
store i8 %259, i8* %260
%261 = trunc i32 %250 to i8
%262 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 3
store i8 %261, i8* %262
%263 = lshr i32 %252, 24
%264 = trunc i32 %263 to i8
%265 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 4
store i8 %264, i8* %265
%266 = lshr i32 %252, 16
%267 = trunc i32 %266 to i8
%268 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 5
store i8 %267, i8* %268
%269 = lshr i32 %252, 8
%270 = trunc i32 %269 to i8
%271 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 6
store i8 %270, i8* %271
%272 = trunc i32 %252 to i8
%273 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 7
store i8 %272, i8* %273
%274 = load i32, i32* @SEEK_SET
%275 = call i32 @fseek(i32* %67, i32 16, i32 %274)
%276 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 8
%277 = call i32 @fread(i8* %276, i32 1, i32 8, i32* %67)
%278 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0))
%279 = xor i32 %128, 8
%280 = sext i32 %279 to i64
%281 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 %280
%282 = load i8, i8* %281
%283 = zext i8 %282 to i32
%284 = xor i32 %128, 9
%285 = sext i32 %284 to i64
%286 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 %285
%287 = load i8, i8* %286
%288 = zext i8 %287 to i32
%289 = xor i32 %128, 10
%290 = sext i32 %289 to i64
%291 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 %290
%292 = load i8, i8* %291
%293 = zext i8 %292 to i32
%294 = xor i32 %128, 11
%295 = sext i32 %294 to i64
%296 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 %295
%297 = load i8, i8* %296
%298 = zext i8 %297 to i32
%299 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.15, i64 0, i64 0), i32 %283, i32 %288, i32 %293, i32 %298)
%300 = xor i32 %128, 12
%301 = sext i32 %300 to i64
%302 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 %301
%303 = load i8, i8* %302
%304 = zext i8 %303 to i32
%305 = xor i32 %128, 13
%306 = sext i32 %305 to i64
%307 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 %306
%308 = load i8, i8* %307
%309 = zext i8 %308 to i32
%310 = xor i32 %128, 14
%311 = sext i32 %310 to i64
%312 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 %311
%313 = load i8, i8* %312
%314 = zext i8 %313 to i32
%315 = xor i32 %128, 15
%316 = sext i32 %315 to i64
%317 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 %316
%318 = load i8, i8* %317
%319 = zext i8 %318 to i32
%320 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.16, i64 0, i64 0), i32 %304, i32 %309, i32 %314, i32 %319)
%321 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.17, i64 0, i64 0))
%322 = load i8, i8* %5
%323 = zext i8 %322 to i32
%324 = load i8, i8* %257
%325 = zext i8 %324 to i32
%326 = load i8, i8* %260
%327 = zext i8 %326 to i32
%328 = load i8, i8* %262
%329 = zext i8 %328 to i32
%330 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.15, i64 0, i64 0), i32 %323, i32 %325, i32 %327, i32 %329)
%331 = load i8, i8* %265
%332 = zext i8 %331 to i32
%333 = load i8, i8* %268
%334 = zext i8 %333 to i32
%335 = load i8, i8* %271
%336 = zext i8 %335 to i32
%337 = load i8, i8* %273
%338 = zext i8 %337 to i32
%339 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.16, i64 0, i64 0), i32 %332, i32 %334, i32 %336, i32 %338)
br i1 %66, label %340, label %359
340: ; preds = %248
%341 = load i32, i32* @SEEK_SET
%342 = call i32 @fseek(i32* %67, i32 16, i32 %341)
%343 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 16
%344 = getelementptr inbounds i8, i8* %343, i64 %154
store i8 %254, i8* %344
%345 = getelementptr inbounds i8, i8* %343, i64 %156
store i8 %256, i8* %345
%346 = getelementptr inbounds i8, i8* %343, i64 %158
store i8 %259, i8* %346
%347 = getelementptr inbounds i8, i8* %343, i64 %160
store i8 %261, i8* %347
%348 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 20
%349 = getelementptr inbounds i8, i8* %348, i64 %154
store i8 %264, i8* %349
%350 = getelementptr inbounds i8, i8* %348, i64 %156
store i8 %267, i8* %350
%351 = getelementptr inbounds i8, i8* %348, i64 %158
store i8 %270, i8* %351
%352 = getelementptr inbounds i8, i8* %348, i64 %160
store i8 %272, i8* %352
%353 = call i32 @fwrite(i8* %343, i32 1, i32 8, i32* %67)
%354 = icmp eq i32 %353, 8
br i1 %354, label %359, label %355
355: ; preds = %340
%356 = load i32, i32* @stderr
%357 = call i32 (i32, i8*, ...) @fprintf(i32 %356, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.18, i64 0, i64 0), i8* %4, i8* %51)
%358 = call i32 @exit(i32 1)
unreachable
359: ; preds = %248, %340
%360 = phi i8* [ getelementptr inbounds ([35 x i8], [35 x i8]* @str.23, i64 0, i64 0), %340 ], [ getelementptr inbounds ([57 x i8], [57 x i8]* @str.22, i64 0, i64 0), %248 ]
%361 = call i32 @puts(i8* dereferenceable(1) %360)
%362 = call i32 @fclose(i32* %67)
ret i32 0
}