#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 */
double legendreEvalPt(double, double *, int);
void legendreEval(double *x, int m1, double *f, int m2, double *a, int n) {
  int j;
#pragma omp parallel for
  for (j = 0; j < m1; ++j) {
    f[j] = legendreEvalPt(x[j], a, n);
  }
}


x86 assembly (clang, -O0):
<legendreEval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1175 <legendreEval+0x65>
mov    -0x8(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   1030 <legendreEvalPt@plt>
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1135 <legendreEval+0x25>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<legendreEval>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1151 <legendreEval+0x41>
mov    %r9d,%r14d
mov    %r8,%r15
mov    %rdx,%r12
mov    %rdi,%r13
mov    %esi,%ebp
xor    %ebx,%ebx
nop
movsd  0x0(%r13,%rbx,8),%xmm0
mov    %r15,%rdi
mov    %r14d,%esi
call   1030 <legendreEvalPt@plt>
movsd  %xmm0,(%r12,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1130 <legendreEval+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @legendreEval(double* nocapture %0, i32 %1, double* nocapture writeonly %2, i32 %3, double* %4, i32 %5) {
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %18
8: ; preds = %6
%9 = zext i32 %1 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 0, %8 ], [ %16, %10 ]
%12 = getelementptr inbounds double, double* %0, i64 %11
%13 = load double, double* %12
%14 = tail call double @legendreEvalPt(double %13, double* %4, i32 %5)
%15 = getelementptr inbounds double, double* %2, i64 %11
store double %14, double* %15
%16 = add nuw nsw i64 %11, 1
%17 = icmp eq i64 %16, %9
br i1 %17, label %18, label %10
18: ; preds = %10, %6
ret void
}