#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
size_t fread(char *, int, int, int /*<<< orphan*/ *);
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stderr;
char *strerror(int);
int strtol(char *, char **, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  FILE *file1;
  FILE *file2;
  char buf1[1024];
  char buf2[1024];
  int size;
  int read;
  size_t readed1;
  size_t readed2;
  char *err;
  int result;
  if (argc < 4) {
    puts("usage: cmpprefix file2 file1 size");
    return EXIT_FAILURE;
  }
  size = strtol(argv[3], &err, 0);
  if (*err != '\0') {
    fprintf(stderr, "invalid digit '%c' at position %d\n", *err,
            err - &argv[3][0]);
    return EXIT_FAILURE;
  } else if (size < 0) {
    fprintf(stderr, "size less then zero\n");
    return EXIT_FAILURE;
  } else if (size == 0) {
    fprintf(stderr, "size equal zero\n");
    return EXIT_FAILURE;
  }
  errno = 0;
  file1 = fopen(argv[1], "rb");
  if (errno) {
    fprintf(stderr, "Can't open file 1 '%s' (err=%d): %s\n", argv[1], errno,
            strerror(errno));
    return EXIT_FAILURE;
  }
  file2 = fopen(argv[2], "rb");
  if (errno) {
    fprintf(stderr, "Can't open file 1 '%s' (err=%d): %s\n", argv[1], errno,
            strerror(errno));
    fclose(file1);
    return EXIT_FAILURE;
  }
  result = EXIT_SUCCESS;
  while (size > 0) {
    read = (size < 1024) ? size : 1024;
    readed1 = fread(buf1, 1, read, file1);
    if (errno) {
      fprintf(stderr, "Can't read from file 1 '%s' (err=%d): %s\n", argv[1],
              errno, strerror(errno));
      result = EXIT_FAILURE;
      goto cleanup;
    }
    readed2 = fread(buf2, 1, read, file2);
    if (errno) {
      fprintf(stderr, "Can't read from file 2 '%s' (err=%d): %s\n", argv[2],
              errno, strerror(errno));
      result = EXIT_FAILURE;
      goto cleanup;
    }
    if (readed1 != read || readed2 != read) {
      result = EXIT_FAILURE;
      goto cleanup;
    } else if (memcmp(buf1, buf2, read) != 0) {
      result = EXIT_FAILURE;
      goto cleanup;
    } else
      size -= read;
  }
cleanup:
  fclose(file1);
  fclose(file2);
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x890,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11c0 <main+0x40>
lea    0xe56(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e1a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1647 <main+0x4c7>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    -0x840(%rbp),%rsi
xor    %edx,%edx
call   1080 <strtol@plt>
mov    %eax,-0x824(%rbp)
mov    -0x840(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1233 <main+0xb3>
mov    0x2dea(%rip),%rax
mov    (%rax),%edi
mov    -0x840(%rbp),%rax
movsbl (%rax),%edx
mov    -0x840(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
sub    %rax,%rcx
lea    0xe07(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2da7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1647 <main+0x4c7>
cmpl   $0x0,-0x824(%rbp)
jge    1268 <main+0xe8>
mov    0x2d99(%rip),%rax
mov    (%rax),%edi
lea    0xdf5(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2d72(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1647 <main+0x4c7>
cmpl   $0x0,-0x824(%rbp)
jne    129d <main+0x11d>
mov    0x2d64(%rip),%rax
mov    (%rax),%edi
lea    0xdd5(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2d3d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1647 <main+0x4c7>
jmp    12a2 <main+0x122>
jmp    12a7 <main+0x127>
mov    0x2d2a(%rip),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xda8(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    0x2d05(%rip),%rax
cmpl   $0x0,(%rax)
je     134c <main+0x1cc>
mov    0x2cfd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x854(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x850(%rbp)
mov    0x2cd7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x848(%rbp)
mov    0x2cc8(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x854(%rbp),%edi
mov    -0x850(%rbp),%rdx
mov    -0x848(%rbp),%ecx
mov    %rax,%r8
lea    0xd3a(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2c8e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1647 <main+0x4c7>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd10(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    0x2c6d(%rip),%rax
cmpl   $0x0,(%rax)
je     13ed <main+0x26d>
mov    0x2c65(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x864(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x860(%rbp)
mov    0x2c3f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x858(%rbp)
mov    0x2c30(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x864(%rbp),%edi
mov    -0x860(%rbp),%rdx
mov    -0x858(%rbp),%ecx
mov    %rax,%r8
lea    0xca2(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    0x2bed(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1647 <main+0x4c7>
mov    0x2bd4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x844(%rbp)
cmpl   $0x0,-0x824(%rbp)
jle    1627 <main+0x4a7>
cmpl   $0x400,-0x824(%rbp)
jge    142a <main+0x2aa>
mov    -0x824(%rbp),%eax
mov    %eax,-0x868(%rbp)
jmp    143a <main+0x2ba>
mov    $0x400,%eax
mov    %eax,-0x868(%rbp)
jmp    143a <main+0x2ba>
mov    -0x868(%rbp),%eax
mov    %eax,-0x828(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x828(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    %rax,-0x830(%rbp)
mov    0x2b69(%rip),%rax
cmpl   $0x0,(%rax)
je     14eb <main+0x36b>
mov    0x2b61(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x87c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x878(%rbp)
mov    0x2b3b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x86c(%rbp)
mov    0x2b2c(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x87c(%rbp),%edi
mov    -0x878(%rbp),%rdx
mov    -0x86c(%rbp),%ecx
mov    %rax,%r8
lea    0xbc3(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2af2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x844(%rbp)
jmp    162c <main+0x4ac>
lea    -0x820(%rbp),%rdi
mov    -0x828(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    %rax,-0x838(%rbp)
mov    0x2ac4(%rip),%rax
cmpl   $0x0,(%rax)
je     1590 <main+0x410>
mov    0x2abc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x88c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x888(%rbp)
mov    0x2a96(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x880(%rbp)
mov    0x2a87(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x88c(%rbp),%edi
mov    -0x888(%rbp),%rdx
mov    -0x880(%rbp),%ecx
mov    %rax,%r8
lea    0xb48(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2a4d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x844(%rbp)
jmp    162c <main+0x4ac>
mov    -0x830(%rbp),%rax
movslq -0x828(%rbp),%rcx
cmp    %rcx,%rax
jne    15be <main+0x43e>
mov    -0x838(%rbp),%rax
movslq -0x828(%rbp),%rcx
cmp    %rcx,%rax
je     15d2 <main+0x452>
mov    0x2a0b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x844(%rbp)
jmp    162c <main+0x4ac>
lea    -0x420(%rbp),%rdi
lea    -0x820(%rbp),%rsi
mov    -0x828(%rbp),%edx
call   1060 <memcmp@plt>
cmp    $0x0,%rax
je     1609 <main+0x489>
mov    0x29d4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x844(%rbp)
jmp    162c <main+0x4ac>
mov    -0x828(%rbp),%ecx
mov    -0x824(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x824(%rbp)
jmp    1622 <main+0x4a2>
jmp    13fc <main+0x27c>
jmp    162c <main+0x4ac>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x844(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x890,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x828,%rsp
cmp    $0x3,%edi
jg     11a7 <main+0x27>
lea    0xe63(%rip),%rdi
call   1030 <puts@plt>
jmp    126d <main+0xed>
mov    %rsi,%rbx
mov    0x18(%rsi),%rdi
lea    0x18(%rsp),%rsi
xor    %edx,%edx
call   1080 <strtol@plt>
mov    0x18(%rsp),%rcx
movsbl (%rcx),%edx
test   %edx,%edx
je     11e6 <main+0x66>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
sub    0x18(%rbx),%rcx
lea    0xe48(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    126d <main+0xed>
mov    %eax,%r12d
test   %eax,%eax
js     1244 <main+0xc4>
je     1256 <main+0xd6>
mov    0x2de2(%rip),%r14
movl   $0x0,(%r14)
mov    0x8(%rbx),%rdi
lea    0xe63(%rip),%rsi
call   1090 <fopen@plt>
mov    (%r14),%ebp
test   %ebp,%ebp
je     128a <main+0x10a>
mov    0x2dc5(%rip),%rax
mov    (%rax),%r14d
mov    0x8(%rbx),%rbx
mov    %ebp,%edi
call   10a0 <strerror@plt>
lea    0xe3e(%rip),%rsi
mov    %r14d,%edi
mov    %rbx,%rdx
mov    %ebp,%ecx
mov    %rax,%r8
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    126d <main+0xed>
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
lea    0xdf1(%rip),%rsi
jmp    1266 <main+0xe6>
mov    0x2d83(%rip),%rax
mov    (%rax),%edi
lea    0xdf4(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x2d5c(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%eax
add    $0x828,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rax,%r15
mov    0x10(%rbx),%rdi
lea    0xdd3(%rip),%rsi
call   1090 <fopen@plt>
mov    (%r14),%ebp
test   %ebp,%ebp
je     12dc <main+0x15c>
mov    0x2d35(%rip),%rax
mov    (%rax),%r14d
mov    0x8(%rbx),%rbx
mov    %ebp,%edi
call   10a0 <strerror@plt>
lea    0xdae(%rip),%rsi
mov    %r14d,%edi
mov    %rbx,%rdx
mov    %ebp,%ecx
mov    %rax,%r8
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r15,%rdi
call   1050 <fclose@plt>
jmp    126d <main+0xed>
mov    %rax,0x8(%rsp)
mov    0x2ce0(%rip),%rax
mov    (%rax),%ebp
lea    0x420(%rsp),%r14
mov    %r15,0x10(%rsp)
cmp    $0x400,%r12d
mov    $0x400,%r13d
cmovb  %r12d,%r13d
mov    %r14,%rdi
mov    $0x1,%esi
mov    %r13d,%edx
mov    %r15,%rcx
call   1040 <fread@plt>
mov    %rax,%r14
mov    0x2cb3(%rip),%rax
mov    (%rax),%r15d
test   %r15d,%r15d
jne    1390 <main+0x210>
lea    0x20(%rsp),%rdi
mov    $0x1,%esi
mov    %r13d,%edx
mov    0x8(%rsp),%rcx
mov    %rax,%r15
call   1040 <fread@plt>
mov    (%r15),%r15d
test   %r15d,%r15d
jne    13ae <main+0x22e>
mov    %r13d,%ecx
cmp    %rcx,%r14
jne    13dc <main+0x25c>
cmp    %rcx,%rax
jne    13dc <main+0x25c>
lea    0x420(%rsp),%r14
mov    %r14,%rdi
lea    0x20(%rsp),%rsi
mov    %r13d,%edx
call   1060 <memcmp@plt>
test   %rax,%rax
mov    0x10(%rsp),%r15
jne    13ec <main+0x26c>
sub    %r13d,%r12d
test   %r12d,%r12d
jg     12f7 <main+0x177>
jmp    13f5 <main+0x275>
mov    0x2c49(%rip),%rax
mov    (%rax),%ebp
mov    0x8(%rbx),%rbx
mov    %r15d,%edi
call   10a0 <strerror@plt>
lea    0xce7(%rip),%rsi
jmp    13ca <main+0x24a>
mov    0x2c2b(%rip),%rax
mov    (%rax),%ebp
mov    0x10(%rbx),%rbx
mov    %r15d,%edi
call   10a0 <strerror@plt>
lea    0xcf3(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %r15d,%ecx
mov    %rax,%r8
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x2bed(%rip),%rax
mov    (%rax),%ebp
mov    0x10(%rsp),%r15
jmp    13f5 <main+0x275>
mov    0x2bdd(%rip),%rax
mov    (%rax),%ebp
mov    0x8(%rsp),%rbx
mov    %r15,%rdi
call   1050 <fclose@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
jmp    1276 <main+0xf6>

LLVM IR (-O0):
@.str = [34 x i8] c"usage: cmpprefix file2 file1 size\00"
@EXIT_FAILURE = global i32 0
@stderr = global i32 0
@.str.1 = [35 x i8] c"invalid digit '%c' at position %d\0A\00"
@.str.2 = [21 x i8] c"size less then zero\0A\00"
@.str.3 = [17 x i8] c"size equal zero\0A\00"
@errno = global i32 0
@.str.4 = [3 x i8] c"rb\00"
@.str.5 = [37 x i8] c"Can't open file 1 '%s' (err=%d): %s\0A\00"
@EXIT_SUCCESS = global i32 0
@.str.6 = [42 x i8] c"Can't read from file 1 '%s' (err=%d): %s\0A\00"
@.str.7 = [42 x i8] c"Can't read from file 2 '%s' (err=%d): %s\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 [1024 x i8]
%9 = alloca [1024 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i64
%13 = alloca i64
%14 = alloca i8*
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 4
br i1 %17, label %18, label %21
18: ; preds = %2
%19 = call i32 @puts(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%20 = load i32, i32* @EXIT_FAILURE
store i32 %20, i32* %3
br label %176
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 3
%24 = load i8*, i8** %23
%25 = call i32 @strtol(i8* %24, i8** %14, i32 0)
store i32 %25, i32* %10
%26 = load i8*, i8** %14
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %45
30: ; preds = %21
%31 = load i32, i32* @stderr
%32 = load i8*, i8** %14
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = load i8*, i8** %14
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 3
%38 = load i8*, i8** %37
%39 = getelementptr inbounds i8, i8* %38, i64 0
%40 = ptrtoint i8* %35 to i64
%41 = ptrtoint i8* %39 to i64
%42 = sub i64 %40, %41
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %34, i64 %42)
%44 = load i32, i32* @EXIT_FAILURE
store i32 %44, i32* %3
br label %176
45: ; preds = %21
%46 = load i32, i32* %10
%47 = icmp slt i32 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %45
%49 = load i32, i32* @stderr
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%51 = load i32, i32* @EXIT_FAILURE
store i32 %51, i32* %3
br label %176
52: ; preds = %45
%53 = load i32, i32* %10
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %59
55: ; preds = %52
%56 = load i32, i32* @stderr
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%58 = load i32, i32* @EXIT_FAILURE
store i32 %58, i32* %3
br label %176
59: ; preds = %52
br label %60
60: ; preds = %59
br label %61
61: ; preds = %60
store i32 0, i32* @errno
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 1
%64 = load i8*, i8** %63
%65 = call i32* @fopen(i8* %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %65, i32** %6
%66 = load i32, i32* @errno
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %78
68: ; preds = %61
%69 = load i32, i32* @stderr
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 1
%72 = load i8*, i8** %71
%73 = load i32, i32* @errno
%74 = load i32, i32* @errno
%75 = call i8* @strerror(i32 %74)
%76 = call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i8* %72, i32 %73, i8* %75)
%77 = load i32, i32* @EXIT_FAILURE
store i32 %77, i32* %3
br label %176
78: ; preds = %61
%79 = load i8**, i8*** %5
%80 = getelementptr inbounds i8*, i8** %79, i64 2
%81 = load i8*, i8** %80
%82 = call i32* @fopen(i8* %81, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %82, i32** %7
%83 = load i32, i32* @errno
%84 = icmp ne i32 %83, 0
br i1 %84, label %85, label %97
85: ; preds = %78
%86 = load i32, i32* @stderr
%87 = load i8**, i8*** %5
%88 = getelementptr inbounds i8*, i8** %87, i64 1
%89 = load i8*, i8** %88
%90 = load i32, i32* @errno
%91 = load i32, i32* @errno
%92 = call i8* @strerror(i32 %91)
%93 = call i32 (i32, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i8* %89, i32 %90, i8* %92)
%94 = load i32*, i32** %6
%95 = call i32 @fclose(i32* %94)
%96 = load i32, i32* @EXIT_FAILURE
store i32 %96, i32* %3
br label %176
97: ; preds = %78
%98 = load i32, i32* @EXIT_SUCCESS
store i32 %98, i32* %15
br label %99
99: ; preds = %168, %97
%100 = load i32, i32* %10
%101 = icmp sgt i32 %100, 0
br i1 %101, label %102, label %169
102: ; preds = %99
%103 = load i32, i32* %10
%104 = icmp slt i32 %103, 1024
br i1 %104, label %105, label %107
105: ; preds = %102
%106 = load i32, i32* %10
br label %108
107: ; preds = %102
br label %108
108: ; preds = %107, %105
%109 = phi i32 [ %106, %105 ], [ 1024, %107 ]
store i32 %109, i32* %11
%110 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%111 = load i32, i32* %11
%112 = load i32*, i32** %6
%113 = call i64 @fread(i8* %110, i32 1, i32 %111, i32* %112)
store i64 %113, i64* %12
%114 = load i32, i32* @errno
%115 = icmp ne i32 %114, 0
br i1 %115, label %116, label %126
116: ; preds = %108
%117 = load i32, i32* @stderr
%118 = load i8**, i8*** %5
%119 = getelementptr inbounds i8*, i8** %118, i64 1
%120 = load i8*, i8** %119
%121 = load i32, i32* @errno
%122 = load i32, i32* @errno
%123 = call i8* @strerror(i32 %122)
%124 = call i32 (i32, i8*, ...) @fprintf(i32 %117, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i8* %120, i32 %121, i8* %123)
%125 = load i32, i32* @EXIT_FAILURE
store i32 %125, i32* %15
br label %170
126: ; preds = %108
%127 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%128 = load i32, i32* %11
%129 = load i32*, i32** %7
%130 = call i64 @fread(i8* %127, i32 1, i32 %128, i32* %129)
store i64 %130, i64* %13
%131 = load i32, i32* @errno
%132 = icmp ne i32 %131, 0
br i1 %132, label %133, label %143
133: ; preds = %126
%134 = load i32, i32* @stderr
%135 = load i8**, i8*** %5
%136 = getelementptr inbounds i8*, i8** %135, i64 2
%137 = load i8*, i8** %136
%138 = load i32, i32* @errno
%139 = load i32, i32* @errno
%140 = call i8* @strerror(i32 %139)
%141 = call i32 (i32, i8*, ...) @fprintf(i32 %134, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i8* %137, i32 %138, i8* %140)
%142 = load i32, i32* @EXIT_FAILURE
store i32 %142, i32* %15
br label %170
143: ; preds = %126
%144 = load i64, i64* %12
%145 = load i32, i32* %11
%146 = sext i32 %145 to i64
%147 = icmp ne i64 %144, %146
br i1 %147, label %153, label %148
148: ; preds = %143
%149 = load i64, i64* %13
%150 = load i32, i32* %11
%151 = sext i32 %150 to i64
%152 = icmp ne i64 %149, %151
br i1 %152, label %153, label %155
153: ; preds = %148, %143
%154 = load i32, i32* @EXIT_FAILURE
store i32 %154, i32* %15
br label %170
155: ; preds = %148
%156 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%157 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%158 = load i32, i32* %11
%159 = call i64 @memcmp(i8* %156, i8* %157, i32 %158)
%160 = icmp ne i64 %159, 0
br i1 %160, label %161, label %163
161: ; preds = %155
%162 = load i32, i32* @EXIT_FAILURE
store i32 %162, i32* %15
br label %170
163: ; preds = %155
%164 = load i32, i32* %11
%165 = load i32, i32* %10
%166 = sub nsw i32 %165, %164
store i32 %166, i32* %10
br label %167
167: ; preds = %163
br label %168
168: ; preds = %167
br label %99
169: ; preds = %99
br label %170
170: ; preds = %169, %161, %153, %133, %116
%171 = load i32*, i32** %6
%172 = call i32 @fclose(i32* %171)
%173 = load i32*, i32** %7
%174 = call i32 @fclose(i32* %173)
%175 = load i32, i32* %15
store i32 %175, i32* %3
br label %176
176: ; preds = %170, %85, %68, %55, %48, %30, %18
%177 = load i32, i32* %3
ret i32 %177
}

LLVM IR (-O2):
@.str = [34 x i8] c"usage: cmpprefix file2 file1 size\00"
@EXIT_FAILURE = global i32 0
@stderr = global i32 0
@.str.1 = [35 x i8] c"invalid digit '%c' at position %d\0A\00"
@.str.2 = [21 x i8] c"size less then zero\0A\00"
@.str.3 = [17 x i8] c"size equal zero\0A\00"
@errno = global i32 0
@.str.4 = [3 x i8] c"rb\00"
@.str.5 = [37 x i8] c"Can't open file 1 '%s' (err=%d): %s\0A\00"
@EXIT_SUCCESS = global i32 0
@.str.6 = [42 x i8] c"Can't read from file 1 '%s' (err=%d): %s\0A\00"
@.str.7 = [42 x i8] c"Can't read from file 2 '%s' (err=%d): %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = alloca i8*
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%8 = bitcast i8** %5 to i8*
%9 = icmp slt i32 %0, 4
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
br label %110
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 3
%15 = load i8*, i8** %14
%16 = call i32 @strtol(i8* %15, i8** %5, i32 0)
%17 = load i8*, i8** %5
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %29, label %20
20: ; preds = %13
%21 = sext i8 %18 to i32
%22 = load i32, i32* @stderr
%23 = load i8*, i8** %14
%24 = ptrtoint i8* %17 to i64
%25 = ptrtoint i8* %23 to i64
%26 = sub i64 %24, %25
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %21, i64 %26)
%28 = load i32, i32* @EXIT_FAILURE
br label %110
29: ; preds = %13
%30 = icmp slt i32 %16, 0
br i1 %30, label %31, label %35
31: ; preds = %29
%32 = load i32, i32* @stderr
%33 = tail call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%34 = load i32, i32* @EXIT_FAILURE
br label %110
35: ; preds = %29
%36 = icmp eq i32 %16, 0
br i1 %36, label %37, label %41
37: ; preds = %35
%38 = load i32, i32* @stderr
%39 = tail call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%40 = load i32, i32* @EXIT_FAILURE
br label %110
41: ; preds = %35
store i32 0, i32* @errno
%42 = getelementptr inbounds i8*, i8** %1, i64 1
%43 = load i8*, i8** %42
%44 = tail call i32* @fopen(i8* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%45 = load i32, i32* @errno
%46 = icmp eq i32 %45, 0
br i1 %46, label %53, label %47
47: ; preds = %41
%48 = load i32, i32* @stderr
%49 = load i8*, i8** %42
%50 = tail call i8* @strerror(i32 %45)
%51 = tail call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i8* %49, i32 %45, i8* %50)
%52 = load i32, i32* @EXIT_FAILURE
br label %110
53: ; preds = %41
%54 = getelementptr inbounds i8*, i8** %1, i64 2
%55 = load i8*, i8** %54
%56 = tail call i32* @fopen(i8* %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%57 = load i32, i32* @errno
%58 = icmp eq i32 %57, 0
br i1 %58, label %66, label %59
59: ; preds = %53
%60 = load i32, i32* @stderr
%61 = load i8*, i8** %42
%62 = tail call i8* @strerror(i32 %57)
%63 = tail call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i8* %61, i32 %57, i8* %62)
%64 = tail call i32 @fclose(i32* %44)
%65 = load i32, i32* @EXIT_FAILURE
br label %110
66: ; preds = %53
%67 = load i32, i32* @EXIT_SUCCESS
br label %70
68: ; preds = %100
%69 = icmp sgt i32 %103, 0
br i1 %69, label %70, label %106
70: ; preds = %66, %68
%71 = phi i32 [ %103, %68 ], [ %16, %66 ]
%72 = icmp ult i32 %71, 1024
%73 = select i1 %72, i32 %71, i32 1024
%74 = call i64 @fread(i8* %6, i32 1, i32 %73, i32* %44)
%75 = load i32, i32* @errno
%76 = icmp eq i32 %75, 0
br i1 %76, label %83, label %77
77: ; preds = %70
%78 = load i32, i32* @stderr
%79 = load i8*, i8** %42
%80 = call i8* @strerror(i32 %75)
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i8* %79, i32 %75, i8* %80)
%82 = load i32, i32* @EXIT_FAILURE
br label %106
83: ; preds = %70
%84 = call i64 @fread(i8* %7, i32 1, i32 %73, i32* %56)
%85 = load i32, i32* @errno
%86 = icmp eq i32 %85, 0
br i1 %86, label %93, label %87
87: ; preds = %83
%88 = load i32, i32* @stderr
%89 = load i8*, i8** %54
%90 = call i8* @strerror(i32 %85)
%91 = call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i8* %89, i32 %85, i8* %90)
%92 = load i32, i32* @EXIT_FAILURE
br label %106
93: ; preds = %83
%94 = zext i32 %73 to i64
%95 = icmp eq i64 %74, %94
%96 = icmp eq i64 %84, %94
%97 = and i1 %95, %96
br i1 %97, label %100, label %98
98: ; preds = %93
%99 = load i32, i32* @EXIT_FAILURE
br label %106
100: ; preds = %93
%101 = call i64 @memcmp(i8* %6, i8* %7, i32 %73)
%102 = icmp eq i64 %101, 0
%103 = sub nsw i32 %71, %73
br i1 %102, label %68, label %104
104: ; preds = %100
%105 = load i32, i32* @EXIT_FAILURE
br label %106
106: ; preds = %68, %104, %98, %87, %77
%107 = phi i32 [ %82, %77 ], [ %92, %87 ], [ %99, %98 ], [ %105, %104 ], [ %67, %68 ]
%108 = call i32 @fclose(i32* %44)
%109 = call i32 @fclose(i32* %56)
br label %110
110: ; preds = %106, %59, %47, %37, %31, %20, %10
%111 = phi i32 [ %12, %10 ], [ %28, %20 ], [ %34, %31 ], [ %40, %37 ], [ %52, %47 ], [ %65, %59 ], [ %107, %106 ]
ret i32 %111
}