; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2011-12/Open (12 Open G2)

; 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.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::pair<long long, std::pair<long long, std::pair<long long, long long>>>, std::allocator<std::pair<long long, std::pair<long long, std::pair<long long, long long>>>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<long long, std::pair<long long, std::pair<long long, long long>>>, std::allocator<std::pair<long long, std::pair<long long, std::pair<long long, long long>>>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<long long, std::pair<long long, std::pair<long long, long long>>>, std::allocator<std::pair<long long, std::pair<long long, std::pair<long long, long long>>>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<long long, std::pair<long long, std::pair<long long, long long>>>, std::allocator<std::pair<long long, std::pair<long long, std::pair<long long, long long>>>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"class.std::multiset" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long 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 }
%"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" }
%"struct.std::pair" = type { i64, %"struct.std::pair.3" }
%"struct.std::pair.3" = type { i64, %"struct.std::pair.5" }
%"struct.std::pair.5" = type { i64, i64 }
%"struct.std::pair.7" = type { i32, %"struct.std::pair.9" }
%"struct.std::pair.9" = type { i32, %"struct.std::pair.5" }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@t = external dso_local global %"class.std::deque", align 8
@H = external dso_local global [100001 x i64], align 16
@W = external dso_local global [100001 x i64], align 16
@dp = external dso_local global [100001 x i64], align 16
@N = external dso_local global i64, align 8
@L = external dso_local global i64, align 8
@cum = external dso_local global [100001 x i64], align 16
@best = external dso_local global %"class.std::multiset", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; 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 i32, align 4
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca i64, align 8
  %7 = alloca %"struct.std::pair.3", align 8
  %8 = alloca %"struct.std::pair.5", align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::pair.7", align 8
  %12 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %13 = alloca i64, align 8
  %14 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %15 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %16 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %17 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %18 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %19 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  store i32 0, ptr %1, align 4
  %20 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %21 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %22 = getelementptr i8, ptr %21, i64 -24
  %23 = load i64, ptr %22, align 8
  %24 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %23
  %25 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %24, ptr noundef null)
  %26 = 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)
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef nonnull align 8 dereferenceable(8) @L)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !8
  br label %28

28:                                               ; preds = %57, %0
  %29 = load i32, ptr %2, align 4, !tbaa !8
  %30 = sext i32 %29 to i64
  %31 = load i64, ptr @N, align 8, !tbaa !11
  %32 = add nsw i64 %31, 1
  %33 = icmp slt i64 %30, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %60

35:                                               ; preds = %28
  %36 = load i32, ptr %2, align 4, !tbaa !8
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [100001 x i64], ptr @H, i64 0, i64 %37
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %38)
  %40 = load i32, ptr %2, align 4, !tbaa !8
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [100001 x i64], ptr @W, i64 0, i64 %41
  %43 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %39, ptr noundef nonnull align 8 dereferenceable(8) %42)
  %44 = load i32, ptr %2, align 4, !tbaa !8
  %45 = sub nsw i32 %44, 1
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [100001 x i64], ptr @cum, i64 0, i64 %46
  %48 = load i64, ptr %47, align 8, !tbaa !11
  %49 = load i32, ptr %2, align 4, !tbaa !8
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [100001 x i64], ptr @W, i64 0, i64 %50
  %52 = load i64, ptr %51, align 8, !tbaa !11
  %53 = add nsw i64 %48, %52
  %54 = load i32, ptr %2, align 4, !tbaa !8
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [100001 x i64], ptr @cum, i64 0, i64 %55
  store i64 %53, ptr %56, align 8, !tbaa !11
  br label %57

57:                                               ; preds = %35
  %58 = load i32, ptr %2, align 4, !tbaa !8
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %2, align 4, !tbaa !8
  br label %28, !llvm.loop !13

60:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !8
  br label %61

61:                                               ; preds = %211, %60
  %62 = load i32, ptr %4, align 4, !tbaa !8
  %63 = sext i32 %62 to i64
  %64 = load i64, ptr @N, align 8, !tbaa !11
  %65 = add nsw i64 %64, 1
  %66 = icmp slt i64 %63, %65
  br i1 %66, label %68, label %67

67:                                               ; preds = %61
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %214

68:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 32, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %69 = load i32, ptr %4, align 4, !tbaa !8
  %70 = sub nsw i32 %69, 1
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %71
  %73 = load i64, ptr %72, align 8, !tbaa !11
  %74 = load i32, ptr %4, align 4, !tbaa !8
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [100001 x i64], ptr @H, i64 0, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !11
  %78 = add nsw i64 %73, %77
  store i64 %78, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #5
  %79 = load i32, ptr %4, align 4, !tbaa !8
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [100001 x i64], ptr @H, i64 0, i64 %80
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %82 = load i32, ptr %4, align 4, !tbaa !8
  %83 = sub nsw i32 %82, 1
  store i32 %83, ptr %9, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %84 = load i32, ptr %4, align 4, !tbaa !8
  %85 = sub nsw i32 %84, 1
  store i32 %85, ptr %10, align 4, !tbaa !8
  call void @_ZNSt4pairIxxEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10)
  call void @_ZNSt4pairIxS_IxxEEC2IxS0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKxRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(8) %81, ptr noundef nonnull align 8 dereferenceable(16) %8)
  call void @_ZNSt4pairIxS_IxS_IxxEEEC2IxS1_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS5_S6_EEEbE4typeELb1EEERKxRKS1_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(24) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %86

86:                                               ; preds = %100, %68
  %87 = call noundef i64 @_ZNKSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %88 = icmp ugt i64 %87, 0
  br i1 %88, label %89, label %98

89:                                               ; preds = %86
  %90 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE4backEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %91 = getelementptr inbounds %"struct.std::pair", ptr %90, i32 0, i32 1
  %92 = getelementptr inbounds %"struct.std::pair.3", ptr %91, i32 0, i32 0
  %93 = load i64, ptr %92, align 8, !tbaa !15
  %94 = getelementptr inbounds %"struct.std::pair", ptr %5, i32 0, i32 1
  %95 = getelementptr inbounds %"struct.std::pair.3", ptr %94, i32 0, i32 0
  %96 = load i64, ptr %95, align 8, !tbaa !15
  %97 = icmp sle i64 %93, %96
  br label %98

98:                                               ; preds = %89, %86
  %99 = phi i1 [ false, %86 ], [ %97, %89 ]
  br i1 %99, label %100, label %130

100:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #5
  %101 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE4backEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  call void @_ZNSt4pairIiS_IiS_IxxEEEC2IxS_IxS0_ETnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE18_ConstructiblePairIS6_S7_EEclsr6_PCCFPIS6_S7_EE26_ImplicitlyConvertiblePairIS6_S7_EEEbE4typeELb1EEERKS_IS6_S7_E(ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef nonnull align 8 dereferenceable(32) %101)
  call void @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %102 = getelementptr inbounds %"struct.std::pair.7", ptr %11, i32 0, i32 0
  %103 = load i32, ptr %102, align 8, !tbaa !19
  %104 = sext i32 %103 to i64
  store i64 %104, ptr %13, align 8, !tbaa !11
  %105 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE4findERKx(ptr noundef nonnull align 8 dereferenceable(48) @best, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %106 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %12, i32 0, i32 0
  store ptr %105, ptr %106, align 8
  %107 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %12, i32 0, i32 0
  %108 = load ptr, ptr %107, align 8
  %109 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIxE(ptr noundef nonnull align 8 dereferenceable(48) @best, ptr %108)
  %110 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %14, i32 0, i32 0
  store ptr %109, ptr %110, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  %111 = getelementptr inbounds %"struct.std::pair.7", ptr %11, i32 0, i32 1
  %112 = getelementptr inbounds %"struct.std::pair.9", ptr %111, i32 0, i32 1
  %113 = getelementptr inbounds %"struct.std::pair.5", ptr %112, i32 0, i32 0
  %114 = load i64, ptr %113, align 8, !tbaa !22
  %115 = getelementptr inbounds %"struct.std::pair", ptr %5, i32 0, i32 1
  %116 = getelementptr inbounds %"struct.std::pair.3", ptr %115, i32 0, i32 1
  %117 = getelementptr inbounds %"struct.std::pair.5", ptr %116, i32 0, i32 0
  store i64 %114, ptr %117, align 8, !tbaa !23
  %118 = getelementptr inbounds %"struct.std::pair", ptr %5, i32 0, i32 1
  %119 = getelementptr inbounds %"struct.std::pair.3", ptr %118, i32 0, i32 1
  %120 = getelementptr inbounds %"struct.std::pair.5", ptr %119, i32 0, i32 0
  %121 = load i64, ptr %120, align 8, !tbaa !23
  %122 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %121
  %123 = load i64, ptr %122, align 8, !tbaa !11
  %124 = load i32, ptr %4, align 4, !tbaa !8
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [100001 x i64], ptr @H, i64 0, i64 %125
  %127 = load i64, ptr %126, align 8, !tbaa !11
  %128 = add nsw i64 %123, %127
  %129 = getelementptr inbounds %"struct.std::pair", ptr %5, i32 0, i32 0
  store i64 %128, ptr %129, align 8, !tbaa !24
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #5
  br label %86, !llvm.loop !25

130:                                              ; preds = %98
  call void @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE9push_backERKS3_(ptr noundef nonnull align 8 dereferenceable(80) @t, ptr noundef nonnull align 8 dereferenceable(32) %5)
  %131 = getelementptr inbounds %"struct.std::pair", ptr %5, i32 0, i32 0
  %132 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) @best, ptr noundef nonnull align 8 dereferenceable(8) %131)
  %133 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %15, i32 0, i32 0
  store ptr %132, ptr %133, align 8
  br label %134

134:                                              ; preds = %146, %130
  %135 = load i32, ptr %4, align 4, !tbaa !8
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [100001 x i64], ptr @cum, i64 0, i64 %136
  %138 = load i64, ptr %137, align 8, !tbaa !11
  %139 = load i32, ptr %3, align 4, !tbaa !8
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [100001 x i64], ptr @cum, i64 0, i64 %140
  %142 = load i64, ptr %141, align 8, !tbaa !11
  %143 = sub nsw i64 %138, %142
  %144 = load i64, ptr @L, align 8, !tbaa !11
  %145 = icmp sgt i64 %143, %144
  br i1 %145, label %146, label %149

146:                                              ; preds = %134
  %147 = load i32, ptr %3, align 4, !tbaa !8
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %3, align 4, !tbaa !8
  br label %134, !llvm.loop !26

149:                                              ; preds = %134
  br label %150

150:                                              ; preds = %202, %149
  %151 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %152 = getelementptr inbounds %"struct.std::pair", ptr %151, i32 0, i32 1
  %153 = getelementptr inbounds %"struct.std::pair.3", ptr %152, i32 0, i32 1
  %154 = getelementptr inbounds %"struct.std::pair.5", ptr %153, i32 0, i32 0
  %155 = load i64, ptr %154, align 8, !tbaa !23
  %156 = load i32, ptr %3, align 4, !tbaa !8
  %157 = sext i32 %156 to i64
  %158 = icmp slt i64 %155, %157
  br i1 %158, label %159, label %203

159:                                              ; preds = %150
  %160 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %161 = getelementptr inbounds %"struct.std::pair", ptr %160, i32 0, i32 0
  %162 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE4findERKx(ptr noundef nonnull align 8 dereferenceable(48) @best, ptr noundef nonnull align 8 dereferenceable(8) %161)
  %163 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %16, i32 0, i32 0
  store ptr %162, ptr %163, align 8
  %164 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %16, i32 0, i32 0
  %165 = load ptr, ptr %164, align 8
  %166 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIxE(ptr noundef nonnull align 8 dereferenceable(48) @best, ptr %165)
  %167 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %17, i32 0, i32 0
  store ptr %166, ptr %167, align 8
  %168 = load i32, ptr %3, align 4, !tbaa !8
  %169 = sext i32 %168 to i64
  %170 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %171 = getelementptr inbounds %"struct.std::pair", ptr %170, i32 0, i32 1
  %172 = getelementptr inbounds %"struct.std::pair.3", ptr %171, i32 0, i32 1
  %173 = getelementptr inbounds %"struct.std::pair.5", ptr %172, i32 0, i32 0
  store i64 %169, ptr %173, align 8, !tbaa !23
  %174 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %175 = getelementptr inbounds %"struct.std::pair", ptr %174, i32 0, i32 1
  %176 = getelementptr inbounds %"struct.std::pair.3", ptr %175, i32 0, i32 1
  %177 = getelementptr inbounds %"struct.std::pair.5", ptr %176, i32 0, i32 0
  %178 = load i64, ptr %177, align 8, !tbaa !23
  %179 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %180 = getelementptr inbounds %"struct.std::pair", ptr %179, i32 0, i32 1
  %181 = getelementptr inbounds %"struct.std::pair.3", ptr %180, i32 0, i32 1
  %182 = getelementptr inbounds %"struct.std::pair.5", ptr %181, i32 0, i32 1
  %183 = load i64, ptr %182, align 8, !tbaa !27
  %184 = icmp sgt i64 %178, %183
  br i1 %184, label %185, label %186

185:                                              ; preds = %159
  call void @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE9pop_frontEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  br label %202

186:                                              ; preds = %159
  %187 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %188 = getelementptr inbounds %"struct.std::pair", ptr %187, i32 0, i32 1
  %189 = getelementptr inbounds %"struct.std::pair.3", ptr %188, i32 0, i32 0
  %190 = load i64, ptr %189, align 8, !tbaa !15
  %191 = load i32, ptr %3, align 4, !tbaa !8
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %192
  %194 = load i64, ptr %193, align 8, !tbaa !11
  %195 = add nsw i64 %190, %194
  %196 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %197 = getelementptr inbounds %"struct.std::pair", ptr %196, i32 0, i32 0
  store i64 %195, ptr %197, align 8, !tbaa !24
  %198 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %199 = getelementptr inbounds %"struct.std::pair", ptr %198, i32 0, i32 0
  %200 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) @best, ptr noundef nonnull align 8 dereferenceable(8) %199)
  %201 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %18, i32 0, i32 0
  store ptr %200, ptr %201, align 8
  br label %202

202:                                              ; preds = %186, %185
  br label %150, !llvm.loop !28

203:                                              ; preds = %150
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %204 = call ptr @_ZNKSt8multisetIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @best) #5
  %205 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %19, i32 0, i32 0
  store ptr %204, ptr %205, align 8
  %206 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIxEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %19) #5
  %207 = load i64, ptr %206, align 8, !tbaa !11
  %208 = load i32, ptr %4, align 4, !tbaa !8
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %209
  store i64 %207, ptr %210, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #5
  br label %211

211:                                              ; preds = %203
  %212 = load i32, ptr %4, align 4, !tbaa !8
  %213 = add nsw i32 %212, 1
  store i32 %213, ptr %4, align 4, !tbaa !8
  br label %61, !llvm.loop !29

214:                                              ; preds = %67
  %215 = load i64, ptr @N, align 8, !tbaa !11
  %216 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %215
  %217 = load i64, ptr %216, align 8, !tbaa !11
  %218 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %217)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  %219 = load i32, ptr %1, align 4
  ret i32 %219
}

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #2 align 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: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxxEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxS_IxxEEC2IxS0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKxRKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE9push_backERKS3_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

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

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

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

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

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

; 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 = { "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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !12, i64 8}
!16 = !{!"_ZTSSt4pairIxS_IxS_IxxEEE", !12, i64 0, !17, i64 8}
!17 = !{!"_ZTSSt4pairIxS_IxxEE", !12, i64 0, !18, i64 8}
!18 = !{!"_ZTSSt4pairIxxE", !12, i64 0, !12, i64 8}
!19 = !{!20, !9, i64 0}
!20 = !{!"_ZTSSt4pairIiS_IiS_IxxEEE", !9, i64 0, !21, i64 8}
!21 = !{!"_ZTSSt4pairIiS_IxxEE", !9, i64 0, !18, i64 8}
!22 = !{!20, !12, i64 16}
!23 = !{!16, !12, i64 16}
!24 = !{!16, !12, i64 0}
!25 = distinct !{!25, !14}
!26 = distinct !{!26, !14}
!27 = !{!16, !12, i64 24}
!28 = distinct !{!28, !14}
!29 = distinct !{!29, !14}


; 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.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::pair<long long, std::pair<long long, std::pair<long long, long long>>>, std::allocator<std::pair<long long, std::pair<long long, std::pair<long long, long long>>>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<long long, std::pair<long long, std::pair<long long, long long>>>, std::allocator<std::pair<long long, std::pair<long long, std::pair<long long, long long>>>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<long long, std::pair<long long, std::pair<long long, long long>>>, std::allocator<std::pair<long long, std::pair<long long, std::pair<long long, long long>>>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<long long, std::pair<long long, std::pair<long long, long long>>>, std::allocator<std::pair<long long, std::pair<long long, std::pair<long long, long long>>>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"class.std::multiset" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long 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 }
%"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" }
%"struct.std::pair" = type { i64, %"struct.std::pair.3" }
%"struct.std::pair.3" = type { i64, %"struct.std::pair.5" }
%"struct.std::pair.5" = type { i64, i64 }
%"struct.std::pair.7" = type { i32, %"struct.std::pair.9" }
%"struct.std::pair.9" = type { i32, %"struct.std::pair.5" }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@t = external dso_local global %"class.std::deque", align 8
@H = external dso_local global [100001 x i64], align 16
@W = external dso_local global [100001 x i64], align 16
@dp = external dso_local local_unnamed_addr global [100001 x i64], align 16
@N = external dso_local global i64, align 8
@L = external dso_local global i64, align 8
@cum = external dso_local local_unnamed_addr global [100001 x i64], align 16
@best = external dso_local global %"class.std::multiset", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %"struct.std::pair", align 8
  %2 = alloca i64, align 8
  %3 = alloca %"struct.std::pair.3", align 8
  %4 = alloca %"struct.std::pair.5", align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair.7", align 8
  %8 = alloca i64, align 8
  %9 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %10 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %11 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %13
  %15 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %14, ptr noundef null)
  %16 = 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)
  %17 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 8 dereferenceable(8) @L)
  %18 = load i64, ptr @N, align 8, !tbaa !8
  %.not38 = icmp slt i64 %18, 1
  br i1 %.not38, label %._crit_edge48, label %.lr.ph

.preheader36:                                     ; preds = %.lr.ph
  %.not3344 = icmp slt i64 %32, 1
  br i1 %.not3344, label %._crit_edge48, label %.lr.ph47

.lr.ph47:                                         ; preds = %.preheader36
  %19 = getelementptr inbounds i8, ptr %1, i64 8
  %20 = getelementptr inbounds i8, ptr %7, i64 16
  %21 = getelementptr inbounds i8, ptr %1, i64 16
  %.pre = load i64, ptr @dp, align 16, !tbaa !8
  br label %36

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %22 = getelementptr inbounds [100001 x i64], ptr @H, i64 0, i64 %indvars.iv
  %23 = 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) %22)
  %24 = getelementptr inbounds [100001 x i64], ptr @W, i64 0, i64 %indvars.iv
  %25 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(8) %24)
  %26 = add nsw i64 %indvars.iv, -1
  %27 = getelementptr inbounds [100001 x i64], ptr @cum, i64 0, i64 %26
  %28 = load i64, ptr %27, align 8, !tbaa !8
  %29 = load i64, ptr %24, align 8, !tbaa !8
  %30 = add nsw i64 %29, %28
  %31 = getelementptr inbounds [100001 x i64], ptr @cum, i64 0, i64 %indvars.iv
  store i64 %30, ptr %31, align 8, !tbaa !8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %32 = load i64, ptr @N, align 8, !tbaa !8
  %.not.not = icmp sgt i64 %32, %indvars.iv
  br i1 %.not.not, label %.lr.ph, label %.preheader36, !llvm.loop !11

._crit_edge48:                                    ; preds = %._crit_edge, %0, %.preheader36
  %.lcssa37 = phi i64 [ %32, %.preheader36 ], [ %18, %0 ], [ %107, %._crit_edge ]
  %33 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %.lcssa37
  %34 = load i64, ptr %33, align 8, !tbaa !8
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %34)
  ret i32 0

36:                                               ; preds = %.lr.ph47, %._crit_edge
  %37 = phi i64 [ %.pre, %.lr.ph47 ], [ %105, %._crit_edge ]
  %indvars.iv54 = phi i64 [ 1, %.lr.ph47 ], [ %indvars.iv.next55, %._crit_edge ]
  %.02846 = phi i64 [ 0, %.lr.ph47 ], [ %indvars.iv51, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %38 = getelementptr inbounds [100001 x i64], ptr @H, i64 0, i64 %indvars.iv54
  %39 = load i64, ptr %38, align 8, !tbaa !8
  %40 = add nsw i64 %39, %37
  store i64 %40, ptr %2, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %41 = trunc i64 %indvars.iv54 to i32
  %42 = add i32 %41, -1
  store i32 %42, ptr %5, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  store i32 %42, ptr %6, align 4, !tbaa !13
  call void @_ZNSt4pairIxxEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @_ZNSt4pairIxS_IxxEEC2IxS0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKxRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(8) %38, ptr noundef nonnull align 8 dereferenceable(16) %4)
  call void @_ZNSt4pairIxS_IxS_IxxEEEC2IxS1_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS5_S6_EEEbE4typeELb1EEERKxRKS1_(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(24) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  %43 = call noundef i64 @_ZNKSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %.not3440 = icmp eq i64 %43, 0
  br i1 %.not3440, label %.critedge, label %.lr.ph41

.lr.ph41:                                         ; preds = %36, %48
  %44 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE4backEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %45 = getelementptr inbounds i8, ptr %44, i64 8
  %46 = load i64, ptr %45, align 8, !tbaa !15
  %47 = load i64, ptr %19, align 8, !tbaa !15
  %.not35 = icmp sgt i64 %46, %47
  br i1 %.not35, label %.critedge, label %48

48:                                               ; preds = %.lr.ph41
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #5
  %49 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE4backEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  call void @_ZNSt4pairIiS_IiS_IxxEEEC2IxS_IxS0_ETnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE18_ConstructiblePairIS6_S7_EEclsr6_PCCFPIS6_S7_EE26_ImplicitlyConvertiblePairIS6_S7_EEEbE4typeELb1EEERKS_IS6_S7_E(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull align 8 dereferenceable(32) %49)
  call void @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  %50 = load i32, ptr %7, align 8, !tbaa !19
  %51 = sext i32 %50 to i64
  store i64 %51, ptr %8, align 8, !tbaa !8
  %52 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE4findERKx(ptr noundef nonnull align 8 dereferenceable(48) @best, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %53 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIxE(ptr noundef nonnull align 8 dereferenceable(48) @best, ptr %52)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  %54 = load i64, ptr %20, align 8, !tbaa !22
  store i64 %54, ptr %21, align 8, !tbaa !23
  %55 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !8
  %57 = load i64, ptr %38, align 8, !tbaa !8
  %58 = add nsw i64 %57, %56
  store i64 %58, ptr %1, align 8, !tbaa !24
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #5
  %59 = call noundef i64 @_ZNKSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %.not34 = icmp eq i64 %59, 0
  br i1 %.not34, label %.critedge, label %.lr.ph41, !llvm.loop !25

.critedge:                                        ; preds = %.lr.ph41, %48, %36
  call void @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE9push_backERKS3_(ptr noundef nonnull align 8 dereferenceable(80) @t, ptr noundef nonnull align 8 dereferenceable(32) %1)
  %60 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) @best, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %61 = getelementptr inbounds [100001 x i64], ptr @cum, i64 0, i64 %indvars.iv54
  %62 = load i64, ptr %61, align 8, !tbaa !8
  %63 = load i64, ptr @L, align 8, !tbaa !8
  %sext = shl i64 %.02846, 32
  %64 = ashr exact i64 %sext, 32
  br label %65

65:                                               ; preds = %65, %.critedge
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %65 ], [ %64, %.critedge ]
  %66 = getelementptr inbounds [100001 x i64], ptr @cum, i64 0, i64 %indvars.iv51
  %67 = load i64, ptr %66, align 8, !tbaa !8
  %68 = sub nsw i64 %62, %67
  %69 = icmp sgt i64 %68, %63
  %indvars.iv.next52 = add nsw i64 %indvars.iv51, 1
  br i1 %69, label %65, label %.preheader, !llvm.loop !26

.preheader:                                       ; preds = %65
  %70 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %71 = getelementptr inbounds i8, ptr %70, i64 16
  %72 = load i64, ptr %71, align 8, !tbaa !23
  %73 = icmp slt i64 %72, %indvars.iv51
  br i1 %73, label %.lr.ph43, label %._crit_edge

.lr.ph43:                                         ; preds = %.preheader
  %74 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %indvars.iv51
  br label %75

75:                                               ; preds = %.lr.ph43, %98
  %76 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %77 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE4findERKx(ptr noundef nonnull align 8 dereferenceable(48) @best, ptr noundef nonnull align 8 dereferenceable(8) %76)
  %78 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIxE(ptr noundef nonnull align 8 dereferenceable(48) @best, ptr %77)
  %79 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %80 = getelementptr inbounds i8, ptr %79, i64 16
  store i64 %indvars.iv51, ptr %80, align 8, !tbaa !23
  %81 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %82 = getelementptr inbounds i8, ptr %81, i64 16
  %83 = load i64, ptr %82, align 8, !tbaa !23
  %84 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %85 = getelementptr inbounds i8, ptr %84, i64 24
  %86 = load i64, ptr %85, align 8, !tbaa !27
  %87 = icmp sgt i64 %83, %86
  br i1 %87, label %88, label %89

88:                                               ; preds = %75
  call void @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE9pop_frontEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  br label %98

89:                                               ; preds = %75
  %90 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %91 = getelementptr inbounds i8, ptr %90, i64 8
  %92 = load i64, ptr %91, align 8, !tbaa !15
  %93 = load i64, ptr %74, align 8, !tbaa !8
  %94 = add nsw i64 %93, %92
  %95 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  store i64 %94, ptr %95, align 8, !tbaa !24
  %96 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %97 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) @best, ptr noundef nonnull align 8 dereferenceable(8) %96)
  br label %98

98:                                               ; preds = %89, %88
  %99 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @t) #5
  %100 = getelementptr inbounds i8, ptr %99, i64 16
  %101 = load i64, ptr %100, align 8, !tbaa !23
  %102 = icmp slt i64 %101, %indvars.iv51
  br i1 %102, label %75, label %._crit_edge, !llvm.loop !28

._crit_edge:                                      ; preds = %98, %.preheader
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #5
  %103 = call ptr @_ZNKSt8multisetIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @best) #5
  store ptr %103, ptr %9, align 8
  %104 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIxEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  %105 = load i64, ptr %104, align 8, !tbaa !8
  %106 = getelementptr inbounds [100001 x i64], ptr @dp, i64 0, i64 %indvars.iv54
  store i64 %105, ptr %106, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #5
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %107 = load i64, ptr @N, align 8, !tbaa !8
  %.not33.not = icmp sgt i64 %107, %indvars.iv54
  br i1 %.not33.not, label %36, label %._crit_edge48, !llvm.loop !29
}

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #2 align 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: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxxEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxS_IxxEEC2IxS0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKxRKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5dequeISt4pairIxS0_IxS0_IxxEEESaIS3_EE9push_backERKS3_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

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

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

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

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

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

; 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 = { "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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"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 = !{!16, !9, i64 8}
!16 = !{!"_ZTSSt4pairIxS_IxS_IxxEEE", !9, i64 0, !17, i64 8}
!17 = !{!"_ZTSSt4pairIxS_IxxEE", !9, i64 0, !18, i64 8}
!18 = !{!"_ZTSSt4pairIxxE", !9, i64 0, !9, i64 8}
!19 = !{!20, !14, i64 0}
!20 = !{!"_ZTSSt4pairIiS_IiS_IxxEEE", !14, i64 0, !21, i64 8}
!21 = !{!"_ZTSSt4pairIiS_IxxEE", !14, i64 0, !18, i64 8}
!22 = !{!20, !9, i64 16}
!23 = !{!16, !9, i64 16}
!24 = !{!16, !9, i64 0}
!25 = distinct !{!25, !12}
!26 = distinct !{!26, !12}
!27 = !{!16, !9, i64 24}
!28 = distinct !{!28, !12}
!29 = distinct !{!29, !12}


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