; LLVM IR from venumb/ZSPACE :: cpp/depends/alglib/cpp/src/dataanalysis.ll (ZN6alglib12kmeansreportC2ERKS0_)

; 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"

%"class.alglib::kmeansreport" = type { %"class.alglib::_kmeansreport_owner", ptr, ptr, ptr, ptr, ptr, ptr, %"class.alglib::real_2d_array", %"class.alglib::integer_1d_array" }
%"class.alglib::_kmeansreport_owner" = type { ptr, ptr }
%"class.alglib::real_2d_array" = type { %"class.alglib::ae_matrix_wrapper.base", [7 x i8] }
%"class.alglib::ae_matrix_wrapper.base" = type <{ ptr, ptr, %"struct.alglib_impl::ae_matrix", i8 }>
%"struct.alglib_impl::ae_matrix" = type { i64, i64, i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon.0 }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, ptr, ptr, ptr }
%union.anon.0 = type { ptr }
%"class.alglib::integer_1d_array" = type { %"class.alglib::ae_vector_wrapper.base", [7 x i8] }
%"class.alglib::ae_vector_wrapper.base" = type <{ ptr, ptr, %"struct.alglib_impl::ae_vector", i8 }>
%"struct.alglib_impl::ae_vector" = type { i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon.1 }
%union.anon.1 = type { ptr }
%"struct.alglib_impl::kmeansreport" = type { i64, i64, i64, i64, double, i64, %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_vector" }

@_ZTVN6alglib12kmeansreportE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

declare i32 @__gxx_personality_v0(...)

declare void @_ZN6alglib13real_2d_arrayC1EPN11alglib_impl9ae_matrixE(ptr noundef nonnull align 8 dereferenceable(97), ptr noundef) unnamed_addr #0

declare void @_ZN6alglib16integer_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81), ptr noundef) unnamed_addr #0

; Function Attrs: nounwind
declare void @_ZN6alglib13real_2d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(97)) unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6alglib19_kmeansreport_ownerC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6alglib19_kmeansreport_ownerD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6alglib12kmeansreportC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(256) %0, ptr noundef nonnull align 8 dereferenceable(256) %1) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN6alglib19_kmeansreport_ownerC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %8)
  store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTVN6alglib12kmeansreportE, i32 0, i32 0, i32 2), ptr %7, align 8, !tbaa !9
  %9 = getelementptr inbounds %"class.alglib::kmeansreport", ptr %7, i32 0, i32 1
  %10 = getelementptr inbounds %"class.alglib::_kmeansreport_owner", ptr %7, i32 0, i32 1
  %11 = load ptr, ptr %10, align 8, !tbaa !11
  %12 = getelementptr inbounds %"struct.alglib_impl::kmeansreport", ptr %11, i32 0, i32 0
  store ptr %12, ptr %9, align 8, !tbaa !5
  %13 = getelementptr inbounds %"class.alglib::kmeansreport", ptr %7, i32 0, i32 2
  %14 = getelementptr inbounds %"class.alglib::_kmeansreport_owner", ptr %7, i32 0, i32 1
  %15 = load ptr, ptr %14, align 8, !tbaa !11
  %16 = getelementptr inbounds %"struct.alglib_impl::kmeansreport", ptr %15, i32 0, i32 1
  store ptr %16, ptr %13, align 8, !tbaa !5
  %17 = getelementptr inbounds %"class.alglib::kmeansreport", ptr %7, i32 0, i32 3
  %18 = getelementptr inbounds %"class.alglib::_kmeansreport_owner", ptr %7, i32 0, i32 1
  %19 = load ptr, ptr %18, align 8, !tbaa !11
  %20 = getelementptr inbounds %"struct.alglib_impl::kmeansreport", ptr %19, i32 0, i32 2
  store ptr %20, ptr %17, align 8, !tbaa !5
  %21 = getelementptr inbounds %"class.alglib::kmeansreport", ptr %7, i32 0, i32 4
  %22 = getelementptr inbounds %"class.alglib::_kmeansreport_owner", ptr %7, i32 0, i32 1
  %23 = load ptr, ptr %22, align 8, !tbaa !11
  %24 = getelementptr inbounds %"struct.alglib_impl::kmeansreport", ptr %23, i32 0, i32 3
  store ptr %24, ptr %21, align 8, !tbaa !5
  %25 = getelementptr inbounds %"class.alglib::kmeansreport", ptr %7, i32 0, i32 5
  %26 = getelementptr inbounds %"class.alglib::_kmeansreport_owner", ptr %7, i32 0, i32 1
  %27 = load ptr, ptr %26, align 8, !tbaa !11
  %28 = getelementptr inbounds %"struct.alglib_impl::kmeansreport", ptr %27, i32 0, i32 4
  store ptr %28, ptr %25, align 8, !tbaa !5
  %29 = getelementptr inbounds %"class.alglib::kmeansreport", ptr %7, i32 0, i32 6
  %30 = getelementptr inbounds %"class.alglib::_kmeansreport_owner", ptr %7, i32 0, i32 1
  %31 = load ptr, ptr %30, align 8, !tbaa !11
  %32 = getelementptr inbounds %"struct.alglib_impl::kmeansreport", ptr %31, i32 0, i32 5
  store ptr %32, ptr %29, align 8, !tbaa !5
  %33 = getelementptr inbounds %"class.alglib::kmeansreport", ptr %7, i32 0, i32 7
  %34 = getelementptr inbounds %"class.alglib::_kmeansreport_owner", ptr %7, i32 0, i32 1
  %35 = load ptr, ptr %34, align 8, !tbaa !11
  %36 = getelementptr inbounds %"struct.alglib_impl::kmeansreport", ptr %35, i32 0, i32 6
  invoke void @_ZN6alglib13real_2d_arrayC1EPN11alglib_impl9ae_matrixE(ptr noundef nonnull align 8 dereferenceable(97) %33, ptr noundef %36)
          to label %37 unwind label %43

37:                                               ; preds = %2
  %38 = getelementptr inbounds %"class.alglib::kmeansreport", ptr %7, i32 0, i32 8
  %39 = getelementptr inbounds %"class.alglib::_kmeansreport_owner", ptr %7, i32 0, i32 1
  %40 = load ptr, ptr %39, align 8, !tbaa !11
  %41 = getelementptr inbounds %"struct.alglib_impl::kmeansreport", ptr %40, i32 0, i32 7
  invoke void @_ZN6alglib16integer_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %38, ptr noundef %41)
          to label %42 unwind label %47

42:                                               ; preds = %37
  ret void

43:                                               ; preds = %2
  %44 = landingpad { ptr, i32 }
          cleanup
  %45 = extractvalue { ptr, i32 } %44, 0
  store ptr %45, ptr %5, align 8
  %46 = extractvalue { ptr, i32 } %44, 1
  store i32 %46, ptr %6, align 4
  br label %51

47:                                               ; preds = %37
  %48 = landingpad { ptr, i32 }
          cleanup
  %49 = extractvalue { ptr, i32 } %48, 0
  store ptr %49, ptr %5, align 8
  %50 = extractvalue { ptr, i32 } %48, 1
  store i32 %50, ptr %6, align 4
  call void @_ZN6alglib13real_2d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(97) %33) #4
  br label %51

51:                                               ; preds = %47, %43
  call void @_ZN6alglib19_kmeansreport_ownerD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #4
  br label %52

52:                                               ; preds = %51
  %53 = load ptr, ptr %5, align 8
  %54 = load i32, ptr %6, align 4
  %55 = insertvalue { ptr, i32 } poison, ptr %53, 0
  %56 = insertvalue { ptr, i32 } %55, i32 %54, 1
  resume { ptr, i32 } %56
}

attributes #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 #1 = { 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 #2 = { mustprogress 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 #3 = { mustprogress 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 #4 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"_ZTSN6alglib19_kmeansreport_ownerE", !6, i64 8}


; 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"

@_ZTVN6alglib12kmeansreportE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

declare i32 @__gxx_personality_v0(...)

declare void @_ZN6alglib13real_2d_arrayC1EPN11alglib_impl9ae_matrixE(ptr noundef nonnull align 8 dereferenceable(97), ptr noundef) unnamed_addr #0

declare void @_ZN6alglib16integer_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81), ptr noundef) unnamed_addr #0

; Function Attrs: nounwind
declare void @_ZN6alglib13real_2d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(97)) unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6alglib19_kmeansreport_ownerC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6alglib19_kmeansreport_ownerD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6alglib12kmeansreportC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(256) %0, ptr noundef nonnull align 8 dereferenceable(256) %1) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN6alglib19_kmeansreport_ownerC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %1)
  store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTVN6alglib12kmeansreportE, i64 16), ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load ptr, ptr %4, align 8, !tbaa !8
  store ptr %5, ptr %3, align 8, !tbaa !12
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = insertelement <4 x ptr> poison, ptr %5, i64 0
  %8 = shufflevector <4 x ptr> %7, <4 x ptr> poison, <4 x i32> zeroinitializer
  %9 = getelementptr i8, <4 x ptr> %8, <4 x i64> <i64 8, i64 16, i64 24, i64 32>
  store <4 x ptr> %9, ptr %6, align 8, !tbaa !12
  %10 = getelementptr inbounds i8, ptr %0, i64 56
  %11 = getelementptr inbounds i8, ptr %5, i64 40
  store ptr %11, ptr %10, align 8, !tbaa !12
  %12 = getelementptr inbounds i8, ptr %0, i64 64
  %13 = getelementptr inbounds i8, ptr %5, i64 48
  invoke void @_ZN6alglib13real_2d_arrayC1EPN11alglib_impl9ae_matrixE(ptr noundef nonnull align 8 dereferenceable(97) %12, ptr noundef nonnull %13)
          to label %14 unwind label %19

14:                                               ; preds = %2
  %15 = getelementptr inbounds i8, ptr %0, i64 168
  %16 = load ptr, ptr %4, align 8, !tbaa !8
  %17 = getelementptr inbounds i8, ptr %16, i64 128
  invoke void @_ZN6alglib16integer_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %15, ptr noundef nonnull %17)
          to label %18 unwind label %21

18:                                               ; preds = %14
  ret void

19:                                               ; preds = %2
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %23

21:                                               ; preds = %14
  %22 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN6alglib13real_2d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(97) %12) #4
  br label %23

23:                                               ; preds = %21, %19
  %.pn = phi { ptr, i32 } [ %22, %21 ], [ %20, %19 ]
  tail call void @_ZN6alglib19_kmeansreport_ownerD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %0) #4
  resume { ptr, i32 } %.pn
}

attributes #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 #1 = { 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 #2 = { mustprogress 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 #3 = { mustprogress 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 #4 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 8}
!9 = !{!"_ZTSN6alglib19_kmeansreport_ownerE", !10, i64 8}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!10, !10, i64 0}


; Effective O3 passes: EarlyCSEPass,InstCombinePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass