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

; 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: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK14VmaAllocator_T18GetMemoryTypeCountEv(ptr noundef nonnull align 8 dereferenceable(5916)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK14VmaAllocator_T19FindMemoryTypeIndexEjPK23VmaAllocationCreateInfojPj(ptr noundef nonnull align 8 dereferenceable(5916) %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4) #2 align 2 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i32 %3, ptr %10, align 4, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  %21 = load ptr, ptr %7, align 8
  %22 = call noundef i32 @_ZNK14VmaAllocator_T23GetGlobalMemoryTypeBitsEv(ptr noundef nonnull align 8 dereferenceable(5916) %21)
  %23 = load i32, ptr %8, align 4, !tbaa !9
  %24 = and i32 %23, %22
  store i32 %24, ptr %8, align 4, !tbaa !9
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.VmaAllocationCreateInfo, ptr %25, i32 0, i32 4
  %27 = load i32, ptr %26, align 8, !tbaa !11
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %35

29:                                               ; preds = %5
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.VmaAllocationCreateInfo, ptr %30, i32 0, i32 4
  %32 = load i32, ptr %31, align 8, !tbaa !11
  %33 = load i32, ptr %8, align 4, !tbaa !9
  %34 = and i32 %33, %32
  store i32 %34, ptr %8, align 4, !tbaa !9
  br label %35

35:                                               ; preds = %29, %5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 0, ptr %14, align 4, !tbaa !9
  %36 = call noundef zeroext i1 @_ZNK14VmaAllocator_T15IsIntegratedGpuEv(ptr noundef nonnull align 8 dereferenceable(5916) %21)
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = load i32, ptr %10, align 4, !tbaa !9
  %39 = call noundef zeroext i1 @_ZL21FindMemoryPreferencesbRK23VmaAllocationCreateInfojRjS2_S2_(i1 noundef zeroext %36, ptr noundef nonnull align 8 dereferenceable(48) %37, i32 noundef %38, ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %14)
  br i1 %39, label %41, label %40

40:                                               ; preds = %35
  store i32 -8, ptr %6, align 4
  store i32 1, ptr %15, align 4
  br label %111

41:                                               ; preds = %35
  %42 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 -1, ptr %42, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 -1, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  store i32 0, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  store i32 1, ptr %18, align 4, !tbaa !9
  br label %43

43:                                               ; preds = %97, %41
  %44 = load i32, ptr %17, align 4, !tbaa !9
  %45 = call noundef i32 @_ZNK14VmaAllocator_T18GetMemoryTypeCountEv(ptr noundef nonnull align 8 dereferenceable(5916) %21)
  %46 = icmp ult i32 %44, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %43
  store i32 2, ptr %15, align 4
  br label %102

48:                                               ; preds = %43
  %49 = load i32, ptr %18, align 4, !tbaa !9
  %50 = load i32, ptr %8, align 4, !tbaa !9
  %51 = and i32 %49, %50
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %96

53:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %54 = getelementptr inbounds %struct.VmaAllocator_T, ptr %21, i32 0, i32 20
  %55 = getelementptr inbounds %struct.VkPhysicalDeviceMemoryProperties, ptr %54, i32 0, i32 1
  %56 = load i32, ptr %17, align 4, !tbaa !9
  %57 = zext i32 %56 to i64
  %58 = getelementptr inbounds [32 x %struct.VkMemoryType], ptr %55, i64 0, i64 %57
  %59 = getelementptr inbounds %struct.VkMemoryType, ptr %58, i32 0, i32 0
  %60 = load i32, ptr %59, align 4, !tbaa !15
  store i32 %60, ptr %19, align 4, !tbaa !9
  %61 = load i32, ptr %12, align 4, !tbaa !9
  %62 = load i32, ptr %19, align 4, !tbaa !9
  %63 = xor i32 %62, -1
  %64 = and i32 %61, %63
  %65 = icmp eq i32 %64, 0
  br i1 %65, label %66, label %92

66:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %67 = load i32, ptr %13, align 4, !tbaa !9
  %68 = load i32, ptr %19, align 4, !tbaa !9
  %69 = xor i32 %68, -1
  %70 = and i32 %67, %69
  %71 = call noundef i32 @_ZL15VmaCountBitsSetj(i32 noundef %70)
  %72 = load i32, ptr %19, align 4, !tbaa !9
  %73 = load i32, ptr %14, align 4, !tbaa !9
  %74 = and i32 %72, %73
  %75 = call noundef i32 @_ZL15VmaCountBitsSetj(i32 noundef %74)
  %76 = add i32 %71, %75
  store i32 %76, ptr %20, align 4, !tbaa !9
  %77 = load i32, ptr %20, align 4, !tbaa !9
  %78 = load i32, ptr %16, align 4, !tbaa !9
  %79 = icmp ult i32 %77, %78
  br i1 %79, label %80, label %88

80:                                               ; preds = %66
  %81 = load i32, ptr %17, align 4, !tbaa !9
  %82 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 %81, ptr %82, align 4, !tbaa !9
  %83 = load i32, ptr %20, align 4, !tbaa !9
  %84 = icmp eq i32 %83, 0
  br i1 %84, label %85, label %86

85:                                               ; preds = %80
  store i32 0, ptr %6, align 4
  store i32 1, ptr %15, align 4
  br label %89

86:                                               ; preds = %80
  %87 = load i32, ptr %20, align 4, !tbaa !9
  store i32 %87, ptr %16, align 4, !tbaa !9
  br label %88

88:                                               ; preds = %86, %66
  store i32 0, ptr %15, align 4
  br label %89

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

91:                                               ; preds = %89
  br label %92

92:                                               ; preds = %91, %53
  store i32 0, ptr %15, align 4
  br label %93

93:                                               ; preds = %92, %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  %94 = load i32, ptr %15, align 4
  switch i32 %94, label %102 [
    i32 0, label %95
  ]

95:                                               ; preds = %93
  br label %96

96:                                               ; preds = %95, %48
  br label %97

97:                                               ; preds = %96
  %98 = load i32, ptr %17, align 4, !tbaa !9
  %99 = add i32 %98, 1
  store i32 %99, ptr %17, align 4, !tbaa !9
  %100 = load i32, ptr %18, align 4, !tbaa !9
  %101 = shl i32 %100, 1
  store i32 %101, ptr %18, align 4, !tbaa !9
  br label %43, !llvm.loop !17

102:                                              ; preds = %93, %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  %103 = load i32, ptr %15, align 4
  switch i32 %103, label %110 [
    i32 2, label %104
  ]

104:                                              ; preds = %102
  %105 = load ptr, ptr %11, align 8, !tbaa !5
  %106 = load i32, ptr %105, align 4, !tbaa !9
  %107 = icmp ne i32 %106, -1
  %108 = zext i1 %107 to i64
  %109 = select i1 %107, i32 0, i32 -8
  store i32 %109, ptr %6, align 4
  store i32 1, ptr %15, align 4
  br label %110

110:                                              ; preds = %104, %102
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %111

111:                                              ; preds = %110, %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  %112 = load i32, ptr %6, align 4
  ret i32 %112
}

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZL21FindMemoryPreferencesbRK23VmaAllocationCreateInfojRjS2_S2_(i1 noundef zeroext, ptr noundef nonnull align 8 dereferenceable(48), i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL15VmaCountBitsSetj(i32 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 16}
!12 = !{!"_ZTS23VmaAllocationCreateInfo", !10, i64 0, !13, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !6, i64 24, !6, i64 32, !14, i64 40}
!13 = !{!"_ZTS14VmaMemoryUsage", !7, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!16, !10, i64 0}
!16 = !{!"_ZTS12VkMemoryType", !10, i64 0, !10, i64 4}
!17 = distinct !{!17, !18}
!18 = !{!"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.VkMemoryType = type { i32, i32 }

; 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: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK14VmaAllocator_T18GetMemoryTypeCountEv(ptr noundef nonnull align 8 dereferenceable(5916)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_ZNK14VmaAllocator_T19FindMemoryTypeIndexEjPK23VmaAllocationCreateInfojPj(ptr noundef nonnull align 8 dereferenceable(5916) %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, ptr nocapture noundef %4) local_unnamed_addr #1 align 2 {
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = tail call noundef i32 @_ZNK14VmaAllocator_T23GetGlobalMemoryTypeBitsEv(ptr noundef nonnull align 8 dereferenceable(5916) %0)
  %10 = and i32 %9, %1
  %11 = getelementptr inbounds i8, ptr %2, i64 16
  %12 = load i32, ptr %11, align 8, !tbaa !5
  %.not = icmp eq i32 %12, 0
  %13 = select i1 %.not, i32 -1, i32 %12
  %spec.select = and i32 %10, %13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #3
  store i32 0, ptr %6, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #3
  store i32 0, ptr %7, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #3
  store i32 0, ptr %8, align 4, !tbaa !13
  %14 = tail call noundef zeroext i1 @_ZNK14VmaAllocator_T15IsIntegratedGpuEv(ptr noundef nonnull align 8 dereferenceable(5916) %0)
  %15 = call noundef zeroext i1 @_ZL21FindMemoryPreferencesbRK23VmaAllocationCreateInfojRjS2_S2_(i1 noundef zeroext %14, ptr noundef nonnull align 8 dereferenceable(48) %2, i32 noundef %3, ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  br i1 %15, label %16, label %.loopexit

16:                                               ; preds = %5
  store i32 -1, ptr %4, align 4, !tbaa !13
  %17 = call noundef i32 @_ZNK14VmaAllocator_T18GetMemoryTypeCountEv(ptr noundef nonnull align 8 dereferenceable(5916) %0)
  %.not4452.not = icmp eq i32 %17, 0
  br i1 %.not4452.not, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %16
  %18 = getelementptr inbounds i8, ptr %0, i64 1036
  br label %19

19:                                               ; preds = %.lr.ph, %.thread
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %.thread ]
  %.03055 = phi i32 [ 1, %.lr.ph ], [ %39, %.thread ]
  %.03253 = phi i32 [ -1, %.lr.ph ], [ %.537, %.thread ]
  %20 = and i32 %spec.select, %.03055
  %.not43 = icmp eq i32 %20, 0
  br i1 %.not43, label %.thread, label %21

21:                                               ; preds = %19
  %22 = getelementptr inbounds [32 x %struct.VkMemoryType], ptr %18, i64 0, i64 %indvars.iv
  %23 = load i32, ptr %22, align 4, !tbaa !14
  %24 = load i32, ptr %6, align 4, !tbaa !13
  %25 = xor i32 %23, -1
  %26 = and i32 %24, %25
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %.thread

28:                                               ; preds = %21
  %29 = load i32, ptr %7, align 4, !tbaa !13
  %30 = and i32 %29, %25
  %31 = call noundef i32 @_ZL15VmaCountBitsSetj(i32 noundef %30)
  %32 = load i32, ptr %8, align 4, !tbaa !13
  %33 = and i32 %32, %23
  %34 = call noundef i32 @_ZL15VmaCountBitsSetj(i32 noundef %33)
  %35 = add i32 %34, %31
  %36 = icmp ult i32 %35, %.03253
  br i1 %36, label %37, label %.thread

37:                                               ; preds = %28
  %38 = trunc nuw i64 %indvars.iv to i32
  store i32 %38, ptr %4, align 4, !tbaa !13
  %.not51 = icmp eq i32 %35, 0
  br i1 %.not51, label %.loopexit, label %.thread

.thread:                                          ; preds = %28, %21, %19, %37
  %.537 = phi i32 [ %35, %37 ], [ %.03253, %19 ], [ %.03253, %21 ], [ %.03253, %28 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %39 = shl i32 %.03055, 1
  %40 = call noundef i32 @_ZNK14VmaAllocator_T18GetMemoryTypeCountEv(ptr noundef nonnull align 8 dereferenceable(5916) %0)
  %41 = zext i32 %40 to i64
  %.not44 = icmp ult i64 %indvars.iv.next, %41
  br i1 %.not44, label %19, label %.critedge, !llvm.loop !16

.critedge:                                        ; preds = %.thread, %16
  %42 = load i32, ptr %4, align 4, !tbaa !13
  %.not45 = icmp eq i32 %42, -1
  %43 = select i1 %.not45, i32 -8, i32 0
  br label %.loopexit

.loopexit:                                        ; preds = %37, %.critedge, %5
  %.7 = phi i32 [ -8, %5 ], [ %43, %.critedge ], [ 0, %37 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #3
  ret i32 %.7
}

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZL21FindMemoryPreferencesbRK23VmaAllocationCreateInfojRjS2_S2_(i1 noundef zeroext, ptr noundef nonnull align 8 dereferenceable(48), i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK14VmaAllocator_T15IsIntegratedGpuEv(ptr noundef nonnull align 8 dereferenceable(5916)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL15VmaCountBitsSetj(i32 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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, !7, i64 16}
!6 = !{!"_ZTS23VmaAllocationCreateInfo", !7, i64 0, !10, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !11, i64 24, !11, i64 32, !12, i64 40}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS14VmaMemoryUsage", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"float", !8, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !7, i64 0}
!15 = !{!"_ZTS12VkMemoryType", !7, i64 0, !7, i64 4}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


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