; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2014-15/Dec 2014 Gold (14 Dec 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"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::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"struct.std::pair" = type { i32, i32 }

@N = external dso_local global i32, align 4
@Q = external dso_local global i32, align 4
@loc = external dso_local global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [12 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4distSt4pairIiiES0_(i64, i64) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z9modifysumii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9modifymaxii(i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4qsumii(i32 noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z4qmaxii(i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::basic_ifstream", align 8
  %3 = alloca %"class.std::basic_ofstream", align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"struct.std::pair", align 4
  %9 = alloca %"struct.std::pair", align 4
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::pair", align 4
  %12 = alloca %"struct.std::pair", align 4
  %13 = alloca %"struct.std::pair", align 4
  %14 = alloca %"struct.std::pair", align 4
  %15 = alloca %"struct.std::pair", align 4
  %16 = alloca %"struct.std::pair", align 4
  %17 = alloca i32, align 4
  %18 = alloca i8, align 1
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca %"struct.std::pair", align 4
  %23 = alloca %"struct.std::pair", align 4
  %24 = alloca %"struct.std::pair", align 4
  %25 = alloca %"struct.std::pair", align 4
  %26 = alloca %"struct.std::pair", align 4
  %27 = alloca %"struct.std::pair", align 4
  %28 = alloca %"struct.std::pair", align 4
  %29 = alloca %"struct.std::pair", align 4
  %30 = alloca %"struct.std::pair", align 4
  %31 = alloca %"struct.std::pair", align 4
  %32 = alloca %"struct.std::pair", align 4
  %33 = alloca %"struct.std::pair", align 4
  %34 = alloca %"struct.std::pair", align 4
  %35 = alloca %"struct.std::pair", align 4
  %36 = alloca %"struct.std::pair", align 4
  %37 = alloca %"struct.std::pair", align 4
  %38 = alloca %"struct.std::pair", align 4
  %39 = alloca %"struct.std::pair", align 4
  %40 = alloca %"struct.std::pair", align 4
  %41 = alloca %"struct.std::pair", align 4
  %42 = alloca %"struct.std::pair", align 4
  %43 = alloca %"struct.std::pair", align 4
  %44 = alloca %"struct.std::pair", align 4
  %45 = alloca i32, align 4
  %46 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 520, ptr %2) #7
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256) %2, ptr noundef @.str, i32 noundef 8)
  call void @llvm.lifetime.start.p0(i64 512, ptr %3) #7
  invoke void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248) %3, ptr noundef @.str.2, i32 noundef 16)
          to label %47 unwind label %60

47:                                               ; preds = %0
  %48 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) @N)
          to label %49 unwind label %64

49:                                               ; preds = %47
  %50 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %48, ptr noundef nonnull align 4 dereferenceable(4) @Q)
          to label %51 unwind label %64

51:                                               ; preds = %49
  %52 = load i32, ptr @N, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  invoke void @_ZNSt6vectorISt4pairIiiESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %53)
          to label %54 unwind label %64

54:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %81, %54
  %56 = load i32, ptr %6, align 4, !tbaa !5
  %57 = load i32, ptr @N, align 4, !tbaa !5
  %58 = icmp slt i32 %56, %57
  br i1 %58, label %68, label %59

59:                                               ; preds = %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %88

60:                                               ; preds = %0
  %61 = landingpad { ptr, i32 }
          cleanup
  %62 = extractvalue { ptr, i32 } %61, 0
  store ptr %62, ptr %4, align 8
  %63 = extractvalue { ptr, i32 } %61, 1
  store i32 %63, ptr %5, align 4
  br label %392

64:                                               ; preds = %51, %49, %47
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %4, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %5, align 4
  br label %391

68:                                               ; preds = %55
  %69 = load i32, ptr %6, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %70) #7
  %72 = getelementptr inbounds %"struct.std::pair", ptr %71, i32 0, i32 0
  %73 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) %72)
          to label %74 unwind label %84

74:                                               ; preds = %68
  %75 = load i32, ptr %6, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %76) #7
  %78 = getelementptr inbounds %"struct.std::pair", ptr %77, i32 0, i32 1
  %79 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %73, ptr noundef nonnull align 4 dereferenceable(4) %78)
          to label %80 unwind label %84

80:                                               ; preds = %74
  br label %81

81:                                               ; preds = %80
  %82 = load i32, ptr %6, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %6, align 4, !tbaa !5
  br label %55, !llvm.loop !9

84:                                               ; preds = %74, %68
  %85 = landingpad { ptr, i32 }
          cleanup
  %86 = extractvalue { ptr, i32 } %85, 0
  store ptr %86, ptr %4, align 8
  %87 = extractvalue { ptr, i32 } %85, 1
  store i32 %87, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %391

88:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %107, %88
  %90 = load i32, ptr %7, align 4, !tbaa !5
  %91 = load i32, ptr @N, align 4, !tbaa !5
  %92 = sub nsw i32 %91, 1
  %93 = icmp slt i32 %90, %92
  br i1 %93, label %95, label %94

94:                                               ; preds = %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %110

95:                                               ; preds = %89
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = load i32, ptr %7, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %98) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 %99, i64 8, i1 false)
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = add nsw i32 %100, 1
  %102 = sext i32 %101 to i64
  %103 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %102) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 %103, i64 8, i1 false)
  %104 = load i64, ptr %8, align 4
  %105 = load i64, ptr %9, align 4
  %106 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %104, i64 %105)
  call void @_Z9modifysumii(i32 noundef %96, i32 noundef %106)
  br label %107

107:                                              ; preds = %95
  %108 = load i32, ptr %7, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %7, align 4, !tbaa !5
  br label %89, !llvm.loop !11

110:                                              ; preds = %94
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %153, %110
  %112 = load i32, ptr %10, align 4, !tbaa !5
  %113 = load i32, ptr @N, align 4, !tbaa !5
  %114 = sub nsw i32 %113, 2
  %115 = icmp slt i32 %112, %114
  br i1 %115, label %117, label %116

116:                                              ; preds = %111
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %160

117:                                              ; preds = %111
  %118 = load i32, ptr %10, align 4, !tbaa !5
  %119 = load i32, ptr %10, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %120) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %121, i64 8, i1 false)
  %122 = load i32, ptr %10, align 4, !tbaa !5
  %123 = add nsw i32 %122, 1
  %124 = sext i32 %123 to i64
  %125 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %124) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %125, i64 8, i1 false)
  %126 = load i64, ptr %11, align 4
  %127 = load i64, ptr %12, align 4
  %128 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %126, i64 %127)
  %129 = load i32, ptr %10, align 4, !tbaa !5
  %130 = add nsw i32 %129, 1
  %131 = sext i32 %130 to i64
  %132 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %131) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %132, i64 8, i1 false)
  %133 = load i32, ptr %10, align 4, !tbaa !5
  %134 = add nsw i32 %133, 2
  %135 = sext i32 %134 to i64
  %136 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %135) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %136, i64 8, i1 false)
  %137 = load i64, ptr %13, align 4
  %138 = load i64, ptr %14, align 4
  %139 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %137, i64 %138)
  %140 = add nsw i32 %128, %139
  %141 = load i32, ptr %10, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %142) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %143, i64 8, i1 false)
  %144 = load i32, ptr %10, align 4, !tbaa !5
  %145 = add nsw i32 %144, 2
  %146 = sext i32 %145 to i64
  %147 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %146) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 4 %147, i64 8, i1 false)
  %148 = load i64, ptr %15, align 4
  %149 = load i64, ptr %16, align 4
  %150 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %148, i64 %149)
  %151 = sub nsw i32 %140, %150
  invoke void @_Z9modifymaxii(i32 noundef %118, i32 noundef %151)
          to label %152 unwind label %156

152:                                              ; preds = %117
  br label %153

153:                                              ; preds = %152
  %154 = load i32, ptr %10, align 4, !tbaa !5
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %10, align 4, !tbaa !5
  br label %111, !llvm.loop !12

156:                                              ; preds = %117
  %157 = landingpad { ptr, i32 }
          cleanup
  %158 = extractvalue { ptr, i32 } %157, 0
  store ptr %158, ptr %4, align 8
  %159 = extractvalue { ptr, i32 } %157, 1
  store i32 %159, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %391

160:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %161

161:                                              ; preds = %385, %160
  %162 = load i32, ptr %17, align 4, !tbaa !5
  %163 = load i32, ptr @Q, align 4, !tbaa !5
  %164 = icmp slt i32 %162, %163
  br i1 %164, label %166, label %165

165:                                              ; preds = %161
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %389

166:                                              ; preds = %161
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #7
  %167 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 1 dereferenceable(1) %18)
          to label %168 unwind label %202

168:                                              ; preds = %166
  %169 = load i8, ptr %18, align 1, !tbaa !13
  %170 = sext i8 %169 to i32
  %171 = icmp eq i32 %170, 85
  br i1 %171, label %172, label %358

172:                                              ; preds = %168
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  %173 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) %19)
          to label %174 unwind label %206

174:                                              ; preds = %172
  %175 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %173, ptr noundef nonnull align 4 dereferenceable(4) %20)
          to label %176 unwind label %206

176:                                              ; preds = %174
  %177 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %175, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %178 unwind label %206

178:                                              ; preds = %176
  %179 = load i32, ptr %19, align 4, !tbaa !5
  %180 = add nsw i32 %179, -1
  store i32 %180, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  invoke void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %22, ptr noundef nonnull align 4 dereferenceable(4) %20, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %181 unwind label %210

181:                                              ; preds = %178
  %182 = load i32, ptr %19, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %183) #7
  %185 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %184, ptr noundef nonnull align 4 dereferenceable(8) %22) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  %186 = load i32, ptr %19, align 4, !tbaa !5
  %187 = load i32, ptr @N, align 4, !tbaa !5
  %188 = sub nsw i32 %187, 1
  %189 = icmp slt i32 %186, %188
  br i1 %189, label %190, label %214

190:                                              ; preds = %181
  %191 = load i32, ptr %19, align 4, !tbaa !5
  %192 = load i32, ptr %19, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %194 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %193) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 4 %194, i64 8, i1 false)
  %195 = load i32, ptr %19, align 4, !tbaa !5
  %196 = add nsw i32 %195, 1
  %197 = sext i32 %196 to i64
  %198 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %197) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %198, i64 8, i1 false)
  %199 = load i64, ptr %23, align 4
  %200 = load i64, ptr %24, align 4
  %201 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %199, i64 %200)
  call void @_Z9modifysumii(i32 noundef %191, i32 noundef %201)
  br label %214

202:                                              ; preds = %166
  %203 = landingpad { ptr, i32 }
          cleanup
  %204 = extractvalue { ptr, i32 } %203, 0
  store ptr %204, ptr %4, align 8
  %205 = extractvalue { ptr, i32 } %203, 1
  store i32 %205, ptr %5, align 4
  br label %388

206:                                              ; preds = %320, %278, %233, %176, %174, %172
  %207 = landingpad { ptr, i32 }
          cleanup
  %208 = extractvalue { ptr, i32 } %207, 0
  store ptr %208, ptr %4, align 8
  %209 = extractvalue { ptr, i32 } %207, 1
  store i32 %209, ptr %5, align 4
  br label %357

210:                                              ; preds = %178
  %211 = landingpad { ptr, i32 }
          cleanup
  %212 = extractvalue { ptr, i32 } %211, 0
  store ptr %212, ptr %4, align 8
  %213 = extractvalue { ptr, i32 } %211, 1
  store i32 %213, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  br label %357

214:                                              ; preds = %190, %181
  %215 = load i32, ptr %19, align 4, !tbaa !5
  %216 = icmp sgt i32 %215, 0
  br i1 %216, label %217, label %230

217:                                              ; preds = %214
  %218 = load i32, ptr %19, align 4, !tbaa !5
  %219 = sub nsw i32 %218, 1
  %220 = load i32, ptr %19, align 4, !tbaa !5
  %221 = sub nsw i32 %220, 1
  %222 = sext i32 %221 to i64
  %223 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %222) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %25, ptr align 4 %223, i64 8, i1 false)
  %224 = load i32, ptr %19, align 4, !tbaa !5
  %225 = sext i32 %224 to i64
  %226 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %225) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 4 %226, i64 8, i1 false)
  %227 = load i64, ptr %25, align 4
  %228 = load i64, ptr %26, align 4
  %229 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %227, i64 %228)
  call void @_Z9modifysumii(i32 noundef %219, i32 noundef %229)
  br label %230

230:                                              ; preds = %217, %214
  %231 = load i32, ptr %19, align 4, !tbaa !5
  %232 = icmp sgt i32 %231, 1
  br i1 %232, label %233, label %270

233:                                              ; preds = %230
  %234 = load i32, ptr %19, align 4, !tbaa !5
  %235 = sub nsw i32 %234, 2
  %236 = load i32, ptr %19, align 4, !tbaa !5
  %237 = sub nsw i32 %236, 2
  %238 = sext i32 %237 to i64
  %239 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %238) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %27, ptr align 4 %239, i64 8, i1 false)
  %240 = load i32, ptr %19, align 4, !tbaa !5
  %241 = sub nsw i32 %240, 1
  %242 = sext i32 %241 to i64
  %243 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %242) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %28, ptr align 4 %243, i64 8, i1 false)
  %244 = load i64, ptr %27, align 4
  %245 = load i64, ptr %28, align 4
  %246 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %244, i64 %245)
  %247 = load i32, ptr %19, align 4, !tbaa !5
  %248 = sub nsw i32 %247, 1
  %249 = sext i32 %248 to i64
  %250 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %249) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %29, ptr align 4 %250, i64 8, i1 false)
  %251 = load i32, ptr %19, align 4, !tbaa !5
  %252 = sext i32 %251 to i64
  %253 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %252) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %30, ptr align 4 %253, i64 8, i1 false)
  %254 = load i64, ptr %29, align 4
  %255 = load i64, ptr %30, align 4
  %256 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %254, i64 %255)
  %257 = add nsw i32 %246, %256
  %258 = load i32, ptr %19, align 4, !tbaa !5
  %259 = sub nsw i32 %258, 2
  %260 = sext i32 %259 to i64
  %261 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %260) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %31, ptr align 4 %261, i64 8, i1 false)
  %262 = load i32, ptr %19, align 4, !tbaa !5
  %263 = sext i32 %262 to i64
  %264 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %263) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %32, ptr align 4 %264, i64 8, i1 false)
  %265 = load i64, ptr %31, align 4
  %266 = load i64, ptr %32, align 4
  %267 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %265, i64 %266)
  %268 = sub nsw i32 %257, %267
  invoke void @_Z9modifymaxii(i32 noundef %235, i32 noundef %268)
          to label %269 unwind label %206

269:                                              ; preds = %233
  br label %270

270:                                              ; preds = %269, %230
  %271 = load i32, ptr %19, align 4, !tbaa !5
  %272 = icmp sgt i32 %271, 0
  br i1 %272, label %273, label %315

273:                                              ; preds = %270
  %274 = load i32, ptr %19, align 4, !tbaa !5
  %275 = load i32, ptr @N, align 4, !tbaa !5
  %276 = sub nsw i32 %275, 1
  %277 = icmp slt i32 %274, %276
  br i1 %277, label %278, label %315

278:                                              ; preds = %273
  %279 = load i32, ptr %19, align 4, !tbaa !5
  %280 = sub nsw i32 %279, 1
  %281 = load i32, ptr %19, align 4, !tbaa !5
  %282 = sub nsw i32 %281, 1
  %283 = sext i32 %282 to i64
  %284 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %283) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %33, ptr align 4 %284, i64 8, i1 false)
  %285 = load i32, ptr %19, align 4, !tbaa !5
  %286 = sext i32 %285 to i64
  %287 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %286) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %34, ptr align 4 %287, i64 8, i1 false)
  %288 = load i64, ptr %33, align 4
  %289 = load i64, ptr %34, align 4
  %290 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %288, i64 %289)
  %291 = load i32, ptr %19, align 4, !tbaa !5
  %292 = sext i32 %291 to i64
  %293 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %292) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %35, ptr align 4 %293, i64 8, i1 false)
  %294 = load i32, ptr %19, align 4, !tbaa !5
  %295 = add nsw i32 %294, 1
  %296 = sext i32 %295 to i64
  %297 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %296) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %36, ptr align 4 %297, i64 8, i1 false)
  %298 = load i64, ptr %35, align 4
  %299 = load i64, ptr %36, align 4
  %300 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %298, i64 %299)
  %301 = add nsw i32 %290, %300
  %302 = load i32, ptr %19, align 4, !tbaa !5
  %303 = sub nsw i32 %302, 1
  %304 = sext i32 %303 to i64
  %305 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %304) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %37, ptr align 4 %305, i64 8, i1 false)
  %306 = load i32, ptr %19, align 4, !tbaa !5
  %307 = add nsw i32 %306, 1
  %308 = sext i32 %307 to i64
  %309 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %308) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %38, ptr align 4 %309, i64 8, i1 false)
  %310 = load i64, ptr %37, align 4
  %311 = load i64, ptr %38, align 4
  %312 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %310, i64 %311)
  %313 = sub nsw i32 %301, %312
  invoke void @_Z9modifymaxii(i32 noundef %280, i32 noundef %313)
          to label %314 unwind label %206

314:                                              ; preds = %278
  br label %315

315:                                              ; preds = %314, %273, %270
  %316 = load i32, ptr %19, align 4, !tbaa !5
  %317 = load i32, ptr @N, align 4, !tbaa !5
  %318 = sub nsw i32 %317, 2
  %319 = icmp slt i32 %316, %318
  br i1 %319, label %320, label %356

320:                                              ; preds = %315
  %321 = load i32, ptr %19, align 4, !tbaa !5
  %322 = load i32, ptr %19, align 4, !tbaa !5
  %323 = sext i32 %322 to i64
  %324 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %323) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %39, ptr align 4 %324, i64 8, i1 false)
  %325 = load i32, ptr %19, align 4, !tbaa !5
  %326 = add nsw i32 %325, 1
  %327 = sext i32 %326 to i64
  %328 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %327) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %40, ptr align 4 %328, i64 8, i1 false)
  %329 = load i64, ptr %39, align 4
  %330 = load i64, ptr %40, align 4
  %331 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %329, i64 %330)
  %332 = load i32, ptr %19, align 4, !tbaa !5
  %333 = add nsw i32 %332, 1
  %334 = sext i32 %333 to i64
  %335 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %334) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %41, ptr align 4 %335, i64 8, i1 false)
  %336 = load i32, ptr %19, align 4, !tbaa !5
  %337 = add nsw i32 %336, 2
  %338 = sext i32 %337 to i64
  %339 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %338) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %42, ptr align 4 %339, i64 8, i1 false)
  %340 = load i64, ptr %41, align 4
  %341 = load i64, ptr %42, align 4
  %342 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %340, i64 %341)
  %343 = add nsw i32 %331, %342
  %344 = load i32, ptr %19, align 4, !tbaa !5
  %345 = sext i32 %344 to i64
  %346 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %345) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %43, ptr align 4 %346, i64 8, i1 false)
  %347 = load i32, ptr %19, align 4, !tbaa !5
  %348 = add nsw i32 %347, 2
  %349 = sext i32 %348 to i64
  %350 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %349) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %44, ptr align 4 %350, i64 8, i1 false)
  %351 = load i64, ptr %43, align 4
  %352 = load i64, ptr %44, align 4
  %353 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %351, i64 %352)
  %354 = sub nsw i32 %343, %353
  invoke void @_Z9modifymaxii(i32 noundef %321, i32 noundef %354)
          to label %355 unwind label %206

355:                                              ; preds = %320
  br label %356

356:                                              ; preds = %355, %315
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %384

357:                                              ; preds = %210, %206
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %388

358:                                              ; preds = %168
  call void @llvm.lifetime.start.p0(i64 4, ptr %45) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %46) #7
  %359 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) %45)
          to label %360 unwind label %380

360:                                              ; preds = %358
  %361 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %359, ptr noundef nonnull align 4 dereferenceable(4) %46)
          to label %362 unwind label %380

362:                                              ; preds = %360
  %363 = load i32, ptr %45, align 4, !tbaa !5
  %364 = add nsw i32 %363, -1
  store i32 %364, ptr %45, align 4, !tbaa !5
  %365 = load i32, ptr %46, align 4, !tbaa !5
  %366 = add nsw i32 %365, -1
  store i32 %366, ptr %46, align 4, !tbaa !5
  %367 = load i32, ptr %45, align 4, !tbaa !5
  %368 = load i32, ptr %46, align 4, !tbaa !5
  %369 = call noundef i32 @_Z4qsumii(i32 noundef %367, i32 noundef %368)
  %370 = load i32, ptr %45, align 4, !tbaa !5
  %371 = load i32, ptr %46, align 4, !tbaa !5
  %372 = sub nsw i32 %371, 1
  %373 = invoke noundef i32 @_Z4qmaxii(i32 noundef %370, i32 noundef %372)
          to label %374 unwind label %380

374:                                              ; preds = %362
  %375 = sub nsw i32 %369, %373
  %376 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef %375)
          to label %377 unwind label %380

377:                                              ; preds = %374
  %378 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %376, ptr noundef @.str.3)
          to label %379 unwind label %380

379:                                              ; preds = %377
  call void @llvm.lifetime.end.p0(i64 4, ptr %46) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %45) #7
  br label %384

380:                                              ; preds = %377, %374, %362, %360, %358
  %381 = landingpad { ptr, i32 }
          cleanup
  %382 = extractvalue { ptr, i32 } %381, 0
  store ptr %382, ptr %4, align 8
  %383 = extractvalue { ptr, i32 } %381, 1
  store i32 %383, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %46) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %45) #7
  br label %388

384:                                              ; preds = %379, %356
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #7
  br label %385

385:                                              ; preds = %384
  %386 = load i32, ptr %17, align 4, !tbaa !5
  %387 = add nsw i32 %386, 1
  store i32 %387, ptr %17, align 4, !tbaa !5
  br label %161, !llvm.loop !14

388:                                              ; preds = %380, %357, %202
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %391

389:                                              ; preds = %165
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %3) #7
  call void @llvm.lifetime.end.p0(i64 512, ptr %3) #7
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %2) #7
  call void @llvm.lifetime.end.p0(i64 520, ptr %2) #7
  %390 = load i32, ptr %1, align 4
  ret i32 %390

391:                                              ; preds = %388, %156, %84, %64
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %3) #7
  br label %392

392:                                              ; preds = %391, %60
  call void @llvm.lifetime.end.p0(i64 512, ptr %3) #7
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %2) #7
  call void @llvm.lifetime.end.p0(i64 520, ptr %2) #7
  br label %393

393:                                              ; preds = %392
  %394 = load ptr, ptr %4, align 8
  %395 = load i32, ptr %5, align 4
  %396 = insertvalue { ptr, i32 } poison, ptr %394, 0
  %397 = insertvalue { ptr, i32 } %396, i32 %395, 1
  resume { ptr, i32 } %397
}

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef, i32 noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248), ptr noundef, i32 noundef) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #0 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) #6

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256)) unnamed_addr #0 align 2

attributes #0 = { 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 #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10}


; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"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::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"struct.std::pair" = type { i32, i32 }

@N = external dso_local global i32, align 4
@Q = external dso_local global i32, align 4
@loc = external dso_local global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [12 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4distSt4pairIiiES0_(i64, i64) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z9modifysumii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9modifymaxii(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4qsumii(i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::basic_ifstream", align 8
  %2 = alloca %"class.std::basic_ofstream", align 8
  %3 = alloca i8, align 1
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair", align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 520, ptr nonnull %1) #6
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256) %1, ptr noundef nonnull @.str, i32 noundef 8)
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %2) #6
  invoke void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248) %2, ptr noundef nonnull @.str.2, i32 noundef 16)
          to label %10 unwind label %20

10:                                               ; preds = %0
  %11 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) @N)
          to label %12 unwind label %22

12:                                               ; preds = %10
  %13 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 4 dereferenceable(4) @Q)
          to label %14 unwind label %22

14:                                               ; preds = %12
  %15 = load i32, ptr @N, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  invoke void @_ZNSt6vectorISt4pairIiiESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %16)
          to label %.preheader73 unwind label %22

.preheader73:                                     ; preds = %14
  %17 = load i32, ptr @N, align 4, !tbaa !5
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph, label %.preheader71.preheader

.preheader72:                                     ; preds = %30
  %19 = icmp sgt i32 %31, 1
  br i1 %19, label %.lr.ph76, label %.preheader71.preheader

20:                                               ; preds = %0
  %21 = landingpad { ptr, i32 }
          cleanup
  br label %231

22:                                               ; preds = %14, %12, %10
  %23 = landingpad { ptr, i32 }
          cleanup
  br label %230

.lr.ph:                                           ; preds = %.preheader73, %30
  %indvars.iv = phi i64 [ %indvars.iv.next, %30 ], [ 0, %.preheader73 ]
  %24 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %indvars.iv) #6
  %25 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) %24)
          to label %26 unwind label %34

26:                                               ; preds = %.lr.ph
  %27 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %indvars.iv) #6
  %28 = getelementptr inbounds i8, ptr %27, i64 4
  %29 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 4 dereferenceable(4) %28)
          to label %30 unwind label %34

30:                                               ; preds = %26
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %31 = load i32, ptr @N, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = icmp slt i64 %indvars.iv.next, %32
  br i1 %33, label %.lr.ph, label %.preheader72, !llvm.loop !9

34:                                               ; preds = %26, %.lr.ph
  %35 = landingpad { ptr, i32 }
          cleanup
  br label %230

.lr.ph76:                                         ; preds = %.preheader72, %.lr.ph76
  %indvars.iv80 = phi i64 [ %indvars.iv.next81, %.lr.ph76 ], [ 0, %.preheader72 ]
  %36 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %indvars.iv80) #6
  %.sroa.039.0.copyload = load i64, ptr %36, align 4
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %37 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %indvars.iv.next81) #6
  %.sroa.038.0.copyload = load i64, ptr %37, align 4
  %38 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.039.0.copyload, i64 %.sroa.038.0.copyload)
  %39 = trunc nuw nsw i64 %indvars.iv80 to i32
  call void @_Z9modifysumii(i32 noundef %39, i32 noundef %38)
  %40 = load i32, ptr @N, align 4, !tbaa !5
  %41 = add nsw i32 %40, -1
  %42 = sext i32 %41 to i64
  %43 = icmp slt i64 %indvars.iv.next81, %42
  br i1 %43, label %.lr.ph76, label %.preheader71.preheader, !llvm.loop !11

.preheader71.preheader:                           ; preds = %.lr.ph76, %.preheader73, %.preheader72
  br label %.preheader71

.preheader71:                                     ; preds = %.preheader71.preheader, %50
  %indvars.iv83 = phi i64 [ %indvars.iv.next84, %50 ], [ 0, %.preheader71.preheader ]
  %44 = load i32, ptr @N, align 4, !tbaa !5
  %45 = add nsw i32 %44, -2
  %46 = sext i32 %45 to i64
  %47 = icmp slt i64 %indvars.iv83, %46
  br i1 %47, label %50, label %.preheader

.preheader:                                       ; preds = %.preheader71
  %48 = load i32, ptr @Q, align 4, !tbaa !5
  %49 = icmp sgt i32 %48, 0
  br i1 %49, label %.lr.ph78, label %._crit_edge

50:                                               ; preds = %.preheader71
  %51 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %indvars.iv83) #6
  %.sroa.028.0.copyload = load i64, ptr %51, align 4
  %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
  %52 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %indvars.iv.next84) #6
  %.sroa.027.0.copyload = load i64, ptr %52, align 4
  %53 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.028.0.copyload, i64 %.sroa.027.0.copyload)
  %54 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %indvars.iv.next84) #6
  %.sroa.026.0.copyload = load i64, ptr %54, align 4
  %55 = add nuw nsw i64 %indvars.iv83, 2
  %56 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %55) #6
  %.sroa.025.0.copyload = load i64, ptr %56, align 4
  %57 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.026.0.copyload, i64 %.sroa.025.0.copyload)
  %58 = add nsw i32 %57, %53
  %59 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %indvars.iv83) #6
  %.sroa.024.0.copyload = load i64, ptr %59, align 4
  %60 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %55) #6
  %.sroa.023.0.copyload = load i64, ptr %60, align 4
  %61 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.024.0.copyload, i64 %.sroa.023.0.copyload)
  %62 = sub i32 %58, %61
  %63 = trunc nuw nsw i64 %indvars.iv83 to i32
  invoke void @_Z9modifymaxii(i32 noundef %63, i32 noundef %62)
          to label %.preheader71 unwind label %64, !llvm.loop !12

64:                                               ; preds = %50
  %65 = landingpad { ptr, i32 }
          cleanup
  br label %230

._crit_edge:                                      ; preds = %225, %.preheader
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %2) #6
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %2) #6
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %1) #6
  call void @llvm.lifetime.end.p0(i64 520, ptr nonnull %1) #6
  ret i32 0

.lr.ph78:                                         ; preds = %.preheader, %225
  %.05777 = phi i32 [ %226, %225 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #6
  %66 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %67 unwind label %95

67:                                               ; preds = %.lr.ph78
  %68 = load i8, ptr %3, align 1, !tbaa !13
  %69 = icmp eq i8 %68, 85
  br i1 %69, label %70, label %203

70:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  %71 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %72 unwind label %97

72:                                               ; preds = %70
  %73 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %71, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %74 unwind label %97

74:                                               ; preds = %72
  %75 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %73, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %76 unwind label %97

76:                                               ; preds = %74
  %77 = load i32, ptr %4, align 4, !tbaa !5
  %78 = add nsw i32 %77, -1
  store i32 %78, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %79 = load i32, ptr %4, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %80) #6
  %82 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %81, ptr noundef nonnull align 4 dereferenceable(8) %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  %83 = load i32, ptr %4, align 4, !tbaa !5
  %84 = load i32, ptr @N, align 4, !tbaa !5
  %85 = add nsw i32 %84, -1
  %86 = icmp slt i32 %83, %85
  br i1 %86, label %87, label %99

87:                                               ; preds = %76
  %88 = sext i32 %83 to i64
  %89 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %88) #6
  %.sroa.021.0.copyload = load i64, ptr %89, align 4
  %90 = load i32, ptr %4, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  %92 = sext i32 %91 to i64
  %93 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %92) #6
  %.sroa.020.0.copyload = load i64, ptr %93, align 4
  %94 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.021.0.copyload, i64 %.sroa.020.0.copyload)
  call void @_Z9modifysumii(i32 noundef %83, i32 noundef %94)
  %.pr = load i32, ptr %4, align 4, !tbaa !5
  br label %99

95:                                               ; preds = %.lr.ph78
  %96 = landingpad { ptr, i32 }
          cleanup
  br label %229

97:                                               ; preds = %175, %143, %111, %74, %72, %70
  %98 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  br label %229

99:                                               ; preds = %87, %76
  %100 = phi i32 [ %.pr, %87 ], [ %83, %76 ]
  %101 = icmp sgt i32 %100, 0
  br i1 %101, label %102, label %.thread90

.thread90:                                        ; preds = %99
  %.pre8991 = load i32, ptr @N, align 4, !tbaa !5
  br label %170

102:                                              ; preds = %99
  %103 = add nsw i32 %100, -1
  %104 = zext nneg i32 %103 to i64
  %105 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %104) #6
  %.sroa.019.0.copyload = load i64, ptr %105, align 4
  %106 = load i32, ptr %4, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %107) #6
  %.sroa.018.0.copyload = load i64, ptr %108, align 4
  %109 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.019.0.copyload, i64 %.sroa.018.0.copyload)
  call void @_Z9modifysumii(i32 noundef %103, i32 noundef %109)
  %.pre = load i32, ptr %4, align 4, !tbaa !5
  %110 = icmp sgt i32 %.pre, 1
  br i1 %110, label %111, label %138

111:                                              ; preds = %102
  %112 = add nsw i32 %.pre, -2
  %113 = zext nneg i32 %112 to i64
  %114 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %113) #6
  %.sroa.017.0.copyload = load i64, ptr %114, align 4
  %115 = load i32, ptr %4, align 4, !tbaa !5
  %116 = add nsw i32 %115, -1
  %117 = sext i32 %116 to i64
  %118 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %117) #6
  %.sroa.016.0.copyload = load i64, ptr %118, align 4
  %119 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.017.0.copyload, i64 %.sroa.016.0.copyload)
  %120 = load i32, ptr %4, align 4, !tbaa !5
  %121 = add nsw i32 %120, -1
  %122 = sext i32 %121 to i64
  %123 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %122) #6
  %.sroa.015.0.copyload = load i64, ptr %123, align 4
  %124 = load i32, ptr %4, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %125) #6
  %.sroa.014.0.copyload = load i64, ptr %126, align 4
  %127 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.015.0.copyload, i64 %.sroa.014.0.copyload)
  %128 = add nsw i32 %127, %119
  %129 = load i32, ptr %4, align 4, !tbaa !5
  %130 = add nsw i32 %129, -2
  %131 = sext i32 %130 to i64
  %132 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %131) #6
  %.sroa.013.0.copyload = load i64, ptr %132, align 4
  %133 = load i32, ptr %4, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %134) #6
  %.sroa.012.0.copyload = load i64, ptr %135, align 4
  %136 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.013.0.copyload, i64 %.sroa.012.0.copyload)
  %137 = sub i32 %128, %136
  invoke void @_Z9modifymaxii(i32 noundef %112, i32 noundef %137)
          to label %thread-pre-split unwind label %97

thread-pre-split:                                 ; preds = %111
  %.pr67 = load i32, ptr %4, align 4, !tbaa !5
  br label %138

138:                                              ; preds = %thread-pre-split, %102
  %139 = phi i32 [ %.pr67, %thread-pre-split ], [ %.pre, %102 ]
  %140 = icmp sgt i32 %139, 0
  %.pre89 = load i32, ptr @N, align 4, !tbaa !5
  %141 = add nsw i32 %.pre89, -1
  %142 = icmp slt i32 %139, %141
  %or.cond = select i1 %140, i1 %142, i1 false
  br i1 %or.cond, label %143, label %170

143:                                              ; preds = %138
  %144 = add nsw i32 %139, -1
  %145 = zext nneg i32 %144 to i64
  %146 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %145) #6
  %.sroa.011.0.copyload = load i64, ptr %146, align 4
  %147 = load i32, ptr %4, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %148) #6
  %.sroa.010.0.copyload = load i64, ptr %149, align 4
  %150 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.011.0.copyload, i64 %.sroa.010.0.copyload)
  %151 = load i32, ptr %4, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %152) #6
  %.sroa.09.0.copyload = load i64, ptr %153, align 4
  %154 = load i32, ptr %4, align 4, !tbaa !5
  %155 = add nsw i32 %154, 1
  %156 = sext i32 %155 to i64
  %157 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %156) #6
  %.sroa.08.0.copyload = load i64, ptr %157, align 4
  %158 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.09.0.copyload, i64 %.sroa.08.0.copyload)
  %159 = add nsw i32 %158, %150
  %160 = load i32, ptr %4, align 4, !tbaa !5
  %161 = add nsw i32 %160, -1
  %162 = sext i32 %161 to i64
  %163 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %162) #6
  %.sroa.07.0.copyload = load i64, ptr %163, align 4
  %164 = load i32, ptr %4, align 4, !tbaa !5
  %165 = add nsw i32 %164, 1
  %166 = sext i32 %165 to i64
  %167 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %166) #6
  %.sroa.06.0.copyload = load i64, ptr %167, align 4
  %168 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.07.0.copyload, i64 %.sroa.06.0.copyload)
  %169 = sub i32 %159, %168
  invoke void @_Z9modifymaxii(i32 noundef %144, i32 noundef %169)
          to label %._crit_edge86 unwind label %97

._crit_edge86:                                    ; preds = %143
  %.pre87 = load i32, ptr %4, align 4, !tbaa !5
  %.pre88 = load i32, ptr @N, align 4, !tbaa !5
  br label %170

170:                                              ; preds = %.thread90, %._crit_edge86, %138
  %171 = phi i32 [ %.pre88, %._crit_edge86 ], [ %.pre89, %138 ], [ %.pre8991, %.thread90 ]
  %172 = phi i32 [ %.pre87, %._crit_edge86 ], [ %139, %138 ], [ %100, %.thread90 ]
  %173 = add nsw i32 %171, -2
  %174 = icmp slt i32 %172, %173
  br i1 %174, label %175, label %202

175:                                              ; preds = %170
  %176 = sext i32 %172 to i64
  %177 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %176) #6
  %.sroa.05.0.copyload = load i64, ptr %177, align 4
  %178 = load i32, ptr %4, align 4, !tbaa !5
  %179 = add nsw i32 %178, 1
  %180 = sext i32 %179 to i64
  %181 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %180) #6
  %.sroa.04.0.copyload = load i64, ptr %181, align 4
  %182 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.05.0.copyload, i64 %.sroa.04.0.copyload)
  %183 = load i32, ptr %4, align 4, !tbaa !5
  %184 = add nsw i32 %183, 1
  %185 = sext i32 %184 to i64
  %186 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %185) #6
  %.sroa.03.0.copyload = load i64, ptr %186, align 4
  %187 = load i32, ptr %4, align 4, !tbaa !5
  %188 = add nsw i32 %187, 2
  %189 = sext i32 %188 to i64
  %190 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %189) #6
  %.sroa.02.0.copyload = load i64, ptr %190, align 4
  %191 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.03.0.copyload, i64 %.sroa.02.0.copyload)
  %192 = add nsw i32 %191, %182
  %193 = load i32, ptr %4, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %194) #6
  %.sroa.01.0.copyload = load i64, ptr %195, align 4
  %196 = load i32, ptr %4, align 4, !tbaa !5
  %197 = add nsw i32 %196, 2
  %198 = sext i32 %197 to i64
  %199 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @loc, i64 noundef %198) #6
  %.sroa.0.0.copyload = load i64, ptr %199, align 4
  %200 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.01.0.copyload, i64 %.sroa.0.0.copyload)
  %201 = sub i32 %192, %200
  invoke void @_Z9modifymaxii(i32 noundef %172, i32 noundef %201)
          to label %202 unwind label %97

202:                                              ; preds = %175, %170
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  br label %225

203:                                              ; preds = %67
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #6
  %204 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %205 unwind label %223

205:                                              ; preds = %203
  %206 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %204, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %207 unwind label %223

207:                                              ; preds = %205
  %208 = load i32, ptr %8, align 4, !tbaa !5
  %209 = add nsw i32 %208, -1
  store i32 %209, ptr %8, align 4, !tbaa !5
  %210 = load i32, ptr %9, align 4, !tbaa !5
  %211 = add nsw i32 %210, -1
  store i32 %211, ptr %9, align 4, !tbaa !5
  %212 = call noundef i32 @_Z4qsumii(i32 noundef %209, i32 noundef %211)
  %213 = load i32, ptr %8, align 4, !tbaa !5
  %214 = load i32, ptr %9, align 4, !tbaa !5
  %215 = add nsw i32 %214, -1
  %216 = invoke noundef i32 @_Z4qmaxii(i32 noundef %213, i32 noundef %215)
          to label %217 unwind label %223

217:                                              ; preds = %207
  %218 = sub nsw i32 %212, %216
  %219 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef %218)
          to label %220 unwind label %223

220:                                              ; preds = %217
  %221 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %219, ptr noundef nonnull @.str.3)
          to label %222 unwind label %223

222:                                              ; preds = %220
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  br label %225

223:                                              ; preds = %220, %217, %207, %205, %203
  %224 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  br label %229

225:                                              ; preds = %222, %202
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #6
  %226 = add nuw nsw i32 %.05777, 1
  %227 = load i32, ptr @Q, align 4, !tbaa !5
  %228 = icmp slt i32 %226, %227
  br i1 %228, label %.lr.ph78, label %._crit_edge, !llvm.loop !14

229:                                              ; preds = %223, %97, %95
  %.pn = phi { ptr, i32 } [ %98, %97 ], [ %224, %223 ], [ %96, %95 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #6
  br label %230

230:                                              ; preds = %229, %64, %34, %22
  %.pn64 = phi { ptr, i32 } [ %35, %34 ], [ %65, %64 ], [ %.pn, %229 ], [ %23, %22 ]
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %2) #6
  br label %231

231:                                              ; preds = %230, %20
  %.pn64.pn = phi { ptr, i32 } [ %.pn64, %230 ], [ %21, %20 ]
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %2) #6
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %1) #6
  call void @llvm.lifetime.end.p0(i64 520, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn64.pn
}

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef, i32 noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248), ptr noundef, i32 noundef) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #0 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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256)) unnamed_addr #0 align 2

attributes #0 = { 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 #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { "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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10}


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