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

; 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 }
%struct.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }
%"class.vl::database::buffer_internal::FileMapping" = type { %"class.vl::Object", i64, i32, ptr, %"class.vl::collections::Dictionary", i64 }
%"class.vl::Object" = type { ptr }
%"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" }
%"class.vl::database::BufferPageDesc" = type <{ ptr, i64, i8, [7 x i8], i64, i8, [7 x i8] }>

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nounwind
declare i32 @fstat(i32 noundef, ptr noundef) #1

declare ptr @__cxa_allocate_exception(i64)

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

declare void @__cxa_free_exception(ptr)

declare void @__cxa_throw(ptr, ptr, ptr)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2vl8database15buffer_internal11FileMapping7MapPageENS0_8IdObjectImLl1EEE(ptr dead_on_unwind noalias writable sret(%"class.vl::Ptr") align 8 %0, ptr noundef nonnull align 8 dereferenceable(152) %1, i64 %2) #3 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 i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca %struct.stat, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i1, align 1
  %15 = alloca i1, align 1
  store ptr %0, ptr %4, align 8
  %16 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %5, i32 0, i32 0
  store i64 %2, ptr %16, align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  %17 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %18 = getelementptr inbounds %"class.vl::database::buffer_internal::FileMapping", ptr %17, i32 0, i32 4
  %19 = call noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryImNS_3PtrINS_8database14BufferPageDescEEEmPS4_E4KeysEv(ptr noundef nonnull align 8 dereferenceable(104) %18)
  %20 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %5, i32 0, i32 0
  %21 = call noundef i64 @_ZNK2vl11collections10SortedListImmE7IndexOfERKm(ptr noundef nonnull align 8 dereferenceable(33) %19, ptr noundef nonnull align 8 dereferenceable(8) %20)
  store i64 %21, ptr %7, align 8, !tbaa !9
  %22 = load i64, ptr %7, align 8, !tbaa !9
  %23 = icmp eq i64 %22, -1
  br i1 %23, label %24, label %121

24:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %25 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %5, i32 0, i32 0
  %26 = load i64, ptr %25, align 8, !tbaa !11
  %27 = getelementptr inbounds %"class.vl::database::buffer_internal::FileMapping", ptr %17, i32 0, i32 1
  %28 = load i64, ptr %27, align 8, !tbaa !13
  %29 = mul i64 %26, %28
  store i64 %29, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 144, ptr %9) #5
  br label %30

30:                                               ; preds = %24
  %31 = getelementptr inbounds %"class.vl::database::buffer_internal::FileMapping", ptr %17, i32 0, i32 2
  %32 = load i32, ptr %31, align 8, !tbaa !27
  %33 = call i32 @fstat(i32 noundef %32, ptr noundef %9) #5
  %34 = icmp ne i32 %33, -1
  br i1 %34, label %42, label %35

35:                                               ; preds = %30
  %36 = call ptr @__cxa_allocate_exception(i64 8) #5
  invoke void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8) %36, ptr noundef @.str)
          to label %37 unwind label %38

37:                                               ; preds = %35
  call void @__cxa_throw(ptr %36, ptr @_ZTIN2vl5ErrorE, ptr null) #6
  unreachable

38:                                               ; preds = %35
  %39 = landingpad { ptr, i32 }
          cleanup
  %40 = extractvalue { ptr, i32 } %39, 0
  store ptr %40, ptr %10, align 8
  %41 = extractvalue { ptr, i32 } %39, 1
  store i32 %41, ptr %11, align 4
  call void @__cxa_free_exception(ptr %36) #5
  br label %120

42:                                               ; preds = %30
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43
  %45 = getelementptr inbounds %struct.stat, ptr %9, i32 0, i32 8
  %46 = load i64, ptr %45, align 8, !tbaa !28
  %47 = load i64, ptr %8, align 8, !tbaa !9
  %48 = getelementptr inbounds %"class.vl::database::buffer_internal::FileMapping", ptr %17, i32 0, i32 1
  %49 = load i64, ptr %48, align 8, !tbaa !13
  %50 = add i64 %47, %49
  %51 = icmp ult i64 %46, %50
  br i1 %51, label %52, label %81

52:                                               ; preds = %44
  br label %53

53:                                               ; preds = %52
  %54 = getelementptr inbounds %struct.stat, ptr %9, i32 0, i32 8
  %55 = load i64, ptr %54, align 8, !tbaa !28
  %56 = load i64, ptr %8, align 8, !tbaa !9
  %57 = icmp eq i64 %55, %56
  br i1 %57, label %65, label %58

58:                                               ; preds = %53
  %59 = call ptr @__cxa_allocate_exception(i64 8) #5
  invoke void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8) %59, ptr noundef @.str.1)
          to label %60 unwind label %61

60:                                               ; preds = %58
  call void @__cxa_throw(ptr %59, ptr @_ZTIN2vl5ErrorE, ptr null) #6
  unreachable

61:                                               ; preds = %58
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %10, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %11, align 4
  call void @__cxa_free_exception(ptr %59) #5
  br label %120

65:                                               ; preds = %53
  br label %66

66:                                               ; preds = %65
  br label %67

67:                                               ; preds = %66
  %68 = getelementptr inbounds %"class.vl::database::buffer_internal::FileMapping", ptr %17, i32 0, i32 2
  %69 = load i32, ptr %68, align 8, !tbaa !27
  %70 = load i64, ptr %8, align 8, !tbaa !9
  %71 = getelementptr inbounds %"class.vl::database::buffer_internal::FileMapping", ptr %17, i32 0, i32 1
  %72 = load i64, ptr %71, align 8, !tbaa !13
  %73 = add i64 %70, %72
  %74 = call i32 @ftruncate(i32 noundef %69, i64 noundef %73) #5
  %75 = load i64, ptr %8, align 8, !tbaa !9
  %76 = getelementptr inbounds %"class.vl::database::buffer_internal::FileMapping", ptr %17, i32 0, i32 1
  %77 = load i64, ptr %76, align 8, !tbaa !13
  %78 = udiv i64 %75, %77
  %79 = add i64 %78, 1
  %80 = getelementptr inbounds %"class.vl::database::buffer_internal::FileMapping", ptr %17, i32 0, i32 5
  store i64 %79, ptr %80, align 8, !tbaa !31
  br label %81

81:                                               ; preds = %67, %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %82 = getelementptr inbounds %"class.vl::database::buffer_internal::FileMapping", ptr %17, i32 0, i32 1
  %83 = load i64, ptr %82, align 8, !tbaa !13
  %84 = getelementptr inbounds %"class.vl::database::buffer_internal::FileMapping", ptr %17, i32 0, i32 2
  %85 = load i32, ptr %84, align 8, !tbaa !27
  %86 = load i64, ptr %8, align 8, !tbaa !9
  %87 = call ptr @mmap(ptr noundef null, i64 noundef %83, i32 noundef 3, i32 noundef 1, i32 noundef %85, i64 noundef %86) #5
  store ptr %87, ptr %12, align 8, !tbaa !5
  %88 = load ptr, ptr %12, align 8, !tbaa !5
  %89 = icmp eq ptr %88, inttoptr (i64 -1 to ptr)
  br i1 %89, label %90, label %91

90:                                               ; preds = %81
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEEC2EPS2_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef null)
  store i32 1, ptr %13, align 4
  br label %119

91:                                               ; preds = %81
  store i1 false, ptr %14, align 1
  call void @_ZN2vl7MakePtrINS_8database14BufferPageDescEJEEENS_3PtrIT_EEDpT0_(ptr dead_on_unwind writable sret(%"class.vl::Ptr") align 8 %0)
  %92 = load ptr, ptr %12, align 8, !tbaa !5
  %93 = invoke noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %94 unwind label %113

94:                                               ; preds = %91
  %95 = getelementptr inbounds %"class.vl::database::BufferPageDesc", ptr %93, i32 0, i32 0
  store ptr %92, ptr %95, align 8, !tbaa !32
  %96 = load i64, ptr %8, align 8, !tbaa !9
  %97 = invoke noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %98 unwind label %113

98:                                               ; preds = %94
  %99 = getelementptr inbounds %"class.vl::database::BufferPageDesc", ptr %97, i32 0, i32 1
  store i64 %96, ptr %99, align 8, !tbaa !34
  %100 = call i64 @time(ptr noundef null) #5
  %101 = invoke noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %102 unwind label %113

102:                                              ; preds = %98
  %103 = getelementptr inbounds %"class.vl::database::BufferPageDesc", ptr %101, i32 0, i32 4
  store i64 %100, ptr %103, align 8, !tbaa !35
  %104 = getelementptr inbounds %"class.vl::database::buffer_internal::FileMapping", ptr %17, i32 0, i32 4
  %105 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %5, i32 0, i32 0
  %106 = invoke noundef zeroext i1 @_ZN2vl11collections10DictionaryImNS_3PtrINS_8database14BufferPageDescEEEmPS4_E3AddERKmRKS5_(ptr noundef nonnull align 8 dereferenceable(104) %104, ptr noundef nonnull align 8 dereferenceable(8) %105, ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %107 unwind label %113

107:                                              ; preds = %102
  %108 = getelementptr inbounds %"class.vl::database::buffer_internal::FileMapping", ptr %17, i32 0, i32 3
  %109 = load ptr, ptr %108, align 8, !tbaa !36
  %110 = atomicrmw add ptr %109, i64 1 seq_cst, align 8
  %111 = add i64 %110, 1
  store i1 true, ptr %14, align 1
  store i32 1, ptr %13, align 4
  %112 = load i1, ptr %14, align 1
  br i1 %112, label %118, label %117

113:                                              ; preds = %102, %98, %94, %91
  %114 = landingpad { ptr, i32 }
          cleanup
  %115 = extractvalue { ptr, i32 } %114, 0
  store ptr %115, ptr %10, align 8
  %116 = extractvalue { ptr, i32 } %114, 1
  store i32 %116, ptr %11, align 4
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %120

117:                                              ; preds = %107
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #5
  br label %118

118:                                              ; preds = %117, %107
  br label %119

119:                                              ; preds = %118, %90
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 144, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %137

120:                                              ; preds = %113, %61, %38
  call void @llvm.lifetime.end.p0(i64 144, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %138

121:                                              ; preds = %3
  store i1 false, ptr %15, align 1
  %122 = getelementptr inbounds %"class.vl::database::buffer_internal::FileMapping", ptr %17, i32 0, i32 4
  %123 = call noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryImNS_3PtrINS_8database14BufferPageDescEEEmPS4_E6ValuesEv(ptr noundef nonnull align 8 dereferenceable(104) %122)
  %124 = load i64, ptr %7, align 8, !tbaa !9
  %125 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK2vl11collections9ArrayBaseINS_3PtrINS_8database14BufferPageDescEEEEixEl(ptr noundef nonnull align 8 dereferenceable(24) %123, i64 noundef %124)
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %125)
  %126 = call i64 @time(ptr noundef null) #5
  %127 = invoke noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %128 unwind label %131

128:                                              ; preds = %121
  %129 = getelementptr inbounds %"class.vl::database::BufferPageDesc", ptr %127, i32 0, i32 4
  store i64 %126, ptr %129, align 8, !tbaa !35
  store i1 true, ptr %15, align 1
  store i32 1, ptr %13, align 4
  %130 = load i1, ptr %15, align 1
  br i1 %130, label %136, label %135

131:                                              ; preds = %121
  %132 = landingpad { ptr, i32 }
          cleanup
  %133 = extractvalue { ptr, i32 } %132, 0
  store ptr %133, ptr %10, align 8
  %134 = extractvalue { ptr, i32 } %132, 1
  store i32 %134, ptr %11, align 4
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #5
  br label %138

135:                                              ; preds = %128
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #5
  br label %136

136:                                              ; preds = %135, %128
  br label %137

137:                                              ; preds = %136, %119
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  ret void

138:                                              ; preds = %131, %120
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %139

139:                                              ; preds = %138
  %140 = load ptr, ptr %10, align 8
  %141 = load i32, ptr %11, align 4
  %142 = insertvalue { ptr, i32 } poison, ptr %140, 0
  %143 = insertvalue { ptr, i32 } %142, i32 %141, 1
  resume { ptr, i32 } %143
}

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

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

; Function Attrs: nounwind
declare i32 @ftruncate(i32 noundef, i64 noundef) #1

; Function Attrs: nounwind
declare ptr @mmap(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl3PtrINS_8database14BufferPageDescEEC2EPS2_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) unnamed_addr #3 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) #3

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN2vl11collections10DictionaryImNS_3PtrINS_8database14BufferPageDescEEEmPS4_E3AddERKmRKS5_(ptr noundef nonnull align 8 dereferenceable(104), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

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

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { nounwind }
attributes #6 = { noreturn }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTSN2vl8database8IdObjectImLl1EEE", !10, i64 0}
!13 = !{!14, !10, i64 8}
!14 = !{!"_ZTSN2vl8database15buffer_internal11FileMappingE", !15, i64 0, !10, i64 8, !16, i64 16, !6, i64 24, !17, i64 32, !10, i64 144}
!15 = !{!"_ZTSN2vl6ObjectE"}
!16 = !{!"int", !7, i64 0}
!17 = !{!"_ZTSN2vl11collections10DictionaryImNS_3PtrINS_8database14BufferPageDescEEEmPS4_EE", !15, i64 0, !18, i64 8, !23, i64 56}
!18 = !{!"_ZTSN2vl11collections10SortedListImmEE", !19, i64 0}
!19 = !{!"_ZTSN2vl11collections8ListBaseImmEE", !20, i64 0, !10, i64 24, !22, i64 32}
!20 = !{!"_ZTSN2vl11collections9ArrayBaseImEE", !21, i64 0, !6, i64 8, !10, i64 16}
!21 = !{!"_ZTSN2vl11collections9ListStoreImLb1EEE", !15, i64 0}
!22 = !{!"bool", !7, i64 0}
!23 = !{!"_ZTSN2vl11collections4ListINS_3PtrINS_8database14BufferPageDescEEEPS4_EE", !24, i64 0}
!24 = !{!"_ZTSN2vl11collections8ListBaseINS_3PtrINS_8database14BufferPageDescEEEPS4_EE", !25, i64 0, !10, i64 24, !22, i64 32}
!25 = !{!"_ZTSN2vl11collections9ArrayBaseINS_3PtrINS_8database14BufferPageDescEEEEE", !26, i64 0, !6, i64 8, !10, i64 16}
!26 = !{!"_ZTSN2vl11collections9ListStoreINS_3PtrINS_8database14BufferPageDescEEELb0EEE", !15, i64 0}
!27 = !{!14, !16, i64 16}
!28 = !{!29, !10, i64 48}
!29 = !{!"_ZTS4stat", !10, i64 0, !10, i64 8, !10, i64 16, !16, i64 24, !16, i64 28, !16, i64 32, !16, i64 36, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !30, i64 72, !30, i64 88, !30, i64 104, !7, i64 120}
!30 = !{!"_ZTS8timespec", !10, i64 0, !10, i64 8}
!31 = !{!14, !10, i64 144}
!32 = !{!33, !6, i64 0}
!33 = !{!"_ZTSN2vl8database14BufferPageDescE", !6, i64 0, !10, i64 8, !22, i64 16, !10, i64 24, !22, i64 32}
!34 = !{!33, !10, i64 8}
!35 = !{!33, !10, i64 24}
!36 = !{!14, !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 }
%"struct.vl::database::IdObject" = type { i64 }
%struct.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nofree nounwind
declare noundef i32 @fstat(i32 noundef, ptr nocapture noundef) local_unnamed_addr #1

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 void @__cxa_free_exception(ptr) local_unnamed_addr

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2vl8database15buffer_internal11FileMapping7MapPageENS0_8IdObjectImLl1EEE(ptr dead_on_unwind noalias writable sret(%"class.vl::Ptr") align 8 %0, ptr noundef nonnull align 8 dereferenceable(152) %1, i64 %2) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"struct.vl::database::IdObject", align 8
  %5 = alloca %struct.stat, align 8
  store i64 %2, ptr %4, align 8
  %6 = getelementptr inbounds i8, ptr %1, i64 32
  %7 = tail call noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryImNS_3PtrINS_8database14BufferPageDescEEEmPS4_E4KeysEv(ptr noundef nonnull align 8 dereferenceable(104) %6)
  %8 = call noundef i64 @_ZNK2vl11collections10SortedListImmE7IndexOfERKm(ptr noundef nonnull align 8 dereferenceable(33) %7, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %9 = icmp eq i64 %8, -1
  br i1 %9, label %10, label %65

10:                                               ; preds = %3
  %11 = load i64, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  %13 = load i64, ptr %12, align 8, !tbaa !10
  %14 = mul i64 %13, %11
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %5) #6
  %15 = getelementptr inbounds i8, ptr %1, i64 16
  %16 = load i32, ptr %15, align 8, !tbaa !25
  %17 = call i32 @fstat(i32 noundef %16, ptr noundef nonnull %5) #6
  %.not = icmp eq i32 %17, -1
  br i1 %.not, label %18, label %23

18:                                               ; preds = %10
  %19 = call ptr @__cxa_allocate_exception(i64 8) #6
  invoke void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull @.str)
          to label %20 unwind label %21

20:                                               ; preds = %18
  call void @__cxa_throw(ptr nonnull %19, ptr nonnull @_ZTIN2vl5ErrorE, ptr null) #7
  unreachable

21:                                               ; preds = %18
  %22 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %19) #6
  br label %64

23:                                               ; preds = %10
  %24 = getelementptr inbounds i8, ptr %5, i64 48
  %25 = load i64, ptr %24, align 8, !tbaa !26
  %26 = load i64, ptr %12, align 8, !tbaa !10
  %27 = add i64 %26, %14
  %28 = icmp ult i64 %25, %27
  br i1 %28, label %29, label %43

29:                                               ; preds = %23
  %30 = icmp eq i64 %25, %14
  br i1 %30, label %36, label %31

31:                                               ; preds = %29
  %32 = call ptr @__cxa_allocate_exception(i64 8) #6
  invoke void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8) %32, ptr noundef nonnull @.str.1)
          to label %33 unwind label %34

33:                                               ; preds = %31
  call void @__cxa_throw(ptr nonnull %32, ptr nonnull @_ZTIN2vl5ErrorE, ptr null) #7
  unreachable

34:                                               ; preds = %31
  %35 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %32) #6
  br label %64

36:                                               ; preds = %29
  %37 = load i32, ptr %15, align 8, !tbaa !25
  %38 = call i32 @ftruncate(i32 noundef %37, i64 noundef %27) #6
  %39 = load i64, ptr %12, align 8, !tbaa !10
  %40 = udiv i64 %14, %39
  %41 = add nuw i64 %40, 1
  %42 = getelementptr inbounds i8, ptr %1, i64 144
  store i64 %41, ptr %42, align 8, !tbaa !29
  br label %43

43:                                               ; preds = %36, %23
  %44 = phi i64 [ %39, %36 ], [ %26, %23 ]
  %45 = load i32, ptr %15, align 8, !tbaa !25
  %46 = call ptr @mmap(ptr noundef null, i64 noundef %44, i32 noundef 3, i32 noundef 1, i32 noundef %45, i64 noundef %14) #6
  %47 = icmp eq ptr %46, inttoptr (i64 -1 to ptr)
  br i1 %47, label %48, label %49

48:                                               ; preds = %43
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEEC2EPS2_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef null)
  br label %63

49:                                               ; preds = %43
  call void @_ZN2vl7MakePtrINS_8database14BufferPageDescEJEEENS_3PtrIT_EEDpT0_(ptr dead_on_unwind writable sret(%"class.vl::Ptr") align 8 %0)
  %50 = call noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  store ptr %46, ptr %50, align 8, !tbaa !30
  %51 = call noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %52 = getelementptr inbounds i8, ptr %51, i64 8
  store i64 %14, ptr %52, align 8, !tbaa !32
  %53 = call i64 @time(ptr noundef null) #6
  %54 = call noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %55 = getelementptr inbounds i8, ptr %54, i64 24
  store i64 %53, ptr %55, align 8, !tbaa !33
  %56 = invoke noundef zeroext i1 @_ZN2vl11collections10DictionaryImNS_3PtrINS_8database14BufferPageDescEEEmPS4_E3AddERKmRKS5_(ptr noundef nonnull align 8 dereferenceable(104) %6, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %57 unwind label %61

57:                                               ; preds = %49
  %58 = getelementptr inbounds i8, ptr %1, i64 24
  %59 = load ptr, ptr %58, align 8, !tbaa !34
  %60 = atomicrmw add ptr %59, i64 1 seq_cst, align 8
  br label %63

61:                                               ; preds = %49
  %62 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #6
  br label %64

63:                                               ; preds = %57, %48
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %5) #6
  br label %71

64:                                               ; preds = %61, %34, %21
  %.pn = phi { ptr, i32 } [ %62, %61 ], [ %35, %34 ], [ %22, %21 ]
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %5) #6
  resume { ptr, i32 } %.pn

65:                                               ; preds = %3
  %66 = call noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryImNS_3PtrINS_8database14BufferPageDescEEEmPS4_E6ValuesEv(ptr noundef nonnull align 8 dereferenceable(104) %6)
  %67 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK2vl11collections9ArrayBaseINS_3PtrINS_8database14BufferPageDescEEEEixEl(ptr noundef nonnull align 8 dereferenceable(24) %66, i64 noundef %8)
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %67)
  %68 = call i64 @time(ptr noundef null) #6
  %69 = call noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %70 = getelementptr inbounds i8, ptr %69, i64 24
  store i64 %68, ptr %70, align 8, !tbaa !33
  br label %71

71:                                               ; preds = %65, %63
  ret void
}

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

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

; Function Attrs: nounwind
declare i32 @ftruncate(i32 noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: nounwind
declare ptr @mmap(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl3PtrINS_8database14BufferPageDescEEC2EPS2_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) unnamed_addr #3 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 #3

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN2vl11collections10DictionaryImNS_3PtrINS_8database14BufferPageDescEEEmPS4_E3AddERKmRKS5_(ptr noundef nonnull align 8 dereferenceable(104), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

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

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #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 }
attributes #7 = { noreturn }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"_ZTSN2vl8database8IdObjectImLl1EEE", !7, i64 0}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !7, i64 8}
!11 = !{!"_ZTSN2vl8database15buffer_internal11FileMappingE", !12, i64 0, !7, i64 8, !13, i64 16, !14, i64 24, !15, i64 32, !7, i64 144}
!12 = !{!"_ZTSN2vl6ObjectE"}
!13 = !{!"int", !8, i64 0}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{!"_ZTSN2vl11collections10DictionaryImNS_3PtrINS_8database14BufferPageDescEEEmPS4_EE", !12, i64 0, !16, i64 8, !21, i64 56}
!16 = !{!"_ZTSN2vl11collections10SortedListImmEE", !17, i64 0}
!17 = !{!"_ZTSN2vl11collections8ListBaseImmEE", !18, i64 0, !7, i64 24, !20, i64 32}
!18 = !{!"_ZTSN2vl11collections9ArrayBaseImEE", !19, i64 0, !14, i64 8, !7, i64 16}
!19 = !{!"_ZTSN2vl11collections9ListStoreImLb1EEE", !12, i64 0}
!20 = !{!"bool", !8, i64 0}
!21 = !{!"_ZTSN2vl11collections4ListINS_3PtrINS_8database14BufferPageDescEEEPS4_EE", !22, i64 0}
!22 = !{!"_ZTSN2vl11collections8ListBaseINS_3PtrINS_8database14BufferPageDescEEEPS4_EE", !23, i64 0, !7, i64 24, !20, i64 32}
!23 = !{!"_ZTSN2vl11collections9ArrayBaseINS_3PtrINS_8database14BufferPageDescEEEEE", !24, i64 0, !14, i64 8, !7, i64 16}
!24 = !{!"_ZTSN2vl11collections9ListStoreINS_3PtrINS_8database14BufferPageDescEEELb0EEE", !12, i64 0}
!25 = !{!11, !13, i64 16}
!26 = !{!27, !7, i64 48}
!27 = !{!"_ZTS4stat", !7, i64 0, !7, i64 8, !7, i64 16, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !28, i64 72, !28, i64 88, !28, i64 104, !8, i64 120}
!28 = !{!"_ZTS8timespec", !7, i64 0, !7, i64 8}
!29 = !{!11, !7, i64 144}
!30 = !{!31, !14, i64 0}
!31 = !{!"_ZTSN2vl8database14BufferPageDescE", !14, i64 0, !7, i64 8, !20, i64 16, !7, i64 24, !20, i64 32}
!32 = !{!31, !7, i64 8}
!33 = !{!31, !7, i64 24}
!34 = !{!11, !14, i64 24}


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