#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  FILE *f1, *f2;
  int n1, n2, i, NoSuper = 0, NoSuper2 = 0, NoZero = 0, OnlySuper = 0,
                 Block1 = 0;
  unsigned char d1[2], d2[2];
  if (argc < 3) {
    printf("USAGE:\n"
           "\tbdiffhead AgcCoreFilename1 AgcCoreFilename2 [OPTIONS]\n"
           "A binary-compare of two files is performed, and a list of all\n"
           "differences is printed.  The files are supposed to represent\n"
           "AGC (Apollo Guidance Computer) core-ropes, consisting of 16-bit\n"
           "words. The output messages use the AGC addressing scheme.\n"
           "The available options are:\n"
           "--no-super     This option discards differences in which one\n"
           "               word has 100 (binary) in bit-positions 5,6,7\n"
           "               (the least-significant bit being position 1)\n"
           "               and 011 in the other word.\n"
           "--only-super   The opposite of the --no-super option.  Shows\n"
           "               ONLY differences involving 000 vs. 100 vs. 011 in \n"
           "               bits 5,6,7.\n"
           "--no-super2    Similar to --no-super, but discards ALL \n"
           "               differences which are merely in bit 7.\n"
           "--no-zero      This option discards differences in which the\n"
           "               word from the 2nd file is 00000.\n");
    return (1);
  }
  f1 = fopen(argv[1], "rb");
  if (f1 == NULL) {
    printf("Could not open file \"%s\".\n", argv[1]);
    return (1);
  }
  f2 = fopen(argv[2], "rb");
  if (f2 == NULL) {
    fclose(f1);
    printf("Could not open file \"%s\".\n", argv[2]);
    return (2);
  }
  for (n1 = 3; n1 < argc; n1++) {
    if (!strcmp(argv[n1], "--no-super"))
      NoSuper = 1;
    else if (!strcmp(argv[n1], "--no-super2"))
      NoSuper2 = 1;
    else if (!strcmp(argv[n1], "--only-super"))
      OnlySuper = 1;
    else if (!strcmp(argv[n1], "--no-zero"))
      NoZero = 1;
    else
      printf("Unrecognized option \"%s\".\n", argv[n1]);
  }
  fseek(f1, 0, SEEK_END);
  fseek(f2, 0, SEEK_END);
  n1 = ftell(f1);
  n2 = ftell(f2);
  rewind(f1);
  rewind(f2);
  if (n1 == (2 * 034 * 02000)) {
    Block1 = 1;
    printf("File %s is Block 1.\n", argv[1]);
  } else if (n1 == (2 * 044 * 02000))
    printf("File %s is Block 2.\n", argv[1]);
  else
    printf("File %s is neither Block 1 nor Block 2.\n", argv[1]);
  if (n2 == (2 * 034 * 02000)) {
    Block1 = 1;
    printf("File %s is Block 1.\n", argv[2]);
  } else if (n2 == (2 * 044 * 02000))
    printf("File %s is Block 2.\n", argv[2]);
  else
    printf("File %s is neither Block 1 nor Block 2.\n", argv[2]);
  if (n1 != n2)
    printf("Files %s and %s are not the same length.\n", argv[1], argv[2]);
  if (n1 < n2)
    n2 = n1;
  else if (n2 < n1)
    n1 = n2;
  while (1 == fread(d1, 2, 1, f1) && 1 == fread(d2, 2, 1, f2))
    if (d1[0] != d2[0] || d1[1] != d2[1]) {
      int Bank, Offset;
      n1 = (d1[0] << 7) | (d1[1] >> 1);
      n2 = (d2[0] << 7) | (d2[1] >> 1);
      if (NoZero && n2 == 0)
        continue;
      i = (ftell(f1) - 2) / 2;
      if (Block1) {
        Offset = 06000 + (i % 02000);
        Bank = 1 + i / 02000;
      } else {
        int sub1, sub2;
        sub1 = 0160 & n1;
        sub2 = 0160 & n2;
        if (NoSuper2 && 00100 == (n1 ^ n2)) {
          continue;
        } else if ((~0160 & n1) == (~0160 & n2) && sub1 != sub2 &&
                   (((0100 == sub1 || 0060 == sub1 || 0000 == sub1) &&
                     (0100 == sub2 || 0060 == sub2 || 0000 == sub2)) ||
                    ((0100 == sub1 || 0060 == sub1 || 0160 == sub1) &&
                     (0100 == sub2 || 0060 == sub2 || 0160 == sub2)))) {
          if (NoSuper)
            continue;
        } else {
          if (OnlySuper)
            continue;
        }
        Offset = 02000 + (i % 02000);
        Bank = i / 02000;
        if (Bank < 4)
          Bank ^= 2;
      }
      printf("0%06o (%02o,%04o", i, Bank, Offset);
      if (i < 04000)
        printf(" or %04o): ", i + (Block1 ? 02000 : 04000));
      else
        printf("):         ");
      if ((d1[1] & 1) || (d2[1] & 1))
        printf("%05o %o  %05o %o\n", n1, d1[1] & 1, n2, d2[1] & 1);
      else
        printf("%05o %05o\n", n1, n2);
    }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11dd <main+0x5d>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    183e <main+0x6be>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0x11b7(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1222 <main+0xa2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0x1197(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    183e <main+0x6be>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0x1172(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1270 <main+0xf0>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0x1149(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    183e <main+0x6be>
movl   $0x3,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1373 <main+0x1f3>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0x112b(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    12b0 <main+0x130>
movl   $0x1,-0x30(%rbp)
jmp    1360 <main+0x1e0>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0x1109(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    12dd <main+0x15d>
movl   $0x1,-0x34(%rbp)
jmp    135b <main+0x1db>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0x10e8(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    130a <main+0x18a>
movl   $0x1,-0x3c(%rbp)
jmp    1356 <main+0x1d6>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0x10c8(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    1337 <main+0x1b7>
movl   $0x1,-0x38(%rbp)
jmp    1351 <main+0x1d1>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0x10a5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1356 <main+0x1d6>
jmp    135b <main+0x1db>
jmp    1360 <main+0x1e0>
jmp    1365 <main+0x1e5>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1277 <main+0xf7>
mov    -0x18(%rbp),%rdi
mov    0x2c6a(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <fseek@plt>
mov    -0x20(%rbp),%rdi
mov    0x2c56(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <fseek@plt>
mov    -0x18(%rbp),%rdi
call   1080 <ftell@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1080 <ftell@plt>
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <rewind@plt>
mov    -0x20(%rbp),%rdi
call   1060 <rewind@plt>
cmpl   $0xe000,-0x24(%rbp)
jne    13f4 <main+0x274>
movl   $0x1,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0x1022(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1437 <main+0x2b7>
cmpl   $0x12000,-0x24(%rbp)
jne    141c <main+0x29c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0x100f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1432 <main+0x2b2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0x1009(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1437 <main+0x2b7>
cmpl   $0xe000,-0x28(%rbp)
jne    1466 <main+0x2e6>
movl   $0x1,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xfb0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    14a9 <main+0x329>
cmpl   $0x12000,-0x28(%rbp)
jne    148e <main+0x30e>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xf9d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    14a4 <main+0x324>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xf97(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    14a9 <main+0x329>
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
je     14d3 <main+0x353>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xf91(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    14ea <main+0x36a>
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    1501 <main+0x381>
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    14fc <main+0x37c>
mov    -0x28(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    1501 <main+0x381>
jmp    1506 <main+0x386>
lea    -0x42(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %edx,%ecx
mov    %al,-0x55(%rbp)
jne    1557 <main+0x3d7>
lea    -0x44(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x55(%rbp)
mov    -0x55(%rbp),%al
test   $0x1,%al
jne    1567 <main+0x3e7>
jmp    1837 <main+0x6b7>
movzbl -0x42(%rbp),%eax
movzbl -0x44(%rbp),%ecx
cmp    %ecx,%eax
jne    1587 <main+0x407>
movzbl -0x41(%rbp),%eax
movzbl -0x43(%rbp),%ecx
cmp    %ecx,%eax
je     1832 <main+0x6b2>
movzbl -0x42(%rbp),%eax
shl    $0x7,%eax
movzbl -0x41(%rbp),%ecx
sar    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x24(%rbp)
movzbl -0x44(%rbp),%eax
shl    $0x7,%eax
movzbl -0x43(%rbp),%ecx
sar    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x38(%rbp)
je     15c6 <main+0x446>
cmpl   $0x0,-0x28(%rbp)
jne    15c6 <main+0x446>
jmp    1506 <main+0x386>
mov    -0x18(%rbp),%rdi
call   1080 <ftell@plt>
sub    $0x2,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x40(%rbp)
je     1611 <main+0x491>
mov    -0x2c(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
add    $0xc00,%edx
mov    %edx,-0x4c(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1773 <main+0x5f3>
mov    -0x24(%rbp),%eax
and    $0x70,%eax
mov    %eax,-0x50(%rbp)
mov    -0x28(%rbp),%eax
and    $0x70,%eax
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     1645 <main+0x4c5>
mov    -0x24(%rbp),%ecx
xor    -0x28(%rbp),%ecx
mov    $0x40,%eax
cmp    %ecx,%eax
jne    1645 <main+0x4c5>
jmp    1506 <main+0x386>
mov    -0x24(%rbp),%eax
and    $0xffffff8f,%eax
mov    -0x28(%rbp),%ecx
and    $0xffffff8f,%ecx
cmp    %ecx,%eax
jne    1720 <main+0x5a0>
mov    -0x50(%rbp),%eax
cmp    -0x54(%rbp),%eax
je     1720 <main+0x5a0>
mov    $0x40,%eax
cmp    -0x50(%rbp),%eax
je     1691 <main+0x511>
mov    $0x30,%eax
cmp    -0x50(%rbp),%eax
je     1691 <main+0x511>
xor    %eax,%eax
cmp    -0x50(%rbp),%eax
jne    16b8 <main+0x538>
mov    $0x40,%eax
cmp    -0x54(%rbp),%eax
je     170c <main+0x58c>
mov    $0x30,%eax
cmp    -0x54(%rbp),%eax
je     170c <main+0x58c>
xor    %eax,%eax
cmp    -0x54(%rbp),%eax
je     170c <main+0x58c>
mov    $0x40,%eax
cmp    -0x50(%rbp),%eax
je     16e2 <main+0x562>
mov    $0x30,%eax
cmp    -0x50(%rbp),%eax
je     16e2 <main+0x562>
mov    $0x70,%eax
cmp    -0x50(%rbp),%eax
jne    1720 <main+0x5a0>
mov    $0x40,%eax
cmp    -0x54(%rbp),%eax
je     170c <main+0x58c>
mov    $0x30,%eax
cmp    -0x54(%rbp),%eax
je     170c <main+0x58c>
mov    $0x70,%eax
cmp    -0x54(%rbp),%eax
jne    1720 <main+0x5a0>
cmpl   $0x0,-0x30(%rbp)
je     171b <main+0x59b>
jmp    1506 <main+0x386>
jmp    1734 <main+0x5b4>
cmpl   $0x0,-0x3c(%rbp)
je     172f <main+0x5af>
jmp    1506 <main+0x386>
jmp    1734 <main+0x5b4>
jmp    1739 <main+0x5b9>
mov    -0x2c(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
add    $0x400,%edx
mov    %edx,-0x4c(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
mov    %eax,-0x48(%rbp)
cmpl   $0x4,-0x48(%rbp)
jge    176e <main+0x5ee>
mov    -0x48(%rbp),%eax
xor    $0x2,%eax
mov    %eax,-0x48(%rbp)
jmp    1773 <main+0x5f3>
mov    -0x2c(%rbp),%esi
mov    -0x48(%rbp),%edx
mov    -0x4c(%rbp),%ecx
lea    0xd04(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x800,-0x2c(%rbp)
jge    17c2 <main+0x642>
mov    -0x2c(%rbp),%esi
mov    -0x40(%rbp),%edx
mov    $0x800,%eax
mov    $0x400,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
add    %eax,%esi
lea    0xce2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    17d0 <main+0x650>
lea    0xcdb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movzbl -0x41(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    17f0 <main+0x670>
movzbl -0x43(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1819 <main+0x699>
mov    -0x24(%rbp),%esi
movzbl -0x41(%rbp),%edx
and    $0x1,%edx
mov    -0x28(%rbp),%ecx
movzbl -0x43(%rbp),%r8d
and    $0x1,%r8d
lea    0xca3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    182d <main+0x6ad>
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
lea    0xc9c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1832 <main+0x6b2>
jmp    1506 <main+0x386>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
cmp    $0x2,%edi
jg     11b9 <main+0x29>
lea    0xf80(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
jmp    16e5 <main+0x555>
mov    %rsi,%rbp
mov    %edi,%ebx
mov    0x8(%rsi),%rdi
lea    0xe37(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,0x20(%rsp)
test   %rax,%rax
je     138e <main+0x1fe>
mov    0x10(%rbp),%rdi
lea    0xe19(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,0x30(%rsp)
test   %rax,%rax
je     13aa <main+0x21a>
movl   $0x0,0x1c(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x18(%rsp)
movl   $0x0,0x10(%rsp)
cmp    $0x4,%ebx
jb     1307 <main+0x177>
mov    %ebx,%ebx
mov    $0x3,%r12d
lea    0xdec(%rip),%r14
lea    0xdf0(%rip),%r15
movl   $0x0,0x10(%rsp)
movl   $0x0,0x18(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x1c(%rsp)
jmp    1275 <main+0xe5>
nopl   0x0(%rax,%rax,1)
movl   $0x1,0x1c(%rsp)
add    $0x1,%r12
cmp    %r12,%rbx
je     1307 <main+0x177>
mov    0x0(%rbp,%r12,8),%r13
mov    %r13,%rdi
mov    %r14,%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1260 <main+0xd0>
mov    %r13,%rdi
mov    %r15,%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     12e0 <main+0x150>
mov    %r13,%rdi
lea    0xd93(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     12ed <main+0x15d>
mov    %r13,%rdi
lea    0xd8d(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     12fa <main+0x16a>
lea    0xd87(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1268 <main+0xd8>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movl   $0x1,0x14(%rsp)
jmp    1268 <main+0xd8>
movl   $0x1,0x10(%rsp)
jmp    1268 <main+0xd8>
movl   $0x1,0x18(%rsp)
jmp    1268 <main+0xd8>
mov    0x2cda(%rip),%r14
mov    (%r14),%edx
mov    0x20(%rsp),%r13
mov    %r13,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    (%r14),%edx
mov    0x30(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    %r13,%rdi
call   1090 <ftell@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
call   1090 <ftell@plt>
mov    %eax,%r12d
mov    %r13,%rdi
call   1070 <rewind@plt>
mov    %rbx,%rdi
call   1070 <rewind@plt>
movl   $0x1,0xc(%rsp)
lea    0xd00(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%r14d
cmp    $0xe000,%r15d
je     13d7 <main+0x247>
xor    %r14d,%r14d
cmp    $0x12000,%r15d
jne    13d0 <main+0x240>
lea    0xcf0(%rip),%rdi
jmp    13d7 <main+0x247>
mov    0x8(%rbp),%rsi
lea    0xc6a(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%eax
jmp    16e5 <main+0x555>
mov    0x20(%rsp),%rdi
call   1050 <fclose@plt>
mov    0x10(%rbp),%rsi
lea    0xc44(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x2,%eax
jmp    16e5 <main+0x555>
lea    0xcba(%rip),%rdi
mov    0x8(%rbp),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    $0xe000,%r12d
je     1409 <main+0x279>
cmp    $0x12000,%r12d
jne    13fd <main+0x26d>
lea    0xc81(%rip),%rbx
jmp    1404 <main+0x274>
lea    0xc8d(%rip),%rbx
mov    %r14d,0xc(%rsp)
mov    0x10(%rbp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    %r12d,%r15d
je     1432 <main+0x2a2>
mov    0x8(%rbp),%rsi
mov    0x10(%rbp),%rdx
lea    0xc8f(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xa(%rsp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    0x20(%rsp),%rcx
call   1040 <fread@plt>
cmp    $0x1,%eax
mov    $0x0,%eax
jne    16e5 <main+0x555>
xor    %eax,%eax
cmpl   $0x0,0xc(%rsp)
sete   %al
shl    $0xa,%eax
add    $0x400,%eax
mov    %eax,0x2c(%rsp)
lea    0x8(%rsp),%rbx
lea    0xa(%rsp),%rbp
jmp    14b0 <main+0x320>
lea    0xc9d(%rip),%rdi
mov    %r12d,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1060 <printf@plt>
nop
mov    %rbp,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    0x20(%rsp),%rcx
call   1040 <fread@plt>
cmp    $0x1,%eax
jne    16e3 <main+0x553>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    0x30(%rsp),%rcx
call   1040 <fread@plt>
cmp    $0x1,%eax
jne    16e3 <main+0x553>
movzbl 0xa(%rsp),%r12d
movzbl 0x8(%rsp),%r13d
movzbl 0xb(%rsp),%eax
movzbl 0x9(%rsp),%r14d
cmp    %r13b,%r12b
jne    14f1 <main+0x361>
cmp    %r14b,%al
je     1490 <main+0x300>
movzbl %r14b,%ebx
shl    $0x7,%r13d
shr    %ebx
or     %ebx,%r13d
cmpl   $0x0,0x18(%rsp)
je     1530 <main+0x3a0>
test   %r13d,%r13d
jne    1530 <main+0x3a0>
mov    %rbp,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    0x20(%rsp),%rcx
call   1040 <fread@plt>
cmp    $0x1,%eax
lea    0x8(%rsp),%rbx
je     14b0 <main+0x320>
jmp    16e3 <main+0x553>
mov    %al,0x7(%rsp)
movzbl %al,%r15d
shl    $0x7,%r12d
shr    %r15d
or     %r15d,%r12d
mov    0x20(%rsp),%rdi
call   1090 <ftell@plt>
cmpl   $0x0,0xc(%rsp)
je     15c1 <main+0x431>
lea    -0x2(%rax),%esi
mov    %esi,%ecx
shr    $0x1f,%ecx
lea    (%rax,%rcx,1),%ebx
add    $0xfffffffe,%ebx
sar    %ebx
lea    0x3ff(%rbx),%ecx
test   %ebx,%ebx
cmovns %ebx,%ecx
and    $0xfffffc00,%ecx
neg    %ecx
add    %ebx,%ecx
add    $0xc00,%ecx
lea    0x7fd(%rax),%edx
test   %esi,%esi
cmovns %esi,%edx
sar    $0xb,%edx
add    $0x1,%edx
mov    %rax,%r15
lea    0xb4b(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    $0x1001,%r15d
jg     1613 <main+0x483>
add    0x2c(%rsp),%ebx
lea    0xb3f(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1621 <main+0x491>
mov    %r13d,%ecx
xor    %r12d,%ecx
cmpl   $0x0,0x14(%rsp)
je     15d7 <main+0x447>
cmp    $0x40,%ecx
je     150a <main+0x37a>
test   $0x7f8f,%ecx
jne    1680 <main+0x4f0>
mov    %r15d,%ecx
and    $0xfffffff0,%ecx
mov    %ebx,%esi
and    $0xfffffff0,%esi
cmp    %esi,%ecx
je     1680 <main+0x4f0>
shr    $0x4,%r15d
lea    -0x3(%r15),%edx
cmp    $0x2,%edx
jb     165d <main+0x4cd>
test   %r15d,%r15d
je     165d <main+0x4cd>
cmp    $0x7,%r15d
jne    1680 <main+0x4f0>
and    $0x30,%ebx
jmp    1676 <main+0x4e6>
lea    0xae7(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x8(%rsp),%rbx
movzbl 0x7(%rsp),%ecx
and    $0x1,%cl
and    $0x1,%r14b
mov    %ecx,%eax
or     %r14b,%al
je     147b <main+0x2eb>
movzbl %cl,%edx
movzbl %r14b,%r8d
lea    0xac2(%rip),%rdi
mov    %r12d,%esi
mov    %r13d,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1490 <main+0x300>
and    $0x30,%ebx
je     168d <main+0x4fd>
cmp    $0x30,%esi
je     168d <main+0x4fd>
cmp    $0x30,%ecx
je     1676 <main+0x4e6>
cmp    $0x70,%ecx
je     1676 <main+0x4e6>
cmp    $0x40,%ecx
jne    1680 <main+0x4f0>
cmp    $0x30,%ebx
je     168d <main+0x4fd>
cmp    $0x40,%esi
je     168d <main+0x4fd>
cmpl   $0x0,0x10(%rsp)
jne    150a <main+0x37a>
jmp    1698 <main+0x508>
cmpl   $0x0,0x1c(%rsp)
jne    150a <main+0x37a>
lea    -0x2(%rax),%edx
mov    %edx,%ecx
shr    $0x1f,%ecx
lea    (%rax,%rcx,1),%ebx
add    $0xfffffffe,%ebx
sar    %ebx
lea    0x3ff(%rbx),%ecx
test   %ebx,%ebx
cmovns %ebx,%ecx
and    $0xfffffc00,%ecx
neg    %ecx
add    %ebx,%ecx
add    $0x400,%ecx
lea    0x7fd(%rax),%esi
test   %edx,%edx
cmovns %edx,%esi
sar    $0xb,%esi
mov    %esi,%edx
xor    $0x2,%edx
cmp    $0x2002,%eax
cmovge %esi,%edx
jmp    158f <main+0x3ff>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [931 x i8] c"USAGE:\0A\09bdiffhead AgcCoreFilename1 AgcCoreFilename2 [OPTIONS]\0AA binary-compare of two files is performed, and a list of all\0Adifferences is printed. The files are supposed to represent\0AAGC (Apollo Guidance Computer) core-ropes, consisting of 16-bit\0Awords. The output messages use the AGC addressing scheme.\0AThe available options are:\0A--no-super This option discards differences in which one\0A word has 100 (binary) in bit-positions 5,6,7\0A (the least-significant bit being position 1)\0A and 011 in the other word.\0A--only-super The opposite of the --no-super option. Shows\0A ONLY differences involving 000 vs. 100 vs. 011 in \0A bits 5,6,7.\0A--no-super2 Similar to --no-super, but discards ALL \0A differences which are merely in bit 7.\0A--no-zero This option discards differences in which the\0A word from the 2nd file is 00000.\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [27 x i8] c"Could not open file \22%s\22.\0A\00"
@.str.3 = [11 x i8] c"--no-super\00"
@.str.4 = [12 x i8] c"--no-super2\00"
@.str.5 = [13 x i8] c"--only-super\00"
@.str.6 = [10 x i8] c"--no-zero\00"
@.str.7 = [27 x i8] c"Unrecognized option \22%s\22.\0A\00"
@SEEK_END = global i32 0
@.str.8 = [21 x i8] c"File %s is Block 1.\0A\00"
@.str.9 = [21 x i8] c"File %s is Block 2.\0A\00"
@.str.10 = [41 x i8] c"File %s is neither Block 1 nor Block 2.\0A\00"
@.str.11 = [42 x i8] c"Files %s and %s are not the same length.\0A\00"
@.str.12 = [17 x i8] c"0%06o (%02o,%04o\00"
@.str.13 = [12 x i8] c" or %04o): \00"
@.str.14 = [12 x i8] c"): \00"
@.str.15 = [18 x i8] c"%05o %o %05o %o\0A\00"
@.str.16 = [11 x i8] c"%05o %05o\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca [2 x i8]
%17 = alloca [2 x i8]
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
store i32 0, i32* %14
store i32 0, i32* %15
%22 = load i32, i32* %4
%23 = icmp slt i32 %22, 3
br i1 %23, label %24, label %26
24: ; preds = %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([931 x i8], [931 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %388
26: ; preds = %2
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32* @fopen(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %30, i32** %6
%31 = load i32*, i32** %6
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %38
33: ; preds = %26
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %36)
store i32 1, i32* %3
br label %388
38: ; preds = %26
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = call i32* @fopen(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %42, i32** %7
%43 = load i32*, i32** %7
%44 = icmp eq i32* %43, null
br i1 %44, label %45, label %52
45: ; preds = %38
%46 = load i32*, i32** %6
%47 = call i32 @fclose(i32* %46)
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 2
%50 = load i8*, i8** %49
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %50)
store i32 2, i32* %3
br label %388
52: ; preds = %38
store i32 3, i32* %8
br label %53
53: ; preds = %104, %52
%54 = load i32, i32* %8
%55 = load i32, i32* %4
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %107
57: ; preds = %53
%58 = load i8**, i8*** %5
%59 = load i32, i32* %8
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8*, i8** %58, i64 %60
%62 = load i8*, i8** %61
%63 = call i32 @strcmp(i8* %62, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%64 = icmp ne i32 %63, 0
br i1 %64, label %66, label %65
65: ; preds = %57
store i32 1, i32* %11
br label %103
66: ; preds = %57
%67 = load i8**, i8*** %5
%68 = load i32, i32* %8
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8*, i8** %67, i64 %69
%71 = load i8*, i8** %70
%72 = call i32 @strcmp(i8* %71, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%73 = icmp ne i32 %72, 0
br i1 %73, label %75, label %74
74: ; preds = %66
store i32 1, i32* %12
br label %102
75: ; preds = %66
%76 = load i8**, i8*** %5
%77 = load i32, i32* %8
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8*, i8** %76, i64 %78
%80 = load i8*, i8** %79
%81 = call i32 @strcmp(i8* %80, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%82 = icmp ne i32 %81, 0
br i1 %82, label %84, label %83
83: ; preds = %75
store i32 1, i32* %14
br label %101
84: ; preds = %75
%85 = load i8**, i8*** %5
%86 = load i32, i32* %8
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8*, i8** %85, i64 %87
%89 = load i8*, i8** %88
%90 = call i32 @strcmp(i8* %89, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%91 = icmp ne i32 %90, 0
br i1 %91, label %93, label %92
92: ; preds = %84
store i32 1, i32* %13
br label %100
93: ; preds = %84
%94 = load i8**, i8*** %5
%95 = load i32, i32* %8
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds i8*, i8** %94, i64 %96
%98 = load i8*, i8** %97
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i8* %98)
br label %100
100: ; preds = %93, %92
br label %101
101: ; preds = %100, %83
br label %102
102: ; preds = %101, %74
br label %103
103: ; preds = %102, %65
br label %104
104: ; preds = %103
%105 = load i32, i32* %8
%106 = add nsw i32 %105, 1
store i32 %106, i32* %8
br label %53
107: ; preds = %53
%108 = load i32*, i32** %6
%109 = load i32, i32* @SEEK_END
%110 = call i32 @fseek(i32* %108, i32 0, i32 %109)
%111 = load i32*, i32** %7
%112 = load i32, i32* @SEEK_END
%113 = call i32 @fseek(i32* %111, i32 0, i32 %112)
%114 = load i32*, i32** %6
%115 = call i32 @ftell(i32* %114)
store i32 %115, i32* %8
%116 = load i32*, i32** %7
%117 = call i32 @ftell(i32* %116)
store i32 %117, i32* %9
%118 = load i32*, i32** %6
%119 = call i32 @rewind(i32* %118)
%120 = load i32*, i32** %7
%121 = call i32 @rewind(i32* %120)
%122 = load i32, i32* %8
%123 = icmp eq i32 %122, 57344
br i1 %123, label %124, label %129
124: ; preds = %107
store i32 1, i32* %15
%125 = load i8**, i8*** %5
%126 = getelementptr inbounds i8*, i8** %125, i64 1
%127 = load i8*, i8** %126
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* %127)
br label %143
129: ; preds = %107
%130 = load i32, i32* %8
%131 = icmp eq i32 %130, 73728
br i1 %131, label %132, label %137
132: ; preds = %129
%133 = load i8**, i8*** %5
%134 = getelementptr inbounds i8*, i8** %133, i64 1
%135 = load i8*, i8** %134
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i8* %135)
br label %142
137: ; preds = %129
%138 = load i8**, i8*** %5
%139 = getelementptr inbounds i8*, i8** %138, i64 1
%140 = load i8*, i8** %139
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.10, i64 0, i64 0), i8* %140)
br label %142
142: ; preds = %137, %132
br label %143
143: ; preds = %142, %124
%144 = load i32, i32* %9
%145 = icmp eq i32 %144, 57344
br i1 %145, label %146, label %151
146: ; preds = %143
store i32 1, i32* %15
%147 = load i8**, i8*** %5
%148 = getelementptr inbounds i8*, i8** %147, i64 2
%149 = load i8*, i8** %148
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* %149)
br label %165
151: ; preds = %143
%152 = load i32, i32* %9
%153 = icmp eq i32 %152, 73728
br i1 %153, label %154, label %159
154: ; preds = %151
%155 = load i8**, i8*** %5
%156 = getelementptr inbounds i8*, i8** %155, i64 2
%157 = load i8*, i8** %156
%158 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i8* %157)
br label %164
159: ; preds = %151
%160 = load i8**, i8*** %5
%161 = getelementptr inbounds i8*, i8** %160, i64 2
%162 = load i8*, i8** %161
%163 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.10, i64 0, i64 0), i8* %162)
br label %164
164: ; preds = %159, %154
br label %165
165: ; preds = %164, %146
%166 = load i32, i32* %8
%167 = load i32, i32* %9
%168 = icmp ne i32 %166, %167
br i1 %168, label %169, label %177
169: ; preds = %165
%170 = load i8**, i8*** %5
%171 = getelementptr inbounds i8*, i8** %170, i64 1
%172 = load i8*, i8** %171
%173 = load i8**, i8*** %5
%174 = getelementptr inbounds i8*, i8** %173, i64 2
%175 = load i8*, i8** %174
%176 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.11, i64 0, i64 0), i8* %172, i8* %175)
br label %177
177: ; preds = %169, %165
%178 = load i32, i32* %8
%179 = load i32, i32* %9
%180 = icmp slt i32 %178, %179
br i1 %180, label %181, label %183
181: ; preds = %177
%182 = load i32, i32* %8
store i32 %182, i32* %9
br label %190
183: ; preds = %177
%184 = load i32, i32* %9
%185 = load i32, i32* %8
%186 = icmp slt i32 %184, %185
br i1 %186, label %187, label %189
187: ; preds = %183
%188 = load i32, i32* %9
store i32 %188, i32* %8
br label %189
189: ; preds = %187, %183
br label %190
190: ; preds = %189, %181
br label %191
191: ; preds = %386, %325, %320, %270, %243, %190
%192 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 0
%193 = load i32*, i32** %6
%194 = call i32 @fread(i8* %192, i32 2, i32 1, i32* %193)
%195 = icmp eq i32 1, %194
br i1 %195, label %196, label %201
196: ; preds = %191
%197 = getelementptr inbounds [2 x i8], [2 x i8]* %17, i64 0, i64 0
%198 = load i32*, i32** %7
%199 = call i32 @fread(i8* %197, i32 2, i32 1, i32* %198)
%200 = icmp eq i32 1, %199
br label %201
201: ; preds = %196, %191
%202 = phi i1 [ false, %191 ], [ %200, %196 ]
br i1 %202, label %203, label %387
203: ; preds = %201
%204 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 0
%205 = load i8, i8* %204
%206 = zext i8 %205 to i32
%207 = getelementptr inbounds [2 x i8], [2 x i8]* %17, i64 0, i64 0
%208 = load i8, i8* %207
%209 = zext i8 %208 to i32
%210 = icmp ne i32 %206, %209
br i1 %210, label %219, label %211
211: ; preds = %203
%212 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 1
%213 = load i8, i8* %212
%214 = zext i8 %213 to i32
%215 = getelementptr inbounds [2 x i8], [2 x i8]* %17, i64 0, i64 1
%216 = load i8, i8* %215
%217 = zext i8 %216 to i32
%218 = icmp ne i32 %214, %217
br i1 %218, label %219, label %386
219: ; preds = %211, %203
%220 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 0
%221 = load i8, i8* %220
%222 = zext i8 %221 to i32
%223 = shl i32 %222, 7
%224 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 1
%225 = load i8, i8* %224
%226 = zext i8 %225 to i32
%227 = ashr i32 %226, 1
%228 = or i32 %223, %227
store i32 %228, i32* %8
%229 = getelementptr inbounds [2 x i8], [2 x i8]* %17, i64 0, i64 0
%230 = load i8, i8* %229
%231 = zext i8 %230 to i32
%232 = shl i32 %231, 7
%233 = getelementptr inbounds [2 x i8], [2 x i8]* %17, i64 0, i64 1
%234 = load i8, i8* %233
%235 = zext i8 %234 to i32
%236 = ashr i32 %235, 1
%237 = or i32 %232, %236
store i32 %237, i32* %9
%238 = load i32, i32* %13
%239 = icmp ne i32 %238, 0
br i1 %239, label %240, label %244
240: ; preds = %219
%241 = load i32, i32* %9
%242 = icmp eq i32 %241, 0
br i1 %242, label %243, label %244
243: ; preds = %240
br label %191
244: ; preds = %240, %219
%245 = load i32*, i32** %6
%246 = call i32 @ftell(i32* %245)
%247 = sub nsw i32 %246, 2
%248 = sdiv i32 %247, 2
store i32 %248, i32* %10
%249 = load i32, i32* %15
%250 = icmp ne i32 %249, 0
br i1 %250, label %251, label %258
251: ; preds = %244
%252 = load i32, i32* %10
%253 = srem i32 %252, 1024
%254 = add nsw i32 3072, %253
store i32 %254, i32* %19
%255 = load i32, i32* %10
%256 = sdiv i32 %255, 1024
%257 = add nsw i32 1, %256
store i32 %257, i32* %18
br label %340
258: ; preds = %244
%259 = load i32, i32* %8
%260 = and i32 112, %259
store i32 %260, i32* %20
%261 = load i32, i32* %9
%262 = and i32 112, %261
store i32 %262, i32* %21
%263 = load i32, i32* %12
%264 = icmp ne i32 %263, 0
br i1 %264, label %265, label %271
265: ; preds = %258
%266 = load i32, i32* %8
%267 = load i32, i32* %9
%268 = xor i32 %266, %267
%269 = icmp eq i32 64, %268
br i1 %269, label %270, label %271
270: ; preds = %265
br label %191
271: ; preds = %265, %258
%272 = load i32, i32* %8
%273 = and i32 -113, %272
%274 = load i32, i32* %9
%275 = and i32 -113, %274
%276 = icmp eq i32 %273, %275
br i1 %276, label %277, label %322
277: ; preds = %271
%278 = load i32, i32* %20
%279 = load i32, i32* %21
%280 = icmp ne i32 %278, %279
br i1 %280, label %281, label %322
281: ; preds = %277
%282 = load i32, i32* %20
%283 = icmp eq i32 64, %282
br i1 %283, label %290, label %284
284: ; preds = %281
%285 = load i32, i32* %20
%286 = icmp eq i32 48, %285
br i1 %286, label %290, label %287
287: ; preds = %284
%288 = load i32, i32* %20
%289 = icmp eq i32 0, %288
br i1 %289, label %290, label %299
290: ; preds = %287, %284, %281
%291 = load i32, i32* %21
%292 = icmp eq i32 64, %291
br i1 %292, label %317, label %293
293: ; preds = %290
%294 = load i32, i32* %21
%295 = icmp eq i32 48, %294
br i1 %295, label %317, label %296
296: ; preds = %293
%297 = load i32, i32* %21
%298 = icmp eq i32 0, %297
br i1 %298, label %317, label %299
299: ; preds = %296, %287
%300 = load i32, i32* %20
%301 = icmp eq i32 64, %300
br i1 %301, label %308, label %302
302: ; preds = %299
%303 = load i32, i32* %20
%304 = icmp eq i32 48, %303
br i1 %304, label %308, label %305
305: ; preds = %302
%306 = load i32, i32* %20
%307 = icmp eq i32 112, %306
br i1 %307, label %308, label %322
308: ; preds = %305, %302, %299
%309 = load i32, i32* %21
%310 = icmp eq i32 64, %309
br i1 %310, label %317, label %311
311: ; preds = %308
%312 = load i32, i32* %21
%313 = icmp eq i32 48, %312
br i1 %313, label %317, label %314
314: ; preds = %311
%315 = load i32, i32* %21
%316 = icmp eq i32 112, %315
br i1 %316, label %317, label %322
317: ; preds = %314, %311, %308, %296, %293, %290
%318 = load i32, i32* %11
%319 = icmp ne i32 %318, 0
br i1 %319, label %320, label %321
320: ; preds = %317
br label %191
321: ; preds = %317
br label %327
322: ; preds = %314, %305, %277, %271
%323 = load i32, i32* %14
%324 = icmp ne i32 %323, 0
br i1 %324, label %325, label %326
325: ; preds = %322
br label %191
326: ; preds = %322
br label %327
327: ; preds = %326, %321
br label %328
328: ; preds = %327
%329 = load i32, i32* %10
%330 = srem i32 %329, 1024
%331 = add nsw i32 1024, %330
store i32 %331, i32* %19
%332 = load i32, i32* %10
%333 = sdiv i32 %332, 1024
store i32 %333, i32* %18
%334 = load i32, i32* %18
%335 = icmp slt i32 %334, 4
br i1 %335, label %336, label %339
336: ; preds = %328
%337 = load i32, i32* %18
%338 = xor i32 %337, 2
store i32 %338, i32* %18
br label %339
339: ; preds = %336, %328
br label %340
340: ; preds = %339, %251
%341 = load i32, i32* %10
%342 = load i32, i32* %18
%343 = load i32, i32* %19
%344 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0), i32 %341, i32 %342, i32 %343)
%345 = load i32, i32* %10
%346 = icmp slt i32 %345, 2048
br i1 %346, label %347, label %355
347: ; preds = %340
%348 = load i32, i32* %10
%349 = load i32, i32* %15
%350 = icmp ne i32 %349, 0
%351 = zext i1 %350 to i64
%352 = select i1 %350, i32 1024, i32 2048
%353 = add nsw i32 %348, %352
%354 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0), i32 %353)
br label %357
355: ; preds = %340
%356 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0))
br label %357
357: ; preds = %355, %347
%358 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 1
%359 = load i8, i8* %358
%360 = zext i8 %359 to i32
%361 = and i32 %360, 1
%362 = icmp ne i32 %361, 0
br i1 %362, label %369, label %363
363: ; preds = %357
%364 = getelementptr inbounds [2 x i8], [2 x i8]* %17, i64 0, i64 1
%365 = load i8, i8* %364
%366 = zext i8 %365 to i32
%367 = and i32 %366, 1
%368 = icmp ne i32 %367, 0
br i1 %368, label %369, label %381
369: ; preds = %363, %357
%370 = load i32, i32* %8
%371 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 1
%372 = load i8, i8* %371
%373 = zext i8 %372 to i32
%374 = and i32 %373, 1
%375 = load i32, i32* %9
%376 = getelementptr inbounds [2 x i8], [2 x i8]* %17, i64 0, i64 1
%377 = load i8, i8* %376
%378 = zext i8 %377 to i32
%379 = and i32 %378, 1
%380 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0), i32 %370, i32 %374, i32 %375, i32 %379)
br label %385
381: ; preds = %363
%382 = load i32, i32* %8
%383 = load i32, i32* %9
%384 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i32 %382, i32 %383)
br label %385
385: ; preds = %381, %369
br label %386
386: ; preds = %385, %211
br label %191
387: ; preds = %201
store i32 0, i32* %3
br label %388
388: ; preds = %387, %45, %33, %24
%389 = load i32, i32* %3
ret i32 %389
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [27 x i8] c"Could not open file \22%s\22.\0A\00"
@.str.3 = [11 x i8] c"--no-super\00"
@.str.4 = [12 x i8] c"--no-super2\00"
@.str.5 = [13 x i8] c"--only-super\00"
@.str.6 = [10 x i8] c"--no-zero\00"
@.str.7 = [27 x i8] c"Unrecognized option \22%s\22.\0A\00"
@SEEK_END = global i32 0
@.str.8 = [21 x i8] c"File %s is Block 1.\0A\00"
@.str.9 = [21 x i8] c"File %s is Block 2.\0A\00"
@.str.10 = [41 x i8] c"File %s is neither Block 1 nor Block 2.\0A\00"
@.str.11 = [42 x i8] c"Files %s and %s are not the same length.\0A\00"
@.str.12 = [17 x i8] c"0%06o (%02o,%04o\00"
@.str.13 = [12 x i8] c" or %04o): \00"
@.str.14 = [12 x i8] c"): \00"
@.str.15 = [18 x i8] c"%05o %o %05o %o\0A\00"
@.str.16 = [11 x i8] c"%05o %05o\0A\00"
@str = [930 x i8] c"USAGE:\0A\09bdiffhead AgcCoreFilename1 AgcCoreFilename2 [OPTIONS]\0AA binary-compare of two files is performed, and a list of all\0Adifferences is printed. The files are supposed to represent\0AAGC (Apollo Guidance Computer) core-ropes, consisting of 16-bit\0Awords. The output messages use the AGC addressing scheme.\0AThe available options are:\0A--no-super This option discards differences in which one\0A word has 100 (binary) in bit-positions 5,6,7\0A (the least-significant bit being position 1)\0A and 011 in the other word.\0A--only-super The opposite of the --no-super option. Shows\0A ONLY differences involving 000 vs. 100 vs. 011 in \0A bits 5,6,7.\0A--no-super2 Similar to --no-super, but discards ALL \0A differences which are merely in bit 7.\0A--no-zero This option discards differences in which the\0A word from the 2nd file is 00000.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2 x i8]
%4 = alloca [2 x i8]
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 3
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([930 x i8], [930 x i8]* @str, i64 0, i64 0))
br label %203
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i8*, i8** %11
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %16)
br label %203
18: ; preds = %10
%19 = getelementptr inbounds i8*, i8** %1, i64 2
%20 = load i8*, i8** %19
%21 = tail call i32* @fopen(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %27, label %23
23: ; preds = %18
%24 = icmp ugt i32 %0, 3
br i1 %24, label %25, label %59
25: ; preds = %23
%26 = zext i32 %0 to i64
br label %31
27: ; preds = %18
%28 = tail call i32 @fclose(i32* %13)
%29 = load i8*, i8** %19
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %29)
br label %203
31: ; preds = %25, %52
%32 = phi i64 [ 3, %25 ], [ %57, %52 ]
%33 = phi i32 [ 0, %25 ], [ %56, %52 ]
%34 = phi i32 [ 0, %25 ], [ %55, %52 ]
%35 = phi i32 [ 0, %25 ], [ %54, %52 ]
%36 = phi i32 [ 0, %25 ], [ %53, %52 ]
%37 = getelementptr inbounds i8*, i8** %1, i64 %32
%38 = load i8*, i8** %37
%39 = tail call i32 @strcmp(i8* dereferenceable(1) %38, i8* dereferenceable(11) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%40 = icmp eq i32 %39, 0
br i1 %40, label %52, label %41
41: ; preds = %31
%42 = tail call i32 @strcmp(i8* dereferenceable(1) %38, i8* dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%43 = icmp eq i32 %42, 0
br i1 %43, label %52, label %44
44: ; preds = %41
%45 = tail call i32 @strcmp(i8* dereferenceable(1) %38, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%46 = icmp eq i32 %45, 0
br i1 %46, label %52, label %47
47: ; preds = %44
%48 = tail call i32 @strcmp(i8* dereferenceable(1) %38, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%49 = icmp eq i32 %48, 0
br i1 %49, label %52, label %50
50: ; preds = %47
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i8* %38)
br label %52
52: ; preds = %47, %44, %41, %31, %50
%53 = phi i32 [ %36, %50 ], [ 1, %31 ], [ %36, %41 ], [ %36, %44 ], [ %36, %47 ]
%54 = phi i32 [ %35, %50 ], [ %35, %31 ], [ 1, %41 ], [ %35, %44 ], [ %35, %47 ]
%55 = phi i32 [ %34, %50 ], [ %34, %31 ], [ %34, %41 ], [ %34, %44 ], [ 1, %47 ]
%56 = phi i32 [ %33, %50 ], [ %33, %31 ], [ %33, %41 ], [ 1, %44 ], [ %33, %47 ]
%57 = add nuw nsw i64 %32, 1
%58 = icmp eq i64 %57, %26
br i1 %58, label %59, label %31
59: ; preds = %52, %23
%60 = phi i32 [ 0, %23 ], [ %53, %52 ]
%61 = phi i32 [ 0, %23 ], [ %54, %52 ]
%62 = phi i32 [ 0, %23 ], [ %55, %52 ]
%63 = phi i32 [ 0, %23 ], [ %56, %52 ]
%64 = load i32, i32* @SEEK_END
%65 = tail call i32 @fseek(i32* %13, i32 0, i32 %64)
%66 = load i32, i32* @SEEK_END
%67 = tail call i32 @fseek(i32* %21, i32 0, i32 %66)
%68 = tail call i32 @ftell(i32* %13)
%69 = tail call i32 @ftell(i32* %21)
%70 = tail call i32 @rewind(i32* %13)
%71 = tail call i32 @rewind(i32* %21)
switch i32 %68, label %73 [
i32 57344, label %74
i32 73728, label %72
]
72: ; preds = %59
br label %74
73: ; preds = %59
br label %74
74: ; preds = %59, %72, %73
%75 = phi i8* [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), %72 ], [ getelementptr inbounds ([41 x i8], [41 x i8]* @.str.10, i64 0, i64 0), %73 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), %59 ]
%76 = phi i32 [ 0, %72 ], [ 0, %73 ], [ 1, %59 ]
%77 = load i8*, i8** %11
%78 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %75, i8* %77)
switch i32 %69, label %80 [
i32 57344, label %81
i32 73728, label %79
]
79: ; preds = %74
br label %81
80: ; preds = %74
br label %81
81: ; preds = %74, %79, %80
%82 = phi i8* [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), %79 ], [ getelementptr inbounds ([41 x i8], [41 x i8]* @.str.10, i64 0, i64 0), %80 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), %74 ]
%83 = phi i32 [ %76, %79 ], [ %76, %80 ], [ 1, %74 ]
%84 = load i8*, i8** %19
%85 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %82, i8* %84)
%86 = icmp eq i32 %68, %69
br i1 %86, label %91, label %87
87: ; preds = %81
%88 = load i8*, i8** %11
%89 = load i8*, i8** %19
%90 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.11, i64 0, i64 0), i8* %88, i8* %89)
br label %91
91: ; preds = %87, %81
%92 = call i32 @fread(i8* %5, i32 2, i32 1, i32* %13)
%93 = icmp eq i32 %92, 1
br i1 %93, label %94, label %203
94: ; preds = %91
%95 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
%96 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 1
%97 = icmp ne i32 %62, 0
%98 = icmp eq i32 %83, 0
%99 = icmp ne i32 %61, 0
%100 = icmp eq i32 %60, 0
%101 = icmp eq i32 %63, 0
%102 = select i1 %98, i32 2048, i32 1024
br label %103
103: ; preds = %199, %94
%104 = call i32 @fread(i8* %6, i32 2, i32 1, i32* %21)
%105 = icmp eq i32 %104, 1
br i1 %105, label %106, label %203
106: ; preds = %103
%107 = load i8, i8* %5
%108 = load i8, i8* %6
%109 = icmp eq i8 %107, %108
%110 = load i8, i8* %95
%111 = load i8, i8* %96
%112 = icmp eq i8 %110, %111
%113 = select i1 %109, i1 %112, i1 false
br i1 %113, label %200, label %114
114: ; preds = %106
%115 = zext i8 %107 to i32
%116 = shl nuw nsw i32 %115, 7
%117 = lshr i8 %110, 1
%118 = zext i8 %117 to i32
%119 = or i32 %116, %118
%120 = zext i8 %108 to i32
%121 = shl nuw nsw i32 %120, 7
%122 = lshr i8 %111, 1
%123 = zext i8 %122 to i32
%124 = or i32 %121, %123
%125 = icmp eq i32 %124, 0
%126 = select i1 %97, i1 %125, i1 false
br i1 %126, label %196, label %127
127: ; preds = %114
%128 = tail call i32 @ftell(i32* %13)
br i1 %98, label %136, label %129
129: ; preds = %127
%130 = add nsw i32 %128, -2
%131 = sdiv i32 %130, 2
%132 = srem i32 %131, 1024
%133 = add nsw i32 %132, 3072
%134 = sdiv i32 %130, 2048
%135 = add nsw i32 %134, 1
br label %173
136: ; preds = %127
%137 = and i32 %118, 112
%138 = and i32 %123, 112
%139 = xor i32 %124, %119
%140 = icmp eq i32 %139, 64
%141 = select i1 %99, i1 %140, i1 false
br i1 %141, label %196, label %142
142: ; preds = %136
%143 = and i32 %139, 32655
%144 = icmp ne i32 %143, 0
%145 = icmp eq i32 %137, %138
%146 = select i1 %144, i1 true, i1 %145
br i1 %146, label %163, label %147
147: ; preds = %142
%148 = lshr i32 %118, 4
switch i32 %148, label %163 [
i32 4, label %151
i32 3, label %151
i32 0, label %151
i32 7, label %149
]
149: ; preds = %147
%150 = and i32 %123, 48
br label %157
151: ; preds = %147, %147, %147
%152 = icmp eq i32 %138, 48
%153 = and i32 %123, 48
%154 = icmp eq i32 %153, 0
%155 = or i1 %154, %152
br i1 %155, label %162, label %156
156: ; preds = %151
switch i32 %137, label %163 [
i32 112, label %157
i32 64, label %157
i32 48, label %157
]
157: ; preds = %149, %156, %156, %156
%158 = phi i32 [ %150, %149 ], [ %153, %156 ], [ %153, %156 ], [ %153, %156 ]
%159 = icmp eq i32 %138, 64
%160 = icmp eq i32 %158, 48
%161 = or i1 %160, %159
br i1 %161, label %162, label %163
162: ; preds = %157, %151
br i1 %100, label %164, label %196
163: ; preds = %147, %156, %157, %142
br i1 %101, label %164, label %196
164: ; preds = %163, %162
%165 = add nsw i32 %128, -2
%166 = sdiv i32 %165, 2
%167 = srem i32 %166, 1024
%168 = add nsw i32 %167, 1024
%169 = sdiv i32 %165, 2048
%170 = icmp slt i32 %128, 8194
%171 = xor i32 %169, 2
%172 = select i1 %170, i32 %171, i32 %169
br label %173
173: ; preds = %164, %129
%174 = phi i32 [ %131, %129 ], [ %166, %164 ]
%175 = phi i32 [ %135, %129 ], [ %172, %164 ]
%176 = phi i32 [ %133, %129 ], [ %168, %164 ]
%177 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0), i32 %174, i32 %175, i32 %176)
%178 = icmp slt i32 %128, 4098
br i1 %178, label %179, label %182
179: ; preds = %173
%180 = add nsw i32 %174, %102
%181 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0), i32 %180)
br label %184
182: ; preds = %173
%183 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0))
br label %184
184: ; preds = %182, %179
%185 = and i8 %110, 1
%186 = icmp eq i8 %185, 0
%187 = and i8 %111, 1
%188 = icmp eq i8 %187, 0
%189 = select i1 %186, i1 %188, i1 false
br i1 %189, label %194, label %190
190: ; preds = %184
%191 = zext i8 %185 to i32
%192 = zext i8 %187 to i32
%193 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0), i32 %119, i32 %191, i32 %124, i32 %192)
br label %200
194: ; preds = %184
%195 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i32 %119, i32 %124)
br label %200
196: ; preds = %163, %162, %136, %114
%197 = call i32 @fread(i8* %5, i32 2, i32 1, i32* %13)
%198 = icmp eq i32 %197, 1
br i1 %198, label %199, label %203
199: ; preds = %196, %200
br label %103
200: ; preds = %106, %190, %194
%201 = call i32 @fread(i8* %5, i32 2, i32 1, i32* %13)
%202 = icmp eq i32 %201, 1
br i1 %202, label %199, label %203
203: ; preds = %200, %196, %103, %91, %27, %15, %8
%204 = phi i32 [ 1, %8 ], [ 1, %15 ], [ 2, %27 ], [ 0, %91 ], [ 0, %103 ], [ 0, %196 ], [ 0, %200 ]
ret i32 %204
}