#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*/ fprintf(int /*<<< orphan*/, char *, char const *, char *);
int remove(char const *);
int /*<<< orphan*/ stderr;
char *strerror(scalar_t__);
int clean_remove(const char *filename) {
  int ret = 0;
  errno = 0;
  ret = remove(filename);
  if (errno && errno != ENOENT) {
    fprintf(stderr, "remove(%s): %s\n", filename, strerror(errno));
  }
  return ret;
}


x86 assembly (clang, -O0):
<clean_remove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    0x2e8e(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <remove@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e74(%rip),%rax
cmpq   $0x0,(%rax)
je     11c1 <clean_remove+0x91>
mov    0x2e63(%rip),%rax
mov    (%rax),%rax
mov    0x2e49(%rip),%rcx
cmp    (%rcx),%rax
je     11c1 <clean_remove+0x91>
mov    0x2e51(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    0x2e35(%rip),%rax
mov    (%rax),%rdi
call   1050 <strerror@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rdx
mov    %rax,%rcx
lea    0xe44(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clean_remove>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2e97(%rip),%rbp
movq   $0x0,0x0(%rbp)
call   1030 <remove@plt>
mov    %eax,%r15d
mov    0x0(%rbp),%rdi
test   %rdi,%rdi
je     118a <clean_remove+0x5a>
mov    0x2e67(%rip),%rax
cmp    (%rax),%rdi
je     118a <clean_remove+0x5a>
mov    0x2e73(%rip),%rax
mov    (%rax),%r14d
call   1050 <strerror@plt>
lea    0xe84(%rip),%rsi
mov    %r14d,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1040 <fprintf@plt>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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