#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;
#define _CS_PATH 128
int /*<<< orphan*/ errno;
int /*<<< orphan*/ strncpy(char *, char *, size_t);
size_t confstr(int name, char *buf, size_t len) {
  switch (name) {
  case _CS_PATH:
    if (buf)
      strncpy(buf, "/bin:/usr/bin", len);
    return sizeof("/bin:/usr/bin");
    break;
  }
  errno = EINVAL;
  return 0;
}


x86 assembly (clang, -O0):
<confstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x80,%eax
jne    1162 <confstr+0x52>
jmp    1136 <confstr+0x26>
cmpq   $0x0,-0x18(%rbp)
je     1155 <confstr+0x45>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xeb0(%rip),%rsi
call   1030 <strncpy@plt>
movq   $0xe,-0x8(%rbp)
jmp    117c <confstr+0x6c>
mov    0x2e6f(%rip),%rax
mov    (%rax),%ecx
mov    0x2e6e(%rip),%rax
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<confstr>:
push   %rbx
cmp    $0x80,%edi
jne    1137 <confstr+0x27>
mov    $0xe,%ebx
test   %rsi,%rsi
je     114b <confstr+0x3b>
lea    0xed6(%rip),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1030 <strncpy@plt>
jmp    114b <confstr+0x3b>
mov    0x2e9a(%rip),%rax
mov    (%rax),%eax
mov    0x2e99(%rip),%rcx
mov    %eax,(%rcx)
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"/bin:/usr/bin\00"
@EINVAL = global i32 0
@errno = global i32 0
define i64 @confstr(i32 %0, i8* %1, i64 %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
store i32 %0, i32* %5
store i8* %1, i8** %6
store i64 %2, i64* %7
%8 = load i32, i32* %5
switch i32 %8, label %17 [
i32 128, label %9
]
9: ; preds = %3
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i8*, i8** %6
%14 = load i64, i64* %7
%15 = call i32 @strncpy(i8* %13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %14)
br label %16
16: ; preds = %12, %9
store i64 14, i64* %4
br label %19
17: ; preds = %3
%18 = load i32, i32* @EINVAL
store i32 %18, i32* @errno
store i64 0, i64* %4
br label %19
19: ; preds = %17, %16
%20 = load i64, i64* %4
ret i64 %20
}

LLVM IR (-O2):
@.str = [14 x i8] c"/bin:/usr/bin\00"
@EINVAL = global i32 0
@errno = global i32 0
define i64 @confstr(i32 %0, i8* %1, i64 %2) {
%4 = icmp eq i32 %0, 128
br i1 %4, label %5, label %9
5: ; preds = %3
%6 = icmp eq i8* %1, null
br i1 %6, label %11, label %7
7: ; preds = %5
%8 = tail call i32 @strncpy(i8* %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %2)
br label %11
9: ; preds = %3
%10 = load i32, i32* @EINVAL
store i32 %10, i32* @errno
br label %11
11: ; preds = %5, %7, %9
%12 = phi i64 [ 0, %9 ], [ 14, %7 ], [ 14, %5 ]
ret i64 %12
}