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

/* Variables and functions */
int /*<<< orphan*/ add_mat(int, int, float **, float **);
int /*<<< orphan*/ memset(float **, int /*<<< orphan*/, int);
void f2(void) {
  float array_of_mat[(100)][(100)][(100)];
  float mat_sum[(100)][(100)];
  memset(mat_sum, 0, sizeof(mat_sum));
  int i;
#pragma omp parallel for reduction(add_mat : mat_sum)
  for (i = 0; i < (100); i++) {
    add_mat((100), (100), mat_sum, array_of_mat[i]);
  }
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3da550,%rsp
lea    -0x3da540(%rbp),%rdi
xor    %esi,%esi
mov    $0x9c40,%edx
call   1030 <memset@plt>
movl   $0x0,-0x3da544(%rbp)
cmpl   $0x64,-0x3da544(%rbp)
jge    1194 <f2+0x74>
lea    -0x3da540(%rbp),%rdx
movslq -0x3da544(%rbp),%rax
lea    -0x3d0900(%rbp),%rcx
imul   $0x9c40,%rax,%rax
add    %rax,%rcx
mov    $0x64,%esi
mov    %esi,%edi
call   1040 <add_mat@plt>
mov    -0x3da544(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3da544(%rbp)
jmp    1148 <f2+0x28>
add    $0x3da550,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
push   %r14
push   %rbx
sub    $0x3da548,%rsp
mov    %rsp,%r14
xor    %ebx,%ebx
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x9c40,%edx
call   1030 <memset@plt>
xchg   %ax,%ax
lea    (%rsp,%rbx,1),%rcx
add    $0x9c40,%rcx
mov    $0x64,%edi
mov    $0x64,%esi
mov    %r14,%rdx
call   1040 <add_mat@plt>
add    $0x9c40,%rbx
cmp    $0x3d0900,%rbx
jne    1140 <f2+0x20>
add    $0x3da548,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @f2() {
%1 = alloca [100 x [100 x [100 x float]]]
%2 = alloca [100 x [100 x float]]
%3 = bitcast [100 x [100 x [100 x float]]]* %1 to i8*
%4 = bitcast [100 x [100 x float]]* %2 to i8*
%5 = bitcast [100 x [100 x float]]* %2 to float**
%6 = call i32 @memset(float** %5, i32 0, i32 40000)
br label %7
7: ; preds = %0, %7
%8 = phi i64 [ 0, %0 ], [ %12, %7 ]
%9 = getelementptr inbounds [100 x [100 x [100 x float]]], [100 x [100 x [100 x float]]]* %1, i64 0, i64 %8, i64 0
%10 = bitcast [100 x float]* %9 to float**
%11 = call i32 @add_mat(i32 100, i32 100, float** %5, float** %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, 100
br i1 %13, label %14, label %7
14: ; preds = %7
ret void
}