#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*/ bot_quat_mult(double *, double *, double const *);
int /*<<< orphan*/ memcpy(double *, double *, int);
void bot_quat_rotate_rev(const double rot[4], double v[3]) {
  double a[4], b[4], c[4];
  b[0] = 0;
  memcpy(b + 1, v, 3 * sizeof(double));
  bot_quat_mult(a, b, rot);
  b[0] = rot[0];
  b[1] = -rot[1];
  b[2] = -rot[2];
  b[3] = -rot[3];
  bot_quat_mult(c, b, a);
  memcpy(v, c + 1, 3 * sizeof(double));
}


x86 assembly (clang, -O0):
<bot_quat_rotate_rev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
lea    -0x50(%rbp),%rdi
add    $0x8,%rdi
mov    -0x10(%rbp),%rsi
mov    $0x18,%edx
call   1030 <memcpy@plt>
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1040 <bot_quat_mult@plt>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    -0x70(%rbp),%rdi
lea    -0x50(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1040 <bot_quat_mult@plt>
mov    -0x10(%rbp),%rdi
lea    -0x70(%rbp),%rsi
add    $0x8,%rsi
mov    $0x18,%edx
call   1030 <memcpy@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bot_quat_rotate_rev>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movq   $0x0,(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x18,%edx
call   1030 <memcpy@plt>
lea    0x40(%rsp),%r15
mov    %rsp,%r12
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1040 <bot_quat_mult@plt>
movsd  (%rbx),%xmm0
movsd  %xmm0,(%rsp)
movups 0x8(%rbx),%xmm0
movaps 0xe8e(%rip),%xmm1
xorps  %xmm1,%xmm0
movups %xmm0,0x8(%rsp)
movsd  0x18(%rbx),%xmm0
xorps  %xmm1,%xmm0
movlps %xmm0,0x18(%rsp)
lea    0x20(%rsp),%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1040 <bot_quat_mult@plt>
lea    0x28(%rsp),%rsi
mov    %r14,%rdi
mov    $0x18,%edx
call   1030 <memcpy@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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