; LLVM IR from eyangch/competitive-programming :: USACOcontests/gold/2021.03 (ucfj)

; 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 }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.__gnu_pbds::detail::bin_search_tree_const_it_" = type { ptr }
%"struct.std::pair" = type <{ %"class.__gnu_pbds::detail::bin_search_tree_const_it_", i8, [7 x i8] }>

@N = external dso_local global i64, align 8
@b = external dso_local global [200000 x i64], align 16
@pv = external dso_local global [200000 x i64], align 16
@oset = external dso_local global %"class.__gnu_pbds::tree", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca %"class.__gnu_pbds::detail::bin_search_tree_const_it_", align 8
  %7 = alloca %"class.__gnu_pbds::detail::bin_search_tree_const_it_", align 8
  %8 = alloca %"struct.std::pair", align 8
  store i32 0, ptr %1, align 4
  %9 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %11
  %13 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  %14 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %16

16:                                               ; preds = %29, %0
  %17 = load i64, ptr %2, align 8, !tbaa !8
  %18 = load i64, ptr @N, align 8, !tbaa !8
  %19 = icmp slt i64 %17, %18
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %32

21:                                               ; preds = %16
  %22 = load i64, ptr %2, align 8, !tbaa !8
  %23 = getelementptr inbounds [200000 x i64], ptr @b, i64 0, i64 %22
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %23)
  %25 = load i64, ptr %2, align 8, !tbaa !8
  %26 = getelementptr inbounds [200000 x i64], ptr @b, i64 0, i64 %25
  %27 = load i64, ptr %26, align 8, !tbaa !8
  %28 = add nsw i64 %27, -1
  store i64 %28, ptr %26, align 8, !tbaa !8
  br label %29

29:                                               ; preds = %21
  %30 = load i64, ptr %2, align 8, !tbaa !8
  %31 = add nsw i64 %30, 1
  store i64 %31, ptr %2, align 8, !tbaa !8
  br label %16, !llvm.loop !11

32:                                               ; preds = %20
  %33 = load i64, ptr @N, align 8, !tbaa !8
  %34 = getelementptr inbounds i64, ptr @pv, i64 %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 -1, ptr %3, align 4, !tbaa !13
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @pv, ptr noundef %34, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 0, ptr %4, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store i64 0, ptr %5, align 8, !tbaa !8
  br label %35

35:                                               ; preds = %80, %32
  %36 = load i64, ptr %5, align 8, !tbaa !8
  %37 = load i64, ptr @N, align 8, !tbaa !8
  %38 = icmp slt i64 %36, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %83

40:                                               ; preds = %35
  %41 = load i64, ptr %5, align 8, !tbaa !8
  %42 = getelementptr inbounds [200000 x i64], ptr @b, i64 0, i64 %41
  %43 = load i64, ptr %42, align 8, !tbaa !8
  %44 = getelementptr inbounds [200000 x i64], ptr @pv, i64 0, i64 %43
  %45 = 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_St7greaterIxES4_E12order_of_keyESC_(ptr noundef nonnull align 8 dereferenceable(8) @oset, ptr noundef nonnull align 8 dereferenceable(8) %44)
  %46 = load i64, ptr %4, align 8, !tbaa !8
  %47 = add i64 %46, %45
  store i64 %47, ptr %4, align 8, !tbaa !8
  %48 = load i64, ptr %5, align 8, !tbaa !8
  %49 = getelementptr inbounds [200000 x i64], ptr @b, i64 0, i64 %48
  %50 = load i64, ptr %49, align 8, !tbaa !8
  %51 = getelementptr inbounds [200000 x i64], ptr @pv, i64 0, i64 %50
  %52 = load i64, ptr %51, align 8, !tbaa !8
  %53 = icmp ne i64 %52, -1
  br i1 %53, label %54, label %65

54:                                               ; preds = %40
  %55 = load i64, ptr %5, align 8, !tbaa !8
  %56 = getelementptr inbounds [200000 x i64], ptr @b, i64 0, i64 %55
  %57 = load i64, ptr %56, align 8, !tbaa !8
  %58 = getelementptr inbounds [200000 x i64], ptr @pv, i64 0, i64 %57
  %59 = call ptr @_ZN10__gnu_pbds6detail19bin_search_tree_setIxNS_9null_typeESt7greaterIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E4findERKx(ptr noundef nonnull align 8 dereferenceable(32) @oset, ptr noundef nonnull align 8 dereferenceable(8) %58)
  %60 = getelementptr inbounds %"class.__gnu_pbds::detail::bin_search_tree_const_it_", ptr %6, i32 0, i32 0
  store ptr %59, ptr %60, align 8
  %61 = getelementptr inbounds %"class.__gnu_pbds::detail::bin_search_tree_const_it_", ptr %6, i32 0, i32 0
  %62 = load ptr, ptr %61, align 8
  %63 = call ptr @_ZN10__gnu_pbds6detail11rb_tree_setIxNS_9null_typeESt7greaterIxENS0_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) @oset, ptr %62)
  %64 = getelementptr inbounds %"class.__gnu_pbds::detail::bin_search_tree_const_it_", ptr %7, i32 0, i32 0
  store ptr %63, ptr %64, align 8
  br label %65

65:                                               ; preds = %54, %40
  %66 = load i64, ptr %5, align 8, !tbaa !8
  %67 = load i64, ptr %5, align 8, !tbaa !8
  %68 = getelementptr inbounds [200000 x i64], ptr @b, i64 0, i64 %67
  %69 = load i64, ptr %68, align 8, !tbaa !8
  %70 = getelementptr inbounds [200000 x i64], ptr @pv, i64 0, i64 %69
  store i64 %66, ptr %70, align 8, !tbaa !8
  %71 = load i64, ptr %5, align 8, !tbaa !8
  %72 = getelementptr inbounds [200000 x i64], ptr @b, i64 0, i64 %71
  %73 = load i64, ptr %72, align 8, !tbaa !8
  %74 = getelementptr inbounds [200000 x i64], ptr @pv, i64 0, i64 %73
  %75 = call { ptr, i8 } @_ZN10__gnu_pbds6detail11rb_tree_setIxNS_9null_typeESt7greaterIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E6insertERKx(ptr noundef nonnull align 8 dereferenceable(32) @oset, ptr noundef nonnull align 8 dereferenceable(8) %74)
  %76 = getelementptr inbounds { ptr, i8 }, ptr %8, i32 0, i32 0
  %77 = extractvalue { ptr, i8 } %75, 0
  store ptr %77, ptr %76, align 8
  %78 = getelementptr inbounds { ptr, i8 }, ptr %8, i32 0, i32 1
  %79 = extractvalue { ptr, i8 } %75, 1
  store i8 %79, ptr %78, align 8
  br label %80

80:                                               ; preds = %65
  %81 = load i64, ptr %5, align 8, !tbaa !8
  %82 = add nsw i64 %81, 1
  store i64 %82, ptr %5, align 8, !tbaa !8
  br label %35, !llvm.loop !15

83:                                               ; preds = %39
  %84 = load i64, ptr %4, align 8, !tbaa !8
  %85 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %84)
  %86 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %85, ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  %87 = load i32, ptr %1, align 4
  ret i32 %87
}

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

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #5

; 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_St7greaterIxES4_E12order_of_keyESC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZN10__gnu_pbds6detail11rb_tree_setIxNS_9null_typeESt7greaterIxENS0_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) #5 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { ptr, i8 } @_ZN10__gnu_pbds6detail11rb_tree_setIxNS_9null_typeESt7greaterIxENS0_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)) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #3 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 = { 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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !10, i64 0}
!15 = distinct !{!15, !12}


; 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.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@N = external dso_local global i64, align 8
@b = external dso_local global [200000 x i64], align 16
@pv = external dso_local global [200000 x i64], align 16
@oset = external dso_local global %"class.__gnu_pbds::tree", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %4
  %6 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %5, ptr noundef null)
  %7 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %8 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %9 = load i64, ptr @N, align 8, !tbaa !8
  %10 = icmp sgt i64 %9, 0
  br i1 %10, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %.lcssa = phi i64 [ %9, %0 ], [ %19, %.lr.ph ]
  %11 = getelementptr inbounds i64, ptr @pv, i64 %.lcssa
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 -1, ptr %1, align 4, !tbaa !11
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @pv, ptr noundef nonnull %11, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %12 = load i64, ptr @N, align 8, !tbaa !8
  %13 = icmp sgt i64 %12, 0
  br i1 %13, label %.lr.ph24, label %._crit_edge25

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.020 = phi i64 [ %18, %.lr.ph ], [ 0, %0 ]
  %14 = getelementptr inbounds [200000 x i64], ptr @b, i64 0, i64 %.020
  %15 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %16 = load i64, ptr %14, align 8, !tbaa !8
  %17 = add nsw i64 %16, -1
  store i64 %17, ptr %14, align 8, !tbaa !8
  %18 = add nuw nsw i64 %.020, 1
  %19 = load i64, ptr @N, align 8, !tbaa !8
  %20 = icmp slt i64 %18, %19
  br i1 %20, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge25:                                    ; preds = %34, %._crit_edge
  %.017.lcssa = phi i64 [ 0, %._crit_edge ], [ %27, %34 ]
  %21 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.017.lcssa)
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull @.str)
  ret i32 0

.lr.ph24:                                         ; preds = %._crit_edge, %34
  %.01722 = phi i64 [ %27, %34 ], [ 0, %._crit_edge ]
  %.01821 = phi i64 [ %38, %34 ], [ 0, %._crit_edge ]
  %23 = getelementptr inbounds [200000 x i64], ptr @b, i64 0, i64 %.01821
  %24 = load i64, ptr %23, align 8, !tbaa !8
  %25 = getelementptr inbounds [200000 x i64], ptr @pv, i64 0, i64 %24
  %26 = 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_St7greaterIxES4_E12order_of_keyESC_(ptr noundef nonnull align 8 dereferenceable(8) @oset, ptr noundef nonnull align 8 dereferenceable(8) %25)
  %27 = add i64 %26, %.01722
  %28 = load i64, ptr %23, align 8, !tbaa !8
  %29 = getelementptr inbounds [200000 x i64], ptr @pv, i64 0, i64 %28
  %30 = load i64, ptr %29, align 8, !tbaa !8
  %.not = icmp eq i64 %30, -1
  br i1 %.not, label %34, label %31

31:                                               ; preds = %.lr.ph24
  %32 = call ptr @_ZN10__gnu_pbds6detail19bin_search_tree_setIxNS_9null_typeESt7greaterIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E4findERKx(ptr noundef nonnull align 8 dereferenceable(32) @oset, ptr noundef nonnull align 8 dereferenceable(8) %29)
  %33 = call ptr @_ZN10__gnu_pbds6detail11rb_tree_setIxNS_9null_typeESt7greaterIxENS0_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) @oset, ptr %32)
  %.pre = load i64, ptr %23, align 8, !tbaa !8
  br label %34

34:                                               ; preds = %31, %.lr.ph24
  %35 = phi i64 [ %.pre, %31 ], [ %28, %.lr.ph24 ]
  %36 = getelementptr inbounds [200000 x i64], ptr @pv, i64 0, i64 %35
  store i64 %.01821, ptr %36, align 8, !tbaa !8
  %37 = call { ptr, i8 } @_ZN10__gnu_pbds6detail11rb_tree_setIxNS_9null_typeESt7greaterIxENS0_11tree_traitsIxS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E6insertERKx(ptr noundef nonnull align 8 dereferenceable(32) @oset, ptr noundef nonnull align 8 dereferenceable(8) %36)
  %38 = add nuw nsw i64 %.01821, 1
  %39 = load i64, ptr @N, align 8, !tbaa !8
  %40 = icmp slt i64 %38, %39
  br i1 %40, label %.lr.ph24, label %._crit_edge25, !llvm.loop !15
}

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

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5

; 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_St7greaterIxES4_E12order_of_keyESC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZN10__gnu_pbds6detail11rb_tree_setIxNS_9null_typeESt7greaterIxENS0_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 #5 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { ptr, i8 } @_ZN10__gnu_pbds6detail11rb_tree_setIxNS_9null_typeESt7greaterIxENS0_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 #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #3 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 = { 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 = { "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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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