#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__ EINVAL;
int /*<<< orphan*/ err_sys(char *, char *);
scalar_t__ errno;
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
long pathconf(char *, int);
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ stdout;
void pr_pathconf(char *mesg, char *path, int name) {
  long val;
  fputs(mesg, stdout);
  errno = 0;
  if ((val = pathconf(path, name)) < 0) {
    if (errno != 0) {
      if (errno == EINVAL) {
        fputs(" (not supported)\n", stdout);
      } else {
        err_sys("pathconf error, path = %s", path);
      }
    } else {
      fputs(" (no limit)\n", stdout);
    }
  } else {
    printf(" %ld\n", val);
  }
}


x86 assembly (clang, -O0):
<pr_pathconf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e72(%rip),%rax
mov    (%rax),%esi
call   1060 <fputs@plt>
mov    0x2e74(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <pathconf@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jge    1201 <pr_pathconf+0xc1>
mov    0x2e4c(%rip),%rax
cmpq   $0x0,(%rax)
je     11e7 <pr_pathconf+0xa7>
mov    0x2e3b(%rip),%rax
mov    (%rax),%rax
mov    0x2e29(%rip),%rcx
cmp    (%rcx),%rax
jne    11d2 <pr_pathconf+0x92>
mov    0x2e11(%rip),%rax
mov    (%rax),%esi
lea    0xe38(%rip),%rdi
call   1060 <fputs@plt>
jmp    11e2 <pr_pathconf+0xa2>
mov    -0x10(%rbp),%rsi
lea    0xe35(%rip),%rdi
call   1030 <err_sys@plt>
jmp    11fc <pr_pathconf+0xbc>
mov    0x2de2(%rip),%rax
mov    (%rax),%esi
lea    0xe35(%rip),%rdi
call   1060 <fputs@plt>
jmp    1211 <pr_pathconf+0xd1>
mov    -0x20(%rbp),%rsi
lea    0xe2d(%rip),%rdi
call   1050 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_pathconf>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
mov    0x2e7d(%rip),%r14
mov    (%r14),%esi
call   1060 <fputs@plt>
mov    0x2e7e(%rip),%r15
movq   $0x0,(%r15)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <pathconf@plt>
test   %rax,%rax
js     1191 <pr_pathconf+0x51>
lea    0xeba(%rip),%rdi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <printf@plt>
mov    (%r15),%rax
test   %rax,%rax
je     11b1 <pr_pathconf+0x71>
mov    0x2e38(%rip),%rcx
cmp    (%rcx),%rax
jne    11ca <pr_pathconf+0x8a>
mov    (%r14),%esi
lea    0xe51(%rip),%rdi
jmp    11bb <pr_pathconf+0x7b>
mov    (%r14),%esi
lea    0xe71(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <fputs@plt>
lea    0xe41(%rip),%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <err_sys@plt>

LLVM IR (-O0):
@stdout = global i32 0
@errno = global i64 0
@EINVAL = global i64 0
@.str = [18 x i8] c" (not supported)\0A\00"
@.str.1 = [26 x i8] c"pathconf error, path = %s\00"
@.str.2 = [13 x i8] c" (no limit)\0A\00"
@.str.3 = [6 x i8] c" %ld\0A\00"
define void @pr_pathconf(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* @stdout
%10 = call i32 @fputs(i8* %8, i32 %9)
store i64 0, i64* @errno
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = call i64 @pathconf(i8* %11, i32 %12)
store i64 %13, i64* %7
%14 = icmp slt i64 %13, 0
br i1 %14, label %15, label %33
15: ; preds = %3
%16 = load i64, i64* @errno
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %29
18: ; preds = %15
%19 = load i64, i64* @errno
%20 = load i64, i64* @EINVAL
%21 = icmp eq i64 %19, %20
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = load i32, i32* @stdout
%24 = call i32 @fputs(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %23)
br label %28
25: ; preds = %18
%26 = load i8*, i8** %5
%27 = call i32 @err_sys(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %26)
br label %28
28: ; preds = %25, %22
br label %32
29: ; preds = %15
%30 = load i32, i32* @stdout
%31 = call i32 @fputs(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %29, %28
br label %36
33: ; preds = %3
%34 = load i64, i64* %7
%35 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i64 %34)
br label %36
36: ; preds = %33, %32
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@errno = global i64 0
@EINVAL = global i64 0
@.str = [18 x i8] c" (not supported)\0A\00"
@.str.1 = [26 x i8] c"pathconf error, path = %s\00"
@.str.2 = [13 x i8] c" (no limit)\0A\00"
@.str.3 = [6 x i8] c" %ld\0A\00"
define void @pr_pathconf(i8* %0, i8* %1, i32 %2) {
%4 = load i32, i32* @stdout
%5 = tail call i32 @fputs(i8* %0, i32 %4)
store i64 0, i64* @errno
%6 = tail call i64 @pathconf(i8* %1, i32 %2)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %22
8: ; preds = %3
%9 = load i64, i64* @errno
%10 = icmp eq i64 %9, 0
br i1 %10, label %19, label %11
11: ; preds = %8
%12 = load i64, i64* @EINVAL
%13 = icmp eq i64 %9, %12
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i32, i32* @stdout
%16 = tail call i32 @fputs(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %24
17: ; preds = %11
%18 = tail call i32 @err_sys(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %24
19: ; preds = %8
%20 = load i32, i32* @stdout
%21 = tail call i32 @fputs(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %20)
br label %24
22: ; preds = %3
%23 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i64 %6)
br label %24
24: ; preds = %19, %17, %14, %22
ret void
}