; 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 }
%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.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.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 }
%struct.VmaPool_T = type { %class.VmaBlockVector, %class.VmaDedicatedAllocationList, i32, ptr, ptr, 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.VmaVector.15 = type { %struct.VmaStlAllocator.16, ptr, i64, i64 }
%struct.VmaStlAllocator.16 = type { 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 @_ZN16VmaMutexLockReadC2ER10VmaRWMutexb(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 @_ZN16VmaMutexLockReadD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK14VmaAllocator_T18GetMemoryTypeCountEv(ptr noundef nonnull align 8 dereferenceable(5916)) #2 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN22VmaIntrusiveLinkedListI21VmaPoolListItemTraitsE7GetNextEPK9VmaPool_T(ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN14VmaAllocator_T15CheckCorruptionEj(ptr noundef nonnull align 8 dereferenceable(5916) %0, i32 noundef %1) #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %struct.VmaMutexLockRead, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %16 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 -8, ptr %6, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %17

17:                                               ; preds = %45, %2
  %18 = load i32, ptr %7, align 4, !tbaa !9
  %19 = call noundef i32 @_ZNK14VmaAllocator_T18GetMemoryTypeCountEv(ptr noundef nonnull align 8 dereferenceable(5916) %16)
  %20 = icmp ult i32 %18, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %17
  store i32 2, ptr %8, align 4
  br label %48

22:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %23 = getelementptr inbounds %struct.VmaAllocator_T, ptr %16, i32 0, i32 21
  %24 = load i32, ptr %7, align 4, !tbaa !9
  %25 = zext i32 %24 to i64
  %26 = getelementptr inbounds [32 x ptr], ptr %23, i64 0, i64 %25
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  store ptr %27, ptr %9, align 8, !tbaa !5
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %41

30:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = call noundef i32 @_ZN14VmaBlockVector15CheckCorruptionEv(ptr noundef nonnull align 8 dereferenceable(181) %31)
  store i32 %32, ptr %10, align 4, !tbaa !11
  %33 = load i32, ptr %10, align 4, !tbaa !11
  switch i32 %33, label %35 [
    i32 -8, label %37
    i32 0, label %34
  ]

34:                                               ; preds = %30
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %37

35:                                               ; preds = %30
  %36 = load i32, ptr %10, align 4, !tbaa !11
  store i32 %36, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %38

37:                                               ; preds = %34, %30
  store i32 0, ptr %8, align 4
  br label %38

38:                                               ; preds = %37, %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %39 = load i32, ptr %8, align 4
  switch i32 %39, label %42 [
    i32 0, label %40
  ]

40:                                               ; preds = %38
  br label %41

41:                                               ; preds = %40, %22
  store i32 0, ptr %8, align 4
  br label %42

42:                                               ; preds = %41, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  %43 = load i32, ptr %8, align 4
  switch i32 %43, label %48 [
    i32 0, label %44
  ]

44:                                               ; preds = %42
  br label %45

45:                                               ; preds = %44
  %46 = load i32, ptr %7, align 4, !tbaa !9
  %47 = add i32 %46, 1
  store i32 %47, ptr %7, align 4, !tbaa !9
  br label %17, !llvm.loop !13

48:                                               ; preds = %42, %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  %49 = load i32, ptr %8, align 4
  switch i32 %49, label %106 [
    i32 2, label %50
  ]

50:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %51 = getelementptr inbounds %struct.VmaAllocator_T, ptr %16, i32 0, i32 31
  %52 = getelementptr inbounds %struct.VmaAllocator_T, ptr %16, i32 0, i32 0
  %53 = load i8, ptr %52, align 8, !tbaa !15, !range !42, !noundef !43
  %54 = trunc i8 %53 to i1
  call void @_ZN16VmaMutexLockReadC2ER10VmaRWMutexb(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(56) %51, i1 noundef zeroext %54)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %55 = getelementptr inbounds %struct.VmaAllocator_T, ptr %16, i32 0, i32 32
  %56 = invoke noundef ptr @_ZN22VmaIntrusiveLinkedListI21VmaPoolListItemTraitsE5FrontEv(ptr noundef nonnull align 8 dereferenceable(24) %55)
          to label %57 unwind label %62

57:                                               ; preds = %50
  store ptr %56, ptr %12, align 8, !tbaa !5
  br label %58

58:                                               ; preds = %97, %57
  %59 = load ptr, ptr %12, align 8, !tbaa !5
  %60 = icmp ne ptr %59, null
  br i1 %60, label %66, label %61

61:                                               ; preds = %58
  store i32 6, ptr %8, align 4
  br label %98

62:                                               ; preds = %93, %66, %50
  %63 = landingpad { ptr, i32 }
          cleanup
  %64 = extractvalue { ptr, i32 } %63, 0
  store ptr %64, ptr %13, align 8
  %65 = extractvalue { ptr, i32 } %63, 1
  store i32 %65, ptr %14, align 4
  br label %100

66:                                               ; preds = %58
  %67 = load ptr, ptr %12, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.VmaPool_T, ptr %67, i32 0, i32 0
  %69 = invoke noundef i32 @_ZNK14VmaBlockVector18GetMemoryTypeIndexEv(ptr noundef nonnull align 8 dereferenceable(181) %68)
          to label %70 unwind label %62

70:                                               ; preds = %66
  %71 = shl i32 1, %69
  %72 = load i32, ptr %5, align 4, !tbaa !9
  %73 = and i32 %71, %72
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %75, label %92

75:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %76 = load ptr, ptr %12, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.VmaPool_T, ptr %76, i32 0, i32 0
  %78 = invoke noundef i32 @_ZN14VmaBlockVector15CheckCorruptionEv(ptr noundef nonnull align 8 dereferenceable(181) %77)
          to label %79 unwind label %81

79:                                               ; preds = %75
  store i32 %78, ptr %15, align 4, !tbaa !11
  %80 = load i32, ptr %15, align 4, !tbaa !11
  switch i32 %80, label %86 [
    i32 -8, label %88
    i32 0, label %85
  ]

81:                                               ; preds = %75
  %82 = landingpad { ptr, i32 }
          cleanup
  %83 = extractvalue { ptr, i32 } %82, 0
  store ptr %83, ptr %13, align 8
  %84 = extractvalue { ptr, i32 } %82, 1
  store i32 %84, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  br label %100

85:                                               ; preds = %79
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %88

86:                                               ; preds = %79
  %87 = load i32, ptr %15, align 4, !tbaa !11
  store i32 %87, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %89

88:                                               ; preds = %85, %79
  store i32 0, ptr %8, align 4
  br label %89

89:                                               ; preds = %88, %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  %90 = load i32, ptr %8, align 4
  switch i32 %90, label %98 [
    i32 0, label %91
  ]

91:                                               ; preds = %89
  br label %92

92:                                               ; preds = %91, %70
  br label %93

93:                                               ; preds = %92
  %94 = getelementptr inbounds %struct.VmaAllocator_T, ptr %16, i32 0, i32 32
  %95 = load ptr, ptr %12, align 8, !tbaa !5
  %96 = invoke noundef ptr @_ZN22VmaIntrusiveLinkedListI21VmaPoolListItemTraitsE7GetNextEPK9VmaPool_T(ptr noundef %95)
          to label %97 unwind label %62

97:                                               ; preds = %93
  store ptr %96, ptr %12, align 8, !tbaa !5
  br label %58, !llvm.loop !44

98:                                               ; preds = %89, %61
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  %99 = load i32, ptr %8, align 4
  switch i32 %99, label %102 [
    i32 6, label %101
  ]

100:                                              ; preds = %81, %62
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @_ZN16VmaMutexLockReadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %108

101:                                              ; preds = %98
  store i32 0, ptr %8, align 4
  br label %102

102:                                              ; preds = %101, %98
  call void @_ZN16VmaMutexLockReadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  %103 = load i32, ptr %8, align 4
  switch i32 %103, label %106 [
    i32 0, label %104
  ]

104:                                              ; preds = %102
  %105 = load i32, ptr %6, align 4, !tbaa !11
  store i32 %105, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %106

106:                                              ; preds = %104, %102, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  %107 = load i32, ptr %3, align 4
  ret i32 %107

108:                                              ; preds = %100
  %109 = load ptr, ptr %13, align 8
  %110 = load i32, ptr %14, align 4
  %111 = insertvalue { ptr, i32 } poison, ptr %109, 0
  %112 = insertvalue { ptr, i32 } %111, i32 %110, 1
  resume { ptr, i32 } %112
}

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 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_ZTS8VkResult", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !17, i64 0}
!16 = !{!"_ZTS14VmaAllocator_T", !17, i64 0, !10, i64 4, !17, i64 8, !17, i64 9, !17, i64 10, !17, i64 11, !17, i64 12, !17, i64 13, !6, i64 16, !6, i64 24, !17, i64 32, !18, i64 40, !19, i64 88, !20, i64 112, !10, i64 200, !28, i64 208, !33, i64 1032, !7, i64 1552, !7, i64 1808, !34, i64 4624, !35, i64 5456, !27, i64 5464, !6, i64 5472, !35, i64 5480, !35, i64 5484, !7, i64 5488, !37, i64 5616, !40, i64 5672, !10, i64 5696, !41, i64 5704, !10, i64 5912}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"_ZTS21VkAllocationCallbacks", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!19 = !{!"_ZTS24VmaDeviceMemoryCallbacks", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!"_ZTS28VmaAllocationObjectAllocator", !21, i64 0, !24, i64 40}
!21 = !{!"_ZTS8VmaMutex", !22, i64 0}
!22 = !{!"_ZTSSt5mutex", !23, i64 0}
!23 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!24 = !{!"_ZTS16VmaPoolAllocatorI15VmaAllocation_TE", !6, i64 0, !10, i64 8, !25, i64 16}
!25 = !{!"_ZTS9VmaVectorIN16VmaPoolAllocatorI15VmaAllocation_TE9ItemBlockE15VmaStlAllocatorIS3_EE", !26, i64 0, !6, i64 8, !27, i64 16, !27, i64 24}
!26 = !{!"_ZTS15VmaStlAllocatorIN16VmaPoolAllocatorI15VmaAllocation_TE9ItemBlockEE", !6, i64 0}
!27 = !{!"long", !7, i64 0}
!28 = !{!"_ZTS26VkPhysicalDeviceProperties", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !29, i64 16, !7, i64 20, !7, i64 276, !30, i64 296, !32, i64 800}
!29 = !{!"_ZTS20VkPhysicalDeviceType", !7, i64 0}
!30 = !{!"_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, !27, i64 48, !27, 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, !7, i64 220, !10, i64 232, !7, i64 236, !10, i64 248, !10, i64 252, !10, i64 256, !10, i64 260, !10, i64 264, !31, i64 268, !31, i64 272, !10, i64 276, !7, i64 280, !7, i64 288, !10, i64 296, !27, i64 304, !27, i64 312, !27, i64 320, !27, i64 328, !10, i64 336, !10, i64 340, !10, i64 344, !10, i64 348, !31, i64 352, !31, 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, !31, i64 424, !10, i64 428, !10, i64 432, !10, i64 436, !10, i64 440, !7, i64 444, !7, i64 452, !31, i64 460, !31, i64 464, !10, i64 468, !10, i64 472, !27, i64 480, !27, i64 488, !27, i64 496}
!31 = !{!"float", !7, i64 0}
!32 = !{!"_ZTS32VkPhysicalDeviceSparseProperties", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16}
!33 = !{!"_ZTS32VkPhysicalDeviceMemoryProperties", !10, i64 0, !7, i64 4, !10, i64 260, !7, i64 264}
!34 = !{!"_ZTS20VmaCurrentBudgetData", !7, i64 0, !7, i64 64, !7, i64 128, !7, i64 256, !35, i64 384, !37, i64 392, !7, i64 448, !7, i64 576, !7, i64 704}
!35 = !{!"_ZTSSt6atomicIjE", !36, i64 0}
!36 = !{!"_ZTSSt13__atomic_baseIjE", !10, i64 0}
!37 = !{!"_ZTS10VmaRWMutex", !38, i64 0}
!38 = !{!"_ZTSSt12shared_mutex", !39, i64 0}
!39 = !{!"_ZTSSt22__shared_mutex_pthread", !7, i64 0}
!40 = !{!"_ZTS22VmaIntrusiveLinkedListI21VmaPoolListItemTraitsE", !6, i64 0, !6, i64 8, !27, i64 16}
!41 = !{!"_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}
!42 = !{i8 0, i8 2}
!43 = !{}
!44 = distinct !{!44, !14}


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

; 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 @_ZN16VmaMutexLockReadC2ER10VmaRWMutexb(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 @_ZN16VmaMutexLockReadD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK14VmaAllocator_T18GetMemoryTypeCountEv(ptr noundef nonnull align 8 dereferenceable(5916)) local_unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN22VmaIntrusiveLinkedListI21VmaPoolListItemTraitsE7GetNextEPK9VmaPool_T(ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN14VmaAllocator_T15CheckCorruptionEj(ptr noundef nonnull align 8 dereferenceable(5916) %0, i32 noundef %1) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %struct.VmaMutexLockRead, align 8
  %4 = tail call noundef i32 @_ZNK14VmaAllocator_T18GetMemoryTypeCountEv(ptr noundef nonnull align 8 dereferenceable(5916) %0)
  %.not4968.not = icmp eq i32 %4, 0
  br i1 %.not4968.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2
  %5 = getelementptr inbounds i8, ptr %0, i64 1552
  br label %6

6:                                                ; preds = %.lr.ph, %12
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %12 ]
  %.03270 = phi i32 [ -8, %.lr.ph ], [ %.436.ph, %12 ]
  %7 = getelementptr inbounds [32 x ptr], ptr %5, i64 0, i64 %indvars.iv
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  %.not = icmp eq ptr %8, null
  br i1 %.not, label %12, label %9

9:                                                ; preds = %6
  %10 = tail call noundef i32 @_ZN14VmaBlockVector15CheckCorruptionEv(ptr noundef nonnull align 8 dereferenceable(181) %8)
  switch i32 %10, label %.thread59 [
    i32 -8, label %11
    i32 0, label %12
  ]

11:                                               ; preds = %9
  br label %12

12:                                               ; preds = %9, %6, %11
  %.436.ph = phi i32 [ %.03270, %11 ], [ %.03270, %6 ], [ %10, %9 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %13 = tail call noundef i32 @_ZNK14VmaAllocator_T18GetMemoryTypeCountEv(ptr noundef nonnull align 8 dereferenceable(5916) %0)
  %14 = zext i32 %13 to i64
  %.not49 = icmp ult i64 %indvars.iv.next, %14
  br i1 %.not49, label %6, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %12, %2
  %.032.lcssa = phi i32 [ -8, %2 ], [ %.436.ph, %12 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %15 = getelementptr inbounds i8, ptr %0, i64 5616
  %16 = load i8, ptr %0, align 8, !tbaa !11, !range !39, !noundef !40
  %17 = trunc nuw i8 %16 to i1
  call void @_ZN16VmaMutexLockReadC2ER10VmaRWMutexb(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(56) %15, i1 noundef zeroext %17)
  %18 = getelementptr inbounds i8, ptr %0, i64 5672
  %19 = call noundef ptr @_ZN22VmaIntrusiveLinkedListI21VmaPoolListItemTraitsE5FrontEv(ptr noundef nonnull align 8 dereferenceable(24) %18)
  br label %20

20:                                               ; preds = %.thread63, %._crit_edge
  %.638 = phi i32 [ %.032.lcssa, %._crit_edge ], [ %.941, %.thread63 ]
  %.031 = phi ptr [ %19, %._crit_edge ], [ %33, %.thread63 ]
  %.not50 = icmp eq ptr %.031, null
  br i1 %.not50, label %34, label %23

21:                                               ; preds = %.thread63
  %22 = landingpad { ptr, i32 }
          cleanup
  br label %35

23:                                               ; preds = %20
  %24 = call noundef i32 @_ZNK14VmaBlockVector18GetMemoryTypeIndexEv(ptr noundef nonnull align 8 dereferenceable(181) %.031)
  %25 = shl nuw i32 1, %24
  %26 = and i32 %25, %1
  %.not51 = icmp eq i32 %26, 0
  br i1 %.not51, label %.thread63, label %27

27:                                               ; preds = %23
  %28 = invoke noundef i32 @_ZN14VmaBlockVector15CheckCorruptionEv(ptr noundef nonnull align 8 dereferenceable(181) %.031)
          to label %29 unwind label %30

29:                                               ; preds = %27
  switch i32 %28, label %34 [
    i32 -8, label %32
    i32 0, label %.thread63
  ]

30:                                               ; preds = %27
  %31 = landingpad { ptr, i32 }
          cleanup
  br label %35

32:                                               ; preds = %29
  br label %.thread63

.thread63:                                        ; preds = %29, %32, %23
  %.941 = phi i32 [ %.638, %23 ], [ %.638, %32 ], [ %28, %29 ]
  %33 = invoke noundef ptr @_ZN22VmaIntrusiveLinkedListI21VmaPoolListItemTraitsE7GetNextEPK9VmaPool_T(ptr noundef nonnull %.031)
          to label %20 unwind label %21, !llvm.loop !41

34:                                               ; preds = %29, %20
  %spec.select = phi i32 [ %.638, %20 ], [ %28, %29 ]
  call void @_ZN16VmaMutexLockReadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  br label %.thread59

35:                                               ; preds = %30, %21
  %.pn = phi { ptr, i32 } [ %22, %21 ], [ %31, %30 ]
  call void @_ZN16VmaMutexLockReadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  resume { ptr, i32 } %.pn

.thread59:                                        ; preds = %9, %34
  %.9 = phi i32 [ %spec.select, %34 ], [ %10, %9 ]
  ret i32 %.9
}

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


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