; LLVM IR from tangjz/acm-icpc :: lydsy (5147)

; 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.std::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [3 x i64] }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@cnt = external dso_local global i32, align 4
@w = external dso_local global [27 x i32], align 16
@f = external dso_local global [151 x i32], align 16
@buf = external dso_local global [151 x i8], align 16
@pat = external dso_local global [151 x i8], align 16
@fst = external dso_local global [27 x %"class.std::bitset"], align 16
@mid = external dso_local global [27 x %"class.std::bitset"], align 16
@lst = external dso_local global [27 x %"class.std::bitset"], align 16
@g = external dso_local global [151 x [151 x %"class.std::bitset"]], 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 [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"class.std::bitset", align 8
  %12 = alloca %"class.std::bitset", align 8
  %13 = alloca %"class.std::bitset", align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %20

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

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

25:                                               ; preds = %20
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @pat)
  %27 = load i8, ptr @pat, align 16, !tbaa !9
  %28 = sext i8 %27 to i32
  %29 = sub nsw i32 %28, 97
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds i32, ptr @w, i64 %30
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %31)
  br label %33

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

36:                                               ; preds = %24
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @buf, ptr noundef @tot)
  %38 = call i64 @strlen(ptr noundef @buf) #9
  %39 = trunc i64 %38 to i32
  store i32 %39, ptr @n, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %103, %36
  %41 = load i32, ptr @tot, align 4, !tbaa !5
  %42 = add nsw i32 %41, -1
  store i32 %42, ptr @tot, align 4, !tbaa !5
  %43 = icmp ne i32 %41, 0
  br i1 %43, label %44, label %104

44:                                               ; preds = %40
  %45 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @pat)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %100, %44
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [151 x i8], ptr @pat, i64 0, i64 %48
  %50 = load i8, ptr %49, align 1, !tbaa !9
  %51 = icmp ne i8 %50, 0
  br i1 %51, label %53, label %52

52:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %103

53:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  %54 = load i32, ptr %3, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [151 x i8], ptr @pat, i64 0, i64 %55
  %57 = load i8, ptr %56, align 1, !tbaa !9
  %58 = sext i8 %57 to i32
  %59 = sub nsw i32 %58, 97
  store i32 %59, ptr %4, align 4, !tbaa !5
  %60 = load i32, ptr %3, align 4, !tbaa !5
  %61 = add nsw i32 %60, 1
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [151 x i8], ptr @pat, i64 0, i64 %62
  %64 = load i8, ptr %63, align 1, !tbaa !9
  %65 = icmp ne i8 %64, 0
  br i1 %65, label %79, label %66

66:                                               ; preds = %53
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [27 x %"class.std::bitset"], ptr @lst, i64 0, i64 %68
  %70 = load i32, ptr %3, align 4, !tbaa !5
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %74

72:                                               ; preds = %66
  %73 = load i32, ptr @cnt, align 4, !tbaa !5
  br label %75

74:                                               ; preds = %66
  br label %75

75:                                               ; preds = %74, %72
  %76 = phi i32 [ %73, %72 ], [ 0, %74 ]
  %77 = sext i32 %76 to i64
  %78 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6bitsetILm151EE3setEmb(ptr noundef nonnull align 8 dereferenceable(24) %69, i64 noundef %77, i1 noundef zeroext true)
  br label %99

79:                                               ; preds = %53
  %80 = load i32, ptr %3, align 4, !tbaa !5
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %90, label %82

82:                                               ; preds = %79
  %83 = load i32, ptr %4, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [27 x %"class.std::bitset"], ptr @fst, i64 0, i64 %84
  %86 = load i32, ptr @cnt, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr @cnt, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6bitsetILm151EE3setEmb(ptr noundef nonnull align 8 dereferenceable(24) %85, i64 noundef %88, i1 noundef zeroext true)
  br label %98

90:                                               ; preds = %79
  %91 = load i32, ptr %4, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [27 x %"class.std::bitset"], ptr @mid, i64 0, i64 %92
  %94 = load i32, ptr @cnt, align 4, !tbaa !5
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr @cnt, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6bitsetILm151EE3setEmb(ptr noundef nonnull align 8 dereferenceable(24) %93, i64 noundef %96, i1 noundef zeroext true)
  br label %98

98:                                               ; preds = %90, %82
  br label %99

99:                                               ; preds = %98, %75
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %100

100:                                              ; preds = %99
  %101 = load i32, ptr %3, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %3, align 4, !tbaa !5
  br label %46, !llvm.loop !12

103:                                              ; preds = %52
  br label %40, !llvm.loop !13

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

105:                                              ; preds = %139, %104
  %106 = load i32, ptr %5, align 4, !tbaa !5
  %107 = load i32, ptr @n, align 4, !tbaa !5
  %108 = icmp slt i32 %106, %107
  br i1 %108, label %110, label %109

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

110:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  %111 = load i32, ptr %5, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [151 x i8], ptr @buf, i64 0, i64 %112
  %114 = load i8, ptr %113, align 1, !tbaa !9
  %115 = sext i8 %114 to i32
  %116 = sub nsw i32 %115, 97
  store i32 %116, ptr %6, align 4, !tbaa !5
  %117 = load i32, ptr %6, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [27 x %"class.std::bitset"], ptr @fst, i64 0, i64 %118
  %120 = load i32, ptr %5, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [151 x [151 x %"class.std::bitset"]], ptr @g, i64 0, i64 %121
  %123 = load i32, ptr %5, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [151 x %"class.std::bitset"], ptr %122, i64 0, i64 %124
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %125, ptr align 8 %119, i64 24, i1 false)
  %126 = load i32, ptr %6, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [27 x %"class.std::bitset"], ptr @lst, i64 0, i64 %127
  %129 = call noundef zeroext i1 @_ZNKSt6bitsetILm151EE4testEm(ptr noundef nonnull align 8 dereferenceable(24) %128, i64 noundef 0)
  br i1 %129, label %130, label %138

130:                                              ; preds = %110
  %131 = load i32, ptr %5, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [151 x [151 x %"class.std::bitset"]], ptr @g, i64 0, i64 %132
  %134 = load i32, ptr %5, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [151 x %"class.std::bitset"], ptr %133, i64 0, i64 %135
  %137 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6bitsetILm151EE3setEmb(ptr noundef nonnull align 8 dereferenceable(24) %136, i64 noundef 0, i1 noundef zeroext true)
  br label %138

138:                                              ; preds = %130, %110
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  br label %139

139:                                              ; preds = %138
  %140 = load i32, ptr %5, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %5, align 4, !tbaa !5
  br label %105, !llvm.loop !14

142:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  %143 = load i32, ptr @n, align 4, !tbaa !5
  %144 = sub nsw i32 %143, 1
  store i32 %144, ptr %7, align 4, !tbaa !5
  br label %145

145:                                              ; preds = %258, %142
  %146 = load i32, ptr %7, align 4, !tbaa !5
  %147 = icmp sge i32 %146, 0
  br i1 %147, label %149, label %148

148:                                              ; preds = %145
  store i32 13, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %261

149:                                              ; preds = %145
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  %150 = load i32, ptr %7, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %9, align 4, !tbaa !5
  br label %152

152:                                              ; preds = %254, %149
  %153 = load i32, ptr %9, align 4, !tbaa !5
  %154 = load i32, ptr @n, align 4, !tbaa !5
  %155 = icmp slt i32 %153, %154
  br i1 %155, label %157, label %156

156:                                              ; preds = %152
  store i32 16, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %257

157:                                              ; preds = %152
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  %158 = load i32, ptr %9, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [151 x i8], ptr @buf, i64 0, i64 %159
  %161 = load i8, ptr %160, align 1, !tbaa !9
  %162 = sext i8 %161 to i32
  %163 = sub nsw i32 %162, 97
  store i32 %163, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #8
  %164 = load i32, ptr %7, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [151 x [151 x %"class.std::bitset"]], ptr @g, i64 0, i64 %165
  %167 = load i32, ptr %9, align 4, !tbaa !5
  %168 = sub nsw i32 %167, 1
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [151 x %"class.std::bitset"], ptr %166, i64 0, i64 %169
  call void @_ZNKSt6bitsetILm151EElsEm(ptr dead_on_unwind writable sret(%"class.std::bitset") align 8 %12, ptr noundef nonnull align 8 dereferenceable(24) %170, i64 noundef 1) #8
  %171 = load i32, ptr %10, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [27 x %"class.std::bitset"], ptr @mid, i64 0, i64 %172
  call void @_ZStanILm151EESt6bitsetIXT_EERKS1_S3_(ptr dead_on_unwind writable sret(%"class.std::bitset") align 8 %11, ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(24) %173) #8
  %174 = load i32, ptr %7, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [151 x [151 x %"class.std::bitset"]], ptr @g, i64 0, i64 %175
  %177 = load i32, ptr %9, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [151 x %"class.std::bitset"], ptr %176, i64 0, i64 %178
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %179, ptr align 8 %11, i64 24, i1 false)
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #8
  %180 = load i32, ptr %7, align 4, !tbaa !5
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [151 x [151 x %"class.std::bitset"]], ptr @g, i64 0, i64 %181
  %183 = load i32, ptr %9, align 4, !tbaa !5
  %184 = sub nsw i32 %183, 1
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [151 x %"class.std::bitset"], ptr %182, i64 0, i64 %185
  %187 = call noundef zeroext i1 @_ZNKSt6bitsetILm151EE4testEm(ptr noundef nonnull align 8 dereferenceable(24) %186, i64 noundef 0)
  br i1 %187, label %188, label %199

188:                                              ; preds = %157
  %189 = load i32, ptr %10, align 4, !tbaa !5
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [27 x %"class.std::bitset"], ptr @fst, i64 0, i64 %190
  %192 = load i32, ptr %7, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [151 x [151 x %"class.std::bitset"]], ptr @g, i64 0, i64 %193
  %195 = load i32, ptr %9, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [151 x %"class.std::bitset"], ptr %194, i64 0, i64 %196
  %198 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6bitsetILm151EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %197, ptr noundef nonnull align 8 dereferenceable(24) %191) #8
  br label %199

199:                                              ; preds = %188, %157
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #8
  %200 = load i32, ptr %7, align 4, !tbaa !5
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [151 x [151 x %"class.std::bitset"]], ptr @g, i64 0, i64 %201
  %203 = load i32, ptr %9, align 4, !tbaa !5
  %204 = sub nsw i32 %203, 1
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds [151 x %"class.std::bitset"], ptr %202, i64 0, i64 %205
  %207 = load i32, ptr %10, align 4, !tbaa !5
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [27 x %"class.std::bitset"], ptr @lst, i64 0, i64 %208
  call void @_ZStanILm151EESt6bitsetIXT_EERKS1_S3_(ptr dead_on_unwind writable sret(%"class.std::bitset") align 8 %13, ptr noundef nonnull align 8 dereferenceable(24) %206, ptr noundef nonnull align 8 dereferenceable(24) %209) #8
  %210 = call noundef zeroext i1 @_ZNKSt6bitsetILm151EE3anyEv(ptr noundef nonnull align 8 dereferenceable(24) %13) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #8
  br i1 %210, label %211, label %219

211:                                              ; preds = %199
  %212 = load i32, ptr %7, align 4, !tbaa !5
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [151 x [151 x %"class.std::bitset"]], ptr @g, i64 0, i64 %213
  %215 = load i32, ptr %9, align 4, !tbaa !5
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [151 x %"class.std::bitset"], ptr %214, i64 0, i64 %216
  %218 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6bitsetILm151EE3setEmb(ptr noundef nonnull align 8 dereferenceable(24) %217, i64 noundef 0, i1 noundef zeroext true)
  br label %219

219:                                              ; preds = %211, %199
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  %220 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %220, ptr %14, align 4, !tbaa !5
  br label %221

221:                                              ; preds = %250, %219
  %222 = load i32, ptr %14, align 4, !tbaa !5
  %223 = load i32, ptr %9, align 4, !tbaa !5
  %224 = icmp slt i32 %222, %223
  br i1 %224, label %226, label %225

225:                                              ; preds = %221
  store i32 19, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %253

226:                                              ; preds = %221
  %227 = load i32, ptr %14, align 4, !tbaa !5
  %228 = add nsw i32 %227, 1
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [151 x [151 x %"class.std::bitset"]], ptr @g, i64 0, i64 %229
  %231 = load i32, ptr %9, align 4, !tbaa !5
  %232 = sext i32 %231 to i64
  %233 = getelementptr inbounds [151 x %"class.std::bitset"], ptr %230, i64 0, i64 %232
  %234 = call noundef zeroext i1 @_ZNKSt6bitsetILm151EE4testEm(ptr noundef nonnull align 8 dereferenceable(24) %233, i64 noundef 0)
  br i1 %234, label %235, label %249

235:                                              ; preds = %226
  %236 = load i32, ptr %7, align 4, !tbaa !5
  %237 = sext i32 %236 to i64
  %238 = getelementptr inbounds [151 x [151 x %"class.std::bitset"]], ptr @g, i64 0, i64 %237
  %239 = load i32, ptr %14, align 4, !tbaa !5
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds [151 x %"class.std::bitset"], ptr %238, i64 0, i64 %240
  %242 = load i32, ptr %7, align 4, !tbaa !5
  %243 = sext i32 %242 to i64
  %244 = getelementptr inbounds [151 x [151 x %"class.std::bitset"]], ptr @g, i64 0, i64 %243
  %245 = load i32, ptr %9, align 4, !tbaa !5
  %246 = sext i32 %245 to i64
  %247 = getelementptr inbounds [151 x %"class.std::bitset"], ptr %244, i64 0, i64 %246
  %248 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6bitsetILm151EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %247, ptr noundef nonnull align 8 dereferenceable(24) %241) #8
  br label %249

249:                                              ; preds = %235, %226
  br label %250

250:                                              ; preds = %249
  %251 = load i32, ptr %14, align 4, !tbaa !5
  %252 = add nsw i32 %251, 1
  store i32 %252, ptr %14, align 4, !tbaa !5
  br label %221, !llvm.loop !15

253:                                              ; preds = %225
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %254

254:                                              ; preds = %253
  %255 = load i32, ptr %9, align 4, !tbaa !5
  %256 = add nsw i32 %255, 1
  store i32 %256, ptr %9, align 4, !tbaa !5
  br label %152, !llvm.loop !16

257:                                              ; preds = %156
  br label %258

258:                                              ; preds = %257
  %259 = load i32, ptr %7, align 4, !tbaa !5
  %260 = add nsw i32 %259, -1
  store i32 %260, ptr %7, align 4, !tbaa !5
  br label %145, !llvm.loop !17

261:                                              ; preds = %148
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 1, ptr %16, align 4, !tbaa !5
  br label %262

262:                                              ; preds = %318, %261
  %263 = load i32, ptr %16, align 4, !tbaa !5
  %264 = load i32, ptr @n, align 4, !tbaa !5
  %265 = icmp sle i32 %263, %264
  br i1 %265, label %267, label %266

266:                                              ; preds = %262
  store i32 22, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %321

267:                                              ; preds = %262
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  %268 = load i32, ptr %16, align 4, !tbaa !5
  %269 = sub nsw i32 %268, 1
  %270 = sext i32 %269 to i64
  %271 = getelementptr inbounds [151 x i8], ptr @buf, i64 0, i64 %270
  %272 = load i8, ptr %271, align 1, !tbaa !9
  %273 = sext i8 %272 to i32
  %274 = sub nsw i32 %273, 97
  %275 = sext i32 %274 to i64
  %276 = getelementptr inbounds [27 x i32], ptr @w, i64 0, i64 %275
  %277 = load i32, ptr %276, align 4, !tbaa !5
  store i32 %277, ptr %17, align 4, !tbaa !5
  %278 = load i32, ptr %17, align 4, !tbaa !5
  %279 = load i32, ptr %15, align 4, !tbaa !5
  %280 = add nsw i32 %279, %278
  store i32 %280, ptr %15, align 4, !tbaa !5
  %281 = load i32, ptr %16, align 4, !tbaa !5
  %282 = sub nsw i32 %281, 1
  %283 = sext i32 %282 to i64
  %284 = getelementptr inbounds [151 x i32], ptr @f, i64 0, i64 %283
  %285 = load i32, ptr %284, align 4, !tbaa !5
  %286 = load i32, ptr %17, align 4, !tbaa !5
  %287 = add nsw i32 %285, %286
  %288 = load i32, ptr %16, align 4, !tbaa !5
  %289 = sext i32 %288 to i64
  %290 = getelementptr inbounds [151 x i32], ptr @f, i64 0, i64 %289
  store i32 %287, ptr %290, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %291

291:                                              ; preds = %314, %267
  %292 = load i32, ptr %18, align 4, !tbaa !5
  %293 = load i32, ptr %16, align 4, !tbaa !5
  %294 = icmp slt i32 %292, %293
  br i1 %294, label %296, label %295

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

296:                                              ; preds = %291
  %297 = load i32, ptr %18, align 4, !tbaa !5
  %298 = sext i32 %297 to i64
  %299 = getelementptr inbounds [151 x [151 x %"class.std::bitset"]], ptr @g, i64 0, i64 %298
  %300 = load i32, ptr %16, align 4, !tbaa !5
  %301 = sub nsw i32 %300, 1
  %302 = sext i32 %301 to i64
  %303 = getelementptr inbounds [151 x %"class.std::bitset"], ptr %299, i64 0, i64 %302
  %304 = call noundef zeroext i1 @_ZNKSt6bitsetILm151EE4testEm(ptr noundef nonnull align 8 dereferenceable(24) %303, i64 noundef 0)
  br i1 %304, label %305, label %313

305:                                              ; preds = %296
  %306 = load i32, ptr %16, align 4, !tbaa !5
  %307 = sext i32 %306 to i64
  %308 = getelementptr inbounds [151 x i32], ptr @f, i64 0, i64 %307
  %309 = load i32, ptr %18, align 4, !tbaa !5
  %310 = sext i32 %309 to i64
  %311 = getelementptr inbounds [151 x i32], ptr @f, i64 0, i64 %310
  %312 = load i32, ptr %311, align 4, !tbaa !5
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %308, i32 noundef %312)
  br label %313

313:                                              ; preds = %305, %296
  br label %314

314:                                              ; preds = %313
  %315 = load i32, ptr %18, align 4, !tbaa !5
  %316 = add nsw i32 %315, 1
  store i32 %316, ptr %18, align 4, !tbaa !5
  br label %291, !llvm.loop !18

317:                                              ; preds = %295
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  br label %318

318:                                              ; preds = %317
  %319 = load i32, ptr %16, align 4, !tbaa !5
  %320 = add nsw i32 %319, 1
  store i32 %320, ptr %16, align 4, !tbaa !5
  br label %262, !llvm.loop !19

321:                                              ; preds = %266
  %322 = load i32, ptr %15, align 4, !tbaa !5
  %323 = load i32, ptr @n, align 4, !tbaa !5
  %324 = sext i32 %323 to i64
  %325 = getelementptr inbounds [151 x i32], ptr @f, i64 0, i64 %324
  %326 = load i32, ptr %325, align 4, !tbaa !5
  %327 = sub nsw i32 %322, %326
  %328 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %327)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  %329 = load i32, ptr %1, align 4
  ret i32 %329
}

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6bitsetILm151EE3setEmb(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, i1 noundef zeroext) #4 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6bitsetILm151EE4testEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZStanILm151EESt6bitsetIXT_EERKS1_S3_(ptr dead_on_unwind noalias writable sret(%"class.std::bitset") align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNKSt6bitsetILm151EElsEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset") align 8, ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #7 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6bitsetILm151EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #7 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6bitsetILm151EE3anyEv(ptr noundef nonnull align 8 dereferenceable(24)) #7 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) #6

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}


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

%"class.std::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [3 x i64] }

@n = external dso_local local_unnamed_addr global i32, align 4
@m = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@cnt = external dso_local local_unnamed_addr global i32, align 4
@w = external dso_local global [27 x i32], align 16
@f = external dso_local global [151 x i32], align 16
@buf = external dso_local global [151 x i8], align 16
@pat = external dso_local global [151 x i8], align 16
@fst = external dso_local global [27 x %"class.std::bitset"], align 16
@mid = external dso_local global [27 x %"class.std::bitset"], align 16
@lst = external dso_local global [27 x %"class.std::bitset"], align 16
@g = external dso_local global [151 x [151 x %"class.std::bitset"]], 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 [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %"class.std::bitset", align 8
  %2 = alloca %"class.std::bitset", align 8
  %3 = alloca %"class.std::bitset", align 8
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m)
  %5 = load i32, ptr @m, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @buf, ptr noundef nonnull @tot)
  %8 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @buf) #8
  %9 = trunc i64 %8 to i32
  store i32 %9, ptr @n, align 4, !tbaa !5
  %10 = load i32, ptr @tot, align 4, !tbaa !5
  %11 = add nsw i32 %10, -1
  store i32 %11, ptr @tot, align 4, !tbaa !5
  %.not94 = icmp eq i32 %10, 0
  br i1 %.not94, label %.preheader86, label %.lr.ph96

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.07189 = phi i32 [ %16, %.lr.ph ], [ 0, %0 ]
  %12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @pat)
  %13 = load i8, ptr @pat, align 16, !tbaa !9
  %14 = sext i8 %13 to i64
  %gep = getelementptr i32, ptr getelementptr (i8, ptr @w, i64 -388), i64 %14
  %15 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %gep)
  %16 = add nuw nsw i32 %.07189, 1
  %17 = load i32, ptr @m, align 4, !tbaa !5
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %.lr.ph, label %._crit_edge, !llvm.loop !10

.loopexit87:                                      ; preds = %47, %37, %.lr.ph96
  %19 = load i32, ptr @tot, align 4, !tbaa !5
  %20 = add nsw i32 %19, -1
  store i32 %20, ptr @tot, align 4, !tbaa !5
  %.not = icmp eq i32 %19, 0
  br i1 %.not, label %.preheader86.loopexit, label %.lr.ph96, !llvm.loop !12

.preheader86.loopexit:                            ; preds = %.loopexit87
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %.preheader86

.preheader86:                                     ; preds = %.preheader86.loopexit, %._crit_edge
  %21 = phi i32 [ %.pre, %.preheader86.loopexit ], [ %9, %._crit_edge ]
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.lr.ph98, label %.preheader.._crit_edge113_crit_edge

.lr.ph96:                                         ; preds = %._crit_edge, %.loopexit87
  %23 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @pat)
  %24 = load i8, ptr @pat, align 16, !tbaa !9
  %.not8090 = icmp eq i8 %24, 0
  br i1 %.not8090, label %.loopexit87, label %.lr.ph93.preheader

.lr.ph93.preheader:                               ; preds = %.lr.ph96
  %25 = sext i8 %24 to i64
  %26 = add nsw i64 %25, -97
  %27 = load i8, ptr getelementptr inbounds (i8, ptr @pat, i64 1), align 1, !tbaa !9
  %.not81.peel = icmp eq i8 %27, 0
  br i1 %.not81.peel, label %34, label %28

28:                                               ; preds = %.lr.ph93.preheader
  %29 = getelementptr inbounds [27 x %"class.std::bitset"], ptr @fst, i64 0, i64 %26
  %30 = load i32, ptr @cnt, align 4, !tbaa !5
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr @cnt, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6bitsetILm151EE3setEmb(ptr noundef nonnull align 8 dereferenceable(24) %29, i64 noundef %32, i1 noundef zeroext true)
  br label %37

34:                                               ; preds = %.lr.ph93.preheader
  %35 = getelementptr inbounds [27 x %"class.std::bitset"], ptr @lst, i64 0, i64 %26
  %36 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6bitsetILm151EE3setEmb(ptr noundef nonnull align 8 dereferenceable(24) %35, i64 noundef 0, i1 noundef zeroext true)
  br label %37

37:                                               ; preds = %34, %28
  %38 = load i8, ptr getelementptr inbounds (i8, ptr @pat, i64 1), align 1, !tbaa !9
  %.not80.peel = icmp eq i8 %38, 0
  br i1 %.not80.peel, label %.loopexit87, label %.lr.ph93

.lr.ph93:                                         ; preds = %37, %47
  %indvars.iv = phi i64 [ %indvars.iv.next, %47 ], [ 1, %37 ]
  %39 = phi i8 [ %50, %47 ], [ %38, %37 ]
  %40 = sext i8 %39 to i64
  %41 = add nsw i64 %40, -97
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %42 = getelementptr inbounds [151 x i8], ptr @pat, i64 0, i64 %indvars.iv.next
  %43 = load i8, ptr %42, align 1, !tbaa !9
  %.not81 = icmp eq i8 %43, 0
  %44 = load i32, ptr @cnt, align 4
  br i1 %.not81, label %47, label %45

45:                                               ; preds = %.lr.ph93
  %46 = add nsw i32 %44, 1
  store i32 %46, ptr @cnt, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %.lr.ph93, %45
  %.sink149 = phi i32 [ %46, %45 ], [ %44, %.lr.ph93 ]
  %mid.pn = phi ptr [ @mid, %45 ], [ @lst, %.lr.ph93 ]
  %.sink = getelementptr inbounds [27 x %"class.std::bitset"], ptr %mid.pn, i64 0, i64 %41
  %48 = sext i32 %.sink149 to i64
  %49 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6bitsetILm151EE3setEmb(ptr noundef nonnull align 8 dereferenceable(24) %.sink, i64 noundef %48, i1 noundef zeroext true)
  %50 = load i8, ptr %42, align 1, !tbaa !9
  %.not80 = icmp eq i8 %50, 0
  br i1 %.not80, label %.loopexit87, label %.lr.ph93, !llvm.loop !13

.preheader85:                                     ; preds = %65
  %51 = icmp sgt i32 %66, 0
  br i1 %51, label %.preheader84.preheader, label %.preheader.._crit_edge113_crit_edge

.preheader84.preheader:                           ; preds = %.preheader85
  %52 = add nsw i32 %66, -1
  %53 = zext nneg i32 %52 to i64
  %54 = zext nneg i32 %66 to i64
  br label %.preheader84

.lr.ph98:                                         ; preds = %.preheader86, %65
  %indvars.iv121 = phi i64 [ %indvars.iv.next122, %65 ], [ 0, %.preheader86 ]
  %55 = getelementptr inbounds [151 x i8], ptr @buf, i64 0, i64 %indvars.iv121
  %56 = load i8, ptr %55, align 1, !tbaa !9
  %57 = sext i8 %56 to i64
  %58 = add nsw i64 %57, -97
  %59 = getelementptr inbounds [27 x %"class.std::bitset"], ptr @fst, i64 0, i64 %58
  %60 = getelementptr inbounds [151 x [151 x %"class.std::bitset"]], ptr @g, i64 0, i64 %indvars.iv121, i64 %indvars.iv121
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %60, ptr noundef nonnull align 8 dereferenceable(24) %59, i64 24, i1 false)
  %61 = getelementptr inbounds [27 x %"class.std::bitset"], ptr @lst, i64 0, i64 %58
  %62 = tail call noundef zeroext i1 @_ZNKSt6bitsetILm151EE4testEm(ptr noundef nonnull align 8 dereferenceable(24) %61, i64 noundef 0)
  br i1 %62, label %63, label %65

63:                                               ; preds = %.lr.ph98
  %64 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6bitsetILm151EE3setEmb(ptr noundef nonnull align 8 dereferenceable(24) %60, i64 noundef 0, i1 noundef zeroext true)
  br label %65

65:                                               ; preds = %63, %.lr.ph98
  %indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1
  %66 = load i32, ptr @n, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = icmp slt i64 %indvars.iv.next122, %67
  br i1 %68, label %.lr.ph98, label %.preheader85, !llvm.loop !15

.loopexit:                                        ; preds = %._crit_edge102, %.preheader84
  %69 = phi i32 [ %71, %.preheader84 ], [ %96, %._crit_edge102 ]
  %70 = icmp sgt i64 %indvars.iv129, 1
  %indvars.iv.next125 = add nsw i64 %indvars.iv124, -1
  br i1 %70, label %.preheader84, label %.preheader, !llvm.loop !16

.preheader84:                                     ; preds = %.preheader84.preheader, %.loopexit
  %71 = phi i32 [ %66, %.preheader84.preheader ], [ %69, %.loopexit ]
  %indvars.iv129 = phi i64 [ %54, %.preheader84.preheader ], [ %indvars.iv.next130, %.loopexit ]
  %indvars.iv124 = phi i64 [ %53, %.preheader84.preheader ], [ %indvars.iv.next125, %.loopexit ]
  %indvars.iv.next130 = add nsw i64 %indvars.iv129, -1
  %72 = sext i32 %71 to i64
  %73 = icmp slt i64 %indvars.iv129, %72
  br i1 %73, label %.lr.ph104, label %.loopexit

.preheader:                                       ; preds = %.loopexit
  %.not79109 = icmp slt i32 %69, 1
  br i1 %.not79109, label %.preheader.._crit_edge113_crit_edge, label %.lr.ph112

.preheader.._crit_edge113_crit_edge:              ; preds = %.preheader86, %.preheader85, %.preheader
  %74 = phi i32 [ %69, %.preheader ], [ %66, %.preheader85 ], [ %21, %.preheader86 ]
  %.pre141 = sext i32 %74 to i64
  br label %._crit_edge113

.lr.ph104:                                        ; preds = %.preheader84, %._crit_edge102
  %indvars.iv131 = phi i64 [ %indvars.iv.next132, %._crit_edge102 ], [ %indvars.iv129, %.preheader84 ]
  %75 = getelementptr inbounds [151 x i8], ptr @buf, i64 0, i64 %indvars.iv131
  %76 = load i8, ptr %75, align 1, !tbaa !9
  %77 = sext i8 %76 to i64
  %78 = add nsw i64 %77, -97
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #9
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #9
  %79 = trunc nuw i64 %indvars.iv131 to i32
  %80 = add i64 %indvars.iv131, 4294967295
  %81 = and i64 %80, 4294967295
  %82 = getelementptr inbounds [151 x [151 x %"class.std::bitset"]], ptr @g, i64 0, i64 %indvars.iv.next130, i64 %81
  call void @_ZNKSt6bitsetILm151EElsEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset") align 8 %2, ptr noundef nonnull align 8 dereferenceable(24) %82, i64 noundef 1) #9
  %83 = getelementptr inbounds [27 x %"class.std::bitset"], ptr @mid, i64 0, i64 %78
  call void @_ZStanILm151EESt6bitsetIXT_EERKS1_S3_(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset") align 8 %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %83) #9
  %84 = getelementptr inbounds [151 x [151 x %"class.std::bitset"]], ptr @g, i64 0, i64 %indvars.iv.next130, i64 %indvars.iv131
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %84, ptr noundef nonnull align 8 dereferenceable(24) %1, i64 24, i1 false)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #9
  %85 = call noundef zeroext i1 @_ZNKSt6bitsetILm151EE4testEm(ptr noundef nonnull align 8 dereferenceable(24) %82, i64 noundef 0)
  br i1 %85, label %86, label %89

86:                                               ; preds = %.lr.ph104
  %87 = getelementptr inbounds [27 x %"class.std::bitset"], ptr @fst, i64 0, i64 %78
  %88 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6bitsetILm151EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %84, ptr noundef nonnull align 8 dereferenceable(24) %87) #9
  br label %89

89:                                               ; preds = %86, %.lr.ph104
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #9
  %90 = getelementptr inbounds [27 x %"class.std::bitset"], ptr @lst, i64 0, i64 %78
  call void @_ZStanILm151EESt6bitsetIXT_EERKS1_S3_(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset") align 8 %3, ptr noundef nonnull align 8 dereferenceable(24) %82, ptr noundef nonnull align 8 dereferenceable(24) %90) #9
  %91 = call noundef zeroext i1 @_ZNKSt6bitsetILm151EE3anyEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #9
  br i1 %91, label %92, label %94

92:                                               ; preds = %89
  %93 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6bitsetILm151EE3setEmb(ptr noundef nonnull align 8 dereferenceable(24) %84, i64 noundef 0, i1 noundef zeroext true)
  br label %94

94:                                               ; preds = %92, %89
  %sext = shl i64 %indvars.iv131, 32
  %95 = ashr exact i64 %sext, 32
  %.not116 = icmp sgt i64 %indvars.iv129, %95
  br i1 %.not116, label %._crit_edge102, label %.lr.ph101

._crit_edge102:                                   ; preds = %104, %94
  %indvars.iv.next132 = add nuw nsw i64 %indvars.iv131, 1
  %96 = load i32, ptr @n, align 4, !tbaa !5
  %97 = trunc nuw i64 %indvars.iv.next132 to i32
  %98 = icmp sgt i32 %96, %97
  br i1 %98, label %.lr.ph104, label %.loopexit, !llvm.loop !17

.lr.ph101:                                        ; preds = %94, %104
  %indvars.iv126 = phi i64 [ %indvars.iv.next127, %104 ], [ %indvars.iv124, %94 ]
  %indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
  %99 = getelementptr inbounds [151 x [151 x %"class.std::bitset"]], ptr @g, i64 0, i64 %indvars.iv.next127, i64 %indvars.iv131
  %100 = call noundef zeroext i1 @_ZNKSt6bitsetILm151EE4testEm(ptr noundef nonnull align 8 dereferenceable(24) %99, i64 noundef 0)
  br i1 %100, label %101, label %104

101:                                              ; preds = %.lr.ph101
  %102 = getelementptr inbounds [151 x [151 x %"class.std::bitset"]], ptr @g, i64 0, i64 %indvars.iv.next130, i64 %indvars.iv126
  %103 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6bitsetILm151EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %84, ptr noundef nonnull align 8 dereferenceable(24) %102) #9
  br label %104

104:                                              ; preds = %.lr.ph101, %101
  %105 = trunc nuw i64 %indvars.iv.next127 to i32
  %106 = icmp slt i32 %105, %79
  br i1 %106, label %.lr.ph101, label %._crit_edge102, !llvm.loop !18

._crit_edge113:                                   ; preds = %122, %.preheader.._crit_edge113_crit_edge
  %.pre-phi = phi i64 [ %.pre141, %.preheader.._crit_edge113_crit_edge ], [ %125, %122 ]
  %.069.lcssa = phi i32 [ 0, %.preheader.._crit_edge113_crit_edge ], [ %123, %122 ]
  %107 = getelementptr inbounds [151 x i32], ptr @f, i64 0, i64 %.pre-phi
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = sub nsw i32 %.069.lcssa, %108
  %110 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %109)
  ret i32 0

.lr.ph112:                                        ; preds = %.preheader, %122
  %indvars.iv138 = phi i64 [ %indvars.iv.next139, %122 ], [ 1, %.preheader ]
  %.069110 = phi i32 [ %123, %122 ], [ 0, %.preheader ]
  %111 = add nsw i64 %indvars.iv138, -1
  %112 = getelementptr inbounds [151 x i8], ptr @buf, i64 0, i64 %111
  %113 = load i8, ptr %112, align 1, !tbaa !9
  %114 = sext i8 %113 to i64
  %115 = add nsw i64 %114, -97
  %116 = getelementptr inbounds [27 x i32], ptr @w, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = getelementptr inbounds [151 x i32], ptr @f, i64 0, i64 %111
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = add nsw i32 %119, %117
  %121 = getelementptr inbounds [151 x i32], ptr @f, i64 0, i64 %indvars.iv138
  store i32 %120, ptr %121, align 4, !tbaa !5
  br label %126

122:                                              ; preds = %132
  %123 = add nsw i32 %117, %.069110
  %indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
  %124 = load i32, ptr @n, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %.not79.not = icmp slt i64 %indvars.iv138, %125
  br i1 %.not79.not, label %.lr.ph112, label %._crit_edge113, !llvm.loop !19

126:                                              ; preds = %.lr.ph112, %132
  %indvars.iv135 = phi i64 [ 0, %.lr.ph112 ], [ %indvars.iv.next136, %132 ]
  %127 = getelementptr inbounds [151 x [151 x %"class.std::bitset"]], ptr @g, i64 0, i64 %indvars.iv135, i64 %111
  %128 = call noundef zeroext i1 @_ZNKSt6bitsetILm151EE4testEm(ptr noundef nonnull align 8 dereferenceable(24) %127, i64 noundef 0)
  br i1 %128, label %129, label %132

129:                                              ; preds = %126
  %130 = getelementptr inbounds [151 x i32], ptr @f, i64 0, i64 %indvars.iv135
  %131 = load i32, ptr %130, align 4, !tbaa !5
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %121, i32 noundef %131)
  br label %132

132:                                              ; preds = %126, %129
  %indvars.iv.next136 = add nuw nsw i64 %indvars.iv135, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next136, %indvars.iv138
  br i1 %exitcond.not, label %122, label %126, !llvm.loop !20
}

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6bitsetILm151EE3setEmb(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, i1 noundef zeroext) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6bitsetILm151EE4testEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZStanILm151EESt6bitsetIXT_EERKS1_S3_(ptr dead_on_unwind noalias writable sret(%"class.std::bitset") align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNKSt6bitsetILm151EElsEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset") align 8, ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #7 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6bitsetILm151EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #7 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6bitsetILm151EE3anyEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #7 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) local_unnamed_addr #6

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

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


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