#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*/ delwin(int /*<<< orphan*/ *);
int /*<<< orphan*/ mvwaddstr(int /*<<< orphan*/ *, int, int, char *);
int /*<<< orphan*/ touchwin(int /*<<< orphan*/ *);
char wgetch(int /*<<< orphan*/ *);
int /*<<< orphan*/ wmove(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
void PressSpace(WINDOW *back_win, WINDOW *cur_win, int y, int x, int sy,
                int sx) {
  mvwaddstr(cur_win, sy, sx, "--press space--");
  wrefresh(cur_win);
  while (wgetch(cur_win) != ' ')
    ;
  delwin(cur_win);
  wmove(back_win, y, x);
  touchwin(back_win);
  wrefresh(back_win);
}


x86 assembly (clang, -O0):
<PressSpace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xe71(%rip),%rcx
call   1080 <mvwaddstr@plt>
mov    -0x10(%rbp),%rdi
call   1040 <wrefresh@plt>
mov    -0x10(%rbp),%rdi
call   1060 <wgetch@plt>
movsbl %al,%eax
cmp    $0x20,%eax
je     11b7 <PressSpace+0x57>
jmp    119d <PressSpace+0x3d>
mov    -0x10(%rbp),%rdi
call   1050 <delwin@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1070 <wmove@plt>
mov    -0x8(%rbp),%rdi
call   1030 <touchwin@plt>
mov    -0x8(%rbp),%rdi
call   1040 <wrefresh@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PressSpace>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %rsi,%rbp
mov    %rdi,%rbx
lea    0xe86(%rip),%rcx
mov    %rsi,%rdi
mov    %r8d,%esi
mov    %r9d,%edx
call   1080 <mvwaddstr@plt>
mov    %rbp,%rdi
call   1040 <wrefresh@plt>
mov    %rbp,%rdi
call   1060 <wgetch@plt>
cmp    $0x20,%al
jne    1190 <PressSpace+0x30>
mov    %rbp,%rdi
call   1050 <delwin@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
call   1070 <wmove@plt>
mov    %rbx,%rdi
call   1030 <touchwin@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <wrefresh@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"--press space--\00"
define void @PressSpace(i32* %0, i32* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32* %0, i32** %7
store i32* %1, i32** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load i32*, i32** %8
%14 = load i32, i32* %11
%15 = load i32, i32* %12
%16 = call i32 @mvwaddstr(i32* %13, i32 %14, i32 %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%17 = load i32*, i32** %8
%18 = call i32 @wrefresh(i32* %17)
br label %19
19: ; preds = %24, %6
%20 = load i32*, i32** %8
%21 = call signext i8 @wgetch(i32* %20)
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 32
br i1 %23, label %24, label %25
24: ; preds = %19
br label %19
25: ; preds = %19
%26 = load i32*, i32** %8
%27 = call i32 @delwin(i32* %26)
%28 = load i32*, i32** %7
%29 = load i32, i32* %9
%30 = load i32, i32* %10
%31 = call i32 @wmove(i32* %28, i32 %29, i32 %30)
%32 = load i32*, i32** %7
%33 = call i32 @touchwin(i32* %32)
%34 = load i32*, i32** %7
%35 = call i32 @wrefresh(i32* %34)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"--press space--\00"
define void @PressSpace(i32* %0, i32* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @mvwaddstr(i32* %1, i32 %4, i32 %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @wrefresh(i32* %1)
br label %9
9: ; preds = %9, %6
%10 = tail call signext i8 @wgetch(i32* %1)
%11 = icmp eq i8 %10, 32
br i1 %11, label %12, label %9
12: ; preds = %9
%13 = tail call i32 @delwin(i32* %1)
%14 = tail call i32 @wmove(i32* %0, i32 %2, i32 %3)
%15 = tail call i32 @touchwin(i32* %0)
%16 = tail call i32 @wrefresh(i32* %0)
ret void
}