#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*/ game(int, int, int);
int /*<<< orphan*/ printf(char *, int, ...);
int main(int argc, char **argv) {
  int w, h, i;
  int arg = argc > 1 ? argv[1][0] - '0' : 3;
  switch (arg) {
  case 0:
    return 0;
    break;
  case 1:
    w = h = 32;
    i = 2500;
    break;
  case 2:
    w = h = 32;
    i = 13000;
    break;
  case 3:
    w = h = 32;
    i = 24000;
    break;
  case 4:
    w = h = 32;
    i = 5 * 24000;
    break;
  case 5:
    w = h = 32;
    i = 10 * 24000;
    break;
  default:
    printf("error: %d\\n", arg);
    return -1;
  }
  printf("life: %d,%d,%d,%d\n", arg, w, h, i);
  game(w, h, i);
  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)
cmpl   $0x1,-0x8(%rbp)
jle    1156 <main+0x36>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x24(%rbp)
jmp    1163 <main+0x43>
mov    $0x3,%eax
mov    %eax,-0x24(%rbp)
jmp    1163 <main+0x43>
mov    -0x24(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %rax,-0x30(%rbp)
sub    $0x5,%rax
ja     121c <main+0xfc>
mov    -0x30(%rbp),%rax
lea    0xe7b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x4(%rbp)
jmp    1269 <main+0x149>
movl   $0x20,-0x18(%rbp)
movl   $0x20,-0x14(%rbp)
movl   $0x9c4,-0x1c(%rbp)
jmp    1239 <main+0x119>
movl   $0x20,-0x18(%rbp)
movl   $0x20,-0x14(%rbp)
movl   $0x32c8,-0x1c(%rbp)
jmp    1239 <main+0x119>
movl   $0x20,-0x18(%rbp)
movl   $0x20,-0x14(%rbp)
movl   $0x5dc0,-0x1c(%rbp)
jmp    1239 <main+0x119>
movl   $0x20,-0x18(%rbp)
movl   $0x20,-0x14(%rbp)
movl   $0x1d4c0,-0x1c(%rbp)
jmp    1239 <main+0x119>
movl   $0x20,-0x18(%rbp)
movl   $0x20,-0x14(%rbp)
movl   $0x3a980,-0x1c(%rbp)
jmp    1239 <main+0x119>
mov    -0x20(%rbp),%esi
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1269 <main+0x149>
mov    -0x20(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1040 <game@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     115f <main+0x3f>
mov    0x8(%rsi),%rax
movsbl (%rax),%eax
add    $0xffffffd0,%eax
cmp    $0x5,%eax
ja     11a0 <main+0x80>
mov    $0x9c4,%ebx
mov    $0x1,%esi
xor    %ebp,%ebp
lea    0xeb6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x32c8,%ebx
mov    $0x2,%esi
jmp    1169 <main+0x49>
mov    $0x5dc0,%ebx
mov    $0x3,%esi
lea    0xeb4(%rip),%rdi
xor    %ebp,%ebp
mov    $0x20,%edx
mov    $0x20,%ecx
mov    %ebx,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x20,%edi
mov    $0x20,%esi
mov    %ebx,%edx
call   1040 <game@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe71(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffff,%ebp
jmp    1197 <main+0x77>
mov    $0x1d4c0,%ebx
mov    $0x4,%esi
jmp    1169 <main+0x49>
mov    $0x3a980,%ebx
mov    $0x5,%esi
jmp    1169 <main+0x49>

LLVM IR (-O0):
@.str = [12 x i8] c"error: %d\\n\00"
@.str.1 = [19 x i8] c"life: %d,%d,%d,%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %20
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = sub nsw i32 %18, 48
br label %21
20: ; preds = %2
br label %21
21: ; preds = %20, %12
%22 = phi i32 [ %19, %12 ], [ 3, %20 ]
store i32 %22, i32* %9
%23 = load i32, i32* %9
switch i32 %23, label %30 [
i32 0, label %24
i32 1, label %25
i32 2, label %26
i32 3, label %27
i32 4, label %28
i32 5, label %29
]
24: ; preds = %21
store i32 0, i32* %3
br label %43
25: ; preds = %21
store i32 32, i32* %7
store i32 32, i32* %6
store i32 2500, i32* %8
br label %33
26: ; preds = %21
store i32 32, i32* %7
store i32 32, i32* %6
store i32 13000, i32* %8
br label %33
27: ; preds = %21
store i32 32, i32* %7
store i32 32, i32* %6
store i32 24000, i32* %8
br label %33
28: ; preds = %21
store i32 32, i32* %7
store i32 32, i32* %6
store i32 120000, i32* %8
br label %33
29: ; preds = %21
store i32 32, i32* %7
store i32 32, i32* %6
store i32 240000, i32* %8
br label %33
30: ; preds = %21
%31 = load i32, i32* %9
%32 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %31)
store i32 -1, i32* %3
br label %43
33: ; preds = %29, %28, %27, %26, %25
%34 = load i32, i32* %9
%35 = load i32, i32* %6
%36 = load i32, i32* %7
%37 = load i32, i32* %8
%38 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %34, i32 %35, i32 %36, i32 %37)
%39 = load i32, i32* %6
%40 = load i32, i32* %7
%41 = load i32, i32* %8
%42 = call i32 @game(i32 %39, i32 %40, i32 %41)
store i32 0, i32* %3
br label %43
43: ; preds = %33, %30, %24
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@.str = [12 x i8] c"error: %d\\n\00"
@.str.1 = [19 x i8] c"life: %d,%d,%d,%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
switch i32 %8, label %13 [
i32 48, label %21
i32 49, label %16
i32 50, label %9
i32 51, label %10
i32 52, label %11
i32 53, label %12
]
9: ; preds = %4
br label %16
10: ; preds = %2, %4
br label %16
11: ; preds = %4
br label %16
12: ; preds = %4
br label %16
13: ; preds = %4
%14 = add nsw i32 %8, -48
%15 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %14)
br label %21
16: ; preds = %4, %12, %11, %10, %9
%17 = phi i32 [ 5, %12 ], [ 4, %11 ], [ 3, %10 ], [ 2, %9 ], [ 1, %4 ]
%18 = phi i32 [ 240000, %12 ], [ 120000, %11 ], [ 24000, %10 ], [ 13000, %9 ], [ 2500, %4 ]
%19 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 32, i32 32, i32 %18)
%20 = tail call i32 @game(i32 32, i32 32, i32 %18)
br label %21
21: ; preds = %4, %16, %13
%22 = phi i32 [ -1, %13 ], [ 0, %16 ], [ 0, %4 ]
ret i32 %22
}