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

; 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::minlpreport" = type { %"class.alglib::_minlpreport_owner.base", ptr, %"class.alglib::real_1d_array", %"class.alglib::real_1d_array", %"class.alglib::real_1d_array", %"class.alglib::integer_1d_array", ptr, ptr, ptr, ptr, ptr }
%"class.alglib::_minlpreport_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::integer_1d_array" = type { %"class.alglib::ae_vector_wrapper.base", [7 x i8] }
%"class.alglib::_minlpreport_owner" = type <{ ptr, ptr, i8, [7 x i8] }>
%"struct.alglib_impl::minlpreport" = type { double, %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", double, double, double, i64, i64 }

@_ZTVN6alglib11minlpreportE = 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 @_ZN6alglib18_minlpreport_ownerC2EPN11alglib_impl11minlpreportE(ptr noundef nonnull align 8 dereferenceable(17), ptr noundef) unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6alglib11minlpreportC2EPN11alglib_impl11minlpreportE(ptr noundef nonnull align 8 dereferenceable(424) %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 @_ZN6alglib18_minlpreport_ownerC2EPN11alglib_impl11minlpreportE(ptr noundef nonnull align 8 dereferenceable(17) %7, ptr noundef %8)
  store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTVN6alglib11minlpreportE, i32 0, i32 0, i32 2), ptr %7, align 8, !tbaa !9
  %9 = getelementptr inbounds %"class.alglib::minlpreport", ptr %7, i32 0, i32 1
  %10 = getelementptr inbounds %"class.alglib::_minlpreport_owner", ptr %7, i32 0, i32 1
  %11 = load ptr, ptr %10, align 8, !tbaa !11
  %12 = getelementptr inbounds %"struct.alglib_impl::minlpreport", ptr %11, i32 0, i32 0
  store ptr %12, ptr %9, align 8, !tbaa !5
  %13 = getelementptr inbounds %"class.alglib::minlpreport", ptr %7, i32 0, i32 2
  %14 = getelementptr inbounds %"class.alglib::_minlpreport_owner", ptr %7, i32 0, i32 1
  %15 = load ptr, ptr %14, align 8, !tbaa !11
  %16 = getelementptr inbounds %"struct.alglib_impl::minlpreport", ptr %15, i32 0, i32 1
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %13, ptr noundef %16)
          to label %17 unwind label %53

17:                                               ; preds = %2
  %18 = getelementptr inbounds %"class.alglib::minlpreport", ptr %7, i32 0, i32 3
  %19 = getelementptr inbounds %"class.alglib::_minlpreport_owner", ptr %7, i32 0, i32 1
  %20 = load ptr, ptr %19, align 8, !tbaa !11
  %21 = getelementptr inbounds %"struct.alglib_impl::minlpreport", ptr %20, i32 0, i32 2
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %18, ptr noundef %21)
          to label %22 unwind label %57

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

27:                                               ; preds = %22
  %28 = getelementptr inbounds %"class.alglib::minlpreport", ptr %7, i32 0, i32 5
  %29 = getelementptr inbounds %"class.alglib::_minlpreport_owner", ptr %7, i32 0, i32 1
  %30 = load ptr, ptr %29, align 8, !tbaa !11
  %31 = getelementptr inbounds %"struct.alglib_impl::minlpreport", ptr %30, i32 0, i32 4
  invoke void @_ZN6alglib16integer_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %28, ptr noundef %31)
          to label %32 unwind label %65

32:                                               ; preds = %27
  %33 = getelementptr inbounds %"class.alglib::minlpreport", ptr %7, i32 0, i32 6
  %34 = getelementptr inbounds %"class.alglib::_minlpreport_owner", ptr %7, i32 0, i32 1
  %35 = load ptr, ptr %34, align 8, !tbaa !11
  %36 = getelementptr inbounds %"struct.alglib_impl::minlpreport", ptr %35, i32 0, i32 5
  store ptr %36, ptr %33, align 8, !tbaa !5
  %37 = getelementptr inbounds %"class.alglib::minlpreport", ptr %7, i32 0, i32 7
  %38 = getelementptr inbounds %"class.alglib::_minlpreport_owner", ptr %7, i32 0, i32 1
  %39 = load ptr, ptr %38, align 8, !tbaa !11
  %40 = getelementptr inbounds %"struct.alglib_impl::minlpreport", ptr %39, i32 0, i32 6
  store ptr %40, ptr %37, align 8, !tbaa !5
  %41 = getelementptr inbounds %"class.alglib::minlpreport", ptr %7, i32 0, i32 8
  %42 = getelementptr inbounds %"class.alglib::_minlpreport_owner", ptr %7, i32 0, i32 1
  %43 = load ptr, ptr %42, align 8, !tbaa !11
  %44 = getelementptr inbounds %"struct.alglib_impl::minlpreport", ptr %43, i32 0, i32 7
  store ptr %44, ptr %41, align 8, !tbaa !5
  %45 = getelementptr inbounds %"class.alglib::minlpreport", ptr %7, i32 0, i32 9
  %46 = getelementptr inbounds %"class.alglib::_minlpreport_owner", ptr %7, i32 0, i32 1
  %47 = load ptr, ptr %46, align 8, !tbaa !11
  %48 = getelementptr inbounds %"struct.alglib_impl::minlpreport", ptr %47, i32 0, i32 8
  store ptr %48, ptr %45, align 8, !tbaa !5
  %49 = getelementptr inbounds %"class.alglib::minlpreport", ptr %7, i32 0, i32 10
  %50 = getelementptr inbounds %"class.alglib::_minlpreport_owner", ptr %7, i32 0, i32 1
  %51 = load ptr, ptr %50, align 8, !tbaa !11
  %52 = getelementptr inbounds %"struct.alglib_impl::minlpreport", ptr %51, i32 0, i32 9
  store ptr %52, ptr %49, align 8, !tbaa !5
  ret void

53:                                               ; preds = %2
  %54 = landingpad { ptr, i32 }
          cleanup
  %55 = extractvalue { ptr, i32 } %54, 0
  store ptr %55, ptr %5, align 8
  %56 = extractvalue { ptr, i32 } %54, 1
  store i32 %56, ptr %6, align 4
  br label %71

57:                                               ; preds = %17
  %58 = landingpad { ptr, i32 }
          cleanup
  %59 = extractvalue { ptr, i32 } %58, 0
  store ptr %59, ptr %5, align 8
  %60 = extractvalue { ptr, i32 } %58, 1
  store i32 %60, ptr %6, align 4
  br label %70

61:                                               ; preds = %22
  %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 %69

65:                                               ; preds = %27
  %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
  call void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81) %23) #4
  br label %69

69:                                               ; preds = %65, %61
  call void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81) %18) #4
  br label %70

70:                                               ; preds = %69, %57
  call void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81) %13) #4
  br label %71

71:                                               ; preds = %70, %53
  call void @_ZN6alglib18_minlpreport_ownerD2Ev(ptr noundef nonnull align 8 dereferenceable(17) %7) #4
  br label %72

72:                                               ; preds = %71
  %73 = load ptr, ptr %5, align 8
  %74 = load i32, ptr %6, align 4
  %75 = insertvalue { ptr, i32 } poison, ptr %73, 0
  %76 = insertvalue { ptr, i32 } %75, i32 %74, 1
  resume { ptr, i32 } %76
}

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 = !{!"_ZTSN6alglib18_minlpreport_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"

@_ZTVN6alglib11minlpreportE = 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 @_ZN6alglib18_minlpreport_ownerC2EPN11alglib_impl11minlpreportE(ptr noundef nonnull align 8 dereferenceable(17), ptr noundef) unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6alglib11minlpreportC2EPN11alglib_impl11minlpreportE(ptr noundef nonnull align 8 dereferenceable(424) %0, ptr noundef %1) unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN6alglib18_minlpreport_ownerC2EPN11alglib_impl11minlpreportE(ptr noundef nonnull align 8 dereferenceable(17) %0, ptr noundef %1)
  store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTVN6alglib11minlpreportE, 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
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %6, ptr noundef nonnull %7)
          to label %8 unwind label %28

8:                                                ; preds = %2
  %9 = getelementptr inbounds i8, ptr %0, i64 120
  %10 = load ptr, ptr %4, align 8, !tbaa !8
  %11 = getelementptr inbounds i8, ptr %10, i64 72
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %9, ptr noundef nonnull %11)
          to label %12 unwind label %30

12:                                               ; preds = %8
  %13 = getelementptr inbounds i8, ptr %0, i64 208
  %14 = load ptr, ptr %4, align 8, !tbaa !8
  %15 = getelementptr inbounds i8, ptr %14, i64 136
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %13, ptr noundef nonnull %15)
          to label %16 unwind label %32

16:                                               ; preds = %12
  %17 = getelementptr inbounds i8, ptr %0, i64 296
  %18 = load ptr, ptr %4, align 8, !tbaa !8
  %19 = getelementptr inbounds i8, ptr %18, i64 200
  invoke void @_ZN6alglib16integer_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %17, ptr noundef nonnull %19)
          to label %20 unwind label %34

20:                                               ; preds = %16
  %21 = getelementptr inbounds i8, ptr %0, i64 384
  %22 = load ptr, ptr %4, align 8, !tbaa !8
  %23 = insertelement <4 x ptr> poison, ptr %22, i64 0
  %24 = shufflevector <4 x ptr> %23, <4 x ptr> poison, <4 x i32> zeroinitializer
  %25 = getelementptr i8, <4 x ptr> %24, <4 x i64> <i64 264, i64 272, i64 280, i64 288>
  store <4 x ptr> %25, ptr %21, align 8, !tbaa !13
  %26 = getelementptr inbounds i8, ptr %0, i64 416
  %27 = getelementptr inbounds i8, ptr %22, i64 296
  store ptr %27, ptr %26, align 8, !tbaa !13
  ret void

28:                                               ; preds = %2
  %29 = landingpad { ptr, i32 }
          cleanup
  br label %38

30:                                               ; preds = %8
  %31 = landingpad { ptr, i32 }
          cleanup
  br label %37

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

34:                                               ; preds = %16
  %35 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81) %13) #4
  br label %36

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

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

38:                                               ; preds = %37, %28
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %37 ], [ %29, %28 ]
  tail call void @_ZN6alglib18_minlpreport_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 = !{!"_ZTSN6alglib18_minlpreport_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