#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 129
#define ENOTEMPTY 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 dormdir(const char *name) {
  if (rmdir(name) < 0) {
    switch (errno) {
    case ENOENT:
    case ENOTEMPTY:
      break;
    default:
      say("pid %d: rmdir %s: %s\n", getpid(), name, strerror(errno));
      break;
    }
  }
}


x86 assembly (clang, -O0):
<dormdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <rmdir@plt>
cmp    $0x0,%rax
jge    11b8 <dormdir+0x78>
mov    0x2e7a(%rip),%rax
mov    (%rax),%eax
add    $0xffffff80,%eax
sub    $0x1,%eax
ja     117e <dormdir+0x3e>
jmp    1179 <dormdir+0x39>
jmp    11b3 <dormdir+0x73>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    %eax,%ecx
lea    0xe52(%rip),%rdi
call   1060 <say@plt>
jmp    11b8 <dormdir+0x78>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dormdir>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1040 <rmdir@plt>
test   %rax,%rax
jns    1165 <dormdir+0x25>
mov    0x2e88(%rip),%rbp
mov    0x0(%rbp),%eax
and    $0xfffffffe,%eax
cmp    $0x80,%eax
jne    116a <dormdir+0x2a>
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%r14d
mov    0x0(%rbp),%edi
call   1050 <strerror@plt>
lea    0xe7d(%rip),%rdi
mov    %r14d,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <say@plt>

LLVM IR (-O0):
@errno = global i32 0
@.str = [22 x i8] c"pid %d: rmdir %s: %s\0A\00"
define void @dormdir(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 129, label %8
i32 128, label %8
]
8: ; preds = %6, %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 ([22 x i8], [22 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 = [22 x i8] c"pid %d: rmdir %s: %s\0A\00"
define void @dormdir(i8* %0) {
%2 = tail call i64 @rmdir(i8* %0)
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = load i32, i32* @errno
%6 = and i32 %5, -2
%7 = icmp eq i32 %6, 128
br i1 %7, label %13, label %8
8: ; preds = %4
%9 = tail call i32 (...) @getpid()
%10 = load i32, i32* @errno
%11 = tail call i32 @strerror(i32 %10)
%12 = tail call i32 @say(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %9, i8* %0, i32 %11)
br label %13
13: ; preds = %4, %8, %1
ret void
}