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

; 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::idwbuilder" = type { i64, %"struct.alglib_impl::ae_vector", i64, i64, double, double, double, double, double, double, i8, i64, double, %"struct.alglib_impl::ae_vector", i64, i64, i64, %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::kdtree", %"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::kdtree" = type { i64, i64, i64, 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::kdtreerequestbuffer", i64 }
%"struct.alglib_impl::kdtreerequestbuffer" = type { %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", i64, double, i8, double, i64, %"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", double, %"struct.alglib_impl::ae_vector" }
%"struct.alglib_impl::ae_vector" = type { i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon.0 }
%union.anon.0 = type { ptr }

@.str.128 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.129 = external hidden unnamed_addr constant [24 x i8], align 1
@_ZN11alglib_implL18idw_defaultnlayersE = external hidden global i64, align 8
@_ZN11alglib_implL18idw_defaultlambda0E = external hidden global double, align 8

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl16idwbuildercreateEllPNS_10idwbuilderEPNS_8ae_stateE(i64 noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3) #1 {
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  store i64 %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !9
  %9 = load ptr, ptr %7, align 8, !tbaa !9
  call void @_ZN11alglib_impl17_idwbuilder_clearEPv(ptr noundef %9)
  %10 = load i64, ptr %5, align 8, !tbaa !5
  %11 = icmp sge i64 %10, 1
  %12 = load ptr, ptr %8, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %11, ptr noundef @.str.128, ptr noundef %12)
  %13 = load i64, ptr %6, align 8, !tbaa !5
  %14 = icmp sge i64 %13, 1
  %15 = load ptr, ptr %8, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %14, ptr noundef @.str.129, ptr noundef %15)
  %16 = load ptr, ptr %7, align 8, !tbaa !9
  %17 = getelementptr inbounds %"struct.alglib_impl::idwbuilder", ptr %16, i32 0, i32 2
  store i64 2, ptr %17, align 8, !tbaa !11
  %18 = load ptr, ptr %7, align 8, !tbaa !9
  %19 = getelementptr inbounds %"struct.alglib_impl::idwbuilder", ptr %18, i32 0, i32 0
  store i64 2, ptr %19, align 8, !tbaa !20
  %20 = load ptr, ptr %7, align 8, !tbaa !9
  %21 = getelementptr inbounds %"struct.alglib_impl::idwbuilder", ptr %20, i32 0, i32 1
  %22 = load i64, ptr %6, align 8, !tbaa !5
  %23 = load ptr, ptr %8, align 8, !tbaa !9
  call void @_ZN11alglib_impl23rvectorsetlengthatleastEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %21, i64 noundef %22, ptr noundef %23)
  %24 = load i64, ptr @_ZN11alglib_implL18idw_defaultnlayersE, align 8, !tbaa !5
  %25 = load ptr, ptr %7, align 8, !tbaa !9
  %26 = getelementptr inbounds %"struct.alglib_impl::idwbuilder", ptr %25, i32 0, i32 3
  store i64 %24, ptr %26, align 8, !tbaa !21
  %27 = load ptr, ptr %7, align 8, !tbaa !9
  %28 = getelementptr inbounds %"struct.alglib_impl::idwbuilder", ptr %27, i32 0, i32 4
  store double 0.000000e+00, ptr %28, align 8, !tbaa !22
  %29 = load ptr, ptr %7, align 8, !tbaa !9
  %30 = getelementptr inbounds %"struct.alglib_impl::idwbuilder", ptr %29, i32 0, i32 5
  store double 5.000000e-01, ptr %30, align 8, !tbaa !23
  %31 = load double, ptr @_ZN11alglib_implL18idw_defaultlambda0E, align 8, !tbaa !24
  %32 = load ptr, ptr %7, align 8, !tbaa !9
  %33 = getelementptr inbounds %"struct.alglib_impl::idwbuilder", ptr %32, i32 0, i32 6
  store double %31, ptr %33, align 8, !tbaa !25
  %34 = load ptr, ptr %7, align 8, !tbaa !9
  %35 = getelementptr inbounds %"struct.alglib_impl::idwbuilder", ptr %34, i32 0, i32 7
  store double 0.000000e+00, ptr %35, align 8, !tbaa !26
  %36 = load ptr, ptr %7, align 8, !tbaa !9
  %37 = getelementptr inbounds %"struct.alglib_impl::idwbuilder", ptr %36, i32 0, i32 8
  store double 1.000000e+00, ptr %37, align 8, !tbaa !27
  %38 = load ptr, ptr %7, align 8, !tbaa !9
  %39 = getelementptr inbounds %"struct.alglib_impl::idwbuilder", ptr %38, i32 0, i32 10
  store i8 0, ptr %39, align 8, !tbaa !28
  %40 = load ptr, ptr %7, align 8, !tbaa !9
  %41 = getelementptr inbounds %"struct.alglib_impl::idwbuilder", ptr %40, i32 0, i32 9
  store double 0.000000e+00, ptr %41, align 8, !tbaa !29
  %42 = load ptr, ptr %7, align 8, !tbaa !9
  %43 = getelementptr inbounds %"struct.alglib_impl::idwbuilder", ptr %42, i32 0, i32 14
  store i64 0, ptr %43, align 8, !tbaa !30
  %44 = load i64, ptr %5, align 8, !tbaa !5
  %45 = load ptr, ptr %7, align 8, !tbaa !9
  %46 = getelementptr inbounds %"struct.alglib_impl::idwbuilder", ptr %45, i32 0, i32 15
  store i64 %44, ptr %46, align 8, !tbaa !31
  %47 = load i64, ptr %6, align 8, !tbaa !5
  %48 = load ptr, ptr %7, align 8, !tbaa !9
  %49 = getelementptr inbounds %"struct.alglib_impl::idwbuilder", ptr %48, i32 0, i32 16
  store i64 %47, ptr %49, align 8, !tbaa !32
  %50 = load ptr, ptr %7, align 8, !tbaa !9
  %51 = getelementptr inbounds %"struct.alglib_impl::idwbuilder", ptr %50, i32 0, i32 12
  store double 0.000000e+00, ptr %51, align 8, !tbaa !33
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl17_idwbuilder_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 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 72}
!12 = !{!"_ZTSN11alglib_impl10idwbuilderE", !6, i64 0, !13, i64 8, !6, i64 72, !6, i64 80, !16, i64 88, !16, i64 96, !16, i64 104, !16, i64 112, !16, i64 120, !16, i64 128, !14, i64 136, !6, i64 144, !16, i64 152, !13, i64 160, !6, i64 224, !6, i64 232, !6, i64 240, !17, i64 248, !17, i64 328, !13, i64 408, !13, i64 472, !18, i64 536, !13, i64 1600}
!13 = !{!"_ZTSN11alglib_impl9ae_vectorE", !6, i64 0, !6, i64 8, !14, i64 16, !15, i64 24, !7, i64 56}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!16 = !{!"double", !7, i64 0}
!17 = !{!"_ZTSN11alglib_impl9ae_matrixE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !14, i64 32, !15, i64 40, !7, i64 72}
!18 = !{!"_ZTSN11alglib_impl6kdtreeE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !17, i64 32, !13, i64 112, !13, i64 176, !13, i64 240, !13, i64 304, !13, i64 368, !19, i64 432, !6, i64 1056}
!19 = !{!"_ZTSN11alglib_impl19kdtreerequestbufferE", !13, i64 0, !13, i64 64, !13, i64 128, !6, i64 192, !16, i64 200, !14, i64 208, !16, i64 216, !6, i64 224, !13, i64 232, !13, i64 296, !13, i64 360, !13, i64 424, !13, i64 488, !16, i64 552, !13, i64 560}
!20 = !{!12, !6, i64 0}
!21 = !{!12, !6, i64 80}
!22 = !{!12, !16, i64 88}
!23 = !{!12, !16, i64 96}
!24 = !{!16, !16, i64 0}
!25 = !{!12, !16, i64 104}
!26 = !{!12, !16, i64 112}
!27 = !{!12, !16, i64 120}
!28 = !{!12, !14, i64 136}
!29 = !{!12, !16, i64 128}
!30 = !{!12, !6, i64 224}
!31 = !{!12, !6, i64 232}
!32 = !{!12, !6, i64 240}
!33 = !{!12, !16, i64 152}


; 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.128 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.129 = external hidden unnamed_addr constant [24 x i8], align 1
@_ZN11alglib_implL18idw_defaultnlayersE = external hidden local_unnamed_addr global i64, align 8
@_ZN11alglib_implL18idw_defaultlambda0E = external hidden local_unnamed_addr global double, align 8

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_impl16idwbuildercreateEllPNS_10idwbuilderEPNS_8ae_stateE(i64 noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #1 {
  tail call void @_ZN11alglib_impl17_idwbuilder_clearEPv(ptr noundef %2)
  %5 = icmp sgt i64 %0, 0
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %5, ptr noundef nonnull @.str.128, ptr noundef %3)
  %6 = icmp sgt i64 %1, 0
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %6, ptr noundef nonnull @.str.129, ptr noundef %3)
  %7 = getelementptr inbounds i8, ptr %2, i64 72
  store i64 2, ptr %7, align 8, !tbaa !5
  store i64 2, ptr %2, align 8, !tbaa !18
  %8 = getelementptr inbounds i8, ptr %2, i64 8
  tail call void @_ZN11alglib_impl23rvectorsetlengthatleastEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef nonnull %8, i64 noundef %1, ptr noundef %3)
  %9 = load i64, ptr @_ZN11alglib_implL18idw_defaultnlayersE, align 8, !tbaa !19
  %10 = getelementptr inbounds i8, ptr %2, i64 80
  store i64 %9, ptr %10, align 8, !tbaa !20
  %11 = getelementptr inbounds i8, ptr %2, i64 88
  store <2 x double> <double 0.000000e+00, double 5.000000e-01>, ptr %11, align 8, !tbaa !21
  %12 = load double, ptr @_ZN11alglib_implL18idw_defaultlambda0E, align 8, !tbaa !21
  %13 = getelementptr inbounds i8, ptr %2, i64 104
  store double %12, ptr %13, align 8, !tbaa !22
  %14 = getelementptr inbounds i8, ptr %2, i64 112
  store <2 x double> <double 0.000000e+00, double 1.000000e+00>, ptr %14, align 8, !tbaa !21
  %15 = getelementptr inbounds i8, ptr %2, i64 136
  store i8 0, ptr %15, align 8, !tbaa !23
  %16 = getelementptr inbounds i8, ptr %2, i64 128
  store double 0.000000e+00, ptr %16, align 8, !tbaa !24
  %17 = getelementptr inbounds i8, ptr %2, i64 224
  store i64 0, ptr %17, align 8, !tbaa !25
  %18 = getelementptr inbounds i8, ptr %2, i64 232
  store i64 %0, ptr %18, align 8, !tbaa !26
  %19 = getelementptr inbounds i8, ptr %2, i64 240
  store i64 %1, ptr %19, align 8, !tbaa !27
  %20 = getelementptr inbounds i8, ptr %2, i64 152
  store double 0.000000e+00, ptr %20, align 8, !tbaa !28
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl17_idwbuilder_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 72}
!6 = !{!"_ZTSN11alglib_impl10idwbuilderE", !7, i64 0, !10, i64 8, !7, i64 72, !7, i64 80, !14, i64 88, !14, i64 96, !14, i64 104, !14, i64 112, !14, i64 120, !14, i64 128, !11, i64 136, !7, i64 144, !14, i64 152, !10, i64 160, !7, i64 224, !7, i64 232, !7, i64 240, !15, i64 248, !15, i64 328, !10, i64 408, !10, i64 472, !16, i64 536, !10, i64 1600}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN11alglib_impl9ae_vectorE", !7, i64 0, !7, i64 8, !11, i64 16, !12, i64 24, !8, i64 56}
!11 = !{!"bool", !8, i64 0}
!12 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!"double", !8, i64 0}
!15 = !{!"_ZTSN11alglib_impl9ae_matrixE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !11, i64 32, !12, i64 40, !8, i64 72}
!16 = !{!"_ZTSN11alglib_impl6kdtreeE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !15, i64 32, !10, i64 112, !10, i64 176, !10, i64 240, !10, i64 304, !10, i64 368, !17, i64 432, !7, i64 1056}
!17 = !{!"_ZTSN11alglib_impl19kdtreerequestbufferE", !10, i64 0, !10, i64 64, !10, i64 128, !7, i64 192, !14, i64 200, !11, i64 208, !14, i64 216, !7, i64 224, !10, i64 232, !10, i64 296, !10, i64 360, !10, i64 424, !10, i64 488, !14, i64 552, !10, i64 560}
!18 = !{!6, !7, i64 0}
!19 = !{!7, !7, i64 0}
!20 = !{!6, !7, i64 80}
!21 = !{!14, !14, i64 0}
!22 = !{!6, !14, i64 104}
!23 = !{!6, !11, i64 136}
!24 = !{!6, !14, i64 128}
!25 = !{!6, !7, i64 224}
!26 = !{!6, !7, i64 232}
!27 = !{!6, !7, i64 240}
!28 = !{!6, !14, i64 152}


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