; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/SHORT/COOK67/Problem D (harshil)

; 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] }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.__gnu_cxx::__normal_iterator.15" = type { ptr }

@_Z6secondB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@P = external dso_local global %"class.std::vector", align 8
@M = external dso_local global %"class.std::vector.3", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(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 #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5buildv() #1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z19LongestCommonPrefixii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::__cxx11::basic_string", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %"class.__gnu_cxx::__normal_iterator.15", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator.15", align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i64, align 8
  %24 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %25 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %26 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %27 = getelementptr i8, ptr %26, i64 -24
  %28 = load i64, ptr %27, align 8
  %29 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %28
  %30 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %29, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.start.p0(i64 32, ptr %3) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #7
  br label %32

32:                                               ; preds = %279, %0
  %33 = load i32, ptr %2, align 4, !tbaa !8
  %34 = add nsw i32 %33, -1
  store i32 %34, ptr %2, align 4, !tbaa !8
  %35 = icmp ne i32 %33, 0
  br i1 %35, label %36, label %286

36:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %37 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %38 unwind label %64

38:                                               ; preds = %36
  %39 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %37, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %40 unwind label %64

40:                                               ; preds = %38
  %41 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) @_Z6secondB5cxx11)
          to label %42 unwind label %64

42:                                               ; preds = %40
  %43 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %3, ptr noundef nonnull align 8 dereferenceable(32) @_Z6secondB5cxx11)
          to label %44 unwind label %64

44:                                               ; preds = %42
  %45 = call ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5beginEv(ptr noundef nonnull align 8 dereferenceable(32) %3) #7
  %46 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.15", ptr %8, i32 0, i32 0
  store ptr %45, ptr %46, align 8
  %47 = call ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE3endEv(ptr noundef nonnull align 8 dereferenceable(32) %3) #7
  %48 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.15", ptr %9, i32 0, i32 0
  store ptr %47, ptr %48, align 8
  %49 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.15", ptr %8, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8
  %51 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.15", ptr %9, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8
  invoke void @_ZSt7reverseIN9__gnu_cxx17__normal_iteratorIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEvT_SA_(ptr %50, ptr %52)
          to label %53 unwind label %64

53:                                               ; preds = %44
  %54 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) @_Z6secondB5cxx11, i8 noundef signext 36)
          to label %55 unwind label %64

55:                                               ; preds = %53
  %56 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLERKS4_(ptr noundef nonnull align 8 dereferenceable(32) @_Z6secondB5cxx11, ptr noundef nonnull align 8 dereferenceable(32) %3)
          to label %57 unwind label %64

57:                                               ; preds = %55
  invoke void @_Z5buildv()
          to label %58 unwind label %64

58:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store i64 0, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !8
  br label %59

59:                                               ; preds = %270, %58
  %60 = load i32, ptr %13, align 4, !tbaa !8
  %61 = load i32, ptr %4, align 4, !tbaa !8
  %62 = icmp slt i32 %60, %61
  br i1 %62, label %68, label %63

63:                                               ; preds = %59
  store i32 4, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %274

64:                                               ; preds = %57, %55, %53, %44, %42, %40, %38, %36
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %6, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %7, align 4
  br label %285

68:                                               ; preds = %59
  %69 = load i32, ptr %13, align 4, !tbaa !8
  %70 = sext i32 %69 to i64
  store i64 %70, ptr %10, align 8, !tbaa !11
  %71 = load i32, ptr %4, align 4, !tbaa !8
  %72 = mul nsw i32 2, %71
  %73 = load i32, ptr %13, align 4, !tbaa !8
  %74 = sub nsw i32 %72, %73
  %75 = sext i32 %74 to i64
  store i64 %75, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !8
  br label %76

76:                                               ; preds = %147, %68
  %77 = load i32, ptr %15, align 4, !tbaa !8
  %78 = load i32, ptr %5, align 4, !tbaa !8
  %79 = add nsw i32 %78, 1
  %80 = icmp slt i32 %77, %79
  br i1 %80, label %82, label %81

81:                                               ; preds = %76
  store i32 7, ptr %14, align 4
  br label %150

82:                                               ; preds = %76
  %83 = load i64, ptr %10, align 8, !tbaa !11
  %84 = icmp slt i64 %83, 0
  br i1 %84, label %90, label %85

85:                                               ; preds = %82
  %86 = load i64, ptr %11, align 8, !tbaa !11
  %87 = load i32, ptr %4, align 4, !tbaa !8
  %88 = sext i32 %87 to i64
  %89 = icmp sle i64 %86, %88
  br i1 %89, label %90, label %91

90:                                               ; preds = %85, %82
  store i32 7, ptr %14, align 4
  br label %150

91:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  store i64 0, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %92 = load i32, ptr %4, align 4, !tbaa !8
  %93 = mul nsw i32 2, %92
  %94 = sext i32 %93 to i64
  %95 = load i64, ptr %11, align 8, !tbaa !11
  %96 = sub nsw i64 %94, %95
  store i64 %96, ptr %18, align 8, !tbaa !11
  %97 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %18)
          to label %98 unwind label %128

98:                                               ; preds = %91
  %99 = load i64, ptr %97, align 8, !tbaa !11
  %100 = add nsw i64 %99, 1
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  store i64 %100, ptr %17, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  br label %101

101:                                              ; preds = %135, %98
  %102 = load i64, ptr %17, align 8, !tbaa !11
  %103 = load i64, ptr %16, align 8, !tbaa !11
  %104 = sub nsw i64 %102, %103
  %105 = icmp sgt i64 %104, 1
  br i1 %105, label %106, label %136

106:                                              ; preds = %101
  %107 = load i64, ptr %17, align 8, !tbaa !11
  %108 = load i64, ptr %16, align 8, !tbaa !11
  %109 = add nsw i64 %107, %108
  %110 = sdiv i64 %109, 2
  %111 = trunc i64 %110 to i32
  store i32 %111, ptr %19, align 4, !tbaa !8
  %112 = load i64, ptr %10, align 8, !tbaa !11
  %113 = load i32, ptr %19, align 4, !tbaa !8
  %114 = sext i32 %113 to i64
  %115 = sub nsw i64 %112, %114
  %116 = trunc i64 %115 to i32
  %117 = load i64, ptr %11, align 8, !tbaa !11
  %118 = load i32, ptr %19, align 4, !tbaa !8
  %119 = sext i32 %118 to i64
  %120 = sub nsw i64 %117, %119
  %121 = trunc i64 %120 to i32
  %122 = call noundef i32 @_Z19LongestCommonPrefixii(i32 noundef %116, i32 noundef %121)
  %123 = load i32, ptr %19, align 4, !tbaa !8
  %124 = icmp sge i32 %122, %123
  br i1 %124, label %125, label %132

125:                                              ; preds = %106
  %126 = load i32, ptr %19, align 4, !tbaa !8
  %127 = sext i32 %126 to i64
  store i64 %127, ptr %16, align 8, !tbaa !11
  br label %135

128:                                              ; preds = %91
  %129 = landingpad { ptr, i32 }
          cleanup
  %130 = extractvalue { ptr, i32 } %129, 0
  store ptr %130, ptr %6, align 8
  %131 = extractvalue { ptr, i32 } %129, 1
  store i32 %131, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %273

132:                                              ; preds = %106
  %133 = load i32, ptr %19, align 4, !tbaa !8
  %134 = sext i32 %133 to i64
  store i64 %134, ptr %17, align 8, !tbaa !11
  br label %135

135:                                              ; preds = %132, %125
  br label %101, !llvm.loop !13

136:                                              ; preds = %101
  %137 = load i64, ptr %16, align 8, !tbaa !11
  %138 = load i64, ptr %10, align 8, !tbaa !11
  %139 = sub nsw i64 %138, %137
  store i64 %139, ptr %10, align 8, !tbaa !11
  %140 = load i64, ptr %10, align 8, !tbaa !11
  %141 = add nsw i64 %140, -1
  store i64 %141, ptr %10, align 8, !tbaa !11
  %142 = load i64, ptr %16, align 8, !tbaa !11
  %143 = load i64, ptr %11, align 8, !tbaa !11
  %144 = sub nsw i64 %143, %142
  store i64 %144, ptr %11, align 8, !tbaa !11
  %145 = load i64, ptr %11, align 8, !tbaa !11
  %146 = add nsw i64 %145, -1
  store i64 %146, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %147

147:                                              ; preds = %136
  %148 = load i32, ptr %15, align 4, !tbaa !8
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %15, align 4, !tbaa !8
  br label %76, !llvm.loop !15

150:                                              ; preds = %90, %81
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %151

151:                                              ; preds = %150
  %152 = load i64, ptr %10, align 8, !tbaa !11
  %153 = add nsw i64 %152, 1
  store i64 %153, ptr %10, align 8, !tbaa !11
  %154 = load i64, ptr %11, align 8, !tbaa !11
  %155 = add nsw i64 %154, -1
  store i64 %155, ptr %11, align 8, !tbaa !11
  %156 = load i32, ptr %13, align 4, !tbaa !8
  %157 = sext i32 %156 to i64
  %158 = load i64, ptr %10, align 8, !tbaa !11
  %159 = sub nsw i64 %157, %158
  %160 = add nsw i64 %159, 1
  %161 = load i32, ptr %13, align 4, !tbaa !8
  %162 = sext i32 %161 to i64
  %163 = load i64, ptr %10, align 8, !tbaa !11
  %164 = sub nsw i64 %162, %163
  %165 = add nsw i64 %164, 1
  %166 = mul nsw i64 %160, %165
  %167 = load i64, ptr %12, align 8, !tbaa !11
  %168 = add nsw i64 %167, %166
  store i64 %168, ptr %12, align 8, !tbaa !11
  %169 = load i32, ptr %13, align 4, !tbaa !8
  %170 = add nsw i32 %169, 1
  %171 = sext i32 %170 to i64
  store i64 %171, ptr %10, align 8, !tbaa !11
  %172 = load i32, ptr %4, align 4, !tbaa !8
  %173 = mul nsw i32 2, %172
  %174 = load i32, ptr %13, align 4, !tbaa !8
  %175 = sub nsw i32 %173, %174
  %176 = sext i32 %175 to i64
  store i64 %176, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  store i32 0, ptr %20, align 4, !tbaa !8
  br label %177

177:                                              ; preds = %248, %151
  %178 = load i32, ptr %20, align 4, !tbaa !8
  %179 = load i32, ptr %5, align 4, !tbaa !8
  %180 = add nsw i32 %179, 1
  %181 = icmp slt i32 %178, %180
  br i1 %181, label %183, label %182

182:                                              ; preds = %177
  store i32 12, ptr %14, align 4
  br label %251

183:                                              ; preds = %177
  %184 = load i64, ptr %10, align 8, !tbaa !11
  %185 = icmp slt i64 %184, 0
  br i1 %185, label %191, label %186

186:                                              ; preds = %183
  %187 = load i64, ptr %11, align 8, !tbaa !11
  %188 = load i32, ptr %4, align 4, !tbaa !8
  %189 = sext i32 %188 to i64
  %190 = icmp sle i64 %187, %189
  br i1 %190, label %191, label %192

191:                                              ; preds = %186, %183
  store i32 12, ptr %14, align 4
  br label %251

192:                                              ; preds = %186
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  store i32 0, ptr %21, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %193 = load i32, ptr %4, align 4, !tbaa !8
  %194 = mul nsw i32 2, %193
  %195 = sext i32 %194 to i64
  %196 = load i64, ptr %11, align 8, !tbaa !11
  %197 = sub nsw i64 %195, %196
  store i64 %197, ptr %23, align 8, !tbaa !11
  %198 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %23)
          to label %199 unwind label %228

199:                                              ; preds = %192
  %200 = load i64, ptr %198, align 8, !tbaa !11
  %201 = add nsw i64 %200, 1
  %202 = trunc i64 %201 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  store i32 %202, ptr %22, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  br label %203

203:                                              ; preds = %234, %199
  %204 = load i32, ptr %22, align 4, !tbaa !8
  %205 = load i32, ptr %21, align 4, !tbaa !8
  %206 = sub nsw i32 %204, %205
  %207 = icmp sgt i32 %206, 1
  br i1 %207, label %208, label %235

208:                                              ; preds = %203
  %209 = load i32, ptr %22, align 4, !tbaa !8
  %210 = load i32, ptr %21, align 4, !tbaa !8
  %211 = add nsw i32 %209, %210
  %212 = sdiv i32 %211, 2
  store i32 %212, ptr %24, align 4, !tbaa !8
  %213 = load i64, ptr %10, align 8, !tbaa !11
  %214 = load i32, ptr %24, align 4, !tbaa !8
  %215 = sext i32 %214 to i64
  %216 = sub nsw i64 %213, %215
  %217 = trunc i64 %216 to i32
  %218 = load i64, ptr %11, align 8, !tbaa !11
  %219 = load i32, ptr %24, align 4, !tbaa !8
  %220 = sext i32 %219 to i64
  %221 = sub nsw i64 %218, %220
  %222 = trunc i64 %221 to i32
  %223 = call noundef i32 @_Z19LongestCommonPrefixii(i32 noundef %217, i32 noundef %222)
  %224 = load i32, ptr %24, align 4, !tbaa !8
  %225 = icmp sge i32 %223, %224
  br i1 %225, label %226, label %232

226:                                              ; preds = %208
  %227 = load i32, ptr %24, align 4, !tbaa !8
  store i32 %227, ptr %21, align 4, !tbaa !8
  br label %234

228:                                              ; preds = %192
  %229 = landingpad { ptr, i32 }
          cleanup
  %230 = extractvalue { ptr, i32 } %229, 0
  store ptr %230, ptr %6, align 8
  %231 = extractvalue { ptr, i32 } %229, 1
  store i32 %231, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %273

232:                                              ; preds = %208
  %233 = load i32, ptr %24, align 4, !tbaa !8
  store i32 %233, ptr %22, align 4, !tbaa !8
  br label %234

234:                                              ; preds = %232, %226
  br label %203, !llvm.loop !16

235:                                              ; preds = %203
  %236 = load i32, ptr %21, align 4, !tbaa !8
  %237 = sext i32 %236 to i64
  %238 = load i64, ptr %10, align 8, !tbaa !11
  %239 = sub nsw i64 %238, %237
  store i64 %239, ptr %10, align 8, !tbaa !11
  %240 = load i64, ptr %10, align 8, !tbaa !11
  %241 = add nsw i64 %240, -1
  store i64 %241, ptr %10, align 8, !tbaa !11
  %242 = load i32, ptr %21, align 4, !tbaa !8
  %243 = sext i32 %242 to i64
  %244 = load i64, ptr %11, align 8, !tbaa !11
  %245 = sub nsw i64 %244, %243
  store i64 %245, ptr %11, align 8, !tbaa !11
  %246 = load i64, ptr %11, align 8, !tbaa !11
  %247 = add nsw i64 %246, -1
  store i64 %247, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %248

248:                                              ; preds = %235
  %249 = load i32, ptr %20, align 4, !tbaa !8
  %250 = add nsw i32 %249, 1
  store i32 %250, ptr %20, align 4, !tbaa !8
  br label %177, !llvm.loop !17

251:                                              ; preds = %191, %182
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %252

252:                                              ; preds = %251
  %253 = load i64, ptr %10, align 8, !tbaa !11
  %254 = add nsw i64 %253, 1
  store i64 %254, ptr %10, align 8, !tbaa !11
  %255 = load i64, ptr %11, align 8, !tbaa !11
  %256 = add nsw i64 %255, -1
  store i64 %256, ptr %11, align 8, !tbaa !11
  %257 = load i32, ptr %13, align 4, !tbaa !8
  %258 = sext i32 %257 to i64
  %259 = load i64, ptr %10, align 8, !tbaa !11
  %260 = sub nsw i64 %258, %259
  %261 = add nsw i64 %260, 1
  %262 = load i32, ptr %13, align 4, !tbaa !8
  %263 = sext i32 %262 to i64
  %264 = load i64, ptr %10, align 8, !tbaa !11
  %265 = sub nsw i64 %263, %264
  %266 = add nsw i64 %265, 2
  %267 = mul nsw i64 %261, %266
  %268 = load i64, ptr %12, align 8, !tbaa !11
  %269 = add nsw i64 %268, %267
  store i64 %269, ptr %12, align 8, !tbaa !11
  br label %270

270:                                              ; preds = %252
  %271 = load i32, ptr %13, align 4, !tbaa !8
  %272 = add nsw i32 %271, 1
  store i32 %272, ptr %13, align 4, !tbaa !8
  br label %59, !llvm.loop !18

273:                                              ; preds = %228, %128
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %284

274:                                              ; preds = %63
  call void @_ZNSt6vectorIS_IiSaIiEESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @P) #7
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @M) #7
  %275 = load i64, ptr %12, align 8, !tbaa !11
  %276 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %275)
          to label %277 unwind label %280

277:                                              ; preds = %274
  %278 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %276, ptr noundef @.str)
          to label %279 unwind label %280

279:                                              ; preds = %277
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %32, !llvm.loop !19

280:                                              ; preds = %277, %274
  %281 = landingpad { ptr, i32 }
          cleanup
  %282 = extractvalue { ptr, i32 } %281, 0
  store ptr %282, ptr %6, align 8
  %283 = extractvalue { ptr, i32 } %281, 1
  store i32 %283, ptr %7, align 4
  br label %284

284:                                              ; preds = %280, %273
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %285

285:                                              ; preds = %284, %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %288

286:                                              ; preds = %32
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %287 = load i32, ptr %1, align 4
  ret i32 %287

288:                                              ; preds = %285
  %289 = load ptr, ptr %6, align 8
  %290 = load i32, ptr %7, align 4
  %291 = insertvalue { ptr, i32 } poison, ptr %289, 0
  %292 = insertvalue { ptr, i32 } %291, i32 %290, 1
  resume { ptr, i32 } %292
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #4

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #0 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #4

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7reverseIN9__gnu_cxx17__normal_iteratorIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEvT_SA_(ptr, ptr) #5

; Function Attrs: mustprogress nounwind uwtable
declare ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5beginEv(ptr noundef nonnull align 8 dereferenceable(32)) #0 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIS_IiSaIiEESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { "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 = { 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 #6 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}


; 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] }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@_Z6secondB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@P = external dso_local global %"class.std::vector", align 8
@M = external dso_local global %"class.std::vector.3", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(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 #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5buildv() local_unnamed_addr #1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z19LongestCommonPrefixii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::__cxx11::basic_string", align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %9 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %11
  %13 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #7
  %15 = load i32, ptr %1, align 4, !tbaa !8
  %16 = add nsw i32 %15, -1
  store i32 %16, ptr %1, align 4, !tbaa !8
  %.not108 = icmp eq i32 %15, 0
  br i1 %.not108, label %._crit_edge111, label %.lr.ph110

.lr.ph110:                                        ; preds = %0, %126
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %17 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %18 unwind label %36

18:                                               ; preds = %.lr.ph110
  %19 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %20 unwind label %36

20:                                               ; preds = %18
  %21 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) @_Z6secondB5cxx11)
          to label %22 unwind label %36

22:                                               ; preds = %20
  %23 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef nonnull align 8 dereferenceable(32) @_Z6secondB5cxx11)
          to label %24 unwind label %36

24:                                               ; preds = %22
  %25 = call ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5beginEv(ptr noundef nonnull align 8 dereferenceable(32) %2) #7
  %26 = call ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE3endEv(ptr noundef nonnull align 8 dereferenceable(32) %2) #7
  invoke void @_ZSt7reverseIN9__gnu_cxx17__normal_iteratorIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEvT_SA_(ptr %25, ptr %26)
          to label %27 unwind label %36

27:                                               ; preds = %24
  %28 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) @_Z6secondB5cxx11, i8 noundef signext 36)
          to label %29 unwind label %36

29:                                               ; preds = %27
  %30 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLERKS4_(ptr noundef nonnull align 8 dereferenceable(32) @_Z6secondB5cxx11, ptr noundef nonnull align 8 dereferenceable(32) %2)
          to label %31 unwind label %36

31:                                               ; preds = %29
  invoke void @_Z5buildv()
          to label %32 unwind label %36

32:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %33 = load i32, ptr %3, align 4, !tbaa !8
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph105.preheader, label %._crit_edge106

.lr.ph105.preheader:                              ; preds = %32
  %.pre = load i32, ptr %4, align 4, !tbaa !8
  br label %.lr.ph105

._crit_edge106:                                   ; preds = %._crit_edge100, %32
  %.065.lcssa = phi i64 [ 0, %32 ], [ %121, %._crit_edge100 ]
  call void @_ZNSt6vectorIS_IiSaIiEESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @P) #7
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @M) #7
  %35 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.065.lcssa)
          to label %124 unwind label %129

36:                                               ; preds = %31, %29, %27, %24, %22, %20, %18, %.lr.ph110
  %37 = landingpad { ptr, i32 }
          cleanup
  br label %131

.lr.ph105:                                        ; preds = %.lr.ph105.preheader, %._crit_edge100
  %38 = phi i32 [ %33, %.lr.ph105.preheader ], [ %113, %._crit_edge100 ]
  %39 = phi i32 [ %.pre, %.lr.ph105.preheader ], [ %115, %._crit_edge100 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph105.preheader ], [ %indvars.iv.next125, %._crit_edge100 ]
  %.065102 = phi i64 [ 0, %.lr.ph105.preheader ], [ %121, %._crit_edge100 ]
  store i64 %indvars.iv, ptr %5, align 8, !tbaa !11
  %40 = trunc nuw nsw i64 %indvars.iv to i32
  %.not7182 = icmp slt i32 %39, 0
  br i1 %.not7182, label %._crit_edge87.thread, label %.lr.ph86.preheader

.lr.ph86.preheader:                               ; preds = %.lr.ph105
  %41 = shl nsw i32 %38, 1
  %42 = sub nsw i32 %41, %40
  %43 = icmp sgt i64 %indvars.iv, -1
  %44 = load i32, ptr %3, align 4
  %.not72158 = icmp sgt i32 %42, %44
  %or.cond159 = select i1 %43, i1 %.not72158, i1 false
  br i1 %or.cond159, label %.lr.ph162.preheader, label %._crit_edge87

.lr.ph162.preheader:                              ; preds = %.lr.ph86.preheader
  %45 = sext i32 %42 to i64
  br label %.lr.ph162

._crit_edge87.thread:                             ; preds = %.lr.ph105
  %indvars.iv.next123 = add nuw nsw i64 %indvars.iv, 1
  br label %._crit_edge100

.lr.ph86:                                         ; preds = %._crit_edge
  %46 = add i64 %.06683161, %72
  %47 = add nuw nsw i32 %.06384160, 1
  %48 = icmp sgt i64 %73, -1
  %49 = load i32, ptr %3, align 4
  %50 = sext i32 %49 to i64
  %.not72 = icmp sgt i64 %46, %50
  %or.cond = select i1 %48, i1 %.not72, i1 false
  br i1 %or.cond, label %.lr.ph162, label %._crit_edge87, !llvm.loop !13

.lr.ph162:                                        ; preds = %.lr.ph162.preheader, %.lr.ph86
  %51 = phi i32 [ %49, %.lr.ph86 ], [ %44, %.lr.ph162.preheader ]
  %.06683161 = phi i64 [ %46, %.lr.ph86 ], [ %45, %.lr.ph162.preheader ]
  %.06384160 = phi i32 [ %47, %.lr.ph86 ], [ 0, %.lr.ph162.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %52 = shl nsw i32 %51, 1
  %53 = sext i32 %52 to i64
  %54 = sub nsw i64 %53, %.06683161
  store i64 %54, ptr %6, align 8, !tbaa !11
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %56 = load i64, ptr %55, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  %57 = icmp sgt i64 %56, 0
  br i1 %57, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.lr.ph162
  %58 = add nuw nsw i64 %56, 1
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.05981 = phi i64 [ %..059, %.lr.ph ], [ %58, %.lr.ph.preheader ]
  %.06180 = phi i64 [ %.061., %.lr.ph ], [ 0, %.lr.ph.preheader ]
  %59 = add nsw i64 %.05981, %.06180
  %60 = sdiv i64 %59, 2
  %61 = trunc i64 %60 to i32
  %62 = load i64, ptr %5, align 8, !tbaa !11
  %sext = shl i64 %60, 32
  %63 = ashr exact i64 %sext, 32
  %64 = sub i64 %62, %60
  %65 = trunc i64 %64 to i32
  %66 = sub i64 %.06683161, %60
  %67 = trunc i64 %66 to i32
  %68 = call noundef i32 @_Z19LongestCommonPrefixii(i32 noundef %65, i32 noundef %67)
  %.not73 = icmp slt i32 %68, %61
  %.061. = select i1 %.not73, i64 %.06180, i64 %63
  %..059 = select i1 %.not73, i64 %63, i64 %.05981
  %69 = sub nsw i64 %..059, %.061.
  %70 = icmp sgt i64 %69, 1
  br i1 %70, label %.lr.ph, label %._crit_edge, !llvm.loop !15

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph162
  %.061.lcssa = phi i64 [ 0, %.lr.ph162 ], [ %.061., %.lr.ph ]
  %71 = load i64, ptr %5, align 8, !tbaa !11
  %72 = xor i64 %.061.lcssa, -1
  %73 = add i64 %71, %72
  store i64 %73, ptr %5, align 8, !tbaa !11
  %74 = load i32, ptr %4, align 4, !tbaa !8
  %.not71.not = icmp slt i32 %.06384160, %74
  br i1 %.not71.not, label %.lr.ph86, label %._crit_edge.._crit_edge87.loopexit_crit_edge, !llvm.loop !13

._crit_edge.._crit_edge87.loopexit_crit_edge:     ; preds = %._crit_edge
  %.pre113.pre = load i32, ptr %3, align 4, !tbaa !8
  br label %._crit_edge87

._crit_edge87:                                    ; preds = %.lr.ph86, %.lr.ph86.preheader, %._crit_edge.._crit_edge87.loopexit_crit_edge
  %.pre113 = phi i32 [ %.pre113.pre, %._crit_edge.._crit_edge87.loopexit_crit_edge ], [ %44, %.lr.ph86.preheader ], [ %49, %.lr.ph86 ]
  %75 = phi i32 [ %74, %._crit_edge.._crit_edge87.loopexit_crit_edge ], [ %39, %.lr.ph86.preheader ], [ %74, %.lr.ph86 ]
  %76 = phi i64 [ %73, %._crit_edge.._crit_edge87.loopexit_crit_edge ], [ %indvars.iv, %.lr.ph86.preheader ], [ %73, %.lr.ph86 ]
  %77 = sub i64 %indvars.iv, %76
  %78 = mul nsw i64 %77, %77
  %79 = add nsw i64 %78, %.065102
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  store i64 %indvars.iv.next, ptr %5, align 8, !tbaa !11
  %.not7495 = icmp slt i32 %75, 0
  br i1 %.not7495, label %._crit_edge100, label %.lr.ph99.preheader

.lr.ph99.preheader:                               ; preds = %._crit_edge87
  %.pre117 = shl nsw i32 %.pre113, 1
  %.pre118 = sub nsw i32 %.pre117, %40
  %80 = icmp sgt i64 %indvars.iv, -2
  %81 = load i32, ptr %3, align 4
  %.not75165 = icmp sgt i32 %.pre118, %81
  %or.cond79166 = select i1 %80, i1 %.not75165, i1 false
  br i1 %or.cond79166, label %.lr.ph169.preheader, label %._crit_edge100

.lr.ph169.preheader:                              ; preds = %.lr.ph99.preheader
  %.pre120 = sext i32 %.pre118 to i64
  br label %.lr.ph169

.lr.ph99:                                         ; preds = %._crit_edge93
  %82 = add i64 %.16796168, %109
  %83 = add nuw nsw i32 %.05797167, 1
  %84 = icmp sgt i64 %110, -1
  %85 = load i32, ptr %3, align 4
  %86 = sext i32 %85 to i64
  %.not75 = icmp sgt i64 %82, %86
  %or.cond79 = select i1 %84, i1 %.not75, i1 false
  br i1 %or.cond79, label %.lr.ph169, label %._crit_edge100, !llvm.loop !16

.lr.ph169:                                        ; preds = %.lr.ph169.preheader, %.lr.ph99
  %87 = phi i32 [ %85, %.lr.ph99 ], [ %81, %.lr.ph169.preheader ]
  %.16796168 = phi i64 [ %82, %.lr.ph99 ], [ %.pre120, %.lr.ph169.preheader ]
  %.05797167 = phi i32 [ %83, %.lr.ph99 ], [ 0, %.lr.ph169.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %88 = shl nsw i32 %87, 1
  %89 = sext i32 %88 to i64
  %90 = sub nsw i64 %89, %.16796168
  store i64 %90, ptr %7, align 8, !tbaa !11
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %92 = load i64, ptr %91, align 8, !tbaa !11
  %93 = trunc i64 %92 to i32
  %94 = add i32 %93, 1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  %95 = icmp sgt i32 %94, 1
  br i1 %95, label %.lr.ph92, label %._crit_edge93

.lr.ph92:                                         ; preds = %.lr.ph169
  %96 = trunc i64 %.16796168 to i32
  br label %97

97:                                               ; preds = %.lr.ph92, %97
  %.05490 = phi i32 [ %94, %.lr.ph92 ], [ %..054, %97 ]
  %.05589 = phi i32 [ 0, %.lr.ph92 ], [ %.055., %97 ]
  %98 = add nsw i32 %.05490, %.05589
  %99 = sdiv i32 %98, 2
  %100 = load i64, ptr %5, align 8, !tbaa !11
  %101 = trunc i64 %100 to i32
  %102 = sub i32 %101, %99
  %103 = sub i32 %96, %99
  %104 = call noundef i32 @_Z19LongestCommonPrefixii(i32 noundef %102, i32 noundef %103)
  %.not76 = icmp slt i32 %104, %99
  %.055. = select i1 %.not76, i32 %.05589, i32 %99
  %..054 = select i1 %.not76, i32 %99, i32 %.05490
  %105 = sub nsw i32 %..054, %.055.
  %106 = icmp sgt i32 %105, 1
  br i1 %106, label %97, label %._crit_edge93, !llvm.loop !17

._crit_edge93:                                    ; preds = %97, %.lr.ph169
  %.055.lcssa = phi i32 [ 0, %.lr.ph169 ], [ %.055., %97 ]
  %107 = load i64, ptr %5, align 8, !tbaa !11
  %108 = xor i32 %.055.lcssa, -1
  %109 = sext i32 %108 to i64
  %110 = add i64 %107, %109
  store i64 %110, ptr %5, align 8, !tbaa !11
  %111 = load i32, ptr %4, align 4, !tbaa !8
  %.not74.not = icmp slt i32 %.05797167, %111
  br i1 %.not74.not, label %.lr.ph99, label %._crit_edge93.._crit_edge100.loopexit_crit_edge, !llvm.loop !16

._crit_edge93.._crit_edge100.loopexit_crit_edge:  ; preds = %._crit_edge93
  %.pre114.pre = load i32, ptr %3, align 4, !tbaa !8
  br label %._crit_edge100

._crit_edge100:                                   ; preds = %.lr.ph99, %.lr.ph99.preheader, %._crit_edge93.._crit_edge100.loopexit_crit_edge, %._crit_edge87.thread, %._crit_edge87
  %indvars.iv.next125 = phi i64 [ %indvars.iv.next, %._crit_edge87 ], [ %indvars.iv.next123, %._crit_edge87.thread ], [ %indvars.iv.next, %._crit_edge93.._crit_edge100.loopexit_crit_edge ], [ %indvars.iv.next, %.lr.ph99.preheader ], [ %indvars.iv.next, %.lr.ph99 ]
  %112 = phi i64 [ %79, %._crit_edge87 ], [ %.065102, %._crit_edge87.thread ], [ %79, %._crit_edge93.._crit_edge100.loopexit_crit_edge ], [ %79, %.lr.ph99.preheader ], [ %79, %.lr.ph99 ]
  %113 = phi i32 [ %.pre113, %._crit_edge87 ], [ %38, %._crit_edge87.thread ], [ %.pre114.pre, %._crit_edge93.._crit_edge100.loopexit_crit_edge ], [ %81, %.lr.ph99.preheader ], [ %85, %.lr.ph99 ]
  %114 = phi i64 [ %indvars.iv.next, %._crit_edge87 ], [ %indvars.iv.next123, %._crit_edge87.thread ], [ %110, %._crit_edge93.._crit_edge100.loopexit_crit_edge ], [ %indvars.iv.next, %.lr.ph99.preheader ], [ %110, %.lr.ph99 ]
  %115 = phi i32 [ %75, %._crit_edge87 ], [ %39, %._crit_edge87.thread ], [ %111, %._crit_edge93.._crit_edge100.loopexit_crit_edge ], [ %75, %.lr.ph99.preheader ], [ %111, %.lr.ph99 ]
  %116 = add nsw i64 %114, 1
  store i64 %116, ptr %5, align 8, !tbaa !11
  %117 = sub nsw i64 %indvars.iv, %116
  %118 = add nsw i64 %117, 1
  %119 = add nsw i64 %117, 2
  %120 = mul nsw i64 %118, %119
  %121 = add nsw i64 %112, %120
  %122 = sext i32 %113 to i64
  %123 = icmp slt i64 %indvars.iv.next125, %122
  br i1 %123, label %.lr.ph105, label %._crit_edge106, !llvm.loop !18

124:                                              ; preds = %._crit_edge106
  %125 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %35, ptr noundef nonnull @.str)
          to label %126 unwind label %129

126:                                              ; preds = %124
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %127 = load i32, ptr %1, align 4, !tbaa !8
  %128 = add nsw i32 %127, -1
  store i32 %128, ptr %1, align 4, !tbaa !8
  %.not = icmp eq i32 %127, 0
  br i1 %.not, label %._crit_edge111, label %.lr.ph110, !llvm.loop !19

129:                                              ; preds = %124, %._crit_edge106
  %130 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br label %131

131:                                              ; preds = %129, %36
  %.pn = phi { ptr, i32 } [ %130, %129 ], [ %37, %36 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  resume { ptr, i32 } %.pn

._crit_edge111:                                   ; preds = %126, %0
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #0 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7reverseIN9__gnu_cxx17__normal_iteratorIPcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEvT_SA_(ptr, ptr) local_unnamed_addr #5

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

; Function Attrs: mustprogress nounwind uwtable
declare ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE3endEv(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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIS_IiSaIiEESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { "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 = { 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 #6 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}


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