; LLVM IR from fast-pack/SIMDCompressionAndIntersection :: advancedbenchmarking/src/ramtocache.ll (Z7entropyRSt3mapIjdSt4lessIjESaISt4pairIKjdEEE)

; 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.std::_Rb_tree_iterator.29" = type { ptr }
%"struct.std::pair.36" = type { i32, double }

; 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: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKjdEES5_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt3mapIjdSt4lessIjESaISt4pairIKjdEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKjdEEptEv(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_Z7entropyRSt3mapIjdSt4lessIjESaISt4pairIKjdEEE(ptr noundef nonnull align 8 dereferenceable(48) %0) #1 {
  %2 = alloca double, align 8
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  %5 = alloca %"struct.std::_Rb_tree_iterator.29", align 8
  %6 = alloca %"struct.std::_Rb_tree_iterator.29", align 8
  %7 = alloca i32, align 4
  %8 = alloca double, align 8
  %9 = alloca %"struct.std::_Rb_tree_iterator.29", align 8
  %10 = alloca %"struct.std::_Rb_tree_iterator.29", align 8
  %11 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  store double 0.000000e+00, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = call ptr @_ZNSt3mapIjdSt4lessIjESaISt4pairIKjdEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %12) #3
  %14 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.29", ptr %5, i32 0, i32 0
  store ptr %13, ptr %14, align 8
  br label %15

15:                                               ; preds = %27, %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = call ptr @_ZNSt3mapIjdSt4lessIjESaISt4pairIKjdEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %16) #3
  %18 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.29", ptr %6, i32 0, i32 0
  store ptr %17, ptr %18, align 8
  %19 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKjdEES5_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br i1 %19, label %21, label %20

20:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  br label %29

21:                                               ; preds = %15
  %22 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKjdEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  %23 = getelementptr inbounds %"struct.std::pair.36", ptr %22, i32 0, i32 1
  %24 = load double, ptr %23, align 8, !tbaa !11
  %25 = load double, ptr %4, align 8, !tbaa !9
  %26 = fadd double %25, %24
  store double %26, ptr %4, align 8, !tbaa !9
  br label %27

27:                                               ; preds = %21
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKjdEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  br label %15, !llvm.loop !14

29:                                               ; preds = %20
  %30 = load double, ptr %4, align 8, !tbaa !9
  %31 = fcmp olt double %30, 1.000000e+00
  br i1 %31, label %32, label %33

32:                                               ; preds = %29
  store double 0.000000e+00, ptr %2, align 8
  store i32 1, ptr %7, align 4
  br label %70

33:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  store double 0.000000e+00, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = call ptr @_ZNSt3mapIjdSt4lessIjESaISt4pairIKjdEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %34) #3
  %36 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.29", ptr %9, i32 0, i32 0
  store ptr %35, ptr %36, align 8
  br label %37

37:                                               ; preds = %66, %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = call ptr @_ZNSt3mapIjdSt4lessIjESaISt4pairIKjdEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %38) #3
  %40 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.29", ptr %10, i32 0, i32 0
  store ptr %39, ptr %40, align 8
  %41 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKjdEES5_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br i1 %41, label %43, label %42

42:                                               ; preds = %37
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %68

43:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %44 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKjdEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #3
  %45 = getelementptr inbounds %"struct.std::pair.36", ptr %44, i32 0, i32 1
  %46 = load double, ptr %45, align 8, !tbaa !11
  store double %46, ptr %11, align 8, !tbaa !9
  %47 = load double, ptr %11, align 8, !tbaa !9
  %48 = fcmp olt double %47, 1.000000e+00
  br i1 %48, label %49, label %50

49:                                               ; preds = %43
  store i32 7, ptr %7, align 4
  br label %63

50:                                               ; preds = %43
  %51 = load double, ptr %11, align 8, !tbaa !9
  %52 = load double, ptr %4, align 8, !tbaa !9
  %53 = fdiv double %51, %52
  %54 = load double, ptr %4, align 8, !tbaa !9
  %55 = load double, ptr %11, align 8, !tbaa !9
  %56 = fdiv double %54, %55
  %57 = call double @log(double noundef %56) #3
  %58 = fmul double %53, %57
  %59 = call double @log(double noundef 2.000000e+00) #3
  %60 = fdiv double %58, %59
  %61 = load double, ptr %8, align 8, !tbaa !9
  %62 = fadd double %61, %60
  store double %62, ptr %8, align 8, !tbaa !9
  store i32 0, ptr %7, align 4
  br label %63

63:                                               ; preds = %50, %49
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  %64 = load i32, ptr %7, align 4
  switch i32 %64, label %72 [
    i32 0, label %65
    i32 7, label %66
  ]

65:                                               ; preds = %63
  br label %66

66:                                               ; preds = %65, %63
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKjdEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #3
  br label %37, !llvm.loop !16

68:                                               ; preds = %42
  %69 = load double, ptr %8, align 8, !tbaa !9
  store double %69, ptr %2, align 8
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %70

70:                                               ; preds = %68, %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %71 = load double, ptr %2, align 8
  ret double %71

72:                                               ; preds = %63
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt3mapIjdSt4lessIjESaISt4pairIKjdEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKjdEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: nounwind
declare double @log(double noundef) #2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"_ZTSSt4pairIKjdE", !13, i64 0, !10, i64 8}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


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

%"struct.std::_Rb_tree_iterator.29" = type { ptr }

; 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 nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKjdEES5_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt3mapIjdSt4lessIjESaISt4pairIKjdEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKjdEEptEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_Z7entropyRSt3mapIjdSt4lessIjESaISt4pairIKjdEEE(ptr noundef nonnull align 8 dereferenceable(48) %0) local_unnamed_addr #1 {
  %2 = alloca %"struct.std::_Rb_tree_iterator.29", align 8
  %3 = alloca %"struct.std::_Rb_tree_iterator.29", align 8
  %4 = alloca %"struct.std::_Rb_tree_iterator.29", align 8
  %5 = alloca %"struct.std::_Rb_tree_iterator.29", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  %6 = tail call ptr @_ZNSt3mapIjdSt4lessIjESaISt4pairIKjdEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %0) #3
  store ptr %6, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %7 = tail call ptr @_ZNSt3mapIjdSt4lessIjESaISt4pairIKjdEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %0) #3
  store ptr %7, ptr %3, align 8
  %8 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKjdEES5_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  br i1 %8, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  br label %36

._crit_edge:                                      ; preds = %.lr.ph
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  %9 = fcmp olt double %13, 1.000000e+00
  br i1 %9, label %36, label %17

.lr.ph:                                           ; preds = %1, %.lr.ph
  %.01517 = phi double [ %13, %.lr.ph ], [ 0.000000e+00, %1 ]
  %10 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKjdEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #3
  %11 = getelementptr inbounds i8, ptr %10, i64 8
  %12 = load double, ptr %11, align 8, !tbaa !5
  %13 = fadd double %.01517, %12
  %14 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKjdEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %15 = call ptr @_ZNSt3mapIjdSt4lessIjESaISt4pairIKjdEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %0) #3
  store ptr %15, ptr %3, align 8
  %16 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKjdEES5_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  br i1 %16, label %.lr.ph, label %._crit_edge, !llvm.loop !11

17:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %18 = call ptr @_ZNSt3mapIjdSt4lessIjESaISt4pairIKjdEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %0) #3
  store ptr %18, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %19 = call ptr @_ZNSt3mapIjdSt4lessIjESaISt4pairIKjdEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %0) #3
  store ptr %19, ptr %5, align 8
  %20 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKjdEES5_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  br i1 %20, label %.lr.ph20, label %._crit_edge21

._crit_edge21:                                    ; preds = %32, %17
  %.014.lcssa = phi double [ 0.000000e+00, %17 ], [ %.1, %32 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  br label %36

.lr.ph20:                                         ; preds = %17, %32
  %.01418 = phi double [ %.1, %32 ], [ 0.000000e+00, %17 ]
  %21 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKjdEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  %22 = getelementptr inbounds i8, ptr %21, i64 8
  %23 = load double, ptr %22, align 8, !tbaa !5
  %24 = fcmp olt double %23, 1.000000e+00
  br i1 %24, label %32, label %25

25:                                               ; preds = %.lr.ph20
  %26 = fdiv double %23, %13
  %27 = fdiv double %13, %23
  %28 = call double @log(double noundef %27) #3
  %29 = fmul double %26, %28
  %30 = fdiv double %29, 0x3FE62E42FEFA39EF
  %31 = fadd double %.01418, %30
  br label %32

32:                                               ; preds = %.lr.ph20, %25
  %.1 = phi double [ %31, %25 ], [ %.01418, %.lr.ph20 ]
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKjdEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %34 = call ptr @_ZNSt3mapIjdSt4lessIjESaISt4pairIKjdEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %0) #3
  store ptr %34, ptr %5, align 8
  %35 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKjdEES5_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  br i1 %35, label %.lr.ph20, label %._crit_edge21, !llvm.loop !13

36:                                               ; preds = %._crit_edge.thread, %._crit_edge, %._crit_edge21
  %.0 = phi double [ %.014.lcssa, %._crit_edge21 ], [ 0.000000e+00, %._crit_edge ], [ 0.000000e+00, %._crit_edge.thread ]
  ret double %.0
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt3mapIjdSt4lessIjESaISt4pairIKjdEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKjdEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @log(double noundef) local_unnamed_addr #2

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

!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 8}
!6 = !{!"_ZTSSt4pairIKjdE", !7, i64 0, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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