#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 *);
int config_get_str(char const *, char const *, char const *, char *, int);
scalar_t__ isdigit(char);
scalar_t__ strcasecmp(char *, char *);
int config_get_bool(const char *filename, const char *section, const char *name,
                    int *val) {
  char buf[64];
  int r;
  if ((r = config_get_str(filename, section, name, buf, 64)) != 0)
    return r;
  if ((strcasecmp(buf, "true") == 0) || (strcasecmp(buf, "t") == 0) ||
      (strcasecmp(buf, "yes") == 0) || (strcasecmp(buf, "y") == 0) ||
      (strcasecmp(buf, "on") == 0) || (atoi(buf) == 1)) {
    *val = 1;
    return 0;
  }
  if ((strcasecmp(buf, "false") == 0) || (strcasecmp(buf, "f") == 0) ||
      (strcasecmp(buf, "no") == 0) || (strcasecmp(buf, "n") == 0) ||
      (strcasecmp(buf, "off") == 0) || (isdigit(buf[0]) && (atoi(buf) == 0))) {
    *val = 0;
    return 0;
  }
  return -1;
}


x86 assembly (clang, -O0):
<config_get_bool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    -0x70(%rbp),%rcx
mov    $0x40,%r8d
call   1050 <config_get_str@plt>
mov    %eax,-0x74(%rbp)
cmp    $0x0,%eax
je     118d <config_get_bool+0x4d>
mov    -0x74(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12fb <config_get_bool+0x1bb>
lea    -0x70(%rbp),%rdi
lea    0xe68(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     1221 <config_get_bool+0xe1>
lea    -0x70(%rbp),%rdi
lea    0xe53(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     1221 <config_get_bool+0xe1>
lea    -0x70(%rbp),%rdi
lea    0xe3b(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     1221 <config_get_bool+0xe1>
lea    -0x70(%rbp),%rdi
lea    0xe25(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     1221 <config_get_bool+0xe1>
lea    -0x70(%rbp),%rdi
lea    0xe0d(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     1221 <config_get_bool+0xe1>
lea    -0x70(%rbp),%rdi
call   1060 <atoi@plt>
cmp    $0x1,%eax
jne    1237 <config_get_bool+0xf7>
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    12fb <config_get_bool+0x1bb>
lea    -0x70(%rbp),%rdi
lea    0xdce(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     12de <config_get_bool+0x19e>
lea    -0x70(%rbp),%rdi
lea    0xdbf(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     12de <config_get_bool+0x19e>
lea    -0x70(%rbp),%rdi
lea    0xda0(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     12de <config_get_bool+0x19e>
lea    -0x70(%rbp),%rdi
lea    0xd7e(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     12de <config_get_bool+0x19e>
lea    -0x70(%rbp),%rdi
lea    0xd6f(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     12de <config_get_bool+0x19e>
movsbl -0x70(%rbp),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%rax
je     12f4 <config_get_bool+0x1b4>
lea    -0x70(%rbp),%rdi
call   1060 <atoi@plt>
cmp    $0x0,%eax
jne    12f4 <config_get_bool+0x1b4>
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    12fb <config_get_bool+0x1bb>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_get_bool>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rcx,%rbx
mov    %rsp,%rcx
mov    $0x40,%r8d
call   1050 <config_get_str@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    127d <config_get_bool+0x13d>
lea    0xe96(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcasecmp@plt>
mov    $0x1,%r14d
test   %rax,%rax
je     1278 <config_get_bool+0x138>
lea    0xe7d(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1278 <config_get_bool+0x138>
lea    0xe67(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1278 <config_get_bool+0x138>
lea    0xe53(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1278 <config_get_bool+0x138>
lea    0xe3d(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1278 <config_get_bool+0x138>
mov    %rsp,%rdi
call   1060 <atoi@plt>
cmp    $0x1,%eax
je     1278 <config_get_bool+0x138>
lea    0xe17(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcasecmp@plt>
xor    %r14d,%r14d
test   %rax,%rax
je     1278 <config_get_bool+0x138>
lea    0xe0b(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1278 <config_get_bool+0x138>
lea    0xdf2(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1278 <config_get_bool+0x138>
lea    0xdd6(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1278 <config_get_bool+0x138>
lea    0xdcd(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1278 <config_get_bool+0x138>
movsbl (%rsp),%edi
call   1040 <isdigit@plt>
mov    $0xffffffff,%ebp
test   %rax,%rax
je     127d <config_get_bool+0x13d>
mov    %rsp,%rdi
call   1060 <atoi@plt>
test   %eax,%eax
jne    127d <config_get_bool+0x13d>
mov    %r14d,(%rbx)
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"true\00"
@.str.1 = [2 x i8] c"t\00"
@.str.2 = [4 x i8] c"yes\00"
@.str.3 = [2 x i8] c"y\00"
@.str.4 = [3 x i8] c"on\00"
@.str.5 = [6 x i8] c"false\00"
@.str.6 = [2 x i8] c"f\00"
@.str.7 = [3 x i8] c"no\00"
@.str.8 = [2 x i8] c"n\00"
@.str.9 = [4 x i8] c"off\00"
define i32 @config_get_bool(i8* %0, i8* %1, i8* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca [64 x i8]
%11 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32* %3, i32** %9
%12 = load i8*, i8** %6
%13 = load i8*, i8** %7
%14 = load i8*, i8** %8
%15 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%16 = call i32 @config_get_str(i8* %12, i8* %13, i8* %14, i8* %15, i32 64)
store i32 %16, i32* %11
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %4
%19 = load i32, i32* %11
store i32 %19, i32* %5
br label %78
20: ; preds = %4
%21 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%22 = call i64 @strcasecmp(i8* %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %44, label %24
24: ; preds = %20
%25 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%26 = call i64 @strcasecmp(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %44, label %28
28: ; preds = %24
%29 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%30 = call i64 @strcasecmp(i8* %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %44, label %32
32: ; preds = %28
%33 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%34 = call i64 @strcasecmp(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %44, label %36
36: ; preds = %32
%37 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%38 = call i64 @strcasecmp(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %44, label %40
40: ; preds = %36
%41 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%42 = call i32 @atoi(i8* %41)
%43 = icmp eq i32 %42, 1
br i1 %43, label %44, label %46
44: ; preds = %40, %36, %32, %28, %24, %20
%45 = load i32*, i32** %9
store i32 1, i32* %45
store i32 0, i32* %5
br label %78
46: ; preds = %40
%47 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%48 = call i64 @strcasecmp(i8* %47, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %75, label %50
50: ; preds = %46
%51 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%52 = call i64 @strcasecmp(i8* %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %75, label %54
54: ; preds = %50
%55 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%56 = call i64 @strcasecmp(i8* %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%57 = icmp eq i64 %56, 0
br i1 %57, label %75, label %58
58: ; preds = %54
%59 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%60 = call i64 @strcasecmp(i8* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%61 = icmp eq i64 %60, 0
br i1 %61, label %75, label %62
62: ; preds = %58
%63 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%64 = call i64 @strcasecmp(i8* %63, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%65 = icmp eq i64 %64, 0
br i1 %65, label %75, label %66
66: ; preds = %62
%67 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%68 = load i8, i8* %67
%69 = call i64 @isdigit(i8 signext %68)
%70 = icmp ne i64 %69, 0
br i1 %70, label %71, label %77
71: ; preds = %66
%72 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%73 = call i32 @atoi(i8* %72)
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %77
75: ; preds = %71, %62, %58, %54, %50, %46
%76 = load i32*, i32** %9
store i32 0, i32* %76
store i32 0, i32* %5
br label %78
77: ; preds = %71, %66
store i32 -1, i32* %5
br label %78
78: ; preds = %77, %75, %44, %18
%79 = load i32, i32* %5
ret i32 %79
}

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