; 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 @_ZN2vl8database13BufferManager10UnlockPageENS0_8IdObjectIiLl0EEENS2_ImLl1EEEPvNS0_15PersistanceTypeE(ptr noundef nonnull align 8 dereferenceable(168) %0, i32 %1, i64 %2, ptr noundef %3, i32 noundef %4) #0 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca i1, align 1
  %7 = alloca %"struct.vl::database::IdObject", align 4
  %8 = alloca %"struct.vl::database::IdObject.16", align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"class.vl::Ptr.15", align 8
  %13 = alloca i8, align 1
  %14 = alloca ptr, align 8
  %15 = alloca %"class.vl::SpinLock::Scope", align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i64, align 8
  %20 = alloca i8, align 1
  %21 = alloca i8, align 1
  %22 = alloca ptr, align 8
  %23 = alloca %"class.vl::SpinLock::Scope", align 8
  %24 = alloca %"struct.vl::database::IdObject.16", align 8
  %25 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %7, i32 0, i32 0
  store i32 %1, ptr %25, align 4
  %26 = getelementptr inbounds %"struct.vl::database::IdObject.16", ptr %8, i32 0, i32 0
  store i64 %2, ptr %26, align 8
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !9
  %27 = load ptr, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr %12) #6
  call void @_ZN2vl3PtrINS_8database13IBufferSourceEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12)
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #6
  store i8 1, ptr %13, align 1, !tbaa !11
  %28 = load i8, ptr %13, align 1, !tbaa !11, !range !13, !noundef !14
  %29 = trunc i8 %28 to i1
  br i1 %29, label %30, label %71

30:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #6
  %31 = getelementptr inbounds %"class.vl::database::BufferManager", ptr %27, i32 0, i32 4
  invoke void @_ZN2vl8SpinLock5ScopeC1ERS0_(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 8 dereferenceable(16) %31)
          to label %32 unwind label %37

32:                                               ; preds = %30
  store ptr %15, ptr %14, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %66, %32
  %34 = load i8, ptr %13, align 1, !tbaa !11, !range !13, !noundef !14
  %35 = trunc i8 %34 to i1
  br i1 %35, label %41, label %36

36:                                               ; preds = %33
  store i32 2, ptr %18, align 4
  br label %67

37:                                               ; preds = %30
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %16, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %17, align 4
  br label %69

41:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %42 = getelementptr inbounds %"class.vl::database::BufferManager", ptr %27, i32 0, i32 6
  %43 = invoke noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryINS_8database8IdObjectIiLl0EEENS_3PtrINS2_13IBufferSourceEEES4_PS6_E4KeysEv(ptr noundef nonnull align 8 dereferenceable(104) %42)
          to label %44 unwind label %50

44:                                               ; preds = %41
  %45 = invoke noundef i64 @_ZNK2vl11collections10SortedListINS_8database8IdObjectIiLl0EEES4_E7IndexOfERKS4_(ptr noundef nonnull align 8 dereferenceable(33) %43, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %46 unwind label %50

46:                                               ; preds = %44
  store i64 %45, ptr %19, align 8, !tbaa !15
  %47 = load i64, ptr %19, align 8, !tbaa !15
  %48 = icmp eq i64 %47, -1
  br i1 %48, label %49, label %54

49:                                               ; preds = %46
  store i1 false, ptr %6, align 1
  store i32 1, ptr %18, align 4
  br label %63

50:                                               ; preds = %60, %57, %54, %44, %41
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %16, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %15) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #6
  br label %69

54:                                               ; preds = %46
  %55 = getelementptr inbounds %"class.vl::database::BufferManager", ptr %27, i32 0, i32 6
  %56 = invoke noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryINS_8database8IdObjectIiLl0EEENS_3PtrINS2_13IBufferSourceEEES4_PS6_E6ValuesEv(ptr noundef nonnull align 8 dereferenceable(104) %55)
          to label %57 unwind label %50

57:                                               ; preds = %54
  %58 = load i64, ptr %19, align 8, !tbaa !15
  %59 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNK2vl11collections9ArrayBaseINS_3PtrINS_8database13IBufferSourceEEEEixEl(ptr noundef nonnull align 8 dereferenceable(24) %56, i64 noundef %58)
          to label %60 unwind label %50

60:                                               ; preds = %57
  %61 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl3PtrINS_8database13IBufferSourceEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull align 8 dereferenceable(32) %59)
          to label %62 unwind label %50

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

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

65:                                               ; preds = %63
  br label %66

66:                                               ; preds = %65
  store i8 0, ptr %13, align 1, !tbaa !11
  br label %33, !llvm.loop !17

67:                                               ; preds = %63, %36
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %15) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  %68 = load i32, ptr %18, align 4
  switch i32 %68, label %72 [
    i32 2, label %70
  ]

69:                                               ; preds = %50, %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #6
  br label %125

70:                                               ; preds = %67
  br label %71

71:                                               ; preds = %70, %5
  store i32 0, ptr %18, align 4
  br label %72

72:                                               ; preds = %71, %67
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #6
  %73 = load i32, ptr %18, align 4
  switch i32 %73, label %123 [
    i32 0, label %74
  ]

74:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #6
  store i8 0, ptr %20, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #6
  store i8 1, ptr %21, align 1, !tbaa !11
  %75 = load i8, ptr %21, align 1, !tbaa !11, !range !13, !noundef !14
  %76 = trunc i8 %75 to i1
  br i1 %76, label %77, label %114

77:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #6
  %78 = invoke noundef ptr @_ZNK2vl3PtrINS_8database13IBufferSourceEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %79 unwind label %90

79:                                               ; preds = %77
  %80 = load ptr, ptr %78, align 8, !tbaa !19
  %81 = getelementptr inbounds ptr, ptr %80, i64 4
  %82 = load ptr, ptr %81, align 8
  %83 = invoke noundef nonnull align 8 dereferenceable(16) ptr %82(ptr noundef nonnull align 8 dereferenceable(8) %78)
          to label %84 unwind label %90

84:                                               ; preds = %79
  invoke void @_ZN2vl8SpinLock5ScopeC1ERS0_(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(16) %83)
          to label %85 unwind label %90

85:                                               ; preds = %84
  store ptr %23, ptr %22, align 8, !tbaa !5
  br label %86

86:                                               ; preds = %107, %85
  %87 = load i8, ptr %21, align 1, !tbaa !11, !range !13, !noundef !14
  %88 = trunc i8 %87 to i1
  br i1 %88, label %94, label %89

89:                                               ; preds = %86
  store i32 5, ptr %18, align 4
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %23) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  br label %113

90:                                               ; preds = %84, %79, %77
  %91 = landingpad { ptr, i32 }
          cleanup
  %92 = extractvalue { ptr, i32 } %91, 0
  store ptr %92, ptr %16, align 8
  %93 = extractvalue { ptr, i32 } %91, 1
  store i32 %93, ptr %17, align 4
  br label %112

94:                                               ; preds = %86
  %95 = invoke noundef ptr @_ZNK2vl3PtrINS_8database13IBufferSourceEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %96 unwind label %108

96:                                               ; preds = %94
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %24, ptr align 8 %8, i64 8, i1 false), !tbaa.struct !21
  %97 = load ptr, ptr %10, align 8, !tbaa !5
  %98 = load i32, ptr %11, align 4, !tbaa !9
  %99 = getelementptr inbounds %"struct.vl::database::IdObject.16", ptr %24, i32 0, i32 0
  %100 = load i64, ptr %99, align 8
  %101 = load ptr, ptr %95, align 8, !tbaa !19
  %102 = getelementptr inbounds ptr, ptr %101, i64 11
  %103 = load ptr, ptr %102, align 8
  %104 = invoke noundef zeroext i1 %103(ptr noundef nonnull align 8 dereferenceable(8) %95, i64 %100, ptr noundef %97, i32 noundef %98)
          to label %105 unwind label %108

105:                                              ; preds = %96
  %106 = zext i1 %104 to i8
  store i8 %106, ptr %20, align 1, !tbaa !11
  br label %107

107:                                              ; preds = %105
  store i8 0, ptr %21, align 1, !tbaa !11
  br label %86, !llvm.loop !22

108:                                              ; preds = %96, %94
  %109 = landingpad { ptr, i32 }
          cleanup
  %110 = extractvalue { ptr, i32 } %109, 0
  store ptr %110, ptr %16, align 8
  %111 = extractvalue { ptr, i32 } %109, 1
  store i32 %111, ptr %17, align 4
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %23) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #6
  br label %112

112:                                              ; preds = %108, %90
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #6
  br label %122

113:                                              ; preds = %89
  br label %114

114:                                              ; preds = %113, %74
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #6
  invoke void @_ZN2vl8database13BufferManager20SwapCacheIfNecessaryEv(ptr noundef nonnull align 8 dereferenceable(168) %27)
          to label %115 unwind label %118

115:                                              ; preds = %114
  %116 = load i8, ptr %20, align 1, !tbaa !11, !range !13, !noundef !14
  %117 = trunc i8 %116 to i1
  store i1 %117, ptr %6, align 1
  store i32 1, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #6
  br label %123

118:                                              ; preds = %114
  %119 = landingpad { ptr, i32 }
          cleanup
  %120 = extractvalue { ptr, i32 } %119, 0
  store ptr %120, ptr %16, align 8
  %121 = extractvalue { ptr, i32 } %119, 1
  store i32 %121, ptr %17, align 4
  br label %122

122:                                              ; preds = %118, %112
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #6
  br label %125

123:                                              ; preds = %115, %72
  call void @_ZN2vl3PtrINS_8database13IBufferSourceEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #6
  %124 = load i1, ptr %6, align 1
  ret i1 %124

125:                                              ; preds = %122, %69
  call void @_ZN2vl3PtrINS_8database13IBufferSourceEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #6
  br label %126

126:                                              ; preds = %125
  %127 = load ptr, ptr %16, align 8
  %128 = load i32, ptr %17, align 4
  %129 = insertvalue { ptr, i32 } poison, ptr %127, 0
  %130 = insertvalue { ptr, i32 } %129, i32 %128, 1
  resume { ptr, i32 } %130
}

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 = !{!"_ZTSN2vl8database15PersistanceTypeE", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !16, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!20, !20, i64 0}
!20 = !{!"vtable pointer", !8, i64 0}
!21 = !{i64 0, i64 8, !15}
!22 = distinct !{!22, !18}


; 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 @_ZN2vl8database13BufferManager10UnlockPageENS0_8IdObjectIiLl0EEENS2_ImLl1EEEPvNS0_15PersistanceTypeE(ptr noundef nonnull align 8 dereferenceable(168) %0, i32 %1, i64 %2, ptr noundef %3, i32 noundef %4) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"struct.vl::database::IdObject", align 4
  %7 = alloca %"class.vl::Ptr.15", align 8
  %8 = alloca %"class.vl::SpinLock::Scope", align 8
  %9 = alloca %"class.vl::SpinLock::Scope", align 8
  store i32 %1, ptr %6, align 4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #5
  call void @_ZN2vl3PtrINS_8database13IBufferSourceEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #5
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  invoke void @_ZN2vl8SpinLock5ScopeC1ERS0_(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %10)
          to label %.critedge unwind label %11

11:                                               ; preds = %5
  %12 = landingpad { ptr, i32 }
          cleanup
  br label %44

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

16:                                               ; preds = %.critedge
  %.not = icmp eq i64 %15, -1
  br i1 %.not, label %.thread, label %19

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

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

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

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

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

30:                                               ; preds = %24
  invoke void @_ZN2vl8SpinLock5ScopeC1ERS0_(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(16) %29)
          to label %.preheader unwind label %32

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

32:                                               ; preds = %30, %24
  %33 = landingpad { ptr, i32 }
          cleanup
  br label %44

.preheader:                                       ; preds = %30
  %34 = call noundef ptr @_ZNK2vl3PtrINS_8database13IBufferSourceEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %7)
  %35 = load ptr, ptr %34, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %35, i64 88
  %37 = load ptr, ptr %36, align 8
  %38 = invoke noundef zeroext i1 %37(ptr noundef nonnull align 8 dereferenceable(8) %34, i64 %2, ptr noundef %3, i32 noundef %4)
          to label %31 unwind label %39, !llvm.loop !8

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

41:                                               ; preds = %31
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %44

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

44:                                               ; preds = %41, %39, %32, %11, %17
  %.pn35.pn.pn = phi { ptr, i32 } [ %18, %17 ], [ %12, %11 ], [ %42, %41 ], [ %40, %39 ], [ %33, %32 ]
  call void @_ZN2vl3PtrINS_8database13IBufferSourceEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #5
  resume { ptr, i32 } %.pn35.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