#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*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ unlink(char *);
int main(int argc, char *argv[]) {
  int fd;
  if (argc != 2) {
    printf("Number of Arguements provided != 2 \n");
    printf("Arguements Required: \n");
    printf("Filename \n");
    exit(-1);
  }
  fd = open(argv[1], O_RDONLY);
  if (fd != -1) {
    close(fd);
    unlink(argv[1]);
    printf("%s deleted! \n", argv[1]);
  } else {
    perror(argv[1]);
  }
  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   $0x2,-0x8(%rbp)
je     11b4 <main+0x54>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e25(%rip),%rax
mov    (%rax),%esi
call   1060 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
je     1207 <main+0xa7>
mov    -0x14(%rbp),%edi
call   1050 <close@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <unlink@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1214 <main+0xb4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <perror@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    11c1 <main+0x51>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
mov    0x2e64(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
cmp    $0xffffffff,%eax
je     11b6 <main+0x46>
mov    %eax,%edi
call   1060 <close@plt>
mov    0x8(%rbx),%rdi
call   1030 <unlink@plt>
mov    0x8(%rbx),%rsi
lea    0xe55(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    0x8(%rbx),%rdi
call   1080 <perror@plt>
jmp    11b2 <main+0x42>
lea    0xe46(%rip),%rdi
call   1040 <puts@plt>
lea    0xe5e(%rip),%rdi
call   1040 <puts@plt>
lea    0xe68(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"Number of Arguements provided != 2 \0A\00"
@.str.1 = [23 x i8] c"Arguements Required: \0A\00"
@.str.2 = [11 x i8] c"Filename \0A\00"
@O_RDONLY = global i32 0
@.str.3 = [14 x i8] c"%s deleted! \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @exit(i32 -1)
unreachable
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = load i32, i32* @O_RDONLY
%19 = call i32 @open(i8* %17, i32 %18)
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = icmp ne i32 %20, -1
br i1 %21, label %22, label %33
22: ; preds = %14
%23 = load i32, i32* %6
%24 = call i32 @close(i32 %23)
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @unlink(i8* %27)
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %31)
br label %38
33: ; preds = %14
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i32 @perror(i8* %36)
br label %38
38: ; preds = %33, %22
ret i32 0
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@.str.3 = [14 x i8] c"%s deleted! \0A\00"
@str = [36 x i8] c"Number of Arguements provided != 2 \00"
@str.4 = [22 x i8] c"Arguements Required: \00"
@str.5 = [10 x i8] c"Filename \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.4, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.5, i64 0, i64 0))
%8 = tail call i32 @exit(i32 -1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = load i32, i32* @O_RDONLY
%13 = tail call i32 @open(i8* %11, i32 %12)
%14 = icmp eq i32 %13, -1
br i1 %14, label %21, label %15
15: ; preds = %9
%16 = tail call i32 @close(i32 %13)
%17 = load i8*, i8** %10
%18 = tail call i32 @unlink(i8* %17)
%19 = load i8*, i8** %10
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %19)
br label %24
21: ; preds = %9
%22 = load i8*, i8** %10
%23 = tail call i32 @perror(i8* %22)
br label %24
24: ; preds = %21, %15
ret i32 0
}