#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 EXIT_SUCCESS;
int /*<<< orphan*/ drawLevel(char **, int **);
int /*<<< orphan*/ initLevel(char **, int **);
int /*<<< orphan*/ updateLevel(char **, int *);
int main() {
  char level[40][20];
  int snakePos[1][2] = {0, 0};
  int snakeLength = 0;
  int runGame = 1;
  initLevel(level, snakePos);
  while (runGame) {
    updateLevel(level, &runGame);
    drawLevel(level, snakePos);
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x338(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
movl   $0x0,-0x33c(%rbp)
movl   $0x1,-0x340(%rbp)
lea    -0x330(%rbp),%rdi
lea    -0x338(%rbp),%rsi
call   1060 <initLevel@plt>
cmpl   $0x0,-0x340(%rbp)
je     11c4 <main+0x84>
lea    -0x330(%rbp),%rdi
lea    -0x340(%rbp),%rsi
call   1030 <updateLevel@plt>
lea    -0x330(%rbp),%rdi
lea    -0x338(%rbp),%rsi
call   1050 <drawLevel@plt>
jmp    118c <main+0x4c>
mov    0x2e15(%rip),%rax
mov    (%rax),%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x330,%rsp
movq   $0x0,0x8(%rsp)
movl   $0x1,0x4(%rsp)
lea    0x10(%rsp),%rbx
lea    0x8(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <initLevel@plt>
lea    0x4(%rsp),%r15
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <updateLevel@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <drawLevel@plt>
cmpl   $0x0,0x4(%rsp)
jne    1170 <main+0x40>
mov    0x2e4c(%rip),%rax
mov    (%rax),%eax
add    $0x330,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [40 x [20 x i8]]
%3 = alloca [1 x [2 x i32]]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [1 x [2 x i32]]* %3 to i8*
store i32 0, i32* %4
store i32 1, i32* %5
%7 = getelementptr inbounds [40 x [20 x i8]], [40 x [20 x i8]]* %2, i64 0, i64 0
%8 = bitcast [20 x i8]* %7 to i8**
%9 = getelementptr inbounds [1 x [2 x i32]], [1 x [2 x i32]]* %3, i64 0, i64 0
%10 = bitcast [2 x i32]* %9 to i32**
%11 = call i32 @initLevel(i8** %8, i32** %10)
br label %12
12: ; preds = %15, %0
%13 = load i32, i32* %5
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %24
15: ; preds = %12
%16 = getelementptr inbounds [40 x [20 x i8]], [40 x [20 x i8]]* %2, i64 0, i64 0
%17 = bitcast [20 x i8]* %16 to i8**
%18 = call i32 @updateLevel(i8** %17, i32* %5)
%19 = getelementptr inbounds [40 x [20 x i8]], [40 x [20 x i8]]* %2, i64 0, i64 0
%20 = bitcast [20 x i8]* %19 to i8**
%21 = getelementptr inbounds [1 x [2 x i32]], [1 x [2 x i32]]* %3, i64 0, i64 0
%22 = bitcast [2 x i32]* %21 to i32**
%23 = call i32 @drawLevel(i8** %20, i32** %22)
br label %12
24: ; preds = %12
%25 = load i32, i32* @EXIT_SUCCESS
ret i32 %25
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [40 x [20 x i8]]
%2 = alloca i64
%3 = alloca i32
%4 = getelementptr inbounds [40 x [20 x i8]], [40 x [20 x i8]]* %1, i64 0, i64 0, i64 0
%5 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%6 = bitcast i32* %3 to i8*
store i32 1, i32* %3
%7 = bitcast [40 x [20 x i8]]* %1 to i8**
%8 = bitcast i64* %2 to i32**
%9 = call i32 @initLevel(i8** %7, i32** %8)
br label %10
10: ; preds = %0, %10
%11 = call i32 @updateLevel(i8** %7, i32* %3)
%12 = call i32 @drawLevel(i8** %7, i32** %8)
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %10
15: ; preds = %10
%16 = load i32, i32* @EXIT_SUCCESS
ret i32 %16
}