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

; 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::fblsgmresstate" = type { %"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_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", i64, i64, double, double, double, double, i64, i64, double, %"struct.alglib_impl::rcommstate" }
%"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 }
%"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::rcommstate" = type { i32, %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector" }

@.str.458 = external hidden unnamed_addr constant [34 x i8], align 1

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

declare noundef double @_ZN11alglib_impl7ae_sqrtEdPNS_8ae_stateE(double noundef, ptr noundef) #0

declare void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef, i64 noundef, ptr noundef) #0

declare void @_ZN11alglib_impl7rallocvElPNS_9ae_vectorEPNS_8ae_stateE(i64 noundef, ptr noundef, ptr noundef) #0

declare void @_ZN11alglib_impl11rcopyallocvElPKNS_9ae_vectorEPS0_PNS_8ae_stateE(i64 noundef, ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl15fblsgmrescreateEPKNS_9ae_vectorEllPNS_14fblsgmresstateEPNS_8ae_stateE(ptr noundef %0, i64 noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4) #1 {
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i64 %1, ptr %7, align 8, !tbaa !9
  store i64 %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  %11 = load i64, ptr %7, align 8, !tbaa !9
  %12 = icmp sgt i64 %11, 0
  br i1 %12, label %13, label %20

13:                                               ; preds = %5
  %14 = load i64, ptr %8, align 8, !tbaa !9
  %15 = icmp sgt i64 %14, 0
  br i1 %15, label %16, label %20

16:                                               ; preds = %13
  %17 = load i64, ptr %8, align 8, !tbaa !9
  %18 = load i64, ptr %7, align 8, !tbaa !9
  %19 = icmp sle i64 %17, %18
  br label %20

20:                                               ; preds = %16, %13, %5
  %21 = phi i1 [ false, %13 ], [ false, %5 ], [ %19, %16 ]
  %22 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %21, ptr noundef @.str.458, ptr noundef %22)
  %23 = load i64, ptr %7, align 8, !tbaa !9
  %24 = load ptr, ptr %9, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.alglib_impl::fblsgmresstate", ptr %24, i32 0, i32 13
  store i64 %23, ptr %25, align 8, !tbaa !11
  %26 = load i64, ptr %8, align 8, !tbaa !9
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  %28 = getelementptr inbounds %"struct.alglib_impl::fblsgmresstate", ptr %27, i32 0, i32 14
  store i64 %26, ptr %28, align 8, !tbaa !20
  %29 = load i64, ptr %7, align 8, !tbaa !9
  %30 = sitofp i64 %29 to double
  %31 = load ptr, ptr %10, align 8, !tbaa !5
  %32 = call noundef double @_ZN11alglib_impl7ae_sqrtEdPNS_8ae_stateE(double noundef %30, ptr noundef %31)
  %33 = fadd double 1.000000e+03, %32
  %34 = fmul double %33, 5.000000e-16
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.alglib_impl::fblsgmresstate", ptr %35, i32 0, i32 15
  store double %34, ptr %36, align 8, !tbaa !21
  %37 = load i64, ptr %7, align 8, !tbaa !9
  %38 = sitofp i64 %37 to double
  %39 = load ptr, ptr %10, align 8, !tbaa !5
  %40 = call noundef double @_ZN11alglib_impl7ae_sqrtEdPNS_8ae_stateE(double noundef %38, ptr noundef %39)
  %41 = fadd double 1.000000e+03, %40
  %42 = fmul double %41, 5.000000e-16
  %43 = load ptr, ptr %9, align 8, !tbaa !5
  %44 = getelementptr inbounds %"struct.alglib_impl::fblsgmresstate", ptr %43, i32 0, i32 16
  store double %42, ptr %44, align 8, !tbaa !22
  %45 = load ptr, ptr %9, align 8, !tbaa !5
  %46 = getelementptr inbounds %"struct.alglib_impl::fblsgmresstate", ptr %45, i32 0, i32 17
  store double 1.000000e+00, ptr %46, align 8, !tbaa !23
  %47 = load i64, ptr %7, align 8, !tbaa !9
  %48 = add nsw i64 10000, %47
  %49 = sitofp i64 %48 to double
  %50 = fmul double %49, 5.000000e-16
  %51 = load ptr, ptr %9, align 8, !tbaa !5
  %52 = getelementptr inbounds %"struct.alglib_impl::fblsgmresstate", ptr %51, i32 0, i32 18
  store double %50, ptr %52, align 8, !tbaa !24
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  %54 = getelementptr inbounds %"struct.alglib_impl::fblsgmresstate", ptr %53, i32 0, i32 19
  store i64 0, ptr %54, align 8, !tbaa !25
  %55 = load ptr, ptr %9, align 8, !tbaa !5
  %56 = getelementptr inbounds %"struct.alglib_impl::fblsgmresstate", ptr %55, i32 0, i32 20
  store i64 0, ptr %56, align 8, !tbaa !26
  %57 = load i64, ptr %7, align 8, !tbaa !9
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = getelementptr inbounds %"struct.alglib_impl::fblsgmresstate", ptr %59, i32 0, i32 0
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN11alglib_impl11rcopyallocvElPKNS_9ae_vectorEPS0_PNS_8ae_stateE(i64 noundef %57, ptr noundef %58, ptr noundef %60, ptr noundef %61)
  %62 = load i64, ptr %7, align 8, !tbaa !9
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  %64 = getelementptr inbounds %"struct.alglib_impl::fblsgmresstate", ptr %63, i32 0, i32 1
  %65 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN11alglib_impl7rallocvElPNS_9ae_vectorEPNS_8ae_stateE(i64 noundef %62, ptr noundef %64, ptr noundef %65)
  %66 = load i64, ptr %7, align 8, !tbaa !9
  %67 = load ptr, ptr %9, align 8, !tbaa !5
  %68 = getelementptr inbounds %"struct.alglib_impl::fblsgmresstate", ptr %67, i32 0, i32 2
  %69 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN11alglib_impl7rallocvElPNS_9ae_vectorEPNS_8ae_stateE(i64 noundef %66, ptr noundef %68, ptr noundef %69)
  %70 = load ptr, ptr %9, align 8, !tbaa !5
  %71 = getelementptr inbounds %"struct.alglib_impl::fblsgmresstate", ptr %70, i32 0, i32 22
  %72 = getelementptr inbounds %"struct.alglib_impl::rcommstate", ptr %71, i32 0, i32 1
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %72, i64 noundef 5, ptr noundef %73)
  %74 = load ptr, ptr %9, align 8, !tbaa !5
  %75 = getelementptr inbounds %"struct.alglib_impl::fblsgmresstate", ptr %74, i32 0, i32 22
  %76 = getelementptr inbounds %"struct.alglib_impl::rcommstate", ptr %75, i32 0, i32 3
  %77 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %76, i64 noundef 11, ptr noundef %77)
  %78 = load ptr, ptr %9, align 8, !tbaa !5
  %79 = getelementptr inbounds %"struct.alglib_impl::fblsgmresstate", ptr %78, i32 0, i32 22
  %80 = getelementptr inbounds %"struct.alglib_impl::rcommstate", ptr %79, i32 0, i32 0
  store i32 -1, ptr %80, align 8, !tbaa !27
  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 = !{!"any pointer", !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 912}
!12 = !{!"_ZTSN11alglib_impl14fblsgmresstateE", !13, i64 0, !13, i64 64, !13, i64 128, !13, i64 192, !16, i64 256, !16, i64 336, !16, i64 416, !16, i64 496, !16, i64 576, !13, i64 656, !13, i64 720, !13, i64 784, !13, i64 848, !10, i64 912, !10, i64 920, !17, i64 928, !17, i64 936, !17, i64 944, !17, i64 952, !10, i64 960, !10, i64 968, !17, i64 976, !18, i64 984}
!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", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!16 = !{!"_ZTSN11alglib_impl9ae_matrixE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !14, i64 32, !15, i64 40, !7, i64 72}
!17 = !{!"double", !7, i64 0}
!18 = !{!"_ZTSN11alglib_impl10rcommstateE", !19, i64 0, !13, i64 8, !13, i64 72, !13, i64 136, !13, i64 200}
!19 = !{!"int", !7, i64 0}
!20 = !{!12, !10, i64 920}
!21 = !{!12, !17, i64 928}
!22 = !{!12, !17, i64 936}
!23 = !{!12, !17, i64 944}
!24 = !{!12, !17, i64 952}
!25 = !{!12, !10, i64 960}
!26 = !{!12, !10, i64 968}
!27 = !{!12, !19, i64 984}


; 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.458 = external hidden unnamed_addr constant [34 x i8], align 1

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

declare noundef double @_ZN11alglib_impl7ae_sqrtEdPNS_8ae_stateE(double noundef, ptr noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl15fblsgmrescreateEPKNS_9ae_vectorEllPNS_14fblsgmresstateEPNS_8ae_stateE(ptr noundef %0, i64 noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #1 {
  %6 = icmp sgt i64 %1, 0
  %7 = icmp sgt i64 %2, 0
  %or.cond = and i1 %6, %7
  %8 = icmp ule i64 %2, %1
  %spec.select = and i1 %8, %or.cond
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %spec.select, ptr noundef nonnull @.str.458, ptr noundef %4)
  %9 = getelementptr inbounds i8, ptr %3, i64 912
  store i64 %1, ptr %9, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %3, i64 920
  store i64 %2, ptr %10, align 8, !tbaa !18
  %11 = sitofp i64 %1 to double
  %12 = tail call noundef double @_ZN11alglib_impl7ae_sqrtEdPNS_8ae_stateE(double noundef %11, ptr noundef %4)
  %13 = fadd double %12, 1.000000e+03
  %14 = fmul double %13, 5.000000e-16
  %15 = getelementptr inbounds i8, ptr %3, i64 928
  store double %14, ptr %15, align 8, !tbaa !19
  %16 = tail call noundef double @_ZN11alglib_impl7ae_sqrtEdPNS_8ae_stateE(double noundef %11, ptr noundef %4)
  %17 = fadd double %16, 1.000000e+03
  %18 = fmul double %17, 5.000000e-16
  %19 = getelementptr inbounds i8, ptr %3, i64 936
  store double %18, ptr %19, align 8, !tbaa !20
  %20 = getelementptr inbounds i8, ptr %3, i64 944
  store double 1.000000e+00, ptr %20, align 8, !tbaa !21
  %21 = add nsw i64 %1, 10000
  %22 = sitofp i64 %21 to double
  %23 = fmul double %22, 5.000000e-16
  %24 = getelementptr inbounds i8, ptr %3, i64 952
  store double %23, ptr %24, align 8, !tbaa !22
  %25 = getelementptr inbounds i8, ptr %3, i64 960
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %25, i8 0, i64 16, i1 false)
  tail call void @_ZN11alglib_impl11rcopyallocvElPKNS_9ae_vectorEPS0_PNS_8ae_stateE(i64 noundef %1, ptr noundef %0, ptr noundef %3, ptr noundef %4)
  %26 = getelementptr inbounds i8, ptr %3, i64 64
  tail call void @_ZN11alglib_impl7rallocvElPNS_9ae_vectorEPNS_8ae_stateE(i64 noundef %1, ptr noundef nonnull %26, ptr noundef %4)
  %27 = getelementptr inbounds i8, ptr %3, i64 128
  tail call void @_ZN11alglib_impl7rallocvElPNS_9ae_vectorEPNS_8ae_stateE(i64 noundef %1, ptr noundef nonnull %27, ptr noundef %4)
  %28 = getelementptr inbounds i8, ptr %3, i64 984
  %29 = getelementptr inbounds i8, ptr %3, i64 992
  tail call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef nonnull %29, i64 noundef 5, ptr noundef %4)
  %30 = getelementptr inbounds i8, ptr %3, i64 1120
  tail call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef nonnull %30, i64 noundef 11, ptr noundef %4)
  store i32 -1, ptr %28, align 8, !tbaa !23
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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" }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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, !8, i64 912}
!6 = !{!"_ZTSN11alglib_impl14fblsgmresstateE", !7, i64 0, !7, i64 64, !7, i64 128, !7, i64 192, !14, i64 256, !14, i64 336, !14, i64 416, !14, i64 496, !14, i64 576, !7, i64 656, !7, i64 720, !7, i64 784, !7, i64 848, !8, i64 912, !8, i64 920, !15, i64 928, !15, i64 936, !15, i64 944, !15, i64 952, !8, i64 960, !8, i64 968, !15, i64 976, !16, i64 984}
!7 = !{!"_ZTSN11alglib_impl9ae_vectorE", !8, i64 0, !8, i64 8, !11, i64 16, !12, i64 24, !9, i64 56}
!8 = !{!"long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"bool", !9, i64 0}
!12 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!13 = !{!"any pointer", !9, i64 0}
!14 = !{!"_ZTSN11alglib_impl9ae_matrixE", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !11, i64 32, !12, i64 40, !9, i64 72}
!15 = !{!"double", !9, i64 0}
!16 = !{!"_ZTSN11alglib_impl10rcommstateE", !17, i64 0, !7, i64 8, !7, i64 72, !7, i64 136, !7, i64 200}
!17 = !{!"int", !9, i64 0}
!18 = !{!6, !8, i64 920}
!19 = !{!6, !15, i64 928}
!20 = !{!6, !15, i64 936}
!21 = !{!6, !15, i64 944}
!22 = !{!6, !15, i64 952}
!23 = !{!6, !17, i64 984}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InstCombinePass,MemCpyOptPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass