#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 RAND_MAX;
int /*<<< orphan*/ evolve(unsigned int **, int, int);
int rand();
int /*<<< orphan*/ show(unsigned int **, int, int);
int /*<<< orphan*/ usleep(int);
void game(int w, int h) {
  unsigned univ[h][w];
  for (int x = 0; x < w; x++)
    for (int y = 0; y < h; y++)
      univ[y][x] = rand() < RAND_MAX / 10 ? 1 : 0;
  while (1) {
    show(univ, w, h);
    evolve(univ, w, h);
    usleep(200000);
  }
}


x86 assembly (clang, -O0):
<game>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
mov    %rax,-0x38(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x10(%rbp)
mov    %rcx,%rdx
imul   %rax,%rdx
lea    0xf(,%rdx,4),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x30(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x18(%rbp)
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1218 <game+0xd8>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1205 <game+0xc5>
mov    $0x0,%al
call   1050 <rand@plt>
mov    -0x38(%rbp),%rsi
mov    %eax,%edi
mov    0x2e25(%rip),%rax
mov    (%rax),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%r8d
mov    -0x30(%rbp),%rax
xor    %edx,%edx
mov    $0x1,%ecx
cmp    %r8d,%edi
cmovl  %ecx,%edx
movslq -0x28(%rbp),%rcx
imul   %rsi,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11a3 <game+0x63>
jmp    120a <game+0xca>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1190 <game+0x50>
jmp    121d <game+0xdd>
jmp    1222 <game+0xe2>
mov    -0x30(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1030 <show@plt>
mov    -0x30(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1040 <evolve@plt>
mov    $0x30d40,%edi
call   1060 <usleep@plt>
jmp    121d <game+0xdd>

x86 assembly (clang, -O2):
<game>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %esi,%r14d
mov    %edi,%r15d
mov    %esi,%eax
mov    %edi,%edx
mov    %rax,-0x38(%rbp)
mov    %rdx,%rcx
mov    %rdx,-0x30(%rbp)
imul   %rdx,%rax
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
test   %edi,%edi
jle    1210 <game+0xd0>
mov    -0x30(%rbp),%rax
lea    0x0(,%rax,4),%rax
mov    %rbx,%r12
xor    %ecx,%ecx
mov    %rax,-0x50(%rbp)
jmp    11b6 <game+0x76>
xchg   %ax,%ax
mov    -0x40(%rbp),%rcx
add    $0x1,%rcx
mov    -0x48(%rbp),%r12
add    $0x4,%r12
cmp    -0x30(%rbp),%rcx
je     1210 <game+0xd0>
mov    %rcx,-0x40(%rbp)
mov    -0x38(%rbp),%r13
mov    %r12,-0x48(%rbp)
test   %r14d,%r14d
jle    11a0 <game+0x60>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <rand@plt>
mov    0x2e0a(%rip),%rcx
movslq (%rcx),%rcx
imul   $0x66666667,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
xor    %edx,%edx
cmp    %ecx,%eax
mov    -0x50(%rbp),%rax
setl   %dl
mov    %edx,(%r12)
add    %rax,%r12
add    $0xffffffffffffffff,%r13
jne    11d0 <game+0x90>
jmp    11a0 <game+0x60>
nop
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
call   1030 <show@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
call   1040 <evolve@plt>
mov    $0x30d40,%edi
call   1060 <usleep@plt>
jmp    1210 <game+0xd0>

LLVM IR (-O0):
@RAND_MAX = global i32 0
define void @game(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%10 = load i32, i32* %4
%11 = zext i32 %10 to i64
%12 = load i32, i32* %3
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %5
%15 = mul nuw i64 %11, %13
%16 = alloca i32, i64 %15
store i64 %11, i64* %6
store i64 %13, i64* %7
store i32 0, i32* %8
br label %17
17: ; preds = %44, %2
%18 = load i32, i32* %8
%19 = load i32, i32* %3
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %47
21: ; preds = %17
store i32 0, i32* %9
br label %22
22: ; preds = %40, %21
%23 = load i32, i32* %9
%24 = load i32, i32* %4
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %43
26: ; preds = %22
%27 = call i32 (...) @rand()
%28 = load i32, i32* @RAND_MAX
%29 = sdiv i32 %28, 10
%30 = icmp slt i32 %27, %29
%31 = zext i1 %30 to i64
%32 = select i1 %30, i32 1, i32 0
%33 = load i32, i32* %9
%34 = sext i32 %33 to i64
%35 = mul nsw i64 %34, %13
%36 = getelementptr inbounds i32, i32* %16, i64 %35
%37 = load i32, i32* %8
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32, i32* %36, i64 %38
store i32 %32, i32* %39
br label %40
40: ; preds = %26
%41 = load i32, i32* %9
%42 = add nsw i32 %41, 1
store i32 %42, i32* %9
br label %22
43: ; preds = %22
br label %44
44: ; preds = %43
%45 = load i32, i32* %8
%46 = add nsw i32 %45, 1
store i32 %46, i32* %8
br label %17
47: ; preds = %17
br label %48
48: ; preds = %49, %47
br label %49
49: ; preds = %48
%50 = bitcast i32* %16 to i32**
%51 = load i32, i32* %3
%52 = load i32, i32* %4
%53 = call i32 @show(i32** %50, i32 %51, i32 %52)
%54 = bitcast i32* %16 to i32**
%55 = load i32, i32* %3
%56 = load i32, i32* %4
%57 = call i32 @evolve(i32** %54, i32 %55, i32 %56)
%58 = call i32 @usleep(i32 200000)
br label %48
}

LLVM IR (-O2):
@RAND_MAX = global i32 0
define void @game(i32 %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = zext i32 %0 to i64
%5 = mul nuw i64 %3, %4
%6 = alloca i32, i64 %5
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = icmp sgt i32 %1, 0
br label %10
10: ; preds = %8, %16
%11 = phi i64 [ 0, %8 ], [ %17, %16 ]
br i1 %9, label %12, label %16
12: ; preds = %10
%13 = getelementptr inbounds i32, i32* %6, i64 %11
br label %19
14: ; preds = %16, %2
%15 = bitcast i32* %6 to i32**
br label %30
16: ; preds = %19, %10
%17 = add nuw nsw i64 %11, 1
%18 = icmp eq i64 %17, %4
br i1 %18, label %14, label %10
19: ; preds = %12, %19
%20 = phi i64 [ 0, %12 ], [ %28, %19 ]
%21 = tail call i32 (...) @rand()
%22 = load i32, i32* @RAND_MAX
%23 = sdiv i32 %22, 10
%24 = icmp slt i32 %21, %23
%25 = zext i1 %24 to i32
%26 = mul nuw nsw i64 %20, %4
%27 = getelementptr inbounds i32, i32* %13, i64 %26
store i32 %25, i32* %27
%28 = add nuw nsw i64 %20, 1
%29 = icmp eq i64 %28, %3
br i1 %29, label %16, label %19
30: ; preds = %14, %30
%31 = call i32 @show(i32** %15, i32 %0, i32 %1)
%32 = call i32 @evolve(i32** %15, i32 %0, i32 %1)
%33 = call i32 @usleep(i32 200000)
br label %30
}