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

%"struct.vl::database::IdObject" = type { i64 }
%"class.vl::Ptr" = type { ptr, ptr, ptr, ptr }
%"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] }>

@_ZTIN2vl5ErrorE = external dso_local constant { ptr, ptr }, align 8
@.str.2 = external hidden unnamed_addr constant [104 x i32], align 4
@.str.3 = external hidden unnamed_addr constant [105 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

declare ptr @__cxa_allocate_exception(i64)

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

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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryImNS_3PtrINS_8database14BufferPageDescEEEmPS4_E4KeysEv(ptr noundef nonnull align 8 dereferenceable(104)) #2 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: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2vl8database15buffer_internal11FileMapping9UnmapPageENS0_8IdObjectImLl1EEE(ptr noundef nonnull align 8 dereferenceable(152) %0, i64 %1) #3 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i1, align 1
  %4 = alloca %"struct.vl::database::IdObject", align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca %"class.vl::Ptr", align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %4, i32 0, i32 0
  store i64 %1, ptr %11, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  %12 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %13 = getelementptr inbounds %"class.vl::database::buffer_internal::FileMapping", ptr %12, i32 0, i32 4
  %14 = call noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryImNS_3PtrINS_8database14BufferPageDescEEEmPS4_E4KeysEv(ptr noundef nonnull align 8 dereferenceable(104) %13)
  %15 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %4, i32 0, i32 0
  %16 = call noundef i64 @_ZNK2vl11collections10SortedListImmE7IndexOfERKm(ptr noundef nonnull align 8 dereferenceable(33) %14, ptr noundef nonnull align 8 dereferenceable(8) %15)
  store i64 %16, ptr %6, align 8, !tbaa !9
  %17 = load i64, ptr %6, align 8, !tbaa !9
  %18 = icmp ne i64 %17, -1
  br i1 %18, label %19, label %96

19:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #5
  %20 = getelementptr inbounds %"class.vl::database::buffer_internal::FileMapping", ptr %12, i32 0, i32 4
  %21 = call noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryImNS_3PtrINS_8database14BufferPageDescEEEmPS4_E6ValuesEv(ptr noundef nonnull align 8 dereferenceable(104) %20)
  %22 = load i64, ptr %6, align 8, !tbaa !9
  %23 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK2vl11collections9ArrayBaseINS_3PtrINS_8database14BufferPageDescEEEEixEl(ptr noundef nonnull align 8 dereferenceable(24) %21, i64 noundef %22)
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull align 8 dereferenceable(32) %23)
  %24 = invoke noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %25 unwind label %49

25:                                               ; preds = %19
  %26 = getelementptr inbounds %"class.vl::database::BufferPageDesc", ptr %24, i32 0, i32 2
  %27 = load i8, ptr %26, align 8, !tbaa !11, !range !14, !noundef !15
  %28 = trunc i8 %27 to i1
  br i1 %28, label %91, label %29

29:                                               ; preds = %25
  %30 = invoke noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %31 unwind label %49

31:                                               ; preds = %29
  %32 = getelementptr inbounds %"class.vl::database::BufferPageDesc", ptr %30, i32 0, i32 5
  %33 = load i8, ptr %32, align 8, !tbaa !16, !range !14, !noundef !15
  %34 = trunc i8 %33 to i1
  br i1 %34, label %35, label %63

35:                                               ; preds = %31
  br label %36

36:                                               ; preds = %35
  %37 = invoke noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %38 unwind label %49

38:                                               ; preds = %36
  %39 = getelementptr inbounds %"class.vl::database::BufferPageDesc", ptr %37, i32 0, i32 0
  %40 = load ptr, ptr %39, align 8, !tbaa !17
  %41 = getelementptr inbounds %"class.vl::database::buffer_internal::FileMapping", ptr %12, i32 0, i32 1
  %42 = load i64, ptr %41, align 8, !tbaa !18
  %43 = invoke i32 @msync(ptr noundef %40, i64 noundef %42, i32 noundef 4)
          to label %44 unwind label %49

44:                                               ; preds = %38
  %45 = icmp ne i32 %43, -1
  br i1 %45, label %57, label %46

46:                                               ; preds = %44
  %47 = call ptr @__cxa_allocate_exception(i64 8) #5
  invoke void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8) %47, ptr noundef @.str.2)
          to label %48 unwind label %53

48:                                               ; preds = %46
  invoke void @__cxa_throw(ptr %47, ptr @_ZTIN2vl5ErrorE, ptr null) #6
          to label %104 unwind label %49

49:                                               ; preds = %82, %75, %64, %59, %48, %38, %36, %29, %19
  %50 = landingpad { ptr, i32 }
          cleanup
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %8, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %9, align 4
  br label %95

53:                                               ; preds = %46
  %54 = landingpad { ptr, i32 }
          cleanup
  %55 = extractvalue { ptr, i32 } %54, 0
  store ptr %55, ptr %8, align 8
  %56 = extractvalue { ptr, i32 } %54, 1
  store i32 %56, ptr %9, align 4
  call void @__cxa_free_exception(ptr %47) #5
  br label %95

57:                                               ; preds = %44
  br label %58

58:                                               ; preds = %57
  br label %59

59:                                               ; preds = %58
  %60 = invoke noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %61 unwind label %49

61:                                               ; preds = %59
  %62 = getelementptr inbounds %"class.vl::database::BufferPageDesc", ptr %60, i32 0, i32 5
  store i8 0, ptr %62, align 8, !tbaa !16
  br label %63

63:                                               ; preds = %61, %31
  br label %64

64:                                               ; preds = %63
  %65 = invoke noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %66 unwind label %49

66:                                               ; preds = %64
  %67 = getelementptr inbounds %"class.vl::database::BufferPageDesc", ptr %65, i32 0, i32 0
  %68 = load ptr, ptr %67, align 8, !tbaa !17
  %69 = getelementptr inbounds %"class.vl::database::buffer_internal::FileMapping", ptr %12, i32 0, i32 1
  %70 = load i64, ptr %69, align 8, !tbaa !18
  %71 = call i32 @munmap(ptr noundef %68, i64 noundef %70) #5
  %72 = icmp ne i32 %71, -1
  br i1 %72, label %80, label %73

73:                                               ; preds = %66
  %74 = call ptr @__cxa_allocate_exception(i64 8) #5
  invoke void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8) %74, ptr noundef @.str.3)
          to label %75 unwind label %76

75:                                               ; preds = %73
  invoke void @__cxa_throw(ptr %74, ptr @_ZTIN2vl5ErrorE, ptr null) #6
          to label %104 unwind label %49

76:                                               ; preds = %73
  %77 = landingpad { ptr, i32 }
          cleanup
  %78 = extractvalue { ptr, i32 } %77, 0
  store ptr %78, ptr %8, align 8
  %79 = extractvalue { ptr, i32 } %77, 1
  store i32 %79, ptr %9, align 4
  call void @__cxa_free_exception(ptr %74) #5
  br label %95

80:                                               ; preds = %66
  br label %81

81:                                               ; preds = %80
  br label %82

82:                                               ; preds = %81
  %83 = getelementptr inbounds %"class.vl::database::buffer_internal::FileMapping", ptr %12, i32 0, i32 4
  %84 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %4, i32 0, i32 0
  %85 = invoke noundef zeroext i1 @_ZN2vl11collections10DictionaryImNS_3PtrINS_8database14BufferPageDescEEEmPS4_E6RemoveERKm(ptr noundef nonnull align 8 dereferenceable(104) %83, ptr noundef nonnull align 8 dereferenceable(8) %84)
          to label %86 unwind label %49

86:                                               ; preds = %82
  %87 = getelementptr inbounds %"class.vl::database::buffer_internal::FileMapping", ptr %12, i32 0, i32 3
  %88 = load ptr, ptr %87, align 8, !tbaa !31
  %89 = atomicrmw sub ptr %88, i64 1 seq_cst, align 8
  %90 = sub i64 %89, 1
  store i1 true, ptr %3, align 1
  store i32 1, ptr %10, align 4
  br label %92

91:                                               ; preds = %25
  store i32 0, ptr %10, align 4
  br label %92

92:                                               ; preds = %91, %86
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #5
  %93 = load i32, ptr %10, align 4
  switch i32 %93, label %97 [
    i32 0, label %94
  ]

94:                                               ; preds = %92
  br label %96

95:                                               ; preds = %76, %53, %49
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %99

96:                                               ; preds = %94, %2
  store i1 false, ptr %3, align 1
  store i32 1, ptr %10, align 4
  br label %97

97:                                               ; preds = %96, %92
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %98 = load i1, ptr %3, align 1
  ret i1 %98

99:                                               ; preds = %95
  %100 = load ptr, ptr %8, align 8
  %101 = load i32, ptr %9, align 4
  %102 = insertvalue { ptr, i32 } poison, ptr %100, 0
  %103 = insertvalue { ptr, i32 } %102, i32 %101, 1
  resume { ptr, i32 } %103

104:                                              ; preds = %75, %48
  unreachable
}

declare i32 @msync(ptr noundef, i64 noundef, i32 noundef) #1

; Function Attrs: nounwind
declare i32 @munmap(ptr noundef, i64 noundef) #4

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { 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 }
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, !13, i64 16}
!12 = !{!"_ZTSN2vl8database14BufferPageDescE", !6, i64 0, !10, i64 8, !13, i64 16, !10, i64 24, !13, i64 32}
!13 = !{!"bool", !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!12, !13, i64 32}
!17 = !{!12, !6, i64 0}
!18 = !{!19, !10, i64 8}
!19 = !{!"_ZTSN2vl8database15buffer_internal11FileMappingE", !20, i64 0, !10, i64 8, !21, i64 16, !6, i64 24, !22, i64 32, !10, i64 144}
!20 = !{!"_ZTSN2vl6ObjectE"}
!21 = !{!"int", !7, i64 0}
!22 = !{!"_ZTSN2vl11collections10DictionaryImNS_3PtrINS_8database14BufferPageDescEEEmPS4_EE", !20, i64 0, !23, i64 8, !27, i64 56}
!23 = !{!"_ZTSN2vl11collections10SortedListImmEE", !24, i64 0}
!24 = !{!"_ZTSN2vl11collections8ListBaseImmEE", !25, i64 0, !10, i64 24, !13, i64 32}
!25 = !{!"_ZTSN2vl11collections9ArrayBaseImEE", !26, i64 0, !6, i64 8, !10, i64 16}
!26 = !{!"_ZTSN2vl11collections9ListStoreImLb1EEE", !20, i64 0}
!27 = !{!"_ZTSN2vl11collections4ListINS_3PtrINS_8database14BufferPageDescEEEPS4_EE", !28, i64 0}
!28 = !{!"_ZTSN2vl11collections8ListBaseINS_3PtrINS_8database14BufferPageDescEEEPS4_EE", !29, i64 0, !10, i64 24, !13, i64 32}
!29 = !{!"_ZTSN2vl11collections9ArrayBaseINS_3PtrINS_8database14BufferPageDescEEEEE", !30, i64 0, !6, i64 8, !10, i64 16}
!30 = !{!"_ZTSN2vl11collections9ListStoreINS_3PtrINS_8database14BufferPageDescEEELb0EEE", !20, i64 0}
!31 = !{!19, !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"

%"struct.vl::database::IdObject" = type { i64 }
%"class.vl::Ptr" = type { ptr, ptr, ptr, ptr }

@_ZTIN2vl5ErrorE = external dso_local constant { ptr, ptr }, align 8
@.str.2 = external hidden unnamed_addr constant [104 x i32], align 4
@.str.3 = external hidden unnamed_addr constant [105 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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

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

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 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 #2 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: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

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

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

8:                                                ; preds = %2
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #5
  %9 = call noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryImNS_3PtrINS_8database14BufferPageDescEEEmPS4_E6ValuesEv(ptr noundef nonnull align 8 dereferenceable(104) %5)
  %10 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK2vl11collections9ArrayBaseINS_3PtrINS_8database14BufferPageDescEEEEixEl(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %7)
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 8 dereferenceable(32) %10)
  %11 = call noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %4)
  %12 = getelementptr inbounds i8, ptr %11, i64 16
  %13 = load i8, ptr %12, align 8, !tbaa !5, !range !12, !noundef !13
  %14 = trunc nuw i8 %13 to i1
  br i1 %14, label %.critedge, label %15

15:                                               ; preds = %8
  %16 = call noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %4)
  %17 = getelementptr inbounds i8, ptr %16, i64 32
  %18 = load i8, ptr %17, align 8, !tbaa !14, !range !12, !noundef !13
  %19 = trunc nuw i8 %18 to i1
  br i1 %19, label %20, label %36

20:                                               ; preds = %15
  %21 = call noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %4)
  %22 = load ptr, ptr %21, align 8, !tbaa !15
  %23 = getelementptr inbounds i8, ptr %0, i64 8
  %24 = load i64, ptr %23, align 8, !tbaa !16
  %25 = invoke i32 @msync(ptr noundef %22, i64 noundef %24, i32 noundef 4)
          to label %26 unwind label %29

26:                                               ; preds = %20
  %.not10 = icmp eq i32 %25, -1
  br i1 %.not10, label %27, label %33

27:                                               ; preds = %26
  %28 = call ptr @__cxa_allocate_exception(i64 8) #5
  invoke void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8) %28, ptr noundef nonnull @.str.2)
          to label %.invoke unwind label %31

29:                                               ; preds = %.invoke, %47, %20
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %53

31:                                               ; preds = %27
  %32 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %28) #5
  br label %53

33:                                               ; preds = %26
  %34 = call noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %4)
  %35 = getelementptr inbounds i8, ptr %34, i64 32
  store i8 0, ptr %35, align 8, !tbaa !14
  br label %36

36:                                               ; preds = %15, %33
  %37 = call noundef ptr @_ZNK2vl3PtrINS_8database14BufferPageDescEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %4)
  %38 = load ptr, ptr %37, align 8, !tbaa !15
  %39 = getelementptr inbounds i8, ptr %0, i64 8
  %40 = load i64, ptr %39, align 8, !tbaa !16
  %41 = call i32 @munmap(ptr noundef %38, i64 noundef %40) #5
  %.not11 = icmp eq i32 %41, -1
  br i1 %.not11, label %42, label %47

42:                                               ; preds = %36
  %43 = call ptr @__cxa_allocate_exception(i64 8) #5
  invoke void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8) %43, ptr noundef nonnull @.str.3)
          to label %.invoke unwind label %45

.invoke:                                          ; preds = %27, %42
  %44 = phi ptr [ %43, %42 ], [ %28, %27 ]
  invoke void @__cxa_throw(ptr nonnull %44, ptr nonnull @_ZTIN2vl5ErrorE, ptr null) #6
          to label %.cont unwind label %29

.cont:                                            ; preds = %.invoke
  unreachable

45:                                               ; preds = %42
  %46 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %43) #5
  br label %53

47:                                               ; preds = %36
  %48 = invoke noundef zeroext i1 @_ZN2vl11collections10DictionaryImNS_3PtrINS_8database14BufferPageDescEEEmPS4_E6RemoveERKm(ptr noundef nonnull align 8 dereferenceable(104) %5, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %49 unwind label %29

49:                                               ; preds = %47
  %50 = getelementptr inbounds i8, ptr %0, i64 24
  %51 = load ptr, ptr %50, align 8, !tbaa !29
  %52 = atomicrmw sub ptr %51, i64 1 seq_cst, align 8
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  br label %54

53:                                               ; preds = %45, %31, %29
  %.pn = phi { ptr, i32 } [ %30, %29 ], [ %46, %45 ], [ %32, %31 ]
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  resume { ptr, i32 } %.pn

.critedge:                                        ; preds = %8
  call void @_ZN2vl3PtrINS_8database14BufferPageDescEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  br label %54

54:                                               ; preds = %2, %.critedge, %49
  %.1 = phi i1 [ true, %49 ], [ false, %.critedge ], [ false, %2 ]
  ret i1 %.1
}

declare i32 @msync(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #1

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { 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 }
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, !11, i64 16}
!6 = !{!"_ZTSN2vl8database14BufferPageDescE", !7, i64 0, !10, i64 8, !11, i64 16, !10, i64 24, !11, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{i8 0, i8 2}
!13 = !{}
!14 = !{!6, !11, i64 32}
!15 = !{!6, !7, i64 0}
!16 = !{!17, !10, i64 8}
!17 = !{!"_ZTSN2vl8database15buffer_internal11FileMappingE", !18, i64 0, !10, i64 8, !19, i64 16, !7, i64 24, !20, i64 32, !10, i64 144}
!18 = !{!"_ZTSN2vl6ObjectE"}
!19 = !{!"int", !8, i64 0}
!20 = !{!"_ZTSN2vl11collections10DictionaryImNS_3PtrINS_8database14BufferPageDescEEEmPS4_EE", !18, i64 0, !21, i64 8, !25, i64 56}
!21 = !{!"_ZTSN2vl11collections10SortedListImmEE", !22, i64 0}
!22 = !{!"_ZTSN2vl11collections8ListBaseImmEE", !23, i64 0, !10, i64 24, !11, i64 32}
!23 = !{!"_ZTSN2vl11collections9ArrayBaseImEE", !24, i64 0, !7, i64 8, !10, i64 16}
!24 = !{!"_ZTSN2vl11collections9ListStoreImLb1EEE", !18, i64 0}
!25 = !{!"_ZTSN2vl11collections4ListINS_3PtrINS_8database14BufferPageDescEEEPS4_EE", !26, i64 0}
!26 = !{!"_ZTSN2vl11collections8ListBaseINS_3PtrINS_8database14BufferPageDescEEEPS4_EE", !27, i64 0, !10, i64 24, !11, i64 32}
!27 = !{!"_ZTSN2vl11collections9ArrayBaseINS_3PtrINS_8database14BufferPageDescEEEEE", !28, i64 0, !7, i64 8, !10, i64 16}
!28 = !{!"_ZTSN2vl11collections9ListStoreINS_3PtrINS_8database14BufferPageDescEEELb0EEE", !18, i64 0}
!29 = !{!17, !7, i64 24}


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