#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*/ file2Input;
typedef int /*<<< orphan*/ file1Input;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *, char *);
int main(int argc, char **argv) {
  FILE *fp1 = NULL;
  FILE *fp2 = NULL;
  assert(argc == 3);
  fp1 = fopen(argv[1], "rb");
  fp2 = fopen(argv[2], "rb");
  assert(fp1 != NULL);
  assert(fp2 != NULL);
  unsigned char file1Input, file2Input;
  while ((1 == fread(&file1Input, sizeof(file1Input), 1, fp1)) &&
         (1 == fread(&file2Input, sizeof(file2Input), 1, fp2))) {
    if (file1Input != file2Input) {
      printf("Test Failed - %s is not a copy of %s\n", argv[1], argv[2]);
      exit(1);
    }
  }
  printf("Test Passed - %s is a copy of %s\n", argv[1], argv[2]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe6a(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe52(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpq   $0x0,-0x20(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rcx
lea    -0x21(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %edx,%ecx
mov    %al,-0x23(%rbp)
jne    1226 <main+0xd6>
mov    -0x20(%rbp),%rcx
lea    -0x22(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x23(%rbp)
mov    -0x23(%rbp),%al
test   $0x1,%al
jne    1236 <main+0xe6>
jmp    1271 <main+0x121>
movzbl -0x21(%rbp),%eax
movzbl -0x22(%rbp),%ecx
cmp    %ecx,%eax
je     126c <main+0x11c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xda6(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
jmp    11db <main+0x8b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xda1(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
xor    %eax,%eax
cmp    $0x3,%edi
sete   %al
mov    %eax,%edi
call   1050 <assert@plt>
mov    0x8(%r14),%rdi
lea    0xe86(%rip),%rbx
mov    %rbx,%rsi
call   1060 <fopen@plt>
mov    %rax,%r15
mov    0x10(%r14),%rdi
mov    %rbx,%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %r15,%r15
setne  %dil
call   1050 <assert@plt>
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1050 <assert@plt>
lea    0xf(%rsp),%r12
lea    0xe(%rsp),%r13
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x1,%eax
jne    121d <main+0xcd>
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
cmp    $0x1,%eax
jne    121d <main+0xcd>
movzbl 0xf(%rsp),%eax
cmp    0xe(%rsp),%al
je     11c0 <main+0x70>
mov    0x8(%r14),%rsi
mov    0x10(%r14),%rdx
lea    0xdf5(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    0x8(%r14),%rsi
mov    0x10(%r14),%rdx
lea    0xdfd(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@.str.1 = [38 x i8] c"Test Failed - %s is not a copy of %s\0A\00"
@.str.2 = [34 x i8] c"Test Passed - %s is a copy of %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 i8
%9 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* null, i32** %6
store i32* null, i32** %7
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 3
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32* @fopen(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %17, i32** %6
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %21, i32** %7
%22 = load i32*, i32** %6
%23 = icmp ne i32* %22, null
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = load i32*, i32** %7
%27 = icmp ne i32* %26, null
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
br label %30
30: ; preds = %55, %2
%31 = load i32*, i32** %6
%32 = call i32 @fread(i8* %8, i32 1, i32 1, i32* %31)
%33 = icmp eq i32 1, %32
br i1 %33, label %34, label %38
34: ; preds = %30
%35 = load i32*, i32** %7
%36 = call i32 @fread(i8* %9, i32 1, i32 1, i32* %35)
%37 = icmp eq i32 1, %36
br label %38
38: ; preds = %34, %30
%39 = phi i1 [ false, %30 ], [ %37, %34 ]
br i1 %39, label %40, label %56
40: ; preds = %38
%41 = load i8, i8* %8
%42 = zext i8 %41 to i32
%43 = load i8, i8* %9
%44 = zext i8 %43 to i32
%45 = icmp ne i32 %42, %44
br i1 %45, label %46, label %55
46: ; preds = %40
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 1
%49 = load i8*, i8** %48
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 2
%52 = load i8*, i8** %51
%53 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %49, i8* %52)
%54 = call i32 @exit(i32 1)
unreachable
55: ; preds = %40
br label %30
56: ; preds = %38
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 1
%59 = load i8*, i8** %58
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 2
%62 = load i8*, i8** %61
%63 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %59, i8* %62)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@.str.1 = [38 x i8] c"Test Failed - %s is not a copy of %s\0A\00"
@.str.2 = [34 x i8] c"Test Passed - %s is a copy of %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8
%4 = alloca i8
%5 = icmp eq i32 %0, 3
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32* @fopen(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%14 = icmp ne i32* %10, null
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = icmp ne i32* %13, null
%18 = zext i1 %17 to i32
%19 = tail call i32 @assert(i32 %18)
br label %20
20: ; preds = %26, %2
%21 = call i32 @fread(i8* %3, i32 1, i32 1, i32* %10)
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %35
23: ; preds = %20
%24 = call i32 @fread(i8* %4, i32 1, i32 1, i32* %13)
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %35
26: ; preds = %23
%27 = load i8, i8* %3
%28 = load i8, i8* %4
%29 = icmp eq i8 %27, %28
br i1 %29, label %20, label %30
30: ; preds = %26
%31 = load i8*, i8** %8
%32 = load i8*, i8** %11
%33 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %31, i8* %32)
%34 = tail call i32 @exit(i32 1)
unreachable
35: ; preds = %20, %23
%36 = load i8*, i8** %8
%37 = load i8*, i8** %11
%38 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %36, i8* %37)
ret i32 0
}