; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/SHORT/COOK65/Problem C/C.ll (Z11buildStringv)

; 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::__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] }

@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@_Z1aB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@_Z1bB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@_Z3resB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@lcs = external dso_local global [1010 x [1010 x i32]], align 16
@nextPos = external dso_local global [1010 x [1010 x i32]], align 16
@ways = external dso_local global [1010 x [1010 x i32]], align 16
@id = external dso_local global [26 x i32], align 16
@inf = external dso_local global i32, align 4
@cnt = external dso_local global [26 x i32], align 16

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11buildStringv() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i8, align 1
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #3
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %24, %0
  %16 = load i32, ptr %1, align 4, !tbaa !5
  %17 = icmp slt i32 %16, 26
  br i1 %17, label %19, label %18

18:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #3
  br label %27

19:                                               ; preds = %15
  %20 = load i32, ptr @inf, align 4, !tbaa !5
  %21 = load i32, ptr %1, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [26 x i32], ptr @id, i64 0, i64 %22
  store i32 %20, ptr %23, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %19
  %25 = load i32, ptr %1, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %1, align 4, !tbaa !5
  br label %15, !llvm.loop !9

27:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = sub nsw i32 %28, 1
  store i32 %29, ptr %2, align 4, !tbaa !5
  br label %30

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

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

34:                                               ; preds = %30
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1bB5cxx11, i64 noundef %37)
  %39 = load i8, ptr %38, align 1, !tbaa !11
  %40 = sext i8 %39 to i32
  %41 = sub nsw i32 %40, 97
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [26 x i32], ptr @id, i64 0, i64 %42
  store i32 %35, ptr %43, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %44 = load i32, ptr @n, align 4, !tbaa !5
  %45 = sub nsw i32 %44, 1
  store i32 %45, ptr %4, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %66, %34
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = icmp sge i32 %47, 0
  br i1 %48, label %50, label %49

49:                                               ; preds = %46
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  br label %69

50:                                               ; preds = %46
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1aB5cxx11, i64 noundef %52)
  %54 = load i8, ptr %53, align 1, !tbaa !11
  %55 = sext i8 %54 to i32
  %56 = sub nsw i32 %55, 97
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [26 x i32], ptr @id, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [1010 x [1010 x i32]], ptr @nextPos, i64 0, i64 %61
  %63 = load i32, ptr %2, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [1010 x i32], ptr %62, i64 0, i64 %64
  store i32 %59, ptr %65, align 4, !tbaa !5
  br label %66

66:                                               ; preds = %50
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = add nsw i32 %67, -1
  store i32 %68, ptr %4, align 4, !tbaa !5
  br label %46, !llvm.loop !12

69:                                               ; preds = %49
  br label %70

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

73:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %74 = load i32, ptr @lcs, align 16, !tbaa !5
  store i32 %74, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %75 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %75, ptr %8, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %244, %73
  %77 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11) #3
  %78 = load i32, ptr %7, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = icmp ult i64 %77, %79
  br i1 %80, label %81, label %247

81:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %82 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %82, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %83 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %83, ptr %10, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %149, %81
  %85 = load i32, ptr %10, align 4, !tbaa !5
  %86 = load i32, ptr @n, align 4, !tbaa !5
  %87 = icmp slt i32 %85, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %84
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %152

89:                                               ; preds = %84
  %90 = load i32, ptr %10, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [1010 x [1010 x i32]], ptr @nextPos, i64 0, i64 %91
  %93 = load i32, ptr %9, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [1010 x i32], ptr %92, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = load i32, ptr @inf, align 4, !tbaa !5
  %98 = icmp eq i32 %96, %97
  br i1 %98, label %115, label %99

99:                                               ; preds = %89
  %100 = load i32, ptr %10, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [1010 x [1010 x i32]], ptr @lcs, i64 0, i64 %101
  %103 = load i32, ptr %10, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [1010 x [1010 x i32]], ptr @nextPos, i64 0, i64 %104
  %106 = load i32, ptr %9, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [1010 x i32], ptr %105, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [1010 x i32], ptr %102, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = load i32, ptr %8, align 4, !tbaa !5
  %114 = icmp ne i32 %112, %113
  br i1 %114, label %115, label %116

115:                                              ; preds = %99, %89
  br label %149

116:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %117 = load i32, ptr %10, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1aB5cxx11, i64 noundef %118)
  %120 = load i8, ptr %119, align 1, !tbaa !11
  %121 = sext i8 %120 to i32
  %122 = sub nsw i32 %121, 97
  store i32 %122, ptr %11, align 4, !tbaa !5
  %123 = load i32, ptr %11, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [26 x i32], ptr @cnt, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = icmp sgt i32 %126, 0
  br i1 %127, label %128, label %129

128:                                              ; preds = %116
  store i32 15, ptr %3, align 4
  br label %146

129:                                              ; preds = %116
  %130 = load i32, ptr %10, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %131
  %133 = load i32, ptr %10, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [1010 x [1010 x i32]], ptr @nextPos, i64 0, i64 %134
  %136 = load i32, ptr %9, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [1010 x i32], ptr %135, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [1010 x i32], ptr %132, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = load i32, ptr %11, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [26 x i32], ptr @cnt, i64 0, i64 %144
  store i32 %142, ptr %145, align 4, !tbaa !5
  store i32 0, ptr %3, align 4
  br label %146

146:                                              ; preds = %129, %128
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  %147 = load i32, ptr %3, align 4
  switch i32 %147, label %248 [
    i32 0, label %148
    i32 15, label %149
  ]

148:                                              ; preds = %146
  br label %149

149:                                              ; preds = %148, %146, %115
  %150 = load i32, ptr %10, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %10, align 4, !tbaa !5
  br label %84, !llvm.loop !14

152:                                              ; preds = %88
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #3
  store i8 97, ptr %12, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %153

153:                                              ; preds = %181, %152
  %154 = load i32, ptr %13, align 4, !tbaa !5
  %155 = icmp slt i32 %154, 26
  br i1 %155, label %157, label %156

156:                                              ; preds = %153
  store i32 16, ptr %3, align 4
  br label %184

157:                                              ; preds = %153
  %158 = load i32, ptr %13, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [26 x i32], ptr @cnt, i64 0, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !5
  %162 = load i32, ptr @k, align 4, !tbaa !5
  %163 = icmp sge i32 %161, %162
  br i1 %163, label %164, label %170

164:                                              ; preds = %157
  %165 = load i32, ptr %13, align 4, !tbaa !5
  %166 = add nsw i32 97, %165
  %167 = trunc i32 %166 to i8
  store i8 %167, ptr %12, align 1, !tbaa !11
  %168 = load i8, ptr %12, align 1, !tbaa !11
  %169 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11, i8 noundef signext %168)
  store i32 16, ptr %3, align 4
  br label %184

170:                                              ; preds = %157
  %171 = load i32, ptr %13, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [26 x i32], ptr @cnt, i64 0, i64 %172
  %174 = load i32, ptr %173, align 4, !tbaa !5
  %175 = load i32, ptr @k, align 4, !tbaa !5
  %176 = sub nsw i32 %175, %174
  store i32 %176, ptr @k, align 4, !tbaa !5
  br label %177

177:                                              ; preds = %170
  %178 = load i32, ptr %13, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [26 x i32], ptr @cnt, i64 0, i64 %179
  store i32 0, ptr %180, align 4, !tbaa !5
  br label %181

181:                                              ; preds = %177
  %182 = load i32, ptr %13, align 4, !tbaa !5
  %183 = add nsw i32 %182, 1
  store i32 %183, ptr %13, align 4, !tbaa !5
  br label %153, !llvm.loop !15

184:                                              ; preds = %164, %156
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  br label %185

185:                                              ; preds = %184
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %186 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %186, ptr %14, align 4, !tbaa !5
  br label %187

187:                                              ; preds = %240, %185
  %188 = load i32, ptr %14, align 4, !tbaa !5
  %189 = load i32, ptr @n, align 4, !tbaa !5
  %190 = icmp slt i32 %188, %189
  br i1 %190, label %192, label %191

191:                                              ; preds = %187
  store i32 19, ptr %3, align 4
  br label %243

192:                                              ; preds = %187
  %193 = load i32, ptr %14, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [1010 x [1010 x i32]], ptr @nextPos, i64 0, i64 %194
  %196 = load i32, ptr %9, align 4, !tbaa !5
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [1010 x i32], ptr %195, i64 0, i64 %197
  %199 = load i32, ptr %198, align 4, !tbaa !5
  %200 = load i32, ptr @inf, align 4, !tbaa !5
  %201 = icmp eq i32 %199, %200
  br i1 %201, label %218, label %202

202:                                              ; preds = %192
  %203 = load i32, ptr %14, align 4, !tbaa !5
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [1010 x [1010 x i32]], ptr @lcs, i64 0, i64 %204
  %206 = load i32, ptr %14, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [1010 x [1010 x i32]], ptr @nextPos, i64 0, i64 %207
  %209 = load i32, ptr %9, align 4, !tbaa !5
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds [1010 x i32], ptr %208, i64 0, i64 %210
  %212 = load i32, ptr %211, align 4, !tbaa !5
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [1010 x i32], ptr %205, i64 0, i64 %213
  %215 = load i32, ptr %214, align 4, !tbaa !5
  %216 = load i32, ptr %8, align 4, !tbaa !5
  %217 = icmp ne i32 %215, %216
  br i1 %217, label %218, label %219

218:                                              ; preds = %202, %192
  br label %240

219:                                              ; preds = %202
  %220 = load i32, ptr %14, align 4, !tbaa !5
  %221 = sext i32 %220 to i64
  %222 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1aB5cxx11, i64 noundef %221)
  %223 = load i8, ptr %222, align 1, !tbaa !11
  %224 = sext i8 %223 to i32
  %225 = load i8, ptr %12, align 1, !tbaa !11
  %226 = sext i8 %225 to i32
  %227 = icmp eq i32 %224, %226
  br i1 %227, label %228, label %239

228:                                              ; preds = %219
  %229 = load i32, ptr %14, align 4, !tbaa !5
  %230 = add nsw i32 %229, 1
  store i32 %230, ptr %5, align 4, !tbaa !5
  %231 = load i32, ptr %14, align 4, !tbaa !5
  %232 = sext i32 %231 to i64
  %233 = getelementptr inbounds [1010 x [1010 x i32]], ptr @nextPos, i64 0, i64 %232
  %234 = load i32, ptr %9, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds [1010 x i32], ptr %233, i64 0, i64 %235
  %237 = load i32, ptr %236, align 4, !tbaa !5
  %238 = add nsw i32 %237, 1
  store i32 %238, ptr %6, align 4, !tbaa !5
  store i32 19, ptr %3, align 4
  br label %243

239:                                              ; preds = %219
  br label %240

240:                                              ; preds = %239, %218
  %241 = load i32, ptr %14, align 4, !tbaa !5
  %242 = add nsw i32 %241, 1
  store i32 %242, ptr %14, align 4, !tbaa !5
  br label %187, !llvm.loop !16

243:                                              ; preds = %228, %191
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  br label %244

244:                                              ; preds = %243
  %245 = load i32, ptr %8, align 4, !tbaa !5
  %246 = add nsw i32 %245, -1
  store i32 %246, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %76, !llvm.loop !17

247:                                              ; preds = %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret void

248:                                              ; preds = %146
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 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) #2 align 2

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

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

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


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

%"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] }

@n = external dso_local local_unnamed_addr global i32, align 4
@k = external dso_local local_unnamed_addr global i32, align 4
@_Z1aB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@_Z1bB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@_Z3resB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@lcs = external dso_local local_unnamed_addr global [1010 x [1010 x i32]], align 16
@nextPos = external dso_local local_unnamed_addr global [1010 x [1010 x i32]], align 16
@ways = external dso_local local_unnamed_addr global [1010 x [1010 x i32]], align 16
@id = external dso_local local_unnamed_addr global [26 x i32], align 16
@inf = external dso_local local_unnamed_addr global i32, align 4
@cnt = external dso_local local_unnamed_addr global [26 x i32], align 16

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11buildStringv() local_unnamed_addr #1 {
  %1 = load i32, ptr @inf, align 4, !tbaa !5
  %2 = insertelement <4 x i32> poison, i32 %1, i64 0
  %3 = shufflevector <4 x i32> %2, <4 x i32> poison, <4 x i32> zeroinitializer
  store <4 x i32> %3, ptr @id, align 16, !tbaa !5
  store <4 x i32> %3, ptr getelementptr inbounds (i8, ptr @id, i64 16), align 16, !tbaa !5
  store <4 x i32> %3, ptr getelementptr inbounds (i8, ptr @id, i64 32), align 16, !tbaa !5
  store <4 x i32> %3, ptr getelementptr inbounds (i8, ptr @id, i64 48), align 16, !tbaa !5
  store <4 x i32> %3, ptr getelementptr inbounds (i8, ptr @id, i64 64), align 16, !tbaa !5
  store <4 x i32> %3, ptr getelementptr inbounds (i8, ptr @id, i64 80), align 16, !tbaa !5
  store i32 %1, ptr getelementptr inbounds (i8, ptr @id, i64 96), align 16, !tbaa !5
  store i32 %1, ptr getelementptr inbounds (i8, ptr @id, i64 100), align 4, !tbaa !5
  %4 = load i32, ptr @n, align 4, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.lr.ph77.preheader, label %._crit_edge

.lr.ph77.preheader:                               ; preds = %0
  %6 = zext nneg i32 %4 to i64
  br label %.lr.ph77

.loopexit70:                                      ; preds = %.lr.ph, %.lr.ph77
  %7 = icmp sgt i64 %indvars.iv93, 1
  br i1 %7, label %.lr.ph77, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.loopexit70, %0
  %8 = load i32, ptr @lcs, align 16, !tbaa !5
  %9 = tail call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11) #2
  %10 = sext i32 %8 to i64
  %11 = icmp ult i64 %9, %10
  br i1 %11, label %.preheader69, label %._crit_edge87

.lr.ph77:                                         ; preds = %.lr.ph77.preheader, %.loopexit70
  %indvars.iv93 = phi i64 [ %6, %.lr.ph77.preheader ], [ %indvars.iv.next94, %.loopexit70 ]
  %indvars.iv.next94 = add nsw i64 %indvars.iv93, -1
  %12 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1bB5cxx11, i64 noundef %indvars.iv.next94)
  %13 = load i8, ptr %12, align 1, !tbaa !11
  %14 = sext i8 %13 to i64
  %15 = add nsw i64 %14, -97
  %16 = getelementptr inbounds [26 x i32], ptr @id, i64 0, i64 %15
  %17 = trunc nuw nsw i64 %indvars.iv.next94 to i32
  store i32 %17, ptr %16, align 4, !tbaa !5
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.lr.ph.preheader, label %.loopexit70

.lr.ph.preheader:                                 ; preds = %.lr.ph77
  %20 = zext nneg i32 %18 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ %20, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %21 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1aB5cxx11, i64 noundef %indvars.iv.next)
  %22 = load i8, ptr %21, align 1, !tbaa !11
  %23 = sext i8 %22 to i64
  %24 = add nsw i64 %23, -97
  %25 = getelementptr inbounds [26 x i32], ptr @id, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = getelementptr inbounds [1010 x [1010 x i32]], ptr @nextPos, i64 0, i64 %indvars.iv.next, i64 %indvars.iv.next94
  store i32 %26, ptr %27, align 4, !tbaa !5
  %28 = icmp ugt i64 %indvars.iv, 1
  br i1 %28, label %.lr.ph, label %.loopexit70, !llvm.loop !12

.preheader69:                                     ; preds = %._crit_edge, %.loopexit
  %.05786 = phi i32 [ %168, %.loopexit ], [ %8, %._crit_edge ]
  %.05885 = phi i32 [ %.1, %.loopexit ], [ 0, %._crit_edge ]
  %.05984 = phi i32 [ %.160, %.loopexit ], [ 0, %._crit_edge ]
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = icmp slt i32 %.05984, %29
  br i1 %30, label %.lr.ph79, label %.preheader

.lr.ph79:                                         ; preds = %.preheader69
  %31 = sext i32 %.05885 to i64
  %32 = sext i32 %.05984 to i64
  %.pre105 = load i32, ptr @inf, align 4, !tbaa !5
  br label %35

.preheader:                                       ; preds = %57, %.preheader69
  %33 = phi i32 [ %29, %.preheader69 ], [ %59, %57 ]
  %k.promoted = load i32, ptr @k, align 4, !tbaa !5
  %34 = load i32, ptr @cnt, align 16, !tbaa !5
  %.not = icmp slt i32 %34, %k.promoted
  br i1 %.not, label %64, label %62

35:                                               ; preds = %.lr.ph79, %57
  %36 = phi i32 [ %.pre105, %.lr.ph79 ], [ %58, %57 ]
  %indvars.iv96 = phi i64 [ %32, %.lr.ph79 ], [ %indvars.iv.next97, %57 ]
  %37 = getelementptr inbounds [1010 x [1010 x i32]], ptr @nextPos, i64 0, i64 %indvars.iv96, i64 %31
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = icmp eq i32 %38, %36
  br i1 %39, label %57, label %40

40:                                               ; preds = %35
  %41 = sext i32 %38 to i64
  %42 = getelementptr inbounds [1010 x [1010 x i32]], ptr @lcs, i64 0, i64 %indvars.iv96, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %.not67 = icmp eq i32 %43, %.05786
  br i1 %.not67, label %44, label %57

44:                                               ; preds = %40
  %45 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1aB5cxx11, i64 noundef %indvars.iv96)
  %46 = load i8, ptr %45, align 1, !tbaa !11
  %47 = sext i8 %46 to i64
  %48 = add nsw i64 %47, -97
  %49 = getelementptr inbounds [26 x i32], ptr @cnt, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = icmp sgt i32 %50, 0
  %.pre = load i32, ptr @inf, align 4, !tbaa !5
  br i1 %51, label %57, label %52

52:                                               ; preds = %44
  %53 = load i32, ptr %37, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %indvars.iv96, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  store i32 %56, ptr %49, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %52, %44, %35, %40
  %58 = phi i32 [ %.pre, %52 ], [ %.pre, %44 ], [ %36, %35 ], [ %36, %40 ]
  %indvars.iv.next97 = add nsw i64 %indvars.iv96, 1
  %59 = load i32, ptr @n, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = icmp slt i64 %indvars.iv.next97, %60
  br i1 %61, label %35, label %.preheader, !llvm.loop !13

62:                                               ; preds = %136, %133, %130, %127, %124, %121, %118, %115, %112, %109, %106, %103, %100, %97, %94, %91, %88, %85, %82, %79, %76, %73, %70, %67, %64, %.preheader
  %.05280.lcssa.wide = phi i8 [ 97, %.preheader ], [ 98, %64 ], [ 99, %67 ], [ 100, %70 ], [ 101, %73 ], [ 102, %76 ], [ 103, %79 ], [ 104, %82 ], [ 105, %85 ], [ 106, %88 ], [ 107, %91 ], [ 108, %94 ], [ 109, %97 ], [ 110, %100 ], [ 111, %103 ], [ 112, %106 ], [ 113, %109 ], [ 114, %112 ], [ 115, %115 ], [ 116, %118 ], [ 117, %121 ], [ 118, %124 ], [ 119, %127 ], [ 120, %130 ], [ 121, %133 ], [ 122, %136 ]
  %63 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11, i8 noundef signext %.05280.lcssa.wide)
  %.pre106 = load i32, ptr @n, align 4, !tbaa !5
  br label %.loopexit68

64:                                               ; preds = %.preheader
  %65 = sub nsw i32 %k.promoted, %34
  store i32 %65, ptr @k, align 4, !tbaa !5
  store i32 0, ptr @cnt, align 16, !tbaa !5
  %66 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 4), align 4, !tbaa !5
  %.not.1 = icmp slt i32 %66, %65
  br i1 %.not.1, label %67, label %62

67:                                               ; preds = %64
  %68 = sub nsw i32 %65, %66
  store i32 %68, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 4), align 4, !tbaa !5
  %69 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 8), align 8, !tbaa !5
  %.not.2 = icmp slt i32 %69, %68
  br i1 %.not.2, label %70, label %62

70:                                               ; preds = %67
  %71 = sub nsw i32 %68, %69
  store i32 %71, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 8), align 8, !tbaa !5
  %72 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 12), align 4, !tbaa !5
  %.not.3 = icmp slt i32 %72, %71
  br i1 %.not.3, label %73, label %62

73:                                               ; preds = %70
  %74 = sub nsw i32 %71, %72
  store i32 %74, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 12), align 4, !tbaa !5
  %75 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 16), align 16, !tbaa !5
  %.not.4 = icmp slt i32 %75, %74
  br i1 %.not.4, label %76, label %62

76:                                               ; preds = %73
  %77 = sub nsw i32 %74, %75
  store i32 %77, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 16), align 16, !tbaa !5
  %78 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 20), align 4, !tbaa !5
  %.not.5 = icmp slt i32 %78, %77
  br i1 %.not.5, label %79, label %62

79:                                               ; preds = %76
  %80 = sub nsw i32 %77, %78
  store i32 %80, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 20), align 4, !tbaa !5
  %81 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 24), align 8, !tbaa !5
  %.not.6 = icmp slt i32 %81, %80
  br i1 %.not.6, label %82, label %62

82:                                               ; preds = %79
  %83 = sub nsw i32 %80, %81
  store i32 %83, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 24), align 8, !tbaa !5
  %84 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 28), align 4, !tbaa !5
  %.not.7 = icmp slt i32 %84, %83
  br i1 %.not.7, label %85, label %62

85:                                               ; preds = %82
  %86 = sub nsw i32 %83, %84
  store i32 %86, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 28), align 4, !tbaa !5
  %87 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 32), align 16, !tbaa !5
  %.not.8 = icmp slt i32 %87, %86
  br i1 %.not.8, label %88, label %62

88:                                               ; preds = %85
  %89 = sub nsw i32 %86, %87
  store i32 %89, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 32), align 16, !tbaa !5
  %90 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 36), align 4, !tbaa !5
  %.not.9 = icmp slt i32 %90, %89
  br i1 %.not.9, label %91, label %62

91:                                               ; preds = %88
  %92 = sub nsw i32 %89, %90
  store i32 %92, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 36), align 4, !tbaa !5
  %93 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 40), align 8, !tbaa !5
  %.not.10 = icmp slt i32 %93, %92
  br i1 %.not.10, label %94, label %62

94:                                               ; preds = %91
  %95 = sub nsw i32 %92, %93
  store i32 %95, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 40), align 8, !tbaa !5
  %96 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 44), align 4, !tbaa !5
  %.not.11 = icmp slt i32 %96, %95
  br i1 %.not.11, label %97, label %62

97:                                               ; preds = %94
  %98 = sub nsw i32 %95, %96
  store i32 %98, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 44), align 4, !tbaa !5
  %99 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 48), align 16, !tbaa !5
  %.not.12 = icmp slt i32 %99, %98
  br i1 %.not.12, label %100, label %62

100:                                              ; preds = %97
  %101 = sub nsw i32 %98, %99
  store i32 %101, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 48), align 16, !tbaa !5
  %102 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 52), align 4, !tbaa !5
  %.not.13 = icmp slt i32 %102, %101
  br i1 %.not.13, label %103, label %62

103:                                              ; preds = %100
  %104 = sub nsw i32 %101, %102
  store i32 %104, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 52), align 4, !tbaa !5
  %105 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 56), align 8, !tbaa !5
  %.not.14 = icmp slt i32 %105, %104
  br i1 %.not.14, label %106, label %62

106:                                              ; preds = %103
  %107 = sub nsw i32 %104, %105
  store i32 %107, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 56), align 8, !tbaa !5
  %108 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 60), align 4, !tbaa !5
  %.not.15 = icmp slt i32 %108, %107
  br i1 %.not.15, label %109, label %62

109:                                              ; preds = %106
  %110 = sub nsw i32 %107, %108
  store i32 %110, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 60), align 4, !tbaa !5
  %111 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 64), align 16, !tbaa !5
  %.not.16 = icmp slt i32 %111, %110
  br i1 %.not.16, label %112, label %62

112:                                              ; preds = %109
  %113 = sub nsw i32 %110, %111
  store i32 %113, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 64), align 16, !tbaa !5
  %114 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 68), align 4, !tbaa !5
  %.not.17 = icmp slt i32 %114, %113
  br i1 %.not.17, label %115, label %62

115:                                              ; preds = %112
  %116 = sub nsw i32 %113, %114
  store i32 %116, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 68), align 4, !tbaa !5
  %117 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 72), align 8, !tbaa !5
  %.not.18 = icmp slt i32 %117, %116
  br i1 %.not.18, label %118, label %62

118:                                              ; preds = %115
  %119 = sub nsw i32 %116, %117
  store i32 %119, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 72), align 8, !tbaa !5
  %120 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 76), align 4, !tbaa !5
  %.not.19 = icmp slt i32 %120, %119
  br i1 %.not.19, label %121, label %62

121:                                              ; preds = %118
  %122 = sub nsw i32 %119, %120
  store i32 %122, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 76), align 4, !tbaa !5
  %123 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 80), align 16, !tbaa !5
  %.not.20 = icmp slt i32 %123, %122
  br i1 %.not.20, label %124, label %62

124:                                              ; preds = %121
  %125 = sub nsw i32 %122, %123
  store i32 %125, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 80), align 16, !tbaa !5
  %126 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 84), align 4, !tbaa !5
  %.not.21 = icmp slt i32 %126, %125
  br i1 %.not.21, label %127, label %62

127:                                              ; preds = %124
  %128 = sub nsw i32 %125, %126
  store i32 %128, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 84), align 4, !tbaa !5
  %129 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 88), align 8, !tbaa !5
  %.not.22 = icmp slt i32 %129, %128
  br i1 %.not.22, label %130, label %62

130:                                              ; preds = %127
  %131 = sub nsw i32 %128, %129
  store i32 %131, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 88), align 8, !tbaa !5
  %132 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 92), align 4, !tbaa !5
  %.not.23 = icmp slt i32 %132, %131
  br i1 %.not.23, label %133, label %62

133:                                              ; preds = %130
  %134 = sub nsw i32 %131, %132
  store i32 %134, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 92), align 4, !tbaa !5
  %135 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 96), align 16, !tbaa !5
  %.not.24 = icmp slt i32 %135, %134
  br i1 %.not.24, label %136, label %62

136:                                              ; preds = %133
  %137 = sub nsw i32 %134, %135
  store i32 %137, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 96), align 16, !tbaa !5
  %138 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 100), align 4, !tbaa !5
  %.not.25 = icmp slt i32 %138, %137
  br i1 %.not.25, label %.loopexit68.loopexit, label %62

.loopexit68.loopexit:                             ; preds = %136
  %139 = sub nsw i32 %137, %138
  store i32 %139, ptr @k, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 100), align 4, !tbaa !5
  br label %.loopexit68

.loopexit68:                                      ; preds = %.loopexit68.loopexit, %62
  %140 = phi i32 [ %.pre106, %62 ], [ %33, %.loopexit68.loopexit ]
  %.053 = phi i8 [ %.05280.lcssa.wide, %62 ], [ 97, %.loopexit68.loopexit ]
  %141 = icmp slt i32 %.05984, %140
  br i1 %141, label %.lr.ph83, label %.loopexit

.lr.ph83:                                         ; preds = %.loopexit68
  %142 = sext i32 %.05885 to i64
  %143 = sext i32 %.05984 to i64
  %.pre108 = load i32, ptr @inf, align 4, !tbaa !5
  br label %144

144:                                              ; preds = %.lr.ph83, %163
  %145 = phi i32 [ %140, %.lr.ph83 ], [ %164, %163 ]
  %146 = phi i32 [ %.pre108, %.lr.ph83 ], [ %165, %163 ]
  %indvars.iv102 = phi i64 [ %143, %.lr.ph83 ], [ %indvars.iv.next103, %163 ]
  %147 = getelementptr inbounds [1010 x [1010 x i32]], ptr @nextPos, i64 0, i64 %indvars.iv102, i64 %142
  %148 = load i32, ptr %147, align 4, !tbaa !5
  %149 = icmp eq i32 %148, %146
  br i1 %149, label %163, label %150

150:                                              ; preds = %144
  %151 = sext i32 %148 to i64
  %152 = getelementptr inbounds [1010 x [1010 x i32]], ptr @lcs, i64 0, i64 %indvars.iv102, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %.not66 = icmp eq i32 %153, %.05786
  br i1 %.not66, label %154, label %163

154:                                              ; preds = %150
  %155 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1aB5cxx11, i64 noundef %indvars.iv102)
  %156 = load i8, ptr %155, align 1, !tbaa !11
  %157 = icmp eq i8 %156, %.053
  br i1 %157, label %158, label %._crit_edge109

._crit_edge109:                                   ; preds = %154
  %.pre107 = load i32, ptr @inf, align 4, !tbaa !5
  %.pre110 = load i32, ptr @n, align 4, !tbaa !5
  br label %163

158:                                              ; preds = %154
  %159 = trunc nsw i64 %indvars.iv102 to i32
  %160 = add nsw i32 %159, 1
  %161 = load i32, ptr %147, align 4, !tbaa !5
  %162 = add nsw i32 %161, 1
  br label %.loopexit

163:                                              ; preds = %._crit_edge109, %144, %150
  %164 = phi i32 [ %.pre110, %._crit_edge109 ], [ %145, %144 ], [ %145, %150 ]
  %165 = phi i32 [ %.pre107, %._crit_edge109 ], [ %146, %144 ], [ %146, %150 ]
  %indvars.iv.next103 = add nsw i64 %indvars.iv102, 1
  %166 = sext i32 %164 to i64
  %167 = icmp slt i64 %indvars.iv.next103, %166
  br i1 %167, label %144, label %.loopexit, !llvm.loop !14

.loopexit:                                        ; preds = %163, %.loopexit68, %158
  %.160 = phi i32 [ %160, %158 ], [ %.05984, %.loopexit68 ], [ %.05984, %163 ]
  %.1 = phi i32 [ %162, %158 ], [ %.05885, %.loopexit68 ], [ %.05885, %163 ]
  %168 = add nsw i32 %.05786, -1
  %169 = tail call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11) #2
  %170 = icmp ult i64 %169, %10
  br i1 %170, label %.preheader69, label %._crit_edge87, !llvm.loop !15

._crit_edge87:                                    ; preds = %.loopexit, %._crit_edge
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 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 #1 align 2

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }

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

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


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