#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 /*<<< orphan*/ dec(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                       int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  char *input_file_name = (argc > 1) ? argv[1] : NULL;
  char *ref_file_name = (argc > 2) ? argv[2] : NULL;
  char *output_file_name = (argc > 3) ? argv[3] : NULL;
  if (!input_file_name || !ref_file_name) {
    printf("error: no file names given\n");
    return 1;
  }
  dec(fopen(input_file_name, "rb"), fopen(ref_file_name, "rb"),
      output_file_name ? fopen(output_file_name, "wb") : NULL);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1161 <main+0x31>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    116c <main+0x3c>
xor    %eax,%eax
mov    %rax,-0x30(%rbp)
jmp    116c <main+0x3c>
mov    -0x30(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    118f <main+0x5f>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    119a <main+0x6a>
xor    %eax,%eax
mov    %rax,-0x38(%rbp)
jmp    119a <main+0x6a>
mov    -0x38(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x3,-0x8(%rbp)
jle    11bd <main+0x8d>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    11c8 <main+0x98>
xor    %eax,%eax
mov    %rax,-0x40(%rbp)
jmp    11c8 <main+0x98>
mov    -0x40(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11e6 <main+0xb6>
cmpq   $0x0,-0x20(%rbp)
jne    11fe <main+0xce>
lea    0xe13(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    126d <main+0x13d>
mov    -0x18(%rbp),%rdi
lea    0xe13(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x50(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xdff(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     124a <main+0x11a>
mov    -0x28(%rbp),%rdi
lea    0xde3(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x58(%rbp)
jmp    1255 <main+0x125>
xor    %eax,%eax
mov    %rax,-0x58(%rbp)
jmp    1255 <main+0x125>
mov    -0x48(%rbp),%rsi
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rdx
call   1030 <dec@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     113f <main+0xf>
jne    115e <main+0x2e>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    %edi,%eax
mov    0x8(%rsi),%rdi
cmp    $0x4,%eax
jb     1174 <main+0x44>
mov    0x18(%rsi),%r14
test   %rdi,%rdi
jne    117c <main+0x4c>
jmp    113f <main+0xf>
xor    %r14d,%r14d
test   %rdi,%rdi
je     113f <main+0xf>
mov    0x10(%rsi),%rbx
test   %rbx,%rbx
je     113f <main+0xf>
lea    0xe74(%rip),%r12
mov    %r12,%rsi
call   1050 <fopen@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <fopen@plt>
mov    %rax,%r12
xor    %ebx,%ebx
test   %r14,%r14
je     11c0 <main+0x90>
lea    0xe50(%rip),%rsi
mov    %r14,%rdi
call   1050 <fopen@plt>
mov    %rax,%rdx
jmp    11c2 <main+0x92>
xor    %edx,%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <dec@plt>
jmp    1150 <main+0x20>

LLVM IR (-O0):
@.str = [28 x i8] c"error: no file names given\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [3 x i8] c"wb\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
br label %16
15: ; preds = %2
br label %16
16: ; preds = %15, %11
%17 = phi i8* [ %14, %11 ], [ null, %15 ]
store i8* %17, i8** %6
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 2
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
br label %25
24: ; preds = %16
br label %25
25: ; preds = %24, %20
%26 = phi i8* [ %23, %20 ], [ null, %24 ]
store i8* %26, i8** %7
%27 = load i32, i32* %4
%28 = icmp sgt i32 %27, 3
br i1 %28, label %29, label %33
29: ; preds = %25
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 3
%32 = load i8*, i8** %31
br label %34
33: ; preds = %25
br label %34
34: ; preds = %33, %29
%35 = phi i8* [ %32, %29 ], [ null, %33 ]
store i8* %35, i8** %8
%36 = load i8*, i8** %6
%37 = icmp ne i8* %36, null
br i1 %37, label %38, label %41
38: ; preds = %34
%39 = load i8*, i8** %7
%40 = icmp ne i8* %39, null
br i1 %40, label %43, label %41
41: ; preds = %38, %34
%42 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %57
43: ; preds = %38
%44 = load i8*, i8** %6
%45 = call i32* @fopen(i8* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%46 = load i8*, i8** %7
%47 = call i32* @fopen(i8* %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%48 = load i8*, i8** %8
%49 = icmp ne i8* %48, null
br i1 %49, label %50, label %53
50: ; preds = %43
%51 = load i8*, i8** %8
%52 = call i32* @fopen(i8* %51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %54
53: ; preds = %43
br label %54
54: ; preds = %53, %50
%55 = phi i32* [ %52, %50 ], [ null, %53 ]
%56 = call i32 @dec(i32* %45, i32* %47, i32* %55)
store i32 0, i32* %3
br label %57
57: ; preds = %54, %41
%58 = load i32, i32* %3
ret i32 %58
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [3 x i8] c"wb\00"
@str = [27 x i8] c"error: no file names given\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %20
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = icmp eq i32 %0, 2
br i1 %7, label %20, label %8
8: ; preds = %4
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = icmp ugt i32 %0, 3
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = getelementptr inbounds i8*, i8** %1, i64 3
%14 = load i8*, i8** %13
br label %15
15: ; preds = %8, %12
%16 = phi i8* [ %14, %12 ], [ null, %8 ]
%17 = icmp ne i8* %6, null
%18 = icmp ne i8* %10, null
%19 = select i1 %17, i1 %18, i1 false
br i1 %19, label %22, label %20
20: ; preds = %4, %2, %15
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %31
22: ; preds = %15
%23 = tail call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%24 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i8* %16, null
br i1 %25, label %28, label %26
26: ; preds = %22
%27 = tail call i32* @fopen(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %22, %26
%29 = phi i32* [ %27, %26 ], [ null, %22 ]
%30 = tail call i32 @dec(i32* %23, i32* %24, i32* %29)
br label %31
31: ; preds = %28, %20
%32 = phi i32 [ 0, %28 ], [ 1, %20 ]
ret i32 %32
}