#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);
void normalize(float vect[4][2]) {
  float length = sqrt(vect[1][1] * vect[1][1] + vect[2][1] * vect[2][1] +
                      vect[3][1] * vect[3][1]);
  vect[1][1] /= length;
  vect[2][1] /= length;
  vect[3][1] /= length;
}


x86 assembly (clang, -O0):
<normalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  0xc(%rax),%xmm1
mov    -0x8(%rbp),%rax
movss  0xc(%rax),%xmm2
mov    -0x8(%rbp),%rax
movss  0x14(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulss  0x14(%rax),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movss  0x1c(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  0x1c(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrt@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movss  0xc(%rax),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,0xc(%rax)
movss  -0xc(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movss  0x14(%rax),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,0x14(%rax)
movss  -0xc(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movss  0x1c(%rax),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,0x1c(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normalize>:
push   %rbx
mov    %rdi,%rbx
movss  0xc(%rdi),%xmm1
movss  0x14(%rdi),%xmm0
mulss  %xmm0,%xmm0
mulss  %xmm1,%xmm1
addss  %xmm0,%xmm1
movss  0x1c(%rdi),%xmm0
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1145 <normalize+0x35>
sqrtss %xmm0,%xmm0
jmp    114a <normalize+0x3a>
call   1030 <sqrt@plt>
movss  0xc(%rbx),%xmm1
movss  0x14(%rbx),%xmm2
divss  %xmm0,%xmm1
movss  %xmm1,0xc(%rbx)
divss  %xmm0,%xmm2
movss  %xmm2,0x14(%rbx)
movss  0x1c(%rbx),%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,0x1c(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @normalize([2 x float]* nocapture %0) {
%2 = getelementptr inbounds [2 x float], [2 x float]* %0, i64 1, i64 1
%3 = load float, float* %2
%4 = getelementptr inbounds [2 x float], [2 x float]* %0, i64 2, i64 1
%5 = load float, float* %4
%6 = fmul float %5, %5
%7 = tail call float @llvm.fmuladd.f32(float %3, float %3, float %6)
%8 = getelementptr inbounds [2 x float], [2 x float]* %0, i64 3, i64 1
%9 = load float, float* %8
%10 = tail call float @llvm.fmuladd.f32(float %9, float %9, float %7)
%11 = tail call float @sqrt(float %10)
%12 = load float, float* %2
%13 = fdiv float %12, %11
store float %13, float* %2
%14 = load float, float* %4
%15 = fdiv float %14, %11
store float %15, float* %4
%16 = load float, float* %8
%17 = fdiv float %16, %11
store float %17, float* %8
ret void
}