; LLVM IR from eyangch/competitive-programming :: USACOcontests/gold/2016.03 (split)

; 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::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, i64 }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, 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 i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %25 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %26 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %27 = getelementptr i8, ptr %26, i64 -24
  %28 = load i64, ptr %27, align 8
  %29 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %28
  %30 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %29, ptr noundef null)
  %31 = load ptr, ptr @stdin, align 8, !tbaa !8
  %32 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %31)
  %33 = load ptr, ptr @stdout, align 8, !tbaa !8
  %34 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %33)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #8
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %36 = load i64, ptr %2, align 8, !tbaa !11
  %37 = call ptr @llvm.stacksave.p0()
  store ptr %37, ptr %3, align 8
  %38 = alloca %"struct.std::pair", i64 %36, align 16
  store i64 %36, ptr %4, align 8
  %39 = icmp eq i64 %36, 0
  br i1 %39, label %46, label %40

40:                                               ; preds = %0
  %41 = getelementptr inbounds %"struct.std::pair", ptr %38, i64 %36
  br label %42

42:                                               ; preds = %42, %40
  %43 = phi ptr [ %38, %40 ], [ %44, %42 ]
  call void @_ZNSt4pairIxxEC2IxxTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16) %43)
  %44 = getelementptr inbounds %"struct.std::pair", ptr %43, i64 1
  %45 = icmp eq ptr %44, %41
  br i1 %45, label %46, label %42

46:                                               ; preds = %42, %0
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  store i64 2147483647, ptr %5, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  store i64 0, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  store i64 2147483647, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  store i64 0, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  store i64 0, ptr %9, align 8, !tbaa !11
  br label %47

47:                                               ; preds = %81, %46
  %48 = load i64, ptr %9, align 8, !tbaa !11
  %49 = load i64, ptr %2, align 8, !tbaa !11
  %50 = icmp slt i64 %48, %49
  br i1 %50, label %52, label %51

51:                                               ; preds = %47
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %84

52:                                               ; preds = %47
  %53 = load i64, ptr %9, align 8, !tbaa !11
  %54 = getelementptr inbounds %"struct.std::pair", ptr %38, i64 %53
  %55 = getelementptr inbounds %"struct.std::pair", ptr %54, i32 0, i32 0
  %56 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %55)
  %57 = load i64, ptr %9, align 8, !tbaa !11
  %58 = getelementptr inbounds %"struct.std::pair", ptr %38, i64 %57
  %59 = getelementptr inbounds %"struct.std::pair", ptr %58, i32 0, i32 1
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %56, ptr noundef nonnull align 8 dereferenceable(8) %59)
  %61 = load i64, ptr %9, align 8, !tbaa !11
  %62 = getelementptr inbounds %"struct.std::pair", ptr %38, i64 %61
  %63 = getelementptr inbounds %"struct.std::pair", ptr %62, i32 0, i32 0
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %63)
  %65 = load i64, ptr %64, align 8, !tbaa !11
  store i64 %65, ptr %5, align 8, !tbaa !11
  %66 = load i64, ptr %9, align 8, !tbaa !11
  %67 = getelementptr inbounds %"struct.std::pair", ptr %38, i64 %66
  %68 = getelementptr inbounds %"struct.std::pair", ptr %67, i32 0, i32 1
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %68)
  %70 = load i64, ptr %69, align 8, !tbaa !11
  store i64 %70, ptr %7, align 8, !tbaa !11
  %71 = load i64, ptr %9, align 8, !tbaa !11
  %72 = getelementptr inbounds %"struct.std::pair", ptr %38, i64 %71
  %73 = getelementptr inbounds %"struct.std::pair", ptr %72, i32 0, i32 0
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %73)
  %75 = load i64, ptr %74, align 8, !tbaa !11
  store i64 %75, ptr %6, align 8, !tbaa !11
  %76 = load i64, ptr %9, align 8, !tbaa !11
  %77 = getelementptr inbounds %"struct.std::pair", ptr %38, i64 %76
  %78 = getelementptr inbounds %"struct.std::pair", ptr %77, i32 0, i32 1
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %78)
  %80 = load i64, ptr %79, align 8, !tbaa !11
  store i64 %80, ptr %8, align 8, !tbaa !11
  br label %81

81:                                               ; preds = %52
  %82 = load i64, ptr %9, align 8, !tbaa !11
  %83 = add nsw i64 %82, 1
  store i64 %83, ptr %9, align 8, !tbaa !11
  br label %47, !llvm.loop !13

84:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %85 = load i64, ptr %6, align 8, !tbaa !11
  %86 = load i64, ptr %5, align 8, !tbaa !11
  %87 = sub nsw i64 %85, %86
  %88 = load i64, ptr %8, align 8, !tbaa !11
  %89 = load i64, ptr %7, align 8, !tbaa !11
  %90 = sub nsw i64 %88, %89
  %91 = mul nsw i64 %87, %90
  store i64 %91, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  store i64 9223372036854775807, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  store i64 0, ptr %12, align 8, !tbaa !11
  br label %92

92:                                               ; preds = %221, %84
  %93 = load i64, ptr %12, align 8, !tbaa !11
  %94 = icmp slt i64 %93, 2
  br i1 %94, label %96, label %95

95:                                               ; preds = %92
  store i32 5, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %224

96:                                               ; preds = %92
  %97 = load i64, ptr %2, align 8, !tbaa !11
  %98 = getelementptr inbounds %"struct.std::pair", ptr %38, i64 %97
  call void @_ZSt4sortIPSt4pairIxxEEvT_S3_(ptr noundef %38, ptr noundef %98)
  %99 = load i64, ptr %2, align 8, !tbaa !11
  %100 = call ptr @llvm.stacksave.p0()
  store ptr %100, ptr %14, align 8
  %101 = alloca i64, i64 %99, align 16
  store i64 %99, ptr %15, align 8
  %102 = load i64, ptr %2, align 8, !tbaa !11
  %103 = alloca i64, i64 %102, align 16
  store i64 %102, ptr %16, align 8
  %104 = load i64, ptr %2, align 8, !tbaa !11
  %105 = sub nsw i64 %104, 1
  %106 = getelementptr inbounds %"struct.std::pair", ptr %38, i64 %105
  %107 = getelementptr inbounds %"struct.std::pair", ptr %106, i32 0, i32 1
  %108 = load i64, ptr %107, align 8, !tbaa !15
  %109 = load i64, ptr %2, align 8, !tbaa !11
  %110 = sub nsw i64 %109, 1
  %111 = getelementptr inbounds i64, ptr %101, i64 %110
  store i64 %108, ptr %111, align 8, !tbaa !11
  %112 = load i64, ptr %2, align 8, !tbaa !11
  %113 = sub nsw i64 %112, 1
  %114 = getelementptr inbounds %"struct.std::pair", ptr %38, i64 %113
  %115 = getelementptr inbounds %"struct.std::pair", ptr %114, i32 0, i32 1
  %116 = load i64, ptr %115, align 8, !tbaa !15
  %117 = load i64, ptr %2, align 8, !tbaa !11
  %118 = sub nsw i64 %117, 1
  %119 = getelementptr inbounds i64, ptr %103, i64 %118
  store i64 %116, ptr %119, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %120 = load i64, ptr %2, align 8, !tbaa !11
  %121 = sub nsw i64 %120, 2
  store i64 %121, ptr %17, align 8, !tbaa !11
  br label %122

122:                                              ; preds = %147, %96
  %123 = load i64, ptr %17, align 8, !tbaa !11
  %124 = icmp sge i64 %123, 0
  br i1 %124, label %126, label %125

125:                                              ; preds = %122
  store i32 8, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %150

126:                                              ; preds = %122
  %127 = load i64, ptr %17, align 8, !tbaa !11
  %128 = add nsw i64 %127, 1
  %129 = getelementptr inbounds i64, ptr %101, i64 %128
  %130 = load i64, ptr %17, align 8, !tbaa !11
  %131 = getelementptr inbounds %"struct.std::pair", ptr %38, i64 %130
  %132 = getelementptr inbounds %"struct.std::pair", ptr %131, i32 0, i32 1
  %133 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %129, ptr noundef nonnull align 8 dereferenceable(8) %132)
  %134 = load i64, ptr %133, align 8, !tbaa !11
  %135 = load i64, ptr %17, align 8, !tbaa !11
  %136 = getelementptr inbounds i64, ptr %101, i64 %135
  store i64 %134, ptr %136, align 8, !tbaa !11
  %137 = load i64, ptr %17, align 8, !tbaa !11
  %138 = add nsw i64 %137, 1
  %139 = getelementptr inbounds i64, ptr %103, i64 %138
  %140 = load i64, ptr %17, align 8, !tbaa !11
  %141 = getelementptr inbounds %"struct.std::pair", ptr %38, i64 %140
  %142 = getelementptr inbounds %"struct.std::pair", ptr %141, i32 0, i32 1
  %143 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %139, ptr noundef nonnull align 8 dereferenceable(8) %142)
  %144 = load i64, ptr %143, align 8, !tbaa !11
  %145 = load i64, ptr %17, align 8, !tbaa !11
  %146 = getelementptr inbounds i64, ptr %103, i64 %145
  store i64 %144, ptr %146, align 8, !tbaa !11
  br label %147

147:                                              ; preds = %126
  %148 = load i64, ptr %17, align 8, !tbaa !11
  %149 = add nsw i64 %148, -1
  store i64 %149, ptr %17, align 8, !tbaa !11
  br label %122, !llvm.loop !17

150:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  store i64 2147483647, ptr %18, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  store i64 0, ptr %19, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  store i64 0, ptr %20, align 8, !tbaa !11
  br label %151

151:                                              ; preds = %200, %150
  %152 = load i64, ptr %20, align 8, !tbaa !11
  %153 = load i64, ptr %2, align 8, !tbaa !11
  %154 = sub nsw i64 %153, 1
  %155 = icmp slt i64 %152, %154
  br i1 %155, label %157, label %156

156:                                              ; preds = %151
  store i32 11, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %203

157:                                              ; preds = %151
  %158 = load i64, ptr %20, align 8, !tbaa !11
  %159 = getelementptr inbounds %"struct.std::pair", ptr %38, i64 %158
  %160 = getelementptr inbounds %"struct.std::pair", ptr %159, i32 0, i32 1
  %161 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef nonnull align 8 dereferenceable(8) %160)
  %162 = load i64, ptr %161, align 8, !tbaa !11
  store i64 %162, ptr %18, align 8, !tbaa !11
  %163 = load i64, ptr %20, align 8, !tbaa !11
  %164 = getelementptr inbounds %"struct.std::pair", ptr %38, i64 %163
  %165 = getelementptr inbounds %"struct.std::pair", ptr %164, i32 0, i32 1
  %166 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 8 dereferenceable(8) %165)
  %167 = load i64, ptr %166, align 8, !tbaa !11
  store i64 %167, ptr %19, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %168 = load i64, ptr %19, align 8, !tbaa !11
  %169 = load i64, ptr %18, align 8, !tbaa !11
  %170 = sub nsw i64 %168, %169
  %171 = load i64, ptr %20, align 8, !tbaa !11
  %172 = getelementptr inbounds %"struct.std::pair", ptr %38, i64 %171
  %173 = getelementptr inbounds %"struct.std::pair", ptr %172, i32 0, i32 0
  %174 = load i64, ptr %173, align 16, !tbaa !18
  %175 = load i64, ptr %5, align 8, !tbaa !11
  %176 = sub nsw i64 %174, %175
  %177 = mul nsw i64 %170, %176
  store i64 %177, ptr %21, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  %178 = load i64, ptr %20, align 8, !tbaa !11
  %179 = add nsw i64 %178, 1
  %180 = getelementptr inbounds i64, ptr %103, i64 %179
  %181 = load i64, ptr %180, align 8, !tbaa !11
  %182 = load i64, ptr %20, align 8, !tbaa !11
  %183 = add nsw i64 %182, 1
  %184 = getelementptr inbounds i64, ptr %101, i64 %183
  %185 = load i64, ptr %184, align 8, !tbaa !11
  %186 = sub nsw i64 %181, %185
  %187 = load i64, ptr %6, align 8, !tbaa !11
  %188 = load i64, ptr %20, align 8, !tbaa !11
  %189 = add nsw i64 %188, 1
  %190 = getelementptr inbounds %"struct.std::pair", ptr %38, i64 %189
  %191 = getelementptr inbounds %"struct.std::pair", ptr %190, i32 0, i32 0
  %192 = load i64, ptr %191, align 16, !tbaa !18
  %193 = sub nsw i64 %187, %192
  %194 = mul nsw i64 %186, %193
  store i64 %194, ptr %22, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #8
  %195 = load i64, ptr %21, align 8, !tbaa !11
  %196 = load i64, ptr %22, align 8, !tbaa !11
  %197 = add nsw i64 %195, %196
  store i64 %197, ptr %23, align 8, !tbaa !11
  %198 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %23)
  %199 = load i64, ptr %198, align 8, !tbaa !11
  store i64 %199, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  br label %200

200:                                              ; preds = %157
  %201 = load i64, ptr %20, align 8, !tbaa !11
  %202 = add nsw i64 %201, 1
  store i64 %202, ptr %20, align 8, !tbaa !11
  br label %151, !llvm.loop !19

203:                                              ; preds = %156
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #8
  store i64 0, ptr %24, align 8, !tbaa !11
  br label %204

204:                                              ; preds = %216, %203
  %205 = load i64, ptr %24, align 8, !tbaa !11
  %206 = load i64, ptr %2, align 8, !tbaa !11
  %207 = icmp slt i64 %205, %206
  br i1 %207, label %209, label %208

208:                                              ; preds = %204
  store i32 14, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #8
  br label %219

209:                                              ; preds = %204
  %210 = load i64, ptr %24, align 8, !tbaa !11
  %211 = getelementptr inbounds %"struct.std::pair", ptr %38, i64 %210
  %212 = getelementptr inbounds %"struct.std::pair", ptr %211, i32 0, i32 0
  %213 = load i64, ptr %24, align 8, !tbaa !11
  %214 = getelementptr inbounds %"struct.std::pair", ptr %38, i64 %213
  %215 = getelementptr inbounds %"struct.std::pair", ptr %214, i32 0, i32 1
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %212, ptr noundef nonnull align 8 dereferenceable(8) %215) #8
  br label %216

216:                                              ; preds = %209
  %217 = load i64, ptr %24, align 8, !tbaa !11
  %218 = add nsw i64 %217, 1
  store i64 %218, ptr %24, align 8, !tbaa !11
  br label %204, !llvm.loop !20

219:                                              ; preds = %208
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  %220 = load ptr, ptr %14, align 8
  call void @llvm.stackrestore.p0(ptr %220)
  br label %221

221:                                              ; preds = %219
  %222 = load i64, ptr %12, align 8, !tbaa !11
  %223 = add nsw i64 %222, 1
  store i64 %223, ptr %12, align 8, !tbaa !11
  br label %92, !llvm.loop !21

224:                                              ; preds = %95
  %225 = load i64, ptr %10, align 8, !tbaa !11
  %226 = load i64, ptr %11, align 8, !tbaa !11
  %227 = sub nsw i64 %225, %226
  %228 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %227)
  %229 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %228, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  %230 = load ptr, ptr %3, align 8
  call void @llvm.stackrestore.p0(ptr %230)
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #8
  %231 = load i32, ptr %1, align 4
  ret i32 %231
}

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

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

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

; 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)) #4 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIxxEEvT_S3_(ptr noundef, ptr noundef) #7

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #7

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { nocallback nofree nosync nounwind willreturn }
attributes #6 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { 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 = !{!"any pointer", !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 = !{!"_ZTSSt4pairIxxE", !12, i64 0, !12, i64 8}
!17 = distinct !{!17, !14}
!18 = !{!16, !12, i64 0}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !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::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, i64 }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, 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 i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, 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 = load ptr, ptr @stdin, align 8, !tbaa !8
  %17 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %16)
  %18 = load ptr, ptr @stdout, align 8, !tbaa !8
  %19 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %18)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %21 = load i64, ptr %1, align 8, !tbaa !11
  %22 = call ptr @llvm.stacksave.p0()
  %23 = alloca %"struct.std::pair", i64 %21, align 16
  %24 = icmp eq i64 %21, 0
  br i1 %24, label %.loopexit, label %25

25:                                               ; preds = %0
  %26 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %21
  br label %27

27:                                               ; preds = %27, %25
  %28 = phi ptr [ %23, %25 ], [ %29, %27 ]
  call void @_ZNSt4pairIxxEC2IxxTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16) %28)
  %29 = getelementptr inbounds i8, ptr %28, i64 16
  %30 = icmp eq ptr %29, %26
  br i1 %30, label %.loopexit, label %27

.loopexit:                                        ; preds = %27, %0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  store i64 2147483647, ptr %2, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  store i64 0, ptr %3, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  store i64 2147483647, ptr %4, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  store i64 0, ptr %5, align 8, !tbaa !11
  %31 = load i64, ptr %1, align 8, !tbaa !11
  %32 = icmp sgt i64 %31, 0
  br i1 %32, label %.lr.ph, label %._crit_edge

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i64, ptr %3, align 8, !tbaa !11
  %.pre52 = load i64, ptr %2, align 8, !tbaa !11
  %.pre53 = load i64, ptr %4, align 8, !tbaa !11
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.loopexit
  %33 = phi i64 [ %63, %._crit_edge.loopexit ], [ %31, %.loopexit ]
  %34 = phi i64 [ %.pre53, %._crit_edge.loopexit ], [ 2147483647, %.loopexit ]
  %35 = phi i64 [ %61, %._crit_edge.loopexit ], [ 0, %.loopexit ]
  %36 = phi i64 [ %.pre52, %._crit_edge.loopexit ], [ 2147483647, %.loopexit ]
  %37 = phi i64 [ %.pre, %._crit_edge.loopexit ], [ 0, %.loopexit ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  store i64 9223372036854775807, ptr %6, align 8, !tbaa !11
  %38 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %33
  call void @_ZSt4sortIPSt4pairIxxEEvT_S3_(ptr noundef nonnull %23, ptr noundef nonnull %38)
  %39 = load i64, ptr %1, align 8, !tbaa !11
  %40 = call ptr @llvm.stacksave.p0()
  %41 = alloca i64, i64 %39, align 16
  %42 = load i64, ptr %1, align 8, !tbaa !11
  %43 = alloca i64, i64 %42, align 16
  %44 = add nsw i64 %42, -1
  %45 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %44, i32 1
  %46 = load i64, ptr %45, align 8, !tbaa !13
  %47 = getelementptr inbounds i64, ptr %41, i64 %44
  store i64 %46, ptr %47, align 8, !tbaa !11
  %48 = getelementptr inbounds i64, ptr %43, i64 %44
  store i64 %46, ptr %48, align 8, !tbaa !11
  %49 = icmp sgt i64 %42, 1
  br i1 %49, label %.lr.ph43.preheader, label %._crit_edge44.thread

._crit_edge44.thread:                             ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  store i64 2147483647, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  store i64 0, ptr %8, align 8, !tbaa !11
  br label %.preheader

.lr.ph:                                           ; preds = %.loopexit, %.lr.ph
  %.03540 = phi i64 [ %62, %.lr.ph ], [ 0, %.loopexit ]
  %50 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %.03540
  %51 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %50)
  %52 = getelementptr inbounds i8, ptr %50, i64 8
  %53 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %51, ptr noundef nonnull align 8 dereferenceable(8) %52)
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %50)
  %55 = load i64, ptr %54, align 8, !tbaa !11
  store i64 %55, ptr %2, align 8, !tbaa !11
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %52)
  %57 = load i64, ptr %56, align 8, !tbaa !11
  store i64 %57, ptr %4, align 8, !tbaa !11
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %50)
  %59 = load i64, ptr %58, align 8, !tbaa !11
  store i64 %59, ptr %3, align 8, !tbaa !11
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %52)
  %61 = load i64, ptr %60, align 8, !tbaa !11
  store i64 %61, ptr %5, align 8, !tbaa !11
  %62 = add nuw nsw i64 %.03540, 1
  %63 = load i64, ptr %1, align 8, !tbaa !11
  %64 = icmp slt i64 %62, %63
  br i1 %64, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !15

.lr.ph43.preheader:                               ; preds = %._crit_edge
  %65 = add nsw i64 %42, -2
  br label %.lr.ph43

._crit_edge44:                                    ; preds = %.lr.ph43
  %.pre54 = load i64, ptr %1, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  store i64 2147483647, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  store i64 0, ptr %8, align 8, !tbaa !11
  %66 = icmp sgt i64 %.pre54, 1
  br i1 %66, label %.lr.ph47, label %.preheader

.lr.ph43:                                         ; preds = %.lr.ph43.preheader, %.lr.ph43
  %.03741 = phi i64 [ %77, %.lr.ph43 ], [ %65, %.lr.ph43.preheader ]
  %67 = add nuw nsw i64 %.03741, 1
  %68 = getelementptr inbounds i64, ptr %41, i64 %67
  %69 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %.03741, i32 1
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %68, ptr noundef nonnull align 8 dereferenceable(8) %69)
  %71 = load i64, ptr %70, align 8, !tbaa !11
  %72 = getelementptr inbounds i64, ptr %41, i64 %.03741
  store i64 %71, ptr %72, align 8, !tbaa !11
  %73 = getelementptr inbounds i64, ptr %43, i64 %67
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %73, ptr noundef nonnull align 8 dereferenceable(8) %69)
  %75 = load i64, ptr %74, align 8, !tbaa !11
  %76 = getelementptr inbounds i64, ptr %43, i64 %.03741
  store i64 %75, ptr %76, align 8, !tbaa !11
  %77 = add nsw i64 %.03741, -1
  %.not = icmp eq i64 %.03741, 0
  br i1 %.not, label %._crit_edge44, label %.lr.ph43, !llvm.loop !17

.preheader:                                       ; preds = %.lr.ph47, %._crit_edge44.thread, %._crit_edge44
  %78 = phi i64 [ %.pre54, %._crit_edge44 ], [ %42, %._crit_edge44.thread ], [ %106, %.lr.ph47 ]
  %79 = icmp sgt i64 %78, 0
  br i1 %79, label %.lr.ph49, label %._crit_edge50

.lr.ph47:                                         ; preds = %._crit_edge44, %.lr.ph47
  %.03645 = phi i64 [ %92, %.lr.ph47 ], [ 0, %._crit_edge44 ]
  %80 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %.03645
  %81 = getelementptr inbounds i8, ptr %80, i64 8
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %81)
  %83 = load i64, ptr %82, align 8, !tbaa !11
  store i64 %83, ptr %7, align 8, !tbaa !11
  %84 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %81)
  %85 = load i64, ptr %84, align 8, !tbaa !11
  store i64 %85, ptr %8, align 8, !tbaa !11
  %86 = load i64, ptr %7, align 8, !tbaa !11
  %87 = sub nsw i64 %85, %86
  %88 = load i64, ptr %80, align 16, !tbaa !18
  %89 = load i64, ptr %2, align 8, !tbaa !11
  %90 = sub nsw i64 %88, %89
  %91 = mul nsw i64 %90, %87
  %92 = add nuw nsw i64 %.03645, 1
  %93 = getelementptr inbounds i64, ptr %43, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !11
  %95 = getelementptr inbounds i64, ptr %41, i64 %92
  %96 = load i64, ptr %95, align 8, !tbaa !11
  %97 = sub nsw i64 %94, %96
  %98 = load i64, ptr %3, align 8, !tbaa !11
  %99 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %92
  %100 = load i64, ptr %99, align 16, !tbaa !18
  %101 = sub nsw i64 %98, %100
  %102 = mul nsw i64 %101, %97
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  %103 = add nsw i64 %102, %91
  store i64 %103, ptr %9, align 8, !tbaa !11
  %104 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %105 = load i64, ptr %104, align 8, !tbaa !11
  store i64 %105, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  %106 = load i64, ptr %1, align 8, !tbaa !11
  %107 = add nsw i64 %106, -1
  %108 = icmp slt i64 %92, %107
  br i1 %108, label %.lr.ph47, label %.preheader, !llvm.loop !19

._crit_edge50:                                    ; preds = %.lr.ph49, %.preheader
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  call void @llvm.stackrestore.p0(ptr %40)
  %109 = load i64, ptr %1, align 8, !tbaa !11
  %110 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %109
  call void @_ZSt4sortIPSt4pairIxxEEvT_S3_(ptr noundef nonnull %23, ptr noundef nonnull %110)
  %111 = load i64, ptr %1, align 8, !tbaa !11
  %112 = call ptr @llvm.stacksave.p0()
  %113 = alloca i64, i64 %111, align 16
  %114 = load i64, ptr %1, align 8, !tbaa !11
  %115 = alloca i64, i64 %114, align 16
  %116 = add nsw i64 %114, -1
  %117 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %116, i32 1
  %118 = load i64, ptr %117, align 8, !tbaa !13
  %119 = getelementptr inbounds i64, ptr %113, i64 %116
  store i64 %118, ptr %119, align 8, !tbaa !11
  %120 = getelementptr inbounds i64, ptr %115, i64 %116
  store i64 %118, ptr %120, align 8, !tbaa !11
  %121 = icmp sgt i64 %114, 1
  br i1 %121, label %.lr.ph43.preheader.1, label %._crit_edge44.1.thread

._crit_edge44.1.thread:                           ; preds = %._crit_edge50
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  store i64 2147483647, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  store i64 0, ptr %8, align 8, !tbaa !11
  br label %.preheader.1

.lr.ph43.preheader.1:                             ; preds = %._crit_edge50
  %122 = add nsw i64 %114, -2
  br label %.lr.ph43.1

.lr.ph43.1:                                       ; preds = %.lr.ph43.1, %.lr.ph43.preheader.1
  %.03741.1 = phi i64 [ %133, %.lr.ph43.1 ], [ %122, %.lr.ph43.preheader.1 ]
  %123 = add nuw nsw i64 %.03741.1, 1
  %124 = getelementptr inbounds i64, ptr %113, i64 %123
  %125 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %.03741.1, i32 1
  %126 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %124, ptr noundef nonnull align 8 dereferenceable(8) %125)
  %127 = load i64, ptr %126, align 8, !tbaa !11
  %128 = getelementptr inbounds i64, ptr %113, i64 %.03741.1
  store i64 %127, ptr %128, align 8, !tbaa !11
  %129 = getelementptr inbounds i64, ptr %115, i64 %123
  %130 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %129, ptr noundef nonnull align 8 dereferenceable(8) %125)
  %131 = load i64, ptr %130, align 8, !tbaa !11
  %132 = getelementptr inbounds i64, ptr %115, i64 %.03741.1
  store i64 %131, ptr %132, align 8, !tbaa !11
  %133 = add nsw i64 %.03741.1, -1
  %.not59 = icmp eq i64 %.03741.1, 0
  br i1 %.not59, label %._crit_edge44.1, label %.lr.ph43.1, !llvm.loop !17

._crit_edge44.1:                                  ; preds = %.lr.ph43.1
  %.pre55 = load i64, ptr %1, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  store i64 2147483647, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  store i64 0, ptr %8, align 8, !tbaa !11
  %134 = icmp sgt i64 %.pre55, 1
  br i1 %134, label %.lr.ph47.1, label %.preheader.1

.lr.ph47.1:                                       ; preds = %._crit_edge44.1, %.lr.ph47.1
  %.03645.1 = phi i64 [ %147, %.lr.ph47.1 ], [ 0, %._crit_edge44.1 ]
  %135 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %.03645.1
  %136 = getelementptr inbounds i8, ptr %135, i64 8
  %137 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %136)
  %138 = load i64, ptr %137, align 8, !tbaa !11
  store i64 %138, ptr %7, align 8, !tbaa !11
  %139 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %136)
  %140 = load i64, ptr %139, align 8, !tbaa !11
  store i64 %140, ptr %8, align 8, !tbaa !11
  %141 = load i64, ptr %7, align 8, !tbaa !11
  %142 = sub nsw i64 %140, %141
  %143 = load i64, ptr %135, align 16, !tbaa !18
  %144 = load i64, ptr %2, align 8, !tbaa !11
  %145 = sub nsw i64 %143, %144
  %146 = mul nsw i64 %145, %142
  %147 = add nuw nsw i64 %.03645.1, 1
  %148 = getelementptr inbounds i64, ptr %115, i64 %147
  %149 = load i64, ptr %148, align 8, !tbaa !11
  %150 = getelementptr inbounds i64, ptr %113, i64 %147
  %151 = load i64, ptr %150, align 8, !tbaa !11
  %152 = sub nsw i64 %149, %151
  %153 = load i64, ptr %3, align 8, !tbaa !11
  %154 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %147
  %155 = load i64, ptr %154, align 16, !tbaa !18
  %156 = sub nsw i64 %153, %155
  %157 = mul nsw i64 %156, %152
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  %158 = add nsw i64 %157, %146
  store i64 %158, ptr %9, align 8, !tbaa !11
  %159 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %160 = load i64, ptr %159, align 8, !tbaa !11
  store i64 %160, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  %161 = load i64, ptr %1, align 8, !tbaa !11
  %162 = add nsw i64 %161, -1
  %163 = icmp slt i64 %147, %162
  br i1 %163, label %.lr.ph47.1, label %.preheader.1, !llvm.loop !19

.preheader.1:                                     ; preds = %.lr.ph47.1, %._crit_edge44.1.thread, %._crit_edge44.1
  %164 = phi i64 [ %.pre55, %._crit_edge44.1 ], [ %114, %._crit_edge44.1.thread ], [ %161, %.lr.ph47.1 ]
  %165 = icmp sgt i64 %164, 0
  br i1 %165, label %.lr.ph49.1, label %._crit_edge50.1

.lr.ph49.1:                                       ; preds = %.preheader.1, %.lr.ph49.1
  %.048.1 = phi i64 [ %168, %.lr.ph49.1 ], [ 0, %.preheader.1 ]
  %166 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %.048.1
  %167 = getelementptr inbounds i8, ptr %166, i64 8
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %166, ptr noundef nonnull align 8 dereferenceable(8) %167) #8
  %168 = add nuw nsw i64 %.048.1, 1
  %169 = load i64, ptr %1, align 8, !tbaa !11
  %170 = icmp slt i64 %168, %169
  br i1 %170, label %.lr.ph49.1, label %._crit_edge50.1, !llvm.loop !20

._crit_edge50.1:                                  ; preds = %.lr.ph49.1, %.preheader.1
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  call void @llvm.stackrestore.p0(ptr %112)
  %171 = sub nsw i64 %37, %36
  %172 = sub nsw i64 %35, %34
  %173 = mul nsw i64 %172, %171
  %174 = load i64, ptr %6, align 8, !tbaa !11
  %175 = sub nsw i64 %173, %174
  %176 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %175)
  %177 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %176, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.stackrestore.p0(ptr %22)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  ret i32 0

.lr.ph49:                                         ; preds = %.preheader, %.lr.ph49
  %.048 = phi i64 [ %180, %.lr.ph49 ], [ 0, %.preheader ]
  %178 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %.048
  %179 = getelementptr inbounds i8, ptr %178, i64 8
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %178, ptr noundef nonnull align 8 dereferenceable(8) %179) #8
  %180 = add nuw nsw i64 %.048, 1
  %181 = load i64, ptr %1, align 8, !tbaa !11
  %182 = icmp slt i64 %180, %181
  br i1 %182, label %.lr.ph49, label %._crit_edge50, !llvm.loop !20
}

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

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

; 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 #4 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIxxEEvT_S3_(ptr noundef, ptr noundef) local_unnamed_addr #7

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #4 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #7

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #6 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { 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 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !10, i64 0}
!13 = !{!14, !12, i64 8}
!14 = !{!"_ZTSSt4pairIxxE", !12, i64 0, !12, i64 8}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = !{!14, !12, i64 0}
!19 = distinct !{!19, !16}
!20 = distinct !{!20, !16}


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