; LLVM IR from tangjz/acm-icpc :: Summer_Training/2016-07-19/upsolved (C - Game - tjz)

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

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@quex = external dso_local global [1001 x i32], align 16
@quey = external dso_local global [1001 x i32], align 16
@sum = external dso_local global i64, align 8
@str = external dso_local global [1001 x [1002 x i8]], 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 [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z5solvev() #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, 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
  store i32 0, ptr %1, align 4
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %15

15:                                               ; preds = %241, %0
  %16 = load i32, ptr @t, align 4, !tbaa !5
  %17 = add nsw i32 %16, -1
  store i32 %17, ptr @t, align 4, !tbaa !5
  %18 = icmp ne i32 %16, 0
  br i1 %18, label %19, label %260

19:                                               ; preds = %15
  store i32 0, ptr @tot, align 4, !tbaa !5
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m)
  store i64 0, ptr @sum, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %43, %19
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %26, label %25

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

26:                                               ; preds = %21
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = mul nsw i64 2, %28
  %30 = load i32, ptr @n, align 4, !tbaa !5
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sub nsw i32 %30, %31
  %33 = sext i32 %32 to i64
  %34 = mul nsw i64 %29, %33
  %35 = load i32, ptr @m, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = mul nsw i64 %34, %36
  %38 = load i32, ptr @m, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = mul nsw i64 %37, %39
  %41 = load i64, ptr @sum, align 8, !tbaa !9
  %42 = add nsw i64 %41, %40
  store i64 %42, ptr @sum, align 8, !tbaa !9
  br label %43

43:                                               ; preds = %26
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %2, align 4, !tbaa !5
  br label %21, !llvm.loop !11

46:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %69, %46
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = load i32, ptr @m, align 4, !tbaa !5
  %50 = icmp slt i32 %48, %49
  br i1 %50, label %52, label %51

51:                                               ; preds = %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %72

52:                                               ; preds = %47
  %53 = load i32, ptr @n, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = mul nsw i64 2, %54
  %56 = load i32, ptr @n, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = mul nsw i64 %55, %57
  %59 = load i32, ptr %3, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = mul nsw i64 %58, %60
  %62 = load i32, ptr @m, align 4, !tbaa !5
  %63 = load i32, ptr %3, align 4, !tbaa !5
  %64 = sub nsw i32 %62, %63
  %65 = sext i32 %64 to i64
  %66 = mul nsw i64 %61, %65
  %67 = load i64, ptr @sum, align 8, !tbaa !9
  %68 = add nsw i64 %67, %66
  store i64 %68, ptr @sum, align 8, !tbaa !9
  br label %69

69:                                               ; preds = %52
  %70 = load i32, ptr %3, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %3, align 4, !tbaa !5
  br label %47, !llvm.loop !13

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

73:                                               ; preds = %155, %72
  %74 = load i32, ptr %4, align 4, !tbaa !5
  %75 = load i32, ptr @n, align 4, !tbaa !5
  %76 = icmp sle i32 %74, %75
  br i1 %76, label %78, label %77

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

78:                                               ; preds = %73
  %79 = load i32, ptr %4, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [1001 x [1002 x i8]], ptr @str, i64 0, i64 %80
  %82 = getelementptr inbounds [1002 x i8], ptr %81, i64 0, i64 0
  %83 = getelementptr inbounds i8, ptr %82, i64 1
  %84 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %83)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %151, %78
  %86 = load i32, ptr %6, align 4, !tbaa !5
  %87 = load i32, ptr @m, align 4, !tbaa !5
  %88 = icmp sle i32 %86, %87
  br i1 %88, label %90, label %89

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

90:                                               ; preds = %85
  %91 = load i32, ptr %4, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [1001 x [1002 x i8]], ptr @str, i64 0, i64 %92
  %94 = load i32, ptr %6, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [1002 x i8], ptr %93, i64 0, i64 %95
  %97 = load i8, ptr %96, align 1, !tbaa !14
  %98 = sext i8 %97 to i32
  %99 = icmp eq i32 %98, 71
  br i1 %99, label %100, label %150

100:                                              ; preds = %90
  %101 = load i32, ptr %4, align 4, !tbaa !5
  %102 = load i32, ptr @tot, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [1001 x i32], ptr @quex, i64 0, i64 %103
  store i32 %101, ptr %104, align 4, !tbaa !5
  %105 = load i32, ptr %6, align 4, !tbaa !5
  %106 = load i32, ptr @tot, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr @tot, align 4, !tbaa !5
  %108 = sext i32 %106 to i64
  %109 = getelementptr inbounds [1001 x i32], ptr @quey, i64 0, i64 %108
  store i32 %105, ptr %109, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %126, %100
  %111 = load i32, ptr %7, align 4, !tbaa !5
  %112 = load i32, ptr @n, align 4, !tbaa !5
  %113 = icmp sle i32 %111, %112
  br i1 %113, label %115, label %114

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

115:                                              ; preds = %110
  %116 = load i32, ptr %4, align 4, !tbaa !5
  %117 = load i32, ptr %7, align 4, !tbaa !5
  %118 = sub nsw i32 %116, %117
  %119 = call i32 @llvm.abs.i32(i32 %118, i1 true)
  %120 = load i32, ptr @m, align 4, !tbaa !5
  %121 = mul nsw i32 %119, %120
  %122 = shl i32 %121, 1
  %123 = sext i32 %122 to i64
  %124 = load i64, ptr @sum, align 8, !tbaa !9
  %125 = sub nsw i64 %124, %123
  store i64 %125, ptr @sum, align 8, !tbaa !9
  br label %126

126:                                              ; preds = %115
  %127 = load i32, ptr %7, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %7, align 4, !tbaa !5
  br label %110, !llvm.loop !15

129:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %130

130:                                              ; preds = %146, %129
  %131 = load i32, ptr %8, align 4, !tbaa !5
  %132 = load i32, ptr @m, align 4, !tbaa !5
  %133 = icmp sle i32 %131, %132
  br i1 %133, label %135, label %134

134:                                              ; preds = %130
  store i32 19, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %149

135:                                              ; preds = %130
  %136 = load i32, ptr @n, align 4, !tbaa !5
  %137 = load i32, ptr %6, align 4, !tbaa !5
  %138 = load i32, ptr %8, align 4, !tbaa !5
  %139 = sub nsw i32 %137, %138
  %140 = call i32 @llvm.abs.i32(i32 %139, i1 true)
  %141 = mul nsw i32 %136, %140
  %142 = shl i32 %141, 1
  %143 = sext i32 %142 to i64
  %144 = load i64, ptr @sum, align 8, !tbaa !9
  %145 = sub nsw i64 %144, %143
  store i64 %145, ptr @sum, align 8, !tbaa !9
  br label %146

146:                                              ; preds = %135
  %147 = load i32, ptr %8, align 4, !tbaa !5
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %8, align 4, !tbaa !5
  br label %130, !llvm.loop !16

149:                                              ; preds = %134
  br label %150

150:                                              ; preds = %149, %90
  br label %151

151:                                              ; preds = %150
  %152 = load i32, ptr %6, align 4, !tbaa !5
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr %6, align 4, !tbaa !5
  br label %85, !llvm.loop !17

154:                                              ; preds = %89
  br label %155

155:                                              ; preds = %154
  %156 = load i32, ptr %4, align 4, !tbaa !5
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %4, align 4, !tbaa !5
  br label %73, !llvm.loop !18

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

159:                                              ; preds = %202, %158
  %160 = load i32, ptr %9, align 4, !tbaa !5
  %161 = load i32, ptr @tot, align 4, !tbaa !5
  %162 = icmp slt i32 %160, %161
  br i1 %162, label %164, label %163

163:                                              ; preds = %159
  store i32 22, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %205

164:                                              ; preds = %159
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %165 = load i32, ptr %9, align 4, !tbaa !5
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr %10, align 4, !tbaa !5
  br label %167

167:                                              ; preds = %198, %164
  %168 = load i32, ptr %10, align 4, !tbaa !5
  %169 = load i32, ptr @tot, align 4, !tbaa !5
  %170 = icmp slt i32 %168, %169
  br i1 %170, label %172, label %171

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

172:                                              ; preds = %167
  %173 = load i32, ptr %9, align 4, !tbaa !5
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [1001 x i32], ptr @quex, i64 0, i64 %174
  %176 = load i32, ptr %175, align 4, !tbaa !5
  %177 = load i32, ptr %10, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [1001 x i32], ptr @quex, i64 0, i64 %178
  %180 = load i32, ptr %179, align 4, !tbaa !5
  %181 = sub nsw i32 %176, %180
  %182 = call i32 @llvm.abs.i32(i32 %181, i1 true)
  %183 = load i32, ptr %9, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [1001 x i32], ptr @quey, i64 0, i64 %184
  %186 = load i32, ptr %185, align 4, !tbaa !5
  %187 = load i32, ptr %10, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [1001 x i32], ptr @quey, i64 0, i64 %188
  %190 = load i32, ptr %189, align 4, !tbaa !5
  %191 = sub nsw i32 %186, %190
  %192 = call i32 @llvm.abs.i32(i32 %191, i1 true)
  %193 = add nsw i32 %182, %192
  %194 = shl i32 %193, 1
  %195 = sext i32 %194 to i64
  %196 = load i64, ptr @sum, align 8, !tbaa !9
  %197 = add nsw i64 %196, %195
  store i64 %197, ptr @sum, align 8, !tbaa !9
  br label %198

198:                                              ; preds = %172
  %199 = load i32, ptr %10, align 4, !tbaa !5
  %200 = add nsw i32 %199, 1
  store i32 %200, ptr %10, align 4, !tbaa !5
  br label %167, !llvm.loop !19

201:                                              ; preds = %171
  br label %202

202:                                              ; preds = %201
  %203 = load i32, ptr %9, align 4, !tbaa !5
  %204 = add nsw i32 %203, 1
  store i32 %204, ptr %9, align 4, !tbaa !5
  br label %159, !llvm.loop !20

205:                                              ; preds = %163
  call void @_Z5solvev()
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %206 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %207 = load i32, ptr %206, align 4, !tbaa !5
  store i32 %207, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %208

208:                                              ; preds = %238, %205
  %209 = load i32, ptr %12, align 4, !tbaa !5
  %210 = load i32, ptr %11, align 4, !tbaa !5
  %211 = icmp sle i32 %209, %210
  br i1 %211, label %213, label %212

212:                                              ; preds = %208
  store i32 28, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %241

213:                                              ; preds = %208
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %214 = load i32, ptr %12, align 4, !tbaa !5
  %215 = add nsw i32 %214, 1
  store i32 %215, ptr %13, align 4, !tbaa !5
  br label %216

216:                                              ; preds = %234, %213
  %217 = load i32, ptr %13, align 4, !tbaa !5
  %218 = load i32, ptr %11, align 4, !tbaa !5
  %219 = icmp sle i32 %217, %218
  br i1 %219, label %221, label %220

220:                                              ; preds = %216
  store i32 31, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %237

221:                                              ; preds = %216
  %222 = load i32, ptr %12, align 4, !tbaa !5
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [1001 x [1002 x i8]], ptr @str, i64 0, i64 %223
  %225 = load i32, ptr %13, align 4, !tbaa !5
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [1002 x i8], ptr %224, i64 0, i64 %226
  %228 = load i32, ptr %13, align 4, !tbaa !5
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [1001 x [1002 x i8]], ptr @str, i64 0, i64 %229
  %231 = load i32, ptr %12, align 4, !tbaa !5
  %232 = sext i32 %231 to i64
  %233 = getelementptr inbounds [1002 x i8], ptr %230, i64 0, i64 %232
  call void @_ZSt4swapIcENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 1 dereferenceable(1) %227, ptr noundef nonnull align 1 dereferenceable(1) %233) #6
  br label %234

234:                                              ; preds = %221
  %235 = load i32, ptr %13, align 4, !tbaa !5
  %236 = add nsw i32 %235, 1
  store i32 %236, ptr %13, align 4, !tbaa !5
  br label %216, !llvm.loop !21

237:                                              ; preds = %220
  br label %238

238:                                              ; preds = %237
  %239 = load i32, ptr %12, align 4, !tbaa !5
  %240 = add nsw i32 %239, 1
  store i32 %240, ptr %12, align 4, !tbaa !5
  br label %208, !llvm.loop !22

241:                                              ; preds = %212
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) @m) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @_Z5solvev()
  %242 = load i64, ptr @sum, align 8, !tbaa !9
  %243 = sitofp i64 %242 to double
  %244 = load i32, ptr @n, align 4, !tbaa !5
  %245 = load i32, ptr @m, align 4, !tbaa !5
  %246 = mul nsw i32 %244, %245
  %247 = load i32, ptr @tot, align 4, !tbaa !5
  %248 = sub nsw i32 %246, %247
  %249 = sext i32 %248 to i64
  %250 = load i32, ptr @n, align 4, !tbaa !5
  %251 = load i32, ptr @m, align 4, !tbaa !5
  %252 = mul nsw i32 %250, %251
  %253 = load i32, ptr @tot, align 4, !tbaa !5
  %254 = sub nsw i32 %252, %253
  %255 = sext i32 %254 to i64
  %256 = mul nsw i64 %249, %255
  %257 = sitofp i64 %256 to double
  %258 = fdiv double %243, %257
  %259 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, double noundef %258)
  br label %15, !llvm.loop !23

260:                                              ; preds = %15
  ret i32 0
}

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIcENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #5

declare i32 @printf(ptr noundef, ...) #3

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@quex = external dso_local local_unnamed_addr global [1001 x i32], align 16
@quey = external dso_local local_unnamed_addr global [1001 x i32], align 16
@sum = external dso_local local_unnamed_addr global i64, align 8
@str = external dso_local global [1001 x [1002 x i8]], 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 [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z5solvev() local_unnamed_addr #0

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %2 = load i32, ptr @t, align 4, !tbaa !5
  %3 = add nsw i32 %2, -1
  store i32 %3, ptr @t, align 4, !tbaa !5
  %.not121 = icmp eq i32 %2, 0
  br i1 %.not121, label %._crit_edge124, label %.lr.ph123

.lr.ph123:                                        ; preds = %0, %._crit_edge120
  store i32 0, ptr @tot, align 4, !tbaa !5
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m)
  store i64 0, ptr @sum, align 8, !tbaa !9
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 1
  %.pre = load i32, ptr @m, align 4, !tbaa !5
  br i1 %6, label %.lr.ph, label %.preheader67

.lr.ph:                                           ; preds = %.lr.ph123
  %7 = sext i32 %.pre to i64
  %8 = zext nneg i32 %5 to i64
  %9 = shl nuw nsw i64 %8, 2
  %10 = add nsw i64 %9, -8
  %11 = add nsw i32 %5, -2
  %12 = zext nneg i32 %11 to i64
  %13 = mul nuw i64 %10, %12
  %14 = add i64 %13, -2
  %15 = shl nuw nsw i64 %8, 1
  %16 = add nsw i64 %15, -10
  %17 = zext nneg i32 %11 to i65
  %18 = add nsw i32 %5, -3
  %19 = zext i32 %18 to i65
  %20 = mul nuw nsw i65 %17, %19
  %21 = lshr i65 %20, 1
  %22 = trunc nuw nsw i65 %21 to i64
  %23 = mul i64 %16, %22
  %24 = add i64 %14, %23
  %25 = add nsw i32 %5, -4
  %26 = zext i32 %25 to i65
  %27 = mul i65 %20, %26
  %28 = lshr i65 %27, 1
  %29 = trunc nuw i65 %28 to i64
  %30 = mul i64 %29, 6148914691236517204
  %31 = add i64 %24, %30
  %32 = add i64 %31, %15
  %33 = mul nsw i64 %7, %7
  %34 = mul i64 %32, %33
  store i64 %34, ptr @sum, align 8, !tbaa !9
  br label %.preheader67

.preheader67:                                     ; preds = %.lr.ph, %.lr.ph123
  %sum.promoted71 = phi i64 [ %34, %.lr.ph ], [ 0, %.lr.ph123 ]
  %35 = icmp sgt i32 %.pre, 1
  br i1 %35, label %.lr.ph73, label %.preheader66

.lr.ph73:                                         ; preds = %.preheader67
  %36 = sext i32 %5 to i64
  %37 = zext nneg i32 %.pre to i64
  %38 = shl nuw nsw i64 %37, 2
  %39 = add nsw i64 %38, -8
  %40 = add nsw i32 %.pre, -2
  %41 = zext nneg i32 %40 to i64
  %42 = mul nuw i64 %39, %41
  %43 = add i64 %42, -2
  %44 = shl nuw nsw i64 %37, 1
  %45 = add nsw i64 %44, -10
  %46 = zext nneg i32 %40 to i65
  %47 = add nsw i32 %.pre, -3
  %48 = zext i32 %47 to i65
  %49 = mul nuw nsw i65 %46, %48
  %50 = lshr i65 %49, 1
  %51 = trunc nuw nsw i65 %50 to i64
  %52 = mul i64 %45, %51
  %53 = add i64 %43, %52
  %54 = add nsw i32 %.pre, -4
  %55 = zext i32 %54 to i65
  %56 = mul i65 %49, %55
  %57 = lshr i65 %56, 1
  %58 = trunc nuw i65 %57 to i64
  %59 = mul i64 %58, 6148914691236517204
  %60 = add i64 %53, %59
  %61 = add i64 %60, %44
  %62 = mul nsw i64 %36, %36
  %63 = mul i64 %61, %62
  %64 = add i64 %sum.promoted71, %63
  store i64 %64, ptr @sum, align 8, !tbaa !9
  br label %.preheader66

.preheader66:                                     ; preds = %.lr.ph73, %.preheader67
  %sum.promoted105171 = phi i64 [ %64, %.lr.ph73 ], [ %sum.promoted71, %.preheader67 ]
  %.not5796 = icmp slt i32 %5, 1
  br i1 %.not5796, label %.preheader65, label %.lr.ph99

.preheader65.loopexit:                            ; preds = %._crit_edge
  %sum.promoted105.pre = load i64, ptr @sum, align 8, !tbaa !9
  br label %.preheader65

.preheader65:                                     ; preds = %.preheader65.loopexit, %.preheader66
  %sum.promoted105 = phi i64 [ %sum.promoted105.pre, %.preheader65.loopexit ], [ %sum.promoted105171, %.preheader66 ]
  %65 = load i32, ptr @tot, align 4, !tbaa !5
  %66 = icmp sgt i32 %65, 0
  br i1 %66, label %.lr.ph110.preheader, label %._crit_edge111

.lr.ph110.preheader:                              ; preds = %.preheader65
  %67 = zext nneg i32 %65 to i64
  %wide.trip.count155 = zext nneg i32 %65 to i64
  br label %.lr.ph110

.lr.ph99:                                         ; preds = %.preheader66, %._crit_edge
  %indvars.iv142 = phi i64 [ %indvars.iv.next143, %._crit_edge ], [ 1, %.preheader66 ]
  %68 = getelementptr inbounds [1001 x [1002 x i8]], ptr @str, i64 0, i64 %indvars.iv142, i64 1
  %69 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %68)
  %70 = load i32, ptr @m, align 4, !tbaa !5
  %.not6091 = icmp slt i32 %70, 1
  %.pre169 = load i32, ptr @n, align 4
  %.fr = freeze i32 %.pre169
  br i1 %.not6091, label %._crit_edge, label %.lr.ph95

.lr.ph95:                                         ; preds = %.lr.ph99
  %sum.promoted86 = load i64, ptr @sum, align 8, !tbaa !9
  %tot.promoted = load i32, ptr @tot, align 4, !tbaa !5
  %.not6176 = icmp slt i32 %.fr, 1
  %71 = shl nuw i32 %70, 1
  %72 = shl i32 %.fr, 1
  %73 = add nuw i32 %70, 1
  %wide.trip.count140 = zext i32 %73 to i64
  %74 = trunc nuw nsw i64 %indvars.iv142 to i32
  br i1 %.not6176, label %.lr.ph95.split.us.preheader, label %.lr.ph95.split.preheader

.lr.ph95.split.preheader:                         ; preds = %.lr.ph95
  %min.iters.check233 = icmp ult i32 %.fr, 4
  %n.vec236 = and i32 %.fr, 2147483644
  %ind.end237 = or disjoint i32 %n.vec236, 1
  %broadcast.splatinsert247 = insertelement <2 x i32> poison, i32 %74, i64 0
  %broadcast.splat248 = shufflevector <2 x i32> %broadcast.splatinsert247, <2 x i32> poison, <2 x i32> zeroinitializer
  %broadcast.splatinsert249 = insertelement <2 x i32> poison, i32 %71, i64 0
  %broadcast.splat250 = shufflevector <2 x i32> %broadcast.splatinsert249, <2 x i32> poison, <2 x i32> zeroinitializer
  %cmp.n253 = icmp eq i32 %.fr, %n.vec236
  %min.iters.check209 = icmp ult i32 %70, 4
  %n.vec212 = and i32 %70, 2147483644
  %ind.end213 = or disjoint i32 %n.vec212, 1
  %broadcast.splatinsert225 = insertelement <2 x i32> poison, i32 %72, i64 0
  %broadcast.splat226 = shufflevector <2 x i32> %broadcast.splatinsert225, <2 x i32> poison, <2 x i32> zeroinitializer
  %cmp.n229 = icmp eq i32 %70, %n.vec212
  br label %.lr.ph95.split

.lr.ph95.split.us.preheader:                      ; preds = %.lr.ph95
  %min.iters.check188 = icmp ult i32 %70, 4
  %n.vec191 = and i32 %70, 2147483644
  %ind.end192 = or disjoint i32 %n.vec191, 1
  %broadcast.splatinsert201 = insertelement <2 x i32> poison, i32 %72, i64 0
  %broadcast.splat202 = shufflevector <2 x i32> %broadcast.splatinsert201, <2 x i32> poison, <2 x i32> zeroinitializer
  %cmp.n205 = icmp eq i32 %70, %n.vec191
  br label %.lr.ph95.split.us

.lr.ph95.split.us:                                ; preds = %.lr.ph95.split.us.preheader, %104
  %indvars.iv137 = phi i64 [ %indvars.iv.next138, %104 ], [ 1, %.lr.ph95.split.us.preheader ]
  %75 = phi i32 [ %105, %104 ], [ %tot.promoted, %.lr.ph95.split.us.preheader ]
  %.lcssa858792.us = phi i64 [ %.lcssa8588.us, %104 ], [ %sum.promoted86, %.lr.ph95.split.us.preheader ]
  %76 = getelementptr inbounds [1001 x [1002 x i8]], ptr @str, i64 0, i64 %indvars.iv142, i64 %indvars.iv137
  %77 = load i8, ptr %76, align 1, !tbaa !11
  %78 = icmp eq i8 %77, 71
  br i1 %78, label %.preheader.us, label %104

.preheader.us:                                    ; preds = %.lr.ph95.split.us
  %79 = sext i32 %75 to i64
  %80 = getelementptr inbounds [1001 x i32], ptr @quex, i64 0, i64 %79
  store i32 %74, ptr %80, align 4, !tbaa !5
  %81 = add nsw i32 %75, 1
  store i32 %81, ptr @tot, align 4, !tbaa !5
  %82 = getelementptr inbounds [1001 x i32], ptr @quey, i64 0, i64 %79
  %83 = trunc nuw nsw i64 %indvars.iv137 to i32
  store i32 %83, ptr %82, align 4, !tbaa !5
  br i1 %min.iters.check188, label %scalar.ph187.preheader, label %vector.ph189

vector.ph189:                                     ; preds = %.preheader.us
  %84 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %.lcssa858792.us, i64 0
  %broadcast.splatinsert199 = insertelement <2 x i32> poison, i32 %83, i64 0
  %broadcast.splat200 = shufflevector <2 x i32> %broadcast.splatinsert199, <2 x i32> poison, <2 x i32> zeroinitializer
  br label %vector.body194

vector.body194:                                   ; preds = %vector.body194, %vector.ph189
  %index195 = phi i32 [ 0, %vector.ph189 ], [ %index.next203, %vector.body194 ]
  %vec.ind = phi <2 x i32> [ <i32 1, i32 2>, %vector.ph189 ], [ %vec.ind.next, %vector.body194 ]
  %vec.phi197 = phi <2 x i64> [ %84, %vector.ph189 ], [ %93, %vector.body194 ]
  %vec.phi198 = phi <2 x i64> [ zeroinitializer, %vector.ph189 ], [ %94, %vector.body194 ]
  %step.add = add <2 x i32> %vec.ind, <i32 2, i32 2>
  %85 = sub nsw <2 x i32> %broadcast.splat200, %vec.ind
  %86 = sub nsw <2 x i32> %broadcast.splat200, %step.add
  %87 = tail call <2 x i32> @llvm.abs.v2i32(<2 x i32> %85, i1 true)
  %88 = tail call <2 x i32> @llvm.abs.v2i32(<2 x i32> %86, i1 true)
  %89 = mul <2 x i32> %broadcast.splat202, %87
  %90 = mul <2 x i32> %broadcast.splat202, %88
  %91 = sext <2 x i32> %89 to <2 x i64>
  %92 = sext <2 x i32> %90 to <2 x i64>
  %93 = sub <2 x i64> %vec.phi197, %91
  %94 = sub <2 x i64> %vec.phi198, %92
  %index.next203 = add nuw i32 %index195, 4
  %vec.ind.next = add <2 x i32> %vec.ind, <i32 4, i32 4>
  %95 = icmp eq i32 %index.next203, %n.vec191
  br i1 %95, label %middle.block186, label %vector.body194, !llvm.loop !12

middle.block186:                                  ; preds = %vector.body194
  %bin.rdx204 = add <2 x i64> %94, %93
  %96 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx204)
  br i1 %cmp.n205, label %..loopexit_crit_edge.us, label %scalar.ph187.preheader

scalar.ph187.preheader:                           ; preds = %middle.block186, %.preheader.us
  %.04983.us.ph = phi i32 [ 1, %.preheader.us ], [ %ind.end192, %middle.block186 ]
  %.ph = phi i64 [ %.lcssa858792.us, %.preheader.us ], [ %96, %middle.block186 ]
  br label %scalar.ph187

scalar.ph187:                                     ; preds = %scalar.ph187.preheader, %scalar.ph187
  %.04983.us = phi i32 [ %103, %scalar.ph187 ], [ %.04983.us.ph, %scalar.ph187.preheader ]
  %97 = phi i64 [ %102, %scalar.ph187 ], [ %.ph, %scalar.ph187.preheader ]
  %98 = sub nsw i32 %83, %.04983.us
  %99 = tail call i32 @llvm.abs.i32(i32 %98, i1 true)
  %100 = mul i32 %72, %99
  %101 = sext i32 %100 to i64
  %102 = sub nsw i64 %97, %101
  %103 = add nuw i32 %.04983.us, 1
  %exitcond136.not = icmp eq i32 %.04983.us, %70
  br i1 %exitcond136.not, label %..loopexit_crit_edge.us, label %scalar.ph187, !llvm.loop !16

104:                                              ; preds = %..loopexit_crit_edge.us, %.lr.ph95.split.us
  %.lcssa8588.us = phi i64 [ %.lcssa178, %..loopexit_crit_edge.us ], [ %.lcssa858792.us, %.lr.ph95.split.us ]
  %105 = phi i32 [ %81, %..loopexit_crit_edge.us ], [ %75, %.lr.ph95.split.us ]
  %indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1
  %exitcond141.not = icmp eq i64 %indvars.iv.next138, %wide.trip.count140
  br i1 %exitcond141.not, label %._crit_edge, label %.lr.ph95.split.us, !llvm.loop !17

..loopexit_crit_edge.us:                          ; preds = %scalar.ph187, %middle.block186
  %.lcssa178 = phi i64 [ %96, %middle.block186 ], [ %102, %scalar.ph187 ]
  store i64 %.lcssa178, ptr @sum, align 8, !tbaa !9
  br label %104

._crit_edge:                                      ; preds = %156, %104, %.lr.ph99
  %indvars.iv.next143 = add nuw nsw i64 %indvars.iv142, 1
  %106 = sext i32 %.fr to i64
  %.not57.not = icmp slt i64 %indvars.iv142, %106
  br i1 %.not57.not, label %.lr.ph99, label %.preheader65.loopexit, !llvm.loop !18

.lr.ph95.split:                                   ; preds = %.lr.ph95.split.preheader, %156
  %indvars.iv = phi i64 [ %indvars.iv.next, %156 ], [ 1, %.lr.ph95.split.preheader ]
  %107 = phi i32 [ %157, %156 ], [ %tot.promoted, %.lr.ph95.split.preheader ]
  %.lcssa858792 = phi i64 [ %.lcssa8588, %156 ], [ %sum.promoted86, %.lr.ph95.split.preheader ]
  %108 = getelementptr inbounds [1001 x [1002 x i8]], ptr @str, i64 0, i64 %indvars.iv142, i64 %indvars.iv
  %109 = load i8, ptr %108, align 1, !tbaa !11
  %110 = icmp eq i8 %109, 71
  br i1 %110, label %.lr.ph78, label %156

.lr.ph78:                                         ; preds = %.lr.ph95.split
  %111 = sext i32 %107 to i64
  %112 = getelementptr inbounds [1001 x i32], ptr @quex, i64 0, i64 %111
  store i32 %74, ptr %112, align 4, !tbaa !5
  %113 = add nsw i32 %107, 1
  store i32 %113, ptr @tot, align 4, !tbaa !5
  %114 = getelementptr inbounds [1001 x i32], ptr @quey, i64 0, i64 %111
  %115 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %115, ptr %114, align 4, !tbaa !5
  br i1 %min.iters.check233, label %scalar.ph232.preheader, label %vector.ph234

vector.ph234:                                     ; preds = %.lr.ph78
  %116 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %.lcssa858792, i64 0
  br label %vector.body239

vector.body239:                                   ; preds = %vector.body239, %vector.ph234
  %index240 = phi i32 [ 0, %vector.ph234 ], [ %index.next251, %vector.body239 ]
  %vec.ind241 = phi <2 x i32> [ <i32 1, i32 2>, %vector.ph234 ], [ %vec.ind.next244, %vector.body239 ]
  %vec.phi245 = phi <2 x i64> [ %116, %vector.ph234 ], [ %125, %vector.body239 ]
  %vec.phi246 = phi <2 x i64> [ zeroinitializer, %vector.ph234 ], [ %126, %vector.body239 ]
  %step.add242 = add <2 x i32> %vec.ind241, <i32 2, i32 2>
  %117 = sub nsw <2 x i32> %broadcast.splat248, %vec.ind241
  %118 = sub nsw <2 x i32> %broadcast.splat248, %step.add242
  %119 = tail call <2 x i32> @llvm.abs.v2i32(<2 x i32> %117, i1 true)
  %120 = tail call <2 x i32> @llvm.abs.v2i32(<2 x i32> %118, i1 true)
  %121 = mul <2 x i32> %broadcast.splat250, %119
  %122 = mul <2 x i32> %broadcast.splat250, %120
  %123 = sext <2 x i32> %121 to <2 x i64>
  %124 = sext <2 x i32> %122 to <2 x i64>
  %125 = sub <2 x i64> %vec.phi245, %123
  %126 = sub <2 x i64> %vec.phi246, %124
  %index.next251 = add nuw i32 %index240, 4
  %vec.ind.next244 = add <2 x i32> %vec.ind241, <i32 4, i32 4>
  %127 = icmp eq i32 %index.next251, %n.vec236
  br i1 %127, label %middle.block231, label %vector.body239, !llvm.loop !19

middle.block231:                                  ; preds = %vector.body239
  %bin.rdx252 = add <2 x i64> %126, %125
  %128 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx252)
  br i1 %cmp.n253, label %..preheader_crit_edge.preheader, label %scalar.ph232.preheader

scalar.ph232.preheader:                           ; preds = %middle.block231, %.lr.ph78
  %.05077.ph = phi i32 [ 1, %.lr.ph78 ], [ %ind.end237, %middle.block231 ]
  %.ph257 = phi i64 [ %.lcssa858792, %.lr.ph78 ], [ %128, %middle.block231 ]
  br label %scalar.ph232

scalar.ph232:                                     ; preds = %scalar.ph232.preheader, %scalar.ph232
  %.05077 = phi i32 [ %135, %scalar.ph232 ], [ %.05077.ph, %scalar.ph232.preheader ]
  %129 = phi i64 [ %134, %scalar.ph232 ], [ %.ph257, %scalar.ph232.preheader ]
  %130 = sub nsw i32 %74, %.05077
  %131 = tail call i32 @llvm.abs.i32(i32 %130, i1 true)
  %132 = mul i32 %71, %131
  %133 = sext i32 %132 to i64
  %134 = sub nsw i64 %129, %133
  %135 = add nuw i32 %.05077, 1
  %exitcond.not = icmp eq i32 %.05077, %.fr
  br i1 %exitcond.not, label %..preheader_crit_edge.preheader, label %scalar.ph232, !llvm.loop !20

..preheader_crit_edge.preheader:                  ; preds = %scalar.ph232, %middle.block231
  %.lcssa = phi i64 [ %128, %middle.block231 ], [ %134, %scalar.ph232 ]
  br i1 %min.iters.check209, label %..preheader_crit_edge.preheader255, label %vector.ph210

vector.ph210:                                     ; preds = %..preheader_crit_edge.preheader
  %136 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %.lcssa, i64 0
  %broadcast.splatinsert223 = insertelement <2 x i32> poison, i32 %115, i64 0
  %broadcast.splat224 = shufflevector <2 x i32> %broadcast.splatinsert223, <2 x i32> poison, <2 x i32> zeroinitializer
  br label %vector.body215

vector.body215:                                   ; preds = %vector.body215, %vector.ph210
  %index216 = phi i32 [ 0, %vector.ph210 ], [ %index.next227, %vector.body215 ]
  %vec.ind217 = phi <2 x i32> [ <i32 1, i32 2>, %vector.ph210 ], [ %vec.ind.next220, %vector.body215 ]
  %vec.phi221 = phi <2 x i64> [ %136, %vector.ph210 ], [ %145, %vector.body215 ]
  %vec.phi222 = phi <2 x i64> [ zeroinitializer, %vector.ph210 ], [ %146, %vector.body215 ]
  %step.add218 = add <2 x i32> %vec.ind217, <i32 2, i32 2>
  %137 = sub nsw <2 x i32> %broadcast.splat224, %vec.ind217
  %138 = sub nsw <2 x i32> %broadcast.splat224, %step.add218
  %139 = tail call <2 x i32> @llvm.abs.v2i32(<2 x i32> %137, i1 true)
  %140 = tail call <2 x i32> @llvm.abs.v2i32(<2 x i32> %138, i1 true)
  %141 = mul <2 x i32> %broadcast.splat226, %139
  %142 = mul <2 x i32> %broadcast.splat226, %140
  %143 = sext <2 x i32> %141 to <2 x i64>
  %144 = sext <2 x i32> %142 to <2 x i64>
  %145 = sub <2 x i64> %vec.phi221, %143
  %146 = sub <2 x i64> %vec.phi222, %144
  %index.next227 = add nuw i32 %index216, 4
  %vec.ind.next220 = add <2 x i32> %vec.ind217, <i32 4, i32 4>
  %147 = icmp eq i32 %index.next227, %n.vec212
  br i1 %147, label %middle.block207, label %vector.body215, !llvm.loop !21

middle.block207:                                  ; preds = %vector.body215
  %bin.rdx228 = add <2 x i64> %146, %145
  %148 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx228)
  br i1 %cmp.n229, label %..loopexit_crit_edge, label %..preheader_crit_edge.preheader255

..preheader_crit_edge.preheader255:               ; preds = %middle.block207, %..preheader_crit_edge.preheader
  %.04983.ph = phi i32 [ 1, %..preheader_crit_edge.preheader ], [ %ind.end213, %middle.block207 ]
  %.ph256 = phi i64 [ %.lcssa, %..preheader_crit_edge.preheader ], [ %148, %middle.block207 ]
  br label %..preheader_crit_edge

..preheader_crit_edge:                            ; preds = %..preheader_crit_edge.preheader255, %..preheader_crit_edge
  %.04983 = phi i32 [ %155, %..preheader_crit_edge ], [ %.04983.ph, %..preheader_crit_edge.preheader255 ]
  %149 = phi i64 [ %154, %..preheader_crit_edge ], [ %.ph256, %..preheader_crit_edge.preheader255 ]
  %150 = sub nsw i32 %115, %.04983
  %151 = tail call i32 @llvm.abs.i32(i32 %150, i1 true)
  %152 = mul i32 %72, %151
  %153 = sext i32 %152 to i64
  %154 = sub nsw i64 %149, %153
  %155 = add nuw i32 %.04983, 1
  %exitcond133.not = icmp eq i32 %.04983, %70
  br i1 %exitcond133.not, label %..loopexit_crit_edge, label %..preheader_crit_edge, !llvm.loop !22

..loopexit_crit_edge:                             ; preds = %..preheader_crit_edge, %middle.block207
  %.lcssa177 = phi i64 [ %148, %middle.block207 ], [ %154, %..preheader_crit_edge ]
  store i64 %.lcssa177, ptr @sum, align 8, !tbaa !9
  br label %156

156:                                              ; preds = %..loopexit_crit_edge, %.lr.ph95.split
  %.lcssa8588 = phi i64 [ %.lcssa177, %..loopexit_crit_edge ], [ %.lcssa858792, %.lr.ph95.split ]
  %157 = phi i32 [ %113, %..loopexit_crit_edge ], [ %107, %.lr.ph95.split ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond135.not = icmp eq i64 %indvars.iv.next, %wide.trip.count140
  br i1 %exitcond135.not, label %._crit_edge, label %.lr.ph95.split, !llvm.loop !17

..loopexit64_crit_edge:                           ; preds = %scalar.ph, %middle.block
  %.lcssa179 = phi i64 [ %191, %middle.block ], [ %204, %scalar.ph ]
  store i64 %.lcssa179, ptr @sum, align 8, !tbaa !9
  br label %.loopexit64

.loopexit64:                                      ; preds = %..loopexit64_crit_edge, %.lr.ph110
  %.lcssa104106 = phi i64 [ %.lcssa179, %..loopexit64_crit_edge ], [ %.lcssa104107108, %.lr.ph110 ]
  %indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1
  %exitcond156.not = icmp eq i64 %indvars.iv.next153, %wide.trip.count155
  br i1 %exitcond156.not, label %._crit_edge111, label %.lr.ph110, !llvm.loop !23

._crit_edge111:                                   ; preds = %.loopexit64, %.preheader65
  tail call void @_Z5solvev()
  %158 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %159 = load i32, ptr %158, align 4, !tbaa !5
  %.not58116 = icmp slt i32 %159, 1
  br i1 %.not58116, label %._crit_edge120, label %.lr.ph119.preheader

.lr.ph119.preheader:                              ; preds = %._crit_edge111
  %160 = add nuw i32 %159, 1
  %161 = zext nneg i32 %159 to i64
  %wide.trip.count166 = zext i32 %160 to i64
  br label %.lr.ph119

.lr.ph110:                                        ; preds = %.lr.ph110.preheader, %.loopexit64
  %indvars.iv152 = phi i64 [ 0, %.lr.ph110.preheader ], [ %indvars.iv.next153, %.loopexit64 ]
  %indvars.iv145 = phi i64 [ 1, %.lr.ph110.preheader ], [ %indvars.iv.next146, %.loopexit64 ]
  %.lcssa104107108 = phi i64 [ %sum.promoted105, %.lr.ph110.preheader ], [ %.lcssa104106, %.loopexit64 ]
  %162 = xor i64 %indvars.iv152, -1
  %163 = add nsw i64 %162, %wide.trip.count155
  %indvars.iv.next153 = add nuw nsw i64 %indvars.iv152, 1
  %164 = icmp ult i64 %indvars.iv.next153, %67
  br i1 %164, label %.lr.ph103, label %.loopexit64

.lr.ph103:                                        ; preds = %.lr.ph110
  %165 = getelementptr inbounds [1001 x i32], ptr @quex, i64 0, i64 %indvars.iv152
  %166 = load i32, ptr %165, align 4, !tbaa !5
  %167 = getelementptr inbounds [1001 x i32], ptr @quey, i64 0, i64 %indvars.iv152
  %168 = load i32, ptr %167, align 4, !tbaa !5
  %min.iters.check = icmp ult i64 %163, 4
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph103
  %n.vec = and i64 %163, -4
  %ind.end = add i64 %indvars.iv145, %n.vec
  %169 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %.lcssa104107108, i64 0
  %broadcast.splatinsert = insertelement <2 x i32> poison, i32 %166, i64 0
  %broadcast.splat = shufflevector <2 x i32> %broadcast.splatinsert, <2 x i32> poison, <2 x i32> zeroinitializer
  %broadcast.splatinsert184 = insertelement <2 x i32> poison, i32 %168, i64 0
  %broadcast.splat185 = shufflevector <2 x i32> %broadcast.splatinsert184, <2 x i32> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ %169, %vector.ph ], [ %188, %vector.body ]
  %vec.phi180 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %189, %vector.body ]
  %offset.idx = add i64 %indvars.iv145, %index
  %170 = getelementptr inbounds [1001 x i32], ptr @quex, i64 0, i64 %offset.idx
  %171 = getelementptr inbounds i8, ptr %170, i64 8
  %wide.load = load <2 x i32>, ptr %170, align 4, !tbaa !5
  %wide.load181 = load <2 x i32>, ptr %171, align 4, !tbaa !5
  %172 = sub nsw <2 x i32> %broadcast.splat, %wide.load
  %173 = sub nsw <2 x i32> %broadcast.splat, %wide.load181
  %174 = tail call <2 x i32> @llvm.abs.v2i32(<2 x i32> %172, i1 true)
  %175 = tail call <2 x i32> @llvm.abs.v2i32(<2 x i32> %173, i1 true)
  %176 = getelementptr inbounds [1001 x i32], ptr @quey, i64 0, i64 %offset.idx
  %177 = getelementptr inbounds i8, ptr %176, i64 8
  %wide.load182 = load <2 x i32>, ptr %176, align 4, !tbaa !5
  %wide.load183 = load <2 x i32>, ptr %177, align 4, !tbaa !5
  %178 = sub nsw <2 x i32> %broadcast.splat185, %wide.load182
  %179 = sub nsw <2 x i32> %broadcast.splat185, %wide.load183
  %180 = tail call <2 x i32> @llvm.abs.v2i32(<2 x i32> %178, i1 true)
  %181 = tail call <2 x i32> @llvm.abs.v2i32(<2 x i32> %179, i1 true)
  %182 = add nuw nsw <2 x i32> %180, %174
  %183 = add nuw nsw <2 x i32> %181, %175
  %184 = shl nuw <2 x i32> %182, <i32 1, i32 1>
  %185 = shl nuw <2 x i32> %183, <i32 1, i32 1>
  %186 = sext <2 x i32> %184 to <2 x i64>
  %187 = sext <2 x i32> %185 to <2 x i64>
  %188 = add <2 x i64> %vec.phi, %186
  %189 = add <2 x i64> %vec.phi180, %187
  %index.next = add nuw i64 %index, 4
  %190 = icmp eq i64 %index.next, %n.vec
  br i1 %190, label %middle.block, label %vector.body, !llvm.loop !24

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %189, %188
  %191 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %163, %n.vec
  br i1 %cmp.n, label %..loopexit64_crit_edge, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph103
  %indvars.iv147.ph = phi i64 [ %indvars.iv145, %.lr.ph103 ], [ %ind.end, %middle.block ]
  %.ph258 = phi i64 [ %.lcssa104107108, %.lr.ph103 ], [ %191, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv147 = phi i64 [ %indvars.iv.next148, %scalar.ph ], [ %indvars.iv147.ph, %scalar.ph.preheader ]
  %192 = phi i64 [ %204, %scalar.ph ], [ %.ph258, %scalar.ph.preheader ]
  %193 = getelementptr inbounds [1001 x i32], ptr @quex, i64 0, i64 %indvars.iv147
  %194 = load i32, ptr %193, align 4, !tbaa !5
  %195 = sub nsw i32 %166, %194
  %196 = tail call i32 @llvm.abs.i32(i32 %195, i1 true)
  %197 = getelementptr inbounds [1001 x i32], ptr @quey, i64 0, i64 %indvars.iv147
  %198 = load i32, ptr %197, align 4, !tbaa !5
  %199 = sub nsw i32 %168, %198
  %200 = tail call i32 @llvm.abs.i32(i32 %199, i1 true)
  %201 = add nuw nsw i32 %200, %196
  %202 = shl nuw i32 %201, 1
  %203 = sext i32 %202 to i64
  %204 = add nsw i64 %192, %203
  %indvars.iv.next148 = add nuw nsw i64 %indvars.iv147, 1
  %exitcond151.not = icmp eq i64 %indvars.iv.next148, %wide.trip.count155
  br i1 %exitcond151.not, label %..loopexit64_crit_edge, label %scalar.ph, !llvm.loop !25

.loopexit63:                                      ; preds = %.lr.ph115, %.lr.ph119
  %indvars.iv.next158 = add nuw nsw i64 %indvars.iv157, 1
  %exitcond167.not = icmp eq i64 %indvars.iv.next164, %wide.trip.count166
  br i1 %exitcond167.not, label %._crit_edge120, label %.lr.ph119, !llvm.loop !26

._crit_edge120:                                   ; preds = %.loopexit63, %._crit_edge111
  tail call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) @m) #6
  tail call void @_Z5solvev()
  %205 = load i64, ptr @sum, align 8, !tbaa !9
  %206 = sitofp i64 %205 to double
  %207 = load i32, ptr @n, align 4, !tbaa !5
  %208 = load i32, ptr @m, align 4, !tbaa !5
  %209 = mul nsw i32 %208, %207
  %210 = load i32, ptr @tot, align 4, !tbaa !5
  %211 = sub nsw i32 %209, %210
  %212 = sext i32 %211 to i64
  %213 = mul nsw i64 %212, %212
  %214 = uitofp nneg i64 %213 to double
  %215 = fdiv double %206, %214
  %216 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %215)
  %217 = load i32, ptr @t, align 4, !tbaa !5
  %218 = add nsw i32 %217, -1
  store i32 %218, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %217, 0
  br i1 %.not, label %._crit_edge124, label %.lr.ph123, !llvm.loop !27

.lr.ph119:                                        ; preds = %.lr.ph119.preheader, %.loopexit63
  %indvars.iv163 = phi i64 [ 1, %.lr.ph119.preheader ], [ %indvars.iv.next164, %.loopexit63 ]
  %indvars.iv157 = phi i64 [ 2, %.lr.ph119.preheader ], [ %indvars.iv.next158, %.loopexit63 ]
  %indvars.iv.next164 = add nuw nsw i64 %indvars.iv163, 1
  %.not59112.not = icmp ult i64 %indvars.iv163, %161
  br i1 %.not59112.not, label %.lr.ph115, label %.loopexit63

.lr.ph115:                                        ; preds = %.lr.ph119, %.lr.ph115
  %indvars.iv159 = phi i64 [ %indvars.iv.next160, %.lr.ph115 ], [ %indvars.iv157, %.lr.ph119 ]
  %219 = getelementptr inbounds [1001 x [1002 x i8]], ptr @str, i64 0, i64 %indvars.iv163, i64 %indvars.iv159
  %220 = getelementptr inbounds [1001 x [1002 x i8]], ptr @str, i64 0, i64 %indvars.iv159, i64 %indvars.iv163
  tail call void @_ZSt4swapIcENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 1 dereferenceable(1) %219, ptr noundef nonnull align 1 dereferenceable(1) %220) #6
  %indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next160 to i32
  %exitcond162.not = icmp eq i32 %160, %lftr.wideiv
  br i1 %exitcond162.not, label %.loopexit63, label %.lr.ph115, !llvm.loop !28

._crit_edge124:                                   ; preds = %._crit_edge120, %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 speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIcENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #4

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

; 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 <2 x i32> @llvm.abs.v2i32(<2 x i32>, i1 immarg) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #5

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 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 #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 speculatable willreturn memory(none) }
attributes #4 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13, !14, !15}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !13, !15, !14}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !13, !14, !15}
!20 = distinct !{!20, !13, !15, !14}
!21 = distinct !{!21, !13, !14, !15}
!22 = distinct !{!22, !13, !15, !14}
!23 = distinct !{!23, !13}
!24 = distinct !{!24, !13, !14, !15}
!25 = distinct !{!25, !13, !15, !14}
!26 = distinct !{!26, !13}
!27 = distinct !{!27, !13}
!28 = distinct !{!28, !13}


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