; LLVM IR from venumb/ZSPACE :: cpp/depends/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::spline2dbuilder" = type { i64, double, i64, double, double, double, double, i64, i64, i64, double, i64, i64, double, %"struct.alglib_impl::ae_vector", i64, i64, double, double, i8, 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 }

@.str.744 = external hidden unnamed_addr constant [28 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_impl21spline2dbuildercreateElPNS_15spline2dbuilderEPNS_8ae_stateE(i64 noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  store i64 %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !9
  %7 = load ptr, ptr %5, align 8, !tbaa !9
  call void @_ZN11alglib_impl22_spline2dbuilder_clearEPv(ptr noundef %7)
  %8 = load i64, ptr %4, align 8, !tbaa !5
  %9 = icmp sge i64 %8, 1
  %10 = load ptr, ptr %6, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %9, ptr noundef @.str.744, ptr noundef %10)
  %11 = load ptr, ptr %5, align 8, !tbaa !9
  %12 = getelementptr inbounds %"struct.alglib_impl::spline2dbuilder", ptr %11, i32 0, i32 0
  store i64 1, ptr %12, align 8, !tbaa !11
  %13 = load ptr, ptr %5, align 8, !tbaa !9
  %14 = getelementptr inbounds %"struct.alglib_impl::spline2dbuilder", ptr %13, i32 0, i32 1
  store double 0.000000e+00, ptr %14, align 8, !tbaa !17
  %15 = load ptr, ptr %5, align 8, !tbaa !9
  %16 = getelementptr inbounds %"struct.alglib_impl::spline2dbuilder", ptr %15, i32 0, i32 2
  store i64 0, ptr %16, align 8, !tbaa !18
  %17 = load ptr, ptr %5, align 8, !tbaa !9
  %18 = getelementptr inbounds %"struct.alglib_impl::spline2dbuilder", ptr %17, i32 0, i32 7
  store i64 0, ptr %18, align 8, !tbaa !19
  %19 = load ptr, ptr %5, align 8, !tbaa !9
  %20 = getelementptr inbounds %"struct.alglib_impl::spline2dbuilder", ptr %19, i32 0, i32 10
  store double 0.000000e+00, ptr %20, align 8, !tbaa !20
  %21 = load ptr, ptr %5, align 8, !tbaa !9
  %22 = getelementptr inbounds %"struct.alglib_impl::spline2dbuilder", ptr %21, i32 0, i32 11
  store i64 0, ptr %22, align 8, !tbaa !21
  %23 = load ptr, ptr %5, align 8, !tbaa !9
  %24 = getelementptr inbounds %"struct.alglib_impl::spline2dbuilder", ptr %23, i32 0, i32 12
  store i64 1, ptr %24, align 8, !tbaa !22
  %25 = load ptr, ptr %5, align 8, !tbaa !9
  %26 = getelementptr inbounds %"struct.alglib_impl::spline2dbuilder", ptr %25, i32 0, i32 15
  store i64 0, ptr %26, align 8, !tbaa !23
  %27 = load i64, ptr %4, align 8, !tbaa !5
  %28 = load ptr, ptr %5, align 8, !tbaa !9
  %29 = getelementptr inbounds %"struct.alglib_impl::spline2dbuilder", ptr %28, i32 0, i32 16
  store i64 %27, ptr %29, align 8, !tbaa !24
  %30 = load ptr, ptr %5, align 8, !tbaa !9
  %31 = getelementptr inbounds %"struct.alglib_impl::spline2dbuilder", ptr %30, i32 0, i32 17
  store double 1.000000e+00, ptr %31, align 8, !tbaa !25
  %32 = load ptr, ptr %5, align 8, !tbaa !9
  %33 = getelementptr inbounds %"struct.alglib_impl::spline2dbuilder", ptr %32, i32 0, i32 18
  store double 1.000000e+00, ptr %33, align 8, !tbaa !26
  %34 = load ptr, ptr %5, align 8, !tbaa !9
  %35 = getelementptr inbounds %"struct.alglib_impl::spline2dbuilder", ptr %34, i32 0, i32 21
  store i64 5, ptr %35, align 8, !tbaa !27
  %36 = load ptr, ptr %5, align 8, !tbaa !9
  %37 = getelementptr inbounds %"struct.alglib_impl::spline2dbuilder", ptr %36, i32 0, i32 19
  store i8 1, ptr %37, align 8, !tbaa !28
  %38 = load ptr, ptr %5, align 8, !tbaa !9
  %39 = getelementptr inbounds %"struct.alglib_impl::spline2dbuilder", ptr %38, i32 0, i32 22
  store i64 16, ptr %39, align 8, !tbaa !29
  %40 = load ptr, ptr %5, align 8, !tbaa !9
  %41 = getelementptr inbounds %"struct.alglib_impl::spline2dbuilder", ptr %40, i32 0, i32 20
  store i64 5, ptr %41, align 8, !tbaa !30
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl22_spline2dbuilder_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 0}
!12 = !{!"_ZTSN11alglib_impl15spline2dbuilderE", !6, i64 0, !13, i64 8, !6, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !13, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !13, i64 80, !6, i64 88, !6, i64 96, !13, i64 104, !14, i64 112, !6, i64 176, !6, i64 184, !13, i64 192, !13, i64 200, !15, i64 208, !6, i64 216, !6, i64 224, !6, i64 232}
!13 = !{!"double", !7, i64 0}
!14 = !{!"_ZTSN11alglib_impl9ae_vectorE", !6, i64 0, !6, i64 8, !15, i64 16, !16, i64 24, !7, i64 56}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!17 = !{!12, !13, i64 8}
!18 = !{!12, !6, i64 16}
!19 = !{!12, !6, i64 56}
!20 = !{!12, !13, i64 80}
!21 = !{!12, !6, i64 88}
!22 = !{!12, !6, i64 96}
!23 = !{!12, !6, i64 176}
!24 = !{!12, !6, i64 184}
!25 = !{!12, !13, i64 192}
!26 = !{!12, !13, i64 200}
!27 = !{!12, !6, i64 224}
!28 = !{!12, !15, i64 208}
!29 = !{!12, !6, i64 232}
!30 = !{!12, !6, i64 216}


; 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.744 = external hidden unnamed_addr constant [28 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_impl21spline2dbuildercreateElPNS_15spline2dbuilderEPNS_8ae_stateE(i64 noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  tail call void @_ZN11alglib_impl22_spline2dbuilder_clearEPv(ptr noundef %1)
  %4 = icmp sgt i64 %0, 0
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %4, ptr noundef nonnull @.str.744, ptr noundef %2)
  store i64 1, ptr %1, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 8
  %6 = getelementptr inbounds i8, ptr %1, i64 56
  store i64 0, ptr %6, align 8, !tbaa !15
  %7 = getelementptr inbounds i8, ptr %1, i64 80
  %8 = getelementptr inbounds i8, ptr %1, i64 96
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %5, i8 0, i64 16, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %7, i8 0, i64 16, i1 false)
  store i64 1, ptr %8, align 8, !tbaa !16
  %9 = getelementptr inbounds i8, ptr %1, i64 176
  store i64 0, ptr %9, align 8, !tbaa !17
  %10 = getelementptr inbounds i8, ptr %1, i64 184
  store i64 %0, ptr %10, align 8, !tbaa !18
  %11 = getelementptr inbounds i8, ptr %1, i64 192
  store <2 x double> <double 1.000000e+00, double 1.000000e+00>, ptr %11, align 8, !tbaa !19
  %12 = getelementptr inbounds i8, ptr %1, i64 224
  store i64 5, ptr %12, align 8, !tbaa !20
  %13 = getelementptr inbounds i8, ptr %1, i64 208
  store i8 1, ptr %13, align 8, !tbaa !21
  %14 = getelementptr inbounds i8, ptr %1, i64 232
  store i64 16, ptr %14, align 8, !tbaa !22
  %15 = getelementptr inbounds i8, ptr %1, i64 216
  store i64 5, ptr %15, align 8, !tbaa !23
  ret void
}

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

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

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" }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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_impl15spline2dbuilderE", !7, i64 0, !10, i64 8, !7, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !10, i64 80, !7, i64 88, !7, i64 96, !10, i64 104, !11, i64 112, !7, i64 176, !7, i64 184, !10, i64 192, !10, i64 200, !12, i64 208, !7, i64 216, !7, i64 224, !7, i64 232}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"_ZTSN11alglib_impl9ae_vectorE", !7, i64 0, !7, 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 56}
!16 = !{!6, !7, i64 96}
!17 = !{!6, !7, i64 176}
!18 = !{!6, !7, i64 184}
!19 = !{!10, !10, i64 0}
!20 = !{!6, !7, i64 224}
!21 = !{!6, !12, i64 208}
!22 = !{!6, !7, i64 232}
!23 = !{!6, !7, i64 216}


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