#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 EXIT_FAILURE;
int EXIT_SUCCESS;
char *basename(char *);
int /*<<< orphan*/ cmp(char *, char *, char *);
int /*<<< orphan*/ stderr;
char *strdup(char *);
int /*<<< orphan*/ test_file(char *);
int /*<<< orphan*/ usage(int /*<<< orphan*/, char *);
int main(int argc, char *argv[]) {
  char *pname = strdup(argv[0]);
  pname = basename(pname);
  if (argc < 4) {
    usage(stderr, pname);
    return EXIT_FAILURE;
  }
  if (!test_file(argv[1]) || !test_file(argv[2]))
    return EXIT_FAILURE;
  cmp(argv[1], argv[2], argv[3]);
  return 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)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <strdup@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <basename@plt>
mov    %rax,-0x18(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11b0 <main+0x60>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rsi
call   1060 <usage@plt>
mov    0x2e32(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1216 <main+0xc6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <test_file@plt>
cmp    $0x0,%eax
je     11dc <main+0x8c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <test_file@plt>
cmp    $0x0,%eax
jne    11ed <main+0x9d>
mov    0x2df5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1216 <main+0xc6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
call   1050 <cmp@plt>
mov    0x2dbf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    (%rsi),%rdi
call   1070 <strdup@plt>
mov    %rax,%rdi
call   1040 <basename@plt>
cmp    $0x3,%ebp
jg     1187 <main+0x37>
mov    0x2e6c(%rip),%rcx
mov    (%rcx),%edi
mov    %rax,%rsi
call   1060 <usage@plt>
mov    0x2e53(%rip),%rbp
jmp    11c0 <main+0x70>
mov    0x8(%rbx),%rdi
call   1030 <test_file@plt>
mov    0x2e41(%rip),%rbp
test   %eax,%eax
je     11c0 <main+0x70>
mov    0x10(%rbx),%rdi
call   1030 <test_file@plt>
test   %eax,%eax
je     11c0 <main+0x70>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
mov    0x18(%rbx),%rdx
call   1050 <cmp@plt>
mov    0x2e10(%rip),%rbp
mov    0x0(%rbp),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 0
%9 = load i8*, i8** %8
%10 = call i8* @strdup(i8* %9)
store i8* %10, i8** %6
%11 = load i8*, i8** %6
%12 = call i8* @basename(i8* %11)
store i8* %12, i8** %6
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 4
br i1 %14, label %15, label %20
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i8*, i8** %6
%18 = call i32 @usage(i32 %16, i8* %17)
%19 = load i32, i32* @EXIT_FAILURE
store i32 %19, i32* %3
br label %46
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @test_file(i8* %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %32
26: ; preds = %20
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 2
%29 = load i8*, i8** %28
%30 = call i32 @test_file(i8* %29)
%31 = icmp ne i32 %30, 0
br i1 %31, label %34, label %32
32: ; preds = %26, %20
%33 = load i32, i32* @EXIT_FAILURE
store i32 %33, i32* %3
br label %46
34: ; preds = %26
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 2
%40 = load i8*, i8** %39
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 3
%43 = load i8*, i8** %42
%44 = call i32 @cmp(i8* %37, i8* %40, i8* %43)
%45 = load i32, i32* @EXIT_SUCCESS
store i32 %45, i32* %3
br label %46
46: ; preds = %34, %32, %15
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i8* @strdup(i8* %3)
%5 = tail call i8* @basename(i8* %4)
%6 = icmp slt i32 %0, 4
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = tail call i32 @usage(i32 %8, i8* %5)
br label %26
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @test_file(i8* %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %26, label %15
15: ; preds = %10
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32 @test_file(i8* %17)
%19 = icmp eq i32 %18, 0
br i1 %19, label %26, label %20
20: ; preds = %15
%21 = load i8*, i8** %11
%22 = load i8*, i8** %16
%23 = getelementptr inbounds i8*, i8** %1, i64 3
%24 = load i8*, i8** %23
%25 = tail call i32 @cmp(i8* %21, i8* %22, i8* %24)
br label %26
26: ; preds = %10, %15, %20, %7
%27 = phi i32* [ @EXIT_FAILURE, %7 ], [ @EXIT_SUCCESS, %20 ], [ @EXIT_FAILURE, %15 ], [ @EXIT_FAILURE, %10 ]
%28 = load i32, i32* %27
ret i32 %28
}