#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 */
char getchar();
int /*<<< orphan*/ keybFlush();
scalar_t__ printf(char *);
int yes() {
  char ch = 'x';
  int res;
  do {
    ch = getchar();
    res = (ch == 'Y' || ch == 'y');
    keybFlush();
  } while (ch != 'y' && ch != 'Y' && ch != 'n' && ch != 'N' &&
           printf("Only (Y)es or (N)o are acceptable: "));
  return res;
}


x86 assembly (clang, -O0):
<yes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x78,-0x1(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x59,%ecx
mov    %al,-0x9(%rbp)
je     1165 <yes+0x35>
movsbl -0x1(%rbp),%eax
cmp    $0x79,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <keybFlush@plt>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x79,%ecx
mov    %al,-0xa(%rbp)
je     11d5 <yes+0xa5>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x59,%ecx
mov    %al,-0xa(%rbp)
je     11d5 <yes+0xa5>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x6e,%ecx
mov    %al,-0xa(%rbp)
je     11d5 <yes+0xa5>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x4e,%ecx
mov    %al,-0xa(%rbp)
je     11d5 <yes+0xa5>
lea    0xe3a(%rip),%rdi
call   1030 <printf@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    113c <yes+0xc>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yes>:
push   %r15
push   %r14
push   %rbx
lea    0xec4(%rip),%r14
movabs $0x80100000801,%r15
jmp    115d <yes+0x2d>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <printf@plt>
test   %rax,%rax
je     117d <yes+0x4d>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <keybFlush@plt>
lea    -0x4e(%rbx),%eax
cmp    $0x2b,%al
ja     1150 <yes+0x20>
movzbl %al,%eax
bt     %rax,%r15
jae    1150 <yes+0x20>
and    $0xdf,%bl
xor    %eax,%eax
cmp    $0x59,%bl
sete   %al
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Only (Y)es or (N)o are acceptable: \00"
define i32 @yes() {
%1 = alloca i8
%2 = alloca i32
store i8 120, i8* %1
br label %3
3: ; preds = %35, %0
%4 = call signext i8 (...) @getchar()
store i8 %4, i8* %1
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 89
br i1 %7, label %12, label %8
8: ; preds = %3
%9 = load i8, i8* %1
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 121
br label %12
12: ; preds = %8, %3
%13 = phi i1 [ true, %3 ], [ %11, %8 ]
%14 = zext i1 %13 to i32
store i32 %14, i32* %2
%15 = call i32 (...) @keybFlush()
br label %16
16: ; preds = %12
%17 = load i8, i8* %1
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 121
br i1 %19, label %20, label %35
20: ; preds = %16
%21 = load i8, i8* %1
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 89
br i1 %23, label %24, label %35
24: ; preds = %20
%25 = load i8, i8* %1
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 110
br i1 %27, label %28, label %35
28: ; preds = %24
%29 = load i8, i8* %1
%30 = sext i8 %29 to i32
%31 = icmp ne i32 %30, 78
br i1 %31, label %32, label %35
32: ; preds = %28
%33 = call i64 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%34 = icmp ne i64 %33, 0
br label %35
35: ; preds = %32, %28, %24, %20, %16
%36 = phi i1 [ false, %28 ], [ false, %24 ], [ false, %20 ], [ false, %16 ], [ %34, %32 ]
br i1 %36, label %3, label %37
37: ; preds = %35
%38 = load i32, i32* %2
ret i32 %38
}

LLVM IR (-O2):
@.str = [36 x i8] c"Only (Y)es or (N)o are acceptable: \00"
define i32 @yes() {
br label %1
1: ; preds = %4, %0
%2 = tail call signext i8 (...) @getchar()
%3 = tail call i32 (...) @keybFlush()
switch i8 %2, label %4 [
i8 121, label %7
i8 110, label %7
i8 89, label %7
i8 78, label %7
]
4: ; preds = %1
%5 = tail call i64 @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %1
7: ; preds = %1, %1, %1, %1, %4
%8 = and i8 %2, -33
%9 = icmp eq i8 %8, 89
%10 = zext i1 %9 to i32
ret i32 %10
}