#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*/ estimate_ncf(double *, double *, double *, double *, double,
                                double);
int /*<<< orphan*/ printf(char *, double, double, double, ...);
int main(void) {
  double omega[3] = {0.0619E-3, -0.0078E-3, 0.6374E-3};
  double acc[3] = {-0.2303, 0.3004, 9.4569};
  double b_est[3] = {-0.0101, -0.0079, 0.0000};
  double q_est[4] = {0.9996, 0.0167, 0.0134, 0.0197};
  double dt = 0.05;
  double kp = 0.1;
  estimate_ncf(q_est, b_est, omega, acc, kp, dt);
  printf("q_est:\t%f\t%f\t%f\t%f\n", q_est[0], q_est[1], q_est[2], q_est[3]);
  printf("q_ref:\t%f\t%f\t%f\t%f\n", 0.9996, 0.0165, 0.0132, 0.0197);
  printf("\nb_est:\t%f\t%f\t%f\n", b_est[0], b_est[1], b_est[2]);
  printf("b_ref:\t%f\t%f\t%f\n", -0.0078, -0.0065, 0.0000);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xf07(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xf04(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xf01(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xf06(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xf03(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xf00(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xf05(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xf02(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xeff(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xf04(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xf01(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0xefe(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xefb(%rip),%rax
mov    %rax,-0x68(%rbp)
movsd  0xe6f(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xe57(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
lea    -0x80(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x40(%rbp),%rcx
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x88(%rbp),%xmm1
call   1040 <estimate_ncf@plt>
movsd  -0x80(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm3
lea    0xe9f(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
lea    0xea5(%rip),%rdi
movsd  0xdd9(%rip),%xmm0
movsd  0xdd9(%rip),%xmm1
movsd  0xdd9(%rip),%xmm2
movsd  0xdd9(%rip),%xmm3
mov    $0x4,%al
call   1030 <printf@plt>
movsd  -0x60(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
lea    0xe7c(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
lea    0xe80(%rip),%rdi
movsd  0xd7e(%rip),%xmm0
movsd  0xd7e(%rip),%xmm1
xorps  %xmm2,%xmm2
mov    $0x3,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x78,%rsp
mov    0xf25(%rip),%rax
mov    %rax,0x70(%rsp)
movaps 0xf09(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
mov    0xf2d(%rip),%rax
mov    %rax,0x50(%rsp)
movaps 0xf11(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
mov    0xf35(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xf19(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xf3e(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xf22(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x20(%rsp),%rdi
mov    %rsp,%rsi
lea    0x60(%rsp),%rdx
lea    0x40(%rsp),%rcx
movsd  0xe63(%rip),%xmm0
movsd  0xe63(%rip),%xmm1
call   1040 <estimate_ncf@plt>
movsd  0x20(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x30(%rsp),%xmm2
movsd  0x38(%rsp),%xmm3
lea    0xef7(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
lea    0xefd(%rip),%rdi
movsd  0xe31(%rip),%xmm0
movsd  0xe31(%rip),%xmm1
movsd  0xe31(%rip),%xmm2
movsd  0xe31(%rip),%xmm3
mov    $0x4,%al
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
lea    0xed2(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
movsd  0xe04(%rip),%xmm0
movsd  0xe04(%rip),%xmm1
xorps  %xmm2,%xmm2
mov    $0x3,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x78,%rsp
ret

LLVM IR (-O0):
@__const.main.omega = [3 x double] [double 6.190000e-05, double -7.800000e-06, double 6.374000e-04]
@__const.main.acc = [3 x double] [double -2.303000e-01, double 3.004000e-01, double 0x4022E9EECBFB15B5]
@__const.main.b_est = [3 x double] [double -1.010000e-02, double -7.900000e-03, double 0.000000e+00]
@__const.main.q_est = [4 x double] [double 9.996000e-01, double 1.670000e-02, double 1.340000e-02, double 1.970000e-02]
@.str = [20 x i8] c"q_est:\09%f\09%f\09%f\09%f\0A\00"
@.str.1 = [20 x i8] c"q_ref:\09%f\09%f\09%f\09%f\0A\00"
@.str.2 = [18 x i8] c"\0Ab_est:\09%f\09%f\09%f\0A\00"
@.str.3 = [17 x i8] c"b_ref:\09%f\09%f\09%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x double]
%3 = alloca [3 x double]
%4 = alloca [3 x double]
%5 = alloca [4 x double]
%6 = alloca double
%7 = alloca double
store i32 0, i32* %1
%8 = bitcast [3 x double]* %2 to i8*
%9 = bitcast [3 x double]* %3 to i8*
%10 = bitcast [3 x double]* %4 to i8*
%11 = bitcast [4 x double]* %5 to i8*
store double 5.000000e-02, double* %6
store double 1.000000e-01, double* %7
%12 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 0
%13 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%14 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%15 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%16 = load double, double* %7
%17 = load double, double* %6
%18 = call i32 @estimate_ncf(double* %12, double* %13, double* %14, double* %15, double %16, double %17)
%19 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 0
%20 = load double, double* %19
%21 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 1
%22 = load double, double* %21
%23 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 2
%24 = load double, double* %23
%25 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 3
%26 = load double, double* %25
%27 = call i32 (i8*, double, double, double, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double %20, double %22, double %24, double %26)
%28 = call i32 (i8*, double, double, double, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double 9.996000e-01, double 1.650000e-02, double 1.320000e-02, double 1.970000e-02)
%29 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%30 = load double, double* %29
%31 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 1
%32 = load double, double* %31
%33 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 2
%34 = load double, double* %33
%35 = call i32 (i8*, double, double, double, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %30, double %32, double %34)
%36 = call i32 (i8*, double, double, double, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), double -7.800000e-03, double 0xBF7A9FBE76C8B439, double 0.000000e+00)
ret i32 0
}

LLVM IR (-O2):
@__const.main.omega = [3 x double] [double 6.190000e-05, double -7.800000e-06, double 6.374000e-04]
@__const.main.acc = [3 x double] [double -2.303000e-01, double 3.004000e-01, double 0x4022E9EECBFB15B5]
@__const.main.b_est = [3 x double] [double -1.010000e-02, double -7.900000e-03, double 0.000000e+00]
@__const.main.q_est = [4 x double] [double 9.996000e-01, double 1.670000e-02, double 1.340000e-02, double 1.970000e-02]
@.str = [20 x i8] c"q_est:\09%f\09%f\09%f\09%f\0A\00"
@.str.1 = [20 x i8] c"q_ref:\09%f\09%f\09%f\09%f\0A\00"
@.str.2 = [18 x i8] c"\0Ab_est:\09%f\09%f\09%f\0A\00"
@.str.3 = [17 x i8] c"b_ref:\09%f\09%f\09%f\0A\00"
define i32 @main() {
%1 = alloca [3 x double]
%2 = alloca [3 x double]
%3 = alloca [3 x double]
%4 = alloca [4 x double]
%5 = bitcast [3 x double]* %1 to i8*
%6 = bitcast [3 x double]* %2 to i8*
%7 = bitcast [3 x double]* %3 to i8*
%8 = bitcast [4 x double]* %4 to i8*
%9 = getelementptr inbounds [4 x double], [4 x double]* %4, i64 0, i64 0
%10 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%11 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
%12 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%13 = call i32 @estimate_ncf(double* %9, double* %10, double* %11, double* %12, double 1.000000e-01, double 5.000000e-02)
%14 = load double, double* %9
%15 = getelementptr inbounds [4 x double], [4 x double]* %4, i64 0, i64 1
%16 = load double, double* %15
%17 = getelementptr inbounds [4 x double], [4 x double]* %4, i64 0, i64 2
%18 = load double, double* %17
%19 = getelementptr inbounds [4 x double], [4 x double]* %4, i64 0, i64 3
%20 = load double, double* %19
%21 = call i32 (i8*, double, double, double, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double %14, double %16, double %18, double %20)
%22 = call i32 (i8*, double, double, double, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double 9.996000e-01, double 1.650000e-02, double 1.320000e-02, double 1.970000e-02)
%23 = load double, double* %10
%24 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 1
%25 = load double, double* %24
%26 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 2
%27 = load double, double* %26
%28 = call i32 (i8*, double, double, double, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %23, double %25, double %27)
%29 = call i32 (i8*, double, double, double, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), double -7.800000e-03, double 0xBF7A9FBE76C8B439, double 0.000000e+00)
ret i32 0
}