#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*/ MatrixAdd(float **, float **, float **);
int /*<<< orphan*/ MatrixMultiply(float **, float **, float **);
int /*<<< orphan*/ MatrixSubtract(float **, float **, float **);
void Kalman_calcx(float **x, float **xp, float **K, float **z, float **H) {
  float x_part1[4][4];
  float x_part2[4][4];
  float x_part3[4][4];
  MatrixMultiply(x_part1, H, xp);
  MatrixSubtract(x_part2, z, x_part1);
  MatrixMultiply(x_part3, K, x_part2);
  MatrixAdd(x, xp, x_part3);
}


x86 assembly (clang, -O0):
<Kalman_calcx>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <MatrixMultiply@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x70(%rbp),%rdx
call   1030 <MatrixSubtract@plt>
lea    -0xf0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
call   1040 <MatrixMultiply@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0xf0(%rbp),%rdx
call   1050 <MatrixAdd@plt>
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Kalman_calcx>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,0x8(%rsp)
lea    0x90(%rsp),%r13
mov    %r13,%rdi
mov    %r8,%rsi
mov    %rbx,%rdx
call   1040 <MatrixMultiply@plt>
lea    0x50(%rsp),%r12
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   1030 <MatrixSubtract@plt>
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1040 <MatrixMultiply@plt>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1050 <MatrixAdd@plt>
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @Kalman_calcx(float** %0, float** %1, float** %2, float** %3, float** %4) {
%6 = alloca float**
%7 = alloca float**
%8 = alloca float**
%9 = alloca float**
%10 = alloca float**
%11 = alloca [4 x [4 x float]]
%12 = alloca [4 x [4 x float]]
%13 = alloca [4 x [4 x float]]
store float** %0, float*** %6
store float** %1, float*** %7
store float** %2, float*** %8
store float** %3, float*** %9
store float** %4, float*** %10
%14 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %11, i64 0, i64 0
%15 = bitcast [4 x float]* %14 to float**
%16 = load float**, float*** %10
%17 = load float**, float*** %7
%18 = call i32 @MatrixMultiply(float** %15, float** %16, float** %17)
%19 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %12, i64 0, i64 0
%20 = bitcast [4 x float]* %19 to float**
%21 = load float**, float*** %9
%22 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %11, i64 0, i64 0
%23 = bitcast [4 x float]* %22 to float**
%24 = call i32 @MatrixSubtract(float** %20, float** %21, float** %23)
%25 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %13, i64 0, i64 0
%26 = bitcast [4 x float]* %25 to float**
%27 = load float**, float*** %8
%28 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %12, i64 0, i64 0
%29 = bitcast [4 x float]* %28 to float**
%30 = call i32 @MatrixMultiply(float** %26, float** %27, float** %29)
%31 = load float**, float*** %6
%32 = load float**, float*** %7
%33 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %13, i64 0, i64 0
%34 = bitcast [4 x float]* %33 to float**
%35 = call i32 @MatrixAdd(float** %31, float** %32, float** %34)
ret void
}

LLVM IR (-O2):
define void @Kalman_calcx(float** %0, float** %1, float** %2, float** %3, float** %4) {
%6 = alloca [4 x [4 x float]]
%7 = alloca [4 x [4 x float]]
%8 = alloca [4 x [4 x float]]
%9 = bitcast [4 x [4 x float]]* %6 to i8*
%10 = bitcast [4 x [4 x float]]* %7 to i8*
%11 = bitcast [4 x [4 x float]]* %8 to i8*
%12 = bitcast [4 x [4 x float]]* %6 to float**
%13 = call i32 @MatrixMultiply(float** %12, float** %4, float** %1)
%14 = bitcast [4 x [4 x float]]* %7 to float**
%15 = call i32 @MatrixSubtract(float** %14, float** %3, float** %12)
%16 = bitcast [4 x [4 x float]]* %8 to float**
%17 = call i32 @MatrixMultiply(float** %16, float** %2, float** %14)
%18 = call i32 @MatrixAdd(float** %0, float** %1, float** %16)
ret void
}