#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 float const *quat_prv;

/* Variables and functions */
int /*<<< orphan*/ QuatMultiply(float *, float *, float *);
void IntegrateEuler(const float *quat_prv, const float *omega, const float dt,
                    float *quat_updated) {
  float omega_quat[4][1] = {{0.0}, {*(omega)}, {*(omega + 1)}, {*(omega + 2)}};
  QuatMultiply((float *)quat_prv, (float *)omega_quat, (float *)quat_updated);
  *(quat_updated) = *(quat_prv) + 0.5 * dt * (*(quat_updated));
  *(quat_updated + 1) = *(quat_prv + 1) + 0.5 * dt * (*(quat_updated + 1));
  *(quat_updated + 2) = *(quat_prv + 2) + 0.5 * dt * (*(quat_updated + 2));
  *(quat_updated + 3) = *(quat_prv + 3) + 0.5 * dt * (*(quat_updated + 3));
}


x86 assembly (clang, -O0):
<IntegrateEuler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <QuatMultiply@plt>
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm2
movsd  0xe78(%rip),%xmm0
mulsd  %xmm2,%xmm0
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm2
movsd  0xe36(%rip),%xmm0
mulsd  %xmm2,%xmm0
mov    -0x20(%rbp),%rax
movss  0x4(%rax),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm2
movsd  0xdf2(%rip),%xmm0
mulsd  %xmm2,%xmm0
mov    -0x20(%rbp),%rax
movss  0x8(%rax),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movss  0xc(%rax),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm2
movsd  0xdae(%rip),%xmm0
mulsd  %xmm2,%xmm0
mov    -0x20(%rbp),%rax
movss  0xc(%rax),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,0xc(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IntegrateEuler>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%rbx
movss  %xmm0,0xc(%rsp)
mov    %rdi,%r14
movl   $0x0,0x10(%rsp)
movss  (%rsi),%xmm0
movss  %xmm0,0x14(%rsp)
movss  0x4(%rsi),%xmm0
movss  %xmm0,0x18(%rsp)
movss  0x8(%rsi),%xmm0
movss  %xmm0,0x1c(%rsp)
lea    0x10(%rsp),%rsi
call   1030 <QuatMultiply@plt>
movss  (%r14),%xmm1
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe94(%rip),%xmm0
cvtss2sd %xmm1,%xmm1
movss  (%rbx),%xmm2
movss  0x4(%rbx),%xmm3
cvtss2sd %xmm2,%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtsd2ss %xmm2,%xmm1
movss  %xmm1,(%rbx)
movss  0x4(%r14),%xmm1
cvtss2sd %xmm1,%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm3,%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtsd2ss %xmm2,%xmm1
movss  %xmm1,0x4(%rbx)
movss  0x8(%r14),%xmm1
cvtss2sd %xmm1,%xmm1
movss  0x8(%rbx),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtsd2ss %xmm2,%xmm1
movss  %xmm1,0x8(%rbx)
movss  0xc(%r14),%xmm1
cvtss2sd %xmm1,%xmm1
movss  0xc(%rbx),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
movss  %xmm0,0xc(%rbx)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @IntegrateEuler(float* %0, float* %1, float %2, float* %3) {
%5 = alloca float*
%6 = alloca float*
%7 = alloca float
%8 = alloca float*
%9 = alloca [4 x [1 x float]]
store float* %0, float** %5
store float* %1, float** %6
store float %2, float* %7
store float* %3, float** %8
%10 = getelementptr inbounds [4 x [1 x float]], [4 x [1 x float]]* %9, i64 0, i64 0
%11 = getelementptr inbounds [1 x float], [1 x float]* %10, i64 0, i64 0
store float 0.000000e+00, float* %11
%12 = getelementptr inbounds [1 x float], [1 x float]* %10, i64 1
%13 = getelementptr inbounds [1 x float], [1 x float]* %12, i64 0, i64 0
%14 = load float*, float** %6
%15 = load float, float* %14
store float %15, float* %13
%16 = getelementptr inbounds [1 x float], [1 x float]* %12, i64 1
%17 = getelementptr inbounds [1 x float], [1 x float]* %16, i64 0, i64 0
%18 = load float*, float** %6
%19 = getelementptr inbounds float, float* %18, i64 1
%20 = load float, float* %19
store float %20, float* %17
%21 = getelementptr inbounds [1 x float], [1 x float]* %16, i64 1
%22 = getelementptr inbounds [1 x float], [1 x float]* %21, i64 0, i64 0
%23 = load float*, float** %6
%24 = getelementptr inbounds float, float* %23, i64 2
%25 = load float, float* %24
store float %25, float* %22
%26 = load float*, float** %5
%27 = getelementptr inbounds [4 x [1 x float]], [4 x [1 x float]]* %9, i64 0, i64 0
%28 = bitcast [1 x float]* %27 to float*
%29 = load float*, float** %8
%30 = call i32 @QuatMultiply(float* %26, float* %28, float* %29)
%31 = load float*, float** %5
%32 = load float, float* %31
%33 = fpext float %32 to double
%34 = load float, float* %7
%35 = fpext float %34 to double
%36 = fmul double 5.000000e-01, %35
%37 = load float*, float** %8
%38 = load float, float* %37
%39 = fpext float %38 to double
%40 = call double @llvm.fmuladd.f64(double %36, double %39, double %33)
%41 = fptrunc double %40 to float
%42 = load float*, float** %8
store float %41, float* %42
%43 = load float*, float** %5
%44 = getelementptr inbounds float, float* %43, i64 1
%45 = load float, float* %44
%46 = fpext float %45 to double
%47 = load float, float* %7
%48 = fpext float %47 to double
%49 = fmul double 5.000000e-01, %48
%50 = load float*, float** %8
%51 = getelementptr inbounds float, float* %50, i64 1
%52 = load float, float* %51
%53 = fpext float %52 to double
%54 = call double @llvm.fmuladd.f64(double %49, double %53, double %46)
%55 = fptrunc double %54 to float
%56 = load float*, float** %8
%57 = getelementptr inbounds float, float* %56, i64 1
store float %55, float* %57
%58 = load float*, float** %5
%59 = getelementptr inbounds float, float* %58, i64 2
%60 = load float, float* %59
%61 = fpext float %60 to double
%62 = load float, float* %7
%63 = fpext float %62 to double
%64 = fmul double 5.000000e-01, %63
%65 = load float*, float** %8
%66 = getelementptr inbounds float, float* %65, i64 2
%67 = load float, float* %66
%68 = fpext float %67 to double
%69 = call double @llvm.fmuladd.f64(double %64, double %68, double %61)
%70 = fptrunc double %69 to float
%71 = load float*, float** %8
%72 = getelementptr inbounds float, float* %71, i64 2
store float %70, float* %72
%73 = load float*, float** %5
%74 = getelementptr inbounds float, float* %73, i64 3
%75 = load float, float* %74
%76 = fpext float %75 to double
%77 = load float, float* %7
%78 = fpext float %77 to double
%79 = fmul double 5.000000e-01, %78
%80 = load float*, float** %8
%81 = getelementptr inbounds float, float* %80, i64 3
%82 = load float, float* %81
%83 = fpext float %82 to double
%84 = call double @llvm.fmuladd.f64(double %79, double %83, double %76)
%85 = fptrunc double %84 to float
%86 = load float*, float** %8
%87 = getelementptr inbounds float, float* %86, i64 3
store float %85, float* %87
ret void
}

LLVM IR (-O2):
define void @IntegrateEuler(float* %0, float* nocapture %1, float %2, float* %3) {
%5 = alloca [4 x [1 x float]]
%6 = bitcast [4 x [1 x float]]* %5 to i8*
%7 = getelementptr inbounds [4 x [1 x float]], [4 x [1 x float]]* %5, i64 0, i64 0, i64 0
store float 0.000000e+00, float* %7
%8 = getelementptr inbounds [4 x [1 x float]], [4 x [1 x float]]* %5, i64 0, i64 1, i64 0
%9 = load float, float* %1
store float %9, float* %8
%10 = getelementptr inbounds [4 x [1 x float]], [4 x [1 x float]]* %5, i64 0, i64 2, i64 0
%11 = getelementptr inbounds float, float* %1, i64 1
%12 = load float, float* %11
store float %12, float* %10
%13 = getelementptr inbounds [4 x [1 x float]], [4 x [1 x float]]* %5, i64 0, i64 3, i64 0
%14 = getelementptr inbounds float, float* %1, i64 2
%15 = load float, float* %14
store float %15, float* %13
%16 = call i32 @QuatMultiply(float* %0, float* %7, float* %3)
%17 = load float, float* %0
%18 = fpext float %17 to double
%19 = fpext float %2 to double
%20 = fmul double %19, 5.000000e-01
%21 = load float, float* %3
%22 = fpext float %21 to double
%23 = call double @llvm.fmuladd.f64(double %20, double %22, double %18)
%24 = fptrunc double %23 to float
store float %24, float* %3
%25 = getelementptr inbounds float, float* %0, i64 1
%26 = load float, float* %25
%27 = fpext float %26 to double
%28 = getelementptr inbounds float, float* %3, i64 1
%29 = load float, float* %28
%30 = fpext float %29 to double
%31 = call double @llvm.fmuladd.f64(double %20, double %30, double %27)
%32 = fptrunc double %31 to float
store float %32, float* %28
%33 = getelementptr inbounds float, float* %0, i64 2
%34 = load float, float* %33
%35 = fpext float %34 to double
%36 = getelementptr inbounds float, float* %3, i64 2
%37 = load float, float* %36
%38 = fpext float %37 to double
%39 = call double @llvm.fmuladd.f64(double %20, double %38, double %35)
%40 = fptrunc double %39 to float
store float %40, float* %36
%41 = getelementptr inbounds float, float* %0, i64 3
%42 = load float, float* %41
%43 = fpext float %42 to double
%44 = getelementptr inbounds float, float* %3, i64 3
%45 = load float, float* %44
%46 = fpext float %45 to double
%47 = call double @llvm.fmuladd.f64(double %20, double %46, double %43)
%48 = fptrunc double %47 to float
store float %48, float* %44
ret void
}