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

%"struct.alglib_impl::xbfgshessian" = type { i64, %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", i64, i64, double, double, double, double, double, double, double, i64, double, double, %"struct.alglib_impl::ae_matrix", i64, double, double, double, i64, double, %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", i8, i64, %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", i8, %"struct.alglib_impl::ae_vector", i8, i64, %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", i8, %"struct.alglib_impl::ae_vector", double, double, i64, %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector" }
%"struct.alglib_impl::ae_matrix" = type { i64, i64, i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon.1 }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, ptr, ptr, ptr }
%union.anon.1 = type { ptr }
%"struct.alglib_impl::ae_vector" = type { i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon.0 }
%union.anon.0 = type { ptr }

@.str.297 = external hidden unnamed_addr constant [55 x i8], align 1

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

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

declare void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr noundef) #1

declare void @_ZN11alglib_impl11rcopyallocmEllPKNS_9ae_matrixEPS0_PNS_8ae_stateE(i64 noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl23hessiangetlowrankmemoryEPNS_12xbfgshessianEPdPNS_9ae_matrixES4_PlPNS_8ae_stateE(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #2 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %14 = load ptr, ptr %8, align 8, !tbaa !5
  store double 0.000000e+00, ptr %14, align 8, !tbaa !9
  %15 = load ptr, ptr %11, align 8, !tbaa !5
  store i64 0, ptr %15, align 8, !tbaa !11
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = getelementptr inbounds %"struct.alglib_impl::xbfgshessian", ptr %16, i32 0, i32 0
  %18 = load i64, ptr %17, align 8, !tbaa !13
  %19 = icmp eq i64 %18, 3
  %20 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %19, ptr noundef @.str.297, ptr noundef %20)
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = getelementptr inbounds %"struct.alglib_impl::xbfgshessian", ptr %21, i32 0, i32 3
  %23 = load i64, ptr %22, align 8, !tbaa !19
  store i64 %23, ptr %13, align 8, !tbaa !11
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.alglib_impl::xbfgshessian", ptr %24, i32 0, i32 0
  %26 = load i64, ptr %25, align 8, !tbaa !13
  %27 = icmp eq i64 %26, 3
  br i1 %27, label %28, label %59

28:                                               ; preds = %6
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = getelementptr inbounds %"struct.alglib_impl::xbfgshessian", ptr %29, i32 0, i32 21
  %31 = load double, ptr %30, align 8, !tbaa !20
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  store double %31, ptr %32, align 8, !tbaa !9
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = getelementptr inbounds %"struct.alglib_impl::xbfgshessian", ptr %33, i32 0, i32 20
  %35 = load i64, ptr %34, align 8, !tbaa !21
  %36 = load ptr, ptr %11, align 8, !tbaa !5
  store i64 %35, ptr %36, align 8, !tbaa !11
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.alglib_impl::xbfgshessian", ptr %37, i32 0, i32 20
  %39 = load i64, ptr %38, align 8, !tbaa !21
  %40 = icmp sgt i64 %39, 0
  br i1 %40, label %41, label %58

41:                                               ; preds = %28
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = getelementptr inbounds %"struct.alglib_impl::xbfgshessian", ptr %42, i32 0, i32 20
  %44 = load i64, ptr %43, align 8, !tbaa !21
  %45 = load i64, ptr %13, align 8, !tbaa !11
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = getelementptr inbounds %"struct.alglib_impl::xbfgshessian", ptr %46, i32 0, i32 22
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN11alglib_impl11rcopyallocmEllPKNS_9ae_matrixEPS0_PNS_8ae_stateE(i64 noundef %44, i64 noundef %45, ptr noundef %47, ptr noundef %48, ptr noundef %49)
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = getelementptr inbounds %"struct.alglib_impl::xbfgshessian", ptr %50, i32 0, i32 20
  %52 = load i64, ptr %51, align 8, !tbaa !21
  %53 = load i64, ptr %13, align 8, !tbaa !11
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = getelementptr inbounds %"struct.alglib_impl::xbfgshessian", ptr %54, i32 0, i32 23
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN11alglib_impl11rcopyallocmEllPKNS_9ae_matrixEPS0_PNS_8ae_stateE(i64 noundef %52, i64 noundef %53, ptr noundef %55, ptr noundef %56, ptr noundef %57)
  br label %58

58:                                               ; preds = %41, %28
  br label %59

59:                                               ; preds = %58, %6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"_ZTSN11alglib_impl12xbfgshessianE", !12, i64 0, !15, i64 8, !15, i64 72, !12, i64 136, !12, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184, !10, i64 192, !10, i64 200, !12, i64 208, !10, i64 216, !10, i64 224, !18, i64 232, !12, i64 312, !10, i64 320, !10, i64 328, !10, i64 336, !12, i64 344, !10, i64 352, !18, i64 360, !18, i64 440, !18, i64 520, !18, i64 600, !16, i64 680, !12, i64 688, !18, i64 696, !18, i64 776, !16, i64 856, !15, i64 864, !16, i64 928, !12, i64 936, !18, i64 944, !15, i64 1024, !15, i64 1088, !18, i64 1152, !15, i64 1232, !15, i64 1296, !16, i64 1360, !15, i64 1368, !10, i64 1432, !10, i64 1440, !12, i64 1448, !18, i64 1456, !15, i64 1536, !15, i64 1600, !15, i64 1664, !15, i64 1728, !15, i64 1792, !15, i64 1856, !18, i64 1920, !18, i64 2000, !18, i64 2080, !18, i64 2160, !18, i64 2240, !18, i64 2320, !18, i64 2400, !18, i64 2480, !15, i64 2560, !15, i64 2624, !18, i64 2688, !15, i64 2768, !18, i64 2832, !18, i64 2912, !18, i64 2992, !18, i64 3072, !18, i64 3152, !15, i64 3232, !15, i64 3296}
!15 = !{!"_ZTSN11alglib_impl9ae_vectorE", !12, i64 0, !12, i64 8, !16, i64 16, !17, i64 24, !7, i64 56}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!18 = !{!"_ZTSN11alglib_impl9ae_matrixE", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !16, i64 32, !17, i64 40, !7, i64 72}
!19 = !{!14, !12, i64 136}
!20 = !{!14, !10, i64 352}
!21 = !{!14, !12, i64 344}


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

@.str.297 = external hidden unnamed_addr constant [55 x i8], align 1

declare void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @_ZN11alglib_impl11rcopyallocmEllPKNS_9ae_matrixEPS0_PNS_8ae_stateE(i64 noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl23hessiangetlowrankmemoryEPNS_12xbfgshessianEPdPNS_9ae_matrixES4_PlPNS_8ae_stateE(ptr noundef %0, ptr nocapture noundef writeonly %1, ptr noundef %2, ptr noundef %3, ptr nocapture noundef writeonly %4, ptr noundef %5) local_unnamed_addr #1 {
  store double 0.000000e+00, ptr %1, align 8, !tbaa !5
  store i64 0, ptr %4, align 8, !tbaa !9
  %7 = load i64, ptr %0, align 8, !tbaa !11
  %8 = icmp eq i64 %7, 3
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %8, ptr noundef nonnull @.str.297, ptr noundef %5)
  %9 = getelementptr inbounds i8, ptr %0, i64 136
  %10 = load i64, ptr %9, align 8, !tbaa !18
  %11 = load i64, ptr %0, align 8, !tbaa !11
  %12 = icmp eq i64 %11, 3
  br i1 %12, label %13, label %23

13:                                               ; preds = %6
  %14 = getelementptr inbounds i8, ptr %0, i64 352
  %15 = load double, ptr %14, align 8, !tbaa !19
  store double %15, ptr %1, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %0, i64 344
  %17 = load i64, ptr %16, align 8, !tbaa !20
  store i64 %17, ptr %4, align 8, !tbaa !9
  %18 = icmp sgt i64 %17, 0
  br i1 %18, label %19, label %23

19:                                               ; preds = %13
  %20 = getelementptr inbounds i8, ptr %0, i64 360
  tail call void @_ZN11alglib_impl11rcopyallocmEllPKNS_9ae_matrixEPS0_PNS_8ae_stateE(i64 noundef %17, i64 noundef %10, ptr noundef nonnull %20, ptr noundef %2, ptr noundef %5)
  %21 = load i64, ptr %16, align 8, !tbaa !20
  %22 = getelementptr inbounds i8, ptr %0, i64 440
  tail call void @_ZN11alglib_impl11rcopyallocmEllPKNS_9ae_matrixEPS0_PNS_8ae_stateE(i64 noundef %21, i64 noundef %10, ptr noundef nonnull %22, ptr noundef %3, ptr noundef %5)
  br label %23

23:                                               ; preds = %13, %19, %6
  ret void
}

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 = { 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" }

!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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTSN11alglib_impl12xbfgshessianE", !10, i64 0, !13, i64 8, !13, i64 72, !10, i64 136, !10, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !10, i64 208, !6, i64 216, !6, i64 224, !17, i64 232, !10, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !10, i64 344, !6, i64 352, !17, i64 360, !17, i64 440, !17, i64 520, !17, i64 600, !14, i64 680, !10, i64 688, !17, i64 696, !17, i64 776, !14, i64 856, !13, i64 864, !14, i64 928, !10, i64 936, !17, i64 944, !13, i64 1024, !13, i64 1088, !17, i64 1152, !13, i64 1232, !13, i64 1296, !14, i64 1360, !13, i64 1368, !6, i64 1432, !6, i64 1440, !10, i64 1448, !17, i64 1456, !13, i64 1536, !13, i64 1600, !13, i64 1664, !13, i64 1728, !13, i64 1792, !13, i64 1856, !17, i64 1920, !17, i64 2000, !17, i64 2080, !17, i64 2160, !17, i64 2240, !17, i64 2320, !17, i64 2400, !17, i64 2480, !13, i64 2560, !13, i64 2624, !17, i64 2688, !13, i64 2768, !17, i64 2832, !17, i64 2912, !17, i64 2992, !17, i64 3072, !17, i64 3152, !13, i64 3232, !13, i64 3296}
!13 = !{!"_ZTSN11alglib_impl9ae_vectorE", !10, i64 0, !10, i64 8, !14, i64 16, !15, i64 24, !7, i64 56}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !16, i64 0, !16, i64 8, !16, i64 16, !16, i64 24}
!16 = !{!"any pointer", !7, i64 0}
!17 = !{!"_ZTSN11alglib_impl9ae_matrixE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !14, i64 32, !15, i64 40, !7, i64 72}
!18 = !{!12, !10, i64 136}
!19 = !{!12, !6, i64 352}
!20 = !{!12, !10, i64 344}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass