; LLVM IR from weicao/cascadb :: src/serialize/layout.ll (ZN7cascadb6Layout10read_indexERNS_11BlockReaderE)

; 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.cascadb::ScopedMutex" = type { i8, ptr }
%"class.cascadb::Layout" = type { ptr, i64, %"class.cascadb::Options", %"class.cascadb::Mutex", i64, ptr, %"class.cascadb::Mutex", %"class.std::map", %"class.std::map", %"class.cascadb::Mutex", %"class.cascadb::Mutex", %"class.std::deque", %"class.std::deque", i64, i64 }
%"class.cascadb::Options" = type <{ ptr, ptr, i64, i64, i64, i64, i64, i64, i64, i32, i32, i32, i32, i32, i32, i32, i8, [3 x i8] }>
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<unsigned long, std::pair<const unsigned long, cascadb::BlockMeta *>, std::_Select1st<std::pair<const unsigned long, cascadb::BlockMeta *>>, std::less<unsigned long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<unsigned long, std::pair<const unsigned long, cascadb::BlockMeta *>, std::_Select1st<std::pair<const unsigned long, cascadb::BlockMeta *>>, std::less<unsigned long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.cascadb::Mutex" = type { i8, %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<cascadb::Layout::Hole, std::allocator<cascadb::Layout::Hole>>::_Deque_impl" }
%"struct.std::_Deque_base<cascadb::Layout::Hole, std::allocator<cascadb::Layout::Hole>>::_Deque_impl" = type { %"struct.std::_Deque_base<cascadb::Layout::Hole, std::allocator<cascadb::Layout::Hole>>::_Deque_impl_data" }
%"struct.std::_Deque_base<cascadb::Layout::Hole, std::allocator<cascadb::Layout::Hole>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@.str.1 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [25 x i8], align 1
@__PRETTY_FUNCTION__._ZN7cascadb6Layout10read_indexERNS_11BlockReaderE = external hidden unnamed_addr constant [48 x i8], align 1

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cascadb11ScopedMutexD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt3mapImPN7cascadb9BlockMetaESt4lessImESaISt4pairIKmS2_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48)) #5 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7cascadb6Layout10read_indexERNS_11BlockReaderE(ptr noundef nonnull align 8 dereferenceable(600) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"class.cascadb::ScopedMutex", align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %14 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #7
  %15 = getelementptr inbounds %"class.cascadb::Layout", ptr %14, i32 0, i32 6
  call void @_ZN7cascadb11ScopedMutexC2EPNS_5MutexE(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef %15)
  %16 = getelementptr inbounds %"class.cascadb::Layout", ptr %14, i32 0, i32 7
  %17 = call noundef i64 @_ZNKSt3mapImPN7cascadb9BlockMetaESt4lessImESaISt4pairIKmS2_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %16) #7
  %18 = icmp eq i64 %17, 0
  br i1 %18, label %19, label %20

19:                                               ; preds = %2
  br label %22

20:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.54, ptr noundef @.str.1, i32 noundef 558, ptr noundef @__PRETTY_FUNCTION__._ZN7cascadb6Layout10read_indexERNS_11BlockReaderE) #8
  unreachable

21:                                               ; No predecessors!
  br label %22

22:                                               ; preds = %21, %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = invoke noundef zeroext i1 @_ZN7cascadb11BlockReader10readUInt32EPj(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef %7)
          to label %25 unwind label %27

25:                                               ; preds = %22
  br i1 %24, label %31, label %26

26:                                               ; preds = %25
  store i1 false, ptr %3, align 1
  store i32 1, ptr %10, align 4
  br label %70

27:                                               ; preds = %22
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %8, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %9, align 4
  br label %72

31:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %32

32:                                               ; preds = %64, %31
  %33 = load i32, ptr %11, align 4, !tbaa !9
  %34 = load i32, ptr %7, align 4, !tbaa !9
  %35 = icmp ult i32 %33, %34
  br i1 %35, label %37, label %36

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

37:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %38 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 24) #9
          to label %39 unwind label %53

39:                                               ; preds = %37
  call void @llvm.memset.p0.i64(ptr align 16 %38, i8 0, i64 24, i1 false)
  store ptr %38, ptr %13, align 8, !tbaa !5
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = invoke noundef zeroext i1 @_ZN7cascadb11BlockReader10readUInt64EPm(ptr noundef nonnull align 8 dereferenceable(16) %40, ptr noundef %12)
          to label %42 unwind label %53

42:                                               ; preds = %39
  br i1 %41, label %43, label %57

43:                                               ; preds = %42
  %44 = load ptr, ptr %13, align 8, !tbaa !5
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = invoke noundef zeroext i1 @_ZN7cascadb6Layout15read_block_metaEPNS_9BlockMetaERNS_11BlockReaderE(ptr noundef nonnull align 8 dereferenceable(600) %14, ptr noundef %44, ptr noundef nonnull align 8 dereferenceable(16) %45)
          to label %47 unwind label %53

47:                                               ; preds = %43
  br i1 %46, label %48, label %57

48:                                               ; preds = %47
  %49 = load ptr, ptr %13, align 8, !tbaa !5
  %50 = getelementptr inbounds %"class.cascadb::Layout", ptr %14, i32 0, i32 7
  %51 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapImPN7cascadb9BlockMetaESt4lessImESaISt4pairIKmS2_EEEixERS6_(ptr noundef nonnull align 8 dereferenceable(48) %50, ptr noundef nonnull align 8 dereferenceable(8) %12)
          to label %52 unwind label %53

52:                                               ; preds = %48
  store ptr %49, ptr %51, align 8, !tbaa !5
  store i32 4, ptr %10, align 4
  br label %62

53:                                               ; preds = %48, %43, %39, %37
  %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 @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %72

57:                                               ; preds = %47, %42
  %58 = load ptr, ptr %13, align 8, !tbaa !5
  %59 = icmp eq ptr %58, null
  br i1 %59, label %61, label %60

60:                                               ; preds = %57
  call void @_ZdlPvm(ptr noundef %58, i64 noundef 24) #10
  br label %61

61:                                               ; preds = %60, %57
  store i1 false, ptr %3, align 1
  store i32 1, ptr %10, align 4
  br label %62

62:                                               ; preds = %61, %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  %63 = load i32, ptr %10, align 4
  switch i32 %63, label %67 [
    i32 4, label %64
  ]

64:                                               ; preds = %62
  %65 = load i32, ptr %11, align 4, !tbaa !9
  %66 = add i32 %65, 1
  store i32 %66, ptr %11, align 4, !tbaa !9
  br label %32, !llvm.loop !11

67:                                               ; preds = %62, %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  %68 = load i32, ptr %10, align 4
  switch i32 %68, label %70 [
    i32 2, label %69
  ]

69:                                               ; preds = %67
  store i1 true, ptr %3, align 1
  store i32 1, ptr %10, align 4
  br label %70

70:                                               ; preds = %69, %67, %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @_ZN7cascadb11ScopedMutexD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #7
  %71 = load i1, ptr %3, align 1
  ret i1 %71

72:                                               ; preds = %53, %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @_ZN7cascadb11ScopedMutexD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #7
  br label %73

73:                                               ; preds = %72
  %74 = load ptr, ptr %8, align 8
  %75 = load i32, ptr %9, align 4
  %76 = insertvalue { ptr, i32 } poison, ptr %74, 0
  %77 = insertvalue { ptr, i32 } %76, i32 %75, 1
  resume { ptr, i32 } %77
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapImPN7cascadb9BlockMetaESt4lessImESaISt4pairIKmS2_EEEixERS6_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7cascadb11BlockReader10readUInt64EPm(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7cascadb6Layout15read_block_metaEPNS_9BlockMetaERNS_11BlockReaderE(ptr noundef nonnull align 8 dereferenceable(600), ptr noundef, ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7cascadb11BlockReader10readUInt32EPj(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) #4 align 2

attributes #0 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nobuiltin 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 = { noreturn 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }
attributes #8 = { noreturn nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin 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 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; 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.cascadb::ScopedMutex" = type { i8, ptr }

@.str.1 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [25 x i8], align 1
@__PRETTY_FUNCTION__._ZN7cascadb6Layout10read_indexERNS_11BlockReaderE = external hidden unnamed_addr constant [48 x i8], align 1

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cascadb11ScopedMutexD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt3mapImPN7cascadb9BlockMetaESt4lessImESaISt4pairIKmS2_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7cascadb6Layout10read_indexERNS_11BlockReaderE(ptr noundef nonnull align 8 dereferenceable(600) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.cascadb::ScopedMutex", align 8
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #7
  %6 = getelementptr inbounds i8, ptr %0, i64 184
  call void @_ZN7cascadb11ScopedMutexC2EPNS_5MutexE(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull %6)
  %7 = getelementptr inbounds i8, ptr %0, i64 232
  %8 = call noundef i64 @_ZNKSt3mapImPN7cascadb9BlockMetaESt4lessImESaISt4pairIKmS2_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %7) #7
  %9 = icmp eq i64 %8, 0
  br i1 %9, label %11, label %10

10:                                               ; preds = %2
  call void @__assert_fail(ptr noundef nonnull @.str.54, ptr noundef nonnull @.str.1, i32 noundef 558, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7cascadb6Layout10read_indexERNS_11BlockReaderE) #8
  unreachable

11:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %12 = invoke noundef zeroext i1 @_ZN7cascadb11BlockReader10readUInt32EPj(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull %4)
          to label %13 unwind label %15

13:                                               ; preds = %11
  br i1 %12, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %13
  %14 = load i32, ptr %4, align 4, !tbaa !5
  %.not22 = icmp eq i32 %14, 0
  br i1 %.not22, label %.loopexit, label %.lr.ph

15:                                               ; preds = %11
  %16 = landingpad { ptr, i32 }
          cleanup
  br label %31

.lr.ph:                                           ; preds = %.preheader, %.critedge
  %.01423 = phi i32 [ %26, %.critedge ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %17 = invoke noalias noundef nonnull dereferenceable(24) ptr @_Znwm(i64 noundef 24) #9
          to label %18 unwind label %28

18:                                               ; preds = %.lr.ph
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(24) %17, i8 0, i64 24, i1 false)
  %19 = invoke noundef zeroext i1 @_ZN7cascadb11BlockReader10readUInt64EPm(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull %5)
          to label %20 unwind label %28

20:                                               ; preds = %18
  br i1 %19, label %21, label %30

21:                                               ; preds = %20
  %22 = invoke noundef zeroext i1 @_ZN7cascadb6Layout15read_block_metaEPNS_9BlockMetaERNS_11BlockReaderE(ptr noundef nonnull align 8 dereferenceable(600) %0, ptr noundef nonnull %17, ptr noundef nonnull align 8 dereferenceable(16) %1)
          to label %23 unwind label %28

23:                                               ; preds = %21
  br i1 %22, label %24, label %30

24:                                               ; preds = %23
  %25 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapImPN7cascadb9BlockMetaESt4lessImESaISt4pairIKmS2_EEEixERS6_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %.critedge unwind label %28

.critedge:                                        ; preds = %24
  store ptr %17, ptr %25, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  %26 = add nuw i32 %.01423, 1
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %.not.not = icmp ult i32 %26, %27
  br i1 %.not.not, label %.lr.ph, label %.loopexit, !llvm.loop !11

28:                                               ; preds = %24, %21, %18, %.lr.ph
  %29 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br label %31

30:                                               ; preds = %20, %23
  call void @_ZdlPvm(ptr noundef nonnull %17, i64 noundef 24) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br label %.loopexit

.loopexit:                                        ; preds = %.critedge, %.preheader, %30, %13
  %.3 = phi i1 [ false, %13 ], [ false, %30 ], [ true, %.preheader ], [ true, %.critedge ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @_ZN7cascadb11ScopedMutexD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  ret i1 %.3

31:                                               ; preds = %28, %15
  %.pn = phi { ptr, i32 } [ %29, %28 ], [ %16, %15 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @_ZN7cascadb11ScopedMutexD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapImPN7cascadb9BlockMetaESt4lessImESaISt4pairIKmS2_EEEixERS6_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7cascadb11BlockReader10readUInt64EPm(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7cascadb6Layout15read_block_metaEPNS_9BlockMetaERNS_11BlockReaderE(ptr noundef nonnull align 8 dereferenceable(600), ptr noundef, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7cascadb11BlockReader10readUInt32EPj(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) local_unnamed_addr #4 align 2

attributes #0 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nobuiltin 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 = { noreturn 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }
attributes #8 = { noreturn nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: ConstraintEliminationPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass