; 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

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_btree_node_deserialize_hash_sha1_long(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 %168

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 = %145, %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 %148

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 %168

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 %168

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 = fptosi double %90 to i64
  %92 = load ptr, ptr %10, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.rl_btree_node, ptr %92, i32 0, i32 2
  %94 = load ptr, ptr %93, align 8, !tbaa !16
  %95 = load i64, ptr %11, align 8, !tbaa !9
  %96 = getelementptr inbounds ptr, ptr %94, i64 %95
  %97 = load ptr, ptr %96, align 8, !tbaa !5
  store i64 %91, ptr %97, align 8, !tbaa !9
  %98 = load ptr, ptr %8, align 8, !tbaa !5
  %99 = load i64, ptr %12, align 8, !tbaa !9
  %100 = add nsw i64 %99, 24
  %101 = getelementptr inbounds i8, ptr %98, i64 %100
  %102 = call i32 @get_4bytes(ptr noundef %101)
  %103 = sext i32 %102 to i64
  store i64 %103, ptr %13, align 8, !tbaa !9
  %104 = load i64, ptr %13, align 8, !tbaa !9
  %105 = icmp ne i64 %104, 0
  br i1 %105, label %106, label %142

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

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

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

134:                                              ; preds = %111
  br label %135

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

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

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

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

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

165:                                              ; preds = %156, %148
  %166 = load ptr, ptr %10, align 8, !tbaa !5
  %167 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %166, ptr %167, align 8, !tbaa !5
  br label %168

168:                                              ; preds = %165, %124, %75, %48, %21
  %169 = load i32, ptr %14, align 4, !tbaa !11
  %170 = icmp ne i32 %169, 0
  br i1 %170, label %171, label %178

171:                                              ; preds = %168
  %172 = load ptr, ptr %10, align 8, !tbaa !5
  %173 = icmp ne ptr %172, null
  br i1 %173, label %174, label %178

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

178:                                              ; preds = %174, %171, %168
  %179 = 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 %179
}

declare double @get_double(ptr noundef) #2

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 = !{!14, !6, i64 8}
!18 = !{!19, !10, i64 8}
!19 = !{!"rl_btree", !6, i64 0, !10, i64 8, !10, i64 16, !6, i64 24, !10, i64 32, !10, i64 40}
!20 = distinct !{!20, !21}
!21 = !{!"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

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_btree_node_deserialize_hash_sha1_long(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 %82

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, %67
  %15 = phi ptr [ %10, %.lr.ph ], [ %.pre, %67 ]
  %.03766 = phi i64 [ 4, %.lr.ph ], [ %68, %67 ]
  %.03865 = phi i64 [ 0, %.lr.ph ], [ %69, %67 ]
  %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 = fptosi double %41 to i64
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %43, i64 16
  %45 = load ptr, ptr %44, align 8, !tbaa !13
  %46 = getelementptr inbounds ptr, ptr %45, i64 %.03865
  %47 = load ptr, ptr %46, align 8, !tbaa !5
  store i64 %42, ptr %47, align 8, !tbaa !14
  %48 = getelementptr inbounds i8, ptr %24, i64 24
  %49 = call i32 @get_4bytes(ptr noundef nonnull %48) #6
  %50 = sext i32 %49 to i64
  %.not47 = icmp eq i32 %49, 0
  %.pre = load ptr, ptr %5, align 8, !tbaa !5
  br i1 %.not47, label %67, label %51

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

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

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

64:                                               ; preds = %54, %51
  %65 = phi ptr [ %58, %54 ], [ %53, %51 ]
  %66 = getelementptr inbounds i64, ptr %65, i64 %.03865
  store i64 %50, ptr %66, align 8, !tbaa !14
  br label %67

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

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

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

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

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

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

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

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

declare double @get_double(ptr noundef) local_unnamed_addr #2

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 = !{!11, !11, i64 0}
!15 = !{!10, !6, i64 8}
!16 = !{!17, !11, i64 8}
!17 = !{!"rl_btree", !6, i64 0, !11, i64 8, !11, i64 16, !6, i64 24, !11, i64 32, !11, i64 40}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


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