; LLVM IR from venumb/ZSPACE :: cpp/depends/alglib/cpp/src (ap)

; 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_shared_pool" = type { %"struct.alglib_impl::ae_lock", ptr, ptr, ptr, ptr, i64, ptr, ptr, ptr, %"struct.alglib_impl::ae_dyn_block" }
%"struct.alglib_impl::ae_lock" = type { ptr, %"struct.alglib_impl::ae_dyn_block", i8 }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, ptr, ptr, ptr }
%"struct.alglib_impl::ae_smart_ptr" = type { ptr, ptr, i8, i8, ptr, %"struct.alglib_impl::ae_dyn_block" }
%"struct.alglib_impl::ae_shared_pool_entry" = type { ptr, ptr }

@.str.23 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [49 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @abort() #0

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11alglib_impl20ae_smart_ptr_releaseEPNS_12ae_smart_ptrE(ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11alglib_impl15ae_acquire_lockEPNS_7ae_lockE(ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11alglib_impl15ae_release_lockEPNS_7ae_lockE(ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl22ae_shared_pool_recycleEPNS_14ae_shared_poolEPNS_12ae_smart_ptrEPNS_8ae_stateE(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %8 = load ptr, ptr %6, align 8, !tbaa !5
  %9 = icmp ne ptr %8, null
  br i1 %9, label %11, label %10

10:                                               ; preds = %3
  call void @abort() #5
  unreachable

11:                                               ; preds = %3
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool", ptr %12, i32 0, i32 1
  %14 = load volatile ptr, ptr %13, align 8, !tbaa !9
  %15 = icmp ne ptr %14, null
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %15, ptr noundef @.str.23, ptr noundef %16)
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %17, i32 0, i32 2
  %19 = load i8, ptr %18, align 8, !tbaa !15, !range !17, !noundef !18
  %20 = trunc i8 %19 to i1
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %20, ptr noundef @.str.24, ptr noundef %21)
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %22, i32 0, i32 1
  %24 = load ptr, ptr %23, align 8, !tbaa !19
  %25 = icmp ne ptr %24, null
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %25, ptr noundef @.str.25, ptr noundef %26)
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool", ptr %27, i32 0, i32 0
  call void @_ZN11alglib_impl15ae_acquire_lockEPNS_7ae_lockE(ptr noundef %28)
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool", ptr %29, i32 0, i32 3
  %31 = load volatile ptr, ptr %30, align 8, !tbaa !20
  %32 = icmp ne ptr %31, null
  br i1 %32, label %33, label %42

33:                                               ; preds = %11
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool", ptr %34, i32 0, i32 3
  %36 = load volatile ptr, ptr %35, align 8, !tbaa !20
  store ptr %36, ptr %7, align 8, !tbaa !5
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool_entry", ptr %37, i32 0, i32 1
  %39 = load volatile ptr, ptr %38, align 8, !tbaa !21
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool", ptr %40, i32 0, i32 3
  store volatile ptr %39, ptr %41, align 8, !tbaa !20
  br label %49

42:                                               ; preds = %11
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool", ptr %43, i32 0, i32 0
  call void @_ZN11alglib_impl15ae_release_lockEPNS_7ae_lockE(ptr noundef %44)
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = call noundef ptr @_ZN11alglib_impl9ae_mallocEmPNS_8ae_stateE(i64 noundef 16, ptr noundef %45)
  store ptr %46, ptr %7, align 8, !tbaa !5
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool", ptr %47, i32 0, i32 0
  call void @_ZN11alglib_impl15ae_acquire_lockEPNS_7ae_lockE(ptr noundef %48)
  br label %49

49:                                               ; preds = %42, %33
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %50, i32 0, i32 1
  %52 = load ptr, ptr %51, align 8, !tbaa !19
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool_entry", ptr %53, i32 0, i32 0
  store volatile ptr %52, ptr %54, align 8, !tbaa !23
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool", ptr %55, i32 0, i32 2
  %57 = load volatile ptr, ptr %56, align 8, !tbaa !24
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool_entry", ptr %58, i32 0, i32 1
  store volatile ptr %57, ptr %59, align 8, !tbaa !21
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool", ptr %61, i32 0, i32 2
  store volatile ptr %60, ptr %62, align 8, !tbaa !24
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %"struct.alglib_impl::ae_shared_pool", ptr %63, i32 0, i32 0
  call void @_ZN11alglib_impl15ae_release_lockEPNS_7ae_lockE(ptr noundef %64)
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN11alglib_impl20ae_smart_ptr_releaseEPNS_12ae_smart_ptrE(ptr noundef %65)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret void
}

attributes #0 = { noreturn nounwind "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #3 = { mustprogress nounwind 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 }
attributes #5 = { noreturn 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, !6, i64 48}
!10 = !{!"_ZTSN11alglib_impl14ae_shared_poolE", !11, i64 0, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !14, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !12, i64 112}
!11 = !{!"_ZTSN11alglib_impl7ae_lockE", !6, i64 0, !12, i64 8, !13, i64 40}
!12 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!16, !13, i64 16}
!16 = !{!"_ZTSN11alglib_impl12ae_smart_ptrE", !6, i64 0, !6, i64 8, !13, i64 16, !13, i64 17, !6, i64 24, !12, i64 32}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!16, !6, i64 8}
!20 = !{!10, !6, i64 64}
!21 = !{!22, !6, i64 8}
!22 = !{!"_ZTSN11alglib_impl20ae_shared_pool_entryE", !6, i64 0, !6, i64 8}
!23 = !{!22, !6, i64 0}
!24 = !{!10, !6, i64 56}


; 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.23 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [49 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11alglib_impl20ae_smart_ptr_releaseEPNS_12ae_smart_ptrE(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11alglib_impl15ae_acquire_lockEPNS_7ae_lockE(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11alglib_impl15ae_release_lockEPNS_7ae_lockE(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl22ae_shared_pool_recycleEPNS_14ae_shared_poolEPNS_12ae_smart_ptrEPNS_8ae_stateE(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %4, label %5

4:                                                ; preds = %3
  tail call void @abort() #3
  unreachable

5:                                                ; preds = %3
  %6 = getelementptr inbounds i8, ptr %0, i64 48
  %7 = load volatile ptr, ptr %6, align 8, !tbaa !5
  %8 = icmp ne ptr %7, null
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %8, ptr noundef nonnull @.str.23, ptr noundef nonnull %2)
  %9 = getelementptr inbounds i8, ptr %1, i64 16
  %10 = load i8, ptr %9, align 8, !tbaa !14, !range !16, !noundef !17
  %11 = trunc nuw i8 %10 to i1
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %11, ptr noundef nonnull @.str.24, ptr noundef nonnull %2)
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  %13 = load ptr, ptr %12, align 8, !tbaa !18
  %14 = icmp ne ptr %13, null
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %14, ptr noundef nonnull @.str.25, ptr noundef nonnull %2)
  tail call void @_ZN11alglib_impl15ae_acquire_lockEPNS_7ae_lockE(ptr noundef %0)
  %15 = getelementptr inbounds i8, ptr %0, i64 64
  %16 = load volatile ptr, ptr %15, align 8, !tbaa !19
  %.not24 = icmp eq ptr %16, null
  br i1 %.not24, label %21, label %17

17:                                               ; preds = %5
  %18 = load volatile ptr, ptr %15, align 8, !tbaa !19
  %19 = getelementptr inbounds i8, ptr %18, i64 8
  %20 = load volatile ptr, ptr %19, align 8, !tbaa !20
  store volatile ptr %20, ptr %15, align 8, !tbaa !19
  br label %23

21:                                               ; preds = %5
  tail call void @_ZN11alglib_impl15ae_release_lockEPNS_7ae_lockE(ptr noundef nonnull %0)
  %22 = tail call noundef ptr @_ZN11alglib_impl9ae_mallocEmPNS_8ae_stateE(i64 noundef 16, ptr noundef nonnull %2)
  tail call void @_ZN11alglib_impl15ae_acquire_lockEPNS_7ae_lockE(ptr noundef nonnull %0)
  br label %23

23:                                               ; preds = %21, %17
  %.0 = phi ptr [ %18, %17 ], [ %22, %21 ]
  %24 = load ptr, ptr %12, align 8, !tbaa !18
  store volatile ptr %24, ptr %.0, align 8, !tbaa !22
  %25 = getelementptr inbounds i8, ptr %0, i64 56
  %26 = load volatile ptr, ptr %25, align 8, !tbaa !23
  %27 = getelementptr inbounds i8, ptr %.0, i64 8
  store volatile ptr %26, ptr %27, align 8, !tbaa !20
  store volatile ptr %.0, ptr %25, align 8, !tbaa !23
  tail call void @_ZN11alglib_impl15ae_release_lockEPNS_7ae_lockE(ptr noundef nonnull %0)
  tail call void @_ZN11alglib_impl20ae_smart_ptr_releaseEPNS_12ae_smart_ptrE(ptr noundef nonnull %1)
  ret void
}

attributes #0 = { noreturn nounwind "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 = { mustprogress nounwind 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 #3 = { noreturn 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, !8, i64 48}
!6 = !{!"_ZTSN11alglib_impl14ae_shared_poolE", !7, i64 0, !8, i64 48, !8, i64 56, !8, i64 64, !8, i64 72, !13, i64 80, !8, i64 88, !8, i64 96, !8, i64 104, !11, i64 112}
!7 = !{!"_ZTSN11alglib_impl7ae_lockE", !8, i64 0, !11, i64 8, !12, i64 40}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24}
!12 = !{!"bool", !9, i64 0}
!13 = !{!"long", !9, i64 0}
!14 = !{!15, !12, i64 16}
!15 = !{!"_ZTSN11alglib_impl12ae_smart_ptrE", !8, i64 0, !8, i64 8, !12, i64 16, !12, i64 17, !8, i64 24, !11, i64 32}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!15, !8, i64 8}
!19 = !{!6, !8, i64 64}
!20 = !{!21, !8, i64 8}
!21 = !{!"_ZTSN11alglib_impl20ae_shared_pool_entryE", !8, i64 0, !8, i64 8}
!22 = !{!21, !8, i64 0}
!23 = !{!6, !8, i64 56}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass