#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*/ EXIT_FAILURE;
scalar_t__ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
long pathconf(char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ stdout;
void pr_pathconf(char *msg, char *path, int name) {
  long val;
  fputs(msg, stdout);
  errno = 0;
  if ((val = pathconf(path, name)) < 0) {
    if (errno != 0) {
      perror("pathconf error");
      exit(EXIT_FAILURE);
    }
    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    0x2e62(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
mov    0x2e64(%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    11e2 <pr_pathconf+0x92>
mov    0x2e3c(%rip),%rax
cmpq   $0x0,(%rax)
je     11c8 <pr_pathconf+0x78>
lea    0xe4b(%rip),%rdi
call   1060 <perror@plt>
mov    0x2e17(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    0x2e01(%rip),%rax
mov    (%rax),%esi
lea    0xe37(%rip),%rdi
call   1050 <fputs@plt>
jmp    11f2 <pr_pathconf+0xa2>
mov    -0x20(%rbp),%rsi
lea    0xe2f(%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    0x2e6d(%rip),%r14
mov    (%r14),%esi
call   1050 <fputs@plt>
mov    0x2e6e(%rip),%r15
movq   $0x0,(%r15)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <pathconf@plt>
test   %rax,%rax
js     11a1 <pr_pathconf+0x51>
lea    0xe8d(%rip),%rdi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>
cmpq   $0x0,(%r15)
jne    11c0 <pr_pathconf+0x70>
mov    (%r14),%esi
lea    0xe5e(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fputs@plt>
lea    0xe39(%rip),%rdi
call   1060 <perror@plt>
mov    0x2e05(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

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

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