#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 current[21], next[21], lenght, len_help;
  for (len_help = 0; len_help < 20; len_help++) {
    current[len_help] = 0;
    next[len_help] = 0;
  }
  scanf("%d", &lenght);
  for (len_help = 1; len_help <= lenght; len_help++) {
    scanf("%d", &current[len_help]);
  }
  next_generation(current, next, lenght);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc8(%rbp)
cmpl   $0x14,-0xc8(%rbp)
jge    117e <main+0x5e>
movslq -0xc8(%rbp),%rax
movl   $0x0,-0x60(%rbp,%rax,4)
movslq -0xc8(%rbp),%rax
movl   $0x0,-0xc0(%rbp,%rax,4)
mov    -0xc8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc8(%rbp)
jmp    113c <main+0x1c>
lea    0xe7b(%rip),%rdi
lea    -0xc4(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc8(%rbp)
mov    -0xc8(%rbp),%eax
cmp    -0xc4(%rbp),%eax
jg     11df <main+0xbf>
movslq -0xc8(%rbp),%rax
lea    -0x60(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe3a(%rip),%rdi
call   1040 <scanf@plt>
mov    -0xc8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc8(%rbp)
jmp    119b <main+0x7b>
lea    -0x60(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
mov    -0xc4(%rbp),%edx
call   1030 <next_generation@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xd0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0xb0(%rsp)
lea    0xe8c(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%edx
test   %edx,%edx
jle    11bd <main+0x9d>
lea    0x14(%rsp),%r15
xor    %ebx,%ebx
lea    0xe6c(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movslq 0xc(%rsp),%rdx
add    $0x1,%rbx
add    $0x4,%r15
cmp    %rdx,%rbx
jl     11a0 <main+0x80>
lea    0x10(%rsp),%rdi
lea    0x70(%rsp),%rsi
call   1030 <next_generation@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [21 x i32]
%2 = bitcast [21 x i32]* %1 to i8*
%3 = alloca [21 x i32]
%4 = bitcast [21 x i32]* %3 to i8*
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 1
br i1 %9, label %18, label %10
10: ; preds = %0, %10
%11 = phi i64 [ %14, %10 ], [ 1, %0 ]
%12 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 %11
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
%14 = add nuw nsw i64 %11, 1
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %11, %16
br i1 %17, label %10, label %18
18: ; preds = %10, %0
%19 = phi i32 [ %8, %0 ], [ %15, %10 ]
%20 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 0
%21 = getelementptr inbounds [21 x i32], [21 x i32]* %3, i64 0, i64 0
%22 = call i32 @next_generation(i32* %20, i32* %21, i32 %19)
ret i32 0
}