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

%class.VmaBlockVector = type <{ ptr, ptr, i32, [4 x i8], i64, i64, i64, i64, i8, [3 x i8], i32, float, [4 x i8], i64, ptr, %class.VmaRWMutex, %class.VmaVector.15, i32, i8, [3 x i8] }>
%class.VmaRWMutex = type { %"class.std::shared_mutex" }
%"class.std::shared_mutex" = type { %"class.std::__shared_mutex_pthread" }
%"class.std::__shared_mutex_pthread" = type { %union.pthread_rwlock_t }
%union.pthread_rwlock_t = type { %struct.__pthread_rwlock_arch_t }
%struct.__pthread_rwlock_arch_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i8, [7 x i8], i64, i32 }
%class.VmaVector.15 = type { %struct.VmaStlAllocator.16, ptr, i64, i64 }
%struct.VmaStlAllocator.16 = type { ptr }
%struct.VmaAllocator_T = type <{ i8, [3 x i8], i32, i8, i8, i8, i8, i8, i8, [2 x i8], ptr, ptr, i8, [7 x i8], %struct.VkAllocationCallbacks, %struct.VmaDeviceMemoryCallbacks, %class.VmaAllocationObjectAllocator, i32, [4 x i8], %struct.VkPhysicalDeviceProperties, %struct.VkPhysicalDeviceMemoryProperties, [32 x ptr], [32 x %class.VmaDedicatedAllocationList], %struct.VmaCurrentBudgetData, %"struct.std::atomic", [4 x i8], i64, ptr, %"struct.std::atomic", %"struct.std::atomic", [32 x i32], %class.VmaRWMutex, %class.VmaIntrusiveLinkedList.14, i32, [4 x i8], %struct.VmaVulkanFunctions, i32, [4 x i8] }>
%struct.VkAllocationCallbacks = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.VmaDeviceMemoryCallbacks = type { ptr, ptr, ptr }
%class.VmaAllocationObjectAllocator = type { %class.VmaMutex, %class.VmaPoolAllocator.11 }
%class.VmaMutex = type { %"class.std::mutex" }
%"class.std::mutex" = type { %"class.std::__mutex_base" }
%"class.std::__mutex_base" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%class.VmaPoolAllocator.11 = type { ptr, i32, %class.VmaVector.12 }
%class.VmaVector.12 = type { %struct.VmaStlAllocator.13, ptr, i64, i64 }
%struct.VmaStlAllocator.13 = type { ptr }
%struct.VkPhysicalDeviceProperties = type { i32, i32, i32, i32, i32, [256 x i8], [16 x i8], %struct.VkPhysicalDeviceLimits, %struct.VkPhysicalDeviceSparseProperties }
%struct.VkPhysicalDeviceLimits = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [3 x i32], i32, [3 x i32], i32, i32, i32, i32, i32, float, float, i32, [2 x i32], [2 x float], i32, i64, i64, i64, i64, i32, i32, i32, i32, float, float, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, i32, i32, i32, i32, [2 x float], [2 x float], float, float, i32, i32, i64, i64, i64 }
%struct.VkPhysicalDeviceSparseProperties = type { i32, i32, i32, i32, i32 }
%struct.VkPhysicalDeviceMemoryProperties = type { i32, [32 x %struct.VkMemoryType], i32, [16 x %struct.VkMemoryHeap] }
%struct.VkMemoryType = type { i32, i32 }
%struct.VkMemoryHeap = type { i64, i32 }
%class.VmaDedicatedAllocationList = type { i8, %class.VmaRWMutex, %class.VmaIntrusiveLinkedList }
%class.VmaIntrusiveLinkedList = type { ptr, ptr, i64 }
%struct.VmaCurrentBudgetData = type { [16 x %"struct.std::atomic"], [16 x %"struct.std::atomic"], [16 x %"struct.std::atomic.9"], [16 x %"struct.std::atomic.9"], %"struct.std::atomic", %class.VmaRWMutex, [16 x i64], [16 x i64], [16 x i64] }
%"struct.std::atomic.9" = type { %"struct.std::__atomic_base.10" }
%"struct.std::__atomic_base.10" = type { i64 }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%class.VmaIntrusiveLinkedList.14 = type { ptr, ptr, i64 }
%struct.VmaVulkanFunctions = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%class.VmaDeviceMemoryBlock = type { ptr, ptr, i32, i32, ptr, %class.VmaMutex, %class.VmaMappingHysteresis, i32, ptr }
%class.VmaMappingHysteresis = type { i32, i32, i32 }
%struct.VmaAllocationRequest = type <{ ptr, i64, %"class.VmaList<VmaSuballocation, VmaStlAllocator<VmaSuballocation>>::iterator", ptr, i64, i32, [4 x i8] }>
%"class.VmaList<VmaSuballocation, VmaStlAllocator<VmaSuballocation>>::iterator" = type { ptr, ptr }

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN20VmaCurrentBudgetData13AddAllocationEjm(ptr noundef nonnull align 8 dereferenceable(832), i32 noundef, i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN20VmaDeviceMemoryBlock9PostAllocEP14VmaAllocator_T(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN20VmaDeviceMemoryBlock3MapEP14VmaAllocator_TjPPv(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef, i32 noundef, ptr noundef) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN20VmaDeviceMemoryBlock30WriteMagicValueAfterAllocationEP14VmaAllocator_Tmm(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef, i64 noundef, i64 noundef) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15VmaAllocation_T19InitBlockAllocationEP20VmaDeviceMemoryBlockP16VmaAllocHandle_Tmmj20VmaSuballocationTypeb(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef, ptr noundef, i64 noundef, i64 noundef, i32 noundef, i32 noundef, i1 noundef zeroext) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15VmaAllocation_T7SetNameEP14VmaAllocator_TPKc(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef, ptr noundef) #3 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN14VmaBlockVector23CommitAllocationRequestER20VmaAllocationRequestP20VmaDeviceMemoryBlockmjPv20VmaSuballocationTypePP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(181) %0, ptr noundef nonnull align 8 dereferenceable(52) %1, ptr noundef %2, i64 noundef %3, i32 noundef %4, ptr noundef %5, i32 noundef %6, ptr noundef %7) #3 align 2 {
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i8, align 1
  %19 = alloca i8, align 1
  %20 = alloca i8, align 1
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store ptr %2, ptr %12, align 8, !tbaa !5
  store i64 %3, ptr %13, align 8, !tbaa !9
  store i32 %4, ptr %14, align 4, !tbaa !11
  store ptr %5, ptr %15, align 8, !tbaa !5
  store i32 %6, ptr %16, align 4, !tbaa !13
  store ptr %7, ptr %17, align 8, !tbaa !5
  %24 = load ptr, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #4
  %25 = load i32, ptr %14, align 4, !tbaa !11
  %26 = and i32 %25, 4
  %27 = icmp ne i32 %26, 0
  %28 = zext i1 %27 to i8
  store i8 %28, ptr %18, align 1, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #4
  %29 = load i32, ptr %14, align 4, !tbaa !11
  %30 = and i32 %29, 32
  %31 = icmp ne i32 %30, 0
  %32 = zext i1 %31 to i8
  store i8 %32, ptr %19, align 1, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #4
  %33 = load i32, ptr %14, align 4, !tbaa !11
  %34 = and i32 %33, 3072
  %35 = icmp ne i32 %34, 0
  %36 = zext i1 %35 to i8
  store i8 %36, ptr %20, align 1, !tbaa !15
  %37 = load ptr, ptr %12, align 8, !tbaa !5
  %38 = getelementptr inbounds %class.VmaBlockVector, ptr %24, i32 0, i32 0
  %39 = load ptr, ptr %38, align 8, !tbaa !17
  call void @_ZN20VmaDeviceMemoryBlock9PostAllocEP14VmaAllocator_T(ptr noundef nonnull align 8 dereferenceable(96) %37, ptr noundef %39)
  %40 = load i8, ptr %18, align 1, !tbaa !15, !range !25, !noundef !26
  %41 = trunc i8 %40 to i1
  br i1 %41, label %42, label %55

42:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  %43 = load ptr, ptr %12, align 8, !tbaa !5
  %44 = getelementptr inbounds %class.VmaBlockVector, ptr %24, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !17
  %46 = call noundef i32 @_ZN20VmaDeviceMemoryBlock3MapEP14VmaAllocator_TjPPv(ptr noundef nonnull align 8 dereferenceable(96) %43, ptr noundef %45, i32 noundef 1, ptr noundef null)
  store i32 %46, ptr %21, align 4, !tbaa !27
  %47 = load i32, ptr %21, align 4, !tbaa !27
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %51

49:                                               ; preds = %42
  %50 = load i32, ptr %21, align 4, !tbaa !27
  store i32 %50, ptr %9, align 4
  store i32 1, ptr %22, align 4
  br label %52

51:                                               ; preds = %42
  store i32 0, ptr %22, align 4
  br label %52

52:                                               ; preds = %51, %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  %53 = load i32, ptr %22, align 4
  switch i32 %53, label %134 [
    i32 0, label %54
  ]

54:                                               ; preds = %52
  br label %55

55:                                               ; preds = %54, %8
  %56 = getelementptr inbounds %class.VmaBlockVector, ptr %24, i32 0, i32 0
  %57 = load ptr, ptr %56, align 8, !tbaa !17
  %58 = getelementptr inbounds %struct.VmaAllocator_T, ptr %57, i32 0, i32 16
  %59 = call noundef ptr @_ZN28VmaAllocationObjectAllocator8AllocateIJRKbEEEP15VmaAllocation_TDpOT_(ptr noundef nonnull align 8 dereferenceable(88) %58, ptr noundef nonnull align 1 dereferenceable(1) %20)
  %60 = load ptr, ptr %17, align 8, !tbaa !5
  store ptr %59, ptr %60, align 8, !tbaa !5
  %61 = load ptr, ptr %12, align 8, !tbaa !5
  %62 = getelementptr inbounds %class.VmaDeviceMemoryBlock, ptr %61, i32 0, i32 0
  %63 = load ptr, ptr %62, align 8, !tbaa !29
  %64 = load ptr, ptr %11, align 8, !tbaa !5
  %65 = load i32, ptr %16, align 4, !tbaa !13
  %66 = load ptr, ptr %17, align 8, !tbaa !5
  %67 = load ptr, ptr %66, align 8, !tbaa !5
  %68 = load ptr, ptr %63, align 8, !tbaa !35
  %69 = getelementptr inbounds ptr, ptr %68, i64 19
  %70 = load ptr, ptr %69, align 8
  call void %70(ptr noundef nonnull align 8 dereferenceable(33) %63, ptr noundef nonnull align 8 dereferenceable(52) %64, i32 noundef %65, ptr noundef %67)
  %71 = load ptr, ptr %17, align 8, !tbaa !5
  %72 = load ptr, ptr %71, align 8, !tbaa !5
  %73 = load ptr, ptr %12, align 8, !tbaa !5
  %74 = load ptr, ptr %11, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.VmaAllocationRequest, ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %75, align 8, !tbaa !37
  %77 = load i64, ptr %13, align 8, !tbaa !9
  %78 = load ptr, ptr %11, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.VmaAllocationRequest, ptr %78, i32 0, i32 1
  %80 = load i64, ptr %79, align 8, !tbaa !41
  %81 = getelementptr inbounds %class.VmaBlockVector, ptr %24, i32 0, i32 2
  %82 = load i32, ptr %81, align 8, !tbaa !42
  %83 = load i32, ptr %16, align 4, !tbaa !13
  %84 = load i8, ptr %18, align 1, !tbaa !15, !range !25, !noundef !26
  %85 = trunc i8 %84 to i1
  call void @_ZN15VmaAllocation_T19InitBlockAllocationEP20VmaDeviceMemoryBlockP16VmaAllocHandle_Tmmj20VmaSuballocationTypeb(ptr noundef nonnull align 8 dereferenceable(84) %72, ptr noundef %73, ptr noundef %76, i64 noundef %77, i64 noundef %80, i32 noundef %82, i32 noundef %83, i1 noundef zeroext %85)
  %86 = load i8, ptr %19, align 1, !tbaa !15, !range !25, !noundef !26
  %87 = trunc i8 %86 to i1
  br i1 %87, label %88, label %94

88:                                               ; preds = %55
  %89 = load ptr, ptr %17, align 8, !tbaa !5
  %90 = load ptr, ptr %89, align 8, !tbaa !5
  %91 = getelementptr inbounds %class.VmaBlockVector, ptr %24, i32 0, i32 0
  %92 = load ptr, ptr %91, align 8, !tbaa !17
  %93 = load ptr, ptr %15, align 8, !tbaa !5
  call void @_ZN15VmaAllocation_T7SetNameEP14VmaAllocator_TPKc(ptr noundef nonnull align 8 dereferenceable(84) %90, ptr noundef %92, ptr noundef %93)
  br label %100

94:                                               ; preds = %55
  %95 = load ptr, ptr %17, align 8, !tbaa !5
  %96 = load ptr, ptr %95, align 8, !tbaa !5
  %97 = getelementptr inbounds %class.VmaBlockVector, ptr %24, i32 0, i32 0
  %98 = load ptr, ptr %97, align 8, !tbaa !17
  %99 = load ptr, ptr %15, align 8, !tbaa !5
  call void @_ZN15VmaAllocation_T11SetUserDataEP14VmaAllocator_TPv(ptr noundef nonnull align 8 dereferenceable(84) %96, ptr noundef %98, ptr noundef %99)
  br label %100

100:                                              ; preds = %94, %88
  %101 = getelementptr inbounds %class.VmaBlockVector, ptr %24, i32 0, i32 0
  %102 = load ptr, ptr %101, align 8, !tbaa !17
  %103 = getelementptr inbounds %struct.VmaAllocator_T, ptr %102, i32 0, i32 23
  %104 = getelementptr inbounds %class.VmaBlockVector, ptr %24, i32 0, i32 0
  %105 = load ptr, ptr %104, align 8, !tbaa !17
  %106 = getelementptr inbounds %class.VmaBlockVector, ptr %24, i32 0, i32 2
  %107 = load i32, ptr %106, align 8, !tbaa !42
  %108 = call noundef i32 @_ZNK14VmaAllocator_T26MemoryTypeIndexToHeapIndexEj(ptr noundef nonnull align 8 dereferenceable(5916) %105, i32 noundef %107)
  %109 = load ptr, ptr %11, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.VmaAllocationRequest, ptr %109, i32 0, i32 1
  %111 = load i64, ptr %110, align 8, !tbaa !41
  call void @_ZN20VmaCurrentBudgetData13AddAllocationEjm(ptr noundef nonnull align 8 dereferenceable(832) %103, i32 noundef %108, i64 noundef %111)
  %112 = call noundef zeroext i1 @_ZNK14VmaBlockVector28IsCorruptionDetectionEnabledEv(ptr noundef nonnull align 8 dereferenceable(181) %24)
  br i1 %112, label %113, label %133

113:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #4
  %114 = load ptr, ptr %12, align 8, !tbaa !5
  %115 = getelementptr inbounds %class.VmaBlockVector, ptr %24, i32 0, i32 0
  %116 = load ptr, ptr %115, align 8, !tbaa !17
  %117 = load ptr, ptr %17, align 8, !tbaa !5
  %118 = load ptr, ptr %117, align 8, !tbaa !5
  %119 = call noundef i64 @_ZNK15VmaAllocation_T9GetOffsetEv(ptr noundef nonnull align 8 dereferenceable(84) %118)
  %120 = load ptr, ptr %11, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.VmaAllocationRequest, ptr %120, i32 0, i32 1
  %122 = load i64, ptr %121, align 8, !tbaa !41
  %123 = call noundef i32 @_ZN20VmaDeviceMemoryBlock30WriteMagicValueAfterAllocationEP14VmaAllocator_Tmm(ptr noundef nonnull align 8 dereferenceable(96) %114, ptr noundef %116, i64 noundef %119, i64 noundef %122)
  store i32 %123, ptr %23, align 4, !tbaa !27
  %124 = load i32, ptr %23, align 4, !tbaa !27
  %125 = icmp eq i32 %124, 0
  br i1 %125, label %126, label %127

126:                                              ; preds = %113
  br label %127

127:                                              ; preds = %126, %113
  %128 = phi i1 [ false, %113 ], [ true, %126 ]
  br i1 %128, label %129, label %130

129:                                              ; preds = %127
  br label %132

130:                                              ; preds = %127
  call void @__assert_fail(ptr noundef @.str.184, ptr noundef @.str.2, i32 noundef 12908, ptr noundef @__PRETTY_FUNCTION__._ZN14VmaBlockVector23CommitAllocationRequestER20VmaAllocationRequestP20VmaDeviceMemoryBlockmjPv20VmaSuballocationTypePP15VmaAllocation_T) #5
  unreachable

131:                                              ; No predecessors!
  br label %132

132:                                              ; preds = %131, %129
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #4
  br label %133

133:                                              ; preds = %132, %100
  store i32 0, ptr %9, align 4
  store i32 1, ptr %22, align 4
  br label %134

134:                                              ; preds = %133, %52
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #4
  %135 = load i32, ptr %9, align 4
  ret i32 %135
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN28VmaAllocationObjectAllocator8AllocateIJRKbEEEP15VmaAllocation_TDpOT_(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 1 dereferenceable(1)) #3 align 2

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

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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_ZTS20VmaSuballocationType", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{!18, !6, i64 0}
!18 = !{!"_ZTS14VmaBlockVector", !6, i64 0, !6, i64 8, !12, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !16, i64 56, !12, i64 60, !19, i64 64, !10, i64 72, !6, i64 80, !20, i64 88, !23, i64 144, !12, i64 176, !16, i64 180}
!19 = !{!"float", !7, i64 0}
!20 = !{!"_ZTS10VmaRWMutex", !21, i64 0}
!21 = !{!"_ZTSSt12shared_mutex", !22, i64 0}
!22 = !{!"_ZTSSt22__shared_mutex_pthread", !7, i64 0}
!23 = !{!"_ZTS9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EE", !24, i64 0, !6, i64 8, !10, i64 16, !10, i64 24}
!24 = !{!"_ZTS15VmaStlAllocatorIP20VmaDeviceMemoryBlockE", !6, i64 0}
!25 = !{i8 0, i8 2}
!26 = !{}
!27 = !{!28, !28, i64 0}
!28 = !{!"_ZTS8VkResult", !7, i64 0}
!29 = !{!30, !6, i64 0}
!30 = !{!"_ZTS20VmaDeviceMemoryBlock", !6, i64 0, !6, i64 8, !12, i64 16, !12, i64 20, !6, i64 24, !31, i64 32, !34, i64 72, !12, i64 84, !6, i64 88}
!31 = !{!"_ZTS8VmaMutex", !32, i64 0}
!32 = !{!"_ZTSSt5mutex", !33, i64 0}
!33 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!34 = !{!"_ZTS20VmaMappingHysteresis", !12, i64 0, !12, i64 4, !12, i64 8}
!35 = !{!36, !36, i64 0}
!36 = !{!"vtable pointer", !8, i64 0}
!37 = !{!38, !6, i64 0}
!38 = !{!"_ZTS20VmaAllocationRequest", !6, i64 0, !10, i64 8, !39, i64 16, !6, i64 32, !10, i64 40, !40, i64 48}
!39 = !{!"_ZTSN7VmaListI16VmaSuballocation15VmaStlAllocatorIS0_EE8iteratorE", !6, i64 0, !6, i64 8}
!40 = !{!"_ZTS24VmaAllocationRequestType", !7, i64 0}
!41 = !{!38, !10, i64 8}
!42 = !{!18, !12, i64 16}


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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN20VmaCurrentBudgetData13AddAllocationEjm(ptr noundef nonnull align 8 dereferenceable(832), i32 noundef, i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN20VmaDeviceMemoryBlock9PostAllocEP14VmaAllocator_T(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN20VmaDeviceMemoryBlock3MapEP14VmaAllocator_TjPPv(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN20VmaDeviceMemoryBlock30WriteMagicValueAfterAllocationEP14VmaAllocator_Tmm(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15VmaAllocation_T19InitBlockAllocationEP20VmaDeviceMemoryBlockP16VmaAllocHandle_Tmmj20VmaSuballocationTypeb(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef, ptr noundef, i64 noundef, i64 noundef, i32 noundef, i32 noundef, i1 noundef zeroext) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15VmaAllocation_T7SetNameEP14VmaAllocator_TPKc(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef, ptr 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 #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN14VmaBlockVector23CommitAllocationRequestER20VmaAllocationRequestP20VmaDeviceMemoryBlockmjPv20VmaSuballocationTypePP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(181) %0, ptr noundef nonnull align 8 dereferenceable(52) %1, ptr noundef nonnull %2, i64 noundef %3, i32 noundef %4, ptr noundef %5, i32 noundef %6, ptr nocapture noundef %7) local_unnamed_addr #3 align 2 {
  %9 = alloca i8, align 1
  %10 = and i32 %4, 4
  %11 = icmp ne i32 %10, 0
  %12 = and i32 %4, 32
  %.not = icmp eq i32 %12, 0
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %9) #4
  %13 = and i32 %4, 3072
  %14 = icmp ne i32 %13, 0
  %15 = zext i1 %14 to i8
  store i8 %15, ptr %9, align 1, !tbaa !5
  %16 = load ptr, ptr %0, align 8, !tbaa !9
  tail call void @_ZN20VmaDeviceMemoryBlock9PostAllocEP14VmaAllocator_T(ptr noundef nonnull align 8 dereferenceable(96) %2, ptr noundef %16)
  br i1 %11, label %17, label %20

17:                                               ; preds = %8
  %18 = load ptr, ptr %0, align 8, !tbaa !9
  %19 = tail call noundef i32 @_ZN20VmaDeviceMemoryBlock3MapEP14VmaAllocator_TjPPv(ptr noundef nonnull align 8 dereferenceable(96) %2, ptr noundef %18, i32 noundef 1, ptr noundef null)
  %.not33 = icmp eq i32 %19, 0
  br i1 %.not33, label %20, label %53

20:                                               ; preds = %17, %8
  %21 = load ptr, ptr %0, align 8, !tbaa !9
  %22 = getelementptr inbounds i8, ptr %21, i64 112
  %23 = call noundef ptr @_ZN28VmaAllocationObjectAllocator8AllocateIJRKbEEEP15VmaAllocation_TDpOT_(ptr noundef nonnull align 8 dereferenceable(88) %22, ptr noundef nonnull align 1 dereferenceable(1) %9)
  store ptr %23, ptr %7, align 8, !tbaa !20
  %24 = load ptr, ptr %2, align 8, !tbaa !21
  %25 = load ptr, ptr %24, align 8, !tbaa !27
  %26 = getelementptr inbounds i8, ptr %25, i64 152
  %27 = load ptr, ptr %26, align 8
  call void %27(ptr noundef nonnull align 8 dereferenceable(33) %24, ptr noundef nonnull align 8 dereferenceable(52) %1, i32 noundef %6, ptr noundef %23)
  %28 = load ptr, ptr %7, align 8, !tbaa !20
  %29 = load ptr, ptr %1, align 8, !tbaa !29
  %30 = getelementptr inbounds i8, ptr %1, i64 8
  %31 = load i64, ptr %30, align 8, !tbaa !33
  %32 = getelementptr inbounds i8, ptr %0, i64 16
  %33 = load i32, ptr %32, align 8, !tbaa !34
  call void @_ZN15VmaAllocation_T19InitBlockAllocationEP20VmaDeviceMemoryBlockP16VmaAllocHandle_Tmmj20VmaSuballocationTypeb(ptr noundef nonnull align 8 dereferenceable(84) %28, ptr noundef nonnull %2, ptr noundef %29, i64 noundef %3, i64 noundef %31, i32 noundef %33, i32 noundef %6, i1 noundef zeroext %11)
  %34 = load ptr, ptr %7, align 8, !tbaa !20
  %35 = load ptr, ptr %0, align 8, !tbaa !9
  br i1 %.not, label %37, label %36

36:                                               ; preds = %20
  call void @_ZN15VmaAllocation_T7SetNameEP14VmaAllocator_TPKc(ptr noundef nonnull align 8 dereferenceable(84) %34, ptr noundef %35, ptr noundef %5)
  br label %38

37:                                               ; preds = %20
  call void @_ZN15VmaAllocation_T11SetUserDataEP14VmaAllocator_TPv(ptr noundef nonnull align 8 dereferenceable(84) %34, ptr noundef %35, ptr noundef %5)
  br label %38

38:                                               ; preds = %37, %36
  %39 = load ptr, ptr %0, align 8, !tbaa !9
  %40 = getelementptr inbounds i8, ptr %39, i64 4624
  %41 = load i32, ptr %32, align 8, !tbaa !34
  %42 = call noundef i32 @_ZNK14VmaAllocator_T26MemoryTypeIndexToHeapIndexEj(ptr noundef nonnull align 8 dereferenceable(5916) %39, i32 noundef %41)
  %43 = load i64, ptr %30, align 8, !tbaa !33
  call void @_ZN20VmaCurrentBudgetData13AddAllocationEjm(ptr noundef nonnull align 8 dereferenceable(832) %40, i32 noundef %42, i64 noundef %43)
  %44 = call noundef zeroext i1 @_ZNK14VmaBlockVector28IsCorruptionDetectionEnabledEv(ptr noundef nonnull align 8 dereferenceable(181) %0)
  br i1 %44, label %45, label %53

45:                                               ; preds = %38
  %46 = load ptr, ptr %0, align 8, !tbaa !9
  %47 = load ptr, ptr %7, align 8, !tbaa !20
  %48 = call noundef i64 @_ZNK15VmaAllocation_T9GetOffsetEv(ptr noundef nonnull align 8 dereferenceable(84) %47)
  %49 = load i64, ptr %30, align 8, !tbaa !33
  %50 = call noundef i32 @_ZN20VmaDeviceMemoryBlock30WriteMagicValueAfterAllocationEP14VmaAllocator_Tmm(ptr noundef nonnull align 8 dereferenceable(96) %2, ptr noundef %46, i64 noundef %48, i64 noundef %49)
  %51 = icmp eq i32 %50, 0
  br i1 %51, label %53, label %52

52:                                               ; preds = %45
  call void @__assert_fail(ptr noundef nonnull @.str.184, ptr noundef nonnull @.str.2, i32 noundef 12908, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN14VmaBlockVector23CommitAllocationRequestER20VmaAllocationRequestP20VmaDeviceMemoryBlockmjPv20VmaSuballocationTypePP15VmaAllocation_T) #5
  unreachable

53:                                               ; preds = %38, %45, %17
  %.1 = phi i32 [ %19, %17 ], [ 0, %45 ], [ 0, %38 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #4
  ret i32 %.1
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN28VmaAllocationObjectAllocator8AllocateIJRKbEEEP15VmaAllocation_TDpOT_(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15VmaAllocation_T11SetUserDataEP14VmaAllocator_TPv(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef, ptr noundef) local_unnamed_addr #2 align 2

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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTS14VmaBlockVector", !11, i64 0, !11, i64 8, !12, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !13, i64 48, !6, i64 56, !12, i64 60, !14, i64 64, !13, i64 72, !11, i64 80, !15, i64 88, !18, i64 144, !12, i64 176, !6, i64 180}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!"_ZTS10VmaRWMutex", !16, i64 0}
!16 = !{!"_ZTSSt12shared_mutex", !17, i64 0}
!17 = !{!"_ZTSSt22__shared_mutex_pthread", !7, i64 0}
!18 = !{!"_ZTS9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EE", !19, i64 0, !11, i64 8, !13, i64 16, !13, i64 24}
!19 = !{!"_ZTS15VmaStlAllocatorIP20VmaDeviceMemoryBlockE", !11, i64 0}
!20 = !{!11, !11, i64 0}
!21 = !{!22, !11, i64 0}
!22 = !{!"_ZTS20VmaDeviceMemoryBlock", !11, i64 0, !11, i64 8, !12, i64 16, !12, i64 20, !11, i64 24, !23, i64 32, !26, i64 72, !12, i64 84, !11, i64 88}
!23 = !{!"_ZTS8VmaMutex", !24, i64 0}
!24 = !{!"_ZTSSt5mutex", !25, i64 0}
!25 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!26 = !{!"_ZTS20VmaMappingHysteresis", !12, i64 0, !12, i64 4, !12, i64 8}
!27 = !{!28, !28, i64 0}
!28 = !{!"vtable pointer", !8, i64 0}
!29 = !{!30, !11, i64 0}
!30 = !{!"_ZTS20VmaAllocationRequest", !11, i64 0, !13, i64 8, !31, i64 16, !11, i64 32, !13, i64 40, !32, i64 48}
!31 = !{!"_ZTSN7VmaListI16VmaSuballocation15VmaStlAllocatorIS0_EE8iteratorE", !11, i64 0, !11, i64 8}
!32 = !{!"_ZTS24VmaAllocationRequestType", !7, i64 0}
!33 = !{!30, !13, i64 8}
!34 = !{!10, !12, i64 16}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass