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

@.str.719 = external hidden unnamed_addr constant [35 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 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) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

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

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

declare noundef double @_ZN11alglib_impl6ae_powEddPNS_8ae_stateE(double noundef, double noundef, ptr noundef) #1

declare noundef zeroext i1 @_ZN11alglib_impl16ae_fp_greater_eqEdd(double noundef, double noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl14bhpanelsetprecEPNS_15biharmonicpanelEdPNS_8ae_stateE(ptr noundef %0, double noundef %1, ptr noundef %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %9 = load double, ptr %5, align 8, !tbaa !9
  %10 = load ptr, ptr %6, align 8, !tbaa !5
  %11 = call noundef zeroext i1 @_ZN11alglib_impl11ae_isfiniteEdPNS_8ae_stateE(double noundef %9, ptr noundef %10)
  br i1 %11, label %12, label %15

12:                                               ; preds = %3
  %13 = load double, ptr %5, align 8, !tbaa !9
  %14 = call noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef %13, double noundef 0.000000e+00)
  br label %15

15:                                               ; preds = %12, %3
  %16 = phi i1 [ false, %3 ], [ %14, %12 ]
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %16, ptr noundef @.str.719, ptr noundef %17)
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %"struct.alglib_impl::biharmonicpanel", ptr %18, i32 0, i32 3
  %20 = load double, ptr %19, align 8, !tbaa !11
  store double %20, ptr %8, align 8, !tbaa !9
  br label %21

21:                                               ; preds = %57, %15
  %22 = load double, ptr %8, align 8, !tbaa !9
  %23 = call double @llvm.fmuladd.f64(double 1.050000e+00, double %22, double 5.000000e-16)
  store double %23, ptr %8, align 8, !tbaa !9
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.alglib_impl::biharmonicpanel", ptr %24, i32 0, i32 17
  %26 = load double, ptr %25, align 8, !tbaa !17
  %27 = load double, ptr %8, align 8, !tbaa !9
  %28 = fmul double %26, %27
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %"struct.alglib_impl::biharmonicpanel", ptr %29, i32 0, i32 6
  %31 = load i64, ptr %30, align 8, !tbaa !18
  %32 = mul nsw i64 2, %31
  %33 = add nsw i64 %32, 1
  %34 = sitofp i64 %33 to double
  %35 = fdiv double 2.000000e+00, %34
  %36 = fmul double %28, %35
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.alglib_impl::biharmonicpanel", ptr %37, i32 0, i32 3
  %39 = load double, ptr %38, align 8, !tbaa !11
  %40 = load double, ptr %8, align 8, !tbaa !9
  %41 = fdiv double %39, %40
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %"struct.alglib_impl::biharmonicpanel", ptr %42, i32 0, i32 6
  %44 = load i64, ptr %43, align 8, !tbaa !18
  %45 = add nsw i64 %44, 1
  %46 = sitofp i64 %45 to double
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = call noundef double @_ZN11alglib_impl6ae_powEddPNS_8ae_stateE(double noundef %41, double noundef %46, ptr noundef %47)
  %49 = fmul double %36, %48
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %"struct.alglib_impl::biharmonicpanel", ptr %50, i32 0, i32 3
  %52 = load double, ptr %51, align 8, !tbaa !11
  %53 = load double, ptr %8, align 8, !tbaa !9
  %54 = fdiv double %52, %53
  %55 = fsub double 1.000000e+00, %54
  %56 = fdiv double %49, %55
  store double %56, ptr %7, align 8, !tbaa !9
  br label %57

57:                                               ; preds = %21
  %58 = load double, ptr %7, align 8, !tbaa !9
  %59 = load double, ptr %5, align 8, !tbaa !9
  %60 = call noundef zeroext i1 @_ZN11alglib_impl16ae_fp_greater_eqEdd(double noundef %58, double noundef %59)
  br i1 %60, label %21, label %61, !llvm.loop !19

61:                                               ; preds = %57
  %62 = load double, ptr %8, align 8, !tbaa !9
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %"struct.alglib_impl::biharmonicpanel", ptr %63, i32 0, i32 4
  store double %62, ptr %64, align 8, !tbaa !21
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 nosync nounwind speculatable willreturn memory(none) }
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, !10, i64 24}
!12 = !{!"_ZTSN11alglib_impl15biharmonicpanelE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !13, i64 40, !13, i64 48, !13, i64 56, !13, i64 64, !13, i64 72, !13, i64 80, !14, i64 88, !14, i64 152, !14, i64 216, !14, i64 280, !14, i64 344, !14, i64 408, !10, i64 472, !14, i64 480, !14, i64 544}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_ZTSN11alglib_impl9ae_vectorE", !13, i64 0, !13, i64 8, !15, i64 16, !16, i64 24, !7, i64 56}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!17 = !{!12, !10, i64 472}
!18 = !{!12, !13, i64 48}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!12, !10, i64 32}


; 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.719 = external hidden unnamed_addr constant [35 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 nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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

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

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

declare noundef zeroext i1 @_ZN11alglib_impl16ae_fp_greater_eqEdd(double noundef, double noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl14bhpanelsetprecEPNS_15biharmonicpanelEdPNS_8ae_stateE(ptr nocapture noundef %0, double noundef %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = tail call noundef zeroext i1 @_ZN11alglib_impl11ae_isfiniteEdPNS_8ae_stateE(double noundef %1, ptr noundef %2)
  br i1 %4, label %5, label %7

5:                                                ; preds = %3
  %6 = tail call noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef %1, double noundef 0.000000e+00)
  br label %7

7:                                                ; preds = %5, %3
  %8 = phi i1 [ false, %3 ], [ %6, %5 ]
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %8, ptr noundef nonnull @.str.719, ptr noundef %2)
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  %10 = load double, ptr %9, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 472
  %12 = getelementptr inbounds i8, ptr %0, i64 48
  br label %13

13:                                               ; preds = %13, %7
  %.0 = phi double [ %10, %7 ], [ %14, %13 ]
  %14 = tail call double @llvm.fmuladd.f64(double %.0, double 1.050000e+00, double 5.000000e-16)
  %15 = load double, ptr %11, align 8, !tbaa !15
  %16 = fmul double %15, %14
  %17 = load i64, ptr %12, align 8, !tbaa !16
  %18 = shl nsw i64 %17, 1
  %19 = or disjoint i64 %18, 1
  %20 = sitofp i64 %19 to double
  %21 = fdiv double 2.000000e+00, %20
  %22 = fmul double %16, %21
  %23 = load double, ptr %9, align 8, !tbaa !5
  %24 = fdiv double %23, %14
  %25 = add nsw i64 %17, 1
  %26 = sitofp i64 %25 to double
  %27 = tail call noundef double @_ZN11alglib_impl6ae_powEddPNS_8ae_stateE(double noundef %24, double noundef %26, ptr noundef %2)
  %28 = fmul double %27, %22
  %29 = load double, ptr %9, align 8, !tbaa !5
  %30 = fdiv double %29, %14
  %31 = fsub double 1.000000e+00, %30
  %32 = fdiv double %28, %31
  %33 = tail call noundef zeroext i1 @_ZN11alglib_impl16ae_fp_greater_eqEdd(double noundef %32, double noundef %1)
  br i1 %33, label %13, label %34, !llvm.loop !17

34:                                               ; preds = %13
  %35 = getelementptr inbounds i8, ptr %0, i64 32
  store double %14, ptr %35, align 8, !tbaa !19
  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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 24}
!6 = !{!"_ZTSN11alglib_impl15biharmonicpanelE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !11, i64 88, !11, i64 152, !11, i64 216, !11, i64 280, !11, i64 344, !11, i64 408, !7, i64 472, !11, i64 480, !11, i64 544}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"_ZTSN11alglib_impl9ae_vectorE", !10, i64 0, !10, i64 8, !12, i64 16, !13, i64 24, !8, i64 56}
!12 = !{!"bool", !8, i64 0}
!13 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{!6, !7, i64 472}
!16 = !{!6, !10, i64 48}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!6, !7, i64 32}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass