; LLVM IR from weicao/cascadb :: src/tree/node.ll (ZN7cascadb9InnerNode4findENS_5SliceERS1_PS0_)

; 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::FastVector<cascadb::Msg>::Iterator" = type { ptr, i64, i64 }
%"class.cascadb::Slice" = type <{ ptr, i32, [4 x i8] }>
%"class.cascadb::Msg" = type { i32, [4 x i8], %"class.cascadb::Slice", %"class.cascadb::Slice" }
%"class.cascadb::DataNode" = type <{ %"class.cascadb::Node", ptr, i32, [4 x i8] }>
%"class.cascadb::Node" = type { ptr, %"class.std::__cxx11::basic_string", i64, %"class.cascadb::Mutex", i8, i8, i8, %struct.timeval, %struct.timeval, i32, i32, %"class.cascadb::RWLock" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"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 }
%struct.timeval = type { i64, i64 }
%"class.cascadb::RWLock" = type { %union.pthread_rwlock_t }
%union.pthread_rwlock_t = type { %struct.__pthread_rwlock_arch_t }
%struct.__pthread_rwlock_arch_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i8, [7 x i8], i64, i32 }

@.str.1 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [9 x i8], align 1
@__PRETTY_FUNCTION__._ZN7cascadb9InnerNode4findENS_5SliceERS1_PS0_ = external hidden unnamed_addr constant [67 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7cascadb9InnerNode10find_pivotENS_5SliceE(ptr noundef nonnull align 8 dereferenceable(312), ptr, i32) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7cascadb6MsgBuf3endEv(ptr dead_on_unwind noalias writable sret(%"class.cascadb::FastVector<cascadb::Msg>::Iterator") align 8, ptr noundef nonnull align 8 dereferenceable(104)) #2 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7cascadb9InnerNode6msgbufEiRNS_5SliceE(ptr noundef nonnull align 8 dereferenceable(312), i32 noundef, ptr noundef nonnull align 8 dereferenceable(12)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN7cascadb9InnerNode5childEi(ptr noundef nonnull align 8 dereferenceable(312), i32 noundef) #4 align 2

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

declare noundef ptr @_ZN7cascadb4Tree9load_nodeEmb(ptr noundef nonnull align 8 dereferenceable(184), i64 noundef, i1 noundef zeroext) #5

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i32 } @_ZNK7cascadb5Slice5cloneEv(ptr noundef nonnull align 8 dereferenceable(12)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7cascadb9InnerNode4findENS_5SliceERS1_PS0_(ptr noundef nonnull align 8 dereferenceable(312) %0, ptr %1, i32 %2, ptr noundef nonnull align 8 dereferenceable(12) %3, ptr noundef %4) unnamed_addr #2 align 2 {
  %6 = alloca i1, align 1
  %7 = alloca %"class.cascadb::Slice", align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i8, align 1
  %12 = alloca i32, align 4
  %13 = alloca %"class.cascadb::Slice", align 8
  %14 = alloca ptr, align 8
  %15 = alloca %"class.cascadb::FastVector<cascadb::Msg>::Iterator", align 8
  %16 = alloca %"class.cascadb::Slice", align 8
  %17 = alloca %"class.cascadb::FastVector<cascadb::Msg>::Iterator", align 8
  %18 = alloca %"class.cascadb::Slice", align 8
  %19 = alloca { ptr, i32 }, align 8
  %20 = alloca i32, align 4
  %21 = alloca i64, align 8
  %22 = alloca ptr, align 8
  %23 = alloca %"class.cascadb::Slice", align 8
  %24 = getelementptr inbounds { ptr, i32 }, ptr %7, i32 0, i32 0
  store ptr %1, ptr %24, align 8
  %25 = getelementptr inbounds { ptr, i32 }, ptr %7, i32 0, i32 1
  store i32 %2, ptr %25, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  %26 = load ptr, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #7
  store i8 0, ptr %11, align 1, !tbaa !9
  call void @_ZN7cascadb4Node9read_lockEv(ptr noundef nonnull align 8 dereferenceable(200) %26)
  %27 = load ptr, ptr %10, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %31

29:                                               ; preds = %5
  %30 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN7cascadb4Node6unlockEv(ptr noundef nonnull align 8 dereferenceable(200) %30)
  br label %31

31:                                               ; preds = %29, %5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %13, ptr align 8 %7, i64 16, i1 false), !tbaa.struct !11
  %32 = getelementptr inbounds { ptr, i32 }, ptr %13, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8
  %34 = getelementptr inbounds { ptr, i32 }, ptr %13, i32 0, i32 1
  %35 = load i32, ptr %34, align 8
  %36 = call noundef i32 @_ZN7cascadb9InnerNode10find_pivotENS_5SliceE(ptr noundef nonnull align 8 dereferenceable(312) %26, ptr %33, i32 %35)
  store i32 %36, ptr %12, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %37 = load i32, ptr %12, align 4, !tbaa !12
  %38 = call noundef ptr @_ZN7cascadb9InnerNode6msgbufEiRNS_5SliceE(ptr noundef nonnull align 8 dereferenceable(312) %26, i32 noundef %37, ptr noundef nonnull align 8 dereferenceable(12) %7)
  store ptr %38, ptr %14, align 8, !tbaa !5
  %39 = load ptr, ptr %14, align 8, !tbaa !5
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %75

41:                                               ; preds = %31
  %42 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN7cascadb6MsgBuf9read_lockEv(ptr noundef nonnull align 8 dereferenceable(104) %42)
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #7
  %43 = load ptr, ptr %14, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %16, ptr align 8 %7, i64 16, i1 false), !tbaa.struct !11
  %44 = getelementptr inbounds { ptr, i32 }, ptr %16, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8
  %46 = getelementptr inbounds { ptr, i32 }, ptr %16, i32 0, i32 1
  %47 = load i32, ptr %46, align 8
  call void @_ZN7cascadb6MsgBuf4findENS_5SliceE(ptr dead_on_unwind writable sret(%"class.cascadb::FastVector<cascadb::Msg>::Iterator") align 8 %15, ptr noundef nonnull align 8 dereferenceable(104) %43, ptr %45, i32 %47)
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #7
  %48 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN7cascadb6MsgBuf3endEv(ptr dead_on_unwind writable sret(%"class.cascadb::FastVector<cascadb::Msg>::Iterator") align 8 %17, ptr noundef nonnull align 8 dereferenceable(104) %48)
  %49 = call noundef zeroext i1 @_ZNK7cascadb10FastVectorINS_3MsgELi32EE8IteratorneERKS3_(ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 8 dereferenceable(24) %17)
  br i1 %49, label %50, label %54

50:                                               ; preds = %41
  %51 = call noundef ptr @_ZN7cascadb10FastVectorINS_3MsgELi32EE8IteratorptEv(ptr noundef nonnull align 8 dereferenceable(24) %15)
  %52 = getelementptr inbounds %"class.cascadb::Msg", ptr %51, i32 0, i32 2
  %53 = call noundef zeroext i1 @_ZN7cascadbeqERKNS_5SliceES2_(ptr noundef nonnull align 8 dereferenceable(12) %52, ptr noundef nonnull align 8 dereferenceable(12) %7)
  br label %54

54:                                               ; preds = %50, %41
  %55 = phi i1 [ false, %41 ], [ %53, %50 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #7
  br i1 %55, label %56, label %70

56:                                               ; preds = %54
  %57 = call noundef ptr @_ZN7cascadb10FastVectorINS_3MsgELi32EE8IteratorptEv(ptr noundef nonnull align 8 dereferenceable(24) %15)
  %58 = getelementptr inbounds %"class.cascadb::Msg", ptr %57, i32 0, i32 0
  %59 = load i32, ptr %58, align 8, !tbaa !14
  %60 = icmp eq i32 %59, 1
  br i1 %60, label %61, label %66

61:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #7
  %62 = call noundef ptr @_ZN7cascadb10FastVectorINS_3MsgELi32EE8IteratorptEv(ptr noundef nonnull align 8 dereferenceable(24) %15)
  %63 = getelementptr inbounds %"class.cascadb::Msg", ptr %62, i32 0, i32 3
  %64 = call { ptr, i32 } @_ZNK7cascadb5Slice5cloneEv(ptr noundef nonnull align 8 dereferenceable(12) %63)
  store { ptr, i32 } %64, ptr %19, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %18, ptr align 8 %19, i64 12, i1 false)
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %65, ptr align 8 %18, i64 12, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #7
  store i8 1, ptr %11, align 1, !tbaa !9
  br label %66

66:                                               ; preds = %61, %56
  %67 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN7cascadb6MsgBuf6unlockEv(ptr noundef nonnull align 8 dereferenceable(104) %67)
  call void @_ZN7cascadb4Node6unlockEv(ptr noundef nonnull align 8 dereferenceable(200) %26)
  %68 = load i8, ptr %11, align 1, !tbaa !9, !range !18, !noundef !19
  %69 = trunc i8 %68 to i1
  store i1 %69, ptr %6, align 1
  store i32 1, ptr %20, align 4
  br label %72

70:                                               ; preds = %54
  %71 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN7cascadb6MsgBuf6unlockEv(ptr noundef nonnull align 8 dereferenceable(104) %71)
  store i32 0, ptr %20, align 4
  br label %72

72:                                               ; preds = %70, %66
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #7
  %73 = load i32, ptr %20, align 4
  switch i32 %73, label %113 [
    i32 0, label %74
  ]

74:                                               ; preds = %72
  br label %75

75:                                               ; preds = %74, %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %76 = load i32, ptr %12, align 4, !tbaa !12
  %77 = call noundef i64 @_ZN7cascadb9InnerNode5childEi(ptr noundef nonnull align 8 dereferenceable(312) %26, i32 noundef %76)
  store i64 %77, ptr %21, align 8, !tbaa !20
  %78 = load i64, ptr %21, align 8, !tbaa !20
  %79 = icmp eq i64 %78, 0
  br i1 %79, label %80, label %87

80:                                               ; preds = %75
  %81 = load i32, ptr %12, align 4, !tbaa !12
  %82 = icmp eq i32 %81, 0
  br i1 %82, label %83, label %84

83:                                               ; preds = %80
  br label %86

84:                                               ; preds = %80
  call void @__assert_fail(ptr noundef @.str.17, ptr noundef @.str.1, i32 noundef 554, ptr noundef @__PRETTY_FUNCTION__._ZN7cascadb9InnerNode4findENS_5SliceERS1_PS0_) #8
  unreachable

85:                                               ; No predecessors!
  br label %86

86:                                               ; preds = %85, %83
  call void @_ZN7cascadb4Node6unlockEv(ptr noundef nonnull align 8 dereferenceable(200) %26)
  store i1 false, ptr %6, align 1
  store i32 1, ptr %20, align 4
  br label %112

87:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %88 = getelementptr inbounds %"class.cascadb::DataNode", ptr %26, i32 0, i32 1
  %89 = load ptr, ptr %88, align 8, !tbaa !22
  %90 = load i64, ptr %21, align 8, !tbaa !20
  %91 = call noundef ptr @_ZN7cascadb4Tree9load_nodeEmb(ptr noundef nonnull align 8 dereferenceable(184) %89, i64 noundef %90, i1 noundef zeroext true)
  store ptr %91, ptr %22, align 8, !tbaa !5
  %92 = load ptr, ptr %22, align 8, !tbaa !5
  %93 = icmp ne ptr %92, null
  br i1 %93, label %94, label %95

94:                                               ; preds = %87
  br label %97

95:                                               ; preds = %87
  call void @__assert_fail(ptr noundef @.str.18, ptr noundef @.str.1, i32 noundef 561, ptr noundef @__PRETTY_FUNCTION__._ZN7cascadb9InnerNode4findENS_5SliceERS1_PS0_) #8
  unreachable

96:                                               ; No predecessors!
  br label %97

97:                                               ; preds = %96, %94
  %98 = load ptr, ptr %22, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %23, ptr align 8 %7, i64 16, i1 false), !tbaa.struct !11
  %99 = load ptr, ptr %9, align 8, !tbaa !5
  %100 = getelementptr inbounds { ptr, i32 }, ptr %23, i32 0, i32 0
  %101 = load ptr, ptr %100, align 8
  %102 = getelementptr inbounds { ptr, i32 }, ptr %23, i32 0, i32 1
  %103 = load i32, ptr %102, align 8
  %104 = load ptr, ptr %98, align 8, !tbaa !31
  %105 = getelementptr inbounds ptr, ptr %104, i64 7
  %106 = load ptr, ptr %105, align 8
  %107 = call noundef zeroext i1 %106(ptr noundef nonnull align 8 dereferenceable(212) %98, ptr %101, i32 %103, ptr noundef nonnull align 8 dereferenceable(12) %99, ptr noundef %26)
  %108 = zext i1 %107 to i8
  store i8 %108, ptr %11, align 1, !tbaa !9
  %109 = load ptr, ptr %22, align 8, !tbaa !5
  call void @_ZN7cascadb4Node7dec_refEv(ptr noundef nonnull align 8 dereferenceable(200) %109)
  %110 = load i8, ptr %11, align 1, !tbaa !9, !range !18, !noundef !19
  %111 = trunc i8 %110 to i1
  store i1 %111, ptr %6, align 1
  store i32 1, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  br label %112

112:                                              ; preds = %97, %86
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  br label %113

113:                                              ; preds = %112, %72
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #7
  %114 = load i1, ptr %6, align 1
  ret i1 %114
}

declare void @_ZN7cascadb6MsgBuf4findENS_5SliceE(ptr dead_on_unwind writable sret(%"class.cascadb::FastVector<cascadb::Msg>::Iterator") align 8, ptr noundef nonnull align 8 dereferenceable(104), ptr, i32) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7cascadbeqERKNS_5SliceES2_(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef nonnull align 8 dereferenceable(12)) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = { inlinehint 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 #7 = { nounwind }
attributes #8 = { noreturn nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i64 0, i64 8, !5, i64 8, i64 4, !12}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !16, i64 0}
!15 = !{!"_ZTSN7cascadb3MsgE", !16, i64 0, !17, i64 8, !17, i64 24}
!16 = !{!"_ZTSN7cascadb7MsgTypeE", !7, i64 0}
!17 = !{!"_ZTSN7cascadb5SliceE", !6, i64 0, !13, i64 8}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!21, !21, i64 0}
!21 = !{!"long", !7, i64 0}
!22 = !{!23, !6, i64 200}
!23 = !{!"_ZTSN7cascadb8DataNodeE", !24, i64 0, !6, i64 200, !30, i64 208}
!24 = !{!"_ZTSN7cascadb4NodeE", !25, i64 8, !21, i64 40, !27, i64 48, !10, i64 96, !10, i64 97, !10, i64 98, !28, i64 104, !28, i64 120, !13, i64 136, !13, i64 140, !29, i64 144}
!25 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !26, i64 0, !21, i64 8, !7, i64 16}
!26 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!27 = !{!"_ZTSN7cascadb5MutexE", !10, i64 0, !7, i64 8}
!28 = !{!"_ZTS7timeval", !21, i64 0, !21, i64 8}
!29 = !{!"_ZTSN7cascadb6RWLockE", !7, i64 0}
!30 = !{!"_ZTSN7cascadb10NodeStatusE", !7, i64 0}
!31 = !{!32, !32, i64 0}
!32 = !{!"vtable pointer", !8, i64 0}


; 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::FastVector<cascadb::Msg>::Iterator" = type { ptr, i64, i64 }
%"class.cascadb::Slice" = type <{ ptr, i32, [4 x i8] }>

@.str.1 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [9 x i8], align 1
@__PRETTY_FUNCTION__._ZN7cascadb9InnerNode4findENS_5SliceERS1_PS0_ = external hidden unnamed_addr constant [67 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7cascadb9InnerNode10find_pivotENS_5SliceE(ptr noundef nonnull align 8 dereferenceable(312), ptr, i32) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7cascadb6MsgBuf3endEv(ptr dead_on_unwind noalias writable sret(%"class.cascadb::FastVector<cascadb::Msg>::Iterator") align 8, ptr noundef nonnull align 8 dereferenceable(104)) local_unnamed_addr #2 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7cascadb9InnerNode6msgbufEiRNS_5SliceE(ptr noundef nonnull align 8 dereferenceable(312), i32 noundef, ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN7cascadb9InnerNode5childEi(ptr noundef nonnull align 8 dereferenceable(312), i32 noundef) local_unnamed_addr #3 align 2

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

declare noundef ptr @_ZN7cascadb4Tree9load_nodeEmb(ptr noundef nonnull align 8 dereferenceable(184), i64 noundef, i1 noundef zeroext) local_unnamed_addr #4

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i32 } @_ZNK7cascadb5Slice5cloneEv(ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7cascadb9InnerNode4findENS_5SliceERS1_PS0_(ptr noundef nonnull align 8 dereferenceable(312) %0, ptr %1, i32 %2, ptr noundef nonnull align 8 dereferenceable(12) %3, ptr noundef %4) unnamed_addr #2 align 2 {
  %6 = alloca %"class.cascadb::Slice", align 8
  %7 = alloca %"class.cascadb::FastVector<cascadb::Msg>::Iterator", align 8
  %8 = alloca %"class.cascadb::FastVector<cascadb::Msg>::Iterator", align 8
  store ptr %1, ptr %6, align 8
  %9 = getelementptr inbounds i8, ptr %6, i64 8
  store i32 %2, ptr %9, align 8
  tail call void @_ZN7cascadb4Node9read_lockEv(ptr noundef nonnull align 8 dereferenceable(200) %0)
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %11, label %10

10:                                               ; preds = %5
  tail call void @_ZN7cascadb4Node6unlockEv(ptr noundef nonnull align 8 dereferenceable(200) %4)
  br label %11

11:                                               ; preds = %10, %5
  %12 = tail call noundef i32 @_ZN7cascadb9InnerNode10find_pivotENS_5SliceE(ptr noundef nonnull align 8 dereferenceable(312) %0, ptr %1, i32 %2)
  %13 = call noundef ptr @_ZN7cascadb9InnerNode6msgbufEiRNS_5SliceE(ptr noundef nonnull align 8 dereferenceable(312) %0, i32 noundef %12, ptr noundef nonnull align 8 dereferenceable(12) %6)
  %.not37 = icmp eq ptr %13, null
  br i1 %.not37, label %29, label %14

14:                                               ; preds = %11
  call void @_ZN7cascadb6MsgBuf9read_lockEv(ptr noundef nonnull align 8 dereferenceable(104) %13)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #6
  %.sroa.08.0.copyload = load ptr, ptr %6, align 8, !tbaa !5
  %.sroa.29.0.copyload = load i32, ptr %9, align 8, !tbaa !9
  call void @_ZN7cascadb6MsgBuf4findENS_5SliceE(ptr dead_on_unwind nonnull writable sret(%"class.cascadb::FastVector<cascadb::Msg>::Iterator") align 8 %7, ptr noundef nonnull align 8 dereferenceable(104) %13, ptr %.sroa.08.0.copyload, i32 %.sroa.29.0.copyload)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #6
  call void @_ZN7cascadb6MsgBuf3endEv(ptr dead_on_unwind nonnull writable sret(%"class.cascadb::FastVector<cascadb::Msg>::Iterator") align 8 %8, ptr noundef nonnull align 8 dereferenceable(104) %13)
  %15 = call noundef zeroext i1 @_ZNK7cascadb10FastVectorINS_3MsgELi32EE8IteratorneERKS3_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(24) %8)
  br i1 %15, label %16, label %.critedge

16:                                               ; preds = %14
  %17 = call noundef ptr @_ZN7cascadb10FastVectorINS_3MsgELi32EE8IteratorptEv(ptr noundef nonnull align 8 dereferenceable(24) %7)
  %18 = getelementptr inbounds i8, ptr %17, i64 8
  %19 = call noundef zeroext i1 @_ZN7cascadbeqERKNS_5SliceES2_(ptr noundef nonnull align 8 dereferenceable(12) %18, ptr noundef nonnull align 8 dereferenceable(12) %6)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #6
  br i1 %19, label %20, label %.thread

20:                                               ; preds = %16
  %21 = call noundef ptr @_ZN7cascadb10FastVectorINS_3MsgELi32EE8IteratorptEv(ptr noundef nonnull align 8 dereferenceable(24) %7)
  %22 = load i32, ptr %21, align 8, !tbaa !11
  %23 = icmp eq i32 %22, 1
  br i1 %23, label %24, label %28

24:                                               ; preds = %20
  %25 = call noundef ptr @_ZN7cascadb10FastVectorINS_3MsgELi32EE8IteratorptEv(ptr noundef nonnull align 8 dereferenceable(24) %7)
  %26 = getelementptr inbounds i8, ptr %25, i64 24
  %27 = call { ptr, i32 } @_ZNK7cascadb5Slice5cloneEv(ptr noundef nonnull align 8 dereferenceable(12) %26)
  %.fca.0.extract = extractvalue { ptr, i32 } %27, 0
  %.fca.1.extract = extractvalue { ptr, i32 } %27, 1
  store ptr %.fca.0.extract, ptr %3, align 8, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  store i32 %.fca.1.extract, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !9
  br label %28

.critedge:                                        ; preds = %14
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #6
  br label %.thread

.thread:                                          ; preds = %16, %.critedge
  call void @_ZN7cascadb6MsgBuf6unlockEv(ptr noundef nonnull align 8 dereferenceable(104) %13)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  br label %29

28:                                               ; preds = %20, %24
  call void @_ZN7cascadb6MsgBuf6unlockEv(ptr noundef nonnull align 8 dereferenceable(104) %13)
  call void @_ZN7cascadb4Node6unlockEv(ptr noundef nonnull align 8 dereferenceable(200) %0)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  br label %46

29:                                               ; preds = %.thread, %11
  %30 = call noundef i64 @_ZN7cascadb9InnerNode5childEi(ptr noundef nonnull align 8 dereferenceable(312) %0, i32 noundef %12)
  %31 = icmp eq i64 %30, 0
  br i1 %31, label %32, label %36

32:                                               ; preds = %29
  %33 = icmp eq i32 %12, 0
  br i1 %33, label %35, label %34

34:                                               ; preds = %32
  call void @__assert_fail(ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.1, i32 noundef 554, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7cascadb9InnerNode4findENS_5SliceERS1_PS0_) #7
  unreachable

35:                                               ; preds = %32
  call void @_ZN7cascadb4Node6unlockEv(ptr noundef nonnull align 8 dereferenceable(200) %0)
  br label %46

36:                                               ; preds = %29
  %37 = getelementptr inbounds i8, ptr %0, i64 200
  %38 = load ptr, ptr %37, align 8, !tbaa !15
  %39 = call noundef ptr @_ZN7cascadb4Tree9load_nodeEmb(ptr noundef nonnull align 8 dereferenceable(184) %38, i64 noundef %30, i1 noundef zeroext true)
  %.not38 = icmp eq ptr %39, null
  br i1 %.not38, label %40, label %41

40:                                               ; preds = %36
  call void @__assert_fail(ptr noundef nonnull @.str.18, ptr noundef nonnull @.str.1, i32 noundef 561, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7cascadb9InnerNode4findENS_5SliceERS1_PS0_) #7
  unreachable

41:                                               ; preds = %36
  %.sroa.0.0.copyload = load ptr, ptr %6, align 8, !tbaa !5
  %.sroa.2.0.copyload = load i32, ptr %9, align 8, !tbaa !9
  %42 = load ptr, ptr %39, align 8, !tbaa !26
  %43 = getelementptr inbounds i8, ptr %42, i64 56
  %44 = load ptr, ptr %43, align 8
  %45 = call noundef zeroext i1 %44(ptr noundef nonnull align 8 dereferenceable(212) %39, ptr %.sroa.0.0.copyload, i32 %.sroa.2.0.copyload, ptr noundef nonnull align 8 dereferenceable(12) %3, ptr noundef nonnull %0)
  call void @_ZN7cascadb4Node7dec_refEv(ptr noundef nonnull align 8 dereferenceable(200) %39)
  br label %46

46:                                               ; preds = %28, %35, %41
  %.2 = phi i1 [ %23, %28 ], [ false, %35 ], [ %45, %41 ]
  ret i1 %.2
}

declare void @_ZN7cascadb6MsgBuf4findENS_5SliceE(ptr dead_on_unwind writable sret(%"class.cascadb::FastVector<cascadb::Msg>::Iterator") align 8, ptr noundef nonnull align 8 dereferenceable(104), ptr, i32) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7cascadbeqERKNS_5SliceES2_(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "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 = { inlinehint 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 #6 = { nounwind }
attributes #7 = { noreturn 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 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN7cascadb3MsgE", !13, i64 0, !14, i64 8, !14, i64 24}
!13 = !{!"_ZTSN7cascadb7MsgTypeE", !7, i64 0}
!14 = !{!"_ZTSN7cascadb5SliceE", !6, i64 0, !10, i64 8}
!15 = !{!16, !6, i64 200}
!16 = !{!"_ZTSN7cascadb8DataNodeE", !17, i64 0, !6, i64 200, !25, i64 208}
!17 = !{!"_ZTSN7cascadb4NodeE", !18, i64 8, !20, i64 40, !21, i64 48, !22, i64 96, !22, i64 97, !22, i64 98, !23, i64 104, !23, i64 120, !10, i64 136, !10, i64 140, !24, i64 144}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !19, i64 0, !20, i64 8, !7, i64 16}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = !{!"_ZTSN7cascadb5MutexE", !22, i64 0, !7, i64 8}
!22 = !{!"bool", !7, i64 0}
!23 = !{!"_ZTS7timeval", !20, i64 0, !20, i64 8}
!24 = !{!"_ZTSN7cascadb6RWLockE", !7, i64 0}
!25 = !{!"_ZTSN7cascadb10NodeStatusE", !7, i64 0}
!26 = !{!27, !27, i64 0}
!27 = !{!"vtable pointer", !8, i64 0}


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