; 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"

%class.VmaBlockMetadata_Linear = type { %class.VmaBlockMetadata.base, i64, %class.VmaVector.2, %class.VmaVector.2, i32, i32, i64, i64, i64 }
%class.VmaBlockMetadata.base = type <{ ptr, i64, ptr, i64, i8 }>
%class.VmaVector.2 = type { %struct.VmaStlAllocator.3, ptr, i64, i64 }
%struct.VmaStlAllocator.3 = type { ptr }
%struct.VmaSuballocation = type { i64, i64, ptr, i32 }
%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.76 = external hidden unnamed_addr constant [112 x i8], align 1
@__PRETTY_FUNCTION__._ZN23VmaBlockMetadata_Linear36CreateAllocationRequest_UpperAddressEmm20VmaSuballocationTypejP20VmaAllocationRequest = external hidden unnamed_addr constant [151 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 @_ZNK16VmaBlockMetadata7GetSizeEv(ptr noundef nonnull align 8 dereferenceable(33)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZL35VmaIsBufferImageGranularityConflict20VmaSuballocationTypeS_(i32 noundef, i32 noundef) #3

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN23VmaBlockMetadata_Linear36CreateAllocationRequest_UpperAddressEmm20VmaSuballocationTypejP20VmaAllocationRequest(ptr noundef nonnull align 8 dereferenceable(144) %0, i64 noundef %1, i64 noundef %2, i32 noundef %3, i32 noundef %4, ptr noundef %5) #4 align 2 {
  %7 = alloca i1, align 1
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i64, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i8, align 1
  %24 = alloca i64, align 8
  %25 = alloca ptr, align 8
  %26 = alloca i64, align 8
  %27 = alloca i64, align 8
  %28 = alloca ptr, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i64 %1, ptr %9, align 8, !tbaa !9
  store i64 %2, ptr %10, align 8, !tbaa !9
  store i32 %3, ptr %11, align 4, !tbaa !11
  store i32 %4, ptr %12, align 4, !tbaa !13
  store ptr %5, ptr %13, align 8, !tbaa !5
  %29 = load ptr, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %30 = call noundef i64 @_ZNK16VmaBlockMetadata7GetSizeEv(ptr noundef nonnull align 8 dereferenceable(33) %29)
  store i64 %30, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %31 = call noundef i64 @_ZNK16VmaBlockMetadata25GetBufferImageGranularityEv(ptr noundef nonnull align 8 dereferenceable(33) %29)
  store i64 %31, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %32 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN23VmaBlockMetadata_Linear23AccessSuballocations1stEv(ptr noundef nonnull align 8 dereferenceable(144) %29)
  store ptr %32, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %33 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN23VmaBlockMetadata_Linear23AccessSuballocations2ndEv(ptr noundef nonnull align 8 dereferenceable(144) %29)
  store ptr %33, ptr %17, align 8, !tbaa !5
  %34 = getelementptr inbounds %class.VmaBlockMetadata_Linear, ptr %29, i32 0, i32 5
  %35 = load i32, ptr %34, align 4, !tbaa !15
  %36 = icmp eq i32 %35, 1
  br i1 %36, label %37, label %38

37:                                               ; preds = %6
  call void @__assert_fail(ptr noundef @.str.76, ptr noundef @.str.2, i32 noundef 9187, ptr noundef @__PRETTY_FUNCTION__._ZN23VmaBlockMetadata_Linear36CreateAllocationRequest_UpperAddressEmm20VmaSuballocationTypejP20VmaAllocationRequest) #6
  unreachable

38:                                               ; preds = %6
  %39 = load i64, ptr %9, align 8, !tbaa !9
  %40 = load i64, ptr %14, align 8, !tbaa !9
  %41 = icmp ugt i64 %39, %40
  br i1 %41, label %42, label %43

42:                                               ; preds = %38
  store i1 false, ptr %7, align 1
  store i32 1, ptr %18, align 4
  br label %208

43:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %44 = load i64, ptr %14, align 8, !tbaa !9
  %45 = load i64, ptr %9, align 8, !tbaa !9
  %46 = sub i64 %44, %45
  store i64 %46, ptr %19, align 8, !tbaa !9
  %47 = load ptr, ptr %17, align 8, !tbaa !5
  %48 = call noundef zeroext i1 @_ZNK9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(32) %47)
  br i1 %48, label %67, label %49

49:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %50 = load ptr, ptr %17, align 8, !tbaa !5
  %51 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EE4backEv(ptr noundef nonnull align 8 dereferenceable(32) %50)
  store ptr %51, ptr %20, align 8, !tbaa !5
  %52 = load ptr, ptr %20, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.VmaSuballocation, ptr %52, i32 0, i32 0
  %54 = load i64, ptr %53, align 8, !tbaa !22
  %55 = load i64, ptr %9, align 8, !tbaa !9
  %56 = sub i64 %54, %55
  store i64 %56, ptr %19, align 8, !tbaa !9
  %57 = load i64, ptr %9, align 8, !tbaa !9
  %58 = load ptr, ptr %20, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.VmaSuballocation, ptr %58, i32 0, i32 0
  %60 = load i64, ptr %59, align 8, !tbaa !22
  %61 = icmp ugt i64 %57, %60
  br i1 %61, label %62, label %63

62:                                               ; preds = %49
  store i1 false, ptr %7, align 1
  store i32 1, ptr %18, align 4
  br label %64

63:                                               ; preds = %49
  store i32 0, ptr %18, align 4
  br label %64

64:                                               ; preds = %63, %62
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  %65 = load i32, ptr %18, align 4
  switch i32 %65, label %207 [
    i32 0, label %66
  ]

66:                                               ; preds = %64
  br label %67

67:                                               ; preds = %66, %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %68 = load i64, ptr %19, align 8, !tbaa !9
  store i64 %68, ptr %21, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %69 = call noundef i64 @_ZNK16VmaBlockMetadata14GetDebugMarginEv(ptr noundef nonnull align 8 dereferenceable(33) %29)
  store i64 %69, ptr %22, align 8, !tbaa !9
  %70 = load i64, ptr %22, align 8, !tbaa !9
  %71 = icmp ugt i64 %70, 0
  br i1 %71, label %72, label %81

72:                                               ; preds = %67
  %73 = load i64, ptr %21, align 8, !tbaa !9
  %74 = load i64, ptr %22, align 8, !tbaa !9
  %75 = icmp ult i64 %73, %74
  br i1 %75, label %76, label %77

76:                                               ; preds = %72
  store i1 false, ptr %7, align 1
  store i32 1, ptr %18, align 4
  br label %206

77:                                               ; preds = %72
  %78 = load i64, ptr %22, align 8, !tbaa !9
  %79 = load i64, ptr %21, align 8, !tbaa !9
  %80 = sub i64 %79, %78
  store i64 %80, ptr %21, align 8, !tbaa !9
  br label %81

81:                                               ; preds = %77, %67
  %82 = load i64, ptr %21, align 8, !tbaa !9
  %83 = load i64, ptr %10, align 8, !tbaa !9
  %84 = call noundef i64 @_ZL12VmaAlignDownImET_S0_S0_(i64 noundef %82, i64 noundef %83)
  store i64 %84, ptr %21, align 8, !tbaa !9
  %85 = load i64, ptr %15, align 8, !tbaa !9
  %86 = icmp ugt i64 %85, 1
  br i1 %86, label %87, label %135

87:                                               ; preds = %81
  %88 = load i64, ptr %15, align 8, !tbaa !9
  %89 = load i64, ptr %10, align 8, !tbaa !9
  %90 = icmp ne i64 %88, %89
  br i1 %90, label %91, label %135

91:                                               ; preds = %87
  %92 = load ptr, ptr %17, align 8, !tbaa !5
  %93 = call noundef zeroext i1 @_ZNK9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(32) %92)
  br i1 %93, label %135, label %94

94:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 1, ptr %23) #5
  store i8 0, ptr %23, align 1, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #5
  %95 = load ptr, ptr %17, align 8, !tbaa !5
  %96 = call noundef i64 @_ZNK9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %95)
  store i64 %96, ptr %24, align 8, !tbaa !9
  br label %97

97:                                               ; preds = %125, %94
  %98 = load i64, ptr %24, align 8, !tbaa !9
  %99 = add i64 %98, -1
  store i64 %99, ptr %24, align 8, !tbaa !9
  %100 = icmp ne i64 %98, 0
  br i1 %100, label %102, label %101

101:                                              ; preds = %97
  store i32 2, ptr %18, align 4
  br label %126

102:                                              ; preds = %97
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #5
  %103 = load ptr, ptr %17, align 8, !tbaa !5
  %104 = load i64, ptr %24, align 8, !tbaa !9
  %105 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(32) %103, i64 noundef %104)
  store ptr %105, ptr %25, align 8, !tbaa !5
  %106 = load i64, ptr %21, align 8, !tbaa !9
  %107 = load i64, ptr %9, align 8, !tbaa !9
  %108 = load ptr, ptr %25, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.VmaSuballocation, ptr %108, i32 0, i32 0
  %110 = load i64, ptr %109, align 8, !tbaa !22
  %111 = load i64, ptr %15, align 8, !tbaa !9
  %112 = call noundef zeroext i1 @_ZL19VmaBlocksOnSamePagemmmm(i64 noundef %106, i64 noundef %107, i64 noundef %110, i64 noundef %111)
  br i1 %112, label %113, label %121

113:                                              ; preds = %102
  %114 = load ptr, ptr %25, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.VmaSuballocation, ptr %114, i32 0, i32 3
  %116 = load i32, ptr %115, align 8, !tbaa !25
  %117 = load i32, ptr %11, align 4, !tbaa !11
  %118 = call noundef zeroext i1 @_ZL35VmaIsBufferImageGranularityConflict20VmaSuballocationTypeS_(i32 noundef %116, i32 noundef %117)
  br i1 %118, label %119, label %120

119:                                              ; preds = %113
  store i8 1, ptr %23, align 1, !tbaa !24
  store i32 2, ptr %18, align 4
  br label %123

120:                                              ; preds = %113
  br label %122

121:                                              ; preds = %102
  store i32 2, ptr %18, align 4
  br label %123

122:                                              ; preds = %120
  store i32 0, ptr %18, align 4
  br label %123

123:                                              ; preds = %122, %121, %119
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #5
  %124 = load i32, ptr %18, align 4
  switch i32 %124, label %126 [
    i32 0, label %125
  ]

125:                                              ; preds = %123
  br label %97, !llvm.loop !26

126:                                              ; preds = %123, %101
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  br label %127

127:                                              ; preds = %126
  %128 = load i8, ptr %23, align 1, !tbaa !24, !range !28, !noundef !29
  %129 = trunc i8 %128 to i1
  br i1 %129, label %130, label %134

130:                                              ; preds = %127
  %131 = load i64, ptr %21, align 8, !tbaa !9
  %132 = load i64, ptr %15, align 8, !tbaa !9
  %133 = call noundef i64 @_ZL12VmaAlignDownImET_S0_S0_(i64 noundef %131, i64 noundef %132)
  store i64 %133, ptr %21, align 8, !tbaa !9
  br label %134

134:                                              ; preds = %130, %127
  call void @llvm.lifetime.end.p0(i64 1, ptr %23) #5
  br label %135

135:                                              ; preds = %134, %91, %87, %81
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #5
  %136 = load ptr, ptr %16, align 8, !tbaa !5
  %137 = call noundef zeroext i1 @_ZNK9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(32) %136)
  br i1 %137, label %148, label %138

138:                                              ; preds = %135
  %139 = load ptr, ptr %16, align 8, !tbaa !5
  %140 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EE4backEv(ptr noundef nonnull align 8 dereferenceable(32) %139)
  %141 = getelementptr inbounds %struct.VmaSuballocation, ptr %140, i32 0, i32 0
  %142 = load i64, ptr %141, align 8, !tbaa !22
  %143 = load ptr, ptr %16, align 8, !tbaa !5
  %144 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EE4backEv(ptr noundef nonnull align 8 dereferenceable(32) %143)
  %145 = getelementptr inbounds %struct.VmaSuballocation, ptr %144, i32 0, i32 1
  %146 = load i64, ptr %145, align 8, !tbaa !30
  %147 = add i64 %142, %146
  br label %149

148:                                              ; preds = %135
  br label %149

149:                                              ; preds = %148, %138
  %150 = phi i64 [ %147, %138 ], [ 0, %148 ]
  store i64 %150, ptr %26, align 8, !tbaa !9
  %151 = load i64, ptr %26, align 8, !tbaa !9
  %152 = load i64, ptr %22, align 8, !tbaa !9
  %153 = add i64 %151, %152
  %154 = load i64, ptr %21, align 8, !tbaa !9
  %155 = icmp ule i64 %153, %154
  br i1 %155, label %156, label %204

156:                                              ; preds = %149
  %157 = load i64, ptr %15, align 8, !tbaa !9
  %158 = icmp ugt i64 %157, 1
  br i1 %158, label %159, label %196

159:                                              ; preds = %156
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #5
  %160 = load ptr, ptr %16, align 8, !tbaa !5
  %161 = call noundef i64 @_ZNK9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %160)
  store i64 %161, ptr %27, align 8, !tbaa !9
  br label %162

162:                                              ; preds = %192, %159
  %163 = load i64, ptr %27, align 8, !tbaa !9
  %164 = add i64 %163, -1
  store i64 %164, ptr %27, align 8, !tbaa !9
  %165 = icmp ne i64 %163, 0
  br i1 %165, label %167, label %166

166:                                              ; preds = %162
  store i32 4, ptr %18, align 4
  br label %193

167:                                              ; preds = %162
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #5
  %168 = load ptr, ptr %16, align 8, !tbaa !5
  %169 = load i64, ptr %27, align 8, !tbaa !9
  %170 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(32) %168, i64 noundef %169)
  store ptr %170, ptr %28, align 8, !tbaa !5
  %171 = load ptr, ptr %28, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.VmaSuballocation, ptr %171, i32 0, i32 0
  %173 = load i64, ptr %172, align 8, !tbaa !22
  %174 = load ptr, ptr %28, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.VmaSuballocation, ptr %174, i32 0, i32 1
  %176 = load i64, ptr %175, align 8, !tbaa !30
  %177 = load i64, ptr %21, align 8, !tbaa !9
  %178 = load i64, ptr %15, align 8, !tbaa !9
  %179 = call noundef zeroext i1 @_ZL19VmaBlocksOnSamePagemmmm(i64 noundef %173, i64 noundef %176, i64 noundef %177, i64 noundef %178)
  br i1 %179, label %180, label %188

180:                                              ; preds = %167
  %181 = load i32, ptr %11, align 4, !tbaa !11
  %182 = load ptr, ptr %28, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.VmaSuballocation, ptr %182, i32 0, i32 3
  %184 = load i32, ptr %183, align 8, !tbaa !25
  %185 = call noundef zeroext i1 @_ZL35VmaIsBufferImageGranularityConflict20VmaSuballocationTypeS_(i32 noundef %181, i32 noundef %184)
  br i1 %185, label %186, label %187

186:                                              ; preds = %180
  store i1 false, ptr %7, align 1
  store i32 1, ptr %18, align 4
  br label %190

187:                                              ; preds = %180
  br label %189

188:                                              ; preds = %167
  store i32 4, ptr %18, align 4
  br label %190

189:                                              ; preds = %187
  store i32 0, ptr %18, align 4
  br label %190

190:                                              ; preds = %189, %188, %186
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #5
  %191 = load i32, ptr %18, align 4
  switch i32 %191, label %193 [
    i32 0, label %192
  ]

192:                                              ; preds = %190
  br label %162, !llvm.loop !31

193:                                              ; preds = %190, %166
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #5
  %194 = load i32, ptr %18, align 4
  switch i32 %194, label %205 [
    i32 4, label %195
  ]

195:                                              ; preds = %193
  br label %196

196:                                              ; preds = %195, %156
  %197 = load i64, ptr %21, align 8, !tbaa !9
  %198 = add i64 %197, 1
  %199 = inttoptr i64 %198 to ptr
  %200 = load ptr, ptr %13, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.VmaAllocationRequest, ptr %200, i32 0, i32 0
  store ptr %199, ptr %201, align 8, !tbaa !32
  %202 = load ptr, ptr %13, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.VmaAllocationRequest, ptr %202, i32 0, i32 5
  store i32 2, ptr %203, align 8, !tbaa !36
  store i1 true, ptr %7, align 1
  store i32 1, ptr %18, align 4
  br label %205

204:                                              ; preds = %149
  store i1 false, ptr %7, align 1
  store i32 1, ptr %18, align 4
  br label %205

205:                                              ; preds = %204, %196, %193
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #5
  br label %206

206:                                              ; preds = %205, %76
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  br label %207

207:                                              ; preds = %206, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  br label %208

208:                                              ; preds = %207, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  %209 = load i1, ptr %7, align 1
  ret i1 %209
}

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZL19VmaBlocksOnSamePagemmmm(i64 noundef, i64 noundef, i64 noundef, i64 noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZL12VmaAlignDownImET_S0_S0_(i64 noundef, i64 noundef) #3

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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #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, !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, !12, i64 0}
!12 = !{!"_ZTS20VmaSuballocationType", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !21, i64 116}
!16 = !{!"_ZTS23VmaBlockMetadata_Linear", !17, i64 0, !10, i64 40, !19, i64 48, !19, i64 80, !14, i64 112, !21, i64 116, !10, i64 120, !10, i64 128, !10, i64 136}
!17 = !{!"_ZTS16VmaBlockMetadata", !10, i64 8, !6, i64 16, !10, i64 24, !18, i64 32}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"_ZTS9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EE", !20, i64 0, !6, i64 8, !10, i64 16, !10, i64 24}
!20 = !{!"_ZTS15VmaStlAllocatorI16VmaSuballocationE", !6, i64 0}
!21 = !{!"_ZTSN23VmaBlockMetadata_Linear18SECOND_VECTOR_MODEE", !7, i64 0}
!22 = !{!23, !10, i64 0}
!23 = !{!"_ZTS16VmaSuballocation", !10, i64 0, !10, i64 8, !6, i64 16, !12, i64 24}
!24 = !{!18, !18, i64 0}
!25 = !{!23, !12, i64 24}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{i8 0, i8 2}
!29 = !{}
!30 = !{!23, !10, i64 8}
!31 = distinct !{!31, !27}
!32 = !{!33, !6, i64 0}
!33 = !{!"_ZTS20VmaAllocationRequest", !6, i64 0, !10, i64 8, !34, i64 16, !6, i64 32, !10, i64 40, !35, i64 48}
!34 = !{!"_ZTSN7VmaListI16VmaSuballocation15VmaStlAllocatorIS0_EE8iteratorE", !6, i64 0, !6, i64 8}
!35 = !{!"_ZTS24VmaAllocationRequestType", !7, i64 0}
!36 = !{!33, !35, i64 48}


; 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"

@.str.2 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.76 = external hidden unnamed_addr constant [112 x i8], align 1
@__PRETTY_FUNCTION__._ZN23VmaBlockMetadata_Linear36CreateAllocationRequest_UpperAddressEmm20VmaSuballocationTypejP20VmaAllocationRequest = external hidden unnamed_addr constant [151 x i8], align 1

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZL35VmaIsBufferImageGranularityConflict20VmaSuballocationTypeS_(i32 noundef, i32 noundef) local_unnamed_addr #2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN23VmaBlockMetadata_Linear36CreateAllocationRequest_UpperAddressEmm20VmaSuballocationTypejP20VmaAllocationRequest(ptr noundef nonnull align 8 dereferenceable(144) %0, i64 noundef %1, i64 noundef %2, i32 noundef %3, i32 noundef %4, ptr nocapture noundef writeonly %5) local_unnamed_addr #1 align 2 {
  %7 = tail call noundef i64 @_ZNK16VmaBlockMetadata7GetSizeEv(ptr noundef nonnull align 8 dereferenceable(33) %0)
  %8 = tail call noundef i64 @_ZNK16VmaBlockMetadata25GetBufferImageGranularityEv(ptr noundef nonnull align 8 dereferenceable(33) %0)
  %9 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZN23VmaBlockMetadata_Linear23AccessSuballocations1stEv(ptr noundef nonnull align 8 dereferenceable(144) %0)
  %10 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZN23VmaBlockMetadata_Linear23AccessSuballocations2ndEv(ptr noundef nonnull align 8 dereferenceable(144) %0)
  %11 = getelementptr inbounds i8, ptr %0, i64 116
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %13 = icmp eq i32 %12, 1
  br i1 %13, label %14, label %15

14:                                               ; preds = %6
  tail call void @__assert_fail(ptr noundef nonnull @.str.76, ptr noundef nonnull @.str.2, i32 noundef 9187, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN23VmaBlockMetadata_Linear36CreateAllocationRequest_UpperAddressEmm20VmaSuballocationTypejP20VmaAllocationRequest) #3
  unreachable

15:                                               ; preds = %6
  %16 = icmp ult i64 %7, %1
  br i1 %16, label %.loopexit, label %17

17:                                               ; preds = %15
  %18 = tail call noundef zeroext i1 @_ZNK9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(32) %10)
  br i1 %18, label %22, label %19

19:                                               ; preds = %17
  %20 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZN9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EE4backEv(ptr noundef nonnull align 8 dereferenceable(32) %10)
  %21 = load i64, ptr %20, align 8, !tbaa !17
  %.not = icmp ult i64 %21, %1
  br i1 %.not, label %.loopexit, label %22

22:                                               ; preds = %19, %17
  %.pn = phi i64 [ %7, %17 ], [ %21, %19 ]
  %.068 = sub i64 %.pn, %1
  %23 = tail call noundef i64 @_ZNK16VmaBlockMetadata14GetDebugMarginEv(ptr noundef nonnull align 8 dereferenceable(33) %0)
  %.not80 = icmp eq i64 %23, 0
  br i1 %.not80, label %28, label %24

24:                                               ; preds = %22
  %25 = icmp ult i64 %.068, %23
  br i1 %25, label %.loopexit, label %26

26:                                               ; preds = %24
  %27 = sub i64 %.068, %23
  br label %28

28:                                               ; preds = %26, %22
  %.073 = phi i64 [ %27, %26 ], [ %.068, %22 ]
  %29 = tail call noundef i64 @_ZL12VmaAlignDownImET_S0_S0_(i64 noundef %.073, i64 noundef %2)
  %30 = icmp ult i64 %8, 2
  %.not81 = icmp eq i64 %8, %2
  %or.cond = or i1 %30, %.not81
  br i1 %or.cond, label %.thread, label %31

31:                                               ; preds = %28
  %32 = tail call noundef zeroext i1 @_ZNK9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(32) %10)
  br i1 %32, label %.thread, label %33

33:                                               ; preds = %31
  %34 = tail call noundef i64 @_ZNK9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %10)
  br label %35

35:                                               ; preds = %41, %33
  %.069 = phi i64 [ %34, %33 ], [ %36, %41 ]
  %36 = add i64 %.069, -1
  %.not82 = icmp eq i64 %.069, 0
  br i1 %.not82, label %.thread, label %37

37:                                               ; preds = %35
  %38 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZN9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(32) %10, i64 noundef %36)
  %39 = load i64, ptr %38, align 8, !tbaa !17
  %40 = tail call noundef zeroext i1 @_ZL19VmaBlocksOnSamePagemmmm(i64 noundef %29, i64 noundef %1, i64 noundef %39, i64 noundef %8)
  br i1 %40, label %41, label %.thread

41:                                               ; preds = %37
  %42 = getelementptr inbounds i8, ptr %38, i64 24
  %43 = load i32, ptr %42, align 8, !tbaa !20
  %44 = tail call noundef zeroext i1 @_ZL35VmaIsBufferImageGranularityConflict20VmaSuballocationTypeS_(i32 noundef %43, i32 noundef %3)
  br i1 %44, label %.critedge, label %35, !llvm.loop !21

.critedge:                                        ; preds = %41
  %45 = tail call noundef i64 @_ZL12VmaAlignDownImET_S0_S0_(i64 noundef %29, i64 noundef %8)
  br label %.thread

.thread:                                          ; preds = %35, %37, %.critedge, %31, %28
  %.275 = phi i64 [ %29, %31 ], [ %29, %28 ], [ %45, %.critedge ], [ %29, %37 ], [ %29, %35 ]
  %46 = tail call noundef zeroext i1 @_ZNK9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(32) %9)
  br i1 %46, label %54, label %47

47:                                               ; preds = %.thread
  %48 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZN9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EE4backEv(ptr noundef nonnull align 8 dereferenceable(32) %9)
  %49 = load i64, ptr %48, align 8, !tbaa !17
  %50 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZN9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EE4backEv(ptr noundef nonnull align 8 dereferenceable(32) %9)
  %51 = getelementptr inbounds i8, ptr %50, i64 8
  %52 = load i64, ptr %51, align 8, !tbaa !23
  %53 = add i64 %52, %49
  br label %54

54:                                               ; preds = %.thread, %47
  %55 = phi i64 [ %53, %47 ], [ 0, %.thread ]
  %56 = add i64 %55, %23
  %.not83 = icmp ugt i64 %56, %.275
  br i1 %.not83, label %.loopexit, label %57

57:                                               ; preds = %54
  br i1 %30, label %.thread93, label %58

58:                                               ; preds = %57
  %59 = tail call noundef i64 @_ZNK9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %9)
  br label %60

60:                                               ; preds = %68, %58
  %.063 = phi i64 [ %59, %58 ], [ %61, %68 ]
  %61 = add i64 %.063, -1
  %.not84 = icmp eq i64 %.063, 0
  br i1 %.not84, label %.thread93, label %62

62:                                               ; preds = %60
  %63 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZN9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(32) %9, i64 noundef %61)
  %64 = load i64, ptr %63, align 8, !tbaa !17
  %65 = getelementptr inbounds i8, ptr %63, i64 8
  %66 = load i64, ptr %65, align 8, !tbaa !23
  %67 = tail call noundef zeroext i1 @_ZL19VmaBlocksOnSamePagemmmm(i64 noundef %64, i64 noundef %66, i64 noundef %.275, i64 noundef %8)
  br i1 %67, label %68, label %.thread93

68:                                               ; preds = %62
  %69 = getelementptr inbounds i8, ptr %63, i64 24
  %70 = load i32, ptr %69, align 8, !tbaa !20
  %71 = tail call noundef zeroext i1 @_ZL35VmaIsBufferImageGranularityConflict20VmaSuballocationTypeS_(i32 noundef %3, i32 noundef %70)
  br i1 %71, label %.loopexit, label %60, !llvm.loop !24

.thread93:                                        ; preds = %62, %60, %57
  %72 = add i64 %.275, 1
  %73 = inttoptr i64 %72 to ptr
  store ptr %73, ptr %5, align 8, !tbaa !25
  %74 = getelementptr inbounds i8, ptr %5, i64 48
  store i32 2, ptr %74, align 8, !tbaa !29
  br label %.loopexit

.loopexit:                                        ; preds = %68, %19, %.thread93, %54, %24, %15
  %.8 = phi i1 [ false, %15 ], [ false, %19 ], [ false, %24 ], [ true, %.thread93 ], [ false, %54 ], [ false, %68 ]
  ret i1 %.8
}

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZL19VmaBlocksOnSamePagemmmm(i64 noundef, i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZL12VmaAlignDownImET_S0_S0_(i64 noundef, i64 noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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, !16, i64 116}
!6 = !{!"_ZTS23VmaBlockMetadata_Linear", !7, i64 0, !8, i64 40, !13, i64 48, !13, i64 80, !15, i64 112, !16, i64 116, !8, i64 120, !8, i64 128, !8, i64 136}
!7 = !{!"_ZTS16VmaBlockMetadata", !8, i64 8, !11, i64 16, !8, i64 24, !12, i64 32}
!8 = !{!"long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"bool", !9, i64 0}
!13 = !{!"_ZTS9VmaVectorI16VmaSuballocation15VmaStlAllocatorIS0_EE", !14, i64 0, !11, i64 8, !8, i64 16, !8, i64 24}
!14 = !{!"_ZTS15VmaStlAllocatorI16VmaSuballocationE", !11, i64 0}
!15 = !{!"int", !9, i64 0}
!16 = !{!"_ZTSN23VmaBlockMetadata_Linear18SECOND_VECTOR_MODEE", !9, i64 0}
!17 = !{!18, !8, i64 0}
!18 = !{!"_ZTS16VmaSuballocation", !8, i64 0, !8, i64 8, !11, i64 16, !19, i64 24}
!19 = !{!"_ZTS20VmaSuballocationType", !9, i64 0}
!20 = !{!18, !19, i64 24}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!18, !8, i64 8}
!24 = distinct !{!24, !22}
!25 = !{!26, !11, i64 0}
!26 = !{!"_ZTS20VmaAllocationRequest", !11, i64 0, !8, i64 8, !27, i64 16, !11, i64 32, !8, i64 40, !28, i64 48}
!27 = !{!"_ZTSN7VmaListI16VmaSuballocation15VmaStlAllocatorIS0_EE8iteratorE", !11, i64 0, !11, i64 8}
!28 = !{!"_ZTS24VmaAllocationRequestType", !9, i64 0}
!29 = !{!26, !28, i64 48}


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