#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 */

/* Variables and functions */
int BUFSIZ;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ isprint(char);
int open(char *, int /*<<< orphan*/);
int read(int, char *, int);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
scalar_t__ strncmp(char *, char *, int);
int filecmp(char *f1, char *f2) {
  int i;
  int fd1, fd2;
  int ret1, ret2 = 0;
  char buf1[BUFSIZ], buf2[BUFSIZ];
  if ((fd1 = open(f1, O_RDONLY)) == -1) {
    fprintf(stderr, "compare_files: open failed %s: %s", f1, strerror(errno));
    return (-1);
  }
  if ((fd2 = open(f2, O_RDONLY)) == -1) {
    fprintf(stderr, "compare_files: open failed %s: %s", f2, strerror(errno));
    close(fd1);
    return (-1);
  }
  while ((ret1 = read(fd1, buf1, BUFSIZ)) > 0) {
    ret2 = read(fd2, buf2, BUFSIZ);
    if (ret1 != ret2) {
      fprintf(stderr, "compare_file: file length mistmatch:");
      fprintf(stderr, "read: %d from %s, %d from %s", ret1, f1, ret2, f2);
      close(fd1);
      close(fd2);
      return (-1);
    }
    for (i = 0; i < ret1; i++) {
      if (strncmp(&buf1[i], &buf2[i], 1)) {
        fprintf(stderr, "compare_file: char mismatch:");
        fprintf(stderr, " %s offset %d: 0x%02x %c  ", f1, i, buf1[i],
                isprint(buf1[i]) ? buf1[1] : '.');
        fprintf(stderr, " %s offset %d: 0x%02x %c\n", f2, i, buf2[i],
                isprint(buf2[i]) ? buf2[i] : '.');
        close(fd1);
        close(fd2);
        return (-1);
      }
    }
  }
  close(fd1);
  close(fd2);
  return 0;
}


x86 assembly (clang, -O0):
<filecmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    0x2e3f(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rdx
mov    %rdx,-0x38(%rbp)
mov    %rcx,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x60(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x40(%rbp)
mov    (%rax),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e09(%rip),%rax
mov    (%rax),%esi
call   1080 <open@plt>
mov    %eax,-0x20(%rbp)
cmp    $0xffffffff,%eax
jne    123f <filecmp+0xcf>
mov    0x2ddf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x6c(%rbp),%edi
mov    -0x68(%rbp),%rdx
mov    %rax,%rcx
lea    0xddb(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    1543 <filecmp+0x3d3>
mov    -0x18(%rbp),%rdi
mov    0x2d9e(%rip),%rax
mov    (%rax),%esi
call   1080 <open@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
jne    12b2 <filecmp+0x142>
mov    0x2d74(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    0x2d50(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x7c(%rbp),%edi
mov    -0x78(%rbp),%rdx
mov    %rax,%rcx
lea    0xd70(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%edi
call   1040 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    1543 <filecmp+0x3d3>
jmp    12b7 <filecmp+0x147>
mov    -0x60(%rbp),%rsi
mov    -0x20(%rbp),%edi
mov    0x2d0b(%rip),%rax
mov    (%rax),%edx
call   1050 <read@plt>
mov    %eax,-0x28(%rbp)
cmp    $0x0,%eax
jle    1525 <filecmp+0x3b5>
mov    -0x58(%rbp),%rsi
mov    -0x24(%rbp),%edi
mov    0x2cea(%rip),%rax
mov    (%rax),%edx
call   1050 <read@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x2c(%rbp),%eax
je     135c <filecmp+0x1ec>
mov    0x2cd5(%rip),%rax
mov    (%rax),%edi
lea    0xd16(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2cbe(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x2c(%rbp),%r8d
mov    -0x18(%rbp),%r9
lea    0xd15(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%edi
call   1040 <close@plt>
mov    -0x24(%rbp),%edi
call   1040 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    1543 <filecmp+0x3d3>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1520 <filecmp+0x3b0>
mov    -0x58(%rbp),%rsi
mov    -0x60(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     150d <filecmp+0x39d>
mov    0x2c38(%rip),%rax
mov    (%rax),%edi
lea    0xcbb(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x60(%rbp),%rax
mov    0x2c1d(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,-0x94(%rbp)
mov    -0x10(%rbp),%rcx
mov    %rcx,-0x90(%rbp)
mov    -0x1c(%rbp),%ecx
mov    %ecx,-0x84(%rbp)
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    %ecx,-0x80(%rbp)
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1070 <isprint@plt>
cmp    $0x0,%rax
je     140c <filecmp+0x29c>
mov    -0x60(%rbp),%rax
movsbl 0x1(%rax),%eax
mov    %eax,-0x98(%rbp)
jmp    141c <filecmp+0x2ac>
mov    $0x2e,%eax
mov    %eax,-0x98(%rbp)
jmp    141c <filecmp+0x2ac>
mov    -0x80(%rbp),%r8d
mov    -0x84(%rbp),%ecx
mov    -0x90(%rbp),%rdx
mov    -0x94(%rbp),%edi
mov    -0x98(%rbp),%r9d
lea    0xc40(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x58(%rbp),%rax
mov    0x2b85(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,-0xac(%rbp)
mov    -0x18(%rbp),%rcx
mov    %rcx,-0xa8(%rbp)
mov    -0x1c(%rbp),%ecx
mov    %ecx,-0xa0(%rbp)
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    %ecx,-0x9c(%rbp)
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1070 <isprint@plt>
cmp    $0x0,%rax
je     14ab <filecmp+0x33b>
mov    -0x58(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0xb0(%rbp)
jmp    14bb <filecmp+0x34b>
mov    $0x2e,%eax
mov    %eax,-0xb0(%rbp)
jmp    14bb <filecmp+0x34b>
mov    -0x9c(%rbp),%r8d
mov    -0xa0(%rbp),%ecx
mov    -0xa8(%rbp),%rdx
mov    -0xac(%rbp),%edi
mov    -0xb0(%rbp),%r9d
lea    0xbb9(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%edi
call   1040 <close@plt>
mov    -0x24(%rbp),%edi
call   1040 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    1543 <filecmp+0x3d3>
jmp    1512 <filecmp+0x3a2>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1363 <filecmp+0x1f3>
jmp    12b7 <filecmp+0x147>
mov    -0x20(%rbp),%edi
call   1040 <close@plt>
mov    -0x24(%rbp),%edi
call   1040 <close@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x4c(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filecmp>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,-0x38(%rbp)
mov    %rdi,%r15
mov    0x2e41(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    %rsp,%r13
sub    %rax,%r13
mov    %r13,%rsp
mov    0x2e36(%rip),%rbx
mov    (%rbx),%esi
call   1080 <open@plt>
cmp    $0xffffffff,%eax
je     128a <filecmp+0x11a>
mov    %eax,%r12d
mov    %r15,-0x48(%rbp)
mov    (%rbx),%esi
mov    -0x38(%rbp),%r15
mov    %r15,%rdi
call   1080 <open@plt>
cmp    $0xffffffff,%eax
je     12bc <filecmp+0x14c>
mov    %eax,%ebx
mov    %r12d,%r15d
mov    0x2de4(%rip),%r12
mov    (%r12),%edx
mov    %r15d,%edi
mov    %r14,%rsi
call   1050 <read@plt>
test   %eax,%eax
jle    1274 <filecmp+0x104>
mov    %r15d,-0x30(%rbp)
mov    %ebx,-0x2c(%rbp)
mov    (%r12),%edx
mov    %ebx,%edi
mov    %r13,%rsi
mov    %eax,%ebx
call   1050 <read@plt>
cmp    %eax,%ebx
jne    13a8 <filecmp+0x238>
mov    %ebx,%ebx
xor    %r15d,%r15d
mov    -0x30(%rbp),%r12d
nopw   0x0(%rax,%rax,1)
lea    (%r14,%r15,1),%rdi
lea    (%r15,%r13,1),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    12f1 <filecmp+0x181>
add    $0x1,%r15
cmp    %r15,%rbx
jne    1230 <filecmp+0xc0>
mov    %r12d,%r15d
mov    0x2d72(%rip),%r12
mov    (%r12),%edx
mov    %r15d,%edi
mov    %r14,%rsi
call   1050 <read@plt>
test   %eax,%eax
mov    -0x2c(%rbp),%ebx
jg     1206 <filecmp+0x96>
mov    %r15d,%edi
call   1040 <close@plt>
mov    %ebx,%edi
call   1040 <close@plt>
xor    %eax,%eax
jmp    1399 <filecmp+0x229>
mov    0x2d47(%rip),%rax
mov    (%rax),%ebx
mov    0x2d2e(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xd58(%rip),%rsi
mov    %ebx,%edi
mov    %r15,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    1394 <filecmp+0x224>
mov    0x2d15(%rip),%rax
mov    (%rax),%ebx
mov    0x2cfc(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xd26(%rip),%rsi
mov    %ebx,%edi
mov    %r15,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r12d,%edi
jmp    138f <filecmp+0x21f>
mov    0x2ce0(%rip),%rbx
mov    (%rbx),%edi
lea    0xd63(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%rbx),%eax
mov    %eax,-0x3c(%rbp)
movsbl (%r14,%r15,1),%r12d
mov    %r12d,%edi
call   1070 <isprint@plt>
mov    $0x2e,%r9d
test   %rax,%rax
je     132a <filecmp+0x1ba>
movsbl 0x1(%r14),%r9d
lea    0xd50(%rip),%rsi
mov    -0x3c(%rbp),%edi
mov    -0x48(%rbp),%rdx
mov    %r15d,%ecx
mov    %r12d,%r8d
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%rbx),%r12d
movsbl 0x0(%r13,%r15,1),%r14d
mov    %r14d,%edi
call   1070 <isprint@plt>
test   %rax,%rax
mov    -0x2c(%rbp),%ebx
mov    $0x2e,%r9d
je     136a <filecmp+0x1fa>
movsbl 0x0(%r13,%r15,1),%r9d
lea    0xd2b(%rip),%rsi
mov    %r12d,%edi
mov    -0x38(%rbp),%rdx
mov    %r15d,%ecx
mov    %r14d,%r8d
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%edi
call   1040 <close@plt>
mov    %ebx,%edi
call   1040 <close@plt>
mov    $0xffffffff,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%r12d
mov    0x2c26(%rip),%r14
mov    (%r14),%edi
lea    0xc66(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r14),%edi
lea    0xc7a(%rip),%rsi
mov    %ebx,%edx
mov    -0x48(%rbp),%rcx
mov    %r12d,%r8d
mov    -0x38(%rbp),%r9
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%edi
call   1040 <close@plt>
mov    -0x2c(%rbp),%edi
jmp    138f <filecmp+0x21f>

LLVM IR (-O0):
@BUFSIZ = global i32 0
@O_RDONLY = global i32 0
@stderr = global i32 0
@.str = [34 x i8] c"compare_files: open failed %s: %s\00"
@errno = global i32 0
@.str.1 = [37 x i8] c"compare_file: file length mistmatch:\00"
@.str.2 = [29 x i8] c"read: %d from %s, %d from %s\00"
@.str.3 = [29 x i8] c"compare_file: char mismatch:\00"
@.str.4 = [27 x i8] c" %s offset %d: 0x%02x %c \00"
@.str.5 = [26 x i8] c" %s offset %d: 0x%02x %c\0A\00"
define i32 @filecmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i64
%14 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %10
%15 = load i32, i32* @BUFSIZ
%16 = zext i32 %15 to i64
%17 = call i8* @llvm.stacksave()
store i8* %17, i8** %11
%18 = alloca i8, i64 %16
store i64 %16, i64* %12
%19 = load i32, i32* @BUFSIZ
%20 = zext i32 %19 to i64
%21 = alloca i8, i64 %20
store i64 %20, i64* %13
%22 = load i8*, i8** %4
%23 = load i32, i32* @O_RDONLY
%24 = call i32 @open(i8* %22, i32 %23)
store i32 %24, i32* %7
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %32
26: ; preds = %2
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %4
%29 = load i32, i32* @errno
%30 = call i8* @strerror(i32 %29)
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %28, i8* %30)
store i32 -1, i32* %3
store i32 1, i32* %14
br label %148
32: ; preds = %2
%33 = load i8*, i8** %5
%34 = load i32, i32* @O_RDONLY
%35 = call i32 @open(i8* %33, i32 %34)
store i32 %35, i32* %8
%36 = icmp eq i32 %35, -1
br i1 %36, label %37, label %45
37: ; preds = %32
%38 = load i32, i32* @stderr
%39 = load i8*, i8** %5
%40 = load i32, i32* @errno
%41 = call i8* @strerror(i32 %40)
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %39, i8* %41)
%43 = load i32, i32* %7
%44 = call i32 @close(i32 %43)
store i32 -1, i32* %3
store i32 1, i32* %14
br label %148
45: ; preds = %32
br label %46
46: ; preds = %142, %45
%47 = load i32, i32* %7
%48 = load i32, i32* @BUFSIZ
%49 = call i32 @read(i32 %47, i8* %18, i32 %48)
store i32 %49, i32* %9
%50 = icmp sgt i32 %49, 0
br i1 %50, label %51, label %143
51: ; preds = %46
%52 = load i32, i32* %8
%53 = load i32, i32* @BUFSIZ
%54 = call i32 @read(i32 %52, i8* %21, i32 %53)
store i32 %54, i32* %10
%55 = load i32, i32* %9
%56 = load i32, i32* %10
%57 = icmp ne i32 %55, %56
br i1 %57, label %58, label %71
58: ; preds = %51
%59 = load i32, i32* @stderr
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %59, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%61 = load i32, i32* @stderr
%62 = load i32, i32* %9
%63 = load i8*, i8** %4
%64 = load i32, i32* %10
%65 = load i8*, i8** %5
%66 = call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %62, i8* %63, i32 %64, i8* %65)
%67 = load i32, i32* %7
%68 = call i32 @close(i32 %67)
%69 = load i32, i32* %8
%70 = call i32 @close(i32 %69)
store i32 -1, i32* %3
store i32 1, i32* %14
br label %148
71: ; preds = %51
store i32 0, i32* %6
br label %72
72: ; preds = %139, %71
%73 = load i32, i32* %6
%74 = load i32, i32* %9
%75 = icmp slt i32 %73, %74
br i1 %75, label %76, label %142
76: ; preds = %72
%77 = load i32, i32* %6
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8, i8* %18, i64 %78
%80 = load i32, i32* %6
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i8, i8* %21, i64 %81
%83 = call i64 @strncmp(i8* %79, i8* %82, i32 1)
%84 = icmp ne i64 %83, 0
br i1 %84, label %85, label %138
85: ; preds = %76
%86 = load i32, i32* @stderr
%87 = call i32 (i32, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%88 = load i32, i32* @stderr
%89 = load i8*, i8** %4
%90 = load i32, i32* %6
%91 = load i32, i32* %6
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds i8, i8* %18, i64 %92
%94 = load i8, i8* %93
%95 = sext i8 %94 to i32
%96 = load i32, i32* %6
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i8, i8* %18, i64 %97
%99 = load i8, i8* %98
%100 = call i64 @isprint(i8 signext %99)
%101 = icmp ne i64 %100, 0
br i1 %101, label %102, label %106
102: ; preds = %85
%103 = getelementptr inbounds i8, i8* %18, i64 1
%104 = load i8, i8* %103
%105 = sext i8 %104 to i32
br label %107
106: ; preds = %85
br label %107
107: ; preds = %106, %102
%108 = phi i32 [ %105, %102 ], [ 46, %106 ]
%109 = call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %89, i32 %90, i32 %95, i32 %108)
%110 = load i32, i32* @stderr
%111 = load i8*, i8** %5
%112 = load i32, i32* %6
%113 = load i32, i32* %6
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds i8, i8* %21, i64 %114
%116 = load i8, i8* %115
%117 = sext i8 %116 to i32
%118 = load i32, i32* %6
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds i8, i8* %21, i64 %119
%121 = load i8, i8* %120
%122 = call i64 @isprint(i8 signext %121)
%123 = icmp ne i64 %122, 0
br i1 %123, label %124, label %130
124: ; preds = %107
%125 = load i32, i32* %6
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i8, i8* %21, i64 %126
%128 = load i8, i8* %127
%129 = sext i8 %128 to i32
br label %131
130: ; preds = %107
br label %131
131: ; preds = %130, %124
%132 = phi i32 [ %129, %124 ], [ 46, %130 ]
%133 = call i32 (i32, i8*, ...) @fprintf(i32 %110, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %111, i32 %112, i32 %117, i32 %132)
%134 = load i32, i32* %7
%135 = call i32 @close(i32 %134)
%136 = load i32, i32* %8
%137 = call i32 @close(i32 %136)
store i32 -1, i32* %3
store i32 1, i32* %14
br label %148
138: ; preds = %76
br label %139
139: ; preds = %138
%140 = load i32, i32* %6
%141 = add nsw i32 %140, 1
store i32 %141, i32* %6
br label %72
142: ; preds = %72
br label %46
143: ; preds = %46
%144 = load i32, i32* %7
%145 = call i32 @close(i32 %144)
%146 = load i32, i32* %8
%147 = call i32 @close(i32 %146)
store i32 0, i32* %3
store i32 1, i32* %14
br label %148
148: ; preds = %143, %131, %58, %37, %26
%149 = load i8*, i8** %11
%150 = load i32, i32* %3
ret i32 %150
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@O_RDONLY = global i32 0
@stderr = global i32 0
@.str = [34 x i8] c"compare_files: open failed %s: %s\00"
@errno = global i32 0
@.str.1 = [37 x i8] c"compare_file: file length mistmatch:\00"
@.str.2 = [29 x i8] c"read: %d from %s, %d from %s\00"
@.str.3 = [29 x i8] c"compare_file: char mismatch:\00"
@.str.4 = [27 x i8] c" %s offset %d: 0x%02x %c \00"
@.str.5 = [26 x i8] c" %s offset %d: 0x%02x %c\0A\00"
define i32 @filecmp(i8* %0, i8* %1) {
%3 = load i32, i32* @BUFSIZ
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = alloca i8, i64 %4
%7 = load i32, i32* @O_RDONLY
%8 = tail call i32 @open(i8* %0, i32 %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i32, i32* @errno
%13 = tail call i8* @strerror(i32 %12)
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %13)
br label %88
15: ; preds = %2
%16 = load i32, i32* @O_RDONLY
%17 = tail call i32 @open(i8* %1, i32 %16)
%18 = icmp eq i32 %17, -1
br i1 %18, label %23, label %19
19: ; preds = %15
%20 = load i32, i32* @BUFSIZ
%21 = call i32 @read(i32 %8, i8* %5, i32 %20)
%22 = icmp sgt i32 %21, 0
br i1 %22, label %33, label %85
23: ; preds = %15
%24 = load i32, i32* @stderr
%25 = load i32, i32* @errno
%26 = tail call i8* @strerror(i32 %25)
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %26)
%28 = tail call i32 @close(i32 %8)
br label %88
29: ; preds = %82
%30 = load i32, i32* @BUFSIZ
%31 = call i32 @read(i32 %8, i8* %5, i32 %30)
%32 = icmp sgt i32 %31, 0
br i1 %32, label %33, label %85
33: ; preds = %19, %29
%34 = phi i32 [ %31, %29 ], [ %21, %19 ]
%35 = load i32, i32* @BUFSIZ
%36 = call i32 @read(i32 %17, i8* %6, i32 %35)
%37 = icmp eq i32 %34, %36
br i1 %37, label %38, label %40
38: ; preds = %33
%39 = zext i32 %34 to i64
br label %47
40: ; preds = %33
%41 = load i32, i32* @stderr
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%43 = load i32, i32* @stderr
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %34, i8* %0, i32 %36, i8* %1)
%45 = call i32 @close(i32 %8)
%46 = call i32 @close(i32 %17)
br label %88
47: ; preds = %38, %82
%48 = phi i64 [ 0, %38 ], [ %83, %82 ]
%49 = getelementptr inbounds i8, i8* %5, i64 %48
%50 = getelementptr inbounds i8, i8* %6, i64 %48
%51 = call i64 @strncmp(i8* %49, i8* %50, i32 1)
%52 = icmp eq i64 %51, 0
br i1 %52, label %82, label %53
53: ; preds = %47
%54 = trunc i64 %48 to i32
%55 = load i32, i32* @stderr
%56 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%57 = load i32, i32* @stderr
%58 = load i8, i8* %49
%59 = sext i8 %58 to i32
%60 = call i64 @isprint(i8 signext %58)
%61 = icmp eq i64 %60, 0
br i1 %61, label %66, label %62
62: ; preds = %53
%63 = getelementptr inbounds i8, i8* %5, i64 1
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
br label %66
66: ; preds = %53, %62
%67 = phi i32 [ %65, %62 ], [ 46, %53 ]
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %0, i32 %54, i32 %59, i32 %67)
%69 = load i32, i32* @stderr
%70 = load i8, i8* %50
%71 = sext i8 %70 to i32
%72 = call i64 @isprint(i8 signext %70)
%73 = icmp eq i64 %72, 0
br i1 %73, label %77, label %74
74: ; preds = %66
%75 = load i8, i8* %50
%76 = sext i8 %75 to i32
br label %77
77: ; preds = %66, %74
%78 = phi i32 [ %76, %74 ], [ 46, %66 ]
%79 = call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %1, i32 %54, i32 %71, i32 %78)
%80 = call i32 @close(i32 %8)
%81 = call i32 @close(i32 %17)
br label %88
82: ; preds = %47
%83 = add nuw nsw i64 %48, 1
%84 = icmp eq i64 %83, %39
br i1 %84, label %29, label %47
85: ; preds = %29, %19
%86 = call i32 @close(i32 %8)
%87 = call i32 @close(i32 %17)
br label %88
88: ; preds = %85, %77, %40, %23, %10
%89 = phi i32 [ -1, %10 ], [ -1, %23 ], [ -1, %40 ], [ -1, %77 ], [ 0, %85 ]
ret i32 %89
}