#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 */
void fill_square_matrix(double *matrix, size_t size, double value) {
  size_t i = 0, j;
#pragma omp parallel for private(i, j)
  for (i = 0; i < size; i++) {
    for (j = 0; j < size; j++) {
      matrix[i * size + j] = value;
    }
  }
}


x86 assembly (clang, -O0):
<fill_square_matrix>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1187 <fill_square_matrix+0x87>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1171 <fill_square_matrix+0x71>
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
imul   -0x10(%rbp),%rcx
add    -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1137 <fill_square_matrix+0x37>
jmp    1176 <fill_square_matrix+0x76>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1121 <fill_square_matrix+0x21>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_square_matrix>:
push   %r15
push   %r14
push   %r12
push   %rbx
test   %rsi,%rsi
je     1223 <fill_square_matrix+0x123>
lea    -0x4(%rsi),%r9
mov    %r9,%r8
shr    $0x2,%r8
add    $0x1,%r8
mov    %rsi,%r11
and    $0xfffffffffffffffc,%r11
movaps %xmm0,%xmm1
movlhps %xmm0,%xmm1
mov    %r8d,%r10d
and    $0x3,%r10d
and    $0xfffffffffffffffc,%r8
lea    0x70(%rdi),%rax
lea    0x0(,%rsi,8),%r14
lea    0x10(%rdi),%r15
mov    %r10,%rbx
shl    $0x5,%rbx
xor    %r12d,%r12d
jmp    1176 <fill_square_matrix+0x76>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r12
add    %r14,%rax
add    %r14,%r15
add    %r14,%rdi
cmp    %rsi,%r12
je     1223 <fill_square_matrix+0x123>
cmp    $0x4,%rsi
jae    1190 <fill_square_matrix+0x90>
xor    %ecx,%ecx
jmp    1210 <fill_square_matrix+0x110>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0xc,%r9
jae    11a0 <fill_square_matrix+0xa0>
xor    %edx,%edx
jmp    11e1 <fill_square_matrix+0xe1>
nopw   0x0(%rax,%rax,1)
mov    %r8,%rcx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nop
movups %xmm1,-0x70(%rax,%rdx,8)
movups %xmm1,-0x60(%rax,%rdx,8)
movups %xmm1,-0x50(%rax,%rdx,8)
movups %xmm1,-0x40(%rax,%rdx,8)
movups %xmm1,-0x30(%rax,%rdx,8)
movups %xmm1,-0x20(%rax,%rdx,8)
movups %xmm1,-0x10(%rax,%rdx,8)
movups %xmm1,(%rax,%rdx,8)
add    $0x10,%rdx
add    $0xfffffffffffffffc,%rcx
jne    11b0 <fill_square_matrix+0xb0>
test   %r10,%r10
je     1202 <fill_square_matrix+0x102>
lea    (%r15,%rdx,8),%rcx
xor    %edx,%edx
nopl   0x0(%rax)
movups %xmm1,-0x10(%rcx,%rdx,1)
movups %xmm1,(%rcx,%rdx,1)
add    $0x20,%rdx
cmp    %rdx,%rbx
jne    11f0 <fill_square_matrix+0xf0>
mov    %r11,%rcx
cmp    %rsi,%r11
je     1160 <fill_square_matrix+0x60>
xchg   %ax,%ax
movsd  %xmm0,(%rdi,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1210 <fill_square_matrix+0x110>
jmp    1160 <fill_square_matrix+0x60>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @fill_square_matrix(double* %0, i64 %1, double %2) {
%4 = alloca double*
%5 = alloca i64
%6 = alloca double
%7 = alloca i64
%8 = alloca i64
store double* %0, double** %4
store i64 %1, i64* %5
store double %2, double* %6
store i64 0, i64* %7
store i64 0, i64* %7
br label %9
9: ; preds = %31, %3
%10 = load i64, i64* %7
%11 = load i64, i64* %5
%12 = icmp ult i64 %10, %11
br i1 %12, label %13, label %34
13: ; preds = %9
store i64 0, i64* %8
br label %14
14: ; preds = %27, %13
%15 = load i64, i64* %8
%16 = load i64, i64* %5
%17 = icmp ult i64 %15, %16
br i1 %17, label %18, label %30
18: ; preds = %14
%19 = load double, double* %6
%20 = load double*, double** %4
%21 = load i64, i64* %7
%22 = load i64, i64* %5
%23 = mul i64 %21, %22
%24 = load i64, i64* %8
%25 = add i64 %23, %24
%26 = getelementptr inbounds double, double* %20, i64 %25
store double %19, double* %26
br label %27
27: ; preds = %18
%28 = load i64, i64* %8
%29 = add i64 %28, 1
store i64 %29, i64* %8
br label %14
30: ; preds = %14
br label %31
31: ; preds = %30
%32 = load i64, i64* %7
%33 = add i64 %32, 1
store i64 %33, i64* %7
br label %9
34: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @fill_square_matrix(double* nocapture writeonly %0, i64 %1, double %2) {
%4 = icmp eq i64 %1, 0
br i1 %4, label %78, label %5
5: ; preds = %3
%6 = add i64 %1, -4
%7 = lshr i64 %6, 2
%8 = add nuw nsw i64 %7, 1
%9 = icmp ult i64 %1, 4
%10 = and i64 %1, -4
%11 = insertelement <2 x double> poison, double %2, i64 0
%12 = shufflevector <2 x double> %11, <2 x double> poison, <2 x i32> zeroinitializer
%13 = insertelement <2 x double> poison, double %2, i64 0
%14 = shufflevector <2 x double> %13, <2 x double> poison, <2 x i32> zeroinitializer
%15 = and i64 %8, 3
%16 = icmp ult i64 %6, 12
%17 = and i64 %8, 9223372036854775804
%18 = icmp eq i64 %15, 0
%19 = icmp eq i64 %10, %1
br label %20
20: ; preds = %5, %75
%21 = phi i64 [ %76, %75 ], [ 0, %5 ]
%22 = mul i64 %21, %1
br i1 %9, label %67, label %23
23: ; preds = %20
br i1 %16, label %53, label %24
24: ; preds = %23, %24
%25 = phi i64 [ %50, %24 ], [ 0, %23 ]
%26 = phi i64 [ %51, %24 ], [ 0, %23 ]
%27 = add i64 %25, %22
%28 = getelementptr inbounds double, double* %0, i64 %27
%29 = bitcast double* %28 to <2 x double>*
store <2 x double> %12, <2 x double>* %29
%30 = getelementptr inbounds double, double* %28, i64 2
%31 = bitcast double* %30 to <2 x double>*
store <2 x double> %14, <2 x double>* %31
%32 = or i64 %25, 4
%33 = add i64 %32, %22
%34 = getelementptr inbounds double, double* %0, i64 %33
%35 = bitcast double* %34 to <2 x double>*
store <2 x double> %12, <2 x double>* %35
%36 = getelementptr inbounds double, double* %34, i64 2
%37 = bitcast double* %36 to <2 x double>*
store <2 x double> %14, <2 x double>* %37
%38 = or i64 %25, 8
%39 = add i64 %38, %22
%40 = getelementptr inbounds double, double* %0, i64 %39
%41 = bitcast double* %40 to <2 x double>*
store <2 x double> %12, <2 x double>* %41
%42 = getelementptr inbounds double, double* %40, i64 2
%43 = bitcast double* %42 to <2 x double>*
store <2 x double> %14, <2 x double>* %43
%44 = or i64 %25, 12
%45 = add i64 %44, %22
%46 = getelementptr inbounds double, double* %0, i64 %45
%47 = bitcast double* %46 to <2 x double>*
store <2 x double> %12, <2 x double>* %47
%48 = getelementptr inbounds double, double* %46, i64 2
%49 = bitcast double* %48 to <2 x double>*
store <2 x double> %14, <2 x double>* %49
%50 = add nuw i64 %25, 16
%51 = add nuw i64 %26, 4
%52 = icmp eq i64 %51, %17
br i1 %52, label %53, label %24
53: ; preds = %24, %23
%54 = phi i64 [ 0, %23 ], [ %50, %24 ]
br i1 %18, label %66, label %55
55: ; preds = %53, %55
%56 = phi i64 [ %63, %55 ], [ %54, %53 ]
%57 = phi i64 [ %64, %55 ], [ 0, %53 ]
%58 = add i64 %56, %22
%59 = getelementptr inbounds double, double* %0, i64 %58
%60 = bitcast double* %59 to <2 x double>*
store <2 x double> %12, <2 x double>* %60
%61 = getelementptr inbounds double, double* %59, i64 2
%62 = bitcast double* %61 to <2 x double>*
store <2 x double> %14, <2 x double>* %62
%63 = add nuw i64 %56, 4
%64 = add i64 %57, 1
%65 = icmp eq i64 %64, %15
br i1 %65, label %66, label %55
66: ; preds = %55, %53
br i1 %19, label %75, label %67
67: ; preds = %20, %66
%68 = phi i64 [ 0, %20 ], [ %10, %66 ]
br label %69
69: ; preds = %67, %69
%70 = phi i64 [ %73, %69 ], [ %68, %67 ]
%71 = add i64 %70, %22
%72 = getelementptr inbounds double, double* %0, i64 %71
store double %2, double* %72
%73 = add nuw i64 %70, 1
%74 = icmp eq i64 %73, %1
br i1 %74, label %75, label %69
75: ; preds = %69, %66
%76 = add nuw i64 %21, 1
%77 = icmp eq i64 %76, %1
br i1 %77, label %78, label %20
78: ; preds = %75, %3
ret void
}