; 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::lptestproblem" = type { i64, i8, double, %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", i64, %"struct.alglib_impl::sparsematrix", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector" }
%"struct.alglib_impl::sparsematrix" = 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_vector", i64, i64, i64, i64, i64, i64 }
%"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 }
%"struct.alglib_impl::ae_state" = type { i64, double, double, double, ptr, %"struct.alglib_impl::ae_dyn_block", ptr, i32, ptr, i64, ptr, ptr, ptr }

@.str.979 = external hidden unnamed_addr constant [25 x i8], align 1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl19lptestproblemcreateElbdPNS_13lptestproblemEPNS_8ae_stateE(i64 noundef %0, i1 noundef zeroext %1, double noundef %2, ptr noundef %3, ptr noundef %4) #1 {
  %6 = alloca i64, align 8
  %7 = alloca i8, align 1
  %8 = alloca double, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  store i64 %0, ptr %6, align 8, !tbaa !5
  %11 = zext i1 %1 to i8
  store i8 %11, ptr %7, align 1, !tbaa !9
  store double %2, ptr %8, align 8, !tbaa !11
  store ptr %3, ptr %9, align 8, !tbaa !13
  store ptr %4, ptr %10, align 8, !tbaa !13
  %12 = load ptr, ptr %9, align 8, !tbaa !13
  call void @_ZN11alglib_impl20_lptestproblem_clearEPv(ptr noundef %12)
  %13 = load i64, ptr %6, align 8, !tbaa !5
  %14 = icmp sge i64 %13, 1
  %15 = load ptr, ptr %10, align 8, !tbaa !13
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %14, ptr noundef @.str.979, ptr noundef %15)
  %16 = load i64, ptr %6, align 8, !tbaa !5
  %17 = load ptr, ptr %9, align 8, !tbaa !13
  %18 = getelementptr inbounds %"struct.alglib_impl::lptestproblem", ptr %17, i32 0, i32 0
  store i64 %16, ptr %18, align 8, !tbaa !15
  %19 = load i8, ptr %7, align 1, !tbaa !9, !range !20, !noundef !21
  %20 = trunc i8 %19 to i1
  %21 = load ptr, ptr %9, align 8, !tbaa !13
  %22 = getelementptr inbounds %"struct.alglib_impl::lptestproblem", ptr %21, i32 0, i32 1
  %23 = zext i1 %20 to i8
  store i8 %23, ptr %22, align 8, !tbaa !22
  %24 = load i8, ptr %7, align 1, !tbaa !9, !range !20, !noundef !21
  %25 = trunc i8 %24 to i1
  br i1 %25, label %26, label %30

26:                                               ; preds = %5
  %27 = load double, ptr %8, align 8, !tbaa !11
  %28 = load ptr, ptr %9, align 8, !tbaa !13
  %29 = getelementptr inbounds %"struct.alglib_impl::lptestproblem", ptr %28, i32 0, i32 2
  store double %27, ptr %29, align 8, !tbaa !23
  br label %36

30:                                               ; preds = %5
  %31 = load ptr, ptr %10, align 8, !tbaa !13
  %32 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %31, i32 0, i32 1
  %33 = load double, ptr %32, align 8, !tbaa !24
  %34 = load ptr, ptr %9, align 8, !tbaa !13
  %35 = getelementptr inbounds %"struct.alglib_impl::lptestproblem", ptr %34, i32 0, i32 2
  store double %33, ptr %35, align 8, !tbaa !23
  br label %36

36:                                               ; preds = %30, %26
  %37 = load ptr, ptr %9, align 8, !tbaa !13
  %38 = getelementptr inbounds %"struct.alglib_impl::lptestproblem", ptr %37, i32 0, i32 3
  %39 = load i64, ptr %6, align 8, !tbaa !5
  %40 = load ptr, ptr %10, align 8, !tbaa !13
  call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %38, i64 noundef %39, ptr noundef %40)
  %41 = load i64, ptr %6, align 8, !tbaa !5
  %42 = load ptr, ptr %9, align 8, !tbaa !13
  %43 = getelementptr inbounds %"struct.alglib_impl::lptestproblem", ptr %42, i32 0, i32 3
  %44 = load ptr, ptr %10, align 8, !tbaa !13
  call void @_ZN11alglib_impl5rsetvEldPNS_9ae_vectorEPNS_8ae_stateE(i64 noundef %41, double noundef 1.000000e+00, ptr noundef %43, ptr noundef %44)
  %45 = load ptr, ptr %9, align 8, !tbaa !13
  %46 = getelementptr inbounds %"struct.alglib_impl::lptestproblem", ptr %45, i32 0, i32 4
  %47 = load i64, ptr %6, align 8, !tbaa !5
  %48 = load ptr, ptr %10, align 8, !tbaa !13
  call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %46, i64 noundef %47, ptr noundef %48)
  %49 = load i64, ptr %6, align 8, !tbaa !5
  %50 = load ptr, ptr %9, align 8, !tbaa !13
  %51 = getelementptr inbounds %"struct.alglib_impl::lptestproblem", ptr %50, i32 0, i32 4
  %52 = load ptr, ptr %10, align 8, !tbaa !13
  call void @_ZN11alglib_impl5rsetvEldPNS_9ae_vectorEPNS_8ae_stateE(i64 noundef %49, double noundef 0.000000e+00, ptr noundef %51, ptr noundef %52)
  %53 = load ptr, ptr %9, align 8, !tbaa !13
  %54 = getelementptr inbounds %"struct.alglib_impl::lptestproblem", ptr %53, i32 0, i32 5
  %55 = load i64, ptr %6, align 8, !tbaa !5
  %56 = load ptr, ptr %10, align 8, !tbaa !13
  call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %54, i64 noundef %55, ptr noundef %56)
  %57 = load i64, ptr %6, align 8, !tbaa !5
  %58 = load ptr, ptr %9, align 8, !tbaa !13
  %59 = getelementptr inbounds %"struct.alglib_impl::lptestproblem", ptr %58, i32 0, i32 5
  %60 = load ptr, ptr %10, align 8, !tbaa !13
  call void @_ZN11alglib_impl5rsetvEldPNS_9ae_vectorEPNS_8ae_stateE(i64 noundef %57, double noundef 0.000000e+00, ptr noundef %59, ptr noundef %60)
  %61 = load ptr, ptr %9, align 8, !tbaa !13
  %62 = getelementptr inbounds %"struct.alglib_impl::lptestproblem", ptr %61, i32 0, i32 6
  %63 = load i64, ptr %6, align 8, !tbaa !5
  %64 = load ptr, ptr %10, align 8, !tbaa !13
  call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %62, i64 noundef %63, ptr noundef %64)
  %65 = load i64, ptr %6, align 8, !tbaa !5
  %66 = load ptr, ptr %9, align 8, !tbaa !13
  %67 = getelementptr inbounds %"struct.alglib_impl::lptestproblem", ptr %66, i32 0, i32 6
  %68 = load ptr, ptr %10, align 8, !tbaa !13
  call void @_ZN11alglib_impl5rsetvEldPNS_9ae_vectorEPNS_8ae_stateE(i64 noundef %65, double noundef 0.000000e+00, ptr noundef %67, ptr noundef %68)
  %69 = load ptr, ptr %9, align 8, !tbaa !13
  %70 = getelementptr inbounds %"struct.alglib_impl::lptestproblem", ptr %69, i32 0, i32 7
  store i64 0, ptr %70, align 8, !tbaa !28
  %71 = load ptr, ptr %9, align 8, !tbaa !13
  %72 = getelementptr inbounds %"struct.alglib_impl::lptestproblem", ptr %71, i32 0, i32 9
  %73 = load ptr, ptr %10, align 8, !tbaa !13
  call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %72, i64 noundef 0, ptr noundef %73)
  %74 = load ptr, ptr %9, align 8, !tbaa !13
  %75 = getelementptr inbounds %"struct.alglib_impl::lptestproblem", ptr %74, i32 0, i32 10
  %76 = load ptr, ptr %10, align 8, !tbaa !13
  call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %75, i64 noundef 0, ptr noundef %76)
  ret void
}

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

declare void @_ZN11alglib_impl5rsetvEldPNS_9ae_vectorEPNS_8ae_stateE(i64 noundef, double noundef, ptr noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl20_lptestproblem_clearEPv(ptr noundef) #1

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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTSN11alglib_impl13lptestproblemE", !6, i64 0, !10, i64 8, !12, i64 16, !17, i64 24, !17, i64 88, !17, i64 152, !17, i64 216, !6, i64 280, !19, i64 288, !17, i64 656, !17, i64 720}
!17 = !{!"_ZTSN11alglib_impl9ae_vectorE", !6, i64 0, !6, i64 8, !10, i64 16, !18, i64 24, !7, i64 56}
!18 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24}
!19 = !{!"_ZTSN11alglib_impl12sparsematrixE", !17, i64 0, !17, i64 64, !17, i64 128, !17, i64 192, !17, i64 256, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!16, !10, i64 8}
!23 = !{!16, !12, i64 16}
!24 = !{!25, !12, i64 8}
!25 = !{!"_ZTSN11alglib_impl8ae_stateE", !6, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !14, i64 32, !18, i64 40, !14, i64 72, !26, i64 80, !14, i64 88, !27, i64 96, !14, i64 104, !14, i64 112, !14, i64 120}
!26 = !{!"_ZTSN11alglib_impl13ae_error_typeE", !7, i64 0}
!27 = !{!"long long", !7, i64 0}
!28 = !{!16, !6, i64 280}


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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl19lptestproblemcreateElbdPNS_13lptestproblemEPNS_8ae_stateE(i64 noundef %0, i1 noundef zeroext %1, double noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #1 {
  %6 = zext i1 %1 to i8
  tail call void @_ZN11alglib_impl20_lptestproblem_clearEPv(ptr noundef %3)
  %7 = icmp sgt i64 %0, 0
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %7, ptr noundef nonnull @.str.979, ptr noundef %4)
  store i64 %0, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %3, i64 8
  store i8 %6, ptr %8, align 8, !tbaa !16
  br i1 %1, label %12, label %9

9:                                                ; preds = %5
  %10 = getelementptr inbounds i8, ptr %4, i64 8
  %11 = load double, ptr %10, align 8, !tbaa !17
  br label %12

12:                                               ; preds = %5, %9
  %.sink = phi double [ %11, %9 ], [ %2, %5 ]
  %13 = getelementptr inbounds i8, ptr %3, i64 16
  store double %.sink, ptr %13, align 8
  %14 = getelementptr inbounds i8, ptr %3, i64 24
  tail call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef nonnull %14, i64 noundef %0, ptr noundef %4)
  tail call void @_ZN11alglib_impl5rsetvEldPNS_9ae_vectorEPNS_8ae_stateE(i64 noundef %0, double noundef 1.000000e+00, ptr noundef nonnull %14, ptr noundef %4)
  %15 = getelementptr inbounds i8, ptr %3, i64 88
  tail call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef nonnull %15, i64 noundef %0, ptr noundef %4)
  tail call void @_ZN11alglib_impl5rsetvEldPNS_9ae_vectorEPNS_8ae_stateE(i64 noundef %0, double noundef 0.000000e+00, ptr noundef nonnull %15, ptr noundef %4)
  %16 = getelementptr inbounds i8, ptr %3, i64 152
  tail call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef nonnull %16, i64 noundef %0, ptr noundef %4)
  tail call void @_ZN11alglib_impl5rsetvEldPNS_9ae_vectorEPNS_8ae_stateE(i64 noundef %0, double noundef 0.000000e+00, ptr noundef nonnull %16, ptr noundef %4)
  %17 = getelementptr inbounds i8, ptr %3, i64 216
  tail call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef nonnull %17, i64 noundef %0, ptr noundef %4)
  tail call void @_ZN11alglib_impl5rsetvEldPNS_9ae_vectorEPNS_8ae_stateE(i64 noundef %0, double noundef 0.000000e+00, ptr noundef nonnull %17, ptr noundef %4)
  %18 = getelementptr inbounds i8, ptr %3, i64 280
  store i64 0, ptr %18, align 8, !tbaa !21
  %19 = getelementptr inbounds i8, ptr %3, i64 656
  tail call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef nonnull %19, i64 noundef 0, ptr noundef %4)
  %20 = getelementptr inbounds i8, ptr %3, i64 720
  tail call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef nonnull %20, i64 noundef 0, ptr noundef %4)
  ret void
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl20_lptestproblem_clearEPv(ptr noundef) local_unnamed_addr #1

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, !7, i64 0}
!6 = !{!"_ZTSN11alglib_impl13lptestproblemE", !7, i64 0, !10, i64 8, !11, i64 16, !12, i64 24, !12, i64 88, !12, i64 152, !12, i64 216, !7, i64 280, !15, i64 288, !12, i64 656, !12, i64 720}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!"_ZTSN11alglib_impl9ae_vectorE", !7, i64 0, !7, i64 8, !10, i64 16, !13, i64 24, !8, i64 56}
!13 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{!"_ZTSN11alglib_impl12sparsematrixE", !12, i64 0, !12, i64 64, !12, i64 128, !12, i64 192, !12, i64 256, !7, i64 320, !7, i64 328, !7, i64 336, !7, i64 344, !7, i64 352, !7, i64 360}
!16 = !{!6, !10, i64 8}
!17 = !{!18, !11, i64 8}
!18 = !{!"_ZTSN11alglib_impl8ae_stateE", !7, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !14, i64 32, !13, i64 40, !14, i64 72, !19, i64 80, !14, i64 88, !20, i64 96, !14, i64 104, !14, i64 112, !14, i64 120}
!19 = !{!"_ZTSN11alglib_impl13ae_error_typeE", !8, i64 0}
!20 = !{!"long long", !8, i64 0}
!21 = !{!6, !7, i64 280}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,JumpThreadingPass,MergedLoadStoreMotionPass,SROAPass,TailCallElimPass