#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 */
typedef int /*<<< orphan*/ Bool;

/* Variables and functions */
int /*<<< orphan*/ False;
int /*<<< orphan*/ True;
scalar_t__ xw_same_string(char *, char *);
Bool xw_parse_bool(char *str, Bool def) {
  if (xw_same_string(str, "true") || xw_same_string(str, "yes") ||
      xw_same_string(str, "t") || xw_same_string(str, "on") ||
      xw_same_string(str, "1"))
    def = True;
  else if (xw_same_string(str, "false") || xw_same_string(str, "no") ||
           xw_same_string(str, "f") || xw_same_string(str, "off") ||
           xw_same_string(str, "0"))
    def = False;
  return def;
}


x86 assembly (clang, -O0):
<xw_parse_bool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed6(%rip),%rsi
call   1030 <xw_same_string@plt>
cmp    $0x0,%rax
jne    11a1 <xw_parse_bool+0x91>
mov    -0x8(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1030 <xw_same_string@plt>
cmp    $0x0,%rax
jne    11a1 <xw_parse_bool+0x91>
mov    -0x8(%rbp),%rdi
lea    0xeab(%rip),%rsi
call   1030 <xw_same_string@plt>
cmp    $0x0,%rax
jne    11a1 <xw_parse_bool+0x91>
mov    -0x8(%rbp),%rdi
lea    0xe93(%rip),%rsi
call   1030 <xw_same_string@plt>
cmp    $0x0,%rax
jne    11a1 <xw_parse_bool+0x91>
mov    -0x8(%rbp),%rdi
lea    0xe7c(%rip),%rsi
call   1030 <xw_same_string@plt>
cmp    $0x0,%rax
je     11b2 <xw_parse_bool+0xa2>
mov    0x2e38(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
jmp    1245 <xw_parse_bool+0x135>
mov    -0x8(%rbp),%rdi
lea    0xe53(%rip),%rsi
call   1030 <xw_same_string@plt>
cmp    $0x0,%rax
jne    1234 <xw_parse_bool+0x124>
mov    -0x8(%rbp),%rdi
lea    0xe3f(%rip),%rsi
call   1030 <xw_same_string@plt>
cmp    $0x0,%rax
jne    1234 <xw_parse_bool+0x124>
mov    -0x8(%rbp),%rdi
lea    0xe2a(%rip),%rsi
call   1030 <xw_same_string@plt>
cmp    $0x0,%rax
jne    1234 <xw_parse_bool+0x124>
mov    -0x8(%rbp),%rdi
lea    0xe0e(%rip),%rsi
call   1030 <xw_same_string@plt>
cmp    $0x0,%rax
jne    1234 <xw_parse_bool+0x124>
mov    -0x8(%rbp),%rdi
lea    0xdf8(%rip),%rsi
call   1030 <xw_same_string@plt>
cmp    $0x0,%rax
je     1240 <xw_parse_bool+0x130>
mov    0x2dad(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
jmp    1245 <xw_parse_bool+0x135>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xw_parse_bool>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
lea    0xee0(%rip),%rsi
call   1030 <xw_same_string@plt>
test   %rax,%rax
jne    117a <xw_parse_bool+0x6a>
lea    0xed4(%rip),%rsi
mov    %r14,%rdi
call   1030 <xw_same_string@plt>
test   %rax,%rax
jne    117a <xw_parse_bool+0x6a>
lea    0xec4(%rip),%rsi
mov    %r14,%rdi
call   1030 <xw_same_string@plt>
test   %rax,%rax
jne    117a <xw_parse_bool+0x6a>
lea    0xeb2(%rip),%rsi
mov    %r14,%rdi
call   1030 <xw_same_string@plt>
test   %rax,%rax
jne    117a <xw_parse_bool+0x6a>
lea    0xea1(%rip),%rsi
mov    %r14,%rdi
call   1030 <xw_same_string@plt>
test   %rax,%rax
je     118d <xw_parse_bool+0x7d>
mov    0x2e5f(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe7c(%rip),%rsi
mov    %r14,%rdi
call   1030 <xw_same_string@plt>
test   %rax,%rax
jne    11f1 <xw_parse_bool+0xe1>
lea    0xe6e(%rip),%rsi
mov    %r14,%rdi
call   1030 <xw_same_string@plt>
test   %rax,%rax
jne    11f1 <xw_parse_bool+0xe1>
lea    0xe5f(%rip),%rsi
mov    %r14,%rdi
call   1030 <xw_same_string@plt>
test   %rax,%rax
jne    11f1 <xw_parse_bool+0xe1>
lea    0xe49(%rip),%rsi
mov    %r14,%rdi
call   1030 <xw_same_string@plt>
test   %rax,%rax
jne    11f1 <xw_parse_bool+0xe1>
lea    0xe39(%rip),%rsi
mov    %r14,%rdi
call   1030 <xw_same_string@plt>
test   %rax,%rax
je     1183 <xw_parse_bool+0x73>
mov    0x2df0(%rip),%rax
jmp    1181 <xw_parse_bool+0x71>

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

LLVM IR (-O2):
@.str = [5 x i8] c"true\00"
@.str.1 = [4 x i8] c"yes\00"
@.str.2 = [2 x i8] c"t\00"
@.str.3 = [3 x i8] c"on\00"
@.str.4 = [2 x i8] c"1\00"
@True = global i32 0
@.str.5 = [6 x i8] c"false\00"
@.str.6 = [3 x i8] c"no\00"
@.str.7 = [2 x i8] c"f\00"
@.str.8 = [4 x i8] c"off\00"
@.str.9 = [2 x i8] c"0\00"
@False = global i32 0
define i32 @xw_parse_bool(i8* %0, i32 %1) {
%3 = tail call i64 @xw_same_string(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %17
5: ; preds = %2
%6 = tail call i64 @xw_same_string(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = tail call i64 @xw_same_string(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = tail call i64 @xw_same_string(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = tail call i64 @xw_same_string(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %14, %11, %8, %5, %2
%18 = load i32, i32* @True
br label %36
19: ; preds = %14
%20 = tail call i64 @xw_same_string(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %34
22: ; preds = %19
%23 = tail call i64 @xw_same_string(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %34
25: ; preds = %22
%26 = tail call i64 @xw_same_string(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %34
28: ; preds = %25
%29 = tail call i64 @xw_same_string(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = tail call i64 @xw_same_string(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %31, %28, %25, %22, %19
%35 = load i32, i32* @False
br label %36
36: ; preds = %31, %34, %17
%37 = phi i32 [ %18, %17 ], [ %35, %34 ], [ %1, %31 ]
ret i32 %37
}