; LLVM IR from rahulyesantharao/b-epsilon-tree :: src/be_tree/be_tree.ll (ZN6BeNode12FlushOneLeafERS_RjS1_)

; 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.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.std::allocator" = type { i8 }
%class.BeNode = type { %class.Serializable, ptr, i32, ptr, ptr, ptr, ptr, ptr }
%class.Serializable = type { ptr }
%struct.BeBuffer = type { i32, i32, [247 x %struct.BeUpsert] }
%struct.BeUpsert = type { i32, i32, i32, i32 }

@.str.11 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [89 x i8], align 1
@__PRETTY_FUNCTION__._ZN6BeNode12FlushOneLeafERS_RjS1_ = external hidden unnamed_addr constant [67 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [25 x i8], align 1
@_ZL20LEAF_FLUSH_THRESHOLD = external hidden constant i32, align 4
@.str.31 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10DebugPrintNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES4_(ptr noundef, ptr noundef) #0

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN6BeNode9SplitLeafERj(ptr noundef nonnull align 8 dereferenceable(64), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6BeNode5SetIdEj(ptr noundef nonnull align 8 dereferenceable(64), i32 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN6BeNode12FlushOneLeafERS_RjS1_(ptr noundef nonnull align 8 dereferenceable(64) %0, ptr noundef nonnull align 8 dereferenceable(64) %1, ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3) #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"class.std::__cxx11::basic_string", align 8
  %13 = alloca %"class.std::allocator", align 1
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca %"class.std::__cxx11::basic_string", align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  %19 = load ptr, ptr %6, align 8
  call void @_ZN6BeNode4OpenEv(ptr noundef nonnull align 8 dereferenceable(64) %19)
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN6BeNode4OpenEv(ptr noundef nonnull align 8 dereferenceable(64) %20)
  %21 = getelementptr inbounds %class.BeNode, ptr %19, i32 0, i32 4
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  %23 = load i32, ptr %22, align 4, !tbaa !13
  %24 = icmp ne i32 %23, 0
  %25 = xor i1 %24, true
  br i1 %25, label %26, label %27

26:                                               ; preds = %4
  br label %29

27:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.12, i32 noundef 346, ptr noundef @__PRETTY_FUNCTION__._ZN6BeNode12FlushOneLeafERS_RjS1_) #5
  unreachable

28:                                               ; No predecessors!
  br label %29

29:                                               ; preds = %28, %26
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = getelementptr inbounds %class.BeNode, ptr %30, i32 0, i32 4
  %32 = load ptr, ptr %31, align 8, !tbaa !9
  %33 = load i32, ptr %32, align 4, !tbaa !13
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %36

35:                                               ; preds = %29
  br label %38

36:                                               ; preds = %29
  call void @__assert_fail(ptr noundef @.str.29, ptr noundef @.str.12, i32 noundef 347, ptr noundef @__PRETTY_FUNCTION__._ZN6BeNode12FlushOneLeafERS_RjS1_) #5
  unreachable

37:                                               ; No predecessors!
  br label %38

38:                                               ; preds = %37, %35
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = getelementptr inbounds %class.BeNode, ptr %39, i32 0, i32 3
  %41 = load ptr, ptr %40, align 8, !tbaa !14
  %42 = load i32, ptr %41, align 4, !tbaa !13
  %43 = getelementptr inbounds %class.BeNode, ptr %19, i32 0, i32 2
  %44 = load i32, ptr %43, align 8, !tbaa !15
  %45 = icmp eq i32 %42, %44
  br i1 %45, label %46, label %47

46:                                               ; preds = %38
  br label %49

47:                                               ; preds = %38
  call void @__assert_fail(ptr noundef @.str.30, ptr noundef @.str.12, i32 noundef 348, ptr noundef @__PRETTY_FUNCTION__._ZN6BeNode12FlushOneLeafERS_RjS1_) #5
  unreachable

48:                                               ; No predecessors!
  br label %49

49:                                               ; preds = %48, %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %50 = getelementptr inbounds %class.BeNode, ptr %19, i32 0, i32 5
  %51 = load ptr, ptr %50, align 8, !tbaa !16
  %52 = getelementptr inbounds %struct.BeBuffer, ptr %51, i32 0, i32 2
  %53 = getelementptr inbounds [247 x %struct.BeUpsert], ptr %52, i64 0, i64 0
  %54 = getelementptr inbounds %class.BeNode, ptr %19, i32 0, i32 5
  %55 = load ptr, ptr %54, align 8, !tbaa !16
  %56 = getelementptr inbounds %struct.BeBuffer, ptr %55, i32 0, i32 0
  %57 = load i32, ptr %56, align 4, !tbaa !17
  %58 = getelementptr inbounds %class.BeNode, ptr %19, i32 0, i32 5
  %59 = load ptr, ptr %58, align 8, !tbaa !16
  %60 = getelementptr inbounds %struct.BeBuffer, ptr %59, i32 0, i32 1
  %61 = load i32, ptr %60, align 4, !tbaa !19
  %62 = sub i32 %57, %61
  %63 = zext i32 %62 to i64
  %64 = getelementptr inbounds %struct.BeUpsert, ptr %53, i64 %63
  store ptr %64, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %65 = getelementptr inbounds %class.BeNode, ptr %19, i32 0, i32 5
  %66 = load ptr, ptr %65, align 8, !tbaa !16
  %67 = getelementptr inbounds %struct.BeBuffer, ptr %66, i32 0, i32 1
  %68 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %67, ptr noundef nonnull align 4 dereferenceable(4) @_ZL20LEAF_FLUSH_THRESHOLD)
  %69 = load i32, ptr %68, align 4, !tbaa !13
  store i32 %69, ptr %11, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef @.str.31, ptr noundef nonnull align 1 dereferenceable(1) %13)
          to label %70 unwind label %93

70:                                               ; preds = %49
  %71 = load i32, ptr %11, align 4, !tbaa !13
  call void @_ZNSt7__cxx119to_stringEi(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %16, i32 noundef %71) #6
  invoke void @_Z10DebugPrintNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES4_(ptr noundef %12, ptr noundef %16)
          to label %72 unwind label %97

72:                                               ; preds = %70
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %16) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #6
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  %75 = call noundef zeroext i1 @_ZN6BeNode10UpsertLeafEP8BeUpsertRi(ptr noundef nonnull align 8 dereferenceable(64) %73, ptr noundef %74, ptr noundef nonnull align 4 dereferenceable(4) %11)
  br i1 %75, label %76, label %119

76:                                               ; preds = %72
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = load ptr, ptr %9, align 8, !tbaa !5
  %79 = call noundef i32 @_ZN6BeNode9SplitLeafERj(ptr noundef nonnull align 8 dereferenceable(64) %77, ptr noundef nonnull align 4 dereferenceable(4) %78)
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 %79, ptr %80, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.BeUpsert, ptr %81, i64 0
  %83 = getelementptr inbounds %struct.BeUpsert, ptr %82, i32 0, i32 0
  %84 = load i32, ptr %83, align 4, !tbaa !20
  store i32 %84, ptr %17, align 4, !tbaa !13
  %85 = load i32, ptr %17, align 4, !tbaa !13
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  %87 = load i32, ptr %86, align 4, !tbaa !13
  %88 = icmp uge i32 %85, %87
  br i1 %88, label %89, label %102

89:                                               ; preds = %76
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = load ptr, ptr %9, align 8, !tbaa !5
  %92 = load i32, ptr %91, align 4, !tbaa !13
  call void @_ZN6BeNode5SetIdEj(ptr noundef nonnull align 8 dereferenceable(64) %90, i32 noundef %92)
  br label %102

93:                                               ; preds = %49
  %94 = landingpad { ptr, i32 }
          cleanup
  %95 = extractvalue { ptr, i32 } %94, 0
  store ptr %95, ptr %14, align 8
  %96 = extractvalue { ptr, i32 } %94, 1
  store i32 %96, ptr %15, align 4
  br label %101

97:                                               ; preds = %70
  %98 = landingpad { ptr, i32 }
          cleanup
  %99 = extractvalue { ptr, i32 } %98, 0
  store ptr %99, ptr %14, align 8
  %100 = extractvalue { ptr, i32 } %98, 1
  store i32 %100, ptr %15, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %16) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #6
  br label %101

101:                                              ; preds = %97, %93
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %135

102:                                              ; preds = %89, %76
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = load ptr, ptr %10, align 8, !tbaa !5
  %105 = call noundef zeroext i1 @_ZN6BeNode10UpsertLeafEP8BeUpsertRi(ptr noundef nonnull align 8 dereferenceable(64) %103, ptr noundef %104, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %106 = getelementptr inbounds %class.BeNode, ptr %19, i32 0, i32 5
  %107 = load ptr, ptr %106, align 8, !tbaa !16
  %108 = getelementptr inbounds %struct.BeBuffer, ptr %107, i32 0, i32 1
  %109 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %108, ptr noundef nonnull align 4 dereferenceable(4) @_ZL20LEAF_FLUSH_THRESHOLD)
  %110 = load i32, ptr %109, align 4, !tbaa !13
  %111 = getelementptr inbounds %class.BeNode, ptr %19, i32 0, i32 5
  %112 = load ptr, ptr %111, align 8, !tbaa !16
  %113 = getelementptr inbounds %struct.BeBuffer, ptr %112, i32 0, i32 0
  %114 = load i32, ptr %113, align 4, !tbaa !17
  %115 = sub i32 %114, %110
  store i32 %115, ptr %113, align 4, !tbaa !17
  %116 = getelementptr inbounds %class.BeNode, ptr %19, i32 0, i32 5
  %117 = load ptr, ptr %116, align 8, !tbaa !16
  %118 = getelementptr inbounds %struct.BeBuffer, ptr %117, i32 0, i32 1
  store i32 0, ptr %118, align 4, !tbaa !19
  store i32 0, ptr %5, align 4
  store i32 1, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %133

119:                                              ; preds = %72
  %120 = getelementptr inbounds %class.BeNode, ptr %19, i32 0, i32 5
  %121 = load ptr, ptr %120, align 8, !tbaa !16
  %122 = getelementptr inbounds %struct.BeBuffer, ptr %121, i32 0, i32 1
  %123 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %122, ptr noundef nonnull align 4 dereferenceable(4) @_ZL20LEAF_FLUSH_THRESHOLD)
  %124 = load i32, ptr %123, align 4, !tbaa !13
  %125 = getelementptr inbounds %class.BeNode, ptr %19, i32 0, i32 5
  %126 = load ptr, ptr %125, align 8, !tbaa !16
  %127 = getelementptr inbounds %struct.BeBuffer, ptr %126, i32 0, i32 0
  %128 = load i32, ptr %127, align 4, !tbaa !17
  %129 = sub i32 %128, %124
  store i32 %129, ptr %127, align 4, !tbaa !17
  %130 = getelementptr inbounds %class.BeNode, ptr %19, i32 0, i32 5
  %131 = load ptr, ptr %130, align 8, !tbaa !16
  %132 = getelementptr inbounds %struct.BeBuffer, ptr %131, i32 0, i32 1
  store i32 0, ptr %132, align 4, !tbaa !19
  store i32 1, ptr %5, align 4
  store i32 1, ptr %18, align 4
  br label %133

133:                                              ; preds = %119, %102
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  %134 = load i32, ptr %5, align 4
  ret i32 %134

135:                                              ; preds = %101
  %136 = load ptr, ptr %14, align 8
  %137 = load i32, ptr %15, align 4
  %138 = insertvalue { ptr, i32 } poison, ptr %136, 0
  %139 = insertvalue { ptr, i32 } %138, i32 %137, 1
  resume { ptr, i32 } %139
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt7__cxx119to_stringEi(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, i32 noundef) #4

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { inlinehint 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 = { 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 32}
!10 = !{!"_ZTS6BeNode", !11, i64 0, !6, i64 8, !12, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!11 = !{!"_ZTS12Serializable"}
!12 = !{!"int", !7, i64 0}
!13 = !{!12, !12, i64 0}
!14 = !{!10, !6, i64 24}
!15 = !{!10, !12, i64 16}
!16 = !{!10, !6, i64 40}
!17 = !{!18, !12, i64 0}
!18 = !{!"_ZTS8BeBuffer", !12, i64 0, !12, i64 4, !7, i64 8}
!19 = !{!18, !12, i64 4}
!20 = !{!21, !12, i64 0}
!21 = !{!"_ZTS8BeUpsert", !12, i64 0, !22, i64 4, !12, i64 8, !12, i64 12}
!22 = !{!"_ZTS14UpsertFunction", !7, 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.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.std::allocator" = type { i8 }
%struct.BeUpsert = type { i32, i32, i32, i32 }

@.str.11 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [89 x i8], align 1
@__PRETTY_FUNCTION__._ZN6BeNode12FlushOneLeafERS_RjS1_ = external hidden unnamed_addr constant [67 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [25 x i8], align 1
@_ZL20LEAF_FLUSH_THRESHOLD = external hidden constant i32, align 4
@.str.31 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10DebugPrintNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES4_(ptr noundef, ptr noundef) local_unnamed_addr #0

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN6BeNode9SplitLeafERj(ptr noundef nonnull align 8 dereferenceable(64), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6BeNode5SetIdEj(ptr noundef nonnull align 8 dereferenceable(64), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_ZN6BeNode12FlushOneLeafERS_RjS1_(ptr noundef nonnull align 8 dereferenceable(64) %0, ptr noundef nonnull align 8 dereferenceable(64) %1, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca i32, align 4
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  %7 = alloca %"class.std::allocator", align 1
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  tail call void @_ZN6BeNode4OpenEv(ptr noundef nonnull align 8 dereferenceable(64) %0)
  tail call void @_ZN6BeNode4OpenEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  %11 = load i32, ptr %10, align 4, !tbaa !12
  %.not = icmp eq i32 %11, 0
  br i1 %.not, label %13, label %12

12:                                               ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.12, i32 noundef 346, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6BeNode12FlushOneLeafERS_RjS1_) #5
  unreachable

13:                                               ; preds = %4
  %14 = getelementptr inbounds i8, ptr %1, i64 32
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  %16 = load i32, ptr %15, align 4, !tbaa !12
  %.not20 = icmp eq i32 %16, 0
  br i1 %.not20, label %17, label %18

17:                                               ; preds = %13
  tail call void @__assert_fail(ptr noundef nonnull @.str.29, ptr noundef nonnull @.str.12, i32 noundef 347, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6BeNode12FlushOneLeafERS_RjS1_) #5
  unreachable

18:                                               ; preds = %13
  %19 = getelementptr inbounds i8, ptr %1, i64 24
  %20 = load ptr, ptr %19, align 8, !tbaa !13
  %21 = load i32, ptr %20, align 4, !tbaa !12
  %22 = getelementptr inbounds i8, ptr %0, i64 16
  %23 = load i32, ptr %22, align 8, !tbaa !14
  %24 = icmp eq i32 %21, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %18
  tail call void @__assert_fail(ptr noundef nonnull @.str.30, ptr noundef nonnull @.str.12, i32 noundef 348, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6BeNode12FlushOneLeafERS_RjS1_) #5
  unreachable

26:                                               ; preds = %18
  %27 = getelementptr inbounds i8, ptr %0, i64 40
  %28 = load ptr, ptr %27, align 8, !tbaa !15
  %29 = getelementptr inbounds i8, ptr %28, i64 8
  %30 = load i32, ptr %28, align 4, !tbaa !16
  %31 = getelementptr inbounds i8, ptr %28, i64 4
  %32 = load i32, ptr %31, align 4, !tbaa !18
  %33 = sub i32 %30, %32
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds %struct.BeUpsert, ptr %29, i64 %34
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %36 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %31, ptr noundef nonnull align 4 dereferenceable(4) @_ZL20LEAF_FLUSH_THRESHOLD)
  %37 = load i32, ptr %36, align 4, !tbaa !12
  store i32 %37, ptr %5, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %7) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull @.str.31, ptr noundef nonnull align 1 dereferenceable(1) %7)
          to label %38 unwind label %46

38:                                               ; preds = %26
  call void @_ZNSt7__cxx119to_stringEi(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %8, i32 noundef %37) #6
  invoke void @_Z10DebugPrintNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES4_(ptr noundef nonnull %6, ptr noundef nonnull %8)
          to label %39 unwind label %48

39:                                               ; preds = %38
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #6
  %40 = call noundef zeroext i1 @_ZN6BeNode10UpsertLeafEP8BeUpsertRi(ptr noundef nonnull align 8 dereferenceable(64) %1, ptr noundef nonnull %35, ptr noundef nonnull align 4 dereferenceable(4) %5)
  br i1 %40, label %41, label %53

41:                                               ; preds = %39
  %42 = call noundef i32 @_ZN6BeNode9SplitLeafERj(ptr noundef nonnull align 8 dereferenceable(64) %1, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i32 %42, ptr %2, align 4, !tbaa !12
  %43 = load i32, ptr %35, align 4, !tbaa !19
  %.not22 = icmp ult i32 %43, %42
  br i1 %.not22, label %51, label %44

44:                                               ; preds = %41
  %45 = load i32, ptr %3, align 4, !tbaa !12
  call void @_ZN6BeNode5SetIdEj(ptr noundef nonnull align 8 dereferenceable(64) %1, i32 noundef %45)
  br label %51

46:                                               ; preds = %26
  %47 = landingpad { ptr, i32 }
          cleanup
  br label %50

48:                                               ; preds = %38
  %49 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  br label %50

50:                                               ; preds = %48, %46
  %.pn = phi { ptr, i32 } [ %49, %48 ], [ %47, %46 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  resume { ptr, i32 } %.pn

51:                                               ; preds = %44, %41
  %52 = call noundef zeroext i1 @_ZN6BeNode10UpsertLeafEP8BeUpsertRi(ptr noundef nonnull align 8 dereferenceable(64) %1, ptr noundef nonnull %35, ptr noundef nonnull align 4 dereferenceable(4) %5)
  br label %53

53:                                               ; preds = %39, %51
  %.0 = phi i32 [ 0, %51 ], [ 1, %39 ]
  %54 = load ptr, ptr %27, align 8, !tbaa !15
  %55 = getelementptr inbounds i8, ptr %54, i64 4
  %56 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %55, ptr noundef nonnull align 4 dereferenceable(4) @_ZL20LEAF_FLUSH_THRESHOLD)
  %57 = load i32, ptr %56, align 4, !tbaa !12
  %58 = load ptr, ptr %27, align 8, !tbaa !15
  %59 = load i32, ptr %58, align 4, !tbaa !16
  %60 = sub i32 %59, %57
  store i32 %60, ptr %58, align 4, !tbaa !16
  %61 = getelementptr inbounds i8, ptr %58, i64 4
  store i32 0, ptr %61, align 4, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  ret i32 %.0
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt7__cxx119to_stringEi(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, i32 noundef) local_unnamed_addr #4

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { inlinehint 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 = { 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, !8, i64 32}
!6 = !{!"_ZTS6BeNode", !7, i64 0, !8, i64 8, !11, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48, !8, i64 56}
!7 = !{!"_ZTS12Serializable"}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!6, !8, i64 24}
!14 = !{!6, !11, i64 16}
!15 = !{!6, !8, i64 40}
!16 = !{!17, !11, i64 0}
!17 = !{!"_ZTS8BeBuffer", !11, i64 0, !11, i64 4, !9, i64 8}
!18 = !{!17, !11, i64 4}
!19 = !{!20, !11, i64 0}
!20 = !{!"_ZTS8BeUpsert", !11, i64 0, !21, i64 4, !11, i64 8, !11, i64 12}
!21 = !{!"_ZTS14UpsertFunction", !9, i64 0}


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