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

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

@.str.75 = external hidden unnamed_addr constant [39 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; 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) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl16_hqrndstate_initEPvPNS_8ae_stateEb(ptr noundef, ptr noundef, i1 noundef zeroext) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl9hqrndseedEllPNS_10hqrndstateEPNS_8ae_stateE(i64 noundef, i64 noundef, ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN11alglib_impl13hqrnduniformiEPNS_10hqrndstateElPNS_8ae_stateE(ptr noundef, i64 noundef, ptr noundef) #3

declare void @_ZN11alglib_impl13ae_frame_makeEPNS_8ae_stateEPNS_8ae_frameE(ptr noundef, ptr noundef) #2

declare void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef) #2

declare noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef, double noundef) #2

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

declare noundef double @_ZN11alglib_impl6ae_logEdPNS_8ae_stateE(double noundef, ptr noundef) #2

declare noundef zeroext i1 @_ZN11alglib_impl11ae_isfiniteEdPNS_8ae_stateE(double noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden noundef i64 @_ZN11alglib_implL26nearestneighbor_tsqueryrnnEPKNS_6kdtreeEPNS_19kdtreerequestbufferEPKNS_9ae_vectorEdbbPNS_8ae_stateE(ptr noundef, ptr noundef, ptr noundef, double noundef, i1 noundef zeroext, i1 noundef zeroext, ptr noundef) #3

declare noundef i64 @_ZN11alglib_impl9ae_minintEllPNS_8ae_stateE(i64 noundef, i64 noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN11alglib_impl26kdtreetsapproxrnnquerycostEPKNS_6kdtreeEPNS_19kdtreerequestbufferEdPNS_8ae_stateE(ptr noundef %0, ptr noundef %1, double noundef %2, ptr noundef %3) #3 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %"struct.alglib_impl::ae_frame", align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca %"struct.alglib_impl::hqrndstate", align 8
  %18 = alloca double, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store double %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl13ae_frame_makeEPNS_8ae_stateEPNS_8ae_frameE(ptr noundef %19, ptr noundef %9)
  call void @llvm.memset.p0.i64(ptr align 8 %17, i8 0, i64 24, i1 false)
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl16_hqrndstate_initEPvPNS_8ae_stateEb(ptr noundef %17, ptr noundef %20, i1 noundef zeroext true)
  %21 = load double, ptr %7, align 8, !tbaa !9
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = call noundef zeroext i1 @_ZN11alglib_impl11ae_isfiniteEdPNS_8ae_stateE(double noundef %21, ptr noundef %22)
  br i1 %23, label %24, label %27

24:                                               ; preds = %4
  %25 = load double, ptr %7, align 8, !tbaa !9
  %26 = call noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef %25, double noundef 0.000000e+00)
  br label %27

27:                                               ; preds = %24, %4
  %28 = phi i1 [ false, %4 ], [ %26, %24 ]
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %28, ptr noundef @.str.75, ptr noundef %29)
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl9hqrndseedEllPNS_10hqrndstateEPNS_8ae_stateE(i64 noundef 46532, i64 noundef 66356, ptr noundef %17, ptr noundef %30)
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %"struct.alglib_impl::kdtree", ptr %31, i32 0, i32 1
  %33 = load i64, ptr %32, align 8, !tbaa !11
  store i64 %33, ptr %14, align 8, !tbaa !19
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %"struct.alglib_impl::kdtree", ptr %34, i32 0, i32 0
  %36 = load i64, ptr %35, align 8, !tbaa !20
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  %38 = call noundef i64 @_ZN11alglib_impl9ae_minintEllPNS_8ae_stateE(i64 noundef 50, i64 noundef %36, ptr noundef %37)
  store i64 %38, ptr %13, align 8, !tbaa !19
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %"struct.alglib_impl::kdtree", ptr %39, i32 0, i32 0
  %41 = load i64, ptr %40, align 8, !tbaa !20
  %42 = add nsw i64 1, %41
  %43 = sitofp i64 %42 to double
  %44 = load ptr, ptr %8, align 8, !tbaa !5
  %45 = call noundef double @_ZN11alglib_impl6ae_logEdPNS_8ae_stateE(double noundef %43, ptr noundef %44)
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = call noundef double @_ZN11alglib_impl6ae_logEdPNS_8ae_stateE(double noundef 2.000000e+00, ptr noundef %46)
  %48 = fdiv double %45, %47
  store double %48, ptr %15, align 8, !tbaa !9
  store double 0.000000e+00, ptr %16, align 8, !tbaa !9
  %49 = load i64, ptr %14, align 8, !tbaa !19
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %"struct.alglib_impl::kdtreerequestbuffer", ptr %50, i32 0, i32 14
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl7rallocvElPNS_9ae_vectorEPNS_8ae_stateE(i64 noundef %49, ptr noundef %51, ptr noundef %52)
  store i64 0, ptr %10, align 8, !tbaa !19
  br label %53

53:                                               ; preds = %105, %27
  %54 = load i64, ptr %10, align 8, !tbaa !19
  %55 = load i64, ptr %13, align 8, !tbaa !19
  %56 = sub nsw i64 %55, 1
  %57 = icmp sle i64 %54, %56
  br i1 %57, label %58, label %108

58:                                               ; preds = %53
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %"struct.alglib_impl::kdtree", ptr %59, i32 0, i32 0
  %61 = load i64, ptr %60, align 8, !tbaa !20
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  %63 = call noundef i64 @_ZN11alglib_impl13hqrnduniformiEPNS_10hqrndstateElPNS_8ae_stateE(ptr noundef %17, i64 noundef %61, ptr noundef %62)
  store i64 %63, ptr %12, align 8, !tbaa !19
  store i64 0, ptr %11, align 8, !tbaa !19
  br label %64

64:                                               ; preds = %88, %58
  %65 = load i64, ptr %11, align 8, !tbaa !19
  %66 = load i64, ptr %14, align 8, !tbaa !19
  %67 = sub nsw i64 %66, 1
  %68 = icmp sle i64 %65, %67
  br i1 %68, label %69, label %91

69:                                               ; preds = %64
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds %"struct.alglib_impl::kdtree", ptr %70, i32 0, i32 4
  %72 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %71, i32 0, i32 6
  %73 = load ptr, ptr %72, align 8, !tbaa !21
  %74 = load i64, ptr %12, align 8, !tbaa !19
  %75 = getelementptr inbounds ptr, ptr %73, i64 %74
  %76 = load ptr, ptr %75, align 8, !tbaa !5
  %77 = load i64, ptr %14, align 8, !tbaa !19
  %78 = load i64, ptr %11, align 8, !tbaa !19
  %79 = add nsw i64 %77, %78
  %80 = getelementptr inbounds double, ptr %76, i64 %79
  %81 = load double, ptr %80, align 8, !tbaa !9
  %82 = load ptr, ptr %6, align 8, !tbaa !5
  %83 = getelementptr inbounds %"struct.alglib_impl::kdtreerequestbuffer", ptr %82, i32 0, i32 14
  %84 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %83, i32 0, i32 4
  %85 = load ptr, ptr %84, align 8, !tbaa !21
  %86 = load i64, ptr %11, align 8, !tbaa !19
  %87 = getelementptr inbounds double, ptr %85, i64 %86
  store double %81, ptr %87, align 8, !tbaa !9
  br label %88

88:                                               ; preds = %69
  %89 = load i64, ptr %11, align 8, !tbaa !19
  %90 = add nsw i64 %89, 1
  store i64 %90, ptr %11, align 8, !tbaa !19
  br label %64, !llvm.loop !22

91:                                               ; preds = %64
  %92 = load double, ptr %16, align 8, !tbaa !9
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = load ptr, ptr %6, align 8, !tbaa !5
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = getelementptr inbounds %"struct.alglib_impl::kdtreerequestbuffer", ptr %95, i32 0, i32 14
  %97 = load double, ptr %7, align 8, !tbaa !9
  %98 = load ptr, ptr %8, align 8, !tbaa !5
  %99 = call noundef i64 @_ZN11alglib_implL26nearestneighbor_tsqueryrnnEPKNS_6kdtreeEPNS_19kdtreerequestbufferEPKNS_9ae_vectorEdbbPNS_8ae_stateE(ptr noundef %93, ptr noundef %94, ptr noundef %96, double noundef %97, i1 noundef zeroext true, i1 noundef zeroext false, ptr noundef %98)
  %100 = sitofp i64 %99 to double
  %101 = load i64, ptr %13, align 8, !tbaa !19
  %102 = sitofp i64 %101 to double
  %103 = fdiv double %100, %102
  %104 = fadd double %92, %103
  store double %104, ptr %16, align 8, !tbaa !9
  br label %105

105:                                              ; preds = %91
  %106 = load i64, ptr %10, align 8, !tbaa !19
  %107 = add nsw i64 %106, 1
  store i64 %107, ptr %10, align 8, !tbaa !19
  br label %53, !llvm.loop !24

108:                                              ; preds = %53
  %109 = load double, ptr %16, align 8, !tbaa !9
  %110 = load double, ptr %15, align 8, !tbaa !9
  %111 = fmul double %109, %110
  %112 = fmul double %111, 1.500000e+01
  store double %112, ptr %18, align 8, !tbaa !9
  %113 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef %113)
  %114 = load double, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #4
  ret double %114
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { "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 = { 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 #4 = { 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, !13, i64 8}
!12 = !{!"_ZTSN11alglib_impl6kdtreeE", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !14, i64 32, !17, i64 112, !17, i64 176, !17, i64 240, !17, i64 304, !17, i64 368, !18, i64 432, !13, i64 1056}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_ZTSN11alglib_impl9ae_matrixE", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !15, i64 32, !16, i64 40, !7, i64 72}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!17 = !{!"_ZTSN11alglib_impl9ae_vectorE", !13, i64 0, !13, i64 8, !15, i64 16, !16, i64 24, !7, i64 56}
!18 = !{!"_ZTSN11alglib_impl19kdtreerequestbufferE", !17, i64 0, !17, i64 64, !17, i64 128, !13, i64 192, !10, i64 200, !15, i64 208, !10, i64 216, !13, i64 224, !17, i64 232, !17, i64 296, !17, i64 360, !17, i64 424, !17, i64 488, !10, i64 552, !17, i64 560}
!19 = !{!13, !13, i64 0}
!20 = !{!12, !13, i64 0}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}


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

%"struct.alglib_impl::ae_frame" = type { %"struct.alglib_impl::ae_dyn_block" }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, ptr, ptr, ptr }
%"struct.alglib_impl::hqrndstate" = type { i64, i64, i64 }

@.str.75 = external hidden unnamed_addr constant [39 x i8], align 1

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

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

; Function Attrs: mustprogress 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) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl16_hqrndstate_initEPvPNS_8ae_stateEb(ptr noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl9hqrndseedEllPNS_10hqrndstateEPNS_8ae_stateE(i64 noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN11alglib_impl13hqrnduniformiEPNS_10hqrndstateElPNS_8ae_stateE(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #3

declare void @_ZN11alglib_impl13ae_frame_makeEPNS_8ae_stateEPNS_8ae_frameE(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef) local_unnamed_addr #2

declare noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef, double noundef) local_unnamed_addr #2

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

declare noundef double @_ZN11alglib_impl6ae_logEdPNS_8ae_stateE(double noundef, ptr noundef) local_unnamed_addr #2

declare noundef zeroext i1 @_ZN11alglib_impl11ae_isfiniteEdPNS_8ae_stateE(double noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden noundef i64 @_ZN11alglib_implL26nearestneighbor_tsqueryrnnEPKNS_6kdtreeEPNS_19kdtreerequestbufferEPKNS_9ae_vectorEdbbPNS_8ae_stateE(ptr noundef, ptr noundef, ptr noundef, double noundef, i1 noundef zeroext, i1 noundef zeroext, ptr noundef) local_unnamed_addr #3

declare noundef i64 @_ZN11alglib_impl9ae_minintEllPNS_8ae_stateE(i64 noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN11alglib_impl26kdtreetsapproxrnnquerycostEPKNS_6kdtreeEPNS_19kdtreerequestbufferEdPNS_8ae_stateE(ptr noundef %0, ptr noundef %1, double noundef %2, ptr noundef %3) local_unnamed_addr #3 {
  %5 = alloca %"struct.alglib_impl::ae_frame", align 8
  %6 = alloca %"struct.alglib_impl::hqrndstate", align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #4
  call void @_ZN11alglib_impl13ae_frame_makeEPNS_8ae_stateEPNS_8ae_frameE(ptr noundef %3, ptr noundef nonnull %5)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %6, i8 0, i64 24, i1 false)
  call void @_ZN11alglib_impl16_hqrndstate_initEPvPNS_8ae_stateEb(ptr noundef nonnull %6, ptr noundef %3, i1 noundef zeroext true)
  %7 = call noundef zeroext i1 @_ZN11alglib_impl11ae_isfiniteEdPNS_8ae_stateE(double noundef %2, ptr noundef %3)
  br i1 %7, label %8, label %10

8:                                                ; preds = %4
  %9 = call noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef %2, double noundef 0.000000e+00)
  br label %10

10:                                               ; preds = %8, %4
  %11 = phi i1 [ false, %4 ], [ %9, %8 ]
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %11, ptr noundef nonnull @.str.75, ptr noundef %3)
  call void @_ZN11alglib_impl9hqrndseedEllPNS_10hqrndstateEPNS_8ae_stateE(i64 noundef 46532, i64 noundef 66356, ptr noundef nonnull %6, ptr noundef %3)
  %12 = getelementptr inbounds i8, ptr %0, i64 8
  %13 = load i64, ptr %12, align 8, !tbaa !5
  %.fr = freeze i64 %13
  %14 = load i64, ptr %0, align 8, !tbaa !17
  %15 = call noundef i64 @_ZN11alglib_impl9ae_minintEllPNS_8ae_stateE(i64 noundef 50, i64 noundef %14, ptr noundef %3)
  %16 = load i64, ptr %0, align 8, !tbaa !17
  %17 = add nsw i64 %16, 1
  %18 = sitofp i64 %17 to double
  %19 = call noundef double @_ZN11alglib_impl6ae_logEdPNS_8ae_stateE(double noundef %18, ptr noundef %3)
  %20 = call noundef double @_ZN11alglib_impl6ae_logEdPNS_8ae_stateE(double noundef 2.000000e+00, ptr noundef %3)
  %21 = getelementptr inbounds i8, ptr %1, i64 560
  call void @_ZN11alglib_impl7rallocvElPNS_9ae_vectorEPNS_8ae_stateE(i64 noundef %.fr, ptr noundef nonnull %21, ptr noundef %3)
  %.not.not45 = icmp sgt i64 %15, 0
  br i1 %.not.not45, label %.lr.ph49, label %._crit_edge50

.lr.ph49:                                         ; preds = %10
  %.not.not4243 = icmp sgt i64 %.fr, 0
  %22 = getelementptr inbounds i8, ptr %0, i64 104
  %23 = getelementptr inbounds i8, ptr %1, i64 616
  %24 = uitofp nneg i64 %15 to double
  br i1 %.not.not4243, label %.lr.ph.us.preheader, label %.lr.ph49.split

.lr.ph.us.preheader:                              ; preds = %.lr.ph49
  %xtraiter = and i64 %.fr, 1
  %25 = icmp eq i64 %.fr, 1
  %unroll_iter = and i64 %.fr, 9223372036854775806
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.lr.ph.us

.lr.ph.us:                                        ; preds = %.lr.ph.us.preheader, %._crit_edge.us
  %.047.us = phi i64 [ %58, %._crit_edge.us ], [ 0, %.lr.ph.us.preheader ]
  %.04046.us = phi double [ %57, %._crit_edge.us ], [ 0.000000e+00, %.lr.ph.us.preheader ]
  %26 = load i64, ptr %0, align 8, !tbaa !17
  %27 = call noundef i64 @_ZN11alglib_impl13hqrnduniformiEPNS_10hqrndstateElPNS_8ae_stateE(ptr noundef nonnull %6, i64 noundef %26, ptr noundef %3)
  br i1 %25, label %._crit_edge.us.unr-lcssa, label %.lr.ph.us.new

.lr.ph.us.new:                                    ; preds = %.lr.ph.us, %.lr.ph.us.new
  %.04144.us = phi i64 [ %45, %.lr.ph.us.new ], [ 0, %.lr.ph.us ]
  %niter = phi i64 [ %niter.next.1, %.lr.ph.us.new ], [ 0, %.lr.ph.us ]
  %28 = load ptr, ptr %22, align 8, !tbaa !18
  %29 = getelementptr inbounds ptr, ptr %28, i64 %27
  %30 = load ptr, ptr %29, align 8, !tbaa !19
  %31 = getelementptr double, ptr %30, i64 %.fr
  %32 = getelementptr double, ptr %31, i64 %.04144.us
  %33 = load double, ptr %32, align 8, !tbaa !20
  %34 = load ptr, ptr %23, align 8, !tbaa !18
  %35 = getelementptr inbounds double, ptr %34, i64 %.04144.us
  store double %33, ptr %35, align 8, !tbaa !20
  %36 = or disjoint i64 %.04144.us, 1
  %37 = load ptr, ptr %22, align 8, !tbaa !18
  %38 = getelementptr inbounds ptr, ptr %37, i64 %27
  %39 = load ptr, ptr %38, align 8, !tbaa !19
  %40 = getelementptr double, ptr %39, i64 %.fr
  %41 = getelementptr double, ptr %40, i64 %36
  %42 = load double, ptr %41, align 8, !tbaa !20
  %43 = load ptr, ptr %23, align 8, !tbaa !18
  %44 = getelementptr inbounds double, ptr %43, i64 %36
  store double %42, ptr %44, align 8, !tbaa !20
  %45 = add nuw nsw i64 %.04144.us, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.us.unr-lcssa, label %.lr.ph.us.new, !llvm.loop !21

._crit_edge.us.unr-lcssa:                         ; preds = %.lr.ph.us.new, %.lr.ph.us
  %.04144.us.unr = phi i64 [ 0, %.lr.ph.us ], [ %45, %.lr.ph.us.new ]
  br i1 %lcmp.mod.not, label %._crit_edge.us, label %._crit_edge.us.epilog-lcssa

._crit_edge.us.epilog-lcssa:                      ; preds = %._crit_edge.us.unr-lcssa
  %46 = load ptr, ptr %22, align 8, !tbaa !18
  %47 = getelementptr inbounds ptr, ptr %46, i64 %27
  %48 = load ptr, ptr %47, align 8, !tbaa !19
  %49 = getelementptr double, ptr %48, i64 %.fr
  %50 = getelementptr double, ptr %49, i64 %.04144.us.unr
  %51 = load double, ptr %50, align 8, !tbaa !20
  %52 = load ptr, ptr %23, align 8, !tbaa !18
  %53 = getelementptr inbounds double, ptr %52, i64 %.04144.us.unr
  store double %51, ptr %53, align 8, !tbaa !20
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %._crit_edge.us.unr-lcssa, %._crit_edge.us.epilog-lcssa
  %54 = call noundef i64 @_ZN11alglib_implL26nearestneighbor_tsqueryrnnEPKNS_6kdtreeEPNS_19kdtreerequestbufferEPKNS_9ae_vectorEdbbPNS_8ae_stateE(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %21, double noundef %2, i1 noundef zeroext true, i1 noundef zeroext false, ptr noundef %3)
  %55 = sitofp i64 %54 to double
  %56 = fdiv double %55, %24
  %57 = fadd double %.04046.us, %56
  %58 = add nuw nsw i64 %.047.us, 1
  %exitcond54.not = icmp eq i64 %58, %15
  br i1 %exitcond54.not, label %._crit_edge50, label %.lr.ph.us, !llvm.loop !23

.lr.ph49.split:                                   ; preds = %.lr.ph49, %.lr.ph49.split
  %.047 = phi i64 [ %65, %.lr.ph49.split ], [ 0, %.lr.ph49 ]
  %.04046 = phi double [ %64, %.lr.ph49.split ], [ 0.000000e+00, %.lr.ph49 ]
  %59 = load i64, ptr %0, align 8, !tbaa !17
  %60 = call noundef i64 @_ZN11alglib_impl13hqrnduniformiEPNS_10hqrndstateElPNS_8ae_stateE(ptr noundef nonnull %6, i64 noundef %59, ptr noundef %3)
  %61 = call noundef i64 @_ZN11alglib_implL26nearestneighbor_tsqueryrnnEPKNS_6kdtreeEPNS_19kdtreerequestbufferEPKNS_9ae_vectorEdbbPNS_8ae_stateE(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %21, double noundef %2, i1 noundef zeroext true, i1 noundef zeroext false, ptr noundef %3)
  %62 = sitofp i64 %61 to double
  %63 = fdiv double %62, %24
  %64 = fadd double %.04046, %63
  %65 = add nuw nsw i64 %.047, 1
  %exitcond.not = icmp eq i64 %65, %15
  br i1 %exitcond.not, label %._crit_edge50, label %.lr.ph49.split, !llvm.loop !23

._crit_edge50:                                    ; preds = %.lr.ph49.split, %._crit_edge.us, %10
  %.040.lcssa = phi double [ 0.000000e+00, %10 ], [ %57, %._crit_edge.us ], [ %64, %.lr.ph49.split ]
  %66 = fdiv double %19, %20
  %67 = fmul double %66, %.040.lcssa
  %68 = fmul double %67, 1.500000e+01
  call void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef %3)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #4
  ret double %68
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { "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 = { 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 #4 = { 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, !7, i64 8}
!6 = !{!"_ZTSN11alglib_impl6kdtreeE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !14, i64 112, !14, i64 176, !14, i64 240, !14, i64 304, !14, i64 368, !15, i64 432, !7, i64 1056}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN11alglib_impl9ae_matrixE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !11, i64 32, !12, i64 40, !8, i64 72}
!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 = !{!"_ZTSN11alglib_impl9ae_vectorE", !7, i64 0, !7, i64 8, !11, i64 16, !12, i64 24, !8, i64 56}
!15 = !{!"_ZTSN11alglib_impl19kdtreerequestbufferE", !14, i64 0, !14, i64 64, !14, i64 128, !7, i64 192, !16, i64 200, !11, i64 208, !16, i64 216, !7, i64 224, !14, i64 232, !14, i64 296, !14, i64 360, !14, i64 424, !14, i64 488, !16, i64 552, !14, i64 560}
!16 = !{!"double", !8, i64 0}
!17 = !{!6, !7, i64 0}
!18 = !{!8, !8, i64 0}
!19 = !{!13, !13, i64 0}
!20 = !{!16, !16, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass