#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 */
double RAND_MAX;
int /*<<< orphan*/ m_free(double *);
double *m_new(int, int);
int /*<<< orphan*/ m_print(double *, int, int, char *);
int /*<<< orphan*/ process(double *, double *, double *, double *, int, int,
                           int, double *, double *, double *, double *,
                           double *, double *, int, double *, double *,
                           double *);
scalar_t__ rand();
int test(void) {
  int i, len;
  len = 16;
  int n = 1, p = 1, q = 1;
  double A = 1., B = 0., C = 1., D = 0., *x_est, *y_est, *P_est, *u = NULL, *y,
         x0 = 1., P0 = 1., Q = 1., R = 1.;
  x_est = m_new(n, len);
  y_est = m_new(n, len);
  P_est = m_new(n, n * len);
  u = m_new(1, len);
  for (i = 0; i < len; i++)
    *(u + i) = 0.0;
  y = m_new(1, len);
  for (i = 0; i < len; i++) {
    *(y + i) = (double)rand() / RAND_MAX;
  }
  process(&A, &B, &C, &D, n, p, q, y, u, &x0, &P0, &Q, &R, len, x_est, y_est,
          P_est);
  m_print(y, n, len, "y");
  m_print(y_est, n, len, "y_est");
  m_print(x_est, n, len, "x_est");
  m_print(P_est, n, len, "P_est");
  m_free(u);
  m_free(y);
  m_free(x_est);
  m_free(y_est);
  m_free(P_est);
  return 0;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf8,%rsp
movl   $0x10,-0x30(%rbp)
movl   $0x1,-0x34(%rbp)
movl   $0x1,-0x38(%rbp)
movl   $0x1,-0x3c(%rbp)
movsd  0xe78(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe63(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
movq   $0x0,-0x80(%rbp)
movsd  0xe46(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xe36(%rip),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0xe26(%rip),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  0xe16(%rip),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%esi
call   1060 <m_new@plt>
mov    %rax,-0x68(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%esi
call   1060 <m_new@plt>
mov    %rax,-0x70(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x34(%rbp),%esi
imul   -0x30(%rbp),%esi
call   1060 <m_new@plt>
mov    %rax,-0x78(%rbp)
mov    -0x30(%rbp),%esi
mov    $0x1,%edi
call   1060 <m_new@plt>
mov    %rax,-0x80(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    1265 <test+0x115>
mov    -0x80(%rbp),%rax
movslq -0x2c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    123b <test+0xeb>
mov    -0x30(%rbp),%esi
mov    $0x1,%edi
call   1060 <m_new@plt>
mov    %rax,-0x88(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    12c1 <test+0x171>
mov    $0x0,%al
call   1070 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2d49(%rip),%rax
divsd  (%rax),%xmm0
mov    -0x88(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1280 <test+0x130>
mov    -0x34(%rbp),%r8d
mov    -0x38(%rbp),%r9d
mov    -0x3c(%rbp),%eax
mov    -0x88(%rbp),%rcx
mov    %rcx,-0xc0(%rbp)
mov    -0x80(%rbp),%rcx
mov    %rcx,-0xb8(%rbp)
mov    -0x30(%rbp),%ebx
mov    -0x68(%rbp),%r11
mov    -0x70(%rbp),%r10
mov    -0x78(%rbp),%rcx
mov    %rcx,-0xb0(%rbp)
lea    -0x48(%rbp),%rdi
lea    -0x50(%rbp),%rsi
lea    -0x58(%rbp),%rdx
lea    -0x60(%rbp),%rcx
lea    -0x90(%rbp),%r13
lea    -0x98(%rbp),%r12
lea    -0xa0(%rbp),%r15
lea    -0xa8(%rbp),%r14
mov    %eax,(%rsp)
mov    -0xc0(%rbp),%rax
mov    %rax,0x8(%rsp)
mov    -0xb8(%rbp),%rax
mov    %rax,0x10(%rsp)
mov    -0xb0(%rbp),%rax
mov    %r13,0x18(%rsp)
mov    %r12,0x20(%rsp)
mov    %r15,0x28(%rsp)
mov    %r14,0x30(%rsp)
mov    %ebx,0x38(%rsp)
mov    %r11,0x40(%rsp)
mov    %r10,0x48(%rsp)
mov    %rax,0x50(%rsp)
call   1040 <process@plt>
mov    -0x88(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x30(%rbp),%edx
lea    0xc7f(%rip),%rcx
call   1030 <m_print@plt>
mov    -0x70(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x30(%rbp),%edx
lea    0xc6b(%rip),%rcx
call   1030 <m_print@plt>
mov    -0x68(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x30(%rbp),%edx
lea    0xc5b(%rip),%rcx
call   1030 <m_print@plt>
mov    -0x78(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x30(%rbp),%edx
lea    0xc4b(%rip),%rcx
call   1030 <m_print@plt>
mov    -0x80(%rbp),%rdi
call   1050 <m_free@plt>
mov    -0x88(%rbp),%rdi
call   1050 <m_free@plt>
mov    -0x68(%rbp),%rdi
call   1050 <m_free@plt>
mov    -0x70(%rbp),%rdi
call   1050 <m_free@plt>
mov    -0x78(%rbp),%rdi
call   1050 <m_free@plt>
xor    %eax,%eax
add    $0xf8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movabs $0x3ff0000000000000,%rax
mov    %rax,0x40(%rsp)
movq   $0x0,0x38(%rsp)
mov    %rax,0x30(%rsp)
movq   $0x0,0x28(%rsp)
mov    %rax,0x20(%rsp)
mov    %rax,0x18(%rsp)
mov    %rax,0x10(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x1,%edi
mov    $0x10,%esi
call   1060 <m_new@plt>
mov    %rax,(%rsp)
mov    $0x1,%edi
mov    $0x10,%esi
call   1060 <m_new@plt>
mov    %rax,%r15
mov    $0x1,%edi
mov    $0x10,%esi
call   1060 <m_new@plt>
mov    %rax,%r12
mov    $0x1,%edi
mov    $0x10,%esi
call   1060 <m_new@plt>
mov    %rax,%r13
xorpd  %xmm0,%xmm0
movupd %xmm0,(%rax)
movupd %xmm0,0x10(%rax)
movupd %xmm0,0x20(%rax)
movupd %xmm0,0x30(%rax)
movupd %xmm0,0x40(%rax)
movupd %xmm0,0x50(%rax)
movupd %xmm0,0x60(%rax)
movupd %xmm0,0x70(%rax)
mov    $0x1,%edi
mov    $0x10,%esi
call   1060 <m_new@plt>
mov    %rax,%rbx
mov    0x2dc3(%rip),%rbp
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0x0(%rbp),%xmm0
movsd  %xmm0,(%rbx,%r14,8)
add    $0x1,%r14
cmp    $0x10,%r14
jne    1230 <test+0xe0>
sub    $0x8,%rsp
lea    0x10(%rsp),%rax
lea    0x18(%rsp),%r14
lea    0x20(%rsp),%r10
lea    0x28(%rsp),%r11
lea    0x48(%rsp),%rdi
lea    0x40(%rsp),%rsi
lea    0x38(%rsp),%rdx
lea    0x30(%rsp),%rcx
mov    $0x1,%r8d
mov    $0x1,%r9d
push   %r12
push   %r15
mov    0x18(%rsp),%rbp
push   %rbp
push   $0x10
push   %rax
push   %r14
push   %r10
push   %r11
push   %r13
push   %rbx
push   $0x1
call   1040 <process@plt>
add    $0x60,%rsp
lea    0xd4c(%rip),%rcx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x10,%edx
call   1030 <m_print@plt>
lea    0xd35(%rip),%rcx
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0x10,%edx
call   1030 <m_print@plt>
lea    0xd22(%rip),%rcx
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x10,%edx
call   1030 <m_print@plt>
lea    0xd0f(%rip),%rcx
mov    %r12,%rdi
mov    $0x1,%esi
mov    $0x10,%edx
call   1030 <m_print@plt>
mov    %r13,%rdi
call   1050 <m_free@plt>
mov    %rbx,%rdi
call   1050 <m_free@plt>
mov    %rbp,%rdi
call   1050 <m_free@plt>
mov    %r15,%rdi
call   1050 <m_free@plt>
mov    %r12,%rdi
call   1050 <m_free@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
@.str = [2 x i8] c"y\00"
@.str.1 = [6 x i8] c"y_est\00"
@.str.2 = [6 x i8] c"x_est\00"
@.str.3 = [6 x i8] c"P_est\00"
define i32 @test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
store i32 16, i32* %2
store i32 1, i32* %3
store i32 1, i32* %4
store i32 1, i32* %5
store double 1.000000e+00, double* %6
store double 0.000000e+00, double* %7
store double 1.000000e+00, double* %8
store double 0.000000e+00, double* %9
store double* null, double** %13
store double 1.000000e+00, double* %15
store double 1.000000e+00, double* %16
store double 1.000000e+00, double* %17
store double 1.000000e+00, double* %18
%19 = load i32, i32* %3
%20 = load i32, i32* %2
%21 = call double* @m_new(i32 %19, i32 %20)
store double* %21, double** %10
%22 = load i32, i32* %3
%23 = load i32, i32* %2
%24 = call double* @m_new(i32 %22, i32 %23)
store double* %24, double** %11
%25 = load i32, i32* %3
%26 = load i32, i32* %3
%27 = load i32, i32* %2
%28 = mul nsw i32 %26, %27
%29 = call double* @m_new(i32 %25, i32 %28)
store double* %29, double** %12
%30 = load i32, i32* %2
%31 = call double* @m_new(i32 1, i32 %30)
store double* %31, double** %13
store i32 0, i32* %1
br label %32
32: ; preds = %41, %0
%33 = load i32, i32* %1
%34 = load i32, i32* %2
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %44
36: ; preds = %32
%37 = load double*, double** %13
%38 = load i32, i32* %1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
store double 0.000000e+00, double* %40
br label %41
41: ; preds = %36
%42 = load i32, i32* %1
%43 = add nsw i32 %42, 1
store i32 %43, i32* %1
br label %32
44: ; preds = %32
%45 = load i32, i32* %2
%46 = call double* @m_new(i32 1, i32 %45)
store double* %46, double** %14
store i32 0, i32* %1
br label %47
47: ; preds = %60, %44
%48 = load i32, i32* %1
%49 = load i32, i32* %2
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %63
51: ; preds = %47
%52 = call i64 (...) @rand()
%53 = sitofp i64 %52 to double
%54 = load double, double* @RAND_MAX
%55 = fdiv double %53, %54
%56 = load double*, double** %14
%57 = load i32, i32* %1
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %56, i64 %58
store double %55, double* %59
br label %60
60: ; preds = %51
%61 = load i32, i32* %1
%62 = add nsw i32 %61, 1
store i32 %62, i32* %1
br label %47
63: ; preds = %47
%64 = load i32, i32* %3
%65 = load i32, i32* %4
%66 = load i32, i32* %5
%67 = load double*, double** %14
%68 = load double*, double** %13
%69 = load i32, i32* %2
%70 = load double*, double** %10
%71 = load double*, double** %11
%72 = load double*, double** %12
%73 = call i32 @process(double* %6, double* %7, double* %8, double* %9, i32 %64, i32 %65, i32 %66, double* %67, double* %68, double* %15, double* %16, double* %17, double* %18, i32 %69, double* %70, double* %71, double* %72)
%74 = load double*, double** %14
%75 = load i32, i32* %3
%76 = load i32, i32* %2
%77 = call i32 @m_print(double* %74, i32 %75, i32 %76, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%78 = load double*, double** %11
%79 = load i32, i32* %3
%80 = load i32, i32* %2
%81 = call i32 @m_print(double* %78, i32 %79, i32 %80, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%82 = load double*, double** %10
%83 = load i32, i32* %3
%84 = load i32, i32* %2
%85 = call i32 @m_print(double* %82, i32 %83, i32 %84, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%86 = load double*, double** %12
%87 = load i32, i32* %3
%88 = load i32, i32* %2
%89 = call i32 @m_print(double* %86, i32 %87, i32 %88, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%90 = load double*, double** %13
%91 = call i32 @m_free(double* %90)
%92 = load double*, double** %14
%93 = call i32 @m_free(double* %92)
%94 = load double*, double** %10
%95 = call i32 @m_free(double* %94)
%96 = load double*, double** %11
%97 = call i32 @m_free(double* %96)
%98 = load double*, double** %12
%99 = call i32 @m_free(double* %98)
ret i32 0
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
@.str = [2 x i8] c"y\00"
@.str.1 = [6 x i8] c"y_est\00"
@.str.2 = [6 x i8] c"x_est\00"
@.str.3 = [6 x i8] c"P_est\00"
define i32 @test() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = bitcast double* %1 to i8*
store double 1.000000e+00, double* %1
%10 = bitcast double* %2 to i8*
store double 0.000000e+00, double* %2
%11 = bitcast double* %3 to i8*
store double 1.000000e+00, double* %3
%12 = bitcast double* %4 to i8*
store double 0.000000e+00, double* %4
%13 = bitcast double* %5 to i8*
store double 1.000000e+00, double* %5
%14 = bitcast double* %6 to i8*
store double 1.000000e+00, double* %6
%15 = bitcast double* %7 to i8*
store double 1.000000e+00, double* %7
%16 = bitcast double* %8 to i8*
store double 1.000000e+00, double* %8
%17 = tail call double* @m_new(i32 1, i32 16)
%18 = tail call double* @m_new(i32 1, i32 16)
%19 = tail call double* @m_new(i32 1, i32 16)
%20 = tail call double* @m_new(i32 1, i32 16)
%21 = bitcast double* %20 to i8*
%22 = tail call double* @m_new(i32 1, i32 16)
br label %23
23: ; preds = %0, %23
%24 = phi i64 [ 0, %0 ], [ %30, %23 ]
%25 = tail call i64 (...) @rand()
%26 = sitofp i64 %25 to double
%27 = load double, double* @RAND_MAX
%28 = fdiv double %26, %27
%29 = getelementptr inbounds double, double* %22, i64 %24
store double %28, double* %29
%30 = add nuw nsw i64 %24, 1
%31 = icmp eq i64 %30, 16
br i1 %31, label %32, label %23
32: ; preds = %23
%33 = call i32 @process(double* %1, double* %2, double* %3, double* %4, i32 1, i32 1, i32 1, double* %22, double* %20, double* %5, double* %6, double* %7, double* %8, i32 16, double* %17, double* %18, double* %19)
%34 = call i32 @m_print(double* %22, i32 1, i32 16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%35 = call i32 @m_print(double* %18, i32 1, i32 16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%36 = call i32 @m_print(double* %17, i32 1, i32 16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%37 = call i32 @m_print(double* %19, i32 1, i32 16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%38 = call i32 @m_free(double* %20)
%39 = call i32 @m_free(double* %22)
%40 = call i32 @m_free(double* %17)
%41 = call i32 @m_free(double* %18)
%42 = call i32 @m_free(double* %19)
ret i32 0
}