#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 */
#define ENOENT 128
int errno;
int /*<<< orphan*/ getpid();
scalar_t__ rmdir(char const *);
int /*<<< orphan*/ say(char *, int /*<<< orphan*/, char const *,
                       int /*<<< orphan*/);
int /*<<< orphan*/ strerror(int);
void cleanup_rmdir(const char *name) {
  if (rmdir(name) < 0) {
    switch (errno) {
    case ENOENT:
      break;
    default:
      say("cleanup (pid %d): rmdir %s: %s\n", getpid(), name, strerror(errno));
      break;
    }
  }
}


x86 assembly (clang, -O0):
<cleanup_rmdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <rmdir@plt>
cmp    $0x0,%rax
jge    11b7 <cleanup_rmdir+0x77>
mov    0x2e7a(%rip),%rax
mov    (%rax),%eax
sub    $0x80,%eax
jne    117d <cleanup_rmdir+0x3d>
jmp    1178 <cleanup_rmdir+0x38>
jmp    11b2 <cleanup_rmdir+0x72>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    %eax,%ecx
lea    0xe53(%rip),%rdi
call   1060 <say@plt>
jmp    11b7 <cleanup_rmdir+0x77>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanup_rmdir>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1040 <rmdir@plt>
test   %rax,%rax
jns    1189 <cleanup_rmdir+0x49>
mov    0x2e88(%rip),%r14
cmpl   $0x80,(%r14)
je     1189 <cleanup_rmdir+0x49>
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%ebp
mov    (%r14),%edi
call   1050 <strerror@plt>
lea    0xe87(%rip),%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <say@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i32 0
@.str = [32 x i8] c"cleanup (pid %d): rmdir %s: %s\0A\00"
define void @cleanup_rmdir(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @rmdir(i8* %3)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %16
6: ; preds = %1
%7 = load i32, i32* @errno
switch i32 %7, label %9 [
i32 128, label %8
]
8: ; preds = %6
br label %15
9: ; preds = %6
%10 = call i32 (...) @getpid()
%11 = load i8*, i8** %2
%12 = load i32, i32* @errno
%13 = call i32 @strerror(i32 %12)
%14 = call i32 @say(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %10, i8* %11, i32 %13)
br label %15
15: ; preds = %9, %8
br label %16
16: ; preds = %15, %1
ret void
}

LLVM IR (-O2):
@errno = global i32 0
@.str = [32 x i8] c"cleanup (pid %d): rmdir %s: %s\0A\00"
define void @cleanup_rmdir(i8* %0) {
%2 = tail call i64 @rmdir(i8* %0)
%3 = icmp sgt i64 %2, -1
%4 = load i32, i32* @errno
%5 = icmp eq i32 %4, 128
%6 = select i1 %3, i1 true, i1 %5
br i1 %6, label %12, label %7
7: ; preds = %1
%8 = tail call i32 (...) @getpid()
%9 = load i32, i32* @errno
%10 = tail call i32 @strerror(i32 %9)
%11 = tail call i32 @say(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %8, i8* %0, i32 %10)
br label %12
12: ; preds = %7, %1
ret void
}