#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 */
float myFunc(int, float *, float *, int, int /*<<< orphan*/ *);
double _bigloop(float *restrict example, float *restrict param, int nExamples) {
  double err = 0.;
#pragma omp parallel for reduction(+ : err)
  for (int i = 0; i < nExamples; i++) {
    float d = myFunc(i, param, example, nExamples, NULL);
    err += d * d;
  }
  return err;
}


x86 assembly (clang, -O0):
<_bigloop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1181 <_bigloop+0x71>
mov    -0x24(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0x14(%rbp),%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <myFunc@plt>
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
mulss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1132 <_bigloop+0x22>
movsd  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_bigloop>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edx,%edx
jle    116b <_bigloop+0x5b>
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
xorps  %xmm0,%xmm0
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %ebp,%ecx
xor    %r8d,%r8d
call   1030 <myFunc@plt>
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1130 <_bigloop+0x20>
jmp    116e <_bigloop+0x5e>
xorps  %xmm0,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @_bigloop(float* noalias %0, float* noalias %1, i32 %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca i32
%7 = alloca double
%8 = alloca i32
%9 = alloca float
store float* %0, float** %4
store float* %1, float** %5
store i32 %2, i32* %6
store double 0.000000e+00, double* %7
store i32 0, i32* %8
br label %10
10: ; preds = %26, %3
%11 = load i32, i32* %8
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %29
14: ; preds = %10
%15 = load i32, i32* %8
%16 = load float*, float** %5
%17 = load float*, float** %4
%18 = load i32, i32* %6
%19 = call float @myFunc(i32 %15, float* %16, float* %17, i32 %18, i32* null)
store float %19, float* %9
%20 = load float, float* %9
%21 = load float, float* %9
%22 = fmul float %20, %21
%23 = fpext float %22 to double
%24 = load double, double* %7
%25 = fadd double %24, %23
store double %25, double* %7
br label %26
26: ; preds = %14
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
br label %10
29: ; preds = %10
%30 = load double, double* %7
ret double %30
}

LLVM IR (-O2):
define double @_bigloop(float* noalias %0, float* noalias %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %7, %3
%6 = phi double [ 0.000000e+00, %3 ], [ %13, %7 ]
ret double %6
7: ; preds = %3, %7
%8 = phi double [ %13, %7 ], [ 0.000000e+00, %3 ]
%9 = phi i32 [ %14, %7 ], [ 0, %3 ]
%10 = tail call float @myFunc(i32 %9, float* %1, float* %0, i32 %2, i32* null)
%11 = fmul float %10, %10
%12 = fpext float %11 to double
%13 = fadd double %8, %12
%14 = add nuw nsw i32 %9, 1
%15 = icmp eq i32 %14, %2
br i1 %15, label %5, label %7
}