; LLVM IR from tangjz/acm-icpc :: 51nod (1857)

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

@s = external dso_local global [403 x i8], align 16
@t = external dso_local global [403 x i8], align 16
@n = external dso_local global i32, align 4
@e = external dso_local global [403 x [403 x i32]], align 16
@m = external dso_local global i32, align 4
@ord = external dso_local global [403 x i32], align 16
@match = external dso_local global [403 x i32], align 16
@tot = external dso_local global i32, align 4
@que = external dso_local global [403 x i32], align 16
@perm = external dso_local global [403 x i32], align 16
@dis = external dso_local global [403 x i64], align 16
@inq = external dso_local global [403 x i8], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z7augmenti(i32 noundef) #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z7rebuildiPi(i32 noundef, ptr noundef) #1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4calcv() #3

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %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 i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i8, align 1
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @s, ptr noundef @t)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %58, %0
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = icmp sle i32 %20, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %61

24:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %4, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %54, %24
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = icmp sle i32 %28, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %57

32:                                               ; preds = %27
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [403 x [403 x i32]], ptr @e, i64 0, i64 %34
  %36 = getelementptr inbounds [403 x i32], ptr %35, i64 0, i64 0
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds i32, ptr %36, i64 %38
  %40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %39)
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [403 x [403 x i32]], ptr @e, i64 0, i64 %42
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [403 x i32], ptr %43, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [403 x [403 x i32]], ptr @e, i64 0, i64 %49
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [403 x i32], ptr %50, i64 0, i64 %52
  store i32 %47, ptr %53, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %32
  %55 = load i32, ptr %4, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %4, align 4, !tbaa !5
  br label %27, !llvm.loop !9

57:                                               ; preds = %31
  br label %58

58:                                               ; preds = %57
  %59 = load i32, ptr %2, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %2, align 4, !tbaa !5
  br label %19, !llvm.loop !11

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

62:                                               ; preds = %117, %61
  %63 = load i32, ptr %5, align 4, !tbaa !5
  %64 = load i32, ptr @n, align 4, !tbaa !5
  %65 = icmp sle i32 %63, %64
  br i1 %65, label %67, label %66

66:                                               ; preds = %62
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  br label %120

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

68:                                               ; preds = %113, %67
  %69 = load i32, ptr %6, align 4, !tbaa !5
  %70 = load i32, ptr @n, align 4, !tbaa !5
  %71 = icmp sle i32 %69, %70
  br i1 %71, label %73, label %72

72:                                               ; preds = %68
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  br label %116

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

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

78:                                               ; preds = %74
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %112

79:                                               ; preds = %74
  %80 = load i32, ptr %6, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [403 x [403 x i32]], ptr @e, i64 0, i64 %81
  %83 = load i32, ptr %7, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [403 x i32], ptr %82, i64 0, i64 %84
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  %86 = load i32, ptr %6, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [403 x [403 x i32]], ptr @e, i64 0, i64 %87
  %89 = load i32, ptr %5, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [403 x i32], ptr %88, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = load i32, ptr %5, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [403 x [403 x i32]], ptr @e, i64 0, i64 %94
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [403 x i32], ptr %95, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = add nsw i32 %92, %99
  store i32 %100, ptr %8, align 4, !tbaa !5
  %101 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %85, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = load i32, ptr %6, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [403 x [403 x i32]], ptr @e, i64 0, i64 %104
  %106 = load i32, ptr %7, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [403 x i32], ptr %105, i64 0, i64 %107
  store i32 %102, ptr %108, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %109

109:                                              ; preds = %79
  %110 = load i32, ptr %7, align 4, !tbaa !5
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %7, align 4, !tbaa !5
  br label %74, !llvm.loop !12

112:                                              ; preds = %78
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %6, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %6, align 4, !tbaa !5
  br label %68, !llvm.loop !13

116:                                              ; preds = %72
  br label %117

117:                                              ; preds = %116
  %118 = load i32, ptr %5, align 4, !tbaa !5
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %5, align 4, !tbaa !5
  br label %62, !llvm.loop !14

120:                                              ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %181, %120
  %122 = load i32, ptr %9, align 4, !tbaa !5
  %123 = load i32, ptr @n, align 4, !tbaa !5
  %124 = icmp slt i32 %122, %123
  br i1 %124, label %126, label %125

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

126:                                              ; preds = %121
  %127 = load i32, ptr %9, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [403 x i8], ptr @s, i64 0, i64 %128
  %130 = load i8, ptr %129, align 1, !tbaa !15
  %131 = sext i8 %130 to i32
  %132 = load i32, ptr %9, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [403 x i8], ptr @t, i64 0, i64 %133
  %135 = load i8, ptr %134, align 1, !tbaa !15
  %136 = sext i8 %135 to i32
  %137 = icmp ne i32 %131, %136
  br i1 %137, label %138, label %180

138:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  %139 = load i32, ptr %9, align 4, !tbaa !5
  %140 = load i32, ptr @m, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr @m, align 4, !tbaa !5
  %142 = sext i32 %140 to i64
  %143 = getelementptr inbounds [403 x i32], ptr @ord, i64 0, i64 %142
  store i32 %139, ptr %143, align 4, !tbaa !5
  store i32 %139, ptr %10, align 4, !tbaa !5
  br label %144

144:                                              ; preds = %163, %138
  %145 = load i32, ptr %9, align 4, !tbaa !5
  %146 = load i32, ptr @n, align 4, !tbaa !5
  %147 = icmp slt i32 %145, %146
  br i1 %147, label %148, label %160

148:                                              ; preds = %144
  %149 = load i32, ptr %9, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [403 x i8], ptr @s, i64 0, i64 %150
  %152 = load i8, ptr %151, align 1, !tbaa !15
  %153 = sext i8 %152 to i32
  %154 = load i32, ptr %9, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [403 x i8], ptr @t, i64 0, i64 %155
  %157 = load i8, ptr %156, align 1, !tbaa !15
  %158 = sext i8 %157 to i32
  %159 = icmp ne i32 %153, %158
  br label %160

160:                                              ; preds = %148, %144
  %161 = phi i1 [ false, %144 ], [ %159, %148 ]
  br i1 %161, label %162, label %166

162:                                              ; preds = %160
  br label %163

163:                                              ; preds = %162
  %164 = load i32, ptr %9, align 4, !tbaa !5
  %165 = add nsw i32 %164, 1
  store i32 %165, ptr %9, align 4, !tbaa !5
  br label %144, !llvm.loop !16

166:                                              ; preds = %160
  %167 = load i32, ptr %9, align 4, !tbaa !5
  %168 = load i32, ptr @m, align 4, !tbaa !5
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr @m, align 4, !tbaa !5
  %170 = sext i32 %168 to i64
  %171 = getelementptr inbounds [403 x i32], ptr @ord, i64 0, i64 %170
  store i32 %167, ptr %171, align 4, !tbaa !5
  %172 = load i32, ptr %10, align 4, !tbaa !5
  %173 = load i32, ptr %9, align 4, !tbaa !5
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [403 x i32], ptr @match, i64 0, i64 %174
  store i32 %172, ptr %175, align 4, !tbaa !5
  %176 = load i32, ptr %9, align 4, !tbaa !5
  %177 = load i32, ptr %10, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [403 x i32], ptr @match, i64 0, i64 %178
  store i32 %176, ptr %179, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %180

180:                                              ; preds = %166, %126
  br label %181

181:                                              ; preds = %180
  %182 = load i32, ptr %9, align 4, !tbaa !5
  %183 = add nsw i32 %182, 1
  store i32 %183, ptr %9, align 4, !tbaa !5
  br label %121, !llvm.loop !17

184:                                              ; preds = %125
  %185 = call i64 @time(ptr noundef null) #8
  %186 = trunc i64 %185 to i32
  call void @srand(i32 noundef %186) #8
  %187 = load i32, ptr @m, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = mul i64 %188, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 @perm, ptr align 16 @ord, i64 %189, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  store i64 9223372036854775807, ptr %11, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  br label %190

190:                                              ; preds = %288, %184
  %191 = call noundef i64 @_Z4calcv()
  store i64 %191, ptr %12, align 8, !tbaa !18
  %192 = load i64, ptr %11, align 8, !tbaa !18
  %193 = icmp slt i64 %191, %192
  br i1 %193, label %195, label %194

194:                                              ; preds = %190
  store i32 23, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  br label %290

195:                                              ; preds = %190
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #8
  store i8 1, ptr %13, align 1, !tbaa !20
  br label %196

196:                                              ; preds = %285, %195
  %197 = load i8, ptr %13, align 1, !tbaa !20, !range !22, !noundef !23
  %198 = trunc i8 %197 to i1
  br i1 %198, label %199, label %286

199:                                              ; preds = %196
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %200

200:                                              ; preds = %216, %199
  %201 = load i32, ptr %14, align 4, !tbaa !5
  %202 = load i32, ptr @m, align 4, !tbaa !5
  %203 = icmp slt i32 %201, %202
  br i1 %203, label %205, label %204

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

205:                                              ; preds = %200
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  %206 = load i32, ptr %14, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [403 x i32], ptr @ord, i64 0, i64 %207
  %209 = load i32, ptr %208, align 4, !tbaa !5
  store i32 %209, ptr %15, align 4, !tbaa !5
  %210 = load i32, ptr %15, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [403 x i8], ptr @inq, i64 0, i64 %211
  store i8 0, ptr %212, align 1, !tbaa !20
  %213 = load i32, ptr %15, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [403 x i64], ptr @dis, i64 0, i64 %214
  store i64 0, ptr %215, align 8, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  br label %216

216:                                              ; preds = %205
  %217 = load i32, ptr %14, align 4, !tbaa !5
  %218 = add nsw i32 %217, 1
  store i32 %218, ptr %14, align 4, !tbaa !5
  br label %200, !llvm.loop !24

219:                                              ; preds = %204
  store i8 0, ptr %13, align 1, !tbaa !20
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %220

220:                                              ; preds = %281, %219
  %221 = load i32, ptr %16, align 4, !tbaa !5
  %222 = load i32, ptr @m, align 4, !tbaa !5
  %223 = icmp slt i32 %221, %222
  br i1 %223, label %225, label %224

224:                                              ; preds = %220
  store i32 31, ptr %3, align 4
  br label %284

225:                                              ; preds = %220
  %226 = load i32, ptr %16, align 4, !tbaa !5
  %227 = sext i32 %226 to i64
  %228 = getelementptr inbounds [403 x i32], ptr @ord, i64 0, i64 %227
  %229 = load i32, ptr %228, align 4, !tbaa !5
  %230 = call noundef zeroext i1 @_Z7augmenti(i32 noundef %229)
  br i1 %230, label %231, label %280

231:                                              ; preds = %225
  store i8 1, ptr %13, align 1, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %232

232:                                              ; preds = %244, %231
  %233 = load i32, ptr %17, align 4, !tbaa !5
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [403 x i32], ptr @que, i64 0, i64 %234
  %236 = load i32, ptr %235, align 4, !tbaa !5
  %237 = load i32, ptr @tot, align 4, !tbaa !5
  %238 = sub nsw i32 %237, 1
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds [403 x i32], ptr @que, i64 0, i64 %239
  %241 = load i32, ptr %240, align 4, !tbaa !5
  %242 = icmp ne i32 %236, %241
  br i1 %242, label %243, label %247

243:                                              ; preds = %232
  br label %244

244:                                              ; preds = %243
  %245 = load i32, ptr %17, align 4, !tbaa !5
  %246 = add nsw i32 %245, 1
  store i32 %246, ptr %17, align 4, !tbaa !5
  br label %232, !llvm.loop !25

247:                                              ; preds = %232
  br label %248

248:                                              ; preds = %276, %247
  %249 = load i32, ptr %17, align 4, !tbaa !5
  %250 = add nsw i32 %249, 1
  %251 = load i32, ptr @tot, align 4, !tbaa !5
  %252 = icmp slt i32 %250, %251
  br i1 %252, label %253, label %279

253:                                              ; preds = %248
  %254 = load i32, ptr %17, align 4, !tbaa !5
  %255 = add nsw i32 %254, 1
  %256 = sext i32 %255 to i64
  %257 = getelementptr inbounds [403 x i32], ptr @que, i64 0, i64 %256
  %258 = load i32, ptr %257, align 4, !tbaa !5
  %259 = load i32, ptr %17, align 4, !tbaa !5
  %260 = sext i32 %259 to i64
  %261 = getelementptr inbounds [403 x i32], ptr @que, i64 0, i64 %260
  %262 = load i32, ptr %261, align 4, !tbaa !5
  %263 = sext i32 %262 to i64
  %264 = getelementptr inbounds [403 x i32], ptr @match, i64 0, i64 %263
  store i32 %258, ptr %264, align 4, !tbaa !5
  %265 = load i32, ptr %17, align 4, !tbaa !5
  %266 = sext i32 %265 to i64
  %267 = getelementptr inbounds [403 x i32], ptr @que, i64 0, i64 %266
  %268 = load i32, ptr %267, align 4, !tbaa !5
  %269 = load i32, ptr %17, align 4, !tbaa !5
  %270 = add nsw i32 %269, 1
  %271 = sext i32 %270 to i64
  %272 = getelementptr inbounds [403 x i32], ptr @que, i64 0, i64 %271
  %273 = load i32, ptr %272, align 4, !tbaa !5
  %274 = sext i32 %273 to i64
  %275 = getelementptr inbounds [403 x i32], ptr @match, i64 0, i64 %274
  store i32 %268, ptr %275, align 4, !tbaa !5
  br label %276

276:                                              ; preds = %253
  %277 = load i32, ptr %17, align 4, !tbaa !5
  %278 = add nsw i32 %277, 2
  store i32 %278, ptr %17, align 4, !tbaa !5
  br label %248, !llvm.loop !26

279:                                              ; preds = %248
  store i32 31, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  br label %284

280:                                              ; preds = %225
  br label %281

281:                                              ; preds = %280
  %282 = load i32, ptr %16, align 4, !tbaa !5
  %283 = add nsw i32 %282, 1
  store i32 %283, ptr %16, align 4, !tbaa !5
  br label %220, !llvm.loop !27

284:                                              ; preds = %279, %224
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %285

285:                                              ; preds = %284
  br label %196, !llvm.loop !28

286:                                              ; preds = %196
  %287 = load i32, ptr @m, align 4, !tbaa !5
  call void @_Z7rebuildiPi(i32 noundef %287, ptr noundef @ord)
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #8
  br label %288

288:                                              ; preds = %286
  %289 = load i64, ptr %12, align 8, !tbaa !18
  store i64 %289, ptr %11, align 8, !tbaa !18
  br label %190, !llvm.loop !29

290:                                              ; preds = %194
  %291 = call noundef i64 @_Z4calcv()
  %292 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %291)
  ret i32 0
}

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

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

; Function Attrs: nounwind
declare void @srand(i32 noundef) #6

; Function Attrs: nounwind
declare i64 @time(ptr noundef) #6

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

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

attributes #0 = { 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 #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { "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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = !{!19, !19, i64 0}
!19 = !{!"long long", !7, i64 0}
!20 = !{!21, !21, i64 0}
!21 = !{!"bool", !7, i64 0}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10}
!28 = distinct !{!28, !10}
!29 = distinct !{!29, !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"

@s = external dso_local global [403 x i8], align 16
@t = external dso_local global [403 x i8], align 16
@n = external dso_local global i32, align 4
@e = external dso_local global [403 x [403 x i32]], align 16
@m = external dso_local local_unnamed_addr global i32, align 4
@ord = external dso_local global [403 x i32], align 16
@match = external dso_local local_unnamed_addr global [403 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@que = external dso_local local_unnamed_addr global [403 x i32], align 16
@perm = external dso_local local_unnamed_addr global [403 x i32], align 16
@dis = external dso_local local_unnamed_addr global [403 x i64], align 16
@inq = external dso_local local_unnamed_addr global [403 x i8], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z7augmenti(i32 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z7rebuildiPi(i32 noundef, ptr noundef) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4calcv() local_unnamed_addr #3

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca i32, align 4
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @s, ptr noundef nonnull @t)
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %.not91 = icmp slt i32 %3, 0
  br i1 %.not91, label %._crit_edge110, label %.lr.ph93

.loopexit.loopexit:                               ; preds = %8
  %.pre155 = sext i32 %14 to i64
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %.lr.ph93
  %.pre-phi156 = phi i64 [ %.pre155, %.loopexit.loopexit ], [ %6, %.lr.ph93 ]
  %4 = phi i32 [ %14, %.loopexit.loopexit ], [ %5, %.lr.ph93 ]
  %.not.not = icmp slt i64 %indvars.iv127, %.pre-phi156
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  br i1 %.not.not, label %.lr.ph93, label %.preheader87, !llvm.loop !9

.preheader87:                                     ; preds = %.loopexit
  %.not72100 = icmp slt i32 %4, 0
  br i1 %.not72100, label %._crit_edge110, label %.preheader86

.lr.ph93:                                         ; preds = %0, %.loopexit
  %5 = phi i32 [ %4, %.loopexit ], [ %3, %0 ]
  %indvars.iv127 = phi i64 [ %indvars.iv.next128, %.loopexit ], [ 0, %0 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %.loopexit ], [ 1, %0 ]
  %indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1
  %6 = sext i32 %5 to i64
  %.not7889.not = icmp slt i64 %indvars.iv127, %6
  br i1 %.not7889.not, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.lr.ph93
  %7 = getelementptr inbounds [403 x [403 x i32]], ptr @e, i64 0, i64 %indvars.iv127
  br label %8

8:                                                ; preds = %.lr.ph, %8
  %indvars.iv124 = phi i64 [ %indvars.iv, %.lr.ph ], [ %indvars.iv.next125, %8 ]
  %9 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv124
  %10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %9)
  %11 = getelementptr inbounds [403 x [403 x i32]], ptr @e, i64 0, i64 %indvars.iv127, i64 %indvars.iv124
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %13 = getelementptr inbounds [403 x [403 x i32]], ptr @e, i64 0, i64 %indvars.iv124, i64 %indvars.iv127
  store i32 %12, ptr %13, align 4, !tbaa !5
  %indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = trunc nuw i64 %indvars.iv124 to i32
  %.not78.not = icmp sgt i32 %14, %15
  br i1 %.not78.not, label %8, label %.loopexit.loopexit, !llvm.loop !11

.preheader86:                                     ; preds = %.preheader87, %._crit_edge99
  %16 = phi i32 [ %22, %._crit_edge99 ], [ %4, %.preheader87 ]
  %indvars.iv136 = phi i64 [ %indvars.iv.next137, %._crit_edge99 ], [ 0, %.preheader87 ]
  %.not7697 = icmp slt i32 %16, 0
  br i1 %.not7697, label %._crit_edge99, label %.preheader85

.preheader84:                                     ; preds = %._crit_edge99
  %17 = icmp sgt i32 %22, 0
  br i1 %17, label %.lr.ph109.preheader, label %._crit_edge110

.lr.ph109.preheader:                              ; preds = %.preheader84
  %m.promoted = load i32, ptr @m, align 4, !tbaa !5
  %18 = zext nneg i32 %22 to i64
  br label %.lr.ph109

.preheader85:                                     ; preds = %.preheader86, %._crit_edge
  %19 = phi i32 [ %24, %._crit_edge ], [ %16, %.preheader86 ]
  %20 = phi i32 [ %25, %._crit_edge ], [ %16, %.preheader86 ]
  %indvars.iv133 = phi i64 [ %indvars.iv.next134, %._crit_edge ], [ 0, %.preheader86 ]
  %.not7794 = icmp slt i32 %20, 0
  br i1 %.not7794, label %.preheader85.._crit_edge_crit_edge, label %.lr.ph96

.preheader85.._crit_edge_crit_edge:               ; preds = %.preheader85
  %.pre157 = sext i32 %20 to i64
  br label %._crit_edge

.lr.ph96:                                         ; preds = %.preheader85
  %21 = getelementptr inbounds [403 x [403 x i32]], ptr @e, i64 0, i64 %indvars.iv133, i64 %indvars.iv136
  br label %26

._crit_edge99:                                    ; preds = %._crit_edge, %.preheader86
  %22 = phi i32 [ %16, %.preheader86 ], [ %24, %._crit_edge ]
  %indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
  %23 = sext i32 %22 to i64
  %.not72.not = icmp slt i64 %indvars.iv136, %23
  br i1 %.not72.not, label %.preheader86, label %.preheader84, !llvm.loop !12

._crit_edge:                                      ; preds = %26, %.preheader85.._crit_edge_crit_edge
  %.pre-phi158 = phi i64 [ %.pre157, %.preheader85.._crit_edge_crit_edge ], [ %35, %26 ]
  %24 = phi i32 [ %19, %.preheader85.._crit_edge_crit_edge ], [ %34, %26 ]
  %25 = phi i32 [ %20, %.preheader85.._crit_edge_crit_edge ], [ %34, %26 ]
  %indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1
  %.not76.not = icmp slt i64 %indvars.iv133, %.pre-phi158
  br i1 %.not76.not, label %.preheader85, label %._crit_edge99, !llvm.loop !14

26:                                               ; preds = %.lr.ph96, %26
  %indvars.iv130 = phi i64 [ 0, %.lr.ph96 ], [ %indvars.iv.next131, %26 ]
  %27 = getelementptr inbounds [403 x [403 x i32]], ptr @e, i64 0, i64 %indvars.iv133, i64 %indvars.iv130
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  %28 = load i32, ptr %21, align 4, !tbaa !5
  %29 = getelementptr inbounds [403 x [403 x i32]], ptr @e, i64 0, i64 %indvars.iv136, i64 %indvars.iv130
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = add nsw i32 %30, %28
  store i32 %31, ptr %1, align 4, !tbaa !5
  %32 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %27, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %33 = load i32, ptr %32, align 4, !tbaa !5
  store i32 %33, ptr %27, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  %indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1
  %34 = load i32, ptr @n, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %.not77.not = icmp slt i64 %indvars.iv130, %35
  br i1 %.not77.not, label %26, label %._crit_edge, !llvm.loop !15

._crit_edge110:                                   ; preds = %64, %0, %.preheader87, %.preheader84
  %36 = call i64 @time(ptr noundef null) #8
  %37 = trunc i64 %36 to i32
  call void @srand(i32 noundef %37) #8
  %38 = load i32, ptr @m, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = shl nsw i64 %39, 2
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @perm, ptr nonnull align 16 @ord, i64 %40, i1 false)
  %41 = call noundef i64 @_Z4calcv()
  %.not = icmp eq i64 %41, 9223372036854775807
  br i1 %.not, label %._crit_edge120, label %.critedge80.preheader

.lr.ph109:                                        ; preds = %.lr.ph109.preheader, %64
  %.065108 = phi i32 [ %66, %64 ], [ 0, %.lr.ph109.preheader ]
  %42 = phi i32 [ %65, %64 ], [ %m.promoted, %.lr.ph109.preheader ]
  %43 = sext i32 %.065108 to i64
  %44 = getelementptr inbounds [403 x i8], ptr @s, i64 0, i64 %43
  %45 = load i8, ptr %44, align 1, !tbaa !16
  %46 = getelementptr inbounds [403 x i8], ptr @t, i64 0, i64 %43
  %47 = load i8, ptr %46, align 1, !tbaa !16
  %.not74 = icmp eq i8 %45, %47
  br i1 %.not74, label %64, label %48

48:                                               ; preds = %.lr.ph109
  %49 = add nsw i32 %42, 1
  %50 = sext i32 %42 to i64
  %51 = getelementptr inbounds [403 x i32], ptr @ord, i64 0, i64 %50
  store i32 %.065108, ptr %51, align 4, !tbaa !5
  %52 = icmp slt i32 %.065108, %22
  br i1 %52, label %.lr.ph104, label %.critedge

.lr.ph104:                                        ; preds = %48, %58
  %indvars.iv139 = phi i64 [ %indvars.iv.next140, %58 ], [ %43, %48 ]
  %53 = getelementptr inbounds [403 x i8], ptr @s, i64 0, i64 %indvars.iv139
  %54 = load i8, ptr %53, align 1, !tbaa !16
  %55 = getelementptr inbounds [403 x i8], ptr @t, i64 0, i64 %indvars.iv139
  %56 = load i8, ptr %55, align 1, !tbaa !16
  %.not75 = icmp eq i8 %54, %56
  br i1 %.not75, label %.lr.ph104..critedge.loopexit_crit_edge, label %58

.lr.ph104..critedge.loopexit_crit_edge:           ; preds = %.lr.ph104
  %57 = trunc nsw i64 %indvars.iv139 to i32
  %sext = shl i64 %indvars.iv139, 32
  %.pre159 = ashr exact i64 %sext, 32
  br label %.critedge

58:                                               ; preds = %.lr.ph104
  %indvars.iv.next140 = add nsw i64 %indvars.iv139, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next140, %18
  br i1 %exitcond.not, label %.critedge, label %.lr.ph104, !llvm.loop !17

.critedge:                                        ; preds = %58, %.lr.ph104..critedge.loopexit_crit_edge, %48
  %.pre-phi = phi i64 [ %43, %48 ], [ %.pre159, %.lr.ph104..critedge.loopexit_crit_edge ], [ %18, %58 ]
  %.166.lcssa = phi i32 [ %.065108, %48 ], [ %57, %.lr.ph104..critedge.loopexit_crit_edge ], [ %22, %58 ]
  %59 = add nsw i32 %42, 2
  store i32 %59, ptr @m, align 4, !tbaa !5
  %60 = sext i32 %49 to i64
  %61 = getelementptr inbounds [403 x i32], ptr @ord, i64 0, i64 %60
  store i32 %.166.lcssa, ptr %61, align 4, !tbaa !5
  %62 = getelementptr inbounds [403 x i32], ptr @match, i64 0, i64 %.pre-phi
  store i32 %.065108, ptr %62, align 4, !tbaa !5
  %63 = getelementptr inbounds [403 x i32], ptr @match, i64 0, i64 %43
  store i32 %.166.lcssa, ptr %63, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %.lr.ph109, %.critedge
  %65 = phi i32 [ %59, %.critedge ], [ %42, %.lr.ph109 ]
  %.2 = phi i32 [ %.166.lcssa, %.critedge ], [ %.065108, %.lr.ph109 ]
  %66 = add nsw i32 %.2, 1
  %67 = icmp slt i32 %66, %22
  br i1 %67, label %.lr.ph109, label %._crit_edge110, !llvm.loop !18

.critedge80.preheader:                            ; preds = %._crit_edge110, %.critedge82
  %68 = phi i64 [ %135, %.critedge82 ], [ %41, %._crit_edge110 ]
  %69 = load i32, ptr @m, align 4, !tbaa !5
  %70 = icmp sgt i32 %69, 0
  br i1 %70, label %.lr.ph112.preheader, label %._crit_edge113.thread

._crit_edge120:                                   ; preds = %.critedge82, %._crit_edge110
  %71 = call noundef i64 @_Z4calcv()
  %72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %71)
  ret i32 0

.critedge80.loopexit:                             ; preds = %.lr.ph119, %.preheader
  %73 = load i32, ptr @m, align 4, !tbaa !5
  %74 = icmp sgt i32 %73, 0
  br i1 %74, label %.lr.ph112.preheader, label %._crit_edge113.thread

._crit_edge113.thread:                            ; preds = %.critedge80.loopexit, %.critedge80.preheader
  %.lcssa174 = phi i32 [ %69, %.critedge80.preheader ], [ %73, %.critedge80.loopexit ]
  store i32 0, ptr @tot, align 4, !tbaa !5
  br label %.critedge82

.lr.ph112.preheader:                              ; preds = %.critedge80.preheader, %.critedge80.loopexit
  %75 = phi i1 [ %74, %.critedge80.loopexit ], [ %70, %.critedge80.preheader ]
  %76 = phi i32 [ %73, %.critedge80.loopexit ], [ %69, %.critedge80.preheader ]
  %wide.trip.count = zext nneg i32 %76 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %77 = icmp ult i32 %76, 4
  br i1 %77, label %._crit_edge113.unr-lcssa, label %.lr.ph112.preheader.new

.lr.ph112.preheader.new:                          ; preds = %.lr.ph112.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483644
  br label %.lr.ph112

._crit_edge113.unr-lcssa:                         ; preds = %.lr.ph112, %.lr.ph112.preheader
  %indvars.iv142.unr = phi i64 [ 0, %.lr.ph112.preheader ], [ %indvars.iv.next143.3, %.lr.ph112 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge113, label %.lr.ph112.epil

.lr.ph112.epil:                                   ; preds = %._crit_edge113.unr-lcssa, %.lr.ph112.epil
  %indvars.iv142.epil = phi i64 [ %indvars.iv.next143.epil, %.lr.ph112.epil ], [ %indvars.iv142.unr, %._crit_edge113.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph112.epil ], [ 0, %._crit_edge113.unr-lcssa ]
  %78 = getelementptr inbounds [403 x i32], ptr @ord, i64 0, i64 %indvars.iv142.epil
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [403 x i8], ptr @inq, i64 0, i64 %80
  store i8 0, ptr %81, align 1, !tbaa !19
  %82 = getelementptr inbounds [403 x i64], ptr @dis, i64 0, i64 %80
  store i64 0, ptr %82, align 8, !tbaa !21
  %indvars.iv.next143.epil = add nuw nsw i64 %indvars.iv142.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge113, label %.lr.ph112.epil, !llvm.loop !23

._crit_edge113:                                   ; preds = %.lr.ph112.epil, %._crit_edge113.unr-lcssa
  store i32 0, ptr @tot, align 4, !tbaa !5
  br i1 %75, label %.lr.ph116, label %.critedge82

.lr.ph112:                                        ; preds = %.lr.ph112, %.lr.ph112.preheader.new
  %indvars.iv142 = phi i64 [ 0, %.lr.ph112.preheader.new ], [ %indvars.iv.next143.3, %.lr.ph112 ]
  %niter = phi i64 [ 0, %.lr.ph112.preheader.new ], [ %niter.next.3, %.lr.ph112 ]
  %83 = getelementptr inbounds [403 x i32], ptr @ord, i64 0, i64 %indvars.iv142
  %84 = load i32, ptr %83, align 16, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [403 x i8], ptr @inq, i64 0, i64 %85
  store i8 0, ptr %86, align 1, !tbaa !19
  %87 = getelementptr inbounds [403 x i64], ptr @dis, i64 0, i64 %85
  store i64 0, ptr %87, align 8, !tbaa !21
  %indvars.iv.next143 = or disjoint i64 %indvars.iv142, 1
  %88 = getelementptr inbounds [403 x i32], ptr @ord, i64 0, i64 %indvars.iv.next143
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [403 x i8], ptr @inq, i64 0, i64 %90
  store i8 0, ptr %91, align 1, !tbaa !19
  %92 = getelementptr inbounds [403 x i64], ptr @dis, i64 0, i64 %90
  store i64 0, ptr %92, align 8, !tbaa !21
  %indvars.iv.next143.1 = or disjoint i64 %indvars.iv142, 2
  %93 = getelementptr inbounds [403 x i32], ptr @ord, i64 0, i64 %indvars.iv.next143.1
  %94 = load i32, ptr %93, align 8, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [403 x i8], ptr @inq, i64 0, i64 %95
  store i8 0, ptr %96, align 1, !tbaa !19
  %97 = getelementptr inbounds [403 x i64], ptr @dis, i64 0, i64 %95
  store i64 0, ptr %97, align 8, !tbaa !21
  %indvars.iv.next143.2 = or disjoint i64 %indvars.iv142, 3
  %98 = getelementptr inbounds [403 x i32], ptr @ord, i64 0, i64 %indvars.iv.next143.2
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [403 x i8], ptr @inq, i64 0, i64 %100
  store i8 0, ptr %101, align 1, !tbaa !19
  %102 = getelementptr inbounds [403 x i64], ptr @dis, i64 0, i64 %100
  store i64 0, ptr %102, align 8, !tbaa !21
  %indvars.iv.next143.3 = add nuw nsw i64 %indvars.iv142, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge113.unr-lcssa, label %.lr.ph112, !llvm.loop !25

103:                                              ; preds = %.lr.ph116
  %indvars.iv.next147 = add nuw nsw i64 %indvars.iv146, 1
  %104 = load i32, ptr @m, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = icmp slt i64 %indvars.iv.next147, %105
  br i1 %106, label %.lr.ph116, label %.critedge82, !llvm.loop !26

.lr.ph116:                                        ; preds = %._crit_edge113, %103
  %indvars.iv146 = phi i64 [ %indvars.iv.next147, %103 ], [ 0, %._crit_edge113 ]
  %107 = getelementptr inbounds [403 x i32], ptr @ord, i64 0, i64 %indvars.iv146
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = call noundef zeroext i1 @_Z7augmenti(i32 noundef %108)
  br i1 %109, label %.preheader83, label %103

.preheader83:                                     ; preds = %.lr.ph116
  %110 = load i32, ptr @tot, align 4, !tbaa !5
  %111 = add nsw i32 %110, -1
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [403 x i32], ptr @que, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %115, %.preheader83
  %indvars.iv149 = phi i64 [ %indvars.iv.next150, %115 ], [ 0, %.preheader83 ]
  %116 = getelementptr inbounds [403 x i32], ptr @que, i64 0, i64 %indvars.iv149
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %.not73 = icmp eq i32 %117, %114
  %indvars.iv.next150 = add nuw nsw i64 %indvars.iv149, 1
  br i1 %.not73, label %.preheader, label %115, !llvm.loop !27

.preheader:                                       ; preds = %115
  %118 = trunc nuw nsw i64 %indvars.iv149 to i32
  %119 = add nuw nsw i32 %118, 1
  %120 = icmp slt i32 %119, %110
  br i1 %120, label %.lr.ph119, label %.critedge80.loopexit

.lr.ph119:                                        ; preds = %.preheader, %.lr.ph119
  %indvars.iv152 = phi i64 [ %indvars.iv.next153, %.lr.ph119 ], [ %indvars.iv149, %.preheader ]
  %121 = phi i32 [ %132, %.lr.ph119 ], [ %119, %.preheader ]
  %122 = zext nneg i32 %121 to i64
  %123 = getelementptr inbounds [403 x i32], ptr @que, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %125 = getelementptr inbounds [403 x i32], ptr @que, i64 0, i64 %indvars.iv152
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [403 x i32], ptr @match, i64 0, i64 %127
  store i32 %124, ptr %128, align 4, !tbaa !5
  %129 = sext i32 %124 to i64
  %130 = getelementptr inbounds [403 x i32], ptr @match, i64 0, i64 %129
  store i32 %126, ptr %130, align 4, !tbaa !5
  %indvars.iv.next153 = add nuw nsw i64 %indvars.iv152, 2
  %131 = trunc i64 %indvars.iv152 to i32
  %132 = add i32 %131, 3
  %133 = icmp slt i32 %132, %110
  br i1 %133, label %.lr.ph119, label %.critedge80.loopexit, !llvm.loop !28

.critedge82:                                      ; preds = %._crit_edge113, %103, %._crit_edge113.thread
  %134 = phi i32 [ %.lcssa174, %._crit_edge113.thread ], [ %104, %103 ], [ %76, %._crit_edge113 ]
  call void @_Z7rebuildiPi(i32 noundef %134, ptr noundef nonnull @ord)
  %135 = call noundef i64 @_Z4calcv()
  %136 = icmp slt i64 %135, %68
  br i1 %136, label %.critedge80.preheader, label %._crit_edge120, !llvm.loop !29
}

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

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

; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #6

; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #6

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

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

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { 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 #6 = { 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 #7 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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}
!13 = !{!"llvm.loop.unswitch.partial.disable"}
!14 = distinct !{!14, !10, !13}
!15 = distinct !{!15, !10}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = !{!20, !20, i64 0}
!20 = !{!"bool", !7, i64 0}
!21 = !{!22, !22, i64 0}
!22 = !{!"long long", !7, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.unroll.disable"}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10}
!28 = distinct !{!28, !10}
!29 = distinct !{!29, !10}


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