; 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.VmaMutexLockRead = type { 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 }
%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 }

@.str.186 = external hidden unnamed_addr constant [12 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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13VmaJsonWriter9EndObjectEv(ptr noundef nonnull align 8 dereferenceable(41)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13VmaJsonWriter11WriteStringEPKc(ptr noundef nonnull align 8 dereferenceable(41), ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13VmaJsonWriter11BeginStringEPKc(ptr noundef nonnull align 8 dereferenceable(41), ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13VmaJsonWriter9EndStringEPKc(ptr noundef nonnull align 8 dereferenceable(41), ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13VmaJsonWriter14ContinueStringEj(ptr noundef nonnull align 8 dereferenceable(41), i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13VmaJsonWriter11WriteNumberEj(ptr noundef nonnull align 8 dereferenceable(41), i32 noundef) #1 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14VmaBlockVector16PrintDetailedMapER13VmaJsonWriter(ptr noundef nonnull align 8 dereferenceable(181) %0, ptr noundef nonnull align 8 dereferenceable(41) %1) #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.VmaMutexLockRead, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %10 = getelementptr inbounds %class.VmaBlockVector, ptr %9, i32 0, i32 15
  %11 = getelementptr inbounds %class.VmaBlockVector, ptr %9, i32 0, i32 0
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = getelementptr inbounds %struct.VmaAllocator_T, ptr %12, i32 0, i32 0
  %14 = load i8, ptr %13, align 8, !tbaa !20, !range !41, !noundef !42
  %15 = trunc i8 %14 to i1
  call void @_ZN16VmaMutexLockReadC2ER10VmaRWMutexb(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(56) %10, i1 noundef zeroext %15)
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN13VmaJsonWriter11BeginObjectEb(ptr noundef nonnull align 8 dereferenceable(41) %16, i1 noundef zeroext false)
          to label %17 unwind label %25

17:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  store i64 0, ptr %8, align 8, !tbaa !43
  br label %18

18:                                               ; preds = %74, %17
  %19 = load i64, ptr %8, align 8, !tbaa !43
  %20 = getelementptr inbounds %class.VmaBlockVector, ptr %9, i32 0, i32 16
  %21 = invoke noundef i64 @_ZNK9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %20)
          to label %22 unwind label %29

22:                                               ; preds = %18
  %23 = icmp ult i64 %19, %21
  br i1 %23, label %33, label %24

24:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %77

25:                                               ; preds = %77, %2
  %26 = landingpad { ptr, i32 }
          cleanup
  %27 = extractvalue { ptr, i32 } %26, 0
  store ptr %27, ptr %6, align 8
  %28 = extractvalue { ptr, i32 } %26, 1
  store i32 %28, ptr %7, align 4
  br label %80

29:                                               ; preds = %71, %63, %59, %58, %55, %50, %48, %46, %44, %43, %40, %35, %33, %18
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %6, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %80

33:                                               ; preds = %22
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN13VmaJsonWriter11BeginStringEPKc(ptr noundef nonnull align 8 dereferenceable(41) %34, ptr noundef null)
          to label %35 unwind label %29

35:                                               ; preds = %33
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %class.VmaBlockVector, ptr %9, i32 0, i32 16
  %38 = load i64, ptr %8, align 8, !tbaa !43
  %39 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(32) %37, i64 noundef %38)
          to label %40 unwind label %29

40:                                               ; preds = %35
  %41 = load ptr, ptr %39, align 8, !tbaa !5
  %42 = invoke noundef i32 @_ZNK20VmaDeviceMemoryBlock5GetIdEv(ptr noundef nonnull align 8 dereferenceable(96) %41)
          to label %43 unwind label %29

43:                                               ; preds = %40
  invoke void @_ZN13VmaJsonWriter14ContinueStringEj(ptr noundef nonnull align 8 dereferenceable(41) %36, i32 noundef %42)
          to label %44 unwind label %29

44:                                               ; preds = %43
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN13VmaJsonWriter9EndStringEPKc(ptr noundef nonnull align 8 dereferenceable(41) %45, ptr noundef null)
          to label %46 unwind label %29

46:                                               ; preds = %44
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN13VmaJsonWriter11BeginObjectEb(ptr noundef nonnull align 8 dereferenceable(41) %47, i1 noundef zeroext false)
          to label %48 unwind label %29

48:                                               ; preds = %46
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN13VmaJsonWriter11WriteStringEPKc(ptr noundef nonnull align 8 dereferenceable(41) %49, ptr noundef @.str.186)
          to label %50 unwind label %29

50:                                               ; preds = %48
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %class.VmaBlockVector, ptr %9, i32 0, i32 16
  %53 = load i64, ptr %8, align 8, !tbaa !43
  %54 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(32) %52, i64 noundef %53)
          to label %55 unwind label %29

55:                                               ; preds = %50
  %56 = load ptr, ptr %54, align 8, !tbaa !5
  %57 = invoke noundef i32 @_ZNK20VmaDeviceMemoryBlock14GetMapRefCountEv(ptr noundef nonnull align 8 dereferenceable(96) %56)
          to label %58 unwind label %29

58:                                               ; preds = %55
  invoke void @_ZN13VmaJsonWriter11WriteNumberEj(ptr noundef nonnull align 8 dereferenceable(41) %51, i32 noundef %57)
          to label %59 unwind label %29

59:                                               ; preds = %58
  %60 = getelementptr inbounds %class.VmaBlockVector, ptr %9, i32 0, i32 16
  %61 = load i64, ptr %8, align 8, !tbaa !43
  %62 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(32) %60, i64 noundef %61)
          to label %63 unwind label %29

63:                                               ; preds = %59
  %64 = load ptr, ptr %62, align 8, !tbaa !5
  %65 = getelementptr inbounds %class.VmaDeviceMemoryBlock, ptr %64, i32 0, i32 0
  %66 = load ptr, ptr %65, align 8, !tbaa !44
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = load ptr, ptr %66, align 8, !tbaa !47
  %69 = getelementptr inbounds ptr, ptr %68, i64 16
  %70 = load ptr, ptr %69, align 8
  invoke void %70(ptr noundef nonnull align 8 dereferenceable(33) %66, ptr noundef nonnull align 8 dereferenceable(41) %67)
          to label %71 unwind label %29

71:                                               ; preds = %63
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN13VmaJsonWriter9EndObjectEv(ptr noundef nonnull align 8 dereferenceable(41) %72)
          to label %73 unwind label %29

73:                                               ; preds = %71
  br label %74

74:                                               ; preds = %73
  %75 = load i64, ptr %8, align 8, !tbaa !43
  %76 = add i64 %75, 1
  store i64 %76, ptr %8, align 8, !tbaa !43
  br label %18, !llvm.loop !49

77:                                               ; preds = %24
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN13VmaJsonWriter9EndObjectEv(ptr noundef nonnull align 8 dereferenceable(41) %78)
          to label %79 unwind label %25

79:                                               ; preds = %77
  call void @_ZN16VmaMutexLockReadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret void

80:                                               ; preds = %29, %25
  call void @_ZN16VmaMutexLockReadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  br label %81

81:                                               ; preds = %80
  %82 = load ptr, ptr %6, align 8
  %83 = load i32, ptr %7, align 4
  %84 = insertvalue { ptr, i32 } poison, ptr %82, 0
  %85 = insertvalue { ptr, i32 } %84, i32 %83, 1
  resume { ptr, i32 } %85
}

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTS14VmaBlockVector", !6, i64 0, !6, i64 8, !11, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !13, i64 56, !11, i64 60, !14, i64 64, !12, i64 72, !6, i64 80, !15, i64 88, !18, i64 144, !11, i64 176, !13, i64 180}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"bool", !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, !6, i64 8, !12, i64 16, !12, i64 24}
!19 = !{!"_ZTS15VmaStlAllocatorIP20VmaDeviceMemoryBlockE", !6, i64 0}
!20 = !{!21, !13, i64 0}
!21 = !{!"_ZTS14VmaAllocator_T", !13, i64 0, !11, 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, !22, i64 40, !23, i64 88, !24, i64 112, !11, i64 200, !31, i64 208, !35, i64 1032, !7, i64 1552, !7, i64 1808, !36, i64 4624, !37, i64 5456, !12, i64 5464, !6, i64 5472, !37, i64 5480, !37, i64 5484, !7, i64 5488, !15, i64 5616, !39, i64 5672, !11, i64 5696, !40, i64 5704, !11, i64 5912}
!22 = !{!"_ZTS21VkAllocationCallbacks", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!23 = !{!"_ZTS24VmaDeviceMemoryCallbacks", !6, i64 0, !6, i64 8, !6, i64 16}
!24 = !{!"_ZTS28VmaAllocationObjectAllocator", !25, i64 0, !28, i64 40}
!25 = !{!"_ZTS8VmaMutex", !26, i64 0}
!26 = !{!"_ZTSSt5mutex", !27, i64 0}
!27 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!28 = !{!"_ZTS16VmaPoolAllocatorI15VmaAllocation_TE", !6, i64 0, !11, i64 8, !29, i64 16}
!29 = !{!"_ZTS9VmaVectorIN16VmaPoolAllocatorI15VmaAllocation_TE9ItemBlockE15VmaStlAllocatorIS3_EE", !30, i64 0, !6, i64 8, !12, i64 16, !12, i64 24}
!30 = !{!"_ZTS15VmaStlAllocatorIN16VmaPoolAllocatorI15VmaAllocation_TE9ItemBlockEE", !6, i64 0}
!31 = !{!"_ZTS26VkPhysicalDeviceProperties", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !32, i64 16, !7, i64 20, !7, i64 276, !33, i64 296, !34, i64 800}
!32 = !{!"_ZTS20VkPhysicalDeviceType", !7, i64 0}
!33 = !{!"_ZTS22VkPhysicalDeviceLimits", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !12, i64 48, !12, i64 56, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116, !11, i64 120, !11, i64 124, !11, i64 128, !11, i64 132, !11, i64 136, !11, i64 140, !11, i64 144, !11, i64 148, !11, i64 152, !11, i64 156, !11, i64 160, !11, i64 164, !11, i64 168, !11, i64 172, !11, i64 176, !11, i64 180, !11, i64 184, !11, i64 188, !11, i64 192, !11, i64 196, !11, i64 200, !11, i64 204, !11, i64 208, !11, i64 212, !11, i64 216, !7, i64 220, !11, i64 232, !7, i64 236, !11, i64 248, !11, i64 252, !11, i64 256, !11, i64 260, !11, i64 264, !14, i64 268, !14, i64 272, !11, i64 276, !7, i64 280, !7, i64 288, !11, i64 296, !12, i64 304, !12, i64 312, !12, i64 320, !12, i64 328, !11, i64 336, !11, i64 340, !11, i64 344, !11, i64 348, !14, i64 352, !14, i64 356, !11, i64 360, !11, i64 364, !11, i64 368, !11, i64 372, !11, i64 376, !11, i64 380, !11, i64 384, !11, i64 388, !11, i64 392, !11, i64 396, !11, i64 400, !11, i64 404, !11, i64 408, !11, i64 412, !11, i64 416, !11, i64 420, !14, i64 424, !11, i64 428, !11, i64 432, !11, i64 436, !11, i64 440, !7, i64 444, !7, i64 452, !14, i64 460, !14, i64 464, !11, i64 468, !11, i64 472, !12, i64 480, !12, i64 488, !12, i64 496}
!34 = !{!"_ZTS32VkPhysicalDeviceSparseProperties", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16}
!35 = !{!"_ZTS32VkPhysicalDeviceMemoryProperties", !11, i64 0, !7, i64 4, !11, i64 260, !7, i64 264}
!36 = !{!"_ZTS20VmaCurrentBudgetData", !7, i64 0, !7, i64 64, !7, i64 128, !7, i64 256, !37, i64 384, !15, i64 392, !7, i64 448, !7, i64 576, !7, i64 704}
!37 = !{!"_ZTSSt6atomicIjE", !38, i64 0}
!38 = !{!"_ZTSSt13__atomic_baseIjE", !11, i64 0}
!39 = !{!"_ZTS22VmaIntrusiveLinkedListI21VmaPoolListItemTraitsE", !6, i64 0, !6, i64 8, !12, i64 16}
!40 = !{!"_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}
!41 = !{i8 0, i8 2}
!42 = !{}
!43 = !{!12, !12, i64 0}
!44 = !{!45, !6, i64 0}
!45 = !{!"_ZTS20VmaDeviceMemoryBlock", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !6, i64 24, !25, i64 32, !46, i64 72, !11, i64 84, !6, i64 88}
!46 = !{!"_ZTS20VmaMappingHysteresis", !11, i64 0, !11, i64 4, !11, i64 8}
!47 = !{!48, !48, i64 0}
!48 = !{!"vtable pointer", !8, i64 0}
!49 = distinct !{!49, !50}
!50 = !{!"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.VmaMutexLockRead = type { ptr }

@.str.186 = external hidden unnamed_addr constant [12 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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13VmaJsonWriter9EndObjectEv(ptr noundef nonnull align 8 dereferenceable(41)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13VmaJsonWriter11WriteStringEPKc(ptr noundef nonnull align 8 dereferenceable(41), ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13VmaJsonWriter11BeginStringEPKc(ptr noundef nonnull align 8 dereferenceable(41), ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13VmaJsonWriter9EndStringEPKc(ptr noundef nonnull align 8 dereferenceable(41), ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13VmaJsonWriter14ContinueStringEj(ptr noundef nonnull align 8 dereferenceable(41), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13VmaJsonWriter11WriteNumberEj(ptr noundef nonnull align 8 dereferenceable(41), i32 noundef) local_unnamed_addr #1 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14VmaBlockVector16PrintDetailedMapER13VmaJsonWriter(ptr noundef nonnull align 8 dereferenceable(181) %0, ptr noundef nonnull align 8 dereferenceable(41) %1) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %struct.VmaMutexLockRead, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %4 = getelementptr inbounds i8, ptr %0, i64 88
  %5 = load ptr, ptr %0, align 8, !tbaa !5
  %6 = load i8, ptr %5, align 8, !tbaa !19, !range !40, !noundef !41
  %7 = trunc nuw i8 %6 to i1
  call void @_ZN16VmaMutexLockReadC2ER10VmaRWMutexb(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(56) %4, i1 noundef zeroext %7)
  invoke void @_ZN13VmaJsonWriter11BeginObjectEb(ptr noundef nonnull align 8 dereferenceable(41) %1, i1 noundef zeroext false)
          to label %.preheader unwind label %10

.preheader:                                       ; preds = %2
  %8 = getelementptr inbounds i8, ptr %0, i64 144
  %9 = call noundef i64 @_ZNK9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %8)
  %.not = icmp eq i64 %9, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %33, %.preheader
  invoke void @_ZN13VmaJsonWriter9EndObjectEv(ptr noundef nonnull align 8 dereferenceable(41) %1)
          to label %37 unwind label %10

10:                                               ; preds = %._crit_edge, %2
  %11 = landingpad { ptr, i32 }
          cleanup
  br label %38

12:                                               ; preds = %32, %25, %21, %20, %19, %18, %14, %.lr.ph
  %13 = landingpad { ptr, i32 }
          cleanup
  br label %38

.lr.ph:                                           ; preds = %.preheader, %33
  %.020 = phi i64 [ %34, %33 ], [ 0, %.preheader ]
  invoke void @_ZN13VmaJsonWriter11BeginStringEPKc(ptr noundef nonnull align 8 dereferenceable(41) %1, ptr noundef null)
          to label %14 unwind label %12

14:                                               ; preds = %.lr.ph
  %15 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(32) %8, i64 noundef %.020)
  %16 = load ptr, ptr %15, align 8, !tbaa !42
  %17 = call noundef i32 @_ZNK20VmaDeviceMemoryBlock5GetIdEv(ptr noundef nonnull align 8 dereferenceable(96) %16)
  invoke void @_ZN13VmaJsonWriter14ContinueStringEj(ptr noundef nonnull align 8 dereferenceable(41) %1, i32 noundef %17)
          to label %18 unwind label %12

18:                                               ; preds = %14
  invoke void @_ZN13VmaJsonWriter9EndStringEPKc(ptr noundef nonnull align 8 dereferenceable(41) %1, ptr noundef null)
          to label %19 unwind label %12

19:                                               ; preds = %18
  invoke void @_ZN13VmaJsonWriter11BeginObjectEb(ptr noundef nonnull align 8 dereferenceable(41) %1, i1 noundef zeroext false)
          to label %20 unwind label %12

20:                                               ; preds = %19
  invoke void @_ZN13VmaJsonWriter11WriteStringEPKc(ptr noundef nonnull align 8 dereferenceable(41) %1, ptr noundef nonnull @.str.186)
          to label %21 unwind label %12

21:                                               ; preds = %20
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(32) %8, i64 noundef %.020)
  %23 = load ptr, ptr %22, align 8, !tbaa !42
  %24 = call noundef i32 @_ZNK20VmaDeviceMemoryBlock14GetMapRefCountEv(ptr noundef nonnull align 8 dereferenceable(96) %23)
  invoke void @_ZN13VmaJsonWriter11WriteNumberEj(ptr noundef nonnull align 8 dereferenceable(41) %1, i32 noundef %24)
          to label %25 unwind label %12

25:                                               ; preds = %21
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(32) %8, i64 noundef %.020)
  %27 = load ptr, ptr %26, align 8, !tbaa !42
  %28 = load ptr, ptr %27, align 8, !tbaa !43
  %29 = load ptr, ptr %28, align 8, !tbaa !46
  %30 = getelementptr inbounds i8, ptr %29, i64 128
  %31 = load ptr, ptr %30, align 8
  invoke void %31(ptr noundef nonnull align 8 dereferenceable(33) %28, ptr noundef nonnull align 8 dereferenceable(41) %1)
          to label %32 unwind label %12

32:                                               ; preds = %25
  invoke void @_ZN13VmaJsonWriter9EndObjectEv(ptr noundef nonnull align 8 dereferenceable(41) %1)
          to label %33 unwind label %12

33:                                               ; preds = %32
  %34 = add nuw i64 %.020, 1
  %35 = call noundef i64 @_ZNK9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %8)
  %36 = icmp ult i64 %34, %35
  br i1 %36, label %.lr.ph, label %._crit_edge, !llvm.loop !48

37:                                               ; preds = %._crit_edge
  call void @_ZN16VmaMutexLockReadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  ret void

38:                                               ; preds = %12, %10
  %.pn = phi { ptr, i32 } [ %13, %12 ], [ %11, %10 ]
  call void @_ZN16VmaMutexLockReadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  resume { ptr, i32 } %.pn
}

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"_ZTS14VmaBlockVector", !7, i64 0, !7, i64 8, !10, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !12, i64 56, !10, i64 60, !13, i64 64, !11, i64 72, !7, i64 80, !14, i64 88, !17, i64 144, !10, i64 176, !12, i64 180}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!"bool", !8, i64 0}
!13 = !{!"float", !8, i64 0}
!14 = !{!"_ZTS10VmaRWMutex", !15, i64 0}
!15 = !{!"_ZTSSt12shared_mutex", !16, i64 0}
!16 = !{!"_ZTSSt22__shared_mutex_pthread", !8, i64 0}
!17 = !{!"_ZTS9VmaVectorIP20VmaDeviceMemoryBlock15VmaStlAllocatorIS1_EE", !18, i64 0, !7, i64 8, !11, i64 16, !11, i64 24}
!18 = !{!"_ZTS15VmaStlAllocatorIP20VmaDeviceMemoryBlockE", !7, i64 0}
!19 = !{!20, !12, i64 0}
!20 = !{!"_ZTS14VmaAllocator_T", !12, i64 0, !10, i64 4, !12, i64 8, !12, i64 9, !12, i64 10, !12, i64 11, !12, i64 12, !12, i64 13, !7, i64 16, !7, i64 24, !12, i64 32, !21, i64 40, !22, i64 88, !23, i64 112, !10, i64 200, !30, i64 208, !34, i64 1032, !8, i64 1552, !8, i64 1808, !35, i64 4624, !36, i64 5456, !11, i64 5464, !7, i64 5472, !36, i64 5480, !36, i64 5484, !8, i64 5488, !14, i64 5616, !38, i64 5672, !10, i64 5696, !39, i64 5704, !10, i64 5912}
!21 = !{!"_ZTS21VkAllocationCallbacks", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!22 = !{!"_ZTS24VmaDeviceMemoryCallbacks", !7, i64 0, !7, i64 8, !7, i64 16}
!23 = !{!"_ZTS28VmaAllocationObjectAllocator", !24, i64 0, !27, i64 40}
!24 = !{!"_ZTS8VmaMutex", !25, i64 0}
!25 = !{!"_ZTSSt5mutex", !26, i64 0}
!26 = !{!"_ZTSSt12__mutex_base", !8, i64 0}
!27 = !{!"_ZTS16VmaPoolAllocatorI15VmaAllocation_TE", !7, i64 0, !10, i64 8, !28, i64 16}
!28 = !{!"_ZTS9VmaVectorIN16VmaPoolAllocatorI15VmaAllocation_TE9ItemBlockE15VmaStlAllocatorIS3_EE", !29, i64 0, !7, i64 8, !11, i64 16, !11, i64 24}
!29 = !{!"_ZTS15VmaStlAllocatorIN16VmaPoolAllocatorI15VmaAllocation_TE9ItemBlockEE", !7, i64 0}
!30 = !{!"_ZTS26VkPhysicalDeviceProperties", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !31, i64 16, !8, i64 20, !8, i64 276, !32, i64 296, !33, i64 800}
!31 = !{!"_ZTS20VkPhysicalDeviceType", !8, i64 0}
!32 = !{!"_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, !11, i64 48, !11, 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, !13, i64 268, !13, i64 272, !10, i64 276, !8, i64 280, !8, i64 288, !10, i64 296, !11, i64 304, !11, i64 312, !11, i64 320, !11, i64 328, !10, i64 336, !10, i64 340, !10, i64 344, !10, i64 348, !13, i64 352, !13, 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, !13, i64 424, !10, i64 428, !10, i64 432, !10, i64 436, !10, i64 440, !8, i64 444, !8, i64 452, !13, i64 460, !13, i64 464, !10, i64 468, !10, i64 472, !11, i64 480, !11, i64 488, !11, i64 496}
!33 = !{!"_ZTS32VkPhysicalDeviceSparseProperties", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16}
!34 = !{!"_ZTS32VkPhysicalDeviceMemoryProperties", !10, i64 0, !8, i64 4, !10, i64 260, !8, i64 264}
!35 = !{!"_ZTS20VmaCurrentBudgetData", !8, i64 0, !8, i64 64, !8, i64 128, !8, i64 256, !36, i64 384, !14, i64 392, !8, i64 448, !8, i64 576, !8, i64 704}
!36 = !{!"_ZTSSt6atomicIjE", !37, i64 0}
!37 = !{!"_ZTSSt13__atomic_baseIjE", !10, i64 0}
!38 = !{!"_ZTS22VmaIntrusiveLinkedListI21VmaPoolListItemTraitsE", !7, i64 0, !7, i64 8, !11, i64 16}
!39 = !{!"_ZTS18VmaVulkanFunctions", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !7, i64 168, !7, i64 176, !7, i64 184, !7, i64 192, !7, i64 200}
!40 = !{i8 0, i8 2}
!41 = !{}
!42 = !{!7, !7, i64 0}
!43 = !{!44, !7, i64 0}
!44 = !{!"_ZTS20VmaDeviceMemoryBlock", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !7, i64 24, !24, i64 32, !45, i64 72, !10, i64 84, !7, i64 88}
!45 = !{!"_ZTS20VmaMappingHysteresis", !10, i64 0, !10, i64 4, !10, i64 8}
!46 = !{!47, !47, i64 0}
!47 = !{!"vtable pointer", !9, i64 0}
!48 = distinct !{!48, !49}
!49 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass