; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2016-17/Feb 2017/Plat/17 Feb P1 (Set).ll (Z5solvev)

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

@ans = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@x = external dso_local global [100001 x i32], align 16
@y = external dso_local global [100001 x i32], align 16
@m = external dso_local global [100001 x i32], align 16
@b = external dso_local global [100001 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.__gnu_pbds::tree", align 8
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair", align 8
  %8 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #5
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %9

9:                                                ; preds = %23, %0
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = load i64, ptr @N, align 8, !tbaa !9
  %13 = icmp slt i64 %11, %12
  br i1 %13, label %15, label %14

14:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  br label %26

15:                                               ; preds = %9
  %16 = load i32, ptr %1, align 4, !tbaa !5
  %17 = load i32, ptr %1, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [100001 x i32], ptr @x, i64 0, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [100001 x i32], ptr @m, i64 0, i64 %21
  store i32 %16, ptr %22, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %15
  %24 = load i32, ptr %1, align 4, !tbaa !5
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr %1, align 4, !tbaa !5
  br label %9, !llvm.loop !11

26:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 32, ptr %2) #5
  call void @_ZN10__gnu_pbds4treeIiNS_9null_typeESt4lessIiENS_11rb_tree_tagENS_33tree_order_statistics_node_updateESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %27 = load i64, ptr @N, align 8, !tbaa !9
  %28 = load i64, ptr @N, align 8, !tbaa !9
  %29 = sub nsw i64 %28, 1
  %30 = mul nsw i64 %27, %29
  %31 = sdiv i64 %30, 2
  store i64 %31, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %65, %26
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = load i64, ptr @N, align 8, !tbaa !9
  %36 = icmp slt i64 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %72

38:                                               ; preds = %32
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [100001 x i32], ptr @y, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [100001 x i32], ptr @m, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %47
  store i32 %45, ptr %48, align 4, !tbaa !5
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %50
  %52 = invoke noundef i64 @_ZNK10__gnu_pbds33tree_order_statistics_node_updateINS_6detail30bin_search_tree_const_node_it_INS1_13rb_tree_node_IimSaIcEEENS1_25bin_search_tree_const_it_IPS5_iPiPKiRiRS9_Lb1ES4_EESD_S4_EESE_St4lessIiES4_E12order_of_keyESC_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(4) %51)
          to label %53 unwind label %68

53:                                               ; preds = %38
  %54 = load i64, ptr %3, align 8, !tbaa !9
  %55 = sub i64 %54, %52
  store i64 %55, ptr %3, align 8, !tbaa !9
  %56 = load i32, ptr %4, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %57
  %59 = invoke { ptr, i8 } @_ZN10__gnu_pbds6detail11rb_tree_setIiNS_9null_typeESt4lessIiENS0_11tree_traitsIiS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E6insertERKi(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef nonnull align 4 dereferenceable(4) %58)
          to label %60 unwind label %68

60:                                               ; preds = %53
  %61 = getelementptr inbounds { ptr, i8 }, ptr %7, i32 0, i32 0
  %62 = extractvalue { ptr, i8 } %59, 0
  store ptr %62, ptr %61, align 8
  %63 = getelementptr inbounds { ptr, i8 }, ptr %7, i32 0, i32 1
  %64 = extractvalue { ptr, i8 } %59, 1
  store i8 %64, ptr %63, align 8
  br label %65

65:                                               ; preds = %60
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %4, align 4, !tbaa !5
  br label %32, !llvm.loop !13

68:                                               ; preds = %53, %38
  %69 = landingpad { ptr, i32 }
          cleanup
  %70 = extractvalue { ptr, i32 } %69, 0
  store ptr %70, ptr %5, align 8
  %71 = extractvalue { ptr, i32 } %69, 1
  store i32 %71, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %103

72:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %73 = load i64, ptr @N, align 8, !tbaa !9
  %74 = sub nsw i64 %73, 1
  %75 = trunc i64 %74 to i32
  store i32 %75, ptr %8, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %95, %72
  %77 = load i32, ptr %8, align 4, !tbaa !5
  %78 = icmp sge i32 %77, 0
  br i1 %78, label %80, label %79

79:                                               ; preds = %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %102

80:                                               ; preds = %76
  %81 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %82 unwind label %98

82:                                               ; preds = %80
  %83 = load i64, ptr %81, align 8, !tbaa !9
  store i64 %83, ptr @ans, align 8, !tbaa !9
  %84 = load i32, ptr %8, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = mul nsw i32 2, %87
  %89 = add nsw i32 %88, 1
  %90 = sext i32 %89 to i64
  %91 = load i64, ptr @N, align 8, !tbaa !9
  %92 = sub nsw i64 %90, %91
  %93 = load i64, ptr %3, align 8, !tbaa !9
  %94 = add nsw i64 %93, %92
  store i64 %94, ptr %3, align 8, !tbaa !9
  br label %95

95:                                               ; preds = %82
  %96 = load i32, ptr %8, align 4, !tbaa !5
  %97 = add nsw i32 %96, -1
  store i32 %97, ptr %8, align 4, !tbaa !5
  br label %76, !llvm.loop !14

98:                                               ; preds = %80
  %99 = landingpad { ptr, i32 }
          cleanup
  %100 = extractvalue { ptr, i32 } %99, 0
  store ptr %100, ptr %5, align 8
  %101 = extractvalue { ptr, i32 } %99, 1
  store i32 %101, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %103

102:                                              ; preds = %79
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @_ZN10__gnu_pbds6detail19bin_search_tree_setIiNS_9null_typeESt4lessIiENS0_11tree_traitsIiS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_ED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %2) #5
  ret void

103:                                              ; preds = %98, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @_ZN10__gnu_pbds6detail19bin_search_tree_setIiNS_9null_typeESt4lessIiENS0_11tree_traitsIiS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_ED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %2) #5
  br label %104

104:                                              ; preds = %103
  %105 = load ptr, ptr %5, align 8
  %106 = load i32, ptr %6, align 4
  %107 = insertvalue { ptr, i32 } poison, ptr %105, 0
  %108 = insertvalue { ptr, i32 } %107, i32 %106, 1
  resume { ptr, i32 } %108
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10__gnu_pbds4treeIiNS_9null_typeESt4lessIiENS_11rb_tree_tagENS_33tree_order_statistics_node_updateESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #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 = !{!"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"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !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 }

@ans = external dso_local global i64, align 8
@N = external dso_local local_unnamed_addr global i64, align 8
@x = external dso_local local_unnamed_addr global [100001 x i32], align 16
@y = external dso_local local_unnamed_addr global [100001 x i32], align 16
@m = external dso_local local_unnamed_addr global [100001 x i32], align 16
@b = external dso_local global [100001 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.__gnu_pbds::tree", align 8
  %2 = alloca i64, align 8
  %3 = load i64, ptr @N, align 8, !tbaa !5
  %4 = icmp sgt i64 %3, 0
  br i1 %4, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %xtraiter = and i64 %3, 3
  %5 = icmp ult i64 %3, 4
  br i1 %5, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %3, 9223372036854775804
  br label %.lr.ph

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next.3, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.lr.ph.epil ], [ %indvars.iv.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %6 = getelementptr inbounds [100001 x i32], ptr @x, i64 0, i64 %indvars.iv.epil
  %7 = load i32, ptr %6, align 4, !tbaa !9
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds [100001 x i32], ptr @m, i64 0, i64 %8
  %10 = trunc nuw nsw i64 %indvars.iv.epil to i32
  store i32 %10, ptr %9, align 4, !tbaa !9
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.lr.ph.epil, !llvm.loop !11

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil, %0
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #5
  call void @_ZN10__gnu_pbds4treeIiNS_9null_typeESt4lessIiENS_11rb_tree_tagENS_33tree_order_statistics_node_updateESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %11 = load i64, ptr @N, align 8, !tbaa !5
  %12 = add nsw i64 %11, -1
  %13 = mul nsw i64 %12, %11
  %14 = sdiv i64 %13, 2
  store i64 %14, ptr %2, align 8, !tbaa !5
  %15 = icmp sgt i64 %11, 0
  br i1 %15, label %.lr.ph23, label %._crit_edge24

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader.new ], [ %indvars.iv.next.3, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.3, %.lr.ph ]
  %16 = getelementptr inbounds [100001 x i32], ptr @x, i64 0, i64 %indvars.iv
  %17 = load i32, ptr %16, align 16, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [100001 x i32], ptr @m, i64 0, i64 %18
  %20 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %20, ptr %19, align 4, !tbaa !9
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %21 = getelementptr inbounds [100001 x i32], ptr @x, i64 0, i64 %indvars.iv.next
  %22 = load i32, ptr %21, align 4, !tbaa !9
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [100001 x i32], ptr @m, i64 0, i64 %23
  %25 = trunc nuw nsw i64 %indvars.iv.next to i32
  store i32 %25, ptr %24, align 4, !tbaa !9
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %26 = getelementptr inbounds [100001 x i32], ptr @x, i64 0, i64 %indvars.iv.next.1
  %27 = load i32, ptr %26, align 8, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [100001 x i32], ptr @m, i64 0, i64 %28
  %30 = trunc nuw nsw i64 %indvars.iv.next.1 to i32
  store i32 %30, ptr %29, align 4, !tbaa !9
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %31 = getelementptr inbounds [100001 x i32], ptr @x, i64 0, i64 %indvars.iv.next.2
  %32 = load i32, ptr %31, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [100001 x i32], ptr @m, i64 0, i64 %33
  %35 = trunc nuw nsw i64 %indvars.iv.next.2 to i32
  store i32 %35, ptr %34, align 4, !tbaa !9
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !13

._crit_edge24:                                    ; preds = %50, %._crit_edge
  %.lcssa = phi i64 [ %11, %._crit_edge ], [ %51, %50 ]
  %36 = trunc i64 %.lcssa to i32
  %.025 = add i32 %36, -1
  %37 = icmp sgt i32 %.025, -1
  br i1 %37, label %.lr.ph28.preheader, label %._crit_edge29

.lr.ph28.preheader:                               ; preds = %._crit_edge24
  %38 = zext nneg i32 %.025 to i64
  br label %.lr.ph28

.lr.ph23:                                         ; preds = %._crit_edge, %50
  %39 = phi i64 [ %48, %50 ], [ %14, %._crit_edge ]
  %indvars.iv32 = phi i64 [ %indvars.iv.next33, %50 ], [ 0, %._crit_edge ]
  %40 = getelementptr inbounds [100001 x i32], ptr @y, i64 0, i64 %indvars.iv32
  %41 = load i32, ptr %40, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [100001 x i32], ptr @m, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !9
  %45 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %indvars.iv32
  store i32 %44, ptr %45, align 4, !tbaa !9
  %46 = invoke noundef i64 @_ZNK10__gnu_pbds33tree_order_statistics_node_updateINS_6detail30bin_search_tree_const_node_it_INS1_13rb_tree_node_IimSaIcEEENS1_25bin_search_tree_const_it_IPS5_iPiPKiRiRS9_Lb1ES4_EESD_S4_EESE_St4lessIiES4_E12order_of_keyESC_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(4) %45)
          to label %47 unwind label %53

47:                                               ; preds = %.lr.ph23
  %48 = sub i64 %39, %46
  store i64 %48, ptr %2, align 8, !tbaa !5
  %49 = invoke { ptr, i8 } @_ZN10__gnu_pbds6detail11rb_tree_setIiNS_9null_typeESt4lessIiENS0_11tree_traitsIiS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_E6insertERKi(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 4 dereferenceable(4) %45)
          to label %50 unwind label %53

50:                                               ; preds = %47
  %indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1
  %51 = load i64, ptr @N, align 8, !tbaa !5
  %52 = icmp sgt i64 %51, %indvars.iv.next33
  br i1 %52, label %.lr.ph23, label %._crit_edge24, !llvm.loop !15

53:                                               ; preds = %47, %.lr.ph23
  %54 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  call void @_ZN10__gnu_pbds6detail19bin_search_tree_setIiNS_9null_typeESt4lessIiENS0_11tree_traitsIiS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_ED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #5
  resume { ptr, i32 } %54

._crit_edge29:                                    ; preds = %.lr.ph28, %._crit_edge24
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  call void @_ZN10__gnu_pbds6detail19bin_search_tree_setIiNS_9null_typeESt4lessIiENS0_11tree_traitsIiS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_ED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #5
  ret void

.lr.ph28:                                         ; preds = %.lr.ph28.preheader, %.lr.ph28
  %indvars.iv35 = phi i64 [ %38, %.lr.ph28.preheader ], [ %indvars.iv.next36, %.lr.ph28 ]
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %56 = load i64, ptr %55, align 8, !tbaa !5
  store i64 %56, ptr @ans, align 8, !tbaa !5
  %57 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %indvars.iv35
  %58 = load i32, ptr %57, align 4, !tbaa !9
  %59 = shl nsw i32 %58, 1
  %60 = or disjoint i32 %59, 1
  %61 = sext i32 %60 to i64
  %62 = load i64, ptr @N, align 8, !tbaa !5
  %63 = load i64, ptr %2, align 8, !tbaa !5
  %64 = sub i64 %63, %62
  %65 = add i64 %64, %61
  store i64 %65, ptr %2, align 8, !tbaa !5
  %indvars.iv.next36 = add nsw i64 %indvars.iv35, -1
  %.not = icmp eq i64 %indvars.iv35, 0
  br i1 %.not, label %._crit_edge29, label %.lr.ph28, !llvm.loop !16
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10__gnu_pbds4treeIiNS_9null_typeESt4lessIiENS_11rb_tree_tagENS_33tree_order_statistics_node_updateESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(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 void @_ZN10__gnu_pbds6detail19bin_search_tree_setIiNS_9null_typeESt4lessIiENS0_11tree_traitsIiS2_S4_NS_33tree_order_statistics_node_updateENS_11rb_tree_tagESaIcEEES8_ED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #4 align 2

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


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass