#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 /*<<< orphan*/ add_mat(int, int, float *, float *);
int /*<<< orphan*/ memset(float **, int /*<<< orphan*/, int);
void f2(float p_array_of_mat[(10)][(10)][(10)], float p_mat_sum[(10)][(10)]) {
  float(*mat_sum)[(10)][(10)] = (float(*)[(10)][(10)])p_mat_sum;
  memset((*mat_sum), 0, sizeof((*mat_sum)));
  int i;
#pragma omp parallel for reduction(add_mat : mat_sum)
  for (i = 0; i < (10); i++) {
    add_mat((10), (10), &(*mat_sum)[0][0], &p_array_of_mat[i][0][0]);
  }
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1030 <memset@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jge    1189 <f2+0x69>
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rcx
movslq -0x1c(%rbp),%rax
imul   $0x190,%rax,%rax
add    %rax,%rcx
mov    $0xa,%esi
mov    %esi,%edi
call   1040 <add_mat@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114f <f2+0x2f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1030 <memset@plt>
mov    $0xa,%edi
mov    $0xa,%esi
mov    %r14,%rdx
mov    %rbx,%rcx
call   1040 <add_mat@plt>
lea    0x190(%rbx),%rcx
mov    $0xa,%edi
mov    $0xa,%esi
mov    %r14,%rdx
call   1040 <add_mat@plt>
lea    0x320(%rbx),%rcx
mov    $0xa,%edi
mov    $0xa,%esi
mov    %r14,%rdx
call   1040 <add_mat@plt>
lea    0x4b0(%rbx),%rcx
mov    $0xa,%edi
mov    $0xa,%esi
mov    %r14,%rdx
call   1040 <add_mat@plt>
lea    0x640(%rbx),%rcx
mov    $0xa,%edi
mov    $0xa,%esi
mov    %r14,%rdx
call   1040 <add_mat@plt>
lea    0x7d0(%rbx),%rcx
mov    $0xa,%edi
mov    $0xa,%esi
mov    %r14,%rdx
call   1040 <add_mat@plt>
lea    0x960(%rbx),%rcx
mov    $0xa,%edi
mov    $0xa,%esi
mov    %r14,%rdx
call   1040 <add_mat@plt>
lea    0xaf0(%rbx),%rcx
mov    $0xa,%edi
mov    $0xa,%esi
mov    %r14,%rdx
call   1040 <add_mat@plt>
lea    0xc80(%rbx),%rcx
mov    $0xa,%edi
mov    $0xa,%esi
mov    %r14,%rdx
call   1040 <add_mat@plt>
add    $0xe10,%rbx
mov    $0xa,%edi
mov    $0xa,%esi
mov    %r14,%rdx
mov    %rbx,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <add_mat@plt>

LLVM IR (-O0):
define void @f2([10 x [10 x float]]* %0, [10 x float]* %1) {
%3 = alloca [10 x [10 x float]]*
%4 = alloca [10 x float]*
%5 = alloca [10 x [10 x float]]*
%6 = alloca i32
store [10 x [10 x float]]* %0, [10 x [10 x float]]** %3
store [10 x float]* %1, [10 x float]** %4
%7 = load [10 x float]*, [10 x float]** %4
%8 = bitcast [10 x float]* %7 to [10 x [10 x float]]*
store [10 x [10 x float]]* %8, [10 x [10 x float]]** %5
%9 = load [10 x [10 x float]]*, [10 x [10 x float]]** %5
%10 = getelementptr inbounds [10 x [10 x float]], [10 x [10 x float]]* %9, i64 0, i64 0
%11 = bitcast [10 x float]* %10 to float**
%12 = call i32 @memset(float** %11, i32 0, i32 400)
store i32 0, i32* %6
br label %13
13: ; preds = %27, %2
%14 = load i32, i32* %6
%15 = icmp slt i32 %14, 10
br i1 %15, label %16, label %30
16: ; preds = %13
%17 = load [10 x [10 x float]]*, [10 x [10 x float]]** %5
%18 = getelementptr inbounds [10 x [10 x float]], [10 x [10 x float]]* %17, i64 0, i64 0
%19 = getelementptr inbounds [10 x float], [10 x float]* %18, i64 0, i64 0
%20 = load [10 x [10 x float]]*, [10 x [10 x float]]** %3
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [10 x [10 x float]], [10 x [10 x float]]* %20, i64 %22
%24 = getelementptr inbounds [10 x [10 x float]], [10 x [10 x float]]* %23, i64 0, i64 0
%25 = getelementptr inbounds [10 x float], [10 x float]* %24, i64 0, i64 0
%26 = call i32 @add_mat(i32 10, i32 10, float* %19, float* %25)
br label %27
27: ; preds = %16
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %13
30: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @f2([10 x [10 x float]]* %0, [10 x float]* %1) {
%3 = bitcast [10 x float]* %1 to float**
%4 = tail call i32 @memset(float** %3, i32 0, i32 400)
%5 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 0
%6 = getelementptr inbounds [10 x [10 x float]], [10 x [10 x float]]* %0, i64 0, i64 0, i64 0
%7 = tail call i32 @add_mat(i32 10, i32 10, float* %5, float* %6)
%8 = getelementptr inbounds [10 x [10 x float]], [10 x [10 x float]]* %0, i64 1, i64 0, i64 0
%9 = tail call i32 @add_mat(i32 10, i32 10, float* %5, float* %8)
%10 = getelementptr inbounds [10 x [10 x float]], [10 x [10 x float]]* %0, i64 2, i64 0, i64 0
%11 = tail call i32 @add_mat(i32 10, i32 10, float* %5, float* %10)
%12 = getelementptr inbounds [10 x [10 x float]], [10 x [10 x float]]* %0, i64 3, i64 0, i64 0
%13 = tail call i32 @add_mat(i32 10, i32 10, float* %5, float* %12)
%14 = getelementptr inbounds [10 x [10 x float]], [10 x [10 x float]]* %0, i64 4, i64 0, i64 0
%15 = tail call i32 @add_mat(i32 10, i32 10, float* %5, float* %14)
%16 = getelementptr inbounds [10 x [10 x float]], [10 x [10 x float]]* %0, i64 5, i64 0, i64 0
%17 = tail call i32 @add_mat(i32 10, i32 10, float* %5, float* %16)
%18 = getelementptr inbounds [10 x [10 x float]], [10 x [10 x float]]* %0, i64 6, i64 0, i64 0
%19 = tail call i32 @add_mat(i32 10, i32 10, float* %5, float* %18)
%20 = getelementptr inbounds [10 x [10 x float]], [10 x [10 x float]]* %0, i64 7, i64 0, i64 0
%21 = tail call i32 @add_mat(i32 10, i32 10, float* %5, float* %20)
%22 = getelementptr inbounds [10 x [10 x float]], [10 x [10 x float]]* %0, i64 8, i64 0, i64 0
%23 = tail call i32 @add_mat(i32 10, i32 10, float* %5, float* %22)
%24 = getelementptr inbounds [10 x [10 x float]], [10 x [10 x float]]* %0, i64 9, i64 0, i64 0
%25 = tail call i32 @add_mat(i32 10, i32 10, float* %5, float* %24)
ret void
}