#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 */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ ACS_HLINE;
int /*<<< orphan*/ ACS_VLINE;
int /*<<< orphan*/ COLOR_PAIR(int);
int /*<<< orphan*/ box(int /*<<< orphan*/ *, int /*<<< orphan*/,
                       int /*<<< orphan*/);
int /*<<< orphan*/ delwin(int /*<<< orphan*/ *);
int /*<<< orphan*/ *newwin(int, int, int, int);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ wbkgd(int /*<<< orphan*/ *, int /*<<< orphan*/);
int wgetch(int /*<<< orphan*/ *);
int /*<<< orphan*/ wmove(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ wprintw(int /*<<< orphan*/ *, char *);
int check_quit() {
  WINDOW *check;
  int key;
  check = newwin(3, 40, 5, 10);
  wmove(check, 1, 2);
  wprintw(check, "Exit program (y/n) ? ");
  wbkgd(check, COLOR_PAIR(2));
  box(check, ACS_VLINE, ACS_HLINE);
  refresh();
  key = wgetch(check);
  delwin(check);
  if (key == 'y')
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<check_quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x3,%edi
mov    $0x28,%esi
mov    $0x5,%edx
mov    $0xa,%ecx
call   1040 <newwin@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
call   10b0 <wmove@plt>
mov    -0x10(%rbp),%rdi
lea    0xe2d(%rip),%rsi
call   1080 <wprintw@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0x2,%edi
call   1070 <COLOR_PAIR@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1030 <wbkgd@plt>
mov    -0x10(%rbp),%rdi
mov    0x2dd8(%rip),%rax
mov    (%rax),%esi
mov    0x2dd7(%rip),%rax
mov    (%rax),%edx
call   1050 <box@plt>
mov    $0x0,%al
call   1090 <refresh@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <wgetch@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <delwin@plt>
cmpl   $0x79,-0x14(%rbp)
jne    1242 <check_quit+0xb2>
movl   $0x1,-0x4(%rbp)
jmp    1249 <check_quit+0xb9>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_quit>:
push   %rbp
push   %rbx
push   %rax
mov    $0x3,%edi
mov    $0x28,%esi
mov    $0x5,%edx
mov    $0xa,%ecx
call   1040 <newwin@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x1,%esi
mov    $0x2,%edx
call   10b0 <wmove@plt>
lea    0xe38(%rip),%rsi
mov    %rbx,%rdi
call   1080 <wprintw@plt>
mov    $0x2,%edi
call   1070 <COLOR_PAIR@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <wbkgd@plt>
mov    0x2ded(%rip),%rax
mov    (%rax),%esi
mov    0x2dec(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
call   1050 <box@plt>
xor    %eax,%eax
call   1090 <refresh@plt>
mov    %rbx,%rdi
call   10a0 <wgetch@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <delwin@plt>
xor    %eax,%eax
cmp    $0x79,%ebp
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Exit program (y/n) ? \00"
@ACS_VLINE = global i32 0
@ACS_HLINE = global i32 0
define i32 @check_quit() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = call i32* @newwin(i32 3, i32 40, i32 5, i32 10)
store i32* %4, i32** %2
%5 = load i32*, i32** %2
%6 = call i32 @wmove(i32* %5, i32 1, i32 2)
%7 = load i32*, i32** %2
%8 = call i32 @wprintw(i32* %7, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%9 = load i32*, i32** %2
%10 = call i32 @COLOR_PAIR(i32 2)
%11 = call i32 @wbkgd(i32* %9, i32 %10)
%12 = load i32*, i32** %2
%13 = load i32, i32* @ACS_VLINE
%14 = load i32, i32* @ACS_HLINE
%15 = call i32 @box(i32* %12, i32 %13, i32 %14)
%16 = call i32 (...) @refresh()
%17 = load i32*, i32** %2
%18 = call i32 @wgetch(i32* %17)
store i32 %18, i32* %3
%19 = load i32*, i32** %2
%20 = call i32 @delwin(i32* %19)
%21 = load i32, i32* %3
%22 = icmp eq i32 %21, 121
br i1 %22, label %23, label %24
23: ; preds = %0
store i32 1, i32* %1
br label %25
24: ; preds = %0
store i32 0, i32* %1
br label %25
25: ; preds = %24, %23
%26 = load i32, i32* %1
ret i32 %26
}

LLVM IR (-O2):
@.str = [22 x i8] c"Exit program (y/n) ? \00"
@ACS_VLINE = global i32 0
@ACS_HLINE = global i32 0
define i32 @check_quit() {
%1 = tail call i32* @newwin(i32 3, i32 40, i32 5, i32 10)
%2 = tail call i32 @wmove(i32* %1, i32 1, i32 2)
%3 = tail call i32 @wprintw(i32* %1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @COLOR_PAIR(i32 2)
%5 = tail call i32 @wbkgd(i32* %1, i32 %4)
%6 = load i32, i32* @ACS_VLINE
%7 = load i32, i32* @ACS_HLINE
%8 = tail call i32 @box(i32* %1, i32 %6, i32 %7)
%9 = tail call i32 (...) @refresh()
%10 = tail call i32 @wgetch(i32* %1)
%11 = tail call i32 @delwin(i32* %1)
%12 = icmp eq i32 %10, 121
%13 = zext i1 %12 to i32
ret i32 %13
}