#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 */
double cos(double);
double sin(double);
void Rodrigues(double *vx, double *vy, double *vz, double kx, double ky,
               double kz, double theta) {
  double ct = cos(theta);
  double st = sin(theta);
  double rx, ry, rz;
  double kdotv = (kx * *vx) + (ky * *vy) + (kz * *vz);
  rx = *vx * ct + (ky * *vz - kz * *vy) * st + kx * kdotv * (1 - ct);
  ry = *vy * ct + (kz * *vx - kx * *vz) * st + ky * kdotv * (1 - ct);
  rz = *vz * ct + (kx * *vy - ky * *vx) * st + kz * kdotv * (1 - ct);
  *vx = rx;
  *vy = ry;
  *vz = rz;
}


x86 assembly (clang, -O0):
<Rodrigues>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
movsd  %xmm3,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  (%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x40(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm4
movsd  -0x30(%rbp),%xmm3
mov    -0x10(%rbp),%rax
mulsd  (%rax),%xmm3
movq   %xmm3,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm3
mulsd  %xmm4,%xmm0
addsd  %xmm3,%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  0xdf9(%rip),%xmm2
subsd  -0x40(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x40(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm4
movsd  -0x20(%rbp),%xmm3
mov    -0x18(%rbp),%rax
mulsd  (%rax),%xmm3
movq   %xmm3,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm3
mulsd  %xmm4,%xmm0
addsd  %xmm3,%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  0xd82(%rip),%xmm2
subsd  -0x40(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x40(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm4
movsd  -0x28(%rbp),%xmm3
mov    -0x8(%rbp),%rax
mulsd  (%rax),%xmm3
movq   %xmm3,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm3
mulsd  %xmm4,%xmm0
addsd  %xmm3,%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  0xd0b(%rip),%xmm2
subsd  -0x40(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x58(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x60(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Rodrigues>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
movsd  %xmm3,0x8(%rsp)
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x18(%rsp)
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movaps %xmm3,%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  (%rbx),%xmm8
movsd  (%r15),%xmm4
movapd %xmm4,%xmm1
movsd  0x10(%rsp),%xmm3
mulsd  %xmm3,%xmm1
movsd  0x18(%rsp),%xmm2
movapd %xmm2,%xmm5
mulsd  %xmm8,%xmm5
addsd  %xmm1,%xmm5
movsd  (%r14),%xmm10
movsd  0x20(%rsp),%xmm9
movapd %xmm9,%xmm1
mulsd  %xmm10,%xmm1
addsd  %xmm5,%xmm1
movapd %xmm4,%xmm5
mulsd  %xmm9,%xmm5
movapd %xmm3,%xmm6
movapd %xmm3,%xmm11
mulsd  %xmm10,%xmm6
subsd  %xmm5,%xmm6
mulsd  %xmm0,%xmm6
movapd %xmm8,%xmm7
movsd  0x28(%rsp),%xmm3
mulsd  %xmm3,%xmm7
addsd  %xmm6,%xmm7
movapd %xmm1,%xmm5
mulsd  %xmm2,%xmm5
movsd  0xe16(%rip),%xmm6
subsd  %xmm3,%xmm6
movapd %xmm3,%xmm12
mulsd  %xmm6,%xmm5
addsd  %xmm7,%xmm5
movapd %xmm10,%xmm7
mulsd  %xmm2,%xmm7
movapd %xmm9,%xmm3
mulsd  %xmm8,%xmm3
subsd  %xmm7,%xmm3
mulsd  %xmm0,%xmm3
mulsd  %xmm4,%xmm2
mulsd  %xmm12,%xmm4
addsd  %xmm3,%xmm4
movapd %xmm1,%xmm3
mulsd  %xmm11,%xmm3
mulsd  %xmm6,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm11,%xmm8
movapd %xmm2,%xmm4
subsd  %xmm8,%xmm4
mulsd  %xmm0,%xmm4
mulsd  %xmm12,%xmm10
addsd  %xmm4,%xmm10
mulsd  %xmm9,%xmm1
mulsd  %xmm6,%xmm1
addsd  %xmm10,%xmm1
movsd  %xmm5,(%rbx)
movsd  %xmm3,(%r15)
movsd  %xmm1,(%r14)
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @Rodrigues(double* %0, double* %1, double* %2, double %3, double %4, double %5, double %6) {
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
store double* %0, double** %8
store double* %1, double** %9
store double* %2, double** %10
store double %3, double* %11
store double %4, double* %12
store double %5, double* %13
store double %6, double* %14
%21 = load double, double* %14
%22 = call double @cos(double %21)
store double %22, double* %15
%23 = load double, double* %14
%24 = call double @sin(double %23)
store double %24, double* %16
%25 = load double, double* %11
%26 = load double*, double** %8
%27 = load double, double* %26
%28 = load double, double* %12
%29 = load double*, double** %9
%30 = load double, double* %29
%31 = fmul double %28, %30
%32 = call double @llvm.fmuladd.f64(double %25, double %27, double %31)
%33 = load double, double* %13
%34 = load double*, double** %10
%35 = load double, double* %34
%36 = call double @llvm.fmuladd.f64(double %33, double %35, double %32)
store double %36, double* %20
%37 = load double*, double** %8
%38 = load double, double* %37
%39 = load double, double* %15
%40 = load double, double* %12
%41 = load double*, double** %10
%42 = load double, double* %41
%43 = load double, double* %13
%44 = load double*, double** %9
%45 = load double, double* %44
%46 = fmul double %43, %45
%47 = fneg double %46
%48 = call double @llvm.fmuladd.f64(double %40, double %42, double %47)
%49 = load double, double* %16
%50 = fmul double %48, %49
%51 = call double @llvm.fmuladd.f64(double %38, double %39, double %50)
%52 = load double, double* %11
%53 = load double, double* %20
%54 = fmul double %52, %53
%55 = load double, double* %15
%56 = fsub double 1.000000e+00, %55
%57 = call double @llvm.fmuladd.f64(double %54, double %56, double %51)
store double %57, double* %17
%58 = load double*, double** %9
%59 = load double, double* %58
%60 = load double, double* %15
%61 = load double, double* %13
%62 = load double*, double** %8
%63 = load double, double* %62
%64 = load double, double* %11
%65 = load double*, double** %10
%66 = load double, double* %65
%67 = fmul double %64, %66
%68 = fneg double %67
%69 = call double @llvm.fmuladd.f64(double %61, double %63, double %68)
%70 = load double, double* %16
%71 = fmul double %69, %70
%72 = call double @llvm.fmuladd.f64(double %59, double %60, double %71)
%73 = load double, double* %12
%74 = load double, double* %20
%75 = fmul double %73, %74
%76 = load double, double* %15
%77 = fsub double 1.000000e+00, %76
%78 = call double @llvm.fmuladd.f64(double %75, double %77, double %72)
store double %78, double* %18
%79 = load double*, double** %10
%80 = load double, double* %79
%81 = load double, double* %15
%82 = load double, double* %11
%83 = load double*, double** %9
%84 = load double, double* %83
%85 = load double, double* %12
%86 = load double*, double** %8
%87 = load double, double* %86
%88 = fmul double %85, %87
%89 = fneg double %88
%90 = call double @llvm.fmuladd.f64(double %82, double %84, double %89)
%91 = load double, double* %16
%92 = fmul double %90, %91
%93 = call double @llvm.fmuladd.f64(double %80, double %81, double %92)
%94 = load double, double* %13
%95 = load double, double* %20
%96 = fmul double %94, %95
%97 = load double, double* %15
%98 = fsub double 1.000000e+00, %97
%99 = call double @llvm.fmuladd.f64(double %96, double %98, double %93)
store double %99, double* %19
%100 = load double, double* %17
%101 = load double*, double** %8
store double %100, double* %101
%102 = load double, double* %18
%103 = load double*, double** %9
store double %102, double* %103
%104 = load double, double* %19
%105 = load double*, double** %10
store double %104, double* %105
ret void
}

LLVM IR (-O2):
define void @Rodrigues(double* nocapture %0, double* nocapture %1, double* nocapture %2, double %3, double %4, double %5, double %6) {
%8 = tail call double @cos(double %6)
%9 = tail call double @sin(double %6)
%10 = load double, double* %0
%11 = load double, double* %1
%12 = fmul double %11, %4
%13 = tail call double @llvm.fmuladd.f64(double %3, double %10, double %12)
%14 = load double, double* %2
%15 = tail call double @llvm.fmuladd.f64(double %5, double %14, double %13)
%16 = fneg double %11
%17 = fmul double %16, %5
%18 = tail call double @llvm.fmuladd.f64(double %4, double %14, double %17)
%19 = fmul double %9, %18
%20 = tail call double @llvm.fmuladd.f64(double %10, double %8, double %19)
%21 = fmul double %15, %3
%22 = fsub double 1.000000e+00, %8
%23 = tail call double @llvm.fmuladd.f64(double %21, double %22, double %20)
%24 = fneg double %14
%25 = fmul double %24, %3
%26 = tail call double @llvm.fmuladd.f64(double %5, double %10, double %25)
%27 = fmul double %9, %26
%28 = tail call double @llvm.fmuladd.f64(double %11, double %8, double %27)
%29 = fmul double %15, %4
%30 = tail call double @llvm.fmuladd.f64(double %29, double %22, double %28)
%31 = fneg double %10
%32 = fmul double %31, %4
%33 = tail call double @llvm.fmuladd.f64(double %3, double %11, double %32)
%34 = fmul double %9, %33
%35 = tail call double @llvm.fmuladd.f64(double %14, double %8, double %34)
%36 = fmul double %15, %5
%37 = tail call double @llvm.fmuladd.f64(double %36, double %22, double %35)
store double %23, double* %0
store double %30, double* %1
store double %37, double* %2
ret void
}