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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.VmaMutexLockWrite = type { ptr }
%struct.VmaDefragmentationContext_T = type { i64, i32, ptr, ptr, %struct.VmaStlAllocator.17, %class.VmaVector.18, i8, i32, i32, ptr, ptr, i64, %struct.VmaDefragmentationStats, %struct.VmaDefragmentationStats, ptr }
%struct.VmaStlAllocator.17 = type { ptr }
%class.VmaVector.18 = type { %struct.VmaStlAllocator.17, ptr, i64, i64 }
%struct.VmaDefragmentationStats = type { i64, i64, i32, i32 }
%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.VmaDefragmentationPassMoveInfo = type { i32, ptr }

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

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN27VmaDefragmentationContext_T19DefragmentPassBeginER30VmaDefragmentationPassMoveInfo(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.VmaMutexLockWrite, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %struct.VmaMutexLockWrite, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %12 = load ptr, ptr %4, align 8
  %13 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %12, i32 0, i32 9
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  %15 = icmp ne ptr %14, null
  br i1 %15, label %16, label %57

16:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %17 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %12, i32 0, i32 9
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  %19 = call noundef nonnull align 8 dereferenceable(56) ptr @_ZN14VmaBlockVector8GetMutexEv(ptr noundef nonnull align 8 dereferenceable(181) %18)
  %20 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %12, i32 0, i32 9
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  %22 = call noundef ptr @_ZNK14VmaBlockVector12GetAllocatorEv(ptr noundef nonnull align 8 dereferenceable(181) %21)
  %23 = getelementptr inbounds %struct.VmaAllocator_T, ptr %22, i32 0, i32 0
  %24 = load i8, ptr %23, align 8, !tbaa !16, !range !42, !noundef !43
  %25 = trunc i8 %24 to i1
  call void @_ZN17VmaMutexLockWriteC2ER10VmaRWMutexb(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(56) %19, i1 noundef zeroext %25)
  %26 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %12, i32 0, i32 9
  %27 = load ptr, ptr %26, align 8, !tbaa !9
  %28 = invoke noundef i64 @_ZNK14VmaBlockVector13GetBlockCountEv(ptr noundef nonnull align 8 dereferenceable(181) %27)
          to label %29 unwind label %36

29:                                               ; preds = %16
  %30 = icmp ugt i64 %28, 1
  br i1 %30, label %31, label %40

31:                                               ; preds = %29
  %32 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %12, i32 0, i32 9
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = invoke noundef zeroext i1 @_ZN27VmaDefragmentationContext_T22ComputeDefragmentationER14VmaBlockVectorm(ptr noundef nonnull align 8 dereferenceable(168) %12, ptr noundef nonnull align 8 dereferenceable(181) %33, i64 noundef 0)
          to label %35 unwind label %36

35:                                               ; preds = %31
  br label %56

36:                                               ; preds = %52, %46, %40, %31, %16
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %7, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %8, align 4
  call void @_ZN17VmaMutexLockWriteD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %176

40:                                               ; preds = %29
  %41 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %12, i32 0, i32 9
  %42 = load ptr, ptr %41, align 8, !tbaa !9
  %43 = invoke noundef i64 @_ZNK14VmaBlockVector13GetBlockCountEv(ptr noundef nonnull align 8 dereferenceable(181) %42)
          to label %44 unwind label %36

44:                                               ; preds = %40
  %45 = icmp eq i64 %43, 1
  br i1 %45, label %46, label %55

46:                                               ; preds = %44
  %47 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %12, i32 0, i32 9
  %48 = load ptr, ptr %47, align 8, !tbaa !9
  %49 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %12, i32 0, i32 9
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  %51 = invoke noundef ptr @_ZNK14VmaBlockVector8GetBlockEm(ptr noundef nonnull align 8 dereferenceable(181) %50, i64 noundef 0)
          to label %52 unwind label %36

52:                                               ; preds = %46
  %53 = invoke noundef zeroext i1 @_ZN27VmaDefragmentationContext_T18ReallocWithinBlockER14VmaBlockVectorP20VmaDeviceMemoryBlock(ptr noundef nonnull align 8 dereferenceable(168) %12, ptr noundef nonnull align 8 dereferenceable(181) %48, ptr noundef %51)
          to label %54 unwind label %36

54:                                               ; preds = %52
  br label %55

55:                                               ; preds = %54, %44
  br label %56

56:                                               ; preds = %55, %35
  call void @_ZN17VmaMutexLockWriteD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %156

57:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !44
  br label %58

58:                                               ; preds = %151, %57
  %59 = load i32, ptr %9, align 4, !tbaa !44
  %60 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %12, i32 0, i32 8
  %61 = load i32, ptr %60, align 8, !tbaa !45
  %62 = icmp ult i32 %59, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %58
  store i32 2, ptr %10, align 4
  br label %154

64:                                               ; preds = %58
  %65 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %12, i32 0, i32 10
  %66 = load ptr, ptr %65, align 8, !tbaa !46
  %67 = load i32, ptr %9, align 4, !tbaa !44
  %68 = zext i32 %67 to i64
  %69 = getelementptr inbounds ptr, ptr %66, i64 %68
  %70 = load ptr, ptr %69, align 8, !tbaa !5
  %71 = icmp ne ptr %70, null
  br i1 %71, label %72, label %150

72:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %73 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %12, i32 0, i32 10
  %74 = load ptr, ptr %73, align 8, !tbaa !46
  %75 = load i32, ptr %9, align 4, !tbaa !44
  %76 = zext i32 %75 to i64
  %77 = getelementptr inbounds ptr, ptr %74, i64 %76
  %78 = load ptr, ptr %77, align 8, !tbaa !5
  %79 = call noundef nonnull align 8 dereferenceable(56) ptr @_ZN14VmaBlockVector8GetMutexEv(ptr noundef nonnull align 8 dereferenceable(181) %78)
  %80 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %12, i32 0, i32 10
  %81 = load ptr, ptr %80, align 8, !tbaa !46
  %82 = load i32, ptr %9, align 4, !tbaa !44
  %83 = zext i32 %82 to i64
  %84 = getelementptr inbounds ptr, ptr %81, i64 %83
  %85 = load ptr, ptr %84, align 8, !tbaa !5
  %86 = call noundef ptr @_ZNK14VmaBlockVector12GetAllocatorEv(ptr noundef nonnull align 8 dereferenceable(181) %85)
  %87 = getelementptr inbounds %struct.VmaAllocator_T, ptr %86, i32 0, i32 0
  %88 = load i8, ptr %87, align 8, !tbaa !16, !range !42, !noundef !43
  %89 = trunc i8 %88 to i1
  call void @_ZN17VmaMutexLockWriteC2ER10VmaRWMutexb(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(56) %79, i1 noundef zeroext %89)
  %90 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %12, i32 0, i32 10
  %91 = load ptr, ptr %90, align 8, !tbaa !46
  %92 = load i32, ptr %9, align 4, !tbaa !44
  %93 = zext i32 %92 to i64
  %94 = getelementptr inbounds ptr, ptr %91, i64 %93
  %95 = load ptr, ptr %94, align 8, !tbaa !5
  %96 = invoke noundef i64 @_ZNK14VmaBlockVector13GetBlockCountEv(ptr noundef nonnull align 8 dereferenceable(181) %95)
          to label %97 unwind label %111

97:                                               ; preds = %72
  %98 = icmp ugt i64 %96, 1
  br i1 %98, label %99, label %116

99:                                               ; preds = %97
  %100 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %12, i32 0, i32 10
  %101 = load ptr, ptr %100, align 8, !tbaa !46
  %102 = load i32, ptr %9, align 4, !tbaa !44
  %103 = zext i32 %102 to i64
  %104 = getelementptr inbounds ptr, ptr %101, i64 %103
  %105 = load ptr, ptr %104, align 8, !tbaa !5
  %106 = load i32, ptr %9, align 4, !tbaa !44
  %107 = zext i32 %106 to i64
  %108 = invoke noundef zeroext i1 @_ZN27VmaDefragmentationContext_T22ComputeDefragmentationER14VmaBlockVectorm(ptr noundef nonnull align 8 dereferenceable(168) %12, ptr noundef nonnull align 8 dereferenceable(181) %105, i64 noundef %107)
          to label %109 unwind label %111

109:                                              ; preds = %99
  br i1 %108, label %110, label %115

110:                                              ; preds = %109
  store i32 2, ptr %10, align 4
  br label %147

111:                                              ; preds = %140, %126, %116, %99, %72
  %112 = landingpad { ptr, i32 }
          cleanup
  %113 = extractvalue { ptr, i32 } %112, 0
  store ptr %113, ptr %7, align 8
  %114 = extractvalue { ptr, i32 } %112, 1
  store i32 %114, ptr %8, align 4
  call void @_ZN17VmaMutexLockWriteD2Ev(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 %9) #3
  br label %176

115:                                              ; preds = %109
  br label %146

116:                                              ; preds = %97
  %117 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %12, i32 0, i32 10
  %118 = load ptr, ptr %117, align 8, !tbaa !46
  %119 = load i32, ptr %9, align 4, !tbaa !44
  %120 = zext i32 %119 to i64
  %121 = getelementptr inbounds ptr, ptr %118, i64 %120
  %122 = load ptr, ptr %121, align 8, !tbaa !5
  %123 = invoke noundef i64 @_ZNK14VmaBlockVector13GetBlockCountEv(ptr noundef nonnull align 8 dereferenceable(181) %122)
          to label %124 unwind label %111

124:                                              ; preds = %116
  %125 = icmp eq i64 %123, 1
  br i1 %125, label %126, label %145

126:                                              ; preds = %124
  %127 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %12, i32 0, i32 10
  %128 = load ptr, ptr %127, align 8, !tbaa !46
  %129 = load i32, ptr %9, align 4, !tbaa !44
  %130 = zext i32 %129 to i64
  %131 = getelementptr inbounds ptr, ptr %128, i64 %130
  %132 = load ptr, ptr %131, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %12, i32 0, i32 10
  %134 = load ptr, ptr %133, align 8, !tbaa !46
  %135 = load i32, ptr %9, align 4, !tbaa !44
  %136 = zext i32 %135 to i64
  %137 = getelementptr inbounds ptr, ptr %134, i64 %136
  %138 = load ptr, ptr %137, align 8, !tbaa !5
  %139 = invoke noundef ptr @_ZNK14VmaBlockVector8GetBlockEm(ptr noundef nonnull align 8 dereferenceable(181) %138, i64 noundef 0)
          to label %140 unwind label %111

140:                                              ; preds = %126
  %141 = invoke noundef zeroext i1 @_ZN27VmaDefragmentationContext_T18ReallocWithinBlockER14VmaBlockVectorP20VmaDeviceMemoryBlock(ptr noundef nonnull align 8 dereferenceable(168) %12, ptr noundef nonnull align 8 dereferenceable(181) %132, ptr noundef %139)
          to label %142 unwind label %111

142:                                              ; preds = %140
  br i1 %141, label %143, label %144

143:                                              ; preds = %142
  store i32 2, ptr %10, align 4
  br label %147

144:                                              ; preds = %142
  br label %145

145:                                              ; preds = %144, %124
  br label %146

146:                                              ; preds = %145, %115
  store i32 0, ptr %10, align 4
  br label %147

147:                                              ; preds = %146, %143, %110
  call void @_ZN17VmaMutexLockWriteD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  %148 = load i32, ptr %10, align 4
  switch i32 %148, label %154 [
    i32 0, label %149
  ]

149:                                              ; preds = %147
  br label %150

150:                                              ; preds = %149, %64
  br label %151

151:                                              ; preds = %150
  %152 = load i32, ptr %9, align 4, !tbaa !44
  %153 = add i32 %152, 1
  store i32 %153, ptr %9, align 4, !tbaa !44
  br label %58, !llvm.loop !47

154:                                              ; preds = %147, %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %155

155:                                              ; preds = %154
  br label %156

156:                                              ; preds = %155, %56
  %157 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %12, i32 0, i32 5
  %158 = call noundef i64 @_ZNK9VmaVectorI22VmaDefragmentationMove15VmaStlAllocatorIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %157)
  %159 = trunc i64 %158 to i32
  %160 = load ptr, ptr %5, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.VmaDefragmentationPassMoveInfo, ptr %160, i32 0, i32 0
  store i32 %159, ptr %161, align 8, !tbaa !49
  %162 = load ptr, ptr %5, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.VmaDefragmentationPassMoveInfo, ptr %162, i32 0, i32 0
  %164 = load i32, ptr %163, align 8, !tbaa !49
  %165 = icmp ugt i32 %164, 0
  br i1 %165, label %166, label %171

166:                                              ; preds = %156
  %167 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %12, i32 0, i32 5
  %168 = call noundef ptr @_ZN9VmaVectorI22VmaDefragmentationMove15VmaStlAllocatorIS0_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(32) %167)
  %169 = load ptr, ptr %5, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.VmaDefragmentationPassMoveInfo, ptr %169, i32 0, i32 1
  store ptr %168, ptr %170, align 8, !tbaa !51
  store i32 5, ptr %3, align 4
  br label %174

171:                                              ; preds = %156
  %172 = load ptr, ptr %5, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.VmaDefragmentationPassMoveInfo, ptr %172, i32 0, i32 1
  store ptr null, ptr %173, align 8, !tbaa !51
  store i32 0, ptr %3, align 4
  br label %174

174:                                              ; preds = %171, %166
  %175 = load i32, ptr %3, align 4
  ret i32 %175

176:                                              ; preds = %111, %36
  %177 = load ptr, ptr %7, align 8
  %178 = load i32, ptr %8, align 4
  %179 = insertvalue { ptr, i32 } poison, ptr %177, 0
  %180 = insertvalue { ptr, i32 } %179, i32 %178, 1
  resume { ptr, i32 } %180
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN27VmaDefragmentationContext_T22ComputeDefragmentationER14VmaBlockVectorm(ptr noundef nonnull align 8 dereferenceable(168), ptr noundef nonnull align 8 dereferenceable(181), i64 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN27VmaDefragmentationContext_T18ReallocWithinBlockER14VmaBlockVectorP20VmaDeviceMemoryBlock(ptr noundef nonnull align 8 dereferenceable(168), ptr noundef nonnull align 8 dereferenceable(181), ptr noundef) #1 align 2

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 88}
!10 = !{!"_ZTS27VmaDefragmentationContext_T", !11, i64 0, !12, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !14, i64 40, !7, i64 72, !12, i64 76, !12, i64 80, !6, i64 88, !6, i64 96, !11, i64 104, !15, i64 112, !15, i64 136, !6, i64 160}
!11 = !{!"long", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ZTS15VmaStlAllocatorI22VmaDefragmentationMoveE", !6, i64 0}
!14 = !{!"_ZTS9VmaVectorI22VmaDefragmentationMove15VmaStlAllocatorIS0_EE", !13, i64 0, !6, i64 8, !11, i64 16, !11, i64 24}
!15 = !{!"_ZTS23VmaDefragmentationStats", !11, i64 0, !11, i64 8, !12, i64 16, !12, i64 20}
!16 = !{!17, !18, i64 0}
!17 = !{!"_ZTS14VmaAllocator_T", !18, i64 0, !12, i64 4, !18, i64 8, !18, i64 9, !18, i64 10, !18, i64 11, !18, i64 12, !18, i64 13, !6, i64 16, !6, i64 24, !18, i64 32, !19, i64 40, !20, i64 88, !21, i64 112, !12, i64 200, !28, i64 208, !33, i64 1032, !7, i64 1552, !7, i64 1808, !34, i64 4624, !35, i64 5456, !11, i64 5464, !6, i64 5472, !35, i64 5480, !35, i64 5484, !7, i64 5488, !37, i64 5616, !40, i64 5672, !12, i64 5696, !41, i64 5704, !12, i64 5912}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"_ZTS21VkAllocationCallbacks", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!20 = !{!"_ZTS24VmaDeviceMemoryCallbacks", !6, i64 0, !6, i64 8, !6, i64 16}
!21 = !{!"_ZTS28VmaAllocationObjectAllocator", !22, i64 0, !25, i64 40}
!22 = !{!"_ZTS8VmaMutex", !23, i64 0}
!23 = !{!"_ZTSSt5mutex", !24, i64 0}
!24 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!25 = !{!"_ZTS16VmaPoolAllocatorI15VmaAllocation_TE", !6, i64 0, !12, i64 8, !26, i64 16}
!26 = !{!"_ZTS9VmaVectorIN16VmaPoolAllocatorI15VmaAllocation_TE9ItemBlockE15VmaStlAllocatorIS3_EE", !27, i64 0, !6, i64 8, !11, i64 16, !11, i64 24}
!27 = !{!"_ZTS15VmaStlAllocatorIN16VmaPoolAllocatorI15VmaAllocation_TE9ItemBlockEE", !6, i64 0}
!28 = !{!"_ZTS26VkPhysicalDeviceProperties", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !29, i64 16, !7, i64 20, !7, i64 276, !30, i64 296, !32, i64 800}
!29 = !{!"_ZTS20VkPhysicalDeviceType", !7, i64 0}
!30 = !{!"_ZTS22VkPhysicalDeviceLimits", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !11, i64 48, !11, i64 56, !12, i64 64, !12, i64 68, !12, i64 72, !12, i64 76, !12, i64 80, !12, i64 84, !12, i64 88, !12, i64 92, !12, i64 96, !12, i64 100, !12, i64 104, !12, i64 108, !12, i64 112, !12, i64 116, !12, i64 120, !12, i64 124, !12, i64 128, !12, i64 132, !12, i64 136, !12, i64 140, !12, i64 144, !12, i64 148, !12, i64 152, !12, i64 156, !12, i64 160, !12, i64 164, !12, i64 168, !12, i64 172, !12, i64 176, !12, i64 180, !12, i64 184, !12, i64 188, !12, i64 192, !12, i64 196, !12, i64 200, !12, i64 204, !12, i64 208, !12, i64 212, !12, i64 216, !7, i64 220, !12, i64 232, !7, i64 236, !12, i64 248, !12, i64 252, !12, i64 256, !12, i64 260, !12, i64 264, !31, i64 268, !31, i64 272, !12, i64 276, !7, i64 280, !7, i64 288, !12, i64 296, !11, i64 304, !11, i64 312, !11, i64 320, !11, i64 328, !12, i64 336, !12, i64 340, !12, i64 344, !12, i64 348, !31, i64 352, !31, i64 356, !12, i64 360, !12, i64 364, !12, i64 368, !12, i64 372, !12, i64 376, !12, i64 380, !12, i64 384, !12, i64 388, !12, i64 392, !12, i64 396, !12, i64 400, !12, i64 404, !12, i64 408, !12, i64 412, !12, i64 416, !12, i64 420, !31, i64 424, !12, i64 428, !12, i64 432, !12, i64 436, !12, i64 440, !7, i64 444, !7, i64 452, !31, i64 460, !31, i64 464, !12, i64 468, !12, i64 472, !11, i64 480, !11, i64 488, !11, i64 496}
!31 = !{!"float", !7, i64 0}
!32 = !{!"_ZTS32VkPhysicalDeviceSparseProperties", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16}
!33 = !{!"_ZTS32VkPhysicalDeviceMemoryProperties", !12, i64 0, !7, i64 4, !12, 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", !12, 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, !11, 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 = !{!12, !12, i64 0}
!45 = !{!10, !12, i64 80}
!46 = !{!10, !6, i64 96}
!47 = distinct !{!47, !48}
!48 = !{!"llvm.loop.mustprogress"}
!49 = !{!50, !12, i64 0}
!50 = !{!"_ZTS30VmaDefragmentationPassMoveInfo", !12, i64 0, !6, i64 8}
!51 = !{!50, !6, i64 8}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.VmaMutexLockWrite = type { ptr }

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

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 6) i32 @_ZN27VmaDefragmentationContext_T19DefragmentPassBeginER30VmaDefragmentationPassMoveInfo(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr nocapture noundef nonnull writeonly align 8 dereferenceable(16) %1) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %struct.VmaMutexLockWrite, align 8
  %4 = alloca %struct.VmaMutexLockWrite, align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 88
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %.preheader, label %10

.preheader:                                       ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 80
  %8 = load i32, ptr %7, align 8, !tbaa !15
  %.not27 = icmp eq i32 %8, 0
  br i1 %.not27, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %9 = getelementptr inbounds i8, ptr %0, i64 96
  br label %35

10:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %11 = tail call noundef nonnull align 8 dereferenceable(56) ptr @_ZN14VmaBlockVector8GetMutexEv(ptr noundef nonnull align 8 dereferenceable(181) %6)
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = tail call noundef ptr @_ZNK14VmaBlockVector12GetAllocatorEv(ptr noundef nonnull align 8 dereferenceable(181) %12)
  %14 = load i8, ptr %13, align 8, !tbaa !16, !range !42, !noundef !43
  %15 = trunc nuw i8 %14 to i1
  call void @_ZN17VmaMutexLockWriteC2ER10VmaRWMutexb(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(56) %11, i1 noundef zeroext %15)
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = invoke noundef i64 @_ZNK14VmaBlockVector13GetBlockCountEv(ptr noundef nonnull align 8 dereferenceable(181) %16)
          to label %18 unwind label %23

18:                                               ; preds = %10
  %19 = icmp ugt i64 %17, 1
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  br i1 %19, label %21, label %25

21:                                               ; preds = %18
  %22 = invoke noundef zeroext i1 @_ZN27VmaDefragmentationContext_T22ComputeDefragmentationER14VmaBlockVectorm(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr noundef nonnull align 8 dereferenceable(181) %20, i64 noundef 0)
          to label %34 unwind label %23

23:                                               ; preds = %32, %29, %25, %21, %10
  %24 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN17VmaMutexLockWriteD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  br label %86

25:                                               ; preds = %18
  %26 = invoke noundef i64 @_ZNK14VmaBlockVector13GetBlockCountEv(ptr noundef nonnull align 8 dereferenceable(181) %20)
          to label %27 unwind label %23

27:                                               ; preds = %25
  %28 = icmp eq i64 %26, 1
  br i1 %28, label %29, label %34

29:                                               ; preds = %27
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = invoke noundef ptr @_ZNK14VmaBlockVector8GetBlockEm(ptr noundef nonnull align 8 dereferenceable(181) %30, i64 noundef 0)
          to label %32 unwind label %23

32:                                               ; preds = %29
  %33 = invoke noundef zeroext i1 @_ZN27VmaDefragmentationContext_T18ReallocWithinBlockER14VmaBlockVectorP20VmaDeviceMemoryBlock(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr noundef nonnull align 8 dereferenceable(181) %30, ptr noundef %31)
          to label %34 unwind label %23

34:                                               ; preds = %27, %32, %21
  call void @_ZN17VmaMutexLockWriteD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  br label %.loopexit

35:                                               ; preds = %.lr.ph, %75
  %36 = phi i32 [ %8, %.lr.ph ], [ %76, %75 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %75 ]
  %37 = load ptr, ptr %9, align 8, !tbaa !44
  %38 = getelementptr inbounds ptr, ptr %37, i64 %indvars.iv
  %39 = load ptr, ptr %38, align 8, !tbaa !45
  %.not23 = icmp eq ptr %39, null
  br i1 %.not23, label %75, label %40

40:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %41 = call noundef nonnull align 8 dereferenceable(56) ptr @_ZN14VmaBlockVector8GetMutexEv(ptr noundef nonnull align 8 dereferenceable(181) %39)
  %42 = load ptr, ptr %9, align 8, !tbaa !44
  %43 = getelementptr inbounds ptr, ptr %42, i64 %indvars.iv
  %44 = load ptr, ptr %43, align 8, !tbaa !45
  %45 = call noundef ptr @_ZNK14VmaBlockVector12GetAllocatorEv(ptr noundef nonnull align 8 dereferenceable(181) %44)
  %46 = load i8, ptr %45, align 8, !tbaa !16, !range !42, !noundef !43
  %47 = trunc nuw i8 %46 to i1
  call void @_ZN17VmaMutexLockWriteC2ER10VmaRWMutexb(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(56) %41, i1 noundef zeroext %47)
  %48 = load ptr, ptr %9, align 8, !tbaa !44
  %49 = getelementptr inbounds ptr, ptr %48, i64 %indvars.iv
  %50 = load ptr, ptr %49, align 8, !tbaa !45
  %51 = invoke noundef i64 @_ZNK14VmaBlockVector13GetBlockCountEv(ptr noundef nonnull align 8 dereferenceable(181) %50)
          to label %52 unwind label %60

52:                                               ; preds = %40
  %53 = icmp ugt i64 %51, 1
  %54 = load ptr, ptr %9, align 8, !tbaa !44
  %55 = getelementptr inbounds ptr, ptr %54, i64 %indvars.iv
  %56 = load ptr, ptr %55, align 8, !tbaa !45
  br i1 %53, label %57, label %62

57:                                               ; preds = %52
  %58 = invoke noundef zeroext i1 @_ZN27VmaDefragmentationContext_T22ComputeDefragmentationER14VmaBlockVectorm(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr noundef nonnull align 8 dereferenceable(181) %56, i64 noundef %indvars.iv)
          to label %59 unwind label %60

59:                                               ; preds = %57
  br i1 %58, label %74, label %.critedge

60:                                               ; preds = %71, %66, %62, %57, %40
  %61 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN17VmaMutexLockWriteD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  br label %86

62:                                               ; preds = %52
  %63 = invoke noundef i64 @_ZNK14VmaBlockVector13GetBlockCountEv(ptr noundef nonnull align 8 dereferenceable(181) %56)
          to label %64 unwind label %60

64:                                               ; preds = %62
  %65 = icmp eq i64 %63, 1
  br i1 %65, label %66, label %.critedge

66:                                               ; preds = %64
  %67 = load ptr, ptr %9, align 8, !tbaa !44
  %68 = getelementptr inbounds ptr, ptr %67, i64 %indvars.iv
  %69 = load ptr, ptr %68, align 8, !tbaa !45
  %70 = invoke noundef ptr @_ZNK14VmaBlockVector8GetBlockEm(ptr noundef nonnull align 8 dereferenceable(181) %69, i64 noundef 0)
          to label %71 unwind label %60

71:                                               ; preds = %66
  %72 = invoke noundef zeroext i1 @_ZN27VmaDefragmentationContext_T18ReallocWithinBlockER14VmaBlockVectorP20VmaDeviceMemoryBlock(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr noundef nonnull align 8 dereferenceable(181) %69, ptr noundef %70)
          to label %73 unwind label %60

73:                                               ; preds = %71
  br i1 %72, label %74, label %.critedge

.critedge:                                        ; preds = %64, %73, %59
  call void @_ZN17VmaMutexLockWriteD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  %.pre = load i32, ptr %7, align 8, !tbaa !15
  br label %75

74:                                               ; preds = %73, %59
  call void @_ZN17VmaMutexLockWriteD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  br label %.loopexit

75:                                               ; preds = %.critedge, %35
  %76 = phi i32 [ %.pre, %.critedge ], [ %36, %35 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %77 = zext i32 %76 to i64
  %78 = icmp ult i64 %indvars.iv.next, %77
  br i1 %78, label %35, label %.loopexit, !llvm.loop !46

.loopexit:                                        ; preds = %75, %.preheader, %74, %34
  %79 = getelementptr inbounds i8, ptr %0, i64 40
  %80 = call noundef i64 @_ZNK9VmaVectorI22VmaDefragmentationMove15VmaStlAllocatorIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %79)
  %81 = trunc i64 %80 to i32
  store i32 %81, ptr %1, align 8, !tbaa !48
  %.not25 = icmp eq i32 %81, 0
  br i1 %.not25, label %84, label %82

82:                                               ; preds = %.loopexit
  %83 = call noundef ptr @_ZN9VmaVectorI22VmaDefragmentationMove15VmaStlAllocatorIS0_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(32) %79)
  br label %84

84:                                               ; preds = %.loopexit, %82
  %.sink = phi ptr [ %83, %82 ], [ null, %.loopexit ]
  %.022 = phi i32 [ 5, %82 ], [ 0, %.loopexit ]
  %85 = getelementptr inbounds i8, ptr %1, i64 8
  store ptr %.sink, ptr %85, align 8
  ret i32 %.022

86:                                               ; preds = %60, %23
  %.pn = phi { ptr, i32 } [ %24, %23 ], [ %61, %60 ]
  resume { ptr, i32 } %.pn
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN27VmaDefragmentationContext_T22ComputeDefragmentationER14VmaBlockVectorm(ptr noundef nonnull align 8 dereferenceable(168), ptr noundef nonnull align 8 dereferenceable(181), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN27VmaDefragmentationContext_T18ReallocWithinBlockER14VmaBlockVectorP20VmaDeviceMemoryBlock(ptr noundef nonnull align 8 dereferenceable(168), ptr noundef nonnull align 8 dereferenceable(181), ptr noundef) local_unnamed_addr #1 align 2

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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, !11, i64 88}
!6 = !{!"_ZTS27VmaDefragmentationContext_T", !7, i64 0, !10, i64 8, !11, i64 16, !11, i64 24, !12, i64 32, !13, i64 40, !8, i64 72, !10, i64 76, !10, i64 80, !11, i64 88, !11, i64 96, !7, i64 104, !14, i64 112, !14, i64 136, !11, i64 160}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"_ZTS15VmaStlAllocatorI22VmaDefragmentationMoveE", !11, i64 0}
!13 = !{!"_ZTS9VmaVectorI22VmaDefragmentationMove15VmaStlAllocatorIS0_EE", !12, i64 0, !11, i64 8, !7, i64 16, !7, i64 24}
!14 = !{!"_ZTS23VmaDefragmentationStats", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20}
!15 = !{!6, !10, i64 80}
!16 = !{!17, !18, i64 0}
!17 = !{!"_ZTS14VmaAllocator_T", !18, i64 0, !10, i64 4, !18, i64 8, !18, i64 9, !18, i64 10, !18, i64 11, !18, i64 12, !18, i64 13, !11, i64 16, !11, i64 24, !18, i64 32, !19, i64 40, !20, i64 88, !21, i64 112, !10, i64 200, !28, i64 208, !33, i64 1032, !8, i64 1552, !8, i64 1808, !34, i64 4624, !35, i64 5456, !7, i64 5464, !11, i64 5472, !35, i64 5480, !35, i64 5484, !8, i64 5488, !37, i64 5616, !40, i64 5672, !10, i64 5696, !41, i64 5704, !10, i64 5912}
!18 = !{!"bool", !8, i64 0}
!19 = !{!"_ZTS21VkAllocationCallbacks", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40}
!20 = !{!"_ZTS24VmaDeviceMemoryCallbacks", !11, i64 0, !11, i64 8, !11, i64 16}
!21 = !{!"_ZTS28VmaAllocationObjectAllocator", !22, i64 0, !25, i64 40}
!22 = !{!"_ZTS8VmaMutex", !23, i64 0}
!23 = !{!"_ZTSSt5mutex", !24, i64 0}
!24 = !{!"_ZTSSt12__mutex_base", !8, i64 0}
!25 = !{!"_ZTS16VmaPoolAllocatorI15VmaAllocation_TE", !11, i64 0, !10, i64 8, !26, i64 16}
!26 = !{!"_ZTS9VmaVectorIN16VmaPoolAllocatorI15VmaAllocation_TE9ItemBlockE15VmaStlAllocatorIS3_EE", !27, i64 0, !11, i64 8, !7, i64 16, !7, i64 24}
!27 = !{!"_ZTS15VmaStlAllocatorIN16VmaPoolAllocatorI15VmaAllocation_TE9ItemBlockEE", !11, i64 0}
!28 = !{!"_ZTS26VkPhysicalDeviceProperties", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !29, i64 16, !8, i64 20, !8, i64 276, !30, i64 296, !32, i64 800}
!29 = !{!"_ZTS20VkPhysicalDeviceType", !8, 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, !7, i64 48, !7, 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, !31, i64 268, !31, i64 272, !10, i64 276, !8, i64 280, !8, i64 288, !10, i64 296, !7, i64 304, !7, i64 312, !7, i64 320, !7, 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, !8, i64 444, !8, i64 452, !31, i64 460, !31, i64 464, !10, i64 468, !10, i64 472, !7, i64 480, !7, i64 488, !7, i64 496}
!31 = !{!"float", !8, i64 0}
!32 = !{!"_ZTS32VkPhysicalDeviceSparseProperties", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16}
!33 = !{!"_ZTS32VkPhysicalDeviceMemoryProperties", !10, i64 0, !8, i64 4, !10, i64 260, !8, i64 264}
!34 = !{!"_ZTS20VmaCurrentBudgetData", !8, i64 0, !8, i64 64, !8, i64 128, !8, i64 256, !35, i64 384, !37, i64 392, !8, i64 448, !8, i64 576, !8, 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", !8, i64 0}
!40 = !{!"_ZTS22VmaIntrusiveLinkedListI21VmaPoolListItemTraitsE", !11, i64 0, !11, i64 8, !7, i64 16}
!41 = !{!"_ZTS18VmaVulkanFunctions", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96, !11, i64 104, !11, i64 112, !11, i64 120, !11, i64 128, !11, i64 136, !11, i64 144, !11, i64 152, !11, i64 160, !11, i64 168, !11, i64 176, !11, i64 184, !11, i64 192, !11, i64 200}
!42 = !{i8 0, i8 2}
!43 = !{}
!44 = !{!6, !11, i64 96}
!45 = !{!11, !11, i64 0}
!46 = distinct !{!46, !47}
!47 = !{!"llvm.loop.mustprogress"}
!48 = !{!49, !10, i64 0}
!49 = !{!"_ZTS30VmaDefragmentationPassMoveInfo", !10, i64 0, !11, i64 8}


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