; 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.VmaMutexLock = type { ptr }
%class.VmaDeviceMemoryBlock = type { ptr, ptr, i32, i32, ptr, %class.VmaMutex, %class.VmaMappingHysteresis, i32, ptr }
%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.VmaMappingHysteresis = type { i32, i32, i32 }
%struct.VmaAllocator_T = type <{ i8, [3 x i8], i32, i8, i8, i8, i8, i8, i8, [2 x i8], ptr, ptr, i8, [7 x i8], %struct.VkAllocationCallbacks, %struct.VmaDeviceMemoryCallbacks, %class.VmaAllocationObjectAllocator, i32, [4 x i8], %struct.VkPhysicalDeviceProperties, %struct.VkPhysicalDeviceMemoryProperties, [32 x ptr], [32 x %class.VmaDedicatedAllocationList], %struct.VmaCurrentBudgetData, %"struct.std::atomic", [4 x i8], i64, ptr, %"struct.std::atomic", %"struct.std::atomic", [32 x i32], %class.VmaRWMutex, %class.VmaIntrusiveLinkedList.14, i32, [4 x i8], %struct.VmaVulkanFunctions, i32, [4 x i8] }>
%struct.VkAllocationCallbacks = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.VmaDeviceMemoryCallbacks = type { ptr, ptr, ptr }
%class.VmaAllocationObjectAllocator = type { %class.VmaMutex, %class.VmaPoolAllocator.11 }
%class.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 }

@.str.2 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.151 = external hidden unnamed_addr constant [100 x i8], align 1
@__PRETTY_FUNCTION__._ZN20VmaDeviceMemoryBlock16BindBufferMemoryEP14VmaAllocator_TP15VmaAllocation_TmP10VkBuffer_TPKv = external hidden unnamed_addr constant [127 x i8], align 1
@.str.153 = external hidden unnamed_addr constant [191 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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN20VmaDeviceMemoryBlock16BindBufferMemoryEP14VmaAllocator_TP15VmaAllocation_TmP10VkBuffer_TPKv(ptr noundef nonnull align 8 dereferenceable(96) %0, ptr noundef %1, ptr noundef %2, i64 noundef %3, ptr noundef %4, ptr noundef %5) #3 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca %struct.VmaMutexLock, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i64 %3, ptr %10, align 8, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  %17 = load ptr, ptr %7, align 8
  %18 = load ptr, ptr %9, align 8, !tbaa !5
  %19 = call noundef i32 @_ZNK15VmaAllocation_T7GetTypeEv(ptr noundef nonnull align 8 dereferenceable(84) %18)
  %20 = icmp eq i32 %19, 1
  br i1 %20, label %21, label %25

21:                                               ; preds = %6
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  %23 = call noundef ptr @_ZNK15VmaAllocation_T8GetBlockEv(ptr noundef nonnull align 8 dereferenceable(84) %22)
  %24 = icmp eq ptr %23, %17
  br label %25

25:                                               ; preds = %21, %6
  %26 = phi i1 [ false, %6 ], [ %24, %21 ]
  br i1 %26, label %27, label %28

27:                                               ; preds = %25
  br label %30

28:                                               ; preds = %25
  call void @__assert_fail(ptr noundef @.str.151, ptr noundef @.str.2, i32 noundef 12012, ptr noundef @__PRETTY_FUNCTION__._ZN20VmaDeviceMemoryBlock16BindBufferMemoryEP14VmaAllocator_TP15VmaAllocation_TmP10VkBuffer_TPKv) #4
  unreachable

29:                                               ; No predecessors!
  br label %30

30:                                               ; preds = %29, %27
  %31 = load i64, ptr %10, align 8, !tbaa !9
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = call noundef i64 @_ZNK15VmaAllocation_T7GetSizeEv(ptr noundef nonnull align 8 dereferenceable(84) %32)
  %34 = icmp ult i64 %31, %33
  br i1 %34, label %35, label %36

35:                                               ; preds = %30
  br label %36

36:                                               ; preds = %35, %30
  %37 = phi i1 [ false, %30 ], [ true, %35 ]
  br i1 %37, label %38, label %39

38:                                               ; preds = %36
  br label %41

39:                                               ; preds = %36
  call void @__assert_fail(ptr noundef @.str.153, ptr noundef @.str.2, i32 noundef 12014, ptr noundef @__PRETTY_FUNCTION__._ZN20VmaDeviceMemoryBlock16BindBufferMemoryEP14VmaAllocator_TP15VmaAllocation_TmP10VkBuffer_TPKv) #4
  unreachable

40:                                               ; No predecessors!
  br label %41

41:                                               ; preds = %40, %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  %43 = call noundef i64 @_ZNK15VmaAllocation_T9GetOffsetEv(ptr noundef nonnull align 8 dereferenceable(84) %42)
  %44 = load i64, ptr %10, align 8, !tbaa !9
  %45 = add i64 %43, %44
  store i64 %45, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %46 = getelementptr inbounds %class.VmaDeviceMemoryBlock, ptr %17, i32 0, i32 5
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.VmaAllocator_T, ptr %47, i32 0, i32 0
  %49 = load i8, ptr %48, align 8, !tbaa !11, !range !38, !noundef !39
  %50 = trunc i8 %49 to i1
  call void @_ZN12VmaMutexLockC2ER8VmaMutexb(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(40) %46, i1 noundef zeroext %50)
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = getelementptr inbounds %class.VmaDeviceMemoryBlock, ptr %17, i32 0, i32 4
  %53 = load ptr, ptr %52, align 8, !tbaa !40
  %54 = load i64, ptr %13, align 8, !tbaa !9
  %55 = load ptr, ptr %11, align 8, !tbaa !5
  %56 = load ptr, ptr %12, align 8, !tbaa !5
  %57 = invoke noundef i32 @_ZN14VmaAllocator_T16BindVulkanBufferEP16VkDeviceMemory_TmP10VkBuffer_TPKv(ptr noundef nonnull align 8 dereferenceable(5916) %51, ptr noundef %53, i64 noundef %54, ptr noundef %55, ptr noundef %56)
          to label %58 unwind label %59

58:                                               ; preds = %41
  call void @_ZN12VmaMutexLockD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  ret i32 %57

59:                                               ; preds = %41
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %15, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %16, align 4
  call void @_ZN12VmaMutexLockD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %63

63:                                               ; preds = %59
  %64 = load ptr, ptr %15, align 8
  %65 = load i32, ptr %16, align 4
  %66 = insertvalue { ptr, i32 } poison, ptr %64, 0
  %67 = insertvalue { ptr, i32 } %66, i32 %65, 1
  resume { ptr, i32 } %67
}

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

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


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

%struct.VmaMutexLock = type { ptr }

@.str.2 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.151 = external hidden unnamed_addr constant [100 x i8], align 1
@__PRETTY_FUNCTION__._ZN20VmaDeviceMemoryBlock16BindBufferMemoryEP14VmaAllocator_TP15VmaAllocation_TmP10VkBuffer_TPKv = external hidden unnamed_addr constant [127 x i8], align 1
@.str.153 = external hidden unnamed_addr constant [191 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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN20VmaDeviceMemoryBlock16BindBufferMemoryEP14VmaAllocator_TP15VmaAllocation_TmP10VkBuffer_TPKv(ptr noundef nonnull align 8 dereferenceable(96) %0, ptr noundef %1, ptr noundef nonnull %2, i64 noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca %struct.VmaMutexLock, align 8
  %8 = tail call noundef i32 @_ZNK15VmaAllocation_T7GetTypeEv(ptr noundef nonnull align 8 dereferenceable(84) %2)
  %9 = icmp eq i32 %8, 1
  br i1 %9, label %10, label %.critedge

10:                                               ; preds = %6
  %11 = tail call noundef ptr @_ZNK15VmaAllocation_T8GetBlockEv(ptr noundef nonnull align 8 dereferenceable(84) %2)
  %12 = icmp eq ptr %11, %0
  br i1 %12, label %13, label %.critedge

.critedge:                                        ; preds = %6, %10
  tail call void @__assert_fail(ptr noundef nonnull @.str.151, ptr noundef nonnull @.str.2, i32 noundef 12012, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN20VmaDeviceMemoryBlock16BindBufferMemoryEP14VmaAllocator_TP15VmaAllocation_TmP10VkBuffer_TPKv) #4
  unreachable

13:                                               ; preds = %10
  %14 = tail call noundef i64 @_ZNK15VmaAllocation_T7GetSizeEv(ptr noundef nonnull align 8 dereferenceable(84) %2)
  %15 = icmp ugt i64 %14, %3
  br i1 %15, label %17, label %16

16:                                               ; preds = %13
  tail call void @__assert_fail(ptr noundef nonnull @.str.153, ptr noundef nonnull @.str.2, i32 noundef 12014, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN20VmaDeviceMemoryBlock16BindBufferMemoryEP14VmaAllocator_TP15VmaAllocation_TmP10VkBuffer_TPKv) #4
  unreachable

17:                                               ; preds = %13
  %18 = tail call noundef i64 @_ZNK15VmaAllocation_T9GetOffsetEv(ptr noundef nonnull align 8 dereferenceable(84) %2)
  %19 = add i64 %18, %3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  %20 = getelementptr inbounds i8, ptr %0, i64 32
  %21 = load i8, ptr %1, align 8, !tbaa !5, !range !36, !noundef !37
  %22 = trunc nuw i8 %21 to i1
  call void @_ZN12VmaMutexLockC2ER8VmaMutexb(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(40) %20, i1 noundef zeroext %22)
  %23 = getelementptr inbounds i8, ptr %0, i64 24
  %24 = load ptr, ptr %23, align 8, !tbaa !38
  %25 = invoke noundef i32 @_ZN14VmaAllocator_T16BindVulkanBufferEP16VkDeviceMemory_TmP10VkBuffer_TPKv(ptr noundef nonnull align 8 dereferenceable(5916) %1, ptr noundef %24, i64 noundef %19, ptr noundef %4, ptr noundef %5)
          to label %26 unwind label %27

26:                                               ; preds = %17
  call void @_ZN12VmaMutexLockD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  ret i32 %25

27:                                               ; preds = %17
  %28 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN12VmaMutexLockD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  resume { ptr, i32 } %28
}

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

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


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