#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__ equals_ic(char const *, char *);
bool valid_bool_input(char const *s) {
  return (s != NULL) && (equals_ic(s, "yes") || equals_ic(s, "no") ||
                         equals_ic(s, "Y") || equals_ic(s, "N"));
}


x86 assembly (clang, -O0):
<valid_bool_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     11b2 <valid_bool_input+0xa2>
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1030 <equals_ic@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0xa(%rbp)
jne    11ac <valid_bool_input+0x9c>
mov    -0x8(%rbp),%rdi
lea    0xeab(%rip),%rsi
call   1030 <equals_ic@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0xa(%rbp)
jne    11ac <valid_bool_input+0x9c>
mov    -0x8(%rbp),%rdi
lea    0xe8c(%rip),%rsi
call   1030 <equals_ic@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0xa(%rbp)
jne    11ac <valid_bool_input+0x9c>
mov    -0x8(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1030 <equals_ic@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_bool_input>:
push   %rbp
push   %rbx
push   %rax
test   %rdi,%rdi
je     1173 <valid_bool_input+0x63>
mov    %rdi,%rbx
lea    0xede(%rip),%rsi
call   1030 <equals_ic@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    1175 <valid_bool_input+0x65>
lea    0xecc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <equals_ic@plt>
test   %rax,%rax
jne    1175 <valid_bool_input+0x65>
lea    0xebb(%rip),%rsi
mov    %rbx,%rdi
call   1030 <equals_ic@plt>
test   %rax,%rax
jne    1175 <valid_bool_input+0x65>
lea    0xea9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <equals_ic@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
jmp    1175 <valid_bool_input+0x65>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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