#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 unsigned long ssize_t;

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char *malloc(unsigned long);
int open(char *, int /*<<< orphan*/);
unsigned long read(int, char *, unsigned long);
int /*<<< orphan*/ stderr;
char *strerror(int);
unsigned long strtoul(char *, int /*<<< orphan*/ *, int);
int main(int argc, char **argv) {
  int fd1, fd2;
  unsigned long int len, i;
  ssize_t ret;
  char *buf1;
  char *buf2;
  if (argc != 4) {
    fprintf(stderr, "Usage: %s file1 file2 len\n", argv[0]);
    return 1;
  }
  errno = 0;
  len = strtoul(argv[3], NULL, 10);
  if (errno) {
    fprintf(stderr, "Error stroul %s : %s\n", argv[3], strerror(errno));
    return errno;
  }
  buf1 = malloc(len);
  if (buf1 == NULL) {
    fprintf(stderr, "Error malloc %lu : %s\n", len, strerror(errno));
    return errno;
  }
  buf2 = malloc(len);
  if (buf2 == NULL) {
    fprintf(stderr, "Error malloc %lu : %s\n", len, strerror(errno));
    return errno;
  }
  fd1 = open(argv[1], O_RDONLY);
  if (fd1 < 0) {
    fprintf(stderr, "Error opening %s : %s\n", argv[1], strerror(errno));
    return errno;
  }
  fd2 = open(argv[2], O_RDONLY);
  if (fd2 < 0) {
    fprintf(stderr, "Error opening %s : %s\n", argv[2], strerror(errno));
    return errno;
  }
  ret = read(fd1, buf1, len);
  if (ret < 0) {
    fprintf(stderr, "Error reading from %s : %s\n", argv[1], strerror(errno));
    return errno;
  } else if (len != ret) {
    fprintf(stderr, "Error reading %lu bytes from %s\n", len, argv[1]);
    return 1;
  }
  ret = read(fd2, buf2, len);
  if (ret < 0) {
    fprintf(stderr, "Error reading from %s : %s\n", argv[2], strerror(errno));
    return errno;
  } else if (len != ret) {
    fprintf(stderr, "Error reading %lu bytes from %s\n", len, argv[2]);
    return 1;
  }
  for (i = 0; i < len; i++)
    if (buf1[i] != buf2[i]) {
      fprintf(stderr, "Error byte %lu in %s(%#x) and %s(%#x) did not match\n",
              i, argv[1], buf1[i], argv[2], buf2[i]);
      return 5;
    }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     11ad <main+0x4d>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe66(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1607 <main+0x4a7>
mov    0x2e1c(%rip),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1070 <strtoul@plt>
mov    %rax,-0x20(%rbp)
mov    0x2df5(%rip),%rax
cmpl   $0x0,(%rax)
je     1233 <main+0xd3>
mov    0x2ded(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x48(%rbp)
mov    0x2dcd(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    -0x4c(%rbp),%edi
mov    -0x48(%rbp),%rdx
mov    %rax,%rcx
lea    0xe00(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2da7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1607 <main+0x4a7>
mov    -0x20(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1296 <main+0x136>
mov    0x2d86(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    0x2d6a(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    -0x5c(%rbp),%edi
mov    -0x58(%rbp),%rdx
mov    %rax,%rcx
lea    0xdb3(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2d44(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1607 <main+0x4a7>
mov    -0x20(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    12f9 <main+0x199>
mov    0x2d23(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    0x2d07(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    -0x6c(%rbp),%edi
mov    -0x68(%rbp),%rdx
mov    %rax,%rcx
lea    0xd50(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2ce1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1607 <main+0x4a7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2ce0(%rip),%rax
mov    (%rax),%esi
call   1060 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    136b <main+0x20b>
mov    0x2cb5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x78(%rbp)
mov    0x2c95(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    -0x7c(%rbp),%edi
mov    -0x78(%rbp),%rdx
mov    %rax,%rcx
lea    0xcf5(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2c6f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1607 <main+0x4a7>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x2c6e(%rip),%rax
mov    (%rax),%esi
call   1060 <open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    13e9 <main+0x289>
mov    0x2c43(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x88(%rbp)
mov    0x2c1d(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    -0x8c(%rbp),%edi
mov    -0x88(%rbp),%rdx
mov    %rax,%rcx
lea    0xc77(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2bf1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1607 <main+0x4a7>
mov    -0x14(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <read@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jae    1463 <main+0x303>
mov    0x2bc9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x98(%rbp)
mov    0x2ba3(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    -0x9c(%rbp),%edi
mov    -0x98(%rbp),%rdx
mov    %rax,%rcx
lea    0xc14(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2b77(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1607 <main+0x4a7>
mov    -0x20(%rbp),%rax
cmp    -0x30(%rbp),%rax
je     14a0 <main+0x340>
mov    0x2b60(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xbee(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1607 <main+0x4a7>
jmp    14a5 <main+0x345>
mov    -0x18(%rbp),%edi
mov    -0x40(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <read@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jae    151f <main+0x3bf>
mov    0x2b0d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xac(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0xa8(%rbp)
mov    0x2ae7(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    -0xac(%rbp),%edi
mov    -0xa8(%rbp),%rdx
mov    %rax,%rcx
lea    0xb58(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2abb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1607 <main+0x4a7>
mov    -0x20(%rbp),%rax
cmp    -0x30(%rbp),%rax
je     155c <main+0x3fc>
mov    0x2aa4(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
lea    0xb32(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1607 <main+0x4a7>
jmp    1561 <main+0x401>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1600 <main+0x4a0>
mov    -0x38(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x40(%rbp),%rcx
mov    -0x28(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     15ea <main+0x48a>
mov    0x2a3a(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0x38(%rbp),%rax
mov    -0x28(%rbp),%rsi
movsbl (%rax,%rsi,1),%r8d
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%r9
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rsi
movsbl (%rax,%rsi,1),%eax
lea    0xac8(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x5,-0x4(%rbp)
jmp    1607 <main+0x4a7>
jmp    15ef <main+0x48f>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1569 <main+0x409>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x4,%edi
jne    11bd <main+0x5d>
mov    0x2e56(%rip),%r13
movl   $0x0,0x0(%r13)
mov    0x18(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <strtoul@plt>
mov    0x0(%r13),%edi
test   %edi,%edi
je     11e1 <main+0x81>
mov    0x2e37(%rip),%rax
mov    (%rax),%ebp
mov    0x18(%rbx),%rbx
call   1080 <strerror@plt>
lea    0xe68(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
jmp    12b9 <main+0x159>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe30(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%eax
jmp    12c7 <main+0x167>
mov    %rax,%r14
mov    %rax,%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     129d <main+0x13d>
mov    %rax,%r15
mov    %r14,%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     129d <main+0x13d>
mov    %rax,%r12
mov    0x8(%rbx),%rdi
mov    0x2dd1(%rip),%rax
mov    (%rax),%esi
call   1060 <open@plt>
test   %eax,%eax
js     12d6 <main+0x176>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
mov    0x2db5(%rip),%rax
mov    (%rax),%esi
call   1060 <open@plt>
test   %eax,%eax
js     12e5 <main+0x185>
mov    %eax,%r13d
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <read@plt>
cmp    %rax,%r14
jne    1307 <main+0x1a7>
mov    %r13d,%edi
mov    %r12,%rsi
mov    %r14,%rdx
call   1030 <read@plt>
cmp    %rax,%r14
jne    1316 <main+0x1b6>
test   %r14,%r14
je     133b <main+0x1db>
xor    %edx,%edx
movsbl (%r15,%rdx,1),%r8d
movsbl (%r12,%rdx,1),%eax
cmp    %al,%r8b
jne    133f <main+0x1df>
add    $0x1,%rdx
xor    %eax,%eax
cmp    %rdx,%r14
jne    127d <main+0x11d>
jmp    12c7 <main+0x167>
mov    0x2d34(%rip),%rax
mov    (%rax),%ebx
xor    %edi,%edi
call   1080 <strerror@plt>
lea    0xd7d(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x0(%r13),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cfb(%rip),%rax
mov    (%rax),%ebp
mov    0x8(%rbx),%rbx
jmp    12f2 <main+0x192>
mov    0x2cec(%rip),%rax
mov    (%rax),%ebp
mov    0x10(%rbx),%rbx
mov    0x0(%r13),%edi
call   1080 <strerror@plt>
lea    0xd46(%rip),%rsi
jmp    11b3 <main+0x53>
mov    0x2cca(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rcx
jmp    1323 <main+0x1c3>
mov    0x2cbb(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbx),%rcx
lea    0xd35(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%eax
jmp    12c7 <main+0x167>
xor    %eax,%eax
jmp    12c7 <main+0x167>
mov    0x2c92(%rip),%rcx
mov    (%rcx),%edi
mov    0x8(%rbx),%rcx
mov    0x10(%rbx),%r9
mov    %eax,(%rsp)
lea    0xd26(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x5,%eax
jmp    12c7 <main+0x167>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"Usage: %s file1 file2 len\0A\00"
@errno = global i32 0
@.str.1 = [22 x i8] c"Error stroul %s : %s\0A\00"
@.str.2 = [23 x i8] c"Error malloc %lu : %s\0A\00"
@O_RDONLY = global i32 0
@.str.3 = [23 x i8] c"Error opening %s : %s\0A\00"
@.str.4 = [28 x i8] c"Error reading from %s : %s\0A\00"
@.str.5 = [33 x i8] c"Error reading %lu bytes from %s\0A\00"
@.str.6 = [53 x i8] c"Error byte %lu in %s(%#x) and %s(%#x) did not match\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 i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 4
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %19)
store i32 1, i32* %3
br label %193
21: ; preds = %2
store i32 0, i32* @errno
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 3
%24 = load i8*, i8** %23
%25 = call i64 @strtoul(i8* %24, i32* null, i32 10)
store i64 %25, i64* %8
%26 = load i32, i32* @errno
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %37
28: ; preds = %21
%29 = load i32, i32* @stderr
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 3
%32 = load i8*, i8** %31
%33 = load i32, i32* @errno
%34 = call i8* @strerror(i32 %33)
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %32, i8* %34)
%36 = load i32, i32* @errno
store i32 %36, i32* %3
br label %193
37: ; preds = %21
%38 = load i64, i64* %8
%39 = call i8* @malloc(i64 %38)
store i8* %39, i8** %11
%40 = load i8*, i8** %11
%41 = icmp eq i8* %40, null
br i1 %41, label %42, label %49
42: ; preds = %37
%43 = load i32, i32* @stderr
%44 = load i64, i64* %8
%45 = load i32, i32* @errno
%46 = call i8* @strerror(i32 %45)
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i64 %44, i8* %46)
%48 = load i32, i32* @errno
store i32 %48, i32* %3
br label %193
49: ; preds = %37
%50 = load i64, i64* %8
%51 = call i8* @malloc(i64 %50)
store i8* %51, i8** %12
%52 = load i8*, i8** %12
%53 = icmp eq i8* %52, null
br i1 %53, label %54, label %61
54: ; preds = %49
%55 = load i32, i32* @stderr
%56 = load i64, i64* %8
%57 = load i32, i32* @errno
%58 = call i8* @strerror(i32 %57)
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i64 %56, i8* %58)
%60 = load i32, i32* @errno
store i32 %60, i32* %3
br label %193
61: ; preds = %49
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 1
%64 = load i8*, i8** %63
%65 = load i32, i32* @O_RDONLY
%66 = call i32 @open(i8* %64, i32 %65)
store i32 %66, i32* %6
%67 = load i32, i32* %6
%68 = icmp slt i32 %67, 0
br i1 %68, label %69, label %78
69: ; preds = %61
%70 = load i32, i32* @stderr
%71 = load i8**, i8*** %5
%72 = getelementptr inbounds i8*, i8** %71, i64 1
%73 = load i8*, i8** %72
%74 = load i32, i32* @errno
%75 = call i8* @strerror(i32 %74)
%76 = call i32 (i32, i8*, ...) @fprintf(i32 %70, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %73, i8* %75)
%77 = load i32, i32* @errno
store i32 %77, i32* %3
br label %193
78: ; preds = %61
%79 = load i8**, i8*** %5
%80 = getelementptr inbounds i8*, i8** %79, i64 2
%81 = load i8*, i8** %80
%82 = load i32, i32* @O_RDONLY
%83 = call i32 @open(i8* %81, i32 %82)
store i32 %83, i32* %7
%84 = load i32, i32* %7
%85 = icmp slt i32 %84, 0
br i1 %85, label %86, label %95
86: ; preds = %78
%87 = load i32, i32* @stderr
%88 = load i8**, i8*** %5
%89 = getelementptr inbounds i8*, i8** %88, i64 2
%90 = load i8*, i8** %89
%91 = load i32, i32* @errno
%92 = call i8* @strerror(i32 %91)
%93 = call i32 (i32, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %90, i8* %92)
%94 = load i32, i32* @errno
store i32 %94, i32* %3
br label %193
95: ; preds = %78
%96 = load i32, i32* %6
%97 = load i8*, i8** %11
%98 = load i64, i64* %8
%99 = call i64 @read(i32 %96, i8* %97, i64 %98)
store i64 %99, i64* %10
%100 = load i64, i64* %10
%101 = icmp ult i64 %100, 0
br i1 %101, label %102, label %111
102: ; preds = %95
%103 = load i32, i32* @stderr
%104 = load i8**, i8*** %5
%105 = getelementptr inbounds i8*, i8** %104, i64 1
%106 = load i8*, i8** %105
%107 = load i32, i32* @errno
%108 = call i8* @strerror(i32 %107)
%109 = call i32 (i32, i8*, ...) @fprintf(i32 %103, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i8* %106, i8* %108)
%110 = load i32, i32* @errno
store i32 %110, i32* %3
br label %193
111: ; preds = %95
%112 = load i64, i64* %8
%113 = load i64, i64* %10
%114 = icmp ne i64 %112, %113
br i1 %114, label %115, label %122
115: ; preds = %111
%116 = load i32, i32* @stderr
%117 = load i64, i64* %8
%118 = load i8**, i8*** %5
%119 = getelementptr inbounds i8*, i8** %118, i64 1
%120 = load i8*, i8** %119
%121 = call i32 (i32, i8*, ...) @fprintf(i32 %116, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i64 %117, i8* %120)
store i32 1, i32* %3
br label %193
122: ; preds = %111
br label %123
123: ; preds = %122
%124 = load i32, i32* %7
%125 = load i8*, i8** %12
%126 = load i64, i64* %8
%127 = call i64 @read(i32 %124, i8* %125, i64 %126)
store i64 %127, i64* %10
%128 = load i64, i64* %10
%129 = icmp ult i64 %128, 0
br i1 %129, label %130, label %139
130: ; preds = %123
%131 = load i32, i32* @stderr
%132 = load i8**, i8*** %5
%133 = getelementptr inbounds i8*, i8** %132, i64 2
%134 = load i8*, i8** %133
%135 = load i32, i32* @errno
%136 = call i8* @strerror(i32 %135)
%137 = call i32 (i32, i8*, ...) @fprintf(i32 %131, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i8* %134, i8* %136)
%138 = load i32, i32* @errno
store i32 %138, i32* %3
br label %193
139: ; preds = %123
%140 = load i64, i64* %8
%141 = load i64, i64* %10
%142 = icmp ne i64 %140, %141
br i1 %142, label %143, label %150
143: ; preds = %139
%144 = load i32, i32* @stderr
%145 = load i64, i64* %8
%146 = load i8**, i8*** %5
%147 = getelementptr inbounds i8*, i8** %146, i64 2
%148 = load i8*, i8** %147
%149 = call i32 (i32, i8*, ...) @fprintf(i32 %144, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i64 %145, i8* %148)
store i32 1, i32* %3
br label %193
150: ; preds = %139
br label %151
151: ; preds = %150
store i64 0, i64* %9
br label %152
152: ; preds = %189, %151
%153 = load i64, i64* %9
%154 = load i64, i64* %8
%155 = icmp ult i64 %153, %154
br i1 %155, label %156, label %192
156: ; preds = %152
%157 = load i8*, i8** %11
%158 = load i64, i64* %9
%159 = getelementptr inbounds i8, i8* %157, i64 %158
%160 = load i8, i8* %159
%161 = sext i8 %160 to i32
%162 = load i8*, i8** %12
%163 = load i64, i64* %9
%164 = getelementptr inbounds i8, i8* %162, i64 %163
%165 = load i8, i8* %164
%166 = sext i8 %165 to i32
%167 = icmp ne i32 %161, %166
br i1 %167, label %168, label %188
168: ; preds = %156
%169 = load i32, i32* @stderr
%170 = load i64, i64* %9
%171 = load i8**, i8*** %5
%172 = getelementptr inbounds i8*, i8** %171, i64 1
%173 = load i8*, i8** %172
%174 = load i8*, i8** %11
%175 = load i64, i64* %9
%176 = getelementptr inbounds i8, i8* %174, i64 %175
%177 = load i8, i8* %176
%178 = sext i8 %177 to i32
%179 = load i8**, i8*** %5
%180 = getelementptr inbounds i8*, i8** %179, i64 2
%181 = load i8*, i8** %180
%182 = load i8*, i8** %12
%183 = load i64, i64* %9
%184 = getelementptr inbounds i8, i8* %182, i64 %183
%185 = load i8, i8* %184
%186 = sext i8 %185 to i32
%187 = call i32 (i32, i8*, ...) @fprintf(i32 %169, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.6, i64 0, i64 0), i64 %170, i8* %173, i32 %178, i8* %181, i32 %186)
store i32 5, i32* %3
br label %193
188: ; preds = %156
br label %189
189: ; preds = %188
%190 = load i64, i64* %9
%191 = add i64 %190, 1
store i64 %191, i64* %9
br label %152
192: ; preds = %152
store i32 0, i32* %3
br label %193
193: ; preds = %192, %168, %143, %130, %115, %102, %86, %69, %54, %42, %28, %15
%194 = load i32, i32* %3
ret i32 %194
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"Usage: %s file1 file2 len\0A\00"
@errno = global i32 0
@.str.1 = [22 x i8] c"Error stroul %s : %s\0A\00"
@.str.2 = [23 x i8] c"Error malloc %lu : %s\0A\00"
@O_RDONLY = global i32 0
@.str.3 = [23 x i8] c"Error opening %s : %s\0A\00"
@.str.5 = [33 x i8] c"Error reading %lu bytes from %s\0A\00"
@.str.6 = [53 x i8] c"Error byte %lu in %s(%#x) and %s(%#x) did not match\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %95
8: ; preds = %2
store i32 0, i32* @errno
%9 = getelementptr inbounds i8*, i8** %1, i64 3
%10 = load i8*, i8** %9
%11 = tail call i64 @strtoul(i8* nocapture %10, i32* null, i32 10)
%12 = load i32, i32* @errno
%13 = icmp eq i32 %12, 0
br i1 %13, label %20, label %14
14: ; preds = %8
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %9
%17 = tail call i8* @strerror(i32 %12)
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %16, i8* %17)
%19 = load i32, i32* @errno
br label %95
20: ; preds = %8
%21 = tail call i8* @malloc(i64 %11)
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i32, i32* @stderr
%25 = tail call i8* @strerror(i32 0)
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i64 %11, i8* %25)
%27 = load i32, i32* @errno
br label %95
28: ; preds = %20
%29 = tail call i8* @malloc(i64 %11)
%30 = icmp eq i8* %29, null
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load i32, i32* @stderr
%33 = tail call i8* @strerror(i32 0)
%34 = tail call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i64 %11, i8* %33)
%35 = load i32, i32* @errno
br label %95
36: ; preds = %28
%37 = getelementptr inbounds i8*, i8** %1, i64 1
%38 = load i8*, i8** %37
%39 = load i32, i32* @O_RDONLY
%40 = tail call i32 @open(i8* %38, i32 %39)
%41 = icmp slt i32 %40, 0
br i1 %41, label %42, label %49
42: ; preds = %36
%43 = load i32, i32* @stderr
%44 = load i8*, i8** %37
%45 = load i32, i32* @errno
%46 = tail call i8* @strerror(i32 %45)
%47 = tail call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %44, i8* %46)
%48 = load i32, i32* @errno
br label %95
49: ; preds = %36
%50 = getelementptr inbounds i8*, i8** %1, i64 2
%51 = load i8*, i8** %50
%52 = load i32, i32* @O_RDONLY
%53 = tail call i32 @open(i8* %51, i32 %52)
%54 = icmp slt i32 %53, 0
br i1 %54, label %55, label %62
55: ; preds = %49
%56 = load i32, i32* @stderr
%57 = load i8*, i8** %50
%58 = load i32, i32* @errno
%59 = tail call i8* @strerror(i32 %58)
%60 = tail call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %57, i8* %59)
%61 = load i32, i32* @errno
br label %95
62: ; preds = %49
%63 = tail call i64 @read(i32 %40, i8* %21, i64 %11)
%64 = icmp eq i64 %11, %63
br i1 %64, label %69, label %65
65: ; preds = %62
%66 = load i32, i32* @stderr
%67 = load i8*, i8** %37
%68 = tail call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i64 %11, i8* %67)
br label %95
69: ; preds = %62
%70 = tail call i64 @read(i32 %53, i8* %29, i64 %11)
%71 = icmp eq i64 %11, %70
br i1 %71, label %72, label %74
72: ; preds = %69
%73 = icmp eq i64 %11, 0
br i1 %73, label %95, label %78
74: ; preds = %69
%75 = load i32, i32* @stderr
%76 = load i8*, i8** %50
%77 = tail call i32 (i32, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i64 %11, i8* %76)
br label %95
78: ; preds = %72, %92
%79 = phi i64 [ %93, %92 ], [ 0, %72 ]
%80 = getelementptr inbounds i8, i8* %21, i64 %79
%81 = load i8, i8* %80
%82 = getelementptr inbounds i8, i8* %29, i64 %79
%83 = load i8, i8* %82
%84 = icmp eq i8 %81, %83
br i1 %84, label %92, label %85
85: ; preds = %78
%86 = sext i8 %83 to i32
%87 = sext i8 %81 to i32
%88 = load i32, i32* @stderr
%89 = load i8*, i8** %37
%90 = load i8*, i8** %50
%91 = tail call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.6, i64 0, i64 0), i64 %79, i8* %89, i32 %87, i8* %90, i32 %86)
br label %95
92: ; preds = %78
%93 = add nuw i64 %79, 1
%94 = icmp eq i64 %93, %11
br i1 %94, label %95, label %78
95: ; preds = %92, %72, %85, %74, %65, %55, %42, %31, %23, %14, %4
%96 = phi i32 [ 1, %4 ], [ %19, %14 ], [ %27, %23 ], [ %35, %31 ], [ %48, %42 ], [ %61, %55 ], [ 1, %65 ], [ 1, %74 ], [ 5, %85 ], [ 0, %72 ], [ 0, %92 ]
ret i32 %96
}