; LLVM IR from tangjz/acm-icpc :: hdu (6052)

; 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 }
%"struct.std::pair" = type { i32, i32 }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@all = external dso_local global i32, align 4
@cnt = external dso_local global i32, align 4
@pos = external dso_local global [101 x i32], align 16
@stk = external dso_local global [101 x [2 x i32]], align 16
@ans = external dso_local global i64, align 8
@e = external dso_local global [10001 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::vector", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"struct.std::pair", align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %22

22:                                               ; preds = %284, %0
  %23 = load i32, ptr @t, align 4, !tbaa !5
  %24 = add nsw i32 %23, -1
  store i32 %24, ptr @t, align 4, !tbaa !5
  %25 = icmp ne i32 %23, 0
  br i1 %25, label %26, label %291

26:                                               ; preds = %22
  %27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %39, %26
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = load i32, ptr @n, align 4, !tbaa !5
  %31 = load i32, ptr @m, align 4, !tbaa !5
  %32 = mul nsw i32 %30, %31
  %33 = icmp slt i32 %29, %32
  br i1 %33, label %35, label %34

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

35:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 24, ptr %3) #6
  call void @llvm.memset.p0.i64(ptr align 8 %3, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [10001 x %"class.std::vector"], ptr @e, i64 0, i64 %37
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %38) #6
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %3) #6
  br label %39

39:                                               ; preds = %35
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %2, align 4, !tbaa !5
  br label %28, !llvm.loop !9

42:                                               ; preds = %34
  %43 = load i32, ptr @n, align 4, !tbaa !5
  %44 = load i32, ptr @n, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  %46 = mul nsw i32 %43, %45
  %47 = ashr i32 %46, 1
  %48 = load i32, ptr @m, align 4, !tbaa !5
  %49 = load i32, ptr @m, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  %51 = mul nsw i32 %48, %50
  %52 = ashr i32 %51, 1
  %53 = mul nsw i32 %47, %52
  store i32 %53, ptr @all, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %75, %42
  %55 = load i32, ptr %4, align 4, !tbaa !5
  %56 = load i32, ptr @n, align 4, !tbaa !5
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %54
  store i32 7, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %78

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

60:                                               ; preds = %71, %59
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = load i32, ptr @m, align 4, !tbaa !5
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %60
  store i32 10, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %74

65:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %66 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %7)
  %67 = load i32, ptr %7, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [10001 x %"class.std::vector"], ptr @e, i64 0, i64 %68
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %70 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %6)
  store i64 %70, ptr %8, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %69, ptr noundef nonnull align 4 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %71

71:                                               ; preds = %65
  %72 = load i32, ptr %6, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %6, align 4, !tbaa !5
  br label %60, !llvm.loop !11

74:                                               ; preds = %64
  br label %75

75:                                               ; preds = %74
  %76 = load i32, ptr %4, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %4, align 4, !tbaa !5
  br label %54, !llvm.loop !12

78:                                               ; preds = %58
  store i64 0, ptr @ans, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %281, %78
  %80 = load i32, ptr %9, align 4, !tbaa !5
  %81 = load i32, ptr @n, align 4, !tbaa !5
  %82 = load i32, ptr @m, align 4, !tbaa !5
  %83 = mul nsw i32 %81, %82
  %84 = icmp slt i32 %80, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %79
  store i32 13, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %284

86:                                               ; preds = %79
  %87 = load i32, ptr %9, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [10001 x %"class.std::vector"], ptr @e, i64 0, i64 %88
  %90 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %89) #6
  %91 = icmp ne i64 %90, 0
  br i1 %91, label %93, label %92

92:                                               ; preds = %86
  br label %281

93:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %94 = load i32, ptr %9, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [10001 x %"class.std::vector"], ptr @e, i64 0, i64 %95
  %97 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %96, i64 noundef 0) #6
  %98 = getelementptr inbounds %"struct.std::pair", ptr %97, i32 0, i32 0
  %99 = load i32, ptr %98, align 4, !tbaa !15
  store i32 %99, ptr %10, align 4, !tbaa !5
  %100 = load i32, ptr %10, align 4, !tbaa !5
  %101 = load i32, ptr %10, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  %103 = mul nsw i32 %100, %102
  %104 = ashr i32 %103, 1
  %105 = load i32, ptr @m, align 4, !tbaa !5
  %106 = load i32, ptr @m, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  %108 = mul nsw i32 %105, %107
  %109 = ashr i32 %108, 1
  %110 = mul nsw i32 %104, %109
  store i32 %110, ptr @cnt, align 4, !tbaa !5
  %111 = load i32, ptr @m, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = mul i64 %112, 4
  call void @llvm.memset.p0.i64(ptr align 16 @pos, i8 -1, i64 %113, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %114 = load i32, ptr %9, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [10001 x %"class.std::vector"], ptr @e, i64 0, i64 %115
  %117 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %116) #6
  %118 = trunc i64 %117 to i32
  store i32 %118, ptr %12, align 4, !tbaa !5
  br label %119

119:                                              ; preds = %253, %93
  %120 = load i32, ptr %11, align 4, !tbaa !5
  %121 = load i32, ptr %12, align 4, !tbaa !5
  %122 = icmp slt i32 %120, %121
  br i1 %122, label %124, label %123

123:                                              ; preds = %119
  store i32 16, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %274

124:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %125 = load i32, ptr %9, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [10001 x %"class.std::vector"], ptr @e, i64 0, i64 %126
  %128 = load i32, ptr %11, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %127, i64 noundef %129) #6
  %131 = getelementptr inbounds %"struct.std::pair", ptr %130, i32 0, i32 0
  %132 = load i32, ptr %131, align 4, !tbaa !15
  store i32 %132, ptr %13, align 4, !tbaa !5
  br label %133

133:                                              ; preds = %162, %124
  %134 = load i32, ptr %11, align 4, !tbaa !5
  %135 = load i32, ptr %12, align 4, !tbaa !5
  %136 = icmp slt i32 %134, %135
  br i1 %136, label %137, label %148

137:                                              ; preds = %133
  %138 = load i32, ptr %9, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [10001 x %"class.std::vector"], ptr @e, i64 0, i64 %139
  %141 = load i32, ptr %11, 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) %140, i64 noundef %142) #6
  %144 = getelementptr inbounds %"struct.std::pair", ptr %143, i32 0, i32 0
  %145 = load i32, ptr %144, align 4, !tbaa !15
  %146 = load i32, ptr %13, align 4, !tbaa !5
  %147 = icmp eq i32 %145, %146
  br label %148

148:                                              ; preds = %137, %133
  %149 = phi i1 [ false, %133 ], [ %147, %137 ]
  br i1 %149, label %150, label %165

150:                                              ; preds = %148
  %151 = load i32, ptr %13, align 4, !tbaa !5
  %152 = load i32, ptr %9, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [10001 x %"class.std::vector"], ptr @e, i64 0, i64 %153
  %155 = load i32, ptr %11, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %154, i64 noundef %156) #6
  %158 = getelementptr inbounds %"struct.std::pair", ptr %157, i32 0, i32 1
  %159 = load i32, ptr %158, align 4, !tbaa !17
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [101 x i32], ptr @pos, i64 0, i64 %160
  store i32 %151, ptr %161, align 4, !tbaa !5
  br label %162

162:                                              ; preds = %150
  %163 = load i32, ptr %11, align 4, !tbaa !5
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr %11, align 4, !tbaa !5
  br label %133, !llvm.loop !18

165:                                              ; preds = %148
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 -1, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %166

166:                                              ; preds = %235, %165
  %167 = load i32, ptr %17, align 4, !tbaa !5
  %168 = load i32, ptr @m, align 4, !tbaa !5
  %169 = icmp slt i32 %167, %168
  br i1 %169, label %171, label %170

170:                                              ; preds = %166
  store i32 21, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %238

171:                                              ; preds = %166
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 1, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %172 = load i32, ptr %13, align 4, !tbaa !5
  %173 = load i32, ptr %17, align 4, !tbaa !5
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [101 x i32], ptr @pos, i64 0, i64 %174
  %176 = load i32, ptr %175, align 4, !tbaa !5
  %177 = sub nsw i32 %172, %176
  store i32 %177, ptr %19, align 4, !tbaa !5
  br label %178

178:                                              ; preds = %212, %171
  %179 = load i32, ptr %16, align 4, !tbaa !5
  %180 = icmp sge i32 %179, 0
  br i1 %180, label %181, label %189

181:                                              ; preds = %178
  %182 = load i32, ptr %16, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [101 x [2 x i32]], ptr @stk, i64 0, i64 %183
  %185 = getelementptr inbounds [2 x i32], ptr %184, i64 0, i64 1
  %186 = load i32, ptr %185, align 4, !tbaa !5
  %187 = load i32, ptr %19, align 4, !tbaa !5
  %188 = icmp sge i32 %186, %187
  br label %189

189:                                              ; preds = %181, %178
  %190 = phi i1 [ false, %178 ], [ %188, %181 ]
  br i1 %190, label %191, label %215

191:                                              ; preds = %189
  %192 = load i32, ptr %16, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [101 x [2 x i32]], ptr @stk, i64 0, i64 %193
  %195 = getelementptr inbounds [2 x i32], ptr %194, i64 0, i64 0
  %196 = load i32, ptr %195, align 8, !tbaa !5
  %197 = load i32, ptr %16, align 4, !tbaa !5
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [101 x [2 x i32]], ptr @stk, i64 0, i64 %198
  %200 = getelementptr inbounds [2 x i32], ptr %199, i64 0, i64 1
  %201 = load i32, ptr %200, align 4, !tbaa !5
  %202 = mul nsw i32 %196, %201
  %203 = load i32, ptr %15, align 4, !tbaa !5
  %204 = sub nsw i32 %203, %202
  store i32 %204, ptr %15, align 4, !tbaa !5
  %205 = load i32, ptr %16, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [101 x [2 x i32]], ptr @stk, i64 0, i64 %206
  %208 = getelementptr inbounds [2 x i32], ptr %207, i64 0, i64 0
  %209 = load i32, ptr %208, align 8, !tbaa !5
  %210 = load i32, ptr %18, align 4, !tbaa !5
  %211 = add nsw i32 %210, %209
  store i32 %211, ptr %18, align 4, !tbaa !5
  br label %212

212:                                              ; preds = %191
  %213 = load i32, ptr %16, align 4, !tbaa !5
  %214 = add nsw i32 %213, -1
  store i32 %214, ptr %16, align 4, !tbaa !5
  br label %178, !llvm.loop !19

215:                                              ; preds = %189
  %216 = load i32, ptr %18, align 4, !tbaa !5
  %217 = load i32, ptr %16, align 4, !tbaa !5
  %218 = add nsw i32 %217, 1
  store i32 %218, ptr %16, align 4, !tbaa !5
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [101 x [2 x i32]], ptr @stk, i64 0, i64 %219
  %221 = getelementptr inbounds [2 x i32], ptr %220, i64 0, i64 0
  store i32 %216, ptr %221, align 8, !tbaa !5
  %222 = load i32, ptr %19, align 4, !tbaa !5
  %223 = load i32, ptr %16, align 4, !tbaa !5
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds [101 x [2 x i32]], ptr @stk, i64 0, i64 %224
  %226 = getelementptr inbounds [2 x i32], ptr %225, i64 0, i64 1
  store i32 %222, ptr %226, align 4, !tbaa !5
  %227 = load i32, ptr %18, align 4, !tbaa !5
  %228 = load i32, ptr %19, align 4, !tbaa !5
  %229 = mul nsw i32 %227, %228
  %230 = load i32, ptr %15, align 4, !tbaa !5
  %231 = add nsw i32 %230, %229
  store i32 %231, ptr %15, align 4, !tbaa !5
  %232 = load i32, ptr %15, align 4, !tbaa !5
  %233 = load i32, ptr %14, align 4, !tbaa !5
  %234 = add nsw i32 %233, %232
  store i32 %234, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %235

235:                                              ; preds = %215
  %236 = load i32, ptr %17, align 4, !tbaa !5
  %237 = add nsw i32 %236, 1
  store i32 %237, ptr %17, align 4, !tbaa !5
  br label %166, !llvm.loop !20

238:                                              ; preds = %170
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %239 = load i32, ptr %11, align 4, !tbaa !5
  %240 = load i32, ptr %12, align 4, !tbaa !5
  %241 = icmp slt i32 %239, %240
  br i1 %241, label %242, label %251

242:                                              ; preds = %238
  %243 = load i32, ptr %9, align 4, !tbaa !5
  %244 = sext i32 %243 to i64
  %245 = getelementptr inbounds [10001 x %"class.std::vector"], ptr @e, i64 0, i64 %244
  %246 = load i32, ptr %11, align 4, !tbaa !5
  %247 = sext i32 %246 to i64
  %248 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %245, i64 noundef %247) #6
  %249 = getelementptr inbounds %"struct.std::pair", ptr %248, i32 0, i32 0
  %250 = load i32, ptr %249, align 4, !tbaa !15
  br label %253

251:                                              ; preds = %238
  %252 = load i32, ptr @n, align 4, !tbaa !5
  br label %253

253:                                              ; preds = %251, %242
  %254 = phi i32 [ %250, %242 ], [ %252, %251 ]
  %255 = load i32, ptr %13, align 4, !tbaa !5
  %256 = sub nsw i32 %254, %255
  store i32 %256, ptr %20, align 4, !tbaa !5
  %257 = load i32, ptr %20, align 4, !tbaa !5
  %258 = load i32, ptr %14, align 4, !tbaa !5
  %259 = mul nsw i32 %257, %258
  %260 = load i32, ptr %20, align 4, !tbaa !5
  %261 = load i32, ptr %20, align 4, !tbaa !5
  %262 = sub nsw i32 %261, 1
  %263 = mul nsw i32 %260, %262
  %264 = ashr i32 %263, 1
  %265 = load i32, ptr @m, align 4, !tbaa !5
  %266 = load i32, ptr @m, align 4, !tbaa !5
  %267 = add nsw i32 %266, 1
  %268 = mul nsw i32 %265, %267
  %269 = ashr i32 %268, 1
  %270 = mul nsw i32 %264, %269
  %271 = add nsw i32 %259, %270
  %272 = load i32, ptr @cnt, align 4, !tbaa !5
  %273 = add nsw i32 %272, %271
  store i32 %273, ptr @cnt, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %119, !llvm.loop !21

274:                                              ; preds = %123
  %275 = load i32, ptr @all, align 4, !tbaa !5
  %276 = load i32, ptr @cnt, align 4, !tbaa !5
  %277 = sub nsw i32 %275, %276
  %278 = sext i32 %277 to i64
  %279 = load i64, ptr @ans, align 8, !tbaa !13
  %280 = add nsw i64 %279, %278
  store i64 %280, ptr @ans, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %281

281:                                              ; preds = %274, %92
  %282 = load i32, ptr %9, align 4, !tbaa !5
  %283 = add nsw i32 %282, 1
  store i32 %283, ptr %9, align 4, !tbaa !5
  br label %79, !llvm.loop !22

284:                                              ; preds = %85
  %285 = load i64, ptr @ans, align 8, !tbaa !13
  %286 = sitofp i64 %285 to double
  %287 = load i32, ptr @all, align 4, !tbaa !5
  %288 = sitofp i32 %287 to double
  %289 = fdiv double %286, %288
  %290 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, double noundef %289)
  br label %22, !llvm.loop !23

291:                                              ; preds = %22
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) #5 align 2

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

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

declare i32 @printf(ptr noundef, ...) #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 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 #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 = !{!14, !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!17 = !{!16, !6, i64 4}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !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 }
%"struct.std::pair" = type { i32, i32 }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@all = external dso_local local_unnamed_addr global i32, align 4
@cnt = external dso_local local_unnamed_addr global i32, align 4
@pos = external dso_local local_unnamed_addr global [101 x i32], align 16
@stk = external dso_local local_unnamed_addr global [101 x [2 x i32]], align 16
@ans = external dso_local local_unnamed_addr global i64, align 8
@e = external dso_local global [10001 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca %"class.std::vector", align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair", align 8
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %7 = load i32, ptr @t, align 4, !tbaa !5
  %8 = add nsw i32 %7, -1
  store i32 %8, ptr @t, align 4, !tbaa !5
  %.not110 = icmp eq i32 %7, 0
  br i1 %.not110, label %._crit_edge113, label %.lr.ph112

.lr.ph112:                                        ; preds = %0, %._crit_edge109
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = load i32, ptr @m, align 4, !tbaa !5
  %12 = mul nsw i32 %11, %10
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph112
  %14 = phi i32 [ %10, %.lr.ph112 ], [ %26, %.lr.ph ]
  %15 = phi i32 [ %11, %.lr.ph112 ], [ %27, %.lr.ph ]
  %16 = add nsw i32 %14, 1
  %17 = mul nsw i32 %16, %14
  %18 = ashr i32 %17, 1
  %19 = add nsw i32 %15, 1
  %20 = mul nsw i32 %19, %15
  %21 = ashr i32 %20, 1
  %22 = mul nsw i32 %21, %18
  store i32 %22, ptr @all, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  %23 = icmp sgt i32 %14, 0
  %24 = icmp sgt i32 %15, 0
  %or.cond = and i1 %23, %24
  br i1 %or.cond, label %.lr.ph79.split, label %._crit_edge80

.lr.ph:                                           ; preds = %.lr.ph112, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph112 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %1, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  %25 = getelementptr inbounds [10001 x %"class.std::vector"], ptr @e, i64 0, i64 %indvars.iv
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %25) #7
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %26 = load i32, ptr @n, align 4, !tbaa !5
  %27 = load i32, ptr @m, align 4, !tbaa !5
  %28 = mul nsw i32 %27, %26
  %29 = sext i32 %28 to i64
  %30 = icmp slt i64 %indvars.iv.next, %29
  br i1 %30, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge80:                                    ; preds = %._crit_edge77, %._crit_edge
  %31 = phi i32 [ %15, %._crit_edge ], [ %41, %._crit_edge77 ]
  %32 = phi i32 [ %14, %._crit_edge ], [ %39, %._crit_edge77 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  store i64 0, ptr @ans, align 8, !tbaa !11
  %33 = mul nsw i32 %31, %32
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph108, label %._crit_edge109

.lr.ph79.split:                                   ; preds = %._crit_edge, %._crit_edge77
  %35 = phi i32 [ %39, %._crit_edge77 ], [ %14, %._crit_edge ]
  %36 = phi i32 [ %42, %._crit_edge77 ], [ 0, %._crit_edge ]
  %37 = phi i32 [ %41, %._crit_edge77 ], [ %15, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  store i32 0, ptr %3, align 4, !tbaa !5
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %.lr.ph76, label %._crit_edge77

._crit_edge77.loopexit:                           ; preds = %.lr.ph76
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  %.pre128 = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge77

._crit_edge77:                                    ; preds = %._crit_edge77.loopexit, %.lr.ph79.split
  %39 = phi i32 [ %.pre128, %._crit_edge77.loopexit ], [ %35, %.lr.ph79.split ]
  %40 = phi i32 [ %.pre, %._crit_edge77.loopexit ], [ %36, %.lr.ph79.split ]
  %41 = phi i32 [ %51, %._crit_edge77.loopexit ], [ %37, %.lr.ph79.split ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %42 = add nsw i32 %40, 1
  store i32 %42, ptr %2, align 4, !tbaa !5
  %43 = icmp slt i32 %42, %39
  br i1 %43, label %.lr.ph79.split, label %._crit_edge80, !llvm.loop !13

.lr.ph76:                                         ; preds = %.lr.ph79.split, %.lr.ph76
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %44 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %4)
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [10001 x %"class.std::vector"], ptr @e, i64 0, i64 %46
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %48 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i64 %48, ptr %5, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %47, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %3, align 4, !tbaa !5
  %51 = load i32, ptr @m, align 4, !tbaa !5
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %.lr.ph76, label %._crit_edge77.loopexit, !llvm.loop !15

._crit_edge109.loopexit:                          ; preds = %144
  %.pre131 = load i64, ptr @ans, align 8, !tbaa !11
  br label %._crit_edge109

._crit_edge109:                                   ; preds = %._crit_edge109.loopexit, %._crit_edge80
  %53 = phi i64 [ %.pre131, %._crit_edge109.loopexit ], [ 0, %._crit_edge80 ]
  %54 = sitofp i64 %53 to double
  %55 = load i32, ptr @all, align 4, !tbaa !5
  %56 = sitofp i32 %55 to double
  %57 = fdiv double %54, %56
  %58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %57)
  %59 = load i32, ptr @t, align 4, !tbaa !5
  %60 = add nsw i32 %59, -1
  store i32 %60, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %59, 0
  br i1 %.not, label %._crit_edge113, label %.lr.ph112, !llvm.loop !16

.lr.ph108:                                        ; preds = %._crit_edge80, %144
  %indvars.iv125 = phi i64 [ %indvars.iv.next126, %144 ], [ 0, %._crit_edge80 ]
  %61 = getelementptr inbounds [10001 x %"class.std::vector"], ptr @e, i64 0, i64 %indvars.iv125
  %62 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %61) #7
  %.not68 = icmp eq i64 %62, 0
  br i1 %.not68, label %144, label %63

63:                                               ; preds = %.lr.ph108
  %64 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %61, i64 noundef 0) #7
  %65 = load i32, ptr %64, align 4, !tbaa !17
  %66 = add nsw i32 %65, 1
  %67 = mul nsw i32 %66, %65
  %68 = ashr i32 %67, 1
  %69 = load i32, ptr @m, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  %71 = mul nsw i32 %70, %69
  %72 = ashr i32 %71, 1
  %73 = mul nsw i32 %72, %68
  store i32 %73, ptr @cnt, align 4, !tbaa !5
  %74 = sext i32 %69 to i64
  %75 = shl nsw i64 %74, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @pos, i8 -1, i64 %75, i1 false)
  %76 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %61) #7
  %77 = trunc i64 %76 to i32
  %78 = icmp sgt i32 %77, 0
  br i1 %78, label %.lr.ph104.preheader, label %.._crit_edge105_crit_edge

.._crit_edge105_crit_edge:                        ; preds = %63
  %.pre130 = load i32, ptr @cnt, align 4, !tbaa !5
  br label %._crit_edge105

.lr.ph104.preheader:                              ; preds = %63
  %79 = and i64 %76, 2147483647
  br label %.lr.ph104

._crit_edge105:                                   ; preds = %128, %.._crit_edge105_crit_edge
  %80 = phi i32 [ %.pre130, %.._crit_edge105_crit_edge ], [ %142, %128 ]
  %81 = load i32, ptr @all, align 4, !tbaa !5
  %82 = sub nsw i32 %81, %80
  %83 = sext i32 %82 to i64
  %84 = load i64, ptr @ans, align 8, !tbaa !11
  %85 = add nsw i64 %84, %83
  store i64 %85, ptr @ans, align 8, !tbaa !11
  br label %144

.lr.ph104:                                        ; preds = %.lr.ph104.preheader, %128
  %.063102 = phi i32 [ %.164.lcssa, %128 ], [ 0, %.lr.ph104.preheader ]
  %86 = sext i32 %.063102 to i64
  %87 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %61, i64 noundef %86) #7
  %88 = load i32, ptr %87, align 4, !tbaa !17
  %89 = add nsw i32 %.063102, 1
  %smax121 = call i32 @llvm.smax.i32(i32 %89, i32 %77)
  br label %90

90:                                               ; preds = %.lr.ph104, %93
  %indvars.iv119 = phi i64 [ %86, %.lr.ph104 ], [ %indvars.iv.next120, %93 ]
  %91 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %61, i64 noundef %indvars.iv119) #7
  %92 = load i32, ptr %91, align 4, !tbaa !17
  %.not132 = icmp eq i32 %92, %88
  br i1 %.not132, label %93, label %.critedge.split.loop.exit139

93:                                               ; preds = %90
  %94 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %61, i64 noundef %indvars.iv119) #7
  %95 = getelementptr inbounds i8, ptr %94, i64 4
  %96 = load i32, ptr %95, align 4, !tbaa !19
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [101 x i32], ptr @pos, i64 0, i64 %97
  store i32 %88, ptr %98, align 4, !tbaa !5
  %indvars.iv.next120 = add nsw i64 %indvars.iv119, 1
  %99 = icmp slt i64 %indvars.iv.next120, %79
  br i1 %99, label %90, label %.critedge, !llvm.loop !20

.critedge.split.loop.exit139:                     ; preds = %90
  %100 = trunc nsw i64 %indvars.iv119 to i32
  br label %.critedge

.critedge:                                        ; preds = %93, %.critedge.split.loop.exit139
  %.164.lcssa = phi i32 [ %100, %.critedge.split.loop.exit139 ], [ %smax121, %93 ]
  %101 = load i32, ptr @m, align 4, !tbaa !5
  %102 = icmp sgt i32 %101, 0
  br i1 %102, label %.lr.ph99.preheader, label %._crit_edge100

.lr.ph99.preheader:                               ; preds = %.critedge
  %wide.trip.count = zext nneg i32 %101 to i64
  br label %.lr.ph99

._crit_edge100:                                   ; preds = %.critedge2, %.critedge
  %.061.lcssa = phi i32 [ 0, %.critedge ], [ %124, %.critedge2 ]
  br i1 %.not132, label %128, label %125

.lr.ph99:                                         ; preds = %.lr.ph99.preheader, %.critedge2
  %indvars.iv122 = phi i64 [ 0, %.lr.ph99.preheader ], [ %indvars.iv.next123, %.critedge2 ]
  %.05897 = phi i32 [ -1, %.lr.ph99.preheader ], [ %118, %.critedge2 ]
  %.05996 = phi i32 [ 0, %.lr.ph99.preheader ], [ %123, %.critedge2 ]
  %.06195 = phi i32 [ 0, %.lr.ph99.preheader ], [ %124, %.critedge2 ]
  %103 = getelementptr inbounds [101 x i32], ptr @pos, i64 0, i64 %indvars.iv122
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = sub nsw i32 %88, %104
  %106 = icmp sgt i32 %.05897, -1
  br i1 %106, label %.lr.ph87, label %.critedge2

.lr.ph87:                                         ; preds = %.lr.ph99, %111
  %.05685 = phi i32 [ %115, %111 ], [ 1, %.lr.ph99 ]
  %.184 = phi i32 [ %116, %111 ], [ %.05897, %.lr.ph99 ]
  %.16083 = phi i32 [ %114, %111 ], [ %.05996, %.lr.ph99 ]
  %107 = zext nneg i32 %.184 to i64
  %108 = getelementptr inbounds [101 x [2 x i32]], ptr @stk, i64 0, i64 %107
  %109 = getelementptr inbounds i8, ptr %108, i64 4
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %.not69 = icmp slt i32 %110, %105
  br i1 %.not69, label %.critedge2, label %111

111:                                              ; preds = %.lr.ph87
  %112 = load i32, ptr %108, align 8, !tbaa !5
  %113 = mul nsw i32 %112, %110
  %114 = sub nsw i32 %.16083, %113
  %115 = add nsw i32 %112, %.05685
  %116 = add nsw i32 %.184, -1
  %117 = icmp sgt i32 %.184, 0
  br i1 %117, label %.lr.ph87, label %.critedge2, !llvm.loop !21

.critedge2:                                       ; preds = %.lr.ph87, %111, %.lr.ph99
  %.160.lcssa = phi i32 [ %.05996, %.lr.ph99 ], [ %114, %111 ], [ %.16083, %.lr.ph87 ]
  %.1.lcssa = phi i32 [ %.05897, %.lr.ph99 ], [ -1, %111 ], [ %.184, %.lr.ph87 ]
  %.056.lcssa = phi i32 [ 1, %.lr.ph99 ], [ %115, %111 ], [ %.05685, %.lr.ph87 ]
  %118 = add nsw i32 %.1.lcssa, 1
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [101 x [2 x i32]], ptr @stk, i64 0, i64 %119
  store i32 %.056.lcssa, ptr %120, align 8, !tbaa !5
  %121 = getelementptr inbounds i8, ptr %120, i64 4
  store i32 %105, ptr %121, align 4, !tbaa !5
  %122 = mul nsw i32 %.056.lcssa, %105
  %123 = add nsw i32 %122, %.160.lcssa
  %124 = add nsw i32 %123, %.06195
  %indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next123, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge100, label %.lr.ph99, !llvm.loop !22

125:                                              ; preds = %._crit_edge100
  %126 = sext i32 %.164.lcssa to i64
  %127 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %61, i64 noundef %126) #7
  %.pre129 = load i32, ptr @m, align 4, !tbaa !5
  br label %128

128:                                              ; preds = %._crit_edge100, %125
  %129 = phi i32 [ %.pre129, %125 ], [ %101, %._crit_edge100 ]
  %.in = phi ptr [ %127, %125 ], [ @n, %._crit_edge100 ]
  %130 = load i32, ptr %.in, align 4, !tbaa !5
  %131 = sub nsw i32 %130, %88
  %132 = mul nsw i32 %131, %.061.lcssa
  %133 = add nsw i32 %131, -1
  %134 = mul nsw i32 %133, %131
  %135 = ashr i32 %134, 1
  %136 = add nsw i32 %129, 1
  %137 = mul nsw i32 %136, %129
  %138 = ashr i32 %137, 1
  %139 = mul nsw i32 %135, %138
  %140 = load i32, ptr @cnt, align 4, !tbaa !5
  %141 = add i32 %140, %132
  %142 = add i32 %141, %139
  store i32 %142, ptr @cnt, align 4, !tbaa !5
  %143 = icmp slt i32 %.164.lcssa, %77
  br i1 %143, label %.lr.ph104, label %._crit_edge105, !llvm.loop !23

144:                                              ; preds = %.lr.ph108, %._crit_edge105
  %indvars.iv.next126 = add nuw nsw i64 %indvars.iv125, 1
  %145 = load i32, ptr @n, align 4, !tbaa !5
  %146 = load i32, ptr @m, align 4, !tbaa !5
  %147 = mul nsw i32 %146, %145
  %148 = sext i32 %147 to i64
  %149 = icmp slt i64 %indvars.iv.next126, %148
  br i1 %149, label %.lr.ph108, label %._crit_edge109.loopexit, !llvm.loop !24

._crit_edge113:                                   ; preds = %._crit_edge109, %0
  ret i32 0
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; 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 nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #5 align 2

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6

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 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 #2 = { nofree nounwind "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 nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10, !14}
!14 = !{!"llvm.loop.unswitch.partial.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!18, !6, i64 0}
!18 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!19 = !{!18, !6, i64 4}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}


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