; LLVM IR from seppo0010/rlite :: src (page_btree)

; 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.rl_btree_node = type { ptr, ptr, ptr, i64 }
%struct.rl_btree = type { ptr, i64, i64, ptr, i64, i64 }

; 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: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #1

declare i32 @get_4bytes(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @rl_btree_node_create(ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local i32 @rl_btree_node_destroy(ptr 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) #5

declare double @get_double(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_btree_node_deserialize_hash_sha1_double(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #3 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %15, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store ptr null, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store i64 4, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = load ptr, ptr %9, align 8, !tbaa !5
  %18 = call i32 @rl_btree_node_create(ptr noundef %16, ptr noundef %17, ptr noundef %10)
  store i32 %18, ptr %14, align 4, !tbaa !11
  %19 = load i32, ptr %14, align 4, !tbaa !11
  %20 = icmp ne i32 0, %19
  br i1 %20, label %21, label %22

21:                                               ; preds = %4
  br label %167

22:                                               ; preds = %4
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = call i32 @get_4bytes(ptr noundef %23)
  %25 = sext i32 %24 to i64
  %26 = load ptr, ptr %10, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.rl_btree_node, ptr %26, i32 0, i32 3
  store i64 %25, ptr %27, align 8, !tbaa !13
  store i64 0, ptr %11, align 8, !tbaa !9
  br label %28

28:                                               ; preds = %144, %22
  %29 = load i64, ptr %11, align 8, !tbaa !9
  %30 = load ptr, ptr %10, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.rl_btree_node, ptr %30, i32 0, i32 3
  %32 = load i64, ptr %31, align 8, !tbaa !13
  %33 = icmp slt i64 %29, %32
  br i1 %33, label %34, label %147

34:                                               ; preds = %28
  %35 = call noalias ptr @malloc(i64 noundef 20) #7
  %36 = load ptr, ptr %10, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.rl_btree_node, ptr %36, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !15
  %39 = load i64, ptr %11, align 8, !tbaa !9
  %40 = getelementptr inbounds ptr, ptr %38, i64 %39
  store ptr %35, ptr %40, align 8, !tbaa !5
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.rl_btree_node, ptr %41, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !15
  %44 = load i64, ptr %11, align 8, !tbaa !9
  %45 = getelementptr inbounds ptr, ptr %43, i64 %44
  %46 = load ptr, ptr %45, align 8, !tbaa !5
  %47 = icmp ne ptr %46, null
  br i1 %47, label %52, label %48

48:                                               ; preds = %34
  %49 = load i64, ptr %11, align 8, !tbaa !9
  %50 = load ptr, ptr %10, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.rl_btree_node, ptr %50, i32 0, i32 3
  store i64 %49, ptr %51, align 8, !tbaa !13
  store i32 4, ptr %14, align 4, !tbaa !11
  br label %167

52:                                               ; preds = %34
  %53 = load ptr, ptr %10, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.rl_btree_node, ptr %53, i32 0, i32 0
  %55 = load ptr, ptr %54, align 8, !tbaa !15
  %56 = load i64, ptr %11, align 8, !tbaa !9
  %57 = getelementptr inbounds ptr, ptr %55, i64 %56
  %58 = load ptr, ptr %57, align 8, !tbaa !5
  %59 = load ptr, ptr %8, align 8, !tbaa !5
  %60 = load i64, ptr %12, align 8, !tbaa !9
  %61 = getelementptr inbounds i8, ptr %59, i64 %60
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %58, ptr align 1 %61, i64 20, i1 false)
  %62 = call noalias ptr @malloc(i64 noundef 8) #7
  %63 = load ptr, ptr %10, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.rl_btree_node, ptr %63, i32 0, i32 2
  %65 = load ptr, ptr %64, align 8, !tbaa !16
  %66 = load i64, ptr %11, align 8, !tbaa !9
  %67 = getelementptr inbounds ptr, ptr %65, i64 %66
  store ptr %62, ptr %67, align 8, !tbaa !5
  %68 = load ptr, ptr %10, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.rl_btree_node, ptr %68, i32 0, i32 2
  %70 = load ptr, ptr %69, align 8, !tbaa !16
  %71 = load i64, ptr %11, align 8, !tbaa !9
  %72 = getelementptr inbounds ptr, ptr %70, i64 %71
  %73 = load ptr, ptr %72, align 8, !tbaa !5
  %74 = icmp ne ptr %73, null
  br i1 %74, label %85, label %75

75:                                               ; preds = %52
  %76 = load ptr, ptr %10, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.rl_btree_node, ptr %76, i32 0, i32 0
  %78 = load ptr, ptr %77, align 8, !tbaa !15
  %79 = load i64, ptr %11, align 8, !tbaa !9
  %80 = getelementptr inbounds ptr, ptr %78, i64 %79
  %81 = load ptr, ptr %80, align 8, !tbaa !5
  call void @free(ptr noundef %81) #6
  %82 = load i64, ptr %11, align 8, !tbaa !9
  %83 = load ptr, ptr %10, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.rl_btree_node, ptr %83, i32 0, i32 3
  store i64 %82, ptr %84, align 8, !tbaa !13
  store i32 4, ptr %14, align 4, !tbaa !11
  br label %167

85:                                               ; preds = %52
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  %87 = load i64, ptr %12, align 8, !tbaa !9
  %88 = add nsw i64 %87, 20
  %89 = getelementptr inbounds i8, ptr %86, i64 %88
  %90 = call double @get_double(ptr noundef %89)
  %91 = load ptr, ptr %10, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.rl_btree_node, ptr %91, i32 0, i32 2
  %93 = load ptr, ptr %92, align 8, !tbaa !16
  %94 = load i64, ptr %11, align 8, !tbaa !9
  %95 = getelementptr inbounds ptr, ptr %93, i64 %94
  %96 = load ptr, ptr %95, align 8, !tbaa !5
  store double %90, ptr %96, align 8, !tbaa !17
  %97 = load ptr, ptr %8, align 8, !tbaa !5
  %98 = load i64, ptr %12, align 8, !tbaa !9
  %99 = add nsw i64 %98, 28
  %100 = getelementptr inbounds i8, ptr %97, i64 %99
  %101 = call i32 @get_4bytes(ptr noundef %100)
  %102 = sext i32 %101 to i64
  store i64 %102, ptr %13, align 8, !tbaa !9
  %103 = load i64, ptr %13, align 8, !tbaa !9
  %104 = icmp ne i64 %103, 0
  br i1 %104, label %105, label %141

105:                                              ; preds = %85
  %106 = load ptr, ptr %10, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.rl_btree_node, ptr %106, i32 0, i32 1
  %108 = load ptr, ptr %107, align 8, !tbaa !19
  %109 = icmp ne ptr %108, null
  br i1 %109, label %134, label %110

110:                                              ; preds = %105
  %111 = load ptr, ptr %9, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.rl_btree, ptr %111, i32 0, i32 1
  %113 = load i64, ptr %112, align 8, !tbaa !20
  %114 = add nsw i64 %113, 1
  %115 = mul i64 8, %114
  %116 = call noalias ptr @malloc(i64 noundef %115) #7
  %117 = load ptr, ptr %10, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.rl_btree_node, ptr %117, i32 0, i32 1
  store ptr %116, ptr %118, align 8, !tbaa !19
  %119 = load ptr, ptr %10, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.rl_btree_node, ptr %119, i32 0, i32 1
  %121 = load ptr, ptr %120, align 8, !tbaa !19
  %122 = icmp ne ptr %121, null
  br i1 %122, label %133, label %123

123:                                              ; preds = %110
  %124 = load ptr, ptr %10, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.rl_btree_node, ptr %124, i32 0, i32 0
  %126 = load ptr, ptr %125, align 8, !tbaa !15
  %127 = load i64, ptr %11, align 8, !tbaa !9
  %128 = getelementptr inbounds ptr, ptr %126, i64 %127
  %129 = load ptr, ptr %128, align 8, !tbaa !5
  call void @free(ptr noundef %129) #6
  %130 = load i64, ptr %11, align 8, !tbaa !9
  %131 = load ptr, ptr %10, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.rl_btree_node, ptr %131, i32 0, i32 3
  store i64 %130, ptr %132, align 8, !tbaa !13
  store i32 4, ptr %14, align 4, !tbaa !11
  br label %167

133:                                              ; preds = %110
  br label %134

134:                                              ; preds = %133, %105
  %135 = load i64, ptr %13, align 8, !tbaa !9
  %136 = load ptr, ptr %10, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.rl_btree_node, ptr %136, i32 0, i32 1
  %138 = load ptr, ptr %137, align 8, !tbaa !19
  %139 = load i64, ptr %11, align 8, !tbaa !9
  %140 = getelementptr inbounds i64, ptr %138, i64 %139
  store i64 %135, ptr %140, align 8, !tbaa !9
  br label %141

141:                                              ; preds = %134, %85
  %142 = load i64, ptr %12, align 8, !tbaa !9
  %143 = add nsw i64 %142, 32
  store i64 %143, ptr %12, align 8, !tbaa !9
  br label %144

144:                                              ; preds = %141
  %145 = load i64, ptr %11, align 8, !tbaa !9
  %146 = add nsw i64 %145, 1
  store i64 %146, ptr %11, align 8, !tbaa !9
  br label %28, !llvm.loop !22

147:                                              ; preds = %28
  %148 = load ptr, ptr %8, align 8, !tbaa !5
  %149 = load i64, ptr %12, align 8, !tbaa !9
  %150 = getelementptr inbounds i8, ptr %148, i64 %149
  %151 = call i32 @get_4bytes(ptr noundef %150)
  %152 = sext i32 %151 to i64
  store i64 %152, ptr %13, align 8, !tbaa !9
  %153 = load i64, ptr %13, align 8, !tbaa !9
  %154 = icmp ne i64 %153, 0
  br i1 %154, label %155, label %164

155:                                              ; preds = %147
  %156 = load i64, ptr %13, align 8, !tbaa !9
  %157 = load ptr, ptr %10, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.rl_btree_node, ptr %157, i32 0, i32 1
  %159 = load ptr, ptr %158, align 8, !tbaa !19
  %160 = load ptr, ptr %10, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.rl_btree_node, ptr %160, i32 0, i32 3
  %162 = load i64, ptr %161, align 8, !tbaa !13
  %163 = getelementptr inbounds i64, ptr %159, i64 %162
  store i64 %156, ptr %163, align 8, !tbaa !9
  br label %164

164:                                              ; preds = %155, %147
  %165 = load ptr, ptr %10, align 8, !tbaa !5
  %166 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %165, ptr %166, align 8, !tbaa !5
  br label %167

167:                                              ; preds = %164, %123, %75, %48, %21
  %168 = load i32, ptr %14, align 4, !tbaa !11
  %169 = icmp ne i32 %168, 0
  br i1 %169, label %170, label %177

170:                                              ; preds = %167
  %171 = load ptr, ptr %10, align 8, !tbaa !5
  %172 = icmp ne ptr %171, null
  br i1 %172, label %173, label %177

173:                                              ; preds = %170
  %174 = load ptr, ptr %5, align 8, !tbaa !5
  %175 = load ptr, ptr %10, align 8, !tbaa !5
  %176 = call i32 @rl_btree_node_destroy(ptr noundef %174, ptr noundef %175)
  br label %177

177:                                              ; preds = %173, %170, %167
  %178 = load i32, ptr %14, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  ret i32 %178
}

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

!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/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 24}
!14 = !{!"rl_btree_node", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24}
!15 = !{!14, !6, i64 0}
!16 = !{!14, !6, i64 16}
!17 = !{!18, !18, i64 0}
!18 = !{!"double", !7, i64 0}
!19 = !{!14, !6, i64 8}
!20 = !{!21, !10, i64 8}
!21 = !{!"rl_btree", !6, i64 0, !10, i64 8, !10, i64 16, !6, i64 24, !10, i64 32, !10, i64 40}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


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

; 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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

declare i32 @get_4bytes(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @rl_btree_node_create(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare dso_local i32 @rl_btree_node_destroy(ptr 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) #5

declare double @get_double(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_btree_node_deserialize_hash_sha1_double(ptr noundef %0, ptr nocapture noundef writeonly %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #3 {
  %5 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  store ptr null, ptr %5, align 8, !tbaa !5
  %6 = call i32 @rl_btree_node_create(ptr noundef %0, ptr noundef %2, ptr noundef nonnull %5)
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %7, label %81

7:                                                ; preds = %4
  %8 = call i32 @get_4bytes(ptr noundef %3) #6
  %9 = sext i32 %8 to i64
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %10, i64 24
  store i64 %9, ptr %11, align 8, !tbaa !9
  %12 = icmp sgt i32 %8, 0
  br i1 %12, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %7
  %13 = getelementptr inbounds i8, ptr %2, i64 8
  br label %14

14:                                               ; preds = %.lr.ph, %66
  %15 = phi ptr [ %10, %.lr.ph ], [ %.pre, %66 ]
  %.03766 = phi i64 [ 4, %.lr.ph ], [ %67, %66 ]
  %.03865 = phi i64 [ 0, %.lr.ph ], [ %68, %66 ]
  %16 = call noalias dereferenceable_or_null(20) ptr @malloc(i64 noundef 20) #7
  %17 = load ptr, ptr %15, align 8, !tbaa !12
  %18 = getelementptr inbounds ptr, ptr %17, i64 %.03865
  store ptr %16, ptr %18, align 8, !tbaa !5
  %19 = load ptr, ptr %5, align 8
  %20 = load ptr, ptr %19, align 8, !tbaa !12
  %21 = getelementptr inbounds ptr, ptr %20, i64 %.03865
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  %.not45 = icmp eq ptr %22, null
  br i1 %.not45, label %.thread81.sink.split, label %23

23:                                               ; preds = %14
  %24 = getelementptr inbounds i8, ptr %3, i64 %.03766
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(20) %22, ptr noundef nonnull align 1 dereferenceable(20) %24, i64 20, i1 false)
  %25 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #7
  %26 = getelementptr inbounds i8, ptr %19, i64 16
  %27 = load ptr, ptr %26, align 8, !tbaa !13
  %28 = getelementptr inbounds ptr, ptr %27, i64 %.03865
  store ptr %25, ptr %28, align 8, !tbaa !5
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %29, i64 16
  %31 = load ptr, ptr %30, align 8, !tbaa !13
  %32 = getelementptr inbounds ptr, ptr %31, i64 %.03865
  %33 = load ptr, ptr %32, align 8, !tbaa !5
  %.not46 = icmp eq ptr %33, null
  br i1 %.not46, label %34, label %39

34:                                               ; preds = %23
  %35 = load ptr, ptr %29, align 8, !tbaa !12
  %36 = getelementptr inbounds ptr, ptr %35, i64 %.03865
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  call void @free(ptr noundef %37) #6
  %38 = load ptr, ptr %5, align 8
  br label %.thread81.sink.split

39:                                               ; preds = %23
  %40 = getelementptr inbounds i8, ptr %24, i64 20
  %41 = call double @get_double(ptr noundef nonnull %40) #6
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds i8, ptr %42, i64 16
  %44 = load ptr, ptr %43, align 8, !tbaa !13
  %45 = getelementptr inbounds ptr, ptr %44, i64 %.03865
  %46 = load ptr, ptr %45, align 8, !tbaa !5
  store double %41, ptr %46, align 8, !tbaa !14
  %47 = getelementptr inbounds i8, ptr %24, i64 28
  %48 = call i32 @get_4bytes(ptr noundef nonnull %47) #6
  %49 = sext i32 %48 to i64
  %.not47 = icmp eq i32 %48, 0
  %.pre = load ptr, ptr %5, align 8, !tbaa !5
  br i1 %.not47, label %66, label %50

50:                                               ; preds = %39
  %51 = getelementptr inbounds i8, ptr %.pre, i64 8
  %52 = load ptr, ptr %51, align 8, !tbaa !16
  %.not48 = icmp eq ptr %52, null
  br i1 %.not48, label %53, label %63

53:                                               ; preds = %50
  %54 = load i64, ptr %13, align 8, !tbaa !17
  %55 = shl i64 %54, 3
  %56 = add i64 %55, 8
  %57 = call noalias ptr @malloc(i64 noundef %56) #7
  store ptr %57, ptr %51, align 8, !tbaa !16
  %.not49 = icmp eq ptr %57, null
  br i1 %.not49, label %58, label %63

58:                                               ; preds = %53
  %59 = load ptr, ptr %.pre, align 8, !tbaa !12
  %60 = getelementptr inbounds ptr, ptr %59, i64 %.03865
  %61 = load ptr, ptr %60, align 8, !tbaa !5
  call void @free(ptr noundef %61) #6
  %62 = load ptr, ptr %5, align 8
  br label %.thread81.sink.split

63:                                               ; preds = %53, %50
  %64 = phi ptr [ %57, %53 ], [ %52, %50 ]
  %65 = getelementptr inbounds i64, ptr %64, i64 %.03865
  store i64 %49, ptr %65, align 8, !tbaa !19
  br label %66

66:                                               ; preds = %63, %39
  %67 = add nuw nsw i64 %.03766, 32
  %68 = add nuw nsw i64 %.03865, 1
  %69 = getelementptr inbounds i8, ptr %.pre, i64 24
  %70 = load i64, ptr %69, align 8, !tbaa !9
  %71 = icmp slt i64 %68, %70
  br i1 %71, label %14, label %._crit_edge, !llvm.loop !20

._crit_edge:                                      ; preds = %66, %7
  %.037.lcssa = phi i64 [ 4, %7 ], [ %67, %66 ]
  %72 = getelementptr inbounds i8, ptr %3, i64 %.037.lcssa
  %73 = call i32 @get_4bytes(ptr noundef nonnull %72) #6
  %.not44 = icmp eq i32 %73, 0
  %.pre78 = load ptr, ptr %5, align 8, !tbaa !5
  br i1 %.not44, label %.thread, label %74

74:                                               ; preds = %._crit_edge
  %75 = sext i32 %73 to i64
  %76 = getelementptr inbounds i8, ptr %.pre78, i64 8
  %77 = load ptr, ptr %76, align 8, !tbaa !16
  %78 = getelementptr inbounds i8, ptr %.pre78, i64 24
  %79 = load i64, ptr %78, align 8, !tbaa !9
  %80 = getelementptr inbounds i64, ptr %77, i64 %79
  store i64 %75, ptr %80, align 8, !tbaa !19
  br label %.thread

.thread:                                          ; preds = %._crit_edge, %74
  store ptr %.pre78, ptr %1, align 8, !tbaa !5
  br label %85

81:                                               ; preds = %4
  %.pre80 = load ptr, ptr %5, align 8
  %.not53 = icmp eq ptr %.pre80, null
  br i1 %.not53, label %85, label %.thread81

.thread81.sink.split:                             ; preds = %14, %58, %34
  %.lcssa.sink = phi ptr [ %38, %34 ], [ %62, %58 ], [ %19, %14 ]
  %82 = getelementptr inbounds i8, ptr %.lcssa.sink, i64 24
  store i64 %.03865, ptr %82, align 8, !tbaa !9
  br label %.thread81

.thread81:                                        ; preds = %.thread81.sink.split, %81
  %.084 = phi i32 [ %6, %81 ], [ 4, %.thread81.sink.split ]
  %83 = phi ptr [ %.pre80, %81 ], [ %.lcssa.sink, %.thread81.sink.split ]
  %84 = call i32 @rl_btree_node_destroy(ptr noundef %0, ptr noundef nonnull %83)
  br label %85

85:                                               ; preds = %.thread, %.thread81, %81
  %.052 = phi i32 [ 0, %.thread ], [ %.084, %.thread81 ], [ %6, %81 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  ret i32 %.052
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { "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 = { 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 #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

!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/C++ TBAA"}
!9 = !{!10, !11, i64 24}
!10 = !{!"rl_btree_node", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24}
!11 = !{!"long", !7, i64 0}
!12 = !{!10, !6, i64 0}
!13 = !{!10, !6, i64 16}
!14 = !{!15, !15, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = !{!10, !6, i64 8}
!17 = !{!18, !11, i64 8}
!18 = !{!"rl_btree", !6, i64 0, !11, i64 8, !11, i64 16, !6, i64 24, !11, i64 32, !11, i64 40}
!19 = !{!11, !11, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


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