#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 */
scalar_t__ CleanUp(int /*<<< orphan*/ *);
int /*<<< orphan*/ DrawScreen(int /*<<< orphan*/ *);
int /*<<< orphan*/ EndCurses(int /*<<< orphan*/ *);
int FlyLander(int /*<<< orphan*/ *, double, double);
int /*<<< orphan*/ InitMoves(int /*<<< orphan*/ *);
int /*<<< orphan*/ InitScore();
int /*<<< orphan*/ InitialiseScreen(int /*<<< orphan*/ **);
int /*<<< orphan*/ StartLander(double *, double *);
int main(int argc, char *argv[]) {
  double init_dy;
  double init_dx;
  WINDOW *screen;
  int LanderStatus;
  InitialiseScreen(&screen);
  InitScore();
  do {
    StartLander(&init_dy, &init_dx);
    do {
      InitMoves(screen);
      DrawScreen(screen);
      LanderStatus = FlyLander(screen, init_dy, init_dx);
      init_dy -= 3.0;
      init_dx += 13.0;
    } while (LanderStatus == 1);
  } while (CleanUp(screen));
  EndCurses(screen);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x28(%rbp),%rdi
call   1040 <InitialiseScreen@plt>
mov    $0x0,%al
call   10a0 <InitScore@plt>
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1090 <StartLander@plt>
mov    -0x28(%rbp),%rdi
call   1030 <InitMoves@plt>
mov    -0x28(%rbp),%rdi
call   1080 <DrawScreen@plt>
mov    -0x28(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1050 <FlyLander@plt>
mov    %eax,-0x2c(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe20(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe07(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cmpl   $0x1,-0x2c(%rbp)
je     11b3 <main+0x33>
jmp    1212 <main+0x92>
mov    -0x28(%rbp),%rdi
call   1060 <CleanUp@plt>
cmp    $0x0,%rax
jne    11a6 <main+0x26>
mov    -0x28(%rbp),%rdi
call   1070 <EndCurses@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsp,%rdi
call   1040 <InitialiseScreen@plt>
xor    %eax,%eax
call   10a0 <InitScore@plt>
lea    0x10(%rsp),%r14
lea    0x8(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1090 <StartLander@plt>
nopl   0x0(%rax,%rax,1)
mov    (%rsp),%rdi
call   1030 <InitMoves@plt>
mov    (%rsp),%rdi
call   1080 <DrawScreen@plt>
mov    (%rsp),%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1050 <FlyLander@plt>
movsd  0x10(%rsp),%xmm0
addsd  0xe1b(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xe0f(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
cmp    $0x1,%eax
je     11b0 <main+0x30>
mov    (%rsp),%rdi
call   1060 <CleanUp@plt>
test   %rax,%rax
jne    11a0 <main+0x20>
mov    (%rsp),%rdi
call   1070 <EndCurses@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca i32*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 @InitialiseScreen(i32** %8)
%11 = call i32 (...) @InitScore()
br label %12
12: ; preds = %31, %2
%13 = call i32 @StartLander(double* %6, double* %7)
br label %14
14: ; preds = %27, %12
%15 = load i32*, i32** %8
%16 = call i32 @InitMoves(i32* %15)
%17 = load i32*, i32** %8
%18 = call i32 @DrawScreen(i32* %17)
%19 = load i32*, i32** %8
%20 = load double, double* %6
%21 = load double, double* %7
%22 = call i32 @FlyLander(i32* %19, double %20, double %21)
store i32 %22, i32* %9
%23 = load double, double* %6
%24 = fsub double %23, 3.000000e+00
store double %24, double* %6
%25 = load double, double* %7
%26 = fadd double %25, 1.300000e+01
store double %26, double* %7
br label %27
27: ; preds = %14
%28 = load i32, i32* %9
%29 = icmp eq i32 %28, 1
br i1 %29, label %14, label %30
30: ; preds = %27
br label %31
31: ; preds = %30
%32 = load i32*, i32** %8
%33 = call i64 @CleanUp(i32* %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %12, label %35
35: ; preds = %31
%36 = load i32*, i32** %8
%37 = call i32 @EndCurses(i32* %36)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32*
%6 = bitcast double* %3 to i8*
%7 = bitcast double* %4 to i8*
%8 = bitcast i32** %5 to i8*
%9 = call i32 @InitialiseScreen(i32** %5)
%10 = call i32 (...) @InitScore()
br label %11
11: ; preds = %27, %2
%12 = call i32 @StartLander(double* %3, double* %4)
br label %13
13: ; preds = %13, %11
%14 = load i32*, i32** %5
%15 = call i32 @InitMoves(i32* %14)
%16 = load i32*, i32** %5
%17 = call i32 @DrawScreen(i32* %16)
%18 = load i32*, i32** %5
%19 = load double, double* %3
%20 = load double, double* %4
%21 = call i32 @FlyLander(i32* %18, double %19, double %20)
%22 = load double, double* %3
%23 = fadd double %22, -3.000000e+00
store double %23, double* %3
%24 = load double, double* %4
%25 = fadd double %24, 1.300000e+01
store double %25, double* %4
%26 = icmp eq i32 %21, 1
br i1 %26, label %13, label %27
27: ; preds = %13
%28 = load i32*, i32** %5
%29 = call i64 @CleanUp(i32* %28)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %11
31: ; preds = %27
%32 = load i32*, i32** %5
%33 = call i32 @EndCurses(i32* %32)
ret i32 0
}