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

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

%struct.BeUpsert = type { i32, i32, i32, i32 }
%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.BePivots = type { i32, [15 x i32], [16 x 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.27 = external hidden unnamed_addr constant [24 x i8], align 1
@__PRETTY_FUNCTION__._ZN6BeNode14FullFlushSetupEv = external hidden unnamed_addr constant [30 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [47 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: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z12SortBeUpsertRK8BeUpsertS1_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) #1

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

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

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

; 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: mustprogress uwtable
define dso_local void @_ZN6BeNode14FullFlushSetupEv(ptr noundef nonnull align 8 dereferenceable(64) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca [16 x i32], align 16
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %struct.BeUpsert, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %14 = load ptr, ptr %2, align 8
  call void @_ZN6BeNode4OpenEv(ptr noundef nonnull align 8 dereferenceable(64) %14)
  %15 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = getelementptr inbounds %struct.BeBuffer, ptr %16, i32 0, i32 1
  %18 = load i32, ptr %17, align 4, !tbaa !13
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %20, label %21

20:                                               ; preds = %1
  br label %23

21:                                               ; preds = %1
  call void @__assert_fail(ptr noundef @.str.27, ptr noundef @.str.12, i32 noundef 288, ptr noundef @__PRETTY_FUNCTION__._ZN6BeNode14FullFlushSetupEv) #7
  unreachable

22:                                               ; No predecessors!
  br label %23

23:                                               ; preds = %22, %20
  %24 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 4
  %25 = load ptr, ptr %24, align 8, !tbaa !15
  %26 = load i32, ptr %25, align 4, !tbaa !16
  %27 = icmp ne i32 %26, 0
  %28 = xor i1 %27, true
  br i1 %28, label %29, label %30

29:                                               ; preds = %23
  br label %32

30:                                               ; preds = %23
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.12, i32 noundef 289, ptr noundef @__PRETTY_FUNCTION__._ZN6BeNode14FullFlushSetupEv) #7
  unreachable

31:                                               ; No predecessors!
  br label %32

32:                                               ; preds = %31, %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  %33 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %34 = load ptr, ptr %33, align 8, !tbaa !9
  %35 = getelementptr inbounds %struct.BeBuffer, ptr %34, i32 0, i32 0
  %36 = load i32, ptr %35, align 4, !tbaa !17
  store i32 %36, ptr %3, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  %37 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 6
  %38 = load ptr, ptr %37, align 8, !tbaa !18
  %39 = getelementptr inbounds %struct.BePivots, ptr %38, i32 0, i32 0
  %40 = load i32, ptr %39, align 4, !tbaa !19
  store i32 %40, ptr %4, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 64, ptr %7) #8
  %41 = getelementptr inbounds [16 x i32], ptr %7, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %41, i8 0, i64 64, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 0, ptr %8, align 4, !tbaa !16
  br label %42

42:                                               ; preds = %61, %32
  %43 = load i32, ptr %8, align 4, !tbaa !16
  %44 = load i32, ptr %3, align 4, !tbaa !16
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %64

47:                                               ; preds = %42
  %48 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %49 = load ptr, ptr %48, align 8, !tbaa !9
  %50 = getelementptr inbounds %struct.BeBuffer, ptr %49, i32 0, i32 2
  %51 = load i32, ptr %8, align 4, !tbaa !16
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [247 x %struct.BeUpsert], ptr %50, i64 0, i64 %52
  %54 = getelementptr inbounds %struct.BeUpsert, ptr %53, i32 0, i32 0
  %55 = load i32, ptr %54, align 4, !tbaa !21
  %56 = call noundef i32 @_ZN6BeNode10IndexOfKeyEj(ptr noundef nonnull align 8 dereferenceable(64) %14, i32 noundef %55)
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [16 x i32], ptr %7, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !16
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %58, align 4, !tbaa !16
  br label %61

61:                                               ; preds = %47
  %62 = load i32, ptr %8, align 4, !tbaa !16
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %8, align 4, !tbaa !16
  br label %42, !llvm.loop !24

64:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 0, ptr %9, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 1, ptr %10, align 4, !tbaa !16
  br label %65

65:                                               ; preds = %84, %64
  %66 = load i32, ptr %10, align 4, !tbaa !16
  %67 = load i32, ptr %4, align 4, !tbaa !16
  %68 = add nsw i32 %67, 1
  %69 = icmp slt i32 %66, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %87

71:                                               ; preds = %65
  %72 = load i32, ptr %10, align 4, !tbaa !16
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [16 x i32], ptr %7, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !16
  %76 = load i32, ptr %9, align 4, !tbaa !16
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [16 x i32], ptr %7, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !16
  %80 = icmp sgt i32 %75, %79
  br i1 %80, label %81, label %83

81:                                               ; preds = %71
  %82 = load i32, ptr %10, align 4, !tbaa !16
  store i32 %82, ptr %9, align 4, !tbaa !16
  br label %83

83:                                               ; preds = %81, %71
  br label %84

84:                                               ; preds = %83
  %85 = load i32, ptr %10, align 4, !tbaa !16
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %10, align 4, !tbaa !16
  br label %65, !llvm.loop !26

87:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  %88 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %89 = load ptr, ptr %88, align 8, !tbaa !9
  %90 = getelementptr inbounds %struct.BeBuffer, ptr %89, i32 0, i32 0
  %91 = load i32, ptr %90, align 4, !tbaa !17
  %92 = sub i32 %91, 1
  store i32 %92, ptr %11, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %93 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %94 = load ptr, ptr %93, align 8, !tbaa !9
  %95 = getelementptr inbounds %struct.BeBuffer, ptr %94, i32 0, i32 0
  %96 = load i32, ptr %95, align 4, !tbaa !17
  %97 = sub i32 %96, 1
  store i32 %97, ptr %12, align 4, !tbaa !16
  br label %98

98:                                               ; preds = %140, %87
  %99 = load i32, ptr %12, align 4, !tbaa !16
  %100 = icmp sge i32 %99, 0
  br i1 %100, label %101, label %143

101:                                              ; preds = %98
  %102 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %103 = load ptr, ptr %102, align 8, !tbaa !9
  %104 = getelementptr inbounds %struct.BeBuffer, ptr %103, i32 0, i32 2
  %105 = load i32, ptr %12, align 4, !tbaa !16
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [247 x %struct.BeUpsert], ptr %104, i64 0, i64 %106
  %108 = getelementptr inbounds %struct.BeUpsert, ptr %107, i32 0, i32 0
  %109 = load i32, ptr %108, align 4, !tbaa !21
  %110 = call noundef i32 @_ZN6BeNode10IndexOfKeyEj(ptr noundef nonnull align 8 dereferenceable(64) %14, i32 noundef %109)
  %111 = load i32, ptr %9, align 4, !tbaa !16
  %112 = icmp eq i32 %110, %111
  br i1 %112, label %113, label %140

113:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #8
  %114 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %115 = load ptr, ptr %114, align 8, !tbaa !9
  %116 = getelementptr inbounds %struct.BeBuffer, ptr %115, i32 0, i32 2
  %117 = load i32, ptr %11, align 4, !tbaa !16
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [247 x %struct.BeUpsert], ptr %116, i64 0, i64 %118
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %119, i64 16, i1 false), !tbaa.struct !27
  %120 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %121 = load ptr, ptr %120, align 8, !tbaa !9
  %122 = getelementptr inbounds %struct.BeBuffer, ptr %121, i32 0, i32 2
  %123 = load i32, ptr %12, align 4, !tbaa !16
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [247 x %struct.BeUpsert], ptr %122, i64 0, i64 %124
  %126 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %127 = load ptr, ptr %126, align 8, !tbaa !9
  %128 = getelementptr inbounds %struct.BeBuffer, ptr %127, i32 0, i32 2
  %129 = load i32, ptr %11, align 4, !tbaa !16
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [247 x %struct.BeUpsert], ptr %128, i64 0, i64 %130
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %131, ptr align 4 %125, i64 16, i1 false), !tbaa.struct !27
  %132 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %133 = load ptr, ptr %132, align 8, !tbaa !9
  %134 = getelementptr inbounds %struct.BeBuffer, ptr %133, i32 0, i32 2
  %135 = load i32, ptr %12, align 4, !tbaa !16
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [247 x %struct.BeUpsert], ptr %134, i64 0, i64 %136
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %137, ptr align 4 %13, i64 16, i1 false), !tbaa.struct !27
  %138 = load i32, ptr %11, align 4, !tbaa !16
  %139 = add nsw i32 %138, -1
  store i32 %139, ptr %11, align 4, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #8
  br label %140

140:                                              ; preds = %113, %101
  %141 = load i32, ptr %12, align 4, !tbaa !16
  %142 = add nsw i32 %141, -1
  store i32 %142, ptr %12, align 4, !tbaa !16
  br label %98, !llvm.loop !29

143:                                              ; preds = %98
  %144 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %145 = load ptr, ptr %144, align 8, !tbaa !9
  %146 = getelementptr inbounds %struct.BeBuffer, ptr %145, i32 0, i32 0
  %147 = load i32, ptr %146, align 4, !tbaa !17
  %148 = sub i32 %147, 1
  %149 = load i32, ptr %11, align 4, !tbaa !16
  %150 = sub i32 %148, %149
  %151 = load i32, ptr %9, align 4, !tbaa !16
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [16 x i32], ptr %7, i64 0, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !16
  %155 = icmp eq i32 %150, %154
  br i1 %155, label %156, label %157

156:                                              ; preds = %143
  br label %159

157:                                              ; preds = %143
  call void @__assert_fail(ptr noundef @.str.28, ptr noundef @.str.12, i32 noundef 326, ptr noundef @__PRETTY_FUNCTION__._ZN6BeNode14FullFlushSetupEv) #7
  unreachable

158:                                              ; No predecessors!
  br label %159

159:                                              ; preds = %158, %156
  %160 = load i32, ptr %9, align 4, !tbaa !16
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [16 x i32], ptr %7, i64 0, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !16
  %164 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %165 = load ptr, ptr %164, align 8, !tbaa !9
  %166 = getelementptr inbounds %struct.BeBuffer, ptr %165, i32 0, i32 1
  store i32 %163, ptr %166, align 4, !tbaa !13
  %167 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %168 = load ptr, ptr %167, align 8, !tbaa !9
  %169 = getelementptr inbounds %struct.BeBuffer, ptr %168, i32 0, i32 2
  %170 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %171 = load ptr, ptr %170, align 8, !tbaa !9
  %172 = getelementptr inbounds %struct.BeBuffer, ptr %171, i32 0, i32 0
  %173 = load i32, ptr %172, align 4, !tbaa !17
  %174 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %175 = load ptr, ptr %174, align 8, !tbaa !9
  %176 = getelementptr inbounds %struct.BeBuffer, ptr %175, i32 0, i32 1
  %177 = load i32, ptr %176, align 4, !tbaa !13
  %178 = sub i32 %173, %177
  %179 = zext i32 %178 to i64
  %180 = getelementptr inbounds [247 x %struct.BeUpsert], ptr %169, i64 0, i64 %179
  %181 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %182 = load ptr, ptr %181, align 8, !tbaa !9
  %183 = getelementptr inbounds %struct.BeBuffer, ptr %182, i32 0, i32 2
  %184 = getelementptr inbounds %class.BeNode, ptr %14, i32 0, i32 5
  %185 = load ptr, ptr %184, align 8, !tbaa !9
  %186 = getelementptr inbounds %struct.BeBuffer, ptr %185, i32 0, i32 0
  %187 = load i32, ptr %186, align 4, !tbaa !17
  %188 = zext i32 %187 to i64
  %189 = getelementptr inbounds [247 x %struct.BeUpsert], ptr %183, i64 0, i64 %188
  call void @_ZSt4sortIP8BeUpsertPFbRKS0_S3_EEvT_S6_T0_(ptr noundef %180, ptr noundef %189, ptr noundef @_Z12SortBeUpsertRK8BeUpsertS1_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 64, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  ret void
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP8BeUpsertPFbRKS0_S3_EEvT_S6_T0_(ptr noundef, ptr noundef, ptr noundef) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { noreturn nounwind }
attributes #8 = { 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 40}
!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 = !{!14, !12, i64 4}
!14 = !{!"_ZTS8BeBuffer", !12, i64 0, !12, i64 4, !7, i64 8}
!15 = !{!10, !6, i64 32}
!16 = !{!12, !12, i64 0}
!17 = !{!14, !12, i64 0}
!18 = !{!10, !6, i64 48}
!19 = !{!20, !12, i64 0}
!20 = !{!"_ZTS8BePivots", !12, i64 0, !7, i64 4, !7, i64 64}
!21 = !{!22, !12, i64 0}
!22 = !{!"_ZTS8BeUpsert", !12, i64 0, !23, i64 4, !12, i64 8, !12, i64 12}
!23 = !{!"_ZTS14UpsertFunction", !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25}
!27 = !{i64 0, i64 4, !16, i64 4, i64 4, !28, i64 8, i64 4, !16, i64 12, i64 4, !16}
!28 = !{!23, !23, i64 0}
!29 = distinct !{!29, !25}


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

%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.27 = external hidden unnamed_addr constant [24 x i8], align 1
@__PRETTY_FUNCTION__._ZN6BeNode14FullFlushSetupEv = external hidden unnamed_addr constant [30 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [47 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: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z12SortBeUpsertRK8BeUpsertS1_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) #1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN6BeNode10IndexOfKeyEj(ptr noundef nonnull align 8 dereferenceable(64), i32 noundef) local_unnamed_addr #2 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 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: mustprogress uwtable
define dso_local void @_ZN6BeNode14FullFlushSetupEv(ptr noundef nonnull align 8 dereferenceable(64) %0) local_unnamed_addr #2 align 2 {
  %2 = alloca [16 x i32], align 16
  %3 = alloca %struct.BeUpsert, align 4
  tail call void @_ZN6BeNode4OpenEv(ptr noundef nonnull align 8 dereferenceable(64) %0)
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %5, i64 4
  %7 = load i32, ptr %6, align 4, !tbaa !12
  %8 = icmp eq i32 %7, 0
  br i1 %8, label %10, label %9

9:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.27, ptr noundef nonnull @.str.12, i32 noundef 288, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6BeNode14FullFlushSetupEv) #7
  unreachable

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

14:                                               ; preds = %10
  tail call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.12, i32 noundef 289, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6BeNode14FullFlushSetupEv) #7
  unreachable

15:                                               ; preds = %10
  %16 = load i32, ptr %5, align 4, !tbaa !16
  %17 = getelementptr inbounds i8, ptr %0, i64 48
  %18 = load ptr, ptr %17, align 8, !tbaa !17
  %19 = load i32, ptr %18, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %2) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %2, i8 0, i64 64, i1 false)
  %20 = icmp sgt i32 %16, 0
  br i1 %20, label %.lr.ph.preheader, label %.preheader

.lr.ph.preheader:                                 ; preds = %15
  %wide.trip.count = zext nneg i32 %16 to i64
  br label %.lr.ph

.preheader:                                       ; preds = %.lr.ph, %15
  %.not2830 = icmp slt i32 %19, 1
  br i1 %.not2830, label %._crit_edge, label %.lr.ph33.preheader

.lr.ph33.preheader:                               ; preds = %.preheader
  %21 = zext nneg i32 %19 to i64
  %xtraiter = and i64 %21, 3
  %22 = icmp ult i32 %19, 4
  br i1 %22, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph33.preheader.new

.lr.ph33.preheader.new:                           ; preds = %.lr.ph33.preheader
  %unroll_iter = and i64 %21, 2147483644
  br label %.lr.ph33

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %23, i64 8
  %25 = getelementptr inbounds [247 x %struct.BeUpsert], ptr %24, i64 0, i64 %indvars.iv
  %26 = load i32, ptr %25, align 4, !tbaa !20
  %27 = tail call noundef i32 @_ZN6BeNode10IndexOfKeyEj(ptr noundef nonnull align 8 dereferenceable(64) %0, i32 noundef %26)
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [16 x i32], ptr %2, i64 0, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !15
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %29, align 4, !tbaa !15
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader, label %.lr.ph, !llvm.loop !23

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph33, %.lr.ph33.preheader
  %spec.select.lcssa.ph = phi i32 [ poison, %.lr.ph33.preheader ], [ %spec.select.3, %.lr.ph33 ]
  %indvars.iv41.unr = phi i64 [ 1, %.lr.ph33.preheader ], [ %indvars.iv.next42.3, %.lr.ph33 ]
  %.02431.unr = phi i32 [ 0, %.lr.ph33.preheader ], [ %spec.select.3, %.lr.ph33 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph33.epil

.lr.ph33.epil:                                    ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph33.epil
  %indvars.iv41.epil = phi i64 [ %indvars.iv.next42.epil, %.lr.ph33.epil ], [ %indvars.iv41.unr, %._crit_edge.loopexit.unr-lcssa ]
  %.02431.epil = phi i32 [ %spec.select.epil, %.lr.ph33.epil ], [ %.02431.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph33.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %32 = getelementptr inbounds [16 x i32], ptr %2, i64 0, i64 %indvars.iv41.epil
  %33 = load i32, ptr %32, align 4, !tbaa !15
  %34 = sext i32 %.02431.epil to i64
  %35 = getelementptr inbounds [16 x i32], ptr %2, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !15
  %37 = icmp sgt i32 %33, %36
  %38 = trunc nuw nsw i64 %indvars.iv41.epil to i32
  %spec.select.epil = select i1 %37, i32 %38, i32 %.02431.epil
  %indvars.iv.next42.epil = add nuw nsw i64 %indvars.iv41.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.lr.ph33.epil, !llvm.loop !25

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph33.epil, %.preheader
  %.024.lcssa = phi i32 [ 0, %.preheader ], [ %spec.select.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %spec.select.epil, %.lr.ph33.epil ]
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = load i32, ptr %39, align 4, !tbaa !16
  %41 = add i32 %40, -1
  %42 = icmp sgt i32 %41, -1
  br i1 %42, label %.lr.ph37.preheader, label %._crit_edge38

.lr.ph37.preheader:                               ; preds = %._crit_edge
  %43 = zext nneg i32 %41 to i64
  br label %.lr.ph37

.lr.ph33:                                         ; preds = %.lr.ph33, %.lr.ph33.preheader.new
  %indvars.iv41 = phi i64 [ 1, %.lr.ph33.preheader.new ], [ %indvars.iv.next42.3, %.lr.ph33 ]
  %.02431 = phi i32 [ 0, %.lr.ph33.preheader.new ], [ %spec.select.3, %.lr.ph33 ]
  %niter = phi i64 [ 0, %.lr.ph33.preheader.new ], [ %niter.next.3, %.lr.ph33 ]
  %44 = getelementptr inbounds [16 x i32], ptr %2, i64 0, i64 %indvars.iv41
  %45 = load i32, ptr %44, align 4, !tbaa !15
  %46 = sext i32 %.02431 to i64
  %47 = getelementptr inbounds [16 x i32], ptr %2, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !15
  %49 = icmp sgt i32 %45, %48
  %50 = trunc nuw nsw i64 %indvars.iv41 to i32
  %spec.select = select i1 %49, i32 %50, i32 %.02431
  %indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
  %51 = getelementptr inbounds [16 x i32], ptr %2, i64 0, i64 %indvars.iv.next42
  %52 = load i32, ptr %51, align 4, !tbaa !15
  %53 = sext i32 %spec.select to i64
  %54 = getelementptr inbounds [16 x i32], ptr %2, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !15
  %56 = icmp sgt i32 %52, %55
  %57 = trunc nuw nsw i64 %indvars.iv.next42 to i32
  %spec.select.1 = select i1 %56, i32 %57, i32 %spec.select
  %indvars.iv.next42.1 = add nuw nsw i64 %indvars.iv41, 2
  %58 = getelementptr inbounds [16 x i32], ptr %2, i64 0, i64 %indvars.iv.next42.1
  %59 = load i32, ptr %58, align 4, !tbaa !15
  %60 = sext i32 %spec.select.1 to i64
  %61 = getelementptr inbounds [16 x i32], ptr %2, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !15
  %63 = icmp sgt i32 %59, %62
  %64 = trunc nuw nsw i64 %indvars.iv.next42.1 to i32
  %spec.select.2 = select i1 %63, i32 %64, i32 %spec.select.1
  %indvars.iv.next42.2 = add nuw nsw i64 %indvars.iv41, 3
  %65 = getelementptr inbounds [16 x i32], ptr %2, i64 0, i64 %indvars.iv.next42.2
  %66 = load i32, ptr %65, align 4, !tbaa !15
  %67 = sext i32 %spec.select.2 to i64
  %68 = getelementptr inbounds [16 x i32], ptr %2, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !15
  %70 = icmp sgt i32 %66, %69
  %71 = trunc nuw nsw i64 %indvars.iv.next42.2 to i32
  %spec.select.3 = select i1 %70, i32 %71, i32 %spec.select.2
  %indvars.iv.next42.3 = add nuw nsw i64 %indvars.iv41, 4
  %niter.next.3 = add nuw i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph33, !llvm.loop !27

.lr.ph37:                                         ; preds = %.lr.ph37.preheader, %88
  %indvars.iv46 = phi i64 [ %43, %.lr.ph37.preheader ], [ %indvars.iv.next47, %88 ]
  %.02234 = phi i32 [ %41, %.lr.ph37.preheader ], [ %.1, %88 ]
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds i8, ptr %72, i64 8
  %74 = getelementptr inbounds [247 x %struct.BeUpsert], ptr %73, i64 0, i64 %indvars.iv46
  %75 = load i32, ptr %74, align 4, !tbaa !20
  %76 = tail call noundef i32 @_ZN6BeNode10IndexOfKeyEj(ptr noundef nonnull align 8 dereferenceable(64) %0, i32 noundef %75)
  %77 = icmp eq i32 %76, %.024.lcssa
  br i1 %77, label %78, label %88

78:                                               ; preds = %.lr.ph37
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3)
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds i8, ptr %79, i64 8
  %81 = sext i32 %.02234 to i64
  %82 = getelementptr inbounds [247 x %struct.BeUpsert], ptr %80, i64 0, i64 %81
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(16) %82, i64 16, i1 false), !tbaa.struct !28
  %83 = getelementptr inbounds [247 x %struct.BeUpsert], ptr %80, i64 0, i64 %indvars.iv46
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %82, ptr noundef nonnull align 4 dereferenceable(16) %83, i64 16, i1 false), !tbaa.struct !28
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = getelementptr inbounds i8, ptr %84, i64 8
  %86 = getelementptr inbounds [247 x %struct.BeUpsert], ptr %85, i64 0, i64 %indvars.iv46
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %86, ptr noundef nonnull align 4 dereferenceable(16) %3, i64 16, i1 false), !tbaa.struct !28
  %87 = add nsw i32 %.02234, -1
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3)
  br label %88

88:                                               ; preds = %78, %.lr.ph37
  %.1 = phi i32 [ %87, %78 ], [ %.02234, %.lr.ph37 ]
  %indvars.iv.next47 = add nsw i64 %indvars.iv46, -1
  %89 = icmp sgt i64 %indvars.iv46, 0
  br i1 %89, label %.lr.ph37, label %._crit_edge38.loopexit, !llvm.loop !30

._crit_edge38.loopexit:                           ; preds = %88
  %.pre = load ptr, ptr %4, align 8, !tbaa !5
  %.pre49 = load i32, ptr %.pre, align 4, !tbaa !16
  br label %._crit_edge38

._crit_edge38:                                    ; preds = %._crit_edge38.loopexit, %._crit_edge
  %90 = phi i32 [ %40, %._crit_edge ], [ %.pre49, %._crit_edge38.loopexit ]
  %91 = phi ptr [ %39, %._crit_edge ], [ %.pre, %._crit_edge38.loopexit ]
  %.022.lcssa = phi i32 [ %41, %._crit_edge ], [ %.1, %._crit_edge38.loopexit ]
  %92 = xor i32 %.022.lcssa, -1
  %93 = add i32 %90, %92
  %94 = sext i32 %.024.lcssa to i64
  %95 = getelementptr inbounds [16 x i32], ptr %2, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !15
  %97 = icmp eq i32 %93, %96
  br i1 %97, label %99, label %98

98:                                               ; preds = %._crit_edge38
  tail call void @__assert_fail(ptr noundef nonnull @.str.28, ptr noundef nonnull @.str.12, i32 noundef 326, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6BeNode14FullFlushSetupEv) #7
  unreachable

99:                                               ; preds = %._crit_edge38
  %.neg = add i32 %.022.lcssa, 1
  %100 = getelementptr inbounds i8, ptr %91, i64 4
  store i32 %93, ptr %100, align 4, !tbaa !12
  %101 = getelementptr inbounds i8, ptr %91, i64 8
  %102 = zext i32 %.neg to i64
  %103 = getelementptr inbounds [247 x %struct.BeUpsert], ptr %101, i64 0, i64 %102
  %104 = zext i32 %90 to i64
  %105 = getelementptr inbounds [247 x %struct.BeUpsert], ptr %101, i64 0, i64 %104
  tail call void @_ZSt4sortIP8BeUpsertPFbRKS0_S3_EEvT_S6_T0_(ptr noundef nonnull %103, ptr noundef nonnull %105, ptr noundef nonnull @_Z12SortBeUpsertRK8BeUpsertS1_)
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %2) #8
  ret void
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP8BeUpsertPFbRKS0_S3_EEvT_S6_T0_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { noreturn nounwind }
attributes #8 = { 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 40}
!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 = !{!13, !11, i64 4}
!13 = !{!"_ZTS8BeBuffer", !11, i64 0, !11, i64 4, !9, i64 8}
!14 = !{!6, !8, i64 32}
!15 = !{!11, !11, i64 0}
!16 = !{!13, !11, i64 0}
!17 = !{!6, !8, i64 48}
!18 = !{!19, !11, i64 0}
!19 = !{!"_ZTS8BePivots", !11, i64 0, !9, i64 4, !9, i64 64}
!20 = !{!21, !11, i64 0}
!21 = !{!"_ZTS8BeUpsert", !11, i64 0, !22, i64 4, !11, i64 8, !11, i64 12}
!22 = !{!"_ZTS14UpsertFunction", !9, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.unroll.disable"}
!27 = distinct !{!27, !24}
!28 = !{i64 0, i64 4, !15, i64 4, i64 4, !29, i64 8, i64 4, !15, i64 12, i64 4, !15}
!29 = !{!22, !22, i64 0}
!30 = distinct !{!30, !24}


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