#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*/ printf(char *, ...);
scalar_t__ util_path_exists(char const *);
scalar_t__ util_path_is_dir(char const *);
scalar_t__ util_path_is_readable(char const *);
scalar_t__ util_path_is_readonly_file(char const *);
scalar_t__ util_path_is_reg_file(char const *);
scalar_t__ util_path_is_writable(char const *);
scalar_t__ util_path_is_writeonly_file(char const *);
void test_path(const char *path) {
  printf("%-20s: ", path);
  if (util_path_exists(path))
    printf("exists=yes ");
  else
    printf("exists=no  ");
  if (util_path_is_readable(path))
    printf("read=yes ");
  else
    printf("read=no  ");
  if (util_path_is_writable(path))
    printf("write=yes ");
  else
    printf("write=no  ");
  if (util_path_is_reg_file(path))
    printf("reg_file=yes ");
  else
    printf("reg_file=no  ");
  if (util_path_is_dir(path))
    printf("dir=yes ");
  else
    printf("dir=no  ");
  if (util_path_is_readonly_file(path))
    printf("read-only_file=yes ");
  else
    printf("read-only_file=no  ");
  if (util_path_is_writeonly_file(path))
    printf("write-only_file=yes");
  else
    printf("write-only_file=no ");
  printf("\n");
}


x86 assembly (clang, -O0):
<test_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   10a0 <util_path_exists@plt>
cmp    $0x0,%rax
je     11c4 <test_path+0x44>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11d2 <test_path+0x52>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <util_path_is_readable@plt>
cmp    $0x0,%rax
je     11f8 <test_path+0x78>
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1206 <test_path+0x86>
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1080 <util_path_is_writable@plt>
cmp    $0x0,%rax
je     122c <test_path+0xac>
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    123a <test_path+0xba>
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <util_path_is_reg_file@plt>
cmp    $0x0,%rax
je     1260 <test_path+0xe0>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    126e <test_path+0xee>
lea    0xdf1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1060 <util_path_is_dir@plt>
cmp    $0x0,%rax
je     1294 <test_path+0x114>
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12a2 <test_path+0x122>
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1090 <util_path_is_readonly_file@plt>
cmp    $0x0,%rax
je     12c8 <test_path+0x148>
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12d6 <test_path+0x156>
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1070 <util_path_is_writeonly_file@plt>
cmp    $0x0,%rax
je     12fc <test_path+0x17c>
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    130a <test_path+0x18a>
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_path>:
push   %rbx
mov    %rdi,%rbx
lea    0xe65(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   10b0 <util_path_exists@plt>
test   %rax,%rax
lea    0xe5d(%rip),%rax
lea    0xe4a(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1060 <util_path_is_readable@plt>
test   %rax,%rax
lea    0xe4f(%rip),%rax
lea    0xe3e(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1090 <util_path_is_writable@plt>
test   %rax,%rax
lea    0xe40(%rip),%rax
lea    0xe2e(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <util_path_is_reg_file@plt>
test   %rax,%rax
lea    0xe35(%rip),%rax
lea    0xe20(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1070 <util_path_is_dir@plt>
test   %rax,%rax
lea    0xe28(%rip),%rax
lea    0xe18(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   10a0 <util_path_is_readonly_file@plt>
test   %rax,%rax
lea    0xe21(%rip),%rax
lea    0xe06(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1080 <util_path_is_writeonly_file@plt>
test   %rax,%rax
lea    0xe25(%rip),%rax
lea    0xe0a(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"%-20s: \00"
@.str.1 = [12 x i8] c"exists=yes \00"
@.str.2 = [12 x i8] c"exists=no \00"
@.str.3 = [10 x i8] c"read=yes \00"
@.str.4 = [10 x i8] c"read=no \00"
@.str.5 = [11 x i8] c"write=yes \00"
@.str.6 = [11 x i8] c"write=no \00"
@.str.7 = [14 x i8] c"reg_file=yes \00"
@.str.8 = [14 x i8] c"reg_file=no \00"
@.str.9 = [9 x i8] c"dir=yes \00"
@.str.10 = [9 x i8] c"dir=no \00"
@.str.11 = [20 x i8] c"read-only_file=yes \00"
@.str.12 = [20 x i8] c"read-only_file=no \00"
@.str.13 = [20 x i8] c"write-only_file=yes\00"
@.str.14 = [20 x i8] c"write-only_file=no \00"
@.str.15 = [2 x i8] c"\0A\00"
define void @test_path(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i8*, i8** %2
%6 = call i64 @util_path_exists(i8* %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %12
10: ; preds = %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
%13 = load i8*, i8** %2
%14 = call i64 @util_path_is_readable(i8* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %20
18: ; preds = %12
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %20
20: ; preds = %18, %16
%21 = load i8*, i8** %2
%22 = call i64 @util_path_is_writable(i8* %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %28
26: ; preds = %20
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %28
28: ; preds = %26, %24
%29 = load i8*, i8** %2
%30 = call i64 @util_path_is_reg_file(i8* %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
br label %36
34: ; preds = %28
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
br label %36
36: ; preds = %34, %32
%37 = load i8*, i8** %2
%38 = call i64 @util_path_is_dir(i8* %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
br label %44
42: ; preds = %36
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0))
br label %44
44: ; preds = %42, %40
%45 = load i8*, i8** %2
%46 = call i64 @util_path_is_readonly_file(i8* %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
br label %52
50: ; preds = %44
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
br label %52
52: ; preds = %50, %48
%53 = load i8*, i8** %2
%54 = call i64 @util_path_is_writeonly_file(i8* %53)
%55 = icmp ne i64 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %52
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0))
br label %60
58: ; preds = %52
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0))
br label %60
60: ; preds = %58, %56
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%-20s: \00"
@.str.1 = [12 x i8] c"exists=yes \00"
@.str.2 = [12 x i8] c"exists=no \00"
@.str.3 = [10 x i8] c"read=yes \00"
@.str.4 = [10 x i8] c"read=no \00"
@.str.5 = [11 x i8] c"write=yes \00"
@.str.6 = [11 x i8] c"write=no \00"
@.str.7 = [14 x i8] c"reg_file=yes \00"
@.str.8 = [14 x i8] c"reg_file=no \00"
@.str.9 = [9 x i8] c"dir=yes \00"
@.str.10 = [9 x i8] c"dir=no \00"
@.str.11 = [20 x i8] c"read-only_file=yes \00"
@.str.12 = [20 x i8] c"read-only_file=no \00"
@.str.13 = [20 x i8] c"write-only_file=yes\00"
@.str.14 = [20 x i8] c"write-only_file=no \00"
define void @test_path(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i64 @util_path_exists(i8* %0)
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %5)
%7 = tail call i64 @util_path_is_readable(i8* %0)
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %9)
%11 = tail call i64 @util_path_is_writable(i8* %0)
%12 = icmp eq i64 %11, 0
%13 = select i1 %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %13)
%15 = tail call i64 @util_path_is_reg_file(i8* %0)
%16 = icmp eq i64 %15, 0
%17 = select i1 %16, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %17)
%19 = tail call i64 @util_path_is_dir(i8* %0)
%20 = icmp eq i64 %19, 0
%21 = select i1 %20, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %21)
%23 = tail call i64 @util_path_is_readonly_file(i8* %0)
%24 = icmp eq i64 %23, 0
%25 = select i1 %24, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %25)
%27 = tail call i64 @util_path_is_writeonly_file(i8* %0)
%28 = icmp eq i64 %27, 0
%29 = select i1 %28, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0)
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %29)
%31 = tail call i32 @putchar(i32 10)
ret void
}