#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*/ rmdir(char *);
int /*<<< orphan*/ unlink(char *);
void cleanup() {
  unlink("file");
  unlink("dir/file");
  unlink("dir/file1");
  unlink("dir/file2");
  rmdir("dir/subdir");
  rmdir("dir/subdir1");
  rmdir("dir/subdir2");
  rmdir("dir");
  rmdir("dir-readonly");
  unlink("dir-nonempty/file");
  rmdir("dir-nonempty");
}


x86 assembly (clang, -O0):
<cleanup>:
push   %rbp
mov    %rsp,%rbp
lea    0xed9(%rip),%rdi
call   1030 <unlink@plt>
lea    0xec9(%rip),%rdi
call   1030 <unlink@plt>
lea    0xec6(%rip),%rdi
call   1030 <unlink@plt>
lea    0xec4(%rip),%rdi
call   1030 <unlink@plt>
lea    0xec2(%rip),%rdi
call   1040 <rmdir@plt>
lea    0xec1(%rip),%rdi
call   1040 <rmdir@plt>
lea    0xec1(%rip),%rdi
call   1040 <rmdir@plt>
lea    0xea5(%rip),%rdi
call   1040 <rmdir@plt>
lea    0xeb5(%rip),%rdi
call   1040 <rmdir@plt>
lea    0xeb6(%rip),%rdi
call   1030 <unlink@plt>
lea    0xebc(%rip),%rdi
call   1040 <rmdir@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanup>:
push   %rax
lea    0xedc(%rip),%rdi
call   1030 <unlink@plt>
lea    0xecc(%rip),%rdi
call   1030 <unlink@plt>
lea    0xec9(%rip),%rdi
call   1030 <unlink@plt>
lea    0xec7(%rip),%rdi
call   1030 <unlink@plt>
lea    0xec5(%rip),%rdi
call   1040 <rmdir@plt>
lea    0xec4(%rip),%rdi
call   1040 <rmdir@plt>
lea    0xec4(%rip),%rdi
call   1040 <rmdir@plt>
lea    0xea8(%rip),%rdi
call   1040 <rmdir@plt>
lea    0xeb8(%rip),%rdi
call   1040 <rmdir@plt>
lea    0xeb9(%rip),%rdi
call   1030 <unlink@plt>
lea    0xebf(%rip),%rdi
pop    %rax
jmp    1040 <rmdir@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"file\00"
@.str.1 = [9 x i8] c"dir/file\00"
@.str.2 = [10 x i8] c"dir/file1\00"
@.str.3 = [10 x i8] c"dir/file2\00"
@.str.4 = [11 x i8] c"dir/subdir\00"
@.str.5 = [12 x i8] c"dir/subdir1\00"
@.str.6 = [12 x i8] c"dir/subdir2\00"
@.str.7 = [4 x i8] c"dir\00"
@.str.8 = [13 x i8] c"dir-readonly\00"
@.str.9 = [18 x i8] c"dir-nonempty/file\00"
@.str.10 = [13 x i8] c"dir-nonempty\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 ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @unlink(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @unlink(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @rmdir(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%6 = call i32 @rmdir(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%7 = call i32 @rmdir(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%8 = call i32 @rmdir(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%9 = call i32 @rmdir(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%10 = call i32 @unlink(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0))
%11 = call i32 @rmdir(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"file\00"
@.str.1 = [9 x i8] c"dir/file\00"
@.str.2 = [10 x i8] c"dir/file1\00"
@.str.3 = [10 x i8] c"dir/file2\00"
@.str.4 = [11 x i8] c"dir/subdir\00"
@.str.5 = [12 x i8] c"dir/subdir1\00"
@.str.6 = [12 x i8] c"dir/subdir2\00"
@.str.7 = [4 x i8] c"dir\00"
@.str.8 = [13 x i8] c"dir-readonly\00"
@.str.9 = [18 x i8] c"dir-nonempty/file\00"
@.str.10 = [13 x i8] c"dir-nonempty\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 ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @unlink(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @unlink(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @rmdir(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%6 = tail call i32 @rmdir(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%7 = tail call i32 @rmdir(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%8 = tail call i32 @rmdir(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%9 = tail call i32 @rmdir(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%10 = tail call i32 @unlink(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0))
%11 = tail call i32 @rmdir(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
ret void
}