#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*/ m_copy(double *, double *, int, int);
double *m_new(int, int);
int /*<<< orphan*/ tick(double *, double *, double *, double *, int, int, int,
                        double *, double *, double *, double *, double *,
                        double *, double *, double *, double *);
void process(double *A, double *B, double *C, double *D, int n, int p, int q,
             double *yv, double *u, double *x0, double *P0, double *Q,
             double *R, int length, double *x_est, double *y_est,
             double *P_est) {
  int i;
  double *P, *x;
  x = m_new(n, 1);
  P = m_new(n, n);
  m_copy(x, x0, n, 1);
  m_copy(P, P0, n, n);
  for (i = 0; i < length; i++) {
    tick(A, B, C, D, n, p, q, yv + i * q, u + i * p, x, P, Q, R, x_est + i * n,
         y_est + i * q, P_est + i * n * n);
    m_copy(x, x_est + i * n, n, 1);
    m_copy(P, P_est + i * n * n, n, n);
  }
}


x86 assembly (clang, -O0):
<process>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    0x60(%rbp),%rax
mov    0x58(%rbp),%rax
mov    0x50(%rbp),%rax
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%rax
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x48(%rbp)
mov    %r8d,-0x4c(%rbp)
mov    %r9d,-0x50(%rbp)
mov    -0x4c(%rbp),%edi
mov    $0x1,%esi
call   1050 <m_new@plt>
mov    %rax,-0x68(%rbp)
mov    -0x4c(%rbp),%edi
mov    -0x4c(%rbp),%esi
call   1050 <m_new@plt>
mov    %rax,-0x60(%rbp)
mov    -0x68(%rbp),%rdi
mov    0x28(%rbp),%rsi
mov    -0x4c(%rbp),%edx
mov    $0x1,%ecx
call   1040 <m_copy@plt>
mov    -0x60(%rbp),%rdi
mov    0x30(%rbp),%rsi
mov    -0x4c(%rbp),%edx
mov    -0x4c(%rbp),%ecx
call   1040 <m_copy@plt>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    0x48(%rbp),%eax
jge    1329 <process+0x1f9>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x48(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x4c(%rbp),%r8d
mov    -0x50(%rbp),%r9d
mov    0x10(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    0x18(%rbp),%rax
mov    -0x54(%rbp),%ecx
imul   0x10(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x78(%rbp)
mov    0x20(%rbp),%r13
mov    -0x54(%rbp),%eax
imul   -0x50(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%r13
mov    -0x68(%rbp),%r12
mov    -0x60(%rbp),%r15
mov    0x38(%rbp),%r14
mov    0x40(%rbp),%rbx
mov    0x50(%rbp),%r11
mov    -0x54(%rbp),%eax
imul   -0x4c(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%r11
mov    0x58(%rbp),%r10
mov    -0x54(%rbp),%eax
imul   0x10(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%r10
mov    0x60(%rbp),%rax
mov    -0x54(%rbp),%ecx
imul   -0x4c(%rbp),%ecx
imul   -0x4c(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    -0x88(%rbp),%rcx
mov    %rax,-0x70(%rbp)
mov    -0x7c(%rbp),%eax
mov    %eax,(%rsp)
mov    -0x78(%rbp),%rax
mov    %rax,0x8(%rsp)
mov    -0x70(%rbp),%rax
mov    %r13,0x10(%rsp)
mov    %r12,0x18(%rsp)
mov    %r15,0x20(%rsp)
mov    %r14,0x28(%rsp)
mov    %rbx,0x30(%rsp)
mov    %r11,0x38(%rsp)
mov    %r10,0x40(%rsp)
mov    %rax,0x48(%rsp)
call   1030 <tick@plt>
mov    -0x68(%rbp),%rdi
mov    0x50(%rbp),%rsi
mov    -0x54(%rbp),%eax
imul   -0x4c(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x4c(%rbp),%edx
mov    $0x1,%ecx
call   1040 <m_copy@plt>
mov    -0x60(%rbp),%rdi
mov    0x60(%rbp),%rsi
mov    -0x54(%rbp),%eax
imul   -0x4c(%rbp),%eax
imul   -0x4c(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x4c(%rbp),%edx
mov    -0x4c(%rbp),%ecx
call   1040 <m_copy@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11d5 <process+0xa5>
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<process>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %r9d,0x4(%rsp)
mov    %r8d,%ebx
mov    %rcx,0x50(%rsp)
mov    %rdx,0x48(%rsp)
mov    %rsi,0x40(%rsp)
mov    %rdi,0x38(%rsp)
mov    0xd8(%rsp),%r15d
mov    0xc0(%rsp),%r12
mov    0xb8(%rsp),%r13
mov    %r8d,%edi
mov    $0x1,%esi
call   1050 <m_new@plt>
mov    %rax,%rbp
mov    %ebx,%edi
mov    %ebx,%esi
call   1050 <m_new@plt>
mov    %rax,%r14
mov    %rbp,0x30(%rsp)
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %ebx,%edx
mov    $0x1,%ecx
call   1040 <m_copy@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
mov    %ebx,(%rsp)
mov    %ebx,%ecx
mov    %r14,%rbx
call   1040 <m_copy@plt>
test   %r15d,%r15d
jle    12e9 <process+0x1b9>
mov    %r15d,%edi
mov    0xf0(%rsp),%r12
mov    0xe8(%rsp),%rax
mov    0xe0(%rsp),%r13
mov    0xb0(%rsp),%r14
mov    0xa8(%rsp),%r15
mov    0xa0(%rsp),%ecx
movslq %ecx,%rcx
movslq 0x4(%rsp),%rdx
movslq (%rsp),%rsi
mov    %edi,%edi
mov    %rsi,%rbp
imul   %rsi,%rbp
shl    $0x3,%rbp
mov    %rbp,0x8(%rsp)
shl    $0x3,%rsi
mov    %rsi,0x10(%rsp)
shl    $0x3,%rdx
mov    %rdx,0x18(%rsp)
shl    $0x3,%rcx
mov    %rcx,0x20(%rsp)
mov    %rbx,0x28(%rsp)
mov    (%rsp),%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %rdi,0x58(%rsp)
mov    %rax,0x60(%rsp)
mov    0x38(%rsp),%rdi
mov    0x40(%rsp),%rsi
mov    0x48(%rsp),%rdx
mov    0x50(%rsp),%rcx
mov    %ebp,%r8d
mov    0x4(%rsp),%r9d
push   %r12
push   %rax
push   %r13
push   0xe8(%rsp)
push   0xe8(%rsp)
push   %rbx
mov    0x60(%rsp),%rbx
push   %rbx
push   %r14
push   %r15
mov    0xe8(%rsp),%eax
push   %rax
call   1030 <tick@plt>
add    $0x50,%rsp
mov    %rbx,%rdi
mov    0x28(%rsp),%rbx
mov    %r13,%rsi
mov    %ebp,%edx
mov    $0x1,%ecx
call   1040 <m_copy@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
mov    %ebp,%ecx
call   1040 <m_copy@plt>
mov    0x58(%rsp),%rdi
mov    0x60(%rsp),%rax
add    0x8(%rsp),%r12
add    0x10(%rsp),%r13
add    0x18(%rsp),%r14
mov    0x20(%rsp),%rcx
add    %rcx,%r15
add    %rcx,%rax
add    $0xffffffffffffffff,%rdi
jne    1240 <process+0x110>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @process(double* %0, double* %1, double* %2, double* %3, i32 %4, i32 %5, i32 %6, double* %7, double* %8, double* %9, double* %10, double* %11, double* %12, i32 %13, double* %14, double* %15, double* %16) {
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca double*
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca double*
%26 = alloca double*
%27 = alloca double*
%28 = alloca double*
%29 = alloca double*
%30 = alloca double*
%31 = alloca i32
%32 = alloca double*
%33 = alloca double*
%34 = alloca double*
%35 = alloca i32
%36 = alloca double*
%37 = alloca double*
store double* %0, double** %18
store double* %1, double** %19
store double* %2, double** %20
store double* %3, double** %21
store i32 %4, i32* %22
store i32 %5, i32* %23
store i32 %6, i32* %24
store double* %7, double** %25
store double* %8, double** %26
store double* %9, double** %27
store double* %10, double** %28
store double* %11, double** %29
store double* %12, double** %30
store i32 %13, i32* %31
store double* %14, double** %32
store double* %15, double** %33
store double* %16, double** %34
%38 = load i32, i32* %22
%39 = call double* @m_new(i32 %38, i32 1)
store double* %39, double** %37
%40 = load i32, i32* %22
%41 = load i32, i32* %22
%42 = call double* @m_new(i32 %40, i32 %41)
store double* %42, double** %36
%43 = load double*, double** %37
%44 = load double*, double** %27
%45 = load i32, i32* %22
%46 = call i32 @m_copy(double* %43, double* %44, i32 %45, i32 1)
%47 = load double*, double** %36
%48 = load double*, double** %28
%49 = load i32, i32* %22
%50 = load i32, i32* %22
%51 = call i32 @m_copy(double* %47, double* %48, i32 %49, i32 %50)
store i32 0, i32* %35
br label %52
52: ; preds = %122, %17
%53 = load i32, i32* %35
%54 = load i32, i32* %31
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %125
56: ; preds = %52
%57 = load double*, double** %18
%58 = load double*, double** %19
%59 = load double*, double** %20
%60 = load double*, double** %21
%61 = load i32, i32* %22
%62 = load i32, i32* %23
%63 = load i32, i32* %24
%64 = load double*, double** %25
%65 = load i32, i32* %35
%66 = load i32, i32* %24
%67 = mul nsw i32 %65, %66
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double, double* %64, i64 %68
%70 = load double*, double** %26
%71 = load i32, i32* %35
%72 = load i32, i32* %23
%73 = mul nsw i32 %71, %72
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds double, double* %70, i64 %74
%76 = load double*, double** %37
%77 = load double*, double** %36
%78 = load double*, double** %29
%79 = load double*, double** %30
%80 = load double*, double** %32
%81 = load i32, i32* %35
%82 = load i32, i32* %22
%83 = mul nsw i32 %81, %82
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds double, double* %80, i64 %84
%86 = load double*, double** %33
%87 = load i32, i32* %35
%88 = load i32, i32* %24
%89 = mul nsw i32 %87, %88
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds double, double* %86, i64 %90
%92 = load double*, double** %34
%93 = load i32, i32* %35
%94 = load i32, i32* %22
%95 = mul nsw i32 %93, %94
%96 = load i32, i32* %22
%97 = mul nsw i32 %95, %96
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds double, double* %92, i64 %98
%100 = call i32 @tick(double* %57, double* %58, double* %59, double* %60, i32 %61, i32 %62, i32 %63, double* %69, double* %75, double* %76, double* %77, double* %78, double* %79, double* %85, double* %91, double* %99)
%101 = load double*, double** %37
%102 = load double*, double** %32
%103 = load i32, i32* %35
%104 = load i32, i32* %22
%105 = mul nsw i32 %103, %104
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %102, i64 %106
%108 = load i32, i32* %22
%109 = call i32 @m_copy(double* %101, double* %107, i32 %108, i32 1)
%110 = load double*, double** %36
%111 = load double*, double** %34
%112 = load i32, i32* %35
%113 = load i32, i32* %22
%114 = mul nsw i32 %112, %113
%115 = load i32, i32* %22
%116 = mul nsw i32 %114, %115
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds double, double* %111, i64 %117
%119 = load i32, i32* %22
%120 = load i32, i32* %22
%121 = call i32 @m_copy(double* %110, double* %118, i32 %119, i32 %120)
br label %122
122: ; preds = %56
%123 = load i32, i32* %35
%124 = add nsw i32 %123, 1
store i32 %124, i32* %35
br label %52
125: ; preds = %52
ret void
}

LLVM IR (-O2):
define void @process(double* %0, double* %1, double* %2, double* %3, i32 %4, i32 %5, i32 %6, double* %7, double* %8, double* %9, double* %10, double* %11, double* %12, i32 %13, double* %14, double* %15, double* %16) {
%18 = tail call double* @m_new(i32 %4, i32 1)
%19 = tail call double* @m_new(i32 %4, i32 %4)
%20 = tail call i32 @m_copy(double* %18, double* %9, i32 %4, i32 1)
%21 = tail call i32 @m_copy(double* %19, double* %10, i32 %4, i32 %4)
%22 = icmp sgt i32 %13, 0
br i1 %22, label %23, label %44
23: ; preds = %17
%24 = sext i32 %6 to i64
%25 = sext i32 %5 to i64
%26 = sext i32 %4 to i64
%27 = zext i32 %13 to i64
br label %28
28: ; preds = %23, %28
%29 = phi i64 [ 0, %23 ], [ %42, %28 ]
%30 = mul nsw i64 %29, %24
%31 = getelementptr inbounds double, double* %7, i64 %30
%32 = mul nsw i64 %29, %25
%33 = getelementptr inbounds double, double* %8, i64 %32
%34 = mul nsw i64 %29, %26
%35 = getelementptr inbounds double, double* %14, i64 %34
%36 = getelementptr inbounds double, double* %15, i64 %30
%37 = mul nsw i64 %34, %26
%38 = getelementptr inbounds double, double* %16, i64 %37
%39 = tail call i32 @tick(double* %0, double* %1, double* %2, double* %3, i32 %4, i32 %5, i32 %6, double* %31, double* %33, double* %18, double* %19, double* %11, double* %12, double* %35, double* %36, double* %38)
%40 = tail call i32 @m_copy(double* %18, double* %35, i32 %4, i32 1)
%41 = tail call i32 @m_copy(double* %19, double* %38, i32 %4, i32 %4)
%42 = add nuw nsw i64 %29, 1
%43 = icmp eq i64 %42, %27
br i1 %43, label %44, label %28
44: ; preds = %28, %17
ret void
}