#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 */
char *config_get_option(char const *);
int /*<<< orphan*/ jlog(int, char *, char const *);
scalar_t__ strcasecmp(char const *, char *);
scalar_t__ strcmp(char const *, char *);
int config_get_bool(const char *key) {
  const char *optstr = config_get_option(key);
  if (!optstr) {
    jlog(5, "There was no value for %s, using \"off\"", key);
    return 0;
  }
  if (strcasecmp(optstr, "on") == 0) {
    return 1;
  }
  if (strcasecmp(optstr, "off") == 0) {
    return 0;
  }
  if (strcasecmp(optstr, "yes") == 0) {
    return 1;
  }
  if (strcasecmp(optstr, "no") == 0) {
    return 0;
  }
  if (strcasecmp(optstr, "true") == 0) {
    return 1;
  }
  if (strcasecmp(optstr, "false") == 0) {
    return 0;
  }
  if (strcmp(optstr, "1") == 0) {
    return 1;
  }
  if (strcmp(optstr, "0") == 0) {
    return 0;
  }
  jlog(5, "There was no value for %s, using \"off\"", key);
  return 0;
}


x86 assembly (clang, -O0):
<config_get_bool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <config_get_option@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1185 <config_get_bool+0x45>
mov    -0x10(%rbp),%rdx
mov    $0x5,%edi
lea    0xe8c(%rip),%rsi
call   1040 <jlog@plt>
movl   $0x0,-0x4(%rbp)
jmp    12d1 <config_get_bool+0x191>
mov    -0x18(%rbp),%rdi
lea    0xe97(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11ab <config_get_bool+0x6b>
movl   $0x1,-0x4(%rbp)
jmp    12d1 <config_get_bool+0x191>
mov    -0x18(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11d1 <config_get_bool+0x91>
movl   $0x0,-0x4(%rbp)
jmp    12d1 <config_get_bool+0x191>
mov    -0x18(%rbp),%rdi
lea    0xe52(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11f7 <config_get_bool+0xb7>
movl   $0x1,-0x4(%rbp)
jmp    12d1 <config_get_bool+0x191>
mov    -0x18(%rbp),%rdi
lea    0xe30(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    121d <config_get_bool+0xdd>
movl   $0x0,-0x4(%rbp)
jmp    12d1 <config_get_bool+0x191>
mov    -0x18(%rbp),%rdi
lea    0xe0d(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1243 <config_get_bool+0x103>
movl   $0x1,-0x4(%rbp)
jmp    12d1 <config_get_bool+0x191>
mov    -0x18(%rbp),%rdi
lea    0xdec(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1269 <config_get_bool+0x129>
movl   $0x0,-0x4(%rbp)
jmp    12d1 <config_get_bool+0x191>
mov    -0x18(%rbp),%rdi
lea    0xdcc(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    128f <config_get_bool+0x14f>
movl   $0x1,-0x4(%rbp)
jmp    12d1 <config_get_bool+0x191>
mov    -0x18(%rbp),%rdi
lea    0xda8(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12b5 <config_get_bool+0x175>
movl   $0x0,-0x4(%rbp)
jmp    12d1 <config_get_bool+0x191>
mov    -0x10(%rbp),%rdx
mov    $0x5,%edi
lea    0xd3b(%rip),%rsi
call   1040 <jlog@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_get_bool>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1060 <config_get_option@plt>
test   %rax,%rax
je     120a <config_get_bool+0xca>
mov    %rax,%rbx
lea    0xec8(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcasecmp@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     1220 <config_get_bool+0xe0>
lea    0xeae(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     121e <config_get_bool+0xde>
lea    0xe9a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1220 <config_get_bool+0xe0>
lea    0xe8a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     121e <config_get_bool+0xde>
lea    0xe79(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1220 <config_get_bool+0xe0>
lea    0xe6a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     121e <config_get_bool+0xde>
lea    0xe5c(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1220 <config_get_bool+0xe0>
lea    0xe4a(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
mov    $0x0,%ebp
test   %rax,%rax
je     1220 <config_get_bool+0xe0>
lea    0xdef(%rip),%rsi
mov    $0x5,%edi
mov    %r14,%rdx
call   1040 <jlog@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [39 x i8] c"There was no value for %s, using \22off\22\00"
@.str.1 = [3 x i8] c"on\00"
@.str.2 = [4 x i8] c"off\00"
@.str.3 = [4 x i8] c"yes\00"
@.str.4 = [3 x i8] c"no\00"
@.str.5 = [5 x i8] c"true\00"
@.str.6 = [6 x i8] c"false\00"
@.str.7 = [2 x i8] c"1\00"
@.str.8 = [2 x i8] c"0\00"
define i32 @config_get_bool(i8* %0) {
%2 = tail call i8* @config_get_option(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %28, label %4
4: ; preds = %1
%5 = tail call i64 @strcasecmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %30, label %7
7: ; preds = %4
%8 = tail call i64 @strcasecmp(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %30, label %10
10: ; preds = %7
%11 = tail call i64 @strcasecmp(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %30, label %13
13: ; preds = %10
%14 = tail call i64 @strcasecmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %30, label %16
16: ; preds = %13
%17 = tail call i64 @strcasecmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %30, label %19
19: ; preds = %16
%20 = tail call i64 @strcasecmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %30, label %22
22: ; preds = %19
%23 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %30, label %25
25: ; preds = %22
%26 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %25, %1
%29 = tail call i32 @jlog(i32 5, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %30
30: ; preds = %28, %25, %22, %19, %16, %13, %10, %7, %4
%31 = phi i32 [ 1, %4 ], [ 0, %7 ], [ 1, %10 ], [ 0, %13 ], [ 1, %16 ], [ 0, %19 ], [ 1, %22 ], [ 0, %25 ], [ 0, %28 ]
ret i32 %31
}