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

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

%struct.Trie = type { i32, [26 x i32] }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@rt = external dso_local global [100001 x i32], align 16
@pw1 = external dso_local global [600001 x i32], align 16
@pw2 = external dso_local global [600001 x i32], align 16
@buf = external dso_local global [600001 x i8], align 16
@pos = external dso_local global [100001 x ptr], align 16
@tail = external dso_local global ptr, align 8
@pre = external dso_local global [600001 x i8], align 16
@suf = external dso_local global [600001 x i8], align 16
@hh = external dso_local global [100001 x i64], align 16
@preh = external dso_local global [600001 x i64], align 16
@sufh = external dso_local global [600001 x i64], align 16
@e = external dso_local global [600001 x %struct.Trie], align 16
@length = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpRKPcS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4cmp2RKPcS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #0

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i64, align 8
  %25 = alloca i64, align 8
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  store i32 1, ptr @pw2, align 16, !tbaa !5
  store i32 1, ptr @pw1, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %59, %0
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = icmp slt i32 %31, 600001
  br i1 %32, label %34, label %33

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

34:                                               ; preds = %30
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = sub nsw i32 %35, 1
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [600001 x i32], ptr @pw1, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = mul nsw i64 27, %40
  %42 = srem i64 %41, 985661441
  %43 = trunc i64 %42 to i32
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [600001 x i32], ptr @pw1, i64 0, i64 %45
  store i32 %43, ptr %46, align 4, !tbaa !5
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = sub nsw i32 %47, 1
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [600001 x i32], ptr @pw2, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = mul nsw i64 27, %52
  %54 = srem i64 %53, 998244353
  %55 = trunc i64 %54 to i32
  %56 = load i32, ptr %2, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [600001 x i32], ptr @pw2, i64 0, i64 %57
  store i32 %55, ptr %58, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %34
  %60 = load i32, ptr %2, align 4, !tbaa !5
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %2, align 4, !tbaa !5
  br label %30, !llvm.loop !9

62:                                               ; preds = %33
  %63 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %64

64:                                               ; preds = %509, %62
  %65 = load i32, ptr @t, align 4, !tbaa !5
  %66 = add nsw i32 %65, -1
  store i32 %66, ptr @t, align 4, !tbaa !5
  %67 = icmp ne i32 %65, 0
  br i1 %67, label %68, label %510

68:                                               ; preds = %64
  %69 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @q)
  store ptr @buf, ptr @tail, align 8, !tbaa !11
  %70 = load ptr, ptr @tail, align 8, !tbaa !11
  %71 = getelementptr inbounds i8, ptr %70, i32 1
  store ptr %71, ptr @tail, align 8, !tbaa !11
  store i8 0, ptr %70, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %72

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

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

77:                                               ; preds = %72
  %78 = load ptr, ptr @tail, align 8, !tbaa !11
  %79 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %78)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 0, ptr %5, align 4, !tbaa !5
  %80 = load ptr, ptr @tail, align 8, !tbaa !11
  %81 = load i32, ptr %3, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [100001 x ptr], ptr @pos, i64 0, i64 %82
  store ptr %80, ptr %83, align 8, !tbaa !11
  br label %84

84:                                               ; preds = %111, %77
  %85 = load ptr, ptr @tail, align 8, !tbaa !11
  %86 = load i8, ptr %85, align 1, !tbaa !13
  %87 = icmp ne i8 %86, 0
  br i1 %87, label %88, label %114

88:                                               ; preds = %84
  %89 = load i32, ptr %4, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = mul nsw i64 %90, 27
  %92 = load ptr, ptr @tail, align 8, !tbaa !11
  %93 = load i8, ptr %92, align 1, !tbaa !13
  %94 = sext i8 %93 to i64
  %95 = add nsw i64 %91, %94
  %96 = sub nsw i64 %95, 97
  %97 = add nsw i64 %96, 1
  %98 = srem i64 %97, 985661441
  %99 = trunc i64 %98 to i32
  store i32 %99, ptr %4, align 4, !tbaa !5
  %100 = load i32, ptr %5, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = mul nsw i64 %101, 27
  %103 = load ptr, ptr @tail, align 8, !tbaa !11
  %104 = load i8, ptr %103, align 1, !tbaa !13
  %105 = sext i8 %104 to i64
  %106 = add nsw i64 %102, %105
  %107 = sub nsw i64 %106, 97
  %108 = add nsw i64 %107, 1
  %109 = srem i64 %108, 998244353
  %110 = trunc i64 %109 to i32
  store i32 %110, ptr %5, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %88
  %112 = load ptr, ptr @tail, align 8, !tbaa !11
  %113 = getelementptr inbounds i8, ptr %112, i32 1
  store ptr %113, ptr @tail, align 8, !tbaa !11
  br label %84, !llvm.loop !14

114:                                              ; preds = %84
  %115 = load i32, ptr %4, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = shl i64 %116, 32
  %118 = load i32, ptr %5, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = or i64 %117, %119
  %121 = load i32, ptr %3, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [100001 x i64], ptr @hh, i64 0, i64 %122
  store i64 %120, ptr %123, align 8, !tbaa !15
  %124 = load ptr, ptr @tail, align 8, !tbaa !11
  %125 = getelementptr inbounds i8, ptr %124, i32 1
  store ptr %125, ptr @tail, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %126

126:                                              ; preds = %114
  %127 = load i32, ptr %3, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %3, align 4, !tbaa !5
  br label %72, !llvm.loop !17

129:                                              ; preds = %76
  %130 = load i32, ptr @n, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds ptr, ptr @pos, i64 %131
  %133 = getelementptr inbounds ptr, ptr %132, i64 1
  call void @_ZSt4sortIPPcPFbRKS0_S3_EEvT_S6_T0_(ptr noundef getelementptr inbounds (ptr, ptr @pos, i64 1), ptr noundef %133, ptr noundef @_Z3cmpRKPcS1_)
  %134 = load i32, ptr @n, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds i64, ptr @hh, i64 %135
  %137 = getelementptr inbounds i64, ptr %136, i64 1
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef getelementptr inbounds (i64, ptr @hh, i64 1), ptr noundef %137)
  store i32 1, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %138

138:                                              ; preds = %166, %129
  %139 = load i32, ptr %6, align 4, !tbaa !5
  %140 = load i32, ptr @n, align 4, !tbaa !5
  %141 = icmp sle i32 %139, %140
  br i1 %141, label %143, label %142

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

143:                                              ; preds = %138
  %144 = load i32, ptr %6, align 4, !tbaa !5
  %145 = sub nsw i32 %144, 1
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [100001 x i32], ptr @rt, i64 0, i64 %146
  %148 = load i32, ptr %147, align 4, !tbaa !5
  %149 = load i32, ptr %6, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [100001 x i32], ptr @rt, i64 0, i64 %150
  store i32 %148, ptr %151, align 4, !tbaa !5
  %152 = load i32, ptr %6, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [100001 x i32], ptr @rt, i64 0, i64 %153
  %155 = load i32, ptr %6, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [100001 x ptr], ptr @pos, i64 0, i64 %156
  %158 = load ptr, ptr %157, align 8, !tbaa !11
  %159 = load i32, ptr %6, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [100001 x ptr], ptr @pos, i64 0, i64 %160
  %162 = load ptr, ptr %161, align 8, !tbaa !11
  %163 = call i64 @strlen(ptr noundef %162) #8
  %164 = getelementptr inbounds i8, ptr %158, i64 %163
  %165 = getelementptr inbounds i8, ptr %164, i64 -1
  call void @_Z5buildRiPc(ptr noundef nonnull align 4 dereferenceable(4) %154, ptr noundef %165)
  br label %166

166:                                              ; preds = %143
  %167 = load i32, ptr %6, align 4, !tbaa !5
  %168 = add nsw i32 %167, 1
  store i32 %168, ptr %6, align 4, !tbaa !5
  br label %138, !llvm.loop !18

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

170:                                              ; preds = %506, %169
  %171 = load i32, ptr %7, align 4, !tbaa !5
  %172 = load i32, ptr @q, align 4, !tbaa !5
  %173 = icmp sle i32 %171, %172
  br i1 %173, label %175, label %174

174:                                              ; preds = %170
  store i32 16, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %509

175:                                              ; preds = %170
  %176 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef getelementptr inbounds (i8, ptr @pre, i64 1), ptr noundef getelementptr inbounds (i8, ptr @suf, i64 1))
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %177 = call i64 @strlen(ptr noundef getelementptr inbounds (i8, ptr @pre, i64 1)) #8
  %178 = trunc i64 %177 to i32
  store i32 %178, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %179 = call i64 @strlen(ptr noundef getelementptr inbounds (i8, ptr @suf, i64 1)) #8
  %180 = trunc i64 %179 to i32
  store i32 %180, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %181 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %181, ptr @length, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %182 = load i32, ptr @n, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds ptr, ptr @pos, i64 %183
  %185 = getelementptr inbounds ptr, ptr %184, i64 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  store ptr getelementptr inbounds (i8, ptr @pre, i64 1), ptr %14, align 8, !tbaa !11
  %186 = call noundef ptr @_ZSt11lower_boundIPPcS0_PFbRKS0_S3_EET_S6_S6_RKT0_T1_(ptr noundef getelementptr inbounds (ptr, ptr @pos, i64 1), ptr noundef %185, ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef @_Z4cmp2RKPcS1_)
  %187 = ptrtoint ptr %186 to i64
  %188 = sub i64 %187, ptrtoint (ptr @pos to i64)
  %189 = sdiv exact i64 %188, 8
  %190 = trunc i64 %189 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  store i32 %190, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %191 = load i32, ptr @n, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds ptr, ptr @pos, i64 %192
  %194 = getelementptr inbounds ptr, ptr %193, i64 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  store ptr getelementptr inbounds (i8, ptr @pre, i64 1), ptr %16, align 8, !tbaa !11
  %195 = call noundef ptr @_ZSt11upper_boundIPPcS0_PFbRKS0_S3_EET_S6_S6_RKT0_T1_(ptr noundef getelementptr inbounds (ptr, ptr @pos, i64 1), ptr noundef %194, ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef @_Z4cmp2RKPcS1_)
  %196 = ptrtoint ptr %195 to i64
  %197 = sub i64 %196, ptrtoint (ptr @pos to i64)
  %198 = sdiv exact i64 %197, 8
  %199 = trunc i64 %198 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  store i32 %199, ptr %15, align 4, !tbaa !5
  %200 = load i32, ptr %13, align 4, !tbaa !5
  %201 = load i32, ptr %15, align 4, !tbaa !5
  %202 = icmp sge i32 %200, %201
  br i1 %202, label %203, label %205

203:                                              ; preds = %175
  %204 = call i32 @puts(ptr noundef @.str.4)
  store i32 18, ptr %8, align 4
  br label %503

205:                                              ; preds = %175
  store i32 0, ptr %12, align 4, !tbaa !5
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 1, ptr %17, align 4, !tbaa !5
  br label %206

206:                                              ; preds = %247, %205
  %207 = load i32, ptr %17, align 4, !tbaa !5
  %208 = load i32, ptr %9, align 4, !tbaa !5
  %209 = icmp sle i32 %207, %208
  br i1 %209, label %211, label %210

210:                                              ; preds = %206
  store i32 19, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %250

211:                                              ; preds = %206
  %212 = load i32, ptr %11, align 4, !tbaa !5
  %213 = sext i32 %212 to i64
  %214 = mul nsw i64 %213, 27
  %215 = load i32, ptr %17, align 4, !tbaa !5
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [600001 x i8], ptr @pre, i64 0, i64 %216
  %218 = load i8, ptr %217, align 1, !tbaa !13
  %219 = sext i8 %218 to i64
  %220 = add nsw i64 %214, %219
  %221 = sub nsw i64 %220, 97
  %222 = add nsw i64 %221, 1
  %223 = srem i64 %222, 985661441
  %224 = trunc i64 %223 to i32
  store i32 %224, ptr %11, align 4, !tbaa !5
  %225 = load i32, ptr %12, align 4, !tbaa !5
  %226 = sext i32 %225 to i64
  %227 = mul nsw i64 %226, 27
  %228 = load i32, ptr %17, align 4, !tbaa !5
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [600001 x i8], ptr @pre, i64 0, i64 %229
  %231 = load i8, ptr %230, align 1, !tbaa !13
  %232 = sext i8 %231 to i64
  %233 = add nsw i64 %227, %232
  %234 = sub nsw i64 %233, 97
  %235 = add nsw i64 %234, 1
  %236 = srem i64 %235, 998244353
  %237 = trunc i64 %236 to i32
  store i32 %237, ptr %12, align 4, !tbaa !5
  %238 = load i32, ptr %11, align 4, !tbaa !5
  %239 = sext i32 %238 to i64
  %240 = shl i64 %239, 32
  %241 = load i32, ptr %12, align 4, !tbaa !5
  %242 = sext i32 %241 to i64
  %243 = or i64 %240, %242
  %244 = load i32, ptr %17, align 4, !tbaa !5
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds [600001 x i64], ptr @preh, i64 0, i64 %245
  store i64 %243, ptr %246, align 8, !tbaa !15
  br label %247

247:                                              ; preds = %211
  %248 = load i32, ptr %17, align 4, !tbaa !5
  %249 = add nsw i32 %248, 1
  store i32 %249, ptr %17, align 4, !tbaa !5
  br label %206, !llvm.loop !19

250:                                              ; preds = %210
  store i32 0, ptr %12, align 4, !tbaa !5
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  store i32 1, ptr %18, align 4, !tbaa !5
  br label %251

251:                                              ; preds = %292, %250
  %252 = load i32, ptr %18, align 4, !tbaa !5
  %253 = load i32, ptr %10, align 4, !tbaa !5
  %254 = icmp sle i32 %252, %253
  br i1 %254, label %256, label %255

255:                                              ; preds = %251
  store i32 22, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  br label %295

256:                                              ; preds = %251
  %257 = load i32, ptr %11, align 4, !tbaa !5
  %258 = sext i32 %257 to i64
  %259 = mul nsw i64 %258, 27
  %260 = load i32, ptr %18, align 4, !tbaa !5
  %261 = sext i32 %260 to i64
  %262 = getelementptr inbounds [600001 x i8], ptr @suf, i64 0, i64 %261
  %263 = load i8, ptr %262, align 1, !tbaa !13
  %264 = sext i8 %263 to i64
  %265 = add nsw i64 %259, %264
  %266 = sub nsw i64 %265, 97
  %267 = add nsw i64 %266, 1
  %268 = srem i64 %267, 985661441
  %269 = trunc i64 %268 to i32
  store i32 %269, ptr %11, align 4, !tbaa !5
  %270 = load i32, ptr %12, align 4, !tbaa !5
  %271 = sext i32 %270 to i64
  %272 = mul nsw i64 %271, 27
  %273 = load i32, ptr %18, align 4, !tbaa !5
  %274 = sext i32 %273 to i64
  %275 = getelementptr inbounds [600001 x i8], ptr @suf, i64 0, i64 %274
  %276 = load i8, ptr %275, align 1, !tbaa !13
  %277 = sext i8 %276 to i64
  %278 = add nsw i64 %272, %277
  %279 = sub nsw i64 %278, 97
  %280 = add nsw i64 %279, 1
  %281 = srem i64 %280, 998244353
  %282 = trunc i64 %281 to i32
  store i32 %282, ptr %12, align 4, !tbaa !5
  %283 = load i32, ptr %11, align 4, !tbaa !5
  %284 = sext i32 %283 to i64
  %285 = shl i64 %284, 32
  %286 = load i32, ptr %12, align 4, !tbaa !5
  %287 = sext i32 %286 to i64
  %288 = or i64 %285, %287
  %289 = load i32, ptr %18, align 4, !tbaa !5
  %290 = sext i32 %289 to i64
  %291 = getelementptr inbounds [600001 x i64], ptr @sufh, i64 0, i64 %290
  store i64 %288, ptr %291, align 8, !tbaa !15
  br label %292

292:                                              ; preds = %256
  %293 = load i32, ptr %18, align 4, !tbaa !5
  %294 = add nsw i32 %293, 1
  store i32 %294, ptr %18, align 4, !tbaa !5
  br label %251, !llvm.loop !20

295:                                              ; preds = %255
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  %296 = load i32, ptr %13, align 4, !tbaa !5
  %297 = sub nsw i32 %296, 1
  %298 = sext i32 %297 to i64
  %299 = getelementptr inbounds [100001 x i32], ptr @rt, i64 0, i64 %298
  %300 = load i32, ptr %299, align 4, !tbaa !5
  store i32 %300, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  %301 = load i32, ptr %15, align 4, !tbaa !5
  %302 = sub nsw i32 %301, 1
  %303 = sext i32 %302 to i64
  %304 = getelementptr inbounds [100001 x i32], ptr @rt, i64 0, i64 %303
  %305 = load i32, ptr %304, align 4, !tbaa !5
  store i32 %305, ptr %20, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %306 = load i32, ptr %10, align 4, !tbaa !5
  %307 = sext i32 %306 to i64
  %308 = getelementptr inbounds i8, ptr @suf, i64 %307
  store ptr %308, ptr %21, align 8, !tbaa !11
  br label %309

309:                                              ; preds = %337, %295
  %310 = load ptr, ptr %21, align 8, !tbaa !11
  %311 = load i8, ptr %310, align 1, !tbaa !13
  %312 = icmp ne i8 %311, 0
  br i1 %312, label %314, label %313

313:                                              ; preds = %309
  store i32 25, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  br label %340

314:                                              ; preds = %309
  %315 = load i32, ptr %19, align 4, !tbaa !5
  %316 = sext i32 %315 to i64
  %317 = getelementptr inbounds [600001 x %struct.Trie], ptr @e, i64 0, i64 %316
  %318 = getelementptr inbounds %struct.Trie, ptr %317, i32 0, i32 1
  %319 = load ptr, ptr %21, align 8, !tbaa !11
  %320 = load i8, ptr %319, align 1, !tbaa !13
  %321 = sext i8 %320 to i32
  %322 = sub nsw i32 %321, 97
  %323 = sext i32 %322 to i64
  %324 = getelementptr inbounds [26 x i32], ptr %318, i64 0, i64 %323
  %325 = load i32, ptr %324, align 4, !tbaa !5
  store i32 %325, ptr %19, align 4, !tbaa !5
  %326 = load i32, ptr %20, align 4, !tbaa !5
  %327 = sext i32 %326 to i64
  %328 = getelementptr inbounds [600001 x %struct.Trie], ptr @e, i64 0, i64 %327
  %329 = getelementptr inbounds %struct.Trie, ptr %328, i32 0, i32 1
  %330 = load ptr, ptr %21, align 8, !tbaa !11
  %331 = load i8, ptr %330, align 1, !tbaa !13
  %332 = sext i8 %331 to i32
  %333 = sub nsw i32 %332, 97
  %334 = sext i32 %333 to i64
  %335 = getelementptr inbounds [26 x i32], ptr %329, i64 0, i64 %334
  %336 = load i32, ptr %335, align 4, !tbaa !5
  store i32 %336, ptr %20, align 4, !tbaa !5
  br label %337

337:                                              ; preds = %314
  %338 = load ptr, ptr %21, align 8, !tbaa !11
  %339 = getelementptr inbounds i8, ptr %338, i32 -1
  store ptr %339, ptr %21, align 8, !tbaa !11
  br label %309, !llvm.loop !21

340:                                              ; preds = %313
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  %341 = load i32, ptr %20, align 4, !tbaa !5
  %342 = sext i32 %341 to i64
  %343 = getelementptr inbounds [600001 x %struct.Trie], ptr @e, i64 0, i64 %342
  %344 = getelementptr inbounds %struct.Trie, ptr %343, i32 0, i32 0
  %345 = load i32, ptr %344, align 4, !tbaa !22
  %346 = load i32, ptr %19, align 4, !tbaa !5
  %347 = sext i32 %346 to i64
  %348 = getelementptr inbounds [600001 x %struct.Trie], ptr @e, i64 0, i64 %347
  %349 = getelementptr inbounds %struct.Trie, ptr %348, i32 0, i32 0
  %350 = load i32, ptr %349, align 4, !tbaa !22
  %351 = sub nsw i32 %345, %350
  store i32 %351, ptr %22, align 4, !tbaa !5
  %352 = load i32, ptr %22, align 4, !tbaa !5
  %353 = icmp ne i32 %352, 0
  br i1 %353, label %356, label %354

354:                                              ; preds = %340
  %355 = call i32 @puts(ptr noundef @.str.4)
  store i32 18, ptr %8, align 4
  br label %502

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

357:                                              ; preds = %496, %356
  %358 = load i32, ptr %23, align 4, !tbaa !5
  %359 = load i32, ptr %9, align 4, !tbaa !5
  %360 = icmp sle i32 %358, %359
  br i1 %360, label %361, label %365

361:                                              ; preds = %357
  %362 = load i32, ptr %23, align 4, !tbaa !5
  %363 = load i32, ptr %10, align 4, !tbaa !5
  %364 = icmp sle i32 %362, %363
  br label %365

365:                                              ; preds = %361, %357
  %366 = phi i1 [ false, %357 ], [ %364, %361 ]
  br i1 %366, label %368, label %367

367:                                              ; preds = %365
  store i32 28, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  br label %499

368:                                              ; preds = %365
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %369 = load i32, ptr %9, align 4, !tbaa !5
  %370 = load i32, ptr %23, align 4, !tbaa !5
  %371 = sub nsw i32 %369, %370
  %372 = sext i32 %371 to i64
  %373 = getelementptr inbounds [600001 x i64], ptr @preh, i64 0, i64 %372
  %374 = load i64, ptr %373, align 8, !tbaa !15
  store i64 %374, ptr %24, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  %375 = load i32, ptr %9, align 4, !tbaa !5
  %376 = sext i32 %375 to i64
  %377 = getelementptr inbounds [600001 x i64], ptr @preh, i64 0, i64 %376
  %378 = load i64, ptr %377, align 8, !tbaa !15
  store i64 %378, ptr %25, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #7
  %379 = load i64, ptr %25, align 8, !tbaa !15
  %380 = ashr i64 %379, 32
  %381 = load i32, ptr %23, align 4, !tbaa !5
  %382 = sext i32 %381 to i64
  %383 = getelementptr inbounds [600001 x i32], ptr @pw1, i64 0, i64 %382
  %384 = load i32, ptr %383, align 4, !tbaa !5
  %385 = sext i32 %384 to i64
  %386 = load i64, ptr %24, align 8, !tbaa !15
  %387 = ashr i64 %386, 32
  %388 = mul nsw i64 %385, %387
  %389 = sub nsw i64 %380, %388
  %390 = srem i64 %389, 985661441
  %391 = trunc i64 %390 to i32
  store i32 %391, ptr %26, align 4, !tbaa !5
  %392 = load i32, ptr %26, align 4, !tbaa !5
  %393 = icmp slt i32 %392, 0
  br i1 %393, label %394, label %398

394:                                              ; preds = %368
  %395 = load i32, ptr %26, align 4, !tbaa !5
  %396 = add nsw i32 %395, 985661441
  store i32 %396, ptr %26, align 4, !tbaa !5
  %397 = icmp ne i32 %396, 0
  br label %398

398:                                              ; preds = %394, %368
  %399 = phi i1 [ false, %368 ], [ %397, %394 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #7
  %400 = load i64, ptr %25, align 8, !tbaa !15
  %401 = and i64 %400, 4294967295
  %402 = load i32, ptr %23, align 4, !tbaa !5
  %403 = sext i32 %402 to i64
  %404 = getelementptr inbounds [600001 x i32], ptr @pw2, i64 0, i64 %403
  %405 = load i32, ptr %404, align 4, !tbaa !5
  %406 = sext i32 %405 to i64
  %407 = load i64, ptr %24, align 8, !tbaa !15
  %408 = and i64 %407, 4294967295
  %409 = mul nsw i64 %406, %408
  %410 = sub nsw i64 %401, %409
  %411 = srem i64 %410, 998244353
  %412 = trunc i64 %411 to i32
  store i32 %412, ptr %27, align 4, !tbaa !5
  %413 = load i32, ptr %27, align 4, !tbaa !5
  %414 = icmp slt i32 %413, 0
  br i1 %414, label %415, label %419

415:                                              ; preds = %398
  %416 = load i32, ptr %27, align 4, !tbaa !5
  %417 = add nsw i32 %416, 998244353
  store i32 %417, ptr %27, align 4, !tbaa !5
  %418 = icmp ne i32 %417, 0
  br label %419

419:                                              ; preds = %415, %398
  %420 = phi i1 [ false, %398 ], [ %418, %415 ]
  %421 = load i32, ptr %26, align 4, !tbaa !5
  %422 = sext i32 %421 to i64
  %423 = shl i64 %422, 32
  %424 = load i32, ptr %27, align 4, !tbaa !5
  %425 = sext i32 %424 to i64
  %426 = or i64 %423, %425
  %427 = load i32, ptr %23, align 4, !tbaa !5
  %428 = sext i32 %427 to i64
  %429 = getelementptr inbounds [600001 x i64], ptr @sufh, i64 0, i64 %428
  %430 = load i64, ptr %429, align 8, !tbaa !15
  %431 = icmp eq i64 %426, %430
  br i1 %431, label %432, label %495

432:                                              ; preds = %419
  %433 = load i32, ptr %10, align 4, !tbaa !5
  %434 = sext i32 %433 to i64
  %435 = getelementptr inbounds [600001 x i32], ptr @pw1, i64 0, i64 %434
  %436 = load i32, ptr %435, align 4, !tbaa !5
  %437 = sext i32 %436 to i64
  %438 = load i64, ptr %24, align 8, !tbaa !15
  %439 = ashr i64 %438, 32
  %440 = mul nsw i64 %437, %439
  %441 = load i32, ptr %10, align 4, !tbaa !5
  %442 = sext i32 %441 to i64
  %443 = getelementptr inbounds [600001 x i64], ptr @sufh, i64 0, i64 %442
  %444 = load i64, ptr %443, align 8, !tbaa !15
  %445 = ashr i64 %444, 32
  %446 = add nsw i64 %440, %445
  %447 = srem i64 %446, 985661441
  %448 = trunc i64 %447 to i32
  store i32 %448, ptr %26, align 4, !tbaa !5
  %449 = load i32, ptr %10, align 4, !tbaa !5
  %450 = sext i32 %449 to i64
  %451 = getelementptr inbounds [600001 x i32], ptr @pw2, i64 0, i64 %450
  %452 = load i32, ptr %451, align 4, !tbaa !5
  %453 = sext i32 %452 to i64
  %454 = load i64, ptr %24, align 8, !tbaa !15
  %455 = and i64 %454, 4294967295
  %456 = mul nsw i64 %453, %455
  %457 = load i32, ptr %10, align 4, !tbaa !5
  %458 = sext i32 %457 to i64
  %459 = getelementptr inbounds [600001 x i64], ptr @sufh, i64 0, i64 %458
  %460 = load i64, ptr %459, align 8, !tbaa !15
  %461 = and i64 %460, 4294967295
  %462 = add nsw i64 %456, %461
  %463 = srem i64 %462, 998244353
  %464 = trunc i64 %463 to i32
  store i32 %464, ptr %27, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #7
  %465 = load i32, ptr @n, align 4, !tbaa !5
  %466 = sext i32 %465 to i64
  %467 = getelementptr inbounds i64, ptr @hh, i64 %466
  %468 = getelementptr inbounds i64, ptr %467, i64 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #7
  %469 = load i32, ptr %26, align 4, !tbaa !5
  %470 = sext i32 %469 to i64
  %471 = shl i64 %470, 32
  %472 = load i32, ptr %27, align 4, !tbaa !5
  %473 = sext i32 %472 to i64
  %474 = or i64 %471, %473
  store i64 %474, ptr %29, align 8, !tbaa !15
  %475 = call noundef ptr @_ZSt11lower_boundIPxxET_S1_S1_RKT0_(ptr noundef getelementptr inbounds (i64, ptr @hh, i64 1), ptr noundef %468, ptr noundef nonnull align 8 dereferenceable(8) %29)
  %476 = ptrtoint ptr %475 to i64
  %477 = sub i64 %476, ptrtoint (ptr @hh to i64)
  %478 = sdiv exact i64 %477, 8
  %479 = trunc i64 %478 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #7
  store i32 %479, ptr %28, align 4, !tbaa !5
  %480 = load i32, ptr %28, align 4, !tbaa !5
  %481 = sext i32 %480 to i64
  %482 = getelementptr inbounds [100001 x i64], ptr @hh, i64 0, i64 %481
  %483 = load i64, ptr %482, align 8, !tbaa !15
  %484 = load i32, ptr %26, align 4, !tbaa !5
  %485 = sext i32 %484 to i64
  %486 = shl i64 %485, 32
  %487 = load i32, ptr %27, align 4, !tbaa !5
  %488 = sext i32 %487 to i64
  %489 = or i64 %486, %488
  %490 = icmp eq i64 %483, %489
  br i1 %490, label %491, label %494

491:                                              ; preds = %432
  %492 = load i32, ptr %22, align 4, !tbaa !5
  %493 = add nsw i32 %492, -1
  store i32 %493, ptr %22, align 4, !tbaa !5
  br label %494

494:                                              ; preds = %491, %432
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #7
  br label %495

495:                                              ; preds = %494, %419
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  br label %496

496:                                              ; preds = %495
  %497 = load i32, ptr %23, align 4, !tbaa !5
  %498 = add nsw i32 %497, 1
  store i32 %498, ptr %23, align 4, !tbaa !5
  br label %357, !llvm.loop !24

499:                                              ; preds = %367
  %500 = load i32, ptr %22, align 4, !tbaa !5
  %501 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %500)
  store i32 0, ptr %8, align 4
  br label %502

502:                                              ; preds = %499, %354
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %503

503:                                              ; preds = %502, %203
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  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
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  %504 = load i32, ptr %8, align 4
  switch i32 %504, label %511 [
    i32 0, label %505
    i32 18, label %506
  ]

505:                                              ; preds = %503
  br label %506

506:                                              ; preds = %505, %503
  %507 = load i32, ptr %7, align 4, !tbaa !5
  %508 = add nsw i32 %507, 1
  store i32 %508, ptr %7, align 4, !tbaa !5
  br label %170, !llvm.loop !25

509:                                              ; preds = %174
  br label %64, !llvm.loop !26

510:                                              ; preds = %64
  ret i32 0

511:                                              ; preds = %503
  unreachable
}

; 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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPPcPFbRKS0_S3_EEvT_S6_T0_(ptr noundef, ptr noundef, ptr noundef) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) #5

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

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

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

declare i32 @puts(ptr noundef) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPxxET_S1_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(8)) #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 = { 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 #2 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind 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 #7 = { nounwind }
attributes #8 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !7, i64 0}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = !{!23, !6, i64 0}
!23 = !{!"_ZTS4Trie", !6, i64 0, !7, i64 4}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !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"

%struct.Trie = type { i32, [26 x i32] }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@rt = external dso_local global [100001 x i32], align 16
@pw1 = external dso_local local_unnamed_addr global [600001 x i32], align 16
@pw2 = external dso_local local_unnamed_addr global [600001 x i32], align 16
@buf = external dso_local global [600001 x i8], align 16
@pos = external dso_local global [100001 x ptr], align 16
@tail = external dso_local local_unnamed_addr global ptr, align 8
@pre = external dso_local global [600001 x i8], align 16
@suf = external dso_local global [600001 x i8], align 16
@hh = external dso_local global [100001 x i64], align 16
@preh = external dso_local local_unnamed_addr global [600001 x i64], align 16
@sufh = external dso_local local_unnamed_addr global [600001 x i64], align 16
@e = external dso_local local_unnamed_addr global [600001 x %struct.Trie], align 16
@length = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpRKPcS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4cmp2RKPcS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #0

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  store i32 1, ptr @pw2, align 16, !tbaa !5
  store i32 1, ptr @pw1, align 16, !tbaa !5
  br label %8

4:                                                ; preds = %8
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %6 = load i32, ptr @t, align 4, !tbaa !5
  %7 = add nsw i32 %6, -1
  store i32 %7, ptr @t, align 4, !tbaa !5
  %.not189 = icmp eq i32 %6, 0
  br i1 %.not189, label %._crit_edge192, label %.lr.ph191

8:                                                ; preds = %0, %8
  %9 = phi i64 [ 1, %0 ], [ %16, %8 ]
  %10 = phi i64 [ 1, %0 ], [ %12, %8 ]
  %indvars.iv = phi i64 [ 1, %0 ], [ %indvars.iv.next, %8 ]
  %11 = mul nsw i64 %10, 27
  %12 = srem i64 %11, 985661441
  %13 = trunc nsw i64 %12 to i32
  %14 = getelementptr inbounds [600001 x i32], ptr @pw1, i64 0, i64 %indvars.iv
  store i32 %13, ptr %14, align 4, !tbaa !5
  %15 = mul nsw i64 %9, 27
  %16 = srem i64 %15, 998244353
  %17 = trunc nsw i64 %16 to i32
  %18 = getelementptr inbounds [600001 x i32], ptr @pw2, i64 0, i64 %indvars.iv
  store i32 %17, ptr %18, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 600001
  br i1 %exitcond.not, label %4, label %8, !llvm.loop !9

.loopexit:                                        ; preds = %205, %.preheader137
  %19 = load i32, ptr @t, align 4, !tbaa !5
  %20 = add nsw i32 %19, -1
  store i32 %20, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %19, 0
  br i1 %.not, label %._crit_edge192, label %.lr.ph191, !llvm.loop !11

.lr.ph191:                                        ; preds = %4, %.loopexit
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @q)
  store ptr getelementptr inbounds (i8, ptr @buf, i64 1), ptr @tail, align 8, !tbaa !12
  store i8 0, ptr @buf, align 16, !tbaa !14
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %.not121145 = icmp slt i32 %22, 1
  br i1 %.not121145, label %.lr.ph191.._crit_edge149_crit_edge, label %.lr.ph148

.lr.ph191.._crit_edge149_crit_edge:               ; preds = %.lr.ph191
  %.pre = sext i32 %22 to i64
  br label %._crit_edge149

._crit_edge149:                                   ; preds = %._crit_edge, %.lr.ph191.._crit_edge149_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.lr.ph191.._crit_edge149_crit_edge ], [ %48, %._crit_edge ]
  %gep187 = getelementptr ptr, ptr getelementptr inbounds (i8, ptr @pos, i64 8), i64 %.pre-phi
  call void @_ZSt4sortIPPcPFbRKS0_S3_EEvT_S6_T0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @pos, i64 8), ptr noundef nonnull %gep187, ptr noundef nonnull @_Z3cmpRKPcS1_)
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %gep188 = getelementptr i64, ptr getelementptr inbounds (i8, ptr @hh, i64 8), i64 %24
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @hh, i64 8), ptr noundef nonnull %gep188)
  store i32 1, ptr @tot, align 4, !tbaa !5
  %25 = load i32, ptr @n, align 4, !tbaa !5
  %.not122151 = icmp slt i32 %25, 1
  br i1 %.not122151, label %.preheader137, label %.lr.ph154

.lr.ph148:                                        ; preds = %.lr.ph191, %._crit_edge
  %26 = phi ptr [ %46, %._crit_edge ], [ getelementptr inbounds (i8, ptr @buf, i64 1), %.lr.ph191 ]
  %indvars.iv202 = phi i64 [ %indvars.iv.next203, %._crit_edge ], [ 1, %.lr.ph191 ]
  %27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %26)
  %28 = load ptr, ptr @tail, align 8, !tbaa !12
  %29 = getelementptr inbounds [100001 x ptr], ptr @pos, i64 0, i64 %indvars.iv202
  store ptr %28, ptr %29, align 8, !tbaa !12
  %30 = load i8, ptr %28, align 1, !tbaa !14
  %.not133140 = icmp eq i8 %30, 0
  br i1 %.not133140, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph148, %.lr.ph
  %31 = phi i8 [ %42, %.lr.ph ], [ %30, %.lr.ph148 ]
  %.094142 = phi i64 [ %37, %.lr.ph ], [ 0, %.lr.ph148 ]
  %.0102141 = phi i64 [ %40, %.lr.ph ], [ 0, %.lr.ph148 ]
  %32 = phi ptr [ %41, %.lr.ph ], [ %28, %.lr.ph148 ]
  %33 = mul nsw i64 %.094142, 27
  %34 = sext i8 %31 to i64
  %35 = add nsw i64 %34, -96
  %36 = add nsw i64 %35, %33
  %37 = srem i64 %36, 985661441
  %38 = mul nsw i64 %.0102141, 27
  %39 = add nsw i64 %35, %38
  %40 = srem i64 %39, 998244353
  %41 = getelementptr inbounds i8, ptr %32, i64 1
  store ptr %41, ptr @tail, align 8, !tbaa !12
  %42 = load i8, ptr %41, align 1, !tbaa !14
  %.not133 = icmp eq i8 %42, 0
  br i1 %.not133, label %._crit_edge, label %.lr.ph, !llvm.loop !15

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph148
  %.0102.lcssa = phi i64 [ 0, %.lr.ph148 ], [ %40, %.lr.ph ]
  %.094.lcssa = phi i64 [ 0, %.lr.ph148 ], [ %37, %.lr.ph ]
  %.lcssa = phi ptr [ %28, %.lr.ph148 ], [ %41, %.lr.ph ]
  %43 = shl nsw i64 %.094.lcssa, 32
  %44 = or i64 %43, %.0102.lcssa
  %45 = getelementptr inbounds [100001 x i64], ptr @hh, i64 0, i64 %indvars.iv202
  store i64 %44, ptr %45, align 8, !tbaa !16
  %46 = getelementptr inbounds i8, ptr %.lcssa, i64 1
  store ptr %46, ptr @tail, align 8, !tbaa !12
  %indvars.iv.next203 = add nuw nsw i64 %indvars.iv202, 1
  %47 = load i32, ptr @n, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %.not121.not = icmp slt i64 %indvars.iv202, %48
  br i1 %.not121.not, label %.lr.ph148, label %._crit_edge149, !llvm.loop !18

.preheader137:                                    ; preds = %.lr.ph154, %._crit_edge149
  %49 = load i32, ptr @q, align 4, !tbaa !5
  %.not123184 = icmp slt i32 %49, 1
  br i1 %.not123184, label %.loopexit, label %.lr.ph186

.lr.ph154:                                        ; preds = %._crit_edge149, %.lr.ph154
  %indvars.iv205 = phi i64 [ %indvars.iv.next206, %.lr.ph154 ], [ 1, %._crit_edge149 ]
  %50 = add nsw i64 %indvars.iv205, -1
  %51 = getelementptr inbounds [100001 x i32], ptr @rt, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = getelementptr inbounds [100001 x i32], ptr @rt, i64 0, i64 %indvars.iv205
  store i32 %52, ptr %53, align 4, !tbaa !5
  %54 = getelementptr inbounds [100001 x ptr], ptr @pos, i64 0, i64 %indvars.iv205
  %55 = load ptr, ptr %54, align 8, !tbaa !12
  %56 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %55) #8
  %57 = getelementptr inbounds i8, ptr %55, i64 %56
  %58 = getelementptr inbounds i8, ptr %57, i64 -1
  call void @_Z5buildRiPc(ptr noundef nonnull align 4 dereferenceable(4) %53, ptr noundef nonnull %58)
  %indvars.iv.next206 = add nuw nsw i64 %indvars.iv205, 1
  %59 = load i32, ptr @n, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %.not122.not = icmp slt i64 %indvars.iv205, %60
  br i1 %.not122.not, label %.lr.ph154, label %.preheader137, !llvm.loop !19

.lr.ph186:                                        ; preds = %.preheader137, %205
  %.0108185 = phi i32 [ %206, %205 ], [ 1, %.preheader137 ]
  %61 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull getelementptr inbounds (i8, ptr @pre, i64 1), ptr noundef nonnull getelementptr inbounds (i8, ptr @suf, i64 1))
  %62 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @pre, i64 1)) #8
  %63 = trunc i64 %62 to i32
  %64 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @suf, i64 1)) #8
  %.fr193 = freeze i64 %64
  %65 = trunc i64 %.fr193 to i32
  store i32 %63, ptr @length, align 4, !tbaa !5
  %66 = load i32, ptr @n, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %gep182 = getelementptr ptr, ptr getelementptr inbounds (i8, ptr @pos, i64 8), i64 %67
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #9
  store ptr getelementptr inbounds (i8, ptr @pre, i64 1), ptr %1, align 8, !tbaa !12
  %68 = call noundef ptr @_ZSt11lower_boundIPPcS0_PFbRKS0_S3_EET_S6_S6_RKT0_T1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @pos, i64 8), ptr noundef nonnull %gep182, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull @_Z4cmp2RKPcS1_)
  %69 = ptrtoint ptr %68 to i64
  %70 = sub i64 %69, ptrtoint (ptr @pos to i64)
  %71 = lshr exact i64 %70, 3
  %72 = trunc i64 %71 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #9
  %73 = load i32, ptr @n, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %gep183 = getelementptr ptr, ptr getelementptr inbounds (i8, ptr @pos, i64 8), i64 %74
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #9
  store ptr getelementptr inbounds (i8, ptr @pre, i64 1), ptr %2, align 8, !tbaa !12
  %75 = call noundef ptr @_ZSt11upper_boundIPPcS0_PFbRKS0_S3_EET_S6_S6_RKT0_T1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @pos, i64 8), ptr noundef nonnull %gep183, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull @_Z4cmp2RKPcS1_)
  %76 = ptrtoint ptr %75 to i64
  %77 = sub i64 %76, ptrtoint (ptr @pos to i64)
  %78 = lshr exact i64 %77, 3
  %79 = trunc i64 %78 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #9
  %.not124 = icmp slt i32 %72, %79
  br i1 %.not124, label %.preheader136, label %81

.preheader136:                                    ; preds = %.lr.ph186
  %.not125155 = icmp slt i32 %63, 1
  br i1 %.not125155, label %.preheader135, label %.lr.ph159.preheader

.lr.ph159.preheader:                              ; preds = %.preheader136
  %80 = add nuw nsw i64 %62, 1
  %wide.trip.count = and i64 %80, 4294967295
  br label %.lr.ph159

81:                                               ; preds = %.lr.ph186
  %82 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.4)
  br label %205

.preheader135:                                    ; preds = %.lr.ph159, %.preheader136
  %.not126160 = icmp slt i32 %65, 1
  br i1 %.not126160, label %._crit_edge165, label %.lr.ph164.preheader

.lr.ph164.preheader:                              ; preds = %.preheader135
  %83 = add nuw nsw i64 %.fr193, 1
  %wide.trip.count215 = and i64 %83, 4294967295
  br label %.lr.ph164

.lr.ph159:                                        ; preds = %.lr.ph159.preheader, %.lr.ph159
  %indvars.iv208 = phi i64 [ 1, %.lr.ph159.preheader ], [ %indvars.iv.next209, %.lr.ph159 ]
  %.0104157 = phi i64 [ 0, %.lr.ph159.preheader ], [ %93, %.lr.ph159 ]
  %.0106156 = phi i64 [ 0, %.lr.ph159.preheader ], [ %90, %.lr.ph159 ]
  %84 = mul nsw i64 %.0106156, 27
  %85 = getelementptr inbounds [600001 x i8], ptr @pre, i64 0, i64 %indvars.iv208
  %86 = load i8, ptr %85, align 1, !tbaa !14
  %87 = sext i8 %86 to i64
  %88 = add nsw i64 %87, -96
  %89 = add nsw i64 %88, %84
  %90 = srem i64 %89, 985661441
  %91 = mul nsw i64 %.0104157, 27
  %92 = add nsw i64 %88, %91
  %93 = srem i64 %92, 998244353
  %94 = shl nsw i64 %90, 32
  %95 = or i64 %94, %93
  %96 = getelementptr inbounds [600001 x i64], ptr @preh, i64 0, i64 %indvars.iv208
  store i64 %95, ptr %96, align 8, !tbaa !16
  %indvars.iv.next209 = add nuw nsw i64 %indvars.iv208, 1
  %exitcond211.not = icmp eq i64 %indvars.iv.next209, %wide.trip.count
  br i1 %exitcond211.not, label %.preheader135, label %.lr.ph159, !llvm.loop !20

._crit_edge165:                                   ; preds = %.lr.ph164, %.preheader135
  %97 = shl i64 %70, 29
  %sext = add i64 %97, -4294967296
  %98 = ashr i64 %sext, 32
  %99 = getelementptr inbounds [100001 x i32], ptr @rt, i64 0, i64 %98
  %100 = shl i64 %77, 29
  %sext127 = add i64 %100, -4294967296
  %101 = ashr i64 %sext127, 32
  %102 = getelementptr inbounds [100001 x i32], ptr @rt, i64 0, i64 %101
  %sext128 = shl i64 %.fr193, 32
  %103 = ashr exact i64 %sext128, 32
  %104 = getelementptr inbounds i8, ptr @suf, i64 %103
  %.098166 = load i32, ptr %102, align 4, !tbaa !5
  %.099167 = load i32, ptr %99, align 4, !tbaa !5
  %105 = load i8, ptr %104, align 1, !tbaa !14
  %.not129168 = icmp eq i8 %105, 0
  br i1 %.not129168, label %._crit_edge174, label %.lr.ph173

.lr.ph164:                                        ; preds = %.lr.ph164.preheader, %.lr.ph164
  %indvars.iv212 = phi i64 [ 1, %.lr.ph164.preheader ], [ %indvars.iv.next213, %.lr.ph164 ]
  %.1105162 = phi i64 [ 0, %.lr.ph164.preheader ], [ %115, %.lr.ph164 ]
  %.1107161 = phi i64 [ 0, %.lr.ph164.preheader ], [ %112, %.lr.ph164 ]
  %106 = mul nsw i64 %.1107161, 27
  %107 = getelementptr inbounds [600001 x i8], ptr @suf, i64 0, i64 %indvars.iv212
  %108 = load i8, ptr %107, align 1, !tbaa !14
  %109 = sext i8 %108 to i64
  %110 = add nsw i64 %109, -96
  %111 = add nsw i64 %110, %106
  %112 = srem i64 %111, 985661441
  %113 = mul nsw i64 %.1105162, 27
  %114 = add nsw i64 %110, %113
  %115 = srem i64 %114, 998244353
  %116 = shl nsw i64 %112, 32
  %117 = or i64 %116, %115
  %118 = getelementptr inbounds [600001 x i64], ptr @sufh, i64 0, i64 %indvars.iv212
  store i64 %117, ptr %118, align 8, !tbaa !16
  %indvars.iv.next213 = add nuw nsw i64 %indvars.iv212, 1
  %exitcond216.not = icmp eq i64 %indvars.iv.next213, %wide.trip.count215
  br i1 %exitcond216.not, label %._crit_edge165, label %.lr.ph164, !llvm.loop !21

._crit_edge174:                                   ; preds = %.lr.ph173, %._crit_edge165
  %.098.lcssa = phi i32 [ %.098166, %._crit_edge165 ], [ %.098, %.lr.ph173 ]
  %.099.lcssa = phi i32 [ %.099167, %._crit_edge165 ], [ %.099, %.lr.ph173 ]
  %119 = sext i32 %.098.lcssa to i64
  %120 = getelementptr inbounds [600001 x %struct.Trie], ptr @e, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !22
  %122 = sext i32 %.099.lcssa to i64
  %123 = getelementptr inbounds [600001 x %struct.Trie], ptr @e, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !22
  %125 = sub nsw i32 %121, %124
  %.not130 = icmp eq i32 %125, 0
  br i1 %.not130, label %143, label %.preheader

.preheader:                                       ; preds = %._crit_edge174
  %invariant.smin = call i32 @llvm.smin.i32(i32 %63, i32 %65)
  %126 = icmp sgt i32 %invariant.smin, 0
  br i1 %126, label %.lr.ph179, label %._crit_edge180

.lr.ph179:                                        ; preds = %.preheader
  %sext131 = shl i64 %62, 32
  %127 = ashr exact i64 %sext131, 32
  %128 = getelementptr inbounds [600001 x i64], ptr @preh, i64 0, i64 %127
  %129 = getelementptr inbounds [600001 x i32], ptr @pw1, i64 0, i64 %103
  %130 = getelementptr inbounds [600001 x i64], ptr @sufh, i64 0, i64 %103
  %131 = getelementptr inbounds [600001 x i32], ptr @pw2, i64 0, i64 %103
  %sext222 = shl i64 %62, 32
  %132 = ashr exact i64 %sext222, 32
  %133 = add nuw i32 %invariant.smin, 1
  %wide.trip.count220 = zext i32 %133 to i64
  br label %146

.lr.ph173:                                        ; preds = %._crit_edge165, %.lr.ph173
  %134 = phi i8 [ %142, %.lr.ph173 ], [ %105, %._crit_edge165 ]
  %.099171 = phi i32 [ %.099, %.lr.ph173 ], [ %.099167, %._crit_edge165 ]
  %.098170 = phi i32 [ %.098, %.lr.ph173 ], [ %.098166, %._crit_edge165 ]
  %.097169 = phi ptr [ %141, %.lr.ph173 ], [ %104, %._crit_edge165 ]
  %135 = sext i32 %.099171 to i64
  %136 = sext i8 %134 to i64
  %137 = add nsw i64 %136, -97
  %138 = getelementptr inbounds [600001 x %struct.Trie], ptr @e, i64 0, i64 %135, i32 1, i64 %137
  %139 = sext i32 %.098170 to i64
  %140 = getelementptr inbounds [600001 x %struct.Trie], ptr @e, i64 0, i64 %139, i32 1, i64 %137
  %141 = getelementptr inbounds i8, ptr %.097169, i64 -1
  %.098 = load i32, ptr %140, align 4, !tbaa !5
  %.099 = load i32, ptr %138, align 4, !tbaa !5
  %142 = load i8, ptr %141, align 1, !tbaa !14
  %.not129 = icmp eq i8 %142, 0
  br i1 %.not129, label %._crit_edge174, label %.lr.ph173, !llvm.loop !24

143:                                              ; preds = %._crit_edge174
  %144 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.4)
  br label %205

._crit_edge180:                                   ; preds = %204, %.preheader
  %.096.lcssa = phi i32 [ %125, %.preheader ], [ %.2, %204 ]
  %145 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %.096.lcssa)
  br label %205

146:                                              ; preds = %.lr.ph179, %204
  %indvars.iv217 = phi i64 [ 1, %.lr.ph179 ], [ %indvars.iv.next218, %204 ]
  %.096177 = phi i32 [ %125, %.lr.ph179 ], [ %.2, %204 ]
  %147 = sub nsw i64 %132, %indvars.iv217
  %148 = getelementptr inbounds [600001 x i64], ptr @preh, i64 0, i64 %147
  %149 = load i64, ptr %148, align 8, !tbaa !16
  %150 = load i64, ptr %128, align 8, !tbaa !16
  %151 = ashr i64 %150, 32
  %152 = getelementptr inbounds [600001 x i32], ptr @pw1, i64 0, i64 %indvars.iv217
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = ashr i64 %149, 32
  %156 = mul nsw i64 %155, %154
  %157 = sub nsw i64 %151, %156
  %158 = srem i64 %157, 985661441
  %159 = icmp slt i64 %158, 0
  %160 = and i64 %150, 4294967295
  %161 = getelementptr inbounds [600001 x i32], ptr @pw2, i64 0, i64 %indvars.iv217
  %162 = load i32, ptr %161, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = and i64 %149, 4294967295
  %165 = mul nsw i64 %164, %163
  %166 = sub nsw i64 %160, %165
  %167 = srem i64 %166, 998244353
  %168 = icmp slt i64 %167, 0
  %169 = add nsw i64 %167, 998244353
  %.091 = select i1 %168, i64 %169, i64 %167
  %170 = shl nsw i64 %158, 32
  %171 = add nsw i64 %170, 4233383654023233536
  %172 = select i1 %159, i64 %171, i64 %170
  %173 = and i64 %.091, 4294967295
  %174 = or disjoint i64 %173, %172
  %175 = getelementptr inbounds [600001 x i64], ptr @sufh, i64 0, i64 %indvars.iv217
  %176 = load i64, ptr %175, align 8, !tbaa !16
  %177 = icmp eq i64 %174, %176
  br i1 %177, label %178, label %204

178:                                              ; preds = %146
  %179 = load i32, ptr %129, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = mul nsw i64 %155, %180
  %182 = load i64, ptr %130, align 8, !tbaa !16
  %183 = ashr i64 %182, 32
  %184 = add nsw i64 %181, %183
  %185 = srem i64 %184, 985661441
  %186 = load i32, ptr %131, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = mul nsw i64 %164, %187
  %189 = and i64 %182, 4294967295
  %190 = add nsw i64 %188, %189
  %191 = srem i64 %190, 998244353
  %192 = load i32, ptr @n, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %gep = getelementptr i64, ptr getelementptr inbounds (i8, ptr @hh, i64 8), i64 %193
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #9
  %194 = shl nsw i64 %185, 32
  %195 = or i64 %191, %194
  store i64 %195, ptr %3, align 8, !tbaa !16
  %196 = call noundef ptr @_ZSt11lower_boundIPxxET_S1_S1_RKT0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @hh, i64 8), ptr noundef nonnull %gep, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %197 = ptrtoint ptr %196 to i64
  %198 = sub i64 %197, ptrtoint (ptr @hh to i64)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #9
  %sext132 = shl i64 %198, 29
  %199 = ashr i64 %sext132, 32
  %200 = getelementptr inbounds [100001 x i64], ptr @hh, i64 0, i64 %199
  %201 = load i64, ptr %200, align 8, !tbaa !16
  %202 = icmp eq i64 %201, %195
  %203 = sext i1 %202 to i32
  %spec.select134 = add nsw i32 %.096177, %203
  br label %204

204:                                              ; preds = %178, %146
  %.2 = phi i32 [ %spec.select134, %178 ], [ %.096177, %146 ]
  %indvars.iv.next218 = add nuw nsw i64 %indvars.iv217, 1
  %exitcond221.not = icmp eq i64 %indvars.iv.next218, %wide.trip.count220
  br i1 %exitcond221.not, label %._crit_edge180, label %146, !llvm.loop !25

205:                                              ; preds = %143, %._crit_edge180, %81
  %206 = add nuw nsw i32 %.0108185, 1
  %207 = load i32, ptr @q, align 4, !tbaa !5
  %.not123.not = icmp slt i32 %.0108185, %207
  br i1 %.not123.not, label %.lr.ph186, label %.loopexit, !llvm.loop !26

._crit_edge192:                                   ; preds = %.loopexit, %4
  ret i32 0
}

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPPcPFbRKS0_S3_EEvT_S6_T0_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #5

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPPcS0_PFbRKS0_S3_EET_S6_S6_RKT0_T1_(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11upper_boundIPPcS0_PFbRKS0_S3_EET_S6_S6_RKT0_T1_(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPxxET_S1_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

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

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

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 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 norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { 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 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !10}
!16 = !{!17, !17, i64 0}
!17 = !{!"long long", !7, i64 0}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = !{!23, !6, i64 0}
!23 = !{!"_ZTS4Trie", !6, i64 0, !7, i64 4}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}


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