#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*/ Vec3Add(double *, double *, double *);
int /*<<< orphan*/ Vec3Cross(double *, double *, double *);
int /*<<< orphan*/ Vec3MultValue(double *, double, double *);
void ScrewToAxis(double q[3], double s[3], double h, double S[6]) {
  double v[3];
  double temp[3];
  Vec3Cross(s, q, temp);
  Vec3MultValue(temp, -1.0, temp);
  Vec3MultValue(s, h, v);
  Vec3Add(v, temp, v);
  S[0] = s[0];
  S[1] = s[1];
  S[2] = s[2];
  S[3] = v[0];
  S[4] = v[1];
  S[5] = v[2];
  return;
}


x86 assembly (clang, -O0):
<ScrewToAxis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
lea    -0x60(%rbp),%rdx
call   1050 <Vec3Cross@plt>
lea    -0x60(%rbp),%rdi
lea    -0x60(%rbp),%rsi
movsd  0xe96(%rip),%xmm0
call   1030 <Vec3MultValue@plt>
mov    -0x10(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
lea    -0x40(%rbp),%rsi
call   1030 <Vec3MultValue@plt>
lea    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1040 <Vec3Add@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x18(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x20(%rax)
movsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x28(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ScrewToAxis>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdx,%r14
movsd  %xmm0,0x8(%rsp)
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0x30(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rdx
call   1050 <Vec3Cross@plt>
movsd  0xe9e(%rip),%xmm0
mov    %r15,%rdi
mov    %r15,%rsi
call   1030 <Vec3MultValue@plt>
lea    0x10(%rsp),%r12
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm0
mov    %r12,%rsi
call   1030 <Vec3MultValue@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <Vec3Add@plt>
movsd  (%rbx),%xmm0
movsd  %xmm0,(%r14)
movsd  0x8(%rbx),%xmm0
movsd  %xmm0,0x8(%r14)
movsd  0x10(%rbx),%xmm0
movsd  %xmm0,0x10(%r14)
movaps 0x10(%rsp),%xmm0
movups %xmm0,0x18(%r14)
movsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x28(%r14)
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @ScrewToAxis(double* %0, double* %1, double %2, double* %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
%8 = alloca double*
%9 = alloca [3 x double]
%10 = alloca [3 x double]
store double* %0, double** %5
store double* %1, double** %6
store double %2, double* %7
store double* %3, double** %8
%11 = load double*, double** %6
%12 = load double*, double** %5
%13 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%14 = call i32 @Vec3Cross(double* %11, double* %12, double* %13)
%15 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%16 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%17 = call i32 @Vec3MultValue(double* %15, double -1.000000e+00, double* %16)
%18 = load double*, double** %6
%19 = load double, double* %7
%20 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%21 = call i32 @Vec3MultValue(double* %18, double %19, double* %20)
%22 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%23 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%24 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%25 = call i32 @Vec3Add(double* %22, double* %23, double* %24)
%26 = load double*, double** %6
%27 = getelementptr inbounds double, double* %26, i64 0
%28 = load double, double* %27
%29 = load double*, double** %8
%30 = getelementptr inbounds double, double* %29, i64 0
store double %28, double* %30
%31 = load double*, double** %6
%32 = getelementptr inbounds double, double* %31, i64 1
%33 = load double, double* %32
%34 = load double*, double** %8
%35 = getelementptr inbounds double, double* %34, i64 1
store double %33, double* %35
%36 = load double*, double** %6
%37 = getelementptr inbounds double, double* %36, i64 2
%38 = load double, double* %37
%39 = load double*, double** %8
%40 = getelementptr inbounds double, double* %39, i64 2
store double %38, double* %40
%41 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%42 = load double, double* %41
%43 = load double*, double** %8
%44 = getelementptr inbounds double, double* %43, i64 3
store double %42, double* %44
%45 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 1
%46 = load double, double* %45
%47 = load double*, double** %8
%48 = getelementptr inbounds double, double* %47, i64 4
store double %46, double* %48
%49 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 2
%50 = load double, double* %49
%51 = load double*, double** %8
%52 = getelementptr inbounds double, double* %51, i64 5
store double %50, double* %52
ret void
}

LLVM IR (-O2):
define void @ScrewToAxis(double* %0, double* %1, double %2, double* nocapture writeonly %3) {
%5 = alloca [3 x double]
%6 = alloca [3 x double]
%7 = bitcast [3 x double]* %5 to i8*
%8 = bitcast [3 x double]* %6 to i8*
%9 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%10 = call i32 @Vec3Cross(double* %1, double* %0, double* %9)
%11 = call i32 @Vec3MultValue(double* %9, double -1.000000e+00, double* %9)
%12 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%13 = call i32 @Vec3MultValue(double* %1, double %2, double* %12)
%14 = call i32 @Vec3Add(double* %12, double* %9, double* %12)
%15 = load double, double* %1
store double %15, double* %3
%16 = getelementptr inbounds double, double* %1, i64 1
%17 = load double, double* %16
%18 = getelementptr inbounds double, double* %3, i64 1
store double %17, double* %18
%19 = getelementptr inbounds double, double* %1, i64 2
%20 = load double, double* %19
%21 = getelementptr inbounds double, double* %3, i64 2
store double %20, double* %21
%22 = getelementptr inbounds double, double* %3, i64 3
%23 = bitcast [3 x double]* %5 to <2 x double>*
%24 = load <2 x double>, <2 x double>* %23
%25 = bitcast double* %22 to <2 x double>*
store <2 x double> %24, <2 x double>* %25
%26 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
%27 = load double, double* %26
%28 = getelementptr inbounds double, double* %3, i64 5
store double %27, double* %28
ret void
}