#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*/ addch(char);
int /*<<< orphan*/ curs_set(int);
char getch();
int /*<<< orphan*/ mvprintw(int, int, char *);
int iscorrect(int y, int x) {
  char c;
  curs_set(1);
  mvprintw(y, x, "Is this correct (y/n): ");
  for (;;) {
    c = getch();
    if (c == 'y') {
      addch('y');
      return 1;
    } else if (c == 'n') {
      addch('n');
      return 0;
    }
  }
}


x86 assembly (clang, -O0):
<iscorrect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x1,%edi
call   1050 <curs_set@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
lea    0xe9b(%rip),%rdx
call   1060 <mvprintw@plt>
mov    $0x0,%al
call   1040 <getch@plt>
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
cmp    $0x79,%eax
jne    1197 <iscorrect+0x57>
mov    $0x79,%edi
call   1030 <addch@plt>
movl   $0x1,-0x4(%rbp)
jmp    11c4 <iscorrect+0x84>
movsbl -0xd(%rbp),%eax
cmp    $0x6e,%eax
jne    11ba <iscorrect+0x7a>
mov    $0x6e,%edi
call   1030 <addch@plt>
movl   $0x0,-0x4(%rbp)
jmp    11c4 <iscorrect+0x84>
jmp    11bf <iscorrect+0x7f>
jmp    116a <iscorrect+0x2a>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iscorrect>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x1,%edi
call   1050 <curs_set@plt>
lea    0xea8(%rip),%rdx
mov    %ebp,%edi
mov    %ebx,%esi
call   1060 <mvprintw@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getch@plt>
cmp    $0x79,%al
je     1183 <iscorrect+0x43>
cmp    $0x6e,%al
jne    1170 <iscorrect+0x30>
xor    %ebx,%ebx
jmp    1188 <iscorrect+0x48>
mov    $0x1,%ebx
movsbl %al,%edi
call   1030 <addch@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Is this correct (y/n): \00"
define i32 @iscorrect(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = call i32 @curs_set(i32 1)
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = call i32 @mvprintw(i32 %8, i32 %9, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %25, %2
%12 = call signext i8 (...) @getch()
store i8 %12, i8* %6
%13 = load i8, i8* %6
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 121
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = call i32 @addch(i8 signext 121)
store i32 1, i32* %3
br label %26
18: ; preds = %11
%19 = load i8, i8* %6
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 110
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 @addch(i8 signext 110)
store i32 0, i32* %3
br label %26
24: ; preds = %18
br label %25
25: ; preds = %24
br label %11
26: ; preds = %22, %16
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [24 x i8] c"Is this correct (y/n): \00"
define i32 @iscorrect(i32 %0, i32 %1) {
%3 = tail call i32 @curs_set(i32 1)
%4 = tail call i32 @mvprintw(i32 %0, i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %5, %2
%6 = tail call signext i8 (...) @getch()
switch i8 %6, label %5 [
i8 121, label %8
i8 110, label %7
]
7: ; preds = %5
br label %8
8: ; preds = %5, %7
%9 = phi i32 [ 0, %7 ], [ 1, %5 ]
%10 = tail call i32 @addch(i8 signext %6)
ret i32 %9
}