#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);
void normalize(float *xn, float *yn, float *zn) {
  double denom;
  denom = sqrt((double)((*xn * *xn) + (*yn * *yn) + (*zn * *zn)));
  *xn = *xn / denom;
  *yn = *yn / denom;
  *zn = *zn / denom;
}


x86 assembly (clang, -O0):
<normalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
mulss  (%rax),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normalize>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movss  (%rdi),%xmm0
movss  (%rsi),%xmm1
mulss  %xmm1,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
movss  (%rdx),%xmm1
mulss  %xmm1,%xmm1
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1154 <normalize+0x44>
sqrtsd %xmm0,%xmm0
jmp    1159 <normalize+0x49>
call   1030 <sqrt@plt>
movss  (%rbx),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm0,%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,(%rbx)
movss  (%r15),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm0,%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,(%r15)
movss  (%r14),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @normalize(float* %0, float* %1, float* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float*
%7 = alloca double
store float* %0, float** %4
store float* %1, float** %5
store float* %2, float** %6
%8 = load float*, float** %4
%9 = load float, float* %8
%10 = load float*, float** %4
%11 = load float, float* %10
%12 = load float*, float** %5
%13 = load float, float* %12
%14 = load float*, float** %5
%15 = load float, float* %14
%16 = fmul float %13, %15
%17 = call float @llvm.fmuladd.f32(float %9, float %11, float %16)
%18 = load float*, float** %6
%19 = load float, float* %18
%20 = load float*, float** %6
%21 = load float, float* %20
%22 = call float @llvm.fmuladd.f32(float %19, float %21, float %17)
%23 = fpext float %22 to double
%24 = call double @sqrt(double %23)
store double %24, double* %7
%25 = load float*, float** %4
%26 = load float, float* %25
%27 = fpext float %26 to double
%28 = load double, double* %7
%29 = fdiv double %27, %28
%30 = fptrunc double %29 to float
%31 = load float*, float** %4
store float %30, float* %31
%32 = load float*, float** %5
%33 = load float, float* %32
%34 = fpext float %33 to double
%35 = load double, double* %7
%36 = fdiv double %34, %35
%37 = fptrunc double %36 to float
%38 = load float*, float** %5
store float %37, float* %38
%39 = load float*, float** %6
%40 = load float, float* %39
%41 = fpext float %40 to double
%42 = load double, double* %7
%43 = fdiv double %41, %42
%44 = fptrunc double %43 to float
%45 = load float*, float** %6
store float %44, float* %45
ret void
}

LLVM IR (-O2):
define void @normalize(float* nocapture %0, float* nocapture %1, float* nocapture %2) {
%4 = load float, float* %0
%5 = load float, float* %1
%6 = fmul float %5, %5
%7 = tail call float @llvm.fmuladd.f32(float %4, float %4, float %6)
%8 = load float, float* %2
%9 = tail call float @llvm.fmuladd.f32(float %8, float %8, float %7)
%10 = fpext float %9 to double
%11 = tail call double @sqrt(double %10)
%12 = load float, float* %0
%13 = fpext float %12 to double
%14 = fdiv double %13, %11
%15 = fptrunc double %14 to float
store float %15, float* %0
%16 = load float, float* %1
%17 = fpext float %16 to double
%18 = fdiv double %17, %11
%19 = fptrunc double %18 to float
store float %19, float* %1
%20 = load float, float* %2
%21 = fpext float %20 to double
%22 = fdiv double %21, %11
%23 = fptrunc double %22 to float
store float %23, float* %2
ret void
}