#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, double);
double omp_get_wtime();
scalar_t__ rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int i, j, k, N;
  float A[100][100], B[100][100], C[100][100];
  double start, end, time_result[100];
  FILE *file;
  for (N = 3; N < 100; N++) {
    srand(time(NULL));
    for (i = 0; i < N; i++)
      for (j = 0; j < N; j++) {
        A[i][j] = (float)rand() / 10;
        B[i][j] = (float)rand() / 10;
      }
    start = omp_get_wtime();
    for (i = 0; i < N; i++)
      for (j = 0; j < N; j++) {
        C[i][j] = 0;
        for (k = 0; k < N; k++)
          C[i][j] += A[i][k] * B[k][j];
      }
    end = omp_get_wtime();
    time_result[N] = end - start;
  }
  file = fopen("/home/user/Labs/Semestr tasks/Matrix/C/result_float.txt", "w");
  for (N = 3; N < 100; N++)
    fprintf(file, "%lf\n", time_result[N]);
  fclose(file);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d820,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    1394 <main+0x224>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1256 <main+0xe6>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1243 <main+0xd3>
mov    $0x0,%al
call   1090 <rand@plt>
cvtsi2ss %rax,%xmm0
movss  0xe23(%rip),%xmm1
divss  %xmm1,%xmm0
movslq -0x8(%rbp),%rcx
lea    -0x9c60(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    $0x0,%al
call   1090 <rand@plt>
cvtsi2ss %rax,%xmm0
movss  0xded(%rip),%xmm1
divss  %xmm1,%xmm0
movslq -0x8(%rbp),%rcx
lea    -0x138a0(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11bd <main+0x4d>
jmp    1248 <main+0xd8>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11aa <main+0x3a>
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x1d4e8(%rbp)
ff
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    135a <main+0x1ea>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1347 <main+0x1d7>
movslq -0x8(%rbp),%rcx
lea    -0x1d4e0(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1334 <main+0x1c4>
movslq -0x8(%rbp),%rcx
lea    -0x9c60(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movslq -0x10(%rbp),%rcx
lea    -0x138a0(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm2
movslq -0x8(%rbp),%rcx
lea    -0x1d4e0(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    12b3 <main+0x143>
jmp    1339 <main+0x1c9>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    127f <main+0x10f>
jmp    134c <main+0x1dc>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    126c <main+0xfc>
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x1d4f0(%rbp)
ff
movsd  -0x1d4f0(%rbp),%xmm0
ff
subsd  -0x1d4e8(%rbp),%xmm0
ff
movslq -0x14(%rbp),%rax
movsd  %xmm0,-0x1d810(%rbp,%rax,8)
fe ff
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1189 <main+0x19>
lea    0xc69(%rip),%rdi
lea    0xc9a(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x1d818(%rbp)
movl   $0x3,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    13ed <main+0x27d>
mov    -0x1d818(%rbp),%rdi
movslq -0x14(%rbp),%rax
movsd  -0x1d810(%rbp,%rax,8),%xmm0
fe ff
lea    0xc64(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    13b5 <main+0x245>
mov    -0x1d818(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x1d820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x330,%rsp
mov    $0x3,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1090 <rand@plt>
xor    %eax,%eax
call   1090 <rand@plt>
add    $0xffffffffffffffff,%rbx
jne    11c0 <main+0x50>
add    $0x1,%r15
cmp    %r14,%r15
jne    11b0 <main+0x40>
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
subsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp,%r14,8)
add    $0x1,%r14
cmp    $0x64,%r14
jne    1190 <main+0x20>
lea    0xdf1(%rip),%rdi
lea    0xe22(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r15
mov    $0x3,%ebx
lea    0xe10(%rip),%r14
nopw   0x0(%rax,%rax,1)
movsd  0x10(%rsp,%rbx,8),%xmm0
mov    %r15,%rdi
mov    %r14,%rsi
call   1060 <fprintf@plt>
add    $0x1,%rbx
cmp    $0x64,%rbx
jne    1230 <main+0xc0>
mov    %r15,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x330,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [56 x i8] c"/home/user/Labs/Semestr tasks/Matrix/C/result_float.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [5 x i8] c"%lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [100 x [100 x float]]
%7 = alloca [100 x [100 x float]]
%8 = alloca [100 x [100 x float]]
%9 = alloca double
%10 = alloca double
%11 = alloca [100 x double]
%12 = alloca i32*
store i32 0, i32* %1
store i32 3, i32* %5
br label %13
13: ; preds = %118, %0
%14 = load i32, i32* %5
%15 = icmp slt i32 %14, 100
br i1 %15, label %16, label %121
16: ; preds = %13
%17 = call i32 @time(i32* null)
%18 = call i32 @srand(i32 %17)
store i32 0, i32* %2
br label %19
19: ; preds = %51, %16
%20 = load i32, i32* %2
%21 = load i32, i32* %5
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %54
23: ; preds = %19
store i32 0, i32* %3
br label %24
24: ; preds = %47, %23
%25 = load i32, i32* %3
%26 = load i32, i32* %5
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %50
28: ; preds = %24
%29 = call i64 (...) @rand()
%30 = sitofp i64 %29 to float
%31 = fdiv float %30, 1.000000e+01
%32 = load i32, i32* %2
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %6, i64 0, i64 %33
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [100 x float], [100 x float]* %34, i64 0, i64 %36
store float %31, float* %37
%38 = call i64 (...) @rand()
%39 = sitofp i64 %38 to float
%40 = fdiv float %39, 1.000000e+01
%41 = load i32, i32* %2
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %7, i64 0, i64 %42
%44 = load i32, i32* %3
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [100 x float], [100 x float]* %43, i64 0, i64 %45
store float %40, float* %46
br label %47
47: ; preds = %28
%48 = load i32, i32* %3
%49 = add nsw i32 %48, 1
store i32 %49, i32* %3
br label %24
50: ; preds = %24
br label %51
51: ; preds = %50
%52 = load i32, i32* %2
%53 = add nsw i32 %52, 1
store i32 %53, i32* %2
br label %19
54: ; preds = %19
%55 = call double (...) @omp_get_wtime()
store double %55, double* %9
store i32 0, i32* %2
br label %56
56: ; preds = %107, %54
%57 = load i32, i32* %2
%58 = load i32, i32* %5
%59 = icmp slt i32 %57, %58
br i1 %59, label %60, label %110
60: ; preds = %56
store i32 0, i32* %3
br label %61
61: ; preds = %103, %60
%62 = load i32, i32* %3
%63 = load i32, i32* %5
%64 = icmp slt i32 %62, %63
br i1 %64, label %65, label %106
65: ; preds = %61
%66 = load i32, i32* %2
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %8, i64 0, i64 %67
%69 = load i32, i32* %3
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [100 x float], [100 x float]* %68, i64 0, i64 %70
store float 0.000000e+00, float* %71
store i32 0, i32* %4
br label %72
72: ; preds = %99, %65
%73 = load i32, i32* %4
%74 = load i32, i32* %5
%75 = icmp slt i32 %73, %74
br i1 %75, label %76, label %102
76: ; preds = %72
%77 = load i32, i32* %2
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %6, i64 0, i64 %78
%80 = load i32, i32* %4
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [100 x float], [100 x float]* %79, i64 0, i64 %81
%83 = load float, float* %82
%84 = load i32, i32* %4
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %7, i64 0, i64 %85
%87 = load i32, i32* %3
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [100 x float], [100 x float]* %86, i64 0, i64 %88
%90 = load float, float* %89
%91 = load i32, i32* %2
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %8, i64 0, i64 %92
%94 = load i32, i32* %3
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [100 x float], [100 x float]* %93, i64 0, i64 %95
%97 = load float, float* %96
%98 = call float @llvm.fmuladd.f32(float %83, float %90, float %97)
store float %98, float* %96
br label %99
99: ; preds = %76
%100 = load i32, i32* %4
%101 = add nsw i32 %100, 1
store i32 %101, i32* %4
br label %72
102: ; preds = %72
br label %103
103: ; preds = %102
%104 = load i32, i32* %3
%105 = add nsw i32 %104, 1
store i32 %105, i32* %3
br label %61
106: ; preds = %61
br label %107
107: ; preds = %106
%108 = load i32, i32* %2
%109 = add nsw i32 %108, 1
store i32 %109, i32* %2
br label %56
110: ; preds = %56
%111 = call double (...) @omp_get_wtime()
store double %111, double* %10
%112 = load double, double* %10
%113 = load double, double* %9
%114 = fsub double %112, %113
%115 = load i32, i32* %5
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [100 x double], [100 x double]* %11, i64 0, i64 %116
store double %114, double* %117
br label %118
118: ; preds = %110
%119 = load i32, i32* %5
%120 = add nsw i32 %119, 1
store i32 %120, i32* %5
br label %13
121: ; preds = %13
%122 = call i32* @fopen(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %122, i32** %12
store i32 3, i32* %5
br label %123
123: ; preds = %133, %121
%124 = load i32, i32* %5
%125 = icmp slt i32 %124, 100
br i1 %125, label %126, label %136
126: ; preds = %123
%127 = load i32*, i32** %12
%128 = load i32, i32* %5
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds [100 x double], [100 x double]* %11, i64 0, i64 %129
%131 = load double, double* %130
%132 = call i32 @fprintf(i32* %127, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %131)
br label %133
133: ; preds = %126
%134 = load i32, i32* %5
%135 = add nsw i32 %134, 1
store i32 %135, i32* %5
br label %123
136: ; preds = %123
%137 = load i32*, i32** %12
%138 = call i32 @fclose(i32* %137)
%139 = load i32, i32* %1
ret i32 %139
}

LLVM IR (-O2):
@.str = [56 x i8] c"/home/user/Labs/Semestr tasks/Matrix/C/result_float.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [5 x i8] c"%lf\0A\00"
define i32 @main() {
%1 = alloca [100 x double]
%2 = bitcast [100 x double]* %1 to i8*
br label %3
3: ; preds = %0, %18
%4 = phi i64 [ 3, %0 ], [ %23, %18 ]
%5 = tail call i32 @time(i32* null)
%6 = tail call i32 @srand(i32 %5)
br label %7
7: ; preds = %3, %15
%8 = phi i64 [ 0, %3 ], [ %16, %15 ]
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %13, %9 ]
%11 = tail call i64 (...) @rand()
%12 = tail call i64 (...) @rand()
%13 = add nuw nsw i64 %10, 1
%14 = icmp eq i64 %13, %4
br i1 %14, label %15, label %9
15: ; preds = %9
%16 = add nuw nsw i64 %8, 1
%17 = icmp eq i64 %16, %4
br i1 %17, label %18, label %7
18: ; preds = %15
%19 = tail call double (...) @omp_get_wtime()
%20 = tail call double (...) @omp_get_wtime()
%21 = fsub double %20, %19
%22 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 0, i64 %4
store double %21, double* %22
%23 = add nuw nsw i64 %4, 1
%24 = icmp eq i64 %23, 100
br i1 %24, label %25, label %3
25: ; preds = %18
%26 = tail call i32* @fopen(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %25, %27
%28 = phi i64 [ 3, %25 ], [ %32, %27 ]
%29 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 0, i64 %28
%30 = load double, double* %29
%31 = tail call i32 @fprintf(i32* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %30)
%32 = add nuw nsw i64 %28, 1
%33 = icmp eq i64 %32, 100
br i1 %33, label %34, label %27
34: ; preds = %27
%35 = tail call i32 @fclose(i32* %26)
ret i32 0
}