; LLVM IR from pdeljanov/Ayane :: src/BufferPool.ll (ZN5Ayane17BufferPoolPrivate11preallocateEi)

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

%"class.std::lock_guard" = type { ptr }
%"class.std::shared_ptr.4" = type { %"class.std::__shared_ptr.5" }
%"class.std::__shared_ptr.5" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.2", %"struct.std::_Head_base.3" }
%"struct.std::_Tuple_impl.2" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { %"class.Ayane::ManagedBufferDeallocator" }
%"class.Ayane::ManagedBufferDeallocator" = type { %"class.std::weak_ptr" }
%"class.std::weak_ptr" = type { %"class.std::__weak_ptr" }
%"class.std::__weak_ptr" = type { ptr, %"class.std::__weak_count" }
%"class.std::__weak_count" = type { ptr }
%"struct.std::_Head_base.3" = type { ptr }
%"class.Ayane::BufferPoolPrivate" = type { %"class.Ayane::ManagedBufferOwner", %"class.std::enable_shared_from_this", %"class.std::mutex", %"class.std::stack", i32, %"class.Ayane::BufferFormat", %"class.Ayane::BufferLength", %"class.std::weak_ptr" }
%"class.Ayane::ManagedBufferOwner" = type { ptr }
%"class.std::enable_shared_from_this" = type { %"class.std::weak_ptr.0" }
%"class.std::weak_ptr.0" = type { %"class.std::__weak_ptr.1" }
%"class.std::__weak_ptr.1" = type { ptr, %"class.std::__weak_count" }
%"class.std::mutex" = type { %"class.std::__mutex_base" }
%"class.std::__mutex_base" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::unique_ptr<Ayane::Buffer, Ayane::ManagedBufferDeallocator>, std::allocator<std::unique_ptr<Ayane::Buffer, Ayane::ManagedBufferDeallocator>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::unique_ptr<Ayane::Buffer, Ayane::ManagedBufferDeallocator>, std::allocator<std::unique_ptr<Ayane::Buffer, Ayane::ManagedBufferDeallocator>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::unique_ptr<Ayane::Buffer, Ayane::ManagedBufferDeallocator>, std::allocator<std::unique_ptr<Ayane::Buffer, Ayane::ManagedBufferDeallocator>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::unique_ptr<Ayane::Buffer, Ayane::ManagedBufferDeallocator>, std::allocator<std::unique_ptr<Ayane::Buffer, Ayane::ManagedBufferDeallocator>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"class.Ayane::BufferFormat" = type { i32, i32, i32 }
%"class.Ayane::BufferLength" = type <{ i32, [4 x i8], double, i32, [4 x i8] }>

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

declare noundef ptr @_ZN5Ayane13BufferFactory4makeENS_12SampleFormatERKNS_12BufferFormatERKNS_12BufferLengthE(i32 noundef, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 8 dereferenceable(20)) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt10unique_ptrIN5Ayane6BufferENS0_24ManagedBufferDeallocatorEEC2IS2_vEEPS1_NSt9enable_ifIXntsr19is_lvalue_referenceIT_EE5valueEOS7_E4typeE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt10unique_ptrIN5Ayane6BufferENS0_24ManagedBufferDeallocatorEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5Ayane24ManagedBufferDeallocatorD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5stackISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESt5dequeIS4_SaIS4_EEE4pushEOS4_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5Ayane17BufferPoolPrivate11preallocateEi(ptr noundef nonnull align 8 dereferenceable(200) %0, i32 noundef %1) #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::lock_guard", align 8
  %6 = alloca %"class.std::shared_ptr.4", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca %"class.std::unique_ptr", align 8
  %12 = alloca %"class.Ayane::ManagedBufferDeallocator", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %13 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %14 = getelementptr inbounds %"class.Ayane::BufferPoolPrivate", ptr %13, i32 0, i32 2
  call void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(40) %14)
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #5
  %15 = getelementptr inbounds i8, ptr %13, i64 8
  invoke void @_ZNSt23enable_shared_from_thisIN5Ayane17BufferPoolPrivateEE16shared_from_thisEv(ptr dead_on_unwind writable sret(%"class.std::shared_ptr.4") align 8 %6, ptr noundef nonnull align 8 dereferenceable(16) %15)
          to label %16 unwind label %24

16:                                               ; preds = %2
  %17 = getelementptr inbounds %"class.Ayane::BufferPoolPrivate", ptr %13, i32 0, i32 7
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt8weak_ptrIN5Ayane18ManagedBufferOwnerEEaSINS0_17BufferPoolPrivateEEENSt9enable_ifIXsr13is_assignableIRSt10__weak_ptrIS1_LN9__gnu_cxx12_Lock_policyE2EERKSt10shared_ptrIT_EEE5valueERS2_E4typeESF_(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 8 dereferenceable(16) %6) #5
  call void @_ZNSt12__shared_ptrIN5Ayane17BufferPoolPrivateELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %40, %16
  %20 = load i32, ptr %9, align 4, !tbaa !9
  %21 = load i32, ptr %4, align 4, !tbaa !9
  %22 = icmp slt i32 %20, %21
  br i1 %22, label %28, label %23

23:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %57

24:                                               ; preds = %2
  %25 = landingpad { ptr, i32 }
          cleanup
  %26 = extractvalue { ptr, i32 } %25, 0
  store ptr %26, ptr %7, align 8
  %27 = extractvalue { ptr, i32 } %25, 1
  store i32 %27, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #5
  br label %58

28:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %29 = getelementptr inbounds %"class.Ayane::BufferPoolPrivate", ptr %13, i32 0, i32 4
  %30 = load i32, ptr %29, align 8, !tbaa !11
  %31 = getelementptr inbounds %"class.Ayane::BufferPoolPrivate", ptr %13, i32 0, i32 5
  %32 = getelementptr inbounds %"class.Ayane::BufferPoolPrivate", ptr %13, i32 0, i32 6
  %33 = invoke noundef ptr @_ZN5Ayane13BufferFactory4makeENS_12SampleFormatERKNS_12BufferFormatERKNS_12BufferLengthE(i32 noundef %30, ptr noundef nonnull align 4 dereferenceable(12) %31, ptr noundef nonnull align 8 dereferenceable(20) %32)
          to label %34 unwind label %43

34:                                               ; preds = %28
  store ptr %33, ptr %10, align 8, !tbaa !5
  %35 = getelementptr inbounds %"class.Ayane::BufferPoolPrivate", ptr %13, i32 0, i32 3
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #5
  %36 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #5
  %37 = getelementptr inbounds %"class.Ayane::BufferPoolPrivate", ptr %13, i32 0, i32 7
  invoke void @_ZN5Ayane24ManagedBufferDeallocatorC1ERSt8weak_ptrINS_18ManagedBufferOwnerEE(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) %37)
          to label %38 unwind label %47

38:                                               ; preds = %34
  call void @_ZNSt10unique_ptrIN5Ayane6BufferENS0_24ManagedBufferDeallocatorEEC2IS2_vEEPS1_NSt9enable_ifIXntsr19is_lvalue_referenceIT_EE5valueEOS7_E4typeE(ptr noundef nonnull align 8 dereferenceable(24) %11, ptr noundef %36, ptr noundef nonnull align 8 dereferenceable(16) %12) #5
  invoke void @_ZNSt5stackISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESt5dequeIS4_SaIS4_EEE4pushEOS4_(ptr noundef nonnull align 8 dereferenceable(80) %35, ptr noundef nonnull align 8 dereferenceable(24) %11)
          to label %39 unwind label %51

39:                                               ; preds = %38
  call void @_ZNSt10unique_ptrIN5Ayane6BufferENS0_24ManagedBufferDeallocatorEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #5
  call void @_ZN5Ayane24ManagedBufferDeallocatorD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %40

40:                                               ; preds = %39
  %41 = load i32, ptr %9, align 4, !tbaa !9
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %9, align 4, !tbaa !9
  br label %19, !llvm.loop !34

43:                                               ; preds = %28
  %44 = landingpad { ptr, i32 }
          cleanup
  %45 = extractvalue { ptr, i32 } %44, 0
  store ptr %45, ptr %7, align 8
  %46 = extractvalue { ptr, i32 } %44, 1
  store i32 %46, ptr %8, align 4
  br label %56

47:                                               ; preds = %34
  %48 = landingpad { ptr, i32 }
          cleanup
  %49 = extractvalue { ptr, i32 } %48, 0
  store ptr %49, ptr %7, align 8
  %50 = extractvalue { ptr, i32 } %48, 1
  store i32 %50, ptr %8, align 4
  br label %55

51:                                               ; preds = %38
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %7, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %8, align 4
  call void @_ZNSt10unique_ptrIN5Ayane6BufferENS0_24ManagedBufferDeallocatorEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #5
  call void @_ZN5Ayane24ManagedBufferDeallocatorD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12) #5
  br label %55

55:                                               ; preds = %51, %47
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #5
  br label %56

56:                                               ; preds = %55, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %58

57:                                               ; preds = %23
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  ret void

58:                                               ; preds = %56, %24
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  br label %59

59:                                               ; preds = %58
  %60 = load ptr, ptr %7, align 8
  %61 = load i32, ptr %8, align 4
  %62 = insertvalue { ptr, i32 } poison, ptr %60, 0
  %63 = insertvalue { ptr, i32 } %62, i32 %61, 1
  resume { ptr, i32 } %63
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt23enable_shared_from_thisIN5Ayane17BufferPoolPrivateEE16shared_from_thisEv(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr.4") align 8, ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt8weak_ptrIN5Ayane18ManagedBufferOwnerEEaSINS0_17BufferPoolPrivateEEENSt9enable_ifIXsr13is_assignableIRSt10__weak_ptrIS1_LN9__gnu_cxx12_Lock_policyE2EERKSt10shared_ptrIT_EEE5valueERS2_E4typeESF_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt12__shared_ptrIN5Ayane17BufferPoolPrivateELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

declare void @_ZN5Ayane24ManagedBufferDeallocatorC1ERSt8weak_ptrINS_18ManagedBufferOwnerEE(ptr, ptr)

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = { inlinehint 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 #5 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !27, i64 144}
!12 = !{!"_ZTSN5Ayane17BufferPoolPrivateE", !13, i64 0, !14, i64 8, !18, i64 24, !20, i64 64, !27, i64 144, !28, i64 148, !29, i64 160, !32, i64 184}
!13 = !{!"_ZTSN5Ayane18ManagedBufferOwnerE"}
!14 = !{!"_ZTSSt23enable_shared_from_thisIN5Ayane17BufferPoolPrivateEE", !15, i64 0}
!15 = !{!"_ZTSSt8weak_ptrIN5Ayane17BufferPoolPrivateEE", !16, i64 0}
!16 = !{!"_ZTSSt10__weak_ptrIN5Ayane17BufferPoolPrivateELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !17, i64 8}
!17 = !{!"_ZTSSt12__weak_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!18 = !{!"_ZTSSt5mutex", !19, i64 0}
!19 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!20 = !{!"_ZTSSt5stackISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESt5dequeIS4_SaIS4_EEE", !21, i64 0}
!21 = !{!"_ZTSSt5dequeISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESaIS4_EE", !22, i64 0}
!22 = !{!"_ZTSSt11_Deque_baseISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESaIS4_EE", !23, i64 0}
!23 = !{!"_ZTSNSt11_Deque_baseISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESaIS4_EE11_Deque_implE", !24, i64 0}
!24 = !{!"_ZTSNSt11_Deque_baseISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESaIS4_EE16_Deque_impl_dataE", !6, i64 0, !25, i64 8, !26, i64 16, !26, i64 48}
!25 = !{!"long", !7, i64 0}
!26 = !{!"_ZTSSt15_Deque_iteratorISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEERS4_PS4_E", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!27 = !{!"_ZTSN5Ayane12SampleFormatE", !7, i64 0}
!28 = !{!"_ZTSN5Ayane12BufferFormatE", !10, i64 0, !10, i64 4, !10, i64 8}
!29 = !{!"_ZTSN5Ayane12BufferLengthE", !30, i64 0, !31, i64 8, !10, i64 16}
!30 = !{!"_ZTSN5Ayane12BufferLength11LengthUnitsE", !7, i64 0}
!31 = !{!"double", !7, i64 0}
!32 = !{!"_ZTSSt8weak_ptrIN5Ayane18ManagedBufferOwnerEE", !33, i64 0}
!33 = !{!"_ZTSSt10__weak_ptrIN5Ayane18ManagedBufferOwnerELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !17, i64 8}
!34 = distinct !{!34, !35}
!35 = !{!"llvm.loop.mustprogress"}


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

%"class.std::lock_guard" = type { ptr }
%"class.std::shared_ptr.4" = type { %"class.std::__shared_ptr.5" }
%"class.std::__shared_ptr.5" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.2", %"struct.std::_Head_base.3" }
%"struct.std::_Tuple_impl.2" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { %"class.Ayane::ManagedBufferDeallocator" }
%"class.Ayane::ManagedBufferDeallocator" = type { %"class.std::weak_ptr" }
%"class.std::weak_ptr" = type { %"class.std::__weak_ptr" }
%"class.std::__weak_ptr" = type { ptr, %"class.std::__weak_count" }
%"class.std::__weak_count" = type { ptr }
%"struct.std::_Head_base.3" = type { ptr }

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

declare noundef ptr @_ZN5Ayane13BufferFactory4makeENS_12SampleFormatERKNS_12BufferFormatERKNS_12BufferLengthE(i32 noundef, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 8 dereferenceable(20)) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt10unique_ptrIN5Ayane6BufferENS0_24ManagedBufferDeallocatorEEC2IS2_vEEPS1_NSt9enable_ifIXntsr19is_lvalue_referenceIT_EE5valueEOS7_E4typeE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt10unique_ptrIN5Ayane6BufferENS0_24ManagedBufferDeallocatorEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5Ayane24ManagedBufferDeallocatorD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5stackISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESt5dequeIS4_SaIS4_EEE4pushEOS4_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5Ayane17BufferPoolPrivate11preallocateEi(ptr noundef nonnull align 8 dereferenceable(200) %0, i32 noundef %1) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::lock_guard", align 8
  %4 = alloca %"class.std::shared_ptr.4", align 8
  %5 = alloca %"class.std::unique_ptr", align 8
  %6 = alloca %"class.Ayane::ManagedBufferDeallocator", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  call void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(40) %7)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  invoke void @_ZNSt23enable_shared_from_thisIN5Ayane17BufferPoolPrivateEE16shared_from_thisEv(ptr dead_on_unwind nonnull writable sret(%"class.std::shared_ptr.4") align 8 %4, ptr noundef nonnull align 8 dereferenceable(16) %8)
          to label %9 unwind label %17

9:                                                ; preds = %2
  %10 = getelementptr inbounds i8, ptr %0, i64 184
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt8weak_ptrIN5Ayane18ManagedBufferOwnerEEaSINS0_17BufferPoolPrivateEEENSt9enable_ifIXsr13is_assignableIRSt10__weak_ptrIS1_LN9__gnu_cxx12_Lock_policyE2EERKSt10shared_ptrIT_EEE5valueERS2_E4typeESF_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  call void @_ZNSt12__shared_ptrIN5Ayane17BufferPoolPrivateELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  %12 = icmp sgt i32 %1, 0
  br i1 %12, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %9
  %13 = getelementptr inbounds i8, ptr %0, i64 144
  %14 = getelementptr inbounds i8, ptr %0, i64 148
  %15 = getelementptr inbounds i8, ptr %0, i64 160
  %16 = getelementptr inbounds i8, ptr %0, i64 64
  br label %19

._crit_edge:                                      ; preds = %24, %9
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  ret void

17:                                               ; preds = %2
  %18 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  br label %33

19:                                               ; preds = %.lr.ph, %24
  %.0613 = phi i32 [ 0, %.lr.ph ], [ %25, %24 ]
  %20 = load i32, ptr %13, align 8, !tbaa !5
  %21 = invoke noundef ptr @_ZN5Ayane13BufferFactory4makeENS_12SampleFormatERKNS_12BufferFormatERKNS_12BufferLengthE(i32 noundef %20, ptr noundef nonnull align 4 dereferenceable(12) %14, ptr noundef nonnull align 8 dereferenceable(20) %15)
          to label %22 unwind label %26

22:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #5
  invoke void @_ZN5Ayane24ManagedBufferDeallocatorC1ERSt8weak_ptrINS_18ManagedBufferOwnerEE(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %10)
          to label %23 unwind label %28

23:                                               ; preds = %22
  call void @_ZNSt10unique_ptrIN5Ayane6BufferENS0_24ManagedBufferDeallocatorEEC2IS2_vEEPS1_NSt9enable_ifIXntsr19is_lvalue_referenceIT_EE5valueEOS7_E4typeE(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef %21, ptr noundef nonnull align 8 dereferenceable(16) %6) #5
  invoke void @_ZNSt5stackISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESt5dequeIS4_SaIS4_EEE4pushEOS4_(ptr noundef nonnull align 8 dereferenceable(80) %16, ptr noundef nonnull align 8 dereferenceable(24) %5)
          to label %24 unwind label %30

24:                                               ; preds = %23
  call void @_ZNSt10unique_ptrIN5Ayane6BufferENS0_24ManagedBufferDeallocatorEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #5
  call void @_ZN5Ayane24ManagedBufferDeallocatorD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  %25 = add nuw nsw i32 %.0613, 1
  %exitcond.not = icmp eq i32 %25, %1
  br i1 %exitcond.not, label %._crit_edge, label %19, !llvm.loop !32

26:                                               ; preds = %19
  %27 = landingpad { ptr, i32 }
          cleanup
  br label %33

28:                                               ; preds = %22
  %29 = landingpad { ptr, i32 }
          cleanup
  br label %32

30:                                               ; preds = %23
  %31 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt10unique_ptrIN5Ayane6BufferENS0_24ManagedBufferDeallocatorEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #5
  call void @_ZN5Ayane24ManagedBufferDeallocatorD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #5
  br label %32

32:                                               ; preds = %30, %28
  %.pn = phi { ptr, i32 } [ %31, %30 ], [ %29, %28 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  br label %33

33:                                               ; preds = %26, %32, %17
  %.pn.pn.pn = phi { ptr, i32 } [ %18, %17 ], [ %.pn, %32 ], [ %27, %26 ]
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  resume { ptr, i32 } %.pn.pn.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt23enable_shared_from_thisIN5Ayane17BufferPoolPrivateEE16shared_from_thisEv(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr.4") align 8, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt8weak_ptrIN5Ayane18ManagedBufferOwnerEEaSINS0_17BufferPoolPrivateEEENSt9enable_ifIXsr13is_assignableIRSt10__weak_ptrIS1_LN9__gnu_cxx12_Lock_policyE2EERKSt10shared_ptrIT_EEE5valueERS2_E4typeESF_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt12__shared_ptrIN5Ayane17BufferPoolPrivateELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

declare void @_ZN5Ayane24ManagedBufferDeallocatorC1ERSt8weak_ptrINS_18ManagedBufferOwnerEE(ptr, ptr) local_unnamed_addr

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = { inlinehint 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 #5 = { 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, !24, i64 144}
!6 = !{!"_ZTSN5Ayane17BufferPoolPrivateE", !7, i64 0, !8, i64 8, !15, i64 24, !17, i64 64, !24, i64 144, !25, i64 148, !27, i64 160, !30, i64 184}
!7 = !{!"_ZTSN5Ayane18ManagedBufferOwnerE"}
!8 = !{!"_ZTSSt23enable_shared_from_thisIN5Ayane17BufferPoolPrivateEE", !9, i64 0}
!9 = !{!"_ZTSSt8weak_ptrIN5Ayane17BufferPoolPrivateEE", !10, i64 0}
!10 = !{!"_ZTSSt10__weak_ptrIN5Ayane17BufferPoolPrivateELN9__gnu_cxx12_Lock_policyE2EE", !11, i64 0, !14, i64 8}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"_ZTSSt12__weak_countILN9__gnu_cxx12_Lock_policyE2EE", !11, i64 0}
!15 = !{!"_ZTSSt5mutex", !16, i64 0}
!16 = !{!"_ZTSSt12__mutex_base", !12, i64 0}
!17 = !{!"_ZTSSt5stackISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESt5dequeIS4_SaIS4_EEE", !18, i64 0}
!18 = !{!"_ZTSSt5dequeISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESaIS4_EE", !19, i64 0}
!19 = !{!"_ZTSSt11_Deque_baseISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESaIS4_EE", !20, i64 0}
!20 = !{!"_ZTSNSt11_Deque_baseISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESaIS4_EE11_Deque_implE", !21, i64 0}
!21 = !{!"_ZTSNSt11_Deque_baseISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESaIS4_EE16_Deque_impl_dataE", !11, i64 0, !22, i64 8, !23, i64 16, !23, i64 48}
!22 = !{!"long", !12, i64 0}
!23 = !{!"_ZTSSt15_Deque_iteratorISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEERS4_PS4_E", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!24 = !{!"_ZTSN5Ayane12SampleFormatE", !12, i64 0}
!25 = !{!"_ZTSN5Ayane12BufferFormatE", !26, i64 0, !26, i64 4, !26, i64 8}
!26 = !{!"int", !12, i64 0}
!27 = !{!"_ZTSN5Ayane12BufferLengthE", !28, i64 0, !29, i64 8, !26, i64 16}
!28 = !{!"_ZTSN5Ayane12BufferLength11LengthUnitsE", !12, i64 0}
!29 = !{!"double", !12, i64 0}
!30 = !{!"_ZTSSt8weak_ptrIN5Ayane18ManagedBufferOwnerEE", !31, i64 0}
!31 = !{!"_ZTSSt10__weak_ptrIN5Ayane18ManagedBufferOwnerELN9__gnu_cxx12_Lock_policyE2EE", !11, i64 0, !14, i64 8}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass