#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();
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int i, j, k, N;
  int 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] = rand() % 10;
        B[i][j] = 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_int.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    136e <main+0x1fe>
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    1240 <main+0xd0>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    122d <main+0xbd>
mov    $0x0,%al
call   1090 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
movslq -0x8(%rbp),%rcx
lea    -0x9c60(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    $0x0,%al
call   1090 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
movslq -0x8(%rbp),%rcx
lea    -0x138a0(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11bd <main+0x4d>
jmp    1232 <main+0xc2>
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    1334 <main+0x1c4>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1321 <main+0x1b1>
movslq -0x8(%rbp),%rcx
lea    -0x1d4e0(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    130e <main+0x19e>
movslq -0x8(%rbp),%rcx
lea    -0x9c60(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
movslq -0x10(%rbp),%rcx
lea    -0x138a0(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
imul   (%rax,%rcx,4),%edx
movslq -0x8(%rbp),%rcx
lea    -0x1d4e0(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
add    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    129c <main+0x12c>
jmp    1313 <main+0x1a3>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1269 <main+0xf9>
jmp    1326 <main+0x1b6>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1256 <main+0xe6>
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    0xc8b(%rip),%rdi
lea    0xcba(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x1d818(%rbp)
movl   $0x3,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    13c7 <main+0x257>
mov    -0x1d818(%rbp),%rdi
movslq -0x14(%rbp),%rax
movsd  -0x1d810(%rbp,%rax,8),%xmm0
fe ff
lea    0xc84(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    138f <main+0x21f>
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,%r15d
cmp    %r15,%r14
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    0xe20(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r15
mov    $0x3,%ebx
lea    0xe0e(%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 = [54 x i8] c"/home/user/Labs/Semestr tasks/Matrix/C/result_int.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 i32]]
%7 = alloca [100 x [100 x i32]]
%8 = alloca [100 x [100 x i32]]
%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 = %117, %0
%14 = load i32, i32* %5
%15 = icmp slt i32 %14, 100
br i1 %15, label %16, label %120
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 = %49, %16
%20 = load i32, i32* %2
%21 = load i32, i32* %5
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %52
23: ; preds = %19
store i32 0, i32* %3
br label %24
24: ; preds = %45, %23
%25 = load i32, i32* %3
%26 = load i32, i32* %5
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %48
28: ; preds = %24
%29 = call i32 (...) @rand()
%30 = srem i32 %29, 10
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %6, i64 0, i64 %32
%34 = load i32, i32* %3
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [100 x i32], [100 x i32]* %33, i64 0, i64 %35
store i32 %30, i32* %36
%37 = call i32 (...) @rand()
%38 = srem i32 %37, 10
%39 = load i32, i32* %2
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %7, i64 0, i64 %40
%42 = load i32, i32* %3
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [100 x i32], [100 x i32]* %41, i64 0, i64 %43
store i32 %38, i32* %44
br label %45
45: ; preds = %28
%46 = load i32, i32* %3
%47 = add nsw i32 %46, 1
store i32 %47, i32* %3
br label %24
48: ; preds = %24
br label %49
49: ; preds = %48
%50 = load i32, i32* %2
%51 = add nsw i32 %50, 1
store i32 %51, i32* %2
br label %19
52: ; preds = %19
%53 = call double (...) @omp_get_wtime()
store double %53, double* %9
store i32 0, i32* %2
br label %54
54: ; preds = %106, %52
%55 = load i32, i32* %2
%56 = load i32, i32* %5
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %109
58: ; preds = %54
store i32 0, i32* %3
br label %59
59: ; preds = %102, %58
%60 = load i32, i32* %3
%61 = load i32, i32* %5
%62 = icmp slt i32 %60, %61
br i1 %62, label %63, label %105
63: ; preds = %59
%64 = load i32, i32* %2
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %8, i64 0, i64 %65
%67 = load i32, i32* %3
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [100 x i32], [100 x i32]* %66, i64 0, i64 %68
store i32 0, i32* %69
store i32 0, i32* %4
br label %70
70: ; preds = %98, %63
%71 = load i32, i32* %4
%72 = load i32, i32* %5
%73 = icmp slt i32 %71, %72
br i1 %73, label %74, label %101
74: ; preds = %70
%75 = load i32, i32* %2
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %6, i64 0, i64 %76
%78 = load i32, i32* %4
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [100 x i32], [100 x i32]* %77, i64 0, i64 %79
%81 = load i32, i32* %80
%82 = load i32, i32* %4
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %7, i64 0, i64 %83
%85 = load i32, i32* %3
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [100 x i32], [100 x i32]* %84, i64 0, i64 %86
%88 = load i32, i32* %87
%89 = mul nsw i32 %81, %88
%90 = load i32, i32* %2
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %8, i64 0, i64 %91
%93 = load i32, i32* %3
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [100 x i32], [100 x i32]* %92, i64 0, i64 %94
%96 = load i32, i32* %95
%97 = add nsw i32 %96, %89
store i32 %97, i32* %95
br label %98
98: ; preds = %74
%99 = load i32, i32* %4
%100 = add nsw i32 %99, 1
store i32 %100, i32* %4
br label %70
101: ; preds = %70
br label %102
102: ; preds = %101
%103 = load i32, i32* %3
%104 = add nsw i32 %103, 1
store i32 %104, i32* %3
br label %59
105: ; preds = %59
br label %106
106: ; preds = %105
%107 = load i32, i32* %2
%108 = add nsw i32 %107, 1
store i32 %108, i32* %2
br label %54
109: ; preds = %54
%110 = call double (...) @omp_get_wtime()
store double %110, double* %10
%111 = load double, double* %10
%112 = load double, double* %9
%113 = fsub double %111, %112
%114 = load i32, i32* %5
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [100 x double], [100 x double]* %11, i64 0, i64 %115
store double %113, double* %116
br label %117
117: ; preds = %109
%118 = load i32, i32* %5
%119 = add nsw i32 %118, 1
store i32 %119, i32* %5
br label %13
120: ; preds = %13
%121 = call i32* @fopen(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %121, i32** %12
store i32 3, i32* %5
br label %122
122: ; preds = %132, %120
%123 = load i32, i32* %5
%124 = icmp slt i32 %123, 100
br i1 %124, label %125, label %135
125: ; preds = %122
%126 = load i32*, i32** %12
%127 = load i32, i32* %5
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds [100 x double], [100 x double]* %11, i64 0, i64 %128
%130 = load double, double* %129
%131 = call i32 @fprintf(i32* %126, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %130)
br label %132
132: ; preds = %125
%133 = load i32, i32* %5
%134 = add nsw i32 %133, 1
store i32 %134, i32* %5
br label %122
135: ; preds = %122
%136 = load i32*, i32** %12
%137 = call i32 @fclose(i32* %136)
%138 = load i32, i32* %1
ret i32 %138
}

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