#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 */
typedef int /*<<< orphan*/ test_arr;
typedef int /*<<< orphan*/ ta2;
typedef int /*<<< orphan*/ ta1;
typedef int /*<<< orphan*/ resa;
typedef int /*<<< orphan*/ res;
typedef int /*<<< orphan*/ m4;
typedef int /*<<< orphan*/ m3;
typedef int /*<<< orphan*/ m2;
typedef int /*<<< orphan*/ m1;

/* Variables and functions */
int calc(int, int);
int checkRand3(int *, int);
int diff(int *, int *, int *, int);
int /*<<< orphan*/ fillRand(int *, int);
int /*<<< orphan*/ fillRand3(int *, int);
int maxOccurance(int *, int);
int meanIndex(int *, int);
double meanValue(int *, int);
int minIndex(int *, int);
int minValue(int *, int);
int /*<<< orphan*/ print_arr(int *, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ sub(int *, int *, int *, int);
int /*<<< orphan*/ test_automata(int *, int, int *, int);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main() {
  puts("Test loops");
  printf("calc(2,1): %lf \n", calc(2, 1));
  printf("calc(42,15): %lf \n\n", calc(42, 15));
  puts("Test arrays");
  srand(time(0));
  int test_arr[30];
  fillRand3(test_arr, (sizeof(test_arr) / sizeof((test_arr)[0])));
  print_arr(test_arr, (sizeof(test_arr) / sizeof((test_arr)[0])));
  fillRand3(test_arr, (sizeof(test_arr) / sizeof((test_arr)[0])));
  test_arr[29] = -42;
  print_arr(test_arr, (sizeof(test_arr) / sizeof((test_arr)[0])));
  printf("Check rand: %d\n",
         checkRand3(test_arr, (sizeof(test_arr) / sizeof((test_arr)[0]))));
  printf("Mean value: %f\n",
         meanValue(test_arr, (sizeof(test_arr) / sizeof((test_arr)[0]))));
  printf("Mean index: %d\n",
         meanIndex(test_arr, (sizeof(test_arr) / sizeof((test_arr)[0]))));
  printf("Min value: %d\n",
         minValue(test_arr, (sizeof(test_arr) / sizeof((test_arr)[0]))));
  printf("Min index: %d\n",
         minIndex(test_arr, (sizeof(test_arr) / sizeof((test_arr)[0]))));
  printf("Max occurances: %d\n",
         maxOccurance(test_arr, (sizeof(test_arr) / sizeof((test_arr)[0]))));
  puts("\nOperations on 2 arrays:");
  int ta1[4];
  fillRand(ta1, (sizeof(ta1) / sizeof((ta1)[0])));
  print_arr(ta1, (sizeof(ta1) / sizeof((ta1)[0])));
  int ta2[4];
  fillRand(ta2, (sizeof(ta2) / sizeof((ta2)[0])));
  print_arr(ta2, (sizeof(ta2) / sizeof((ta2)[0])));
  int resa[4];
  printf("diff res: %d\n",
         diff(ta1, ta2, resa, (sizeof(resa) / sizeof((resa)[0]))));
  print_arr(resa, (sizeof(resa) / sizeof((resa)[0])));
  printf("Diff shall return 1: %d\n",
         diff(resa, resa, resa, (sizeof(resa) / sizeof((resa)[0]))));
  puts("Sub:");
  print_arr(ta1, (sizeof(ta1) / sizeof((ta1)[0])));
  print_arr(ta2, (sizeof(ta2) / sizeof((ta2)[0])));
  sub(ta1, ta2, ta1, (sizeof(ta1) / sizeof((ta1)[0])));
  print_arr(ta1, (sizeof(ta1) / sizeof((ta1)[0])));
  puts("");
  puts("Testing automata");
  int res[1000];
  int m1[] = {1, 2, 3, 4, 5, 6};
  int m2[] = {10, 105, 10};
  int m3[] = {105, 105, 105, 105, 105, 105, 105};
  int m4[] = {10, 105, 105, 105, 105, 105, 5};
  test_automata(m1, (sizeof(m1) / sizeof((m1)[0])), res,
                (sizeof(res) / sizeof((res)[0])));
  test_automata(m2, (sizeof(m2) / sizeof((m2)[0])), res,
                (sizeof(res) / sizeof((res)[0])));
  test_automata(m3, (sizeof(m3) / sizeof((m3)[0])), res,
                (sizeof(res) / sizeof((res)[0])));
  test_automata(m3, (sizeof(m3) / sizeof((m3)[0])), res, 3);
  test_automata(m4, (sizeof(m4) / sizeof((m4)[0])), res,
                (sizeof(res) / sizeof((res)[0])));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10c0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xdd7(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1090 <calc@plt>
mov    %eax,%esi
lea    0xdc5(%rip),%rdi
call   1080 <printf@plt>
mov    $0x2a,%edi
mov    $0xf,%esi
call   1090 <calc@plt>
mov    %eax,%esi
lea    0xdb9(%rip),%rdi
call   1080 <printf@plt>
lea    0xdc1(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10f0 <time@plt>
mov    %eax,%edi
call   10b0 <srand@plt>
lea    -0x80(%rbp),%rdi
mov    $0x1e,%esi
call   1050 <fillRand3@plt>
lea    -0x80(%rbp),%rdi
mov    $0x1e,%esi
call   1070 <print_arr@plt>
lea    -0x80(%rbp),%rdi
mov    $0x1e,%esi
call   1050 <fillRand3@plt>
movl   $0xffffffd6,-0xc(%rbp)
lea    -0x80(%rbp),%rdi
mov    $0x1e,%esi
call   1070 <print_arr@plt>
lea    -0x80(%rbp),%rdi
mov    $0x1e,%esi
call   10a0 <checkRand3@plt>
mov    %eax,%esi
lea    0xd64(%rip),%rdi
call   1080 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    $0x1e,%esi
call   1110 <meanValue@plt>
cvttsd2si %xmm0,%esi
lea    0xd56(%rip),%rdi
call   1080 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    $0x1e,%esi
call   10d0 <meanIndex@plt>
mov    %eax,%esi
lea    0xd4a(%rip),%rdi
call   1080 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    $0x1e,%esi
call   10c0 <minValue@plt>
mov    %eax,%esi
lea    0xd3e(%rip),%rdi
call   1080 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    $0x1e,%esi
call   10e0 <minIndex@plt>
mov    %eax,%esi
lea    0xd31(%rip),%rdi
call   1080 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    $0x1e,%esi
call   1040 <maxOccurance@plt>
mov    %eax,%esi
lea    0xd24(%rip),%rdi
call   1080 <printf@plt>
lea    0xd2c(%rip),%rdi
call   1030 <puts@plt>
lea    -0x90(%rbp),%rdi
mov    $0x4,%esi
call   1060 <fillRand@plt>
lea    -0x90(%rbp),%rdi
mov    $0x4,%esi
call   1070 <print_arr@plt>
lea    -0xa0(%rbp),%rdi
mov    $0x4,%esi
call   1060 <fillRand@plt>
lea    -0xa0(%rbp),%rdi
mov    $0x4,%esi
call   1070 <print_arr@plt>
lea    -0x90(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
mov    $0x4,%ecx
call   1130 <diff@plt>
mov    %eax,%esi
lea    0xcd4(%rip),%rdi
call   1080 <printf@plt>
lea    -0xb0(%rbp),%rdi
mov    $0x4,%esi
call   1070 <print_arr@plt>
lea    -0xb0(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
mov    $0x4,%ecx
call   1130 <diff@plt>
mov    %eax,%esi
lea    0xca4(%rip),%rdi
call   1080 <printf@plt>
lea    0xcb1(%rip),%rdi
call   1030 <puts@plt>
lea    -0x90(%rbp),%rdi
mov    $0x4,%esi
call   1070 <print_arr@plt>
lea    -0xa0(%rbp),%rdi
mov    $0x4,%esi
call   1070 <print_arr@plt>
lea    -0x90(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
lea    -0x90(%rbp),%rdx
mov    $0x4,%ecx
call   1120 <sub@plt>
lea    -0x90(%rbp),%rdi
mov    $0x4,%esi
call   1070 <print_arr@plt>
lea    0xba4(%rip),%rdi
call   1030 <puts@plt>
lea    0xc4c(%rip),%rdi
call   1030 <puts@plt>
mov    0xc5d(%rip),%rax
mov    %rax,-0x1070(%rbp)
mov    0xc57(%rip),%rax
mov    %rax,-0x1068(%rbp)
mov    0xc51(%rip),%rax
mov    %rax,-0x1060(%rbp)
mov    0xc4b(%rip),%rax
mov    %rax,-0x107c(%rbp)
mov    0xc46(%rip),%eax
mov    %eax,-0x1074(%rbp)
mov    0xc49(%rip),%rax
mov    %rax,-0x10a0(%rbp)
mov    0xc43(%rip),%rax
mov    %rax,-0x1098(%rbp)
mov    0xc3d(%rip),%rax
mov    %rax,-0x1090(%rbp)
mov    0xc38(%rip),%eax
mov    %eax,-0x1088(%rbp)
mov    0xc33(%rip),%rax
mov    %rax,-0x10c0(%rbp)
mov    0xc2d(%rip),%rax
mov    %rax,-0x10b8(%rbp)
mov    0xc27(%rip),%rax
mov    %rax,-0x10b0(%rbp)
mov    0xc22(%rip),%eax
mov    %eax,-0x10a8(%rbp)
lea    -0x1070(%rbp),%rdi
lea    -0x1050(%rbp),%rdx
mov    $0x6,%esi
mov    $0x3e8,%ecx
call   1100 <test_automata@plt>
lea    -0x107c(%rbp),%rdi
lea    -0x1050(%rbp),%rdx
mov    $0x3,%esi
mov    $0x3e8,%ecx
call   1100 <test_automata@plt>
lea    -0x10a0(%rbp),%rdi
lea    -0x1050(%rbp),%rdx
mov    $0x7,%esi
mov    $0x3e8,%ecx
call   1100 <test_automata@plt>
lea    -0x10a0(%rbp),%rdi
lea    -0x1050(%rbp),%rdx
mov    $0x7,%esi
mov    $0x3,%ecx
call   1100 <test_automata@plt>
lea    -0x10c0(%rbp),%rdi
lea    -0x1050(%rbp),%rdx
mov    $0x7,%esi
mov    $0x3e8,%ecx
call   1100 <test_automata@plt>
xor    %eax,%eax
add    $0x10c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10c0,%rsp
lea    0xdcd(%rip),%rdi
call   1040 <puts@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   10a0 <calc@plt>
lea    0xdbd(%rip),%rdi
mov    %eax,%esi
call   1090 <printf@plt>
mov    $0x2a,%edi
mov    $0xf,%esi
call   10a0 <calc@plt>
lea    0xdb1(%rip),%rdi
mov    %eax,%esi
call   1090 <printf@plt>
lea    0xdb7(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1100 <time@plt>
mov    %eax,%edi
call   10c0 <srand@plt>
lea    0xa0(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1060 <fillRand3@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1080 <print_arr@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1060 <fillRand3@plt>
movl   $0xffffffd6,0x114(%rsp)
d6 ff ff ff
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1080 <print_arr@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
call   10b0 <checkRand3@plt>
lea    0xd55(%rip),%rdi
mov    %eax,%esi
call   1090 <printf@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1120 <meanValue@plt>
cvttsd2si %xmm0,%esi
lea    0xd46(%rip),%rdi
call   1090 <printf@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
call   10e0 <meanIndex@plt>
lea    0xd3d(%rip),%rdi
mov    %eax,%esi
call   1090 <printf@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
call   10d0 <minValue@plt>
lea    0xd32(%rip),%rdi
mov    %eax,%esi
call   1090 <printf@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
call   10f0 <minIndex@plt>
lea    0xd26(%rip),%rdi
mov    %eax,%esi
call   1090 <printf@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1050 <maxOccurance@plt>
lea    0xd1a(%rip),%rdi
mov    %eax,%esi
call   1090 <printf@plt>
lea    0xd20(%rip),%rdi
call   1040 <puts@plt>
lea    0x90(%rsp),%r15
mov    %r15,%rdi
mov    $0x4,%esi
call   1070 <fillRand@plt>
mov    %r15,%rdi
mov    $0x4,%esi
call   1080 <print_arr@plt>
lea    0x80(%rsp),%r14
mov    %r14,%rdi
mov    $0x4,%esi
call   1070 <fillRand@plt>
mov    %r14,%rdi
mov    $0x4,%esi
call   1080 <print_arr@plt>
lea    0x70(%rsp),%rbx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    $0x4,%ecx
call   1140 <diff@plt>
lea    0xcd1(%rip),%rdi
mov    %eax,%esi
call   1090 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1080 <print_arr@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
mov    $0x4,%ecx
call   1140 <diff@plt>
lea    0xcb1(%rip),%rdi
mov    %eax,%esi
call   1090 <printf@plt>
lea    0xcbc(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
mov    $0x4,%esi
call   1080 <print_arr@plt>
mov    %r14,%rdi
mov    $0x4,%esi
call   1080 <print_arr@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    $0x4,%ecx
call   1130 <sub@plt>
mov    %r15,%rdi
mov    $0x4,%esi
call   1080 <print_arr@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xc71(%rip),%rdi
call   1040 <puts@plt>
mov    0xc92(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xc76(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    0xc8b(%rip),%eax
mov    %eax,0x8(%rsp)
mov    0xc78(%rip),%rax
mov    %rax,(%rsp)
movups 0xc91(%rip),%xmm0
movups %xmm0,0x5c(%rsp)
movaps 0xc79(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movups 0xc99(%rip),%xmm0
movups %xmm0,0x3c(%rsp)
movaps 0xc81(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0x10(%rsp),%rdi
lea    0x120(%rsp),%rbx
mov    $0x6,%esi
mov    %rbx,%rdx
mov    $0x3e8,%ecx
call   1110 <test_automata@plt>
mov    %rsp,%rdi
mov    $0x3,%esi
mov    %rbx,%rdx
mov    $0x3e8,%ecx
call   1110 <test_automata@plt>
lea    0x50(%rsp),%r14
mov    %r14,%rdi
mov    $0x7,%esi
mov    %rbx,%rdx
mov    $0x3e8,%ecx
call   1110 <test_automata@plt>
mov    %r14,%rdi
mov    $0x7,%esi
mov    %rbx,%rdx
mov    $0x3,%ecx
call   1110 <test_automata@plt>
lea    0x30(%rsp),%rdi
mov    $0x7,%esi
mov    %rbx,%rdx
mov    $0x3e8,%ecx
call   1110 <test_automata@plt>
xor    %eax,%eax
add    $0x10c0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Test loops\00"
@.str.1 = [17 x i8] c"calc(2,1): %lf \0A\00"
@.str.2 = [20 x i8] c"calc(42,15): %lf \0A\0A\00"
@.str.3 = [12 x i8] c"Test arrays\00"
@.str.4 = [16 x i8] c"Check rand: %d\0A\00"
@.str.5 = [16 x i8] c"Mean value: %f\0A\00"
@.str.6 = [16 x i8] c"Mean index: %d\0A\00"
@.str.7 = [15 x i8] c"Min value: %d\0A\00"
@.str.8 = [15 x i8] c"Min index: %d\0A\00"
@.str.9 = [20 x i8] c"Max occurances: %d\0A\00"
@.str.10 = [25 x i8] c"\0AOperations on 2 arrays:\00"
@.str.11 = [14 x i8] c"diff res: %d\0A\00"
@.str.12 = [25 x i8] c"Diff shall return 1: %d\0A\00"
@.str.13 = [5 x i8] c"Sub:\00"
@.str.14 = [1 x i8] zeroinitializer
@.str.15 = [17 x i8] c"Testing automata\00"
@__const.main.m1 = [6 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6]
@__const.main.m2 = [3 x i32] [i32 10, i32 105, i32 10]
@__const.main.m3 = [7 x i32] [i32 105, i32 105, i32 105, i32 105, i32 105, i32 105, i32 105]
@__const.main.m4 = [7 x i32] [i32 10, i32 105, i32 105, i32 105, i32 105, i32 105, i32 5]
define i32 @main() {
%1 = alloca i32
%2 = alloca [30 x i32]
%3 = alloca [4 x i32]
%4 = alloca [4 x i32]
%5 = alloca [4 x i32]
%6 = alloca [1000 x i32]
%7 = alloca [6 x i32]
%8 = alloca [3 x i32]
%9 = alloca [7 x i32]
%10 = alloca [7 x i32]
store i32 0, i32* %1
%11 = call i32 @puts(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @calc(i32 2, i32 1)
%13 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = call i32 @calc(i32 42, i32 15)
%15 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 @time(i32 0)
%18 = call i32 @srand(i32 %17)
%19 = getelementptr inbounds [30 x i32], [30 x i32]* %2, i64 0, i64 0
%20 = call i32 @fillRand3(i32* %19, i32 30)
%21 = getelementptr inbounds [30 x i32], [30 x i32]* %2, i64 0, i64 0
%22 = call i32 @print_arr(i32* %21, i32 30)
%23 = getelementptr inbounds [30 x i32], [30 x i32]* %2, i64 0, i64 0
%24 = call i32 @fillRand3(i32* %23, i32 30)
%25 = getelementptr inbounds [30 x i32], [30 x i32]* %2, i64 0, i64 29
store i32 -42, i32* %25
%26 = getelementptr inbounds [30 x i32], [30 x i32]* %2, i64 0, i64 0
%27 = call i32 @print_arr(i32* %26, i32 30)
%28 = getelementptr inbounds [30 x i32], [30 x i32]* %2, i64 0, i64 0
%29 = call i32 @checkRand3(i32* %28, i32 30)
%30 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds [30 x i32], [30 x i32]* %2, i64 0, i64 0
%32 = call double @meanValue(i32* %31, i32 30)
%33 = fptosi double %32 to i32
%34 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %33)
%35 = getelementptr inbounds [30 x i32], [30 x i32]* %2, i64 0, i64 0
%36 = call i32 @meanIndex(i32* %35, i32 30)
%37 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i32 %36)
%38 = getelementptr inbounds [30 x i32], [30 x i32]* %2, i64 0, i64 0
%39 = call i32 @minValue(i32* %38, i32 30)
%40 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 %39)
%41 = getelementptr inbounds [30 x i32], [30 x i32]* %2, i64 0, i64 0
%42 = call i32 @minIndex(i32* %41, i32 30)
%43 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i32 %42)
%44 = getelementptr inbounds [30 x i32], [30 x i32]* %2, i64 0, i64 0
%45 = call i32 @maxOccurance(i32* %44, i32 30)
%46 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i32 %45)
%47 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
%48 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%49 = call i32 @fillRand(i32* %48, i32 4)
%50 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%51 = call i32 @print_arr(i32* %50, i32 4)
%52 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%53 = call i32 @fillRand(i32* %52, i32 4)
%54 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%55 = call i32 @print_arr(i32* %54, i32 4)
%56 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%57 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%58 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%59 = call i32 @diff(i32* %56, i32* %57, i32* %58, i32 4)
%60 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i32 %59)
%61 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%62 = call i32 @print_arr(i32* %61, i32 4)
%63 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%64 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%65 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%66 = call i32 @diff(i32* %63, i32* %64, i32* %65, i32 4)
%67 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.12, i64 0, i64 0), i32 %66)
%68 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
%69 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%70 = call i32 @print_arr(i32* %69, i32 4)
%71 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%72 = call i32 @print_arr(i32* %71, i32 4)
%73 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%74 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%75 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%76 = call i32 @sub(i32* %73, i32* %74, i32* %75, i32 4)
%77 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%78 = call i32 @print_arr(i32* %77, i32 4)
%79 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.14, i64 0, i64 0))
%80 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0))
%81 = bitcast [6 x i32]* %7 to i8*
%82 = bitcast [3 x i32]* %8 to i8*
%83 = bitcast [7 x i32]* %9 to i8*
%84 = bitcast [7 x i32]* %10 to i8*
%85 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 0
%86 = getelementptr inbounds [1000 x i32], [1000 x i32]* %6, i64 0, i64 0
%87 = call i32 @test_automata(i32* %85, i32 6, i32* %86, i32 1000)
%88 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 0
%89 = getelementptr inbounds [1000 x i32], [1000 x i32]* %6, i64 0, i64 0
%90 = call i32 @test_automata(i32* %88, i32 3, i32* %89, i32 1000)
%91 = getelementptr inbounds [7 x i32], [7 x i32]* %9, i64 0, i64 0
%92 = getelementptr inbounds [1000 x i32], [1000 x i32]* %6, i64 0, i64 0
%93 = call i32 @test_automata(i32* %91, i32 7, i32* %92, i32 1000)
%94 = getelementptr inbounds [7 x i32], [7 x i32]* %9, i64 0, i64 0
%95 = getelementptr inbounds [1000 x i32], [1000 x i32]* %6, i64 0, i64 0
%96 = call i32 @test_automata(i32* %94, i32 7, i32* %95, i32 3)
%97 = getelementptr inbounds [7 x i32], [7 x i32]* %10, i64 0, i64 0
%98 = getelementptr inbounds [1000 x i32], [1000 x i32]* %6, i64 0, i64 0
%99 = call i32 @test_automata(i32* %97, i32 7, i32* %98, i32 1000)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"Test loops\00"
@.str.1 = [17 x i8] c"calc(2,1): %lf \0A\00"
@.str.2 = [20 x i8] c"calc(42,15): %lf \0A\0A\00"
@.str.3 = [12 x i8] c"Test arrays\00"
@.str.4 = [16 x i8] c"Check rand: %d\0A\00"
@.str.5 = [16 x i8] c"Mean value: %f\0A\00"
@.str.6 = [16 x i8] c"Mean index: %d\0A\00"
@.str.7 = [15 x i8] c"Min value: %d\0A\00"
@.str.8 = [15 x i8] c"Min index: %d\0A\00"
@.str.9 = [20 x i8] c"Max occurances: %d\0A\00"
@.str.10 = [25 x i8] c"\0AOperations on 2 arrays:\00"
@.str.11 = [14 x i8] c"diff res: %d\0A\00"
@.str.12 = [25 x i8] c"Diff shall return 1: %d\0A\00"
@.str.13 = [5 x i8] c"Sub:\00"
@.str.15 = [17 x i8] c"Testing automata\00"
@__const.main.m1 = [6 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6]
@__const.main.m2 = [3 x i32] [i32 10, i32 105, i32 10]
@__const.main.m3 = [7 x i32] [i32 105, i32 105, i32 105, i32 105, i32 105, i32 105, i32 105]
@__const.main.m4 = [7 x i32] [i32 10, i32 105, i32 105, i32 105, i32 105, i32 105, i32 5]
define i32 @main() {
%1 = alloca [30 x i32]
%2 = alloca [4 x i32]
%3 = alloca [4 x i32]
%4 = alloca [4 x i32]
%5 = alloca [1000 x i32]
%6 = alloca [6 x i32]
%7 = alloca [3 x i32]
%8 = alloca [7 x i32]
%9 = alloca [7 x i32]
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @calc(i32 2, i32 1)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = tail call i32 @calc(i32 42, i32 15)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%16 = tail call i32 @time(i32 0)
%17 = tail call i32 @srand(i32 %16)
%18 = bitcast [30 x i32]* %1 to i8*
%19 = getelementptr inbounds [30 x i32], [30 x i32]* %1, i64 0, i64 0
%20 = call i32 @fillRand3(i32* %19, i32 30)
%21 = call i32 @print_arr(i32* %19, i32 30)
%22 = call i32 @fillRand3(i32* %19, i32 30)
%23 = getelementptr inbounds [30 x i32], [30 x i32]* %1, i64 0, i64 29
store i32 -42, i32* %23
%24 = call i32 @print_arr(i32* %19, i32 30)
%25 = call i32 @checkRand3(i32* %19, i32 30)
%26 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %25)
%27 = call double @meanValue(i32* %19, i32 30)
%28 = fptosi double %27 to i32
%29 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %28)
%30 = call i32 @meanIndex(i32* %19, i32 30)
%31 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i32 %30)
%32 = call i32 @minValue(i32* %19, i32 30)
%33 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 %32)
%34 = call i32 @minIndex(i32* %19, i32 30)
%35 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i32 %34)
%36 = call i32 @maxOccurance(i32* %19, i32 30)
%37 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i32 %36)
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
%39 = bitcast [4 x i32]* %2 to i8*
%40 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%41 = call i32 @fillRand(i32* %40, i32 4)
%42 = call i32 @print_arr(i32* %40, i32 4)
%43 = bitcast [4 x i32]* %3 to i8*
%44 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%45 = call i32 @fillRand(i32* %44, i32 4)
%46 = call i32 @print_arr(i32* %44, i32 4)
%47 = bitcast [4 x i32]* %4 to i8*
%48 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%49 = call i32 @diff(i32* %40, i32* %44, i32* %48, i32 4)
%50 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i32 %49)
%51 = call i32 @print_arr(i32* %48, i32 4)
%52 = call i32 @diff(i32* %48, i32* %48, i32* %48, i32 4)
%53 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.12, i64 0, i64 0), i32 %52)
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
%55 = call i32 @print_arr(i32* %40, i32 4)
%56 = call i32 @print_arr(i32* %44, i32 4)
%57 = call i32 @sub(i32* %40, i32* %44, i32* %40, i32 4)
%58 = call i32 @print_arr(i32* %40, i32 4)
%59 = call i32 @putchar(i32 10)
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0))
%61 = bitcast [1000 x i32]* %5 to i8*
%62 = bitcast [6 x i32]* %6 to i8*
%63 = bitcast [3 x i32]* %7 to i8*
%64 = bitcast [7 x i32]* %8 to i8*
%65 = bitcast [7 x i32]* %9 to i8*
%66 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%67 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 0
%68 = call i32 @test_automata(i32* %66, i32 6, i32* %67, i32 1000)
%69 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%70 = call i32 @test_automata(i32* %69, i32 3, i32* %67, i32 1000)
%71 = getelementptr inbounds [7 x i32], [7 x i32]* %8, i64 0, i64 0
%72 = call i32 @test_automata(i32* %71, i32 7, i32* %67, i32 1000)
%73 = call i32 @test_automata(i32* %71, i32 7, i32* %67, i32 3)
%74 = getelementptr inbounds [7 x i32], [7 x i32]* %9, i64 0, i64 0
%75 = call i32 @test_automata(i32* %74, i32 7, i32* %67, i32 1000)
ret i32 0
}