#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*/ kbhit();
int /*<<< orphan*/ strchr(char *, char);
unsigned char wait_answer(void) {
  char c;
  do {
    while (!kbhit())
      ;
    c = getchar();
  } while (!strchr("yYtTnN", c));
  return !(c == 'N' || c == 'n');
}


x86 assembly (clang, -O0):
<wait_answer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
jmp    113d <wait_answer+0xd>
mov    $0x0,%al
call   1040 <kbhit@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1159 <wait_answer+0x29>
jmp    115e <wait_answer+0x2e>
jmp    113d <wait_answer+0xd>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x1(%rbp)
lea    0xe91(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <strchr@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1138 <wait_answer+0x8>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x4e,%ecx
mov    %al,-0x2(%rbp)
je     11a7 <wait_answer+0x77>
movsbl -0x1(%rbp),%eax
cmp    $0x6e,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_answer>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%r14
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <kbhit@plt>
test   %eax,%eax
je     1140 <wait_answer+0x10>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <strchr@plt>
test   %eax,%eax
je     1140 <wait_answer+0x10>
and    $0xdf,%bl
cmp    $0x4e,%bl
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"yYtTnN\00"
define zeroext i8 @wait_answer() {
%1 = alloca i8
br label %2
2: ; preds = %10, %0
br label %3
3: ; preds = %7, %2
%4 = call i32 (...) @kbhit()
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
%9 = call signext i8 (...) @getchar()
store i8 %9, i8* %1
br label %10
10: ; preds = %8
%11 = load i8, i8* %1
%12 = call i32 @strchr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 signext %11)
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
br i1 %14, label %2, label %15
15: ; preds = %10
%16 = load i8, i8* %1
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 78
br i1 %18, label %23, label %19
19: ; preds = %15
%20 = load i8, i8* %1
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 110
br label %23
23: ; preds = %19, %15
%24 = phi i1 [ true, %15 ], [ %22, %19 ]
%25 = xor i1 %24, true
%26 = zext i1 %25 to i32
%27 = trunc i32 %26 to i8
ret i8 %27
}

LLVM IR (-O2):
@.str = [7 x i8] c"yYtTnN\00"
define zeroext i8 @wait_answer() {
br label %1
1: ; preds = %4, %0
%2 = tail call i32 (...) @kbhit()
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %1, %5
br label %1
5: ; preds = %1
%6 = tail call signext i8 (...) @getchar()
%7 = tail call i32 @strchr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 signext %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %4, label %9
9: ; preds = %5
%10 = and i8 %6, -33
%11 = icmp ne i8 %10, 78
%12 = zext i1 %11 to i8
ret i8 %12
}