#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 cosf(int /*<<< orphan*/);
int /*<<< orphan*/ mlDegToRad(float);
int /*<<< orphan*/ mlVectorMultMatrixTo(float const *, float const *, float *);
float sinf(int /*<<< orphan*/);
void mlVectorRotateTo(const float *a, const float *axis, float angle,
                      float *result) {
  const float c = cosf(mlDegToRad(angle)), s = sinf(mlDegToRad(angle));
  const float matrix[16] = {axis[0] * axis[0] * (1.0f - c) + c,
                            axis[1] * axis[0] * (1.0f - c) + axis[2] * s,
                            axis[0] * axis[2] * (1.0f - c) - axis[1] * s,
                            0.0f,
                            axis[0] * axis[1] * (1.0f - c) - axis[2] * s,
                            axis[1] * axis[1] * (1.0f - c) + c,
                            axis[1] * axis[2] * (1.0f - c) + axis[0] * s,
                            0.0f,
                            axis[0] * axis[2] * (1.0f - c) + axis[1] * s,
                            axis[1] * axis[2] * (1.0f - c) - axis[0] * s,
                            axis[2] * axis[2] * (1.0f - c) + c,
                            0.0f,
                            0.0f,
                            0.0f,
                            0.0f,
                            1.0f};
  mlVectorMultMatrixTo(a, matrix, result);
}


x86 assembly (clang, -O0):
<mlVectorRotateTo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
movss  -0x14(%rbp),%xmm0
call   1060 <mlDegToRad@plt>
mov    %eax,%edi
call   1040 <cosf@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x14(%rbp),%xmm0
call   1060 <mlDegToRad@plt>
mov    %eax,%edi
call   1030 <sinf@plt>
movss  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
mulss  (%rax),%xmm0
movss  0xe63(%rip),%xmm2
subss  -0x24(%rbp),%xmm2
movss  -0x24(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulss  (%rax),%xmm0
movss  0xe33(%rip),%xmm2
subss  -0x24(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm1
mulss  -0x28(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x6c(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
mulss  0x8(%rax),%xmm0
movss  0xdfa(%rip),%xmm2
subss  -0x24(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm1
mulss  -0x28(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x64(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
mulss  0x4(%rax),%xmm0
movss  0xdac(%rip),%xmm2
subss  -0x24(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm1
mulss  -0x28(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulss  0x4(%rax),%xmm0
movss  0xd65(%rip),%xmm2
subss  -0x24(%rbp),%xmm2
movss  -0x24(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x5c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulss  0x8(%rax),%xmm0
movss  0xd34(%rip),%xmm2
subss  -0x24(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm1
mulss  -0x28(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x54(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
mulss  0x8(%rax),%xmm0
movss  0xcf4(%rip),%xmm2
subss  -0x24(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm1
mulss  -0x28(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulss  0x8(%rax),%xmm0
movss  0xcba(%rip),%xmm2
subss  -0x24(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm1
mulss  -0x28(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulss  0x8(%rax),%xmm0
movss  0xc74(%rip),%xmm2
subss  -0x24(%rbp),%xmm2
movss  -0x24(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x44(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x3c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  0xc35(%rip),%xmm0
movss  %xmm0,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <mlVectorMultMatrixTo@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mlVectorRotateTo>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rdx,%r14
movss  %xmm0,0x8(%rsp)
mov    %rsi,%rbx
mov    %rdi,%r15
call   1060 <mlDegToRad@plt>
mov    %eax,%edi
call   1040 <cosf@plt>
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm0
call   1060 <mlDegToRad@plt>
mov    %eax,%edi
call   1030 <sinf@plt>
movss  (%rbx),%xmm1
movaps %xmm1,%xmm4
movaps %xmm0,%xmm8
movaps %xmm1,%xmm3
movaps %xmm0,%xmm5
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm1
movss  0xe63(%rip),%xmm6
movss  0xc(%rsp),%xmm2
subss  %xmm2,%xmm6
mulss  %xmm6,%xmm1
addss  %xmm2,%xmm1
movaps %xmm2,%xmm9
movss  %xmm1,0x10(%rsp)
movss  0x4(%rbx),%xmm1
movss  0x8(%rbx),%xmm7
mulss  %xmm1,%xmm4
mulss  %xmm7,%xmm8
mulss  %xmm6,%xmm4
movaps %xmm4,%xmm2
addss  %xmm8,%xmm2
movss  %xmm2,0x14(%rsp)
mulss  %xmm7,%xmm3
mulss  %xmm6,%xmm3
mulss  %xmm1,%xmm5
movaps %xmm3,%xmm2
subss  %xmm5,%xmm2
movss  %xmm2,0x18(%rsp)
movl   $0x0,0x1c(%rsp)
subss  %xmm8,%xmm4
movss  %xmm4,0x20(%rsp)
movaps %xmm1,%xmm2
mulss  %xmm1,%xmm2
mulss  %xmm6,%xmm2
addss  %xmm9,%xmm2
movss  %xmm2,0x24(%rsp)
mulss  %xmm7,%xmm1
mulss  %xmm6,%xmm1
movaps %xmm1,%xmm2
addss  %xmm0,%xmm2
movss  %xmm2,0x28(%rsp)
movl   $0x0,0x2c(%rsp)
addss  %xmm3,%xmm5
movss  %xmm5,0x30(%rsp)
subss  %xmm0,%xmm1
movss  %xmm1,0x34(%rsp)
mulss  %xmm7,%xmm7
mulss  %xmm6,%xmm7
addss  %xmm9,%xmm7
movss  %xmm7,0x38(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x3c(%rsp)
movl   $0x3f800000,0x4c(%rsp)
3f
lea    0x10(%rsp),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
call   1050 <mlVectorMultMatrixTo@plt>
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @mlVectorRotateTo(float* %0, float* %1, float %2, float* %3) {
%5 = alloca float*
%6 = alloca float*
%7 = alloca float
%8 = alloca float*
%9 = alloca float
%10 = alloca float
%11 = alloca [16 x float]
store float* %0, float** %5
store float* %1, float** %6
store float %2, float* %7
store float* %3, float** %8
%12 = load float, float* %7
%13 = call i32 @mlDegToRad(float %12)
%14 = call float @cosf(i32 %13)
store float %14, float* %9
%15 = load float, float* %7
%16 = call i32 @mlDegToRad(float %15)
%17 = call float @sinf(i32 %16)
store float %17, float* %10
%18 = getelementptr inbounds [16 x float], [16 x float]* %11, i64 0, i64 0
%19 = load float*, float** %6
%20 = getelementptr inbounds float, float* %19, i64 0
%21 = load float, float* %20
%22 = load float*, float** %6
%23 = getelementptr inbounds float, float* %22, i64 0
%24 = load float, float* %23
%25 = fmul float %21, %24
%26 = load float, float* %9
%27 = fsub float 1.000000e+00, %26
%28 = load float, float* %9
%29 = call float @llvm.fmuladd.f32(float %25, float %27, float %28)
store float %29, float* %18
%30 = getelementptr inbounds float, float* %18, i64 1
%31 = load float*, float** %6
%32 = getelementptr inbounds float, float* %31, i64 1
%33 = load float, float* %32
%34 = load float*, float** %6
%35 = getelementptr inbounds float, float* %34, i64 0
%36 = load float, float* %35
%37 = fmul float %33, %36
%38 = load float, float* %9
%39 = fsub float 1.000000e+00, %38
%40 = load float*, float** %6
%41 = getelementptr inbounds float, float* %40, i64 2
%42 = load float, float* %41
%43 = load float, float* %10
%44 = fmul float %42, %43
%45 = call float @llvm.fmuladd.f32(float %37, float %39, float %44)
store float %45, float* %30
%46 = getelementptr inbounds float, float* %30, i64 1
%47 = load float*, float** %6
%48 = getelementptr inbounds float, float* %47, i64 0
%49 = load float, float* %48
%50 = load float*, float** %6
%51 = getelementptr inbounds float, float* %50, i64 2
%52 = load float, float* %51
%53 = fmul float %49, %52
%54 = load float, float* %9
%55 = fsub float 1.000000e+00, %54
%56 = load float*, float** %6
%57 = getelementptr inbounds float, float* %56, i64 1
%58 = load float, float* %57
%59 = load float, float* %10
%60 = fmul float %58, %59
%61 = fneg float %60
%62 = call float @llvm.fmuladd.f32(float %53, float %55, float %61)
store float %62, float* %46
%63 = getelementptr inbounds float, float* %46, i64 1
store float 0.000000e+00, float* %63
%64 = getelementptr inbounds float, float* %63, i64 1
%65 = load float*, float** %6
%66 = getelementptr inbounds float, float* %65, i64 0
%67 = load float, float* %66
%68 = load float*, float** %6
%69 = getelementptr inbounds float, float* %68, i64 1
%70 = load float, float* %69
%71 = fmul float %67, %70
%72 = load float, float* %9
%73 = fsub float 1.000000e+00, %72
%74 = load float*, float** %6
%75 = getelementptr inbounds float, float* %74, i64 2
%76 = load float, float* %75
%77 = load float, float* %10
%78 = fmul float %76, %77
%79 = fneg float %78
%80 = call float @llvm.fmuladd.f32(float %71, float %73, float %79)
store float %80, float* %64
%81 = getelementptr inbounds float, float* %64, i64 1
%82 = load float*, float** %6
%83 = getelementptr inbounds float, float* %82, i64 1
%84 = load float, float* %83
%85 = load float*, float** %6
%86 = getelementptr inbounds float, float* %85, i64 1
%87 = load float, float* %86
%88 = fmul float %84, %87
%89 = load float, float* %9
%90 = fsub float 1.000000e+00, %89
%91 = load float, float* %9
%92 = call float @llvm.fmuladd.f32(float %88, float %90, float %91)
store float %92, float* %81
%93 = getelementptr inbounds float, float* %81, i64 1
%94 = load float*, float** %6
%95 = getelementptr inbounds float, float* %94, i64 1
%96 = load float, float* %95
%97 = load float*, float** %6
%98 = getelementptr inbounds float, float* %97, i64 2
%99 = load float, float* %98
%100 = fmul float %96, %99
%101 = load float, float* %9
%102 = fsub float 1.000000e+00, %101
%103 = load float*, float** %6
%104 = getelementptr inbounds float, float* %103, i64 0
%105 = load float, float* %104
%106 = load float, float* %10
%107 = fmul float %105, %106
%108 = call float @llvm.fmuladd.f32(float %100, float %102, float %107)
store float %108, float* %93
%109 = getelementptr inbounds float, float* %93, i64 1
store float 0.000000e+00, float* %109
%110 = getelementptr inbounds float, float* %109, i64 1
%111 = load float*, float** %6
%112 = getelementptr inbounds float, float* %111, i64 0
%113 = load float, float* %112
%114 = load float*, float** %6
%115 = getelementptr inbounds float, float* %114, i64 2
%116 = load float, float* %115
%117 = fmul float %113, %116
%118 = load float, float* %9
%119 = fsub float 1.000000e+00, %118
%120 = load float*, float** %6
%121 = getelementptr inbounds float, float* %120, i64 1
%122 = load float, float* %121
%123 = load float, float* %10
%124 = fmul float %122, %123
%125 = call float @llvm.fmuladd.f32(float %117, float %119, float %124)
store float %125, float* %110
%126 = getelementptr inbounds float, float* %110, i64 1
%127 = load float*, float** %6
%128 = getelementptr inbounds float, float* %127, i64 1
%129 = load float, float* %128
%130 = load float*, float** %6
%131 = getelementptr inbounds float, float* %130, i64 2
%132 = load float, float* %131
%133 = fmul float %129, %132
%134 = load float, float* %9
%135 = fsub float 1.000000e+00, %134
%136 = load float*, float** %6
%137 = getelementptr inbounds float, float* %136, i64 0
%138 = load float, float* %137
%139 = load float, float* %10
%140 = fmul float %138, %139
%141 = fneg float %140
%142 = call float @llvm.fmuladd.f32(float %133, float %135, float %141)
store float %142, float* %126
%143 = getelementptr inbounds float, float* %126, i64 1
%144 = load float*, float** %6
%145 = getelementptr inbounds float, float* %144, i64 2
%146 = load float, float* %145
%147 = load float*, float** %6
%148 = getelementptr inbounds float, float* %147, i64 2
%149 = load float, float* %148
%150 = fmul float %146, %149
%151 = load float, float* %9
%152 = fsub float 1.000000e+00, %151
%153 = load float, float* %9
%154 = call float @llvm.fmuladd.f32(float %150, float %152, float %153)
store float %154, float* %143
%155 = getelementptr inbounds float, float* %143, i64 1
store float 0.000000e+00, float* %155
%156 = getelementptr inbounds float, float* %155, i64 1
store float 0.000000e+00, float* %156
%157 = getelementptr inbounds float, float* %156, i64 1
store float 0.000000e+00, float* %157
%158 = getelementptr inbounds float, float* %157, i64 1
store float 0.000000e+00, float* %158
%159 = getelementptr inbounds float, float* %158, i64 1
store float 1.000000e+00, float* %159
%160 = load float*, float** %5
%161 = getelementptr inbounds [16 x float], [16 x float]* %11, i64 0, i64 0
%162 = load float*, float** %8
%163 = call i32 @mlVectorMultMatrixTo(float* %160, float* %161, float* %162)
ret void
}

LLVM IR (-O2):
define void @mlVectorRotateTo(float* %0, float* nocapture %1, float %2, float* %3) {
%5 = alloca [16 x float]
%6 = tail call i32 @mlDegToRad(float %2)
%7 = tail call float @cosf(i32 %6)
%8 = tail call i32 @mlDegToRad(float %2)
%9 = tail call float @sinf(i32 %8)
%10 = bitcast [16 x float]* %5 to i8*
%11 = getelementptr inbounds [16 x float], [16 x float]* %5, i64 0, i64 0
%12 = load float, float* %1
%13 = fmul float %12, %12
%14 = fsub float 1.000000e+00, %7
%15 = tail call float @llvm.fmuladd.f32(float %13, float %14, float %7)
store float %15, float* %11
%16 = getelementptr inbounds [16 x float], [16 x float]* %5, i64 0, i64 1
%17 = getelementptr inbounds float, float* %1, i64 1
%18 = load float, float* %17
%19 = fmul float %12, %18
%20 = getelementptr inbounds float, float* %1, i64 2
%21 = load float, float* %20
%22 = fmul float %9, %21
%23 = tail call float @llvm.fmuladd.f32(float %19, float %14, float %22)
store float %23, float* %16
%24 = getelementptr inbounds [16 x float], [16 x float]* %5, i64 0, i64 2
%25 = fmul float %12, %21
%26 = fneg float %18
%27 = fmul float %9, %26
%28 = tail call float @llvm.fmuladd.f32(float %25, float %14, float %27)
store float %28, float* %24
%29 = getelementptr inbounds [16 x float], [16 x float]* %5, i64 0, i64 3
store float 0.000000e+00, float* %29
%30 = getelementptr inbounds [16 x float], [16 x float]* %5, i64 0, i64 4
%31 = fneg float %21
%32 = fmul float %9, %31
%33 = tail call float @llvm.fmuladd.f32(float %19, float %14, float %32)
store float %33, float* %30
%34 = getelementptr inbounds [16 x float], [16 x float]* %5, i64 0, i64 5
%35 = fmul float %18, %18
%36 = tail call float @llvm.fmuladd.f32(float %35, float %14, float %7)
store float %36, float* %34
%37 = getelementptr inbounds [16 x float], [16 x float]* %5, i64 0, i64 6
%38 = fmul float %18, %21
%39 = fmul float %9, %12
%40 = tail call float @llvm.fmuladd.f32(float %38, float %14, float %39)
store float %40, float* %37
%41 = getelementptr inbounds [16 x float], [16 x float]* %5, i64 0, i64 7
store float 0.000000e+00, float* %41
%42 = getelementptr inbounds [16 x float], [16 x float]* %5, i64 0, i64 8
%43 = fmul float %9, %18
%44 = tail call float @llvm.fmuladd.f32(float %25, float %14, float %43)
store float %44, float* %42
%45 = getelementptr inbounds [16 x float], [16 x float]* %5, i64 0, i64 9
%46 = fneg float %12
%47 = fmul float %9, %46
%48 = tail call float @llvm.fmuladd.f32(float %38, float %14, float %47)
store float %48, float* %45
%49 = getelementptr inbounds [16 x float], [16 x float]* %5, i64 0, i64 10
%50 = fmul float %21, %21
%51 = tail call float @llvm.fmuladd.f32(float %50, float %14, float %7)
store float %51, float* %49
%52 = getelementptr inbounds [16 x float], [16 x float]* %5, i64 0, i64 11
%53 = getelementptr inbounds [16 x float], [16 x float]* %5, i64 0, i64 15
%54 = bitcast float* %52 to i8*
store float 1.000000e+00, float* %53
%55 = call i32 @mlVectorMultMatrixTo(float* %0, float* %11, float* %3)
ret void
}