; LLVM IR from dynexcoin/Dynex :: src/DynexCNCore (BlockchainIndices)

; 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::pair.61" = type { %"struct.std::_Rb_tree_iterator.60", %"struct.std::_Rb_tree_iterator.60" }
%"struct.std::_Rb_tree_iterator.60" = type { ptr }
%"class.DynexCN::TimestampBlocksIndex" = type <{ %"class.std::multimap.54", i8, [7 x i8] }>
%"class.std::multimap.54" = type { %"class.std::_Rb_tree.55" }
%"class.std::_Rb_tree.55" = type { %"struct.std::_Rb_tree<unsigned long, std::pair<const unsigned long, Crypto::Hash>, std::_Select1st<std::pair<const unsigned long, Crypto::Hash>>, std::less<unsigned long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<unsigned long, std::pair<const unsigned long, Crypto::Hash>, std::_Select1st<std::pair<const unsigned long, Crypto::Hash>>, std::less<unsigned long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::pair.63" = type { i64, %"struct.Crypto::Hash" }
%"struct.Crypto::Hash" = type { [32 x i8] }

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6CryptoeqERKNS_4HashES2_(ptr noundef nonnull align 1 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(32)) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7DynexCN20TimestampBlocksIndex6removeEmRKN6Crypto4HashE(ptr noundef nonnull align 8 dereferenceable(49) %0, i64 noundef %1, ptr noundef nonnull align 1 dereferenceable(32) %2) #3 align 2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %"struct.std::pair.61", align 8
  %9 = alloca %"struct.std::_Rb_tree_iterator.60", align 8
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::_Rb_tree_iterator.60", align 8
  %12 = alloca %"struct.std::_Rb_tree_iterator.60", align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  %13 = load ptr, ptr %5, align 8
  %14 = getelementptr inbounds %"class.DynexCN::TimestampBlocksIndex", ptr %13, i32 0, i32 1
  %15 = load i8, ptr %14, align 8, !tbaa !11, !range !22, !noundef !23
  %16 = trunc i8 %15 to i1
  br i1 %16, label %18, label %17

17:                                               ; preds = %3
  store i1 false, ptr %4, align 1
  br label %48

18:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #5
  %19 = getelementptr inbounds %"class.DynexCN::TimestampBlocksIndex", ptr %13, i32 0, i32 0
  %20 = call { ptr, ptr } @_ZNSt8multimapImN6Crypto4HashESt4lessImESaISt4pairIKmS1_EEE11equal_rangeERS5_(ptr noundef nonnull align 8 dereferenceable(48) %19, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %21 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 0
  %22 = extractvalue { ptr, ptr } %20, 0
  store ptr %22, ptr %21, align 8
  %23 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 1
  %24 = extractvalue { ptr, ptr } %20, 1
  store ptr %24, ptr %23, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %25 = getelementptr inbounds %"struct.std::pair.61", ptr %8, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %25, i64 8, i1 false), !tbaa.struct !24
  br label %26

26:                                               ; preds = %42, %18
  %27 = getelementptr inbounds %"struct.std::pair.61", ptr %8, i32 0, i32 1
  %28 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKmN6Crypto4HashEEES7_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %27) #5
  br i1 %28, label %30, label %29

29:                                               ; preds = %26
  store i32 2, ptr %10, align 4
  br label %44

30:                                               ; preds = %26
  %31 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmN6Crypto4HashEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  %32 = getelementptr inbounds %"struct.std::pair.63", ptr %31, i32 0, i32 1
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = call noundef zeroext i1 @_ZN6CryptoeqERKNS_4HashES2_(ptr noundef nonnull align 1 dereferenceable(32) %32, ptr noundef nonnull align 1 dereferenceable(32) %33)
  br i1 %34, label %35, label %41

35:                                               ; preds = %30
  %36 = getelementptr inbounds %"class.DynexCN::TimestampBlocksIndex", ptr %13, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %9, i64 8, i1 false), !tbaa.struct !24
  %37 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.60", ptr %11, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8
  %39 = call ptr @_ZNSt8multimapImN6Crypto4HashESt4lessImESaISt4pairIKmS1_EEE5eraseB5cxx11ESt17_Rb_tree_iteratorIS6_E(ptr noundef nonnull align 8 dereferenceable(48) %36, ptr %38)
  %40 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.60", ptr %12, i32 0, i32 0
  store ptr %39, ptr %40, align 8
  store i1 true, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %44

41:                                               ; preds = %30
  br label %42

42:                                               ; preds = %41
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKmN6Crypto4HashEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  br label %26, !llvm.loop !25

44:                                               ; preds = %35, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  %45 = load i32, ptr %10, align 4
  switch i32 %45, label %47 [
    i32 2, label %46
  ]

46:                                               ; preds = %44
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %47

47:                                               ; preds = %46, %44
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #5
  br label %48

48:                                               ; preds = %47, %17
  %49 = load i1, ptr %4, align 1
  ret i1 %49
}

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, ptr } @_ZNSt8multimapImN6Crypto4HashESt4lessImESaISt4pairIKmS1_EEE11equal_rangeERS5_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKmN6Crypto4HashEEES7_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt8multimapImN6Crypto4HashESt4lessImESaISt4pairIKmS1_EEE5eraseB5cxx11ESt17_Rb_tree_iteratorIS6_E(ptr noundef nonnull align 8 dereferenceable(48), ptr) #3 align 2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #3 = { mustprogress 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 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 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !21, i64 48}
!12 = !{!"_ZTSN7DynexCN20TimestampBlocksIndexE", !13, i64 0, !21, i64 48}
!13 = !{!"_ZTSSt8multimapImN6Crypto4HashESt4lessImESaISt4pairIKmS1_EEE", !14, i64 0}
!14 = !{!"_ZTSSt8_Rb_treeImSt4pairIKmN6Crypto4HashEESt10_Select1stIS4_ESt4lessImESaIS4_EE", !15, i64 0}
!15 = !{!"_ZTSNSt8_Rb_treeImSt4pairIKmN6Crypto4HashEESt10_Select1stIS4_ESt4lessImESaIS4_EE13_Rb_tree_implIS8_Lb1EEE", !16, i64 0, !18, i64 8}
!16 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessImEE", !17, i64 0}
!17 = !{!"_ZTSSt4lessImE"}
!18 = !{!"_ZTSSt15_Rb_tree_header", !19, i64 0, !10, i64 32}
!19 = !{!"_ZTSSt18_Rb_tree_node_base", !20, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!20 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!21 = !{!"bool", !7, i64 0}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{i64 0, i64 8, !5}
!25 = distinct !{!25, !26}
!26 = !{!"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"

%"struct.std::pair.61" = type { %"struct.std::_Rb_tree_iterator.60", %"struct.std::_Rb_tree_iterator.60" }
%"struct.std::_Rb_tree_iterator.60" = 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6CryptoeqERKNS_4HashES2_(ptr noundef nonnull align 1 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(32)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7DynexCN20TimestampBlocksIndex6removeEmRKN6Crypto4HashE(ptr noundef nonnull align 8 dereferenceable(49) %0, i64 noundef %1, ptr noundef nonnull align 1 dereferenceable(32) %2) local_unnamed_addr #2 align 2 {
  %4 = alloca i64, align 8
  %5 = alloca %"struct.std::pair.61", align 8
  %6 = alloca %"struct.std::_Rb_tree_iterator.60", align 8
  store i64 %1, ptr %4, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 48
  %8 = load i8, ptr %7, align 8, !tbaa !9, !range !21, !noundef !22
  %9 = trunc nuw i8 %8 to i1
  br i1 %9, label %10, label %26

10:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #4
  %11 = call { ptr, ptr } @_ZNSt8multimapImN6Crypto4HashESt4lessImESaISt4pairIKmS1_EEE11equal_rangeERS5_(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %12 = extractvalue { ptr, ptr } %11, 0
  store ptr %12, ptr %5, align 8
  %13 = getelementptr inbounds i8, ptr %5, i64 8
  %14 = extractvalue { ptr, ptr } %11, 1
  store ptr %14, ptr %13, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %.cast = ptrtoint ptr %12 to i64
  store i64 %.cast, ptr %6, align 8, !tbaa !23
  %15 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKmN6Crypto4HashEEES7_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %13) #4
  br i1 %15, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %10, %21
  %16 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmN6Crypto4HashEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #4
  %17 = getelementptr inbounds i8, ptr %16, i64 8
  %18 = call noundef zeroext i1 @_ZN6CryptoeqERKNS_4HashES2_(ptr noundef nonnull align 1 dereferenceable(32) %17, ptr noundef nonnull align 1 dereferenceable(32) %2)
  br i1 %18, label %19, label %21

19:                                               ; preds = %.lr.ph
  %.sroa.01.0.copyload = load ptr, ptr %6, align 8, !tbaa !23
  %20 = call ptr @_ZNSt8multimapImN6Crypto4HashESt4lessImESaISt4pairIKmS1_EEE5eraseB5cxx11ESt17_Rb_tree_iteratorIS6_E(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr %.sroa.01.0.copyload)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  br label %24

21:                                               ; preds = %.lr.ph
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKmN6Crypto4HashEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #4
  %23 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKmN6Crypto4HashEEES7_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %13) #4
  br i1 %23, label %.lr.ph, label %.critedge, !llvm.loop !24

.critedge:                                        ; preds = %21, %10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  br label %24

24:                                               ; preds = %19, %.critedge
  %25 = phi i1 [ true, %19 ], [ false, %.critedge ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #4
  br label %26

26:                                               ; preds = %3, %24
  %.2 = phi i1 [ %25, %24 ], [ false, %3 ]
  ret i1 %.2
}

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, ptr } @_ZNSt8multimapImN6Crypto4HashESt4lessImESaISt4pairIKmS1_EEE11equal_rangeERS5_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKmN6Crypto4HashEEES7_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 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 #3 = { 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 #4 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !20, i64 48}
!10 = !{!"_ZTSN7DynexCN20TimestampBlocksIndexE", !11, i64 0, !20, i64 48}
!11 = !{!"_ZTSSt8multimapImN6Crypto4HashESt4lessImESaISt4pairIKmS1_EEE", !12, i64 0}
!12 = !{!"_ZTSSt8_Rb_treeImSt4pairIKmN6Crypto4HashEESt10_Select1stIS4_ESt4lessImESaIS4_EE", !13, i64 0}
!13 = !{!"_ZTSNSt8_Rb_treeImSt4pairIKmN6Crypto4HashEESt10_Select1stIS4_ESt4lessImESaIS4_EE13_Rb_tree_implIS8_Lb1EEE", !14, i64 0, !16, i64 8}
!14 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessImEE", !15, i64 0}
!15 = !{!"_ZTSSt4lessImE"}
!16 = !{!"_ZTSSt15_Rb_tree_header", !17, i64 0, !6, i64 32}
!17 = !{!"_ZTSSt18_Rb_tree_node_base", !18, i64 0, !19, i64 8, !19, i64 16, !19, i64 24}
!18 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!19 = !{!"any pointer", !7, i64 0}
!20 = !{!"bool", !7, i64 0}
!21 = !{i8 0, i8 2}
!22 = !{}
!23 = !{!19, !19, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


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