#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 COLS;
int /*<<< orphan*/ mvwaddstr(int /*<<< orphan*/ *, int, int, char *);
int /*<<< orphan*/ werase(int /*<<< orphan*/ *);
char wgetch(int /*<<< orphan*/ *);
void Introduction(WINDOW *screen) {
  werase(screen);
  mvwaddstr(screen, 2, (COLS - sizeof("Lunar Lander")) / 2, "Lunar Lander");
  mvwaddstr(screen, 5,
            (COLS - sizeof("The classic arcade game comes to Unix.")) / 2,
            "The classic arcade game comes to Unix.");
  mvwaddstr(screen, 9, (COLS - sizeof("Controls:")) / 2, "Controls:");
  mvwaddstr(screen, 11, (COLS - sizeof("'0'-'9' - power level")) / 2,
            "'0'-'9' - power level");
  mvwaddstr(screen, 12,
            (COLS - sizeof("'z' - set left retro rocket to power level")) / 2,
            "'z' - set left retro rocket to power level");
  mvwaddstr(screen, 13,
            (COLS - sizeof("'x' - set vertical thrust to power level")) / 2,
            "'x' - set vertical thrust to power level");
  mvwaddstr(screen, 14,
            (COLS - sizeof("'c' - set right retro to power level")) / 2,
            "'c' - set right retro to power level");
  mvwaddstr(screen, 18, (COLS - sizeof("Stacey Campbell at HCR, 1989")) / 2,
            "Stacey Campbell at HCR, 1989");
  mvwaddstr(screen, 20, (COLS - sizeof("--press space to start game--")) / 2,
            "--press space to start game--");
  while (wgetch(screen) != ' ')
    ;
}


x86 assembly (clang, -O0):
<Introduction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <werase@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e98(%rip),%rax
movslq (%rax),%rax
sub    $0xd,%rax
shr    $0x1,%rax
mov    %eax,%edx
mov    $0x2,%esi
lea    0xe97(%rip),%rcx
call   1040 <mvwaddstr@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e6f(%rip),%rax
movslq (%rax),%rax
sub    $0x27,%rax
shr    $0x1,%rax
mov    %eax,%edx
mov    $0x5,%esi
lea    0xe7b(%rip),%rcx
call   1040 <mvwaddstr@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e46(%rip),%rax
movslq (%rax),%rax
sub    $0xa,%rax
shr    $0x1,%rax
mov    %eax,%edx
mov    $0x9,%esi
lea    0xe79(%rip),%rcx
call   1040 <mvwaddstr@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e1d(%rip),%rax
movslq (%rax),%rax
sub    $0x16,%rax
shr    $0x1,%rax
mov    %eax,%edx
mov    $0xb,%esi
lea    0xe5a(%rip),%rcx
call   1040 <mvwaddstr@plt>
mov    -0x8(%rbp),%rdi
mov    0x2df4(%rip),%rax
movslq (%rax),%rax
sub    $0x2b,%rax
shr    $0x1,%rax
mov    %eax,%edx
mov    $0xc,%esi
lea    0xe47(%rip),%rcx
call   1040 <mvwaddstr@plt>
mov    -0x8(%rbp),%rdi
mov    0x2dcb(%rip),%rax
movslq (%rax),%rax
sub    $0x29,%rax
shr    $0x1,%rax
mov    %eax,%edx
mov    $0xd,%esi
lea    0xe49(%rip),%rcx
call   1040 <mvwaddstr@plt>
mov    -0x8(%rbp),%rdi
mov    0x2da2(%rip),%rax
movslq (%rax),%rax
sub    $0x25,%rax
shr    $0x1,%rax
mov    %eax,%edx
mov    $0xe,%esi
lea    0xe49(%rip),%rcx
call   1040 <mvwaddstr@plt>
mov    -0x8(%rbp),%rdi
mov    0x2d79(%rip),%rax
movslq (%rax),%rax
sub    $0x1d,%rax
shr    $0x1,%rax
mov    %eax,%edx
mov    $0x12,%esi
lea    0xe45(%rip),%rcx
call   1040 <mvwaddstr@plt>
mov    -0x8(%rbp),%rdi
mov    0x2d50(%rip),%rax
movslq (%rax),%rax
sub    $0x1e,%rax
shr    $0x1,%rax
mov    %eax,%edx
mov    $0x14,%esi
lea    0xe39(%rip),%rcx
call   1040 <mvwaddstr@plt>
mov    -0x8(%rbp),%rdi
call   1030 <wgetch@plt>
movsbl %al,%eax
cmp    $0x20,%eax
je     12d0 <Introduction+0x1a0>
jmp    12b6 <Introduction+0x186>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Introduction>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1050 <werase@plt>
mov    0x2ea4(%rip),%r14
movslq (%r14),%rax
movabs $0x1ffffffd5,%r15
lea    (%rax,%r15,1),%rdx
add    $0x1e,%rdx
shr    %rdx
lea    0xe9d(%rip),%rcx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <mvwaddstr@plt>
movslq (%r14),%rax
lea    (%rax,%r15,1),%rdx
add    $0x4,%rdx
shr    %rdx
lea    0xe88(%rip),%rcx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <mvwaddstr@plt>
movslq (%r14),%rax
lea    (%rax,%r15,1),%rdx
add    $0x21,%rdx
shr    %rdx
lea    0xe8d(%rip),%rcx
mov    %rbx,%rdi
mov    $0x9,%esi
call   1040 <mvwaddstr@plt>
movslq (%r14),%rax
lea    (%rax,%r15,1),%rdx
add    $0x15,%rdx
shr    %rdx
lea    0xe75(%rip),%rcx
mov    %rbx,%rdi
mov    $0xb,%esi
call   1040 <mvwaddstr@plt>
movslq (%r14),%rdx
add    %r15,%rdx
shr    %rdx
lea    0xe6e(%rip),%rcx
mov    %rbx,%rdi
mov    $0xc,%esi
call   1040 <mvwaddstr@plt>
movslq (%r14),%rax
lea    (%rax,%r15,1),%rdx
add    $0x2,%rdx
shr    %rdx
lea    0xe77(%rip),%rcx
mov    %rbx,%rdi
mov    $0xd,%esi
call   1040 <mvwaddstr@plt>
movslq (%r14),%rax
lea    (%rax,%r15,1),%rdx
add    $0x6,%rdx
shr    %rdx
lea    0xe7e(%rip),%rcx
mov    %rbx,%rdi
mov    $0xe,%esi
call   1040 <mvwaddstr@plt>
movslq (%r14),%rax
lea    (%rax,%r15,1),%rdx
add    $0xe,%rdx
shr    %rdx
lea    0xe81(%rip),%rcx
mov    %rbx,%rdi
mov    $0x12,%esi
call   1040 <mvwaddstr@plt>
movslq (%r14),%rax
lea    (%rax,%r15,1),%rdx
add    $0xd,%rdx
shr    %rdx
lea    0xe7c(%rip),%rcx
mov    %rbx,%rdi
mov    $0x14,%esi
call   1040 <mvwaddstr@plt>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <wgetch@plt>
cmp    $0x20,%al
jne    1280 <Introduction+0x150>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@COLS = global i32 0
@.str = [13 x i8] c"Lunar Lander\00"
@.str.1 = [39 x i8] c"The classic arcade game comes to Unix.\00"
@.str.2 = [10 x i8] c"Controls:\00"
@.str.3 = [22 x i8] c"'0'-'9' - power level\00"
@.str.4 = [43 x i8] c"'z' - set left retro rocket to power level\00"
@.str.5 = [41 x i8] c"'x' - set vertical thrust to power level\00"
@.str.6 = [37 x i8] c"'c' - set right retro to power level\00"
@.str.7 = [29 x i8] c"Stacey Campbell at HCR, 1989\00"
@.str.8 = [30 x i8] c"--press space to start game--\00"
define void @Introduction(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @werase(i32* %3)
%5 = load i32*, i32** %2
%6 = load i32, i32* @COLS
%7 = sext i32 %6 to i64
%8 = sub i64 %7, 13
%9 = udiv i64 %8, 2
%10 = trunc i64 %9 to i32
%11 = call i32 @mvwaddstr(i32* %5, i32 2, i32 %10, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%12 = load i32*, i32** %2
%13 = load i32, i32* @COLS
%14 = sext i32 %13 to i64
%15 = sub i64 %14, 39
%16 = udiv i64 %15, 2
%17 = trunc i64 %16 to i32
%18 = call i32 @mvwaddstr(i32* %12, i32 5, i32 %17, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%19 = load i32*, i32** %2
%20 = load i32, i32* @COLS
%21 = sext i32 %20 to i64
%22 = sub i64 %21, 10
%23 = udiv i64 %22, 2
%24 = trunc i64 %23 to i32
%25 = call i32 @mvwaddstr(i32* %19, i32 9, i32 %24, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%26 = load i32*, i32** %2
%27 = load i32, i32* @COLS
%28 = sext i32 %27 to i64
%29 = sub i64 %28, 22
%30 = udiv i64 %29, 2
%31 = trunc i64 %30 to i32
%32 = call i32 @mvwaddstr(i32* %26, i32 11, i32 %31, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%33 = load i32*, i32** %2
%34 = load i32, i32* @COLS
%35 = sext i32 %34 to i64
%36 = sub i64 %35, 43
%37 = udiv i64 %36, 2
%38 = trunc i64 %37 to i32
%39 = call i32 @mvwaddstr(i32* %33, i32 12, i32 %38, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
%40 = load i32*, i32** %2
%41 = load i32, i32* @COLS
%42 = sext i32 %41 to i64
%43 = sub i64 %42, 41
%44 = udiv i64 %43, 2
%45 = trunc i64 %44 to i32
%46 = call i32 @mvwaddstr(i32* %40, i32 13, i32 %45, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%47 = load i32*, i32** %2
%48 = load i32, i32* @COLS
%49 = sext i32 %48 to i64
%50 = sub i64 %49, 37
%51 = udiv i64 %50, 2
%52 = trunc i64 %51 to i32
%53 = call i32 @mvwaddstr(i32* %47, i32 14, i32 %52, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
%54 = load i32*, i32** %2
%55 = load i32, i32* @COLS
%56 = sext i32 %55 to i64
%57 = sub i64 %56, 29
%58 = udiv i64 %57, 2
%59 = trunc i64 %58 to i32
%60 = call i32 @mvwaddstr(i32* %54, i32 18, i32 %59, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%61 = load i32*, i32** %2
%62 = load i32, i32* @COLS
%63 = sext i32 %62 to i64
%64 = sub i64 %63, 30
%65 = udiv i64 %64, 2
%66 = trunc i64 %65 to i32
%67 = call i32 @mvwaddstr(i32* %61, i32 20, i32 %66, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0))
br label %68
68: ; preds = %73, %1
%69 = load i32*, i32** %2
%70 = call signext i8 @wgetch(i32* %69)
%71 = sext i8 %70 to i32
%72 = icmp ne i32 %71, 32
br i1 %72, label %73, label %74
73: ; preds = %68
br label %68
74: ; preds = %68
ret void
}

LLVM IR (-O2):
@COLS = global i32 0
@.str = [13 x i8] c"Lunar Lander\00"
@.str.1 = [39 x i8] c"The classic arcade game comes to Unix.\00"
@.str.2 = [10 x i8] c"Controls:\00"
@.str.3 = [22 x i8] c"'0'-'9' - power level\00"
@.str.4 = [43 x i8] c"'z' - set left retro rocket to power level\00"
@.str.5 = [41 x i8] c"'x' - set vertical thrust to power level\00"
@.str.6 = [37 x i8] c"'c' - set right retro to power level\00"
@.str.7 = [29 x i8] c"Stacey Campbell at HCR, 1989\00"
@.str.8 = [30 x i8] c"--press space to start game--\00"
define void @Introduction(i32* %0) {
%2 = tail call i32 @werase(i32* %0)
%3 = load i32, i32* @COLS
%4 = sext i32 %3 to i64
%5 = add nsw i64 %4, 8589934579
%6 = lshr i64 %5, 1
%7 = trunc i64 %6 to i32
%8 = tail call i32 @mvwaddstr(i32* %0, i32 2, i32 %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @COLS
%10 = sext i32 %9 to i64
%11 = add nsw i64 %10, 8589934553
%12 = lshr i64 %11, 1
%13 = trunc i64 %12 to i32
%14 = tail call i32 @mvwaddstr(i32* %0, i32 5, i32 %13, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* @COLS
%16 = sext i32 %15 to i64
%17 = add nsw i64 %16, 8589934582
%18 = lshr i64 %17, 1
%19 = trunc i64 %18 to i32
%20 = tail call i32 @mvwaddstr(i32* %0, i32 9, i32 %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%21 = load i32, i32* @COLS
%22 = sext i32 %21 to i64
%23 = add nsw i64 %22, 8589934570
%24 = lshr i64 %23, 1
%25 = trunc i64 %24 to i32
%26 = tail call i32 @mvwaddstr(i32* %0, i32 11, i32 %25, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%27 = load i32, i32* @COLS
%28 = sext i32 %27 to i64
%29 = add nsw i64 %28, 8589934549
%30 = lshr i64 %29, 1
%31 = trunc i64 %30 to i32
%32 = tail call i32 @mvwaddstr(i32* %0, i32 12, i32 %31, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
%33 = load i32, i32* @COLS
%34 = sext i32 %33 to i64
%35 = add nsw i64 %34, 8589934551
%36 = lshr i64 %35, 1
%37 = trunc i64 %36 to i32
%38 = tail call i32 @mvwaddstr(i32* %0, i32 13, i32 %37, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%39 = load i32, i32* @COLS
%40 = sext i32 %39 to i64
%41 = add nsw i64 %40, 8589934555
%42 = lshr i64 %41, 1
%43 = trunc i64 %42 to i32
%44 = tail call i32 @mvwaddstr(i32* %0, i32 14, i32 %43, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
%45 = load i32, i32* @COLS
%46 = sext i32 %45 to i64
%47 = add nsw i64 %46, 8589934563
%48 = lshr i64 %47, 1
%49 = trunc i64 %48 to i32
%50 = tail call i32 @mvwaddstr(i32* %0, i32 18, i32 %49, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%51 = load i32, i32* @COLS
%52 = sext i32 %51 to i64
%53 = add nsw i64 %52, 8589934562
%54 = lshr i64 %53, 1
%55 = trunc i64 %54 to i32
%56 = tail call i32 @mvwaddstr(i32* %0, i32 20, i32 %55, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0))
br label %57
57: ; preds = %57, %1
%58 = tail call signext i8 @wgetch(i32* %0)
%59 = icmp eq i8 %58, 32
br i1 %59, label %60, label %57
60: ; preds = %57
ret void
}