; LLVM IR from tangjz/acm-icpc :: codeforces/complete (856B)

; 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
@dep = external dso_local global [1000001 x i32], align 16
@e = external dso_local global [1000001 x [27 x i32]], align 16
@ord = external dso_local global [1000001 x i32], align 16
@f = external dso_local global [1000001 x i32], align 16
@dp = external dso_local global [1000001 x [2 x i32]], align 16
@buf = external dso_local global [1000001 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

17:                                               ; preds = %262, %0
  %18 = load i32, ptr @t, align 4, !tbaa !5
  %19 = add nsw i32 %18, -1
  store i32 %19, ptr @t, align 4, !tbaa !5
  %20 = icmp ne i32 %18, 0
  br i1 %20, label %21, label %265

21:                                               ; preds = %17
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @m)
  store i32 0, ptr @n, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 16 @e, i8 0, i64 108, i1 false)
  br label %23

23:                                               ; preds = %83, %21
  %24 = load i32, ptr @m, align 4, !tbaa !5
  %25 = add nsw i32 %24, -1
  store i32 %25, ptr @m, align 4, !tbaa !5
  %26 = icmp ne i32 %24, 0
  br i1 %26, label %27, label %84

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

29:                                               ; preds = %80, %27
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [1000001 x i8], ptr @buf, i64 0, i64 %31
  %33 = load i8, ptr %32, align 1, !tbaa !9
  %34 = icmp ne i8 %33, 0
  br i1 %34, label %36, label %35

35:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %83

36:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [1000001 x i8], ptr @buf, i64 0, i64 %38
  %40 = load i8, ptr %39, align 1, !tbaa !9
  %41 = sext i8 %40 to i32
  %42 = sub nsw i32 %41, 97
  store i32 %42, ptr %4, align 4, !tbaa !5
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [1000001 x [27 x i32]], ptr @e, i64 0, i64 %44
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [27 x i32], ptr %45, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %72, label %51

51:                                               ; preds = %36
  %52 = load i32, ptr @n, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr @n, align 4, !tbaa !5
  %54 = load i32, ptr %3, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [1000001 x [27 x i32]], ptr @e, i64 0, i64 %55
  %57 = load i32, ptr %4, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [27 x i32], ptr %56, i64 0, i64 %58
  store i32 %53, ptr %59, align 4, !tbaa !5
  %60 = load i32, ptr @n, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [1000001 x [27 x i32]], ptr @e, i64 0, i64 %61
  %63 = getelementptr inbounds [27 x i32], ptr %62, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 4 %63, i8 0, i64 108, i1 false)
  %64 = load i32, ptr %3, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [1000001 x i32], ptr @dep, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  %69 = load i32, ptr @n, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [1000001 x i32], ptr @dep, i64 0, i64 %70
  store i32 %68, ptr %71, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %51, %36
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1000001 x [27 x i32]], ptr @e, i64 0, i64 %74
  %76 = load i32, ptr %4, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [27 x i32], ptr %75, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  store i32 %79, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %80

80:                                               ; preds = %72
  %81 = load i32, ptr %2, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %2, align 4, !tbaa !5
  br label %29, !llvm.loop !10

83:                                               ; preds = %35
  br label %23, !llvm.loop !12

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

85:                                               ; preds = %111, %84
  %86 = load i32, ptr %5, align 4, !tbaa !5
  %87 = icmp slt i32 %86, 26
  br i1 %87, label %89, label %88

88:                                               ; preds = %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %114

89:                                               ; preds = %85
  %90 = load i32, ptr %5, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [27 x i32], ptr @e, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = icmp ne i32 %93, 0
  br i1 %94, label %95, label %110

95:                                               ; preds = %89
  %96 = load i32, ptr %5, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [27 x i32], ptr @e, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %100
  store i32 0, ptr %101, align 4, !tbaa !5
  %102 = load i32, ptr %5, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [27 x i32], ptr @e, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = load i32, ptr @n, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr @n, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [1000001 x i32], ptr @ord, i64 0, i64 %108
  store i32 %105, ptr %109, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %95, %89
  br label %111

111:                                              ; preds = %110
  %112 = load i32, ptr %5, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %5, align 4, !tbaa !5
  br label %85, !llvm.loop !13

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

115:                                              ; preds = %192, %114
  %116 = load i32, ptr %6, align 4, !tbaa !5
  %117 = load i32, ptr @n, align 4, !tbaa !5
  %118 = icmp sle i32 %116, %117
  br i1 %118, label %120, label %119

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

120:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %121 = load i32, ptr %6, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [1000001 x i32], ptr @ord, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  store i32 %124, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %125

125:                                              ; preds = %188, %120
  %126 = load i32, ptr %9, align 4, !tbaa !5
  %127 = icmp slt i32 %126, 26
  br i1 %127, label %129, label %128

128:                                              ; preds = %125
  store i32 15, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %191

129:                                              ; preds = %125
  %130 = load i32, ptr %8, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [1000001 x [27 x i32]], ptr @e, i64 0, i64 %131
  %133 = load i32, ptr %9, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [27 x i32], ptr %132, i64 0, i64 %134
  %136 = load i32, ptr %135, align 4, !tbaa !5
  %137 = icmp ne i32 %136, 0
  br i1 %137, label %138, label %187

138:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %139 = load i32, ptr %8, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [1000001 x [27 x i32]], ptr @e, i64 0, i64 %140
  %142 = load i32, ptr %9, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [27 x i32], ptr %141, i64 0, i64 %143
  %145 = load i32, ptr %144, align 4, !tbaa !5
  store i32 %145, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %146 = load i32, ptr %8, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !5
  store i32 %149, ptr %11, align 4, !tbaa !5
  br label %150

150:                                              ; preds = %166, %138
  %151 = load i32, ptr %11, align 4, !tbaa !5
  %152 = icmp ne i32 %151, 0
  br i1 %152, label %153, label %163

153:                                              ; preds = %150
  %154 = load i32, ptr %11, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [1000001 x [27 x i32]], ptr @e, i64 0, i64 %155
  %157 = load i32, ptr %9, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [27 x i32], ptr %156, i64 0, i64 %158
  %160 = load i32, ptr %159, align 4, !tbaa !5
  %161 = icmp ne i32 %160, 0
  %162 = xor i1 %161, true
  br label %163

163:                                              ; preds = %153, %150
  %164 = phi i1 [ false, %150 ], [ %162, %153 ]
  br i1 %164, label %165, label %171

165:                                              ; preds = %163
  br label %166

166:                                              ; preds = %165
  %167 = load i32, ptr %11, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !5
  store i32 %170, ptr %11, align 4, !tbaa !5
  br label %150, !llvm.loop !14

171:                                              ; preds = %163
  %172 = load i32, ptr %11, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [1000001 x [27 x i32]], ptr @e, i64 0, i64 %173
  %175 = load i32, ptr %9, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [27 x i32], ptr %174, i64 0, i64 %176
  %178 = load i32, ptr %177, align 4, !tbaa !5
  %179 = load i32, ptr %10, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %180
  store i32 %178, ptr %181, align 4, !tbaa !5
  %182 = load i32, ptr %10, align 4, !tbaa !5
  %183 = load i32, ptr @n, align 4, !tbaa !5
  %184 = add nsw i32 %183, 1
  store i32 %184, ptr @n, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [1000001 x i32], ptr @ord, i64 0, i64 %185
  store i32 %182, ptr %186, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %187

187:                                              ; preds = %171, %129
  br label %188

188:                                              ; preds = %187
  %189 = load i32, ptr %9, align 4, !tbaa !5
  %190 = add nsw i32 %189, 1
  store i32 %190, ptr %9, align 4, !tbaa !5
  br label %125, !llvm.loop !15

191:                                              ; preds = %128
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %192

192:                                              ; preds = %191
  %193 = load i32, ptr %6, align 4, !tbaa !5
  %194 = add nsw i32 %193, 1
  store i32 %194, ptr %6, align 4, !tbaa !5
  br label %115, !llvm.loop !16

195:                                              ; preds = %119
  %196 = load i32, ptr @n, align 4, !tbaa !5
  %197 = add nsw i32 %196, 1
  %198 = sext i32 %197 to i64
  %199 = mul i64 %198, 8
  call void @llvm.memset.p0.i64(ptr align 16 @dp, i8 0, i64 %199, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %200 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %200, ptr %12, align 4, !tbaa !5
  br label %201

201:                                              ; preds = %259, %195
  %202 = load i32, ptr %12, align 4, !tbaa !5
  %203 = icmp sge i32 %202, 1
  br i1 %203, label %205, label %204

204:                                              ; preds = %201
  store i32 21, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %262

205:                                              ; preds = %201
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %206 = load i32, ptr %12, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [1000001 x i32], ptr @ord, i64 0, i64 %207
  %209 = load i32, ptr %208, align 4, !tbaa !5
  store i32 %209, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %210 = load i32, ptr %13, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %211
  %213 = load i32, ptr %212, align 4, !tbaa !5
  store i32 %213, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %214 = load i32, ptr %13, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [1000001 x [2 x i32]], ptr @dp, i64 0, i64 %215
  %217 = getelementptr inbounds [2 x i32], ptr %216, i64 0, i64 0
  %218 = load i32, ptr %13, align 4, !tbaa !5
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [1000001 x [2 x i32]], ptr @dp, i64 0, i64 %219
  %221 = getelementptr inbounds [2 x i32], ptr %220, i64 0, i64 1
  %222 = load i32, ptr %221, align 4, !tbaa !5
  %223 = add nsw i32 %222, 1
  store i32 %223, ptr %221, align 4, !tbaa !5
  %224 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %217, ptr noundef nonnull align 4 dereferenceable(4) %221)
  %225 = load i32, ptr %224, align 4, !tbaa !5
  store i32 %225, ptr %15, align 4, !tbaa !5
  %226 = load i32, ptr %15, align 4, !tbaa !5
  %227 = load i32, ptr %14, align 4, !tbaa !5
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [1000001 x [2 x i32]], ptr @dp, i64 0, i64 %228
  %230 = getelementptr inbounds [2 x i32], ptr %229, i64 0, i64 0
  %231 = load i32, ptr %230, align 8, !tbaa !5
  %232 = add nsw i32 %231, %226
  store i32 %232, ptr %230, align 8, !tbaa !5
  %233 = load i32, ptr %14, align 4, !tbaa !5
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [1000001 x i32], ptr @dep, i64 0, i64 %234
  %236 = load i32, ptr %235, align 4, !tbaa !5
  %237 = add nsw i32 %236, 1
  %238 = load i32, ptr %13, align 4, !tbaa !5
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds [1000001 x i32], ptr @dep, i64 0, i64 %239
  %241 = load i32, ptr %240, align 4, !tbaa !5
  %242 = icmp slt i32 %237, %241
  br i1 %242, label %243, label %245

243:                                              ; preds = %205
  %244 = load i32, ptr %15, align 4, !tbaa !5
  br label %251

245:                                              ; preds = %205
  %246 = load i32, ptr %13, align 4, !tbaa !5
  %247 = sext i32 %246 to i64
  %248 = getelementptr inbounds [1000001 x [2 x i32]], ptr @dp, i64 0, i64 %247
  %249 = getelementptr inbounds [2 x i32], ptr %248, i64 0, i64 0
  %250 = load i32, ptr %249, align 8, !tbaa !5
  br label %251

251:                                              ; preds = %245, %243
  %252 = phi i32 [ %244, %243 ], [ %250, %245 ]
  %253 = load i32, ptr %14, align 4, !tbaa !5
  %254 = sext i32 %253 to i64
  %255 = getelementptr inbounds [1000001 x [2 x i32]], ptr @dp, i64 0, i64 %254
  %256 = getelementptr inbounds [2 x i32], ptr %255, i64 0, i64 1
  %257 = load i32, ptr %256, align 4, !tbaa !5
  %258 = add nsw i32 %257, %252
  store i32 %258, ptr %256, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %259

259:                                              ; preds = %251
  %260 = load i32, ptr %12, align 4, !tbaa !5
  %261 = add nsw i32 %260, -1
  store i32 %261, ptr %12, align 4, !tbaa !5
  br label %201, !llvm.loop !17

262:                                              ; preds = %204
  %263 = load i32, ptr @dp, align 16, !tbaa !5
  %264 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %263)
  br label %17, !llvm.loop !18

265:                                              ; preds = %17
  ret i32 0
}

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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)) #4

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

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


; 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 local_unnamed_addr global i32, align 4
@m = external dso_local global i32, align 4
@dep = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@e = external dso_local local_unnamed_addr global [1000001 x [27 x i32]], align 16
@ord = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@f = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@dp = external dso_local global [1000001 x [2 x i32]], align 16
@buf = external dso_local global [1000001 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %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
  %.not87 = icmp eq i32 %2, 0
  br i1 %.not87, label %._crit_edge90, label %.lr.ph89

.lr.ph89:                                         ; preds = %0, %._crit_edge86
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m)
  store i32 0, ptr @n, align 4, !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(108) @e, i8 0, i64 108, i1 false)
  %5 = load i32, ptr @m, align 4, !tbaa !5
  %6 = add nsw i32 %5, -1
  store i32 %6, ptr @m, align 4, !tbaa !5
  %.not5668 = icmp eq i32 %5, 0
  br i1 %.not5668, label %._crit_edge, label %.lr.ph69

.loopexit:                                        ; preds = %26, %.lr.ph69
  %7 = load i32, ptr @m, align 4, !tbaa !5
  %8 = add nsw i32 %7, -1
  store i32 %8, ptr @m, align 4, !tbaa !5
  %.not56 = icmp eq i32 %7, 0
  br i1 %.not56, label %._crit_edge, label %.lr.ph69, !llvm.loop !9

.lr.ph69:                                         ; preds = %.lr.ph89, %.loopexit
  %9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @buf)
  %10 = load i8, ptr @buf, align 16, !tbaa !11
  %.not6265 = icmp eq i8 %10, 0
  br i1 %.not6265, label %.loopexit, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.lr.ph69
  %n.promoted = load i32, ptr @n, align 4, !tbaa !5
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %26
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %26 ]
  %11 = phi i8 [ %10, %.lr.ph.preheader ], [ %30, %26 ]
  %.04666 = phi i32 [ 0, %.lr.ph.preheader ], [ %27, %26 ]
  %12 = phi i32 [ %n.promoted, %.lr.ph.preheader ], [ %28, %26 ]
  %13 = sext i8 %11 to i64
  %14 = add nsw i64 %13, -97
  %15 = sext i32 %.04666 to i64
  %16 = getelementptr inbounds [1000001 x [27 x i32]], ptr @e, i64 0, i64 %15, i64 %14
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %.not63 = icmp eq i32 %17, 0
  br i1 %.not63, label %18, label %26

18:                                               ; preds = %.lr.ph
  %19 = add nsw i32 %12, 1
  store i32 %19, ptr @n, align 4, !tbaa !5
  store i32 %19, ptr %16, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [1000001 x [27 x i32]], ptr @e, i64 0, i64 %20
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(108) %21, i8 0, i64 108, i1 false)
  %22 = getelementptr inbounds [1000001 x i32], ptr @dep, i64 0, i64 %15
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  %25 = getelementptr inbounds [1000001 x i32], ptr @dep, i64 0, i64 %20
  store i32 %24, ptr %25, align 4, !tbaa !5
  %.pre = load i32, ptr %16, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %18, %.lr.ph
  %27 = phi i32 [ %.pre, %18 ], [ %17, %.lr.ph ]
  %28 = phi i32 [ %19, %18 ], [ %12, %.lr.ph ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %29 = getelementptr inbounds [1000001 x i8], ptr @buf, i64 0, i64 %indvars.iv.next
  %30 = load i8, ptr %29, align 1, !tbaa !11
  %.not62 = icmp eq i8 %30, 0
  br i1 %.not62, label %.loopexit, label %.lr.ph, !llvm.loop !12

._crit_edge:                                      ; preds = %.loopexit, %.lr.ph89
  store i32 0, ptr @n, align 4, !tbaa !5
  br label %34

.preheader64:                                     ; preds = %53
  %.not5778 = icmp slt i32 %n.promoted74.1, 1
  br i1 %.not5778, label %._crit_edge82.thread, label %.lr.ph81

._crit_edge82.thread:                             ; preds = %.preheader64
  %31 = add nsw i32 %n.promoted74.1, 1
  %32 = sext i32 %31 to i64
  %33 = shl nsw i64 %32, 3
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @dp, i8 0, i64 %33, i1 false)
  br label %._crit_edge86

34:                                               ; preds = %53, %._crit_edge
  %indvars.iv91 = phi i64 [ 0, %._crit_edge ], [ %indvars.iv.next92.1, %53 ]
  %35 = phi i32 [ 0, %._crit_edge ], [ %n.promoted74.1, %53 ]
  %36 = getelementptr inbounds [27 x i32], ptr @e, i64 0, i64 %indvars.iv91
  %37 = load i32, ptr %36, align 8, !tbaa !5
  %.not61 = icmp eq i32 %37, 0
  br i1 %.not61, label %44, label %38

38:                                               ; preds = %34
  %39 = sext i32 %37 to i64
  %40 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %39
  store i32 0, ptr %40, align 4, !tbaa !5
  %41 = add nsw i32 %35, 1
  store i32 %41, ptr @n, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [1000001 x i32], ptr @ord, i64 0, i64 %42
  store i32 %37, ptr %43, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %34, %38
  %n.promoted74 = phi i32 [ %35, %34 ], [ %41, %38 ]
  %indvars.iv.next92 = or disjoint i64 %indvars.iv91, 1
  %45 = getelementptr inbounds [27 x i32], ptr @e, i64 0, i64 %indvars.iv.next92
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %.not61.1 = icmp eq i32 %46, 0
  br i1 %.not61.1, label %53, label %47

47:                                               ; preds = %44
  %48 = sext i32 %46 to i64
  %49 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %48
  store i32 0, ptr %49, align 4, !tbaa !5
  %50 = add nsw i32 %n.promoted74, 1
  store i32 %50, ptr @n, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [1000001 x i32], ptr @ord, i64 0, i64 %51
  store i32 %46, ptr %52, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %47, %44
  %n.promoted74.1 = phi i32 [ %n.promoted74, %44 ], [ %50, %47 ]
  %indvars.iv.next92.1 = add nuw nsw i64 %indvars.iv91, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next92.1, 26
  br i1 %exitcond.not.1, label %.preheader64, label %34, !llvm.loop !13

._crit_edge82:                                    ; preds = %62
  %54 = add nsw i32 %n.promoted7275, 1
  %55 = sext i32 %54 to i64
  %56 = shl nsw i64 %55, 3
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @dp, i8 0, i64 %56, i1 false)
  %57 = icmp sgt i32 %n.promoted7275, 0
  br i1 %57, label %.lr.ph85.preheader, label %._crit_edge86

.lr.ph85.preheader:                               ; preds = %._crit_edge82
  %58 = zext nneg i32 %n.promoted7275 to i64
  br label %.lr.ph85

.lr.ph81:                                         ; preds = %.preheader64, %62
  %indvars.iv98 = phi i64 [ %indvars.iv.next99, %62 ], [ 1, %.preheader64 ]
  %n.promoted727779 = phi i32 [ %n.promoted7275, %62 ], [ %n.promoted74.1, %.preheader64 ]
  %59 = getelementptr inbounds [1000001 x i32], ptr @ord, i64 0, i64 %indvars.iv98
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  br label %64

62:                                               ; preds = %78
  %indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
  %63 = sext i32 %n.promoted7275 to i64
  %.not57.not = icmp slt i64 %indvars.iv98, %63
  br i1 %.not57.not, label %.lr.ph81, label %._crit_edge82, !llvm.loop !14

64:                                               ; preds = %.lr.ph81, %78
  %indvars.iv94 = phi i64 [ 0, %.lr.ph81 ], [ %indvars.iv.next95, %78 ]
  %n.promoted7276 = phi i32 [ %n.promoted727779, %.lr.ph81 ], [ %n.promoted7275, %78 ]
  %65 = phi i32 [ %n.promoted727779, %.lr.ph81 ], [ %79, %78 ]
  %66 = getelementptr inbounds [1000001 x [27 x i32]], ptr @e, i64 0, i64 %61, i64 %indvars.iv94
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %.not58 = icmp eq i32 %67, 0
  br i1 %.not58, label %78, label %.preheader

.preheader:                                       ; preds = %64, %68
  %.pn = phi i64 [ %69, %68 ], [ %61, %64 ]
  %.049.in = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %.pn
  %.049 = load i32, ptr %.049.in, align 4, !tbaa !5
  %.not59 = icmp eq i32 %.049, 0
  br i1 %.not59, label %.preheader..critedge_crit_edge, label %68

.preheader..critedge_crit_edge:                   ; preds = %.preheader
  %.phi.trans.insert = getelementptr inbounds [1000001 x [27 x i32]], ptr @e, i64 0, i64 0, i64 %indvars.iv94
  %.pre104 = load i32, ptr %.phi.trans.insert, align 4, !tbaa !5
  br label %.critedge

68:                                               ; preds = %.preheader
  %69 = sext i32 %.049 to i64
  %70 = getelementptr inbounds [1000001 x [27 x i32]], ptr @e, i64 0, i64 %69, i64 %indvars.iv94
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %.not60 = icmp eq i32 %71, 0
  br i1 %.not60, label %.preheader, label %.critedge, !llvm.loop !15

.critedge:                                        ; preds = %68, %.preheader..critedge_crit_edge
  %72 = phi i32 [ %.pre104, %.preheader..critedge_crit_edge ], [ %71, %68 ]
  %73 = sext i32 %67 to i64
  %74 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %73
  store i32 %72, ptr %74, align 4, !tbaa !5
  %75 = add nsw i32 %65, 1
  store i32 %75, ptr @n, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [1000001 x i32], ptr @ord, i64 0, i64 %76
  store i32 %67, ptr %77, align 4, !tbaa !5
  br label %78

78:                                               ; preds = %64, %.critedge
  %n.promoted7275 = phi i32 [ %n.promoted7276, %64 ], [ %75, %.critedge ]
  %79 = phi i32 [ %65, %64 ], [ %75, %.critedge ]
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %exitcond97.not = icmp eq i64 %indvars.iv.next95, 26
  br i1 %exitcond97.not, label %62, label %64, !llvm.loop !16

._crit_edge86:                                    ; preds = %107, %._crit_edge82.thread, %._crit_edge82
  %80 = load i32, ptr @dp, align 16, !tbaa !5
  %81 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %80)
  %82 = load i32, ptr @t, align 4, !tbaa !5
  %83 = add nsw i32 %82, -1
  store i32 %83, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %82, 0
  br i1 %.not, label %._crit_edge90, label %.lr.ph89, !llvm.loop !17

.lr.ph85:                                         ; preds = %.lr.ph85.preheader, %107
  %indvars.iv101 = phi i64 [ %58, %.lr.ph85.preheader ], [ %indvars.iv.next102, %107 ]
  %84 = getelementptr inbounds [1000001 x i32], ptr @ord, i64 0, i64 %indvars.iv101
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = getelementptr inbounds [1000001 x [2 x i32]], ptr @dp, i64 0, i64 %86
  %90 = getelementptr inbounds i8, ptr %89, i64 4
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %90, align 4, !tbaa !5
  %93 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %89, ptr noundef nonnull align 4 dereferenceable(4) %90)
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = sext i32 %88 to i64
  %96 = getelementptr inbounds [1000001 x [2 x i32]], ptr @dp, i64 0, i64 %95
  %97 = load i32, ptr %96, align 8, !tbaa !5
  %98 = add nsw i32 %97, %94
  store i32 %98, ptr %96, align 8, !tbaa !5
  %99 = getelementptr inbounds [1000001 x i32], ptr @dep, i64 0, i64 %95
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = add nsw i32 %100, 1
  %102 = getelementptr inbounds [1000001 x i32], ptr @dep, i64 0, i64 %86
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = icmp slt i32 %101, %103
  br i1 %104, label %107, label %105

105:                                              ; preds = %.lr.ph85
  %106 = load i32, ptr %89, align 8, !tbaa !5
  br label %107

107:                                              ; preds = %.lr.ph85, %105
  %108 = phi i32 [ %106, %105 ], [ %94, %.lr.ph85 ]
  %109 = getelementptr inbounds i8, ptr %96, i64 4
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = add nsw i32 %110, %108
  store i32 %111, ptr %109, align 4, !tbaa !5
  %indvars.iv.next102 = add nsw i64 %indvars.iv101, -1
  %112 = icmp sgt i64 %indvars.iv101, 1
  br i1 %112, label %.lr.ph85, label %._crit_edge86, !llvm.loop !18

._crit_edge90:                                    ; preds = %._crit_edge86, %0
  ret i32 0
}

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

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

; 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 #3

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

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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" }

!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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


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