#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 atoi(char const *);
int /*<<< orphan*/ strcasecmp(char const *, char *);
int atobv(char const *arg, int def) {
  if (!arg)
    return def;
  if (!strcasecmp(arg, "true") || !strcasecmp(arg, "yes") ||
      !strcasecmp(arg, "on") || !strcasecmp(arg, "enable"))
    return 1;
  return atoi(arg);
}


x86 assembly (clang, -O0):
<atobv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1145 <atobv+0x25>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11c1 <atobv+0xa1>
mov    -0x10(%rbp),%rdi
lea    0xeb0(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     11a9 <atobv+0x89>
mov    -0x10(%rbp),%rdi
lea    0xe9c(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     11a9 <atobv+0x89>
mov    -0x10(%rbp),%rdi
lea    0xe87(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     11a9 <atobv+0x89>
mov    -0x10(%rbp),%rdi
lea    0xe71(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    11b5 <atobv+0x95>
movl   $0x1,-0x4(%rbp)
jmp    11c1 <atobv+0xa1>
mov    -0x10(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atobv>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
test   %rdi,%rdi
je     1189 <atobv+0x69>
mov    %rdi,%rbx
lea    0xecc(%rip),%rsi
call   1030 <strcasecmp@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     1189 <atobv+0x69>
lea    0xebc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1189 <atobv+0x69>
lea    0xead(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1189 <atobv+0x69>
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1189 <atobv+0x69>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <atoi@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"true\00"
@.str.1 = [4 x i8] c"yes\00"
@.str.2 = [3 x i8] c"on\00"
@.str.3 = [7 x i8] c"enable\00"
define i32 @atobv(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = load i32, i32* %5
store i32 %9, i32* %3
br label %30
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = call i32 @strcasecmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %26
14: ; preds = %10
%15 = load i8*, i8** %4
%16 = call i32 @strcasecmp(i8* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load i8*, i8** %4
%20 = call i32 @strcasecmp(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i8*, i8** %4
%24 = call i32 @strcasecmp(i8* %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %22, %18, %14, %10
store i32 1, i32* %3
br label %30
27: ; preds = %22
%28 = load i8*, i8** %4
%29 = call i32 @atoi(i8* %28)
store i32 %29, i32* %3
br label %30
30: ; preds = %27, %26, %8
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@.str = [5 x i8] c"true\00"
@.str.1 = [4 x i8] c"yes\00"
@.str.2 = [3 x i8] c"on\00"
@.str.3 = [7 x i8] c"enable\00"
define i32 @atobv(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %18, label %4
4: ; preds = %2
%5 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %18, label %7
7: ; preds = %4
%8 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %18, label %10
10: ; preds = %7
%11 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %10
%14 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = tail call i32 @atoi(i8* %0)
br label %18
18: ; preds = %4, %7, %10, %13, %2, %16
%19 = phi i32 [ %17, %16 ], [ %1, %2 ], [ 1, %13 ], [ 1, %10 ], [ 1, %7 ], [ 1, %4 ]
ret i32 %19
}