#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 */
scalar_t__ EACCES;
scalar_t__ EINVAL;
scalar_t__ EISDIR;
scalar_t__ ENOENT;
scalar_t__ ENOTDIR;
scalar_t__ ENOTEMPTY;
int /*<<< orphan*/ F_OK;
int access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ assert(int);
scalar_t__ errno;
int /*<<< orphan*/ puts(char *);
int rename(char *, char *);
void test() {
  int err;
  err = rename("noexist", "dir");
  assert(err == -1);
  assert(errno == ENOENT);
  err = rename("file", "dir");
  assert(err == -1);
  assert(errno == EISDIR);
  err = rename("dir", "file");
  assert(err == -1);
  assert(errno == ENOTDIR);
  err = rename("dir", "dir-nonempty");
  assert(err == -1);
  assert(errno == ENOTEMPTY);
  err = rename("dir", "dir-readonly/dir");
  assert(err == -1);
  assert(errno == EACCES);
  err = rename("dir", "dir/somename");
  assert(err == -1);
  assert(errno == EINVAL);
  err = rename("dir/subdir", "dir");
  assert(err == -1);
  assert(errno == ENOTEMPTY);
  err = rename("dir/file", "dir/file1");
  assert(!err);
  err = rename("dir/file1", "dir/file2");
  assert(!err);
  err = access("dir/file2", F_OK);
  assert(!err);
  err = rename("dir/subdir", "dir/subdir1");
  assert(!err);
  err = rename("dir/subdir1", "dir/subdir2");
  assert(!err);
  err = access("dir/subdir2", F_OK);
  assert(!err);
  err = rename("dir/subdir2", "dir/subdir3/subdir3_1/subdir1 renamed");
  assert(!err);
  err = access("dir/subdir3/subdir3_1/subdir1 renamed", F_OK);
  assert(!err);
  puts("success");
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
lea    0xecc(%rip),%rsi
call   1060 <rename@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0x2e52(%rip),%rax
mov    (%rax),%rax
mov    0x2e30(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xeab(%rip),%rdi
lea    0xe84(%rip),%rsi
call   1060 <rename@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0x2e0a(%rip),%rax
mov    (%rax),%rax
mov    0x2e18(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe43(%rip),%rdi
lea    0xe5c(%rip),%rsi
call   1060 <rename@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0x2dc2(%rip),%rax
mov    (%rax),%rax
mov    0x2de8(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xdfb(%rip),%rdi
lea    0xdda(%rip),%rsi
call   1060 <rename@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0x2d7a(%rip),%rax
mov    (%rax),%rax
mov    0x2d50(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xdb3(%rip),%rdi
lea    0xd9f(%rip),%rsi
call   1060 <rename@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0x2d32(%rip),%rax
mov    (%rax),%rax
mov    0x2d38(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xd6b(%rip),%rdi
lea    0xd68(%rip),%rsi
call   1060 <rename@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0x2cea(%rip),%rax
mov    (%rax),%rax
mov    0x2cd8(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xd34(%rip),%rdi
lea    0xd1c(%rip),%rsi
call   1060 <rename@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0x2ca2(%rip),%rax
mov    (%rax),%rax
mov    0x2c78(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xcf7(%rip),%rdi
lea    0xcf9(%rip),%rsi
call   1060 <rename@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xcd7(%rip),%rdi
lea    0xcda(%rip),%rsi
call   1060 <rename@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0x2c07(%rip),%rax
mov    (%rax),%esi
lea    0xcaf(%rip),%rdi
call   1050 <access@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xc6f(%rip),%rdi
lea    0xc90(%rip),%rsi
call   1060 <rename@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xc6e(%rip),%rdi
lea    0xc73(%rip),%rsi
call   1060 <rename@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0x2b8a(%rip),%rax
mov    (%rax),%esi
lea    0xc48(%rip),%rdi
call   1050 <access@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xc26(%rip),%rdi
lea    0xc2b(%rip),%rsi
call   1060 <rename@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0x2b36(%rip),%rax
mov    (%rax),%esi
lea    0xc00(%rip),%rdi
call   1050 <access@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xc04(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xeb1(%rip),%rdi
lea    0xecc(%rip),%r15
mov    %r15,%rsi
call   1060 <rename@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1040 <assert@plt>
mov    0x2e55(%rip),%r12
mov    (%r12),%rax
mov    0x2e32(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%rax
sete   %dil
call   1040 <assert@plt>
lea    0xeaf(%rip),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <rename@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1040 <assert@plt>
mov    (%r12),%rax
mov    0x2e29(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%rax
sete   %dil
call   1040 <assert@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <rename@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1040 <assert@plt>
mov    (%r12),%rax
mov    0x2e0f(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%rax
sete   %dil
call   1040 <assert@plt>
lea    0xe0a(%rip),%rsi
mov    %r15,%rdi
call   1060 <rename@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1040 <assert@plt>
mov    (%r12),%rax
mov    0x2d89(%rip),%rbx
xor    %edi,%edi
cmp    (%rbx),%rax
sete   %dil
call   1040 <assert@plt>
lea    0xde1(%rip),%rsi
mov    %r15,%rdi
call   1060 <rename@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1040 <assert@plt>
mov    (%r12),%rax
mov    0x2d83(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%rax
sete   %dil
call   1040 <assert@plt>
lea    0xdbc(%rip),%rsi
mov    %r15,%rdi
call   1060 <rename@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1040 <assert@plt>
mov    (%r12),%rax
mov    0x2d35(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%rax
sete   %dil
call   1040 <assert@plt>
lea    0xd93(%rip),%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <rename@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1040 <assert@plt>
mov    (%r12),%rax
xor    %edi,%edi
cmp    (%rbx),%rax
sete   %dil
call   1040 <assert@plt>
lea    0xd6c(%rip),%rdi
lea    0xd6e(%rip),%rbx
mov    %rbx,%rsi
call   1060 <rename@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xd5c(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <rename@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    0x2c8c(%rip),%r12
mov    (%r12),%esi
mov    %r15,%rdi
call   1050 <access@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xd27(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <rename@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xd14(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <rename@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    (%r12),%esi
mov    %r14,%rdi
call   1050 <access@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xce8(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <rename@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    (%r12),%esi
mov    %rbx,%rdi
call   1050 <access@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xcd6(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"noexist\00"
@.str.1 = [4 x i8] c"dir\00"
@errno = global i64 0
@ENOENT = global i64 0
@.str.2 = [5 x i8] c"file\00"
@EISDIR = global i64 0
@ENOTDIR = global i64 0
@.str.3 = [13 x i8] c"dir-nonempty\00"
@ENOTEMPTY = global i64 0
@.str.4 = [17 x i8] c"dir-readonly/dir\00"
@EACCES = global i64 0
@.str.5 = [13 x i8] c"dir/somename\00"
@EINVAL = global i64 0
@.str.6 = [11 x i8] c"dir/subdir\00"
@.str.7 = [9 x i8] c"dir/file\00"
@.str.8 = [10 x i8] c"dir/file1\00"
@.str.9 = [10 x i8] c"dir/file2\00"
@F_OK = global i32 0
@.str.10 = [12 x i8] c"dir/subdir1\00"
@.str.11 = [12 x i8] c"dir/subdir2\00"
@.str.12 = [38 x i8] c"dir/subdir3/subdir3_1/subdir1 renamed\00"
@.str.13 = [8 x i8] c"success\00"
define void @test() {
%1 = alloca i32
%2 = call i32 @rename(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, -1
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load i64, i64* @errno
%8 = load i64, i64* @ENOENT
%9 = icmp eq i64 %7, %8
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = call i32 @rename(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32 %12, i32* %1
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, -1
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load i64, i64* @errno
%18 = load i64, i64* @EISDIR
%19 = icmp eq i64 %17, %18
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = call i32 @rename(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i32 %22, i32* %1
%23 = load i32, i32* %1
%24 = icmp eq i32 %23, -1
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = load i64, i64* @errno
%28 = load i64, i64* @ENOTDIR
%29 = icmp eq i64 %27, %28
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = call i32 @rename(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
store i32 %32, i32* %1
%33 = load i32, i32* %1
%34 = icmp eq i32 %33, -1
%35 = zext i1 %34 to i32
%36 = call i32 @assert(i32 %35)
%37 = load i64, i64* @errno
%38 = load i64, i64* @ENOTEMPTY
%39 = icmp eq i64 %37, %38
%40 = zext i1 %39 to i32
%41 = call i32 @assert(i32 %40)
%42 = call i32 @rename(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
store i32 %42, i32* %1
%43 = load i32, i32* %1
%44 = icmp eq i32 %43, -1
%45 = zext i1 %44 to i32
%46 = call i32 @assert(i32 %45)
%47 = load i64, i64* @errno
%48 = load i64, i64* @EACCES
%49 = icmp eq i64 %47, %48
%50 = zext i1 %49 to i32
%51 = call i32 @assert(i32 %50)
%52 = call i32 @rename(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
store i32 %52, i32* %1
%53 = load i32, i32* %1
%54 = icmp eq i32 %53, -1
%55 = zext i1 %54 to i32
%56 = call i32 @assert(i32 %55)
%57 = load i64, i64* @errno
%58 = load i64, i64* @EINVAL
%59 = icmp eq i64 %57, %58
%60 = zext i1 %59 to i32
%61 = call i32 @assert(i32 %60)
%62 = call i32 @rename(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32 %62, i32* %1
%63 = load i32, i32* %1
%64 = icmp eq i32 %63, -1
%65 = zext i1 %64 to i32
%66 = call i32 @assert(i32 %65)
%67 = load i64, i64* @errno
%68 = load i64, i64* @ENOTEMPTY
%69 = icmp eq i64 %67, %68
%70 = zext i1 %69 to i32
%71 = call i32 @assert(i32 %70)
%72 = call i32 @rename(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
store i32 %72, i32* %1
%73 = load i32, i32* %1
%74 = icmp ne i32 %73, 0
%75 = xor i1 %74, true
%76 = zext i1 %75 to i32
%77 = call i32 @assert(i32 %76)
%78 = call i32 @rename(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
store i32 %78, i32* %1
%79 = load i32, i32* %1
%80 = icmp ne i32 %79, 0
%81 = xor i1 %80, true
%82 = zext i1 %81 to i32
%83 = call i32 @assert(i32 %82)
%84 = load i32, i32* @F_OK
%85 = call i32 @access(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 %84)
store i32 %85, i32* %1
%86 = load i32, i32* %1
%87 = icmp ne i32 %86, 0
%88 = xor i1 %87, true
%89 = zext i1 %88 to i32
%90 = call i32 @assert(i32 %89)
%91 = call i32 @rename(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
store i32 %91, i32* %1
%92 = load i32, i32* %1
%93 = icmp ne i32 %92, 0
%94 = xor i1 %93, true
%95 = zext i1 %94 to i32
%96 = call i32 @assert(i32 %95)
%97 = call i32 @rename(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0))
store i32 %97, i32* %1
%98 = load i32, i32* %1
%99 = icmp ne i32 %98, 0
%100 = xor i1 %99, true
%101 = zext i1 %100 to i32
%102 = call i32 @assert(i32 %101)
%103 = load i32, i32* @F_OK
%104 = call i32 @access(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i32 %103)
store i32 %104, i32* %1
%105 = load i32, i32* %1
%106 = icmp ne i32 %105, 0
%107 = xor i1 %106, true
%108 = zext i1 %107 to i32
%109 = call i32 @assert(i32 %108)
%110 = call i32 @rename(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0))
store i32 %110, i32* %1
%111 = load i32, i32* %1
%112 = icmp ne i32 %111, 0
%113 = xor i1 %112, true
%114 = zext i1 %113 to i32
%115 = call i32 @assert(i32 %114)
%116 = load i32, i32* @F_OK
%117 = call i32 @access(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), i32 %116)
store i32 %117, i32* %1
%118 = load i32, i32* %1
%119 = icmp ne i32 %118, 0
%120 = xor i1 %119, true
%121 = zext i1 %120 to i32
%122 = call i32 @assert(i32 %121)
%123 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"noexist\00"
@.str.1 = [4 x i8] c"dir\00"
@errno = global i64 0
@ENOENT = global i64 0
@.str.2 = [5 x i8] c"file\00"
@EISDIR = global i64 0
@ENOTDIR = global i64 0
@.str.3 = [13 x i8] c"dir-nonempty\00"
@ENOTEMPTY = global i64 0
@.str.4 = [17 x i8] c"dir-readonly/dir\00"
@EACCES = global i64 0
@.str.5 = [13 x i8] c"dir/somename\00"
@EINVAL = global i64 0
@.str.6 = [11 x i8] c"dir/subdir\00"
@.str.7 = [9 x i8] c"dir/file\00"
@.str.8 = [10 x i8] c"dir/file1\00"
@.str.9 = [10 x i8] c"dir/file2\00"
@F_OK = global i32 0
@.str.10 = [12 x i8] c"dir/subdir1\00"
@.str.11 = [12 x i8] c"dir/subdir2\00"
@.str.12 = [38 x i8] c"dir/subdir3/subdir3_1/subdir1 renamed\00"
@.str.13 = [8 x i8] c"success\00"
define void @test() {
%1 = tail call i32 @rename(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32 %1, -1
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = load i64, i64* @errno
%6 = load i64, i64* @ENOENT
%7 = icmp eq i64 %5, %6
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = tail call i32 @rename(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32 %10, -1
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = load i64, i64* @errno
%15 = load i64, i64* @EISDIR
%16 = icmp eq i64 %14, %15
%17 = zext i1 %16 to i32
%18 = tail call i32 @assert(i32 %17)
%19 = tail call i32 @rename(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i32 %19, -1
%21 = zext i1 %20 to i32
%22 = tail call i32 @assert(i32 %21)
%23 = load i64, i64* @errno
%24 = load i64, i64* @ENOTDIR
%25 = icmp eq i64 %23, %24
%26 = zext i1 %25 to i32
%27 = tail call i32 @assert(i32 %26)
%28 = tail call i32 @rename(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%29 = icmp eq i32 %28, -1
%30 = zext i1 %29 to i32
%31 = tail call i32 @assert(i32 %30)
%32 = load i64, i64* @errno
%33 = load i64, i64* @ENOTEMPTY
%34 = icmp eq i64 %32, %33
%35 = zext i1 %34 to i32
%36 = tail call i32 @assert(i32 %35)
%37 = tail call i32 @rename(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%38 = icmp eq i32 %37, -1
%39 = zext i1 %38 to i32
%40 = tail call i32 @assert(i32 %39)
%41 = load i64, i64* @errno
%42 = load i64, i64* @EACCES
%43 = icmp eq i64 %41, %42
%44 = zext i1 %43 to i32
%45 = tail call i32 @assert(i32 %44)
%46 = tail call i32 @rename(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%47 = icmp eq i32 %46, -1
%48 = zext i1 %47 to i32
%49 = tail call i32 @assert(i32 %48)
%50 = load i64, i64* @errno
%51 = load i64, i64* @EINVAL
%52 = icmp eq i64 %50, %51
%53 = zext i1 %52 to i32
%54 = tail call i32 @assert(i32 %53)
%55 = tail call i32 @rename(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%56 = icmp eq i32 %55, -1
%57 = zext i1 %56 to i32
%58 = tail call i32 @assert(i32 %57)
%59 = load i64, i64* @errno
%60 = load i64, i64* @ENOTEMPTY
%61 = icmp eq i64 %59, %60
%62 = zext i1 %61 to i32
%63 = tail call i32 @assert(i32 %62)
%64 = tail call i32 @rename(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%65 = icmp eq i32 %64, 0
%66 = zext i1 %65 to i32
%67 = tail call i32 @assert(i32 %66)
%68 = tail call i32 @rename(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
%69 = icmp eq i32 %68, 0
%70 = zext i1 %69 to i32
%71 = tail call i32 @assert(i32 %70)
%72 = load i32, i32* @F_OK
%73 = tail call i32 @access(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 %72)
%74 = icmp eq i32 %73, 0
%75 = zext i1 %74 to i32
%76 = tail call i32 @assert(i32 %75)
%77 = tail call i32 @rename(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%78 = icmp eq i32 %77, 0
%79 = zext i1 %78 to i32
%80 = tail call i32 @assert(i32 %79)
%81 = tail call i32 @rename(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0))
%82 = icmp eq i32 %81, 0
%83 = zext i1 %82 to i32
%84 = tail call i32 @assert(i32 %83)
%85 = load i32, i32* @F_OK
%86 = tail call i32 @access(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i32 %85)
%87 = icmp eq i32 %86, 0
%88 = zext i1 %87 to i32
%89 = tail call i32 @assert(i32 %88)
%90 = tail call i32 @rename(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0))
%91 = icmp eq i32 %90, 0
%92 = zext i1 %91 to i32
%93 = tail call i32 @assert(i32 %92)
%94 = load i32, i32* @F_OK
%95 = tail call i32 @access(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), i32 %94)
%96 = icmp eq i32 %95, 0
%97 = zext i1 %96 to i32
%98 = tail call i32 @assert(i32 %97)
%99 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
ret void
}