#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 */
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int omp_get_thread_num();
double sqrt(double);
void dnrm2_seq(int n, double *x, double *nrm, int p) {
  *nrm = 0.0;
  int i, nc, pr;
  double *tempnrm = (double *)malloc(sizeof(double) * p);
  if (n >= 4) {
    nc = n - (n % 4);
    if (p == 1) {
      for (i = 0; i < nc; i += 4) {
        *nrm += x[i] * x[i];
        *nrm += x[i + 1] * x[i + 1];
        *nrm += x[i + 2] * x[i + 2];
        *nrm += x[i + 3] * x[i + 3];
      }
    } else {
#pragma omp parallel private(i) shared(x, nc, tempnrm, pr)
      {
        pr = omp_get_thread_num();
        tempnrm[pr] = 0.0;
#pragma omp for schedule(static)
        for (i = 0; i < nc; i += 4) {
          tempnrm[pr] += x[i] * x[i];
          tempnrm[pr] += x[i + 1] * x[i + 1];
          tempnrm[pr] += x[i + 2] * x[i + 2];
          tempnrm[pr] += x[i + 3] * x[i + 3];
        }
      }
      for (i = 0; i < p; i++) {
        *nrm += tempnrm[i];
      }
    }
    if (nc != n) {
      for (i = nc; i < n; i++) {
        *nrm += x[i] * x[i];
      }
    }
  } else {
    for (i = 0; i < n; i++)
      *nrm += x[i] * x[i];
  }
  free(tempnrm);
  *nrm = sqrt(*nrm);
}


x86 assembly (clang, -O0):
<dnrm2_seq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpl   $0x4,-0x4(%rbp)
jl     1469 <dnrm2_seq+0x329>
mov    -0x4(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x34(%rbp),%eax
sub    %edx,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    129d <dnrm2_seq+0x15d>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1298 <dnrm2_seq+0x158>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x20(%rbp)
jmp    11a8 <dnrm2_seq+0x68>
jmp    1405 <dnrm2_seq+0x2c5>
mov    $0x0,%al
call   1040 <omp_get_thread_num@plt>
mov    %eax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x28(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    13c6 <dnrm2_seq+0x286>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x30(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x30(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x30(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x30(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x20(%rbp)
jmp    12be <dnrm2_seq+0x17e>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1400 <dnrm2_seq+0x2c0>
mov    -0x30(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    13cd <dnrm2_seq+0x28d>
jmp    1405 <dnrm2_seq+0x2c5>
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
je     1464 <dnrm2_seq+0x324>
mov    -0x24(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    145f <dnrm2_seq+0x31f>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1417 <dnrm2_seq+0x2d7>
jmp    1464 <dnrm2_seq+0x324>
jmp    14bd <dnrm2_seq+0x37d>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    14b8 <dnrm2_seq+0x378>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1470 <dnrm2_seq+0x330>
jmp    14bd <dnrm2_seq+0x37d>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
call   1060 <sqrt@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dnrm2_seq>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%r12d
movq   $0x0,(%rdx)
lea    0x0(,%rbp,8),%edi
call   1050 <malloc@plt>
mov    %rax,%r15
cmp    $0x3,%r12d
jle    11f9 <dnrm2_seq+0xb9>
mov    %r12d,%r13d
and    $0xfffffffc,%r13d
cmp    $0x1,%ebp
jne    1251 <dnrm2_seq+0x111>
test   %r13d,%r13d
je     1353 <dnrm2_seq+0x213>
mov    %r13d,%eax
movsd  (%r14),%xmm0
xor    %ecx,%ecx
nopl   0x0(%rax)
movsd  (%rbx,%rcx,8),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
movsd  0x8(%rbx,%rcx,8),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
movsd  0x10(%rbx,%rcx,8),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
movsd  0x18(%rbx,%rcx,8),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
add    $0x4,%rcx
cmp    %rax,%rcx
jb     11a0 <dnrm2_seq+0x60>
jmp    1353 <dnrm2_seq+0x213>
test   %r12d,%r12d
jle    1414 <dnrm2_seq+0x2d4>
movsd  (%rbx),%xmm0
mulsd  %xmm0,%xmm0
addsd  (%r14),%xmm0
movsd  %xmm0,(%r14)
cmp    $0x1,%r12d
je     1414 <dnrm2_seq+0x2d4>
movsd  0x8(%rbx),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
cmp    $0x2,%r12d
je     1414 <dnrm2_seq+0x2d4>
movsd  0x10(%rbx),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
jmp    1414 <dnrm2_seq+0x2d4>
xor    %eax,%eax
call   1040 <omp_get_thread_num@plt>
cltq
movq   $0x0,(%r15,%rax,8)
test   %r13d,%r13d
je     12c8 <dnrm2_seq+0x188>
mov    %r13d,%ecx
xorpd  %xmm0,%xmm0
xor    %edx,%edx
movsd  (%rbx,%rdx,8),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r15,%rax,8)
movsd  0x8(%rbx,%rdx,8),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r15,%rax,8)
movsd  0x10(%rbx,%rdx,8),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r15,%rax,8)
movsd  0x18(%rbx,%rdx,8),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r15,%rax,8)
add    $0x4,%rdx
cmp    %rcx,%rdx
jb     1270 <dnrm2_seq+0x130>
test   %ebp,%ebp
jle    1353 <dnrm2_seq+0x213>
mov    %ebp,%ecx
movsd  (%r14),%xmm0
lea    -0x1(%rcx),%rdx
mov    %ecx,%eax
and    $0x3,%eax
cmp    $0x3,%rdx
jae    12ea <dnrm2_seq+0x1aa>
xor    %edx,%edx
jmp    1328 <dnrm2_seq+0x1e8>
and    $0xfffffffc,%ecx
xor    %edx,%edx
nop
addsd  (%r15,%rdx,8),%xmm0
movsd  %xmm0,(%r14)
addsd  0x8(%r15,%rdx,8),%xmm0
movsd  %xmm0,(%r14)
addsd  0x10(%r15,%rdx,8),%xmm0
movsd  %xmm0,(%r14)
addsd  0x18(%r15,%rdx,8),%xmm0
movsd  %xmm0,(%r14)
add    $0x4,%rdx
cmp    %rdx,%rcx
jne    12f0 <dnrm2_seq+0x1b0>
test   %rax,%rax
je     1353 <dnrm2_seq+0x213>
lea    (%r15,%rdx,8),%rcx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
addsd  (%rcx,%rdx,8),%xmm0
movsd  %xmm0,(%r14)
add    $0x1,%rdx
cmp    %rdx,%rax
jne    1340 <dnrm2_seq+0x200>
test   $0x3,%r12b
je     1414 <dnrm2_seq+0x2d4>
cmp    %r12d,%r13d
jge    1414 <dnrm2_seq+0x2d4>
movslq %r13d,%rax
movslq %r12d,%rcx
movsd  (%r14),%xmm0
mov    %rax,%rdx
not    %rdx
add    %rcx,%rdx
mov    %rcx,%rsi
and    $0x3,%rsi
je     13ac <dnrm2_seq+0x26c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rbx,%rax,8),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
add    $0x1,%rax
add    $0xffffffffffffffff,%rsi
jne    1390 <dnrm2_seq+0x250>
cmp    $0x3,%rdx
jb     1414 <dnrm2_seq+0x2d4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rbx,%rax,8),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
movsd  0x8(%rbx,%rax,8),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
movsd  0x10(%rbx,%rax,8),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
movsd  0x18(%rbx,%rax,8),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
add    $0x4,%rax
cmp    %rax,%rcx
jne    13c0 <dnrm2_seq+0x280>
mov    %r15,%rdi
call   1030 <free@plt>
movsd  (%r14),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1431 <dnrm2_seq+0x2f1>
sqrtsd %xmm0,%xmm0
jmp    1436 <dnrm2_seq+0x2f6>
call   1060 <sqrt@plt>
movsd  %xmm0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @dnrm2_seq(i32 %0, double* %1, double* %2, i32 %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double*
store i32 %0, i32* %5
store double* %1, double** %6
store double* %2, double** %7
store i32 %3, i32* %8
%13 = load double*, double** %7
store double 0.000000e+00, double* %13
%14 = load i32, i32* %8
%15 = sext i32 %14 to i64
%16 = mul i64 8, %15
%17 = trunc i64 %16 to i32
%18 = call i64 @malloc(i32 %17)
%19 = inttoptr i64 %18 to double*
store double* %19, double** %12
%20 = load i32, i32* %5
%21 = icmp sge i32 %20, 4
br i1 %21, label %22, label %228
22: ; preds = %4
%23 = load i32, i32* %5
%24 = load i32, i32* %5
%25 = srem i32 %24, 4
%26 = sub nsw i32 %23, %25
store i32 %26, i32* %10
%27 = load i32, i32* %8
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %97
29: ; preds = %22
store i32 0, i32* %9
br label %30
30: ; preds = %93, %29
%31 = load i32, i32* %9
%32 = load i32, i32* %10
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %96
34: ; preds = %30
%35 = load double*, double** %6
%36 = load i32, i32* %9
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %35, i64 %37
%39 = load double, double* %38
%40 = load double*, double** %6
%41 = load i32, i32* %9
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %40, i64 %42
%44 = load double, double* %43
%45 = load double*, double** %7
%46 = load double, double* %45
%47 = call double @llvm.fmuladd.f64(double %39, double %44, double %46)
store double %47, double* %45
%48 = load double*, double** %6
%49 = load i32, i32* %9
%50 = add nsw i32 %49, 1
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %48, i64 %51
%53 = load double, double* %52
%54 = load double*, double** %6
%55 = load i32, i32* %9
%56 = add nsw i32 %55, 1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double, double* %54, i64 %57
%59 = load double, double* %58
%60 = load double*, double** %7
%61 = load double, double* %60
%62 = call double @llvm.fmuladd.f64(double %53, double %59, double %61)
store double %62, double* %60
%63 = load double*, double** %6
%64 = load i32, i32* %9
%65 = add nsw i32 %64, 2
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %63, i64 %66
%68 = load double, double* %67
%69 = load double*, double** %6
%70 = load i32, i32* %9
%71 = add nsw i32 %70, 2
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double, double* %69, i64 %72
%74 = load double, double* %73
%75 = load double*, double** %7
%76 = load double, double* %75
%77 = call double @llvm.fmuladd.f64(double %68, double %74, double %76)
store double %77, double* %75
%78 = load double*, double** %6
%79 = load i32, i32* %9
%80 = add nsw i32 %79, 3
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds double, double* %78, i64 %81
%83 = load double, double* %82
%84 = load double*, double** %6
%85 = load i32, i32* %9
%86 = add nsw i32 %85, 3
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds double, double* %84, i64 %87
%89 = load double, double* %88
%90 = load double*, double** %7
%91 = load double, double* %90
%92 = call double @llvm.fmuladd.f64(double %83, double %89, double %91)
store double %92, double* %90
br label %93
93: ; preds = %34
%94 = load i32, i32* %9
%95 = add nsw i32 %94, 4
store i32 %95, i32* %9
br label %30
96: ; preds = %30
br label %199
97: ; preds = %22
%98 = call i32 (...) @omp_get_thread_num()
store i32 %98, i32* %11
%99 = load double*, double** %12
%100 = load i32, i32* %11
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds double, double* %99, i64 %101
store double 0.000000e+00, double* %102
store i32 0, i32* %9
br label %103
103: ; preds = %178, %97
%104 = load i32, i32* %9
%105 = load i32, i32* %10
%106 = icmp slt i32 %104, %105
br i1 %106, label %107, label %181
107: ; preds = %103
%108 = load double*, double** %6
%109 = load i32, i32* %9
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds double, double* %108, i64 %110
%112 = load double, double* %111
%113 = load double*, double** %6
%114 = load i32, i32* %9
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds double, double* %113, i64 %115
%117 = load double, double* %116
%118 = load double*, double** %12
%119 = load i32, i32* %11
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds double, double* %118, i64 %120
%122 = load double, double* %121
%123 = call double @llvm.fmuladd.f64(double %112, double %117, double %122)
store double %123, double* %121
%124 = load double*, double** %6
%125 = load i32, i32* %9
%126 = add nsw i32 %125, 1
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds double, double* %124, i64 %127
%129 = load double, double* %128
%130 = load double*, double** %6
%131 = load i32, i32* %9
%132 = add nsw i32 %131, 1
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds double, double* %130, i64 %133
%135 = load double, double* %134
%136 = load double*, double** %12
%137 = load i32, i32* %11
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds double, double* %136, i64 %138
%140 = load double, double* %139
%141 = call double @llvm.fmuladd.f64(double %129, double %135, double %140)
store double %141, double* %139
%142 = load double*, double** %6
%143 = load i32, i32* %9
%144 = add nsw i32 %143, 2
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds double, double* %142, i64 %145
%147 = load double, double* %146
%148 = load double*, double** %6
%149 = load i32, i32* %9
%150 = add nsw i32 %149, 2
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds double, double* %148, i64 %151
%153 = load double, double* %152
%154 = load double*, double** %12
%155 = load i32, i32* %11
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds double, double* %154, i64 %156
%158 = load double, double* %157
%159 = call double @llvm.fmuladd.f64(double %147, double %153, double %158)
store double %159, double* %157
%160 = load double*, double** %6
%161 = load i32, i32* %9
%162 = add nsw i32 %161, 3
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds double, double* %160, i64 %163
%165 = load double, double* %164
%166 = load double*, double** %6
%167 = load i32, i32* %9
%168 = add nsw i32 %167, 3
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds double, double* %166, i64 %169
%171 = load double, double* %170
%172 = load double*, double** %12
%173 = load i32, i32* %11
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds double, double* %172, i64 %174
%176 = load double, double* %175
%177 = call double @llvm.fmuladd.f64(double %165, double %171, double %176)
store double %177, double* %175
br label %178
178: ; preds = %107
%179 = load i32, i32* %9
%180 = add nsw i32 %179, 4
store i32 %180, i32* %9
br label %103
181: ; preds = %103
store i32 0, i32* %9
br label %182
182: ; preds = %195, %181
%183 = load i32, i32* %9
%184 = load i32, i32* %8
%185 = icmp slt i32 %183, %184
br i1 %185, label %186, label %198
186: ; preds = %182
%187 = load double*, double** %12
%188 = load i32, i32* %9
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds double, double* %187, i64 %189
%191 = load double, double* %190
%192 = load double*, double** %7
%193 = load double, double* %192
%194 = fadd double %193, %191
store double %194, double* %192
br label %195
195: ; preds = %186
%196 = load i32, i32* %9
%197 = add nsw i32 %196, 1
store i32 %197, i32* %9
br label %182
198: ; preds = %182
br label %199
199: ; preds = %198, %96
%200 = load i32, i32* %10
%201 = load i32, i32* %5
%202 = icmp ne i32 %200, %201
br i1 %202, label %203, label %227
203: ; preds = %199
%204 = load i32, i32* %10
store i32 %204, i32* %9
br label %205
205: ; preds = %223, %203
%206 = load i32, i32* %9
%207 = load i32, i32* %5
%208 = icmp slt i32 %206, %207
br i1 %208, label %209, label %226
209: ; preds = %205
%210 = load double*, double** %6
%211 = load i32, i32* %9
%212 = sext i32 %211 to i64
%213 = getelementptr inbounds double, double* %210, i64 %212
%214 = load double, double* %213
%215 = load double*, double** %6
%216 = load i32, i32* %9
%217 = sext i32 %216 to i64
%218 = getelementptr inbounds double, double* %215, i64 %217
%219 = load double, double* %218
%220 = load double*, double** %7
%221 = load double, double* %220
%222 = call double @llvm.fmuladd.f64(double %214, double %219, double %221)
store double %222, double* %220
br label %223
223: ; preds = %209
%224 = load i32, i32* %9
%225 = add nsw i32 %224, 1
store i32 %225, i32* %9
br label %205
226: ; preds = %205
br label %227
227: ; preds = %226, %199
br label %251
228: ; preds = %4
store i32 0, i32* %9
br label %229
229: ; preds = %247, %228
%230 = load i32, i32* %9
%231 = load i32, i32* %5
%232 = icmp slt i32 %230, %231
br i1 %232, label %233, label %250
233: ; preds = %229
%234 = load double*, double** %6
%235 = load i32, i32* %9
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds double, double* %234, i64 %236
%238 = load double, double* %237
%239 = load double*, double** %6
%240 = load i32, i32* %9
%241 = sext i32 %240 to i64
%242 = getelementptr inbounds double, double* %239, i64 %241
%243 = load double, double* %242
%244 = load double*, double** %7
%245 = load double, double* %244
%246 = call double @llvm.fmuladd.f64(double %238, double %243, double %245)
store double %246, double* %244
br label %247
247: ; preds = %233
%248 = load i32, i32* %9
%249 = add nsw i32 %248, 1
store i32 %249, i32* %9
br label %229
250: ; preds = %229
br label %251
251: ; preds = %250, %227
%252 = load double*, double** %12
%253 = call i32 @free(double* %252)
%254 = load double*, double** %7
%255 = load double, double* %254
%256 = call double @sqrt(double %255)
%257 = load double*, double** %7
store double %256, double* %257
ret void
}

LLVM IR (-O2):
define void @dnrm2_seq(i32 %0, double* nocapture %1, double* nocapture %2, i32 %3) {
store double 0.000000e+00, double* %2
%5 = shl i32 %3, 3
%6 = tail call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to double*
%8 = icmp sgt i32 %0, 3
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = icmp sgt i32 %0, 0
br i1 %10, label %159, label %173
11: ; preds = %4
%12 = and i32 %0, 3
%13 = and i32 %0, -4
%14 = icmp eq i32 %3, 1
br i1 %14, label %15, label %40
15: ; preds = %11
%16 = icmp eq i32 %13, 0
br i1 %16, label %113, label %17
17: ; preds = %15
%18 = zext i32 %13 to i64
%19 = load double, double* %2
br label %20
20: ; preds = %17, %20
%21 = phi double [ %19, %17 ], [ %37, %20 ]
%22 = phi i64 [ 0, %17 ], [ %38, %20 ]
%23 = getelementptr inbounds double, double* %1, i64 %22
%24 = load double, double* %23
%25 = tail call double @llvm.fmuladd.f64(double %24, double %24, double %21)
store double %25, double* %2
%26 = or i64 %22, 1
%27 = getelementptr inbounds double, double* %1, i64 %26
%28 = load double, double* %27
%29 = tail call double @llvm.fmuladd.f64(double %28, double %28, double %25)
store double %29, double* %2
%30 = or i64 %22, 2
%31 = getelementptr inbounds double, double* %1, i64 %30
%32 = load double, double* %31
%33 = tail call double @llvm.fmuladd.f64(double %32, double %32, double %29)
store double %33, double* %2
%34 = or i64 %22, 3
%35 = getelementptr inbounds double, double* %1, i64 %34
%36 = load double, double* %35
%37 = tail call double @llvm.fmuladd.f64(double %36, double %36, double %33)
store double %37, double* %2
%38 = add nuw nsw i64 %22, 4
%39 = icmp ult i64 %38, %18
br i1 %39, label %20, label %113
40: ; preds = %11
%41 = tail call i32 (...) @omp_get_thread_num()
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %7, i64 %42
store double 0.000000e+00, double* %43
%44 = icmp eq i32 %13, 0
br i1 %44, label %47, label %45
45: ; preds = %40
%46 = zext i32 %13 to i64
br label %57
47: ; preds = %57, %40
%48 = icmp sgt i32 %3, 0
br i1 %48, label %49, label %113
49: ; preds = %47
%50 = zext i32 %3 to i64
%51 = load double, double* %2
%52 = add nsw i64 %50, -1
%53 = and i64 %50, 3
%54 = icmp ult i64 %52, 3
br i1 %54, label %99, label %55
55: ; preds = %49
%56 = and i64 %50, 4294967292
br label %77
57: ; preds = %45, %57
%58 = phi double [ 0.000000e+00, %45 ], [ %74, %57 ]
%59 = phi i64 [ 0, %45 ], [ %75, %57 ]
%60 = getelementptr inbounds double, double* %1, i64 %59
%61 = load double, double* %60
%62 = tail call double @llvm.fmuladd.f64(double %61, double %61, double %58)
store double %62, double* %43
%63 = or i64 %59, 1
%64 = getelementptr inbounds double, double* %1, i64 %63
%65 = load double, double* %64
%66 = tail call double @llvm.fmuladd.f64(double %65, double %65, double %62)
store double %66, double* %43
%67 = or i64 %59, 2
%68 = getelementptr inbounds double, double* %1, i64 %67
%69 = load double, double* %68
%70 = tail call double @llvm.fmuladd.f64(double %69, double %69, double %66)
store double %70, double* %43
%71 = or i64 %59, 3
%72 = getelementptr inbounds double, double* %1, i64 %71
%73 = load double, double* %72
%74 = tail call double @llvm.fmuladd.f64(double %73, double %73, double %70)
store double %74, double* %43
%75 = add nuw nsw i64 %59, 4
%76 = icmp ult i64 %75, %46
br i1 %76, label %57, label %47
77: ; preds = %77, %55
%78 = phi double [ %51, %55 ], [ %95, %77 ]
%79 = phi i64 [ 0, %55 ], [ %96, %77 ]
%80 = phi i64 [ 0, %55 ], [ %97, %77 ]
%81 = getelementptr inbounds double, double* %7, i64 %79
%82 = load double, double* %81
%83 = fadd double %82, %78
store double %83, double* %2
%84 = or i64 %79, 1
%85 = getelementptr inbounds double, double* %7, i64 %84
%86 = load double, double* %85
%87 = fadd double %86, %83
store double %87, double* %2
%88 = or i64 %79, 2
%89 = getelementptr inbounds double, double* %7, i64 %88
%90 = load double, double* %89
%91 = fadd double %90, %87
store double %91, double* %2
%92 = or i64 %79, 3
%93 = getelementptr inbounds double, double* %7, i64 %92
%94 = load double, double* %93
%95 = fadd double %94, %91
store double %95, double* %2
%96 = add nuw nsw i64 %79, 4
%97 = add i64 %80, 4
%98 = icmp eq i64 %97, %56
br i1 %98, label %99, label %77
99: ; preds = %77, %49
%100 = phi double [ %51, %49 ], [ %95, %77 ]
%101 = phi i64 [ 0, %49 ], [ %96, %77 ]
%102 = icmp eq i64 %53, 0
br i1 %102, label %113, label %103
103: ; preds = %99, %103
%104 = phi double [ %109, %103 ], [ %100, %99 ]
%105 = phi i64 [ %110, %103 ], [ %101, %99 ]
%106 = phi i64 [ %111, %103 ], [ 0, %99 ]
%107 = getelementptr inbounds double, double* %7, i64 %105
%108 = load double, double* %107
%109 = fadd double %108, %104
store double %109, double* %2
%110 = add nuw nsw i64 %105, 1
%111 = add i64 %106, 1
%112 = icmp eq i64 %111, %53
br i1 %112, label %113, label %103
113: ; preds = %99, %103, %20, %47, %15
%114 = icmp ne i32 %12, 0
%115 = icmp slt i32 %13, %0
%116 = and i1 %114, %115
br i1 %116, label %117, label %173
117: ; preds = %113
%118 = sext i32 %13 to i64
%119 = sext i32 %0 to i64
%120 = load double, double* %2
%121 = xor i64 %118, -1
%122 = add nsw i64 %121, %119
%123 = and i64 %119, 3
%124 = icmp eq i64 %123, 0
br i1 %124, label %135, label %125
125: ; preds = %117, %125
%126 = phi double [ %131, %125 ], [ %120, %117 ]
%127 = phi i64 [ %132, %125 ], [ %118, %117 ]
%128 = phi i64 [ %133, %125 ], [ 0, %117 ]
%129 = getelementptr inbounds double, double* %1, i64 %127
%130 = load double, double* %129
%131 = tail call double @llvm.fmuladd.f64(double %130, double %130, double %126)
store double %131, double* %2
%132 = add nsw i64 %127, 1
%133 = add i64 %128, 1
%134 = icmp eq i64 %133, %123
br i1 %134, label %135, label %125
135: ; preds = %125, %117
%136 = phi double [ %120, %117 ], [ %131, %125 ]
%137 = phi i64 [ %118, %117 ], [ %132, %125 ]
%138 = icmp ult i64 %122, 3
br i1 %138, label %173, label %139
139: ; preds = %135, %139
%140 = phi double [ %156, %139 ], [ %136, %135 ]
%141 = phi i64 [ %157, %139 ], [ %137, %135 ]
%142 = getelementptr inbounds double, double* %1, i64 %141
%143 = load double, double* %142
%144 = tail call double @llvm.fmuladd.f64(double %143, double %143, double %140)
store double %144, double* %2
%145 = add nsw i64 %141, 1
%146 = getelementptr inbounds double, double* %1, i64 %145
%147 = load double, double* %146
%148 = tail call double @llvm.fmuladd.f64(double %147, double %147, double %144)
store double %148, double* %2
%149 = add nsw i64 %141, 2
%150 = getelementptr inbounds double, double* %1, i64 %149
%151 = load double, double* %150
%152 = tail call double @llvm.fmuladd.f64(double %151, double %151, double %148)
store double %152, double* %2
%153 = add nsw i64 %141, 3
%154 = getelementptr inbounds double, double* %1, i64 %153
%155 = load double, double* %154
%156 = tail call double @llvm.fmuladd.f64(double %155, double %155, double %152)
store double %156, double* %2
%157 = add nsw i64 %141, 4
%158 = icmp eq i64 %157, %119
br i1 %158, label %173, label %139
159: ; preds = %9
%160 = load double, double* %2
%161 = load double, double* %1
%162 = tail call double @llvm.fmuladd.f64(double %161, double %161, double %160)
store double %162, double* %2
%163 = icmp eq i32 %0, 1
br i1 %163, label %173, label %164
164: ; preds = %159
%165 = getelementptr inbounds double, double* %1, i64 1
%166 = load double, double* %165
%167 = tail call double @llvm.fmuladd.f64(double %166, double %166, double %162)
store double %167, double* %2
%168 = icmp eq i32 %0, 2
br i1 %168, label %173, label %169
169: ; preds = %164
%170 = getelementptr inbounds double, double* %1, i64 2
%171 = load double, double* %170
%172 = tail call double @llvm.fmuladd.f64(double %171, double %171, double %167)
store double %172, double* %2
br label %173
173: ; preds = %159, %164, %169, %135, %139, %9, %113
%174 = tail call i32 @free(double* %7)
%175 = load double, double* %2
%176 = tail call double @sqrt(double %175)
store double %176, double* %2
ret void
}