; 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.VmaDefragmentationContext_T::MoveAllocationData" = type { i64, i64, i32, i32, %struct.VmaDefragmentationMove }
%struct.VmaDefragmentationMove = type { i32, ptr, ptr }
%struct.VmaAllocationRequest = type <{ ptr, i64, %"class.VmaList<VmaSuballocation, VmaStlAllocator<VmaSuballocation>>::iterator", ptr, i64, i32, [4 x i8] }>
%"class.VmaList<VmaSuballocation, VmaStlAllocator<VmaSuballocation>>::iterator" = type { ptr, ptr }
%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.VmaDefragmentationContext_T = type { i64, i32, ptr, ptr, %struct.VmaStlAllocator.17, %class.VmaVector.18, i8, i32, i32, ptr, ptr, i64, %struct.VmaDefragmentationStats, %struct.VmaDefragmentationStats, ptr }
%struct.VmaStlAllocator.17 = type { ptr }
%class.VmaVector.18 = type { %struct.VmaStlAllocator.17, ptr, i64, i64 }
%struct.VmaDefragmentationStats = type { i64, i64, i32, i32 }

@.str.2 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [2 x i8], align 1
@__PRETTY_FUNCTION__._ZN27VmaDefragmentationContext_T18ReallocWithinBlockER14VmaBlockVectorP20VmaDeviceMemoryBlock = external hidden unnamed_addr constant [95 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7VmaListI16VmaSuballocation15VmaStlAllocatorIS0_EE8iteratorC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #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 @_ZN14VmaBlockVector23CommitAllocationRequestER20VmaAllocationRequestP20VmaDeviceMemoryBlockmjPv20VmaSuballocationTypePP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(181), ptr noundef nonnull align 8 dereferenceable(52), ptr noundef, i64 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN27VmaDefragmentationContext_T18ReallocWithinBlockER14VmaBlockVectorP20VmaDeviceMemoryBlock(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr noundef nonnull align 8 dereferenceable(181) %1, ptr noundef %2) #3 align 2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %"struct.VmaDefragmentationContext_T::MoveAllocationData", align 8
  %12 = alloca i64, align 8
  %13 = alloca %struct.VmaAllocationRequest, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %14 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = getelementptr inbounds %class.VmaDeviceMemoryBlock, ptr %15, i32 0, i32 0
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  store ptr %17, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  %19 = load ptr, ptr %18, align 8, !tbaa !16
  %20 = getelementptr inbounds ptr, ptr %19, i64 11
  %21 = load ptr, ptr %20, align 8
  %22 = call noundef ptr %21(ptr noundef nonnull align 8 dereferenceable(33) %18)
  store ptr %22, ptr %9, align 8, !tbaa !5
  br label %23

23:                                               ; preds = %121, %3
  %24 = load ptr, ptr %9, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  br i1 %25, label %27, label %26

26:                                               ; preds = %23
  store i32 2, ptr %10, align 4
  br label %128

27:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 48, ptr %11) #4
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN27VmaDefragmentationContext_T11GetMoveDataEP16VmaAllocHandle_TP16VmaBlockMetadata(ptr dead_on_unwind writable sret(%"struct.VmaDefragmentationContext_T::MoveAllocationData") align 8 %11, ptr noundef %28, ptr noundef %29)
  %30 = getelementptr inbounds %"struct.VmaDefragmentationContext_T::MoveAllocationData", ptr %11, i32 0, i32 4
  %31 = getelementptr inbounds %struct.VmaDefragmentationMove, ptr %30, i32 0, i32 1
  %32 = load ptr, ptr %31, align 8, !tbaa !18
  %33 = call noundef ptr @_ZNK15VmaAllocation_T11GetUserDataEv(ptr noundef nonnull align 8 dereferenceable(84) %32)
  %34 = icmp eq ptr %33, %14
  br i1 %34, label %35, label %36

35:                                               ; preds = %27
  store i32 4, ptr %10, align 4
  br label %118

36:                                               ; preds = %27
  %37 = getelementptr inbounds %"struct.VmaDefragmentationContext_T::MoveAllocationData", ptr %11, i32 0, i32 4
  %38 = getelementptr inbounds %struct.VmaDefragmentationMove, ptr %37, i32 0, i32 1
  %39 = load ptr, ptr %38, align 8, !tbaa !18
  %40 = call noundef i64 @_ZNK15VmaAllocation_T7GetSizeEv(ptr noundef nonnull align 8 dereferenceable(84) %39)
  %41 = call noundef i32 @_ZN27VmaDefragmentationContext_T13CheckCountersEm(ptr noundef nonnull align 8 dereferenceable(168) %14, i64 noundef %40)
  switch i32 %41, label %44 [
    i32 1, label %42
    i32 2, label %43
    i32 0, label %45
  ]

42:                                               ; preds = %36
  store i32 4, ptr %10, align 4
  br label %118

43:                                               ; preds = %36
  store i1 true, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %118

44:                                               ; preds = %36
  call void @__assert_fail(ptr noundef @.str.57, ptr noundef @.str.2, i32 noundef 13494, ptr noundef @__PRETTY_FUNCTION__._ZN27VmaDefragmentationContext_T18ReallocWithinBlockER14VmaBlockVectorP20VmaDeviceMemoryBlock) #5
  unreachable

45:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %46 = getelementptr inbounds %"struct.VmaDefragmentationContext_T::MoveAllocationData", ptr %11, i32 0, i32 4
  %47 = getelementptr inbounds %struct.VmaDefragmentationMove, ptr %46, i32 0, i32 1
  %48 = load ptr, ptr %47, align 8, !tbaa !18
  %49 = call noundef i64 @_ZNK15VmaAllocation_T9GetOffsetEv(ptr noundef nonnull align 8 dereferenceable(84) %48)
  store i64 %49, ptr %12, align 8, !tbaa !24
  %50 = load i64, ptr %12, align 8, !tbaa !24
  %51 = icmp ne i64 %50, 0
  br i1 %51, label %52, label %116

52:                                               ; preds = %45
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = load ptr, ptr %53, align 8, !tbaa !16
  %55 = getelementptr inbounds ptr, ptr %54, i64 6
  %56 = load ptr, ptr %55, align 8
  %57 = call noundef i64 %56(ptr noundef nonnull align 8 dereferenceable(33) %53)
  %58 = getelementptr inbounds %"struct.VmaDefragmentationContext_T::MoveAllocationData", ptr %11, i32 0, i32 0
  %59 = load i64, ptr %58, align 8, !tbaa !25
  %60 = icmp uge i64 %57, %59
  br i1 %60, label %61, label %116

61:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 56, ptr %13) #4
  %62 = getelementptr inbounds %struct.VmaAllocationRequest, ptr %13, i32 0, i32 0
  store ptr null, ptr %62, align 8, !tbaa !26
  %63 = getelementptr inbounds %struct.VmaAllocationRequest, ptr %13, i32 0, i32 1
  store i64 0, ptr %63, align 8, !tbaa !30
  %64 = getelementptr inbounds %struct.VmaAllocationRequest, ptr %13, i32 0, i32 2
  call void @_ZN7VmaListI16VmaSuballocation15VmaStlAllocatorIS0_EE8iteratorC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %64)
  %65 = getelementptr inbounds %struct.VmaAllocationRequest, ptr %13, i32 0, i32 3
  store ptr null, ptr %65, align 8, !tbaa !31
  %66 = getelementptr inbounds %struct.VmaAllocationRequest, ptr %13, i32 0, i32 4
  store i64 0, ptr %66, align 8, !tbaa !32
  %67 = getelementptr inbounds %struct.VmaAllocationRequest, ptr %13, i32 0, i32 5
  store i32 0, ptr %67, align 8, !tbaa !33
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = getelementptr inbounds %"struct.VmaDefragmentationContext_T::MoveAllocationData", ptr %11, i32 0, i32 0
  %70 = load i64, ptr %69, align 8, !tbaa !25
  %71 = getelementptr inbounds %"struct.VmaDefragmentationContext_T::MoveAllocationData", ptr %11, i32 0, i32 1
  %72 = load i64, ptr %71, align 8, !tbaa !34
  %73 = getelementptr inbounds %"struct.VmaDefragmentationContext_T::MoveAllocationData", ptr %11, i32 0, i32 2
  %74 = load i32, ptr %73, align 8, !tbaa !35
  %75 = load ptr, ptr %68, align 8, !tbaa !16
  %76 = getelementptr inbounds ptr, ptr %75, i64 17
  %77 = load ptr, ptr %76, align 8
  %78 = call noundef zeroext i1 %77(ptr noundef nonnull align 8 dereferenceable(33) %68, i64 noundef %70, i64 noundef %72, i1 noundef zeroext false, i32 noundef %74, i32 noundef 262144, ptr noundef %13)
  br i1 %78, label %79, label %112

79:                                               ; preds = %61
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.VmaAllocationRequest, ptr %13, i32 0, i32 0
  %82 = load ptr, ptr %81, align 8, !tbaa !26
  %83 = load ptr, ptr %80, align 8, !tbaa !16
  %84 = getelementptr inbounds ptr, ptr %83, i64 9
  %85 = load ptr, ptr %84, align 8
  %86 = call noundef i64 %85(ptr noundef nonnull align 8 dereferenceable(33) %80, ptr noundef %82)
  %87 = load i64, ptr %12, align 8, !tbaa !24
  %88 = icmp ult i64 %86, %87
  br i1 %88, label %89, label %111

89:                                               ; preds = %79
  %90 = load ptr, ptr %6, align 8, !tbaa !5
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = getelementptr inbounds %"struct.VmaDefragmentationContext_T::MoveAllocationData", ptr %11, i32 0, i32 1
  %93 = load i64, ptr %92, align 8, !tbaa !34
  %94 = getelementptr inbounds %"struct.VmaDefragmentationContext_T::MoveAllocationData", ptr %11, i32 0, i32 3
  %95 = load i32, ptr %94, align 4, !tbaa !36
  %96 = getelementptr inbounds %"struct.VmaDefragmentationContext_T::MoveAllocationData", ptr %11, i32 0, i32 2
  %97 = load i32, ptr %96, align 8, !tbaa !35
  %98 = getelementptr inbounds %"struct.VmaDefragmentationContext_T::MoveAllocationData", ptr %11, i32 0, i32 4
  %99 = getelementptr inbounds %struct.VmaDefragmentationMove, ptr %98, i32 0, i32 2
  %100 = call noundef i32 @_ZN14VmaBlockVector23CommitAllocationRequestER20VmaAllocationRequestP20VmaDeviceMemoryBlockmjPv20VmaSuballocationTypePP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(181) %90, ptr noundef nonnull align 8 dereferenceable(52) %13, ptr noundef %91, i64 noundef %93, i32 noundef %95, ptr noundef %14, i32 noundef %97, ptr noundef %99)
  %101 = icmp eq i32 %100, 0
  br i1 %101, label %102, label %110

102:                                              ; preds = %89
  %103 = getelementptr inbounds %struct.VmaDefragmentationContext_T, ptr %14, i32 0, i32 5
  %104 = getelementptr inbounds %"struct.VmaDefragmentationContext_T::MoveAllocationData", ptr %11, i32 0, i32 4
  call void @_ZN9VmaVectorI22VmaDefragmentationMove15VmaStlAllocatorIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %103, ptr noundef nonnull align 8 dereferenceable(24) %104)
  %105 = getelementptr inbounds %"struct.VmaDefragmentationContext_T::MoveAllocationData", ptr %11, i32 0, i32 0
  %106 = load i64, ptr %105, align 8, !tbaa !25
  %107 = call noundef zeroext i1 @_ZN27VmaDefragmentationContext_T17IncrementCountersEm(ptr noundef nonnull align 8 dereferenceable(168) %14, i64 noundef %106)
  br i1 %107, label %108, label %109

108:                                              ; preds = %102
  store i1 true, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %113

109:                                              ; preds = %102
  br label %110

110:                                              ; preds = %109, %89
  br label %111

111:                                              ; preds = %110, %79
  br label %112

112:                                              ; preds = %111, %61
  store i32 0, ptr %10, align 4
  br label %113

113:                                              ; preds = %112, %108
  call void @llvm.lifetime.end.p0(i64 56, ptr %13) #4
  %114 = load i32, ptr %10, align 4
  switch i32 %114, label %117 [
    i32 0, label %115
  ]

115:                                              ; preds = %113
  br label %116

116:                                              ; preds = %115, %52, %45
  store i32 0, ptr %10, align 4
  br label %117

117:                                              ; preds = %116, %113
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %118

118:                                              ; preds = %117, %43, %42, %35
  call void @llvm.lifetime.end.p0(i64 48, ptr %11) #4
  %119 = load i32, ptr %10, align 4
  switch i32 %119, label %128 [
    i32 0, label %120
    i32 4, label %121
  ]

120:                                              ; preds = %118
  br label %121

121:                                              ; preds = %120, %118
  %122 = load ptr, ptr %8, align 8, !tbaa !5
  %123 = load ptr, ptr %9, align 8, !tbaa !5
  %124 = load ptr, ptr %122, align 8, !tbaa !16
  %125 = getelementptr inbounds ptr, ptr %124, i64 12
  %126 = load ptr, ptr %125, align 8
  %127 = call noundef ptr %126(ptr noundef nonnull align 8 dereferenceable(33) %122, ptr noundef %123)
  store ptr %127, ptr %9, align 8, !tbaa !5
  br label %23, !llvm.loop !37

128:                                              ; preds = %118, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  %129 = load i32, ptr %10, align 4
  switch i32 %129, label %131 [
    i32 2, label %130
  ]

130:                                              ; preds = %128
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %131

131:                                              ; preds = %130, %128
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %132 = load i1, ptr %4, align 1
  ret i1 %132
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN27VmaDefragmentationContext_T11GetMoveDataEP16VmaAllocHandle_TP16VmaBlockMetadata(ptr dead_on_unwind noalias writable sret(%"struct.VmaDefragmentationContext_T::MoveAllocationData") align 8, ptr noundef, ptr noundef) #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN27VmaDefragmentationContext_T17IncrementCountersEm(ptr noundef nonnull align 8 dereferenceable(168), i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9VmaVectorI22VmaDefragmentationMove15VmaStlAllocatorIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(24)) #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 = { nounwind }
attributes #5 = { noreturn nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTS20VmaDeviceMemoryBlock", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !6, i64 24, !12, i64 32, !15, i64 72, !11, i64 84, !6, i64 88}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTS8VmaMutex", !13, i64 0}
!13 = !{!"_ZTSSt5mutex", !14, i64 0}
!14 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!15 = !{!"_ZTS20VmaMappingHysteresis", !11, i64 0, !11, i64 4, !11, i64 8}
!16 = !{!17, !17, i64 0}
!17 = !{!"vtable pointer", !8, i64 0}
!18 = !{!19, !6, i64 32}
!19 = !{!"_ZTSN27VmaDefragmentationContext_T18MoveAllocationDataE", !20, i64 0, !20, i64 8, !21, i64 16, !11, i64 20, !22, i64 24}
!20 = !{!"long", !7, i64 0}
!21 = !{!"_ZTS20VmaSuballocationType", !7, i64 0}
!22 = !{!"_ZTS22VmaDefragmentationMove", !23, i64 0, !6, i64 8, !6, i64 16}
!23 = !{!"_ZTS31VmaDefragmentationMoveOperation", !7, i64 0}
!24 = !{!20, !20, i64 0}
!25 = !{!19, !20, i64 0}
!26 = !{!27, !6, i64 0}
!27 = !{!"_ZTS20VmaAllocationRequest", !6, i64 0, !20, i64 8, !28, i64 16, !6, i64 32, !20, i64 40, !29, i64 48}
!28 = !{!"_ZTSN7VmaListI16VmaSuballocation15VmaStlAllocatorIS0_EE8iteratorE", !6, i64 0, !6, i64 8}
!29 = !{!"_ZTS24VmaAllocationRequestType", !7, i64 0}
!30 = !{!27, !20, i64 8}
!31 = !{!27, !6, i64 32}
!32 = !{!27, !20, i64 40}
!33 = !{!27, !29, i64 48}
!34 = !{!19, !20, i64 8}
!35 = !{!19, !21, i64 16}
!36 = !{!19, !11, i64 20}
!37 = distinct !{!37, !38}
!38 = !{!"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.VmaDefragmentationContext_T::MoveAllocationData" = type { i64, i64, i32, i32, %struct.VmaDefragmentationMove }
%struct.VmaDefragmentationMove = type { i32, ptr, ptr }
%struct.VmaAllocationRequest = type <{ ptr, i64, %"class.VmaList<VmaSuballocation, VmaStlAllocator<VmaSuballocation>>::iterator", ptr, i64, i32, [4 x i8] }>
%"class.VmaList<VmaSuballocation, VmaStlAllocator<VmaSuballocation>>::iterator" = type { ptr, ptr }

@.str.2 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [2 x i8], align 1
@__PRETTY_FUNCTION__._ZN27VmaDefragmentationContext_T18ReallocWithinBlockER14VmaBlockVectorP20VmaDeviceMemoryBlock = external hidden unnamed_addr constant [95 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7VmaListI16VmaSuballocation15VmaStlAllocatorIS0_EE8iteratorC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) 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 @_ZN14VmaBlockVector23CommitAllocationRequestER20VmaAllocationRequestP20VmaDeviceMemoryBlockmjPv20VmaSuballocationTypePP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(181), ptr noundef nonnull align 8 dereferenceable(52), ptr noundef, i64 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN27VmaDefragmentationContext_T18ReallocWithinBlockER14VmaBlockVectorP20VmaDeviceMemoryBlock(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr noundef nonnull align 8 dereferenceable(181) %1, ptr noundef %2) local_unnamed_addr #3 align 2 {
  %4 = alloca %"struct.VmaDefragmentationContext_T::MoveAllocationData", align 8
  %5 = alloca %struct.VmaAllocationRequest, align 8
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = load ptr, ptr %6, align 8, !tbaa !15
  %8 = getelementptr inbounds i8, ptr %7, i64 88
  %9 = load ptr, ptr %8, align 8
  %10 = tail call noundef ptr %9(ptr noundef nonnull align 8 dereferenceable(33) %6)
  %.not36.not = icmp eq ptr %10, null
  br i1 %.not36.not, label %.critedge29, label %.lr.ph

.lr.ph:                                           ; preds = %3
  %11 = getelementptr inbounds i8, ptr %4, i64 24
  %12 = getelementptr inbounds i8, ptr %4, i64 32
  %13 = getelementptr inbounds i8, ptr %5, i64 16
  %14 = getelementptr inbounds i8, ptr %5, i64 32
  %15 = getelementptr inbounds i8, ptr %4, i64 8
  %16 = getelementptr inbounds i8, ptr %4, i64 16
  %17 = getelementptr inbounds i8, ptr %4, i64 20
  %18 = getelementptr inbounds i8, ptr %4, i64 40
  %19 = getelementptr inbounds i8, ptr %0, i64 40
  br label %20

20:                                               ; preds = %.lr.ph, %63
  %.02337 = phi ptr [ %10, %.lr.ph ], [ %67, %63 ]
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #5
  call void @_ZN27VmaDefragmentationContext_T11GetMoveDataEP16VmaAllocHandle_TP16VmaBlockMetadata(ptr dead_on_unwind nonnull writable sret(%"struct.VmaDefragmentationContext_T::MoveAllocationData") align 8 %4, ptr noundef nonnull %.02337, ptr noundef nonnull %6)
  %21 = load ptr, ptr %12, align 8, !tbaa !17
  %22 = call noundef ptr @_ZNK15VmaAllocation_T11GetUserDataEv(ptr noundef nonnull align 8 dereferenceable(84) %21)
  %23 = icmp eq ptr %22, %0
  br i1 %23, label %63, label %24

24:                                               ; preds = %20
  %25 = load ptr, ptr %12, align 8, !tbaa !17
  %26 = call noundef i64 @_ZNK15VmaAllocation_T7GetSizeEv(ptr noundef nonnull align 8 dereferenceable(84) %25)
  %27 = call noundef i32 @_ZN27VmaDefragmentationContext_T13CheckCountersEm(ptr noundef nonnull align 8 dereferenceable(168) %0, i64 noundef %26)
  switch i32 %27, label %28 [
    i32 1, label %63
    i32 2, label %.loopexit
    i32 0, label %29
  ]

28:                                               ; preds = %24
  call void @__assert_fail(ptr noundef nonnull @.str.57, ptr noundef nonnull @.str.2, i32 noundef 13494, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN27VmaDefragmentationContext_T18ReallocWithinBlockER14VmaBlockVectorP20VmaDeviceMemoryBlock) #6
  unreachable

29:                                               ; preds = %24
  %30 = load ptr, ptr %12, align 8, !tbaa !17
  %31 = call noundef i64 @_ZNK15VmaAllocation_T9GetOffsetEv(ptr noundef nonnull align 8 dereferenceable(84) %30)
  %.not26 = icmp eq i64 %31, 0
  br i1 %.not26, label %63, label %32

32:                                               ; preds = %29
  %33 = load ptr, ptr %6, align 8, !tbaa !15
  %34 = getelementptr inbounds i8, ptr %33, i64 48
  %35 = load ptr, ptr %34, align 8
  %36 = call noundef i64 %35(ptr noundef nonnull align 8 dereferenceable(33) %6)
  %37 = load i64, ptr %4, align 8, !tbaa !23
  %.not27 = icmp ult i64 %36, %37
  br i1 %.not27, label %63, label %38

38:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %5) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %5, i8 0, i64 16, i1 false)
  call void @_ZN7VmaListI16VmaSuballocation15VmaStlAllocatorIS0_EE8iteratorC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(20) %14, i8 0, i64 20, i1 false)
  %39 = load i64, ptr %4, align 8, !tbaa !23
  %40 = load i64, ptr %15, align 8, !tbaa !24
  %41 = load i32, ptr %16, align 8, !tbaa !25
  %42 = load ptr, ptr %6, align 8, !tbaa !15
  %43 = getelementptr inbounds i8, ptr %42, i64 136
  %44 = load ptr, ptr %43, align 8
  %45 = call noundef zeroext i1 %44(ptr noundef nonnull align 8 dereferenceable(33) %6, i64 noundef %39, i64 noundef %40, i1 noundef zeroext false, i32 noundef %41, i32 noundef 262144, ptr noundef nonnull %5)
  br i1 %45, label %46, label %.critedge

46:                                               ; preds = %38
  %47 = load ptr, ptr %5, align 8, !tbaa !26
  %48 = load ptr, ptr %6, align 8, !tbaa !15
  %49 = getelementptr inbounds i8, ptr %48, i64 72
  %50 = load ptr, ptr %49, align 8
  %51 = call noundef i64 %50(ptr noundef nonnull align 8 dereferenceable(33) %6, ptr noundef %47)
  %52 = icmp ult i64 %51, %31
  br i1 %52, label %53, label %.critedge

53:                                               ; preds = %46
  %54 = load i64, ptr %15, align 8, !tbaa !24
  %55 = load i32, ptr %17, align 4, !tbaa !30
  %56 = load i32, ptr %16, align 8, !tbaa !25
  %57 = call noundef i32 @_ZN14VmaBlockVector23CommitAllocationRequestER20VmaAllocationRequestP20VmaDeviceMemoryBlockmjPv20VmaSuballocationTypePP15VmaAllocation_T(ptr noundef nonnull align 8 dereferenceable(181) %1, ptr noundef nonnull align 8 dereferenceable(52) %5, ptr noundef nonnull %2, i64 noundef %54, i32 noundef %55, ptr noundef nonnull %0, i32 noundef %56, ptr noundef nonnull %18)
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %.critedge

59:                                               ; preds = %53
  call void @_ZN9VmaVectorI22VmaDefragmentationMove15VmaStlAllocatorIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %19, ptr noundef nonnull align 8 dereferenceable(24) %11)
  %60 = load i64, ptr %4, align 8, !tbaa !23
  %61 = call noundef zeroext i1 @_ZN27VmaDefragmentationContext_T17IncrementCountersEm(ptr noundef nonnull align 8 dereferenceable(168) %0, i64 noundef %60)
  br i1 %61, label %62, label %.critedge

.critedge:                                        ; preds = %46, %59, %53, %38
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %5) #5
  br label %63

62:                                               ; preds = %59
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %5) #5
  br label %.loopexit

.loopexit:                                        ; preds = %24, %62
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #5
  br label %.critedge29

63:                                               ; preds = %20, %24, %.critedge, %32, %29
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #5
  %64 = load ptr, ptr %6, align 8, !tbaa !15
  %65 = getelementptr inbounds i8, ptr %64, i64 96
  %66 = load ptr, ptr %65, align 8
  %67 = call noundef ptr %66(ptr noundef nonnull align 8 dereferenceable(33) %6, ptr noundef nonnull %.02337)
  %.not.not = icmp eq ptr %67, null
  br i1 %.not.not, label %.critedge29, label %20, !llvm.loop !31

.critedge29:                                      ; preds = %63, %3, %.loopexit
  %.not34 = phi i1 [ true, %.loopexit ], [ false, %3 ], [ false, %63 ]
  ret i1 %.not34
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN27VmaDefragmentationContext_T11GetMoveDataEP16VmaAllocHandle_TP16VmaBlockMetadata(ptr dead_on_unwind noalias writable sret(%"struct.VmaDefragmentationContext_T::MoveAllocationData") align 8, ptr noundef, ptr noundef) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN27VmaDefragmentationContext_T17IncrementCountersEm(ptr noundef nonnull align 8 dereferenceable(168), i64 noundef) local_unnamed_addr #2 align 2

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

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

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
attributes #6 = { noreturn nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"_ZTS20VmaDeviceMemoryBlock", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !7, i64 24, !11, i64 32, !14, i64 72, !10, i64 84, !7, i64 88}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_ZTS8VmaMutex", !12, i64 0}
!12 = !{!"_ZTSSt5mutex", !13, i64 0}
!13 = !{!"_ZTSSt12__mutex_base", !8, i64 0}
!14 = !{!"_ZTS20VmaMappingHysteresis", !10, i64 0, !10, i64 4, !10, i64 8}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !9, i64 0}
!17 = !{!18, !7, i64 32}
!18 = !{!"_ZTSN27VmaDefragmentationContext_T18MoveAllocationDataE", !19, i64 0, !19, i64 8, !20, i64 16, !10, i64 20, !21, i64 24}
!19 = !{!"long", !8, i64 0}
!20 = !{!"_ZTS20VmaSuballocationType", !8, i64 0}
!21 = !{!"_ZTS22VmaDefragmentationMove", !22, i64 0, !7, i64 8, !7, i64 16}
!22 = !{!"_ZTS31VmaDefragmentationMoveOperation", !8, i64 0}
!23 = !{!18, !19, i64 0}
!24 = !{!18, !19, i64 8}
!25 = !{!18, !20, i64 16}
!26 = !{!27, !7, i64 0}
!27 = !{!"_ZTS20VmaAllocationRequest", !7, i64 0, !19, i64 8, !28, i64 16, !7, i64 32, !19, i64 40, !29, i64 48}
!28 = !{!"_ZTSN7VmaListI16VmaSuballocation15VmaStlAllocatorIS0_EE8iteratorE", !7, i64 0, !7, i64 8}
!29 = !{!"_ZTS24VmaAllocationRequestType", !8, i64 0}
!30 = !{!18, !10, i64 20}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass