#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 146
#define _PC_ASYNC_IO 145
#define _PC_CHOWN_RESTRICTED 144
#define _PC_FILESIZEBITS 143
int _PC_LINK_MAX;
#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;
  }
  if (name == _PC_LINK_MAX) {
    return 127;
  }
  switch (name) {
  default:
    __set_errno(EINVAL);
    return -1;
  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    125e <pathconf+0x14e>
mov    -0x14(%rbp),%eax
mov    0x2e74(%rip),%rcx
cmp    (%rcx),%eax
jne    1169 <pathconf+0x59>
movq   $0x7f,-0x8(%rbp)
jmp    125e <pathconf+0x14e>
mov    -0x14(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x12,%eax
ja     1192 <pathconf+0x82>
mov    -0x20(%rbp),%rax
lea    0xe77(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    125e <pathconf+0x14e>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    125e <pathconf+0x14e>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    125e <pathconf+0x14e>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    125e <pathconf+0x14e>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    125e <pathconf+0x14e>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    125e <pathconf+0x14e>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    125e <pathconf+0x14e>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    125e <pathconf+0x14e>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    125e <pathconf+0x14e>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    125e <pathconf+0x14e>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    125e <pathconf+0x14e>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    125e <pathconf+0x14e>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    125e <pathconf+0x14e>
movq   $0x20,-0x8(%rbp)
jmp    125e <pathconf+0x14e>
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     113e <pathconf+0x2e>
mov    0x2eab(%rip),%rcx
mov    $0x7f,%eax
cmp    %esi,(%rcx)
je     113c <pathconf+0x2c>
add    $0xffffff80,%esi
cmp    $0x13,%esi
jae    1147 <pathconf+0x37>
movslq %esi,%rax
lea    0xec8(%rip),%rcx
mov    (%rcx,%rax,8),%rax
pop    %rcx
ret
mov    0x2e8b(%rip),%rax
jmp    114e <pathconf+0x3e>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffffffffffff,%rax
pop    %rcx
ret

LLVM IR (-O0):
@ENOENT = global i32 0
@_PC_LINK_MAX = 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 %38
14: ; preds = %2
%15 = load i32, i32* %5
%16 = load i32, i32* @_PC_LINK_MAX
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %19
18: ; preds = %14
store i64 127, i64* %3
br label %38
19: ; preds = %14
%20 = load i32, i32* %5
switch i32 %20, label %21 [
i32 142, label %24
i32 141, label %25
i32 140, label %26
i32 138, label %27
i32 137, label %28
i32 144, label %29
i32 139, label %30
i32 128, label %31
i32 129, label %32
i32 145, label %33
i32 136, label %34
i32 131, label %35
i32 143, label %36
i32 135, label %37
i32 134, label %37
i32 133, label %37
i32 132, label %37
i32 146, label %37
i32 130, label %37
]
21: ; preds = %19
%22 = load i32, i32* @EINVAL
%23 = call i32 @__set_errno(i32 %22)
store i64 -1, i64* %3
br label %38
24: ; preds = %19
store i64 -1, i64* %3
br label %38
25: ; preds = %19
store i64 -1, i64* %3
br label %38
26: ; preds = %19
store i64 -1, i64* %3
br label %38
27: ; preds = %19
store i64 -1, i64* %3
br label %38
28: ; preds = %19
store i64 -1, i64* %3
br label %38
29: ; preds = %19
store i64 -1, i64* %3
br label %38
30: ; preds = %19
store i64 -1, i64* %3
br label %38
31: ; preds = %19
store i64 -1, i64* %3
br label %38
32: ; preds = %19
store i64 -1, i64* %3
br label %38
33: ; preds = %19
store i64 -1, i64* %3
br label %38
34: ; preds = %19
store i64 -1, i64* %3
br label %38
35: ; preds = %19
store i64 -1, i64* %3
br label %38
36: ; preds = %19
store i64 32, i64* %3
br label %38
37: ; preds = %19, %19, %19, %19, %19, %19
store i64 -1, i64* %3
br label %38
38: ; preds = %37, %36, %35, %34, %33, %32, %31, %30, %29, %28, %27, %26, %25, %24, %21, %18, %11
%39 = load i64, i64* %3
ret i64 %39
}

LLVM IR (-O2):
@ENOENT = global i32 0
@_PC_LINK_MAX = global i32 0
@EINVAL = global i32 0
@switch.table.pathconf = [19 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 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 %21
8: ; preds = %2
%9 = load i32, i32* @_PC_LINK_MAX
%10 = icmp eq i32 %9, %1
br i1 %10, label %21, label %11
11: ; preds = %8
%12 = add i32 %1, -128
%13 = icmp ult i32 %12, 19
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load i32, i32* @EINVAL
%16 = tail call i32 @__set_errno(i32 %15)
br label %21
17: ; preds = %11
%18 = sext i32 %12 to i64
%19 = getelementptr inbounds [19 x i64], [19 x i64]* @switch.table.pathconf, i64 0, i64 %18
%20 = load i64, i64* %19
br label %21
21: ; preds = %17, %8, %14, %5
%22 = phi i64 [ -1, %5 ], [ -1, %14 ], [ 127, %8 ], [ %20, %17 ]
ret i64 %22
}