#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 */
typedef union quat {
  int dummy;
} quat;

/* Variables and functions */
int /*<<< orphan*/ quat_init_axis(union quat *, float, float, float, float);
int /*<<< orphan*/ quat_to_axis(union quat *, float *, float *, float *,
                                float *);
void compute_arbitrary_spin(float frame_rate_hz, double timestamp,
                            union quat *orientation,
                            union quat *rotational_velocity) {
  float x, y, z, a;
  quat_to_axis(rotational_velocity, &x, &y, &z, &a);
  a = a * frame_rate_hz / 10.0 * timestamp;
  quat_init_axis(orientation, x, y, z, a);
}


x86 assembly (clang, -O0):
<compute_arbitrary_spin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x24(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x2c(%rbp),%rcx
lea    -0x30(%rbp),%r8
call   1030 <quat_to_axis@plt>
movss  -0x30(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe97(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x10(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
movss  -0x24(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
movss  -0x2c(%rbp),%xmm2
movss  -0x30(%rbp),%xmm3
call   1040 <quat_init_axis@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_arbitrary_spin>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rax
mov    %rdi,%rbx
movsd  %xmm1,0x18(%rsp)
movss  %xmm0,0x8(%rsp)
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x4(%rsp),%r8
mov    %rax,%rdi
call   1030 <quat_to_axis@plt>
movss  0x8(%rsp),%xmm0
mulss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0xe95(%rip),%xmm0
mulsd  0x18(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm3
movss  %xmm3,0x4(%rsp)
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
movss  0xc(%rsp),%xmm2
mov    %rbx,%rdi
call   1040 <quat_init_axis@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%union.quat = type { i32 }
define void @compute_arbitrary_spin(float %0, double %1, %union.quat* %2, %union.quat* %3) {
%5 = alloca float
%6 = alloca double
%7 = alloca %union.quat*
%8 = alloca %union.quat*
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
store float %0, float* %5
store double %1, double* %6
store %union.quat* %2, %union.quat** %7
store %union.quat* %3, %union.quat** %8
%13 = load %union.quat*, %union.quat** %8
%14 = call i32 @quat_to_axis(%union.quat* %13, float* %9, float* %10, float* %11, float* %12)
%15 = load float, float* %12
%16 = load float, float* %5
%17 = fmul float %15, %16
%18 = fpext float %17 to double
%19 = fdiv double %18, 1.000000e+01
%20 = load double, double* %6
%21 = fmul double %19, %20
%22 = fptrunc double %21 to float
store float %22, float* %12
%23 = load %union.quat*, %union.quat** %7
%24 = load float, float* %9
%25 = load float, float* %10
%26 = load float, float* %11
%27 = load float, float* %12
%28 = call i32 @quat_init_axis(%union.quat* %23, float %24, float %25, float %26, float %27)
ret void
}

LLVM IR (-O2):
%union.quat = type { i32 }
define void @compute_arbitrary_spin(float %0, double %1, %union.quat* %2, %union.quat* %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = bitcast float* %5 to i8*
%10 = bitcast float* %6 to i8*
%11 = bitcast float* %7 to i8*
%12 = bitcast float* %8 to i8*
%13 = call i32 @quat_to_axis(%union.quat* %3, float* %5, float* %6, float* %7, float* %8)
%14 = load float, float* %8
%15 = fmul float %14, %0
%16 = fpext float %15 to double
%17 = fdiv double %16, 1.000000e+01
%18 = fmul double %17, %1
%19 = fptrunc double %18 to float
store float %19, float* %8
%20 = load float, float* %5
%21 = load float, float* %6
%22 = load float, float* %7
%23 = call i32 @quat_init_axis(%union.quat* %2, float %20, float %21, float %22, float %19)
ret void
}