; 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_key = type { i8, i64, i64, i64, 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_key(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 i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  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
  store ptr null, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %16, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = load ptr, ptr %10, align 8, !tbaa !5
  %19 = call i32 @rl_btree_node_create(ptr noundef %17, ptr noundef %18, ptr noundef %9)
  store i32 %19, ptr %11, align 4, !tbaa !9
  %20 = load i32, ptr %11, align 4, !tbaa !9
  %21 = icmp ne i32 0, %20
  br i1 %21, label %22, label %23

22:                                               ; preds = %4
  br label %201

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

29:                                               ; preds = %178, %23
  %30 = load i64, ptr %12, align 8, !tbaa !14
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.rl_btree_node, ptr %31, i32 0, i32 3
  %33 = load i64, ptr %32, align 8, !tbaa !11
  %34 = icmp slt i64 %30, %33
  br i1 %34, label %35, label %181

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

49:                                               ; preds = %35
  %50 = load i64, ptr %12, align 8, !tbaa !14
  %51 = load ptr, ptr %9, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.rl_btree_node, ptr %51, i32 0, i32 3
  store i64 %50, ptr %52, align 8, !tbaa !11
  store i32 4, ptr %11, align 4, !tbaa !9
  br label %201

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

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

86:                                               ; preds = %53
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  %88 = load i64, ptr %13, align 8, !tbaa !14
  %89 = add nsw i64 %88, 20
  %90 = getelementptr inbounds i8, ptr %87, i64 %89
  %91 = load i8, ptr %90, align 1, !tbaa !17
  %92 = load ptr, ptr %15, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.rl_key, ptr %92, i32 0, i32 0
  store i8 %91, ptr %93, align 8, !tbaa !18
  %94 = load ptr, ptr %8, align 8, !tbaa !5
  %95 = load i64, ptr %13, align 8, !tbaa !14
  %96 = add nsw i64 %95, 21
  %97 = getelementptr inbounds i8, ptr %94, i64 %96
  %98 = call i32 @get_4bytes(ptr noundef %97)
  %99 = sext i32 %98 to i64
  %100 = load ptr, ptr %15, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.rl_key, ptr %100, i32 0, i32 1
  store i64 %99, ptr %101, align 8, !tbaa !21
  %102 = load ptr, ptr %8, align 8, !tbaa !5
  %103 = load i64, ptr %13, align 8, !tbaa !14
  %104 = add nsw i64 %103, 25
  %105 = getelementptr inbounds i8, ptr %102, i64 %104
  %106 = call i32 @get_4bytes(ptr noundef %105)
  %107 = sext i32 %106 to i64
  %108 = load ptr, ptr %15, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.rl_key, ptr %108, i32 0, i32 2
  store i64 %107, ptr %109, align 8, !tbaa !22
  %110 = load ptr, ptr %8, align 8, !tbaa !5
  %111 = load i64, ptr %13, align 8, !tbaa !14
  %112 = add nsw i64 %111, 29
  %113 = getelementptr inbounds i8, ptr %110, i64 %112
  %114 = call i64 @get_8bytes(ptr noundef %113)
  %115 = load ptr, ptr %15, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.rl_key, ptr %115, i32 0, i32 3
  store i64 %114, ptr %116, align 8, !tbaa !23
  %117 = load ptr, ptr %8, align 8, !tbaa !5
  %118 = load i64, ptr %13, align 8, !tbaa !14
  %119 = add nsw i64 %118, 37
  %120 = getelementptr inbounds i8, ptr %117, i64 %119
  %121 = call i32 @get_4bytes(ptr noundef %120)
  %122 = sext i32 %121 to i64
  %123 = load ptr, ptr %15, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.rl_key, ptr %123, i32 0, i32 4
  store i64 %122, ptr %124, align 8, !tbaa !24
  %125 = load ptr, ptr %8, align 8, !tbaa !5
  %126 = load i64, ptr %13, align 8, !tbaa !14
  %127 = add nsw i64 %126, 41
  %128 = getelementptr inbounds i8, ptr %125, i64 %127
  %129 = call i32 @get_4bytes(ptr noundef %128)
  %130 = sext i32 %129 to i64
  store i64 %130, ptr %14, align 8, !tbaa !14
  %131 = load i64, ptr %14, align 8, !tbaa !14
  %132 = icmp ne i64 %131, 0
  br i1 %132, label %133, label %175

133:                                              ; preds = %86
  %134 = load ptr, ptr %9, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.rl_btree_node, ptr %134, i32 0, i32 1
  %136 = load ptr, ptr %135, align 8, !tbaa !25
  %137 = icmp ne ptr %136, null
  br i1 %137, label %168, label %138

138:                                              ; preds = %133
  %139 = load ptr, ptr %10, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.rl_btree, ptr %139, i32 0, i32 1
  %141 = load i64, ptr %140, align 8, !tbaa !26
  %142 = add nsw i64 %141, 1
  %143 = mul i64 8, %142
  %144 = call noalias ptr @malloc(i64 noundef %143) #7
  %145 = load ptr, ptr %9, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.rl_btree_node, ptr %145, i32 0, i32 1
  store ptr %144, ptr %146, align 8, !tbaa !25
  %147 = load ptr, ptr %9, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.rl_btree_node, ptr %147, i32 0, i32 1
  %149 = load ptr, ptr %148, align 8, !tbaa !25
  %150 = icmp ne ptr %149, null
  br i1 %150, label %167, label %151

151:                                              ; preds = %138
  %152 = load ptr, ptr %9, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.rl_btree_node, ptr %152, i32 0, i32 0
  %154 = load ptr, ptr %153, align 8, !tbaa !15
  %155 = load i64, ptr %12, align 8, !tbaa !14
  %156 = getelementptr inbounds ptr, ptr %154, i64 %155
  %157 = load ptr, ptr %156, align 8, !tbaa !5
  call void @free(ptr noundef %157) #6
  %158 = load ptr, ptr %9, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.rl_btree_node, ptr %158, i32 0, i32 2
  %160 = load ptr, ptr %159, align 8, !tbaa !16
  %161 = load i64, ptr %12, align 8, !tbaa !14
  %162 = getelementptr inbounds ptr, ptr %160, i64 %161
  %163 = load ptr, ptr %162, align 8, !tbaa !5
  call void @free(ptr noundef %163) #6
  %164 = load i64, ptr %12, align 8, !tbaa !14
  %165 = load ptr, ptr %9, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.rl_btree_node, ptr %165, i32 0, i32 3
  store i64 %164, ptr %166, align 8, !tbaa !11
  store i32 4, ptr %11, align 4, !tbaa !9
  br label %201

167:                                              ; preds = %138
  br label %168

168:                                              ; preds = %167, %133
  %169 = load i64, ptr %14, align 8, !tbaa !14
  %170 = load ptr, ptr %9, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.rl_btree_node, ptr %170, i32 0, i32 1
  %172 = load ptr, ptr %171, align 8, !tbaa !25
  %173 = load i64, ptr %12, align 8, !tbaa !14
  %174 = getelementptr inbounds i64, ptr %172, i64 %173
  store i64 %169, ptr %174, align 8, !tbaa !14
  br label %175

175:                                              ; preds = %168, %86
  %176 = load i64, ptr %13, align 8, !tbaa !14
  %177 = add nsw i64 %176, 45
  store i64 %177, ptr %13, align 8, !tbaa !14
  br label %178

178:                                              ; preds = %175
  %179 = load i64, ptr %12, align 8, !tbaa !14
  %180 = add nsw i64 %179, 1
  store i64 %180, ptr %12, align 8, !tbaa !14
  br label %29, !llvm.loop !28

181:                                              ; preds = %29
  %182 = load ptr, ptr %8, align 8, !tbaa !5
  %183 = load i64, ptr %13, align 8, !tbaa !14
  %184 = getelementptr inbounds i8, ptr %182, i64 %183
  %185 = call i32 @get_4bytes(ptr noundef %184)
  %186 = sext i32 %185 to i64
  store i64 %186, ptr %14, align 8, !tbaa !14
  %187 = load i64, ptr %14, align 8, !tbaa !14
  %188 = icmp ne i64 %187, 0
  br i1 %188, label %189, label %198

189:                                              ; preds = %181
  %190 = load i64, ptr %14, align 8, !tbaa !14
  %191 = load ptr, ptr %9, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.rl_btree_node, ptr %191, i32 0, i32 1
  %193 = load ptr, ptr %192, align 8, !tbaa !25
  %194 = load ptr, ptr %9, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.rl_btree_node, ptr %194, i32 0, i32 3
  %196 = load i64, ptr %195, align 8, !tbaa !11
  %197 = getelementptr inbounds i64, ptr %193, i64 %196
  store i64 %190, ptr %197, align 8, !tbaa !14
  br label %198

198:                                              ; preds = %189, %181
  %199 = load ptr, ptr %9, align 8, !tbaa !5
  %200 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %199, ptr %200, align 8, !tbaa !5
  br label %201

201:                                              ; preds = %198, %151, %76, %49, %22
  %202 = load i32, ptr %11, align 4, !tbaa !9
  %203 = icmp ne i32 %202, 0
  br i1 %203, label %204, label %211

204:                                              ; preds = %201
  %205 = load ptr, ptr %9, align 8, !tbaa !5
  %206 = icmp ne ptr %205, null
  br i1 %206, label %207, label %211

207:                                              ; preds = %204
  %208 = load ptr, ptr %5, align 8, !tbaa !5
  %209 = load ptr, ptr %9, align 8, !tbaa !5
  %210 = call i32 @rl_btree_node_destroy(ptr noundef %208, ptr noundef %209)
  br label %211

211:                                              ; preds = %207, %204, %201
  %212 = load i32, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, 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 %212
}

declare i64 @get_8bytes(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 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 24}
!12 = !{!"rl_btree_node", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24}
!13 = !{!"long", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = !{!12, !6, i64 0}
!16 = !{!12, !6, i64 16}
!17 = !{!7, !7, i64 0}
!18 = !{!19, !7, i64 0}
!19 = !{!"rl_key", !7, i64 0, !13, i64 8, !13, i64 16, !20, i64 24, !13, i64 32}
!20 = !{!"long long", !7, i64 0}
!21 = !{!19, !13, i64 8}
!22 = !{!19, !13, i64 16}
!23 = !{!19, !20, i64 24}
!24 = !{!19, !13, i64 32}
!25 = !{!12, !6, i64 8}
!26 = !{!27, !13, i64 8}
!27 = !{!"rl_btree", !6, i64 0, !13, i64 8, !13, i64 16, !6, i64 24, !13, i64 32, !13, i64 40}
!28 = distinct !{!28, !29}
!29 = !{!"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_key(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 %96

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, %81
  %15 = phi ptr [ %10, %.lr.ph ], [ %.pre, %81 ]
  %.05079 = phi i64 [ 4, %.lr.ph ], [ %82, %81 ]
  %.05178 = phi i64 [ 0, %.lr.ph ], [ %83, %81 ]
  %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 %.05178
  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 %.05178
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  %.not58 = icmp eq ptr %22, null
  br i1 %.not58, label %.thread94.sink.split, label %23

23:                                               ; preds = %14
  %24 = getelementptr inbounds i8, ptr %3, i64 %.05079
  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(40) ptr @malloc(i64 noundef 40) #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 %.05178
  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 %.05178
  %33 = load ptr, ptr %32, align 8, !tbaa !5
  %.not59 = icmp eq ptr %33, null
  br i1 %.not59, label %34, label %39

34:                                               ; preds = %23
  %35 = load ptr, ptr %29, align 8, !tbaa !12
  %36 = getelementptr inbounds ptr, ptr %35, i64 %.05178
  %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 %.thread94.sink.split

39:                                               ; preds = %23
  %40 = getelementptr inbounds i8, ptr %24, i64 20
  %41 = load i8, ptr %40, align 1, !tbaa !14
  store i8 %41, ptr %25, align 8, !tbaa !15
  %42 = getelementptr inbounds i8, ptr %24, i64 21
  %43 = call i32 @get_4bytes(ptr noundef nonnull %42) #6
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds i8, ptr %25, i64 8
  store i64 %44, ptr %45, align 8, !tbaa !18
  %46 = getelementptr inbounds i8, ptr %24, i64 25
  %47 = call i32 @get_4bytes(ptr noundef nonnull %46) #6
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds i8, ptr %25, i64 16
  store i64 %48, ptr %49, align 8, !tbaa !19
  %50 = getelementptr inbounds i8, ptr %24, i64 29
  %51 = call i64 @get_8bytes(ptr noundef nonnull %50) #6
  %52 = getelementptr inbounds i8, ptr %25, i64 24
  store i64 %51, ptr %52, align 8, !tbaa !20
  %53 = getelementptr inbounds i8, ptr %24, i64 37
  %54 = call i32 @get_4bytes(ptr noundef nonnull %53) #6
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i8, ptr %25, i64 32
  store i64 %55, ptr %56, align 8, !tbaa !21
  %57 = getelementptr inbounds i8, ptr %24, i64 41
  %58 = call i32 @get_4bytes(ptr noundef nonnull %57) #6
  %59 = sext i32 %58 to i64
  %.not60 = icmp eq i32 %58, 0
  %.pre = load ptr, ptr %5, align 8, !tbaa !5
  br i1 %.not60, label %81, label %60

60:                                               ; preds = %39
  %61 = getelementptr inbounds i8, ptr %.pre, i64 8
  %62 = load ptr, ptr %61, align 8, !tbaa !22
  %.not61 = icmp eq ptr %62, null
  br i1 %.not61, label %63, label %78

63:                                               ; preds = %60
  %64 = load i64, ptr %13, align 8, !tbaa !23
  %65 = shl i64 %64, 3
  %66 = add i64 %65, 8
  %67 = call noalias ptr @malloc(i64 noundef %66) #7
  store ptr %67, ptr %61, align 8, !tbaa !22
  %.not62 = icmp eq ptr %67, null
  br i1 %.not62, label %68, label %78

68:                                               ; preds = %63
  %69 = load ptr, ptr %.pre, align 8, !tbaa !12
  %70 = getelementptr inbounds ptr, ptr %69, i64 %.05178
  %71 = load ptr, ptr %70, align 8, !tbaa !5
  call void @free(ptr noundef %71) #6
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = getelementptr inbounds i8, ptr %72, i64 16
  %74 = load ptr, ptr %73, align 8, !tbaa !13
  %75 = getelementptr inbounds ptr, ptr %74, i64 %.05178
  %76 = load ptr, ptr %75, align 8, !tbaa !5
  call void @free(ptr noundef %76) #6
  %77 = load ptr, ptr %5, align 8
  br label %.thread94.sink.split

78:                                               ; preds = %63, %60
  %79 = phi ptr [ %67, %63 ], [ %62, %60 ]
  %80 = getelementptr inbounds i64, ptr %79, i64 %.05178
  store i64 %59, ptr %80, align 8, !tbaa !25
  br label %81

81:                                               ; preds = %78, %39
  %82 = add nuw nsw i64 %.05079, 45
  %83 = add nuw nsw i64 %.05178, 1
  %84 = getelementptr inbounds i8, ptr %.pre, i64 24
  %85 = load i64, ptr %84, align 8, !tbaa !9
  %86 = icmp slt i64 %83, %85
  br i1 %86, label %14, label %._crit_edge, !llvm.loop !26

._crit_edge:                                      ; preds = %81, %7
  %.050.lcssa = phi i64 [ 4, %7 ], [ %82, %81 ]
  %87 = getelementptr inbounds i8, ptr %3, i64 %.050.lcssa
  %88 = call i32 @get_4bytes(ptr noundef nonnull %87) #6
  %.not57 = icmp eq i32 %88, 0
  %.pre91 = load ptr, ptr %5, align 8, !tbaa !5
  br i1 %.not57, label %.thread, label %89

89:                                               ; preds = %._crit_edge
  %90 = sext i32 %88 to i64
  %91 = getelementptr inbounds i8, ptr %.pre91, i64 8
  %92 = load ptr, ptr %91, align 8, !tbaa !22
  %93 = getelementptr inbounds i8, ptr %.pre91, i64 24
  %94 = load i64, ptr %93, align 8, !tbaa !9
  %95 = getelementptr inbounds i64, ptr %92, i64 %94
  store i64 %90, ptr %95, align 8, !tbaa !25
  br label %.thread

.thread:                                          ; preds = %._crit_edge, %89
  store ptr %.pre91, ptr %1, align 8, !tbaa !5
  br label %100

96:                                               ; preds = %4
  %.pre93 = load ptr, ptr %5, align 8
  %.not66 = icmp eq ptr %.pre93, null
  br i1 %.not66, label %100, label %.thread94

.thread94.sink.split:                             ; preds = %14, %68, %34
  %.lcssa.sink = phi ptr [ %38, %34 ], [ %77, %68 ], [ %19, %14 ]
  %97 = getelementptr inbounds i8, ptr %.lcssa.sink, i64 24
  store i64 %.05178, ptr %97, align 8, !tbaa !9
  br label %.thread94

.thread94:                                        ; preds = %.thread94.sink.split, %96
  %.097 = phi i32 [ %6, %96 ], [ 4, %.thread94.sink.split ]
  %98 = phi ptr [ %.pre93, %96 ], [ %.lcssa.sink, %.thread94.sink.split ]
  %99 = call i32 @rl_btree_node_destroy(ptr noundef %0, ptr noundef nonnull %98)
  br label %100

100:                                              ; preds = %.thread, %.thread94, %96
  %.065 = phi i32 [ 0, %.thread ], [ %.097, %.thread94 ], [ %6, %96 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  ret i32 %.065
}

declare i64 @get_8bytes(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 = !{!7, !7, i64 0}
!15 = !{!16, !7, i64 0}
!16 = !{!"rl_key", !7, i64 0, !11, i64 8, !11, i64 16, !17, i64 24, !11, i64 32}
!17 = !{!"long long", !7, i64 0}
!18 = !{!16, !11, i64 8}
!19 = !{!16, !11, i64 16}
!20 = !{!16, !17, i64 24}
!21 = !{!16, !11, i64 32}
!22 = !{!10, !6, i64 8}
!23 = !{!24, !11, i64 8}
!24 = !{!"rl_btree", !6, i64 0, !11, i64 8, !11, i64 16, !6, i64 24, !11, i64 32, !11, i64 40}
!25 = !{!11, !11, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


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