#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*/ EINVAL;
int /*<<< orphan*/ ENOENT;
#define _PC_ALLOC_SIZE_MIN 147
#define _PC_ASYNC_IO 146
#define _PC_CHOWN_RESTRICTED 145
#define _PC_FILESIZEBITS 144
#define _PC_LINK_MAX 143
#define _PC_MAX_CANON 142
#define _PC_MAX_INPUT 141
#define _PC_NAME_MAX 140
#define _PC_NO_TRUNC 139
#define _PC_PATH_MAX 138
#define _PC_PIPE_BUF 137
#define _PC_PRIO_IO 136
#define _PC_REC_INCR_XFER_SIZE 135
#define _PC_REC_MAX_XFER_SIZE 134
#define _PC_REC_MIN_XFER_SIZE 133
#define _PC_REC_XFER_ALIGN 132
#define _PC_SOCK_MAXBUF 131
#define _PC_SYMLINK_MAX 130
#define _PC_SYNC_IO 129
#define _PC_VDISABLE 128
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
long int pathconf(const char *path, int name) {
  if (path[0] == '\0') {
    __set_errno(ENOENT);
    return -1;
  }
  switch (name) {
  default:
    __set_errno(EINVAL);
    return -1;
  case _PC_LINK_MAX:
    return 127;
  case _PC_MAX_CANON:
    return -1;
  case _PC_MAX_INPUT:
    return -1;
  case _PC_NAME_MAX:
    return -1;
  case _PC_PATH_MAX:
    return -1;
  case _PC_PIPE_BUF:
    return -1;
  case _PC_CHOWN_RESTRICTED:
    return -1;
  case _PC_NO_TRUNC:
    return -1;
  case _PC_VDISABLE:
    return -1;
  case _PC_SYNC_IO:
    return -1;
  case _PC_ASYNC_IO:
    return -1;
  case _PC_PRIO_IO:
    return -1;
  case _PC_SOCK_MAXBUF:
    return -1;
  case _PC_FILESIZEBITS:
    return 32;
  case _PC_REC_INCR_XFER_SIZE:
  case _PC_REC_MAX_XFER_SIZE:
  case _PC_REC_MIN_XFER_SIZE:
  case _PC_REC_XFER_ALIGN:
  case _PC_ALLOC_SIZE_MIN:
  case _PC_SYMLINK_MAX:
    return -1;
  }
}


x86 assembly (clang, -O0):
<pathconf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    114a <pathconf+0x3a>
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    124c <pathconf+0x13c>
mov    -0x14(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x13,%eax
ja     1173 <pathconf+0x63>
mov    -0x20(%rbp),%rax
lea    0xe96(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    124c <pathconf+0x13c>
movq   $0x7f,-0x8(%rbp)
jmp    124c <pathconf+0x13c>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    124c <pathconf+0x13c>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    124c <pathconf+0x13c>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    124c <pathconf+0x13c>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    124c <pathconf+0x13c>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    124c <pathconf+0x13c>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    124c <pathconf+0x13c>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    124c <pathconf+0x13c>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    124c <pathconf+0x13c>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    124c <pathconf+0x13c>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    124c <pathconf+0x13c>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    124c <pathconf+0x13c>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    124c <pathconf+0x13c>
movq   $0x20,-0x8(%rbp)
jmp    124c <pathconf+0x13c>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pathconf>:
push   %rax
cmpb   $0x0,(%rdi)
je     112e <pathconf+0x1e>
add    $0xffffff80,%esi
cmp    $0x14,%esi
jae    1137 <pathconf+0x27>
movslq %esi,%rax
lea    0xed8(%rip),%rcx
mov    (%rcx,%rax,8),%rax
pop    %rcx
ret
mov    0x2e9b(%rip),%rax
jmp    113e <pathconf+0x2e>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffffffffffff,%rax
pop    %rcx
ret

LLVM IR (-O0):
@ENOENT = global i32 0
@EINVAL = global i32 0
define i64 @pathconf(i8* %0, i32 %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i8*, i8** %4
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i32, i32* @ENOENT
%13 = call i32 @__set_errno(i32 %12)
store i64 -1, i64* %3
br label %34
14: ; preds = %2
%15 = load i32, i32* %5
switch i32 %15, label %16 [
i32 143, label %19
i32 142, label %20
i32 141, label %21
i32 140, label %22
i32 138, label %23
i32 137, label %24
i32 145, label %25
i32 139, label %26
i32 128, label %27
i32 129, label %28
i32 146, label %29
i32 136, label %30
i32 131, label %31
i32 144, label %32
i32 135, label %33
i32 134, label %33
i32 133, label %33
i32 132, label %33
i32 147, label %33
i32 130, label %33
]
16: ; preds = %14
%17 = load i32, i32* @EINVAL
%18 = call i32 @__set_errno(i32 %17)
store i64 -1, i64* %3
br label %34
19: ; preds = %14
store i64 127, i64* %3
br label %34
20: ; preds = %14
store i64 -1, i64* %3
br label %34
21: ; preds = %14
store i64 -1, i64* %3
br label %34
22: ; preds = %14
store i64 -1, i64* %3
br label %34
23: ; preds = %14
store i64 -1, i64* %3
br label %34
24: ; preds = %14
store i64 -1, i64* %3
br label %34
25: ; preds = %14
store i64 -1, i64* %3
br label %34
26: ; preds = %14
store i64 -1, i64* %3
br label %34
27: ; preds = %14
store i64 -1, i64* %3
br label %34
28: ; preds = %14
store i64 -1, i64* %3
br label %34
29: ; preds = %14
store i64 -1, i64* %3
br label %34
30: ; preds = %14
store i64 -1, i64* %3
br label %34
31: ; preds = %14
store i64 -1, i64* %3
br label %34
32: ; preds = %14
store i64 32, i64* %3
br label %34
33: ; preds = %14, %14, %14, %14, %14, %14
store i64 -1, i64* %3
br label %34
34: ; preds = %33, %32, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %16, %11
%35 = load i64, i64* %3
ret i64 %35
}

LLVM IR (-O2):
@ENOENT = global i32 0
@EINVAL = global i32 0
@switch.table.pathconf = [20 x i64] [i64 -1, i64 -1, i64 -1, i64 -1, i64 -1, i64 -1, i64 -1, i64 -1, i64 -1, i64 -1, i64 -1, i64 -1, i64 -1, i64 -1, i64 -1, i64 127, i64 32, i64 -1, i64 -1, i64 -1]
define i64 @pathconf(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* @ENOENT
%7 = tail call i32 @__set_errno(i32 %6)
br label %18
8: ; preds = %2
%9 = add i32 %1, -128
%10 = icmp ult i32 %9, 20
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = load i32, i32* @EINVAL
%13 = tail call i32 @__set_errno(i32 %12)
br label %18
14: ; preds = %8
%15 = sext i32 %9 to i64
%16 = getelementptr inbounds [20 x i64], [20 x i64]* @switch.table.pathconf, i64 0, i64 %15
%17 = load i64, i64* %16
br label %18
18: ; preds = %14, %11, %5
%19 = phi i64 [ -1, %5 ], [ -1, %11 ], [ %17, %14 ]
ret i64 %19
}