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

/* Variables and functions */
int /*<<< orphan*/ add_vec(float *, float *, int);
int /*<<< orphan*/ memset(float *, int /*<<< orphan*/, int);
void f1(void) {
  float array_of_vec[(100)][(100)];
  float vec_sum[(100)];
  memset(vec_sum, 0, sizeof(vec_sum));
  int i;
#pragma omp parallel for reduction(add_vec : vec_sum)
  for (i = 0; i < (100); i++) {
    add_vec(&vec_sum[0], &array_of_vec[i][0], (100));
  }
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9de0,%rsp
lea    -0x9dd0(%rbp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1030 <memset@plt>
movl   $0x0,-0x9dd4(%rbp)
cmpl   $0x64,-0x9dd4(%rbp)
jge    1192 <f1+0x72>
lea    -0x9dd0(%rbp),%rdi
movslq -0x9dd4(%rbp),%rax
lea    -0x9c40(%rbp),%rsi
imul   $0x190,%rax,%rax
add    %rax,%rsi
mov    $0x64,%edx
call   1040 <add_vec@plt>
mov    -0x9dd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9dd4(%rbp)
jmp    1148 <f1+0x28>
add    $0x9de0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
push   %r14
push   %rbx
sub    $0x9dd8,%rsp
mov    %rsp,%r14
xor    %ebx,%ebx
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1030 <memset@plt>
xchg   %ax,%ax
lea    (%rsp,%rbx,1),%rsi
add    $0x190,%rsi
mov    %r14,%rdi
mov    $0x64,%edx
call   1040 <add_vec@plt>
add    $0x190,%rbx
cmp    $0x9c40,%rbx
jne    1140 <f1+0x20>
add    $0x9dd8,%rsp
pop    %rbx
pop    %r14
ret

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

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