#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 */
scalar_t__ cos(double);
int /*<<< orphan*/ mat333Multiply(double **, double **, double **);
int /*<<< orphan*/ mat33Add(double **, double **, double **);
int /*<<< orphan*/ matMultScalar(scalar_t__, double **, double **);
scalar_t__ sin(double);
void mat33AngleAxisRotation(double theta, double axis[3], double rot[3][3]) {
  double axis33[3][3] = {
      0, -axis[2], axis[1], axis[2], 0, -axis[0], -axis[1], axis[0], 0,
  };
  double axis33Square[3][3];
  double identity[3][3] = {
      1, 0, 0, 0, 1, 0, 0, 0, 1,
  };
  double rAddPart1[3][3];
  double rAddPart2[3][3];
  mat333Multiply(axis33, axis33, axis33Square);
  matMultScalar(sin(theta), axis33, rAddPart1);
  matMultScalar(1 - cos(theta), axis33Square, rAddPart2);
  mat33Add(rAddPart1, rAddPart2, rot);
  mat33Add(rot, identity, rot);
}


x86 assembly (clang, -O0):
<mat33AngleAxisRotation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    -0x100(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1060 <memset@plt>
movsd  0xdbe(%rip),%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
movsd  0xdae(%rip),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  0xd9e(%rip),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
lea    -0x60(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
call   1040 <mat333Multiply@plt>
movsd  -0x8(%rbp),%xmm0
call   1070 <sin@plt>
mov    %rax,%rdi
lea    -0x60(%rbp),%rsi
lea    -0x150(%rbp),%rdx
call   1050 <matMultScalar@plt>
movsd  -0x8(%rbp),%xmm0
call   1080 <cos@plt>
mov    $0x1,%edi
sub    %rax,%rdi
lea    -0xb0(%rbp),%rsi
lea    -0x1a0(%rbp),%rdx
call   1050 <matMultScalar@plt>
lea    -0x150(%rbp),%rdi
lea    -0x1a0(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <mat33Add@plt>
mov    -0x18(%rbp),%rdi
lea    -0x100(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <mat33Add@plt>
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mat33AngleAxisRotation>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x198,%rsp
mov    %rsi,%r14
movsd  %xmm0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
movsd  0x10(%rdi),%xmm0
movaps 0xe84(%rip),%xmm1
movaps %xmm0,%xmm2
xorps  %xmm1,%xmm2
movlps %xmm2,0x18(%rsp)
movups (%rdi),%xmm2
movhps %xmm2,0x20(%rsp)
movsd  %xmm0,0x28(%rsp)
movq   $0x0,0x30(%rsp)
xorps  %xmm2,%xmm1
movups %xmm1,0x38(%rsp)
movlps %xmm2,0x48(%rsp)
movq   $0x0,0x50(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x70(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x60(%rsp)
mov    %rax,0x80(%rsp)
mov    %rax,0xa0(%rsp)
lea    0x10(%rsp),%rbx
lea    0x150(%rsp),%r15
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1040 <mat333Multiply@plt>
movsd  0x8(%rsp),%xmm0
call   1060 <sin@plt>
lea    0x100(%rsp),%r12
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1050 <matMultScalar@plt>
movsd  0x8(%rsp),%xmm0
call   1070 <cos@plt>
mov    $0x1,%edi
sub    %rax,%rdi
lea    0xb0(%rsp),%rbx
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <matMultScalar@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <mat33Add@plt>
lea    0x60(%rsp),%rsi
mov    %r14,%rdi
mov    %r14,%rdx
call   1030 <mat33Add@plt>
add    $0x198,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @mat33AngleAxisRotation(double %0, double* %1, [3 x double]* %2) {
%4 = alloca double
%5 = alloca double*
%6 = alloca [3 x double]*
%7 = alloca [3 x [3 x double]]
%8 = alloca [3 x [3 x double]]
%9 = alloca [3 x [3 x double]]
%10 = alloca [3 x [3 x double]]
%11 = alloca [3 x [3 x double]]
store double %0, double* %4
store double* %1, double** %5
store [3 x double]* %2, [3 x double]** %6
%12 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %7, i64 0, i64 0
%13 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0, i64 0
store double 0.000000e+00, double* %13
%14 = getelementptr inbounds double, double* %13, i64 1
%15 = load double*, double** %5
%16 = getelementptr inbounds double, double* %15, i64 2
%17 = load double, double* %16
%18 = fneg double %17
store double %18, double* %14
%19 = getelementptr inbounds double, double* %14, i64 1
%20 = load double*, double** %5
%21 = getelementptr inbounds double, double* %20, i64 1
%22 = load double, double* %21
store double %22, double* %19
%23 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 1
%24 = getelementptr inbounds [3 x double], [3 x double]* %23, i64 0, i64 0
%25 = load double*, double** %5
%26 = getelementptr inbounds double, double* %25, i64 2
%27 = load double, double* %26
store double %27, double* %24
%28 = getelementptr inbounds double, double* %24, i64 1
store double 0.000000e+00, double* %28
%29 = getelementptr inbounds double, double* %28, i64 1
%30 = load double*, double** %5
%31 = getelementptr inbounds double, double* %30, i64 0
%32 = load double, double* %31
%33 = fneg double %32
store double %33, double* %29
%34 = getelementptr inbounds [3 x double], [3 x double]* %23, i64 1
%35 = getelementptr inbounds [3 x double], [3 x double]* %34, i64 0, i64 0
%36 = load double*, double** %5
%37 = getelementptr inbounds double, double* %36, i64 1
%38 = load double, double* %37
%39 = fneg double %38
store double %39, double* %35
%40 = getelementptr inbounds double, double* %35, i64 1
%41 = load double*, double** %5
%42 = getelementptr inbounds double, double* %41, i64 0
%43 = load double, double* %42
store double %43, double* %40
%44 = getelementptr inbounds double, double* %40, i64 1
store double 0.000000e+00, double* %44
%45 = bitcast [3 x [3 x double]]* %9 to i8*
%46 = bitcast i8* %45 to [3 x [3 x double]]*
%47 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %46, i32 0, i32 0
%48 = getelementptr inbounds [3 x double], [3 x double]* %47, i32 0, i32 0
store double 1.000000e+00, double* %48
%49 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %46, i32 0, i32 1
%50 = getelementptr inbounds [3 x double], [3 x double]* %49, i32 0, i32 1
store double 1.000000e+00, double* %50
%51 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %46, i32 0, i32 2
%52 = getelementptr inbounds [3 x double], [3 x double]* %51, i32 0, i32 2
store double 1.000000e+00, double* %52
%53 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %7, i64 0, i64 0
%54 = bitcast [3 x double]* %53 to double**
%55 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %7, i64 0, i64 0
%56 = bitcast [3 x double]* %55 to double**
%57 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %8, i64 0, i64 0
%58 = bitcast [3 x double]* %57 to double**
%59 = call i32 @mat333Multiply(double** %54, double** %56, double** %58)
%60 = load double, double* %4
%61 = call i64 @sin(double %60)
%62 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %7, i64 0, i64 0
%63 = bitcast [3 x double]* %62 to double**
%64 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %10, i64 0, i64 0
%65 = bitcast [3 x double]* %64 to double**
%66 = call i32 @matMultScalar(i64 %61, double** %63, double** %65)
%67 = load double, double* %4
%68 = call i64 @cos(double %67)
%69 = sub nsw i64 1, %68
%70 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %8, i64 0, i64 0
%71 = bitcast [3 x double]* %70 to double**
%72 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %11, i64 0, i64 0
%73 = bitcast [3 x double]* %72 to double**
%74 = call i32 @matMultScalar(i64 %69, double** %71, double** %73)
%75 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %10, i64 0, i64 0
%76 = bitcast [3 x double]* %75 to double**
%77 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %11, i64 0, i64 0
%78 = bitcast [3 x double]* %77 to double**
%79 = load [3 x double]*, [3 x double]** %6
%80 = bitcast [3 x double]* %79 to double**
%81 = call i32 @mat33Add(double** %76, double** %78, double** %80)
%82 = load [3 x double]*, [3 x double]** %6
%83 = bitcast [3 x double]* %82 to double**
%84 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %9, i64 0, i64 0
%85 = bitcast [3 x double]* %84 to double**
%86 = load [3 x double]*, [3 x double]** %6
%87 = bitcast [3 x double]* %86 to double**
%88 = call i32 @mat33Add(double** %83, double** %85, double** %87)
ret void
}

LLVM IR (-O2):
define void @mat33AngleAxisRotation(double %0, double* nocapture %1, [3 x double]* %2) {
%4 = alloca [3 x [3 x double]]
%5 = alloca [3 x [3 x double]]
%6 = alloca [3 x [3 x double]]
%7 = alloca [3 x [3 x double]]
%8 = alloca [3 x [3 x double]]
%9 = bitcast [3 x [3 x double]]* %4 to i8*
%10 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 0, i64 0
store double 0.000000e+00, double* %10
%11 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 0, i64 1
%12 = getelementptr inbounds double, double* %1, i64 2
%13 = load double, double* %12
%14 = fneg double %13
store double %14, double* %11
%15 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 0, i64 2
%16 = bitcast double* %1 to <2 x double>*
%17 = load <2 x double>, <2 x double>* %16
%18 = extractelement <2 x double> %17, i64 1
store double %18, double* %15
%19 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 1, i64 0
store double %13, double* %19
%20 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 1, i64 1
store double 0.000000e+00, double* %20
%21 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 1, i64 2
%22 = fneg <2 x double> %17
%23 = bitcast double* %21 to <2 x double>*
store <2 x double> %22, <2 x double>* %23
%24 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 2, i64 1
%25 = extractelement <2 x double> %17, i64 0
store double %25, double* %24
%26 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 2, i64 2
store double 0.000000e+00, double* %26
%27 = bitcast [3 x [3 x double]]* %5 to i8*
%28 = bitcast [3 x [3 x double]]* %6 to i8*
%29 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %6, i64 0, i64 0, i64 0
store double 1.000000e+00, double* %29
%30 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %6, i64 0, i64 1, i64 1
store double 1.000000e+00, double* %30
%31 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %6, i64 0, i64 2, i64 2
store double 1.000000e+00, double* %31
%32 = bitcast [3 x [3 x double]]* %7 to i8*
%33 = bitcast [3 x [3 x double]]* %8 to i8*
%34 = bitcast [3 x [3 x double]]* %4 to double**
%35 = bitcast [3 x [3 x double]]* %5 to double**
%36 = call i32 @mat333Multiply(double** %34, double** %34, double** %35)
%37 = call i64 @sin(double %0)
%38 = bitcast [3 x [3 x double]]* %7 to double**
%39 = call i32 @matMultScalar(i64 %37, double** %34, double** %38)
%40 = call i64 @cos(double %0)
%41 = sub nsw i64 1, %40
%42 = bitcast [3 x [3 x double]]* %8 to double**
%43 = call i32 @matMultScalar(i64 %41, double** %35, double** %42)
%44 = bitcast [3 x double]* %2 to double**
%45 = call i32 @mat33Add(double** %38, double** %42, double** %44)
%46 = bitcast [3 x [3 x double]]* %6 to double**
%47 = call i32 @mat33Add(double** %44, double** %46, double** %44)
ret void
}