#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*/ BiosGetTicks(unsigned int *);
scalar_t__ BiosKeyAvailable();
int /*<<< orphan*/ BiosReadKey();
int /*<<< orphan*/ BiosSetGfxMode(int);
int /*<<< orphan*/ play();
int /*<<< orphan*/ srand(unsigned int);
int /*<<< orphan*/ text(int, int, char *, int);
int main(void) {
  unsigned ticks[2];
  BiosSetGfxMode(1);
  text((40 - 20) / 2, 25 / 2, "Press a key to start", 0x00 | 0x0F);
  while (BiosKeyAvailable())
    BiosReadKey();
  BiosReadKey();
  BiosGetTicks(ticks);
  srand(ticks[0]);
  play();
  BiosSetGfxMode(3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
call   1090 <BiosSetGfxMode@plt>
mov    $0xa,%edi
mov    $0xc,%esi
lea    0xe66(%rip),%rdx
mov    $0xf,%ecx
call   1040 <text@plt>
mov    $0x0,%al
call   1030 <BiosKeyAvailable@plt>
cmp    $0x0,%rax
je     11c1 <main+0x51>
mov    $0x0,%al
call   1060 <BiosReadKey@plt>
jmp    11a4 <main+0x34>
mov    $0x0,%al
call   1060 <BiosReadKey@plt>
lea    -0xc(%rbp),%rdi
call   1050 <BiosGetTicks@plt>
mov    -0xc(%rbp),%edi
call   1070 <srand@plt>
mov    $0x0,%al
call   1080 <play@plt>
mov    $0x3,%edi
call   1090 <BiosSetGfxMode@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1090 <BiosSetGfxMode@plt>
lea    0xe7e(%rip),%rdx
mov    $0xa,%edi
mov    $0xc,%esi
mov    $0xf,%ecx
call   1040 <text@plt>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <BiosKeyAvailable@plt>
test   %rax,%rax
je     11b5 <main+0x45>
xor    %eax,%eax
call   1060 <BiosReadKey@plt>
jmp    11a0 <main+0x30>
xor    %eax,%eax
call   1060 <BiosReadKey@plt>
mov    %rsp,%rdi
call   1050 <BiosGetTicks@plt>
mov    (%rsp),%edi
call   1070 <srand@plt>
xor    %eax,%eax
call   1080 <play@plt>
mov    $0x3,%edi
call   1090 <BiosSetGfxMode@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Press a key to start\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
store i32 0, i32* %1
%3 = call i32 @BiosSetGfxMode(i32 1)
%4 = call i32 @text(i32 10, i32 12, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 15)
br label %5
5: ; preds = %8, %0
%6 = call i64 (...) @BiosKeyAvailable()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = call i32 (...) @BiosReadKey()
br label %5
10: ; preds = %5
%11 = call i32 (...) @BiosReadKey()
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%13 = call i32 @BiosGetTicks(i32* %12)
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%15 = load i32, i32* %14
%16 = call i32 @srand(i32 %15)
%17 = call i32 (...) @play()
%18 = call i32 @BiosSetGfxMode(i32 3)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Press a key to start\00"
define i32 @main() {
%1 = alloca [2 x i32]
%2 = bitcast [2 x i32]* %1 to i8*
%3 = tail call i32 @BiosSetGfxMode(i32 1)
%4 = tail call i32 @text(i32 10, i32 12, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 15)
%5 = tail call i64 (...) @BiosKeyAvailable()
%6 = icmp eq i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %0, %7
%8 = tail call i32 (...) @BiosReadKey()
%9 = tail call i64 (...) @BiosKeyAvailable()
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %7
11: ; preds = %7, %0
%12 = tail call i32 (...) @BiosReadKey()
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%14 = call i32 @BiosGetTicks(i32* %13)
%15 = load i32, i32* %13
%16 = call i32 @srand(i32 %15)
%17 = call i32 (...) @play()
%18 = call i32 @BiosSetGfxMode(i32 3)
ret i32 0
}