#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 */
struct ahrs_data {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ahrs_euler_init(struct ahrs_data *, int, double *);
int /*<<< orphan*/ quat_of_eulers(double *, double, double, double);
void ahrs_quat_init(struct ahrs_data *ad, int len, double *X) {
  ahrs_euler_init(ad, len, X);
  X[6] = X[5];
  X[5] = X[4];
  X[4] = X[3];
  quat_of_eulers(X, X[0], X[1], X[2]);
}


x86 assembly (clang, -O0):
<ahrs_quat_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <ahrs_euler_init@plt>
mov    -0x18(%rbp),%rax
movsd  0x28(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x30(%rax)
mov    -0x18(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x28(%rax)
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x18(%rbp),%rdi
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
call   1040 <quat_of_eulers@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ahrs_quat_init>:
push   %rbx
mov    %rdx,%rbx
call   1030 <ahrs_euler_init@plt>
movsd  0x28(%rbx),%xmm0
movsd  %xmm0,0x30(%rbx)
movups 0x18(%rbx),%xmm0
movups %xmm0,0x20(%rbx)
movsd  (%rbx),%xmm0
movsd  0x8(%rbx),%xmm1
movsd  0x10(%rbx),%xmm2
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <quat_of_eulers@plt>

LLVM IR (-O0):
%struct.ahrs_data = type { i32 }
define void @ahrs_quat_init(%struct.ahrs_data* %0, i32 %1, double* %2) {
%4 = alloca %struct.ahrs_data*
%5 = alloca i32
%6 = alloca double*
store %struct.ahrs_data* %0, %struct.ahrs_data** %4
store i32 %1, i32* %5
store double* %2, double** %6
%7 = load %struct.ahrs_data*, %struct.ahrs_data** %4
%8 = load i32, i32* %5
%9 = load double*, double** %6
%10 = call i32 @ahrs_euler_init(%struct.ahrs_data* %7, i32 %8, double* %9)
%11 = load double*, double** %6
%12 = getelementptr inbounds double, double* %11, i64 5
%13 = load double, double* %12
%14 = load double*, double** %6
%15 = getelementptr inbounds double, double* %14, i64 6
store double %13, double* %15
%16 = load double*, double** %6
%17 = getelementptr inbounds double, double* %16, i64 4
%18 = load double, double* %17
%19 = load double*, double** %6
%20 = getelementptr inbounds double, double* %19, i64 5
store double %18, double* %20
%21 = load double*, double** %6
%22 = getelementptr inbounds double, double* %21, i64 3
%23 = load double, double* %22
%24 = load double*, double** %6
%25 = getelementptr inbounds double, double* %24, i64 4
store double %23, double* %25
%26 = load double*, double** %6
%27 = load double*, double** %6
%28 = getelementptr inbounds double, double* %27, i64 0
%29 = load double, double* %28
%30 = load double*, double** %6
%31 = getelementptr inbounds double, double* %30, i64 1
%32 = load double, double* %31
%33 = load double*, double** %6
%34 = getelementptr inbounds double, double* %33, i64 2
%35 = load double, double* %34
%36 = call i32 @quat_of_eulers(double* %26, double %29, double %32, double %35)
ret void
}

LLVM IR (-O2):
%struct.ahrs_data = type { i32 }
define void @ahrs_quat_init(%struct.ahrs_data* %0, i32 %1, double* %2) {
%4 = tail call i32 @ahrs_euler_init(%struct.ahrs_data* %0, i32 %1, double* %2)
%5 = getelementptr inbounds double, double* %2, i64 5
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %2, i64 6
store double %6, double* %7
%8 = getelementptr inbounds double, double* %2, i64 4
%9 = getelementptr inbounds double, double* %2, i64 3
%10 = bitcast double* %9 to <2 x double>*
%11 = load <2 x double>, <2 x double>* %10
%12 = bitcast double* %8 to <2 x double>*
store <2 x double> %11, <2 x double>* %12
%13 = load double, double* %2
%14 = getelementptr inbounds double, double* %2, i64 1
%15 = load double, double* %14
%16 = getelementptr inbounds double, double* %2, i64 2
%17 = load double, double* %16
%18 = tail call i32 @quat_of_eulers(double* %2, double %13, double %15, double %17)
ret void
}