#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 /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ filecomp(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  FILE *fp1;
  FILE *fp2;
  if (argc != 3) {
    fprintf(stderr, "mindiff: usage: mindiff <file1> <file2>\n");
    exit(EXIT_FAILURE);
  }
  if ((fp1 = fopen(*++argv, "r")) == NULL) {
    fprintf(stderr, "mindiff: cannot open file %s\n", *argv);
    exit(EXIT_FAILURE);
  }
  if ((fp2 = fopen(*++argv, "r")) == NULL) {
    fprintf(stderr, "mindiff: cannot open file %s\n", *argv);
    exit(EXIT_FAILURE);
  }
  filecomp(fp1, fp2);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1185 <main+0x45>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xe8a(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11de <main+0x9e>
mov    0x2e27(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe62(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xe31(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1237 <main+0xf7>
mov    0x2dce(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe09(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2da8(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <filecomp@plt>
mov    0x2d85(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    1170 <main+0x30>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xed2(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
jne    1189 <main+0x49>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
jmp    11ae <main+0x6e>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
lea    0xe80(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    11bc <main+0x7c>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
lea    0xe92(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
jne    11ca <main+0x8a>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbx),%rdx
lea    0xe76(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x2e15(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <filecomp@plt>
mov    0x2df4(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [41 x i8] c"mindiff: usage: mindiff <file1> <file2>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [30 x i8] c"mindiff: cannot open file %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 3
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i32 1
store i8** %17, i8*** %5
%18 = load i8*, i8** %17
%19 = call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %19, i32** %6
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %28
21: ; preds = %15
%22 = load i32, i32* @stderr
%23 = load i8**, i8*** %5
%24 = load i8*, i8** %23
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %24)
%26 = load i32, i32* @EXIT_FAILURE
%27 = call i32 @exit(i32 %26)
unreachable
28: ; preds = %15
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i32 1
store i8** %30, i8*** %5
%31 = load i8*, i8** %30
%32 = call i32* @fopen(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %32, i32** %7
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %41
34: ; preds = %28
%35 = load i32, i32* @stderr
%36 = load i8**, i8*** %5
%37 = load i8*, i8** %36
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %37)
%39 = load i32, i32* @EXIT_FAILURE
%40 = call i32 @exit(i32 %39)
unreachable
41: ; preds = %28
%42 = load i32*, i32** %6
%43 = load i32*, i32** %7
%44 = call i32 @filecomp(i32* %42, i32* %43)
%45 = load i32, i32* @EXIT_SUCCESS
%46 = call i32 @exit(i32 %45)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [41 x i8] c"mindiff: usage: mindiff <file1> <file2>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [30 x i8] c"mindiff: cannot open file %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %20
14: ; preds = %9
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %10
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @EXIT_FAILURE
%19 = tail call i32 @exit(i32 %18)
unreachable
20: ; preds = %9
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = tail call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %31
25: ; preds = %20
%26 = load i32, i32* @stderr
%27 = load i8*, i8** %21
%28 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %27)
%29 = load i32, i32* @EXIT_FAILURE
%30 = tail call i32 @exit(i32 %29)
unreachable
31: ; preds = %20
%32 = tail call i32 @filecomp(i32* %12, i32* %23)
%33 = load i32, i32* @EXIT_SUCCESS
%34 = tail call i32 @exit(i32 %33)
unreachable
}