; 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.VmaAllocationCreateInfo = type { i32, i32, i32, i32, i32, ptr, ptr, float }
%struct.VkMemoryRequirements = type { i64, i64, i32 }
%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.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 }
%class.VmaDedicatedAllocationList = type { i8, %class.VmaRWMutex, %class.VmaIntrusiveLinkedList }
%class.VmaIntrusiveLinkedList = type { ptr, ptr, i64 }
%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 }
%struct.VmaCurrentBudgetData = type { [16 x %"struct.std::atomic"], [16 x %"struct.std::atomic"], [16 x %"struct.std::atomic.9"], [16 x %"struct.std::atomic.9"], %"struct.std::atomic", %class.VmaRWMutex, [16 x i64], [16 x i64], [16 x i64] }
%"struct.std::atomic.9" = type { %"struct.std::__atomic_base.10" }
%"struct.std::__atomic_base.10" = type { i64 }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%class.VmaIntrusiveLinkedList.14 = type { ptr, ptr, i64 }
%struct.VmaVulkanFunctions = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@.str.2 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.267 = external hidden unnamed_addr constant [30 x i8], align 1
@__PRETTY_FUNCTION__._ZN14VmaAllocator_T14AllocateMemoryERK20VkMemoryRequirementsbbP10VkBuffer_TP9VkImage_TjRK23VmaAllocationCreateInfo20VmaSuballocationTypemPP15VmaAllocation_T = external hidden unnamed_addr constant [190 x i8], align 1
@.str.269 = external hidden unnamed_addr constant [56 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; 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) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z9VmaIsPow2ImEbT_(i64 noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN14VmaAllocator_T20AllocateMemoryOfTypeEP9VmaPool_TmmbP10VkBuffer_TP9VkImage_TjRK23VmaAllocationCreateInfoj20VmaSuballocationTypeR26VmaDedicatedAllocationListR14VmaBlockVectormPP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(5916), ptr noundef, i64 noundef, i64 noundef, i1 noundef zeroext, ptr noundef, ptr noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(48), i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(181), i64 noundef, ptr noundef) #5 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN14VmaAllocator_T20CalcAllocationParamsER23VmaAllocationCreateInfobb(ptr noundef nonnull align 8 dereferenceable(5916), ptr noundef nonnull align 8 dereferenceable(48), i1 noundef zeroext, i1 noundef zeroext) #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN14VmaAllocator_T14AllocateMemoryERK20VkMemoryRequirementsbbP10VkBuffer_TP9VkImage_TjRK23VmaAllocationCreateInfo20VmaSuballocationTypemPP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(5916) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i1 noundef zeroext %2, i1 noundef zeroext %3, ptr noundef %4, ptr noundef %5, i32 noundef %6, ptr noundef nonnull align 8 dereferenceable(48) %7, i32 noundef %8, i64 noundef %9, ptr noundef %10) #5 align 2 {
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i8, align 1
  %16 = alloca i8, align 1
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca i64, align 8
  %23 = alloca ptr, align 8
  %24 = alloca %struct.VmaAllocationCreateInfo, align 8
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca ptr, align 8
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca ptr, align 8
  store ptr %0, ptr %13, align 8, !tbaa !5
  store ptr %1, ptr %14, align 8, !tbaa !5
  %31 = zext i1 %2 to i8
  store i8 %31, ptr %15, align 1, !tbaa !9
  %32 = zext i1 %3 to i8
  store i8 %32, ptr %16, align 1, !tbaa !9
  store ptr %4, ptr %17, align 8, !tbaa !5
  store ptr %5, ptr %18, align 8, !tbaa !5
  store i32 %6, ptr %19, align 4, !tbaa !11
  store ptr %7, ptr %20, align 8, !tbaa !5
  store i32 %8, ptr %21, align 4, !tbaa !13
  store i64 %9, ptr %22, align 8, !tbaa !15
  store ptr %10, ptr %23, align 8, !tbaa !5
  %33 = load ptr, ptr %13, align 8
  %34 = load ptr, ptr %23, align 8, !tbaa !5
  %35 = load i64, ptr %22, align 8, !tbaa !15
  %36 = mul i64 8, %35
  call void @llvm.memset.p0.i64(ptr align 8 %34, i8 0, i64 %36, i1 false)
  %37 = load ptr, ptr %14, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.VkMemoryRequirements, ptr %37, i32 0, i32 1
  %39 = load i64, ptr %38, align 8, !tbaa !17
  %40 = call noundef zeroext i1 @_Z9VmaIsPow2ImEbT_(i64 noundef %39)
  br i1 %40, label %41, label %42

41:                                               ; preds = %11
  br label %44

42:                                               ; preds = %11
  call void @__assert_fail(ptr noundef @.str.267, ptr noundef @.str.2, i32 noundef 15117, ptr noundef @__PRETTY_FUNCTION__._ZN14VmaAllocator_T14AllocateMemoryERK20VkMemoryRequirementsbbP10VkBuffer_TP9VkImage_TjRK23VmaAllocationCreateInfo20VmaSuballocationTypemPP15VmaAllocation_T) #7
  unreachable

43:                                               ; No predecessors!
  br label %44

44:                                               ; preds = %43, %41
  %45 = load ptr, ptr %14, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.VkMemoryRequirements, ptr %45, i32 0, i32 0
  %47 = load i64, ptr %46, align 8, !tbaa !19
  %48 = icmp eq i64 %47, 0
  br i1 %48, label %49, label %50

49:                                               ; preds = %44
  store i32 -3, ptr %12, align 4
  br label %166

50:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 48, ptr %24) #8
  %51 = load ptr, ptr %20, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %24, ptr align 8 %51, i64 48, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #8
  %52 = load i8, ptr %15, align 1, !tbaa !9, !range !25, !noundef !26
  %53 = trunc i8 %52 to i1
  %54 = load i8, ptr %16, align 1, !tbaa !9, !range !25, !noundef !26
  %55 = trunc i8 %54 to i1
  %56 = call noundef i32 @_ZN14VmaAllocator_T20CalcAllocationParamsER23VmaAllocationCreateInfobb(ptr noundef nonnull align 8 dereferenceable(5916) %33, ptr noundef nonnull align 8 dereferenceable(48) %24, i1 noundef zeroext %53, i1 noundef zeroext %55)
  store i32 %56, ptr %25, align 4, !tbaa !27
  %57 = load i32, ptr %25, align 4, !tbaa !27
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %59, label %61

59:                                               ; preds = %50
  %60 = load i32, ptr %25, align 4, !tbaa !27
  store i32 %60, ptr %12, align 4
  store i32 1, ptr %26, align 4
  br label %165

61:                                               ; preds = %50
  %62 = getelementptr inbounds %struct.VmaAllocationCreateInfo, ptr %24, i32 0, i32 5
  %63 = load ptr, ptr %62, align 8, !tbaa !29
  %64 = icmp ne ptr %63, null
  br i1 %64, label %65, label %92

65:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #8
  %66 = getelementptr inbounds %struct.VmaAllocationCreateInfo, ptr %24, i32 0, i32 5
  %67 = load ptr, ptr %66, align 8, !tbaa !29
  %68 = getelementptr inbounds %struct.VmaPool_T, ptr %67, i32 0, i32 0
  store ptr %68, ptr %27, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.VmaAllocationCreateInfo, ptr %24, i32 0, i32 5
  %70 = load ptr, ptr %69, align 8, !tbaa !29
  %71 = load ptr, ptr %14, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.VkMemoryRequirements, ptr %71, i32 0, i32 0
  %73 = load i64, ptr %72, align 8, !tbaa !19
  %74 = load ptr, ptr %14, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.VkMemoryRequirements, ptr %74, i32 0, i32 1
  %76 = load i64, ptr %75, align 8, !tbaa !17
  %77 = load i8, ptr %16, align 1, !tbaa !9, !range !25, !noundef !26
  %78 = trunc i8 %77 to i1
  %79 = load ptr, ptr %17, align 8, !tbaa !5
  %80 = load ptr, ptr %18, align 8, !tbaa !5
  %81 = load i32, ptr %19, align 4, !tbaa !11
  %82 = load ptr, ptr %27, align 8, !tbaa !5
  %83 = call noundef i32 @_ZNK14VmaBlockVector18GetMemoryTypeIndexEv(ptr noundef nonnull align 8 dereferenceable(181) %82)
  %84 = load i32, ptr %21, align 4, !tbaa !13
  %85 = getelementptr inbounds %struct.VmaAllocationCreateInfo, ptr %24, i32 0, i32 5
  %86 = load ptr, ptr %85, align 8, !tbaa !29
  %87 = getelementptr inbounds %struct.VmaPool_T, ptr %86, i32 0, i32 1
  %88 = load ptr, ptr %27, align 8, !tbaa !5
  %89 = load i64, ptr %22, align 8, !tbaa !15
  %90 = load ptr, ptr %23, align 8, !tbaa !5
  %91 = call noundef i32 @_ZN14VmaAllocator_T20AllocateMemoryOfTypeEP9VmaPool_TmmbP10VkBuffer_TP9VkImage_TjRK23VmaAllocationCreateInfoj20VmaSuballocationTypeR26VmaDedicatedAllocationListR14VmaBlockVectormPP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(5916) %33, ptr noundef %70, i64 noundef %73, i64 noundef %76, i1 noundef zeroext %78, ptr noundef %79, ptr noundef %80, i32 noundef %81, ptr noundef nonnull align 8 dereferenceable(48) %24, i32 noundef %83, i32 noundef %84, ptr noundef nonnull align 8 dereferenceable(88) %87, ptr noundef nonnull align 8 dereferenceable(181) %88, i64 noundef %89, ptr noundef %90)
  store i32 %91, ptr %12, align 4
  store i32 1, ptr %26, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #8
  br label %165

92:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #8
  %93 = load ptr, ptr %14, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.VkMemoryRequirements, ptr %93, i32 0, i32 2
  %95 = load i32, ptr %94, align 8, !tbaa !31
  store i32 %95, ptr %28, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #8
  store i32 -1, ptr %29, align 4, !tbaa !11
  %96 = load i32, ptr %28, align 4, !tbaa !11
  %97 = load i32, ptr %19, align 4, !tbaa !11
  %98 = call noundef i32 @_ZNK14VmaAllocator_T19FindMemoryTypeIndexEjPK23VmaAllocationCreateInfojPj(ptr noundef nonnull align 8 dereferenceable(5916) %33, i32 noundef %96, ptr noundef %24, i32 noundef %97, ptr noundef %29)
  store i32 %98, ptr %25, align 4, !tbaa !27
  %99 = load i32, ptr %25, align 4, !tbaa !27
  %100 = icmp ne i32 %99, 0
  br i1 %100, label %101, label %103

101:                                              ; preds = %92
  %102 = load i32, ptr %25, align 4, !tbaa !27
  store i32 %102, ptr %12, align 4
  store i32 1, ptr %26, align 4
  br label %164

103:                                              ; preds = %92
  br label %104

104:                                              ; preds = %160, %103
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #8
  %105 = getelementptr inbounds %struct.VmaAllocator_T, ptr %33, i32 0, i32 21
  %106 = load i32, ptr %29, align 4, !tbaa !11
  %107 = zext i32 %106 to i64
  %108 = getelementptr inbounds [32 x ptr], ptr %105, i64 0, i64 %107
  %109 = load ptr, ptr %108, align 8, !tbaa !5
  store ptr %109, ptr %30, align 8, !tbaa !5
  %110 = load ptr, ptr %30, align 8, !tbaa !5
  %111 = icmp ne ptr %110, null
  br i1 %111, label %112, label %113

112:                                              ; preds = %104
  br label %113

113:                                              ; preds = %112, %104
  %114 = phi i1 [ false, %104 ], [ true, %112 ]
  br i1 %114, label %115, label %116

115:                                              ; preds = %113
  br label %118

116:                                              ; preds = %113
  call void @__assert_fail(ptr noundef @.str.269, ptr noundef @.str.2, i32 noundef 15160, ptr noundef @__PRETTY_FUNCTION__._ZN14VmaAllocator_T14AllocateMemoryERK20VkMemoryRequirementsbbP10VkBuffer_TP9VkImage_TjRK23VmaAllocationCreateInfo20VmaSuballocationTypemPP15VmaAllocation_T) #7
  unreachable

117:                                              ; No predecessors!
  br label %118

118:                                              ; preds = %117, %115
  %119 = load ptr, ptr %14, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.VkMemoryRequirements, ptr %119, i32 0, i32 0
  %121 = load i64, ptr %120, align 8, !tbaa !19
  %122 = load ptr, ptr %14, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.VkMemoryRequirements, ptr %122, i32 0, i32 1
  %124 = load i64, ptr %123, align 8, !tbaa !17
  %125 = load i8, ptr %15, align 1, !tbaa !9, !range !25, !noundef !26
  %126 = trunc i8 %125 to i1
  br i1 %126, label %130, label %127

127:                                              ; preds = %118
  %128 = load i8, ptr %16, align 1, !tbaa !9, !range !25, !noundef !26
  %129 = trunc i8 %128 to i1
  br label %130

130:                                              ; preds = %127, %118
  %131 = phi i1 [ true, %118 ], [ %129, %127 ]
  %132 = load ptr, ptr %17, align 8, !tbaa !5
  %133 = load ptr, ptr %18, align 8, !tbaa !5
  %134 = load i32, ptr %19, align 4, !tbaa !11
  %135 = load i32, ptr %29, align 4, !tbaa !11
  %136 = load i32, ptr %21, align 4, !tbaa !13
  %137 = getelementptr inbounds %struct.VmaAllocator_T, ptr %33, i32 0, i32 22
  %138 = load i32, ptr %29, align 4, !tbaa !11
  %139 = zext i32 %138 to i64
  %140 = getelementptr inbounds [32 x %class.VmaDedicatedAllocationList], ptr %137, i64 0, i64 %139
  %141 = load ptr, ptr %30, align 8, !tbaa !5
  %142 = load i64, ptr %22, align 8, !tbaa !15
  %143 = load ptr, ptr %23, align 8, !tbaa !5
  %144 = call noundef i32 @_ZN14VmaAllocator_T20AllocateMemoryOfTypeEP9VmaPool_TmmbP10VkBuffer_TP9VkImage_TjRK23VmaAllocationCreateInfoj20VmaSuballocationTypeR26VmaDedicatedAllocationListR14VmaBlockVectormPP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(5916) %33, ptr noundef null, i64 noundef %121, i64 noundef %124, i1 noundef zeroext %131, ptr noundef %132, ptr noundef %133, i32 noundef %134, ptr noundef nonnull align 8 dereferenceable(48) %24, i32 noundef %135, i32 noundef %136, ptr noundef nonnull align 8 dereferenceable(88) %140, ptr noundef nonnull align 8 dereferenceable(181) %141, i64 noundef %142, ptr noundef %143)
  store i32 %144, ptr %25, align 4, !tbaa !27
  %145 = load i32, ptr %25, align 4, !tbaa !27
  %146 = icmp eq i32 %145, 0
  br i1 %146, label %147, label %148

147:                                              ; preds = %130
  store i32 0, ptr %12, align 4
  store i32 1, ptr %26, align 4
  br label %157

148:                                              ; preds = %130
  %149 = load i32, ptr %29, align 4, !tbaa !11
  %150 = shl i32 1, %149
  %151 = xor i32 %150, -1
  %152 = load i32, ptr %28, align 4, !tbaa !11
  %153 = and i32 %152, %151
  store i32 %153, ptr %28, align 4, !tbaa !11
  %154 = load i32, ptr %28, align 4, !tbaa !11
  %155 = load i32, ptr %19, align 4, !tbaa !11
  %156 = call noundef i32 @_ZNK14VmaAllocator_T19FindMemoryTypeIndexEjPK23VmaAllocationCreateInfojPj(ptr noundef nonnull align 8 dereferenceable(5916) %33, i32 noundef %154, ptr noundef %24, i32 noundef %155, ptr noundef %29)
  store i32 %156, ptr %25, align 4, !tbaa !27
  store i32 0, ptr %26, align 4
  br label %157

157:                                              ; preds = %148, %147
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #8
  %158 = load i32, ptr %26, align 4
  switch i32 %158, label %164 [
    i32 0, label %159
  ]

159:                                              ; preds = %157
  br label %160

160:                                              ; preds = %159
  %161 = load i32, ptr %25, align 4, !tbaa !27
  %162 = icmp eq i32 %161, 0
  br i1 %162, label %104, label %163, !llvm.loop !32

163:                                              ; preds = %160
  store i32 -2, ptr %12, align 4
  store i32 1, ptr %26, align 4
  br label %164

164:                                              ; preds = %163, %157, %101
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #8
  br label %165

165:                                              ; preds = %164, %65, %59
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %24) #8
  br label %166

166:                                              ; preds = %165, %49
  %167 = load i32, ptr %12, align 4
  ret i32 %167
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { inlinehint 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 #5 = { 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 #6 = { 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 #7 = { noreturn nounwind }
attributes #8 = { 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 = !{!"bool", !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 = !{!"long", !7, i64 0}
!17 = !{!18, !16, i64 8}
!18 = !{!"_ZTS20VkMemoryRequirements", !16, i64 0, !16, i64 8, !12, i64 16}
!19 = !{!18, !16, i64 0}
!20 = !{i64 0, i64 4, !11, i64 4, i64 4, !21, i64 8, i64 4, !11, i64 12, i64 4, !11, i64 16, i64 4, !11, i64 24, i64 8, !5, i64 32, i64 8, !5, i64 40, i64 4, !23}
!21 = !{!22, !22, i64 0}
!22 = !{!"_ZTS14VmaMemoryUsage", !7, i64 0}
!23 = !{!24, !24, i64 0}
!24 = !{!"float", !7, i64 0}
!25 = !{i8 0, i8 2}
!26 = !{}
!27 = !{!28, !28, i64 0}
!28 = !{!"_ZTS8VkResult", !7, i64 0}
!29 = !{!30, !6, i64 24}
!30 = !{!"_ZTS23VmaAllocationCreateInfo", !12, i64 0, !22, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !6, i64 24, !6, i64 32, !24, i64 40}
!31 = !{!18, !12, i64 16}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}


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

%struct.VmaAllocationCreateInfo = type { i32, i32, i32, i32, i32, ptr, ptr, float }
%class.VmaDedicatedAllocationList = type { i8, %class.VmaRWMutex, %class.VmaIntrusiveLinkedList }
%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 = type { ptr, ptr, i64 }

@.str.2 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.267 = external hidden unnamed_addr constant [30 x i8], align 1
@__PRETTY_FUNCTION__._ZN14VmaAllocator_T14AllocateMemoryERK20VkMemoryRequirementsbbP10VkBuffer_TP9VkImage_TjRK23VmaAllocationCreateInfo20VmaSuballocationTypemPP15VmaAllocation_T = external hidden unnamed_addr constant [190 x i8], align 1
@.str.269 = external hidden unnamed_addr constant [56 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; 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 #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z9VmaIsPow2ImEbT_(i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN14VmaAllocator_T20AllocateMemoryOfTypeEP9VmaPool_TmmbP10VkBuffer_TP9VkImage_TjRK23VmaAllocationCreateInfoj20VmaSuballocationTypeR26VmaDedicatedAllocationListR14VmaBlockVectormPP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(5916), ptr noundef, i64 noundef, i64 noundef, i1 noundef zeroext, ptr noundef, ptr noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(48), i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(181), i64 noundef, ptr noundef) local_unnamed_addr #5 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN14VmaAllocator_T20CalcAllocationParamsER23VmaAllocationCreateInfobb(ptr noundef nonnull align 8 dereferenceable(5916), ptr noundef nonnull align 8 dereferenceable(48), i1 noundef zeroext, i1 noundef zeroext) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN14VmaAllocator_T14AllocateMemoryERK20VkMemoryRequirementsbbP10VkBuffer_TP9VkImage_TjRK23VmaAllocationCreateInfo20VmaSuballocationTypemPP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(5916) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(24) %1, i1 noundef zeroext %2, i1 noundef zeroext %3, ptr noundef %4, ptr noundef %5, i32 noundef %6, ptr nocapture noundef nonnull readonly align 8 dereferenceable(48) %7, i32 noundef %8, i64 noundef %9, ptr noundef %10) local_unnamed_addr #5 align 2 {
  %12 = alloca %struct.VmaAllocationCreateInfo, align 8
  %13 = alloca i32, align 4
  %14 = shl i64 %9, 3
  tail call void @llvm.memset.p0.i64(ptr align 8 %10, i8 0, i64 %14, i1 false)
  %15 = getelementptr inbounds i8, ptr %1, i64 8
  %16 = load i64, ptr %15, align 8, !tbaa !5
  %17 = tail call noundef zeroext i1 @_Z9VmaIsPow2ImEbT_(i64 noundef %16)
  br i1 %17, label %19, label %18

18:                                               ; preds = %11
  tail call void @__assert_fail(ptr noundef nonnull @.str.267, ptr noundef nonnull @.str.2, i32 noundef 15117, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN14VmaAllocator_T14AllocateMemoryERK20VkMemoryRequirementsbbP10VkBuffer_TP9VkImage_TjRK23VmaAllocationCreateInfo20VmaSuballocationTypemPP15VmaAllocation_T) #7
  unreachable

19:                                               ; preds = %11
  %20 = load i64, ptr %1, align 8, !tbaa !11
  %21 = icmp eq i64 %20, 0
  br i1 %21, label %60, label %22

22:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %12) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %12, ptr noundef nonnull align 8 dereferenceable(48) %7, i64 48, i1 false), !tbaa.struct !12
  %23 = call noundef i32 @_ZN14VmaAllocator_T20CalcAllocationParamsER23VmaAllocationCreateInfobb(ptr noundef nonnull align 8 dereferenceable(5916) %0, ptr noundef nonnull align 8 dereferenceable(48) %12, i1 noundef zeroext %2, i1 noundef zeroext %3)
  %.not = icmp eq i32 %23, 0
  br i1 %.not, label %24, label %59

24:                                               ; preds = %22
  %25 = getelementptr inbounds i8, ptr %12, i64 24
  %26 = load ptr, ptr %25, align 8, !tbaa !20
  %.not53 = icmp eq ptr %26, null
  br i1 %.not53, label %34, label %27

27:                                               ; preds = %24
  %28 = load i64, ptr %1, align 8, !tbaa !11
  %29 = load i64, ptr %15, align 8, !tbaa !5
  %30 = call noundef i32 @_ZNK14VmaBlockVector18GetMemoryTypeIndexEv(ptr noundef nonnull align 8 dereferenceable(181) %26)
  %31 = load ptr, ptr %25, align 8, !tbaa !20
  %32 = getelementptr inbounds i8, ptr %31, i64 184
  %33 = call noundef i32 @_ZN14VmaAllocator_T20AllocateMemoryOfTypeEP9VmaPool_TmmbP10VkBuffer_TP9VkImage_TjRK23VmaAllocationCreateInfoj20VmaSuballocationTypeR26VmaDedicatedAllocationListR14VmaBlockVectormPP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(5916) %0, ptr noundef nonnull %26, i64 noundef %28, i64 noundef %29, i1 noundef zeroext %3, ptr noundef %4, ptr noundef %5, i32 noundef %6, ptr noundef nonnull align 8 dereferenceable(48) %12, i32 noundef %30, i32 noundef %8, ptr noundef nonnull align 8 dereferenceable(88) %32, ptr noundef nonnull align 8 dereferenceable(181) %26, i64 noundef %9, ptr noundef %10)
  br label %59

34:                                               ; preds = %24
  %35 = getelementptr inbounds i8, ptr %1, i64 16
  %36 = load i32, ptr %35, align 8, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #8
  store i32 -1, ptr %13, align 4, !tbaa !13
  %37 = call noundef i32 @_ZNK14VmaAllocator_T19FindMemoryTypeIndexEjPK23VmaAllocationCreateInfojPj(ptr noundef nonnull align 8 dereferenceable(5916) %0, i32 noundef %36, ptr noundef nonnull %12, i32 noundef %6, ptr noundef nonnull %13)
  %.not54 = icmp eq i32 %37, 0
  br i1 %.not54, label %.preheader, label %.thread

.preheader:                                       ; preds = %34
  %38 = getelementptr inbounds i8, ptr %0, i64 1552
  %39 = or i1 %2, %3
  %40 = getelementptr inbounds i8, ptr %0, i64 1808
  br label %41

41:                                               ; preds = %.preheader, %52
  %.044 = phi i32 [ %56, %52 ], [ %36, %.preheader ]
  %42 = load i32, ptr %13, align 4, !tbaa !13
  %43 = zext i32 %42 to i64
  %44 = getelementptr inbounds [32 x ptr], ptr %38, i64 0, i64 %43
  %45 = load ptr, ptr %44, align 8, !tbaa !16
  %.not55 = icmp eq ptr %45, null
  br i1 %.not55, label %46, label %47

46:                                               ; preds = %41
  call void @__assert_fail(ptr noundef nonnull @.str.269, ptr noundef nonnull @.str.2, i32 noundef 15160, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN14VmaAllocator_T14AllocateMemoryERK20VkMemoryRequirementsbbP10VkBuffer_TP9VkImage_TjRK23VmaAllocationCreateInfo20VmaSuballocationTypemPP15VmaAllocation_T) #7
  unreachable

47:                                               ; preds = %41
  %48 = load i64, ptr %1, align 8, !tbaa !11
  %49 = load i64, ptr %15, align 8, !tbaa !5
  %50 = getelementptr inbounds [32 x %class.VmaDedicatedAllocationList], ptr %40, i64 0, i64 %43
  %51 = call noundef i32 @_ZN14VmaAllocator_T20AllocateMemoryOfTypeEP9VmaPool_TmmbP10VkBuffer_TP9VkImage_TjRK23VmaAllocationCreateInfoj20VmaSuballocationTypeR26VmaDedicatedAllocationListR14VmaBlockVectormPP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(5916) %0, ptr noundef null, i64 noundef %48, i64 noundef %49, i1 noundef zeroext %39, ptr noundef %4, ptr noundef %5, i32 noundef %6, ptr noundef nonnull align 8 dereferenceable(48) %12, i32 noundef %42, i32 noundef %8, ptr noundef nonnull align 8 dereferenceable(88) %50, ptr noundef nonnull align 8 dereferenceable(181) %45, i64 noundef %9, ptr noundef %10)
  %.not56 = icmp eq i32 %51, 0
  br i1 %.not56, label %.thread, label %52

52:                                               ; preds = %47
  %53 = load i32, ptr %13, align 4, !tbaa !13
  %54 = shl nuw i32 1, %53
  %55 = xor i32 %54, -1
  %56 = and i32 %.044, %55
  %57 = call noundef i32 @_ZNK14VmaAllocator_T19FindMemoryTypeIndexEjPK23VmaAllocationCreateInfojPj(ptr noundef nonnull align 8 dereferenceable(5916) %0, i32 noundef %56, ptr noundef nonnull %12, i32 noundef %6, ptr noundef nonnull %13)
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %41, label %.thread, !llvm.loop !23

.thread:                                          ; preds = %47, %52, %34
  %.2 = phi i32 [ %37, %34 ], [ 0, %47 ], [ -2, %52 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #8
  br label %59

59:                                               ; preds = %22, %.thread, %27
  %.3 = phi i32 [ %33, %27 ], [ %.2, %.thread ], [ %23, %22 ]
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %12) #8
  br label %60

60:                                               ; preds = %19, %59
  %.4 = phi i32 [ %.3, %59 ], [ -3, %19 ]
  ret i32 %.4
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { inlinehint 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 #5 = { 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 #6 = { 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 #7 = { noreturn nounwind }
attributes #8 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 8}
!6 = !{!"_ZTS20VkMemoryRequirements", !7, i64 0, !7, i64 8, !10, i64 16}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{i64 0, i64 4, !13, i64 4, i64 4, !14, i64 8, i64 4, !13, i64 12, i64 4, !13, i64 16, i64 4, !13, i64 24, i64 8, !16, i64 32, i64 8, !16, i64 40, i64 4, !18}
!13 = !{!10, !10, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"_ZTS14VmaMemoryUsage", !8, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"any pointer", !8, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"float", !8, i64 0}
!20 = !{!21, !17, i64 24}
!21 = !{!"_ZTS23VmaAllocationCreateInfo", !10, i64 0, !15, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !17, i64 24, !17, i64 32, !19, i64 40}
!22 = !{!6, !10, i64 16}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


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