; LLVM IR from beagleboard/librobotcontrol :: library/src/math (kalman)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.rc_matrix_t = type { i32, i32, ptr, i32 }
%struct.rc_vector_t = type { i32, ptr, i32 }
%struct.rc_kalman_t = type { %struct.rc_matrix_t, %struct.rc_matrix_t, %struct.rc_matrix_t, %struct.rc_matrix_t, %struct.rc_matrix_t, %struct.rc_matrix_t, %struct.rc_matrix_t, %struct.rc_vector_t, %struct.rc_vector_t, i32, i64 }

@stderr = external global ptr, align 8
@.str.13 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [74 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [71 x i8], align 1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

declare i32 @rc_matrix_duplicate(ptr noundef byval(%struct.rc_matrix_t) align 8, ptr noundef) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

declare i32 @rc_matrix_free(ptr noundef) #3

declare i32 @rc_vector_free(ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @rc_kalman_update_lin(ptr noundef %0, ptr noundef byval(%struct.rc_vector_t) align 8 %1, ptr noundef byval(%struct.rc_vector_t) align 8 %2) #4 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca %struct.rc_matrix_t, align 8
  %7 = alloca %struct.rc_matrix_t, align 8
  %8 = alloca %struct.rc_matrix_t, align 8
  %9 = alloca %struct.rc_matrix_t, align 8
  %10 = alloca %struct.rc_vector_t, align 8
  %11 = alloca %struct.rc_vector_t, align 8
  %12 = alloca %struct.rc_vector_t, align 8
  %13 = alloca %struct.rc_vector_t, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #6
  call void @llvm.memset.p0.i64(ptr align 8 %6, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #6
  call void @llvm.memset.p0.i64(ptr align 8 %7, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #6
  call void @llvm.memset.p0.i64(ptr align 8 %8, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #6
  call void @llvm.memset.p0.i64(ptr align 8 %9, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #6
  call void @llvm.memset.p0.i64(ptr align 8 %10, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #6
  call void @llvm.memset.p0.i64(ptr align 8 %11, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #6
  call void @llvm.memset.p0.i64(ptr align 8 %12, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #6
  call void @llvm.memset.p0.i64(ptr align 8 %13, i8 0, i64 24, i1 false)
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = icmp eq ptr %15, null
  %17 = xor i1 %16, true
  %18 = xor i1 %17, true
  %19 = zext i1 %18 to i32
  %20 = sext i32 %19 to i64
  %21 = call i64 @llvm.expect.i64(i64 %20, i64 0)
  %22 = icmp ne i64 %21, 0
  br i1 %22, label %23, label %26

23:                                               ; preds = %3
  %24 = load ptr, ptr @stderr, align 8, !tbaa !5
  %25 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef @.str.13) #6
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %164

26:                                               ; preds = %3
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.rc_kalman_t, ptr %27, i32 0, i32 9
  %29 = load i32, ptr %28, align 8, !tbaa !9
  %30 = icmp ne i32 %29, 1
  %31 = xor i1 %30, true
  %32 = xor i1 %31, true
  %33 = zext i1 %32 to i32
  %34 = sext i32 %33 to i64
  %35 = call i64 @llvm.expect.i64(i64 %34, i64 0)
  %36 = icmp ne i64 %35, 0
  br i1 %36, label %37, label %40

37:                                               ; preds = %26
  %38 = load ptr, ptr @stderr, align 8, !tbaa !5
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef @.str.14) #6
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %164

40:                                               ; preds = %26
  %41 = getelementptr inbounds %struct.rc_vector_t, ptr %1, i32 0, i32 2
  %42 = load i32, ptr %41, align 8, !tbaa !15
  %43 = icmp ne i32 %42, 1
  br i1 %43, label %48, label %44

44:                                               ; preds = %40
  %45 = getelementptr inbounds %struct.rc_vector_t, ptr %2, i32 0, i32 2
  %46 = load i32, ptr %45, align 8, !tbaa !15
  %47 = icmp ne i32 %46, 1
  br label %48

48:                                               ; preds = %44, %40
  %49 = phi i1 [ true, %40 ], [ %47, %44 ]
  %50 = xor i1 %49, true
  %51 = xor i1 %50, true
  %52 = zext i1 %51 to i32
  %53 = sext i32 %52 to i64
  %54 = call i64 @llvm.expect.i64(i64 %53, i64 0)
  %55 = icmp ne i64 %54, 0
  br i1 %55, label %56, label %59

56:                                               ; preds = %48
  %57 = load ptr, ptr @stderr, align 8, !tbaa !5
  %58 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef @.str.15) #6
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %164

59:                                               ; preds = %48
  %60 = getelementptr inbounds %struct.rc_vector_t, ptr %1, i32 0, i32 0
  %61 = load i32, ptr %60, align 8, !tbaa !16
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.rc_kalman_t, ptr %62, i32 0, i32 1
  %64 = getelementptr inbounds %struct.rc_matrix_t, ptr %63, i32 0, i32 1
  %65 = load i32, ptr %64, align 4, !tbaa !17
  %66 = icmp ne i32 %61, %65
  %67 = xor i1 %66, true
  %68 = xor i1 %67, true
  %69 = zext i1 %68 to i32
  %70 = sext i32 %69 to i64
  %71 = call i64 @llvm.expect.i64(i64 %70, i64 0)
  %72 = icmp ne i64 %71, 0
  br i1 %72, label %73, label %76

73:                                               ; preds = %59
  %74 = load ptr, ptr @stderr, align 8, !tbaa !5
  %75 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %74, ptr noundef @.str.16) #6
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %164

76:                                               ; preds = %59
  %77 = getelementptr inbounds %struct.rc_vector_t, ptr %2, i32 0, i32 0
  %78 = load i32, ptr %77, align 8, !tbaa !16
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.rc_kalman_t, ptr %79, i32 0, i32 2
  %81 = getelementptr inbounds %struct.rc_matrix_t, ptr %80, i32 0, i32 0
  %82 = load i32, ptr %81, align 8, !tbaa !18
  %83 = icmp ne i32 %78, %82
  %84 = xor i1 %83, true
  %85 = xor i1 %84, true
  %86 = zext i1 %85 to i32
  %87 = sext i32 %86 to i64
  %88 = call i64 @llvm.expect.i64(i64 %87, i64 0)
  %89 = icmp ne i64 %88, 0
  br i1 %89, label %90, label %93

90:                                               ; preds = %76
  %91 = load ptr, ptr @stderr, align 8, !tbaa !5
  %92 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %91, ptr noundef @.str.17) #6
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %164

93:                                               ; preds = %76
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.rc_kalman_t, ptr %94, i32 0, i32 0
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.rc_kalman_t, ptr %96, i32 0, i32 7
  %98 = call i32 @rc_matrix_times_col_vec(ptr noundef byval(%struct.rc_matrix_t) align 8 %95, ptr noundef byval(%struct.rc_vector_t) align 8 %97, ptr noundef %12)
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.rc_kalman_t, ptr %99, i32 0, i32 1
  %101 = call i32 @rc_matrix_times_col_vec(ptr noundef byval(%struct.rc_matrix_t) align 8 %100, ptr noundef byval(%struct.rc_vector_t) align 8 %1, ptr noundef %13)
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.rc_kalman_t, ptr %102, i32 0, i32 8
  %104 = call i32 @rc_vector_sum(ptr noundef byval(%struct.rc_vector_t) align 8 %12, ptr noundef byval(%struct.rc_vector_t) align 8 %13, ptr noundef %103)
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.rc_kalman_t, ptr %105, i32 0, i32 0
  %107 = load ptr, ptr %5, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.rc_kalman_t, ptr %107, i32 0, i32 5
  %109 = call i32 @rc_matrix_multiply(ptr noundef byval(%struct.rc_matrix_t) align 8 %106, ptr noundef byval(%struct.rc_matrix_t) align 8 %108, ptr noundef %7)
  %110 = load ptr, ptr %5, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.rc_kalman_t, ptr %110, i32 0, i32 0
  %112 = call i32 @rc_matrix_transpose(ptr noundef byval(%struct.rc_matrix_t) align 8 %111, ptr noundef %9)
  %113 = call i32 @rc_matrix_right_multiply_inplace(ptr noundef %7, ptr noundef byval(%struct.rc_matrix_t) align 8 %9)
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.rc_kalman_t, ptr %114, i32 0, i32 3
  %116 = call i32 @rc_matrix_add_inplace(ptr noundef %7, ptr noundef byval(%struct.rc_matrix_t) align 8 %115)
  %117 = call i32 @rc_matrix_symmetrize(ptr noundef %7)
  %118 = load ptr, ptr %5, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.rc_kalman_t, ptr %118, i32 0, i32 2
  %120 = load ptr, ptr %5, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.rc_kalman_t, ptr %120, i32 0, i32 8
  %122 = call i32 @rc_matrix_times_col_vec(ptr noundef byval(%struct.rc_matrix_t) align 8 %119, ptr noundef byval(%struct.rc_vector_t) align 8 %121, ptr noundef %10)
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.rc_kalman_t, ptr %123, i32 0, i32 2
  %125 = call i32 @rc_matrix_transpose(ptr noundef byval(%struct.rc_matrix_t) align 8 %124, ptr noundef %8)
  %126 = call i32 @rc_matrix_multiply(ptr noundef byval(%struct.rc_matrix_t) align 8 %7, ptr noundef byval(%struct.rc_matrix_t) align 8 %8, ptr noundef %6)
  %127 = call i32 @rc_matrix_left_multiply_inplace(ptr noundef byval(%struct.rc_matrix_t) align 8 %7, ptr noundef %8)
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.rc_kalman_t, ptr %128, i32 0, i32 2
  %130 = call i32 @rc_matrix_left_multiply_inplace(ptr noundef byval(%struct.rc_matrix_t) align 8 %129, ptr noundef %8)
  %131 = load ptr, ptr %5, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.rc_kalman_t, ptr %131, i32 0, i32 4
  %133 = call i32 @rc_matrix_add_inplace(ptr noundef %8, ptr noundef byval(%struct.rc_matrix_t) align 8 %132)
  %134 = call i32 @rc_algebra_invert_matrix_inplace(ptr noundef %8)
  %135 = call i32 @rc_matrix_right_multiply_inplace(ptr noundef %6, ptr noundef byval(%struct.rc_matrix_t) align 8 %8)
  %136 = call i32 @rc_vector_subtract(ptr noundef byval(%struct.rc_vector_t) align 8 %2, ptr noundef byval(%struct.rc_vector_t) align 8 %10, ptr noundef %11)
  %137 = call i32 @rc_matrix_times_col_vec(ptr noundef byval(%struct.rc_matrix_t) align 8 %6, ptr noundef byval(%struct.rc_vector_t) align 8 %11, ptr noundef %12)
  %138 = load ptr, ptr %5, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.rc_kalman_t, ptr %138, i32 0, i32 8
  %140 = load ptr, ptr %5, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.rc_kalman_t, ptr %140, i32 0, i32 7
  %142 = call i32 @rc_vector_sum(ptr noundef byval(%struct.rc_vector_t) align 8 %139, ptr noundef byval(%struct.rc_vector_t) align 8 %12, ptr noundef %141)
  %143 = load ptr, ptr %5, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.rc_kalman_t, ptr %143, i32 0, i32 2
  %145 = call i32 @rc_matrix_multiply(ptr noundef byval(%struct.rc_matrix_t) align 8 %144, ptr noundef byval(%struct.rc_matrix_t) align 8 %7, ptr noundef %8)
  %146 = call i32 @rc_matrix_left_multiply_inplace(ptr noundef byval(%struct.rc_matrix_t) align 8 %6, ptr noundef %8)
  %147 = call i32 @rc_matrix_subtract_inplace(ptr noundef %7, ptr noundef byval(%struct.rc_matrix_t) align 8 %8)
  %148 = call i32 @rc_matrix_symmetrize(ptr noundef %7)
  %149 = load ptr, ptr %5, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.rc_kalman_t, ptr %149, i32 0, i32 5
  %151 = call i32 @rc_matrix_duplicate(ptr noundef byval(%struct.rc_matrix_t) align 8 %7, ptr noundef %150)
  %152 = call i32 @rc_matrix_free(ptr noundef %6)
  %153 = call i32 @rc_matrix_free(ptr noundef %7)
  %154 = call i32 @rc_matrix_free(ptr noundef %8)
  %155 = call i32 @rc_matrix_free(ptr noundef %9)
  %156 = call i32 @rc_vector_free(ptr noundef %10)
  %157 = call i32 @rc_vector_free(ptr noundef %11)
  %158 = call i32 @rc_vector_free(ptr noundef %12)
  %159 = call i32 @rc_vector_free(ptr noundef %13)
  %160 = load ptr, ptr %5, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.rc_kalman_t, ptr %160, i32 0, i32 10
  %162 = load i64, ptr %161, align 8, !tbaa !19
  %163 = add i64 %162, 1
  store i64 %163, ptr %161, align 8, !tbaa !19
  store i32 0, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %164

164:                                              ; preds = %93, %90, %73, %56, %37, %23
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #6
  %165 = load i32, ptr %4, align 4
  ret i32 %165
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #5

declare i32 @rc_matrix_times_col_vec(ptr noundef byval(%struct.rc_matrix_t) align 8, ptr noundef byval(%struct.rc_vector_t) align 8, ptr noundef) #3

declare i32 @rc_vector_sum(ptr noundef byval(%struct.rc_vector_t) align 8, ptr noundef byval(%struct.rc_vector_t) align 8, ptr noundef) #3

declare i32 @rc_matrix_multiply(ptr noundef byval(%struct.rc_matrix_t) align 8, ptr noundef byval(%struct.rc_matrix_t) align 8, ptr noundef) #3

declare i32 @rc_matrix_transpose(ptr noundef byval(%struct.rc_matrix_t) align 8, ptr noundef) #3

declare i32 @rc_matrix_right_multiply_inplace(ptr noundef, ptr noundef byval(%struct.rc_matrix_t) align 8) #3

declare i32 @rc_matrix_add_inplace(ptr noundef, ptr noundef byval(%struct.rc_matrix_t) align 8) #3

declare i32 @rc_matrix_symmetrize(ptr noundef) #3

declare i32 @rc_matrix_left_multiply_inplace(ptr noundef byval(%struct.rc_matrix_t) align 8, ptr noundef) #3

declare i32 @rc_algebra_invert_matrix_inplace(ptr noundef) #3

declare i32 @rc_vector_subtract(ptr noundef byval(%struct.rc_vector_t) align 8, ptr noundef byval(%struct.rc_vector_t) align 8, ptr noundef) #3

declare i32 @rc_matrix_subtract_inplace(ptr noundef, ptr noundef byval(%struct.rc_matrix_t) align 8) #3

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !12, i64 216}
!10 = !{!"rc_kalman_t", !11, i64 0, !11, i64 24, !11, i64 48, !11, i64 72, !11, i64 96, !11, i64 120, !11, i64 144, !13, i64 168, !13, i64 192, !12, i64 216, !14, i64 224}
!11 = !{!"rc_matrix_t", !12, i64 0, !12, i64 4, !6, i64 8, !12, i64 16}
!12 = !{!"int", !7, i64 0}
!13 = !{!"rc_vector_t", !12, i64 0, !6, i64 8, !12, i64 16}
!14 = !{!"long", !7, i64 0}
!15 = !{!13, !12, i64 16}
!16 = !{!13, !12, i64 0}
!17 = !{!10, !12, i64 28}
!18 = !{!10, !12, i64 48}
!19 = !{!10, !14, i64 224}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.rc_matrix_t = type { i32, i32, ptr, i32 }
%struct.rc_vector_t = type { i32, ptr, i32 }

@stderr = external local_unnamed_addr global ptr, align 8
@.str.13 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [74 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [71 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

declare i32 @rc_matrix_duplicate(ptr noundef byval(%struct.rc_matrix_t) align 8, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

declare i32 @rc_matrix_free(ptr noundef) local_unnamed_addr #3

declare i32 @rc_vector_free(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @rc_kalman_update_lin(ptr noundef %0, ptr noundef byval(%struct.rc_vector_t) align 8 %1, ptr noundef byval(%struct.rc_vector_t) align 8 %2) local_unnamed_addr #4 {
  %4 = alloca %struct.rc_matrix_t, align 8
  %5 = alloca %struct.rc_matrix_t, align 8
  %6 = alloca %struct.rc_matrix_t, align 8
  %7 = alloca %struct.rc_matrix_t, align 8
  %8 = alloca %struct.rc_vector_t, align 8
  %9 = alloca %struct.rc_vector_t, align 8
  %10 = alloca %struct.rc_vector_t, align 8
  %11 = alloca %struct.rc_vector_t, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %4, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %5, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %6, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %7, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %8, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %9, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %10, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %11) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %11, i8 0, i64 24, i1 false)
  %12 = icmp eq ptr %0, null
  br i1 %12, label %13, label %16, !prof !5

13:                                               ; preds = %3
  %14 = load ptr, ptr @stderr, align 8, !tbaa !6
  %15 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef nonnull @.str.13) #6
  br label %89

16:                                               ; preds = %3
  %17 = getelementptr inbounds i8, ptr %0, i64 216
  %18 = load i32, ptr %17, align 8, !tbaa !10
  %.not = icmp eq i32 %18, 1
  br i1 %.not, label %22, label %19, !prof !16

19:                                               ; preds = %16
  %20 = load ptr, ptr @stderr, align 8, !tbaa !6
  %21 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef nonnull @.str.14) #6
  br label %89

22:                                               ; preds = %16
  %23 = getelementptr inbounds i8, ptr %1, i64 16
  %24 = load i32, ptr %23, align 8, !tbaa !17
  %25 = icmp ne i32 %24, 1
  %26 = getelementptr inbounds i8, ptr %2, i64 16
  %27 = load i32, ptr %26, align 8
  %28 = icmp ne i32 %27, 1
  %29 = select i1 %25, i1 true, i1 %28, !prof !5
  br i1 %29, label %30, label %33, !prof !5

30:                                               ; preds = %22
  %31 = load ptr, ptr @stderr, align 8, !tbaa !6
  %32 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef nonnull @.str.15) #6
  br label %89

33:                                               ; preds = %22
  %34 = load i32, ptr %1, align 8, !tbaa !18
  %35 = getelementptr inbounds i8, ptr %0, i64 24
  %36 = getelementptr inbounds i8, ptr %0, i64 28
  %37 = load i32, ptr %36, align 4, !tbaa !19
  %.not23 = icmp eq i32 %34, %37
  br i1 %.not23, label %41, label %38, !prof !16

38:                                               ; preds = %33
  %39 = load ptr, ptr @stderr, align 8, !tbaa !6
  %40 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef nonnull @.str.16) #6
  br label %89

41:                                               ; preds = %33
  %42 = load i32, ptr %2, align 8, !tbaa !18
  %43 = getelementptr inbounds i8, ptr %0, i64 48
  %44 = load i32, ptr %43, align 8, !tbaa !20
  %.not24 = icmp eq i32 %42, %44
  br i1 %.not24, label %48, label %45, !prof !16

45:                                               ; preds = %41
  %46 = load ptr, ptr @stderr, align 8, !tbaa !6
  %47 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef nonnull @.str.17) #6
  br label %89

48:                                               ; preds = %41
  %49 = getelementptr inbounds i8, ptr %0, i64 168
  %50 = call i32 @rc_matrix_times_col_vec(ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %0, ptr noundef nonnull byval(%struct.rc_vector_t) align 8 %49, ptr noundef nonnull %10) #5
  %51 = call i32 @rc_matrix_times_col_vec(ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %35, ptr noundef nonnull byval(%struct.rc_vector_t) align 8 %1, ptr noundef nonnull %11) #5
  %52 = getelementptr inbounds i8, ptr %0, i64 192
  %53 = call i32 @rc_vector_sum(ptr noundef nonnull byval(%struct.rc_vector_t) align 8 %10, ptr noundef nonnull byval(%struct.rc_vector_t) align 8 %11, ptr noundef nonnull %52) #5
  %54 = getelementptr inbounds i8, ptr %0, i64 120
  %55 = call i32 @rc_matrix_multiply(ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %0, ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %54, ptr noundef nonnull %5) #5
  %56 = call i32 @rc_matrix_transpose(ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %0, ptr noundef nonnull %7) #5
  %57 = call i32 @rc_matrix_right_multiply_inplace(ptr noundef nonnull %5, ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %7) #5
  %58 = getelementptr inbounds i8, ptr %0, i64 72
  %59 = call i32 @rc_matrix_add_inplace(ptr noundef nonnull %5, ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %58) #5
  %60 = call i32 @rc_matrix_symmetrize(ptr noundef nonnull %5) #5
  %61 = call i32 @rc_matrix_times_col_vec(ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %43, ptr noundef nonnull byval(%struct.rc_vector_t) align 8 %52, ptr noundef nonnull %8) #5
  %62 = call i32 @rc_matrix_transpose(ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %43, ptr noundef nonnull %6) #5
  %63 = call i32 @rc_matrix_multiply(ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %5, ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %6, ptr noundef nonnull %4) #5
  %64 = call i32 @rc_matrix_left_multiply_inplace(ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %5, ptr noundef nonnull %6) #5
  %65 = call i32 @rc_matrix_left_multiply_inplace(ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %43, ptr noundef nonnull %6) #5
  %66 = getelementptr inbounds i8, ptr %0, i64 96
  %67 = call i32 @rc_matrix_add_inplace(ptr noundef nonnull %6, ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %66) #5
  %68 = call i32 @rc_algebra_invert_matrix_inplace(ptr noundef nonnull %6) #5
  %69 = call i32 @rc_matrix_right_multiply_inplace(ptr noundef nonnull %4, ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %6) #5
  %70 = call i32 @rc_vector_subtract(ptr noundef nonnull byval(%struct.rc_vector_t) align 8 %2, ptr noundef nonnull byval(%struct.rc_vector_t) align 8 %8, ptr noundef nonnull %9) #5
  %71 = call i32 @rc_matrix_times_col_vec(ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %4, ptr noundef nonnull byval(%struct.rc_vector_t) align 8 %9, ptr noundef nonnull %10) #5
  %72 = call i32 @rc_vector_sum(ptr noundef nonnull byval(%struct.rc_vector_t) align 8 %52, ptr noundef nonnull byval(%struct.rc_vector_t) align 8 %10, ptr noundef nonnull %49) #5
  %73 = call i32 @rc_matrix_multiply(ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %43, ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %5, ptr noundef nonnull %6) #5
  %74 = call i32 @rc_matrix_left_multiply_inplace(ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %4, ptr noundef nonnull %6) #5
  %75 = call i32 @rc_matrix_subtract_inplace(ptr noundef nonnull %5, ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %6) #5
  %76 = call i32 @rc_matrix_symmetrize(ptr noundef nonnull %5) #5
  %77 = call i32 @rc_matrix_duplicate(ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %5, ptr noundef nonnull %54) #5
  %78 = call i32 @rc_matrix_free(ptr noundef nonnull %4) #5
  %79 = call i32 @rc_matrix_free(ptr noundef nonnull %5) #5
  %80 = call i32 @rc_matrix_free(ptr noundef nonnull %6) #5
  %81 = call i32 @rc_matrix_free(ptr noundef nonnull %7) #5
  %82 = call i32 @rc_vector_free(ptr noundef nonnull %8) #5
  %83 = call i32 @rc_vector_free(ptr noundef nonnull %9) #5
  %84 = call i32 @rc_vector_free(ptr noundef nonnull %10) #5
  %85 = call i32 @rc_vector_free(ptr noundef nonnull %11) #5
  %86 = getelementptr inbounds i8, ptr %0, i64 224
  %87 = load i64, ptr %86, align 8, !tbaa !21
  %88 = add i64 %87, 1
  store i64 %88, ptr %86, align 8, !tbaa !21
  br label %89

89:                                               ; preds = %48, %45, %38, %30, %19, %13
  %.0 = phi i32 [ -1, %13 ], [ -1, %19 ], [ -1, %30 ], [ -1, %38 ], [ -1, %45 ], [ 0, %48 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  ret i32 %.0
}

declare i32 @rc_matrix_times_col_vec(ptr noundef byval(%struct.rc_matrix_t) align 8, ptr noundef byval(%struct.rc_vector_t) align 8, ptr noundef) local_unnamed_addr #3

declare i32 @rc_vector_sum(ptr noundef byval(%struct.rc_vector_t) align 8, ptr noundef byval(%struct.rc_vector_t) align 8, ptr noundef) local_unnamed_addr #3

declare i32 @rc_matrix_multiply(ptr noundef byval(%struct.rc_matrix_t) align 8, ptr noundef byval(%struct.rc_matrix_t) align 8, ptr noundef) local_unnamed_addr #3

declare i32 @rc_matrix_transpose(ptr noundef byval(%struct.rc_matrix_t) align 8, ptr noundef) local_unnamed_addr #3

declare i32 @rc_matrix_right_multiply_inplace(ptr noundef, ptr noundef byval(%struct.rc_matrix_t) align 8) local_unnamed_addr #3

declare i32 @rc_matrix_add_inplace(ptr noundef, ptr noundef byval(%struct.rc_matrix_t) align 8) local_unnamed_addr #3

declare i32 @rc_matrix_symmetrize(ptr noundef) local_unnamed_addr #3

declare i32 @rc_matrix_left_multiply_inplace(ptr noundef byval(%struct.rc_matrix_t) align 8, ptr noundef) local_unnamed_addr #3

declare i32 @rc_algebra_invert_matrix_inplace(ptr noundef) local_unnamed_addr #3

declare i32 @rc_vector_subtract(ptr noundef byval(%struct.rc_vector_t) align 8, ptr noundef byval(%struct.rc_vector_t) align 8, ptr noundef) local_unnamed_addr #3

declare i32 @rc_matrix_subtract_inplace(ptr noundef, ptr noundef byval(%struct.rc_matrix_t) align 8) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { cold nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!6 = !{!7, !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !13, i64 216}
!11 = !{!"rc_kalman_t", !12, i64 0, !12, i64 24, !12, i64 48, !12, i64 72, !12, i64 96, !12, i64 120, !12, i64 144, !14, i64 168, !14, i64 192, !13, i64 216, !15, i64 224}
!12 = !{!"rc_matrix_t", !13, i64 0, !13, i64 4, !7, i64 8, !13, i64 16}
!13 = !{!"int", !8, i64 0}
!14 = !{!"rc_vector_t", !13, i64 0, !7, i64 8, !13, i64 16}
!15 = !{!"long", !8, i64 0}
!16 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!17 = !{!14, !13, i64 16}
!18 = !{!14, !13, i64 0}
!19 = !{!11, !13, i64 28}
!20 = !{!11, !13, i64 48}
!21 = !{!11, !15, i64 224}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LowerExpectIntrinsicPass,SROAPass,SimplifyCFGPass,TailCallElimPass