#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(char const *, char const *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int config_get_boolean(const char *section, const char *name, int value) {
  char *s;
  if (value)
    s = "yes";
  else
    s = "no";
  s = config_get(section, name, s);
  if (!s)
    return value;
  if (!strcmp(s, "yes"))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<config_get_boolean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     114d <config_get_boolean+0x2d>
lea    0xebc(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1158 <config_get_boolean+0x38>
lea    0xeb0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <config_get@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1183 <config_get_boolean+0x63>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11af <config_get_boolean+0x8f>
mov    -0x28(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11a8 <config_get_boolean+0x88>
movl   $0x1,-0x4(%rbp)
jmp    11af <config_get_boolean+0x8f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_get_boolean>:
push   %rbx
mov    %edx,%ebx
test   %edx,%edx
lea    0xed8(%rip),%rax
lea    0xecd(%rip),%rdx
cmove  %rax,%rdx
call   1030 <config_get@plt>
test   %rax,%rax
je     1157 <config_get_boolean+0x37>
lea    0xeb8(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcmp@plt>
xor    %ebx,%ebx
test   %eax,%eax
sete   %bl
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"yes\00"
@.str.1 = [3 x i8] c"no\00"
define i32 @config_get_boolean(i8* %0, i8* %1, i32 %2) {
%4 = icmp eq i32 %2, 0
%5 = select i1 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
%6 = tail call i8* @config_get(i8* %0, i8* %1, i8* %5)
%7 = icmp eq i8* %6, null
br i1 %7, label %12, label %8
8: ; preds = %3
%9 = tail call i32 @strcmp(i8* %6, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %8, %3
%13 = phi i32 [ %2, %3 ], [ %11, %8 ]
ret i32 %13
}