#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 GetRand(int /*<<< orphan*/, int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ intToBin(int, int *);
int /*<<< orphan*/ iteractions(int, int, int *, int *, int);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ stdin;
main() {
  int n, size, i, j, niteractions;
  char grid;
  printf("Hello there! This is a program to calculate Elementar Cellular "
         "Automatons.\n");
  printf("NΦ (max is 255): ");
  scanf("%d", &n);
  printf("Size: ");
  scanf("%d", &size);
  int binary[8];
  int start[size];
  printf("Number of iteractions: ");
  scanf("%d", &niteractions);
  printf("Press I to insert the initial grid or R for a random one: ");
  fflush(stdin);
  scanf(" %c", &grid);
  if (grid == 'I') {
    for (j = 0; j < size; j++) {
      printf("Position %d:", j);
      scanf("%d", &start[j]);
    }
  }
  if (grid == 'R') {
    for (j = 0; j < size; j++) {
      start[j] = rand() % 2;
      start[j] = GetRand(0, 1);
    }
  }
  if (size <= 2) {
    printf("Increase size.\n");
    return 0;
  } else
    intToBin(n, binary);
  for (i = 0; i < 8; i++) {
    printf("%d", binary[i]);
  }
  printf("\n");
  for (i = 0; i < size; i++)
    if (start[i] == 0)
      printf("□ ");
    else
      printf("■ ");
  printf(" t=0 \n \n");
  iteractions(n, size, binary, start, niteractions);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x61(%rbp)
call   1030 <printf@plt>
mov    -0x61(%rbp),%al
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x61(%rbp),%al
lea    0xeb6(%rip),%rdi
mov    %rdi,-0x70(%rbp)
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x61(%rbp),%al
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x70(%rbp),%rdi
mov    -0x61(%rbp),%al
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x48(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x60(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x50(%rbp)
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe4e(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2db7(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
lea    0xe7d(%rip),%rdi
lea    -0x19(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
movsbl -0x19(%rbp),%eax
cmp    $0x49,%eax
jne    12ab <main+0x13b>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12a6 <main+0x136>
mov    -0x14(%rbp),%esi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x60(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    125e <main+0xee>
jmp    12ab <main+0x13b>
movsbl -0x19(%rbp),%eax
cmp    $0x52,%eax
jne    1311 <main+0x1a1>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    130c <main+0x19c>
mov    $0x0,%al
call   1090 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x60(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
xor    %edi,%edi
mov    $0x1,%esi
call   1070 <GetRand@plt>
mov    %eax,%edx
mov    -0x60(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12bf <main+0x14f>
jmp    1311 <main+0x1a1>
cmpl   $0x2,-0xc(%rbp)
jg     133c <main+0x1cc>
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x54(%rbp)
jmp    1417 <main+0x2a7>
mov    -0x8(%rbp),%edi
lea    -0x40(%rbp),%rsi
call   1050 <intToBin@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    137d <main+0x20d>
movslq -0x10(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xcf7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    134f <main+0x1df>
lea    0xd6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    13e4 <main+0x274>
mov    -0x60(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    13c3 <main+0x253>
lea    0xd26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13d1 <main+0x261>
lea    0xd18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13d6 <main+0x266>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1392 <main+0x222>
lea    0xcfc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x60(%rbp),%rcx
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
lea    -0x40(%rbp),%rdx
mov    -0x18(%rbp),%r8d
call   1080 <iteractions@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x54(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
lea    0xee3(%rip),%rdi
call   1040 <puts@plt>
lea    0xe4c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe51(%rip),%r14
lea    -0x34(%rbp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0xe3f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    -0x30(%rbp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    %rsp,%r13
mov    -0x30(%rbp),%eax
mov    %rsp,%r12
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
lea    0xe0f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    -0x38(%rbp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0xe0b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
lea    0xe2a(%rip),%rdi
lea    -0x29(%rbp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    -0x29(%rbp),%al
cmp    $0x49,%al
jne    12b1 <main+0x121>
cmpl   $0x0,-0x30(%rbp)
jle    130a <main+0x17a>
mov    %r13,-0x68(%rbp)
lea    0xe07(%rip),%r14
lea    0xd9f(%rip),%r15
mov    %r12,%r13
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
add    $0x1,%rbx
movslq -0x30(%rbp),%rax
add    $0x4,%r13
cmp    %rax,%rbx
jl     1280 <main+0xf0>
mov    -0x29(%rbp),%al
mov    -0x68(%rbp),%r13
cmp    $0x52,%al
jne    130a <main+0x17a>
cmpl   $0x0,-0x30(%rbp)
jle    12f9 <main+0x169>
xor    %ebx,%ebx
nopl   (%rax)
xor    %eax,%eax
call   10b0 <rand@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%eax
mov    %eax,(%r12,%rbx,4)
xor    %edi,%edi
mov    $0x1,%esi
call   1090 <GetRand@plt>
mov    %eax,(%r12,%rbx,4)
add    $0x1,%rbx
movslq -0x30(%rbp),%rax
cmp    %rax,%rbx
jl     12c0 <main+0x130>
cmp    $0x2,%eax
jg     1312 <main+0x182>
lea    0xdde(%rip),%rdi
call   1040 <puts@plt>
jmp    13f5 <main+0x265>
mov    -0x30(%rbp),%eax
cmp    $0x2,%eax
jle    12f9 <main+0x169>
mov    -0x34(%rbp),%edi
lea    -0x60(%rbp),%rsi
call   1070 <intToBin@plt>
mov    -0x60(%rbp),%esi
lea    0xceb(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x5c(%rbp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x58(%rbp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x54(%rbp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x50(%rbp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x4c(%rbp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x48(%rbp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x44(%rbp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmpl   $0x0,-0x30(%rbp)
jle    13d3 <main+0x243>
lea    0xcdd(%rip),%r15
lea    0xcdb(%rip),%r14
xor    %ebx,%ebx
jmp    13c4 <main+0x234>
nop
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
movslq -0x30(%rbp),%rax
cmp    %rax,%rbx
jge    13d3 <main+0x243>
cmpl   $0x0,(%r12,%rbx,4)
mov    %r15,%rdi
je     13b0 <main+0x220>
mov    %r14,%rdi
jmp    13b0 <main+0x220>
lea    0xcfc(%rip),%rdi
call   1040 <puts@plt>
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0x38(%rbp),%r8d
lea    -0x60(%rbp),%rdx
mov    %r12,%rcx
call   10a0 <iteractions@plt>
mov    %r13,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [76 x i8] c"Hello there! This is a program to calculate Elementar Cellular Automatons.\0A\00"
@.str.1 = [19 x i8] c"N\CE\A6 (max is 255): \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [7 x i8] c"Size: \00"
@.str.4 = [24 x i8] c"Number of iteractions: \00"
@.str.5 = [59 x i8] c"Press I to insert the initial grid or R for a random one: \00"
@stdin = global i32 0
@.str.6 = [4 x i8] c" %c\00"
@.str.7 = [13 x i8] c"Position %d:\00"
@.str.8 = [16 x i8] c"Increase size.\0A\00"
@.str.9 = [2 x i8] c"\0A\00"
@.str.10 = [5 x i8] c"\E2\96\A1 \00"
@.str.11 = [5 x i8] c"\E2\96\A0 \00"
@.str.12 = [9 x i8] c" t=0 \0A \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = alloca [8 x i32]
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32
store i32 0, i32* %1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%17 = load i32, i32* %3
%18 = zext i32 %17 to i64
%19 = call i8* @llvm.stacksave()
store i8* %19, i8** %9
%20 = alloca i32, i64 %18
store i64 %18, i64* %10
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.5, i64 0, i64 0))
%24 = load i32, i32* @stdin
%25 = call i32 @fflush(i32 %24)
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %7)
%27 = load i8, i8* %7
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 73
br i1 %29, label %30, label %46
30: ; preds = %0
store i32 0, i32* %5
br label %31
31: ; preds = %42, %30
%32 = load i32, i32* %5
%33 = load i32, i32* %3
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %45
35: ; preds = %31
%36 = load i32, i32* %5
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %5
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %20, i64 %39
%41 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %40)
br label %42
42: ; preds = %35
%43 = load i32, i32* %5
%44 = add nsw i32 %43, 1
store i32 %44, i32* %5
br label %31
45: ; preds = %31
br label %46
46: ; preds = %45, %0
%47 = load i8, i8* %7
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 82
br i1 %49, label %50, label %69
50: ; preds = %46
store i32 0, i32* %5
br label %51
51: ; preds = %65, %50
%52 = load i32, i32* %5
%53 = load i32, i32* %3
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %68
55: ; preds = %51
%56 = call i32 (...) @rand()
%57 = srem i32 %56, 2
%58 = load i32, i32* %5
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i32, i32* %20, i64 %59
store i32 %57, i32* %60
%61 = call i32 @GetRand(i32 0, i32 1)
%62 = load i32, i32* %5
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i32, i32* %20, i64 %63
store i32 %61, i32* %64
br label %65
65: ; preds = %55
%66 = load i32, i32* %5
%67 = add nsw i32 %66, 1
store i32 %67, i32* %5
br label %51
68: ; preds = %51
br label %69
69: ; preds = %68, %46
%70 = load i32, i32* %3
%71 = icmp sle i32 %70, 2
br i1 %71, label %72, label %74
72: ; preds = %69
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %1
store i32 1, i32* %11
br label %118
74: ; preds = %69
%75 = load i32, i32* %2
%76 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 0
%77 = call i32 @intToBin(i32 %75, i32* %76)
br label %78
78: ; preds = %74
store i32 0, i32* %4
br label %79
79: ; preds = %88, %78
%80 = load i32, i32* %4
%81 = icmp slt i32 %80, 8
br i1 %81, label %82, label %91
82: ; preds = %79
%83 = load i32, i32* %4
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 %84
%86 = load i32, i32* %85
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %86)
br label %88
88: ; preds = %82
%89 = load i32, i32* %4
%90 = add nsw i32 %89, 1
store i32 %90, i32* %4
br label %79
91: ; preds = %79
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %4
br label %93
93: ; preds = %108, %91
%94 = load i32, i32* %4
%95 = load i32, i32* %3
%96 = icmp slt i32 %94, %95
br i1 %96, label %97, label %111
97: ; preds = %93
%98 = load i32, i32* %4
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i32, i32* %20, i64 %99
%101 = load i32, i32* %100
%102 = icmp eq i32 %101, 0
br i1 %102, label %103, label %105
103: ; preds = %97
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br label %107
105: ; preds = %97
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
br label %107
107: ; preds = %105, %103
br label %108
108: ; preds = %107
%109 = load i32, i32* %4
%110 = add nsw i32 %109, 1
store i32 %110, i32* %4
br label %93
111: ; preds = %93
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0))
%113 = load i32, i32* %2
%114 = load i32, i32* %3
%115 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 0
%116 = load i32, i32* %6
%117 = call i32 @iteractions(i32 %113, i32 %114, i32* %115, i32* %20, i32 %116)
store i32 0, i32* %1
store i32 1, i32* %11
br label %118
118: ; preds = %111, %72
%119 = load i8*, i8** %9
%120 = load i32, i32* %1
ret i32 %120
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"N\CE\A6 (max is 255): \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [7 x i8] c"Size: \00"
@.str.4 = [24 x i8] c"Number of iteractions: \00"
@.str.5 = [59 x i8] c"Press I to insert the initial grid or R for a random one: \00"
@stdin = global i32 0
@.str.6 = [4 x i8] c" %c\00"
@.str.7 = [13 x i8] c"Position %d:\00"
@.str.10 = [5 x i8] c"\E2\96\A1 \00"
@.str.11 = [5 x i8] c"\E2\96\A0 \00"
@str = [75 x i8] c"Hello there! This is a program to calculate Elementar Cellular Automatons.\00"
@str.13 = [8 x i8] c" t=0 \0A \00"
@str.14 = [15 x i8] c"Increase size.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = alloca [8 x i32]
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%14 = bitcast [8 x i32]* %5 to i8*
%15 = load i32, i32* %2
%16 = zext i32 %15 to i64
%17 = call i8* @llvm.stacksave()
%18 = alloca i32, i64 %16
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.5, i64 0, i64 0))
%22 = load i32, i32* @stdin
%23 = call i32 @fflush(i32 %22)
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %4)
%25 = load i8, i8* %4
%26 = icmp eq i8 %25, 73
br i1 %26, label %27, label %42
27: ; preds = %0
%28 = load i32, i32* %2
%29 = icmp sgt i32 %28, 0
br i1 %29, label %30, label %58
30: ; preds = %27, %30
%31 = phi i64 [ %36, %30 ], [ 0, %27 ]
%32 = trunc i64 %31 to i32
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %32)
%34 = getelementptr inbounds i32, i32* %18, i64 %31
%35 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %34)
%36 = add nuw nsw i64 %31, 1
%37 = load i32, i32* %2
%38 = sext i32 %37 to i64
%39 = icmp slt i64 %36, %38
br i1 %39, label %30, label %40
40: ; preds = %30
%41 = load i8, i8* %4
br label %42
42: ; preds = %40, %0
%43 = phi i8 [ %25, %0 ], [ %41, %40 ]
%44 = icmp eq i8 %43, 82
br i1 %44, label %45, label %58
45: ; preds = %42
%46 = load i32, i32* %2
%47 = icmp sgt i32 %46, 0
br i1 %47, label %48, label %63
48: ; preds = %45, %48
%49 = phi i64 [ %54, %48 ], [ 0, %45 ]
%50 = call i32 (...) @rand()
%51 = srem i32 %50, 2
%52 = getelementptr inbounds i32, i32* %18, i64 %49
store i32 %51, i32* %52
%53 = call i32 @GetRand(i32 0, i32 1)
store i32 %53, i32* %52
%54 = add nuw nsw i64 %49, 1
%55 = load i32, i32* %2
%56 = sext i32 %55 to i64
%57 = icmp slt i64 %54, %56
br i1 %57, label %48, label %60
58: ; preds = %27, %42
%59 = load i32, i32* %2
br label %60
60: ; preds = %48, %58
%61 = phi i32 [ %59, %58 ], [ %55, %48 ]
%62 = icmp slt i32 %61, 3
br i1 %62, label %63, label %65
63: ; preds = %45, %60
%64 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.14, i64 0, i64 0))
br label %112
65: ; preds = %60
%66 = load i32, i32* %1
%67 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 0
%68 = call i32 @intToBin(i32 %66, i32* %67)
%69 = load i32, i32* %67
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %69)
%71 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 1
%72 = load i32, i32* %71
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %72)
%74 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 2
%75 = load i32, i32* %74
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %75)
%77 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 3
%78 = load i32, i32* %77
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %78)
%80 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 4
%81 = load i32, i32* %80
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %81)
%83 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 5
%84 = load i32, i32* %83
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %84)
%86 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 6
%87 = load i32, i32* %86
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %87)
%89 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 7
%90 = load i32, i32* %89
%91 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %90)
%92 = call i32 @putchar(i32 10)
%93 = load i32, i32* %2
%94 = icmp sgt i32 %93, 0
br i1 %94, label %95, label %106
95: ; preds = %65, %95
%96 = phi i64 [ %102, %95 ], [ 0, %65 ]
%97 = getelementptr inbounds i32, i32* %18, i64 %96
%98 = load i32, i32* %97
%99 = icmp eq i32 %98, 0
%100 = select i1 %99, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0)
%101 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %100)
%102 = add nuw nsw i64 %96, 1
%103 = load i32, i32* %2
%104 = sext i32 %103 to i64
%105 = icmp slt i64 %102, %104
br i1 %105, label %95, label %106
106: ; preds = %95, %65
%107 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.13, i64 0, i64 0))
%108 = load i32, i32* %1
%109 = load i32, i32* %2
%110 = load i32, i32* %3
%111 = call i32 @iteractions(i32 %108, i32 %109, i32* %67, i32* %18, i32 %110)
br label %112
112: ; preds = %106, %63
ret i32 0
}