#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;
long fpathconf(int, int);
int /*<<< orphan*/ pexit(char *);
int /*<<< orphan*/ printf(char *, char const *, ...);
void fpathconfPrint(const char *msg, int fd, int name) {
  long limit;
  errno = 0;
  limit = fpathconf(fd, name);
  if (limit == -1) {
    if (errno == 0) {
      printf("%s (indeterminate)\n", msg);
    } else {
      pexit("fpathconf");
    }
  } else {
    printf("%s %ld\n", msg, limit);
  }
}


x86 assembly (clang, -O0):
<fpathconfPrint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    0x2e97(%rip),%rax
movq   $0x0,(%rax)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <fpathconf@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0xffffffffffffffff,-0x18(%rbp)
jne    11a3 <fpathconfPrint+0x73>
mov    0x2e6f(%rip),%rax
cmpq   $0x0,(%rax)
jne    1192 <fpathconfPrint+0x62>
mov    -0x8(%rbp),%rsi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119e <fpathconfPrint+0x6e>
lea    0xe7b(%rip),%rdi
call   1050 <pexit@plt>
jmp    11b9 <fpathconfPrint+0x89>
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fpathconfPrint>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ea2(%rip),%r14
movq   $0x0,(%r14)
mov    %esi,%edi
mov    %edx,%esi
call   1040 <fpathconf@plt>
cmp    $0xffffffffffffffff,%rax
je     116f <fpathconfPrint+0x3f>
lea    0xec3(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>
cmpq   $0x0,(%r14)
je     1188 <fpathconfPrint+0x58>
lea    0xe98(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <pexit@plt>
lea    0xe71(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@errno = global i64 0
@.str = [20 x i8] c"%s (indeterminate)\0A\00"
@.str.1 = [10 x i8] c"fpathconf\00"
@.str.2 = [8 x i8] c"%s %ld\0A\00"
define void @fpathconfPrint(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i64 0, i64* @errno
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i64 @fpathconf(i32 %8, i32 %9)
store i64 %10, i64* %7
%11 = load i64, i64* %7
%12 = icmp eq i64 %11, -1
br i1 %12, label %13, label %22
13: ; preds = %3
%14 = load i64, i64* @errno
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i8*, i8** %4
%18 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %17)
br label %21
19: ; preds = %13
%20 = call i32 @pexit(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %19, %16
br label %26
22: ; preds = %3
%23 = load i8*, i8** %4
%24 = load i64, i64* %7
%25 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %23, i64 %24)
br label %26
26: ; preds = %22, %21
ret void
}

LLVM IR (-O2):
@errno = global i64 0
@.str = [20 x i8] c"%s (indeterminate)\0A\00"
@.str.1 = [10 x i8] c"fpathconf\00"
@.str.2 = [8 x i8] c"%s %ld\0A\00"
define void @fpathconfPrint(i8* %0, i32 %1, i32 %2) {
store i64 0, i64* @errno
%4 = tail call i64 @fpathconf(i32 %1, i32 %2)
%5 = icmp eq i64 %4, -1
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = load i64, i64* @errno
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %15
11: ; preds = %6
%12 = tail call i32 @pexit(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %15
13: ; preds = %3
%14 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %0, i64 %4)
br label %15
15: ; preds = %9, %11, %13
ret void
}