#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*/ buf2;
typedef int /*<<< orphan*/ buf1;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ O_RDONLY;
int atoi(int /*<<< orphan*/);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int getopt(int, char **, char *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ optarg;
int optind;
int optopt;
int /*<<< orphan*/ printf(char *, ...);
int read(int, char **, int);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int cmp_main(int argc, char *argv[]) {
  int c;
  int fd1, fd2;
  char buf1[4096], buf2[4096];
  int res, res1, res2;
  int rv = 0;
  int i;
  int filepos = 0;
  int show_byte = 0;
  int show_all = 0;
  int limit = 0;
  do {
    c = getopt(argc, argv, "bln:");
    if (c == EOF)
      break;
    switch (c) {
    case 'b':
      show_byte = 1;
      break;
    case 'l':
      show_all = 1;
      break;
    case 'n':
      limit = atoi(optarg);
      break;
    case '?':
      fprintf(stderr, "%s: invalid option -%c\n", argv[0], optopt);
      exit(1);
    }
  } while (1);
  if (optind + 2 != argc) {
    fprintf(stderr, "Usage: %s [-b] [-l] [-n count] file1 file2\n", argv[0]);
    exit(1);
  }
  fd1 = open(argv[optind], O_RDONLY);
  if (fd1 < 0) {
    fprintf(stderr, "could not open %s, %s\n", argv[optind], strerror(errno));
    return 1;
  }
  fd2 = open(argv[optind + 1], O_RDONLY);
  if (fd2 < 0) {
    fprintf(stderr, "could not open %s, %s\n", argv[optind + 1],
            strerror(errno));
    return 1;
  }
  while (1) {
    res1 = read(fd1, &buf1, sizeof(buf1));
    res2 = read(fd2, &buf2, sizeof(buf2));
    res = res1 < res2 ? res1 : res2;
    if (res1 == 0 && res2 == 0) {
      return rv;
    }
    for (i = 0; i < res; i++) {
      if (buf1[i] != buf2[i]) {
        printf("%s %s differ byte %d", argv[optind], argv[optind + 1],
               filepos + i);
        if (show_byte)
          printf(" 0x%02x 0x%02x", buf1[i], buf2[i]);
        printf("\n");
        if (!show_all)
          return 1;
        rv = 1;
      }
      if (limit) {
        limit--;
        if (limit == 0)
          return rv;
      }
    }
    if (res1 != res2 || res < 0) {
      printf("%s on %s\n", res < 0 ? "Read error" : "EOF",
             res1 < res2 ? argv[optind] : argv[optind + 1]);
      return 1;
    }
    filepos += res;
  }
}


x86 assembly (clang, -O0):
<cmp_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2080,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x2030(%rbp)
movl   $0x0,-0x2038(%rbp)
movl   $0x0,-0x203c(%rbp)
movl   $0x0,-0x2040(%rbp)
movl   $0x0,-0x2044(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe2e(%rip),%rdx
call   1070 <getopt@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2dec(%rip),%rcx
cmp    (%rcx),%eax
jne    11f1 <cmp_main+0x71>
jmp    12c0 <cmp_main+0x140>
mov    -0x14(%rbp),%eax
mov    %eax,-0x2048(%rbp)
sub    $0x3f,%eax
je     127b <cmp_main+0xfb>
jmp    1208 <cmp_main+0x88>
mov    -0x2048(%rbp),%eax
sub    $0x62,%eax
je     1244 <cmp_main+0xc4>
jmp    121c <cmp_main+0x9c>
mov    -0x2048(%rbp),%eax
sub    $0x6c,%eax
je     1253 <cmp_main+0xd3>
jmp    1230 <cmp_main+0xb0>
mov    -0x2048(%rbp),%eax
sub    $0x6e,%eax
je     1262 <cmp_main+0xe2>
jmp    12ac <cmp_main+0x12c>
movl   $0x1,-0x203c(%rbp)
jmp    12ac <cmp_main+0x12c>
movl   $0x1,-0x2040(%rbp)
jmp    12ac <cmp_main+0x12c>
mov    0x2d8f(%rip),%rax
mov    (%rax),%edi
call   1080 <atoi@plt>
mov    %eax,-0x2044(%rbp)
jmp    12ac <cmp_main+0x12c>
mov    0x2d36(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    0x2d46(%rip),%rax
mov    (%rax),%ecx
lea    0xd6a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    12b1 <cmp_main+0x131>
mov    $0x1,%al
test   $0x1,%al
jne    11c4 <cmp_main+0x44>
jmp    12c0 <cmp_main+0x140>
mov    0x2d01(%rip),%rax
mov    (%rax),%eax
add    $0x2,%eax
cmp    -0x8(%rbp),%eax
je     12fd <cmp_main+0x17d>
mov    0x2cdc(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd31(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x2cc0(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
mov    0x2cca(%rip),%rax
mov    (%rax),%esi
call   1060 <open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    138a <cmp_main+0x20a>
mov    0x2c87(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2054(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2c84(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x2050(%rbp)
mov    0x2c57(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x2054(%rbp),%edi
mov    -0x2050(%rbp),%rdx
mov    %rax,%rcx
lea    0xcd2(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    16cf <cmp_main+0x54f>
mov    -0x10(%rbp),%rax
mov    0x2c33(%rip),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
mov    0x2c38(%rip),%rax
mov    (%rax),%esi
call   1060 <open@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1421 <cmp_main+0x2a1>
mov    0x2bf5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2064(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2bf2(%rip),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x2060(%rbp)
mov    0x2bc0(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x2064(%rbp),%edi
mov    -0x2060(%rbp),%rdx
mov    %rax,%rcx
lea    0xc3b(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    16cf <cmp_main+0x54f>
jmp    1426 <cmp_main+0x2a6>
mov    -0x18(%rbp),%edi
lea    -0x1020(%rbp),%rsi
mov    $0x1000,%edx
call   1040 <read@plt>
mov    %eax,-0x2028(%rbp)
mov    -0x1c(%rbp),%edi
lea    -0x2020(%rbp),%rsi
mov    $0x1000,%edx
call   1040 <read@plt>
mov    %eax,-0x202c(%rbp)
mov    -0x2028(%rbp),%eax
cmp    -0x202c(%rbp),%eax
jge    147d <cmp_main+0x2fd>
mov    -0x2028(%rbp),%eax
mov    %eax,-0x2068(%rbp)
jmp    1489 <cmp_main+0x309>
mov    -0x202c(%rbp),%eax
mov    %eax,-0x2068(%rbp)
mov    -0x2068(%rbp),%eax
mov    %eax,-0x2024(%rbp)
cmpl   $0x0,-0x2028(%rbp)
jne    14bd <cmp_main+0x33d>
cmpl   $0x0,-0x202c(%rbp)
jne    14bd <cmp_main+0x33d>
mov    -0x2030(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    16cf <cmp_main+0x54f>
movl   $0x0,-0x2034(%rbp)
mov    -0x2034(%rbp),%eax
cmp    -0x2024(%rbp),%eax
jge    1601 <cmp_main+0x481>
movslq -0x2034(%rbp),%rax
movsbl -0x1020(%rbp,%rax,1),%eax
ff
movslq -0x2034(%rbp),%rcx
movsbl -0x2020(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
je     15ac <cmp_main+0x42c>
mov    -0x10(%rbp),%rax
mov    0x2abe(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x10(%rbp),%rax
mov    0x2aac(%rip),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x2038(%rbp),%ecx
add    -0x2034(%rbp),%ecx
lea    0xb25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x203c(%rbp)
je     157b <cmp_main+0x3fb>
movslq -0x2034(%rbp),%rax
movsbl -0x1020(%rbp,%rax,1),%esi
ff
movslq -0x2034(%rbp),%rax
movsbl -0x2020(%rbp,%rax,1),%edx
ff
lea    0xb01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xac5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x2040(%rbp)
jne    15a2 <cmp_main+0x422>
movl   $0x1,-0x4(%rbp)
jmp    16cf <cmp_main+0x54f>
movl   $0x1,-0x2030(%rbp)
cmpl   $0x0,-0x2044(%rbp)
je     15e8 <cmp_main+0x468>
mov    -0x2044(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2044(%rbp)
cmpl   $0x0,-0x2044(%rbp)
jne    15e3 <cmp_main+0x463>
mov    -0x2030(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    16cf <cmp_main+0x54f>
jmp    15e8 <cmp_main+0x468>
jmp    15ed <cmp_main+0x46d>
mov    -0x2034(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2034(%rbp)
jmp    14c7 <cmp_main+0x347>
mov    -0x2028(%rbp),%eax
cmp    -0x202c(%rbp),%eax
jne    1620 <cmp_main+0x4a0>
cmpl   $0x0,-0x2024(%rbp)
jge    16b8 <cmp_main+0x538>
mov    -0x2024(%rbp),%edx
lea    0xa6c(%rip),%rax
lea    0xa5a(%rip),%rcx
cmp    $0x0,%edx
cmovl  %rcx,%rax
mov    %rax,-0x2070(%rbp)
mov    -0x2028(%rbp),%eax
cmp    -0x202c(%rbp),%eax
jge    1672 <cmp_main+0x4f2>
mov    -0x10(%rbp),%rax
mov    0x2969(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x2078(%rbp)
jmp    1690 <cmp_main+0x510>
mov    -0x10(%rbp),%rax
mov    0x294b(%rip),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x2078(%rbp)
mov    -0x2070(%rbp),%rsi
mov    -0x2078(%rbp),%rdx
lea    0x9df(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    16cf <cmp_main+0x54f>
mov    -0x2024(%rbp),%eax
add    -0x2038(%rbp),%eax
mov    %eax,-0x2038(%rbp)
jmp    1426 <cmp_main+0x2a6>
mov    -0x4(%rbp),%eax
add    $0x2080,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2038,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
lea    0xe53(%rip),%rdx
call   1080 <getopt@plt>
mov    0x2e17(%rip),%r12
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
mov    $0x0,%ebp
cmp    (%r12),%eax
jne    13c4 <cmp_main+0x234>
mov    0x2de9(%rip),%r15
movslq (%r15),%rax
lea    0x2(%rax),%ecx
cmp    %ebx,%ecx
jne    1516 <cmp_main+0x386>
mov    (%r14,%rax,8),%rdi
mov    0x2de8(%rip),%r12
mov    (%r12),%esi
call   1070 <open@plt>
test   %eax,%eax
js     1471 <cmp_main+0x2e1>
mov    %eax,%r13d
movslq (%r15),%rax
mov    0x8(%r14,%rax,8),%rdi
mov    (%r12),%esi
call   1070 <open@plt>
test   %eax,%eax
js     1483 <cmp_main+0x2f3>
mov    %eax,%r12d
lea    0x1030(%rsp),%rsi
mov    %r13d,%edi
mov    $0x1000,%edx
call   1050 <read@plt>
mov    %eax,%ebx
lea    0x30(%rsp),%rsi
mov    %r12d,%edi
mov    $0x1000,%edx
call   1050 <read@plt>
cmp    %eax,%ebx
setl   %cl
mov    %eax,%edx
or     %ebx,%edx
je     14d1 <cmp_main+0x341>
mov    %cl,0x7(%rsp)
mov    %r12d,0x20(%rsp)
mov    %r13d,0x24(%rsp)
cmp    %eax,%ebx
mov    %eax,0x18(%rsp)
mov    %ebx,0x1c(%rsp)
cmovl  %ebx,%eax
mov    %eax,0x8(%rsp)
movl   $0x0,0x14(%rsp)
xor    %ecx,%ecx
mov    0x8(%rsp),%eax
test   %eax,%eax
jle    1350 <cmp_main+0x1c0>
mov    %eax,%r15d
mov    0x14(%rsp),%edx
mov    %rdx,0x28(%rsp)
xor    %r13d,%r13d
jmp    12bf <cmp_main+0x12f>
cs nopw 0x0(%rax,%rax,1)
xor    %ebp,%ebp
add    $0x1,%r13
cmp    %r13,%r15
je     1350 <cmp_main+0x1c0>
movsbl 0x1030(%rsp,%r13,1),%ebx
movsbl 0x30(%rsp,%r13,1),%r12d
cmp    %r12b,%bl
je     1331 <cmp_main+0x1a1>
mov    0x2cee(%rip),%rax
movslq (%rax),%rax
mov    (%r14,%rax,8),%rsi
mov    0x8(%r14,%rax,8),%rdx
mov    0x28(%rsp),%rax
lea    (%rax,%r13,1),%ecx
lea    0xd6a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x10(%rsp)
je     1317 <cmp_main+0x187>
lea    0xd6a(%rip),%rdi
mov    %ebx,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%ecx
cmpl   $0x0,0xc(%rsp)
je     14bd <cmp_main+0x32d>
test   %ebp,%ebp
je     12b0 <cmp_main+0x120>
add    $0xffffffff,%ebp
jne    12b2 <cmp_main+0x122>
jmp    14bd <cmp_main+0x32d>
nopw   0x0(%rax,%rax,1)
mov    0x18(%rsp),%eax
cmp    %eax,0x1c(%rsp)
mov    0x8(%rsp),%eax
jne    14d5 <cmp_main+0x345>
test   %eax,%eax
js     14d5 <cmp_main+0x345>
add    %eax,0x14(%rsp)
mov    0x24(%rsp),%edi
lea    0x1030(%rsp),%rsi
mov    $0x1000,%edx
mov    %ecx,%r15d
call   1050 <read@plt>
mov    %eax,%ebx
mov    0x20(%rsp),%edi
lea    0x30(%rsp),%rsi
mov    $0x1000,%edx
call   1050 <read@plt>
cmp    %eax,%ebx
setl   0x7(%rsp)
mov    %eax,%ecx
cmovl  %ebx,%ecx
mov    %ecx,0x8(%rsp)
mov    %r15d,%ecx
mov    %eax,0x18(%rsp)
mov    %ebx,0x1c(%rsp)
or     %ebx,%eax
jne    1289 <cmp_main+0xf9>
jmp    14bd <cmp_main+0x32d>
xor    %ebp,%ebp
lea    0xc33(%rip),%r15
mov    0x2c24(%rip),%r13
movl   $0x0,0xc(%rsp)
movl   $0x0,0x10(%rsp)
jmp    140f <cmp_main+0x27f>
cs nopw 0x0(%rax,%rax,1)
movl   $0x1,0xc(%rsp)
mov    %ebx,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1080 <getopt@plt>
cmp    (%r12),%eax
je     11d8 <cmp_main+0x48>
cmp    $0x6b,%eax
jle    1430 <cmp_main+0x2a0>
cmp    $0x6c,%eax
je     13f0 <cmp_main+0x260>
cmp    $0x6e,%eax
jne    13f8 <cmp_main+0x268>
mov    0x0(%r13),%edi
call   1090 <atoi@plt>
mov    %eax,%ebp
jmp    13f8 <cmp_main+0x268>
nopl   0x0(%rax,%rax,1)
cmp    $0x62,%eax
jne    143f <cmp_main+0x2af>
movl   $0x1,0x10(%rsp)
jmp    13f8 <cmp_main+0x268>
cmp    $0x3f,%eax
jne    13f8 <cmp_main+0x268>
mov    0x2b6d(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
mov    0x2b81(%rip),%rax
mov    (%rax),%ecx
lea    0xba5(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    0x2b40(%rip),%rax
mov    (%rax),%ebx
movslq (%r15),%rax
mov    (%r14,%rax,8),%rbp
jmp    1494 <cmp_main+0x304>
mov    0x2b2e(%rip),%rax
mov    (%rax),%ebx
movslq (%r15),%rax
mov    0x8(%r14,%rax,8),%rbp
mov    0x2b15(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xba0(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%ecx
mov    %ecx,%eax
add    $0x2038,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ecx,%ecx
jmp    14bd <cmp_main+0x32d>
test   %eax,%eax
lea    0xbb0(%rip),%rax
lea    0xbb4(%rip),%rsi
cmovs  %rax,%rsi
mov    0x2ad8(%rip),%rax
movslq (%rax),%rax
mov    0x7(%rsp),%cl
not    %cl
movzbl %cl,%ecx
and    $0x1,%ecx
add    %rax,%rcx
mov    (%r14,%rcx,8),%rdx
lea    0xb77(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    14b8 <cmp_main+0x328>
mov    0x2a9b(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xaf4(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"bln:\00"
@EOF = global i32 0
@optarg = global i32 0
@stderr = global i32 0
@.str.1 = [24 x i8] c"%s: invalid option -%c\0A\00"
@optopt = global i32 0
@optind = global i32 0
@.str.2 = [44 x i8] c"Usage: %s [-b] [-l] [-n count] file1 file2\0A\00"
@O_RDONLY = global i32 0
@.str.3 = [23 x i8] c"could not open %s, %s\0A\00"
@errno = global i32 0
@.str.4 = [21 x i8] c"%s %s differ byte %d\00"
@.str.5 = [15 x i8] c" 0x%02x 0x%02x\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [10 x i8] c"%s on %s\0A\00"
@.str.8 = [11 x i8] c"Read error\00"
@.str.9 = [4 x i8] c"EOF\00"
define i32 @cmp_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 [4096 x i8]
%10 = alloca [4096 x i8]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %14
store i32 0, i32* %16
store i32 0, i32* %17
store i32 0, i32* %18
store i32 0, i32* %19
br label %20
20: ; preds = %44, %2
%21 = load i32, i32* %4
%22 = load i8**, i8*** %5
%23 = call i32 @getopt(i32 %21, i8** %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %23, i32* %6
%24 = load i32, i32* %6
%25 = load i32, i32* @EOF
%26 = icmp eq i32 %24, %25
br i1 %26, label %27, label %28
27: ; preds = %20
br label %45
28: ; preds = %20
%29 = load i32, i32* %6
switch i32 %29, label %43 [
i32 98, label %30
i32 108, label %31
i32 110, label %32
i32 63, label %35
]
30: ; preds = %28
store i32 1, i32* %17
br label %43
31: ; preds = %28
store i32 1, i32* %18
br label %43
32: ; preds = %28
%33 = load i32, i32* @optarg
%34 = call i32 @atoi(i32 %33)
store i32 %34, i32* %19
br label %43
35: ; preds = %28
%36 = load i32, i32* @stderr
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 0
%39 = load i8*, i8** %38
%40 = load i32, i32* @optopt
%41 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %39, i32 %40)
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %28, %32, %31, %30
br label %44
44: ; preds = %43
br i1 true, label %20, label %45
45: ; preds = %44, %27
%46 = load i32, i32* @optind
%47 = add nsw i32 %46, 2
%48 = load i32, i32* %4
%49 = icmp ne i32 %47, %48
br i1 %49, label %50, label %57
50: ; preds = %45
%51 = load i32, i32* @stderr
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 0
%54 = load i8*, i8** %53
%55 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i8* %54)
%56 = call i32 @exit(i32 1)
unreachable
57: ; preds = %45
%58 = load i8**, i8*** %5
%59 = load i32, i32* @optind
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8*, i8** %58, i64 %60
%62 = load i8*, i8** %61
%63 = load i32, i32* @O_RDONLY
%64 = call i32 @open(i8* %62, i32 %63)
store i32 %64, i32* %7
%65 = load i32, i32* %7
%66 = icmp slt i32 %65, 0
br i1 %66, label %67, label %77
67: ; preds = %57
%68 = load i32, i32* @stderr
%69 = load i8**, i8*** %5
%70 = load i32, i32* @optind
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8*, i8** %69, i64 %71
%73 = load i8*, i8** %72
%74 = load i32, i32* @errno
%75 = call i8* @strerror(i32 %74)
%76 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %73, i8* %75)
store i32 1, i32* %3
br label %226
77: ; preds = %57
%78 = load i8**, i8*** %5
%79 = load i32, i32* @optind
%80 = add nsw i32 %79, 1
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i8*, i8** %78, i64 %81
%83 = load i8*, i8** %82
%84 = load i32, i32* @O_RDONLY
%85 = call i32 @open(i8* %83, i32 %84)
store i32 %85, i32* %8
%86 = load i32, i32* %8
%87 = icmp slt i32 %86, 0
br i1 %87, label %88, label %99
88: ; preds = %77
%89 = load i32, i32* @stderr
%90 = load i8**, i8*** %5
%91 = load i32, i32* @optind
%92 = add nsw i32 %91, 1
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8*, i8** %90, i64 %93
%95 = load i8*, i8** %94
%96 = load i32, i32* @errno
%97 = call i8* @strerror(i32 %96)
%98 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %95, i8* %97)
store i32 1, i32* %3
br label %226
99: ; preds = %77
br label %100
100: ; preds = %99, %222
%101 = load i32, i32* %7
%102 = bitcast [4096 x i8]* %9 to i8**
%103 = call i32 @read(i32 %101, i8** %102, i32 4096)
store i32 %103, i32* %12
%104 = load i32, i32* %8
%105 = bitcast [4096 x i8]* %10 to i8**
%106 = call i32 @read(i32 %104, i8** %105, i32 4096)
store i32 %106, i32* %13
%107 = load i32, i32* %12
%108 = load i32, i32* %13
%109 = icmp slt i32 %107, %108
br i1 %109, label %110, label %112
110: ; preds = %100
%111 = load i32, i32* %12
br label %114
112: ; preds = %100
%113 = load i32, i32* %13
br label %114
114: ; preds = %112, %110
%115 = phi i32 [ %111, %110 ], [ %113, %112 ]
store i32 %115, i32* %11
%116 = load i32, i32* %12
%117 = icmp eq i32 %116, 0
br i1 %117, label %118, label %123
118: ; preds = %114
%119 = load i32, i32* %13
%120 = icmp eq i32 %119, 0
br i1 %120, label %121, label %123
121: ; preds = %118
%122 = load i32, i32* %14
store i32 %122, i32* %3
br label %226
123: ; preds = %118, %114
store i32 0, i32* %15
br label %124
124: ; preds = %188, %123
%125 = load i32, i32* %15
%126 = load i32, i32* %11
%127 = icmp slt i32 %125, %126
br i1 %127, label %128, label %191
128: ; preds = %124
%129 = load i32, i32* %15
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 %130
%132 = load i8, i8* %131
%133 = sext i8 %132 to i32
%134 = load i32, i32* %15
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 %135
%137 = load i8, i8* %136
%138 = sext i8 %137 to i32
%139 = icmp ne i32 %133, %138
br i1 %139, label %140, label %176
140: ; preds = %128
%141 = load i8**, i8*** %5
%142 = load i32, i32* @optind
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i8*, i8** %141, i64 %143
%145 = load i8*, i8** %144
%146 = load i8**, i8*** %5
%147 = load i32, i32* @optind
%148 = add nsw i32 %147, 1
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds i8*, i8** %146, i64 %149
%151 = load i8*, i8** %150
%152 = load i32, i32* %16
%153 = load i32, i32* %15
%154 = add nsw i32 %152, %153
%155 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %145, i8* %151, i32 %154)
%156 = load i32, i32* %17
%157 = icmp ne i32 %156, 0
br i1 %157, label %158, label %170
158: ; preds = %140
%159 = load i32, i32* %15
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 %160
%162 = load i8, i8* %161
%163 = sext i8 %162 to i32
%164 = load i32, i32* %15
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 %165
%167 = load i8, i8* %166
%168 = sext i8 %167 to i32
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 %163, i32 %168)
br label %170
170: ; preds = %158, %140
%171 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%172 = load i32, i32* %18
%173 = icmp ne i32 %172, 0
br i1 %173, label %175, label %174
174: ; preds = %170
store i32 1, i32* %3
br label %226
175: ; preds = %170
store i32 1, i32* %14
br label %176
176: ; preds = %175, %128
%177 = load i32, i32* %19
%178 = icmp ne i32 %177, 0
br i1 %178, label %179, label %187
179: ; preds = %176
%180 = load i32, i32* %19
%181 = add nsw i32 %180, -1
store i32 %181, i32* %19
%182 = load i32, i32* %19
%183 = icmp eq i32 %182, 0
br i1 %183, label %184, label %186
184: ; preds = %179
%185 = load i32, i32* %14
store i32 %185, i32* %3
br label %226
186: ; preds = %179
br label %187
187: ; preds = %186, %176
br label %188
188: ; preds = %187
%189 = load i32, i32* %15
%190 = add nsw i32 %189, 1
store i32 %190, i32* %15
br label %124
191: ; preds = %124
%192 = load i32, i32* %12
%193 = load i32, i32* %13
%194 = icmp ne i32 %192, %193
br i1 %194, label %198, label %195
195: ; preds = %191
%196 = load i32, i32* %11
%197 = icmp slt i32 %196, 0
br i1 %197, label %198, label %222
198: ; preds = %195, %191
%199 = load i32, i32* %11
%200 = icmp slt i32 %199, 0
%201 = zext i1 %200 to i64
%202 = select i1 %200, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0)
%203 = load i32, i32* %12
%204 = load i32, i32* %13
%205 = icmp slt i32 %203, %204
br i1 %205, label %206, label %212
206: ; preds = %198
%207 = load i8**, i8*** %5
%208 = load i32, i32* @optind
%209 = sext i32 %208 to i64
%210 = getelementptr inbounds i8*, i8** %207, i64 %209
%211 = load i8*, i8** %210
br label %219
212: ; preds = %198
%213 = load i8**, i8*** %5
%214 = load i32, i32* @optind
%215 = add nsw i32 %214, 1
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds i8*, i8** %213, i64 %216
%218 = load i8*, i8** %217
br label %219
219: ; preds = %212, %206
%220 = phi i8* [ %211, %206 ], [ %218, %212 ]
%221 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %202, i8* %220)
store i32 1, i32* %3
br label %226
222: ; preds = %195
%223 = load i32, i32* %11
%224 = load i32, i32* %16
%225 = add nsw i32 %224, %223
store i32 %225, i32* %16
br label %100
226: ; preds = %219, %184, %174, %121, %88, %67
%227 = load i32, i32* %3
ret i32 %227
}

LLVM IR (-O2):
@.str = [5 x i8] c"bln:\00"
@EOF = global i32 0
@optarg = global i32 0
@stderr = global i32 0
@.str.1 = [24 x i8] c"%s: invalid option -%c\0A\00"
@optopt = global i32 0
@optind = global i32 0
@.str.2 = [44 x i8] c"Usage: %s [-b] [-l] [-n count] file1 file2\0A\00"
@O_RDONLY = global i32 0
@.str.3 = [23 x i8] c"could not open %s, %s\0A\00"
@errno = global i32 0
@.str.4 = [21 x i8] c"%s %s differ byte %d\00"
@.str.5 = [15 x i8] c" 0x%02x 0x%02x\00"
@.str.7 = [10 x i8] c"%s on %s\0A\00"
@.str.8 = [11 x i8] c"Read error\00"
@.str.9 = [4 x i8] c"EOF\00"
define i32 @cmp_main(i32 %0, i8** %1) {
%3 = alloca [4096 x i8]
%4 = alloca [4096 x i8]
%5 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%7 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %33, label %10
10: ; preds = %2, %26
%11 = phi i32 [ %30, %26 ], [ %7, %2 ]
%12 = phi i32 [ %29, %26 ], [ 0, %2 ]
%13 = phi i32 [ %28, %26 ], [ 0, %2 ]
%14 = phi i32 [ %27, %26 ], [ 0, %2 ]
switch i32 %11, label %26 [
i32 98, label %15
i32 108, label %16
i32 110, label %17
i32 63, label %20
]
15: ; preds = %10
br label %26
16: ; preds = %10
br label %26
17: ; preds = %10
%18 = load i32, i32* @optarg
%19 = tail call i32 @atoi(i32 %18)
br label %26
20: ; preds = %10
%21 = load i32, i32* @stderr
%22 = load i8*, i8** %1
%23 = load i32, i32* @optopt
%24 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %22, i32 %23)
%25 = tail call i32 @exit(i32 1)
unreachable
26: ; preds = %15, %16, %17, %10
%27 = phi i32 [ %14, %10 ], [ %14, %17 ], [ %14, %16 ], [ 1, %15 ]
%28 = phi i32 [ %13, %10 ], [ %13, %17 ], [ 1, %16 ], [ %13, %15 ]
%29 = phi i32 [ %12, %10 ], [ %19, %17 ], [ %12, %16 ], [ %12, %15 ]
%30 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%31 = load i32, i32* @EOF
%32 = icmp eq i32 %30, %31
br i1 %32, label %33, label %10
33: ; preds = %26, %2
%34 = phi i32 [ 0, %2 ], [ %27, %26 ]
%35 = phi i32 [ 0, %2 ], [ %28, %26 ]
%36 = phi i32 [ 0, %2 ], [ %29, %26 ]
%37 = load i32, i32* @optind
%38 = add nsw i32 %37, 2
%39 = icmp eq i32 %38, %0
br i1 %39, label %45, label %40
40: ; preds = %33
%41 = load i32, i32* @stderr
%42 = load i8*, i8** %1
%43 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i8* %42)
%44 = tail call i32 @exit(i32 1)
unreachable
45: ; preds = %33
%46 = sext i32 %37 to i64
%47 = getelementptr inbounds i8*, i8** %1, i64 %46
%48 = load i8*, i8** %47
%49 = load i32, i32* @O_RDONLY
%50 = tail call i32 @open(i8* %48, i32 %49)
%51 = icmp slt i32 %50, 0
br i1 %51, label %52, label %61
52: ; preds = %45
%53 = load i32, i32* @stderr
%54 = load i32, i32* @optind
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8*, i8** %1, i64 %55
%57 = load i8*, i8** %56
%58 = load i32, i32* @errno
%59 = tail call i8* @strerror(i32 %58)
%60 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %57, i8* %59)
br label %164
61: ; preds = %45
%62 = load i32, i32* @optind
%63 = add nsw i32 %62, 1
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8*, i8** %1, i64 %64
%66 = load i8*, i8** %65
%67 = load i32, i32* @O_RDONLY
%68 = tail call i32 @open(i8* %66, i32 %67)
%69 = icmp slt i32 %68, 0
br i1 %69, label %82, label %70
70: ; preds = %61
%71 = bitcast [4096 x i8]* %3 to i8**
%72 = call i32 @read(i32 %50, i8** %71, i32 4096)
%73 = bitcast [4096 x i8]* %4 to i8**
%74 = call i32 @read(i32 %68, i8** %73, i32 4096)
%75 = icmp slt i32 %72, %74
%76 = or i32 %74, %72
%77 = icmp eq i32 %76, 0
br i1 %77, label %164, label %78
78: ; preds = %70
%79 = select i1 %75, i32 %72, i32 %74
%80 = icmp eq i32 %34, 0
%81 = icmp eq i32 %35, 0
br label %100
82: ; preds = %61
%83 = load i32, i32* @stderr
%84 = load i32, i32* @optind
%85 = add nsw i32 %84, 1
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8*, i8** %1, i64 %86
%88 = load i8*, i8** %87
%89 = load i32, i32* @errno
%90 = tail call i8* @strerror(i32 %89)
%91 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %83, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %88, i8* %90)
br label %164
92: ; preds = %148
%93 = add nsw i32 %101, %106
%94 = call i32 @read(i32 %50, i8** %71, i32 4096)
%95 = call i32 @read(i32 %68, i8** %73, i32 4096)
%96 = icmp slt i32 %94, %95
%97 = select i1 %96, i32 %94, i32 %95
%98 = or i32 %95, %94
%99 = icmp eq i32 %98, 0
br i1 %99, label %164, label %100
100: ; preds = %78, %92
%101 = phi i32 [ %79, %78 ], [ %97, %92 ]
%102 = phi i1 [ %75, %78 ], [ %96, %92 ]
%103 = phi i32 [ %74, %78 ], [ %95, %92 ]
%104 = phi i32 [ %72, %78 ], [ %94, %92 ]
%105 = phi i32 [ %36, %78 ], [ %150, %92 ]
%106 = phi i32 [ 0, %78 ], [ %93, %92 ]
%107 = phi i32 [ 0, %78 ], [ %149, %92 ]
%108 = icmp sgt i32 %101, 0
br i1 %108, label %109, label %148
109: ; preds = %100
%110 = zext i32 %101 to i64
br label %111
111: ; preds = %109, %144
%112 = phi i64 [ 0, %109 ], [ %146, %144 ]
%113 = phi i32 [ %105, %109 ], [ %145, %144 ]
%114 = phi i32 [ %107, %109 ], [ %139, %144 ]
%115 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %112
%116 = load i8, i8* %115
%117 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 %112
%118 = load i8, i8* %117
%119 = icmp eq i8 %116, %118
br i1 %119, label %138, label %120
120: ; preds = %111
%121 = load i32, i32* @optind
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i8*, i8** %1, i64 %122
%124 = load i8*, i8** %123
%125 = add nsw i32 %121, 1
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i8*, i8** %1, i64 %126
%128 = load i8*, i8** %127
%129 = trunc i64 %112 to i32
%130 = add nsw i32 %106, %129
%131 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %124, i8* %128, i32 %130)
br i1 %80, label %136, label %132
132: ; preds = %120
%133 = sext i8 %116 to i32
%134 = sext i8 %118 to i32
%135 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 %133, i32 %134)
br label %136
136: ; preds = %132, %120
%137 = tail call i32 @putchar(i32 10)
br i1 %81, label %164, label %138
138: ; preds = %136, %111
%139 = phi i32 [ %114, %111 ], [ 1, %136 ]
%140 = icmp eq i32 %113, 0
br i1 %140, label %144, label %141
141: ; preds = %138
%142 = add nsw i32 %113, -1
%143 = icmp eq i32 %142, 0
br i1 %143, label %164, label %144
144: ; preds = %138, %141
%145 = phi i32 [ %142, %141 ], [ 0, %138 ]
%146 = add nuw nsw i64 %112, 1
%147 = icmp eq i64 %146, %110
br i1 %147, label %148, label %111
148: ; preds = %144, %100
%149 = phi i32 [ %107, %100 ], [ %139, %144 ]
%150 = phi i32 [ %105, %100 ], [ %145, %144 ]
%151 = icmp ne i32 %104, %103
%152 = icmp slt i32 %101, 0
%153 = or i1 %151, %152
br i1 %153, label %154, label %92
154: ; preds = %148
%155 = select i1 %152, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0)
%156 = load i32, i32* @optind
%157 = xor i1 %102, true
%158 = zext i1 %157 to i32
%159 = add nsw i32 %156, %158
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds i8*, i8** %1, i64 %160
%162 = load i8*, i8** %161
%163 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %155, i8* %162)
br label %164
164: ; preds = %92, %141, %136, %70, %154, %82, %52
%165 = phi i32 [ 1, %52 ], [ 1, %82 ], [ 1, %154 ], [ 0, %70 ], [ %139, %141 ], [ 1, %136 ], [ %149, %92 ]
ret i32 %165
}