#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 */
int EOF;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int getchar();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int yesno() {
  int c;
  int rv;
  fflush(stderr);
  fflush(stdout);
  c = getchar();
  rv = (c == 'y') || (c == 'Y');
  while (c != EOF && c != '\n')
    c = getchar();
  return rv;
}


x86 assembly (clang, -O0):
<yesno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x79,-0x4(%rbp)
mov    %al,-0x9(%rbp)
je     1167 <yesno+0x47>
cmpl   $0x59,-0x4(%rbp)
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%ecx
xor    %eax,%eax
mov    0x2e6a(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0xa(%rbp)
je     1193 <yesno+0x73>
cmpl   $0xa,-0x4(%rbp)
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    11a3 <yesno+0x83>
jmp    11b2 <yesno+0x92>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x4(%rbp)
jmp    1172 <yesno+0x52>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yesno>:
push   %rbp
push   %rbx
push   %rax
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %eax,%ebp
cmp    $0xa,%eax
je     1170 <yesno+0x50>
mov    0x2e94(%rip),%rbx
cmp    (%rbx),%ebp
je     1170 <yesno+0x50>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%eax
je     1170 <yesno+0x50>
cmp    (%rbx),%eax
jne    1160 <yesno+0x40>
and    $0xffffffdf,%ebp
xor    %eax,%eax
cmp    $0x59,%ebp
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@stdout = global i32 0
@EOF = global i32 0
define i32 @yesno() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @stderr
%4 = call i32 @fflush(i32 %3)
%5 = load i32, i32* @stdout
%6 = call i32 @fflush(i32 %5)
%7 = call i32 (...) @getchar()
store i32 %7, i32* %1
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 121
br i1 %9, label %13, label %10
10: ; preds = %0
%11 = load i32, i32* %1
%12 = icmp eq i32 %11, 89
br label %13
13: ; preds = %10, %0
%14 = phi i1 [ true, %0 ], [ %12, %10 ]
%15 = zext i1 %14 to i32
store i32 %15, i32* %2
br label %16
16: ; preds = %25, %13
%17 = load i32, i32* %1
%18 = load i32, i32* @EOF
%19 = icmp ne i32 %17, %18
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load i32, i32* %1
%22 = icmp ne i32 %21, 10
br label %23
23: ; preds = %20, %16
%24 = phi i1 [ false, %16 ], [ %22, %20 ]
br i1 %24, label %25, label %27
25: ; preds = %23
%26 = call i32 (...) @getchar()
store i32 %26, i32* %1
br label %16
27: ; preds = %23
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
@stderr = global i32 0
@stdout = global i32 0
@EOF = global i32 0
define i32 @yesno() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fflush(i32 %1)
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
%5 = tail call i32 (...) @getchar()
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
%8 = icmp ne i32 %5, 10
%9 = and i1 %8, %7
br i1 %9, label %10, label %16
10: ; preds = %0, %10
%11 = tail call i32 (...) @getchar()
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
%14 = icmp ne i32 %11, 10
%15 = and i1 %14, %13
br i1 %15, label %10, label %16
16: ; preds = %10, %0
%17 = and i32 %5, -33
%18 = icmp eq i32 %17, 89
%19 = zext i1 %18 to i32
ret i32 %19
}