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

; 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::InnerNode" = type { %"class.cascadb::DataNode.base", i8, i64, ptr, %"class.cascadb::Slice", i32, i32, i32, i16, %"class.std::vector", i64, i64, i64 }
%"class.cascadb::DataNode.base" = type <{ %"class.cascadb::Node", ptr, i32 }>
%"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 }
%"class.cascadb::Slice" = type <{ ptr, i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<cascadb::Pivot, std::allocator<cascadb::Pivot>>::_Vector_impl" }
%"struct.std::_Vector_base<cascadb::Pivot, std::allocator<cascadb::Pivot>>::_Vector_impl" = type { %"struct.std::_Vector_base<cascadb::Pivot, std::allocator<cascadb::Pivot>>::_Vector_impl_data" }
%"struct.std::_Vector_base<cascadb::Pivot, std::allocator<cascadb::Pivot>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.cascadb::DataNode" = type <{ %"class.cascadb::Node", ptr, i32, [4 x i8] }>
%"class.cascadb::Tree" = type { %"class.std::__cxx11::basic_string", %"class.cascadb::Options", ptr, ptr, ptr, ptr, ptr, ptr }
%"class.cascadb::Options" = type <{ ptr, ptr, i64, i64, i64, i64, i64, i64, i64, i32, i32, i32, i32, i32, i32, i32, i8, [3 x i8] }>

@.str = external hidden unnamed_addr constant [22 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [66 x i8], align 1
@__PRETTY_FUNCTION__._ZN7cascadb9InnerNode15init_empty_rootEv = external hidden unnamed_addr constant [43 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7cascadb9InnerNode15init_empty_rootEv(ptr noundef nonnull align 8 dereferenceable(312) %0) #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  %6 = getelementptr inbounds %"class.cascadb::InnerNode", ptr %5, i32 0, i32 3
  %7 = load ptr, ptr %6, align 8, !tbaa !9
  %8 = icmp eq ptr %7, null
  br i1 %8, label %9, label %10

9:                                                ; preds = %1
  br label %12

10:                                               ; preds = %1
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 74, ptr noundef @__PRETTY_FUNCTION__._ZN7cascadb9InnerNode15init_empty_rootEv) #5
  unreachable

11:                                               ; No predecessors!
  br label %12

12:                                               ; preds = %11, %9
  %13 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 104) #6
  %14 = getelementptr inbounds %"class.cascadb::DataNode", ptr %5, i32 0, i32 1
  %15 = load ptr, ptr %14, align 8, !tbaa !28
  %16 = getelementptr inbounds %"class.cascadb::Tree", ptr %15, i32 0, i32 1
  %17 = getelementptr inbounds %"class.cascadb::Options", ptr %16, i32 0, i32 1
  %18 = load ptr, ptr %17, align 8, !tbaa !29
  invoke void @_ZN7cascadb6MsgBufC2EPNS_10ComparatorE(ptr noundef nonnull align 8 dereferenceable(104) %13, ptr noundef %18)
          to label %19 unwind label %26

19:                                               ; preds = %12
  %20 = getelementptr inbounds %"class.cascadb::InnerNode", ptr %5, i32 0, i32 3
  store ptr %13, ptr %20, align 8, !tbaa !9
  %21 = getelementptr inbounds %"class.cascadb::InnerNode", ptr %5, i32 0, i32 3
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  %23 = call noundef i64 @_ZNK7cascadb6MsgBuf4sizeEv(ptr noundef nonnull align 8 dereferenceable(104) %22)
  %24 = getelementptr inbounds %"class.cascadb::InnerNode", ptr %5, i32 0, i32 12
  store i64 %23, ptr %24, align 8, !tbaa !33
  %25 = getelementptr inbounds %"class.cascadb::InnerNode", ptr %5, i32 0, i32 1
  store i8 1, ptr %25, align 4, !tbaa !34
  call void @_ZN7cascadb4Node9set_dirtyEb(ptr noundef nonnull align 8 dereferenceable(200) %5, i1 noundef zeroext true)
  ret void

26:                                               ; preds = %12
  %27 = landingpad { ptr, i32 }
          cleanup
  %28 = extractvalue { ptr, i32 } %27, 0
  store ptr %28, ptr %3, align 8
  %29 = extractvalue { ptr, i32 } %27, 1
  store i32 %29, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %13, i64 noundef 104) #7
  br label %30

30:                                               ; preds = %26
  %31 = load ptr, ptr %3, align 8
  %32 = load i32, ptr %4, align 4
  %33 = insertvalue { ptr, i32 } poison, ptr %31, 0
  %34 = insertvalue { ptr, i32 } %33, i32 %32, 1
  resume { ptr, i32 } %34
}

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7cascadb4Node9set_dirtyEb(ptr noundef nonnull align 8 dereferenceable(200), i1 noundef zeroext) #1 align 2

attributes #0 = { 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 #1 = { 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 #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 = { 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 #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 = { noreturn nounwind }
attributes #6 = { builtin allocsize(0) }
attributes #7 = { 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, !6, i64 224}
!10 = !{!"_ZTSN7cascadb9InnerNodeE", !11, i64 0, !17, i64 212, !15, i64 216, !6, i64 224, !22, i64 232, !19, i64 248, !19, i64 252, !19, i64 256, !23, i64 260, !24, i64 264, !15, i64 288, !15, i64 296, !15, i64 304}
!11 = !{!"_ZTSN7cascadb8DataNodeE", !12, i64 0, !6, i64 200, !21, i64 208}
!12 = !{!"_ZTSN7cascadb4NodeE", !13, i64 8, !15, i64 40, !16, i64 48, !17, i64 96, !17, i64 97, !17, i64 98, !18, i64 104, !18, i64 120, !19, i64 136, !19, i64 140, !20, i64 144}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !14, i64 0, !15, i64 8, !7, i64 16}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!"_ZTSN7cascadb5MutexE", !17, i64 0, !7, i64 8}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"_ZTS7timeval", !15, i64 0, !15, i64 8}
!19 = !{!"int", !7, i64 0}
!20 = !{!"_ZTSN7cascadb6RWLockE", !7, i64 0}
!21 = !{!"_ZTSN7cascadb10NodeStatusE", !7, i64 0}
!22 = !{!"_ZTSN7cascadb5SliceE", !6, i64 0, !19, i64 8}
!23 = !{!"short", !7, i64 0}
!24 = !{!"_ZTSSt6vectorIN7cascadb5PivotESaIS1_EE", !25, i64 0}
!25 = !{!"_ZTSSt12_Vector_baseIN7cascadb5PivotESaIS1_EE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIN7cascadb5PivotESaIS1_EE12_Vector_implE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIN7cascadb5PivotESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!28 = !{!11, !6, i64 200}
!29 = !{!30, !6, i64 40}
!30 = !{!"_ZTSN7cascadb4TreeE", !13, i64 0, !31, i64 32, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176}
!31 = !{!"_ZTSN7cascadb7OptionsE", !6, i64 0, !6, i64 8, !15, i64 16, !15, i64 24, !15, i64 32, !15, i64 40, !15, i64 48, !15, i64 56, !15, i64 64, !19, i64 72, !19, i64 76, !19, i64 80, !19, i64 84, !19, i64 88, !19, i64 92, !32, i64 96, !17, i64 100}
!32 = !{!"_ZTSN7cascadb8CompressE", !7, i64 0}
!33 = !{!10, !15, i64 304}
!34 = !{!10, !17, i64 212}


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

@.str = external hidden unnamed_addr constant [22 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [66 x i8], align 1
@__PRETTY_FUNCTION__._ZN7cascadb9InnerNode15init_empty_rootEv = external hidden unnamed_addr constant [43 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7cascadb9InnerNode15init_empty_rootEv(ptr noundef nonnull align 8 dereferenceable(312) %0) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 224
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = icmp eq ptr %3, null
  br i1 %4, label %6, label %5

5:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 74, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7cascadb9InnerNode15init_empty_rootEv) #5
  unreachable

6:                                                ; preds = %1
  %7 = tail call noalias noundef nonnull dereferenceable(104) ptr @_Znwm(i64 noundef 104) #6
  %8 = getelementptr inbounds i8, ptr %0, i64 200
  %9 = load ptr, ptr %8, align 8, !tbaa !27
  %10 = getelementptr inbounds i8, ptr %9, i64 40
  %11 = load ptr, ptr %10, align 8, !tbaa !28
  invoke void @_ZN7cascadb6MsgBufC2EPNS_10ComparatorE(ptr noundef nonnull align 8 dereferenceable(104) %7, ptr noundef %11)
          to label %12 unwind label %16

12:                                               ; preds = %6
  store ptr %7, ptr %2, align 8, !tbaa !5
  %13 = tail call noundef i64 @_ZNK7cascadb6MsgBuf4sizeEv(ptr noundef nonnull align 8 dereferenceable(104) %7)
  %14 = getelementptr inbounds i8, ptr %0, i64 304
  store i64 %13, ptr %14, align 8, !tbaa !32
  %15 = getelementptr inbounds i8, ptr %0, i64 212
  store i8 1, ptr %15, align 4, !tbaa !33
  tail call void @_ZN7cascadb4Node9set_dirtyEb(ptr noundef nonnull align 8 dereferenceable(200) %0, i1 noundef zeroext true)
  ret void

16:                                               ; preds = %6
  %17 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %7, i64 noundef 104) #7
  resume { ptr, i32 } %17
}

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7cascadb4Node9set_dirtyEb(ptr noundef nonnull align 8 dereferenceable(200), i1 noundef zeroext) local_unnamed_addr #1 align 2

attributes #0 = { 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 #1 = { 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 #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 = { 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 #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 = { noreturn nounwind }
attributes #6 = { builtin allocsize(0) }
attributes #7 = { 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, !11, i64 224}
!6 = !{!"_ZTSN7cascadb9InnerNodeE", !7, i64 0, !16, i64 212, !14, i64 216, !11, i64 224, !21, i64 232, !18, i64 248, !18, i64 252, !18, i64 256, !22, i64 260, !23, i64 264, !14, i64 288, !14, i64 296, !14, i64 304}
!7 = !{!"_ZTSN7cascadb8DataNodeE", !8, i64 0, !11, i64 200, !20, i64 208}
!8 = !{!"_ZTSN7cascadb4NodeE", !9, i64 8, !14, i64 40, !15, i64 48, !16, i64 96, !16, i64 97, !16, i64 98, !17, i64 104, !17, i64 120, !18, i64 136, !18, i64 140, !19, i64 144}
!9 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !10, i64 0, !14, i64 8, !12, i64 16}
!10 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !11, i64 0}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"long", !12, i64 0}
!15 = !{!"_ZTSN7cascadb5MutexE", !16, i64 0, !12, i64 8}
!16 = !{!"bool", !12, i64 0}
!17 = !{!"_ZTS7timeval", !14, i64 0, !14, i64 8}
!18 = !{!"int", !12, i64 0}
!19 = !{!"_ZTSN7cascadb6RWLockE", !12, i64 0}
!20 = !{!"_ZTSN7cascadb10NodeStatusE", !12, i64 0}
!21 = !{!"_ZTSN7cascadb5SliceE", !11, i64 0, !18, i64 8}
!22 = !{!"short", !12, i64 0}
!23 = !{!"_ZTSSt6vectorIN7cascadb5PivotESaIS1_EE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseIN7cascadb5PivotESaIS1_EE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIN7cascadb5PivotESaIS1_EE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIN7cascadb5PivotESaIS1_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!27 = !{!7, !11, i64 200}
!28 = !{!29, !11, i64 40}
!29 = !{!"_ZTSN7cascadb4TreeE", !9, i64 0, !30, i64 32, !11, i64 136, !11, i64 144, !11, i64 152, !11, i64 160, !11, i64 168, !11, i64 176}
!30 = !{!"_ZTSN7cascadb7OptionsE", !11, i64 0, !11, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !14, i64 40, !14, i64 48, !14, i64 56, !14, i64 64, !18, i64 72, !18, i64 76, !18, i64 80, !18, i64 84, !18, i64 88, !18, i64 92, !31, i64 96, !16, i64 100}
!31 = !{!"_ZTSN7cascadb8CompressE", !12, i64 0}
!32 = !{!6, !14, i64 304}
!33 = !{!6, !16, i64 212}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass