; LLVM IR from cruppstahl/upscaledb :: src/3page_manager/freelist.ll (ZN9upscaledb8Freelist5allocEm)

; 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" = type { ptr }
%"struct.upscaledb::Freelist" = type { ptr, %"class.std::map", i64, i64 }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<unsigned long, std::pair<const unsigned long, unsigned long>, std::_Select1st<std::pair<const unsigned long, unsigned long>>, std::less<unsigned long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<unsigned long, std::pair<const unsigned long, unsigned long>, std::_Select1st<std::pair<const unsigned long, unsigned long>>, 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.upscaledb::EnvConfig" = type <{ i32, i32, i32, i32, i64, i64, i64, %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", i32, i8, [16 x i8], [3 x i8], i64, i32, [4 x i8] }>
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"struct.std::pair.3" = type { 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 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: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt3mapImmSt4lessImESaISt4pairIKmmEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) #2 align 2

; 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 ptr @_ZNSt3mapImmSt4lessImESaISt4pairIKmmEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN9upscaledb8Freelist5allocEm(ptr noundef nonnull align 8 dereferenceable(72) %0, i64 noundef %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %8 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %11 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %12 = alloca i64, align 8
  %13 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %14 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %15 = alloca %"struct.std::_Rb_tree_iterator", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !9
  %16 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i64 0, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %17 = getelementptr inbounds %"struct.upscaledb::Freelist", ptr %16, i32 0, i32 0
  %18 = load ptr, ptr %17, align 8, !tbaa !11
  %19 = getelementptr inbounds %"struct.upscaledb::EnvConfig", ptr %18, i32 0, i32 3
  %20 = load i32, ptr %19, align 4, !tbaa !21
  store i32 %20, ptr %6, align 4, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %21 = getelementptr inbounds %"struct.upscaledb::Freelist", ptr %16, i32 0, i32 1
  %22 = call ptr @_ZNSt3mapImmSt4lessImESaISt4pairIKmmEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %21) #4
  %23 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %7, i32 0, i32 0
  store ptr %22, ptr %23, align 8
  br label %24

24:                                               ; preds = %76, %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %25 = getelementptr inbounds %"struct.upscaledb::Freelist", ptr %16, i32 0, i32 1
  %26 = call ptr @_ZNSt3mapImmSt4lessImESaISt4pairIKmmEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %25) #4
  %27 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %8, i32 0, i32 0
  store ptr %26, ptr %27, align 8
  %28 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKmmEES5_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br i1 %28, label %30, label %29

29:                                               ; preds = %24
  store i32 2, ptr %9, align 4
  br label %79

30:                                               ; preds = %24
  %31 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmmEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  %32 = getelementptr inbounds %"struct.std::pair.3", ptr %31, i32 0, i32 1
  %33 = load i64, ptr %32, align 8, !tbaa !28
  %34 = load i64, ptr %4, align 8, !tbaa !9
  %35 = icmp eq i64 %33, %34
  br i1 %35, label %36, label %45

36:                                               ; preds = %30
  %37 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmmEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  %38 = getelementptr inbounds %"struct.std::pair.3", ptr %37, i32 0, i32 0
  %39 = load i64, ptr %38, align 8, !tbaa !30
  store i64 %39, ptr %5, align 8, !tbaa !9
  %40 = getelementptr inbounds %"struct.upscaledb::Freelist", ptr %16, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %7, i64 8, i1 false), !tbaa.struct !31
  %41 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %10, i32 0, i32 0
  %42 = load ptr, ptr %41, align 8
  %43 = call ptr @_ZNSt3mapImmSt4lessImESaISt4pairIKmmEEE5eraseB5cxx11ESt17_Rb_tree_iteratorIS4_E(ptr noundef nonnull align 8 dereferenceable(48) %40, ptr %42)
  %44 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %11, i32 0, i32 0
  store ptr %43, ptr %44, align 8
  store i32 2, ptr %9, align 4
  br label %79

45:                                               ; preds = %30
  %46 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmmEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  %47 = getelementptr inbounds %"struct.std::pair.3", ptr %46, i32 0, i32 1
  %48 = load i64, ptr %47, align 8, !tbaa !28
  %49 = load i64, ptr %4, align 8, !tbaa !9
  %50 = icmp ugt i64 %48, %49
  br i1 %50, label %51, label %75

51:                                               ; preds = %45
  %52 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmmEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  %53 = getelementptr inbounds %"struct.std::pair.3", ptr %52, i32 0, i32 0
  %54 = load i64, ptr %53, align 8, !tbaa !30
  store i64 %54, ptr %5, align 8, !tbaa !9
  %55 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmmEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  %56 = getelementptr inbounds %"struct.std::pair.3", ptr %55, i32 0, i32 1
  %57 = load i64, ptr %56, align 8, !tbaa !28
  %58 = load i64, ptr %4, align 8, !tbaa !9
  %59 = sub i64 %57, %58
  %60 = getelementptr inbounds %"struct.upscaledb::Freelist", ptr %16, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %61 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmmEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  %62 = getelementptr inbounds %"struct.std::pair.3", ptr %61, i32 0, i32 0
  %63 = load i64, ptr %62, align 8, !tbaa !30
  %64 = load i64, ptr %4, align 8, !tbaa !9
  %65 = load i32, ptr %6, align 4, !tbaa !27
  %66 = zext i32 %65 to i64
  %67 = mul i64 %64, %66
  %68 = add i64 %63, %67
  store i64 %68, ptr %12, align 8, !tbaa !9
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapImmSt4lessImESaISt4pairIKmmEEEixEOm(ptr noundef nonnull align 8 dereferenceable(48) %60, ptr noundef nonnull align 8 dereferenceable(8) %12)
  store i64 %59, ptr %69, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %70 = getelementptr inbounds %"struct.upscaledb::Freelist", ptr %16, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %13, ptr align 8 %7, i64 8, i1 false), !tbaa.struct !31
  %71 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %13, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8
  %73 = call ptr @_ZNSt3mapImmSt4lessImESaISt4pairIKmmEEE5eraseB5cxx11ESt17_Rb_tree_iteratorIS4_E(ptr noundef nonnull align 8 dereferenceable(48) %70, ptr %72)
  %74 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %14, i32 0, i32 0
  store ptr %73, ptr %74, align 8
  store i32 2, ptr %9, align 4
  br label %79

75:                                               ; preds = %45
  br label %76

76:                                               ; preds = %75
  %77 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKmmEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %7, i32 noundef 0) #4
  %78 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %15, i32 0, i32 0
  store ptr %77, ptr %78, align 8
  br label %24, !llvm.loop !32

79:                                               ; preds = %51, %36, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %80

80:                                               ; preds = %79
  %81 = load i64, ptr %5, align 8, !tbaa !9
  %82 = icmp ne i64 %81, 0
  br i1 %82, label %83, label %87

83:                                               ; preds = %80
  %84 = getelementptr inbounds %"struct.upscaledb::Freelist", ptr %16, i32 0, i32 2
  %85 = load i64, ptr %84, align 8, !tbaa !34
  %86 = add i64 %85, 1
  store i64 %86, ptr %84, align 8, !tbaa !34
  br label %91

87:                                               ; preds = %80
  %88 = getelementptr inbounds %"struct.upscaledb::Freelist", ptr %16, i32 0, i32 3
  %89 = load i64, ptr %88, align 8, !tbaa !35
  %90 = add i64 %89, 1
  store i64 %90, ptr %88, align 8, !tbaa !35
  br label %91

91:                                               ; preds = %87, %83
  %92 = load i64, ptr %5, align 8, !tbaa !9
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret i64 %92
}

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

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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, !6, i64 0}
!12 = !{!"_ZTSN9upscaledb8FreelistE", !6, i64 0, !13, i64 8, !10, i64 56, !10, i64 64}
!13 = !{!"_ZTSSt3mapImmSt4lessImESaISt4pairIKmmEEE", !14, i64 0}
!14 = !{!"_ZTSSt8_Rb_treeImSt4pairIKmmESt10_Select1stIS2_ESt4lessImESaIS2_EE", !15, i64 0}
!15 = !{!"_ZTSNSt8_Rb_treeImSt4pairIKmmESt10_Select1stIS2_ESt4lessImESaIS2_EE13_Rb_tree_implIS6_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 = !{!22, !23, i64 12}
!22 = !{!"_ZTSN9upscaledb9EnvConfigE", !23, i64 0, !23, i64 4, !23, i64 8, !23, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !24, i64 40, !24, i64 72, !23, i64 104, !26, i64 108, !7, i64 109, !10, i64 128, !23, i64 136}
!23 = !{!"int", !7, i64 0}
!24 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !25, i64 0, !10, i64 8, !7, i64 16}
!25 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!26 = !{!"bool", !7, i64 0}
!27 = !{!23, !23, i64 0}
!28 = !{!29, !10, i64 8}
!29 = !{!"_ZTSSt4pairIKmmE", !10, i64 0, !10, i64 8}
!30 = !{!29, !10, i64 0}
!31 = !{i64 0, i64 8, !5}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = !{!12, !10, i64 56}
!35 = !{!12, !10, i64 64}


; 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" = 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 nounwind uwtable
declare dso_local ptr @_ZNSt3mapImmSt4lessImESaISt4pairIKmmEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #1 align 2

; 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 ptr @_ZNSt3mapImmSt4lessImESaISt4pairIKmmEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN9upscaledb8Freelist5allocEm(ptr noundef nonnull align 8 dereferenceable(72) %0, i64 noundef %1) local_unnamed_addr #2 align 2 {
  %3 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %4 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %5 = alloca i64, align 8
  %6 = load ptr, ptr %0, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %6, i64 12
  %8 = load i32, ptr %7, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = tail call ptr @_ZNSt3mapImmSt4lessImESaISt4pairIKmmEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %9) #3
  store ptr %10, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %11 = tail call ptr @_ZNSt3mapImmSt4lessImESaISt4pairIKmmEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %9) #3
  store ptr %11, ptr %4, align 8
  %12 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKmmEES5_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  br i1 %12, label %.lr.ph, label %.thread

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

.lr.ph:                                           ; preds = %2, %37
  %13 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmmEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  %14 = getelementptr inbounds i8, ptr %13, i64 8
  %15 = load i64, ptr %14, align 8, !tbaa !25
  %16 = icmp eq i64 %15, %1
  %17 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmmEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  br i1 %16, label %18, label %20

18:                                               ; preds = %.lr.ph
  %19 = load i64, ptr %17, align 8, !tbaa !27
  br label %41

20:                                               ; preds = %.lr.ph
  %21 = getelementptr inbounds i8, ptr %17, i64 8
  %22 = load i64, ptr %21, align 8, !tbaa !25
  %23 = icmp ugt i64 %22, %1
  br i1 %23, label %24, label %37

24:                                               ; preds = %20
  %25 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmmEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  %26 = load i64, ptr %25, align 8, !tbaa !27
  %27 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmmEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  %28 = getelementptr inbounds i8, ptr %27, i64 8
  %29 = load i64, ptr %28, align 8, !tbaa !25
  %30 = sub i64 %29, %1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %31 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmmEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  %32 = load i64, ptr %31, align 8, !tbaa !27
  %33 = zext i32 %8 to i64
  %34 = mul i64 %33, %1
  %35 = add i64 %32, %34
  store i64 %35, ptr %5, align 8, !tbaa !28
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapImmSt4lessImESaISt4pairIKmmEEEixEOm(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull align 8 dereferenceable(8) %5)
  store i64 %30, ptr %36, align 8, !tbaa !28
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  br label %41

37:                                               ; preds = %20
  %38 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKmmEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef 0) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %39 = call ptr @_ZNSt3mapImmSt4lessImESaISt4pairIKmmEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %9) #3
  store ptr %39, ptr %4, align 8
  %40 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKmmEES5_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  br i1 %40, label %.lr.ph, label %.thread, !llvm.loop !29

41:                                               ; preds = %24, %18
  %.0 = phi i64 [ %19, %18 ], [ %26, %24 ]
  %.sroa.02.0.copyload.sink = load ptr, ptr %3, align 8, !tbaa !31
  %42 = call ptr @_ZNSt3mapImmSt4lessImESaISt4pairIKmmEEE5eraseB5cxx11ESt17_Rb_tree_iteratorIS4_E(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr %.sroa.02.0.copyload.sink)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  %.not = icmp eq i64 %.0, 0
  br i1 %.not, label %43, label %44

43:                                               ; preds = %.thread, %41
  br label %44

44:                                               ; preds = %41, %43
  %.sink18 = phi i64 [ 64, %43 ], [ 56, %41 ]
  %.014 = phi i64 [ 0, %43 ], [ %.0, %41 ]
  %45 = getelementptr inbounds i8, ptr %0, i64 %.sink18
  %46 = load i64, ptr %45, align 8, !tbaa !28
  %47 = add i64 %46, 1
  store i64 %47, ptr %45, align 8, !tbaa !28
  ret i64 %.014
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKmmEES5_(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 noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmmEEptEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKmmEEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #1 align 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 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 = { 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, !7, i64 0}
!6 = !{!"_ZTSN9upscaledb8FreelistE", !7, i64 0, !10, i64 8, !18, i64 56, !18, i64 64}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt3mapImmSt4lessImESaISt4pairIKmmEEE", !11, i64 0}
!11 = !{!"_ZTSSt8_Rb_treeImSt4pairIKmmESt10_Select1stIS2_ESt4lessImESaIS2_EE", !12, i64 0}
!12 = !{!"_ZTSNSt8_Rb_treeImSt4pairIKmmESt10_Select1stIS2_ESt4lessImESaIS2_EE13_Rb_tree_implIS6_Lb1EEE", !13, i64 0, !15, i64 8}
!13 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessImEE", !14, i64 0}
!14 = !{!"_ZTSSt4lessImE"}
!15 = !{!"_ZTSSt15_Rb_tree_header", !16, i64 0, !18, i64 32}
!16 = !{!"_ZTSSt18_Rb_tree_node_base", !17, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!17 = !{!"_ZTSSt14_Rb_tree_color", !8, i64 0}
!18 = !{!"long", !8, i64 0}
!19 = !{!20, !21, i64 12}
!20 = !{!"_ZTSN9upscaledb9EnvConfigE", !21, i64 0, !21, i64 4, !21, i64 8, !21, i64 12, !18, i64 16, !18, i64 24, !18, i64 32, !22, i64 40, !22, i64 72, !21, i64 104, !24, i64 108, !8, i64 109, !18, i64 128, !21, i64 136}
!21 = !{!"int", !8, i64 0}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !23, i64 0, !18, i64 8, !8, i64 16}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !7, i64 0}
!24 = !{!"bool", !8, i64 0}
!25 = !{!26, !18, i64 8}
!26 = !{!"_ZTSSt4pairIKmmE", !18, i64 0, !18, i64 8}
!27 = !{!26, !18, i64 0}
!28 = !{!18, !18, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = !{!7, !7, i64 0}


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