#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*/ computePatchOpt(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  FILE *originalFile;
  FILE *targetFile;
  if (argc < 3) {
    fprintf(stderr,
            "!!!!! Usage: ./computePatchOpt originalFile targetFile !!!!!\n");
    exit(EXIT_FAILURE);
  }
  originalFile = fopen(argv[1], "r");
  targetFile = fopen(argv[2], "r");
  if (originalFile == NULL) {
    fprintf(stderr, "!!!!! Error opening originalFile !!!!! \n");
    exit(EXIT_FAILURE);
  }
  if (targetFile == NULL) {
    fprintf(stderr, "!!!!! Error opening targetFile !!!!!\n");
    exit(EXIT_FAILURE);
  }
  computePatchOpt(originalFile, targetFile);
  fclose(originalFile);
  fclose(targetFile);
  return 0;
}


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)
jge    1193 <main+0x43>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
lea    0xe80(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe9c(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe84(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11f1 <main+0xa1>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
lea    0xe62(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
cmpq   $0x0,-0x20(%rbp)
jne    121f <main+0xcf>
mov    0x2ddd(%rip),%rax
mov    (%rax),%edi
lea    0xe5d(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dc0(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1070 <computePatchOpt@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x2,%edi
jle    11af <main+0x5f>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xed6(%rip),%r15
mov    %r15,%rsi
call   1050 <fopen@plt>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
mov    %r15,%rsi
call   1050 <fopen@plt>
test   %r14,%r14
je     11c1 <main+0x71>
mov    %rax,%rbx
test   %rax,%rax
je     11d3 <main+0x83>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <computePatchOpt@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
lea    0xe41(%rip),%rsi
jmp    11e3 <main+0x93>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
lea    0xe6f(%rip),%rsi
jmp    11e3 <main+0x93>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
lea    0xe86(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [62 x i8] c"!!!!! Usage: ./computePatchOpt originalFile targetFile !!!!!\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [41 x i8] c"!!!!! Error opening originalFile !!!!! \0A\00"
@.str.3 = [38 x i8] c"!!!!! Error opening targetFile !!!!!\0A\00"
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 slt i32 %8, 3
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([62 x i8], [62 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, i64 1
%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 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %23, i32** %7
%24 = load i32*, i32** %6
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %31
26: ; preds = %15
%27 = load i32, i32* @stderr
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%29 = load i32, i32* @EXIT_FAILURE
%30 = call i32 @exit(i32 %29)
unreachable
31: ; preds = %15
%32 = load i32*, i32** %7
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %39
34: ; preds = %31
%35 = load i32, i32* @stderr
%36 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
%37 = load i32, i32* @EXIT_FAILURE
%38 = call i32 @exit(i32 %37)
unreachable
39: ; preds = %31
%40 = load i32*, i32** %6
%41 = load i32*, i32** %7
%42 = call i32 @computePatchOpt(i32* %40, i32* %41)
%43 = load i32*, i32** %6
%44 = call i32 @fclose(i32* %43)
%45 = load i32*, i32** %7
%46 = call i32 @fclose(i32* %45)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [62 x i8] c"!!!!! Usage: ./computePatchOpt originalFile targetFile !!!!!\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [41 x i8] c"!!!!! Error opening originalFile !!!!! \0A\00"
@.str.3 = [38 x i8] c"!!!!! Error opening targetFile !!!!!\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([62 x i8], [62 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 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i32* %12, null
br i1 %16, label %17, label %22
17: ; preds = %9
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%20 = load i32, i32* @EXIT_FAILURE
%21 = tail call i32 @exit(i32 %20)
unreachable
22: ; preds = %9
%23 = icmp eq i32* %15, null
br i1 %23, label %24, label %29
24: ; preds = %22
%25 = load i32, i32* @stderr
%26 = tail call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
%27 = load i32, i32* @EXIT_FAILURE
%28 = tail call i32 @exit(i32 %27)
unreachable
29: ; preds = %22
%30 = tail call i32 @computePatchOpt(i32* %12, i32* %15)
%31 = tail call i32 @fclose(i32* %12)
%32 = tail call i32 @fclose(i32* %15)
ret i32 0
}