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

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

%class.anon = type { i8 }

@n = external dso_local global i32, align 4
@len = external dso_local global [27 x i32], align 16
@seq = external dso_local global [27 x [100001 x i32]], align 16
@ord = external dso_local global [27 x i32], align 16
@buf = external dso_local global [100001 x i8], align 16
@ban = external dso_local global [27 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 [14 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %class.anon, align 1
  %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
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %257, %0
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %20 = icmp eq i32 %19, 1
  br i1 %20, label %22, label %21

21:                                               ; preds = %18
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %260

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

23:                                               ; preds = %38, %22
  %24 = load i32, ptr %4, align 4, !tbaa !5
  %25 = icmp slt i32 %24, 26
  br i1 %25, label %27, label %26

26:                                               ; preds = %23
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %41

27:                                               ; preds = %23
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [27 x i32], ptr @len, i64 0, i64 %29
  store i32 0, ptr %30, align 4, !tbaa !5
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [27 x i32], ptr @ord, i64 0, i64 %33
  store i32 %31, ptr %34, align 4, !tbaa !5
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [27 x i8], ptr @ban, i64 0, i64 %36
  store i8 0, ptr %37, align 1, !tbaa !9
  br label %38

38:                                               ; preds = %27
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %4, align 4, !tbaa !5
  br label %23, !llvm.loop !11

41:                                               ; preds = %26
  br label %42

42:                                               ; preds = %105, %41
  %43 = load i32, ptr @n, align 4, !tbaa !5
  %44 = add nsw i32 %43, -1
  store i32 %44, ptr @n, align 4, !tbaa !5
  %45 = icmp ne i32 %43, 0
  br i1 %45, label %46, label %106

46:                                               ; preds = %42
  %47 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @buf)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %48 = call i64 @strlen(ptr noundef @buf) #6
  %49 = trunc i64 %48 to i32
  store i32 %49, ptr %5, align 4, !tbaa !5
  %50 = load i32, ptr %5, align 4, !tbaa !5
  %51 = icmp sgt i32 %50, 1
  br i1 %51, label %52, label %58

52:                                               ; preds = %46
  %53 = load i8, ptr @buf, align 16, !tbaa !13
  %54 = sext i8 %53 to i32
  %55 = sub nsw i32 %54, 97
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [27 x i8], ptr @ban, i64 0, i64 %56
  store i8 1, ptr %57, align 1, !tbaa !9
  br label %58

58:                                               ; preds = %52, %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  br label %59

59:                                               ; preds = %102, %58
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = load i32, ptr %5, align 4, !tbaa !5
  %62 = icmp slt i32 %60, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %59
  store i32 10, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %105

64:                                               ; preds = %59
  %65 = load i32, ptr %5, align 4, !tbaa !5
  %66 = sub nsw i32 %65, 1
  %67 = load i32, ptr %6, align 4, !tbaa !5
  %68 = sub nsw i32 %66, %67
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [100001 x i8], ptr @buf, i64 0, i64 %69
  %71 = load i8, ptr %70, align 1, !tbaa !13
  %72 = sext i8 %71 to i32
  %73 = sub nsw i32 %72, 97
  store i32 %73, ptr %7, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %82, %64
  %75 = load i32, ptr %7, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [27 x i32], ptr @len, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = load i32, ptr %6, align 4, !tbaa !5
  %80 = icmp sle i32 %78, %79
  br i1 %80, label %81, label %93

81:                                               ; preds = %74
  br label %82

82:                                               ; preds = %81
  %83 = load i32, ptr %7, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [27 x [100001 x i32]], ptr @seq, i64 0, i64 %84
  %86 = load i32, ptr %7, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [27 x i32], ptr @len, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %88, align 4, !tbaa !5
  %91 = sext i32 %89 to i64
  %92 = getelementptr inbounds [100001 x i32], ptr %85, i64 0, i64 %91
  store i32 0, ptr %92, align 4, !tbaa !5
  br label %74, !llvm.loop !14

93:                                               ; preds = %74
  %94 = load i32, ptr %7, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [27 x [100001 x i32]], ptr @seq, i64 0, i64 %95
  %97 = load i32, ptr %6, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [100001 x i32], ptr %96, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %99, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %93
  %103 = load i32, ptr %6, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %6, align 4, !tbaa !5
  br label %59, !llvm.loop !15

105:                                              ; preds = %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %42, !llvm.loop !16

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

107:                                              ; preds = %179, %106
  %108 = load i32, ptr %8, align 4, !tbaa !5
  %109 = icmp slt i32 %108, 26
  br i1 %109, label %111, label %110

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

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

112:                                              ; preds = %175, %111
  %113 = load i32, ptr %9, align 4, !tbaa !5
  %114 = load i32, ptr %8, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [27 x i32], ptr @len, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = icmp slt i32 %113, %117
  br i1 %118, label %120, label %119

119:                                              ; preds = %112
  store i32 19, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %178

120:                                              ; preds = %112
  %121 = load i32, ptr %8, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [27 x [100001 x i32]], ptr @seq, i64 0, i64 %122
  %124 = load i32, ptr %9, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [100001 x i32], ptr %123, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = icmp sge i32 %127, 26
  br i1 %128, label %129, label %174

129:                                              ; preds = %120
  %130 = load i32, ptr %9, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1
  %132 = load i32, ptr %8, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [27 x i32], ptr @len, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = icmp eq i32 %131, %135
  br i1 %136, label %137, label %148

137:                                              ; preds = %129
  %138 = load i32, ptr %8, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [27 x [100001 x i32]], ptr @seq, i64 0, i64 %139
  %141 = load i32, ptr %8, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [27 x i32], ptr @len, i64 0, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %143, align 4, !tbaa !5
  %146 = sext i32 %144 to i64
  %147 = getelementptr inbounds [100001 x i32], ptr %140, i64 0, i64 %146
  store i32 0, ptr %147, align 4, !tbaa !5
  br label %148

148:                                              ; preds = %137, %129
  %149 = load i32, ptr %8, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [27 x [100001 x i32]], ptr @seq, i64 0, i64 %150
  %152 = load i32, ptr %9, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [100001 x i32], ptr %151, i64 0, i64 %153
  %155 = load i32, ptr %154, align 4, !tbaa !5
  %156 = sdiv i32 %155, 26
  %157 = load i32, ptr %8, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [27 x [100001 x i32]], ptr @seq, i64 0, i64 %158
  %160 = load i32, ptr %9, align 4, !tbaa !5
  %161 = add nsw i32 %160, 1
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [100001 x i32], ptr %159, i64 0, i64 %162
  %164 = load i32, ptr %163, align 4, !tbaa !5
  %165 = add nsw i32 %164, %156
  store i32 %165, ptr %163, align 4, !tbaa !5
  %166 = load i32, ptr %8, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [27 x [100001 x i32]], ptr @seq, i64 0, i64 %167
  %169 = load i32, ptr %9, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [100001 x i32], ptr %168, i64 0, i64 %170
  %172 = load i32, ptr %171, align 4, !tbaa !5
  %173 = srem i32 %172, 26
  store i32 %173, ptr %171, align 4, !tbaa !5
  br label %174

174:                                              ; preds = %148, %120
  br label %175

175:                                              ; preds = %174
  %176 = load i32, ptr %9, align 4, !tbaa !5
  %177 = add nsw i32 %176, 1
  store i32 %177, ptr %9, align 4, !tbaa !5
  br label %112, !llvm.loop !17

178:                                              ; preds = %119
  br label %179

179:                                              ; preds = %178
  %180 = load i32, ptr %8, align 4, !tbaa !5
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr %8, align 4, !tbaa !5
  br label %107, !llvm.loop !18

182:                                              ; preds = %110
  call void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef @ord, ptr noundef getelementptr inbounds (i32, ptr @ord, i64 26))
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %183

183:                                              ; preds = %193, %182
  %184 = load i32, ptr %11, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [27 x i32], ptr @ord, i64 0, i64 %185
  %187 = load i32, ptr %186, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [27 x i8], ptr @ban, i64 0, i64 %188
  %190 = load i8, ptr %189, align 1, !tbaa !9, !range !19, !noundef !20
  %191 = trunc i8 %190 to i1
  br i1 %191, label %192, label %196

192:                                              ; preds = %183
  br label %193

193:                                              ; preds = %192
  %194 = load i32, ptr %11, align 4, !tbaa !5
  %195 = add nsw i32 %194, 1
  store i32 %195, ptr %11, align 4, !tbaa !5
  br label %183, !llvm.loop !21

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

197:                                              ; preds = %250, %196
  %198 = load i32, ptr %13, align 4, !tbaa !5
  %199 = icmp slt i32 %198, 26
  br i1 %199, label %201, label %200

200:                                              ; preds = %197
  store i32 25, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %253

201:                                              ; preds = %197
  %202 = load i32, ptr %13, align 4, !tbaa !5
  %203 = load i32, ptr %11, align 4, !tbaa !5
  %204 = icmp eq i32 %202, %203
  br i1 %204, label %205, label %206

205:                                              ; preds = %201
  br label %250

206:                                              ; preds = %201
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %207 = load i32, ptr %13, align 4, !tbaa !5
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [27 x i32], ptr @ord, i64 0, i64 %208
  %210 = load i32, ptr %209, align 4, !tbaa !5
  store i32 %210, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %211 = load i32, ptr %15, align 4, !tbaa !5
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds [27 x i32], ptr @len, i64 0, i64 %212
  %214 = load i32, ptr %213, align 4, !tbaa !5
  %215 = sub nsw i32 %214, 1
  store i32 %215, ptr %17, align 4, !tbaa !5
  br label %216

216:                                              ; preds = %235, %206
  %217 = load i32, ptr %17, align 4, !tbaa !5
  %218 = icmp sge i32 %217, 0
  br i1 %218, label %220, label %219

219:                                              ; preds = %216
  store i32 28, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %238

220:                                              ; preds = %216
  %221 = load i32, ptr %16, align 4, !tbaa !5
  %222 = sext i32 %221 to i64
  %223 = mul nsw i64 %222, 26
  %224 = load i32, ptr %15, align 4, !tbaa !5
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [27 x [100001 x i32]], ptr @seq, i64 0, i64 %225
  %227 = load i32, ptr %17, align 4, !tbaa !5
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [100001 x i32], ptr %226, i64 0, i64 %228
  %230 = load i32, ptr %229, align 4, !tbaa !5
  %231 = sext i32 %230 to i64
  %232 = add nsw i64 %223, %231
  %233 = srem i64 %232, 1000000007
  %234 = trunc i64 %233 to i32
  store i32 %234, ptr %16, align 4, !tbaa !5
  br label %235

235:                                              ; preds = %220
  %236 = load i32, ptr %17, align 4, !tbaa !5
  %237 = add nsw i32 %236, -1
  store i32 %237, ptr %17, align 4, !tbaa !5
  br label %216, !llvm.loop !22

238:                                              ; preds = %219
  %239 = load i32, ptr %12, align 4, !tbaa !5
  %240 = sext i32 %239 to i64
  %241 = load i32, ptr %16, align 4, !tbaa !5
  %242 = sext i32 %241 to i64
  %243 = load i32, ptr %14, align 4, !tbaa !5
  %244 = add nsw i32 %243, 1
  store i32 %244, ptr %14, align 4, !tbaa !5
  %245 = sext i32 %244 to i64
  %246 = mul nsw i64 %242, %245
  %247 = add nsw i64 %240, %246
  %248 = srem i64 %247, 1000000007
  %249 = trunc i64 %248 to i32
  store i32 %249, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %250

250:                                              ; preds = %238, %205
  %251 = load i32, ptr %13, align 4, !tbaa !5
  %252 = add nsw i32 %251, 1
  store i32 %252, ptr %13, align 4, !tbaa !5
  br label %197, !llvm.loop !23

253:                                              ; preds = %200
  %254 = load i32, ptr %2, align 4, !tbaa !5
  %255 = load i32, ptr %12, align 4, !tbaa !5
  %256 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %254, i32 noundef %255)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %257

257:                                              ; preds = %253
  %258 = load i32, ptr %2, align 4, !tbaa !5
  %259 = add nsw i32 %258, 1
  store i32 %259, ptr %2, align 4, !tbaa !5
  br label %18, !llvm.loop !24

260:                                              ; preds = %21
  ret i32 0
}

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef, ptr noundef) #4

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

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


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

@n = external dso_local global i32, align 4
@len = external dso_local local_unnamed_addr global [27 x i32], align 16
@seq = external dso_local local_unnamed_addr global [27 x [100001 x i32]], align 16
@ord = external dso_local global [27 x i32], align 16
@buf = external dso_local global [100001 x i8], align 16
@ban = external dso_local local_unnamed_addr global [27 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 [14 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %2 = icmp eq i32 %1, 1
  br i1 %2, label %.preheader72, label %._crit_edge94

.preheader72:                                     ; preds = %0, %73
  %.05593 = phi i32 [ %75, %73 ], [ 1, %0 ]
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(104) @len, i8 0, i64 104, i1 false), !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(26) @ban, i8 0, i64 26, i1 false), !tbaa !9
  store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, ptr @ord, align 16, !tbaa !5
  store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, ptr getelementptr inbounds (i8, ptr @ord, i64 16), align 16, !tbaa !5
  store <4 x i32> <i32 8, i32 9, i32 10, i32 11>, ptr getelementptr inbounds (i8, ptr @ord, i64 32), align 16, !tbaa !5
  store <4 x i32> <i32 12, i32 13, i32 14, i32 15>, ptr getelementptr inbounds (i8, ptr @ord, i64 48), align 16, !tbaa !5
  store <4 x i32> <i32 16, i32 17, i32 18, i32 19>, ptr getelementptr inbounds (i8, ptr @ord, i64 64), align 16, !tbaa !5
  store <4 x i32> <i32 20, i32 21, i32 22, i32 23>, ptr getelementptr inbounds (i8, ptr @ord, i64 80), align 16, !tbaa !5
  store i32 24, ptr getelementptr inbounds (i8, ptr @ord, i64 96), align 16, !tbaa !5
  store i32 25, ptr getelementptr inbounds (i8, ptr @ord, i64 100), align 4, !tbaa !5
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %4 = add nsw i32 %3, -1
  store i32 %4, ptr @n, align 4, !tbaa !5
  %.not78 = icmp eq i32 %3, 0
  br i1 %.not78, label %.preheader.preheader, label %.lr.ph79

.preheader.preheader:                             ; preds = %.loopexit, %.preheader72
  br label %.preheader

._crit_edge94:                                    ; preds = %73, %0
  ret i32 0

.loopexit:                                        ; preds = %35, %15
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = add nsw i32 %5, -1
  store i32 %6, ptr @n, align 4, !tbaa !5
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %.preheader.preheader, label %.lr.ph79, !llvm.loop !11

.lr.ph79:                                         ; preds = %.preheader72, %.loopexit
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @buf)
  %8 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @buf) #5
  %9 = trunc i64 %8 to i32
  %10 = icmp sgt i32 %9, 1
  br i1 %10, label %.thread, label %15

.thread:                                          ; preds = %.lr.ph79
  %11 = load i8, ptr @buf, align 16, !tbaa !13
  %12 = sext i8 %11 to i64
  %13 = add nsw i64 %12, -97
  %14 = getelementptr inbounds [27 x i8], ptr @ban, i64 0, i64 %13
  store i8 1, ptr %14, align 1, !tbaa !9
  br label %.lr.ph77.preheader

15:                                               ; preds = %.lr.ph79
  %16 = icmp eq i32 %9, 1
  br i1 %16, label %.lr.ph77.preheader, label %.loopexit

.lr.ph77.preheader:                               ; preds = %.thread, %15
  %17 = and i64 %8, 2147483647
  %wide.trip.count = and i64 %8, 2147483647
  br label %.lr.ph77

.lr.ph77:                                         ; preds = %.lr.ph77.preheader, %35
  %indvars.iv = phi i64 [ 0, %.lr.ph77.preheader ], [ %indvars.iv.next, %35 ]
  %18 = xor i64 %indvars.iv, -1
  %19 = add nsw i64 %17, %18
  %20 = getelementptr inbounds [100001 x i8], ptr @buf, i64 0, i64 %19
  %21 = load i8, ptr %20, align 1, !tbaa !13
  %22 = sext i8 %21 to i64
  %23 = add nsw i64 %22, -97
  %24 = getelementptr inbounds [27 x i32], ptr @len, i64 0, i64 %23
  %.promoted = load i32, ptr %24, align 4, !tbaa !5
  %25 = sext i32 %.promoted to i64
  %.not6874 = icmp slt i64 %indvars.iv, %25
  br i1 %.not6874, label %35, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.lr.ph77
  %26 = mul nsw i64 %22, 400004
  %27 = shl nsw i64 %25, 2
  %28 = getelementptr i8, ptr getelementptr (i8, ptr @seq, i64 -38800388), i64 %26
  %scevgep = getelementptr i8, ptr %28, i64 %27
  %29 = trunc nuw nsw i64 %indvars.iv to i32
  %30 = sub i32 %29, %.promoted
  %31 = zext i32 %30 to i64
  %32 = shl nuw nsw i64 %31, 2
  %33 = add nuw nsw i64 %32, 4
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i8 0, i64 %33, i1 false), !tbaa !5
  %34 = add i32 %29, 1
  store i32 %34, ptr %24, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %.lr.ph.preheader, %.lr.ph77
  %36 = getelementptr inbounds [27 x [100001 x i32]], ptr @seq, i64 0, i64 %23, i64 %indvars.iv
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %36, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph77, !llvm.loop !14

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge83
  %indvars.iv104 = phi i64 [ %indvars.iv.next105, %._crit_edge83 ], [ 0, %.preheader.preheader ]
  %39 = getelementptr inbounds [27 x i32], ptr @len, i64 0, i64 %indvars.iv104
  %.promoted80 = load i32, ptr %39, align 4, !tbaa !5
  %40 = icmp sgt i32 %.promoted80, 0
  br i1 %40, label %.lr.ph82, label %._crit_edge83

41:                                               ; preds = %._crit_edge83
  tail call void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef nonnull @ord, ptr noundef nonnull getelementptr inbounds (i8, ptr @ord, i64 104))
  br label %65

._crit_edge83:                                    ; preds = %.lr.ph82._crit_edge, %.preheader
  %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
  %exitcond107.not = icmp eq i64 %indvars.iv.next105, 26
  br i1 %exitcond107.not, label %41, label %.preheader, !llvm.loop !15

.lr.ph82:                                         ; preds = %.preheader, %.lr.ph82._crit_edge
  %indvars.iv101 = phi i64 [ %46, %.lr.ph82._crit_edge ], [ 0, %.preheader ]
  %42 = phi i32 [ %62, %.lr.ph82._crit_edge ], [ %.promoted80, %.preheader ]
  %43 = getelementptr inbounds [27 x [100001 x i32]], ptr @seq, i64 0, i64 %indvars.iv104, i64 %indvars.iv101
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = icmp sgt i32 %44, 25
  %46 = add nuw nsw i64 %indvars.iv101, 1
  br i1 %45, label %47, label %.lr.ph82._crit_edge

47:                                               ; preds = %.lr.ph82
  %48 = zext i32 %42 to i64
  %49 = icmp eq i64 %46, %48
  br i1 %49, label %50, label %54

50:                                               ; preds = %47
  %51 = add nsw i32 %42, 1
  store i32 %51, ptr %39, align 4, !tbaa !5
  %52 = sext i32 %42 to i64
  %53 = getelementptr inbounds [27 x [100001 x i32]], ptr @seq, i64 0, i64 %indvars.iv104, i64 %52
  store i32 0, ptr %53, align 4, !tbaa !5
  %.pre = load i32, ptr %43, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %50, %47
  %55 = phi i32 [ %.pre, %50 ], [ %44, %47 ]
  %56 = phi i32 [ %51, %50 ], [ %42, %47 ]
  %57 = sdiv i32 %55, 26
  %58 = getelementptr inbounds [27 x [100001 x i32]], ptr @seq, i64 0, i64 %indvars.iv104, i64 %46
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = add nsw i32 %59, %57
  store i32 %60, ptr %58, align 4, !tbaa !5
  %61 = srem i32 %55, 26
  store i32 %61, ptr %43, align 4, !tbaa !5
  br label %.lr.ph82._crit_edge

.lr.ph82._crit_edge:                              ; preds = %.lr.ph82, %54
  %62 = phi i32 [ %56, %54 ], [ %42, %.lr.ph82 ]
  %63 = sext i32 %62 to i64
  %64 = icmp slt i64 %46, %63
  br i1 %64, label %.lr.ph82, label %._crit_edge83, !llvm.loop !16

65:                                               ; preds = %65, %41
  %indvars.iv108 = phi i64 [ %indvars.iv.next109, %65 ], [ 0, %41 ]
  %66 = getelementptr inbounds [27 x i32], ptr @ord, i64 0, i64 %indvars.iv108
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [27 x i8], ptr @ban, i64 0, i64 %68
  %70 = load i8, ptr %69, align 1, !tbaa !9, !range !17, !noundef !18
  %71 = trunc nuw i8 %70 to i1
  %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
  br i1 %71, label %65, label %.preheader69, !llvm.loop !19

.preheader69:                                     ; preds = %65
  %72 = and i64 %indvars.iv108, 4294967295
  br label %78

73:                                               ; preds = %114
  %74 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.05593, i32 noundef %.159)
  %75 = add nuw nsw i32 %.05593, 1
  %76 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %77 = icmp eq i32 %76, 1
  br i1 %77, label %.preheader72, label %._crit_edge94, !llvm.loop !20

78:                                               ; preds = %.preheader69, %114
  %indvars.iv114 = phi i64 [ 0, %.preheader69 ], [ %indvars.iv.next115, %114 ]
  %.05692 = phi i32 [ 0, %.preheader69 ], [ %.1, %114 ]
  %.05890 = phi i32 [ 0, %.preheader69 ], [ %.159, %114 ]
  %79 = icmp eq i64 %indvars.iv114, %72
  br i1 %79, label %114, label %80

80:                                               ; preds = %78
  %81 = getelementptr inbounds [27 x i32], ptr @ord, i64 0, i64 %indvars.iv114
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [27 x i32], ptr @len, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = icmp sgt i32 %85, 0
  br i1 %86, label %.lr.ph88.preheader, label %._crit_edge89

.lr.ph88.preheader:                               ; preds = %80
  %87 = zext nneg i32 %85 to i64
  %xtraiter = and i64 %87, 1
  %88 = icmp eq i32 %85, 1
  br i1 %88, label %._crit_edge89.loopexit.unr-lcssa, label %.lr.ph88.preheader.new

.lr.ph88.preheader.new:                           ; preds = %.lr.ph88.preheader
  %unroll_iter = and i64 %87, 2147483646
  br label %.lr.ph88

._crit_edge89.loopexit.unr-lcssa:                 ; preds = %.lr.ph88, %.lr.ph88.preheader
  %.lcssa.ph = phi i64 [ poison, %.lr.ph88.preheader ], [ %113, %.lr.ph88 ]
  %indvars.iv111.unr = phi i64 [ %87, %.lr.ph88.preheader ], [ %indvars.iv.next112.1, %.lr.ph88 ]
  %.05485.unr = phi i64 [ 0, %.lr.ph88.preheader ], [ %113, %.lr.ph88 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge89, label %.lr.ph88.epil

.lr.ph88.epil:                                    ; preds = %._crit_edge89.loopexit.unr-lcssa
  %indvars.iv.next112.epil = add nsw i64 %indvars.iv111.unr, -1
  %89 = mul nsw i64 %.05485.unr, 26
  %90 = getelementptr inbounds [27 x [100001 x i32]], ptr @seq, i64 0, i64 %83, i64 %indvars.iv.next112.epil
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = add nsw i64 %89, %92
  %94 = srem i64 %93, 1000000007
  br label %._crit_edge89

._crit_edge89:                                    ; preds = %.lr.ph88.epil, %._crit_edge89.loopexit.unr-lcssa, %80
  %.054.lcssa = phi i64 [ 0, %80 ], [ %.lcssa.ph, %._crit_edge89.loopexit.unr-lcssa ], [ %94, %.lr.ph88.epil ]
  %95 = sext i32 %.05890 to i64
  %96 = add nsw i32 %.05692, 1
  %97 = sext i32 %96 to i64
  %98 = mul nsw i64 %.054.lcssa, %97
  %99 = add nsw i64 %98, %95
  %100 = srem i64 %99, 1000000007
  %101 = trunc nsw i64 %100 to i32
  br label %114

.lr.ph88:                                         ; preds = %.lr.ph88, %.lr.ph88.preheader.new
  %indvars.iv111 = phi i64 [ %87, %.lr.ph88.preheader.new ], [ %indvars.iv.next112.1, %.lr.ph88 ]
  %.05485 = phi i64 [ 0, %.lr.ph88.preheader.new ], [ %113, %.lr.ph88 ]
  %niter = phi i64 [ 0, %.lr.ph88.preheader.new ], [ %niter.next.1, %.lr.ph88 ]
  %indvars.iv.next112 = add nsw i64 %indvars.iv111, -1
  %102 = mul nsw i64 %.05485, 26
  %103 = getelementptr inbounds [27 x [100001 x i32]], ptr @seq, i64 0, i64 %83, i64 %indvars.iv.next112
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = add nsw i64 %102, %105
  %107 = srem i64 %106, 1000000007
  %indvars.iv.next112.1 = add nsw i64 %indvars.iv111, -2
  %108 = mul nsw i64 %107, 26
  %109 = getelementptr inbounds [27 x [100001 x i32]], ptr @seq, i64 0, i64 %83, i64 %indvars.iv.next112.1
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = add nsw i64 %108, %111
  %113 = srem i64 %112, 1000000007
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1.not = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1.not, label %._crit_edge89.loopexit.unr-lcssa, label %.lr.ph88, !llvm.loop !21

114:                                              ; preds = %78, %._crit_edge89
  %.159 = phi i32 [ %.05890, %78 ], [ %101, %._crit_edge89 ]
  %.1 = phi i32 [ %.05692, %78 ], [ %96, %._crit_edge89 ]
  %indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
  %exitcond117.not = icmp eq i64 %indvars.iv.next115, 26
  br i1 %exitcond117.not, label %73, label %78, !llvm.loop !22
}

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef, ptr noundef) local_unnamed_addr #3

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

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

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


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