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

; 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 uwtable
declare dso_local void @_ZN6alglib26_optguardnonc0report_ownerC2Ev(ptr noundef nonnull align 8 dereferenceable(17)) 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 #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6alglib19optguardnonc0reportC2Ev(ptr noundef nonnull align 8 dereferenceable(440) %0) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  call void @_ZN6alglib26_optguardnonc0report_ownerC2Ev(ptr noundef nonnull align 8 dereferenceable(17) %5)
  store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTVN6alglib19optguardnonc0reportE, i32 0, i32 0, i32 2), ptr %5, align 8, !tbaa !9
  %6 = getelementptr inbounds %"class.alglib::optguardnonc0report", ptr %5, i32 0, i32 1
  %7 = getelementptr inbounds %"class.alglib::_optguardnonc0report_owner", ptr %5, i32 0, i32 1
  %8 = load ptr, ptr %7, align 8, !tbaa !11
  %9 = getelementptr inbounds %"struct.alglib_impl::optguardnonc0report", ptr %8, i32 0, i32 0
  store ptr %9, ptr %6, align 8, !tbaa !5
  %10 = getelementptr inbounds %"class.alglib::optguardnonc0report", ptr %5, i32 0, i32 2
  %11 = getelementptr inbounds %"class.alglib::_optguardnonc0report_owner", ptr %5, i32 0, i32 1
  %12 = load ptr, ptr %11, align 8, !tbaa !11
  %13 = getelementptr inbounds %"struct.alglib_impl::optguardnonc0report", ptr %12, i32 0, i32 1
  store ptr %13, ptr %10, align 8, !tbaa !5
  %14 = getelementptr inbounds %"class.alglib::optguardnonc0report", ptr %5, i32 0, i32 3
  %15 = getelementptr inbounds %"class.alglib::_optguardnonc0report_owner", ptr %5, i32 0, i32 1
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  %17 = getelementptr inbounds %"struct.alglib_impl::optguardnonc0report", ptr %16, i32 0, i32 2
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %14, ptr noundef %17)
          to label %18 unwind label %58

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

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

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

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

58:                                               ; preds = %1
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %3, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %4, align 4
  br label %76

62:                                               ; preds = %18
  %63 = landingpad { ptr, i32 }
          cleanup
  %64 = extractvalue { ptr, i32 } %63, 0
  store ptr %64, ptr %3, align 8
  %65 = extractvalue { ptr, i32 } %63, 1
  store i32 %65, ptr %4, align 4
  br label %75

66:                                               ; preds = %23
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %3, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %4, align 4
  br label %74

70:                                               ; preds = %32
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %3, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %4, align 4
  call void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81) %28) #4
  br label %74

74:                                               ; preds = %70, %66
  call void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81) %19) #4
  br label %75

75:                                               ; preds = %74, %62
  call void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81) %14) #4
  br label %76

76:                                               ; preds = %75, %58
  call void @_ZN6alglib26_optguardnonc0report_ownerD2Ev(ptr noundef nonnull align 8 dereferenceable(17) %5) #4
  br label %77

77:                                               ; preds = %76
  %78 = load ptr, ptr %3, align 8
  %79 = load i32, ptr %4, align 4
  %80 = insertvalue { ptr, i32 } poison, ptr %78, 0
  %81 = insertvalue { ptr, i32 } %80, i32 %79, 1
  resume { ptr, i32 } %81
}

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 = !{!"_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 uwtable
declare dso_local void @_ZN6alglib26_optguardnonc0report_ownerC2Ev(ptr noundef nonnull align 8 dereferenceable(17)) 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 #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6alglib19optguardnonc0reportC2Ev(ptr noundef nonnull align 8 dereferenceable(440) %0) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN6alglib26_optguardnonc0report_ownerC2Ev(ptr noundef nonnull align 8 dereferenceable(17) %0)
  store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTVN6alglib19optguardnonc0reportE, i64 16), ptr %0, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 24
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !8
  store ptr %4, ptr %2, align 8, !tbaa !13
  %5 = getelementptr inbounds i8, ptr %0, i64 32
  %6 = getelementptr inbounds i8, ptr %4, i64 8
  store ptr %6, ptr %5, align 8, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %0, i64 40
  %8 = getelementptr inbounds i8, ptr %4, i64 16
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %7, ptr noundef nonnull %8)
          to label %9 unwind label %31

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

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

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

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

31:                                               ; preds = %1
  %32 = landingpad { ptr, i32 }
          cleanup
  br label %41

33:                                               ; preds = %9
  %34 = landingpad { ptr, i32 }
          cleanup
  br label %40

35:                                               ; preds = %13
  %36 = landingpad { ptr, i32 }
          cleanup
  br label %39

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

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

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

41:                                               ; preds = %40, %31
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %40 ], [ %32, %31 ]
  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 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 = !{!"_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