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

; 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.vl::database::IdObject" = type { i32 }
%"struct.vl::database::IdObject.16" = type { i64 }
%"class.vl::Ptr.15" = type { ptr, ptr, ptr, ptr }
%"class.vl::SpinLock::Scope" = type { %"class.vl::Object", ptr }
%"class.vl::Object" = type { ptr }
%"class.vl::database::BufferManager" = type { i64, i64, i64, i64, %"class.vl::SpinLock", i64, %"class.vl::collections::Dictionary" }
%"class.vl::SpinLock" = type { %"class.vl::Object", i64 }
%"class.vl::collections::Dictionary" = type { %"class.vl::Object", %"class.vl::collections::SortedList", %"class.vl::collections::List", %"class.vl::collections::IEnumerable.6" }
%"class.vl::collections::SortedList" = 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::Interface" = type { ptr }
%"class.vl::collections::List" = type { %"class.vl::collections::ListBase.base.5", %"class.vl::collections::IEnumerable.3" }
%"class.vl::collections::ListBase.base.5" = type <{ %"class.vl::collections::ArrayBase.base.4", i64, i8 }>
%"class.vl::collections::ArrayBase.base.4" = type { %"class.vl::collections::ListStore.2", ptr, i64 }
%"class.vl::collections::ListStore.2" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.3" = type { %"class.vl::Interface" }
%"class.vl::collections::IEnumerable.6" = type { %"class.vl::Interface" }

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl8database13BufferManager20SwapCacheIfNecessaryEv(ptr noundef nonnull align 8 dereferenceable(168)) #0 align 2

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: nounwind
declare void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #5

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2vl8database13BufferManager8FreePageENS0_8IdObjectIiLl0EEENS2_ImLl1EEE(ptr noundef nonnull align 8 dereferenceable(168) %0, i32 %1, i64 %2) #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i1, align 1
  %5 = alloca %"struct.vl::database::IdObject", align 4
  %6 = alloca %"struct.vl::database::IdObject.16", align 8
  %7 = alloca ptr, align 8
  %8 = alloca %"class.vl::Ptr.15", align 8
  %9 = alloca i8, align 1
  %10 = alloca ptr, align 8
  %11 = alloca %"class.vl::SpinLock::Scope", align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  %16 = alloca i8, align 1
  %17 = alloca i8, align 1
  %18 = alloca ptr, align 8
  %19 = alloca %"class.vl::SpinLock::Scope", align 8
  %20 = alloca %"struct.vl::database::IdObject.16", align 8
  %21 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %5, i32 0, i32 0
  store i32 %1, ptr %21, align 4
  %22 = getelementptr inbounds %"struct.vl::database::IdObject.16", ptr %6, i32 0, i32 0
  store i64 %2, ptr %22, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  %23 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #6
  call void @_ZN2vl3PtrINS_8database13IBufferSourceEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8)
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #6
  store i8 1, ptr %9, align 1, !tbaa !9
  %24 = load i8, ptr %9, align 1, !tbaa !9, !range !11, !noundef !12
  %25 = trunc i8 %24 to i1
  br i1 %25, label %26, label %67

26:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #6
  %27 = getelementptr inbounds %"class.vl::database::BufferManager", ptr %23, i32 0, i32 4
  invoke void @_ZN2vl8SpinLock5ScopeC1ERS0_(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 8 dereferenceable(16) %27)
          to label %28 unwind label %33

28:                                               ; preds = %26
  store ptr %11, ptr %10, align 8, !tbaa !5
  br label %29

29:                                               ; preds = %62, %28
  %30 = load i8, ptr %9, align 1, !tbaa !9, !range !11, !noundef !12
  %31 = trunc i8 %30 to i1
  br i1 %31, label %37, label %32

32:                                               ; preds = %29
  store i32 2, ptr %14, align 4
  br label %63

33:                                               ; preds = %26
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %12, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %13, align 4
  br label %65

37:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %38 = getelementptr inbounds %"class.vl::database::BufferManager", ptr %23, i32 0, i32 6
  %39 = invoke noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryINS_8database8IdObjectIiLl0EEENS_3PtrINS2_13IBufferSourceEEES4_PS6_E4KeysEv(ptr noundef nonnull align 8 dereferenceable(104) %38)
          to label %40 unwind label %46

40:                                               ; preds = %37
  %41 = invoke noundef i64 @_ZNK2vl11collections10SortedListINS_8database8IdObjectIiLl0EEES4_E7IndexOfERKS4_(ptr noundef nonnull align 8 dereferenceable(33) %39, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %42 unwind label %46

42:                                               ; preds = %40
  store i64 %41, ptr %15, align 8, !tbaa !13
  %43 = load i64, ptr %15, align 8, !tbaa !13
  %44 = icmp eq i64 %43, -1
  br i1 %44, label %45, label %50

45:                                               ; preds = %42
  store i1 false, ptr %4, align 1
  store i32 1, ptr %14, align 4
  br label %59

46:                                               ; preds = %56, %53, %50, %40, %37
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %12, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %11) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #6
  br label %65

50:                                               ; preds = %42
  %51 = getelementptr inbounds %"class.vl::database::BufferManager", ptr %23, i32 0, i32 6
  %52 = invoke noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryINS_8database8IdObjectIiLl0EEENS_3PtrINS2_13IBufferSourceEEES4_PS6_E6ValuesEv(ptr noundef nonnull align 8 dereferenceable(104) %51)
          to label %53 unwind label %46

53:                                               ; preds = %50
  %54 = load i64, ptr %15, align 8, !tbaa !13
  %55 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNK2vl11collections9ArrayBaseINS_3PtrINS_8database13IBufferSourceEEEEixEl(ptr noundef nonnull align 8 dereferenceable(24) %52, i64 noundef %54)
          to label %56 unwind label %46

56:                                               ; preds = %53
  %57 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl3PtrINS_8database13IBufferSourceEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull align 8 dereferenceable(32) %55)
          to label %58 unwind label %46

58:                                               ; preds = %56
  store i32 0, ptr %14, align 4
  br label %59

59:                                               ; preds = %58, %45
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  %60 = load i32, ptr %14, align 4
  switch i32 %60, label %63 [
    i32 0, label %61
  ]

61:                                               ; preds = %59
  br label %62

62:                                               ; preds = %61
  store i8 0, ptr %9, align 1, !tbaa !9
  br label %29, !llvm.loop !15

63:                                               ; preds = %59, %32
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %11) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  %64 = load i32, ptr %14, align 4
  switch i32 %64, label %68 [
    i32 2, label %66
  ]

65:                                               ; preds = %46, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #6
  br label %119

66:                                               ; preds = %63
  br label %67

67:                                               ; preds = %66, %3
  store i32 0, ptr %14, align 4
  br label %68

68:                                               ; preds = %67, %63
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #6
  %69 = load i32, ptr %14, align 4
  switch i32 %69, label %117 [
    i32 0, label %70
  ]

70:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #6
  store i8 0, ptr %16, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #6
  store i8 1, ptr %17, align 1, !tbaa !9
  %71 = load i8, ptr %17, align 1, !tbaa !9, !range !11, !noundef !12
  %72 = trunc i8 %71 to i1
  br i1 %72, label %73, label %108

73:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #6
  %74 = invoke noundef ptr @_ZNK2vl3PtrINS_8database13IBufferSourceEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %75 unwind label %86

75:                                               ; preds = %73
  %76 = load ptr, ptr %74, align 8, !tbaa !17
  %77 = getelementptr inbounds ptr, ptr %76, i64 4
  %78 = load ptr, ptr %77, align 8
  %79 = invoke noundef nonnull align 8 dereferenceable(16) ptr %78(ptr noundef nonnull align 8 dereferenceable(8) %74)
          to label %80 unwind label %86

80:                                               ; preds = %75
  invoke void @_ZN2vl8SpinLock5ScopeC1ERS0_(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 8 dereferenceable(16) %79)
          to label %81 unwind label %86

81:                                               ; preds = %80
  store ptr %19, ptr %18, align 8, !tbaa !5
  br label %82

82:                                               ; preds = %101, %81
  %83 = load i8, ptr %17, align 1, !tbaa !9, !range !11, !noundef !12
  %84 = trunc i8 %83 to i1
  br i1 %84, label %90, label %85

85:                                               ; preds = %82
  store i32 5, ptr %14, align 4
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %19) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  br label %107

86:                                               ; preds = %80, %75, %73
  %87 = landingpad { ptr, i32 }
          cleanup
  %88 = extractvalue { ptr, i32 } %87, 0
  store ptr %88, ptr %12, align 8
  %89 = extractvalue { ptr, i32 } %87, 1
  store i32 %89, ptr %13, align 4
  br label %106

90:                                               ; preds = %82
  %91 = invoke noundef ptr @_ZNK2vl3PtrINS_8database13IBufferSourceEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %92 unwind label %102

92:                                               ; preds = %90
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 8 %6, i64 8, i1 false), !tbaa.struct !19
  %93 = getelementptr inbounds %"struct.vl::database::IdObject.16", ptr %20, i32 0, i32 0
  %94 = load i64, ptr %93, align 8
  %95 = load ptr, ptr %91, align 8, !tbaa !17
  %96 = getelementptr inbounds ptr, ptr %95, i64 9
  %97 = load ptr, ptr %96, align 8
  %98 = invoke noundef zeroext i1 %97(ptr noundef nonnull align 8 dereferenceable(8) %91, i64 %94)
          to label %99 unwind label %102

99:                                               ; preds = %92
  %100 = zext i1 %98 to i8
  store i8 %100, ptr %16, align 1, !tbaa !9
  br label %101

101:                                              ; preds = %99
  store i8 0, ptr %17, align 1, !tbaa !9
  br label %82, !llvm.loop !20

102:                                              ; preds = %92, %90
  %103 = landingpad { ptr, i32 }
          cleanup
  %104 = extractvalue { ptr, i32 } %103, 0
  store ptr %104, ptr %12, align 8
  %105 = extractvalue { ptr, i32 } %103, 1
  store i32 %105, ptr %13, align 4
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %19) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #6
  br label %106

106:                                              ; preds = %102, %86
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #6
  br label %116

107:                                              ; preds = %85
  br label %108

108:                                              ; preds = %107, %70
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #6
  invoke void @_ZN2vl8database13BufferManager20SwapCacheIfNecessaryEv(ptr noundef nonnull align 8 dereferenceable(168) %23)
          to label %109 unwind label %112

109:                                              ; preds = %108
  %110 = load i8, ptr %16, align 1, !tbaa !9, !range !11, !noundef !12
  %111 = trunc i8 %110 to i1
  store i1 %111, ptr %4, align 1
  store i32 1, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #6
  br label %117

112:                                              ; preds = %108
  %113 = landingpad { ptr, i32 }
          cleanup
  %114 = extractvalue { ptr, i32 } %113, 0
  store ptr %114, ptr %12, align 8
  %115 = extractvalue { ptr, i32 } %113, 1
  store i32 %115, ptr %13, align 4
  br label %116

116:                                              ; preds = %112, %106
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #6
  br label %119

117:                                              ; preds = %109, %68
  call void @_ZN2vl3PtrINS_8database13IBufferSourceEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #6
  %118 = load i1, ptr %4, align 1
  ret i1 %118

119:                                              ; preds = %116, %65
  call void @_ZN2vl3PtrINS_8database13IBufferSourceEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #6
  br label %120

120:                                              ; preds = %119
  %121 = load ptr, ptr %12, align 8
  %122 = load i32, ptr %13, align 4
  %123 = insertvalue { ptr, i32 } poison, ptr %121, 0
  %124 = insertvalue { ptr, i32 } %123, i32 %122, 1
  resume { ptr, i32 } %124
}

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { 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 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!18, !18, i64 0}
!18 = !{!"vtable pointer", !8, i64 0}
!19 = !{i64 0, i64 8, !13}
!20 = distinct !{!20, !16}


; 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.vl::database::IdObject" = type { i32 }
%"class.vl::Ptr.15" = type { ptr, ptr, ptr, ptr }
%"class.vl::SpinLock::Scope" = type { %"class.vl::Object", ptr }
%"class.vl::Object" = type { ptr }

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl8database13BufferManager20SwapCacheIfNecessaryEv(ptr noundef nonnull align 8 dereferenceable(168)) local_unnamed_addr #0 align 2

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryINS_8database8IdObjectIiLl0EEENS_3PtrINS2_13IBufferSourceEEES4_PS6_E6ValuesEv(ptr noundef nonnull align 8 dereferenceable(104)) local_unnamed_addr #3 align 2

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

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

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

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

; Function Attrs: nounwind
declare void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryINS_8database8IdObjectIiLl0EEENS_3PtrINS2_13IBufferSourceEEES4_PS6_E4KeysEv(ptr noundef nonnull align 8 dereferenceable(104)) local_unnamed_addr #3 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2vl8database13BufferManager8FreePageENS0_8IdObjectIiLl0EEENS2_ImLl1EEE(ptr noundef nonnull align 8 dereferenceable(168) %0, i32 %1, i64 %2) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"struct.vl::database::IdObject", align 4
  %5 = alloca %"class.vl::Ptr.15", align 8
  %6 = alloca %"class.vl::SpinLock::Scope", align 8
  %7 = alloca %"class.vl::SpinLock::Scope", align 8
  store i32 %1, ptr %4, align 4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #5
  call void @_ZN2vl3PtrINS_8database13IBufferSourceEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #5
  %8 = getelementptr inbounds i8, ptr %0, i64 32
  invoke void @_ZN2vl8SpinLock5ScopeC1ERS0_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %8)
          to label %.critedge unwind label %9

9:                                                ; preds = %3
  %10 = landingpad { ptr, i32 }
          cleanup
  br label %42

.critedge:                                        ; preds = %3
  %11 = getelementptr inbounds i8, ptr %0, i64 56
  %12 = call noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryINS_8database8IdObjectIiLl0EEENS_3PtrINS2_13IBufferSourceEEES4_PS6_E4KeysEv(ptr noundef nonnull align 8 dereferenceable(104) %11)
  %13 = invoke noundef i64 @_ZNK2vl11collections10SortedListINS_8database8IdObjectIiLl0EEES4_E7IndexOfERKS4_(ptr noundef nonnull align 8 dereferenceable(33) %12, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %14 unwind label %15

14:                                               ; preds = %.critedge
  %.not = icmp eq i64 %13, -1
  br i1 %.not, label %.thread, label %17

15:                                               ; preds = %20, %17, %.critedge
  %16 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #5
  br label %42

17:                                               ; preds = %14
  %18 = call noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryINS_8database8IdObjectIiLl0EEENS_3PtrINS2_13IBufferSourceEEES4_PS6_E6ValuesEv(ptr noundef nonnull align 8 dereferenceable(104) %11)
  %19 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNK2vl11collections9ArrayBaseINS_3PtrINS_8database13IBufferSourceEEEEixEl(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef %13)
          to label %20 unwind label %15

20:                                               ; preds = %17
  %21 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl3PtrINS_8database13IBufferSourceEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 8 dereferenceable(32) %19)
          to label %22 unwind label %15

.thread:                                          ; preds = %14
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #5
  br label %41

22:                                               ; preds = %20
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #5
  %23 = call noundef ptr @_ZNK2vl3PtrINS_8database13IBufferSourceEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %5)
  %24 = load ptr, ptr %23, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %24, i64 32
  %26 = load ptr, ptr %25, align 8
  %27 = invoke noundef nonnull align 8 dereferenceable(16) ptr %26(ptr noundef nonnull align 8 dereferenceable(8) %23)
          to label %28 unwind label %30

28:                                               ; preds = %22
  invoke void @_ZN2vl8SpinLock5ScopeC1ERS0_(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %27)
          to label %.preheader unwind label %30

29:                                               ; preds = %.preheader
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  invoke void @_ZN2vl8database13BufferManager20SwapCacheIfNecessaryEv(ptr noundef nonnull align 8 dereferenceable(168) %0)
          to label %41 unwind label %39

30:                                               ; preds = %28, %22
  %31 = landingpad { ptr, i32 }
          cleanup
  br label %42

.preheader:                                       ; preds = %28
  %32 = call noundef ptr @_ZNK2vl3PtrINS_8database13IBufferSourceEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %5)
  %33 = load ptr, ptr %32, align 8, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %33, i64 72
  %35 = load ptr, ptr %34, align 8
  %36 = invoke noundef zeroext i1 %35(ptr noundef nonnull align 8 dereferenceable(8) %32, i64 %2)
          to label %29 unwind label %37, !llvm.loop !8

37:                                               ; preds = %.preheader
  %38 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  br label %42

39:                                               ; preds = %29
  %40 = landingpad { ptr, i32 }
          cleanup
  br label %42

41:                                               ; preds = %.thread, %29
  %.5 = phi i1 [ %36, %29 ], [ false, %.thread ]
  call void @_ZN2vl3PtrINS_8database13IBufferSourceEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  ret i1 %.5

42:                                               ; preds = %39, %37, %30, %9, %15
  %.pn33.pn.pn = phi { ptr, i32 } [ %16, %15 ], [ %10, %9 ], [ %40, %39 ], [ %38, %37 ], [ %31, %30 ]
  call void @_ZN2vl3PtrINS_8database13IBufferSourceEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  resume { ptr, i32 } %.pn33.pn.pn
}

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


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