#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*/ Sys_Printf(char *, char const *);
int /*<<< orphan*/ strcasecmp(char const *, char *);
int /*<<< orphan*/ strcmp(char const *, char *);
int atoboolean(const char *var) {
  int value = 0;
  if (!strcasecmp(var, "false") || !strcasecmp(var, "low") ||
      !strcasecmp(var, "no") || !strcasecmp(var, "off") || !strcmp(var, "0"))
    value = 0;
  else if (!strcasecmp(var, "true") || !strcasecmp(var, "high") ||
           !strcasecmp(var, "yes") || !strcasecmp(var, "on") ||
           !strcmp(var, "1"))
    value = 1;
  else
    Sys_Printf("Invalid value `%s'\n", var);
  return value;
}


x86 assembly (clang, -O0):
<atoboolean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     11c0 <atoboolean+0x90>
mov    -0x8(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     11c0 <atoboolean+0x90>
mov    -0x8(%rbp),%rdi
lea    0xe8a(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     11c0 <atoboolean+0x90>
mov    -0x8(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     11c0 <atoboolean+0x90>
mov    -0x8(%rbp),%rdi
lea    0xe5f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11cc <atoboolean+0x9c>
movl   $0x0,-0xc(%rbp)
jmp    126a <atoboolean+0x13a>
mov    -0x8(%rbp),%rdi
lea    0xe3c(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     1249 <atoboolean+0x119>
mov    -0x8(%rbp),%rdi
lea    0xe28(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     1249 <atoboolean+0x119>
mov    -0x8(%rbp),%rdi
lea    0xe14(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     1249 <atoboolean+0x119>
mov    -0x8(%rbp),%rdi
lea    0xdff(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     1249 <atoboolean+0x119>
mov    -0x8(%rbp),%rdi
lea    0xde9(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1255 <atoboolean+0x125>
movl   $0x1,-0xc(%rbp)
jmp    1265 <atoboolean+0x135>
mov    -0x8(%rbp),%rsi
lea    0xdc6(%rip),%rdi
call   1050 <Sys_Printf@plt>
jmp    126a <atoboolean+0x13a>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atoboolean>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xec3(%rip),%rsi
call   1030 <strcasecmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     1219 <atoboolean+0xe9>
lea    0xeb3(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1219 <atoboolean+0xe9>
lea    0xea0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1219 <atoboolean+0xe9>
lea    0xe8c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1219 <atoboolean+0xe9>
lea    0xe79(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1219 <atoboolean+0xe9>
lea    0xe68(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     1219 <atoboolean+0xe9>
lea    0xe55(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1219 <atoboolean+0xe9>
lea    0xe47(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1219 <atoboolean+0xe9>
lea    0xe38(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1219 <atoboolean+0xe9>
lea    0xe28(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1219 <atoboolean+0xe9>
lea    0xe17(%rip),%rdi
mov    %rbx,%rsi
call   1050 <Sys_Printf@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"false\00"
@.str.1 = [4 x i8] c"low\00"
@.str.2 = [3 x i8] c"no\00"
@.str.3 = [4 x i8] c"off\00"
@.str.4 = [2 x i8] c"0\00"
@.str.5 = [5 x i8] c"true\00"
@.str.6 = [5 x i8] c"high\00"
@.str.7 = [4 x i8] c"yes\00"
@.str.8 = [3 x i8] c"on\00"
@.str.9 = [2 x i8] c"1\00"
@.str.10 = [20 x i8] c"Invalid value `%s'\0A\00"
define i32 @atoboolean(i8* %0) {
%2 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %33, label %4
4: ; preds = %1
%5 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %33, label %7
7: ; preds = %4
%8 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %33, label %10
10: ; preds = %7
%11 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %33, label %13
13: ; preds = %10
%14 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %33, label %16
16: ; preds = %13
%17 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
br i1 %18, label %33, label %19
19: ; preds = %16
%20 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %33, label %22
22: ; preds = %19
%23 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%24 = icmp eq i32 %23, 0
br i1 %24, label %33, label %25
25: ; preds = %22
%26 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%27 = icmp eq i32 %26, 0
br i1 %27, label %33, label %28
28: ; preds = %25
%29 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%30 = icmp eq i32 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %28
%32 = tail call i32 @Sys_Printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i8* %0)
br label %33
33: ; preds = %16, %19, %22, %25, %28, %1, %4, %7, %10, %13, %31
%34 = phi i32 [ 0, %31 ], [ 0, %13 ], [ 0, %10 ], [ 0, %7 ], [ 0, %4 ], [ 0, %1 ], [ 1, %28 ], [ 1, %25 ], [ 1, %22 ], [ 1, %19 ], [ 1, %16 ]
ret i32 %34
}