#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 /*<<< orphan*/ addstr(char const *);
int /*<<< orphan*/ clrtoeol();
int getchar();
int /*<<< orphan*/ getyx(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ move(int, int);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ stdscr;
int query(const char *prompt) {
  int c, retval;
  int y, x;
  getyx(stdscr, y, x);
  move((23 - 1), (60 + 2));
  addstr(prompt);
  clrtoeol();
  refresh();
  retval = ((c = getchar()) == 'y' || c == 'Y');
  move((23 - 1), (60 + 2));
  clrtoeol();
  move(y, x);
  return retval;
}


x86 assembly (clang, -O0):
<query>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <getyx@plt>
mov    $0x16,%edi
mov    $0x3e,%esi
call   1080 <move@plt>
mov    -0x8(%rbp),%rdi
call   1070 <addstr@plt>
mov    $0x0,%al
call   1060 <clrtoeol@plt>
mov    $0x0,%al
call   1050 <refresh@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0xc(%rbp)
mov    $0x1,%al
cmp    $0x79,%ecx
mov    %al,-0x19(%rbp)
je     11ca <query+0x6a>
cmpl   $0x59,-0xc(%rbp)
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
mov    $0x16,%edi
mov    $0x3e,%esi
call   1080 <move@plt>
mov    $0x0,%al
call   1060 <clrtoeol@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1080 <move@plt>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<query>:
push   %rbx
mov    %rdi,%rbx
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
call   1030 <getyx@plt>
mov    $0x16,%edi
mov    $0x3e,%esi
call   1080 <move@plt>
mov    %rbx,%rdi
call   1070 <addstr@plt>
xor    %eax,%eax
call   1060 <clrtoeol@plt>
xor    %eax,%eax
call   1050 <refresh@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
and    $0xffffffdf,%eax
xor    %ebx,%ebx
cmp    $0x59,%eax
sete   %bl
mov    $0x16,%edi
mov    $0x3e,%esi
call   1080 <move@plt>
xor    %eax,%eax
call   1060 <clrtoeol@plt>
call   1080 <move@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@stdscr = global i32 0
define i32 @query(i8* %0) {
%2 = load i32, i32* @stdscr
%3 = tail call i32 @getyx(i32 %2, i32 undef, i32 undef)
%4 = tail call i32 @move(i32 22, i32 62)
%5 = tail call i32 @addstr(i8* %0)
%6 = tail call i32 (...) @clrtoeol()
%7 = tail call i32 (...) @refresh()
%8 = tail call i32 (...) @getchar()
%9 = and i32 %8, -33
%10 = icmp eq i32 %9, 89
%11 = zext i1 %10 to i32
%12 = tail call i32 @move(i32 22, i32 62)
%13 = tail call i32 (...) @clrtoeol()
%14 = tail call i32 @move(i32 undef, i32 undef)
ret i32 %11
}