#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;
int /*<<< orphan*/ errno;
scalar_t__ strcasecmp(char const *, char *);
bool yesno(const char *value) {
  if (!value) {
    errno = ENOENT;
    return false;
  }
  if (strcasecmp(value, "yes") == 0 || strcasecmp(value, "y") == 0 ||
      strcasecmp(value, "true") == 0 || strcasecmp(value, "on") == 0 ||
      strcasecmp(value, "1") == 0)
    return true;
  if (strcasecmp(value, "no") != 0 && strcasecmp(value, "n") != 0 &&
      strcasecmp(value, "false") != 0 && strcasecmp(value, "off") != 0 &&
      strcasecmp(value, "0") != 0)
    errno = EINVAL;
  return false;
}


x86 assembly (clang, -O0):
<yesno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1145 <yesno+0x35>
mov    0x2e9a(%rip),%rax
mov    (%rax),%ecx
mov    0x2ea9(%rip),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    126e <yesno+0x15e>
mov    -0x10(%rbp),%rdi
lea    0xeb0(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11c7 <yesno+0xb7>
mov    -0x10(%rbp),%rdi
lea    0xe9a(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11c7 <yesno+0xb7>
mov    -0x10(%rbp),%rdi
lea    0xe82(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11c7 <yesno+0xb7>
mov    -0x10(%rbp),%rdi
lea    0xe6d(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11c7 <yesno+0xb7>
mov    -0x10(%rbp),%rdi
lea    0xe56(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11d3 <yesno+0xc3>
movl   $0x1,-0x4(%rbp)
jmp    126e <yesno+0x15e>
mov    -0x10(%rbp),%rdi
lea    0xe32(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     1267 <yesno+0x157>
mov    -0x10(%rbp),%rdi
lea    0xe14(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     1267 <yesno+0x157>
mov    -0x10(%rbp),%rdi
lea    0xe01(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     1267 <yesno+0x157>
mov    -0x10(%rbp),%rdi
lea    0xded(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     1267 <yesno+0x157>
mov    -0x10(%rbp),%rdi
lea    0xdd7(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     1267 <yesno+0x157>
mov    0x2d7c(%rip),%rax
mov    (%rax),%ecx
mov    0x2d7b(%rip),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yesno>:
push   %rbp
push   %rbx
push   %rax
test   %rdi,%rdi
je     1208 <yesno+0xf8>
mov    %rdi,%rbx
lea    0xeda(%rip),%rsi
call   1030 <strcasecmp@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     121c <yesno+0x10c>
lea    0xec4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     121c <yesno+0x10c>
lea    0xeae(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     121c <yesno+0x10c>
lea    0xe9b(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     121c <yesno+0x10c>
lea    0xe86(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     121c <yesno+0x10c>
lea    0xe70(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     121c <yesno+0x10c>
lea    0xe56(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     121c <yesno+0x10c>
lea    0xe49(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     121c <yesno+0x10c>
lea    0xe3b(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     121c <yesno+0x10c>
lea    0xe2b(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     121c <yesno+0x10c>
mov    0x2dd2(%rip),%rax
jmp    120f <yesno+0xff>
mov    0x2db9(%rip),%rax
mov    (%rax),%eax
mov    0x2dc8(%rip),%rcx
mov    %eax,(%rcx)
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@ENOENT = global i32 0
@errno = global i32 0
@.str = [4 x i8] c"yes\00"
@.str.1 = [2 x i8] c"y\00"
@.str.2 = [5 x i8] c"true\00"
@.str.3 = [3 x i8] c"on\00"
@.str.4 = [2 x i8] c"1\00"
@.str.5 = [3 x i8] c"no\00"
@.str.6 = [2 x i8] c"n\00"
@.str.7 = [6 x i8] c"false\00"
@.str.8 = [4 x i8] c"off\00"
@.str.9 = [2 x i8] c"0\00"
@EINVAL = global i32 0
define i32 @yesno(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = load i32, i32* @ENOENT
store i32 %7, i32* @errno
store i32 0, i32* %2
br label %52
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i64 @strcasecmp(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %28, label %12
12: ; preds = %8
%13 = load i8*, i8** %3
%14 = call i64 @strcasecmp(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %28, label %16
16: ; preds = %12
%17 = load i8*, i8** %3
%18 = call i64 @strcasecmp(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %28, label %20
20: ; preds = %16
%21 = load i8*, i8** %3
%22 = call i64 @strcasecmp(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %28, label %24
24: ; preds = %20
%25 = load i8*, i8** %3
%26 = call i64 @strcasecmp(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %24, %20, %16, %12, %8
store i32 1, i32* %2
br label %52
29: ; preds = %24
%30 = load i8*, i8** %3
%31 = call i64 @strcasecmp(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %51
33: ; preds = %29
%34 = load i8*, i8** %3
%35 = call i64 @strcasecmp(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %51
37: ; preds = %33
%38 = load i8*, i8** %3
%39 = call i64 @strcasecmp(i8* %38, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %51
41: ; preds = %37
%42 = load i8*, i8** %3
%43 = call i64 @strcasecmp(i8* %42, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%44 = icmp ne i64 %43, 0
br i1 %44, label %45, label %51
45: ; preds = %41
%46 = load i8*, i8** %3
%47 = call i64 @strcasecmp(i8* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %45
%50 = load i32, i32* @EINVAL
store i32 %50, i32* @errno
br label %51
51: ; preds = %49, %45, %41, %37, %33, %29
store i32 0, i32* %2
br label %52
52: ; preds = %51, %28, %6
%53 = load i32, i32* %2
ret i32 %53
}

LLVM IR (-O2):
@ENOENT = global i32 0
@errno = global i32 0
@.str = [4 x i8] c"yes\00"
@.str.1 = [2 x i8] c"y\00"
@.str.2 = [5 x i8] c"true\00"
@.str.3 = [3 x i8] c"on\00"
@.str.4 = [2 x i8] c"1\00"
@.str.5 = [3 x i8] c"no\00"
@.str.6 = [2 x i8] c"n\00"
@.str.7 = [6 x i8] c"false\00"
@.str.8 = [4 x i8] c"off\00"
@.str.9 = [2 x i8] c"0\00"
@EINVAL = global i32 0
define i32 @yesno(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %33, label %3
3: ; preds = %1
%4 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %36, label %6
6: ; preds = %3
%7 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %36, label %9
9: ; preds = %6
%10 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %36, label %12
12: ; preds = %9
%13 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %36, label %15
15: ; preds = %12
%16 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %36, label %18
18: ; preds = %15
%19 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %36, label %21
21: ; preds = %18
%22 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %36, label %24
24: ; preds = %21
%25 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %36, label %27
27: ; preds = %24
%28 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %36, label %30
30: ; preds = %27
%31 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %30, %1
%34 = phi i32* [ @ENOENT, %1 ], [ @EINVAL, %30 ]
%35 = load i32, i32* %34
store i32 %35, i32* @errno
br label %36
36: ; preds = %33, %18, %21, %24, %27, %30, %3, %6, %9, %12, %15
%37 = phi i32 [ 1, %15 ], [ 1, %12 ], [ 1, %9 ], [ 1, %6 ], [ 1, %3 ], [ 0, %30 ], [ 0, %27 ], [ 0, %24 ], [ 0, %21 ], [ 0, %18 ], [ 0, %33 ]
ret i32 %37
}