; LLVM IR from khushmmehta/Scorch-V :: src/ScorchVkEngine/Abstractions (VulkanMemoryAllocator)

; 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.VmaMutexLockWrite = type { ptr }
%class.VmaBlockVector = type <{ ptr, ptr, i32, [4 x i8], i64, i64, i64, i64, i8, [3 x i8], i32, float, [4 x i8], i64, ptr, %class.VmaRWMutex, %class.VmaVector.15, i32, i8, [3 x i8] }>
%class.VmaRWMutex = type { %"class.std::shared_mutex" }
%"class.std::shared_mutex" = type { %"class.std::__shared_mutex_pthread" }
%"class.std::__shared_mutex_pthread" = type { %union.pthread_rwlock_t }
%union.pthread_rwlock_t = type { %struct.__pthread_rwlock_arch_t }
%struct.__pthread_rwlock_arch_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i8, [7 x i8], i64, i32 }
%class.VmaVector.15 = type { %struct.VmaStlAllocator.16, ptr, i64, i64 }
%struct.VmaStlAllocator.16 = type { ptr }
%struct.VmaAllocator_T = type <{ i8, [3 x i8], i32, i8, i8, i8, i8, i8, i8, [2 x i8], ptr, ptr, i8, [7 x i8], %struct.VkAllocationCallbacks, %struct.VmaDeviceMemoryCallbacks, %class.VmaAllocationObjectAllocator, i32, [4 x i8], %struct.VkPhysicalDeviceProperties, %struct.VkPhysicalDeviceMemoryProperties, [32 x ptr], [32 x %class.VmaDedicatedAllocationList], %struct.VmaCurrentBudgetData, %"struct.std::atomic", [4 x i8], i64, ptr, %"struct.std::atomic", %"struct.std::atomic", [32 x i32], %class.VmaRWMutex, %class.VmaIntrusiveLinkedList.14, i32, [4 x i8], %struct.VmaVulkanFunctions, i32, [4 x i8] }>
%struct.VkAllocationCallbacks = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.VmaDeviceMemoryCallbacks = type { ptr, ptr, ptr }
%class.VmaAllocationObjectAllocator = type { %class.VmaMutex, %class.VmaPoolAllocator.11 }
%class.VmaMutex = type { %"class.std::mutex" }
%"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.VmaPoolAllocator.11 = type { ptr, i32, %class.VmaVector.12 }
%class.VmaVector.12 = type { %struct.VmaStlAllocator.13, ptr, i64, i64 }
%struct.VmaStlAllocator.13 = type { ptr }
%struct.VkPhysicalDeviceProperties = type { i32, i32, i32, i32, i32, [256 x i8], [16 x i8], %struct.VkPhysicalDeviceLimits, %struct.VkPhysicalDeviceSparseProperties }
%struct.VkPhysicalDeviceLimits = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [3 x i32], i32, [3 x i32], i32, i32, i32, i32, i32, float, float, i32, [2 x i32], [2 x float], i32, i64, i64, i64, i64, i32, i32, i32, i32, float, float, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, i32, i32, i32, i32, [2 x float], [2 x float], float, float, i32, i32, i64, i64, i64 }
%struct.VkPhysicalDeviceSparseProperties = type { i32, i32, i32, i32, i32 }
%struct.VkPhysicalDeviceMemoryProperties = type { i32, [32 x %struct.VkMemoryType], i32, [16 x %struct.VkMemoryHeap] }
%struct.VkMemoryType = type { i32, i32 }
%struct.VkMemoryHeap = type { i64, i32 }
%class.VmaDedicatedAllocationList = type { i8, %class.VmaRWMutex, %class.VmaIntrusiveLinkedList }
%class.VmaIntrusiveLinkedList = type { ptr, ptr, i64 }
%struct.VmaCurrentBudgetData = type { [16 x %"struct.std::atomic"], [16 x %"struct.std::atomic"], [16 x %"struct.std::atomic.9"], [16 x %"struct.std::atomic.9"], %"struct.std::atomic", %class.VmaRWMutex, [16 x i64], [16 x i64], [16 x i64] }
%"struct.std::atomic.9" = type { %"struct.std::__atomic_base.10" }
%"struct.std::__atomic_base.10" = type { i64 }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%class.VmaIntrusiveLinkedList.14 = type { ptr, ptr, i64 }
%struct.VmaVulkanFunctions = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

; 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 i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17VmaMutexLockWriteC2ER10VmaRWMutexb(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(56), i1 noundef zeroext) unnamed_addr #1 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZL10VmaAlignUpImET_S0_S0_(i64 noundef, i64 noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK14VmaBlockVector28IsCorruptionDetectionEnabledEv(ptr noundef nonnull align 8 dereferenceable(181)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN14VmaBlockVector8AllocateEmmRK23VmaAllocationCreateInfo20VmaSuballocationTypemPP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(181) %0, i64 noundef %1, i64 noundef %2, ptr noundef nonnull align 8 dereferenceable(48) %3, i32 noundef %4, i64 noundef %5, ptr noundef %6) #1 align 2 personality ptr @__gxx_personality_v0 {
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca %struct.VmaMutexLockWrite, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i64 %1, ptr %9, align 8, !tbaa !9
  store i64 %2, ptr %10, align 8, !tbaa !9
  store ptr %3, ptr %11, align 8, !tbaa !5
  store i32 %4, ptr %12, align 4, !tbaa !11
  store i64 %5, ptr %13, align 8, !tbaa !9
  store ptr %6, ptr %14, align 8, !tbaa !5
  %20 = load ptr, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !13
  %21 = getelementptr inbounds %class.VmaBlockVector, ptr %20, i32 0, i32 13
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %21)
  %23 = load i64, ptr %22, align 8, !tbaa !9
  store i64 %23, ptr %10, align 8, !tbaa !9
  %24 = call noundef zeroext i1 @_ZNK14VmaBlockVector28IsCorruptionDetectionEnabledEv(ptr noundef nonnull align 8 dereferenceable(181) %20)
  br i1 %24, label %25, label %30

25:                                               ; preds = %7
  %26 = load i64, ptr %9, align 8, !tbaa !9
  %27 = call noundef i64 @_ZL10VmaAlignUpImET_S0_S0_(i64 noundef %26, i64 noundef 4)
  store i64 %27, ptr %9, align 8, !tbaa !9
  %28 = load i64, ptr %10, align 8, !tbaa !9
  %29 = call noundef i64 @_ZL10VmaAlignUpImET_S0_S0_(i64 noundef %28, i64 noundef 4)
  store i64 %29, ptr %10, align 8, !tbaa !9
  br label %30

30:                                               ; preds = %25, %7
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %31 = getelementptr inbounds %class.VmaBlockVector, ptr %20, i32 0, i32 15
  %32 = getelementptr inbounds %class.VmaBlockVector, ptr %20, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8, !tbaa !15
  %34 = getelementptr inbounds %struct.VmaAllocator_T, ptr %33, i32 0, i32 0
  %35 = load i8, ptr %34, align 8, !tbaa !25, !range !46, !noundef !47
  %36 = trunc i8 %35 to i1
  call void @_ZN17VmaMutexLockWriteC2ER10VmaRWMutexb(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(56) %31, i1 noundef zeroext %36)
  store i64 0, ptr %15, align 8, !tbaa !9
  br label %37

37:                                               ; preds = %59, %30
  %38 = load i64, ptr %15, align 8, !tbaa !9
  %39 = load i64, ptr %13, align 8, !tbaa !9
  %40 = icmp ult i64 %38, %39
  br i1 %40, label %41, label %62

41:                                               ; preds = %37
  %42 = load i64, ptr %9, align 8, !tbaa !9
  %43 = load i64, ptr %10, align 8, !tbaa !9
  %44 = load ptr, ptr %11, align 8, !tbaa !5
  %45 = load i32, ptr %12, align 4, !tbaa !11
  %46 = load ptr, ptr %14, align 8, !tbaa !5
  %47 = load i64, ptr %15, align 8, !tbaa !9
  %48 = getelementptr inbounds ptr, ptr %46, i64 %47
  %49 = invoke noundef i32 @_ZN14VmaBlockVector12AllocatePageEmmRK23VmaAllocationCreateInfo20VmaSuballocationTypePP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(181) %20, i64 noundef %42, i64 noundef %43, ptr noundef nonnull align 8 dereferenceable(48) %44, i32 noundef %45, ptr noundef %48)
          to label %50 unwind label %54

50:                                               ; preds = %41
  store i32 %49, ptr %16, align 4, !tbaa !13
  %51 = load i32, ptr %16, align 4, !tbaa !13
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %58

53:                                               ; preds = %50
  br label %62

54:                                               ; preds = %41
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %18, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %19, align 4
  call void @_ZN17VmaMutexLockWriteD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %81

58:                                               ; preds = %50
  br label %59

59:                                               ; preds = %58
  %60 = load i64, ptr %15, align 8, !tbaa !9
  %61 = add i64 %60, 1
  store i64 %61, ptr %15, align 8, !tbaa !9
  br label %37, !llvm.loop !48

62:                                               ; preds = %53, %37
  call void @_ZN17VmaMutexLockWriteD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  %63 = load i32, ptr %16, align 4, !tbaa !13
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %79

65:                                               ; preds = %62
  br label %66

66:                                               ; preds = %70, %65
  %67 = load i64, ptr %15, align 8, !tbaa !9
  %68 = add i64 %67, -1
  store i64 %68, ptr %15, align 8, !tbaa !9
  %69 = icmp ne i64 %67, 0
  br i1 %69, label %70, label %75

70:                                               ; preds = %66
  %71 = load ptr, ptr %14, align 8, !tbaa !5
  %72 = load i64, ptr %15, align 8, !tbaa !9
  %73 = getelementptr inbounds ptr, ptr %71, i64 %72
  %74 = load ptr, ptr %73, align 8, !tbaa !5
  call void @_ZN14VmaBlockVector4FreeEP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(181) %20, ptr noundef %74)
  br label %66, !llvm.loop !50

75:                                               ; preds = %66
  %76 = load ptr, ptr %14, align 8, !tbaa !5
  %77 = load i64, ptr %13, align 8, !tbaa !9
  %78 = mul i64 8, %77
  call void @llvm.memset.p0.i64(ptr align 8 %76, i8 0, i64 %78, i1 false)
  br label %79

79:                                               ; preds = %75, %62
  %80 = load i32, ptr %16, align 4, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  ret i32 %80

81:                                               ; preds = %54
  %82 = load ptr, ptr %18, align 8
  %83 = load i32, ptr %19, align 4
  %84 = insertvalue { ptr, i32 } poison, ptr %82, 0
  %85 = insertvalue { ptr, i32 } %84, i32 %83, 1
  resume { ptr, i32 } %85
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN14VmaBlockVector12AllocatePageEmmRK23VmaAllocationCreateInfo20VmaSuballocationTypePP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(181), i64 noundef, i64 noundef, ptr noundef nonnull align 8 dereferenceable(48), i32 noundef, ptr noundef) #1 align 2

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

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_ZTS20VmaSuballocationType", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_ZTS8VkResult", !7, i64 0}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTS14VmaBlockVector", !6, i64 0, !6, i64 8, !17, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !18, i64 56, !17, i64 60, !19, i64 64, !10, i64 72, !6, i64 80, !20, i64 88, !23, i64 144, !17, i64 176, !18, i64 180}
!17 = !{!"int", !7, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"float", !7, i64 0}
!20 = !{!"_ZTS10VmaRWMutex", !21, i64 0}
!21 = !{!"_ZTSSt12shared_mutex", !22, i64 0}
!22 = !{!"_ZTSSt22__shared_mutex_pthread", !7, i64 0}
!23 = !{!"_ZTS9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EE", !24, i64 0, !6, i64 8, !10, i64 16, !10, i64 24}
!24 = !{!"_ZTS15VmaStlAllocatorIP20VmaDeviceMemoryBlockE", !6, i64 0}
!25 = !{!26, !18, i64 0}
!26 = !{!"_ZTS14VmaAllocator_T", !18, i64 0, !17, i64 4, !18, i64 8, !18, i64 9, !18, i64 10, !18, i64 11, !18, i64 12, !18, i64 13, !6, i64 16, !6, i64 24, !18, i64 32, !27, i64 40, !28, i64 88, !29, i64 112, !17, i64 200, !36, i64 208, !40, i64 1032, !7, i64 1552, !7, i64 1808, !41, i64 4624, !42, i64 5456, !10, i64 5464, !6, i64 5472, !42, i64 5480, !42, i64 5484, !7, i64 5488, !20, i64 5616, !44, i64 5672, !17, i64 5696, !45, i64 5704, !17, i64 5912}
!27 = !{!"_ZTS21VkAllocationCallbacks", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!28 = !{!"_ZTS24VmaDeviceMemoryCallbacks", !6, i64 0, !6, i64 8, !6, i64 16}
!29 = !{!"_ZTS28VmaAllocationObjectAllocator", !30, i64 0, !33, i64 40}
!30 = !{!"_ZTS8VmaMutex", !31, i64 0}
!31 = !{!"_ZTSSt5mutex", !32, i64 0}
!32 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!33 = !{!"_ZTS16VmaPoolAllocatorI15VmaAllocation_TE", !6, i64 0, !17, i64 8, !34, i64 16}
!34 = !{!"_ZTS9VmaVectorIN16VmaPoolAllocatorI15VmaAllocation_TE9ItemBlockE15VmaStlAllocatorIS3_EE", !35, i64 0, !6, i64 8, !10, i64 16, !10, i64 24}
!35 = !{!"_ZTS15VmaStlAllocatorIN16VmaPoolAllocatorI15VmaAllocation_TE9ItemBlockEE", !6, i64 0}
!36 = !{!"_ZTS26VkPhysicalDeviceProperties", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !37, i64 16, !7, i64 20, !7, i64 276, !38, i64 296, !39, i64 800}
!37 = !{!"_ZTS20VkPhysicalDeviceType", !7, i64 0}
!38 = !{!"_ZTS22VkPhysicalDeviceLimits", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20, !17, i64 24, !17, i64 28, !17, i64 32, !17, i64 36, !17, i64 40, !10, i64 48, !10, i64 56, !17, i64 64, !17, i64 68, !17, i64 72, !17, i64 76, !17, i64 80, !17, i64 84, !17, i64 88, !17, i64 92, !17, i64 96, !17, i64 100, !17, i64 104, !17, i64 108, !17, i64 112, !17, i64 116, !17, i64 120, !17, i64 124, !17, i64 128, !17, i64 132, !17, i64 136, !17, i64 140, !17, i64 144, !17, i64 148, !17, i64 152, !17, i64 156, !17, i64 160, !17, i64 164, !17, i64 168, !17, i64 172, !17, i64 176, !17, i64 180, !17, i64 184, !17, i64 188, !17, i64 192, !17, i64 196, !17, i64 200, !17, i64 204, !17, i64 208, !17, i64 212, !17, i64 216, !7, i64 220, !17, i64 232, !7, i64 236, !17, i64 248, !17, i64 252, !17, i64 256, !17, i64 260, !17, i64 264, !19, i64 268, !19, i64 272, !17, i64 276, !7, i64 280, !7, i64 288, !17, i64 296, !10, i64 304, !10, i64 312, !10, i64 320, !10, i64 328, !17, i64 336, !17, i64 340, !17, i64 344, !17, i64 348, !19, i64 352, !19, i64 356, !17, i64 360, !17, i64 364, !17, i64 368, !17, i64 372, !17, i64 376, !17, i64 380, !17, i64 384, !17, i64 388, !17, i64 392, !17, i64 396, !17, i64 400, !17, i64 404, !17, i64 408, !17, i64 412, !17, i64 416, !17, i64 420, !19, i64 424, !17, i64 428, !17, i64 432, !17, i64 436, !17, i64 440, !7, i64 444, !7, i64 452, !19, i64 460, !19, i64 464, !17, i64 468, !17, i64 472, !10, i64 480, !10, i64 488, !10, i64 496}
!39 = !{!"_ZTS32VkPhysicalDeviceSparseProperties", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16}
!40 = !{!"_ZTS32VkPhysicalDeviceMemoryProperties", !17, i64 0, !7, i64 4, !17, i64 260, !7, i64 264}
!41 = !{!"_ZTS20VmaCurrentBudgetData", !7, i64 0, !7, i64 64, !7, i64 128, !7, i64 256, !42, i64 384, !20, i64 392, !7, i64 448, !7, i64 576, !7, i64 704}
!42 = !{!"_ZTSSt6atomicIjE", !43, i64 0}
!43 = !{!"_ZTSSt13__atomic_baseIjE", !17, i64 0}
!44 = !{!"_ZTS22VmaIntrusiveLinkedListI21VmaPoolListItemTraitsE", !6, i64 0, !6, i64 8, !10, i64 16}
!45 = !{!"_ZTS18VmaVulkanFunctions", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200}
!46 = !{i8 0, i8 2}
!47 = !{}
!48 = distinct !{!48, !49}
!49 = !{!"llvm.loop.mustprogress"}
!50 = distinct !{!50, !49}


; 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.VmaMutexLockWrite = type { ptr }

; 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17VmaMutexLockWriteC2ER10VmaRWMutexb(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(56), i1 noundef zeroext) unnamed_addr #1 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZL10VmaAlignUpImET_S0_S0_(i64 noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK14VmaBlockVector28IsCorruptionDetectionEnabledEv(ptr noundef nonnull align 8 dereferenceable(181)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN14VmaBlockVector8AllocateEmmRK23VmaAllocationCreateInfo20VmaSuballocationTypemPP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(181) %0, i64 noundef %1, i64 noundef %2, ptr noundef nonnull align 8 dereferenceable(48) %3, i32 noundef %4, i64 noundef %5, ptr noundef %6) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %8 = alloca i64, align 8
  %9 = alloca %struct.VmaMutexLockWrite, align 8
  store i64 %2, ptr %8, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 72
  %11 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %12 = load i64, ptr %11, align 8, !tbaa !5
  store i64 %12, ptr %8, align 8, !tbaa !5
  %13 = call noundef zeroext i1 @_ZNK14VmaBlockVector28IsCorruptionDetectionEnabledEv(ptr noundef nonnull align 8 dereferenceable(181) %0)
  br i1 %13, label %14, label %18

14:                                               ; preds = %7
  %15 = call noundef i64 @_ZL10VmaAlignUpImET_S0_S0_(i64 noundef %1, i64 noundef 4)
  %16 = load i64, ptr %8, align 8, !tbaa !5
  %17 = call noundef i64 @_ZL10VmaAlignUpImET_S0_S0_(i64 noundef %16, i64 noundef 4)
  store i64 %17, ptr %8, align 8, !tbaa !5
  br label %18

18:                                               ; preds = %14, %7
  %.0 = phi i64 [ %15, %14 ], [ %1, %7 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #5
  %19 = getelementptr inbounds i8, ptr %0, i64 88
  %20 = load ptr, ptr %0, align 8, !tbaa !9
  %21 = load i8, ptr %20, align 8, !tbaa !20, !range !41, !noundef !42
  %22 = trunc nuw i8 %21 to i1
  call void @_ZN17VmaMutexLockWriteC2ER10VmaRWMutexb(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(56) %19, i1 noundef zeroext %22)
  %.not35 = icmp eq i64 %5, 0
  br i1 %.not35, label %.thread, label %.lr.ph

.thread:                                          ; preds = %29, %18
  call void @_ZN17VmaMutexLockWriteD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  br label %36

.lr.ph:                                           ; preds = %18, %29
  %.01931 = phi i64 [ %30, %29 ], [ 0, %18 ]
  %23 = load i64, ptr %8, align 8, !tbaa !5
  %24 = getelementptr inbounds ptr, ptr %6, i64 %.01931
  %25 = invoke noundef i32 @_ZN14VmaBlockVector12AllocatePageEmmRK23VmaAllocationCreateInfo20VmaSuballocationTypePP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(181) %0, i64 noundef %.0, i64 noundef %23, ptr noundef nonnull align 8 dereferenceable(48) %3, i32 noundef %4, ptr noundef %24)
          to label %26 unwind label %27

26:                                               ; preds = %.lr.ph
  %.not = icmp eq i32 %25, 0
  br i1 %.not, label %29, label %31

27:                                               ; preds = %.lr.ph
  %28 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN17VmaMutexLockWriteD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  resume { ptr, i32 } %28

29:                                               ; preds = %26
  %30 = add nuw i64 %.01931, 1
  %exitcond.not = icmp eq i64 %30, %5
  br i1 %exitcond.not, label %.thread, label %.lr.ph, !llvm.loop !43

31:                                               ; preds = %26
  call void @_ZN17VmaMutexLockWriteD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  %.not2532 = icmp eq i64 %.01931, 0
  br i1 %.not2532, label %._crit_edge, label %.lr.ph34

.lr.ph34:                                         ; preds = %31, %.lr.ph34
  %.133 = phi i64 [ %32, %.lr.ph34 ], [ %.01931, %31 ]
  %32 = add i64 %.133, -1
  %33 = getelementptr inbounds ptr, ptr %6, i64 %32
  %34 = load ptr, ptr %33, align 8, !tbaa !45
  call void @_ZN14VmaBlockVector4FreeEP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(181) %0, ptr noundef %34)
  %.not25 = icmp eq i64 %32, 0
  br i1 %.not25, label %._crit_edge, label %.lr.ph34, !llvm.loop !46

._crit_edge:                                      ; preds = %.lr.ph34, %31
  %35 = shl i64 %5, 3
  call void @llvm.memset.p0.i64(ptr align 8 %6, i8 0, i64 %35, i1 false)
  br label %36

36:                                               ; preds = %.thread, %._crit_edge
  %.12128 = phi i32 [ 0, %.thread ], [ %25, %._crit_edge ]
  ret i32 %.12128
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN14VmaBlockVector12AllocatePageEmmRK23VmaAllocationCreateInfo20VmaSuballocationTypePP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(181), i64 noundef, i64 noundef, ptr noundef nonnull align 8 dereferenceable(48), i32 noundef, ptr noundef) local_unnamed_addr #1 align 2

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

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTS14VmaBlockVector", !11, i64 0, !11, i64 8, !12, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !13, i64 56, !12, i64 60, !14, i64 64, !6, i64 72, !11, i64 80, !15, i64 88, !18, i64 144, !12, i64 176, !13, i64 180}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!"_ZTS10VmaRWMutex", !16, i64 0}
!16 = !{!"_ZTSSt12shared_mutex", !17, i64 0}
!17 = !{!"_ZTSSt22__shared_mutex_pthread", !7, i64 0}
!18 = !{!"_ZTS9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EE", !19, i64 0, !11, i64 8, !6, i64 16, !6, i64 24}
!19 = !{!"_ZTS15VmaStlAllocatorIP20VmaDeviceMemoryBlockE", !11, i64 0}
!20 = !{!21, !13, i64 0}
!21 = !{!"_ZTS14VmaAllocator_T", !13, i64 0, !12, i64 4, !13, i64 8, !13, i64 9, !13, i64 10, !13, i64 11, !13, i64 12, !13, i64 13, !11, i64 16, !11, i64 24, !13, i64 32, !22, i64 40, !23, i64 88, !24, i64 112, !12, i64 200, !31, i64 208, !35, i64 1032, !7, i64 1552, !7, i64 1808, !36, i64 4624, !37, i64 5456, !6, i64 5464, !11, i64 5472, !37, i64 5480, !37, i64 5484, !7, i64 5488, !15, i64 5616, !39, i64 5672, !12, i64 5696, !40, i64 5704, !12, i64 5912}
!22 = !{!"_ZTS21VkAllocationCallbacks", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40}
!23 = !{!"_ZTS24VmaDeviceMemoryCallbacks", !11, i64 0, !11, i64 8, !11, i64 16}
!24 = !{!"_ZTS28VmaAllocationObjectAllocator", !25, i64 0, !28, i64 40}
!25 = !{!"_ZTS8VmaMutex", !26, i64 0}
!26 = !{!"_ZTSSt5mutex", !27, i64 0}
!27 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!28 = !{!"_ZTS16VmaPoolAllocatorI15VmaAllocation_TE", !11, i64 0, !12, i64 8, !29, i64 16}
!29 = !{!"_ZTS9VmaVectorIN16VmaPoolAllocatorI15VmaAllocation_TE9ItemBlockE15VmaStlAllocatorIS3_EE", !30, i64 0, !11, i64 8, !6, i64 16, !6, i64 24}
!30 = !{!"_ZTS15VmaStlAllocatorIN16VmaPoolAllocatorI15VmaAllocation_TE9ItemBlockEE", !11, i64 0}
!31 = !{!"_ZTS26VkPhysicalDeviceProperties", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !32, i64 16, !7, i64 20, !7, i64 276, !33, i64 296, !34, i64 800}
!32 = !{!"_ZTS20VkPhysicalDeviceType", !7, i64 0}
!33 = !{!"_ZTS22VkPhysicalDeviceLimits", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !6, i64 48, !6, i64 56, !12, i64 64, !12, i64 68, !12, i64 72, !12, i64 76, !12, i64 80, !12, i64 84, !12, i64 88, !12, i64 92, !12, i64 96, !12, i64 100, !12, i64 104, !12, i64 108, !12, i64 112, !12, i64 116, !12, i64 120, !12, i64 124, !12, i64 128, !12, i64 132, !12, i64 136, !12, i64 140, !12, i64 144, !12, i64 148, !12, i64 152, !12, i64 156, !12, i64 160, !12, i64 164, !12, i64 168, !12, i64 172, !12, i64 176, !12, i64 180, !12, i64 184, !12, i64 188, !12, i64 192, !12, i64 196, !12, i64 200, !12, i64 204, !12, i64 208, !12, i64 212, !12, i64 216, !7, i64 220, !12, i64 232, !7, i64 236, !12, i64 248, !12, i64 252, !12, i64 256, !12, i64 260, !12, i64 264, !14, i64 268, !14, i64 272, !12, i64 276, !7, i64 280, !7, i64 288, !12, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !12, i64 336, !12, i64 340, !12, i64 344, !12, i64 348, !14, i64 352, !14, i64 356, !12, i64 360, !12, i64 364, !12, i64 368, !12, i64 372, !12, i64 376, !12, i64 380, !12, i64 384, !12, i64 388, !12, i64 392, !12, i64 396, !12, i64 400, !12, i64 404, !12, i64 408, !12, i64 412, !12, i64 416, !12, i64 420, !14, i64 424, !12, i64 428, !12, i64 432, !12, i64 436, !12, i64 440, !7, i64 444, !7, i64 452, !14, i64 460, !14, i64 464, !12, i64 468, !12, i64 472, !6, i64 480, !6, i64 488, !6, i64 496}
!34 = !{!"_ZTS32VkPhysicalDeviceSparseProperties", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16}
!35 = !{!"_ZTS32VkPhysicalDeviceMemoryProperties", !12, i64 0, !7, i64 4, !12, i64 260, !7, i64 264}
!36 = !{!"_ZTS20VmaCurrentBudgetData", !7, i64 0, !7, i64 64, !7, i64 128, !7, i64 256, !37, i64 384, !15, i64 392, !7, i64 448, !7, i64 576, !7, i64 704}
!37 = !{!"_ZTSSt6atomicIjE", !38, i64 0}
!38 = !{!"_ZTSSt13__atomic_baseIjE", !12, i64 0}
!39 = !{!"_ZTS22VmaIntrusiveLinkedListI21VmaPoolListItemTraitsE", !11, i64 0, !11, i64 8, !6, i64 16}
!40 = !{!"_ZTS18VmaVulkanFunctions", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96, !11, i64 104, !11, i64 112, !11, i64 120, !11, i64 128, !11, i64 136, !11, i64 144, !11, i64 152, !11, i64 160, !11, i64 168, !11, i64 176, !11, i64 184, !11, i64 192, !11, i64 200}
!41 = !{i8 0, i8 2}
!42 = !{}
!43 = distinct !{!43, !44}
!44 = !{!"llvm.loop.mustprogress"}
!45 = !{!11, !11, i64 0}
!46 = distinct !{!46, !44}


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