; LLVM IR from andreimaximov/algorithms :: codeforces/ability-to-convert (main)

; 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<cache, std::allocator<cache>>::_Vector_impl" }
%"struct.std::_Vector_base<cache, std::allocator<cache>>::_Vector_impl" = type { %"struct.std::_Vector_base<cache, std::allocator<cache>>::_Vector_impl_data" }
%"struct.std::_Vector_base<cache, std::allocator<cache>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator.0" = type { i8 }
%struct.cache = type { i64, i64 }

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7convertjRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8 %0, i32 noundef %1, ptr noundef nonnull align 8 dereferenceable(32) %2) #0 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca %"class.std::vector", align 8
  %8 = alloca %"class.std::allocator.0", align 1
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %struct.cache, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %struct.cache, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca %"class.std::__cxx11::basic_string", align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca %struct.cache, align 8
  store ptr %0, ptr %4, align 8
  store i32 %1, ptr %5, align 4, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #5
  %21 = load ptr, ptr %6, align 8, !tbaa !9
  %22 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %21) #5
  %23 = add i64 %22, 1
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #5
  call void @_ZNSaI5cacheEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #5
  invoke void @_ZNSt6vectorI5cacheSaIS0_EEC2EmRKS1_(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %23, ptr noundef nonnull align 1 dereferenceable(1) %8)
          to label %24 unwind label %38

24:                                               ; preds = %3
  call void @_ZNSt15__new_allocatorI5cacheED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #5
  %25 = getelementptr inbounds %struct.cache, ptr %11, i32 0, i32 0
  store i64 0, ptr %25, align 8, !tbaa !11
  %26 = getelementptr inbounds %struct.cache, ptr %11, i32 0, i32 1
  store i64 1, ptr %26, align 8, !tbaa !14
  %27 = load ptr, ptr %6, align 8, !tbaa !9
  %28 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %27) #5
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %28) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %29, ptr align 8 %11, i64 16, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %30 = load ptr, ptr %6, align 8, !tbaa !9
  %31 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %30) #5
  %32 = sub i64 %31, 1
  %33 = trunc i64 %32 to i32
  store i32 %33, ptr %12, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %163, %24
  %35 = load i32, ptr %12, align 4, !tbaa !5
  %36 = icmp sge i32 %35, 0
  br i1 %36, label %42, label %37

37:                                               ; preds = %34
  store i32 2, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %166

38:                                               ; preds = %3
  %39 = landingpad { ptr, i32 }
          cleanup
  %40 = extractvalue { ptr, i32 } %39, 0
  store ptr %40, ptr %9, align 8
  %41 = extractvalue { ptr, i32 } %39, 1
  store i32 %41, ptr %10, align 4
  call void @_ZNSt15__new_allocatorI5cacheED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #5
  br label %176

42:                                               ; preds = %34
  %43 = load ptr, ptr %6, align 8, !tbaa !9
  %44 = load i32, ptr %12, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %43, i64 noundef %45) #5
  %47 = load i8, ptr %46, align 1, !tbaa !17
  %48 = sext i8 %47 to i32
  %49 = icmp eq i32 %48, 48
  br i1 %49, label %50, label %71

50:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #5
  %51 = getelementptr inbounds %struct.cache, ptr %14, i32 0, i32 0
  %52 = load i32, ptr %12, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  %54 = sext i32 %53 to i64
  %55 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %54) #5
  %56 = getelementptr inbounds %struct.cache, ptr %55, i32 0, i32 0
  %57 = load i64, ptr %56, align 8, !tbaa !11
  store i64 %57, ptr %51, align 8, !tbaa !11
  %58 = getelementptr inbounds %struct.cache, ptr %14, i32 0, i32 1
  %59 = load i32, ptr %12, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  %61 = sext i32 %60 to i64
  %62 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %61) #5
  %63 = getelementptr inbounds %struct.cache, ptr %62, i32 0, i32 1
  %64 = load i64, ptr %63, align 8, !tbaa !14
  %65 = load i32, ptr %5, align 4, !tbaa !5
  %66 = zext i32 %65 to i64
  %67 = mul i64 %64, %66
  store i64 %67, ptr %58, align 8, !tbaa !14
  %68 = load i32, ptr %12, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %69) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %70, ptr align 8 %14, i64 16, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #5
  br label %163

71:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %72 = load i32, ptr %12, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  store i64 %73, ptr %15, align 8, !tbaa !16
  br label %74

74:                                               ; preds = %158, %71
  %75 = load i64, ptr %15, align 8, !tbaa !16
  %76 = load ptr, ptr %6, align 8, !tbaa !9
  %77 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %76) #5
  %78 = icmp ult i64 %75, %77
  br i1 %78, label %80, label %79

79:                                               ; preds = %74
  store i32 5, ptr %13, align 4
  br label %161

80:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr %17) #5
  %81 = load ptr, ptr %6, align 8, !tbaa !9
  %82 = load i32, ptr %12, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = load i64, ptr %15, align 8, !tbaa !16
  %85 = load i32, ptr %12, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = sub i64 %84, %86
  %88 = add i64 %87, 1
  invoke void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %17, ptr noundef nonnull align 8 dereferenceable(32) %81, i64 noundef %83, i64 noundef %88)
          to label %89 unwind label %97

89:                                               ; preds = %80
  %90 = invoke noundef i64 @_ZNSt7__cxx116stoullERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEPmi(ptr noundef nonnull align 8 dereferenceable(32) %17, ptr noundef null, i32 noundef 10)
          to label %91 unwind label %101

91:                                               ; preds = %89
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #5
  store i64 %90, ptr %16, align 8, !tbaa !16
  %92 = load i64, ptr %16, align 8, !tbaa !16
  %93 = load i32, ptr %5, align 4, !tbaa !5
  %94 = zext i32 %93 to i64
  %95 = icmp uge i64 %92, %94
  br i1 %95, label %96, label %106

96:                                               ; preds = %91
  store i32 5, ptr %13, align 4
  br label %155

97:                                               ; preds = %80
  %98 = landingpad { ptr, i32 }
          cleanup
  %99 = extractvalue { ptr, i32 } %98, 0
  store ptr %99, ptr %9, align 8
  %100 = extractvalue { ptr, i32 } %98, 1
  store i32 %100, ptr %10, align 4
  br label %105

101:                                              ; preds = %89
  %102 = landingpad { ptr, i32 }
          cleanup
  %103 = extractvalue { ptr, i32 } %102, 0
  store ptr %103, ptr %9, align 8
  %104 = extractvalue { ptr, i32 } %102, 1
  store i32 %104, ptr %10, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #5
  br label %105

105:                                              ; preds = %101, %97
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %175

106:                                              ; preds = %91
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %107 = load i64, ptr %15, align 8, !tbaa !16
  %108 = add i64 %107, 1
  %109 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %108) #5
  %110 = getelementptr inbounds %struct.cache, ptr %109, i32 0, i32 1
  %111 = load i64, ptr %110, align 8, !tbaa !14
  store i64 %111, ptr %18, align 8, !tbaa !16
  %112 = call noundef i64 @_ZNSt14numeric_limitsImE3maxEv() #5
  %113 = load i64, ptr %16, align 8, !tbaa !16
  %114 = udiv i64 %112, %113
  %115 = load i64, ptr %18, align 8, !tbaa !16
  %116 = icmp ult i64 %114, %115
  br i1 %116, label %117, label %118

117:                                              ; preds = %106
  store i32 7, ptr %13, align 4
  br label %154

118:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %119 = load i64, ptr %16, align 8, !tbaa !16
  %120 = load i64, ptr %18, align 8, !tbaa !16
  %121 = mul i64 %119, %120
  %122 = load i64, ptr %15, align 8, !tbaa !16
  %123 = add i64 %122, 1
  %124 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %123) #5
  %125 = getelementptr inbounds %struct.cache, ptr %124, i32 0, i32 0
  %126 = load i64, ptr %125, align 8, !tbaa !11
  %127 = add i64 %121, %126
  store i64 %127, ptr %19, align 8, !tbaa !16
  %128 = load i32, ptr %12, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %129) #5
  %131 = getelementptr inbounds %struct.cache, ptr %130, i32 0, i32 1
  %132 = load i64, ptr %131, align 8, !tbaa !14
  %133 = icmp eq i64 %132, 0
  br i1 %133, label %142, label %134

134:                                              ; preds = %118
  %135 = load i64, ptr %19, align 8, !tbaa !16
  %136 = load i32, ptr %12, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %137) #5
  %139 = getelementptr inbounds %struct.cache, ptr %138, i32 0, i32 0
  %140 = load i64, ptr %139, align 8, !tbaa !11
  %141 = icmp ult i64 %135, %140
  br i1 %141, label %142, label %153

142:                                              ; preds = %134, %118
  call void @llvm.lifetime.start.p0(i64 16, ptr %20) #5
  %143 = getelementptr inbounds %struct.cache, ptr %20, i32 0, i32 0
  %144 = load i64, ptr %19, align 8, !tbaa !16
  store i64 %144, ptr %143, align 8, !tbaa !11
  %145 = getelementptr inbounds %struct.cache, ptr %20, i32 0, i32 1
  %146 = load i64, ptr %18, align 8, !tbaa !16
  %147 = load i32, ptr %5, align 4, !tbaa !5
  %148 = zext i32 %147 to i64
  %149 = mul i64 %146, %148
  store i64 %149, ptr %145, align 8, !tbaa !14
  %150 = load i32, ptr %12, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %151) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %152, ptr align 8 %20, i64 16, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #5
  br label %153

153:                                              ; preds = %142, %134
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  store i32 0, ptr %13, align 4
  br label %154

154:                                              ; preds = %153, %117
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  br label %155

155:                                              ; preds = %154, %96
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  %156 = load i32, ptr %13, align 4
  switch i32 %156, label %161 [
    i32 0, label %157
    i32 7, label %158
  ]

157:                                              ; preds = %155
  br label %158

158:                                              ; preds = %157, %155
  %159 = load i64, ptr %15, align 8, !tbaa !16
  %160 = add i64 %159, 1
  store i64 %160, ptr %15, align 8, !tbaa !16
  br label %74, !llvm.loop !18

161:                                              ; preds = %155, %79
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %162

162:                                              ; preds = %161
  br label %163

163:                                              ; preds = %162, %50
  %164 = load i32, ptr %12, align 4, !tbaa !5
  %165 = add nsw i32 %164, -1
  store i32 %165, ptr %12, align 4, !tbaa !5
  br label %34, !llvm.loop !20

166:                                              ; preds = %37
  %167 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef 0) #5
  %168 = getelementptr inbounds %struct.cache, ptr %167, i32 0, i32 0
  %169 = load i64, ptr %168, align 8, !tbaa !11
  invoke void @_ZNSt7__cxx119to_stringEm(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %0, i64 noundef %169)
          to label %170 unwind label %171

170:                                              ; preds = %166
  store i32 1, ptr %13, align 4
  call void @_ZNSt6vectorI5cacheSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #5
  ret void

171:                                              ; preds = %166
  %172 = landingpad { ptr, i32 }
          cleanup
  %173 = extractvalue { ptr, i32 } %172, 0
  store ptr %173, ptr %9, align 8
  %174 = extractvalue { ptr, i32 } %172, 1
  store i32 %174, ptr %10, align 4
  br label %175

175:                                              ; preds = %171, %105
  call void @_ZNSt6vectorI5cacheSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  br label %176

176:                                              ; preds = %175, %38
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #5
  br label %177

177:                                              ; preds = %176
  %178 = load ptr, ptr %9, align 8
  %179 = load i32, ptr %10, align 4
  %180 = insertvalue { ptr, i32 } poison, ptr %178, 0
  %181 = insertvalue { ptr, i32 } %180, i32 %179, 1
  resume { ptr, i32 } %181
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaI5cacheEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI5cacheSaIS0_EEC2EmRKS1_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 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) #1

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZNSt7__cxx116stoullERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEPmi(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, i32 noundef) #4

; Function Attrs: mustprogress uwtable
declare void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef) #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNSt14numeric_limitsImE3maxEv() #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt7__cxx119to_stringEm(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, i64 noundef) #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorI5cacheED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

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


; 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<cache, std::allocator<cache>>::_Vector_impl" }
%"struct.std::_Vector_base<cache, std::allocator<cache>>::_Vector_impl" = type { %"struct.std::_Vector_base<cache, std::allocator<cache>>::_Vector_impl_data" }
%"struct.std::_Vector_base<cache, std::allocator<cache>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator.0" = type { i8 }

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7convertjRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8 %0, i32 noundef %1, ptr noundef nonnull align 8 dereferenceable(32) %2) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.std::vector", align 8
  %5 = alloca %"class.std::allocator.0", align 1
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #4
  %7 = tail call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  %8 = add i64 %7, 1
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #4
  call void @_ZNSaI5cacheEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #4
  invoke void @_ZNSt6vectorI5cacheSaIS0_EEC2EmRKS1_(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %8, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %9 unwind label %20

9:                                                ; preds = %3
  call void @_ZNSt15__new_allocatorI5cacheED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #4
  %10 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %10) #4
  store i64 0, ptr %11, align 8, !tbaa !5
  %.sroa.429.0..sroa_idx = getelementptr inbounds i8, ptr %11, i64 8
  store i64 1, ptr %.sroa.429.0..sroa_idx, align 8, !tbaa !5
  %12 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  %13 = trunc i64 %12 to i32
  %.04356 = add i32 %13, -1
  %14 = icmp sgt i32 %.04356, -1
  br i1 %14, label %.lr.ph59, label %._crit_edge

.lr.ph59:                                         ; preds = %9
  %15 = zext i32 %1 to i64
  %16 = zext nneg i32 %.04356 to i64
  %17 = and i64 %12, 4294967295
  br label %22

._crit_edge:                                      ; preds = %.loopexit, %9
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef 0) #4
  %19 = load i64, ptr %18, align 8, !tbaa !9
  invoke void @_ZNSt7__cxx119to_stringEm(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %0, i64 noundef %19)
          to label %73 unwind label %74

20:                                               ; preds = %3
  %21 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorI5cacheED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #4
  br label %77

22:                                               ; preds = %.lr.ph59, %.loopexit
  %indvars.iv60 = phi i64 [ %17, %.lr.ph59 ], [ %indvars.iv.next61, %.loopexit ]
  %indvars.iv = phi i64 [ %16, %.lr.ph59 ], [ %indvars.iv.next, %.loopexit ]
  %23 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %2, i64 noundef %indvars.iv) #4
  %24 = load i8, ptr %23, align 1, !tbaa !11
  %25 = icmp eq i8 %24, 48
  br i1 %25, label %28, label %.preheader

.preheader:                                       ; preds = %22
  %26 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  %27 = icmp ugt i64 %26, %indvars.iv
  br i1 %27, label %.lr.ph, label %.loopexit

28:                                               ; preds = %22
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %indvars.iv60) #4
  %30 = load i64, ptr %29, align 8, !tbaa !9
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %indvars.iv60) #4
  %32 = getelementptr inbounds i8, ptr %31, i64 8
  %33 = load i64, ptr %32, align 8, !tbaa !12
  %34 = mul i64 %33, %15
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %indvars.iv) #4
  store i64 %30, ptr %35, align 8, !tbaa !5
  %.sroa.414.0..sroa_idx = getelementptr inbounds i8, ptr %35, i64 8
  store i64 %34, ptr %.sroa.414.0..sroa_idx, align 8, !tbaa !5
  br label %.loopexit

.lr.ph:                                           ; preds = %.preheader, %69
  %.04654 = phi i64 [ %46, %69 ], [ %indvars.iv, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #4
  %reass.sub = sub nuw i64 %.04654, %indvars.iv
  %36 = add nuw i64 %reass.sub, 1
  invoke void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %6, ptr noundef nonnull align 8 dereferenceable(32) %2, i64 noundef %indvars.iv, i64 noundef %36)
          to label %37 unwind label %40

37:                                               ; preds = %.lr.ph
  %38 = invoke noundef i64 @_ZNSt7__cxx116stoullERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEPmi(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef null, i32 noundef 10)
          to label %39 unwind label %42

39:                                               ; preds = %37
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #4
  %.not = icmp ult i64 %38, %15
  br i1 %.not, label %45, label %.loopexit

40:                                               ; preds = %.lr.ph
  %41 = landingpad { ptr, i32 }
          cleanup
  br label %44

42:                                               ; preds = %37
  %43 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #4
  br label %44

44:                                               ; preds = %42, %40
  %.pn = phi { ptr, i32 } [ %43, %42 ], [ %41, %40 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #4
  br label %76

45:                                               ; preds = %39
  %46 = add nuw i64 %.04654, 1
  %47 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %46) #4
  %48 = getelementptr inbounds i8, ptr %47, i64 8
  %49 = load i64, ptr %48, align 8, !tbaa !12
  %50 = call noundef i64 @_ZNSt14numeric_limitsImE3maxEv() #4
  %51 = udiv i64 %50, %38
  %52 = icmp ult i64 %51, %49
  br i1 %52, label %69, label %53

53:                                               ; preds = %45
  %54 = mul i64 %49, %38
  %55 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %46) #4
  %56 = load i64, ptr %55, align 8, !tbaa !9
  %57 = add i64 %56, %54
  %58 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %indvars.iv) #4
  %59 = getelementptr inbounds i8, ptr %58, i64 8
  %60 = load i64, ptr %59, align 8, !tbaa !12
  %61 = icmp eq i64 %60, 0
  br i1 %61, label %66, label %62

62:                                               ; preds = %53
  %63 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %indvars.iv) #4
  %64 = load i64, ptr %63, align 8, !tbaa !9
  %65 = icmp ult i64 %57, %64
  br i1 %65, label %66, label %69

66:                                               ; preds = %62, %53
  %67 = mul i64 %49, %15
  %68 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI5cacheSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %indvars.iv) #4
  store i64 %57, ptr %68, align 8, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %68, i64 8
  store i64 %67, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !5
  br label %69

69:                                               ; preds = %45, %66, %62
  %70 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  %71 = icmp ult i64 %46, %70
  br i1 %71, label %.lr.ph, label %.loopexit, !llvm.loop !13

.loopexit:                                        ; preds = %69, %39, %.preheader, %28
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %72 = icmp sgt i64 %indvars.iv, 0
  %indvars.iv.next61 = add nsw i64 %indvars.iv60, -1
  br i1 %72, label %22, label %._crit_edge, !llvm.loop !15

73:                                               ; preds = %._crit_edge
  call void @_ZNSt6vectorI5cacheSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #4
  ret void

74:                                               ; preds = %._crit_edge
  %75 = landingpad { ptr, i32 }
          cleanup
  br label %76

76:                                               ; preds = %74, %44
  %.pn.pn = phi { ptr, i32 } [ %.pn, %44 ], [ %75, %74 ]
  call void @_ZNSt6vectorI5cacheSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  br label %77

77:                                               ; preds = %76, %20
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %76 ], [ %21, %20 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #4
  resume { ptr, i32 } %.pn.pn.pn
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaI5cacheEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI5cacheSaIS0_EEC2EmRKS1_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 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) #1

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZNSt7__cxx116stoullERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEPmi(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef) local_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 #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNSt14numeric_limitsImE3maxEv() local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt7__cxx119to_stringEm(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, i64 noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorI5cacheED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress 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 = { 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 #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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTS5cache", !6, i64 0, !6, i64 8}
!11 = !{!7, !7, i64 0}
!12 = !{!10, !6, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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