#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 sqrtf(float);
void mat4_getScaling(float *dst, float *mat) {
  float m11 = mat[0];
  float m12 = mat[1];
  float m13 = mat[2];
  float m21 = mat[4];
  float m22 = mat[5];
  float m23 = mat[6];
  float m31 = mat[8];
  float m32 = mat[9];
  float m33 = mat[10];
  dst[0] = sqrtf(m11 * m11 + m12 * m12 + m13 * m13);
  dst[1] = sqrtf(m21 * m21 + m22 * m22 + m23 * m23);
  dst[2] = sqrtf(m31 * m31 + m32 * m32 + m33 * m33);
}


x86 assembly (clang, -O0):
<mat4_getScaling>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x10(%rax),%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movss  0x14(%rax),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movss  0x18(%rax),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movss  0x20(%rax),%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x24(%rax),%xmm0
movss  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movss  0x28(%rax),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x14(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
movss  -0x18(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x1c(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrtf@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x20(%rbp),%xmm1
movss  -0x20(%rbp),%xmm2
movss  -0x24(%rbp),%xmm0
mulss  -0x24(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
movss  -0x28(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrtf@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x2c(%rbp),%xmm1
movss  -0x2c(%rbp),%xmm2
movss  -0x30(%rbp),%xmm0
mulss  -0x30(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x34(%rbp),%xmm0
movss  -0x34(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrtf@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mat4_getScaling>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
movss  (%rsi),%xmm1
movss  0x4(%rsi),%xmm2
movss  0x8(%rsi),%xmm0
movss  0x10(%rsi),%xmm5
movss  0x14(%rsi),%xmm6
movss  0x18(%rsi),%xmm4
movss  0x20(%rsi),%xmm3
movss  %xmm3,0x1c(%rsp)
movss  0x24(%rsi),%xmm3
movss  %xmm3,0x18(%rsp)
movss  0x28(%rsi),%xmm3
movss  %xmm3,0x8(%rsp)
mulss  %xmm2,%xmm2
mulss  %xmm1,%xmm1
addss  %xmm2,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1178 <mat4_getScaling+0x68>
sqrtss %xmm0,%xmm0
jmp    11a4 <mat4_getScaling+0x94>
movss  %xmm4,0x14(%rsp)
movss  %xmm5,0x10(%rsp)
movss  %xmm6,0xc(%rsp)
call   1030 <sqrtf@plt>
xorps  %xmm1,%xmm1
movss  0xc(%rsp),%xmm6
movss  0x10(%rsp),%xmm5
movss  0x14(%rsp),%xmm4
movss  %xmm0,(%rbx)
mulss  %xmm6,%xmm6
mulss  %xmm5,%xmm5
addss  %xmm6,%xmm5
mulss  %xmm4,%xmm4
addss  %xmm5,%xmm4
ucomiss %xmm1,%xmm4
jb     11ca <mat4_getScaling+0xba>
xorps  %xmm0,%xmm0
sqrtss %xmm4,%xmm0
jmp    11d2 <mat4_getScaling+0xc2>
movaps %xmm4,%xmm0
call   1030 <sqrtf@plt>
movss  0x8(%rsp),%xmm1
movss  %xmm0,0x4(%rbx)
movss  0x18(%rsp),%xmm2
mulss  %xmm2,%xmm2
movss  0x1c(%rsp),%xmm0
mulss  %xmm0,%xmm0
addss  %xmm2,%xmm0
mulss  %xmm1,%xmm1
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
jb     120e <mat4_getScaling+0xfe>
xorps  %xmm0,%xmm0
sqrtss %xmm1,%xmm0
jmp    1216 <mat4_getScaling+0x106>
movaps %xmm1,%xmm0
call   1030 <sqrtf@plt>
movss  %xmm0,0x8(%rbx)
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define void @mat4_getScaling(float* nocapture writeonly %0, float* nocapture %1) {
%3 = load float, float* %1
%4 = getelementptr inbounds float, float* %1, i64 1
%5 = load float, float* %4
%6 = getelementptr inbounds float, float* %1, i64 2
%7 = load float, float* %6
%8 = getelementptr inbounds float, float* %1, i64 4
%9 = load float, float* %8
%10 = getelementptr inbounds float, float* %1, i64 5
%11 = load float, float* %10
%12 = getelementptr inbounds float, float* %1, i64 6
%13 = load float, float* %12
%14 = getelementptr inbounds float, float* %1, i64 8
%15 = load float, float* %14
%16 = getelementptr inbounds float, float* %1, i64 9
%17 = load float, float* %16
%18 = getelementptr inbounds float, float* %1, i64 10
%19 = load float, float* %18
%20 = fmul float %5, %5
%21 = tail call float @llvm.fmuladd.f32(float %3, float %3, float %20)
%22 = tail call float @llvm.fmuladd.f32(float %7, float %7, float %21)
%23 = tail call float @sqrtf(float %22)
store float %23, float* %0
%24 = fmul float %11, %11
%25 = tail call float @llvm.fmuladd.f32(float %9, float %9, float %24)
%26 = tail call float @llvm.fmuladd.f32(float %13, float %13, float %25)
%27 = tail call float @sqrtf(float %26)
%28 = getelementptr inbounds float, float* %0, i64 1
store float %27, float* %28
%29 = fmul float %17, %17
%30 = tail call float @llvm.fmuladd.f32(float %15, float %15, float %29)
%31 = tail call float @llvm.fmuladd.f32(float %19, float %19, float %30)
%32 = tail call float @sqrtf(float %31)
%33 = getelementptr inbounds float, float* %0, i64 2
store float %32, float* %33
ret void
}