; 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::varsfuncjac" = type { i64, i64, i8, %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::sparsematrix" }
%"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_matrix" = type { i64, i64, i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon.1 }
%union.anon.1 = type { ptr }
%"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 }

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl7vfjcopyEPKNS_11varsfuncjacEPS0_PNS_8ae_stateE(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = getelementptr inbounds %"struct.alglib_impl::varsfuncjac", ptr %7, i32 0, i32 0
  %9 = load i64, ptr %8, align 8, !tbaa !9
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds %"struct.alglib_impl::varsfuncjac", ptr %10, i32 0, i32 0
  store i64 %9, ptr %11, align 8, !tbaa !9
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %"struct.alglib_impl::varsfuncjac", ptr %12, i32 0, i32 1
  %14 = load i64, ptr %13, align 8, !tbaa !17
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %"struct.alglib_impl::varsfuncjac", ptr %15, i32 0, i32 1
  store i64 %14, ptr %16, align 8, !tbaa !17
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %"struct.alglib_impl::varsfuncjac", ptr %17, i32 0, i32 2
  %19 = load i8, ptr %18, align 8, !tbaa !18, !range !19, !noundef !20
  %20 = trunc i8 %19 to i1
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %"struct.alglib_impl::varsfuncjac", ptr %21, i32 0, i32 2
  %23 = zext i1 %20 to i8
  store i8 %23, ptr %22, align 8, !tbaa !18
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.alglib_impl::varsfuncjac", ptr %24, i32 0, i32 0
  %26 = load i64, ptr %25, align 8, !tbaa !9
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %"struct.alglib_impl::varsfuncjac", ptr %27, i32 0, i32 3
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %"struct.alglib_impl::varsfuncjac", ptr %29, i32 0, i32 3
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_impl11rcopyallocvElPKNS_9ae_vectorEPS0_PNS_8ae_stateE(i64 noundef %26, ptr noundef %28, ptr noundef %30, ptr noundef %31)
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.alglib_impl::varsfuncjac", ptr %32, i32 0, i32 1
  %34 = load i64, ptr %33, align 8, !tbaa !17
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.alglib_impl::varsfuncjac", ptr %35, i32 0, i32 4
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.alglib_impl::varsfuncjac", ptr %37, i32 0, i32 4
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_impl11rcopyallocvElPKNS_9ae_vectorEPS0_PNS_8ae_stateE(i64 noundef %34, ptr noundef %36, ptr noundef %38, ptr noundef %39)
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %"struct.alglib_impl::varsfuncjac", ptr %40, i32 0, i32 2
  %42 = load i8, ptr %41, align 8, !tbaa !18, !range !19, !noundef !20
  %43 = trunc i8 %42 to i1
  br i1 %43, label %44, label %56

44:                                               ; preds = %3
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %"struct.alglib_impl::varsfuncjac", ptr %45, i32 0, i32 1
  %47 = load i64, ptr %46, align 8, !tbaa !17
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %"struct.alglib_impl::varsfuncjac", ptr %48, i32 0, i32 0
  %50 = load i64, ptr %49, align 8, !tbaa !9
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %"struct.alglib_impl::varsfuncjac", ptr %51, i32 0, i32 5
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %"struct.alglib_impl::varsfuncjac", ptr %53, i32 0, i32 5
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_impl11rcopyallocmEllPKNS_9ae_matrixEPS0_PNS_8ae_stateE(i64 noundef %47, i64 noundef %50, ptr noundef %52, ptr noundef %54, ptr noundef %55)
  br label %62

56:                                               ; preds = %3
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %"struct.alglib_impl::varsfuncjac", ptr %57, i32 0, i32 6
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %"struct.alglib_impl::varsfuncjac", ptr %59, i32 0, i32 6
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_impl13sparsecopybufEPKNS_12sparsematrixEPS0_PNS_8ae_stateE(ptr noundef %58, ptr noundef %60, ptr noundef %61)
  br label %62

62:                                               ; preds = %56, %44
  ret void
}

declare void @_ZN11alglib_impl13sparsecopybufEPKNS_12sparsematrixEPS0_PNS_8ae_stateE(ptr noundef, ptr noundef, ptr noundef) #0

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, !11, i64 0}
!10 = !{!"_ZTSN11alglib_impl11varsfuncjacE", !11, i64 0, !11, i64 8, !12, i64 16, !13, i64 24, !13, i64 88, !15, i64 152, !16, i64 232}
!11 = !{!"long", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!"_ZTSN11alglib_impl9ae_vectorE", !11, i64 0, !11, i64 8, !12, i64 16, !14, i64 24, !7, i64 56}
!14 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!15 = !{!"_ZTSN11alglib_impl9ae_matrixE", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !12, i64 32, !14, i64 40, !7, i64 72}
!16 = !{!"_ZTSN11alglib_impl12sparsematrixE", !13, i64 0, !13, i64 64, !13, i64 128, !13, i64 192, !13, i64 256, !11, i64 320, !11, i64 328, !11, i64 336, !11, i64 344, !11, i64 352, !11, i64 360}
!17 = !{!10, !11, i64 8}
!18 = !{!10, !12, i64 16}
!19 = !{i8 0, i8 2}
!20 = !{}


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

declare void @_ZN11alglib_impl11rcopyallocvElPKNS_9ae_vectorEPS0_PNS_8ae_stateE(i64 noundef, ptr noundef, 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_impl7vfjcopyEPKNS_11varsfuncjacEPS0_PNS_8ae_stateE(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load <2 x i64>, ptr %0, align 8, !tbaa !5
  store <2 x i64> %5, ptr %1, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load i8, ptr %6, align 8, !tbaa !9, !range !17, !noundef !18
  %8 = getelementptr inbounds i8, ptr %1, i64 16
  store i8 %7, ptr %8, align 8, !tbaa !9
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  %10 = getelementptr inbounds i8, ptr %1, i64 24
  %11 = extractelement <2 x i64> %5, i64 0
  tail call void @_ZN11alglib_impl11rcopyallocvElPKNS_9ae_vectorEPS0_PNS_8ae_stateE(i64 noundef %11, ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef %2)
  %12 = load i64, ptr %4, align 8, !tbaa !19
  %13 = getelementptr inbounds i8, ptr %0, i64 88
  %14 = getelementptr inbounds i8, ptr %1, i64 88
  tail call void @_ZN11alglib_impl11rcopyallocvElPKNS_9ae_vectorEPS0_PNS_8ae_stateE(i64 noundef %12, ptr noundef nonnull %13, ptr noundef nonnull %14, ptr noundef %2)
  %15 = load i8, ptr %6, align 8, !tbaa !9, !range !17, !noundef !18
  %16 = trunc nuw i8 %15 to i1
  br i1 %16, label %17, label %22

17:                                               ; preds = %3
  %18 = load i64, ptr %4, align 8, !tbaa !19
  %19 = load i64, ptr %0, align 8, !tbaa !20
  %20 = getelementptr inbounds i8, ptr %0, i64 152
  %21 = getelementptr inbounds i8, ptr %1, i64 152
  tail call void @_ZN11alglib_impl11rcopyallocmEllPKNS_9ae_matrixEPS0_PNS_8ae_stateE(i64 noundef %18, i64 noundef %19, ptr noundef nonnull %20, ptr noundef nonnull %21, ptr noundef %2)
  br label %25

22:                                               ; preds = %3
  %23 = getelementptr inbounds i8, ptr %0, i64 232
  %24 = getelementptr inbounds i8, ptr %1, i64 232
  tail call void @_ZN11alglib_impl13sparsecopybufEPKNS_12sparsematrixEPS0_PNS_8ae_stateE(ptr noundef nonnull %23, ptr noundef nonnull %24, ptr noundef %2)
  br label %25

25:                                               ; preds = %22, %17
  ret void
}

declare void @_ZN11alglib_impl13sparsecopybufEPKNS_12sparsematrixEPS0_PNS_8ae_stateE(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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, !11, i64 16}
!10 = !{!"_ZTSN11alglib_impl11varsfuncjacE", !6, i64 0, !6, i64 8, !11, i64 16, !12, i64 24, !12, i64 88, !15, i64 152, !16, i64 232}
!11 = !{!"bool", !7, i64 0}
!12 = !{!"_ZTSN11alglib_impl9ae_vectorE", !6, i64 0, !6, i64 8, !11, i64 16, !13, i64 24, !7, i64 56}
!13 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!"_ZTSN11alglib_impl9ae_matrixE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !11, i64 32, !13, i64 40, !7, i64 72}
!16 = !{!"_ZTSN11alglib_impl12sparsematrixE", !12, i64 0, !12, i64 64, !12, i64 128, !12, i64 192, !12, i64 256, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!10, !6, i64 8}
!20 = !{!10, !6, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InstCombinePass,SLPVectorizerPass,SROAPass,TailCallElimPass