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

; 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
@.str.30 = external hidden unnamed_addr constant [25 x i8], align 1
@__PRETTY_FUNCTION__._ZN6BeNode16FlushOneInternalERS_ = external hidden unnamed_addr constant [47 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [20 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 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: 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) #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) #5

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

21:                                               ; preds = %2
  br label %24

22:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.12, i32 noundef 384, ptr noundef @__PRETTY_FUNCTION__._ZN6BeNode16FlushOneInternalERS_) #6
  unreachable

23:                                               ; No predecessors!
  br label %24

24:                                               ; preds = %23, %21
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %class.BeNode, ptr %25, i32 0, i32 4
  %27 = load ptr, ptr %26, align 8, !tbaa !9
  %28 = load i32, ptr %27, align 4, !tbaa !13
  %29 = icmp ne i32 %28, 0
  %30 = xor i1 %29, true
  br i1 %30, label %31, label %32

31:                                               ; preds = %24
  br label %34

32:                                               ; preds = %24
  call void @__assert_fail(ptr noundef @.str.32, ptr noundef @.str.12, i32 noundef 385, ptr noundef @__PRETTY_FUNCTION__._ZN6BeNode16FlushOneInternalERS_) #6
  unreachable

33:                                               ; No predecessors!
  br label %34

34:                                               ; preds = %33, %31
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %class.BeNode, ptr %35, i32 0, i32 3
  %37 = load ptr, ptr %36, align 8, !tbaa !14
  %38 = load i32, ptr %37, align 4, !tbaa !13
  %39 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 2
  %40 = load i32, ptr %39, align 8, !tbaa !15
  %41 = icmp eq i32 %38, %40
  br i1 %41, label %42, label %43

42:                                               ; preds = %34
  br label %45

43:                                               ; preds = %34
  call void @__assert_fail(ptr noundef @.str.30, ptr noundef @.str.12, i32 noundef 386, ptr noundef @__PRETTY_FUNCTION__._ZN6BeNode16FlushOneInternalERS_) #6
  unreachable

44:                                               ; No predecessors!
  br label %45

45:                                               ; preds = %44, %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %class.BeNode, ptr %46, i32 0, i32 5
  %48 = load ptr, ptr %47, align 8, !tbaa !16
  %49 = getelementptr inbounds %struct.BeBuffer, ptr %48, i32 0, i32 0
  %50 = load i32, ptr %49, align 4, !tbaa !17
  %51 = sub i32 247, %50
  store i32 %51, ptr %6, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %52 = load i32, ptr %6, align 4, !tbaa !13
  %53 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %54 = load ptr, ptr %53, align 8, !tbaa !16
  %55 = getelementptr inbounds %struct.BeBuffer, ptr %54, i32 0, i32 1
  %56 = load i32, ptr %55, align 4, !tbaa !19
  %57 = icmp uge i32 %52, %56
  br i1 %57, label %58, label %63

58:                                               ; preds = %45
  %59 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %60 = load ptr, ptr %59, align 8, !tbaa !16
  %61 = getelementptr inbounds %struct.BeBuffer, ptr %60, i32 0, i32 1
  %62 = load i32, ptr %61, align 4, !tbaa !19
  store i32 %62, ptr %7, align 4, !tbaa !13
  br label %72

63:                                               ; preds = %45
  %64 = load i32, ptr %6, align 4, !tbaa !13
  %65 = icmp uge i32 %64, 11
  br i1 %65, label %66, label %67

66:                                               ; preds = %63
  store i32 11, ptr %7, align 4, !tbaa !13
  br label %71

67:                                               ; preds = %63
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %class.BeNode, ptr %68, i32 0, i32 2
  %70 = load i32, ptr %69, align 8, !tbaa !15
  call void @_ZN6BeNode5SetIdEj(ptr noundef nonnull align 8 dereferenceable(64) %14, i32 noundef %70)
  store i32 2, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %131

71:                                               ; preds = %66
  br label %72

72:                                               ; preds = %71, %58
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef @.str.33, ptr noundef nonnull align 1 dereferenceable(1) %10)
          to label %73 unwind label %122

73:                                               ; preds = %72
  %74 = load i32, ptr %7, align 4, !tbaa !13
  call void @_ZNSt7__cxx119to_stringEi(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %13, i32 noundef %74) #7
  invoke void @_Z10DebugPrintNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES4_(ptr noundef %9, ptr noundef %13)
          to label %75 unwind label %126

75:                                               ; preds = %73
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #7
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #7
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = getelementptr inbounds %class.BeNode, ptr %76, i32 0, i32 5
  %78 = load ptr, ptr %77, align 8, !tbaa !16
  %79 = getelementptr inbounds %struct.BeBuffer, ptr %78, i32 0, i32 2
  %80 = getelementptr inbounds [247 x %struct.BeUpsert], ptr %79, i64 0, i64 0
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = getelementptr inbounds %class.BeNode, ptr %81, i32 0, i32 5
  %83 = load ptr, ptr %82, align 8, !tbaa !16
  %84 = getelementptr inbounds %struct.BeBuffer, ptr %83, i32 0, i32 0
  %85 = load i32, ptr %84, align 4, !tbaa !17
  %86 = zext i32 %85 to i64
  %87 = getelementptr inbounds %struct.BeUpsert, ptr %80, i64 %86
  %88 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %89 = load ptr, ptr %88, align 8, !tbaa !16
  %90 = getelementptr inbounds %struct.BeBuffer, ptr %89, i32 0, i32 2
  %91 = getelementptr inbounds [247 x %struct.BeUpsert], ptr %90, i64 0, i64 0
  %92 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %93 = load ptr, ptr %92, align 8, !tbaa !16
  %94 = getelementptr inbounds %struct.BeBuffer, ptr %93, i32 0, i32 0
  %95 = load i32, ptr %94, align 4, !tbaa !17
  %96 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %97 = load ptr, ptr %96, align 8, !tbaa !16
  %98 = getelementptr inbounds %struct.BeBuffer, ptr %97, i32 0, i32 1
  %99 = load i32, ptr %98, align 4, !tbaa !19
  %100 = sub i32 %95, %99
  %101 = zext i32 %100 to i64
  %102 = getelementptr inbounds %struct.BeUpsert, ptr %91, i64 %101
  %103 = load i32, ptr %7, align 4, !tbaa !13
  %104 = sext i32 %103 to i64
  %105 = mul i64 %104, 16
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %87, ptr align 4 %102, i64 %105, i1 false)
  %106 = load i32, ptr %7, align 4, !tbaa !13
  %107 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %108 = load ptr, ptr %107, align 8, !tbaa !16
  %109 = getelementptr inbounds %struct.BeBuffer, ptr %108, i32 0, i32 0
  %110 = load i32, ptr %109, align 4, !tbaa !17
  %111 = sub i32 %110, %106
  store i32 %111, ptr %109, align 4, !tbaa !17
  %112 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %113 = load ptr, ptr %112, align 8, !tbaa !16
  %114 = getelementptr inbounds %struct.BeBuffer, ptr %113, i32 0, i32 1
  store i32 0, ptr %114, align 4, !tbaa !19
  %115 = load i32, ptr %7, align 4, !tbaa !13
  %116 = load ptr, ptr %5, align 8, !tbaa !5
  %117 = getelementptr inbounds %class.BeNode, ptr %116, i32 0, i32 5
  %118 = load ptr, ptr %117, align 8, !tbaa !16
  %119 = getelementptr inbounds %struct.BeBuffer, ptr %118, i32 0, i32 0
  %120 = load i32, ptr %119, align 4, !tbaa !17
  %121 = add i32 %120, %115
  store i32 %121, ptr %119, align 4, !tbaa !17
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %131

122:                                              ; preds = %72
  %123 = landingpad { ptr, i32 }
          cleanup
  %124 = extractvalue { ptr, i32 } %123, 0
  store ptr %124, ptr %11, align 8
  %125 = extractvalue { ptr, i32 } %123, 1
  store i32 %125, ptr %12, align 4
  br label %130

126:                                              ; preds = %73
  %127 = landingpad { ptr, i32 }
          cleanup
  %128 = extractvalue { ptr, i32 } %127, 0
  store ptr %128, ptr %11, align 8
  %129 = extractvalue { ptr, i32 } %127, 1
  store i32 %129, ptr %12, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #7
  br label %130

130:                                              ; preds = %126, %122
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %133

131:                                              ; preds = %75, %67
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  %132 = load i32, ptr %3, align 4
  ret i32 %132

133:                                              ; preds = %130
  %134 = load ptr, ptr %11, align 8
  %135 = load i32, ptr %12, align 4
  %136 = insertvalue { ptr, i32 } poison, ptr %134, 0
  %137 = insertvalue { ptr, i32 } %136, i32 %135, 1
  resume { ptr, i32 } %137
}

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { noreturn nounwind }
attributes #7 = { 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}


; 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
@.str.30 = external hidden unnamed_addr constant [25 x i8], align 1
@__PRETTY_FUNCTION__._ZN6BeNode16FlushOneInternalERS_ = external hidden unnamed_addr constant [47 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [20 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 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 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) #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 #5

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 1, 3) i32 @_ZN6BeNode16FlushOneInternalERS_(ptr noundef nonnull align 8 dereferenceable(64) %0, ptr noundef nonnull align 8 dereferenceable(64) %1) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::__cxx11::basic_string", align 8
  %4 = alloca %"class.std::allocator", align 1
  %5 = 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)
  %6 = getelementptr inbounds i8, ptr %0, i64 32
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = load i32, ptr %7, align 4, !tbaa !12
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %10, label %9

9:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.12, i32 noundef 384, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6BeNode16FlushOneInternalERS_) #6
  unreachable

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

14:                                               ; preds = %10
  tail call void @__assert_fail(ptr noundef nonnull @.str.32, ptr noundef nonnull @.str.12, i32 noundef 385, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6BeNode16FlushOneInternalERS_) #6
  unreachable

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

22:                                               ; preds = %15
  tail call void @__assert_fail(ptr noundef nonnull @.str.30, ptr noundef nonnull @.str.12, i32 noundef 386, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6BeNode16FlushOneInternalERS_) #6
  unreachable

23:                                               ; preds = %15
  %24 = getelementptr inbounds i8, ptr %1, i64 40
  %25 = load ptr, ptr %24, align 8, !tbaa !15
  %26 = load i32, ptr %25, align 4, !tbaa !16
  %27 = sub i32 247, %26
  %28 = getelementptr inbounds i8, ptr %0, i64 40
  %29 = load ptr, ptr %28, align 8, !tbaa !15
  %30 = getelementptr inbounds i8, ptr %29, i64 4
  %31 = load i32, ptr %30, align 4, !tbaa !18
  %.not23 = icmp ult i32 %27, %31
  br i1 %.not23, label %32, label %37

32:                                               ; preds = %23
  %33 = icmp ugt i32 %27, 10
  br i1 %33, label %37, label %34

34:                                               ; preds = %32
  %35 = getelementptr inbounds i8, ptr %1, i64 16
  %36 = load i32, ptr %35, align 8, !tbaa !14
  tail call void @_ZN6BeNode5SetIdEj(ptr noundef nonnull align 8 dereferenceable(64) %0, i32 noundef %36)
  br label %67

37:                                               ; preds = %32, %23
  %.018 = phi i32 [ %31, %23 ], [ 11, %32 ]
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %3, ptr noundef nonnull @.str.33, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %38 unwind label %62

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

39:                                               ; preds = %38
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #7
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #7
  %40 = load ptr, ptr %24, align 8, !tbaa !15
  %41 = getelementptr inbounds i8, ptr %40, i64 8
  %42 = load i32, ptr %40, align 4, !tbaa !16
  %43 = zext i32 %42 to i64
  %44 = getelementptr inbounds %struct.BeUpsert, ptr %41, i64 %43
  %45 = load ptr, ptr %28, align 8, !tbaa !15
  %46 = getelementptr inbounds i8, ptr %45, i64 8
  %47 = load i32, ptr %45, align 4, !tbaa !16
  %48 = getelementptr inbounds i8, ptr %45, i64 4
  %49 = load i32, ptr %48, align 4, !tbaa !18
  %50 = sub i32 %47, %49
  %51 = zext i32 %50 to i64
  %52 = getelementptr inbounds %struct.BeUpsert, ptr %46, i64 %51
  %53 = sext i32 %.018 to i64
  %54 = shl nsw i64 %53, 4
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %44, ptr nonnull align 4 %52, i64 %54, i1 false)
  %55 = load ptr, ptr %28, align 8, !tbaa !15
  %56 = load i32, ptr %55, align 4, !tbaa !16
  %57 = sub i32 %56, %.018
  store i32 %57, ptr %55, align 4, !tbaa !16
  %58 = getelementptr inbounds i8, ptr %55, i64 4
  store i32 0, ptr %58, align 4, !tbaa !18
  %59 = load ptr, ptr %24, align 8, !tbaa !15
  %60 = load i32, ptr %59, align 4, !tbaa !16
  %61 = add i32 %60, %.018
  store i32 %61, ptr %59, align 4, !tbaa !16
  br label %67

62:                                               ; preds = %37
  %63 = landingpad { ptr, i32 }
          cleanup
  br label %66

64:                                               ; preds = %38
  %65 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #7
  br label %66

66:                                               ; preds = %64, %62
  %.pn = phi { ptr, i32 } [ %65, %64 ], [ %63, %62 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #7
  resume { ptr, i32 } %.pn

67:                                               ; preds = %39, %34
  %.019 = phi i32 [ 1, %39 ], [ 2, %34 ]
  ret i32 %.019
}

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { noreturn nounwind }
attributes #7 = { 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}


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