#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 */
struct tiniparser_dictionary {
  int dummy;
};

/* Variables and functions */
char *tiniparser_getstring(struct tiniparser_dictionary *, char const *,
                           int /*<<< orphan*/ *);
bool tiniparser_getboolean(struct tiniparser_dictionary *d, const char *key,
                           bool default_value) {
  const char *value = tiniparser_getstring(d, key, NULL);
  if (value == NULL) {
    return default_value;
  }
  switch (value[0]) {
  case '1':
  case 'T':
  case 't':
  case 'y':
  case 'Y':
    return true;
  case '0':
  case 'F':
  case 'f':
  case 'n':
  case 'N':
    return false;
  default:
    break;
  }
  return default_value;
}


x86 assembly (clang, -O0):
<tiniparser_getboolean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <tiniparser_getstring@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    114e <tiniparser_getboolean+0x3e>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    119e <tiniparser_getboolean+0x8e>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
add    $0xffffffd0,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x49,%eax
ja     1193 <tiniparser_getboolean+0x83>
mov    -0x30(%rbp),%rax
lea    0xe8e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    119e <tiniparser_getboolean+0x8e>
movl   $0x0,-0x4(%rbp)
jmp    119e <tiniparser_getboolean+0x8e>
jmp    1198 <tiniparser_getboolean+0x88>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tiniparser_getboolean>:
push   %rbx
mov    %edx,%ebx
xor    %edx,%edx
call   1030 <tiniparser_getstring@plt>
test   %rax,%rax
je     1143 <tiniparser_getboolean+0x33>
movsbl (%rax),%ecx
add    $0xffffffd0,%ecx
cmp    $0x49,%ecx
ja     1143 <tiniparser_getboolean+0x33>
mov    $0x1,%eax
lea    0xeca(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
xor    %eax,%eax
pop    %rbx
ret
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.tiniparser_dictionary = type { i32 }
define i32 @tiniparser_getboolean(%struct.tiniparser_dictionary* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.tiniparser_dictionary*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store %struct.tiniparser_dictionary* %0, %struct.tiniparser_dictionary** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%9 = load %struct.tiniparser_dictionary*, %struct.tiniparser_dictionary** %5
%10 = load i8*, i8** %6
%11 = call i8* @tiniparser_getstring(%struct.tiniparser_dictionary* %9, i8* %10, i32* null)
store i8* %11, i8** %8
%12 = load i8*, i8** %8
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = load i32, i32* %7
store i32 %15, i32* %4
br label %26
16: ; preds = %3
%17 = load i8*, i8** %8
%18 = getelementptr inbounds i8, i8* %17, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
switch i32 %20, label %23 [
i32 49, label %21
i32 84, label %21
i32 116, label %21
i32 121, label %21
i32 89, label %21
i32 48, label %22
i32 70, label %22
i32 102, label %22
i32 110, label %22
i32 78, label %22
]
21: ; preds = %16, %16, %16, %16, %16
store i32 1, i32* %4
br label %26
22: ; preds = %16, %16, %16, %16, %16
store i32 0, i32* %4
br label %26
23: ; preds = %16
br label %24
24: ; preds = %23
%25 = load i32, i32* %7
store i32 %25, i32* %4
br label %26
26: ; preds = %24, %22, %21, %14
%27 = load i32, i32* %4
ret i32 %27
}

LLVM IR (-O2):
%struct.tiniparser_dictionary = type { i32 }
define i32 @tiniparser_getboolean(%struct.tiniparser_dictionary* %0, i8* %1, i32 %2) {
%4 = tail call i8* @tiniparser_getstring(%struct.tiniparser_dictionary* %0, i8* %1, i32* null)
%5 = icmp eq i8* %4, null
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
switch i32 %8, label %10 [
i32 49, label %11
i32 84, label %11
i32 116, label %11
i32 121, label %11
i32 89, label %11
i32 48, label %9
i32 70, label %9
i32 102, label %9
i32 110, label %9
i32 78, label %9
]
9: ; preds = %6, %6, %6, %6, %6
br label %11
10: ; preds = %6
br label %11
11: ; preds = %6, %6, %6, %6, %6, %3, %10, %9
%12 = phi i32 [ %2, %10 ], [ 0, %9 ], [ %2, %3 ], [ 1, %6 ], [ 1, %6 ], [ 1, %6 ], [ 1, %6 ], [ 1, %6 ]
ret i32 %12
}