; 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.VmaMutexLockRead = 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 }
%class.VmaDeviceMemoryBlock = type { ptr, ptr, i32, i32, ptr, %class.VmaMutex, %class.VmaMappingHysteresis, i32, ptr }
%class.VmaMappingHysteresis = type { i32, i32, i32 }

@.str.2 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.178 = external hidden unnamed_addr constant [7 x i8], align 1
@__PRETTY_FUNCTION__._ZN14VmaBlockVector13AddStatisticsER13VmaStatistics = external hidden unnamed_addr constant [52 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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14VmaBlockVector13AddStatisticsER13VmaStatistics(ptr noundef nonnull align 8 dereferenceable(181) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.VmaMutexLockRead, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %12 = getelementptr inbounds %class.VmaBlockVector, ptr %11, i32 0, i32 15
  %13 = getelementptr inbounds %class.VmaBlockVector, ptr %11, i32 0, i32 0
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  %15 = getelementptr inbounds %struct.VmaAllocator_T, ptr %14, i32 0, i32 0
  %16 = load i8, ptr %15, align 8, !tbaa !20, !range !41, !noundef !42
  %17 = trunc i8 %16 to i1
  call void @_ZN16VmaMutexLockReadC2ER10VmaRWMutexb(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(56) %12, i1 noundef zeroext %17)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %18 = getelementptr inbounds %class.VmaBlockVector, ptr %11, i32 0, i32 16
  %19 = invoke noundef i64 @_ZNK9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %18)
          to label %20 unwind label %27

20:                                               ; preds = %2
  store i64 %19, ptr %6, align 8, !tbaa !43
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !44
  br label %21

21:                                               ; preds = %56, %20
  %22 = load i32, ptr %9, align 4, !tbaa !44
  %23 = zext i32 %22 to i64
  %24 = load i64, ptr %6, align 8, !tbaa !43
  %25 = icmp ult i64 %23, %24
  br i1 %25, label %31, label %26

26:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %59

27:                                               ; preds = %2
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %7, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %8, align 4
  br label %60

31:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %32 = getelementptr inbounds %class.VmaBlockVector, ptr %11, i32 0, i32 16
  %33 = load i32, ptr %9, align 4, !tbaa !44
  %34 = zext i32 %33 to i64
  %35 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(32) %32, i64 noundef %34)
          to label %36 unwind label %42

36:                                               ; preds = %31
  %37 = load ptr, ptr %35, align 8, !tbaa !5
  store ptr %37, ptr %10, align 8, !tbaa !5
  %38 = load ptr, ptr %10, align 8, !tbaa !5
  %39 = icmp ne ptr %38, null
  br i1 %39, label %40, label %41

40:                                               ; preds = %36
  br label %47

41:                                               ; preds = %36
  call void @__assert_fail(ptr noundef @.str.178, ptr noundef @.str.2, i32 noundef 12418, ptr noundef @__PRETTY_FUNCTION__._ZN14VmaBlockVector13AddStatisticsER13VmaStatistics) #5
  unreachable

42:                                               ; preds = %47, %31
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %7, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %60

46:                                               ; No predecessors!
  br label %47

47:                                               ; preds = %46, %40
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  %49 = getelementptr inbounds %class.VmaDeviceMemoryBlock, ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !45
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = load ptr, ptr %50, align 8, !tbaa !48
  %53 = getelementptr inbounds ptr, ptr %52, i64 15
  %54 = load ptr, ptr %53, align 8
  invoke void %54(ptr noundef nonnull align 8 dereferenceable(33) %50, ptr noundef nonnull align 8 dereferenceable(24) %51)
          to label %55 unwind label %42

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

56:                                               ; preds = %55
  %57 = load i32, ptr %9, align 4, !tbaa !44
  %58 = add i32 %57, 1
  store i32 %58, ptr %9, align 4, !tbaa !44
  br label %21, !llvm.loop !50

59:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @_ZN16VmaMutexLockReadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret void

60:                                               ; preds = %42, %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @_ZN16VmaMutexLockReadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %61

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

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

%struct.VmaMutexLockRead = type { ptr }

@.str.2 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.178 = external hidden unnamed_addr constant [7 x i8], align 1
@__PRETTY_FUNCTION__._ZN14VmaBlockVector13AddStatisticsER13VmaStatistics = external hidden unnamed_addr constant [52 x i8], align 1

; 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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14VmaBlockVector13AddStatisticsER13VmaStatistics(ptr noundef nonnull align 8 dereferenceable(181) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %struct.VmaMutexLockRead, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  %4 = getelementptr inbounds i8, ptr %0, i64 88
  %5 = load ptr, ptr %0, align 8, !tbaa !5
  %6 = load i8, ptr %5, align 8, !tbaa !19, !range !40, !noundef !41
  %7 = trunc nuw i8 %6 to i1
  call void @_ZN16VmaMutexLockReadC2ER10VmaRWMutexb(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(56) %4, i1 noundef zeroext %7)
  %8 = getelementptr inbounds i8, ptr %0, i64 144
  %9 = call noundef i64 @_ZNK9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %8)
  %.not12 = icmp eq i64 %9, 0
  br i1 %.not12, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %21, %2
  call void @_ZN16VmaMutexLockReadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  ret void

.lr.ph:                                           ; preds = %2, %21
  %10 = phi i64 [ %23, %21 ], [ 0, %2 ]
  %.011 = phi i32 [ %22, %21 ], [ 0, %2 ]
  %11 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(32) %8, i64 noundef %10)
  %12 = load ptr, ptr %11, align 8, !tbaa !42
  %.not = icmp eq ptr %12, null
  br i1 %.not, label %13, label %16

13:                                               ; preds = %.lr.ph
  call void @__assert_fail(ptr noundef nonnull @.str.178, ptr noundef nonnull @.str.2, i32 noundef 12418, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN14VmaBlockVector13AddStatisticsER13VmaStatistics) #5
  unreachable

14:                                               ; preds = %16
  %15 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN16VmaMutexLockReadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  resume { ptr, i32 } %15

16:                                               ; preds = %.lr.ph
  %17 = load ptr, ptr %12, align 8, !tbaa !43
  %18 = load ptr, ptr %17, align 8, !tbaa !46
  %19 = getelementptr inbounds i8, ptr %18, i64 120
  %20 = load ptr, ptr %19, align 8
  invoke void %20(ptr noundef nonnull align 8 dereferenceable(33) %17, ptr noundef nonnull align 8 dereferenceable(24) %1)
          to label %21 unwind label %14

21:                                               ; preds = %16
  %22 = add i32 %.011, 1
  %23 = zext i32 %22 to i64
  %24 = icmp ugt i64 %9, %23
  br i1 %24, label %.lr.ph, label %._crit_edge, !llvm.loop !48
}

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


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