; LLVM IR from vczh/herodb :: Kernel/Source/Utility (InMemoryBuffer)

; 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.vl::Ptr" = type { ptr, ptr, ptr, ptr }
%"struct.vl::database::IdObject" = type { i64 }
%"class.vl::database::InMemoryBufferSource" = type { %"class.vl::Object", %"class.vl::database::IBufferSource", %"struct.vl::database::IdObject.0", ptr, i64, %"class.vl::SpinLock", %"class.vl::collections::List", %"class.vl::collections::List.1", %"struct.vl::database::IdObject" }
%"class.vl::Object" = type { ptr }
%"class.vl::database::IBufferSource" = type { %"class.vl::Interface" }
%"class.vl::Interface" = type { ptr }
%"struct.vl::database::IdObject.0" = type { i32 }
%"class.vl::SpinLock" = type { %"class.vl::Object", i64 }
%"class.vl::collections::List" = type { %"class.vl::collections::ListBase.base", %"class.vl::collections::IEnumerable" }
%"class.vl::collections::ListBase.base" = type <{ %"class.vl::collections::ArrayBase.base", i64, i8 }>
%"class.vl::collections::ArrayBase.base" = type { %"class.vl::collections::ListStore", ptr, i64 }
%"class.vl::collections::ListStore" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable" = type { %"class.vl::Interface" }
%"class.vl::collections::List.1" = type { %"class.vl::collections::ListBase.base.7", %"class.vl::collections::IEnumerable.5" }
%"class.vl::collections::ListBase.base.7" = type <{ %"class.vl::collections::ArrayBase.base.6", i64, i8 }>
%"class.vl::collections::ArrayBase.base.6" = type { %"class.vl::collections::ListStore.4", ptr, i64 }
%"class.vl::collections::ListStore.4" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.5" = type { %"class.vl::Interface" }
%"class.vl::database::BufferPageDesc" = type <{ ptr, i64, i8, [7 x i8], i64, i8, [7 x i8] }>

@.str = external hidden unnamed_addr constant [110 x i32], align 4
@_ZTIN2vl5ErrorE = external dso_local constant { ptr, ptr }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2vl8database20InMemoryBufferSource7MapPageENS0_8IdObjectImLl1EEE(ptr dead_on_unwind noalias writable sret(%"class.vl::Ptr") align 8 %0, ptr noundef nonnull align 8 dereferenceable(160) %1, i64 %2) #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca %"struct.vl::database::IdObject", align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i1, align 1
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i1, align 1
  store ptr %0, ptr %4, align 8
  %13 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %5, i32 0, i32 0
  store i64 %2, ptr %13, align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  %14 = load ptr, ptr %6, align 8
  br label %15

15:                                               ; preds = %3
  %16 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %5, i32 0, i32 0
  %17 = load i64, ptr %16, align 8, !tbaa !9
  %18 = getelementptr inbounds %"class.vl::database::InMemoryBufferSource", ptr %14, i32 0, i32 6
  %19 = call noundef i64 @_ZNK2vl11collections9ArrayBaseINS_3PtrINS_8database14BufferPageDescEEEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %18)
  %20 = icmp ule i64 %17, %19
  br i1 %20, label %28, label %21

21:                                               ; preds = %15
  %22 = call ptr @__cxa_allocate_exception(i64 8) #6
  invoke void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef @.str)
          to label %23 unwind label %24

23:                                               ; preds = %21
  call void @__cxa_throw(ptr %22, ptr @_ZTIN2vl5ErrorE, ptr null) #7
  unreachable

24:                                               ; preds = %21
  %25 = landingpad { ptr, i32 }
          cleanup
  %26 = extractvalue { ptr, i32 } %25, 0
  store ptr %26, ptr %7, align 8
  %27 = extractvalue { ptr, i32 } %25, 1
  store i32 %27, ptr %8, align 4
  call void @__cxa_free_exception(ptr %22) #6
  br label %113

28:                                               ; preds = %15
  br label %29

29:                                               ; preds = %28
  %30 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %5, i32 0, i32 0
  %31 = load i64, ptr %30, align 8, !tbaa !9
  %32 = getelementptr inbounds %"class.vl::database::InMemoryBufferSource", ptr %14, i32 0, i32 6
  %33 = call noundef i64 @_ZNK2vl11collections9ArrayBaseINS_3PtrINS_8database14BufferPageDescEEEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %32)
  %34 = icmp ult i64 %31, %33
  br i1 %34, label %35, label %57

35:                                               ; preds = %29
  %36 = getelementptr inbounds %"class.vl::database::InMemoryBufferSource", ptr %14, i32 0, i32 6
  %37 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %5, i32 0, i32 0
  %38 = load i64, ptr %37, align 8, !tbaa !9
  %39 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl11collections4ListINS_3PtrINS_8database14BufferPageDescEEEPS4_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %36, i64 noundef %38)
  %40 = call noundef zeroext i1 @_ZNK2vl3PtrINS_8database14BufferPageDescEEcvbEv(ptr noundef nonnull align 8 dereferenceable(32) %39)
  br i1 %40, label %41, label %57

41:                                               ; preds = %35
  store i1 false, ptr %9, align 1
  %42 = getelementptr inbounds %"class.vl::database::InMemoryBufferSource", ptr %14, i32 0, i32 6
  %43 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %5, i32 0, i32 0
  %44 = load i64, ptr %43, align 8, !tbaa !9
  %45 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl11collections4ListINS_3PtrINS_8database14BufferPageDescEEEPS4_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %42, i64 noundef %44)
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %45)
  %46 = call i64 @time(ptr noundef null) #6
  %47 = invoke noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %48 unwind label %51

48:                                               ; preds = %41
  %49 = getelementptr inbounds %"class.vl::database::BufferPageDesc", ptr %47, i32 0, i32 4
  store i64 %46, ptr %49, align 8, !tbaa !12
  store i1 true, ptr %9, align 1
  %50 = load i1, ptr %9, align 1
  br i1 %50, label %56, label %55

51:                                               ; preds = %41
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %7, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %8, align 4
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #6
  br label %113

55:                                               ; preds = %48
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #6
  br label %56

56:                                               ; preds = %55, %48
  br label %112

57:                                               ; preds = %35, %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %58 = getelementptr inbounds %"class.vl::database::InMemoryBufferSource", ptr %14, i32 0, i32 4
  %59 = load i64, ptr %58, align 8, !tbaa !15
  %60 = call noalias ptr @malloc(i64 noundef %59) #8
  store ptr %60, ptr %10, align 8, !tbaa !5
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = icmp ne ptr %61, null
  br i1 %62, label %64, label %63

63:                                               ; preds = %57
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEEC2EPS2_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef null)
  store i32 1, ptr %11, align 4
  br label %111

64:                                               ; preds = %57
  store i1 false, ptr %12, align 1
  call void @_ZN2vl7MakePtrINS_8database14BufferPageDescEJEEENS_3PtrIT_EEDpT0_(ptr dead_on_unwind writable sret(%"class.vl::Ptr") align 8 %0)
  %65 = load ptr, ptr %10, align 8, !tbaa !5
  %66 = invoke noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %67 unwind label %91

67:                                               ; preds = %64
  %68 = getelementptr inbounds %"class.vl::database::BufferPageDesc", ptr %66, i32 0, i32 0
  store ptr %65, ptr %68, align 8, !tbaa !30
  %69 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %5, i32 0, i32 0
  %70 = load i64, ptr %69, align 8, !tbaa !9
  %71 = getelementptr inbounds %"class.vl::database::InMemoryBufferSource", ptr %14, i32 0, i32 4
  %72 = load i64, ptr %71, align 8, !tbaa !15
  %73 = mul i64 %70, %72
  %74 = invoke noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %75 unwind label %91

75:                                               ; preds = %67
  %76 = getelementptr inbounds %"class.vl::database::BufferPageDesc", ptr %74, i32 0, i32 1
  store i64 %73, ptr %76, align 8, !tbaa !31
  %77 = call i64 @time(ptr noundef null) #6
  %78 = invoke noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %79 unwind label %91

79:                                               ; preds = %75
  %80 = getelementptr inbounds %"class.vl::database::BufferPageDesc", ptr %78, i32 0, i32 4
  store i64 %77, ptr %80, align 8, !tbaa !12
  %81 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %5, i32 0, i32 0
  %82 = load i64, ptr %81, align 8, !tbaa !9
  %83 = getelementptr inbounds %"class.vl::database::InMemoryBufferSource", ptr %14, i32 0, i32 6
  %84 = invoke noundef i64 @_ZNK2vl11collections9ArrayBaseINS_3PtrINS_8database14BufferPageDescEEEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %83)
          to label %85 unwind label %91

85:                                               ; preds = %79
  %86 = icmp eq i64 %82, %84
  br i1 %86, label %87, label %95

87:                                               ; preds = %85
  %88 = getelementptr inbounds %"class.vl::database::InMemoryBufferSource", ptr %14, i32 0, i32 6
  %89 = invoke noundef i64 @_ZN2vl11collections4ListINS_3PtrINS_8database14BufferPageDescEEEPS4_E3AddERKS5_(ptr noundef nonnull align 8 dereferenceable(33) %88, ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %90 unwind label %91

90:                                               ; preds = %87
  br label %103

91:                                               ; preds = %100, %95, %87, %79, %75, %67, %64
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %7, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %8, align 4
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %113

95:                                               ; preds = %85
  %96 = getelementptr inbounds %"class.vl::database::InMemoryBufferSource", ptr %14, i32 0, i32 6
  %97 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %5, i32 0, i32 0
  %98 = load i64, ptr %97, align 8, !tbaa !9
  %99 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl11collections4ListINS_3PtrINS_8database14BufferPageDescEEEPS4_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %96, i64 noundef %98)
          to label %100 unwind label %91

100:                                              ; preds = %95
  %101 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl3PtrINS_8database14BufferPageDescEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(32) %99, ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %102 unwind label %91

102:                                              ; preds = %100
  br label %103

103:                                              ; preds = %102, %90
  %104 = getelementptr inbounds %"class.vl::database::InMemoryBufferSource", ptr %14, i32 0, i32 3
  %105 = load ptr, ptr %104, align 8, !tbaa !32
  %106 = atomicrmw add ptr %105, i64 1 seq_cst, align 8
  %107 = add i64 %106, 1
  store i1 true, ptr %12, align 1
  store i32 1, ptr %11, align 4
  %108 = load i1, ptr %12, align 1
  br i1 %108, label %110, label %109

109:                                              ; preds = %103
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #6
  br label %110

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

111:                                              ; preds = %110, %63
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %112

112:                                              ; preds = %111, %56
  ret void

113:                                              ; preds = %91, %51, %24
  %114 = load ptr, ptr %7, align 8
  %115 = load i32, ptr %8, align 4
  %116 = insertvalue { ptr, i32 } poison, ptr %114, 0
  %117 = insertvalue { ptr, i32 } %116, i32 %115, 1
  resume { ptr, i32 } %117
}

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

declare ptr @__cxa_allocate_exception(i64)

declare void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

declare void @__cxa_free_exception(ptr)

declare void @__cxa_throw(ptr, ptr, ptr)

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl3PtrINS_8database14BufferPageDescEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: nounwind
declare i64 @time(ptr noundef) #3

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

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

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #5

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl3PtrINS_8database14BufferPageDescEEC2EPS2_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl7MakePtrINS_8database14BufferPageDescEJEEENS_3PtrIT_EEDpT0_(ptr dead_on_unwind noalias writable sret(%"class.vl::Ptr") align 8) #0

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

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

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

attributes #0 = { 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 #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 = { "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 "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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind allocsize(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 #6 = { nounwind }
attributes #7 = { noreturn }
attributes #8 = { nounwind allocsize(0) }

!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, !11, i64 0}
!10 = !{!"_ZTSN2vl8database8IdObjectImLl1EEE", !11, i64 0}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !11, i64 24}
!13 = !{!"_ZTSN2vl8database14BufferPageDescE", !6, i64 0, !11, i64 8, !14, i64 16, !11, i64 24, !14, i64 32}
!14 = !{!"bool", !7, i64 0}
!15 = !{!16, !11, i64 32}
!16 = !{!"_ZTSN2vl8database20InMemoryBufferSourceE", !17, i64 0, !18, i64 8, !19, i64 16, !6, i64 24, !11, i64 32, !21, i64 40, !22, i64 56, !26, i64 104, !10, i64 152}
!17 = !{!"_ZTSN2vl6ObjectE"}
!18 = !{!"_ZTSN2vl8database13IBufferSourceE"}
!19 = !{!"_ZTSN2vl8database8IdObjectIiLl0EEE", !20, i64 0}
!20 = !{!"int", !7, i64 0}
!21 = !{!"_ZTSN2vl8SpinLockE", !17, i64 0, !11, i64 8}
!22 = !{!"_ZTSN2vl11collections4ListINS_3PtrINS_8database14BufferPageDescEEEPS4_EE", !23, i64 0}
!23 = !{!"_ZTSN2vl11collections8ListBaseINS_3PtrINS_8database14BufferPageDescEEEPS4_EE", !24, i64 0, !11, i64 24, !14, i64 32}
!24 = !{!"_ZTSN2vl11collections9ArrayBaseINS_3PtrINS_8database14BufferPageDescEEEEE", !25, i64 0, !6, i64 8, !11, i64 16}
!25 = !{!"_ZTSN2vl11collections9ListStoreINS_3PtrINS_8database14BufferPageDescEEELb0EEE", !17, i64 0}
!26 = !{!"_ZTSN2vl11collections4ListImmEE", !27, i64 0}
!27 = !{!"_ZTSN2vl11collections8ListBaseImmEE", !28, i64 0, !11, i64 24, !14, i64 32}
!28 = !{!"_ZTSN2vl11collections9ArrayBaseImEE", !29, i64 0, !6, i64 8, !11, i64 16}
!29 = !{!"_ZTSN2vl11collections9ListStoreImLb1EEE", !17, i64 0}
!30 = !{!13, !6, i64 0}
!31 = !{!13, !11, i64 8}
!32 = !{!16, !6, i64 24}


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

%"class.vl::Ptr" = type { ptr, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [110 x i32], align 4
@_ZTIN2vl5ErrorE = external dso_local constant { ptr, ptr }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2vl8database20InMemoryBufferSource7MapPageENS0_8IdObjectImLl1EEE(ptr dead_on_unwind noalias writable sret(%"class.vl::Ptr") align 8 %0, ptr noundef nonnull align 8 dereferenceable(160) %1, i64 %2) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = getelementptr inbounds i8, ptr %1, i64 56
  %5 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseINS_3PtrINS_8database14BufferPageDescEEEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %.not = icmp ult i64 %5, %2
  br i1 %.not, label %6, label %11

6:                                                ; preds = %3
  %7 = tail call ptr @__cxa_allocate_exception(i64 8) #5
  invoke void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull @.str)
          to label %8 unwind label %9

8:                                                ; preds = %6
  tail call void @__cxa_throw(ptr nonnull %7, ptr nonnull @_ZTIN2vl5ErrorE, ptr null) #6
  unreachable

9:                                                ; preds = %6
  %10 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_free_exception(ptr %7) #5
  br label %51

11:                                               ; preds = %3
  %12 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseINS_3PtrINS_8database14BufferPageDescEEEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %13 = icmp ugt i64 %12, %2
  br i1 %13, label %14, label %22

14:                                               ; preds = %11
  %15 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl11collections4ListINS_3PtrINS_8database14BufferPageDescEEEPS4_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %4, i64 noundef %2)
  %16 = tail call noundef zeroext i1 @_ZNK2vl3PtrINS_8database14BufferPageDescEEcvbEv(ptr noundef nonnull align 8 dereferenceable(32) %15)
  br i1 %16, label %17, label %22

17:                                               ; preds = %14
  %18 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl11collections4ListINS_3PtrINS_8database14BufferPageDescEEEPS4_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %4, i64 noundef %2)
  tail call void @_ZN2vl3PtrINS_8database14BufferPageDescEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %18)
  %19 = tail call i64 @time(ptr noundef null) #5
  %20 = tail call noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %21 = getelementptr inbounds i8, ptr %20, i64 24
  store i64 %19, ptr %21, align 8, !tbaa !5
  br label %50

22:                                               ; preds = %14, %11
  %23 = getelementptr inbounds i8, ptr %1, i64 32
  %24 = load i64, ptr %23, align 8, !tbaa !12
  %25 = tail call noalias ptr @malloc(i64 noundef %24) #7
  %.not15 = icmp eq ptr %25, null
  br i1 %.not15, label %26, label %27

26:                                               ; preds = %22
  tail call void @_ZN2vl3PtrINS_8database14BufferPageDescEEC2EPS2_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef null)
  br label %50

27:                                               ; preds = %22
  tail call void @_ZN2vl7MakePtrINS_8database14BufferPageDescEJEEENS_3PtrIT_EEDpT0_(ptr dead_on_unwind writable sret(%"class.vl::Ptr") align 8 %0)
  %28 = tail call noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  store ptr %25, ptr %28, align 8, !tbaa !28
  %29 = load i64, ptr %23, align 8, !tbaa !12
  %30 = mul i64 %29, %2
  %31 = tail call noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %32 = getelementptr inbounds i8, ptr %31, i64 8
  store i64 %30, ptr %32, align 8, !tbaa !29
  %33 = tail call i64 @time(ptr noundef null) #5
  %34 = tail call noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %35 = getelementptr inbounds i8, ptr %34, i64 24
  store i64 %33, ptr %35, align 8, !tbaa !5
  %36 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseINS_3PtrINS_8database14BufferPageDescEEEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %37 = icmp eq i64 %36, %2
  br i1 %37, label %38, label %42

38:                                               ; preds = %27
  %39 = invoke noundef i64 @_ZN2vl11collections4ListINS_3PtrINS_8database14BufferPageDescEEEPS4_E3AddERKS5_(ptr noundef nonnull align 8 dereferenceable(33) %4, ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %46 unwind label %40

40:                                               ; preds = %44, %42, %38
  %41 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN2vl3PtrINS_8database14BufferPageDescEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #5
  br label %51

42:                                               ; preds = %27
  %43 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl11collections4ListINS_3PtrINS_8database14BufferPageDescEEEPS4_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %4, i64 noundef %2)
          to label %44 unwind label %40

44:                                               ; preds = %42
  %45 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl3PtrINS_8database14BufferPageDescEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(32) %43, ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %46 unwind label %40

46:                                               ; preds = %44, %38
  %47 = getelementptr inbounds i8, ptr %1, i64 24
  %48 = load ptr, ptr %47, align 8, !tbaa !30
  %49 = atomicrmw add ptr %48, i64 1 seq_cst, align 8
  br label %50

50:                                               ; preds = %26, %46, %17
  ret void

51:                                               ; preds = %40, %9
  %.pn = phi { ptr, i32 } [ %41, %40 ], [ %10, %9 ]
  resume { ptr, i32 } %.pn
}

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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

declare void @__cxa_free_exception(ptr) local_unnamed_addr

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl3PtrINS_8database14BufferPageDescEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #3

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

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl3PtrINS_8database14BufferPageDescEEC2EPS2_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl7MakePtrINS_8database14BufferPageDescEJEEENS_3PtrIT_EEDpT0_(ptr dead_on_unwind noalias writable sret(%"class.vl::Ptr") align 8) local_unnamed_addr #0

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

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

attributes #0 = { 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 #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 = { "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 "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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 }
attributes #7 = { nounwind allocsize(0) }

!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, !10, i64 24}
!6 = !{!"_ZTSN2vl8database14BufferPageDescE", !7, i64 0, !10, i64 8, !11, i64 16, !10, i64 24, !11, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!13, !10, i64 32}
!13 = !{!"_ZTSN2vl8database20InMemoryBufferSourceE", !14, i64 0, !15, i64 8, !16, i64 16, !7, i64 24, !10, i64 32, !18, i64 40, !19, i64 56, !23, i64 104, !27, i64 152}
!14 = !{!"_ZTSN2vl6ObjectE"}
!15 = !{!"_ZTSN2vl8database13IBufferSourceE"}
!16 = !{!"_ZTSN2vl8database8IdObjectIiLl0EEE", !17, i64 0}
!17 = !{!"int", !8, i64 0}
!18 = !{!"_ZTSN2vl8SpinLockE", !14, i64 0, !10, i64 8}
!19 = !{!"_ZTSN2vl11collections4ListINS_3PtrINS_8database14BufferPageDescEEEPS4_EE", !20, i64 0}
!20 = !{!"_ZTSN2vl11collections8ListBaseINS_3PtrINS_8database14BufferPageDescEEEPS4_EE", !21, i64 0, !10, i64 24, !11, i64 32}
!21 = !{!"_ZTSN2vl11collections9ArrayBaseINS_3PtrINS_8database14BufferPageDescEEEEE", !22, i64 0, !7, i64 8, !10, i64 16}
!22 = !{!"_ZTSN2vl11collections9ListStoreINS_3PtrINS_8database14BufferPageDescEEELb0EEE", !14, i64 0}
!23 = !{!"_ZTSN2vl11collections4ListImmEE", !24, i64 0}
!24 = !{!"_ZTSN2vl11collections8ListBaseImmEE", !25, i64 0, !10, i64 24, !11, i64 32}
!25 = !{!"_ZTSN2vl11collections9ArrayBaseImEE", !26, i64 0, !7, i64 8, !10, i64 16}
!26 = !{!"_ZTSN2vl11collections9ListStoreImLb1EEE", !14, i64 0}
!27 = !{!"_ZTSN2vl8database8IdObjectImLl1EEE", !10, i64 0}
!28 = !{!6, !7, i64 0}
!29 = !{!6, !10, i64 8}
!30 = !{!13, !7, i64 24}


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