#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(void) {
  int old_cells[20];
  int new_cells[20];
  int limiter;
  int counter;
  int generation_counter = 0;
  int deadflag = 1;
  scanf("%d", &limiter);
  counter = 0;
  while (counter != limiter) {
    scanf("%d", &old_cells[counter]);
    new_cells[counter] = old_cells[counter];
    counter++;
  }
  old_cells[0] = 0;
  old_cells[counter] = 0;
  new_cells[0] = 0;
  new_cells[counter] = 0;
  while (generation_counter != 1000) {
    counter = 0;
    while (counter != limiter) {
      if (old_cells[counter] == 0) {
        printf(".");
      }
      if (old_cells[counter] == 1) {
        printf("*");
        deadflag = 0;
      }
      counter++;
    }
    printf("\n");
    next_generation(old_cells, new_cells, limiter);
    generation_counter++;
    if (deadflag == 1) {
      return 0;
    }
    deadflag = 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xbc(%rbp)
movl   $0x1,-0xc0(%rbp)
lea    0xea3(%rip),%rdi
lea    -0xb4(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0xb8(%rbp)
mov    -0xb8(%rbp),%eax
cmp    -0xb4(%rbp),%eax
je     11d0 <main+0xa0>
movslq -0xb8(%rbp),%rax
lea    -0x60(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe62(%rip),%rdi
call   1050 <scanf@plt>
movslq -0xb8(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%ecx
movslq -0xb8(%rbp),%rax
mov    %ecx,-0xb0(%rbp,%rax,4)
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
jmp    1173 <main+0x43>
movl   $0x0,-0x60(%rbp)
movslq -0xb8(%rbp),%rax
movl   $0x0,-0x60(%rbp,%rax,4)
movl   $0x0,-0xb0(%rbp)
movslq -0xb8(%rbp),%rax
movl   $0x0,-0xb0(%rbp,%rax,4)
cmpl   $0x3e8,-0xbc(%rbp)
je     12e1 <main+0x1b1>
movl   $0x0,-0xb8(%rbp)
mov    -0xb8(%rbp),%eax
cmp    -0xb4(%rbp),%eax
je     1288 <main+0x158>
movslq -0xb8(%rbp),%rax
cmpl   $0x0,-0x60(%rbp,%rax,4)
jne    124c <main+0x11c>
lea    0xdbc(%rip),%rdi
call   1040 <printf@plt>
movslq -0xb8(%rbp),%rax
cmpl   $0x1,-0x60(%rbp,%rax,4)
jne    1274 <main+0x144>
lea    0xda0(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0xc0(%rbp)
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
jmp    121c <main+0xec>
lea    0xd78(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
mov    -0xb4(%rbp),%edx
call   1030 <next_generation@plt>
mov    -0xbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
cmpl   $0x1,-0xc0(%rbp)
jne    12d2 <main+0x1a2>
movl   $0x0,-0x4(%rbp)
jmp    12e8 <main+0x1b8>
movl   $0x1,-0xc0(%rbp)
jmp    1202 <main+0xd2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xb0,%rsp
lea    0xeba(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
xor    %r15d,%r15d
cmpl   $0x0,0xc(%rsp)
je     119a <main+0x6a>
lea    0x60(%rsp),%rbp
lea    0x10(%rsp),%rbx
xor    %r12d,%r12d
lea    0xe92(%rip),%r14
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    (%rbx),%eax
mov    %eax,0x0(%rbp)
add    $0x1,%r12
mov    0xc(%rsp),%eax
add    $0x4,%rbp
add    $0x4,%rbx
cmp    %rax,%r12
jne    1170 <main+0x40>
mov    %r12d,%ecx
jmp    119e <main+0x6e>
xor    %eax,%eax
xor    %ecx,%ecx
movl   $0x0,0x10(%rsp)
movl   $0x0,0x10(%rsp,%rcx,4)
movl   $0x0,0x60(%rsp)
movl   $0x0,0x60(%rsp,%rcx,4)
lea    0x10(%rsp),%r14
lea    0x60(%rsp),%r12
nopl   0x0(%rax,%rax,1)
mov    $0x1,%ebp
test   %eax,%eax
je     1230 <main+0x100>
xor    %ebx,%ebx
jmp    11ed <main+0xbd>
nopl   (%rax)
add    $0x1,%rbx
mov    0xc(%rsp),%eax
cmp    %rax,%rbx
je     1230 <main+0x100>
mov    0x10(%rsp,%rbx,4),%eax
test   %eax,%eax
je     1200 <main+0xd0>
cmp    $0x1,%eax
jne    11e0 <main+0xb0>
jmp    1213 <main+0xe3>
nopl   0x0(%rax)
mov    $0x2e,%edi
call   1040 <putchar@plt>
mov    0x10(%rsp,%rbx,4),%eax
cmp    $0x1,%eax
jne    11e0 <main+0xb0>
mov    $0x2a,%edi
call   1040 <putchar@plt>
xor    %ebp,%ebp
jmp    11e0 <main+0xb0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0xc(%rsp),%edx
mov    %r14,%rdi
mov    %r12,%rsi
call   1030 <next_generation@plt>
cmp    $0x1,%ebp
je     1264 <main+0x134>
add    $0x1,%r15d
cmp    $0x3e8,%r15d
je     1264 <main+0x134>
mov    0xc(%rsp),%eax
jmp    11d0 <main+0xa0>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
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 [20 x i32]
%3 = alloca [20 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
store i32 1, i32* %7
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
store i32 0, i32* %5
br label %9
9: ; preds = %13, %0
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %10, %11
br i1 %12, label %13, label %27
13: ; preds = %9
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 %15
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %16)
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %23
store i32 %21, i32* %24
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %9
27: ; preds = %9
%28 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
store i32 0, i32* %28
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 %30
store i32 0, i32* %31
%32 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
store i32 0, i32* %32
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %34
store i32 0, i32* %35
br label %36
36: ; preds = %74, %27
%37 = load i32, i32* %6
%38 = icmp ne i32 %37, 1000
br i1 %38, label %39, label %75
39: ; preds = %36
store i32 0, i32* %5
br label %40
40: ; preds = %60, %39
%41 = load i32, i32* %5
%42 = load i32, i32* %4
%43 = icmp ne i32 %41, %42
br i1 %43, label %44, label %63
44: ; preds = %40
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 %46
%48 = load i32, i32* %47
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %44
%51 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %52
52: ; preds = %50, %44
%53 = load i32, i32* %5
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 %54
%56 = load i32, i32* %55
%57 = icmp eq i32 %56, 1
br i1 %57, label %58, label %60
58: ; preds = %52
%59 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %7
br label %60
60: ; preds = %58, %52
%61 = load i32, i32* %5
%62 = add nsw i32 %61, 1
store i32 %62, i32* %5
br label %40
63: ; preds = %40
%64 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%65 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%66 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
%67 = load i32, i32* %4
%68 = call i32 @next_generation(i32* %65, i32* %66, i32 %67)
%69 = load i32, i32* %6
%70 = add nsw i32 %69, 1
store i32 %70, i32* %6
%71 = load i32, i32* %7
%72 = icmp eq i32 %71, 1
br i1 %72, label %73, label %74
73: ; preds = %63
store i32 0, i32* %1
br label %76
74: ; preds = %63
store i32 1, i32* %7
br label %36
75: ; preds = %36
store i32 0, i32* %1
br label %76
76: ; preds = %75, %73
%77 = load i32, i32* %1
ret i32 %77
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [20 x i32]
%2 = alloca [20 x i32]
%3 = alloca i32
%4 = bitcast [20 x i32]* %1 to i8*
%5 = bitcast [20 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 = load i32, i32* %3
%9 = icmp eq i32 %8, 0
br i1 %9, label %22, label %10
10: ; preds = %0, %10
%11 = phi i64 [ %16, %10 ], [ 0, %0 ]
%12 = getelementptr inbounds [20 x i32], [20 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 = load i32, i32* %12
%15 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 %11
store i32 %14, i32* %15
%16 = add nuw i64 %11, 1
%17 = load i32, i32* %3
%18 = zext i32 %17 to i64
%19 = icmp eq i64 %16, %18
br i1 %19, label %20, label %10
20: ; preds = %10
%21 = and i64 %16, 4294967295
br label %22
22: ; preds = %20, %0
%23 = phi i32 [ 0, %0 ], [ %17, %20 ]
%24 = phi i64 [ 0, %0 ], [ %21, %20 ]
%25 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
store i32 0, i32* %25
%26 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 %24
store i32 0, i32* %26
%27 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
store i32 0, i32* %27
%28 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 %24
store i32 0, i32* %28
br label %29
29: ; preds = %62, %22
%30 = phi i32 [ %23, %22 ], [ %63, %62 ]
%31 = phi i32 [ 0, %22 ], [ %59, %62 ]
%32 = icmp eq i32 %30, 0
br i1 %32, label %53, label %33
33: ; preds = %29, %47
%34 = phi i64 [ %49, %47 ], [ 0, %29 ]
%35 = phi i32 [ %48, %47 ], [ 1, %29 ]
%36 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 %34
%37 = load i32, i32* %36
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %33
%40 = call i32 @putchar(i32 46)
%41 = load i32, i32* %36
br label %42
42: ; preds = %39, %33
%43 = phi i32 [ %41, %39 ], [ %37, %33 ]
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %47
45: ; preds = %42
%46 = call i32 @putchar(i32 42)
br label %47
47: ; preds = %45, %42
%48 = phi i32 [ 0, %45 ], [ %35, %42 ]
%49 = add nuw i64 %34, 1
%50 = load i32, i32* %3
%51 = zext i32 %50 to i64
%52 = icmp eq i64 %49, %51
br i1 %52, label %53, label %33
53: ; preds = %47, %29
%54 = phi i32 [ 1, %29 ], [ %48, %47 ]
%55 = call i32 @putchar(i32 10)
%56 = load i32, i32* %3
%57 = call i32 @next_generation(i32* %25, i32* %27, i32 %56)
%58 = icmp eq i32 %54, 1
%59 = add nuw nsw i32 %31, 1
%60 = icmp eq i32 %59, 1000
%61 = select i1 %58, i1 true, i1 %60
br i1 %61, label %64, label %62
62: ; preds = %53
%63 = load i32, i32* %3
br label %29
64: ; preds = %53
ret i32 0
}