void fun(int neqn, int nvar, const double *x, double *f) {
  double xp[] = {0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0,
                 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0};
  double yp[] = {1.216737514, 1.250032542, 1.305579195, 1.040182335,
                 1.751867738, 1.109716707, 2.018141531, 1.992418729,
                 1.807916923, 2.078806005, 2.698801324, 2.644662712,
                 3.412756702, 4.406137221, 4.567156645, 4.999550779,
                 5.652854194, 6.784320119, 8.307936836, 8.395126494,
                 10.30252404};
  int i;
  for (i = 0; i < neqn; ++i) {
    f[i] = x[0] * ((xp[i]) * (xp[i]) * (xp[i])) + x[1] * ((xp[i]) * (xp[i])) +
           x[2] * xp[i] + x[3] - yp[i];
  }
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
lea    -0xc0(%rbp),%rdi
lea    0xec9(%rip),%rsi
mov    $0xa8,%edx
call   1030 <memcpy@plt>
lea    -0x170(%rbp),%rdi
lea    0xf61(%rip),%rsi
mov    $0xa8,%edx
call   1030 <memcpy@plt>
movl   $0x0,-0x174(%rbp)
mov    -0x174(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    123d <fun+0x12d>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
movslq -0x174(%rbp),%rax
movsd  -0xc0(%rbp,%rax,8),%xmm2
ff ff
movslq -0x174(%rbp),%rax
mulsd  -0xc0(%rbp,%rax,8),%xmm2
ff ff
movslq -0x174(%rbp),%rax
mulsd  -0xc0(%rbp,%rax,8),%xmm2
ff ff
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movslq -0x174(%rbp),%rax
movsd  -0xc0(%rbp,%rax,8),%xmm3
ff ff
movslq -0x174(%rbp),%rax
mulsd  -0xc0(%rbp,%rax,8),%xmm3
ff ff
mulsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movslq -0x174(%rbp),%rax
movsd  -0xc0(%rbp,%rax,8),%xmm2
ff ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
addsd  0x18(%rax),%xmm0
movslq -0x174(%rbp),%rax
subsd  -0x170(%rbp,%rax,8),%xmm0
ff ff
mov    -0x18(%rbp),%rax
movslq -0x174(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x174(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x174(%rbp)
jmp    1163 <fun+0x53>
add    $0x180,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
test   %edi,%edi
jle    1183 <fun+0x83>
mov    %edi,%r11d
cmp    $0x1,%edi
je     111e <fun+0x1e>
lea    0x20(%rdx),%rax
cmp    %rcx,%rax
jbe    1184 <fun+0x84>
lea    (%rcx,%r11,8),%rax
cmp    %rdx,%rax
jbe    1184 <fun+0x84>
xor    %r8d,%r8d
lea    (%rcx,%r8,8),%rcx
lea    0xf84(%rip),%rax
lea    (%rax,%r8,8),%rdi
lea    0xec9(%rip),%rax
lea    (%rax,%r8,8),%rsi
sub    %r8,%r11
xor    %eax,%eax
movsd  (%rsi,%rax,8),%xmm0
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm0,%xmm2
mulsd  %xmm1,%xmm2
mulsd  0x8(%rdx),%xmm1
mulsd  (%rdx),%xmm2
addsd  %xmm1,%xmm2
mulsd  0x10(%rdx),%xmm0
addsd  %xmm2,%xmm0
addsd  0x18(%rdx),%xmm0
subsd  (%rdi,%rax,8),%xmm0
movsd  %xmm0,(%rcx,%rax,8)
add    $0x1,%rax
cmp    %rax,%r11
jne    1140 <fun+0x40>
ret
mov    %r11d,%r8d
and    $0xfffffffe,%r8d
movsd  (%rdx),%xmm0
movsd  0x8(%rdx),%xmm1
movsd  0x10(%rdx),%xmm2
movsd  0x18(%rdx),%xmm3
unpcklpd %xmm0,%xmm0
unpcklpd %xmm1,%xmm1
unpcklpd %xmm2,%xmm2
unpcklpd %xmm3,%xmm3
xor    %edi,%edi
lea    0xe49(%rip),%r9
lea    0xef2(%rip),%r10
mov    %r8,%rsi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movapd (%rdi,%r9,1),%xmm4
movapd %xmm4,%xmm5
mulpd  %xmm4,%xmm5
movapd %xmm2,%xmm6
mulpd  %xmm4,%xmm6
mulpd  %xmm5,%xmm4
mulpd  %xmm0,%xmm4
mulpd  %xmm1,%xmm5
addpd  %xmm4,%xmm5
addpd  %xmm6,%xmm5
addpd  %xmm3,%xmm5
subpd  (%rdi,%r10,1),%xmm5
movupd %xmm5,(%rcx,%rdi,1)
add    $0x10,%rdi
add    $0xfffffffffffffffe,%rsi
jne    11d0 <fun+0xd0>
cmp    %r11,%r8
je     1183 <fun+0x83>
jmp    1121 <fun+0x21>

LLVM IR (-O0):
@__const.fun.xp = [21 x double] [double 0.000000e+00, double 1.000000e-01, double 2.000000e-01, double 3.000000e-01, double 4.000000e-01, double 5.000000e-01, double 6.000000e-01, double 0x3FE6666666666666, double 8.000000e-01, double 9.000000e-01, double 1.000000e+00, double 1.100000e+00, double 1.200000e+00, double 1.300000e+00, double 1.400000e+00, double 1.500000e+00, double 1.600000e+00, double 1.700000e+00, double 1.800000e+00, double 1.900000e+00, double 2.000000e+00]
@__const.fun.yp = [21 x double] [double 0x3FF377C1C1672438, double 0x3FF400221F6D3642, double 0x3FF4E3A7028DCEE0, double 0x3FF0A4963B6B3B0C, double 0x3FFC07A6771A0A3A, double 0x3FF1C1664E463CAE, double 0x400025276312C145, double 0x3FFFE0F2760FE2DD, double 0x3FFCED3A4BA2B81E, double 0x4000A1650AF1A097, double 0x400597252607DA1D, double 0x40052844EC87ECE3, double 0x400B4D5362C25BC9, double 0x40119FE26F878886, double 0x401244C4B627EFB3, double 0x4013FF8A3D49FC3C, double 0x40169C85CF512550, double 0x401B2324D032CCA0, double 0x40209DA9E59FB51A, double 0x4020CA4E051306BA, double 0x40249AE46E541B8B]
define void @fun(i32 %0, i32 %1, double* %2, double* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca double*
%8 = alloca double*
%9 = alloca [21 x double]
%10 = alloca [21 x double]
%11 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store double* %2, double** %7
store double* %3, double** %8
%12 = bitcast [21 x double]* %9 to i8*
%13 = bitcast [21 x double]* %10 to i8*
store i32 0, i32* %11
br label %14
14: ; preds = %71, %4
%15 = load i32, i32* %11
%16 = load i32, i32* %5
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %74
18: ; preds = %14
%19 = load double*, double** %7
%20 = getelementptr inbounds double, double* %19, i64 0
%21 = load double, double* %20
%22 = load i32, i32* %11
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [21 x double], [21 x double]* %9, i64 0, i64 %23
%25 = load double, double* %24
%26 = load i32, i32* %11
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [21 x double], [21 x double]* %9, i64 0, i64 %27
%29 = load double, double* %28
%30 = fmul double %25, %29
%31 = load i32, i32* %11
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [21 x double], [21 x double]* %9, i64 0, i64 %32
%34 = load double, double* %33
%35 = fmul double %30, %34
%36 = load double*, double** %7
%37 = getelementptr inbounds double, double* %36, i64 1
%38 = load double, double* %37
%39 = load i32, i32* %11
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [21 x double], [21 x double]* %9, i64 0, i64 %40
%42 = load double, double* %41
%43 = load i32, i32* %11
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [21 x double], [21 x double]* %9, i64 0, i64 %44
%46 = load double, double* %45
%47 = fmul double %42, %46
%48 = fmul double %38, %47
%49 = call double @llvm.fmuladd.f64(double %21, double %35, double %48)
%50 = load double*, double** %7
%51 = getelementptr inbounds double, double* %50, i64 2
%52 = load double, double* %51
%53 = load i32, i32* %11
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [21 x double], [21 x double]* %9, i64 0, i64 %54
%56 = load double, double* %55
%57 = call double @llvm.fmuladd.f64(double %52, double %56, double %49)
%58 = load double*, double** %7
%59 = getelementptr inbounds double, double* %58, i64 3
%60 = load double, double* %59
%61 = fadd double %57, %60
%62 = load i32, i32* %11
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [21 x double], [21 x double]* %10, i64 0, i64 %63
%65 = load double, double* %64
%66 = fsub double %61, %65
%67 = load double*, double** %8
%68 = load i32, i32* %11
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds double, double* %67, i64 %69
store double %66, double* %70
br label %71
71: ; preds = %18
%72 = load i32, i32* %11
%73 = add nsw i32 %72, 1
store i32 %73, i32* %11
br label %14
74: ; preds = %14
ret void
}

LLVM IR (-O2):
@__const.fun.xp = [21 x double] [double 0.000000e+00, double 1.000000e-01, double 2.000000e-01, double 3.000000e-01, double 4.000000e-01, double 5.000000e-01, double 6.000000e-01, double 0x3FE6666666666666, double 8.000000e-01, double 9.000000e-01, double 1.000000e+00, double 1.100000e+00, double 1.200000e+00, double 1.300000e+00, double 1.400000e+00, double 1.500000e+00, double 1.600000e+00, double 1.700000e+00, double 1.800000e+00, double 1.900000e+00, double 2.000000e+00]
@__const.fun.yp = [21 x double] [double 0x3FF377C1C1672438, double 0x3FF400221F6D3642, double 0x3FF4E3A7028DCEE0, double 0x3FF0A4963B6B3B0C, double 0x3FFC07A6771A0A3A, double 0x3FF1C1664E463CAE, double 0x400025276312C145, double 0x3FFFE0F2760FE2DD, double 0x3FFCED3A4BA2B81E, double 0x4000A1650AF1A097, double 0x400597252607DA1D, double 0x40052844EC87ECE3, double 0x400B4D5362C25BC9, double 0x40119FE26F878886, double 0x401244C4B627EFB3, double 0x4013FF8A3D49FC3C, double 0x40169C85CF512550, double 0x401B2324D032CCA0, double 0x40209DA9E59FB51A, double 0x4020CA4E051306BA, double 0x40249AE46E541B8B]
define void @fun(i32 %0, i32 %1, double* nocapture %2, double* nocapture writeonly %3) {
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %75
6: ; preds = %4
%7 = getelementptr inbounds double, double* %2, i64 1
%8 = getelementptr inbounds double, double* %2, i64 2
%9 = getelementptr inbounds double, double* %2, i64 3
%10 = zext i32 %0 to i64
%11 = icmp eq i32 %0, 1
br i1 %11, label %53, label %12
12: ; preds = %6
%13 = getelementptr double, double* %3, i64 %10
%14 = getelementptr double, double* %2, i64 4
%15 = icmp ugt double* %14, %3
%16 = icmp ugt double* %13, %2
%17 = and i1 %15, %16
br i1 %17, label %53, label %18
18: ; preds = %12
%19 = and i64 %10, 4294967294
%20 = load double, double* %2
%21 = insertelement <2 x double> poison, double %20, i64 0
%22 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer
%23 = load double, double* %7
%24 = insertelement <2 x double> poison, double %23, i64 0
%25 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> zeroinitializer
%26 = load double, double* %8
%27 = insertelement <2 x double> poison, double %26, i64 0
%28 = shufflevector <2 x double> %27, <2 x double> poison, <2 x i32> zeroinitializer
%29 = load double, double* %9
%30 = insertelement <2 x double> poison, double %29, i64 0
%31 = shufflevector <2 x double> %30, <2 x double> poison, <2 x i32> zeroinitializer
br label %32
32: ; preds = %32, %18
%33 = phi i64 [ 0, %18 ], [ %49, %32 ]
%34 = getelementptr inbounds [21 x double], [21 x double]* @__const.fun.xp, i64 0, i64 %33
%35 = bitcast double* %34 to <2 x double>*
%36 = load <2 x double>, <2 x double>* %35
%37 = fmul <2 x double> %36, %36
%38 = fmul <2 x double> %36, %37
%39 = fmul <2 x double> %25, %37
%40 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %22, <2 x double> %38, <2 x double> %39)
%41 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %28, <2 x double> %36, <2 x double> %40)
%42 = fadd <2 x double> %31, %41
%43 = getelementptr inbounds [21 x double], [21 x double]* @__const.fun.yp, i64 0, i64 %33
%44 = bitcast double* %43 to <2 x double>*
%45 = load <2 x double>, <2 x double>* %44
%46 = fsub <2 x double> %42, %45
%47 = getelementptr inbounds double, double* %3, i64 %33
%48 = bitcast double* %47 to <2 x double>*
store <2 x double> %46, <2 x double>* %48
%49 = add nuw i64 %33, 2
%50 = icmp eq i64 %49, %19
br i1 %50, label %51, label %32
51: ; preds = %32
%52 = icmp eq i64 %19, %10
br i1 %52, label %75, label %53
53: ; preds = %12, %6, %51
%54 = phi i64 [ 0, %12 ], [ 0, %6 ], [ %19, %51 ]
br label %55
55: ; preds = %53, %55
%56 = phi i64 [ %73, %55 ], [ %54, %53 ]
%57 = load double, double* %2
%58 = getelementptr inbounds [21 x double], [21 x double]* @__const.fun.xp, i64 0, i64 %56
%59 = load double, double* %58
%60 = fmul double %59, %59
%61 = fmul double %59, %60
%62 = load double, double* %7
%63 = fmul double %62, %60
%64 = tail call double @llvm.fmuladd.f64(double %57, double %61, double %63)
%65 = load double, double* %8
%66 = tail call double @llvm.fmuladd.f64(double %65, double %59, double %64)
%67 = load double, double* %9
%68 = fadd double %67, %66
%69 = getelementptr inbounds [21 x double], [21 x double]* @__const.fun.yp, i64 0, i64 %56
%70 = load double, double* %69
%71 = fsub double %68, %70
%72 = getelementptr inbounds double, double* %3, i64 %56
store double %71, double* %72
%73 = add nuw nsw i64 %56, 1
%74 = icmp eq i64 %73, %10
br i1 %74, label %75, label %55
75: ; preds = %55, %51, %4
ret void
}