#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__ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
long pathconf(char *, int);
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
char *strerror(scalar_t__);
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) {
      (void)fprintf(stderr, "pathconf error, path = %s : %s\n", path,
                    strerror(errno));
      exit(1);
    }
    fputs(" (no limit)\n", stdout);
  } else
    printf(" %ld\n", val);
}


x86 assembly (clang, -O0):
<pr_pathconf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e52(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
mov    0x2e4c(%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    121b <pr_pathconf+0xbb>
mov    0x2e24(%rip),%rax
cmpq   $0x0,(%rax)
je     1201 <pr_pathconf+0xa1>
mov    0x2e1b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    0x2dff(%rip),%rax
mov    (%rax),%rdi
call   1080 <strerror@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rdx
mov    %rax,%rcx
lea    0xe0e(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    0x2dc8(%rip),%rax
mov    (%rax),%esi
lea    0xe0f(%rip),%rdi
call   1050 <fputs@plt>
jmp    122b <pr_pathconf+0xcb>
mov    -0x20(%rbp),%rsi
lea    0xe07(%rip),%rdi
call   1040 <printf@plt>
add    $0x30,%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    0x2e5d(%rip),%r14
mov    (%r14),%esi
call   1050 <fputs@plt>
mov    0x2e56(%rip),%r15
movq   $0x0,(%r15)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <pathconf@plt>
test   %rax,%rax
js     11b1 <pr_pathconf+0x51>
lea    0xe8e(%rip),%rdi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>
mov    (%r15),%rdi
test   %rdi,%rdi
jne    11d2 <pr_pathconf+0x72>
mov    (%r14),%esi
lea    0xe5d(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fputs@plt>
mov    0x2e07(%rip),%rax
mov    (%rax),%ebp
call   1080 <strerror@plt>
lea    0xe19(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@errno = global i64 0
@stderr = global i32 0
@.str = [32 x i8] c"pathconf error, path = %s : %s\0A\00"
@.str.1 = [13 x i8] c" (no limit)\0A\00"
@.str.2 = [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 %28
15: ; preds = %3
%16 = load i64, i64* @errno
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %15
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %5
%21 = load i64, i64* @errno
%22 = call i8* @strerror(i64 %21)
%23 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %20, i8* %22)
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %15
%26 = load i32, i32* @stdout
%27 = call i32 @fputs(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %26)
br label %31
28: ; preds = %3
%29 = load i64, i64* %7
%30 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %29)
br label %31
31: ; preds = %28, %25
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@errno = global i64 0
@stderr = global i32 0
@.str = [32 x i8] c"pathconf error, path = %s : %s\0A\00"
@.str.1 = [13 x i8] c" (no limit)\0A\00"
@.str.2 = [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 %19
8: ; preds = %3
%9 = load i64, i64* @errno
%10 = icmp eq i64 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %8
%12 = load i32, i32* @stderr
%13 = tail call i8* @strerror(i64 %9)
%14 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %13)
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %8
%17 = load i32, i32* @stdout
%18 = tail call i32 @fputs(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %21
19: ; preds = %3
%20 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %6)
br label %21
21: ; preds = %19, %16
ret void
}