; LLVM IR from mitdbg/deneva :: storage/index_btree.ll (ZN11index_btree12index_insertEmP8itemid_ti)

; 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.glob_param = type { i64 }
%struct.bt_node = type { ptr, i8, ptr, ptr, i32, ptr, i8, %union.pthread_mutex_t, i32, i32 }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%class.index_btree = type { %class.index_base, i64, i32, ptr, ptr, ptr }
%class.index_base = type { ptr, ptr }

@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [14 x i8], align 1
@__PRETTY_FUNCTION__._ZN11index_btree12index_insertEmP8itemid_ti = external hidden unnamed_addr constant [65 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [12 x i8], align 1

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN11index_btree9find_rootEm(ptr noundef nonnull align 8 dereferenceable(56), i64 noundef) #2 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN11index_btree12index_insertEmP8itemid_ti(ptr noundef nonnull align 8 dereferenceable(56) %0, i64 noundef %1, ptr noundef %2, i32 noundef %3) unnamed_addr #4 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %struct.glob_param, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca [100 x ptr], align 16
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca %struct.glob_param, align 8
  %17 = alloca ptr, align 8
  %18 = alloca %struct.glob_param, align 8
  %19 = alloca i32, align 4
  %20 = alloca %struct.glob_param, align 8
  %21 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !11
  %22 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %23 = load i32, ptr %8, align 4, !tbaa !11
  %24 = icmp ne i32 %23, -1
  br i1 %24, label %25, label %26

25:                                               ; preds = %4
  br label %28

26:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 130, ptr noundef @__PRETTY_FUNCTION__._ZN11index_btree12index_insertEmP8itemid_ti) #6
  unreachable

27:                                               ; No predecessors!
  br label %28

28:                                               ; preds = %27, %25
  %29 = load i32, ptr %8, align 4, !tbaa !11
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds %struct.glob_param, ptr %9, i32 0, i32 0
  store i64 %30, ptr %31, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %32 = getelementptr inbounds %struct.glob_param, ptr %9, i32 0, i32 0
  %33 = load i64, ptr %32, align 8, !tbaa !13
  %34 = call noundef ptr @_ZN11index_btree9find_rootEm(ptr noundef nonnull align 8 dereferenceable(56) %22, i64 noundef %33)
  store ptr %34, ptr %11, align 8, !tbaa !5
  %35 = load ptr, ptr %11, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %37, label %38

37:                                               ; preds = %28
  br label %40

38:                                               ; preds = %28
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.1, i32 noundef 135, ptr noundef @__PRETTY_FUNCTION__._ZN11index_btree12index_insertEmP8itemid_ti) #6
  unreachable

39:                                               ; No predecessors!
  br label %40

40:                                               ; preds = %39, %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 800, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store ptr null, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  store ptr null, ptr %15, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %16, ptr align 8 %9, i64 8, i1 false), !tbaa.struct !17
  %41 = load i64, ptr %6, align 8, !tbaa !9
  %42 = getelementptr inbounds %struct.glob_param, ptr %16, i32 0, i32 0
  %43 = load i64, ptr %42, align 8
  %44 = call noundef i32 @_ZN11index_btree9find_leafE10glob_paramm9idx_acc_tRP7bt_nodeS4_(ptr noundef nonnull align 8 dereferenceable(56) %22, i64 %43, i64 noundef %41, i32 noundef 0, ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %15)
  store i32 %44, ptr %10, align 4, !tbaa !15
  %45 = load i32, ptr %10, align 4, !tbaa !15
  %46 = icmp eq i32 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %40
  br label %50

48:                                               ; preds = %40
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 142, ptr noundef @__PRETTY_FUNCTION__._ZN11index_btree12index_insertEmP8itemid_ti) #6
  unreachable

49:                                               ; No predecessors!
  br label %50

50:                                               ; preds = %49, %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %51 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %51, ptr %17, align 8, !tbaa !5
  %52 = load ptr, ptr %15, align 8, !tbaa !5
  %53 = icmp ne ptr %52, null
  br i1 %53, label %54, label %80

54:                                               ; preds = %50
  br label %55

55:                                               ; preds = %73, %54
  %56 = load ptr, ptr %17, align 8, !tbaa !5
  %57 = load ptr, ptr %15, align 8, !tbaa !5
  %58 = icmp ne ptr %56, %57
  br i1 %58, label %59, label %74

59:                                               ; preds = %55
  %60 = load ptr, ptr %17, align 8, !tbaa !5
  %61 = load i32, ptr %12, align 4, !tbaa !11
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %12, align 4, !tbaa !11
  %63 = sext i32 %61 to i64
  %64 = getelementptr inbounds [100 x ptr], ptr %13, i64 0, i64 %63
  store ptr %60, ptr %64, align 8, !tbaa !5
  %65 = load ptr, ptr %17, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.bt_node, ptr %65, i32 0, i32 3
  %67 = load ptr, ptr %66, align 8, !tbaa !18
  store ptr %67, ptr %17, align 8, !tbaa !5
  %68 = load i32, ptr %12, align 4, !tbaa !11
  %69 = icmp slt i32 %68, 100
  br i1 %69, label %70, label %71

70:                                               ; preds = %59
  br label %73

71:                                               ; preds = %59
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.1, i32 noundef 150, ptr noundef @__PRETTY_FUNCTION__._ZN11index_btree12index_insertEmP8itemid_ti) #6
  unreachable

72:                                               ; No predecessors!
  br label %73

73:                                               ; preds = %72, %70
  br label %55, !llvm.loop !22

74:                                               ; preds = %55
  %75 = load ptr, ptr %15, align 8, !tbaa !5
  %76 = load i32, ptr %12, align 4, !tbaa !11
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %12, align 4, !tbaa !11
  %78 = sext i32 %76 to i64
  %79 = getelementptr inbounds [100 x ptr], ptr %13, i64 0, i64 %78
  store ptr %75, ptr %79, align 8, !tbaa !5
  br label %86

80:                                               ; preds = %50
  %81 = load ptr, ptr %14, align 8, !tbaa !5
  %82 = load i32, ptr %12, align 4, !tbaa !11
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %12, align 4, !tbaa !11
  %84 = sext i32 %82 to i64
  %85 = getelementptr inbounds [100 x ptr], ptr %13, i64 0, i64 %84
  store ptr %81, ptr %85, align 8, !tbaa !5
  br label %86

86:                                               ; preds = %80, %74
  %87 = load ptr, ptr %14, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.bt_node, ptr %87, i32 0, i32 4
  %89 = load i32, ptr %88, align 8, !tbaa !24
  %90 = getelementptr inbounds %class.index_btree, ptr %22, i32 0, i32 2
  %91 = load i32, ptr %90, align 8, !tbaa !25
  %92 = sub i32 %91, 1
  %93 = icmp ult i32 %89, %92
  br i1 %93, label %99, label %94

94:                                               ; preds = %86
  %95 = load ptr, ptr %14, align 8, !tbaa !5
  %96 = load i64, ptr %6, align 8, !tbaa !9
  %97 = call noundef i32 @_ZN11index_btree12leaf_has_keyEP7bt_nodem(ptr noundef nonnull align 8 dereferenceable(56) %22, ptr noundef %95, i64 noundef %96)
  %98 = icmp sge i32 %97, 0
  br i1 %98, label %99, label %121

99:                                               ; preds = %94, %86
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %18, ptr align 8 %9, i64 8, i1 false), !tbaa.struct !17
  %100 = load ptr, ptr %14, align 8, !tbaa !5
  %101 = load i64, ptr %6, align 8, !tbaa !9
  %102 = load ptr, ptr %7, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.glob_param, ptr %18, i32 0, i32 0
  %104 = load i64, ptr %103, align 8
  %105 = call noundef i32 @_ZN11index_btree16insert_into_leafE10glob_paramP7bt_nodemP8itemid_t(ptr noundef nonnull align 8 dereferenceable(56) %22, i64 %104, ptr noundef %100, i64 noundef %101, ptr noundef %102)
  store i32 %105, ptr %10, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  store i32 0, ptr %19, align 4, !tbaa !11
  br label %106

106:                                              ; preds = %117, %99
  %107 = load i32, ptr %19, align 4, !tbaa !11
  %108 = load i32, ptr %12, align 4, !tbaa !11
  %109 = icmp slt i32 %107, %108
  br i1 %109, label %111, label %110

110:                                              ; preds = %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %120

111:                                              ; preds = %106
  %112 = load i32, ptr %19, align 4, !tbaa !11
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [100 x ptr], ptr %13, i64 0, i64 %113
  %115 = load ptr, ptr %114, align 8, !tbaa !5
  %116 = call noundef i32 @_ZN11index_btree13release_latchEP7bt_node(ptr noundef nonnull align 8 dereferenceable(56) %22, ptr noundef %115)
  br label %117

117:                                              ; preds = %111
  %118 = load i32, ptr %19, align 4, !tbaa !11
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %19, align 4, !tbaa !11
  br label %106, !llvm.loop !28

120:                                              ; preds = %110
  br label %143

121:                                              ; preds = %94
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 8 %9, i64 8, i1 false), !tbaa.struct !17
  %122 = load ptr, ptr %14, align 8, !tbaa !5
  %123 = load i64, ptr %6, align 8, !tbaa !9
  %124 = load ptr, ptr %7, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.glob_param, ptr %20, i32 0, i32 0
  %126 = load i64, ptr %125, align 8
  %127 = call noundef i32 @_ZN11index_btree15split_lf_insertE10glob_paramP7bt_nodemP8itemid_t(ptr noundef nonnull align 8 dereferenceable(56) %22, i64 %126, ptr noundef %122, i64 noundef %123, ptr noundef %124)
  store i32 %127, ptr %10, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  store i32 0, ptr %21, align 4, !tbaa !11
  br label %128

128:                                              ; preds = %139, %121
  %129 = load i32, ptr %21, align 4, !tbaa !11
  %130 = load i32, ptr %12, align 4, !tbaa !11
  %131 = icmp slt i32 %129, %130
  br i1 %131, label %133, label %132

132:                                              ; preds = %128
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  br label %142

133:                                              ; preds = %128
  %134 = load i32, ptr %21, align 4, !tbaa !11
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [100 x ptr], ptr %13, i64 0, i64 %135
  %137 = load ptr, ptr %136, align 8, !tbaa !5
  %138 = call noundef i32 @_ZN11index_btree13release_latchEP7bt_node(ptr noundef nonnull align 8 dereferenceable(56) %22, ptr noundef %137)
  br label %139

139:                                              ; preds = %133
  %140 = load i32, ptr %21, align 4, !tbaa !11
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %21, align 4, !tbaa !11
  br label %128, !llvm.loop !29

142:                                              ; preds = %132
  br label %143

143:                                              ; preds = %142, %120
  %144 = load i32, ptr %10, align 4, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 800, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  ret i32 %144
}

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

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { nounwind }
attributes #6 = { noreturn nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"_ZTS10glob_param", !10, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"_ZTS2RC", !7, i64 0}
!17 = !{i64 0, i64 8, !9}
!18 = !{!19, !6, i64 24}
!19 = !{!"_ZTS7bt_node", !6, i64 0, !20, i64 8, !6, i64 16, !6, i64 24, !12, i64 32, !6, i64 40, !20, i64 48, !7, i64 56, !21, i64 96, !12, i64 100}
!20 = !{!"bool", !7, i64 0}
!21 = !{!"_ZTS7latch_t", !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!19, !12, i64 32}
!25 = !{!26, !12, i64 24}
!26 = !{!"_ZTS11index_btree", !27, i64 0, !10, i64 16, !12, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!27 = !{!"_ZTS10index_base", !6, i64 8}
!28 = distinct !{!28, !23}
!29 = distinct !{!29, !23}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [14 x i8], align 1
@__PRETTY_FUNCTION__._ZN11index_btree12index_insertEmP8itemid_ti = external hidden unnamed_addr constant [65 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [12 x i8], align 1

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN11index_btree9find_rootEm(ptr noundef nonnull align 8 dereferenceable(56), i64 noundef) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN11index_btree12index_insertEmP8itemid_ti(ptr noundef nonnull align 8 dereferenceable(56) %0, i64 noundef %1, ptr noundef %2, i32 noundef %3) unnamed_addr #3 align 2 {
  %5 = alloca [100 x ptr], align 16
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %.not = icmp eq i32 %3, -1
  br i1 %.not, label %8, label %9

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

9:                                                ; preds = %4
  %10 = sext i32 %3 to i64
  %11 = tail call noundef ptr @_ZN11index_btree9find_rootEm(ptr noundef nonnull align 8 dereferenceable(56) %0, i64 noundef %10)
  %.not39 = icmp eq ptr %11, null
  br i1 %.not39, label %12, label %13

12:                                               ; preds = %9
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.1, i32 noundef 135, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN11index_btree12index_insertEmP8itemid_ti) #4
  unreachable

13:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  store ptr null, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  store ptr null, ptr %7, align 8, !tbaa !5
  %14 = call noundef i32 @_ZN11index_btree9find_leafE10glob_paramm9idx_acc_tRP7bt_nodeS4_(ptr noundef nonnull align 8 dereferenceable(56) %0, i64 %10, i64 noundef %1, i32 noundef 0, ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %17, label %16

16:                                               ; preds = %13
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 142, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN11index_btree12index_insertEmP8itemid_ti) #4
  unreachable

17:                                               ; preds = %13
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %.not40 = icmp eq ptr %19, null
  br i1 %.not40, label %42, label %.preheader

.preheader:                                       ; preds = %17, %33
  %indvars.iv = phi i64 [ %32, %33 ], [ 0, %17 ]
  %.035 = phi ptr [ %36, %33 ], [ %18, %17 ]
  %.not41 = icmp eq ptr %.035, %19
  %20 = or disjoint i64 %indvars.iv, 1
  br i1 %.not41, label %38, label %.preheader.1

.preheader.1:                                     ; preds = %.preheader
  %21 = getelementptr inbounds [100 x ptr], ptr %5, i64 0, i64 %indvars.iv
  store ptr %.035, ptr %21, align 16, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %.035, i64 24
  %23 = load ptr, ptr %22, align 8, !tbaa !9
  %.not41.1 = icmp eq ptr %23, %19
  %24 = or disjoint i64 %indvars.iv, 2
  br i1 %.not41.1, label %38, label %.preheader.2

.preheader.2:                                     ; preds = %.preheader.1
  %25 = getelementptr inbounds [100 x ptr], ptr %5, i64 0, i64 %20
  store ptr %23, ptr %25, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %23, i64 24
  %27 = load ptr, ptr %26, align 8, !tbaa !9
  %.not41.2 = icmp eq ptr %27, %19
  %28 = or disjoint i64 %indvars.iv, 3
  br i1 %.not41.2, label %38, label %.preheader.3

.preheader.3:                                     ; preds = %.preheader.2
  %29 = getelementptr inbounds [100 x ptr], ptr %5, i64 0, i64 %24
  store ptr %27, ptr %29, align 16, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %27, i64 24
  %31 = load ptr, ptr %30, align 8, !tbaa !9
  %.not41.3 = icmp eq ptr %31, %19
  %32 = add nuw nsw i64 %indvars.iv, 4
  br i1 %.not41.3, label %38, label %33

33:                                               ; preds = %.preheader.3
  %34 = getelementptr inbounds [100 x ptr], ptr %5, i64 0, i64 %28
  store ptr %31, ptr %34, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %31, i64 24
  %36 = load ptr, ptr %35, align 8, !tbaa !9
  %exitcond.not.3 = icmp eq i64 %32, 100
  br i1 %exitcond.not.3, label %37, label %.preheader, !llvm.loop !14

37:                                               ; preds = %33
  call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.1, i32 noundef 150, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN11index_btree12index_insertEmP8itemid_ti) #4
  unreachable

38:                                               ; preds = %.preheader.3, %.preheader.2, %.preheader.1, %.preheader
  %indvars.iv.lcssa = phi i64 [ %indvars.iv, %.preheader ], [ %20, %.preheader.1 ], [ %24, %.preheader.2 ], [ %28, %.preheader.3 ]
  %.lcssa = phi i64 [ %20, %.preheader ], [ %24, %.preheader.1 ], [ %28, %.preheader.2 ], [ %32, %.preheader.3 ]
  %39 = and i64 %indvars.iv.lcssa, 4294967295
  %40 = getelementptr inbounds [100 x ptr], ptr %5, i64 0, i64 %39
  store ptr %19, ptr %40, align 8, !tbaa !5
  %41 = and i64 %.lcssa, 4294967295
  br label %43

42:                                               ; preds = %17
  store ptr %18, ptr %5, align 16, !tbaa !5
  br label %43

43:                                               ; preds = %42, %38
  %.1 = phi i64 [ %41, %38 ], [ 1, %42 ]
  %44 = getelementptr inbounds i8, ptr %18, i64 32
  %45 = load i32, ptr %44, align 8, !tbaa !16
  %46 = getelementptr inbounds i8, ptr %0, i64 24
  %47 = load i32, ptr %46, align 8, !tbaa !17
  %48 = add i32 %47, -1
  %49 = icmp ult i32 %45, %48
  br i1 %49, label %53, label %50

50:                                               ; preds = %43
  %51 = call noundef i32 @_ZN11index_btree12leaf_has_keyEP7bt_nodem(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef nonnull %18, i64 noundef %1)
  %52 = icmp sgt i32 %51, -1
  %.pre = load ptr, ptr %6, align 8, !tbaa !5
  br i1 %52, label %53, label %60

53:                                               ; preds = %50, %43
  %54 = phi ptr [ %.pre, %50 ], [ %18, %43 ]
  %55 = call noundef i32 @_ZN11index_btree16insert_into_leafE10glob_paramP7bt_nodemP8itemid_t(ptr noundef nonnull align 8 dereferenceable(56) %0, i64 %10, ptr noundef %54, i64 noundef %1, ptr noundef %2)
  br label %56

56:                                               ; preds = %53, %56
  %indvars.iv53 = phi i64 [ 0, %53 ], [ %indvars.iv.next54, %56 ]
  %57 = getelementptr inbounds [100 x ptr], ptr %5, i64 0, i64 %indvars.iv53
  %58 = load ptr, ptr %57, align 8, !tbaa !5
  %59 = call noundef i32 @_ZN11index_btree13release_latchEP7bt_node(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef %58)
  %indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
  %exitcond57.not = icmp eq i64 %indvars.iv.next54, %.1
  br i1 %exitcond57.not, label %.loopexit, label %56, !llvm.loop !21

60:                                               ; preds = %50
  %61 = call noundef i32 @_ZN11index_btree15split_lf_insertE10glob_paramP7bt_nodemP8itemid_t(ptr noundef nonnull align 8 dereferenceable(56) %0, i64 %10, ptr noundef %.pre, i64 noundef %1, ptr noundef %2)
  br label %62

62:                                               ; preds = %60, %62
  %indvars.iv49 = phi i64 [ 0, %60 ], [ %indvars.iv.next50, %62 ]
  %63 = getelementptr inbounds [100 x ptr], ptr %5, i64 0, i64 %indvars.iv49
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = call noundef i32 @_ZN11index_btree13release_latchEP7bt_node(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef %64)
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %exitcond52.not = icmp eq i64 %indvars.iv.next50, %.1
  br i1 %exitcond52.not, label %.loopexit, label %62, !llvm.loop !22

.loopexit:                                        ; preds = %62, %56
  %.032 = phi i32 [ %55, %56 ], [ %61, %62 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %5) #5
  ret i32 %.032
}

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

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 = { 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 #4 = { noreturn nounwind }
attributes #5 = { 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 24}
!10 = !{!"_ZTS7bt_node", !6, i64 0, !11, i64 8, !6, i64 16, !6, i64 24, !12, i64 32, !6, i64 40, !11, i64 48, !7, i64 56, !13, i64 96, !12, i64 100}
!11 = !{!"bool", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ZTS7latch_t", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!10, !12, i64 32}
!17 = !{!18, !12, i64 24}
!18 = !{!"_ZTS11index_btree", !19, i64 0, !20, i64 16, !12, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!19 = !{!"_ZTS10index_base", !6, i64 8}
!20 = !{!"long", !7, i64 0}
!21 = distinct !{!21, !15}
!22 = distinct !{!22, !15}


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