#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 _getconf_confstr(char const *);
int _getconf_pathconf(char const *, char const *);
int _getconf_sysconf(char const *);
scalar_t__ strncmp(char const *, char *, int);
int _getconf(char const *specification, char const *var, char const *path) {
  if (path != NULL)
    return _getconf_pathconf(var, path);
  if (strncmp(var, "_SC_", 4) == 0)
    return _getconf_confstr(var);
  return _getconf_sysconf(var);
}


x86 assembly (clang, -O0):
<_getconf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1174 <_getconf+0x34>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <_getconf_pathconf@plt>
mov    %eax,-0x4(%rbp)
jmp    11b0 <_getconf+0x70>
mov    -0x18(%rbp),%rdi
lea    0xe81(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    11a4 <_getconf+0x64>
mov    -0x18(%rbp),%rdi
call   1060 <_getconf_confstr@plt>
mov    %eax,-0x4(%rbp)
jmp    11b0 <_getconf+0x70>
mov    -0x18(%rbp),%rdi
call   1050 <_getconf_sysconf@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_getconf>:
push   %rbx
mov    %rsi,%rbx
test   %rdx,%rdx
je     1155 <_getconf+0x15>
mov    %rbx,%rdi
mov    %rdx,%rsi
pop    %rbx
jmp    1030 <_getconf_pathconf@plt>
lea    0xea4(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
mov    %rbx,%rdi
test   %rax,%rax
je     1177 <_getconf+0x37>
pop    %rbx
jmp    1050 <_getconf_sysconf@plt>
pop    %rbx
jmp    1060 <_getconf_confstr@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"_SC_\00"
define i32 @_getconf(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%8 = load i8*, i8** %7
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i8*, i8** %6
%12 = load i8*, i8** %7
%13 = call i32 @_getconf_pathconf(i8* %11, i8* %12)
store i32 %13, i32* %4
br label %24
14: ; preds = %3
%15 = load i8*, i8** %6
%16 = call i64 @strncmp(i8* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = load i8*, i8** %6
%20 = call i32 @_getconf_confstr(i8* %19)
store i32 %20, i32* %4
br label %24
21: ; preds = %14
%22 = load i8*, i8** %6
%23 = call i32 @_getconf_sysconf(i8* %22)
store i32 %23, i32* %4
br label %24
24: ; preds = %21, %18, %10
%25 = load i32, i32* %4
ret i32 %25
}

LLVM IR (-O2):
@.str = [5 x i8] c"_SC_\00"
define i32 @_getconf(i8* nocapture readnone %0, i8* %1, i8* %2) {
%4 = icmp eq i8* %2, null
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @_getconf_pathconf(i8* %1, i8* %2)
br label %14
7: ; preds = %3
%8 = tail call i64 @strncmp(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @_getconf_confstr(i8* %1)
br label %14
12: ; preds = %7
%13 = tail call i32 @_getconf_sysconf(i8* %1)
br label %14
14: ; preds = %12, %10, %5
%15 = phi i32 [ %6, %5 ], [ %11, %10 ], [ %13, %12 ]
ret i32 %15
}