#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 uint8_t;

/* Variables and functions */
char readchar();
uint8_t yes_or_no(void) {
  char c;
  do {
    c = readchar();
    if (c == 'Y' || c == 'y' || c == 'J' || c == 'j')
      return 1;
  } while (c != -1 && c != 'N' && c != 'n');
  return 0;
}


x86 assembly (clang, -O0):
<yes_or_no>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <readchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x59,%eax
je     1156 <yes_or_no+0x46>
movsbl -0x5(%rbp),%eax
cmp    $0x79,%eax
je     1156 <yes_or_no+0x46>
movsbl -0x5(%rbp),%eax
cmp    $0x4a,%eax
je     1156 <yes_or_no+0x46>
movsbl -0x5(%rbp),%eax
cmp    $0x6a,%eax
jne    1162 <yes_or_no+0x52>
movl   $0x1,-0x4(%rbp)
jmp    11aa <yes_or_no+0x9a>
jmp    1167 <yes_or_no+0x57>
movsbl -0x5(%rbp),%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
mov    %al,-0x6(%rbp)
je     1198 <yes_or_no+0x88>
movsbl -0x5(%rbp),%ecx
xor    %eax,%eax
cmp    $0x4e,%ecx
mov    %al,-0x6(%rbp)
je     1198 <yes_or_no+0x88>
movsbl -0x5(%rbp),%eax
cmp    $0x6e,%eax
setne  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
test   $0x1,%al
jne    1118 <yes_or_no+0x8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yes_or_no>:
push   %r14
push   %rbx
push   %rax
movabs $0x800100008001,%rbx
movabs $0x1000000010,%r14
jmp    1134 <yes_or_no+0x24>
nopw   0x0(%rax,%rax,1)
cmp    $0xff,%al
je     1152 <yes_or_no+0x42>
xor    %eax,%eax
call   1030 <readchar@plt>
lea    -0x4a(%rax),%ecx
cmp    $0x2f,%cl
ja     1130 <yes_or_no+0x20>
movzbl %cl,%ecx
bt     %rcx,%rbx
jb     1156 <yes_or_no+0x46>
bt     %rcx,%r14
jae    1130 <yes_or_no+0x20>
xor    %eax,%eax
jmp    115b <yes_or_no+0x4b>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @yes_or_no() {
%1 = alloca i32
%2 = alloca i8
br label %3
3: ; preds = %34, %0
%4 = call signext i8 (...) @readchar()
store i8 %4, i8* %2
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 89
br i1 %7, label %20, label %8
8: ; preds = %3
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 121
br i1 %11, label %20, label %12
12: ; preds = %8
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 74
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 106
br i1 %19, label %20, label %21
20: ; preds = %16, %12, %8, %3
store i32 1, i32* %1
br label %37
21: ; preds = %16
br label %22
22: ; preds = %21
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, -1
br i1 %25, label %26, label %34
26: ; preds = %22
%27 = load i8, i8* %2
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 78
br i1 %29, label %30, label %34
30: ; preds = %26
%31 = load i8, i8* %2
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %32, 110
br label %34
34: ; preds = %30, %26, %22
%35 = phi i1 [ false, %26 ], [ false, %22 ], [ %33, %30 ]
br i1 %35, label %3, label %36
36: ; preds = %34
store i32 0, i32* %1
br label %37
37: ; preds = %36, %20
%38 = load i32, i32* %1
ret i32 %38
}

LLVM IR (-O2):
define i32 @yes_or_no() {
br label %1
1: ; preds = %1, %0
%2 = tail call signext i8 (...) @readchar()
switch i8 %2, label %1 [
i8 121, label %3
i8 106, label %3
i8 89, label %3
i8 74, label %3
i8 -1, label %4
i8 110, label %4
i8 78, label %4
]
3: ; preds = %1, %1, %1, %1
br label %4
4: ; preds = %1, %1, %1, %3
%5 = phi i32 [ 1, %3 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ]
ret i32 %5
}