#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 */
int /*<<< orphan*/ glmCrossProduct3d(double *, double *, double *);
int /*<<< orphan*/ glmNormalizeVector3d(double *);
void glmOrthonormalizeMatrix3d(double m[9]) {
  glmNormalizeVector3d(m);
  glmCrossProduct3d(&m[6], m, &m[3]);
  glmNormalizeVector3d(&m[6]);
  glmCrossProduct3d(&m[3], &m[6], m);
  glmNormalizeVector3d(&m[3]);
}


x86 assembly (clang, -O0):
<glmOrthonormalizeMatrix3d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <glmNormalizeVector3d@plt>
mov    -0x8(%rbp),%rdi
add    $0x30,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rdx
add    $0x18,%rdx
call   1030 <glmCrossProduct3d@plt>
mov    -0x8(%rbp),%rdi
add    $0x30,%rdi
call   1040 <glmNormalizeVector3d@plt>
mov    -0x8(%rbp),%rdi
add    $0x18,%rdi
mov    -0x8(%rbp),%rsi
add    $0x30,%rsi
mov    -0x8(%rbp),%rdx
call   1030 <glmCrossProduct3d@plt>
mov    -0x8(%rbp),%rdi
add    $0x18,%rdi
call   1040 <glmNormalizeVector3d@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmOrthonormalizeMatrix3d>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1040 <glmNormalizeVector3d@plt>
lea    0x30(%rbx),%r14
lea    0x18(%rbx),%r15
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1030 <glmCrossProduct3d@plt>
mov    %r14,%rdi
call   1040 <glmNormalizeVector3d@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <glmCrossProduct3d@plt>
mov    %r15,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <glmNormalizeVector3d@plt>

LLVM IR (-O0):
define void @glmOrthonormalizeMatrix3d(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = call i32 @glmNormalizeVector3d(double* %3)
%5 = load double*, double** %2
%6 = getelementptr inbounds double, double* %5, i64 6
%7 = load double*, double** %2
%8 = load double*, double** %2
%9 = getelementptr inbounds double, double* %8, i64 3
%10 = call i32 @glmCrossProduct3d(double* %6, double* %7, double* %9)
%11 = load double*, double** %2
%12 = getelementptr inbounds double, double* %11, i64 6
%13 = call i32 @glmNormalizeVector3d(double* %12)
%14 = load double*, double** %2
%15 = getelementptr inbounds double, double* %14, i64 3
%16 = load double*, double** %2
%17 = getelementptr inbounds double, double* %16, i64 6
%18 = load double*, double** %2
%19 = call i32 @glmCrossProduct3d(double* %15, double* %17, double* %18)
%20 = load double*, double** %2
%21 = getelementptr inbounds double, double* %20, i64 3
%22 = call i32 @glmNormalizeVector3d(double* %21)
ret void
}

LLVM IR (-O2):
define void @glmOrthonormalizeMatrix3d(double* %0) {
%2 = tail call i32 @glmNormalizeVector3d(double* %0)
%3 = getelementptr inbounds double, double* %0, i64 6
%4 = getelementptr inbounds double, double* %0, i64 3
%5 = tail call i32 @glmCrossProduct3d(double* %3, double* %0, double* %4)
%6 = tail call i32 @glmNormalizeVector3d(double* %3)
%7 = tail call i32 @glmCrossProduct3d(double* %4, double* %3, double* %0)
%8 = tail call i32 @glmNormalizeVector3d(double* %4)
ret void
}