; LLVM IR from AdarshGaur/Competitive-Programming :: Codeforces/Codeforces Round #748 (Div. 3)/E. Gardener and Tree.ll (Z5solvev)

; 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::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.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<long, std::allocator<long>>::_Deque_impl" }
%"struct.std::_Deque_base<long, std::allocator<long>>::_Deque_impl" = type { %"struct.std::_Deque_base<long, std::allocator<long>>::_Deque_impl_data" }
%"struct.std::_Deque_base<long, std::allocator<long>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@_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 uwtable
define dso_local void @_Z5solvev() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %"class.std::queue", align 8
  %12 = alloca %"class.std::vector", align 8
  %13 = alloca i64, align 8
  %14 = alloca %"class.std::allocator", align 1
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %21 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %22 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %25 = load i64, ptr %1, align 8, !tbaa !5
  %26 = call ptr @llvm.stacksave.p0()
  store ptr %26, ptr %3, align 8
  %27 = alloca %"class.std::vector", i64 %25, align 16
  store i64 %25, ptr %4, align 8
  %28 = icmp eq i64 %25, 0
  br i1 %28, label %35, label %29

29:                                               ; preds = %0
  %30 = getelementptr inbounds %"class.std::vector", ptr %27, i64 %25
  br label %31

31:                                               ; preds = %31, %29
  %32 = phi ptr [ %27, %29 ], [ %33, %31 ]
  call void @_ZNSt6vectorIlSaIlEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %32) #7
  %33 = getelementptr inbounds %"class.std::vector", ptr %32, i64 1
  %34 = icmp eq ptr %33, %30
  br i1 %34, label %35, label %31

35:                                               ; preds = %31, %0
  %36 = load i64, ptr %1, align 8, !tbaa !5
  %37 = alloca i64, i64 %36, align 16
  store i64 %36, ptr %5, align 8
  %38 = mul nuw i64 8, %36
  call void @llvm.memset.p0.i64(ptr align 16 %37, i8 0, i64 %38, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 1, ptr %6, align 8, !tbaa !5
  br label %39

39:                                               ; preds = %67, %35
  %40 = load i64, ptr %6, align 8, !tbaa !5
  %41 = load i64, ptr %1, align 8, !tbaa !5
  %42 = icmp slt i64 %40, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %74

44:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %45 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %46 unwind label %70

46:                                               ; preds = %44
  %47 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %45, ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %48 unwind label %70

48:                                               ; preds = %46
  %49 = load i64, ptr %7, align 8, !tbaa !5
  %50 = add nsw i64 %49, -1
  store i64 %50, ptr %7, align 8, !tbaa !5
  %51 = load i64, ptr %8, align 8, !tbaa !5
  %52 = add nsw i64 %51, -1
  store i64 %52, ptr %8, align 8, !tbaa !5
  %53 = load i64, ptr %7, align 8, !tbaa !5
  %54 = getelementptr inbounds %"class.std::vector", ptr %27, i64 %53
  invoke void @_ZNSt6vectorIlSaIlEE9push_backERKl(ptr noundef nonnull align 8 dereferenceable(24) %54, ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %55 unwind label %70

55:                                               ; preds = %48
  %56 = load i64, ptr %8, align 8, !tbaa !5
  %57 = getelementptr inbounds %"class.std::vector", ptr %27, i64 %56
  invoke void @_ZNSt6vectorIlSaIlEE9push_backERKl(ptr noundef nonnull align 8 dereferenceable(24) %57, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %58 unwind label %70

58:                                               ; preds = %55
  %59 = load i64, ptr %7, align 8, !tbaa !5
  %60 = getelementptr inbounds i64, ptr %37, i64 %59
  %61 = load i64, ptr %60, align 8, !tbaa !5
  %62 = add nsw i64 %61, 1
  store i64 %62, ptr %60, align 8, !tbaa !5
  %63 = load i64, ptr %8, align 8, !tbaa !5
  %64 = getelementptr inbounds i64, ptr %37, i64 %63
  %65 = load i64, ptr %64, align 8, !tbaa !5
  %66 = add nsw i64 %65, 1
  store i64 %66, ptr %64, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %67

67:                                               ; preds = %58
  %68 = load i64, ptr %6, align 8, !tbaa !5
  %69 = add nsw i64 %68, 1
  store i64 %69, ptr %6, align 8, !tbaa !5
  br label %39, !llvm.loop !9

70:                                               ; preds = %55, %48, %46, %44
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %9, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %202

74:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 80, ptr %11) #7
  invoke void @_ZNSt5queueIlSt5dequeIlSaIlEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %75 unwind label %83

75:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #7
  %76 = load i64, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  store i64 0, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #7
  call void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %14) #7
  invoke void @_ZNSt6vectorIlSaIlEEC2EmRKlRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %76, ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 1 dereferenceable(1) %14)
          to label %77 unwind label %87

77:                                               ; preds = %75
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %14) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  store i64 0, ptr %15, align 8, !tbaa !5
  br label %78

78:                                               ; preds = %105, %77
  %79 = load i64, ptr %15, align 8, !tbaa !5
  %80 = load i64, ptr %1, align 8, !tbaa !5
  %81 = icmp slt i64 %79, %80
  br i1 %81, label %91, label %82

82:                                               ; preds = %78
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  br label %108

83:                                               ; preds = %74
  %84 = landingpad { ptr, i32 }
          cleanup
  %85 = extractvalue { ptr, i32 } %84, 0
  store ptr %85, ptr %9, align 8
  %86 = extractvalue { ptr, i32 } %84, 1
  store i32 %86, ptr %10, align 4
  br label %201

87:                                               ; preds = %75
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %9, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %10, align 4
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %14) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %200

91:                                               ; preds = %78
  %92 = load i64, ptr %15, align 8, !tbaa !5
  %93 = getelementptr inbounds i64, ptr %37, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !5
  %95 = icmp sle i64 %94, 1
  br i1 %95, label %96, label %104

96:                                               ; preds = %91
  %97 = load i64, ptr %15, align 8, !tbaa !5
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %97) #7
  store i64 1, ptr %98, align 8, !tbaa !5
  invoke void @_ZNSt5queueIlSt5dequeIlSaIlEEE4pushERKl(ptr noundef nonnull align 8 dereferenceable(80) %11, ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %99 unwind label %100

99:                                               ; preds = %96
  br label %104

100:                                              ; preds = %96
  %101 = landingpad { ptr, i32 }
          cleanup
  %102 = extractvalue { ptr, i32 } %101, 0
  store ptr %102, ptr %9, align 8
  %103 = extractvalue { ptr, i32 } %101, 1
  store i32 %103, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  br label %199

104:                                              ; preds = %99, %91
  br label %105

105:                                              ; preds = %104
  %106 = load i64, ptr %15, align 8, !tbaa !5
  %107 = add nsw i64 %106, 1
  store i64 %107, ptr %15, align 8, !tbaa !5
  br label %78, !llvm.loop !11

108:                                              ; preds = %82
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %109 = load i64, ptr %1, align 8, !tbaa !5
  store i64 %109, ptr %16, align 8, !tbaa !5
  br label %110

110:                                              ; preds = %182, %180, %108
  %111 = invoke noundef zeroext i1 @_ZNKSt5queueIlSt5dequeIlSaIlEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %112 unwind label %127

112:                                              ; preds = %110
  %113 = xor i1 %111, true
  br i1 %113, label %114, label %184

114:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %115 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5queueIlSt5dequeIlSaIlEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %116 unwind label %131

116:                                              ; preds = %114
  %117 = load i64, ptr %115, align 8, !tbaa !5
  store i64 %117, ptr %17, align 8, !tbaa !5
  invoke void @_ZNSt5queueIlSt5dequeIlSaIlEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %118 unwind label %131

118:                                              ; preds = %116
  %119 = load i64, ptr %16, align 8, !tbaa !5
  %120 = add nsw i64 %119, -1
  store i64 %120, ptr %16, align 8, !tbaa !5
  %121 = load i64, ptr %17, align 8, !tbaa !5
  %122 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %121) #7
  %123 = load i64, ptr %122, align 8, !tbaa !5
  %124 = load i64, ptr %2, align 8, !tbaa !5
  %125 = icmp eq i64 %123, %124
  br i1 %125, label %126, label %135

126:                                              ; preds = %118
  store i32 8, ptr %18, align 4
  br label %180, !llvm.loop !12

127:                                              ; preds = %187, %184, %110
  %128 = landingpad { ptr, i32 }
          cleanup
  %129 = extractvalue { ptr, i32 } %128, 0
  store ptr %129, ptr %9, align 8
  %130 = extractvalue { ptr, i32 } %128, 1
  store i32 %130, ptr %10, align 4
  br label %198

131:                                              ; preds = %116, %114
  %132 = landingpad { ptr, i32 }
          cleanup
  %133 = extractvalue { ptr, i32 } %132, 0
  store ptr %133, ptr %9, align 8
  %134 = extractvalue { ptr, i32 } %132, 1
  store i32 %134, ptr %10, align 4
  br label %183

135:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %136 = load i64, ptr %17, align 8, !tbaa !5
  %137 = getelementptr inbounds %"class.std::vector", ptr %27, i64 %136
  store ptr %137, ptr %19, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %138 = load ptr, ptr %19, align 8, !tbaa !13
  %139 = call ptr @_ZNSt6vectorIlSaIlEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %138) #7
  %140 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %20, i32 0, i32 0
  store ptr %139, ptr %140, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %141 = load ptr, ptr %19, align 8, !tbaa !13
  %142 = call ptr @_ZNSt6vectorIlSaIlEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %141) #7
  %143 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %21, i32 0, i32 0
  store ptr %142, ptr %143, align 8
  br label %144

144:                                              ; preds = %177, %135
  %145 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPlSt6vectorIlSaIlEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  br i1 %145, label %147, label %146

146:                                              ; preds = %144
  store i32 10, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  br label %179

147:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %148 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPlSt6vectorIlSaIlEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %20) #7
  %149 = load i64, ptr %148, align 8, !tbaa !5
  store i64 %149, ptr %22, align 8, !tbaa !5
  %150 = load i64, ptr %22, align 8, !tbaa !5
  %151 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %150) #7
  %152 = load i64, ptr %151, align 8, !tbaa !5
  %153 = icmp eq i64 %152, 0
  br i1 %153, label %154, label %176

154:                                              ; preds = %147
  %155 = load i64, ptr %22, align 8, !tbaa !5
  %156 = getelementptr inbounds i64, ptr %37, i64 %155
  %157 = load i64, ptr %156, align 8, !tbaa !5
  %158 = add nsw i64 %157, -1
  store i64 %158, ptr %156, align 8, !tbaa !5
  %159 = load i64, ptr %22, align 8, !tbaa !5
  %160 = getelementptr inbounds i64, ptr %37, i64 %159
  %161 = load i64, ptr %160, align 8, !tbaa !5
  %162 = icmp sle i64 %161, 1
  br i1 %162, label %163, label %175

163:                                              ; preds = %154
  invoke void @_ZNSt5queueIlSt5dequeIlSaIlEEE4pushERKl(ptr noundef nonnull align 8 dereferenceable(80) %11, ptr noundef nonnull align 8 dereferenceable(8) %22)
          to label %164 unwind label %171

164:                                              ; preds = %163
  %165 = load i64, ptr %17, align 8, !tbaa !5
  %166 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %165) #7
  %167 = load i64, ptr %166, align 8, !tbaa !5
  %168 = add nsw i64 %167, 1
  %169 = load i64, ptr %22, align 8, !tbaa !5
  %170 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %169) #7
  store i64 %168, ptr %170, align 8, !tbaa !5
  br label %175

171:                                              ; preds = %163
  %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
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  br label %183

175:                                              ; preds = %164, %154
  br label %176

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

177:                                              ; preds = %176
  %178 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPlSt6vectorIlSaIlEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %20) #7
  br label %144

179:                                              ; preds = %146
  store i32 0, ptr %18, align 4
  br label %180

180:                                              ; preds = %179, %126
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  %181 = load i32, ptr %18, align 4
  switch i32 %181, label %215 [
    i32 0, label %182
    i32 8, label %110
  ]

182:                                              ; preds = %180
  br label %110, !llvm.loop !12

183:                                              ; preds = %171, %131
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  br label %198

184:                                              ; preds = %112
  %185 = load i64, ptr %16, align 8, !tbaa !5
  %186 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %185)
          to label %187 unwind label %127

187:                                              ; preds = %184
  %188 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %186, ptr noundef @.str)
          to label %189 unwind label %127

189:                                              ; preds = %187
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #7
  call void @_ZNSt5queueIlSt5dequeIlSaIlEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %11) #7
  call void @llvm.lifetime.end.p0(i64 80, ptr %11) #7
  %190 = getelementptr inbounds %"class.std::vector", ptr %27, i64 %25
  %191 = icmp eq ptr %27, %190
  br i1 %191, label %196, label %192

192:                                              ; preds = %192, %189
  %193 = phi ptr [ %190, %189 ], [ %194, %192 ]
  %194 = getelementptr inbounds %"class.std::vector", ptr %193, i64 -1
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %194) #7
  %195 = icmp eq ptr %194, %27
  br i1 %195, label %196, label %192

196:                                              ; preds = %192, %189
  %197 = load ptr, ptr %3, align 8
  call void @llvm.stackrestore.p0(ptr %197)
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #7
  ret void

198:                                              ; preds = %183, %127
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %199

199:                                              ; preds = %198, %100
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  br label %200

200:                                              ; preds = %199, %87
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #7
  call void @_ZNSt5queueIlSt5dequeIlSaIlEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %11) #7
  br label %201

201:                                              ; preds = %200, %83
  call void @llvm.lifetime.end.p0(i64 80, ptr %11) #7
  br label %202

202:                                              ; preds = %201, %70
  %203 = getelementptr inbounds %"class.std::vector", ptr %27, i64 %25
  %204 = icmp eq ptr %27, %203
  br i1 %204, label %209, label %205

205:                                              ; preds = %205, %202
  %206 = phi ptr [ %203, %202 ], [ %207, %205 ]
  %207 = getelementptr inbounds %"class.std::vector", ptr %206, i64 -1
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %207) #7
  %208 = icmp eq ptr %207, %27
  br i1 %208, label %209, label %205

209:                                              ; preds = %205, %202
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #7
  br label %210

210:                                              ; preds = %209
  %211 = load ptr, ptr %9, align 8
  %212 = load i32, ptr %10, align 4
  %213 = insertvalue { ptr, i32 } poison, ptr %211, 0
  %214 = insertvalue { ptr, i32 } %213, i32 %212, 1
  resume { ptr, i32 } %214

215:                                              ; preds = %180
  unreachable
}

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueIlSt5dequeIlSaIlEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIlSaIlEEC2EmRKlRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueIlSt5dequeIlSaIlEEE4pushERKl(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5queueIlSt5dequeIlSaIlEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5queueIlSt5dequeIlSaIlEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIlSt5dequeIlSaIlEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) #3 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPlSt6vectorIlSaIlEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPlSt6vectorIlSaIlEEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) #3 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) #6

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIlSt5dequeIlSaIlEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #5 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 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 = { nocallback nofree nosync nounwind willreturn }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}


; 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::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.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<long, std::allocator<long>>::_Deque_impl" }
%"struct.std::_Deque_base<long, std::allocator<long>>::_Deque_impl" = type { %"struct.std::_Deque_base<long, std::allocator<long>>::_Deque_impl_data" }
%"struct.std::_Deque_base<long, std::allocator<long>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@_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 uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca %"class.std::queue", align 8
  %6 = alloca %"class.std::vector", align 8
  %7 = alloca i64, align 8
  %8 = alloca %"class.std::allocator", align 1
  %9 = alloca i64, align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %12 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %15 = load i64, ptr %1, align 8, !tbaa !5
  %16 = call ptr @llvm.stacksave.p0()
  %17 = alloca %"class.std::vector", i64 %15, align 16
  %18 = icmp eq i64 %15, 0
  br i1 %18, label %.loopexit31, label %19

19:                                               ; preds = %0
  %20 = getelementptr inbounds %"class.std::vector", ptr %17, i64 %15
  br label %21

21:                                               ; preds = %21, %19
  %22 = phi ptr [ %17, %19 ], [ %23, %21 ]
  call void @_ZNSt6vectorIlSaIlEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %22) #7
  %23 = getelementptr inbounds i8, ptr %22, i64 24
  %24 = icmp eq ptr %23, %20
  br i1 %24, label %.loopexit31, label %21

.loopexit31:                                      ; preds = %21, %0
  %25 = load i64, ptr %1, align 8, !tbaa !5
  %26 = alloca i64, i64 %25, align 16
  %27 = shl nuw i64 %25, 3
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %26, i8 0, i64 %27, i1 false)
  %28 = icmp sgt i64 %25, 1
  br i1 %28, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %41, %.loopexit31
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %5) #7
  invoke void @_ZNSt5queueIlSt5dequeIlSaIlEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
          to label %55 unwind label %61

.lr.ph:                                           ; preds = %.loopexit31, %41
  %.034 = phi i64 [ %50, %41 ], [ 1, %.loopexit31 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %29 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %30 unwind label %53

30:                                               ; preds = %.lr.ph
  %31 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %29, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %32 unwind label %53

32:                                               ; preds = %30
  %33 = load i64, ptr %3, align 8, !tbaa !5
  %34 = add nsw i64 %33, -1
  store i64 %34, ptr %3, align 8, !tbaa !5
  %35 = load i64, ptr %4, align 8, !tbaa !5
  %36 = add nsw i64 %35, -1
  store i64 %36, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %"class.std::vector", ptr %17, i64 %34
  invoke void @_ZNSt6vectorIlSaIlEE9push_backERKl(ptr noundef nonnull align 8 dereferenceable(24) %37, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %38 unwind label %53

38:                                               ; preds = %32
  %39 = load i64, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %"class.std::vector", ptr %17, i64 %39
  invoke void @_ZNSt6vectorIlSaIlEE9push_backERKl(ptr noundef nonnull align 8 dereferenceable(24) %40, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %41 unwind label %53

41:                                               ; preds = %38
  %42 = load i64, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds i64, ptr %26, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !5
  %45 = add nsw i64 %44, 1
  store i64 %45, ptr %43, align 8, !tbaa !5
  %46 = load i64, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds i64, ptr %26, i64 %46
  %48 = load i64, ptr %47, align 8, !tbaa !5
  %49 = add nsw i64 %48, 1
  store i64 %49, ptr %47, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  %50 = add nuw nsw i64 %.034, 1
  %51 = load i64, ptr %1, align 8, !tbaa !5
  %52 = icmp slt i64 %50, %51
  br i1 %52, label %.lr.ph, label %._crit_edge, !llvm.loop !9

53:                                               ; preds = %38, %32, %30, %.lr.ph
  %54 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  br label %128

55:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #7
  %56 = load i64, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  store i64 0, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %8) #7
  call void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #7
  invoke void @_ZNSt6vectorIlSaIlEEC2EmRKlRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %56, ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 1 dereferenceable(1) %8)
          to label %57 unwind label %63

57:                                               ; preds = %55
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #7
  store i64 0, ptr %9, align 8, !tbaa !5
  %58 = load i64, ptr %1, align 8, !tbaa !5
  %59 = icmp sgt i64 %58, 0
  br i1 %59, label %.lr.ph37, label %._crit_edge38

._crit_edge38:                                    ; preds = %73, %57
  %.lcssa = phi i64 [ %58, %57 ], [ %74, %73 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  %60 = call noundef zeroext i1 @_ZNKSt5queueIlSt5dequeIlSaIlEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  br i1 %60, label %._crit_edge45, label %.lr.ph44

61:                                               ; preds = %._crit_edge
  %62 = landingpad { ptr, i32 }
          cleanup
  br label %127

63:                                               ; preds = %55
  %64 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  br label %126

.lr.ph37:                                         ; preds = %57, %73
  %65 = phi i64 [ %74, %73 ], [ %58, %57 ]
  %storemerge35 = phi i64 [ %76, %73 ], [ 0, %57 ]
  %66 = getelementptr inbounds i64, ptr %26, i64 %storemerge35
  %67 = load i64, ptr %66, align 8, !tbaa !5
  %68 = icmp slt i64 %67, 2
  br i1 %68, label %69, label %73

69:                                               ; preds = %.lr.ph37
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %storemerge35) #7
  store i64 1, ptr %70, align 8, !tbaa !5
  invoke void @_ZNSt5queueIlSt5dequeIlSaIlEEE4pushERKl(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %._crit_edge50 unwind label %71

._crit_edge50:                                    ; preds = %69
  %.pre = load i64, ptr %9, align 8, !tbaa !5
  %.pre51 = load i64, ptr %1, align 8, !tbaa !5
  br label %73

71:                                               ; preds = %69
  %72 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  br label %125

73:                                               ; preds = %._crit_edge50, %.lr.ph37
  %74 = phi i64 [ %.pre51, %._crit_edge50 ], [ %65, %.lr.ph37 ]
  %75 = phi i64 [ %.pre, %._crit_edge50 ], [ %storemerge35, %.lr.ph37 ]
  %76 = add nsw i64 %75, 1
  store i64 %76, ptr %9, align 8, !tbaa !5
  %77 = icmp slt i64 %76, %74
  br i1 %77, label %.lr.ph37, label %._crit_edge38, !llvm.loop !11

.lr.ph44:                                         ; preds = %._crit_edge38, %115
  %.01242 = phi i64 [ %80, %115 ], [ %.lcssa, %._crit_edge38 ]
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5queueIlSt5dequeIlSaIlEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %79 = load i64, ptr %78, align 8, !tbaa !5
  call void @_ZNSt5queueIlSt5dequeIlSaIlEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %80 = add nsw i64 %.01242, -1
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %79) #7
  %82 = load i64, ptr %81, align 8, !tbaa !5
  %83 = load i64, ptr %2, align 8, !tbaa !5
  %84 = icmp eq i64 %82, %83
  br i1 %84, label %115, label %87, !llvm.loop !12

85:                                               ; preds = %118, %._crit_edge45
  %86 = landingpad { ptr, i32 }
          cleanup
  br label %125

87:                                               ; preds = %.lr.ph44
  %88 = getelementptr inbounds %"class.std::vector", ptr %17, i64 %79
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  %89 = call ptr @_ZNSt6vectorIlSaIlEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %88) #7
  store ptr %89, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #7
  %90 = call ptr @_ZNSt6vectorIlSaIlEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %88) #7
  store ptr %90, ptr %11, align 8
  %91 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPlSt6vectorIlSaIlEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  br i1 %91, label %.lr.ph40, label %._crit_edge41

._crit_edge41:                                    ; preds = %112, %87
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  br label %115

.lr.ph40:                                         ; preds = %87, %112
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #7
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPlSt6vectorIlSaIlEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  %93 = load i64, ptr %92, align 8, !tbaa !5
  store i64 %93, ptr %12, align 8, !tbaa !5
  %94 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %93) #7
  %95 = load i64, ptr %94, align 8, !tbaa !5
  %96 = icmp eq i64 %95, 0
  br i1 %96, label %97, label %112

97:                                               ; preds = %.lr.ph40
  %98 = load i64, ptr %12, align 8, !tbaa !5
  %99 = getelementptr inbounds i64, ptr %26, i64 %98
  %100 = load i64, ptr %99, align 8, !tbaa !5
  %101 = add nsw i64 %100, -1
  store i64 %101, ptr %99, align 8, !tbaa !5
  %102 = icmp slt i64 %100, 3
  br i1 %102, label %103, label %112

103:                                              ; preds = %97
  invoke void @_ZNSt5queueIlSt5dequeIlSaIlEEE4pushERKl(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 8 dereferenceable(8) %12)
          to label %104 unwind label %110

104:                                              ; preds = %103
  %105 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %79) #7
  %106 = load i64, ptr %105, align 8, !tbaa !5
  %107 = add nsw i64 %106, 1
  %108 = load i64, ptr %12, align 8, !tbaa !5
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %108) #7
  store i64 %107, ptr %109, align 8, !tbaa !5
  br label %112

110:                                              ; preds = %103
  %111 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  br label %125

112:                                              ; preds = %97, %104, %.lr.ph40
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #7
  %113 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPlSt6vectorIlSaIlEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  %114 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPlSt6vectorIlSaIlEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  br i1 %114, label %.lr.ph40, label %._crit_edge41

115:                                              ; preds = %.lr.ph44, %._crit_edge41
  %116 = call noundef zeroext i1 @_ZNKSt5queueIlSt5dequeIlSaIlEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  br i1 %116, label %._crit_edge45, label %.lr.ph44

._crit_edge45:                                    ; preds = %115, %._crit_edge38
  %.012.lcssa = phi i64 [ %.lcssa, %._crit_edge38 ], [ %80, %115 ]
  %117 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.012.lcssa)
          to label %118 unwind label %85

118:                                              ; preds = %._crit_edge45
  %119 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %117, ptr noundef nonnull @.str)
          to label %120 unwind label %85

120:                                              ; preds = %118
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #7
  call void @_ZNSt5queueIlSt5dequeIlSaIlEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #7
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %5) #7
  br i1 %18, label %.loopexit30, label %.preheader29.preheader

.preheader29.preheader:                           ; preds = %120
  %121 = getelementptr inbounds %"class.std::vector", ptr %17, i64 %15
  br label %.preheader29

.preheader29:                                     ; preds = %.preheader29.preheader, %.preheader29
  %122 = phi ptr [ %123, %.preheader29 ], [ %121, %.preheader29.preheader ]
  %123 = getelementptr inbounds i8, ptr %122, i64 -24
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %123) #7
  %124 = icmp eq ptr %123, %17
  br i1 %124, label %.loopexit30, label %.preheader29

.loopexit30:                                      ; preds = %.preheader29, %120
  call void @llvm.stackrestore.p0(ptr %16)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  ret void

125:                                              ; preds = %85, %110, %71
  %.pn23 = phi { ptr, i32 } [ %72, %71 ], [ %111, %110 ], [ %86, %85 ]
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  br label %126

126:                                              ; preds = %125, %63
  %.pn23.pn = phi { ptr, i32 } [ %.pn23, %125 ], [ %64, %63 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #7
  call void @_ZNSt5queueIlSt5dequeIlSaIlEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #7
  br label %127

127:                                              ; preds = %126, %61
  %.pn23.pn.pn = phi { ptr, i32 } [ %.pn23.pn, %126 ], [ %62, %61 ]
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %5) #7
  br label %128

128:                                              ; preds = %127, %53
  %.pn27 = phi { ptr, i32 } [ %54, %53 ], [ %.pn23.pn.pn, %127 ]
  br i1 %18, label %.loopexit, label %.preheader.preheader

.preheader.preheader:                             ; preds = %128
  %129 = getelementptr inbounds %"class.std::vector", ptr %17, i64 %15
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.preheader
  %130 = phi ptr [ %131, %.preheader ], [ %129, %.preheader.preheader ]
  %131 = getelementptr inbounds i8, ptr %130, i64 -24
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %131) #7
  %132 = icmp eq ptr %131, %17
  br i1 %132, label %.loopexit, label %.preheader

.loopexit:                                        ; preds = %.preheader, %128
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  resume { ptr, i32 } %.pn27
}

; 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 uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

declare i32 @__gxx_personality_v0(...)

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

; 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 uwtable
declare dso_local void @_ZNSt5queueIlSt5dequeIlSaIlEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIlSaIlEEC2EmRKlRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueIlSt5dequeIlSaIlEEE4pushERKl(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5queueIlSt5dequeIlSaIlEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5queueIlSt5dequeIlSaIlEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIlSt5dequeIlSaIlEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #3 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPlSt6vectorIlSaIlEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPlSt6vectorIlSaIlEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPlSt6vectorIlSaIlEEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 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 #6

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIlSt5dequeIlSaIlEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #5 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 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 nocallback nofree nosync nounwind willreturn }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass