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

; 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
@_Z1aB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@_Z1bB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@lcs = external dso_local global [1010 x [1010 x i32]], align 16
@ways = external dso_local global [1010 x [1010 x i32]], align 16
@inf = external dso_local global i32, align 4

; 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 @_Z11computeWaysv() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = sub nsw i32 %5, 1
  store i32 %6, ptr %1, align 4, !tbaa !5
  br label %7

7:                                                ; preds = %209, %0
  %8 = load i32, ptr %1, align 4, !tbaa !5
  %9 = icmp sge i32 %8, 0
  br i1 %9, label %11, label %10

10:                                               ; preds = %7
  store i32 2, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  br label %212

11:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = sub nsw i32 %12, 1
  store i32 %13, ptr %3, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %205, %11
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = icmp sge i32 %15, 0
  br i1 %16, label %18, label %17

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

18:                                               ; preds = %14
  %19 = load i32, ptr %1, align 4, !tbaa !5
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = sub nsw i32 %20, 1
  %22 = icmp eq i32 %19, %21
  br i1 %22, label %28, label %23

23:                                               ; preds = %18
  %24 = load i32, ptr %3, align 4, !tbaa !5
  %25 = load i32, ptr @n, align 4, !tbaa !5
  %26 = sub nsw i32 %25, 1
  %27 = icmp eq i32 %24, %26
  br i1 %27, label %28, label %35

28:                                               ; preds = %23, %18
  %29 = load i32, ptr %1, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %30
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [1010 x i32], ptr %31, i64 0, i64 %33
  store i32 1, ptr %34, align 4, !tbaa !5
  br label %204

35:                                               ; preds = %23
  %36 = load i32, ptr %1, 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) @_Z1aB5cxx11, i64 noundef %37)
  %39 = load i8, ptr %38, align 1, !tbaa !9
  %40 = sext i8 %39 to i32
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1bB5cxx11, i64 noundef %42)
  %44 = load i8, ptr %43, align 1, !tbaa !9
  %45 = sext i8 %44 to i32
  %46 = icmp eq i32 %40, %45
  br i1 %46, label %47, label %63

47:                                               ; preds = %35
  %48 = load i32, ptr %1, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %50
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [1010 x i32], ptr %51, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = load i32, ptr %1, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %58
  %60 = load i32, ptr %3, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [1010 x i32], ptr %59, i64 0, i64 %61
  store i32 %56, ptr %62, align 4, !tbaa !5
  br label %203

63:                                               ; preds = %35
  %64 = load i32, ptr %1, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [1010 x [1010 x i32]], ptr @lcs, i64 0, i64 %65
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [1010 x i32], ptr %66, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = load i32, ptr %1, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1010 x [1010 x i32]], ptr @lcs, i64 0, i64 %74
  %76 = load i32, ptr %3, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [1010 x i32], ptr %75, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = icmp eq i32 %71, %79
  br i1 %80, label %81, label %158

81:                                               ; preds = %63
  %82 = load i32, ptr %1, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %83
  %85 = load i32, ptr %3, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [1010 x i32], ptr %84, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = load i32, ptr %1, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %92
  %94 = load i32, ptr %3, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [1010 x i32], ptr %93, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = add nsw i32 %89, %97
  %99 = load i32, ptr %1, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %100
  %102 = load i32, ptr %3, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [1010 x i32], ptr %101, i64 0, i64 %103
  store i32 %98, ptr %104, align 4, !tbaa !5
  %105 = load i32, ptr %1, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [1010 x [1010 x i32]], ptr @lcs, i64 0, i64 %107
  %109 = load i32, ptr %3, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [1010 x i32], ptr %108, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = load i32, ptr %1, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [1010 x [1010 x i32]], ptr @lcs, i64 0, i64 %116
  %118 = load i32, ptr %3, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [1010 x i32], ptr %117, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = icmp eq i32 %113, %121
  br i1 %122, label %123, label %141

123:                                              ; preds = %81
  %124 = load i32, ptr %1, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %126
  %128 = load i32, ptr %3, align 4, !tbaa !5
  %129 = add nsw i32 %128, 1
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [1010 x i32], ptr %127, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = load i32, ptr %1, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %134
  %136 = load i32, ptr %3, 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 = sub nsw i32 %139, %132
  store i32 %140, ptr %138, align 4, !tbaa !5
  br label %141

141:                                              ; preds = %123, %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %142 = load i32, ptr @inf, align 4, !tbaa !5
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %4, align 4, !tbaa !5
  %144 = load i32, ptr %1, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %145
  %147 = load i32, ptr %3, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [1010 x i32], ptr %146, i64 0, i64 %148
  %150 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %149)
  %151 = load i32, ptr %150, align 4, !tbaa !5
  %152 = load i32, ptr %1, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %153
  %155 = load i32, ptr %3, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [1010 x i32], ptr %154, i64 0, i64 %156
  store i32 %151, ptr %157, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %202

158:                                              ; preds = %63
  %159 = load i32, ptr %1, align 4, !tbaa !5
  %160 = add nsw i32 %159, 1
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [1010 x [1010 x i32]], ptr @lcs, i64 0, i64 %161
  %163 = load i32, ptr %3, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [1010 x i32], ptr %162, i64 0, i64 %164
  %166 = load i32, ptr %165, align 4, !tbaa !5
  %167 = load i32, ptr %1, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [1010 x [1010 x i32]], ptr @lcs, i64 0, i64 %168
  %170 = load i32, ptr %3, align 4, !tbaa !5
  %171 = add nsw i32 %170, 1
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [1010 x i32], ptr %169, i64 0, i64 %172
  %174 = load i32, ptr %173, align 4, !tbaa !5
  %175 = icmp sgt i32 %166, %174
  br i1 %175, label %176, label %185

176:                                              ; preds = %158
  %177 = load i32, ptr %1, align 4, !tbaa !5
  %178 = add nsw i32 %177, 1
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %179
  %181 = load i32, ptr %3, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [1010 x i32], ptr %180, i64 0, i64 %182
  %184 = load i32, ptr %183, align 4, !tbaa !5
  br label %194

185:                                              ; preds = %158
  %186 = load i32, ptr %1, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %187
  %189 = load i32, ptr %3, align 4, !tbaa !5
  %190 = add nsw i32 %189, 1
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [1010 x i32], ptr %188, i64 0, i64 %191
  %193 = load i32, ptr %192, align 4, !tbaa !5
  br label %194

194:                                              ; preds = %185, %176
  %195 = phi i32 [ %184, %176 ], [ %193, %185 ]
  %196 = load i32, ptr %1, align 4, !tbaa !5
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %197
  %199 = load i32, ptr %3, align 4, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [1010 x i32], ptr %198, i64 0, i64 %200
  store i32 %195, ptr %201, align 4, !tbaa !5
  br label %202

202:                                              ; preds = %194, %141
  br label %203

203:                                              ; preds = %202, %47
  br label %204

204:                                              ; preds = %203, %28
  br label %205

205:                                              ; preds = %204
  %206 = load i32, ptr %3, align 4, !tbaa !5
  %207 = add nsw i32 %206, -1
  store i32 %207, ptr %3, align 4, !tbaa !5
  br label %14, !llvm.loop !10

208:                                              ; preds = %17
  br label %209

209:                                              ; preds = %208
  %210 = load i32, ptr %1, align 4, !tbaa !5
  %211 = add nsw i32 %210, -1
  store i32 %211, ptr %1, align 4, !tbaa !5
  br label %7, !llvm.loop !12

212:                                              ; preds = %10
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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 = { 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 #4 = { 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}


; 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
@_Z1aB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@_Z1bB5cxx11 = 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
@ways = external dso_local global [1010 x [1010 x i32]], align 16
@inf = external dso_local local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress 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) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z11computeWaysv() local_unnamed_addr #1 {
  %1 = alloca i32, align 4
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %.lr.ph56.split.preheader, label %._crit_edge

.lr.ph56.split.preheader:                         ; preds = %0
  %.04653 = add nsw i32 %2, -1
  %4 = zext nneg i32 %.04653 to i64
  %5 = zext nneg i32 %2 to i64
  br label %.lr.ph56.split

.loopexit:                                        ; preds = %57, %.lr.ph56.split
  %indvars.iv.next60 = add nsw i64 %indvars.iv59, -1
  %6 = icmp sgt i64 %indvars.iv59, 0
  %indvars.iv.next62 = add nsw i64 %indvars.iv61, -1
  br i1 %6, label %.lr.ph56.split, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.loopexit, %0
  ret void

.lr.ph56.split:                                   ; preds = %.lr.ph56.split.preheader, %.loopexit
  %indvars.iv61 = phi i64 [ %5, %.lr.ph56.split.preheader ], [ %indvars.iv.next62, %.loopexit ]
  %indvars.iv59 = phi i64 [ %4, %.lr.ph56.split.preheader ], [ %indvars.iv.next60, %.loopexit ]
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.lr.ph56.split
  %9 = zext nneg i32 %7 to i64
  br label %10

10:                                               ; preds = %.lr.ph, %57
  %indvars.iv = phi i64 [ %9, %.lr.ph ], [ %indvars.iv.next, %57 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = zext i32 %11 to i64
  %13 = icmp eq i64 %indvars.iv61, %12
  %14 = icmp eq i64 %indvars.iv, %12
  %or.cond = or i1 %13, %14
  br i1 %or.cond, label %15, label %17

15:                                               ; preds = %10
  %16 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %indvars.iv59, i64 %indvars.iv.next
  store i32 1, ptr %16, align 4, !tbaa !5
  br label %57

17:                                               ; preds = %10
  %18 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1aB5cxx11, i64 noundef %indvars.iv59)
  %19 = load i8, ptr %18, align 1, !tbaa !12
  %20 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1bB5cxx11, i64 noundef %indvars.iv.next)
  %21 = load i8, ptr %20, align 1, !tbaa !12
  %22 = icmp eq i8 %19, %21
  br i1 %22, label %23, label %27

23:                                               ; preds = %17
  %24 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %indvars.iv61, i64 %indvars.iv
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %indvars.iv59, i64 %indvars.iv.next
  store i32 %25, ptr %26, align 4, !tbaa !5
  br label %57

27:                                               ; preds = %17
  %28 = getelementptr inbounds [1010 x [1010 x i32]], ptr @lcs, i64 0, i64 %indvars.iv59, i64 %indvars.iv
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = getelementptr inbounds [1010 x [1010 x i32]], ptr @lcs, i64 0, i64 %indvars.iv61, i64 %indvars.iv.next
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = icmp eq i32 %29, %31
  %33 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %indvars.iv59, i64 %indvars.iv.next
  br i1 %32, label %34, label %52

34:                                               ; preds = %27
  %35 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %indvars.iv59, i64 %indvars.iv
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %indvars.iv61, i64 %indvars.iv.next
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = add nsw i32 %38, %36
  store i32 %39, ptr %33, align 4, !tbaa !5
  %40 = getelementptr inbounds [1010 x [1010 x i32]], ptr @lcs, i64 0, i64 %indvars.iv61, i64 %indvars.iv
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = icmp eq i32 %41, %29
  br i1 %42, label %43, label %47

43:                                               ; preds = %34
  %44 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %indvars.iv61, i64 %indvars.iv
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = sub nsw i32 %39, %45
  store i32 %46, ptr %33, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %43, %34
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #3
  %48 = load i32, ptr @inf, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %1, align 4, !tbaa !5
  %50 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %33)
  %51 = load i32, ptr %50, align 4, !tbaa !5
  store i32 %51, ptr %33, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #3
  br label %57

52:                                               ; preds = %27
  %53 = icmp sgt i32 %31, %29
  %54 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %indvars.iv61, i64 %indvars.iv.next
  %55 = getelementptr inbounds [1010 x [1010 x i32]], ptr @ways, i64 0, i64 %indvars.iv59, i64 %indvars.iv
  %.in = select i1 %53, ptr %54, ptr %55
  %56 = load i32, ptr %.in, align 4, !tbaa !5
  store i32 %56, ptr %33, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %15, %47, %52, %23
  %58 = icmp ugt i64 %indvars.iv, 1
  br i1 %58, label %10, label %.loopexit, !llvm.loop !13
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

attributes #0 = { mustprogress 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 = { 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 #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, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.unswitch.partial.disable"}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass