#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*/ AT_FDCWD;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int unlinkat(int /*<<< orphan*/, char *, int);
int main(int argc, char **argv) {
  if (argc < 2 || *argv[1] == '-') {
    fprintf(stderr, "Usage: wipe_lnx FILE...\n");
    return 1;
  }
  while (--argc && *argv[argc] != '-') {
    int rc;
    printf("Trying to wipe file '%s': ", argv[argc]);
    fflush(stdout);
    rc = unlinkat(AT_FDCWD, argv[argc], 0x8000);
    if (rc) {
      perror("error: ");
      return 2;
    }
    printf("ok\n");
  }
  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)
jl     1184 <main+0x34>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11a5 <main+0x55>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
lea    0xe6c(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    126f <main+0x11f>
jmp    11aa <main+0x5a>
mov    -0x8(%rbp),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
je     11d9 <main+0x89>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    11e9 <main+0x99>
jmp    1268 <main+0x118>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2dce(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    $0x8000,%edx
call   1030 <unlinkat@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1255 <main+0x105>
lea    0xdf0(%rip),%rdi
call   1070 <perror@plt>
movl   $0x2,-0x4(%rbp)
jmp    126f <main+0x11f>
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11aa <main+0x5a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     117c <main+0x1c>
mov    %rsi,%rbx
mov    0x8(%rsi),%rax
cmpb   $0x2d,(%rax)
jne    1198 <main+0x38>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
lea    0xe74(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%eax
jmp    1206 <main+0xa6>
mov    %edi,%ebp
lea    0xe78(%rip),%r15
mov    0x2e30(%rip),%r13
mov    0x2e19(%rip),%r14
lea    0xe86(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
mov    -0x8(%rbx,%rbp,8),%rsi
cmpb   $0x2d,(%rsi)
je     1204 <main+0xa4>
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%r13),%edi
call   1070 <fflush@plt>
mov    (%r14),%edi
mov    -0x8(%rbx,%rbp,8),%rsi
mov    $0x8000,%edx
call   1030 <unlinkat@plt>
test   %eax,%eax
jne    1215 <main+0xb5>
mov    %r12,%rdi
call   1040 <puts@plt>
add    $0xffffffffffffffff,%rbp
cmp    $0x1,%ebp
jne    11c0 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe18(%rip),%rdi
call   1080 <perror@plt>
mov    $0x2,%eax
jmp    1206 <main+0xa6>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"Usage: wipe_lnx FILE...\0A\00"
@.str.1 = [27 x i8] c"Trying to wipe file '%s': \00"
@stdout = global i32 0
@AT_FDCWD = global i32 0
@.str.2 = [8 x i8] c"error: \00"
@.str.3 = [4 x i8] c"ok\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 slt i32 %7, 2
br i1 %8, label %16, label %9
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 45
br i1 %15, label %16, label %19
16: ; preds = %9, %2
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %58
19: ; preds = %9
br label %20
20: ; preds = %55, %19
%21 = load i32, i32* %4
%22 = add nsw i32 %21, -1
store i32 %22, i32* %4
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %33
24: ; preds = %20
%25 = load i8**, i8*** %5
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
%29 = load i8*, i8** %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 45
br label %33
33: ; preds = %24, %20
%34 = phi i1 [ false, %20 ], [ %32, %24 ]
br i1 %34, label %35, label %57
35: ; preds = %33
%36 = load i8**, i8*** %5
%37 = load i32, i32* %4
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %36, i64 %38
%40 = load i8*, i8** %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %40)
%42 = load i32, i32* @stdout
%43 = call i32 @fflush(i32 %42)
%44 = load i32, i32* @AT_FDCWD
%45 = load i8**, i8*** %5
%46 = load i32, i32* %4
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %45, i64 %47
%49 = load i8*, i8** %48
%50 = call i32 @unlinkat(i32 %44, i8* %49, i32 32768)
store i32 %50, i32* %6
%51 = load i32, i32* %6
%52 = icmp ne i32 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %35
%54 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
store i32 2, i32* %3
br label %58
55: ; preds = %35
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %20
57: ; preds = %33
store i32 0, i32* %3
br label %58
58: ; preds = %57, %53, %16
%59 = load i32, i32* %3
ret i32 %59
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"Usage: wipe_lnx FILE...\0A\00"
@.str.1 = [27 x i8] c"Trying to wipe file '%s': \00"
@stdout = global i32 0
@AT_FDCWD = global i32 0
@.str.2 = [8 x i8] c"error: \00"
@str = [3 x i8] c"ok\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 45
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = zext i32 %0 to i64
%11 = add nsw i64 %10, -1
br label %15
12: ; preds = %4, %2
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %36
15: ; preds = %9, %31
%16 = phi i64 [ %11, %9 ], [ %33, %31 ]
%17 = getelementptr inbounds i8*, i8** %1, i64 %16
%18 = load i8*, i8** %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 45
br i1 %20, label %36, label %21
21: ; preds = %15
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%23 = load i32, i32* @stdout
%24 = tail call i32 @fflush(i32 %23)
%25 = load i32, i32* @AT_FDCWD
%26 = load i8*, i8** %17
%27 = tail call i32 @unlinkat(i32 %25, i8* %26, i32 32768)
%28 = icmp eq i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %21
%30 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %36
31: ; preds = %21
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%33 = add nsw i64 %16, -1
%34 = trunc i64 %33 to i32
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %15
36: ; preds = %31, %15, %29, %12
%37 = phi i32 [ 1, %12 ], [ 2, %29 ], [ 0, %15 ], [ 0, %31 ]
ret i32 %37
}