; LLVM IR from lzyrapx/Competitive-Programming :: LibreOJ (104（pb_ds）)

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

%"class.__gnu_pbds::tree" = type { %"class.__gnu_pbds::basic_branch" }
%"class.__gnu_pbds::basic_branch" = type { %"class.__gnu_pbds::detail::rb_tree_set" }
%"class.__gnu_pbds::detail::rb_tree_set" = type { %"class.__gnu_pbds::detail::bin_search_tree_set" }
%"class.__gnu_pbds::detail::bin_search_tree_set" = type { %"class.__gnu_pbds::tree_order_statistics_node_update", [8 x i8], ptr, i64 }
%"class.__gnu_pbds::tree_order_statistics_node_update" = type { %"struct.__gnu_pbds::detail::branch_policy" }
%"struct.__gnu_pbds::detail::branch_policy" = type { ptr }
%"struct.std::pair" = type <{ %"class.__gnu_pbds::detail::bin_search_tree_const_it_", i8, [7 x i8] }>
%"class.__gnu_pbds::detail::bin_search_tree_const_it_" = type { ptr }

@rbt = external dso_local global %"class.__gnu_pbds::tree", align 8
@n = external dso_local global i32, align 4
@k = external dso_local global i64, align 8
@ans = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca %"class.__gnu_pbds::detail::bin_search_tree_const_it_", align 8
  %7 = alloca i64, align 8
  %8 = alloca %"class.__gnu_pbds::detail::bin_search_tree_const_it_", align 8
  %9 = alloca i64, align 8
  %10 = alloca %"class.__gnu_pbds::detail::bin_search_tree_const_it_", align 8
  %11 = alloca %"class.__gnu_pbds::detail::bin_search_tree_const_it_", align 8
  %12 = alloca i64, align 8
  %13 = alloca %"class.__gnu_pbds::detail::bin_search_tree_const_it_", align 8
  %14 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %15 = call noundef i32 @_Z4readv()
  store i32 %15, ptr @n, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  br label %16

16:                                               ; preds = %101, %0
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = icmp sle i32 %17, %18
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %104

21:                                               ; preds = %16
  %22 = call noundef i32 @_Z4readv()
  store i32 %22, ptr %3, align 4, !tbaa !5
  %23 = call noundef i32 @_Z4readv()
  %24 = sext i32 %23 to i64
  store i64 %24, ptr @k, align 8, !tbaa !9
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = icmp eq i32 %25, 1
  br i1 %26, label %27, label %38

27:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %28 = load i64, ptr @k, align 8, !tbaa !9
  %29 = shl i64 %28, 20
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = add nsw i64 %29, %31
  store i64 %32, ptr %4, align 8, !tbaa !9
  %33 = call { ptr, i8 } @_ZN10__gnu_pbds6detail11rb_tree_setIxNS_9null_typeESt4lessIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E6insertERKx(ptr noundef nonnull align 8 dereferenceable(32) @rbt, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %34 = getelementptr inbounds { ptr, i8 }, ptr %5, i32 0, i32 0
  %35 = extractvalue { ptr, i8 } %33, 0
  store ptr %35, ptr %34, align 8
  %36 = getelementptr inbounds { ptr, i8 }, ptr %5, i32 0, i32 1
  %37 = extractvalue { ptr, i8 } %33, 1
  store i8 %37, ptr %36, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  br label %38

38:                                               ; preds = %27, %21
  %39 = load i32, ptr %3, align 4, !tbaa !5
  %40 = icmp eq i32 %39, 2
  br i1 %40, label %41, label %50

41:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %42 = load i64, ptr @k, align 8, !tbaa !9
  %43 = shl i64 %42, 20
  store i64 %43, ptr %7, align 8, !tbaa !9
  %44 = call ptr @_ZN10__gnu_pbds6detail19bin_search_tree_setIxNS_9null_typeESt4lessIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E11lower_boundERKx(ptr noundef nonnull align 8 dereferenceable(32) @rbt, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %45 = getelementptr inbounds %"class.__gnu_pbds::detail::bin_search_tree_const_it_", ptr %6, i32 0, i32 0
  store ptr %44, ptr %45, align 8
  %46 = getelementptr inbounds %"class.__gnu_pbds::detail::bin_search_tree_const_it_", ptr %6, i32 0, i32 0
  %47 = load ptr, ptr %46, align 8
  %48 = call ptr @_ZN10__gnu_pbds6detail11rb_tree_setIxNS_9null_typeESt4lessIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E5eraseENS0_25bin_search_tree_const_it_IPNS0_13rb_tree_node_IxmS8_EExPxPKxRxRSG_Lb1ES8_EE(ptr noundef nonnull align 8 dereferenceable(32) @rbt, ptr %47)
  %49 = getelementptr inbounds %"class.__gnu_pbds::detail::bin_search_tree_const_it_", ptr %8, i32 0, i32 0
  store ptr %48, ptr %49, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %50

50:                                               ; preds = %41, %38
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = icmp eq i32 %51, 3
  br i1 %52, label %53, label %59

53:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %54 = load i64, ptr @k, align 8, !tbaa !9
  %55 = shl i64 %54, 20
  store i64 %55, ptr %9, align 8, !tbaa !9
  %56 = call noundef i64 @_ZNK10__gnu_pbds33tree_order_statistics_node_updateINS_6detail30bin_search_tree_const_node_it_INS1_13rb_tree_node_IxmSaIcEEENS1_25bin_search_tree_const_it_IPS5_xPxPKxRxRS9_Lb1ES4_EESD_S4_EESE_St4lessIxES4_E12order_of_keyESC_(ptr noundef nonnull align 8 dereferenceable(8) @rbt, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %57 = add i64 %56, 1
  %58 = call i32 (ptr, ...) @printf(ptr noundef @.str, i64 noundef %57)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %59

59:                                               ; preds = %53, %50
  %60 = load i32, ptr %3, align 4, !tbaa !5
  %61 = icmp eq i32 %60, 4
  br i1 %61, label %62, label %72

62:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %63 = load i64, ptr @k, align 8, !tbaa !9
  %64 = sub nsw i64 %63, 1
  %65 = call ptr @_ZN10__gnu_pbds33tree_order_statistics_node_updateINS_6detail30bin_search_tree_const_node_it_INS1_13rb_tree_node_IxmSaIcEEENS1_25bin_search_tree_const_it_IPS5_xPxPKxRxRS9_Lb1ES4_EESD_S4_EESE_St4lessIxES4_E13find_by_orderEm(ptr noundef nonnull align 8 dereferenceable(8) @rbt, i64 noundef %64)
  %66 = getelementptr inbounds %"class.__gnu_pbds::detail::bin_search_tree_const_it_", ptr %10, i32 0, i32 0
  store ptr %65, ptr %66, align 8
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK10__gnu_pbds6detail25bin_search_tree_const_it_IPNS0_13rb_tree_node_IxmSaIcEEExPxPKxRxRS7_Lb1ES3_EdeEv(ptr noundef nonnull align 8 dereferenceable(8) %10)
  %68 = load i64, ptr %67, align 8, !tbaa !9
  store i64 %68, ptr @ans, align 8, !tbaa !9
  %69 = load i64, ptr @ans, align 8, !tbaa !9
  %70 = ashr i64 %69, 20
  %71 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %70)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %72

72:                                               ; preds = %62, %59
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = icmp eq i32 %73, 5
  br i1 %74, label %75, label %86

75:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %76 = load i64, ptr @k, align 8, !tbaa !9
  %77 = shl i64 %76, 20
  store i64 %77, ptr %12, align 8, !tbaa !9
  %78 = call ptr @_ZN10__gnu_pbds6detail19bin_search_tree_setIxNS_9null_typeESt4lessIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E11lower_boundERKx(ptr noundef nonnull align 8 dereferenceable(32) @rbt, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %79 = getelementptr inbounds %"class.__gnu_pbds::detail::bin_search_tree_const_it_", ptr %11, i32 0, i32 0
  store ptr %78, ptr %79, align 8
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10__gnu_pbds6detail25bin_search_tree_const_it_IPNS0_13rb_tree_node_IxmSaIcEEExPxPKxRxRS7_Lb1ES3_EmmEv(ptr noundef nonnull align 8 dereferenceable(8) %11)
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK10__gnu_pbds6detail25bin_search_tree_const_it_IPNS0_13rb_tree_node_IxmSaIcEEExPxPKxRxRS7_Lb1ES3_EdeEv(ptr noundef nonnull align 8 dereferenceable(8) %80)
  %82 = load i64, ptr %81, align 8, !tbaa !9
  store i64 %82, ptr @ans, align 8, !tbaa !9
  %83 = load i64, ptr @ans, align 8, !tbaa !9
  %84 = ashr i64 %83, 20
  %85 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %84)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %86

86:                                               ; preds = %75, %72
  %87 = load i32, ptr %3, align 4, !tbaa !5
  %88 = icmp eq i32 %87, 6
  br i1 %88, label %89, label %100

89:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %90 = load i64, ptr @k, align 8, !tbaa !9
  %91 = add nsw i64 %90, 1
  %92 = shl i64 %91, 20
  store i64 %92, ptr %14, align 8, !tbaa !9
  %93 = call ptr @_ZN10__gnu_pbds6detail19bin_search_tree_setIxNS_9null_typeESt4lessIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E11lower_boundERKx(ptr noundef nonnull align 8 dereferenceable(32) @rbt, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %94 = getelementptr inbounds %"class.__gnu_pbds::detail::bin_search_tree_const_it_", ptr %13, i32 0, i32 0
  store ptr %93, ptr %94, align 8
  %95 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK10__gnu_pbds6detail25bin_search_tree_const_it_IPNS0_13rb_tree_node_IxmSaIcEEExPxPKxRxRS7_Lb1ES3_EdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13)
  %96 = load i64, ptr %95, align 8, !tbaa !9
  store i64 %96, ptr @ans, align 8, !tbaa !9
  %97 = load i64, ptr @ans, align 8, !tbaa !9
  %98 = ashr i64 %97, 20
  %99 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %98)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %100

100:                                              ; preds = %89, %86
  br label %101

101:                                              ; preds = %100
  %102 = load i32, ptr %2, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %2, align 4, !tbaa !5
  br label %16, !llvm.loop !11

104:                                              ; preds = %20
  ret i32 0
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z4readv() #1

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { ptr, i8 } @_ZN10__gnu_pbds6detail11rb_tree_setIxNS_9null_typeESt4lessIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E6insertERKx(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZN10__gnu_pbds6detail11rb_tree_setIxNS_9null_typeESt4lessIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E5eraseENS0_25bin_search_tree_const_it_IPNS0_13rb_tree_node_IxmS8_EExPxPKxRxRSG_Lb1ES8_EE(ptr noundef nonnull align 8 dereferenceable(32), ptr) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZN10__gnu_pbds6detail19bin_search_tree_setIxNS_9null_typeESt4lessIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E11lower_boundERKx(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

declare i32 @printf(ptr noundef, ...) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZNK10__gnu_pbds33tree_order_statistics_node_updateINS_6detail30bin_search_tree_const_node_it_INS1_13rb_tree_node_IxmSaIcEEENS1_25bin_search_tree_const_it_IPS5_xPxPKxRxRS9_Lb1ES4_EESD_S4_EESE_St4lessIxES4_E12order_of_keyESC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZN10__gnu_pbds33tree_order_statistics_node_updateINS_6detail30bin_search_tree_const_node_it_INS1_13rb_tree_node_IxmSaIcEEENS1_25bin_search_tree_const_it_IPS5_xPxPKxRxRS9_Lb1ES4_EESD_S4_EESE_St4lessIxES4_E13find_by_orderEm(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #1 align 2

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

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

attributes #0 = { mustprogress norecurse 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 #1 = { inlinehint 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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"

%"class.__gnu_pbds::tree" = type { %"class.__gnu_pbds::basic_branch" }
%"class.__gnu_pbds::basic_branch" = type { %"class.__gnu_pbds::detail::rb_tree_set" }
%"class.__gnu_pbds::detail::rb_tree_set" = type { %"class.__gnu_pbds::detail::bin_search_tree_set" }
%"class.__gnu_pbds::detail::bin_search_tree_set" = type { %"class.__gnu_pbds::tree_order_statistics_node_update", [8 x i8], ptr, i64 }
%"class.__gnu_pbds::tree_order_statistics_node_update" = type { %"struct.__gnu_pbds::detail::branch_policy" }
%"struct.__gnu_pbds::detail::branch_policy" = type { ptr }
%"class.__gnu_pbds::detail::bin_search_tree_const_it_" = type { ptr }

@rbt = external dso_local global %"class.__gnu_pbds::tree", align 8
@n = external dso_local local_unnamed_addr global i32, align 4
@k = external dso_local local_unnamed_addr global i64, align 8
@ans = external dso_local local_unnamed_addr global i64, align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca %"class.__gnu_pbds::detail::bin_search_tree_const_it_", align 8
  %5 = alloca %"class.__gnu_pbds::detail::bin_search_tree_const_it_", align 8
  %6 = alloca i64, align 8
  %7 = alloca %"class.__gnu_pbds::detail::bin_search_tree_const_it_", align 8
  %8 = alloca i64, align 8
  %9 = tail call noundef i32 @_Z4readv()
  store i32 %9, ptr @n, align 4, !tbaa !5
  %.not11 = icmp slt i32 %9, 1
  br i1 %.not11, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %49, %0
  ret i32 0

.lr.ph:                                           ; preds = %0, %49
  %indvars.iv = phi i64 [ %indvars.iv.next, %49 ], [ 1, %0 ]
  %10 = call noundef i32 @_Z4readv()
  %11 = call noundef i32 @_Z4readv()
  %12 = sext i32 %11 to i64
  store i64 %12, ptr @k, align 8, !tbaa !9
  switch i32 %10, label %49 [
    i32 1, label %13
    i32 2, label %17
    i32 3, label %21
    i32 4, label %26
    i32 5, label %33
    i32 6, label %41
  ]

13:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  %14 = shl nsw i64 %12, 20
  %15 = add nsw i64 %14, %indvars.iv
  store i64 %15, ptr %1, align 8, !tbaa !9
  %16 = call { ptr, i8 } @_ZN10__gnu_pbds6detail11rb_tree_setIxNS_9null_typeESt4lessIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E6insertERKx(ptr noundef nonnull align 8 dereferenceable(32) @rbt, ptr noundef nonnull align 8 dereferenceable(8) %1)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  br label %49

17:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %18 = shl nsw i64 %12, 20
  store i64 %18, ptr %2, align 8, !tbaa !9
  %19 = call ptr @_ZN10__gnu_pbds6detail19bin_search_tree_setIxNS_9null_typeESt4lessIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E11lower_boundERKx(ptr noundef nonnull align 8 dereferenceable(32) @rbt, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %20 = call ptr @_ZN10__gnu_pbds6detail11rb_tree_setIxNS_9null_typeESt4lessIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E5eraseENS0_25bin_search_tree_const_it_IPNS0_13rb_tree_node_IxmS8_EExPxPKxRxRSG_Lb1ES8_EE(ptr noundef nonnull align 8 dereferenceable(32) @rbt, ptr %19)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  br label %49

21:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %22 = shl nsw i64 %12, 20
  store i64 %22, ptr %3, align 8, !tbaa !9
  %23 = call noundef i64 @_ZNK10__gnu_pbds33tree_order_statistics_node_updateINS_6detail30bin_search_tree_const_node_it_INS1_13rb_tree_node_IxmSaIcEEENS1_25bin_search_tree_const_it_IPS5_xPxPKxRxRS9_Lb1ES4_EESD_S4_EESE_St4lessIxES4_E12order_of_keyESC_(ptr noundef nonnull align 8 dereferenceable(8) @rbt, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %24 = add i64 %23, 1
  %25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %24)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br label %49

26:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %27 = add nsw i64 %12, -1
  %28 = call ptr @_ZN10__gnu_pbds33tree_order_statistics_node_updateINS_6detail30bin_search_tree_const_node_it_INS1_13rb_tree_node_IxmSaIcEEENS1_25bin_search_tree_const_it_IPS5_xPxPKxRxRS9_Lb1ES4_EESD_S4_EESE_St4lessIxES4_E13find_by_orderEm(ptr noundef nonnull align 8 dereferenceable(8) @rbt, i64 noundef %27)
  store ptr %28, ptr %4, align 8
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK10__gnu_pbds6detail25bin_search_tree_const_it_IPNS0_13rb_tree_node_IxmSaIcEEExPxPKxRxRS7_Lb1ES3_EdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4)
  %30 = load i64, ptr %29, align 8, !tbaa !9
  store i64 %30, ptr @ans, align 8, !tbaa !9
  %31 = ashr i64 %30, 20
  %32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %31)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %49

33:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %34 = shl nsw i64 %12, 20
  store i64 %34, ptr %6, align 8, !tbaa !9
  %35 = call ptr @_ZN10__gnu_pbds6detail19bin_search_tree_setIxNS_9null_typeESt4lessIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E11lower_boundERKx(ptr noundef nonnull align 8 dereferenceable(32) @rbt, ptr noundef nonnull align 8 dereferenceable(8) %6)
  store ptr %35, ptr %5, align 8
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10__gnu_pbds6detail25bin_search_tree_const_it_IPNS0_13rb_tree_node_IxmSaIcEEExPxPKxRxRS7_Lb1ES3_EmmEv(ptr noundef nonnull align 8 dereferenceable(8) %5)
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK10__gnu_pbds6detail25bin_search_tree_const_it_IPNS0_13rb_tree_node_IxmSaIcEEExPxPKxRxRS7_Lb1ES3_EdeEv(ptr noundef nonnull align 8 dereferenceable(8) %36)
  %38 = load i64, ptr %37, align 8, !tbaa !9
  store i64 %38, ptr @ans, align 8, !tbaa !9
  %39 = ashr i64 %38, 20
  %40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %39)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br label %49

41:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  %42 = shl nsw i64 %12, 20
  %43 = add nsw i64 %42, 1048576
  store i64 %43, ptr %8, align 8, !tbaa !9
  %44 = call ptr @_ZN10__gnu_pbds6detail19bin_search_tree_setIxNS_9null_typeESt4lessIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E11lower_boundERKx(ptr noundef nonnull align 8 dereferenceable(32) @rbt, ptr noundef nonnull align 8 dereferenceable(8) %8)
  store ptr %44, ptr %7, align 8
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK10__gnu_pbds6detail25bin_search_tree_const_it_IPNS0_13rb_tree_node_IxmSaIcEEExPxPKxRxRS7_Lb1ES3_EdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7)
  %46 = load i64, ptr %45, align 8, !tbaa !9
  store i64 %46, ptr @ans, align 8, !tbaa !9
  %47 = ashr i64 %46, 20
  %48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %47)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br label %49

49:                                               ; preds = %33, %26, %21, %17, %13, %.lr.ph, %41
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %50 = load i32, ptr @n, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %.not.not = icmp slt i64 %indvars.iv, %51
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z4readv() local_unnamed_addr #1

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { ptr, i8 } @_ZN10__gnu_pbds6detail11rb_tree_setIxNS_9null_typeESt4lessIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E6insertERKx(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(8)) 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) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZN10__gnu_pbds6detail11rb_tree_setIxNS_9null_typeESt4lessIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E5eraseENS0_25bin_search_tree_const_it_IPNS0_13rb_tree_node_IxmS8_EExPxPKxRxRSG_Lb1ES8_EE(ptr noundef nonnull align 8 dereferenceable(32), ptr) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZN10__gnu_pbds6detail19bin_search_tree_setIxNS_9null_typeESt4lessIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E11lower_boundERKx(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZNK10__gnu_pbds33tree_order_statistics_node_updateINS_6detail30bin_search_tree_const_node_it_INS1_13rb_tree_node_IxmSaIcEEENS1_25bin_search_tree_const_it_IPS5_xPxPKxRxRS9_Lb1ES4_EESD_S4_EESE_St4lessIxES4_E12order_of_keyESC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZN10__gnu_pbds33tree_order_statistics_node_updateINS_6detail30bin_search_tree_const_node_it_INS1_13rb_tree_node_IxmSaIcEEENS1_25bin_search_tree_const_it_IPS5_xPxPKxRxRS9_Lb1ES4_EESD_S4_EESE_St4lessIxES4_E13find_by_orderEm(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #1 align 2

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

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

attributes #0 = { mustprogress norecurse 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 #1 = { inlinehint 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree 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 #4 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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