#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int current[21], next[21], lenght, counter, counter2;
  scanf("%d", &lenght);
  next[0] = 0;
  next[lenght - 1] = 0;
  for (counter = 0; counter < lenght; counter++)
    scanf("%d", &current[counter]);
  for (counter2 = 0; counter2 < lenght; counter2++) {
    if (current[counter2] == 1)
      printf("*");
    if (current[counter2] == 0)
      printf(".");
  }
  printf("\n");
  next_generation(current, next, lenght);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0xc4(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0xc0(%rbp)
mov    -0xc4(%rbp),%eax
sub    $0x1,%eax
cltq
movl   $0x0,-0xc0(%rbp,%rax,4)
movl   $0x0,-0xc8(%rbp)
mov    -0xc8(%rbp),%eax
cmp    -0xc4(%rbp),%eax
jge    11c3 <main+0x93>
movslq -0xc8(%rbp),%rax
lea    -0x60(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe56(%rip),%rdi
call   1050 <scanf@plt>
mov    -0xc8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc8(%rbp)
jmp    117f <main+0x4f>
movl   $0x0,-0xcc(%rbp)
mov    -0xcc(%rbp),%eax
cmp    -0xc4(%rbp),%eax
jge    1234 <main+0x104>
movslq -0xcc(%rbp),%rax
cmpl   $0x1,-0x60(%rbp,%rax,4)
jne    11fd <main+0xcd>
lea    0xe0b(%rip),%rdi
call   1040 <printf@plt>
movslq -0xcc(%rbp),%rax
cmpl   $0x0,-0x60(%rbp,%rax,4)
jne    121b <main+0xeb>
lea    0xdef(%rip),%rdi
call   1040 <printf@plt>
jmp    1220 <main+0xf0>
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    11cd <main+0x9d>
lea    0xdcc(%rip),%rdi
call   1040 <printf@plt>
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
lea    0xebd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
movl   $0x0,0x70(%rsp)
movslq 0xc(%rsp),%rax
movl   $0x0,0x6c(%rsp,%rax,4)
test   %rax,%rax
jle    11ec <main+0xbc>
lea    0x10(%rsp),%r15
xor    %ebx,%ebx
lea    0xe87(%rip),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
add    $0x4,%r15
cmp    %rax,%rbx
jl     1180 <main+0x50>
test   %eax,%eax
jle    11ec <main+0xbc>
xor    %ebx,%ebx
jmp    11c2 <main+0x92>
cs nopw 0x0(%rax,%rax,1)
nop
test   %eax,%eax
je     11e0 <main+0xb0>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jge    11ec <main+0xbc>
mov    0x10(%rsp,%rbx,4),%eax
cmp    $0x1,%eax
jne    11b0 <main+0x80>
mov    $0x2a,%edi
call   1040 <putchar@plt>
mov    0x10(%rsp,%rbx,4),%eax
jmp    11b0 <main+0x80>
nopl   0x0(%rax,%rax,1)
mov    $0x2e,%edi
call   1040 <putchar@plt>
jmp    11b4 <main+0x84>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0xc(%rsp),%edx
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"
@.str.1 = [2 x i8] c"*\00"
@.str.2 = [2 x i8] c".\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [21 x i32]
%3 = alloca [21 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%8 = getelementptr inbounds [21 x i32], [21 x i32]* %3, i64 0, i64 0
store i32 0, i32* %8
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [21 x i32], [21 x i32]* %3, i64 0, i64 %11
store i32 0, i32* %12
store i32 0, i32* %5
br label %13
13: ; preds = %22, %0
%14 = load i32, i32* %5
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %25
17: ; preds = %13
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [21 x i32], [21 x i32]* %2, i64 0, i64 %19
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %20)
br label %22
22: ; preds = %17
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %13
25: ; preds = %13
store i32 0, i32* %6
br label %26
26: ; preds = %47, %25
%27 = load i32, i32* %6
%28 = load i32, i32* %4
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %50
30: ; preds = %26
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [21 x i32], [21 x i32]* %2, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = icmp eq i32 %34, 1
br i1 %35, label %36, label %38
36: ; preds = %30
%37 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %38
38: ; preds = %36, %30
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [21 x i32], [21 x i32]* %2, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %38
%45 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %46
46: ; preds = %44, %38
br label %47
47: ; preds = %46
%48 = load i32, i32* %6
%49 = add nsw i32 %48, 1
store i32 %49, i32* %6
br label %26
50: ; preds = %26
%51 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%52 = getelementptr inbounds [21 x i32], [21 x i32]* %2, i64 0, i64 0
%53 = getelementptr inbounds [21 x i32], [21 x i32]* %3, i64 0, i64 0
%54 = load i32, i32* %4
%55 = call i32 @next_generation(i32* %52, i32* %53, i32 %54)
ret i32 0
}

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