#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 sqrt(double);
double hypot9(double *a) {
  double r;
  r = *a * *a;
  a++;
  r += *a * *a;
  a++;
  r += *a * *a;
  a++;
  r += *a * *a;
  a++;
  r += *a * *a;
  a++;
  r += *a * *a;
  a++;
  r += *a * *a;
  a++;
  r += *a * *a;
  a++;
  r += *a * *a;
  return sqrt(r);
}


x86 assembly (clang, -O0):
<hypot9>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hypot9>:
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0x18(%rdi),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x20(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0x28(%rdi),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x30(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0x38(%rdi),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x40(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     118f <hypot9+0x7f>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @hypot9(double* %0) {
%2 = alloca double*
%3 = alloca double
store double* %0, double** %2
%4 = load double*, double** %2
%5 = load double, double* %4
%6 = load double*, double** %2
%7 = load double, double* %6
%8 = fmul double %5, %7
store double %8, double* %3
%9 = load double*, double** %2
%10 = getelementptr inbounds double, double* %9, i32 1
store double* %10, double** %2
%11 = load double*, double** %2
%12 = load double, double* %11
%13 = load double*, double** %2
%14 = load double, double* %13
%15 = load double, double* %3
%16 = call double @llvm.fmuladd.f64(double %12, double %14, double %15)
store double %16, double* %3
%17 = load double*, double** %2
%18 = getelementptr inbounds double, double* %17, i32 1
store double* %18, double** %2
%19 = load double*, double** %2
%20 = load double, double* %19
%21 = load double*, double** %2
%22 = load double, double* %21
%23 = load double, double* %3
%24 = call double @llvm.fmuladd.f64(double %20, double %22, double %23)
store double %24, double* %3
%25 = load double*, double** %2
%26 = getelementptr inbounds double, double* %25, i32 1
store double* %26, double** %2
%27 = load double*, double** %2
%28 = load double, double* %27
%29 = load double*, double** %2
%30 = load double, double* %29
%31 = load double, double* %3
%32 = call double @llvm.fmuladd.f64(double %28, double %30, double %31)
store double %32, double* %3
%33 = load double*, double** %2
%34 = getelementptr inbounds double, double* %33, i32 1
store double* %34, double** %2
%35 = load double*, double** %2
%36 = load double, double* %35
%37 = load double*, double** %2
%38 = load double, double* %37
%39 = load double, double* %3
%40 = call double @llvm.fmuladd.f64(double %36, double %38, double %39)
store double %40, double* %3
%41 = load double*, double** %2
%42 = getelementptr inbounds double, double* %41, i32 1
store double* %42, double** %2
%43 = load double*, double** %2
%44 = load double, double* %43
%45 = load double*, double** %2
%46 = load double, double* %45
%47 = load double, double* %3
%48 = call double @llvm.fmuladd.f64(double %44, double %46, double %47)
store double %48, double* %3
%49 = load double*, double** %2
%50 = getelementptr inbounds double, double* %49, i32 1
store double* %50, double** %2
%51 = load double*, double** %2
%52 = load double, double* %51
%53 = load double*, double** %2
%54 = load double, double* %53
%55 = load double, double* %3
%56 = call double @llvm.fmuladd.f64(double %52, double %54, double %55)
store double %56, double* %3
%57 = load double*, double** %2
%58 = getelementptr inbounds double, double* %57, i32 1
store double* %58, double** %2
%59 = load double*, double** %2
%60 = load double, double* %59
%61 = load double*, double** %2
%62 = load double, double* %61
%63 = load double, double* %3
%64 = call double @llvm.fmuladd.f64(double %60, double %62, double %63)
store double %64, double* %3
%65 = load double*, double** %2
%66 = getelementptr inbounds double, double* %65, i32 1
store double* %66, double** %2
%67 = load double*, double** %2
%68 = load double, double* %67
%69 = load double*, double** %2
%70 = load double, double* %69
%71 = load double, double* %3
%72 = call double @llvm.fmuladd.f64(double %68, double %70, double %71)
store double %72, double* %3
%73 = load double, double* %3
%74 = call double @sqrt(double %73)
ret double %74
}

LLVM IR (-O2):
define double @hypot9(double* nocapture %0) {
%2 = load double, double* %0
%3 = fmul double %2, %2
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = load double, double* %4
%6 = tail call double @llvm.fmuladd.f64(double %5, double %5, double %3)
%7 = getelementptr inbounds double, double* %0, i64 2
%8 = load double, double* %7
%9 = tail call double @llvm.fmuladd.f64(double %8, double %8, double %6)
%10 = getelementptr inbounds double, double* %0, i64 3
%11 = load double, double* %10
%12 = tail call double @llvm.fmuladd.f64(double %11, double %11, double %9)
%13 = getelementptr inbounds double, double* %0, i64 4
%14 = load double, double* %13
%15 = tail call double @llvm.fmuladd.f64(double %14, double %14, double %12)
%16 = getelementptr inbounds double, double* %0, i64 5
%17 = load double, double* %16
%18 = tail call double @llvm.fmuladd.f64(double %17, double %17, double %15)
%19 = getelementptr inbounds double, double* %0, i64 6
%20 = load double, double* %19
%21 = tail call double @llvm.fmuladd.f64(double %20, double %20, double %18)
%22 = getelementptr inbounds double, double* %0, i64 7
%23 = load double, double* %22
%24 = tail call double @llvm.fmuladd.f64(double %23, double %23, double %21)
%25 = getelementptr inbounds double, double* %0, i64 8
%26 = load double, double* %25
%27 = tail call double @llvm.fmuladd.f64(double %26, double %26, double %24)
%28 = tail call double @sqrt(double %27)
ret double %28
}