#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*/ bu_extra_argument(char *);
scalar_t__ bu_handle_version(int, char **);
int /*<<< orphan*/ bu_missing_argument(char *);
scalar_t__ has_arg(int, char **, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ puts(char *);
int unlink(char *);
int main(int argc, char **argv) {
  if (has_arg(argc, argv, "-h") || has_arg(argc, argv, "--help")) {
    puts("Usage: unlink FILE");
    puts("Removes an existing file path, FILE.");
    return 1;
  }
  if (bu_handle_version(argc, argv)) {
    return 0;
  }
  if (argc < 2) {
    bu_missing_argument(argv[0]);
    return 1;
  }
  if (argc > 2) {
    bu_extra_argument(argv[0]);
    return 1;
  }
  if (unlink(argv[1]) == -1) {
    perror(argv[0]);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe6c(%rip),%rdx
call   1050 <has_arg@plt>
cmp    $0x0,%rax
jne    11c0 <main+0x50>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe52(%rip),%rdx
call   1050 <has_arg@plt>
cmp    $0x0,%rax
je     11e4 <main+0x74>
lea    0xe43(%rip),%rdi
call   1040 <puts@plt>
lea    0xe4a(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    127f <main+0x10f>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1080 <bu_handle_version@plt>
cmp    $0x0,%rax
je     1206 <main+0x96>
movl   $0x0,-0x4(%rbp)
jmp    127f <main+0x10f>
cmpl   $0x2,-0x8(%rbp)
jge    1228 <main+0xb8>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <bu_missing_argument@plt>
movl   $0x1,-0x4(%rbp)
jmp    127f <main+0x10f>
cmpl   $0x2,-0x8(%rbp)
jle    124a <main+0xda>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <bu_extra_argument@plt>
movl   $0x1,-0x4(%rbp)
jmp    127f <main+0x10f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <unlink@plt>
cmp    $0xffffffff,%eax
jne    1278 <main+0x108>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    127f <main+0x10f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
lea    0xe80(%rip),%rdx
call   1050 <has_arg@plt>
test   %rax,%rax
jne    11a0 <main+0x30>
lea    0xe72(%rip),%rdx
mov    %ebp,%edi
mov    %r14,%rsi
call   1050 <has_arg@plt>
test   %rax,%rax
je     11c4 <main+0x54>
lea    0xe63(%rip),%rdi
call   1040 <puts@plt>
lea    0xe6a(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %ebp,%edi
mov    %r14,%rsi
call   1080 <bu_handle_version@plt>
xor    %ebx,%ebx
test   %rax,%rax
jne    11bd <main+0x4d>
cmp    $0x1,%ebp
jg     11e4 <main+0x74>
mov    (%r14),%rdi
call   1090 <bu_missing_argument@plt>
jmp    11b8 <main+0x48>
cmp    $0x2,%ebp
jne    1201 <main+0x91>
mov    0x8(%r14),%rdi
call   1030 <unlink@plt>
cmp    $0xffffffff,%eax
jne    11bd <main+0x4d>
mov    (%r14),%rdi
call   1070 <perror@plt>
jmp    11b8 <main+0x48>
mov    (%r14),%rdi
call   1060 <bu_extra_argument@plt>
jmp    11b8 <main+0x48>

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [19 x i8] c"Usage: unlink FILE\00"
@.str.3 = [37 x i8] c"Removes an existing file path, FILE.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i64 @has_arg(i32 %6, i8** %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i64 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %2
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i64 @has_arg(i32 %11, i8** %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %10, %2
%16 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %52
18: ; preds = %10
%19 = load i32, i32* %4
%20 = load i8**, i8*** %5
%21 = call i64 @bu_handle_version(i32 %19, i8** %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %18
store i32 0, i32* %3
br label %52
24: ; preds = %18
%25 = load i32, i32* %4
%26 = icmp slt i32 %25, 2
br i1 %26, label %27, label %32
27: ; preds = %24
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 0
%30 = load i8*, i8** %29
%31 = call i32 @bu_missing_argument(i8* %30)
store i32 1, i32* %3
br label %52
32: ; preds = %24
%33 = load i32, i32* %4
%34 = icmp sgt i32 %33, 2
br i1 %34, label %35, label %40
35: ; preds = %32
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 0
%38 = load i8*, i8** %37
%39 = call i32 @bu_extra_argument(i8* %38)
store i32 1, i32* %3
br label %52
40: ; preds = %32
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = load i8*, i8** %42
%44 = call i32 @unlink(i8* %43)
%45 = icmp eq i32 %44, -1
br i1 %45, label %46, label %51
46: ; preds = %40
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 0
%49 = load i8*, i8** %48
%50 = call i32 @perror(i8* %49)
store i32 1, i32* %3
br label %52
51: ; preds = %40
store i32 0, i32* %3
br label %52
52: ; preds = %51, %46, %35, %27, %23, %15
%53 = load i32, i32* %3
ret i32 %53
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [19 x i8] c"Usage: unlink FILE\00"
@.str.3 = [37 x i8] c"Removes an existing file path, FILE.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i64 @has_arg(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i64 @has_arg(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %5, %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
br label %32
11: ; preds = %5
%12 = tail call i64 @bu_handle_version(i32 %0, i8** %1)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %32
14: ; preds = %11
%15 = icmp slt i32 %0, 2
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = load i8*, i8** %1
%18 = tail call i32 @bu_missing_argument(i8* %17)
br label %32
19: ; preds = %14
%20 = icmp eq i32 %0, 2
br i1 %20, label %24, label %21
21: ; preds = %19
%22 = load i8*, i8** %1
%23 = tail call i32 @bu_extra_argument(i8* %22)
br label %32
24: ; preds = %19
%25 = getelementptr inbounds i8*, i8** %1, i64 1
%26 = load i8*, i8** %25
%27 = tail call i32 @unlink(i8* %26)
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %32
29: ; preds = %24
%30 = load i8*, i8** %1
%31 = tail call i32 @perror(i8* %30)
br label %32
32: ; preds = %24, %11, %29, %21, %16, %8
%33 = phi i32 [ 1, %8 ], [ 1, %16 ], [ 1, %21 ], [ 1, %29 ], [ 0, %11 ], [ 0, %24 ]
ret i32 %33
}