#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*/ F_OK;
int access(char *, int /*<<< orphan*/);
int errno;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ rmdir(char *);
int /*<<< orphan*/ unlink(char *);
int main() {
  char *files[] = {"/device", "/file", "/file-forbidden", "/noexist"};
  char *folders[] = {"/empty", "/empty-forbidden", "/full"};
  int i;
  for (i = 0; i < sizeof files / sizeof files[0]; i++) {
    printf("access(%s) before: %d\n", files[i], access(files[i], F_OK));
    rmdir(files[i]);
    printf("errno: %d\n", errno);
    errno = 0;
    printf("access(%s) after rmdir: %d\n", files[i], access(files[i], F_OK));
    unlink(files[i]);
    printf("errno: %d\n", errno);
    errno = 0;
    printf("access(%s) after unlink: %d\n\n", files[i], access(files[i], F_OK));
  }
  for (i = 0; i < sizeof folders / sizeof folders[0]; i++) {
    printf("access(%s) before: %d\n", folders[i], access(folders[i], F_OK));
    unlink(folders[i]);
    printf("errno: %d\n", errno);
    errno = 0;
    printf("access(%s) after unlink: %d\n", folders[i],
           access(folders[i], F_OK));
    rmdir(folders[i]);
    printf("errno: %d\n", errno);
    errno = 0;
    printf("access(%s) after rmdir: %d\n\n", folders[i],
           access(folders[i], F_OK));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2c77(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2c74(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2c71(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2c6e(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2c6b(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0x2c68(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0x2c65(%rip),%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x54(%rbp)
movslq -0x54(%rbp),%rax
cmp    $0x4,%rax
jae    12ce <main+0x18e>
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rax
mov    %rax,-0x70(%rbp)
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
mov    0x2df7(%rip),%rax
mov    (%rax),%esi
call   1060 <access@plt>
mov    -0x70(%rbp),%rsi
mov    %eax,%edx
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
call   1040 <rmdir@plt>
mov    0x2dd7(%rip),%rax
mov    (%rax),%esi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2dc0(%rip),%rax
movl   $0x0,(%rax)
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rax
mov    %rax,-0x68(%rbp)
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
mov    0x2d8d(%rip),%rax
mov    (%rax),%esi
call   1060 <access@plt>
mov    -0x68(%rbp),%rsi
mov    %eax,%edx
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
call   1030 <unlink@plt>
mov    0x2d6d(%rip),%rax
mov    (%rax),%esi
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2d56(%rip),%rax
movl   $0x0,(%rax)
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rax
mov    %rax,-0x60(%rbp)
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
mov    0x2d23(%rip),%rax
mov    (%rax),%esi
call   1060 <access@plt>
mov    -0x60(%rbp),%rsi
mov    %eax,%edx
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11a6 <main+0x66>
movl   $0x0,-0x54(%rbp)
movslq -0x54(%rbp),%rax
cmp    $0x3,%rax
jae    1403 <main+0x2c3>
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
mov    %rax,-0x88(%rbp)
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rdi
mov    0x2cc5(%rip),%rax
mov    (%rax),%esi
call   1060 <access@plt>
mov    -0x88(%rbp),%rsi
mov    %eax,%edx
lea    0xd2b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rdi
call   1030 <unlink@plt>
mov    0x2ca2(%rip),%rax
mov    (%rax),%esi
lea    0xd1d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2c8b(%rip),%rax
movl   $0x0,(%rax)
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
mov    %rax,-0x80(%rbp)
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rdi
mov    0x2c58(%rip),%rax
mov    (%rax),%esi
call   1060 <access@plt>
mov    -0x80(%rbp),%rsi
mov    %eax,%edx
lea    0xd1d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rdi
call   1040 <rmdir@plt>
mov    0x2c38(%rip),%rax
mov    (%rax),%esi
lea    0xcb3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2c21(%rip),%rax
movl   $0x0,(%rax)
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
mov    %rax,-0x78(%rbp)
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rdi
mov    0x2bee(%rip),%rax
mov    (%rax),%esi
call   1060 <access@plt>
mov    -0x78(%rbp),%rsi
mov    %eax,%edx
lea    0xcd0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    12d5 <main+0x195>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e7e(%rip),%rbp
mov    0x0(%rbp),%esi
lea    0xea4(%rip),%rbx
mov    %rbx,%rdi
call   1060 <access@plt>
lea    0xeda(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <rmdir@plt>
mov    0x2e57(%rip),%r14
mov    (%r14),%esi
lea    0xec9(%rip),%r13
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x0,(%r14)
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1060 <access@plt>
lea    0xeb1(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
mov    (%r14),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x0,(%r14)
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1060 <access@plt>
lea    0xe93(%rip),%r12
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%rbp),%esi
lea    0xdff(%rip),%rbx
mov    %rbx,%rdi
call   1060 <access@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <rmdir@plt>
mov    (%r14),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x0,(%r14)
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1060 <access@plt>
lea    0xe19(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
mov    (%r14),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x0,(%r14)
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1060 <access@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%rbp),%esi
lea    0xd74(%rip),%rbx
mov    %rbx,%rdi
call   1060 <access@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <rmdir@plt>
mov    (%r14),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x0,(%r14)
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1060 <access@plt>
lea    0xd88(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
mov    (%r14),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x0,(%r14)
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1060 <access@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%rbp),%esi
lea    0xcf3(%rip),%rbx
mov    %rbx,%rdi
call   1060 <access@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <rmdir@plt>
mov    (%r14),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x0,(%r14)
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1060 <access@plt>
lea    0xcf7(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
mov    (%r14),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x0,(%r14)
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1060 <access@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%rbp),%esi
lea    0xc6b(%rip),%rbx
mov    %rbx,%rdi
call   1060 <access@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
mov    (%r14),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x0,(%r14)
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1060 <access@plt>
lea    0xca0(%rip),%r12
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <rmdir@plt>
mov    (%r14),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x0,(%r14)
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1060 <access@plt>
lea    0xc80(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%rbp),%esi
lea    0xbd7(%rip),%rbx
mov    %rbx,%rdi
call   1060 <access@plt>
lea    0xbdf(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
mov    (%r14),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x0,(%r14)
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1060 <access@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <rmdir@plt>
mov    (%r14),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x0,(%r14)
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1060 <access@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%rbp),%esi
lea    0xb57(%rip),%rbx
mov    %rbx,%rdi
call   1060 <access@plt>
lea    0xb4e(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
mov    (%r14),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x0,(%r14)
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1060 <access@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <rmdir@plt>
mov    (%r14),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x0,(%r14)
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1060 <access@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"/device\00"
@.str.1 = [6 x i8] c"/file\00"
@.str.2 = [16 x i8] c"/file-forbidden\00"
@.str.3 = [9 x i8] c"/noexist\00"
@__const.main.files = [4 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [7 x i8] c"/empty\00"
@.str.5 = [17 x i8] c"/empty-forbidden\00"
@.str.6 = [6 x i8] c"/full\00"
@__const.main.folders = [3 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i32 0, i32 0)]
@.str.7 = [23 x i8] c"access(%s) before: %d\0A\00"
@F_OK = global i32 0
@.str.8 = [11 x i8] c"errno: %d\0A\00"
@errno = global i32 0
@.str.9 = [28 x i8] c"access(%s) after rmdir: %d\0A\00"
@.str.10 = [30 x i8] c"access(%s) after unlink: %d\0A\0A\00"
@.str.11 = [29 x i8] c"access(%s) after unlink: %d\0A\00"
@.str.12 = [29 x i8] c"access(%s) after rmdir: %d\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8*]
%3 = alloca [3 x i8*]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [4 x i8*]* %2 to i8*
%6 = bitcast [3 x i8*]* %3 to i8*
store i32 0, i32* %4
br label %7
7: ; preds = %59, %0
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = icmp ult i64 %9, 4
br i1 %10, label %11, label %62
11: ; preds = %7
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 %13
%15 = load i8*, i8** %14
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 %17
%19 = load i8*, i8** %18
%20 = load i32, i32* @F_OK
%21 = call i32 @access(i8* %19, i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %15, i32 %21)
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 @rmdir(i8* %26)
%28 = load i32, i32* @errno
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %28)
store i32 0, i32* @errno
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 %31
%33 = load i8*, i8** %32
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 %35
%37 = load i8*, i8** %36
%38 = load i32, i32* @F_OK
%39 = call i32 @access(i8* %37, i32 %38)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i8* %33, i32 %39)
%41 = load i32, i32* %4
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 %42
%44 = load i8*, i8** %43
%45 = call i32 @unlink(i8* %44)
%46 = load i32, i32* @errno
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %46)
store i32 0, i32* @errno
%48 = load i32, i32* %4
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 %49
%51 = load i8*, i8** %50
%52 = load i32, i32* %4
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 %53
%55 = load i8*, i8** %54
%56 = load i32, i32* @F_OK
%57 = call i32 @access(i8* %55, i32 %56)
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i8* %51, i32 %57)
br label %59
59: ; preds = %11
%60 = load i32, i32* %4
%61 = add nsw i32 %60, 1
store i32 %61, i32* %4
br label %7
62: ; preds = %7
store i32 0, i32* %4
br label %63
63: ; preds = %115, %62
%64 = load i32, i32* %4
%65 = sext i32 %64 to i64
%66 = icmp ult i64 %65, 3
br i1 %66, label %67, label %118
67: ; preds = %63
%68 = load i32, i32* %4
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 %69
%71 = load i8*, i8** %70
%72 = load i32, i32* %4
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 %73
%75 = load i8*, i8** %74
%76 = load i32, i32* @F_OK
%77 = call i32 @access(i8* %75, i32 %76)
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %71, i32 %77)
%79 = load i32, i32* %4
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 %80
%82 = load i8*, i8** %81
%83 = call i32 @unlink(i8* %82)
%84 = load i32, i32* @errno
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %84)
store i32 0, i32* @errno
%86 = load i32, i32* %4
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 %87
%89 = load i8*, i8** %88
%90 = load i32, i32* %4
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 %91
%93 = load i8*, i8** %92
%94 = load i32, i32* @F_OK
%95 = call i32 @access(i8* %93, i32 %94)
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0), i8* %89, i32 %95)
%97 = load i32, i32* %4
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 %98
%100 = load i8*, i8** %99
%101 = call i32 @rmdir(i8* %100)
%102 = load i32, i32* @errno
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %102)
store i32 0, i32* @errno
%104 = load i32, i32* %4
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 %105
%107 = load i8*, i8** %106
%108 = load i32, i32* %4
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 %109
%111 = load i8*, i8** %110
%112 = load i32, i32* @F_OK
%113 = call i32 @access(i8* %111, i32 %112)
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i8* %107, i32 %113)
br label %115
115: ; preds = %67
%116 = load i32, i32* %4
%117 = add nsw i32 %116, 1
store i32 %117, i32* %4
br label %63
118: ; preds = %63
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"/device\00"
@.str.1 = [6 x i8] c"/file\00"
@.str.2 = [16 x i8] c"/file-forbidden\00"
@.str.3 = [9 x i8] c"/noexist\00"
@.str.4 = [7 x i8] c"/empty\00"
@.str.5 = [17 x i8] c"/empty-forbidden\00"
@.str.6 = [6 x i8] c"/full\00"
@.str.7 = [23 x i8] c"access(%s) before: %d\0A\00"
@F_OK = global i32 0
@.str.8 = [11 x i8] c"errno: %d\0A\00"
@errno = global i32 0
@.str.9 = [28 x i8] c"access(%s) after rmdir: %d\0A\00"
@.str.10 = [30 x i8] c"access(%s) after unlink: %d\0A\0A\00"
@.str.11 = [29 x i8] c"access(%s) after unlink: %d\0A\00"
@.str.12 = [29 x i8] c"access(%s) after rmdir: %d\0A\0A\00"
define i32 @main() {
%1 = load i32, i32* @F_OK
%2 = tail call i32 @access(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @rmdir(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @errno
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %5)
store i32 0, i32* @errno
%7 = load i32, i32* @F_OK
%8 = tail call i32 @access(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = tail call i32 @unlink(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @errno
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %11)
store i32 0, i32* @errno
%13 = load i32, i32* @F_OK
%14 = tail call i32 @access(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = load i32, i32* @F_OK
%17 = tail call i32 @access(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = tail call i32 @rmdir(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%20 = load i32, i32* @errno
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %20)
store i32 0, i32* @errno
%22 = load i32, i32* @F_OK
%23 = tail call i32 @access(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = tail call i32 @unlink(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%26 = load i32, i32* @errno
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %26)
store i32 0, i32* @errno
%28 = load i32, i32* @F_OK
%29 = tail call i32 @access(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = load i32, i32* @F_OK
%32 = tail call i32 @access(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %31)
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %32)
%34 = tail call i32 @rmdir(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%35 = load i32, i32* @errno
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %35)
store i32 0, i32* @errno
%37 = load i32, i32* @F_OK
%38 = tail call i32 @access(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %37)
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %38)
%40 = tail call i32 @unlink(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%41 = load i32, i32* @errno
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %41)
store i32 0, i32* @errno
%43 = load i32, i32* @F_OK
%44 = tail call i32 @access(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %43)
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %44)
%46 = load i32, i32* @F_OK
%47 = tail call i32 @access(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %46)
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %47)
%49 = tail call i32 @rmdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%50 = load i32, i32* @errno
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %50)
store i32 0, i32* @errno
%52 = load i32, i32* @F_OK
%53 = tail call i32 @access(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %52)
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %53)
%55 = tail call i32 @unlink(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%56 = load i32, i32* @errno
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %56)
store i32 0, i32* @errno
%58 = load i32, i32* @F_OK
%59 = tail call i32 @access(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %58)
%60 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %59)
%61 = load i32, i32* @F_OK
%62 = tail call i32 @access(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %61)
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %62)
%64 = tail call i32 @unlink(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%65 = load i32, i32* @errno
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %65)
store i32 0, i32* @errno
%67 = load i32, i32* @F_OK
%68 = tail call i32 @access(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %67)
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %68)
%70 = tail call i32 @rmdir(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%71 = load i32, i32* @errno
%72 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %71)
store i32 0, i32* @errno
%73 = load i32, i32* @F_OK
%74 = tail call i32 @access(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %73)
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %74)
%76 = load i32, i32* @F_OK
%77 = tail call i32 @access(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %76)
%78 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %77)
%79 = tail call i32 @unlink(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%80 = load i32, i32* @errno
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %80)
store i32 0, i32* @errno
%82 = load i32, i32* @F_OK
%83 = tail call i32 @access(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %82)
%84 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %83)
%85 = tail call i32 @rmdir(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%86 = load i32, i32* @errno
%87 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %86)
store i32 0, i32* @errno
%88 = load i32, i32* @F_OK
%89 = tail call i32 @access(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %88)
%90 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %89)
%91 = load i32, i32* @F_OK
%92 = tail call i32 @access(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 %91)
%93 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 %92)
%94 = tail call i32 @unlink(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%95 = load i32, i32* @errno
%96 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %95)
store i32 0, i32* @errno
%97 = load i32, i32* @F_OK
%98 = tail call i32 @access(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 %97)
%99 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 %98)
%100 = tail call i32 @rmdir(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%101 = load i32, i32* @errno
%102 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %101)
store i32 0, i32* @errno
%103 = load i32, i32* @F_OK
%104 = tail call i32 @access(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 %103)
%105 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 %104)
ret i32 0
}