; LLVM IR from Dimandragon/non-parametric-dsp :: alglib-cpp/src (optimization)

; 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::optguardnonc0report" = type { %"class.alglib::_optguardnonc0report_owner.base", ptr, ptr, %"class.alglib::real_1d_array", %"class.alglib::real_1d_array", ptr, %"class.alglib::real_1d_array", %"class.alglib::real_1d_array", ptr, ptr, ptr, ptr, ptr }
%"class.alglib::_optguardnonc0report_owner.base" = type <{ ptr, ptr, i8 }>
%"class.alglib::real_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.0 }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, ptr, ptr, ptr }
%union.anon.0 = type { ptr }
%"class.alglib::_optguardnonc0report_owner" = type <{ ptr, ptr, i8, [7 x i8] }>
%"struct.alglib_impl::optguardnonc0report" = type { i8, i64, %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", i64, %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", i64, i64, i64, i64, i64 }

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6alglib19optguardnonc0reportC2EPN11alglib_impl19optguardnonc0reportE(ptr noundef nonnull align 8 dereferenceable(440) %0, ptr noundef %1) unnamed_addr #3 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 @_ZN6alglib26_optguardnonc0report_ownerC2EPN11alglib_impl19optguardnonc0reportE(ptr noundef nonnull align 8 dereferenceable(17) %7, ptr noundef %8)
  store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTVN6alglib19optguardnonc0reportE, i32 0, i32 0, i32 2), ptr %7, align 8, !tbaa !9
  %9 = getelementptr inbounds %"class.alglib::optguardnonc0report", ptr %7, i32 0, i32 1
  %10 = getelementptr inbounds %"class.alglib::_optguardnonc0report_owner", ptr %7, i32 0, i32 1
  %11 = load ptr, ptr %10, align 8, !tbaa !11
  %12 = getelementptr inbounds %"struct.alglib_impl::optguardnonc0report", ptr %11, i32 0, i32 0
  store ptr %12, ptr %9, align 8, !tbaa !5
  %13 = getelementptr inbounds %"class.alglib::optguardnonc0report", ptr %7, i32 0, i32 2
  %14 = getelementptr inbounds %"class.alglib::_optguardnonc0report_owner", ptr %7, i32 0, i32 1
  %15 = load ptr, ptr %14, align 8, !tbaa !11
  %16 = getelementptr inbounds %"struct.alglib_impl::optguardnonc0report", ptr %15, i32 0, i32 1
  store ptr %16, ptr %13, align 8, !tbaa !5
  %17 = getelementptr inbounds %"class.alglib::optguardnonc0report", ptr %7, i32 0, i32 3
  %18 = getelementptr inbounds %"class.alglib::_optguardnonc0report_owner", ptr %7, i32 0, i32 1
  %19 = load ptr, ptr %18, align 8, !tbaa !11
  %20 = getelementptr inbounds %"struct.alglib_impl::optguardnonc0report", ptr %19, i32 0, i32 2
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %17, ptr noundef %20)
          to label %21 unwind label %61

21:                                               ; preds = %2
  %22 = getelementptr inbounds %"class.alglib::optguardnonc0report", ptr %7, i32 0, i32 4
  %23 = getelementptr inbounds %"class.alglib::_optguardnonc0report_owner", ptr %7, i32 0, i32 1
  %24 = load ptr, ptr %23, align 8, !tbaa !11
  %25 = getelementptr inbounds %"struct.alglib_impl::optguardnonc0report", ptr %24, i32 0, i32 3
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %22, ptr noundef %25)
          to label %26 unwind label %65

26:                                               ; preds = %21
  %27 = getelementptr inbounds %"class.alglib::optguardnonc0report", ptr %7, i32 0, i32 5
  %28 = getelementptr inbounds %"class.alglib::_optguardnonc0report_owner", ptr %7, i32 0, i32 1
  %29 = load ptr, ptr %28, align 8, !tbaa !11
  %30 = getelementptr inbounds %"struct.alglib_impl::optguardnonc0report", ptr %29, i32 0, i32 4
  store ptr %30, ptr %27, align 8, !tbaa !5
  %31 = getelementptr inbounds %"class.alglib::optguardnonc0report", ptr %7, i32 0, i32 6
  %32 = getelementptr inbounds %"class.alglib::_optguardnonc0report_owner", ptr %7, i32 0, i32 1
  %33 = load ptr, ptr %32, align 8, !tbaa !11
  %34 = getelementptr inbounds %"struct.alglib_impl::optguardnonc0report", ptr %33, i32 0, i32 5
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %31, ptr noundef %34)
          to label %35 unwind label %69

35:                                               ; preds = %26
  %36 = getelementptr inbounds %"class.alglib::optguardnonc0report", ptr %7, i32 0, i32 7
  %37 = getelementptr inbounds %"class.alglib::_optguardnonc0report_owner", ptr %7, i32 0, i32 1
  %38 = load ptr, ptr %37, align 8, !tbaa !11
  %39 = getelementptr inbounds %"struct.alglib_impl::optguardnonc0report", ptr %38, i32 0, i32 6
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %36, ptr noundef %39)
          to label %40 unwind label %73

40:                                               ; preds = %35
  %41 = getelementptr inbounds %"class.alglib::optguardnonc0report", ptr %7, i32 0, i32 8
  %42 = getelementptr inbounds %"class.alglib::_optguardnonc0report_owner", ptr %7, i32 0, i32 1
  %43 = load ptr, ptr %42, align 8, !tbaa !11
  %44 = getelementptr inbounds %"struct.alglib_impl::optguardnonc0report", ptr %43, i32 0, i32 7
  store ptr %44, ptr %41, align 8, !tbaa !5
  %45 = getelementptr inbounds %"class.alglib::optguardnonc0report", ptr %7, i32 0, i32 9
  %46 = getelementptr inbounds %"class.alglib::_optguardnonc0report_owner", ptr %7, i32 0, i32 1
  %47 = load ptr, ptr %46, align 8, !tbaa !11
  %48 = getelementptr inbounds %"struct.alglib_impl::optguardnonc0report", ptr %47, i32 0, i32 8
  store ptr %48, ptr %45, align 8, !tbaa !5
  %49 = getelementptr inbounds %"class.alglib::optguardnonc0report", ptr %7, i32 0, i32 10
  %50 = getelementptr inbounds %"class.alglib::_optguardnonc0report_owner", ptr %7, i32 0, i32 1
  %51 = load ptr, ptr %50, align 8, !tbaa !11
  %52 = getelementptr inbounds %"struct.alglib_impl::optguardnonc0report", ptr %51, i32 0, i32 9
  store ptr %52, ptr %49, align 8, !tbaa !5
  %53 = getelementptr inbounds %"class.alglib::optguardnonc0report", ptr %7, i32 0, i32 11
  %54 = getelementptr inbounds %"class.alglib::_optguardnonc0report_owner", ptr %7, i32 0, i32 1
  %55 = load ptr, ptr %54, align 8, !tbaa !11
  %56 = getelementptr inbounds %"struct.alglib_impl::optguardnonc0report", ptr %55, i32 0, i32 10
  store ptr %56, ptr %53, align 8, !tbaa !5
  %57 = getelementptr inbounds %"class.alglib::optguardnonc0report", ptr %7, i32 0, i32 12
  %58 = getelementptr inbounds %"class.alglib::_optguardnonc0report_owner", ptr %7, i32 0, i32 1
  %59 = load ptr, ptr %58, align 8, !tbaa !11
  %60 = getelementptr inbounds %"struct.alglib_impl::optguardnonc0report", ptr %59, i32 0, i32 11
  store ptr %60, ptr %57, align 8, !tbaa !5
  ret void

61:                                               ; preds = %2
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %5, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %6, align 4
  br label %79

65:                                               ; preds = %21
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %5, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %6, align 4
  br label %78

69:                                               ; preds = %26
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %5, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %6, align 4
  br label %77

73:                                               ; preds = %35
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %5, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %6, align 4
  call void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81) %31) #4
  br label %77

77:                                               ; preds = %73, %69
  call void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81) %22) #4
  br label %78

78:                                               ; preds = %77, %65
  call void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81) %17) #4
  br label %79

79:                                               ; preds = %78, %61
  call void @_ZN6alglib26_optguardnonc0report_ownerD2Ev(ptr noundef nonnull align 8 dereferenceable(17) %7) #4
  br label %80

80:                                               ; preds = %79
  %81 = load ptr, ptr %5, align 8
  %82 = load i32, ptr %6, align 4
  %83 = insertvalue { ptr, i32 } poison, ptr %81, 0
  %84 = insertvalue { ptr, i32 } %83, i32 %82, 1
  resume { ptr, i32 } %84
}

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 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 #3 = { 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 #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 = !{!"_ZTSN6alglib26_optguardnonc0report_ownerE", !6, i64 8, !13, i64 16}
!13 = !{!"bool", !7, i64 0}


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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6alglib19optguardnonc0reportC2EPN11alglib_impl19optguardnonc0reportE(ptr noundef nonnull align 8 dereferenceable(440) %0, ptr noundef %1) unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN6alglib26_optguardnonc0report_ownerC2EPN11alglib_impl19optguardnonc0reportE(ptr noundef nonnull align 8 dereferenceable(17) %0, ptr noundef %1)
  store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTVN6alglib19optguardnonc0reportE, i64 16), ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 24
  %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 !13
  %6 = getelementptr inbounds i8, ptr %0, i64 32
  %7 = getelementptr inbounds i8, ptr %5, i64 8
  store ptr %7, ptr %6, align 8, !tbaa !13
  %8 = getelementptr inbounds i8, ptr %0, i64 40
  %9 = getelementptr inbounds i8, ptr %5, i64 16
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %8, ptr noundef nonnull %9)
          to label %10 unwind label %32

10:                                               ; preds = %2
  %11 = getelementptr inbounds i8, ptr %0, i64 128
  %12 = load ptr, ptr %4, align 8, !tbaa !8
  %13 = getelementptr inbounds i8, ptr %12, i64 80
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %11, ptr noundef nonnull %13)
          to label %14 unwind label %34

14:                                               ; preds = %10
  %15 = getelementptr inbounds i8, ptr %0, i64 216
  %16 = load ptr, ptr %4, align 8, !tbaa !8
  %17 = getelementptr inbounds i8, ptr %16, i64 144
  store ptr %17, ptr %15, align 8, !tbaa !13
  %18 = getelementptr inbounds i8, ptr %0, i64 224
  %19 = getelementptr inbounds i8, ptr %16, i64 152
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %18, ptr noundef nonnull %19)
          to label %20 unwind label %36

20:                                               ; preds = %14
  %21 = getelementptr inbounds i8, ptr %0, i64 312
  %22 = load ptr, ptr %4, align 8, !tbaa !8
  %23 = getelementptr inbounds i8, ptr %22, i64 216
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %21, ptr noundef nonnull %23)
          to label %24 unwind label %38

24:                                               ; preds = %20
  %25 = getelementptr inbounds i8, ptr %0, i64 400
  %26 = load ptr, ptr %4, align 8, !tbaa !8
  %27 = insertelement <4 x ptr> poison, ptr %26, i64 0
  %28 = shufflevector <4 x ptr> %27, <4 x ptr> poison, <4 x i32> zeroinitializer
  %29 = getelementptr i8, <4 x ptr> %28, <4 x i64> <i64 280, i64 288, i64 296, i64 304>
  store <4 x ptr> %29, ptr %25, align 8, !tbaa !13
  %30 = getelementptr inbounds i8, ptr %0, i64 432
  %31 = getelementptr inbounds i8, ptr %26, i64 312
  store ptr %31, ptr %30, align 8, !tbaa !13
  ret void

32:                                               ; preds = %2
  %33 = landingpad { ptr, i32 }
          cleanup
  br label %42

34:                                               ; preds = %10
  %35 = landingpad { ptr, i32 }
          cleanup
  br label %41

36:                                               ; preds = %14
  %37 = landingpad { ptr, i32 }
          cleanup
  br label %40

38:                                               ; preds = %20
  %39 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81) %18) #4
  br label %40

40:                                               ; preds = %38, %36
  %.pn = phi { ptr, i32 } [ %39, %38 ], [ %37, %36 ]
  tail call void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81) %11) #4
  br label %41

41:                                               ; preds = %40, %34
  %.pn.pn = phi { ptr, i32 } [ %.pn, %40 ], [ %35, %34 ]
  tail call void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81) %8) #4
  br label %42

42:                                               ; preds = %41, %32
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %41 ], [ %33, %32 ]
  tail call void @_ZN6alglib26_optguardnonc0report_ownerD2Ev(ptr noundef nonnull align 8 dereferenceable(17) %0) #4
  resume { ptr, i32 } %.pn.pn.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 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 #3 = { 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 #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 = !{!"_ZTSN6alglib26_optguardnonc0report_ownerE", !10, i64 8, !12, i64 16}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"bool", !11, i64 0}
!13 = !{!10, !10, i64 0}


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