#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 */
scalar_t__ parseBool(char *);
int /*<<< orphan*/ printf(char *);
bool testParseBool(void) {
  if (!parseBool("true")) {
    printf("'true' is not true\n");
    return false;
  }
  if (!parseBool("True")) {
    printf("'True' is not true\n");
    return false;
  }
  if (!parseBool("TRUE")) {
    printf("'TRUE' is not true\n");
    return false;
  }
  if (parseBool("false")) {
    printf("'false' is not false\n");
    return false;
  }
  if (parseBool("blort")) {
    printf("'blort' is not false\n");
    return false;
  }
  if (parseBool("")) {
    printf("'' is not false\n");
    return false;
  }
  if (parseBool(NULL)) {
    printf("NULL is not false\n");
    return false;
  }
  if (parseBool(0)) {
    printf("0 is not false\n");
    return false;
  }
  return true;
}


x86 assembly (clang, -O0):
<testParseBool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1040 <parseBool@plt>
cmp    $0x0,%rax
jne    1156 <testParseBool+0x36>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1299 <testParseBool+0x179>
lea    0xebc(%rip),%rdi
call   1040 <parseBool@plt>
cmp    $0x0,%rax
jne    1184 <testParseBool+0x64>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1299 <testParseBool+0x179>
lea    0xea7(%rip),%rdi
call   1040 <parseBool@plt>
cmp    $0x0,%rax
jne    11b2 <testParseBool+0x92>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1299 <testParseBool+0x179>
lea    0xe92(%rip),%rdi
call   1040 <parseBool@plt>
cmp    $0x0,%rax
je     11e0 <testParseBool+0xc0>
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1299 <testParseBool+0x179>
lea    0xe80(%rip),%rdi
call   1040 <parseBool@plt>
cmp    $0x0,%rax
je     120e <testParseBool+0xee>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1299 <testParseBool+0x179>
lea    0xe7e(%rip),%rdi
call   1040 <parseBool@plt>
cmp    $0x0,%rax
je     123c <testParseBool+0x11c>
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1299 <testParseBool+0x179>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <parseBool@plt>
cmp    $0x0,%rax
je     1267 <testParseBool+0x147>
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1299 <testParseBool+0x179>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <parseBool@plt>
cmp    $0x0,%rax
je     1292 <testParseBool+0x172>
lea    0xe26(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1299 <testParseBool+0x179>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testParseBool>:
push   %rax
lea    0xf1c(%rip),%rdi
call   1040 <parseBool@plt>
test   %rax,%rax
je     116e <testParseBool+0x4e>
lea    0xec7(%rip),%rdi
call   1040 <parseBool@plt>
test   %rax,%rax
je     1177 <testParseBool+0x57>
lea    0xebb(%rip),%rdi
call   1040 <parseBool@plt>
test   %rax,%rax
je     1180 <testParseBool+0x60>
lea    0xf19(%rip),%rdi
call   1040 <parseBool@plt>
test   %rax,%rax
je     1189 <testParseBool+0x69>
lea    0xf23(%rip),%rdi
jmp    11e5 <testParseBool+0xc5>
lea    0xe9b(%rip),%rdi
jmp    11e5 <testParseBool+0xc5>
lea    0xea5(%rip),%rdi
jmp    11e5 <testParseBool+0xc5>
lea    0xeaf(%rip),%rdi
jmp    11e5 <testParseBool+0xc5>
lea    0xe7a(%rip),%rdi
call   1040 <parseBool@plt>
test   %rax,%rax
je     11a3 <testParseBool+0x83>
lea    0xed9(%rip),%rdi
jmp    11e5 <testParseBool+0xc5>
lea    0xe5f(%rip),%rdi
call   1040 <parseBool@plt>
test   %rax,%rax
je     11bd <testParseBool+0x9d>
lea    0xeaf(%rip),%rdi
jmp    11e5 <testParseBool+0xc5>
xor    %edi,%edi
call   1040 <parseBool@plt>
test   %rax,%rax
je     11d2 <testParseBool+0xb2>
lea    0xe88(%rip),%rdi
jmp    11e5 <testParseBool+0xc5>
xor    %edi,%edi
call   1040 <parseBool@plt>
test   %rax,%rax
je     11ee <testParseBool+0xce>
lea    0xe64(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"true\00"
@.str.1 = [20 x i8] c"'true' is not true\0A\00"
@.str.2 = [5 x i8] c"True\00"
@.str.3 = [20 x i8] c"'True' is not true\0A\00"
@.str.4 = [5 x i8] c"TRUE\00"
@.str.5 = [20 x i8] c"'TRUE' is not true\0A\00"
@.str.6 = [6 x i8] c"false\00"
@.str.7 = [22 x i8] c"'false' is not false\0A\00"
@.str.8 = [6 x i8] c"blort\00"
@.str.9 = [22 x i8] c"'blort' is not false\0A\00"
@.str.10 = [1 x i8] zeroinitializer
@.str.11 = [17 x i8] c"'' is not false\0A\00"
@.str.12 = [19 x i8] c"NULL is not false\0A\00"
@.str.13 = [16 x i8] c"0 is not false\0A\00"
define i32 @testParseBool() {
%1 = alloca i32
%2 = call i64 @parseBool(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp ne i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %42
6: ; preds = %0
%7 = call i64 @parseBool(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp ne i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %42
11: ; preds = %6
%12 = call i64 @parseBool(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%13 = icmp ne i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %1
br label %42
16: ; preds = %11
%17 = call i64 @parseBool(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %1
br label %42
21: ; preds = %16
%22 = call i64 @parseBool(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %1
br label %42
26: ; preds = %21
%27 = call i64 @parseBool(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.10, i64 0, i64 0))
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %1
br label %42
31: ; preds = %26
%32 = call i64 @parseBool(i8* null)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0))
store i32 0, i32* %1
br label %42
36: ; preds = %31
%37 = call i64 @parseBool(i8* null)
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0))
store i32 0, i32* %1
br label %42
41: ; preds = %36
store i32 1, i32* %1
br label %42
42: ; preds = %41, %39, %34, %29, %24, %19, %14, %9, %4
%43 = load i32, i32* %1
ret i32 %43
}

LLVM IR (-O2):
@.str = [5 x i8] c"true\00"
@.str.2 = [5 x i8] c"True\00"
@.str.4 = [5 x i8] c"TRUE\00"
@.str.6 = [6 x i8] c"false\00"
@.str.8 = [6 x i8] c"blort\00"
@.str.10 = [1 x i8] zeroinitializer
@str = [19 x i8] c"'true' is not true\00"
@str.14 = [19 x i8] c"'True' is not true\00"
@str.15 = [19 x i8] c"'TRUE' is not true\00"
@str.16 = [15 x i8] c"0 is not false\00"
@str.17 = [18 x i8] c"NULL is not false\00"
@str.18 = [16 x i8] c"'' is not false\00"
@str.19 = [21 x i8] c"'blort' is not false\00"
@str.20 = [21 x i8] c"'false' is not false\00"
define i32 @testParseBool() {
%1 = tail call i64 @parseBool(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
br i1 %2, label %24, label %3
3: ; preds = %0
%4 = tail call i64 @parseBool(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %24, label %6
6: ; preds = %3
%7 = tail call i64 @parseBool(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %24, label %9
9: ; preds = %6
%10 = tail call i64 @parseBool(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %24
12: ; preds = %9
%13 = tail call i64 @parseBool(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %24
15: ; preds = %12
%16 = tail call i64 @parseBool(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.10, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = tail call i64 @parseBool(i8* null)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = tail call i64 @parseBool(i8* null)
%23 = icmp eq i64 %22, 0
br i1 %23, label %27, label %24
24: ; preds = %21, %18, %15, %12, %9, %6, %3, %0
%25 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0), %0 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.14, i64 0, i64 0), %3 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.15, i64 0, i64 0), %6 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @str.20, i64 0, i64 0), %9 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @str.19, i64 0, i64 0), %12 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.18, i64 0, i64 0), %15 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @str.17, i64 0, i64 0), %18 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.16, i64 0, i64 0), %21 ]
%26 = tail call i32 @puts(i8* dereferenceable(1) %25)
br label %27
27: ; preds = %24, %21
%28 = phi i32 [ 1, %21 ], [ 0, %24 ]
ret i32 %28
}