#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*/ next_generation(int *, int *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int next[20], current[20], counter, length;
  for (counter = 0; counter < 20; counter++) {
    current[counter] = next[counter] = 0;
  }
  while (length > 20 || length < 1) {
    scanf("%d", &length);
  }
  for (counter = 0; counter < length; counter++) {
    scanf("%d", &current[counter]);
  }
  next_generation(current, next, length);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xb4(%rbp)
cmpl   $0x14,-0xb4(%rbp)
jge    117e <main+0x5e>
movslq -0xb4(%rbp),%rax
movl   $0x0,-0x60(%rbp,%rax,4)
movslq -0xb4(%rbp),%rax
movl   $0x0,-0xb0(%rbp,%rax,4)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    113c <main+0x1c>
jmp    1183 <main+0x63>
mov    $0x1,%al
cmpl   $0x14,-0xb8(%rbp)
mov    %al,-0xb9(%rbp)
jg     11a8 <main+0x88>
cmpl   $0x1,-0xb8(%rbp)
setl   %al
mov    %al,-0xb9(%rbp)
mov    -0xb9(%rbp),%al
test   $0x1,%al
jne    11bb <main+0x9b>
jmp    11d3 <main+0xb3>
lea    0xe3e(%rip),%rdi
lea    -0xb8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    1183 <main+0x63>
movl   $0x0,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
cmp    -0xb8(%rbp),%eax
jge    1224 <main+0x104>
movslq -0xb4(%rbp),%rax
lea    -0xb0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xdf5(%rip),%rdi
call   1040 <scanf@plt>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    11dd <main+0xbd>
lea    -0xb0(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0xb8(%rbp),%edx
call   1030 <next_generation@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xa8,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
mov    %rsp,%rdi
lea    0x50(%rsp),%rsi
call   1030 <next_generation@plt>
xor    %eax,%eax
add    $0xa8,%rsp
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [20 x i32]
%2 = bitcast [20 x i32]* %1 to i8*
%3 = alloca [20 x i32]
%4 = bitcast [20 x i32]* %3 to i8*
%5 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
%6 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%7 = call i32 @next_generation(i32* %5, i32* %6, i32 undef)
ret i32 0
}