#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;
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
long pathconf(char const *, int);
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void pr_pathconf(char *mesg, const 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 {
        fprintf(stderr, "pathconf error, path = %s\n", 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    0x2e6a(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
mov    0x2e6c(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <pathconf@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jge    120a <pr_pathconf+0xca>
mov    0x2e44(%rip),%rax
cmpq   $0x0,(%rax)
je     11f0 <pr_pathconf+0xb0>
mov    0x2e33(%rip),%rax
mov    (%rax),%rax
mov    0x2e21(%rip),%rcx
cmp    (%rcx),%rax
jne    11d2 <pr_pathconf+0x92>
mov    0x2e09(%rip),%rax
mov    (%rax),%esi
lea    0xe38(%rip),%rdi
call   1050 <fputs@plt>
jmp    11eb <pr_pathconf+0xab>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe2c(%rip),%rsi
call   1060 <fprintf@plt>
jmp    1205 <pr_pathconf+0xc5>
mov    0x2dd1(%rip),%rax
mov    (%rax),%esi
lea    0xe2d(%rip),%rdi
call   1050 <fputs@plt>
jmp    121a <pr_pathconf+0xda>
mov    -0x20(%rbp),%rsi
lea    0xe25(%rip),%rdi
call   1040 <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    0x2e75(%rip),%r14
mov    (%r14),%esi
call   1050 <fputs@plt>
mov    0x2e76(%rip),%r15
movq   $0x0,(%r15)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <pathconf@plt>
test   %rax,%rax
js     1191 <pr_pathconf+0x51>
lea    0xebb(%rip),%rdi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>
mov    (%r15),%rax
test   %rax,%rax
je     11b1 <pr_pathconf+0x71>
mov    0x2e30(%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    0xe72(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fputs@plt>
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
lea    0xe38(%rip),%rsi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <fprintf@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"
@stderr = global i32 0
@.str.1 = [27 x i8] c"pathconf error, path = %s\0A\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 %34
15: ; preds = %3
%16 = load i64, i64* @errno
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %30
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 %29
25: ; preds = %18
%26 = load i32, i32* @stderr
%27 = load i8*, i8** %5
%28 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %27)
br label %29
29: ; preds = %25, %22
br label %33
30: ; preds = %15
%31 = load i32, i32* @stdout
%32 = call i32 @fputs(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %30, %29
br label %37
34: ; preds = %3
%35 = load i64, i64* %7
%36 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i64 %35)
br label %37
37: ; preds = %34, %33
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"
@stderr = global i32 0
@.str.1 = [27 x i8] c"pathconf error, path = %s\0A\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 %23
8: ; preds = %3
%9 = load i64, i64* @errno
%10 = icmp eq i64 %9, 0
br i1 %10, label %20, 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 %25
17: ; preds = %11
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %25
20: ; preds = %8
%21 = load i32, i32* @stdout
%22 = tail call i32 @fputs(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %21)
br label %25
23: ; preds = %3
%24 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i64 %6)
br label %25
25: ; preds = %20, %17, %14, %23
ret void
}