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

@.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__._ZN14VmaBlockVector15CheckCorruptionEv = external hidden unnamed_addr constant [43 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 uwtable
declare dso_local noundef i32 @_ZN20VmaDeviceMemoryBlock15CheckCorruptionEP14VmaAllocator_T(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef) #2 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 nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK14VmaBlockVector28IsCorruptionDetectionEnabledEv(ptr noundef nonnull align 8 dereferenceable(181)) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN14VmaBlockVector15CheckCorruptionEv(ptr noundef nonnull align 8 dereferenceable(181) %0) #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca %struct.VmaMutexLockRead, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8
  %12 = call noundef zeroext i1 @_ZNK14VmaBlockVector28IsCorruptionDetectionEnabledEv(ptr noundef nonnull align 8 dereferenceable(181) %11)
  br i1 %12, label %14, label %13

13:                                               ; preds = %1
  store i32 -8, ptr %2, align 4
  br label %76

14:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %15 = getelementptr inbounds %class.VmaBlockVector, ptr %11, i32 0, i32 15
  %16 = getelementptr inbounds %class.VmaBlockVector, ptr %11, i32 0, i32 0
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  %18 = getelementptr inbounds %struct.VmaAllocator_T, ptr %17, i32 0, i32 0
  %19 = load i8, ptr %18, align 8, !tbaa !20, !range !41, !noundef !42
  %20 = trunc i8 %19 to i1
  call void @_ZN16VmaMutexLockReadC2ER10VmaRWMutexb(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(56) %15, i1 noundef zeroext %20)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !43
  br label %21

21:                                               ; preds = %67, %14
  %22 = load i32, ptr %5, align 4, !tbaa !43
  %23 = zext i32 %22 to i64
  %24 = getelementptr inbounds %class.VmaBlockVector, ptr %11, i32 0, i32 16
  %25 = invoke noundef i64 @_ZNK9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %24)
          to label %26 unwind label %29

26:                                               ; preds = %21
  %27 = icmp ult i64 %23, %25
  br i1 %27, label %33, label %28

28:                                               ; preds = %26
  store i32 2, ptr %8, align 4
  br label %71

29:                                               ; preds = %21
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %6, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %7, align 4
  br label %73

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

38:                                               ; preds = %33
  %39 = load ptr, ptr %37, align 8, !tbaa !5
  store ptr %39, ptr %9, align 8, !tbaa !5
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  %41 = icmp ne ptr %40, null
  br i1 %41, label %42, label %43

42:                                               ; preds = %38
  br label %49

43:                                               ; preds = %38
  call void @__assert_fail(ptr noundef @.str.178, ptr noundef @.str.2, i32 noundef 13028, ptr noundef @__PRETTY_FUNCTION__._ZN14VmaBlockVector15CheckCorruptionEv) #5
  unreachable

44:                                               ; preds = %33
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %6, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %7, align 4
  br label %70

48:                                               ; No predecessors!
  br label %49

49:                                               ; preds = %48, %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %50 = load ptr, ptr %9, align 8, !tbaa !5
  %51 = getelementptr inbounds %class.VmaBlockVector, ptr %11, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !9
  %53 = invoke noundef i32 @_ZN20VmaDeviceMemoryBlock15CheckCorruptionEP14VmaAllocator_T(ptr noundef nonnull align 8 dereferenceable(96) %50, ptr noundef %52)
          to label %54 unwind label %59

54:                                               ; preds = %49
  store i32 %53, ptr %10, align 4, !tbaa !44
  %55 = load i32, ptr %10, align 4, !tbaa !44
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %57, label %63

57:                                               ; preds = %54
  %58 = load i32, ptr %10, align 4, !tbaa !44
  store i32 %58, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %64

59:                                               ; preds = %49
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %6, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %70

63:                                               ; preds = %54
  store i32 0, ptr %8, align 4
  br label %64

64:                                               ; preds = %63, %57
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  %65 = load i32, ptr %8, align 4
  switch i32 %65, label %71 [
    i32 0, label %66
  ]

66:                                               ; preds = %64
  br label %67

67:                                               ; preds = %66
  %68 = load i32, ptr %5, align 4, !tbaa !43
  %69 = add i32 %68, 1
  store i32 %69, ptr %5, align 4, !tbaa !43
  br label %21, !llvm.loop !46

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

71:                                               ; preds = %64, %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  %72 = load i32, ptr %8, align 4
  switch i32 %72, label %75 [
    i32 2, label %74
  ]

73:                                               ; preds = %70, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @_ZN16VmaMutexLockReadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %78

74:                                               ; preds = %71
  store i32 0, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %75

75:                                               ; preds = %74, %71
  call void @_ZN16VmaMutexLockReadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %76

76:                                               ; preds = %75, %13
  %77 = load i32, ptr %2, align 4
  ret i32 %77

78:                                               ; preds = %73
  %79 = load ptr, ptr %6, align 8
  %80 = load i32, ptr %7, align 4
  %81 = insertvalue { ptr, i32 } poison, ptr %79, 0
  %82 = insertvalue { ptr, i32 } %81, i32 %80, 1
  resume { ptr, i32 } %82
}

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 = !{!11, !11, i64 0}
!44 = !{!45, !45, i64 0}
!45 = !{!"_ZTS8VkResult", !7, i64 0}
!46 = distinct !{!46, !47}
!47 = !{!"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__._ZN14VmaBlockVector15CheckCorruptionEv = external hidden unnamed_addr constant [43 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 uwtable
declare dso_local noundef i32 @_ZN20VmaDeviceMemoryBlock15CheckCorruptionEP14VmaAllocator_T(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef) local_unnamed_addr #2 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 nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK14VmaBlockVector28IsCorruptionDetectionEnabledEv(ptr noundef nonnull align 8 dereferenceable(181)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN14VmaBlockVector15CheckCorruptionEv(ptr noundef nonnull align 8 dereferenceable(181) %0) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %struct.VmaMutexLockRead, align 8
  %3 = tail call noundef zeroext i1 @_ZNK14VmaBlockVector28IsCorruptionDetectionEnabledEv(ptr noundef nonnull align 8 dereferenceable(181) %0)
  br i1 %3, label %4, label %25

4:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  %5 = getelementptr inbounds i8, ptr %0, i64 88
  %6 = load ptr, ptr %0, align 8, !tbaa !5
  %7 = load i8, ptr %6, align 8, !tbaa !19, !range !40, !noundef !41
  %8 = trunc nuw i8 %7 to i1
  call void @_ZN16VmaMutexLockReadC2ER10VmaRWMutexb(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(56) %5, i1 noundef zeroext %8)
  %9 = getelementptr inbounds i8, ptr %0, i64 144
  %10 = call noundef i64 @_ZNK9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %9)
  %.not2021.not = icmp eq i64 %10, 0
  br i1 %.not2021.not, label %._crit_edge, label %.lr.ph

11:                                               ; preds = %22
  %12 = add i32 %.01322, 1
  %13 = zext i32 %12 to i64
  %14 = call noundef i64 @_ZNK9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %9)
  %.not20 = icmp ugt i64 %14, %13
  br i1 %.not20, label %.lr.ph, label %._crit_edge, !llvm.loop !42

.lr.ph:                                           ; preds = %4, %11
  %15 = phi i64 [ %13, %11 ], [ 0, %4 ]
  %.01322 = phi i32 [ %12, %11 ], [ 0, %4 ]
  %16 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(32) %9, i64 noundef %15)
  %17 = load ptr, ptr %16, align 8, !tbaa !44
  %.not = icmp eq ptr %17, null
  br i1 %.not, label %18, label %19

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

19:                                               ; preds = %.lr.ph
  %20 = load ptr, ptr %0, align 8, !tbaa !5
  %21 = invoke noundef i32 @_ZN20VmaDeviceMemoryBlock15CheckCorruptionEP14VmaAllocator_T(ptr noundef nonnull align 8 dereferenceable(96) %17, ptr noundef %20)
          to label %22 unwind label %23

22:                                               ; preds = %19
  %.not19 = icmp eq i32 %21, 0
  br i1 %.not19, label %11, label %._crit_edge

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

._crit_edge:                                      ; preds = %22, %11, %4
  %spec.select = phi i32 [ 0, %4 ], [ 0, %11 ], [ %21, %22 ]
  call void @_ZN16VmaMutexLockReadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  br label %25

25:                                               ; preds = %1, %._crit_edge
  %.4 = phi i32 [ %spec.select, %._crit_edge ], [ -8, %1 ]
  ret i32 %.4
}

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 = distinct !{!42, !43}
!43 = !{!"llvm.loop.mustprogress"}
!44 = !{!7, !7, i64 0}


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