#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 */
scalar_t__ ENOENT;
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, char *);
int /*<<< orphan*/ stderr;
char *strerror(scalar_t__);
scalar_t__ unlink(char const *);
void xunlink(const char *pathname) {
  if (unlink(pathname) < 0 && errno != ENOENT) {
    fprintf(stderr, "  Error: Cannot remove %s: %s\n", pathname,
            strerror(errno));
    exit(1);
  }
}


x86 assembly (clang, -O0):
<xunlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <unlink@plt>
cmp    $0x0,%rax
jge    11bc <xunlink+0x7c>
mov    0x2e72(%rip),%rax
mov    (%rax),%rax
mov    0x2e58(%rip),%rcx
cmp    (%rcx),%rax
je     11bc <xunlink+0x7c>
mov    0x2e60(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e44(%rip),%rax
mov    (%rax),%rdi
call   1060 <strerror@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    %rax,%rcx
lea    0xe53(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xunlink>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <unlink@plt>
test   %rax,%rax
jns    1166 <xunlink+0x26>
mov    0x2e81(%rip),%rax
mov    (%rax),%rdi
mov    0x2e67(%rip),%rax
cmp    (%rax),%rdi
jne    116d <xunlink+0x2d>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2e6c(%rip),%rax
mov    (%rax),%ebp
call   1060 <strerror@plt>
lea    0xe7e(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@errno = global i64 0
@ENOENT = global i64 0
@stderr = global i32 0
@.str = [31 x i8] c" Error: Cannot remove %s: %s\0A\00"
define void @xunlink(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @unlink(i8* %3)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %17
6: ; preds = %1
%7 = load i64, i64* @errno
%8 = load i64, i64* @ENOENT
%9 = icmp ne i64 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %2
%13 = load i64, i64* @errno
%14 = call i8* @strerror(i64 %13)
%15 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %14)
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@errno = global i64 0
@ENOENT = global i64 0
@stderr = global i32 0
@.str = [31 x i8] c" Error: Cannot remove %s: %s\0A\00"
define void @xunlink(i8* %0) {
%2 = tail call i64 @unlink(i8* %0)
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = load i64, i64* @errno
%6 = load i64, i64* @ENOENT
%7 = icmp eq i64 %5, %6
br i1 %7, label %13, label %8
8: ; preds = %4
%9 = load i32, i32* @stderr
%10 = tail call i8* @strerror(i64 %5)
%11 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %10)
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %4, %1
ret void
}