; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/74 Division 1/Problem B (B)

; 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.ww = type { %"class.std::__cxx11::basic_string", i32, i64, i64, i64, i64 }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@a = external dso_local global [1010 x %struct.ww], align 16
@i = external dso_local global i32, align 4
@j = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@t = external dso_local global i32, align 4
@f = external dso_local global [1010 x [1010 x i32]], align 16
@in = external dso_local global [1010 x i32], align 16
@p = external dso_local global [1010 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3bfsv() #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::__cxx11::basic_string", align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"class.std::__cxx11::basic_string", align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  store i32 1, ptr @i, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %229, %0
  %15 = load i32, ptr @i, align 4, !tbaa !5
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = icmp sle i32 %15, %16
  br i1 %17, label %18, label %232

18:                                               ; preds = %14
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef getelementptr inbounds (i8, ptr @p, i64 1))
  %20 = call i64 @strlen(ptr noundef getelementptr inbounds (i8, ptr @p, i64 1)) #8
  %21 = trunc i64 %20 to i32
  store i32 %21, ptr @m, align 4, !tbaa !5
  store i32 1, ptr @j, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %35, %18
  %23 = load i32, ptr @j, align 4, !tbaa !5
  %24 = load i32, ptr @m, align 4, !tbaa !5
  %25 = icmp sle i32 %23, %24
  br i1 %25, label %26, label %38

26:                                               ; preds = %22
  %27 = load i32, ptr @j, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %28
  %30 = load i8, ptr %29, align 1, !tbaa !9
  %31 = sext i8 %30 to i32
  %32 = icmp eq i32 %31, 46
  br i1 %32, label %33, label %34

33:                                               ; preds = %26
  br label %38

34:                                               ; preds = %26
  br label %35

35:                                               ; preds = %34
  %36 = load i32, ptr @j, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr @j, align 4, !tbaa !5
  br label %22, !llvm.loop !10

38:                                               ; preds = %33, %22
  %39 = load i32, ptr @j, align 4, !tbaa !5
  %40 = load i32, ptr @m, align 4, !tbaa !5
  %41 = icmp sle i32 %39, %40
  br i1 %41, label %42, label %215

42:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 32, ptr %2) #9
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #9
  store i32 1, ptr @k, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %55, %42
  %44 = load i32, ptr @k, align 4, !tbaa !5
  %45 = load i32, ptr @j, align 4, !tbaa !5
  %46 = sub nsw i32 %45, 1
  %47 = icmp sle i32 %44, %46
  br i1 %47, label %48, label %62

48:                                               ; preds = %43
  %49 = load i32, ptr @k, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %50
  %52 = load i8, ptr %51, align 1, !tbaa !9
  %53 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %2, i8 noundef signext %52)
          to label %54 unwind label %58

54:                                               ; preds = %48
  br label %55

55:                                               ; preds = %54
  %56 = load i32, ptr @k, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr @k, align 4, !tbaa !5
  br label %43, !llvm.loop !12

58:                                               ; preds = %48
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %3, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %4, align 4
  br label %214

62:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #9
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 8 dereferenceable(32) %2)
          to label %63 unwind label %88

63:                                               ; preds = %62
  %64 = invoke noundef i32 @_Z4findNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef %6)
          to label %65 unwind label %92

65:                                               ; preds = %63
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #9
  store i32 %64, ptr %5, align 4, !tbaa !5
  %66 = load i32, ptr @j, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %68
  %70 = load i8, ptr %69, align 1, !tbaa !9
  %71 = sext i8 %70 to i32
  %72 = icmp eq i32 %71, 112
  br i1 %72, label %73, label %149

73:                                               ; preds = %65
  %74 = load i32, ptr @j, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr @k, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %97, %73
  %77 = load i32, ptr @k, align 4, !tbaa !5
  %78 = load i32, ptr @m, align 4, !tbaa !5
  %79 = icmp sle i32 %77, %78
  br i1 %79, label %80, label %100

80:                                               ; preds = %76
  %81 = load i32, ptr @k, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %82
  %84 = load i8, ptr %83, align 1, !tbaa !9
  %85 = sext i8 %84 to i32
  %86 = icmp eq i32 %85, 40
  br i1 %86, label %87, label %96

87:                                               ; preds = %80
  br label %100

88:                                               ; preds = %62
  %89 = landingpad { ptr, i32 }
          cleanup
  %90 = extractvalue { ptr, i32 } %89, 0
  store ptr %90, ptr %3, align 8
  %91 = extractvalue { ptr, i32 } %89, 1
  store i32 %91, ptr %4, align 4
  br label %213

92:                                               ; preds = %63
  %93 = landingpad { ptr, i32 }
          cleanup
  %94 = extractvalue { ptr, i32 } %93, 0
  store ptr %94, ptr %3, align 8
  %95 = extractvalue { ptr, i32 } %93, 1
  store i32 %95, ptr %4, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #9
  br label %213

96:                                               ; preds = %80
  br label %97

97:                                               ; preds = %96
  %98 = load i32, ptr @k, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr @k, align 4, !tbaa !5
  br label %76, !llvm.loop !13

100:                                              ; preds = %87, %76
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #9
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #9
  %101 = load i32, ptr @k, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %8, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %115, %100
  %104 = load i32, ptr %8, align 4, !tbaa !5
  %105 = load i32, ptr @m, align 4, !tbaa !5
  %106 = sub nsw i32 %105, 1
  %107 = icmp sle i32 %104, %106
  br i1 %107, label %108, label %122

108:                                              ; preds = %103
  %109 = load i32, ptr %8, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %110
  %112 = load i8, ptr %111, align 1, !tbaa !9
  %113 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %7, i8 noundef signext %112)
          to label %114 unwind label %118

114:                                              ; preds = %108
  br label %115

115:                                              ; preds = %114
  %116 = load i32, ptr %8, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %8, align 4, !tbaa !5
  br label %103, !llvm.loop !14

118:                                              ; preds = %108
  %119 = landingpad { ptr, i32 }
          cleanup
  %120 = extractvalue { ptr, i32 } %119, 0
  store ptr %120, ptr %3, align 8
  %121 = extractvalue { ptr, i32 } %119, 1
  store i32 %121, ptr %4, align 4
  br label %148

122:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %123 unwind label %139

123:                                              ; preds = %122
  %124 = invoke noundef i32 @_Z4findNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef %10)
          to label %125 unwind label %143

125:                                              ; preds = %123
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #9
  store i32 %124, ptr %9, align 4, !tbaa !5
  %126 = load i32, ptr %5, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %127
  %129 = load i32, ptr %9, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [1010 x i32], ptr %128, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %131, align 4, !tbaa !5
  %134 = load i32, ptr %9, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [1010 x i32], ptr @in, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %136, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #9
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #9
  br label %212

139:                                              ; preds = %122
  %140 = landingpad { ptr, i32 }
          cleanup
  %141 = extractvalue { ptr, i32 } %140, 0
  store ptr %141, ptr %3, align 8
  %142 = extractvalue { ptr, i32 } %140, 1
  store i32 %142, ptr %4, align 4
  br label %147

143:                                              ; preds = %123
  %144 = landingpad { ptr, i32 }
          cleanup
  %145 = extractvalue { ptr, i32 } %144, 0
  store ptr %145, ptr %3, align 8
  %146 = extractvalue { ptr, i32 } %144, 1
  store i32 %146, ptr %4, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #9
  br label %147

147:                                              ; preds = %143, %139
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  br label %148

148:                                              ; preds = %147, %118
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #9
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #9
  br label %213

149:                                              ; preds = %65
  %150 = load i32, ptr @j, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr @k, align 4, !tbaa !5
  br label %152

152:                                              ; preds = %165, %149
  %153 = load i32, ptr @k, align 4, !tbaa !5
  %154 = load i32, ptr @m, align 4, !tbaa !5
  %155 = icmp sle i32 %153, %154
  br i1 %155, label %156, label %168

156:                                              ; preds = %152
  %157 = load i32, ptr @k, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %158
  %160 = load i8, ptr %159, align 1, !tbaa !9
  %161 = sext i8 %160 to i32
  %162 = icmp eq i32 %161, 40
  br i1 %162, label %163, label %164

163:                                              ; preds = %156
  br label %168

164:                                              ; preds = %156
  br label %165

165:                                              ; preds = %164
  %166 = load i32, ptr @k, align 4, !tbaa !5
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr @k, align 4, !tbaa !5
  br label %152, !llvm.loop !15

168:                                              ; preds = %163, %152
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  %169 = load i32, ptr @k, align 4, !tbaa !5
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr %12, align 4, !tbaa !5
  br label %171

171:                                              ; preds = %186, %168
  %172 = load i32, ptr %12, align 4, !tbaa !5
  %173 = load i32, ptr @m, align 4, !tbaa !5
  %174 = sub nsw i32 %173, 1
  %175 = icmp sle i32 %172, %174
  br i1 %175, label %176, label %189

176:                                              ; preds = %171
  %177 = load i32, ptr %11, align 4, !tbaa !5
  %178 = mul nsw i32 %177, 10
  %179 = load i32, ptr %12, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %180
  %182 = load i8, ptr %181, align 1, !tbaa !9
  %183 = sext i8 %182 to i32
  %184 = add nsw i32 %178, %183
  %185 = sub nsw i32 %184, 48
  store i32 %185, ptr %11, align 4, !tbaa !5
  br label %186

186:                                              ; preds = %176
  %187 = load i32, ptr %12, align 4, !tbaa !5
  %188 = add nsw i32 %187, 1
  store i32 %188, ptr %12, align 4, !tbaa !5
  br label %171, !llvm.loop !16

189:                                              ; preds = %171
  %190 = load i32, ptr @j, align 4, !tbaa !5
  %191 = add nsw i32 %190, 5
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %192
  %194 = load i8, ptr %193, align 1, !tbaa !9
  %195 = sext i8 %194 to i32
  %196 = icmp eq i32 %195, 98
  br i1 %196, label %197, label %204

197:                                              ; preds = %189
  %198 = load i32, ptr %11, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = load i32, ptr %5, align 4, !tbaa !5
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [1010 x %struct.ww], ptr @a, i64 0, i64 %201
  %203 = getelementptr inbounds %struct.ww, ptr %202, i32 0, i32 4
  store i64 %199, ptr %203, align 8, !tbaa !17
  br label %211

204:                                              ; preds = %189
  %205 = load i32, ptr %11, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = load i32, ptr %5, align 4, !tbaa !5
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [1010 x %struct.ww], ptr @a, i64 0, i64 %208
  %210 = getelementptr inbounds %struct.ww, ptr %209, i32 0, i32 5
  store i64 %206, ptr %210, align 8, !tbaa !24
  br label %211

211:                                              ; preds = %204, %197
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  br label %212

212:                                              ; preds = %211, %125
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #9
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %2) #9
  br label %228

213:                                              ; preds = %148, %92, %88
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #9
  br label %214

214:                                              ; preds = %213, %58
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %2) #9
  br label %249

215:                                              ; preds = %38
  %216 = load i8, ptr getelementptr inbounds ([1010 x i8], ptr @p, i64 0, i64 1), align 1, !tbaa !9
  %217 = sext i8 %216 to i32
  %218 = icmp eq i32 %217, 87
  br i1 %218, label %219, label %220

219:                                              ; preds = %215
  call void @_Z6Widgetv()
  br label %227

220:                                              ; preds = %215
  %221 = load i8, ptr getelementptr inbounds ([1010 x i8], ptr @p, i64 0, i64 1), align 1, !tbaa !9
  %222 = sext i8 %221 to i32
  %223 = icmp eq i32 %222, 72
  br i1 %223, label %224, label %225

224:                                              ; preds = %220
  call void @_Z4HBoxv()
  br label %226

225:                                              ; preds = %220
  call void @_Z4VBoxv()
  br label %226

226:                                              ; preds = %225, %224
  br label %227

227:                                              ; preds = %226, %219
  br label %228

228:                                              ; preds = %227, %212
  br label %229

229:                                              ; preds = %228
  %230 = load i32, ptr @i, align 4, !tbaa !5
  %231 = add nsw i32 %230, 1
  store i32 %231, ptr @i, align 4, !tbaa !5
  br label %14, !llvm.loop !25

232:                                              ; preds = %14
  call void @_Z3bfsv()
  %233 = load i32, ptr @t, align 4, !tbaa !5
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds %struct.ww, ptr @a, i64 %234
  %236 = getelementptr inbounds %struct.ww, ptr %235, i64 1
  call void @_ZSt4sortIP2wwPFbRKS0_S3_EEvT_S6_T0_(ptr noundef getelementptr inbounds (%struct.ww, ptr @a, i64 1), ptr noundef %236, ptr noundef @_Z3cc1RK2wwS1_)
  store i32 1, ptr @i, align 4, !tbaa !5
  br label %237

237:                                              ; preds = %245, %232
  %238 = load i32, ptr @i, align 4, !tbaa !5
  %239 = load i32, ptr @t, align 4, !tbaa !5
  %240 = icmp sle i32 %238, %239
  br i1 %240, label %241, label %248

241:                                              ; preds = %237
  %242 = load i32, ptr @i, align 4, !tbaa !5
  %243 = sext i32 %242 to i64
  %244 = getelementptr inbounds [1010 x %struct.ww], ptr @a, i64 0, i64 %243
  call void @_ZN2ww5printEv(ptr noundef nonnull align 8 dereferenceable(72) %244)
  br label %245

245:                                              ; preds = %241
  %246 = load i32, ptr @i, align 4, !tbaa !5
  %247 = add nsw i32 %246, 1
  store i32 %247, ptr @i, align 4, !tbaa !5
  br label %237, !llvm.loop !26

248:                                              ; preds = %237
  ret i32 0

249:                                              ; preds = %214
  %250 = load ptr, ptr %3, align 8
  %251 = load i32, ptr %4, align 4
  %252 = insertvalue { ptr, i32 } poison, ptr %250, 0
  %253 = insertvalue { ptr, i32 } %252, i32 %251, 1
  resume { ptr, i32 } %253
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z4findNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef) #6

; Function Attrs: mustprogress uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z6Widgetv() #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z4HBoxv() #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z4VBoxv() #6

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cc1RK2wwS1_(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef nonnull align 8 dereferenceable(72)) #7

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN2ww5printEv(ptr noundef nonnull align 8 dereferenceable(72)) #6 align 2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = { 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 #5 = { 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 #6 = { 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 #7 = { 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 #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 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = !{!18, !23, i64 56}
!18 = !{!"_ZTS2ww", !19, i64 0, !6, i64 32, !23, i64 40, !23, i64 48, !23, i64 56, !23, i64 64}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !20, i64 0, !22, i64 8, !7, i64 16}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !21, i64 0}
!21 = !{!"any pointer", !7, i64 0}
!22 = !{!"long", !7, i64 0}
!23 = !{!"long long", !7, i64 0}
!24 = !{!18, !23, i64 64}
!25 = distinct !{!25, !11}
!26 = distinct !{!26, !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"

%struct.ww = type { %"class.std::__cxx11::basic_string", i32, i64, i64, i64, i64 }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@a = external dso_local global [1010 x %struct.ww], align 16
@i = external dso_local local_unnamed_addr global i32, align 4
@j = external dso_local local_unnamed_addr global i32, align 4
@k = external dso_local local_unnamed_addr global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local local_unnamed_addr global i32, align 4
@t = external dso_local local_unnamed_addr global i32, align 4
@f = external dso_local local_unnamed_addr global [1010 x [1010 x i32]], align 16
@in = external dso_local local_unnamed_addr global [1010 x i32], align 16
@p = external dso_local global [1010 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3bfsv() local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::__cxx11::basic_string", align 8
  %2 = alloca %"class.std::__cxx11::basic_string", align 8
  %3 = alloca %"class.std::__cxx11::basic_string", align 8
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  store i32 1, ptr @i, align 4, !tbaa !5
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %.not82 = icmp slt i32 %6, 1
  br i1 %.not82, label %._crit_edge85, label %.lr.ph84

.lr.ph84:                                         ; preds = %0, %141
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull getelementptr inbounds (i8, ptr @p, i64 1))
  %8 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @p, i64 1)) #8
  %9 = trunc i64 %8 to i32
  store i32 %9, ptr @m, align 4, !tbaa !5
  %.not3149 = icmp slt i32 %9, 1
  br i1 %.not3149, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.lr.ph84
  %10 = add nuw nsw i64 %8, 1
  %wide.trip.count = and i64 %10, 4294967295
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %14
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next, %14 ]
  %11 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %indvars.iv
  %12 = load i8, ptr %11, align 1, !tbaa !9
  %13 = icmp eq i8 %12, 46
  br i1 %13, label %15, label %14

14:                                               ; preds = %.lr.ph
  %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 %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !10

15:                                               ; preds = %.lr.ph
  %16 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %16, ptr @j, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #9
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #9
  store i32 1, ptr @k, align 4, !tbaa !5
  %17 = load i32, ptr @j, align 4, !tbaa !5
  %.not34.not51 = icmp sgt i32 %17, 1
  br i1 %.not34.not51, label %.lr.ph54, label %._crit_edge55

.lr.ph54:                                         ; preds = %15, %22
  %storemerge3352 = phi i32 [ %24, %22 ], [ 1, %15 ]
  %18 = sext i32 %storemerge3352 to i64
  %19 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %18
  %20 = load i8, ptr %19, align 1, !tbaa !9
  %21 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %1, i8 noundef signext %20)
          to label %22 unwind label %26

22:                                               ; preds = %.lr.ph54
  %23 = load i32, ptr @k, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr @k, align 4, !tbaa !5
  %25 = load i32, ptr @j, align 4, !tbaa !5
  %.not34.not = icmp slt i32 %24, %25
  br i1 %.not34.not, label %.lr.ph54, label %._crit_edge55, !llvm.loop !12

26:                                               ; preds = %.lr.ph54
  %27 = landingpad { ptr, i32 }
          cleanup
  br label %134

._crit_edge55:                                    ; preds = %22, %15
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef nonnull align 8 dereferenceable(32) %1)
          to label %28 unwind label %47

28:                                               ; preds = %._crit_edge55
  %29 = invoke noundef i32 @_Z4findNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull %2)
          to label %30 unwind label %49

30:                                               ; preds = %28
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #9
  %31 = load i32, ptr @j, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %33
  %35 = load i8, ptr %34, align 1, !tbaa !9
  %36 = icmp eq i8 %35, 112
  %37 = load i32, ptr @m, align 4, !tbaa !5
  %.not3975.not = icmp slt i32 %31, %37
  br i1 %36, label %.preheader, label %.preheader47

.preheader47:                                     ; preds = %30
  br i1 %.not3975.not, label %.lr.ph59.preheader, label %._crit_edge60

.lr.ph59.preheader:                               ; preds = %.preheader47
  %38 = sext i32 %31 to i64
  %39 = add nsw i64 %38, 1
  %40 = add i32 %37, 1
  br label %.lr.ph59

.preheader:                                       ; preds = %30
  br i1 %.not3975.not, label %.lr.ph77.preheader, label %._crit_edge78

.lr.ph77.preheader:                               ; preds = %.preheader
  %41 = sext i32 %31 to i64
  %42 = add nsw i64 %41, 1
  %43 = add i32 %37, 1
  br label %.lr.ph77

.lr.ph77:                                         ; preds = %.lr.ph77.preheader, %51
  %indvars.iv103 = phi i64 [ %42, %.lr.ph77.preheader ], [ %indvars.iv.next104, %51 ]
  %44 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %indvars.iv103
  %45 = load i8, ptr %44, align 1, !tbaa !9
  %46 = icmp eq i8 %45, 40
  br i1 %46, label %._crit_edge78.loopexit.split.loop.exit, label %51

47:                                               ; preds = %._crit_edge55
  %48 = landingpad { ptr, i32 }
          cleanup
  br label %134

49:                                               ; preds = %28
  %50 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #9
  br label %134

51:                                               ; preds = %.lr.ph77
  %indvars.iv.next104 = add nsw i64 %indvars.iv103, 1
  %lftr.wideiv106 = trunc i64 %indvars.iv.next104 to i32
  %exitcond107.not = icmp eq i32 %43, %lftr.wideiv106
  br i1 %exitcond107.not, label %._crit_edge78, label %.lr.ph77, !llvm.loop !13

._crit_edge78.loopexit.split.loop.exit:           ; preds = %.lr.ph77
  %52 = trunc nsw i64 %indvars.iv103 to i32
  br label %._crit_edge78

._crit_edge78:                                    ; preds = %51, %._crit_edge78.loopexit.split.loop.exit, %.preheader
  %storemerge38.lcssa = phi i32 [ %32, %.preheader ], [ %52, %._crit_edge78.loopexit.split.loop.exit ], [ %43, %51 ]
  store i32 %storemerge38.lcssa, ptr @k, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #9
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #9
  %53 = load i32, ptr @k, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  br label %55

55:                                               ; preds = %59, %._crit_edge78
  %indvars.iv108 = phi i64 [ %indvars.iv.next109, %59 ], [ %54, %._crit_edge78 ]
  %56 = load i32, ptr @m, align 4, !tbaa !5
  %57 = add nsw i32 %56, -1
  %58 = sext i32 %57 to i64
  %.not40.not = icmp slt i64 %indvars.iv108, %58
  br i1 %.not40.not, label %59, label %65

59:                                               ; preds = %55
  %indvars.iv.next109 = add nsw i64 %indvars.iv108, 1
  %60 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %indvars.iv.next109
  %61 = load i8, ptr %60, align 1, !tbaa !9
  %62 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %3, i8 noundef signext %61)
          to label %55 unwind label %63, !llvm.loop !14

63:                                               ; preds = %59
  %64 = landingpad { ptr, i32 }
          cleanup
  br label %81

65:                                               ; preds = %55
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 8 dereferenceable(32) %3)
          to label %66 unwind label %77

66:                                               ; preds = %65
  %67 = invoke noundef i32 @_Z4findNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull %4)
          to label %68 unwind label %79

68:                                               ; preds = %66
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #9
  %69 = sext i32 %29 to i64
  %70 = sext i32 %67 to i64
  %71 = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %69, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %71, align 4, !tbaa !5
  %74 = getelementptr inbounds [1010 x i32], ptr @in, i64 0, i64 %70
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %74, align 4, !tbaa !5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #9
  br label %133

77:                                               ; preds = %65
  %78 = landingpad { ptr, i32 }
          cleanup
  br label %81

79:                                               ; preds = %66
  %80 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #9
  br label %81

81:                                               ; preds = %77, %79, %63
  %.pn42 = phi { ptr, i32 } [ %64, %63 ], [ %80, %79 ], [ %78, %77 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #9
  br label %134

.lr.ph59:                                         ; preds = %.lr.ph59.preheader, %85
  %indvars.iv94 = phi i64 [ %39, %.lr.ph59.preheader ], [ %indvars.iv.next95, %85 ]
  %82 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %indvars.iv94
  %83 = load i8, ptr %82, align 1, !tbaa !9
  %84 = icmp eq i8 %83, 40
  br i1 %84, label %._crit_edge60.loopexit.split.loop.exit, label %85

85:                                               ; preds = %.lr.ph59
  %indvars.iv.next95 = add nsw i64 %indvars.iv94, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next95 to i32
  %exitcond97.not = icmp eq i32 %40, %lftr.wideiv
  br i1 %exitcond97.not, label %._crit_edge60, label %.lr.ph59, !llvm.loop !15

._crit_edge60.loopexit.split.loop.exit:           ; preds = %.lr.ph59
  %86 = trunc nsw i64 %indvars.iv94 to i32
  br label %._crit_edge60

._crit_edge60:                                    ; preds = %85, %._crit_edge60.loopexit.split.loop.exit, %.preheader47
  %storemerge35.lcssa56 = phi i32 [ %32, %.preheader47 ], [ %86, %._crit_edge60.loopexit.split.loop.exit ], [ %40, %85 ]
  store i32 %storemerge35.lcssa56, ptr @k, align 4, !tbaa !5
  %87 = add nsw i32 %37, -1
  %.not37.not68 = icmp slt i32 %storemerge35.lcssa56, %87
  br i1 %.not37.not68, label %.lr.ph72.preheader, label %._crit_edge73

.lr.ph72.preheader:                               ; preds = %._crit_edge60
  %88 = sext i32 %storemerge35.lcssa56 to i64
  %wide.trip.count101 = sext i32 %87 to i64
  %89 = sub nsw i64 %wide.trip.count101, %88
  %xtraiter = and i64 %89, 3
  %90 = sub nsw i64 %88, %wide.trip.count101
  %91 = icmp ugt i64 %90, -4
  br i1 %91, label %._crit_edge73.loopexit.unr-lcssa, label %.lr.ph72.preheader.new

.lr.ph72.preheader.new:                           ; preds = %.lr.ph72.preheader
  %unroll_iter = and i64 %89, -4
  br label %.lr.ph72

.lr.ph72:                                         ; preds = %.lr.ph72, %.lr.ph72.preheader.new
  %indvars.iv98 = phi i64 [ %88, %.lr.ph72.preheader.new ], [ %indvars.iv.next99.3, %.lr.ph72 ]
  %.01569 = phi i32 [ 0, %.lr.ph72.preheader.new ], [ %115, %.lr.ph72 ]
  %niter = phi i64 [ 0, %.lr.ph72.preheader.new ], [ %niter.next.3, %.lr.ph72 ]
  %indvars.iv.next99 = add nsw i64 %indvars.iv98, 1
  %92 = mul nsw i32 %.01569, 10
  %93 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %indvars.iv.next99
  %94 = load i8, ptr %93, align 1, !tbaa !9
  %95 = sext i8 %94 to i32
  %96 = add i32 %92, -48
  %97 = add i32 %96, %95
  %indvars.iv.next99.1 = add nsw i64 %indvars.iv98, 2
  %98 = mul nsw i32 %97, 10
  %99 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %indvars.iv.next99.1
  %100 = load i8, ptr %99, align 1, !tbaa !9
  %101 = sext i8 %100 to i32
  %102 = add i32 %98, -48
  %103 = add i32 %102, %101
  %indvars.iv.next99.2 = add nsw i64 %indvars.iv98, 3
  %104 = mul nsw i32 %103, 10
  %105 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %indvars.iv.next99.2
  %106 = load i8, ptr %105, align 1, !tbaa !9
  %107 = sext i8 %106 to i32
  %108 = add i32 %104, -48
  %109 = add i32 %108, %107
  %indvars.iv.next99.3 = add nsw i64 %indvars.iv98, 4
  %110 = mul nsw i32 %109, 10
  %111 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %indvars.iv.next99.3
  %112 = load i8, ptr %111, align 1, !tbaa !9
  %113 = sext i8 %112 to i32
  %114 = add i32 %110, -48
  %115 = add i32 %114, %113
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge73.loopexit.unr-lcssa, label %.lr.ph72, !llvm.loop !16

._crit_edge73.loopexit.unr-lcssa:                 ; preds = %.lr.ph72, %.lr.ph72.preheader
  %.lcssa.ph = phi i32 [ poison, %.lr.ph72.preheader ], [ %115, %.lr.ph72 ]
  %indvars.iv98.unr = phi i64 [ %88, %.lr.ph72.preheader ], [ %indvars.iv.next99.3, %.lr.ph72 ]
  %.01569.unr = phi i32 [ 0, %.lr.ph72.preheader ], [ %115, %.lr.ph72 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge73, label %.lr.ph72.epil

.lr.ph72.epil:                                    ; preds = %._crit_edge73.loopexit.unr-lcssa, %.lr.ph72.epil
  %indvars.iv98.epil = phi i64 [ %indvars.iv.next99.epil, %.lr.ph72.epil ], [ %indvars.iv98.unr, %._crit_edge73.loopexit.unr-lcssa ]
  %.01569.epil = phi i32 [ %121, %.lr.ph72.epil ], [ %.01569.unr, %._crit_edge73.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph72.epil ], [ 0, %._crit_edge73.loopexit.unr-lcssa ]
  %indvars.iv.next99.epil = add nsw i64 %indvars.iv98.epil, 1
  %116 = mul nsw i32 %.01569.epil, 10
  %117 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %indvars.iv.next99.epil
  %118 = load i8, ptr %117, align 1, !tbaa !9
  %119 = sext i8 %118 to i32
  %120 = add i32 %116, -48
  %121 = add i32 %120, %119
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge73, label %.lr.ph72.epil, !llvm.loop !17

._crit_edge73:                                    ; preds = %._crit_edge73.loopexit.unr-lcssa, %.lr.ph72.epil, %._crit_edge60
  %.015.lcssa = phi i32 [ 0, %._crit_edge60 ], [ %.lcssa.ph, %._crit_edge73.loopexit.unr-lcssa ], [ %121, %.lr.ph72.epil ]
  %122 = add nsw i32 %31, 5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [1010 x i8], ptr @p, i64 0, i64 %123
  %125 = load i8, ptr %124, align 1, !tbaa !9
  %126 = icmp eq i8 %125, 98
  %127 = sext i32 %.015.lcssa to i64
  %128 = sext i32 %29 to i64
  br i1 %126, label %129, label %131

129:                                              ; preds = %._crit_edge73
  %130 = getelementptr inbounds [1010 x %struct.ww], ptr @a, i64 0, i64 %128, i32 4
  store i64 %127, ptr %130, align 8, !tbaa !19
  br label %133

131:                                              ; preds = %._crit_edge73
  %132 = getelementptr inbounds [1010 x %struct.ww], ptr @a, i64 0, i64 %128, i32 5
  store i64 %127, ptr %132, align 8, !tbaa !26
  br label %133

133:                                              ; preds = %129, %131, %68
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #9
  br label %141

134:                                              ; preds = %47, %49, %81, %26
  %.pn45 = phi { ptr, i32 } [ %27, %26 ], [ %.pn42, %81 ], [ %50, %49 ], [ %48, %47 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #9
  resume { ptr, i32 } %.pn45

._crit_edge.loopexit:                             ; preds = %14
  %135 = trunc i64 %8 to i32
  %136 = add nuw i32 %135, 1
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.lr.ph84
  %storemerge30.lcssa = phi i32 [ 1, %.lr.ph84 ], [ %136, %._crit_edge.loopexit ]
  store i32 %storemerge30.lcssa, ptr @j, align 4, !tbaa !5
  %137 = load i8, ptr getelementptr inbounds (i8, ptr @p, i64 1), align 1, !tbaa !9
  switch i8 %137, label %140 [
    i8 87, label %138
    i8 72, label %139
  ]

138:                                              ; preds = %._crit_edge
  call void @_Z6Widgetv()
  br label %141

139:                                              ; preds = %._crit_edge
  call void @_Z4HBoxv()
  br label %141

140:                                              ; preds = %._crit_edge
  call void @_Z4VBoxv()
  br label %141

141:                                              ; preds = %133, %139, %140, %138
  %142 = load i32, ptr @i, align 4, !tbaa !5
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr @i, align 4, !tbaa !5
  %144 = load i32, ptr @n, align 4, !tbaa !5
  %.not.not = icmp slt i32 %142, %144
  br i1 %.not.not, label %.lr.ph84, label %._crit_edge85, !llvm.loop !27

._crit_edge85:                                    ; preds = %141, %0
  call void @_Z3bfsv()
  %145 = load i32, ptr @t, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds %struct.ww, ptr @a, i64 %146
  %148 = getelementptr inbounds i8, ptr %147, i64 72
  call void @_ZSt4sortIP2wwPFbRKS0_S3_EEvT_S6_T0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 72), ptr noundef nonnull %148, ptr noundef nonnull @_Z3cc1RK2wwS1_)
  store i32 1, ptr @i, align 4, !tbaa !5
  %149 = load i32, ptr @t, align 4, !tbaa !5
  %.not2986 = icmp slt i32 %149, 1
  br i1 %.not2986, label %._crit_edge90, label %.lr.ph89

.lr.ph89:                                         ; preds = %._crit_edge85, %.lr.ph89
  %storemerge2887 = phi i32 [ %153, %.lr.ph89 ], [ 1, %._crit_edge85 ]
  %150 = sext i32 %storemerge2887 to i64
  %151 = getelementptr inbounds [1010 x %struct.ww], ptr @a, i64 0, i64 %150
  call void @_ZN2ww5printEv(ptr noundef nonnull align 8 dereferenceable(72) %151)
  %152 = load i32, ptr @i, align 4, !tbaa !5
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr @i, align 4, !tbaa !5
  %154 = load i32, ptr @t, align 4, !tbaa !5
  %.not29.not = icmp slt i32 %152, %154
  br i1 %.not29.not, label %.lr.ph89, label %._crit_edge90, !llvm.loop !28

._crit_edge90:                                    ; preds = %.lr.ph89, %._crit_edge85
  ret i32 0
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) local_unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z4findNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z6Widgetv() local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z4HBoxv() local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z4VBoxv() local_unnamed_addr #6

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cc1RK2wwS1_(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef nonnull align 8 dereferenceable(72)) #7

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN2ww5printEv(ptr noundef nonnull align 8 dereferenceable(72)) local_unnamed_addr #6 align 2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { 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 #7 = { 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 #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 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.unroll.disable"}
!19 = !{!20, !25, i64 56}
!20 = !{!"_ZTS2ww", !21, i64 0, !6, i64 32, !25, i64 40, !25, i64 48, !25, i64 56, !25, i64 64}
!21 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !22, i64 0, !24, i64 8, !7, i64 16}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !23, i64 0}
!23 = !{!"any pointer", !7, i64 0}
!24 = !{!"long", !7, i64 0}
!25 = !{!"long long", !7, i64 0}
!26 = !{!20, !25, i64 64}
!27 = distinct !{!27, !11}
!28 = distinct !{!28, !11}


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