; LLVM IR from tangjz/acm-icpc :: codeforces/complete (235C)

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

@cnt = external dso_local global i32, align 4
@rt = external dso_local global i32, align 4
@last = external dso_local global i32, align 4
@dep = external dso_local global [2000003 x i32], align 16
@par = external dso_local global [2000003 x i32], align 16
@son = external dso_local global [2000003 x [27 x i32]], align 16
@sz = external dso_local global [2000003 x i32], align 16
@ord = external dso_local global [2000003 x i32], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@ctr = external dso_local global [1000001 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 nounwind uwtable
declare dso_local noundef i32 @_Z7newNodei(i32 noundef) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z6appendi(i32 noundef) #0

; 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 norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %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 @buf)
  %17 = call i64 @strlen(ptr noundef @buf) #6
  %18 = trunc i64 %17 to i32
  store i32 %18, ptr @n, align 4, !tbaa !5
  store i32 0, ptr @cnt, align 4, !tbaa !5
  %19 = call noundef i32 @_Z7newNodei(i32 noundef 0)
  store i32 %19, ptr @last, align 4, !tbaa !5
  store i32 %19, ptr @rt, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %20

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

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %35

25:                                               ; preds = %20
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [1000001 x i8], ptr @buf, i64 0, i64 %27
  %29 = load i8, ptr %28, align 1, !tbaa !9
  %30 = sext i8 %29 to i32
  %31 = sub nsw i32 %30, 97
  call void @_Z6appendi(i32 noundef %31)
  br label %32

32:                                               ; preds = %25
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %2, align 4, !tbaa !5
  br label %20, !llvm.loop !10

35:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %50, %35
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = load i32, ptr @cnt, align 4, !tbaa !5
  %39 = icmp sle i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %53

41:                                               ; preds = %36
  %42 = load i32, ptr %3, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %47, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %41
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %3, align 4, !tbaa !5
  br label %36, !llvm.loop !12

53:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %54

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

58:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %73

59:                                               ; preds = %54
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = sub nsw i32 %60, 1
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = load i32, ptr %4, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = add nsw i32 %68, %64
  store i32 %69, ptr %67, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %59
  %71 = load i32, ptr %4, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %4, align 4, !tbaa !5
  br label %54, !llvm.loop !13

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

75:                                               ; preds = %91, %73
  %76 = load i32, ptr %5, align 4, !tbaa !5
  %77 = icmp sge i32 %76, 1
  br i1 %77, label %79, label %78

78:                                               ; preds = %75
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %94

79:                                               ; preds = %75
  %80 = load i32, ptr %5, align 4, !tbaa !5
  %81 = load i32, ptr %5, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = add nsw i32 %87, -1
  store i32 %88, ptr %86, align 4, !tbaa !5
  %89 = sext i32 %87 to i64
  %90 = getelementptr inbounds [2000003 x i32], ptr @ord, i64 0, i64 %89
  store i32 %80, ptr %90, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %79
  %92 = load i32, ptr %5, align 4, !tbaa !5
  %93 = add nsw i32 %92, -1
  store i32 %93, ptr %5, align 4, !tbaa !5
  br label %75, !llvm.loop !14

94:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %95 = load i32, ptr @cnt, align 4, !tbaa !5
  store i32 %95, ptr %6, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %117, %94
  %97 = load i32, ptr %6, align 4, !tbaa !5
  %98 = icmp sgt i32 %97, 1
  br i1 %98, label %100, label %99

99:                                               ; preds = %96
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %120

100:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %101 = load i32, ptr %6, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [2000003 x i32], ptr @ord, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  store i32 %104, ptr %7, align 4, !tbaa !5
  %105 = load i32, ptr %7, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [2000003 x i32], ptr @sz, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = load i32, ptr %7, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [2000003 x i32], ptr @par, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [2000003 x i32], ptr @sz, i64 0, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !5
  %116 = add nsw i32 %115, %108
  store i32 %116, ptr %114, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %117

117:                                              ; preds = %100
  %118 = load i32, ptr %6, align 4, !tbaa !5
  %119 = add nsw i32 %118, -1
  store i32 %119, ptr %6, align 4, !tbaa !5
  br label %96, !llvm.loop !15

120:                                              ; preds = %99
  %121 = load i32, ptr @cnt, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = mul i64 %122, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @ctr, i64 1), i8 0, i64 %123, i1 false)
  %124 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %125

125:                                              ; preds = %271, %120
  %126 = load i32, ptr %8, align 4, !tbaa !5
  %127 = load i32, ptr @m, align 4, !tbaa !5
  %128 = icmp sle i32 %126, %127
  br i1 %128, label %130, label %129

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

130:                                              ; preds = %125
  %131 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @buf)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %132 = call i64 @strlen(ptr noundef @buf) #6
  %133 = trunc i64 %132 to i32
  store i32 %133, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %134 = load i32, ptr @rt, align 4, !tbaa !5
  store i32 %134, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %135

135:                                              ; preds = %265, %130
  %136 = load i32, ptr %14, align 4, !tbaa !5
  %137 = load i32, ptr %10, align 4, !tbaa !5
  %138 = load i32, ptr %10, align 4, !tbaa !5
  %139 = add nsw i32 %137, %138
  %140 = icmp slt i32 %136, %139
  br i1 %140, label %142, label %141

141:                                              ; preds = %135
  store i32 20, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %268

142:                                              ; preds = %135
  %143 = load i32, ptr %14, align 4, !tbaa !5
  %144 = load i32, ptr %10, align 4, !tbaa !5
  %145 = icmp sge i32 %143, %144
  br i1 %145, label %146, label %204

146:                                              ; preds = %142
  %147 = load i32, ptr %12, align 4, !tbaa !5
  %148 = load i32, ptr %10, align 4, !tbaa !5
  %149 = icmp sge i32 %147, %148
  br i1 %149, label %150, label %204

150:                                              ; preds = %146
  br label %151

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

154:                                              ; preds = %151
  %155 = load i32, ptr %11, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [2000003 x i32], ptr @par, i64 0, i64 %156
  %158 = load i32, ptr %157, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !5
  %162 = load i32, ptr %10, align 4, !tbaa !5
  %163 = icmp sge i32 %161, %162
  br label %164

164:                                              ; preds = %154, %151
  %165 = phi i1 [ false, %151 ], [ %163, %154 ]
  br i1 %165, label %166, label %179

166:                                              ; preds = %164
  %167 = load i32, ptr %11, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [2000003 x i32], ptr @par, i64 0, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %171
  %173 = load i32, ptr %172, align 4, !tbaa !5
  store i32 %173, ptr %12, align 4, !tbaa !5
  br label %174

174:                                              ; preds = %166
  %175 = load i32, ptr %11, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [2000003 x i32], ptr @par, i64 0, i64 %176
  %178 = load i32, ptr %177, align 4, !tbaa !5
  store i32 %178, ptr %11, align 4, !tbaa !5
  br label %151, !llvm.loop !16

179:                                              ; preds = %164
  %180 = load i32, ptr %11, align 4, !tbaa !5
  %181 = icmp ne i32 %180, 0
  br i1 %181, label %184, label %182

182:                                              ; preds = %179
  %183 = load i32, ptr @rt, align 4, !tbaa !5
  store i32 %183, ptr %11, align 4, !tbaa !5
  br label %203

184:                                              ; preds = %179
  %185 = load i32, ptr %11, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %186
  %188 = load i32, ptr %187, align 4, !tbaa !5
  %189 = load i32, ptr %8, align 4, !tbaa !5
  %190 = icmp slt i32 %188, %189
  br i1 %190, label %191, label %202

191:                                              ; preds = %184
  %192 = load i32, ptr %11, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [2000003 x i32], ptr @sz, i64 0, i64 %193
  %195 = load i32, ptr %194, align 4, !tbaa !5
  %196 = load i32, ptr %13, align 4, !tbaa !5
  %197 = add nsw i32 %196, %195
  store i32 %197, ptr %13, align 4, !tbaa !5
  %198 = load i32, ptr %8, align 4, !tbaa !5
  %199 = load i32, ptr %11, align 4, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %200
  store i32 %198, ptr %201, align 4, !tbaa !5
  br label %202

202:                                              ; preds = %191, %184
  br label %203

203:                                              ; preds = %202, %182
  br label %204

204:                                              ; preds = %203, %146, %142
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %205 = load i32, ptr %14, align 4, !tbaa !5
  %206 = load i32, ptr %10, align 4, !tbaa !5
  %207 = icmp slt i32 %205, %206
  br i1 %207, label %208, label %210

208:                                              ; preds = %204
  %209 = load i32, ptr %14, align 4, !tbaa !5
  br label %214

210:                                              ; preds = %204
  %211 = load i32, ptr %14, align 4, !tbaa !5
  %212 = load i32, ptr %10, align 4, !tbaa !5
  %213 = sub nsw i32 %211, %212
  br label %214

214:                                              ; preds = %210, %208
  %215 = phi i32 [ %209, %208 ], [ %213, %210 ]
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [1000001 x i8], ptr @buf, i64 0, i64 %216
  %218 = load i8, ptr %217, align 1, !tbaa !9
  %219 = sext i8 %218 to i32
  %220 = sub nsw i32 %219, 97
  store i32 %220, ptr %15, align 4, !tbaa !5
  br label %221

221:                                              ; preds = %244, %214
  %222 = load i32, ptr %11, align 4, !tbaa !5
  %223 = icmp ne i32 %222, 0
  br i1 %223, label %224, label %234

224:                                              ; preds = %221
  %225 = load i32, ptr %11, align 4, !tbaa !5
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [2000003 x [27 x i32]], ptr @son, i64 0, i64 %226
  %228 = load i32, ptr %15, align 4, !tbaa !5
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [27 x i32], ptr %227, i64 0, i64 %229
  %231 = load i32, ptr %230, align 4, !tbaa !5
  %232 = icmp ne i32 %231, 0
  %233 = xor i1 %232, true
  br label %234

234:                                              ; preds = %224, %221
  %235 = phi i1 [ false, %221 ], [ %233, %224 ]
  br i1 %235, label %236, label %249

236:                                              ; preds = %234
  %237 = load i32, ptr %11, align 4, !tbaa !5
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds [2000003 x i32], ptr @par, i64 0, i64 %238
  %240 = load i32, ptr %239, align 4, !tbaa !5
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %241
  %243 = load i32, ptr %242, align 4, !tbaa !5
  store i32 %243, ptr %12, align 4, !tbaa !5
  br label %244

244:                                              ; preds = %236
  %245 = load i32, ptr %11, align 4, !tbaa !5
  %246 = sext i32 %245 to i64
  %247 = getelementptr inbounds [2000003 x i32], ptr @par, i64 0, i64 %246
  %248 = load i32, ptr %247, align 4, !tbaa !5
  store i32 %248, ptr %11, align 4, !tbaa !5
  br label %221, !llvm.loop !17

249:                                              ; preds = %234
  %250 = load i32, ptr %11, align 4, !tbaa !5
  %251 = icmp ne i32 %250, 0
  br i1 %251, label %254, label %252

252:                                              ; preds = %249
  %253 = load i32, ptr @rt, align 4, !tbaa !5
  store i32 %253, ptr %11, align 4, !tbaa !5
  br label %264

254:                                              ; preds = %249
  %255 = load i32, ptr %11, align 4, !tbaa !5
  %256 = sext i32 %255 to i64
  %257 = getelementptr inbounds [2000003 x [27 x i32]], ptr @son, i64 0, i64 %256
  %258 = load i32, ptr %15, align 4, !tbaa !5
  %259 = sext i32 %258 to i64
  %260 = getelementptr inbounds [27 x i32], ptr %257, i64 0, i64 %259
  %261 = load i32, ptr %260, align 4, !tbaa !5
  store i32 %261, ptr %11, align 4, !tbaa !5
  %262 = load i32, ptr %12, align 4, !tbaa !5
  %263 = add nsw i32 %262, 1
  store i32 %263, ptr %12, align 4, !tbaa !5
  br label %264

264:                                              ; preds = %254, %252
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %265

265:                                              ; preds = %264
  %266 = load i32, ptr %14, align 4, !tbaa !5
  %267 = add nsw i32 %266, 1
  store i32 %267, ptr %14, align 4, !tbaa !5
  br label %135, !llvm.loop !18

268:                                              ; preds = %141
  %269 = load i32, ptr %13, align 4, !tbaa !5
  %270 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %269)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %271

271:                                              ; preds = %268
  %272 = load i32, ptr %8, align 4, !tbaa !5
  %273 = add nsw i32 %272, 1
  store i32 %273, ptr %8, align 4, !tbaa !5
  br label %125, !llvm.loop !19

274:                                              ; preds = %129
  ret i32 0
}

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #5

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

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 nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { "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 willreturn memory(read) "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 willreturn memory(read) }
attributes #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!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}
!19 = distinct !{!19, !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"

@cnt = external dso_local local_unnamed_addr global i32, align 4
@rt = external dso_local local_unnamed_addr global i32, align 4
@last = external dso_local local_unnamed_addr global i32, align 4
@dep = external dso_local local_unnamed_addr global [2000003 x i32], align 16
@par = external dso_local local_unnamed_addr global [2000003 x i32], align 16
@son = external dso_local local_unnamed_addr global [2000003 x [27 x i32]], align 16
@sz = external dso_local local_unnamed_addr global [2000003 x i32], align 16
@ord = external dso_local local_unnamed_addr global [2000003 x i32], align 16
@n = external dso_local local_unnamed_addr global i32, align 4
@m = external dso_local global i32, align 4
@ctr = external dso_local local_unnamed_addr global [1000001 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 nounwind uwtable
declare dso_local noundef i32 @_Z7newNodei(i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @buf)
  %2 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @buf) #6
  %3 = trunc i64 %2 to i32
  store i32 %3, ptr @n, align 4, !tbaa !5
  store i32 0, ptr @cnt, align 4, !tbaa !5
  %4 = tail call noundef i32 @_Z7newNodei(i32 noundef 0)
  store i32 %4, ptr @last, align 4, !tbaa !5
  store i32 %4, ptr @rt, align 4, !tbaa !5
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %.preheader87

.preheader87:                                     ; preds = %.lr.ph, %0
  %.lcssa93 = phi i32 [ %5, %0 ], [ %14, %.lr.ph ]
  %7 = load i32, ptr @cnt, align 4, !tbaa !5
  %.not95 = icmp slt i32 %7, 1
  br i1 %.not95, label %.preheader86, label %.lr.ph97.preheader

.lr.ph97.preheader:                               ; preds = %.preheader87
  %8 = zext nneg i32 %7 to i64
  %xtraiter = and i64 %8, 3
  %9 = icmp ult i32 %7, 4
  br i1 %9, label %.preheader86.loopexit.unr-lcssa, label %.lr.ph97.preheader.new

.lr.ph97.preheader.new:                           ; preds = %.lr.ph97.preheader
  %unroll_iter = and i64 %8, 2147483644
  br label %.lr.ph97

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %10 = getelementptr inbounds [1000001 x i8], ptr @buf, i64 0, i64 %indvars.iv
  %11 = load i8, ptr %10, align 1, !tbaa !9
  %12 = sext i8 %11 to i32
  %13 = add nsw i32 %12, -97
  tail call void @_Z6appendi(i32 noundef %13)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = icmp slt i64 %indvars.iv.next, %15
  br i1 %16, label %.lr.ph, label %.preheader87, !llvm.loop !10

.preheader86.loopexit.unr-lcssa:                  ; preds = %.lr.ph97, %.lr.ph97.preheader
  %indvars.iv133.unr = phi i64 [ 1, %.lr.ph97.preheader ], [ %indvars.iv.next134.3, %.lr.ph97 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader86, label %.lr.ph97.epil

.lr.ph97.epil:                                    ; preds = %.preheader86.loopexit.unr-lcssa, %.lr.ph97.epil
  %indvars.iv133.epil = phi i64 [ %indvars.iv.next134.epil, %.lr.ph97.epil ], [ %indvars.iv133.unr, %.preheader86.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph97.epil ], [ 0, %.preheader86.loopexit.unr-lcssa ]
  %17 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %indvars.iv133.epil
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr %20, align 4, !tbaa !5
  %indvars.iv.next134.epil = add nuw nsw i64 %indvars.iv133.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 %.preheader86, label %.lr.ph97.epil, !llvm.loop !12

.preheader86:                                     ; preds = %.preheader86.loopexit.unr-lcssa, %.lr.ph97.epil, %.preheader87
  %.not7499 = icmp slt i32 %.lcssa93, 1
  br i1 %.not7499, label %.preheader85, label %.lr.ph101.preheader

.lr.ph101.preheader:                              ; preds = %.preheader86
  %.pre = load i32, ptr @ctr, align 16, !tbaa !5
  %23 = zext nneg i32 %.lcssa93 to i64
  %xtraiter180 = and i64 %23, 3
  %24 = icmp ult i32 %.lcssa93, 4
  br i1 %24, label %.preheader85.loopexit.unr-lcssa, label %.lr.ph101.preheader.new

.lr.ph101.preheader.new:                          ; preds = %.lr.ph101.preheader
  %unroll_iter183 = and i64 %23, 2147483644
  br label %.lr.ph101

.lr.ph97:                                         ; preds = %.lr.ph97, %.lr.ph97.preheader.new
  %indvars.iv133 = phi i64 [ 1, %.lr.ph97.preheader.new ], [ %indvars.iv.next134.3, %.lr.ph97 ]
  %niter = phi i64 [ 0, %.lr.ph97.preheader.new ], [ %niter.next.3, %.lr.ph97 ]
  %25 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %indvars.iv133
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %28, align 4, !tbaa !5
  %indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1
  %31 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %indvars.iv.next134
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %34, align 4, !tbaa !5
  %indvars.iv.next134.1 = add nuw nsw i64 %indvars.iv133, 2
  %37 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %indvars.iv.next134.1
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %40, align 4, !tbaa !5
  %indvars.iv.next134.2 = add nuw nsw i64 %indvars.iv133, 3
  %43 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %indvars.iv.next134.2
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %46, align 4, !tbaa !5
  %indvars.iv.next134.3 = add nuw nsw i64 %indvars.iv133, 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 %.preheader86.loopexit.unr-lcssa, label %.lr.ph97, !llvm.loop !14

.preheader85.loopexit.unr-lcssa:                  ; preds = %.lr.ph101, %.lr.ph101.preheader
  %.unr = phi i32 [ %.pre, %.lr.ph101.preheader ], [ %75, %.lr.ph101 ]
  %indvars.iv136.unr = phi i64 [ 1, %.lr.ph101.preheader ], [ %indvars.iv.next137.3, %.lr.ph101 ]
  %lcmp.mod182.not = icmp eq i64 %xtraiter180, 0
  br i1 %lcmp.mod182.not, label %.preheader85, label %.lr.ph101.epil

.lr.ph101.epil:                                   ; preds = %.preheader85.loopexit.unr-lcssa, %.lr.ph101.epil
  %49 = phi i32 [ %52, %.lr.ph101.epil ], [ %.unr, %.preheader85.loopexit.unr-lcssa ]
  %indvars.iv136.epil = phi i64 [ %indvars.iv.next137.epil, %.lr.ph101.epil ], [ %indvars.iv136.unr, %.preheader85.loopexit.unr-lcssa ]
  %epil.iter181 = phi i64 [ %epil.iter181.next, %.lr.ph101.epil ], [ 0, %.preheader85.loopexit.unr-lcssa ]
  %50 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %indvars.iv136.epil
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = add nsw i32 %51, %49
  store i32 %52, ptr %50, align 4, !tbaa !5
  %indvars.iv.next137.epil = add nuw nsw i64 %indvars.iv136.epil, 1
  %epil.iter181.next = add i64 %epil.iter181, 1
  %epil.iter181.cmp.not = icmp eq i64 %epil.iter181.next, %xtraiter180
  br i1 %epil.iter181.cmp.not, label %.preheader85, label %.lr.ph101.epil, !llvm.loop !15

.preheader85:                                     ; preds = %.preheader85.loopexit.unr-lcssa, %.lr.ph101.epil, %.preheader86
  %53 = icmp sgt i32 %7, 0
  br i1 %53, label %.lr.ph103.preheader, label %._crit_edge

.lr.ph103.preheader:                              ; preds = %.preheader85
  %54 = zext nneg i32 %7 to i64
  %xtraiter185 = and i64 %54, 1
  %lcmp.mod186.not = icmp eq i64 %xtraiter185, 0
  br i1 %lcmp.mod186.not, label %.lr.ph103.prol.loopexit, label %.lr.ph103.prol

.lr.ph103.prol:                                   ; preds = %.lr.ph103.preheader
  %55 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = add nsw i32 %59, -1
  store i32 %60, ptr %58, align 4, !tbaa !5
  %61 = sext i32 %59 to i64
  %62 = getelementptr inbounds [2000003 x i32], ptr @ord, i64 0, i64 %61
  store i32 %7, ptr %62, align 4, !tbaa !5
  %indvars.iv.next142.prol = add nsw i64 %54, -1
  br label %.lr.ph103.prol.loopexit

.lr.ph103.prol.loopexit:                          ; preds = %.lr.ph103.prol, %.lr.ph103.preheader
  %indvars.iv141.unr = phi i64 [ %54, %.lr.ph103.preheader ], [ %indvars.iv.next142.prol, %.lr.ph103.prol ]
  %cond = icmp eq i32 %7, 1
  br i1 %cond, label %._crit_edge, label %.lr.ph103

.lr.ph101:                                        ; preds = %.lr.ph101, %.lr.ph101.preheader.new
  %63 = phi i32 [ %.pre, %.lr.ph101.preheader.new ], [ %75, %.lr.ph101 ]
  %indvars.iv136 = phi i64 [ 1, %.lr.ph101.preheader.new ], [ %indvars.iv.next137.3, %.lr.ph101 ]
  %niter184 = phi i64 [ 0, %.lr.ph101.preheader.new ], [ %niter184.next.3, %.lr.ph101 ]
  %64 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %indvars.iv136
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = add nsw i32 %65, %63
  store i32 %66, ptr %64, align 4, !tbaa !5
  %indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
  %67 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %indvars.iv.next137
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = add nsw i32 %68, %66
  store i32 %69, ptr %67, align 4, !tbaa !5
  %indvars.iv.next137.1 = add nuw nsw i64 %indvars.iv136, 2
  %70 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %indvars.iv.next137.1
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = add nsw i32 %71, %69
  store i32 %72, ptr %70, align 4, !tbaa !5
  %indvars.iv.next137.2 = add nuw nsw i64 %indvars.iv136, 3
  %73 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %indvars.iv.next137.2
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = add nsw i32 %74, %72
  store i32 %75, ptr %73, align 4, !tbaa !5
  %indvars.iv.next137.3 = add nuw nsw i64 %indvars.iv136, 4
  %niter184.next.3 = add i64 %niter184, 4
  %niter184.ncmp.3 = icmp eq i64 %niter184.next.3, %unroll_iter183
  br i1 %niter184.ncmp.3, label %.preheader85.loopexit.unr-lcssa, label %.lr.ph101, !llvm.loop !16

.preheader84:                                     ; preds = %.lr.ph103
  %.not = icmp eq i32 %7, 1
  br i1 %.not, label %._crit_edge, label %.lr.ph105.preheader

.lr.ph105.preheader:                              ; preds = %.preheader84
  %76 = zext nneg i32 %7 to i64
  br label %.lr.ph105

.lr.ph103:                                        ; preds = %.lr.ph103.prol.loopexit, %.lr.ph103
  %indvars.iv141 = phi i64 [ %indvars.iv.next142.1, %.lr.ph103 ], [ %indvars.iv141.unr, %.lr.ph103.prol.loopexit ]
  %77 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %indvars.iv141
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = add nsw i32 %81, -1
  store i32 %82, ptr %80, align 4, !tbaa !5
  %83 = sext i32 %81 to i64
  %84 = getelementptr inbounds [2000003 x i32], ptr @ord, i64 0, i64 %83
  %85 = trunc nuw nsw i64 %indvars.iv141 to i32
  store i32 %85, ptr %84, align 4, !tbaa !5
  %indvars.iv.next142 = add nsw i64 %indvars.iv141, -1
  %86 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %indvars.iv.next142
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = add nsw i32 %90, -1
  store i32 %91, ptr %89, align 4, !tbaa !5
  %92 = sext i32 %90 to i64
  %93 = getelementptr inbounds [2000003 x i32], ptr @ord, i64 0, i64 %92
  %94 = trunc nuw nsw i64 %indvars.iv.next142 to i32
  store i32 %94, ptr %93, align 4, !tbaa !5
  %indvars.iv.next142.1 = add nsw i64 %indvars.iv141, -2
  %95 = icmp ugt i64 %indvars.iv.next142, 1
  br i1 %95, label %.lr.ph103, label %.preheader84, !llvm.loop !17

._crit_edge:                                      ; preds = %.lr.ph103.prol.loopexit, %.lr.ph105, %.preheader85, %.preheader84
  %96 = sext i32 %7 to i64
  %97 = shl nsw i64 %96, 2
  tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @ctr, i64 4), i8 0, i64 %97, i1 false)
  %98 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @m)
  %99 = load i32, ptr @m, align 4, !tbaa !5
  %.not75120 = icmp slt i32 %99, 1
  br i1 %.not75120, label %._crit_edge124, label %.lr.ph123

.lr.ph105:                                        ; preds = %.lr.ph105.preheader, %.lr.ph105
  %indvars.iv144 = phi i64 [ %76, %.lr.ph105.preheader ], [ %indvars.iv.next145, %.lr.ph105 ]
  %100 = getelementptr inbounds [2000003 x i32], ptr @ord, i64 0, i64 %indvars.iv144
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [2000003 x i32], ptr @sz, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = getelementptr inbounds [2000003 x i32], ptr @par, i64 0, i64 %102
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [2000003 x i32], ptr @sz, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = add nsw i32 %109, %104
  store i32 %110, ptr %108, align 4, !tbaa !5
  %indvars.iv.next145 = add nsw i64 %indvars.iv144, -1
  %111 = icmp ugt i64 %indvars.iv144, 2
  br i1 %111, label %.lr.ph105, label %._crit_edge, !llvm.loop !18

._crit_edge124:                                   ; preds = %._crit_edge118, %._crit_edge
  ret i32 0

.lr.ph123:                                        ; preds = %._crit_edge, %._crit_edge118
  %.068121 = phi i32 [ %119, %._crit_edge118 ], [ 1, %._crit_edge ]
  %112 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @buf)
  %113 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @buf) #6
  %114 = trunc i64 %113 to i32
  %115 = icmp sgt i32 %114, 0
  br i1 %115, label %.lr.ph117, label %._crit_edge118

.lr.ph117:                                        ; preds = %.lr.ph123
  %116 = shl nuw i32 %114, 1
  %117 = load i32, ptr @rt, align 4
  %smax = tail call i32 @llvm.smax.i32(i32 %116, i32 1)
  br label %121

._crit_edge118:                                   ; preds = %.critedge83, %.lr.ph123
  %.059.lcssa = phi i32 [ 0, %.lr.ph123 ], [ %.1155, %.critedge83 ]
  %118 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.059.lcssa)
  %119 = add nuw nsw i32 %.068121, 1
  %120 = load i32, ptr @m, align 4, !tbaa !5
  %.not75.not = icmp slt i32 %.068121, %120
  br i1 %.not75.not, label %.lr.ph123, label %._crit_edge124, !llvm.loop !19

121:                                              ; preds = %.lr.ph117, %.critedge83
  %.058115 = phi i32 [ 0, %.lr.ph117 ], [ %155, %.critedge83 ]
  %.059114 = phi i32 [ 0, %.lr.ph117 ], [ %.1155, %.critedge83 ]
  %.060113 = phi i32 [ 0, %.lr.ph117 ], [ %.4, %.critedge83 ]
  %.062.in112 = phi ptr [ @rt, %.lr.ph117 ], [ %.466.in, %.critedge83 ]
  %.062 = load i32, ptr %.062.in112, align 4, !tbaa !5
  %.not76 = icmp slt i32 %.058115, %114
  %.not77 = icmp slt i32 %.060113, %114
  %or.cond = select i1 %.not76, i1 true, i1 %.not77
  br i1 %or.cond, label %.critedge82, label %.preheader

.preheader:                                       ; preds = %121, %122
  %.163 = phi i32 [ %125, %122 ], [ %.062, %121 ]
  %.161 = phi i32 [ %128, %122 ], [ %.060113, %121 ]
  %.not78 = icmp eq i32 %.163, 0
  br i1 %.not78, label %.critedge82, label %122

122:                                              ; preds = %.preheader
  %123 = sext i32 %.163 to i64
  %124 = getelementptr inbounds [2000003 x i32], ptr @par, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %.not79 = icmp slt i32 %128, %114
  br i1 %.not79, label %.critedge, label %.preheader, !llvm.loop !20

.critedge:                                        ; preds = %122
  %129 = getelementptr inbounds [1000001 x i32], ptr @ctr, i64 0, i64 %123
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = icmp slt i32 %130, %.068121
  br i1 %131, label %132, label %.critedge82.thread

132:                                              ; preds = %.critedge
  %133 = getelementptr inbounds [2000003 x i32], ptr @sz, i64 0, i64 %123
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = add nsw i32 %134, %.059114
  store i32 %.068121, ptr %129, align 4, !tbaa !5
  br label %.critedge82.thread

.critedge82.thread:                               ; preds = %132, %.critedge
  %.1.ph = phi i32 [ %.059114, %.critedge ], [ %135, %132 ]
  %136 = select i1 %.not76, i32 0, i32 %114
  br label %.lr.ph110.preheader

.critedge82:                                      ; preds = %.preheader, %121
  %.264 = phi i32 [ %.062, %121 ], [ %117, %.preheader ]
  %.2 = phi i32 [ %.060113, %121 ], [ %.161, %.preheader ]
  %137 = select i1 %.not76, i32 0, i32 %114
  %.not80106 = icmp eq i32 %.264, 0
  br i1 %.not80106, label %.critedge83, label %.lr.ph110.preheader

.lr.ph110.preheader:                              ; preds = %.critedge82.thread, %.critedge82
  %.pn163 = phi i32 [ %136, %.critedge82.thread ], [ %137, %.critedge82 ]
  %.1154 = phi i32 [ %.1.ph, %.critedge82.thread ], [ %.059114, %.critedge82 ]
  %.2153 = phi i32 [ %.161, %.critedge82.thread ], [ %.2, %.critedge82 ]
  %.264152 = phi i32 [ %.163, %.critedge82.thread ], [ %.264, %.critedge82 ]
  %.pn.in = sub nsw i32 %.058115, %.pn163
  %.pn = sext i32 %.pn.in to i64
  %.in.in.in = getelementptr inbounds [1000001 x i8], ptr @buf, i64 0, i64 %.pn
  %.in.in = load i8, ptr %.in.in.in, align 1, !tbaa !9
  %.in = sext i8 %.in.in to i64
  %138 = add nsw i64 %.in, -97
  %139 = sext i32 %.264152 to i64
  %140 = getelementptr inbounds [2000003 x [27 x i32]], ptr @son, i64 0, i64 %139, i64 %138
  %141 = load i32, ptr %140, align 4, !tbaa !5
  %.not81171 = icmp eq i32 %141, 0
  br i1 %.not81171, label %.lr.ph172, label %.critedge2

.lr.ph110:                                        ; preds = %.lr.ph172
  %142 = sext i32 %147 to i64
  %143 = getelementptr inbounds [2000003 x [27 x i32]], ptr @son, i64 0, i64 %142, i64 %138
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %.not81 = icmp eq i32 %144, 0
  br i1 %.not81, label %.lr.ph172, label %.critedge2.loopexit, !llvm.loop !21

.lr.ph172:                                        ; preds = %.lr.ph110.preheader, %.lr.ph110
  %145 = phi i64 [ %142, %.lr.ph110 ], [ %139, %.lr.ph110.preheader ]
  %146 = getelementptr inbounds [2000003 x i32], ptr @par, i64 0, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !5
  %.not80 = icmp eq i32 %147, 0
  br i1 %.not80, label %.critedge83.loopexit, label %.lr.ph110, !llvm.loop !21

.critedge2.loopexit:                              ; preds = %.lr.ph110
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %148
  %150 = load i32, ptr %149, align 4, !tbaa !5
  br label %.critedge2

.critedge2:                                       ; preds = %.critedge2.loopexit, %.lr.ph110.preheader
  %.3108.lcssa = phi i32 [ %.2153, %.lr.ph110.preheader ], [ %150, %.critedge2.loopexit ]
  %.lcssa166 = phi ptr [ %140, %.lr.ph110.preheader ], [ %143, %.critedge2.loopexit ]
  %151 = add nsw i32 %.3108.lcssa, 1
  br label %.critedge83

.critedge83.loopexit:                             ; preds = %.lr.ph172
  %152 = sext i32 %147 to i64
  %153 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !5
  br label %.critedge83

.critedge83:                                      ; preds = %.critedge83.loopexit, %.critedge82, %.critedge2
  %.1155 = phi i32 [ %.1154, %.critedge2 ], [ %.059114, %.critedge82 ], [ %.1154, %.critedge83.loopexit ]
  %.466.in = phi ptr [ %.lcssa166, %.critedge2 ], [ @rt, %.critedge82 ], [ @rt, %.critedge83.loopexit ]
  %.4 = phi i32 [ %151, %.critedge2 ], [ %.2, %.critedge82 ], [ %154, %.critedge83.loopexit ]
  %155 = add nuw nsw i32 %.058115, 1
  %exitcond147.not = icmp eq i32 %155, %smax
  br i1 %exitcond147.not, label %._crit_edge118, label %121, !llvm.loop !22
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #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 nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { 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 #3 = { 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 #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 willreturn memory(read) }

!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, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}
!21 = distinct !{!21, !11}
!22 = distinct !{!22, !11}


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