#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*/ chmod(char *, int);
int /*<<< orphan*/ rmdir(char *);
int /*<<< orphan*/ unlink(char *);
void cleanup() {
  unlink("file");
  unlink("file1");
  unlink("file1-link");
  rmdir("dir-empty");
  unlink("dir-empty-link");
  chmod("dir-readonly", 0777);
  unlink("dir-readonly/anotherfile");
  rmdir("dir-readonly/anotherdir");
  rmdir("dir-readonly");
  unlink("dir-full/anotherfile");
  rmdir("dir-full");
}


x86 assembly (clang, -O0):
<cleanup>:
push   %rbp
mov    %rsp,%rbp
lea    0xf3d(%rip),%rdi
call   1030 <unlink@plt>
lea    0xeb9(%rip),%rdi
call   1030 <unlink@plt>
lea    0xeb3(%rip),%rdi
call   1030 <unlink@plt>
lea    0xeb2(%rip),%rdi
call   1040 <rmdir@plt>
lea    0xeb0(%rip),%rdi
call   1030 <unlink@plt>
lea    0xeb3(%rip),%rdi
mov    $0x1ff,%esi
call   1050 <chmod@plt>
lea    0xeaf(%rip),%rdi
call   1030 <unlink@plt>
lea    0xebc(%rip),%rdi
call   1040 <rmdir@plt>
lea    0xe8a(%rip),%rdi
call   1040 <rmdir@plt>
lea    0xebc(%rip),%rdi
call   1030 <unlink@plt>
lea    0xec5(%rip),%rdi
call   1040 <rmdir@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanup>:
push   %rbx
lea    0xf40(%rip),%rdi
call   1030 <unlink@plt>
lea    0xebc(%rip),%rdi
call   1030 <unlink@plt>
lea    0xeb6(%rip),%rdi
call   1030 <unlink@plt>
lea    0xeb5(%rip),%rdi
call   1040 <rmdir@plt>
lea    0xeb3(%rip),%rdi
call   1030 <unlink@plt>
lea    0xeb6(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1ff,%esi
call   1050 <chmod@plt>
lea    0xeaf(%rip),%rdi
call   1030 <unlink@plt>
lea    0xebc(%rip),%rdi
call   1040 <rmdir@plt>
mov    %rbx,%rdi
call   1040 <rmdir@plt>
lea    0xec0(%rip),%rdi
call   1030 <unlink@plt>
lea    0xec9(%rip),%rdi
pop    %rbx
jmp    1040 <rmdir@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"file\00"
@.str.1 = [6 x i8] c"file1\00"
@.str.2 = [11 x i8] c"file1-link\00"
@.str.3 = [10 x i8] c"dir-empty\00"
@.str.4 = [15 x i8] c"dir-empty-link\00"
@.str.5 = [13 x i8] c"dir-readonly\00"
@.str.6 = [25 x i8] c"dir-readonly/anotherfile\00"
@.str.7 = [24 x i8] c"dir-readonly/anotherdir\00"
@.str.8 = [21 x i8] c"dir-full/anotherfile\00"
@.str.9 = [9 x i8] c"dir-full\00"
define void @cleanup() {
%1 = call i32 @unlink(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @unlink(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @rmdir(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @unlink(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%6 = call i32 @chmod(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 511)
%7 = call i32 @unlink(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
%8 = call i32 @rmdir(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%9 = call i32 @rmdir(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @unlink(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%11 = call i32 @rmdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"file\00"
@.str.1 = [6 x i8] c"file1\00"
@.str.2 = [11 x i8] c"file1-link\00"
@.str.3 = [10 x i8] c"dir-empty\00"
@.str.4 = [15 x i8] c"dir-empty-link\00"
@.str.5 = [13 x i8] c"dir-readonly\00"
@.str.6 = [25 x i8] c"dir-readonly/anotherfile\00"
@.str.7 = [24 x i8] c"dir-readonly/anotherdir\00"
@.str.8 = [21 x i8] c"dir-full/anotherfile\00"
@.str.9 = [9 x i8] c"dir-full\00"
define void @cleanup() {
%1 = tail call i32 @unlink(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @unlink(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @rmdir(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @unlink(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%6 = tail call i32 @chmod(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 511)
%7 = tail call i32 @unlink(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
%8 = tail call i32 @rmdir(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%9 = tail call i32 @rmdir(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%10 = tail call i32 @unlink(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%11 = tail call i32 @rmdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
ret void
}