#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 */
float sqrt(float);
float vector3d_modulus(float *vector) {
  static float R;
  R = vector[0] * vector[0];
  R += vector[1] * vector[1];
  R += vector[2] * vector[2];
  return sqrt(R);
}


x86 assembly (clang, -O0):
<vector3d_modulus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mulss  (%rax),%xmm0
movss  %xmm0,0x2ef8(%rip)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm2
movss  0x2ede(%rip),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,0x2ece(%rip)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm2
movss  0x2eb4(%rip),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,0x2ea4(%rip)
movss  0x2e9c(%rip),%xmm0
call   1030 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector3d_modulus>:
movss  (%rdi),%xmm0
movss  0x4(%rdi),%xmm1
mulss  %xmm0,%xmm0
mulss  %xmm1,%xmm1
addss  %xmm0,%xmm1
movss  0x8(%rdi),%xmm0
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     113f <vector3d_modulus+0x2f>
sqrtss %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
@vector3d_modulus.R = internal global float 0.000000e+00
define float @vector3d_modulus(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = getelementptr inbounds float, float* %3, i64 0
%5 = load float, float* %4
%6 = load float*, float** %2
%7 = getelementptr inbounds float, float* %6, i64 0
%8 = load float, float* %7
%9 = fmul float %5, %8
store float %9, float* @vector3d_modulus.R
%10 = load float*, float** %2
%11 = getelementptr inbounds float, float* %10, i64 1
%12 = load float, float* %11
%13 = load float*, float** %2
%14 = getelementptr inbounds float, float* %13, i64 1
%15 = load float, float* %14
%16 = load float, float* @vector3d_modulus.R
%17 = call float @llvm.fmuladd.f32(float %12, float %15, float %16)
store float %17, float* @vector3d_modulus.R
%18 = load float*, float** %2
%19 = getelementptr inbounds float, float* %18, i64 2
%20 = load float, float* %19
%21 = load float*, float** %2
%22 = getelementptr inbounds float, float* %21, i64 2
%23 = load float, float* %22
%24 = load float, float* @vector3d_modulus.R
%25 = call float @llvm.fmuladd.f32(float %20, float %23, float %24)
store float %25, float* @vector3d_modulus.R
%26 = load float, float* @vector3d_modulus.R
%27 = call float @sqrt(float %26)
ret float %27
}

LLVM IR (-O2):
define float @vector3d_modulus(float* nocapture %0) {
%2 = load float, float* %0
%3 = fmul float %2, %2
%4 = getelementptr inbounds float, float* %0, i64 1
%5 = load float, float* %4
%6 = tail call float @llvm.fmuladd.f32(float %5, float %5, float %3)
%7 = getelementptr inbounds float, float* %0, i64 2
%8 = load float, float* %7
%9 = tail call float @llvm.fmuladd.f32(float %8, float %8, float %6)
%10 = tail call float @sqrt(float %9)
ret float %10
}