void hs28(double *p, double *x, int m, int n, void *data) {
  register int i;
  double t1, t2;
  t1 = p[0] + p[1];
  t2 = p[1] + p[2];
  for (i = 0; i < n; ++i)
    x[i] = t1 * t1 + t2 * t2;
}


x86 assembly (clang, -O0):
<hs28>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    118d <hs28+0x8d>
movsd  -0x30(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114a <hs28+0x4a>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hs28>:
test   %ecx,%ecx
jle    123e <hs28+0x13e>
movsd  0x8(%rdi),%xmm0
movsd  0x10(%rdi),%xmm1
addsd  %xmm0,%xmm1
addsd  (%rdi),%xmm0
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    %ecx,%eax
cmp    $0x4,%ecx
jae    1134 <hs28+0x34>
xor    %ecx,%ecx
jmp    1230 <hs28+0x130>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
lea    -0x4(%rcx),%rdx
mov    %rdx,%rdi
shr    $0x2,%rdi
add    $0x1,%rdi
mov    %edi,%r8d
and    $0x7,%r8d
cmp    $0x1c,%rdx
jae    1164 <hs28+0x64>
xor    %edx,%edx
jmp    11f5 <hs28+0xf5>
and    $0xfffffffffffffff8,%rdi
xor    %edx,%edx
nopw   0x0(%rax,%rax,1)
movupd %xmm1,(%rsi,%rdx,8)
movupd %xmm1,0x10(%rsi,%rdx,8)
movupd %xmm1,0x20(%rsi,%rdx,8)
movupd %xmm1,0x30(%rsi,%rdx,8)
movupd %xmm1,0x40(%rsi,%rdx,8)
movupd %xmm1,0x50(%rsi,%rdx,8)
movupd %xmm1,0x60(%rsi,%rdx,8)
movupd %xmm1,0x70(%rsi,%rdx,8)
movupd %xmm1,0x80(%rsi,%rdx,8)
movupd %xmm1,0x90(%rsi,%rdx,8)
movupd %xmm1,0xa0(%rsi,%rdx,8)
movupd %xmm1,0xb0(%rsi,%rdx,8)
movupd %xmm1,0xc0(%rsi,%rdx,8)
movupd %xmm1,0xd0(%rsi,%rdx,8)
movupd %xmm1,0xe0(%rsi,%rdx,8)
movupd %xmm1,0xf0(%rsi,%rdx,8)
add    $0x20,%rdx
add    $0xfffffffffffffff8,%rdi
jne    1170 <hs28+0x70>
test   %r8,%r8
je     1224 <hs28+0x124>
lea    (%rsi,%rdx,8),%rdx
add    $0x10,%rdx
shl    $0x5,%r8
xor    %edi,%edi
nopl   0x0(%rax,%rax,1)
movupd %xmm1,-0x10(%rdx,%rdi,1)
movupd %xmm1,(%rdx,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%r8
jne    1210 <hs28+0x110>
cmp    %rax,%rcx
je     123e <hs28+0x13e>
nopl   0x0(%rax)
movsd  %xmm0,(%rsi,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1230 <hs28+0x130>
ret

LLVM IR (-O0):
define void @hs28(double* %0, double* %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca double
%13 = alloca double
store double* %0, double** %6
store double* %1, double** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%14 = load double*, double** %6
%15 = getelementptr inbounds double, double* %14, i64 0
%16 = load double, double* %15
%17 = load double*, double** %6
%18 = getelementptr inbounds double, double* %17, i64 1
%19 = load double, double* %18
%20 = fadd double %16, %19
store double %20, double* %12
%21 = load double*, double** %6
%22 = getelementptr inbounds double, double* %21, i64 1
%23 = load double, double* %22
%24 = load double*, double** %6
%25 = getelementptr inbounds double, double* %24, i64 2
%26 = load double, double* %25
%27 = fadd double %23, %26
store double %27, double* %13
store i32 0, i32* %11
br label %28
28: ; preds = %43, %5
%29 = load i32, i32* %11
%30 = load i32, i32* %9
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %46
32: ; preds = %28
%33 = load double, double* %12
%34 = load double, double* %12
%35 = load double, double* %13
%36 = load double, double* %13
%37 = fmul double %35, %36
%38 = call double @llvm.fmuladd.f64(double %33, double %34, double %37)
%39 = load double*, double** %7
%40 = load i32, i32* %11
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %39, i64 %41
store double %38, double* %42
br label %43
43: ; preds = %32
%44 = load i32, i32* %11
%45 = add nsw i32 %44, 1
store i32 %45, i32* %11
br label %28
46: ; preds = %28
ret void
}

LLVM IR (-O2):
define void @hs28(double* nocapture %0, double* nocapture writeonly %1, i32 %2, i32 %3, i8* nocapture readnone %4) {
%6 = getelementptr inbounds double, double* %0, i64 1
%7 = load double, double* %6
%8 = icmp sgt i32 %3, 0
br i1 %8, label %9, label %99
9: ; preds = %5
%10 = getelementptr inbounds double, double* %0, i64 2
%11 = load double, double* %10
%12 = fadd double %7, %11
%13 = load double, double* %0
%14 = fadd double %13, %7
%15 = fmul double %12, %12
%16 = tail call double @llvm.fmuladd.f64(double %14, double %14, double %15)
%17 = zext i32 %3 to i64
%18 = icmp ult i32 %3, 4
br i1 %18, label %92, label %19
19: ; preds = %9
%20 = and i64 %17, 4294967292
%21 = insertelement <2 x double> poison, double %16, i64 0
%22 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer
%23 = insertelement <2 x double> poison, double %16, i64 0
%24 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> zeroinitializer
%25 = add nsw i64 %20, -4
%26 = lshr exact i64 %25, 2
%27 = add nuw nsw i64 %26, 1
%28 = and i64 %27, 7
%29 = icmp ult i64 %25, 28
br i1 %29, label %77, label %30
30: ; preds = %19
%31 = and i64 %27, 9223372036854775800
br label %32
32: ; preds = %32, %30
%33 = phi i64 [ 0, %30 ], [ %74, %32 ]
%34 = phi i64 [ 0, %30 ], [ %75, %32 ]
%35 = getelementptr inbounds double, double* %1, i64 %33
%36 = bitcast double* %35 to <2 x double>*
store <2 x double> %22, <2 x double>* %36
%37 = getelementptr inbounds double, double* %35, i64 2
%38 = bitcast double* %37 to <2 x double>*
store <2 x double> %24, <2 x double>* %38
%39 = or i64 %33, 4
%40 = getelementptr inbounds double, double* %1, i64 %39
%41 = bitcast double* %40 to <2 x double>*
store <2 x double> %22, <2 x double>* %41
%42 = getelementptr inbounds double, double* %40, i64 2
%43 = bitcast double* %42 to <2 x double>*
store <2 x double> %24, <2 x double>* %43
%44 = or i64 %33, 8
%45 = getelementptr inbounds double, double* %1, i64 %44
%46 = bitcast double* %45 to <2 x double>*
store <2 x double> %22, <2 x double>* %46
%47 = getelementptr inbounds double, double* %45, i64 2
%48 = bitcast double* %47 to <2 x double>*
store <2 x double> %24, <2 x double>* %48
%49 = or i64 %33, 12
%50 = getelementptr inbounds double, double* %1, i64 %49
%51 = bitcast double* %50 to <2 x double>*
store <2 x double> %22, <2 x double>* %51
%52 = getelementptr inbounds double, double* %50, i64 2
%53 = bitcast double* %52 to <2 x double>*
store <2 x double> %24, <2 x double>* %53
%54 = or i64 %33, 16
%55 = getelementptr inbounds double, double* %1, i64 %54
%56 = bitcast double* %55 to <2 x double>*
store <2 x double> %22, <2 x double>* %56
%57 = getelementptr inbounds double, double* %55, i64 2
%58 = bitcast double* %57 to <2 x double>*
store <2 x double> %24, <2 x double>* %58
%59 = or i64 %33, 20
%60 = getelementptr inbounds double, double* %1, i64 %59
%61 = bitcast double* %60 to <2 x double>*
store <2 x double> %22, <2 x double>* %61
%62 = getelementptr inbounds double, double* %60, i64 2
%63 = bitcast double* %62 to <2 x double>*
store <2 x double> %24, <2 x double>* %63
%64 = or i64 %33, 24
%65 = getelementptr inbounds double, double* %1, i64 %64
%66 = bitcast double* %65 to <2 x double>*
store <2 x double> %22, <2 x double>* %66
%67 = getelementptr inbounds double, double* %65, i64 2
%68 = bitcast double* %67 to <2 x double>*
store <2 x double> %24, <2 x double>* %68
%69 = or i64 %33, 28
%70 = getelementptr inbounds double, double* %1, i64 %69
%71 = bitcast double* %70 to <2 x double>*
store <2 x double> %22, <2 x double>* %71
%72 = getelementptr inbounds double, double* %70, i64 2
%73 = bitcast double* %72 to <2 x double>*
store <2 x double> %24, <2 x double>* %73
%74 = add nuw i64 %33, 32
%75 = add i64 %34, 8
%76 = icmp eq i64 %75, %31
br i1 %76, label %77, label %32
77: ; preds = %32, %19
%78 = phi i64 [ 0, %19 ], [ %74, %32 ]
%79 = icmp eq i64 %28, 0
br i1 %79, label %90, label %80
80: ; preds = %77, %80
%81 = phi i64 [ %87, %80 ], [ %78, %77 ]
%82 = phi i64 [ %88, %80 ], [ 0, %77 ]
%83 = getelementptr inbounds double, double* %1, i64 %81
%84 = bitcast double* %83 to <2 x double>*
store <2 x double> %22, <2 x double>* %84
%85 = getelementptr inbounds double, double* %83, i64 2
%86 = bitcast double* %85 to <2 x double>*
store <2 x double> %24, <2 x double>* %86
%87 = add nuw i64 %81, 4
%88 = add i64 %82, 1
%89 = icmp eq i64 %88, %28
br i1 %89, label %90, label %80
90: ; preds = %80, %77
%91 = icmp eq i64 %20, %17
br i1 %91, label %99, label %92
92: ; preds = %9, %90
%93 = phi i64 [ 0, %9 ], [ %20, %90 ]
br label %94
94: ; preds = %92, %94
%95 = phi i64 [ %97, %94 ], [ %93, %92 ]
%96 = getelementptr inbounds double, double* %1, i64 %95
store double %16, double* %96
%97 = add nuw nsw i64 %95, 1
%98 = icmp eq i64 %97, %17
br i1 %98, label %99, label %94
99: ; preds = %94, %90, %5
ret void
}