#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*/ LOG_io(char *, char const *, int /*<<< orphan*/);
int errno;
scalar_t__ rmdir(char const *);
int /*<<< orphan*/ strerror(int);
scalar_t__ stub1(char const *);
scalar_t__ unlink(char const *);
void del_n_log(const char *s, int f, int e) {
  if ((f ? rmdir : unlink)(s) < 0 && errno != e)
    LOG_io("del %s: %s", s, strerror(errno));
}


x86 assembly (clang, -O0):
<del_n_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%edx
mov    0x2e8c(%rip),%rax
mov    0x2e95(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    -0x8(%rbp),%rdi
call   *%rax
cmp    $0x0,%rax
jge    1194 <del_n_log+0x74>
mov    0x2e7f(%rip),%rax
mov    (%rax),%eax
cmp    -0x10(%rbp),%eax
je     1194 <del_n_log+0x74>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
lea    0xe71(%rip),%rdi
call   1030 <LOG_io@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<del_n_log>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
test   %esi,%esi
jne    1135 <del_n_log+0x15>
mov    0x2e95(%rip),%rax
jmp    113c <del_n_log+0x1c>
mov    0x2e9c(%rip),%rax
mov    %rbx,%rdi
call   *%rax
test   %rax,%rax
jns    1153 <del_n_log+0x33>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
cmp    %ebp,%edi
jne    115a <del_n_log+0x3a>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
call   1040 <strerror@plt>
lea    0xe9a(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <LOG_io@plt>

LLVM IR (-O0):
@errno = global i32 0
@.str = [11 x i8] c"del %s: %s\00"
define void @del_n_log(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i64 (i8*)* @rmdir, i64 (i8*)* @unlink
%11 = load i8*, i8** %4
%12 = call i64 %10(i8* %11)
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %23
14: ; preds = %3
%15 = load i32, i32* @errno
%16 = load i32, i32* %6
%17 = icmp ne i32 %15, %16
br i1 %17, label %18, label %23
18: ; preds = %14
%19 = load i8*, i8** %4
%20 = load i32, i32* @errno
%21 = call i32 @strerror(i32 %20)
%22 = call i32 @LOG_io(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %19, i32 %21)
br label %23
23: ; preds = %18, %14, %3
ret void
}

LLVM IR (-O2):
@errno = global i32 0
@.str = [11 x i8] c"del %s: %s\00"
define void @del_n_log(i8* %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, 0
%5 = select i1 %4, i64 (i8*)* @unlink, i64 (i8*)* @rmdir
%6 = tail call i64 %5(i8* %0)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %3
%9 = load i32, i32* @errno
%10 = icmp eq i32 %9, %2
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = tail call i32 @strerror(i32 %9)
%13 = tail call i32 @LOG_io(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %12)
br label %14
14: ; preds = %11, %8, %3
ret void
}