#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*/ dcm_orthonormalize(float **);
int /*<<< orphan*/ vector3d_add(float *, float *, float *);
int /*<<< orphan*/ vector3d_cross(float *, float *, float *);
void dcm_rotate(float dcm[3][3], float w[3]) {
  int i;
  float dR[3];
  for (i = 0; i < 3; i++) {
    vector3d_cross(w, dcm[i], dR);
    vector3d_add(dcm[i], dR, dcm[i]);
  }
  dcm_orthonormalize(dcm);
}


x86 assembly (clang, -O0):
<dcm_rotate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    11a2 <dcm_rotate+0x72>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x14(%rbp),%rax
imul   $0xc,%rax,%rax
add    %rax,%rsi
lea    -0x20(%rbp),%rdx
call   1040 <vector3d_cross@plt>
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rax
imul   $0xc,%rax,%rax
add    %rax,%rdi
lea    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%rdx
movslq -0x14(%rbp),%rax
imul   $0xc,%rax,%rax
add    %rax,%rdx
call   1030 <vector3d_add@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <dcm_rotate+0x17>
mov    -0x8(%rbp),%rdi
call   1050 <dcm_orthonormalize@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dcm_rotate>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xc(%rsp),%r14
mov    %rsi,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   1040 <vector3d_cross@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1030 <vector3d_add@plt>
lea    0xc(%r12),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <vector3d_cross@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <vector3d_add@plt>
lea    0x18(%r12),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <vector3d_cross@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <vector3d_add@plt>
mov    %r12,%rdi
call   1050 <dcm_orthonormalize@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @dcm_rotate([3 x float]* %0, float* %1) {
%3 = alloca [3 x float]*
%4 = alloca float*
%5 = alloca i32
%6 = alloca [3 x float]
store [3 x float]* %0, [3 x float]** %3
store float* %1, float** %4
store i32 0, i32* %5
br label %7
7: ; preds = %31, %2
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 3
br i1 %9, label %10, label %34
10: ; preds = %7
%11 = load float*, float** %4
%12 = load [3 x float]*, [3 x float]** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [3 x float], [3 x float]* %12, i64 %14
%16 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 0
%17 = getelementptr inbounds [3 x float], [3 x float]* %6, i64 0, i64 0
%18 = call i32 @vector3d_cross(float* %11, float* %16, float* %17)
%19 = load [3 x float]*, [3 x float]** %3
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [3 x float], [3 x float]* %19, i64 %21
%23 = getelementptr inbounds [3 x float], [3 x float]* %22, i64 0, i64 0
%24 = getelementptr inbounds [3 x float], [3 x float]* %6, i64 0, i64 0
%25 = load [3 x float]*, [3 x float]** %3
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [3 x float], [3 x float]* %25, i64 %27
%29 = getelementptr inbounds [3 x float], [3 x float]* %28, i64 0, i64 0
%30 = call i32 @vector3d_add(float* %23, float* %24, float* %29)
br label %31
31: ; preds = %10
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %7
34: ; preds = %7
%35 = load [3 x float]*, [3 x float]** %3
%36 = bitcast [3 x float]* %35 to float**
%37 = call i32 @dcm_orthonormalize(float** %36)
ret void
}

LLVM IR (-O2):
define void @dcm_rotate([3 x float]* %0, float* %1) {
%3 = alloca [3 x float]
%4 = bitcast [3 x float]* %3 to i8*
%5 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 0
%6 = getelementptr inbounds [3 x float], [3 x float]* %0, i64 0, i64 0
%7 = call i32 @vector3d_cross(float* %1, float* %6, float* %5)
%8 = call i32 @vector3d_add(float* %6, float* %5, float* %6)
%9 = getelementptr inbounds [3 x float], [3 x float]* %0, i64 1, i64 0
%10 = call i32 @vector3d_cross(float* %1, float* %9, float* %5)
%11 = call i32 @vector3d_add(float* %9, float* %5, float* %9)
%12 = getelementptr inbounds [3 x float], [3 x float]* %0, i64 2, i64 0
%13 = call i32 @vector3d_cross(float* %1, float* %12, float* %5)
%14 = call i32 @vector3d_add(float* %12, float* %5, float* %12)
%15 = bitcast [3 x float]* %0 to float**
%16 = call i32 @dcm_orthonormalize(float** %15)
ret void
}