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

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

declare i32 @rl_read(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, i32 noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_btree_random_element(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #4 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  %16 = 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 4, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.rl_btree, ptr %17, i32 0, i32 2
  %19 = load i64, ptr %18, align 8, !tbaa !9
  store i64 %19, ptr %11, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %20 = load i64, ptr %11, align 8, !tbaa !12
  %21 = mul i64 8, %20
  %22 = call noalias ptr @malloc(i64 noundef %21) #7
  store ptr %22, ptr %12, align 8, !tbaa !5
  %23 = load ptr, ptr %12, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %26, label %25

25:                                               ; preds = %4
  store i32 4, ptr %9, align 4, !tbaa !13
  br label %168

26:                                               ; preds = %4
  %27 = load ptr, ptr %12, align 8, !tbaa !5
  %28 = getelementptr inbounds i64, ptr %27, i64 0
  store i64 1, ptr %28, align 8, !tbaa !12
  store i64 1, ptr %10, align 8, !tbaa !12
  br label %29

29:                                               ; preds = %58, %26
  %30 = load i64, ptr %10, align 8, !tbaa !12
  %31 = load i64, ptr %11, align 8, !tbaa !12
  %32 = icmp slt i64 %30, %31
  br i1 %32, label %33, label %61

33:                                               ; preds = %29
  %34 = load ptr, ptr %12, align 8, !tbaa !5
  %35 = load i64, ptr %10, align 8, !tbaa !12
  %36 = sub nsw i64 %35, 1
  %37 = getelementptr inbounds i64, ptr %34, i64 %36
  %38 = load i64, ptr %37, align 8, !tbaa !12
  %39 = sitofp i64 %38 to double
  %40 = load ptr, ptr %12, align 8, !tbaa !5
  %41 = load i64, ptr %10, align 8, !tbaa !12
  %42 = sub nsw i64 %41, 1
  %43 = getelementptr inbounds i64, ptr %40, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !12
  %45 = sitofp i64 %44 to double
  %46 = fmul double %45, 7.500000e-01
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.rl_btree, ptr %47, i32 0, i32 1
  %49 = load i64, ptr %48, align 8, !tbaa !15
  %50 = sitofp i64 %49 to double
  %51 = fmul double %46, %50
  %52 = call double @llvm.ceil.f64(double %51)
  %53 = fadd double %39, %52
  %54 = fptosi double %53 to i64
  %55 = load ptr, ptr %12, align 8, !tbaa !5
  %56 = load i64, ptr %10, align 8, !tbaa !12
  %57 = getelementptr inbounds i64, ptr %55, i64 %56
  store i64 %54, ptr %57, align 8, !tbaa !12
  br label %58

58:                                               ; preds = %33
  %59 = load i64, ptr %10, align 8, !tbaa !12
  %60 = add nsw i64 %59, 1
  store i64 %60, ptr %10, align 8, !tbaa !12
  br label %29, !llvm.loop !16

61:                                               ; preds = %29
  %62 = call i32 @rand() #6
  %63 = sitofp i32 %62 to float
  %64 = fdiv float %63, 0x41E0000000000000
  %65 = load ptr, ptr %12, align 8, !tbaa !5
  %66 = load i64, ptr %11, align 8, !tbaa !12
  %67 = sub nsw i64 %66, 1
  %68 = getelementptr inbounds i64, ptr %65, i64 %67
  %69 = load i64, ptr %68, align 8, !tbaa !12
  %70 = sitofp i64 %69 to float
  %71 = fmul float %64, %70
  %72 = fptosi float %71 to i64
  %73 = add nsw i64 1, %72
  store i64 %73, ptr %13, align 8, !tbaa !12
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.rl_btree, ptr %75, i32 0, i32 3
  %77 = load ptr, ptr %76, align 8, !tbaa !18
  %78 = getelementptr inbounds %struct.rl_btree_type, ptr %77, i32 0, i32 1
  %79 = load ptr, ptr %78, align 8, !tbaa !19
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.rl_btree, ptr %80, i32 0, i32 4
  %82 = load i64, ptr %81, align 8, !tbaa !21
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = call i32 @rl_read(ptr noundef %74, ptr noundef %79, i64 noundef %82, ptr noundef %83, ptr noundef %15, i32 noundef 1)
  store i32 %84, ptr %9, align 4, !tbaa !13
  %85 = load i32, ptr %9, align 4, !tbaa !13
  %86 = icmp ne i32 2, %85
  br i1 %86, label %87, label %88

87:                                               ; preds = %61
  br label %168

88:                                               ; preds = %61
  %89 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %89, ptr %16, align 8, !tbaa !5
  store i64 0, ptr %10, align 8, !tbaa !12
  br label %90

90:                                               ; preds = %164, %88
  %91 = load i64, ptr %10, align 8, !tbaa !12
  %92 = load i64, ptr %11, align 8, !tbaa !12
  %93 = icmp slt i64 %91, %92
  br i1 %93, label %94, label %167

94:                                               ; preds = %90
  %95 = load i64, ptr %13, align 8, !tbaa !12
  %96 = load ptr, ptr %12, align 8, !tbaa !5
  %97 = load i64, ptr %10, align 8, !tbaa !12
  %98 = getelementptr inbounds i64, ptr %96, i64 %97
  %99 = load i64, ptr %98, align 8, !tbaa !12
  %100 = icmp sgt i64 %95, %99
  br i1 %100, label %101, label %131

101:                                              ; preds = %94
  %102 = call i32 @rand() #6
  %103 = sitofp i32 %102 to float
  %104 = fdiv float %103, 0x41E0000000000000
  %105 = load ptr, ptr %16, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.rl_btree_node, ptr %105, i32 0, i32 3
  %107 = load i64, ptr %106, align 8, !tbaa !22
  %108 = add nsw i64 1, %107
  %109 = sitofp i64 %108 to float
  %110 = fmul float %104, %109
  %111 = fptosi float %110 to i64
  store i64 %111, ptr %14, align 8, !tbaa !12
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = load ptr, ptr %6, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.rl_btree, ptr %113, i32 0, i32 3
  %115 = load ptr, ptr %114, align 8, !tbaa !18
  %116 = getelementptr inbounds %struct.rl_btree_type, ptr %115, i32 0, i32 1
  %117 = load ptr, ptr %116, align 8, !tbaa !19
  %118 = load ptr, ptr %16, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.rl_btree_node, ptr %118, i32 0, i32 1
  %120 = load ptr, ptr %119, align 8, !tbaa !24
  %121 = load i64, ptr %14, align 8, !tbaa !12
  %122 = getelementptr inbounds i64, ptr %120, i64 %121
  %123 = load i64, ptr %122, align 8, !tbaa !12
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  %125 = call i32 @rl_read(ptr noundef %112, ptr noundef %117, i64 noundef %123, ptr noundef %124, ptr noundef %15, i32 noundef 1)
  store i32 %125, ptr %9, align 4, !tbaa !13
  %126 = load i32, ptr %9, align 4, !tbaa !13
  %127 = icmp ne i32 2, %126
  br i1 %127, label %128, label %129

128:                                              ; preds = %101
  br label %168

129:                                              ; preds = %101
  %130 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %130, ptr %16, align 8, !tbaa !5
  br label %163

131:                                              ; preds = %94
  %132 = call i32 @rand() #6
  %133 = sitofp i32 %132 to float
  %134 = fdiv float %133, 0x41E0000000000000
  %135 = load ptr, ptr %16, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.rl_btree_node, ptr %135, i32 0, i32 3
  %137 = load i64, ptr %136, align 8, !tbaa !22
  %138 = sitofp i64 %137 to float
  %139 = fmul float %134, %138
  %140 = fptosi float %139 to i64
  store i64 %140, ptr %14, align 8, !tbaa !12
  %141 = load ptr, ptr %7, align 8, !tbaa !5
  %142 = icmp ne ptr %141, null
  br i1 %142, label %143, label %151

143:                                              ; preds = %131
  %144 = load ptr, ptr %16, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.rl_btree_node, ptr %144, i32 0, i32 0
  %146 = load ptr, ptr %145, align 8, !tbaa !25
  %147 = load i64, ptr %14, align 8, !tbaa !12
  %148 = getelementptr inbounds ptr, ptr %146, i64 %147
  %149 = load ptr, ptr %148, align 8, !tbaa !5
  %150 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %149, ptr %150, align 8, !tbaa !5
  br label %151

151:                                              ; preds = %143, %131
  %152 = load ptr, ptr %8, align 8, !tbaa !5
  %153 = icmp ne ptr %152, null
  br i1 %153, label %154, label %162

154:                                              ; preds = %151
  %155 = load ptr, ptr %16, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.rl_btree_node, ptr %155, i32 0, i32 2
  %157 = load ptr, ptr %156, align 8, !tbaa !26
  %158 = load i64, ptr %14, align 8, !tbaa !12
  %159 = getelementptr inbounds ptr, ptr %157, i64 %158
  %160 = load ptr, ptr %159, align 8, !tbaa !5
  %161 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %160, ptr %161, align 8, !tbaa !5
  br label %162

162:                                              ; preds = %154, %151
  br label %167

163:                                              ; preds = %129
  br label %164

164:                                              ; preds = %163
  %165 = load i64, ptr %10, align 8, !tbaa !12
  %166 = add nsw i64 %165, 1
  store i64 %166, ptr %10, align 8, !tbaa !12
  br label %90, !llvm.loop !27

167:                                              ; preds = %162, %90
  store i32 0, ptr %9, align 4, !tbaa !13
  br label %168

168:                                              ; preds = %167, %128, %87, %25
  %169 = load ptr, ptr %12, align 8, !tbaa !5
  call void @free(ptr noundef %169) #6
  %170 = load i32, ptr %9, align 4, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, 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 4, ptr %9) #6
  ret i32 %170
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #5

; Function Attrs: nounwind
declare i32 @rand() #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 = { 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 #3 = { "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 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 16}
!10 = !{!"rl_btree", !6, i64 0, !11, i64 8, !11, i64 16, !6, i64 24, !11, i64 32, !11, i64 40}
!11 = !{!"long", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!10, !11, i64 8}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!10, !6, i64 24}
!19 = !{!20, !6, i64 8}
!20 = !{!"", !6, i64 0, !6, i64 8, !14, i64 16, !14, i64 20, !6, i64 24}
!21 = !{!10, !11, i64 32}
!22 = !{!23, !11, i64 24}
!23 = !{!"rl_btree_node", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24}
!24 = !{!23, !6, i64 8}
!25 = !{!23, !6, i64 0}
!26 = !{!23, !6, i64 16}
!27 = distinct !{!27, !17}


; 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

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

declare i32 @rl_read(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local range(i32 3, 2) i32 @rl_btree_random_element(ptr noundef %0, ptr noundef %1, ptr noundef writeonly %2, ptr noundef writeonly %3) local_unnamed_addr #4 {
  %5 = alloca ptr, align 8
  %6 = getelementptr inbounds i8, ptr %1, i64 16
  %7 = load i64, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %8 = shl i64 %7, 3
  %9 = tail call noalias ptr @malloc(i64 noundef %8) #8
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %.loopexit, label %10

10:                                               ; preds = %4
  store i64 1, ptr %9, align 8, !tbaa !11
  %11 = icmp sgt i64 %7, 1
  br i1 %11, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %10
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  %13 = load i64, ptr %12, align 8, !tbaa !12
  %14 = sitofp i64 %13 to double
  %load_initial = load i64, ptr %9, align 8
  %15 = add nsw i64 %7, -1
  %xtraiter = and i64 %15, 1
  %16 = icmp eq i64 %7, 2
  br i1 %16, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %15, -2
  %invariant.gep = getelementptr i8, ptr %9, i64 8
  br label %17

17:                                               ; preds = %17, %.lr.ph.new
  %store_forwarded = phi i64 [ %load_initial, %.lr.ph.new ], [ %30, %17 ]
  %.04558 = phi i64 [ 1, %.lr.ph.new ], [ %31, %17 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %17 ]
  %18 = getelementptr i64, ptr %9, i64 %.04558
  %19 = sitofp i64 %store_forwarded to double
  %20 = fmul double %19, 7.500000e-01
  %21 = fmul double %20, %14
  %22 = tail call double @llvm.ceil.f64(double %21)
  %23 = fadd double %22, %19
  %24 = fptosi double %23 to i64
  store i64 %24, ptr %18, align 8, !tbaa !11
  %gep = getelementptr i64, ptr %invariant.gep, i64 %.04558
  %25 = sitofp i64 %24 to double
  %26 = fmul double %25, 7.500000e-01
  %27 = fmul double %26, %14
  %28 = tail call double @llvm.ceil.f64(double %27)
  %29 = fadd double %28, %25
  %30 = fptosi double %29 to i64
  store i64 %30, ptr %gep, align 8, !tbaa !11
  %31 = add nuw nsw i64 %.04558, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %17, !llvm.loop !13

._crit_edge.loopexit.unr-lcssa:                   ; preds = %17, %.lr.ph
  %store_forwarded.unr = phi i64 [ %load_initial, %.lr.ph ], [ %30, %17 ]
  %.04558.unr = phi i64 [ 1, %.lr.ph ], [ %31, %17 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %._crit_edge.loopexit.epilog-lcssa

._crit_edge.loopexit.epilog-lcssa:                ; preds = %._crit_edge.loopexit.unr-lcssa
  %32 = getelementptr i64, ptr %9, i64 %.04558.unr
  %33 = sitofp i64 %store_forwarded.unr to double
  %34 = fmul double %33, 7.500000e-01
  %35 = fmul double %34, %14
  %36 = tail call double @llvm.ceil.f64(double %35)
  %37 = fadd double %36, %33
  %38 = fptosi double %37 to i64
  store i64 %38, ptr %32, align 8, !tbaa !11
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.epilog-lcssa, %._crit_edge.loopexit.unr-lcssa, %10
  %39 = tail call i32 @rand() #7
  %40 = sitofp i32 %39 to float
  %41 = fmul float %40, 0x3E00000000000000
  %42 = getelementptr i64, ptr %9, i64 %7
  %43 = getelementptr i8, ptr %42, i64 -8
  %44 = load i64, ptr %43, align 8, !tbaa !11
  %45 = sitofp i64 %44 to float
  %46 = fmul float %41, %45
  %47 = fptosi float %46 to i64
  %48 = getelementptr inbounds i8, ptr %1, i64 24
  %49 = load ptr, ptr %48, align 8, !tbaa !15
  %50 = getelementptr inbounds i8, ptr %49, i64 8
  %51 = load ptr, ptr %50, align 8, !tbaa !16
  %52 = getelementptr inbounds i8, ptr %1, i64 32
  %53 = load i64, ptr %52, align 8, !tbaa !19
  %54 = call i32 @rl_read(ptr noundef %0, ptr noundef %51, i64 noundef %53, ptr noundef nonnull %1, ptr noundef nonnull %5, i32 noundef 1) #7
  %.not52 = icmp eq i32 %54, 2
  br i1 %.not52, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %._crit_edge
  %55 = icmp sgt i64 %7, 0
  br i1 %55, label %.lr.ph62, label %.loopexit

56:                                               ; preds = %65
  %57 = add nuw nsw i64 %.160, 1
  %exitcond66.not = icmp eq i64 %57, %7
  br i1 %exitcond66.not, label %.loopexit, label %.lr.ph62, !llvm.loop !20

.lr.ph62:                                         ; preds = %.preheader, %56
  %.160 = phi i64 [ %57, %56 ], [ 0, %.preheader ]
  %.061 = load ptr, ptr %5, align 8, !tbaa !21
  %58 = getelementptr inbounds i64, ptr %9, i64 %.160
  %59 = load i64, ptr %58, align 8, !tbaa !11
  %.not53 = icmp sgt i64 %59, %47
  %60 = call i32 @rand() #7
  %61 = sitofp i32 %60 to float
  %62 = fmul float %61, 0x3E00000000000000
  %63 = getelementptr inbounds i8, ptr %.061, i64 24
  %64 = load i64, ptr %63, align 8, !tbaa !22
  br i1 %.not53, label %78, label %65

65:                                               ; preds = %.lr.ph62
  %66 = add nsw i64 %64, 1
  %67 = sitofp i64 %66 to float
  %68 = fmul float %62, %67
  %69 = fptosi float %68 to i64
  %70 = load ptr, ptr %48, align 8, !tbaa !15
  %71 = getelementptr inbounds i8, ptr %70, i64 8
  %72 = load ptr, ptr %71, align 8, !tbaa !16
  %73 = getelementptr inbounds i8, ptr %.061, i64 8
  %74 = load ptr, ptr %73, align 8, !tbaa !24
  %75 = getelementptr inbounds i64, ptr %74, i64 %69
  %76 = load i64, ptr %75, align 8, !tbaa !11
  %77 = call i32 @rl_read(ptr noundef %0, ptr noundef %72, i64 noundef %76, ptr noundef nonnull %1, ptr noundef nonnull %5, i32 noundef 1) #7
  %.not56 = icmp eq i32 %77, 2
  br i1 %.not56, label %56, label %.loopexit

78:                                               ; preds = %.lr.ph62
  %79 = sitofp i64 %64 to float
  %80 = fmul float %62, %79
  %81 = fptosi float %80 to i64
  %.not54 = icmp eq ptr %2, null
  br i1 %.not54, label %86, label %82

82:                                               ; preds = %78
  %83 = load ptr, ptr %.061, align 8, !tbaa !25
  %84 = getelementptr inbounds ptr, ptr %83, i64 %81
  %85 = load ptr, ptr %84, align 8, !tbaa !21
  store ptr %85, ptr %2, align 8, !tbaa !21
  br label %86

86:                                               ; preds = %82, %78
  %.not55 = icmp eq ptr %3, null
  br i1 %.not55, label %.loopexit, label %87

87:                                               ; preds = %86
  %88 = getelementptr inbounds i8, ptr %.061, i64 16
  %89 = load ptr, ptr %88, align 8, !tbaa !26
  %90 = getelementptr inbounds ptr, ptr %89, i64 %81
  %91 = load ptr, ptr %90, align 8, !tbaa !21
  store ptr %91, ptr %3, align 8, !tbaa !21
  br label %.loopexit

.loopexit:                                        ; preds = %65, %56, %.preheader, %87, %86, %4, %._crit_edge
  %.044 = phi i32 [ %54, %._crit_edge ], [ 4, %4 ], [ 0, %86 ], [ 0, %87 ], [ 0, %.preheader ], [ %77, %65 ], [ 0, %56 ]
  call void @free(ptr noundef %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  ret i32 %.044
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #5

; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #6

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 = { 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 #3 = { "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 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 #7 = { nounwind }
attributes #8 = { 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, !10, i64 16}
!6 = !{!"rl_btree", !7, i64 0, !10, i64 8, !10, i64 16, !7, i64 24, !10, i64 32, !10, i64 40}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = !{!6, !10, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!6, !7, i64 24}
!16 = !{!17, !7, i64 8}
!17 = !{!"", !7, i64 0, !7, i64 8, !18, i64 16, !18, i64 20, !7, i64 24}
!18 = !{!"int", !8, i64 0}
!19 = !{!6, !10, i64 32}
!20 = distinct !{!20, !14}
!21 = !{!7, !7, i64 0}
!22 = !{!23, !10, i64 24}
!23 = !{!"rl_btree_node", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24}
!24 = !{!23, !7, i64 8}
!25 = !{!23, !7, i64 0}
!26 = !{!23, !7, i64 16}


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