; LLVM IR from eyangch/competitive-programming :: Codeforces/1583 (e)

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

@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@Q = external dso_local global i64, align 8
@graph = external dso_local global [300000 x %"class.std::vector"], align 16
@tg = external dso_local global [300000 x %"class.std::vector"], align 16
@a = external dso_local global [300000 x i64], align 16
@b = external dso_local global [300000 x i64], align 16
@oc = external dso_local global [300000 x i64], align 16
@vis = external dso_local global [300000 x i8], align 16
@d = external dso_local global [300000 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsx(i64 noundef) #1

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4dfsdxxx(i64 noundef, i64 noundef, i64 noundef) #1

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

32:                                               ; preds = %50, %0
  %33 = load i64, ptr %2, align 8, !tbaa !8
  %34 = load i64, ptr @M, align 8, !tbaa !8
  %35 = icmp slt i64 %33, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  br label %53

37:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  %38 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %38, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %40 = load i64, ptr %3, align 8, !tbaa !8
  %41 = sub nsw i64 %40, 1
  %42 = getelementptr inbounds [300000 x %"class.std::vector"], ptr @graph, i64 0, i64 %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %43 = load i64, ptr %4, align 8, !tbaa !8
  %44 = sub nsw i64 %43, 1
  store i64 %44, ptr %5, align 8, !tbaa !8
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %42, ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  %45 = load i64, ptr %4, align 8, !tbaa !8
  %46 = sub nsw i64 %45, 1
  %47 = getelementptr inbounds [300000 x %"class.std::vector"], ptr @graph, i64 0, i64 %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %48 = load i64, ptr %3, align 8, !tbaa !8
  %49 = sub nsw i64 %48, 1
  store i64 %49, ptr %6, align 8, !tbaa !8
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %47, ptr noundef nonnull align 8 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  br label %50

50:                                               ; preds = %37
  %51 = load i64, ptr %2, align 8, !tbaa !8
  %52 = add nsw i64 %51, 1
  store i64 %52, ptr %2, align 8, !tbaa !8
  br label %32, !llvm.loop !11

53:                                               ; preds = %36
  %54 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @Q)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store i64 0, ptr %7, align 8, !tbaa !8
  br label %55

55:                                               ; preds = %87, %53
  %56 = load i64, ptr %7, align 8, !tbaa !8
  %57 = load i64, ptr @Q, align 8, !tbaa !8
  %58 = icmp slt i64 %56, %57
  br i1 %58, label %60, label %59

59:                                               ; preds = %55
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %90

60:                                               ; preds = %55
  %61 = load i64, ptr %7, align 8, !tbaa !8
  %62 = getelementptr inbounds [300000 x i64], ptr @a, i64 0, i64 %61
  %63 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %62)
  %64 = load i64, ptr %7, align 8, !tbaa !8
  %65 = getelementptr inbounds [300000 x i64], ptr @b, i64 0, i64 %64
  %66 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %63, ptr noundef nonnull align 8 dereferenceable(8) %65)
  %67 = load i64, ptr %7, align 8, !tbaa !8
  %68 = getelementptr inbounds [300000 x i64], ptr @a, i64 0, i64 %67
  %69 = load i64, ptr %68, align 8, !tbaa !8
  %70 = add nsw i64 %69, -1
  store i64 %70, ptr %68, align 8, !tbaa !8
  %71 = load i64, ptr %7, align 8, !tbaa !8
  %72 = getelementptr inbounds [300000 x i64], ptr @b, i64 0, i64 %71
  %73 = load i64, ptr %72, align 8, !tbaa !8
  %74 = add nsw i64 %73, -1
  store i64 %74, ptr %72, align 8, !tbaa !8
  %75 = load i64, ptr %7, align 8, !tbaa !8
  %76 = getelementptr inbounds [300000 x i64], ptr @a, i64 0, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !8
  %78 = getelementptr inbounds [300000 x i64], ptr @oc, i64 0, i64 %77
  %79 = load i64, ptr %78, align 8, !tbaa !8
  %80 = add nsw i64 %79, 1
  store i64 %80, ptr %78, align 8, !tbaa !8
  %81 = load i64, ptr %7, align 8, !tbaa !8
  %82 = getelementptr inbounds [300000 x i64], ptr @b, i64 0, i64 %81
  %83 = load i64, ptr %82, align 8, !tbaa !8
  %84 = getelementptr inbounds [300000 x i64], ptr @oc, i64 0, i64 %83
  %85 = load i64, ptr %84, align 8, !tbaa !8
  %86 = add nsw i64 %85, 1
  store i64 %86, ptr %84, align 8, !tbaa !8
  br label %87

87:                                               ; preds = %60
  %88 = load i64, ptr %7, align 8, !tbaa !8
  %89 = add nsw i64 %88, 1
  store i64 %89, ptr %7, align 8, !tbaa !8
  br label %55, !llvm.loop !13

90:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store i64 0, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store i64 0, ptr %9, align 8, !tbaa !8
  br label %91

91:                                               ; preds = %103, %90
  %92 = load i64, ptr %9, align 8, !tbaa !8
  %93 = load i64, ptr @N, align 8, !tbaa !8
  %94 = icmp slt i64 %92, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %91
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %106

96:                                               ; preds = %91
  %97 = load i64, ptr %9, align 8, !tbaa !8
  %98 = getelementptr inbounds [300000 x i64], ptr @oc, i64 0, i64 %97
  %99 = load i64, ptr %98, align 8, !tbaa !8
  %100 = srem i64 %99, 2
  %101 = load i64, ptr %8, align 8, !tbaa !8
  %102 = add nsw i64 %101, %100
  store i64 %102, ptr %8, align 8, !tbaa !8
  br label %103

103:                                              ; preds = %96
  %104 = load i64, ptr %9, align 8, !tbaa !8
  %105 = add nsw i64 %104, 1
  store i64 %105, ptr %9, align 8, !tbaa !8
  br label %91, !llvm.loop !14

106:                                              ; preds = %95
  %107 = load i64, ptr %8, align 8, !tbaa !8
  %108 = icmp ne i64 %107, 0
  br i1 %108, label %109, label %116

109:                                              ; preds = %106
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %111 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %110, i8 noundef signext 10)
  %112 = load i64, ptr %8, align 8, !tbaa !8
  %113 = sdiv i64 %112, 2
  %114 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %111, i64 noundef %113)
  %115 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %114, i8 noundef signext 10)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %10, align 4
  br label %209

116:                                              ; preds = %106
  %117 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.4)
  %118 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %117, i8 noundef signext 10)
  store i8 1, ptr @vis, align 16, !tbaa !15
  call void @_Z3dfsx(i64 noundef 0)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  store i64 0, ptr %11, align 8, !tbaa !8
  br label %119

119:                                              ; preds = %204, %116
  %120 = load i64, ptr %11, align 8, !tbaa !8
  %121 = load i64, ptr @Q, align 8, !tbaa !8
  %122 = icmp slt i64 %120, %121
  br i1 %122, label %124, label %123

123:                                              ; preds = %119
  store i32 11, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %208

124:                                              ; preds = %119
  %125 = load i64, ptr %11, align 8, !tbaa !8
  %126 = getelementptr inbounds [300000 x i64], ptr @b, i64 0, i64 %125
  %127 = load i64, ptr %126, align 8, !tbaa !8
  call void @_Z4dfsdxxx(i64 noundef %127, i64 noundef -1, i64 noundef 0)
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #7
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %128 = load i64, ptr %11, align 8, !tbaa !8
  %129 = getelementptr inbounds [300000 x i64], ptr @a, i64 0, i64 %128
  %130 = load i64, ptr %129, align 8, !tbaa !8
  store i64 %130, ptr %13, align 8, !tbaa !8
  invoke void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(8) %13)
          to label %131 unwind label %150

131:                                              ; preds = %124
  br label %132

132:                                              ; preds = %170, %131
  %133 = load i64, ptr %13, align 8, !tbaa !8
  %134 = load i64, ptr %11, align 8, !tbaa !8
  %135 = getelementptr inbounds [300000 x i64], ptr @b, i64 0, i64 %134
  %136 = load i64, ptr %135, align 8, !tbaa !8
  %137 = icmp ne i64 %133, %136
  br i1 %137, label %138, label %171

138:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %139 = load i64, ptr %13, align 8, !tbaa !8
  %140 = getelementptr inbounds [300000 x %"class.std::vector"], ptr @tg, i64 0, i64 %139
  store ptr %140, ptr %16, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %141 = load ptr, ptr %16, align 8, !tbaa !17
  %142 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %141) #7
  %143 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  store ptr %142, ptr %143, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %144 = load ptr, ptr %16, align 8, !tbaa !17
  %145 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %144) #7
  %146 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %18, i32 0, i32 0
  store ptr %145, ptr %146, align 8
  br label %147

147:                                              ; preds = %167, %138
  %148 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %18) #7
  br i1 %148, label %154, label %149

149:                                              ; preds = %147
  store i32 16, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %169

150:                                              ; preds = %201, %174, %171, %169, %124
  %151 = landingpad { ptr, i32 }
          cleanup
  %152 = extractvalue { ptr, i32 } %151, 0
  store ptr %152, ptr %14, align 8
  %153 = extractvalue { ptr, i32 } %151, 1
  store i32 %153, ptr %15, align 4
  br label %207

154:                                              ; preds = %147
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %155 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #7
  %156 = load i64, ptr %155, align 8, !tbaa !8
  store i64 %156, ptr %19, align 8, !tbaa !8
  %157 = load i64, ptr %19, align 8, !tbaa !8
  %158 = getelementptr inbounds [300000 x i64], ptr @d, i64 0, i64 %157
  %159 = load i64, ptr %158, align 8, !tbaa !8
  %160 = load i64, ptr %13, align 8, !tbaa !8
  %161 = getelementptr inbounds [300000 x i64], ptr @d, i64 0, i64 %160
  %162 = load i64, ptr %161, align 8, !tbaa !8
  %163 = icmp slt i64 %159, %162
  br i1 %163, label %164, label %166

164:                                              ; preds = %154
  %165 = load i64, ptr %19, align 8, !tbaa !8
  store i64 %165, ptr %13, align 8, !tbaa !8
  br label %166

166:                                              ; preds = %164, %154
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  br label %167

167:                                              ; preds = %166
  %168 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #7
  br label %147

169:                                              ; preds = %149
  invoke void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(8) %13)
          to label %170 unwind label %150

170:                                              ; preds = %169
  br label %132, !llvm.loop !19

171:                                              ; preds = %132
  %172 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  %173 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %172)
          to label %174 unwind label %150

174:                                              ; preds = %171
  %175 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %173, i8 noundef signext 10)
          to label %176 unwind label %150

176:                                              ; preds = %174
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  store ptr %12, ptr %20, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %177 = load ptr, ptr %20, align 8, !tbaa !17
  %178 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %177) #7
  %179 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %21, i32 0, i32 0
  store ptr %178, ptr %179, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %180 = load ptr, ptr %20, align 8, !tbaa !17
  %181 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %180) #7
  %182 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %22, i32 0, i32 0
  store ptr %181, ptr %182, align 8
  br label %183

183:                                              ; preds = %195, %176
  %184 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 8 dereferenceable(8) %22) #7
  br i1 %184, label %186, label %185

185:                                              ; preds = %183
  store i32 18, 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
  br label %201

186:                                              ; preds = %183
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %187 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  %188 = load i64, ptr %187, align 8, !tbaa !8
  store i64 %188, ptr %23, align 8, !tbaa !8
  %189 = load i64, ptr %23, align 8, !tbaa !8
  %190 = add nsw i64 %189, 1
  %191 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %190)
          to label %192 unwind label %197

192:                                              ; preds = %186
  %193 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %191, i8 noundef signext 32)
          to label %194 unwind label %197

194:                                              ; preds = %192
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  br label %195

195:                                              ; preds = %194
  %196 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  br label %183

197:                                              ; preds = %192, %186
  %198 = landingpad { ptr, i32 }
          cleanup
  %199 = extractvalue { ptr, i32 } %198, 0
  store ptr %199, ptr %14, align 8
  %200 = extractvalue { ptr, i32 } %198, 1
  store i32 %200, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  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
  br label %207

201:                                              ; preds = %185
  %202 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 10)
          to label %203 unwind label %150

203:                                              ; preds = %201
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #7
  br label %204

204:                                              ; preds = %203
  %205 = load i64, ptr %11, align 8, !tbaa !8
  %206 = add nsw i64 %205, 1
  store i64 %206, ptr %11, align 8, !tbaa !8
  br label %119, !llvm.loop !20

207:                                              ; preds = %197, %150
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %213

208:                                              ; preds = %123
  store i32 0, ptr %10, align 4
  br label %209

209:                                              ; preds = %208, %109
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  %210 = load i32, ptr %10, align 4
  switch i32 %210, label %218 [
    i32 0, label %211
    i32 1, label %211
  ]

211:                                              ; preds = %209, %209
  %212 = load i32, ptr %1, align 4
  ret i32 %212

213:                                              ; preds = %207
  %214 = load ptr, ptr %14, align 8
  %215 = load i32, ptr %15, align 4
  %216 = insertvalue { ptr, i32 } poison, ptr %214, 0
  %217 = insertvalue { ptr, i32 } %216, i32 %215, 1
  resume { ptr, i32 } %217

218:                                              ; preds = %209
  unreachable
}

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #6

; 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 @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #1 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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


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

@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@Q = external dso_local global i64, align 8
@graph = external dso_local global [300000 x %"class.std::vector"], align 16
@tg = external dso_local global [300000 x %"class.std::vector"], align 16
@a = external dso_local global [300000 x i64], align 16
@b = external dso_local global [300000 x i64], align 16
@oc = external dso_local local_unnamed_addr global [300000 x i64], align 16
@vis = external dso_local local_unnamed_addr global [300000 x i8], align 16
@d = external dso_local local_unnamed_addr global [300000 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsx(i64 noundef) local_unnamed_addr #1

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4dfsdxxx(i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 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::vector", align 8
  %6 = alloca i64, align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %11 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %13
  %15 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %14, ptr noundef null)
  %16 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %17 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %18 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %19 = load i64, ptr @M, align 8, !tbaa !8
  %20 = icmp sgt i64 %19, 0
  br i1 %20, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @Q)
  %22 = load i64, ptr @Q, align 8, !tbaa !8
  %23 = icmp sgt i64 %22, 0
  br i1 %23, label %.lr.ph44, label %.preheader40

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.03041 = phi i64 [ %36, %.lr.ph ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %26 = load i64, ptr %1, align 8, !tbaa !8
  %27 = add nsw i64 %26, -1
  %28 = getelementptr inbounds [300000 x %"class.std::vector"], ptr @graph, i64 0, i64 %27
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  %29 = load i64, ptr %2, align 8, !tbaa !8
  %30 = add nsw i64 %29, -1
  store i64 %30, ptr %3, align 8, !tbaa !8
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %28, ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  %31 = load i64, ptr %2, align 8, !tbaa !8
  %32 = add nsw i64 %31, -1
  %33 = getelementptr inbounds [300000 x %"class.std::vector"], ptr @graph, i64 0, i64 %32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %34 = load i64, ptr %1, align 8, !tbaa !8
  %35 = add nsw i64 %34, -1
  store i64 %35, ptr %4, align 8, !tbaa !8
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %33, ptr noundef nonnull align 8 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  %36 = add nuw nsw i64 %.03041, 1
  %37 = load i64, ptr @M, align 8, !tbaa !8
  %38 = icmp slt i64 %36, %37
  br i1 %38, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader40:                                     ; preds = %.lr.ph44, %._crit_edge
  %39 = load i64, ptr @N, align 8, !tbaa !8
  %40 = icmp sgt i64 %39, 0
  br i1 %40, label %.lr.ph47.preheader, label %._crit_edge48.thread

.lr.ph47.preheader:                               ; preds = %.preheader40
  %min.iters.check = icmp ult i64 %39, 4
  br i1 %min.iters.check, label %.lr.ph47.preheader62, label %vector.ph

.lr.ph47.preheader62:                             ; preds = %middle.block, %.lr.ph47.preheader
  %.03246.ph = phi i64 [ 0, %.lr.ph47.preheader ], [ %48, %middle.block ]
  %.03645.ph = phi i64 [ 0, %.lr.ph47.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph47

vector.ph:                                        ; preds = %.lr.ph47.preheader
  %n.vec = and i64 %39, 9223372036854775804
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %45, %vector.body ]
  %vec.phi60 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %46, %vector.body ]
  %41 = getelementptr inbounds [300000 x i64], ptr @oc, i64 0, i64 %index
  %42 = getelementptr inbounds i8, ptr %41, i64 16
  %wide.load = load <2 x i64>, ptr %41, align 16, !tbaa !8
  %wide.load61 = load <2 x i64>, ptr %42, align 16, !tbaa !8
  %43 = srem <2 x i64> %wide.load, <i64 2, i64 2>
  %44 = srem <2 x i64> %wide.load61, <i64 2, i64 2>
  %45 = add <2 x i64> %43, %vec.phi
  %46 = add <2 x i64> %44, %vec.phi60
  %index.next = add nuw i64 %index, 4
  %47 = icmp eq i64 %index.next, %n.vec
  br i1 %47, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %46, %45
  %48 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %39, %n.vec
  br i1 %cmp.n, label %._crit_edge48, label %.lr.ph47.preheader62

.lr.ph44:                                         ; preds = %._crit_edge, %.lr.ph44
  %.03142 = phi i64 [ %63, %.lr.ph44 ], [ 0, %._crit_edge ]
  %49 = getelementptr inbounds [300000 x i64], ptr @a, i64 0, i64 %.03142
  %50 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %49)
  %51 = getelementptr inbounds [300000 x i64], ptr @b, i64 0, i64 %.03142
  %52 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %50, ptr noundef nonnull align 8 dereferenceable(8) %51)
  %53 = load i64, ptr %49, align 8, !tbaa !8
  %54 = add nsw i64 %53, -1
  store i64 %54, ptr %49, align 8, !tbaa !8
  %55 = load i64, ptr %51, align 8, !tbaa !8
  %56 = add nsw i64 %55, -1
  store i64 %56, ptr %51, align 8, !tbaa !8
  %57 = getelementptr inbounds [300000 x i64], ptr @oc, i64 0, i64 %54
  %58 = load i64, ptr %57, align 8, !tbaa !8
  %59 = add nsw i64 %58, 1
  store i64 %59, ptr %57, align 8, !tbaa !8
  %60 = getelementptr inbounds [300000 x i64], ptr @oc, i64 0, i64 %56
  %61 = load i64, ptr %60, align 8, !tbaa !8
  %62 = add nsw i64 %61, 1
  store i64 %62, ptr %60, align 8, !tbaa !8
  %63 = add nuw nsw i64 %.03142, 1
  %64 = load i64, ptr @Q, align 8, !tbaa !8
  %65 = icmp slt i64 %63, %64
  br i1 %65, label %.lr.ph44, label %.preheader40, !llvm.loop !16

._crit_edge48:                                    ; preds = %.lr.ph47, %middle.block
  %.lcssa = phi i64 [ %48, %middle.block ], [ %69, %.lr.ph47 ]
  %.not = icmp eq i64 %.lcssa, 0
  br i1 %.not, label %._crit_edge48.thread, label %71

.lr.ph47:                                         ; preds = %.lr.ph47.preheader62, %.lr.ph47
  %.03246 = phi i64 [ %69, %.lr.ph47 ], [ %.03246.ph, %.lr.ph47.preheader62 ]
  %.03645 = phi i64 [ %70, %.lr.ph47 ], [ %.03645.ph, %.lr.ph47.preheader62 ]
  %66 = getelementptr inbounds [300000 x i64], ptr @oc, i64 0, i64 %.03645
  %67 = load i64, ptr %66, align 8, !tbaa !8
  %68 = srem i64 %67, 2
  %69 = add nsw i64 %68, %.03246
  %70 = add nuw nsw i64 %.03645, 1
  %exitcond.not = icmp eq i64 %70, %39
  br i1 %exitcond.not, label %._crit_edge48, label %.lr.ph47, !llvm.loop !17

71:                                               ; preds = %._crit_edge48
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %72, i8 noundef signext 10)
  %74 = sdiv i64 %.lcssa, 2
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %73, i64 noundef %74)
  %76 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %75, i8 noundef signext 10)
  br label %.loopexit39

._crit_edge48.thread:                             ; preds = %.preheader40, %._crit_edge48
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.4)
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %77, i8 noundef signext 10)
  store i8 1, ptr @vis, align 16, !tbaa !18
  call void @_Z3dfsx(i64 noundef 0)
  %79 = load i64, ptr @Q, align 8, !tbaa !8
  %80 = icmp sgt i64 %79, 0
  br i1 %80, label %.lr.ph57, label %.loopexit39

.lr.ph57:                                         ; preds = %._crit_edge48.thread, %125
  %.03555 = phi i64 [ %126, %125 ], [ 0, %._crit_edge48.thread ]
  %81 = getelementptr inbounds [300000 x i64], ptr @b, i64 0, i64 %.03555
  %82 = load i64, ptr %81, align 8, !tbaa !8
  call void @_Z4dfsdxxx(i64 noundef %82, i64 noundef -1, i64 noundef 0)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #8
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  %83 = getelementptr inbounds [300000 x i64], ptr @a, i64 0, i64 %.03555
  %84 = load i64, ptr %83, align 8, !tbaa !8
  store i64 %84, ptr %6, align 8, !tbaa !8
  invoke void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %.preheader unwind label %.loopexit.split-lp

.preheader:                                       ; preds = %.lr.ph57, %._crit_edge51
  %85 = load i64, ptr %6, align 8, !tbaa !8
  %86 = load i64, ptr %81, align 8, !tbaa !8
  %.not37 = icmp eq i64 %85, %86
  br i1 %.not37, label %104, label %87

87:                                               ; preds = %.preheader
  %88 = getelementptr inbounds [300000 x %"class.std::vector"], ptr @tg, i64 0, i64 %85
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %89 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %88) #8
  store ptr %89, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  %90 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %88) #8
  store ptr %90, ptr %8, align 8
  %91 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  br i1 %91, label %.lr.ph50, label %._crit_edge51

._crit_edge51:                                    ; preds = %101, %87
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  invoke void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %.preheader unwind label %.loopexit, !llvm.loop !20

.loopexit:                                        ; preds = %._crit_edge51
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %129

.loopexit.split-lp:                               ; preds = %.lr.ph57, %104, %107, %._crit_edge54
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %129

.lr.ph50:                                         ; preds = %87, %101
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  %93 = load i64, ptr %92, align 8, !tbaa !8
  %94 = getelementptr inbounds [300000 x i64], ptr @d, i64 0, i64 %93
  %95 = load i64, ptr %94, align 8, !tbaa !8
  %96 = load i64, ptr %6, align 8, !tbaa !8
  %97 = getelementptr inbounds [300000 x i64], ptr @d, i64 0, i64 %96
  %98 = load i64, ptr %97, align 8, !tbaa !8
  %99 = icmp slt i64 %95, %98
  br i1 %99, label %100, label %101

100:                                              ; preds = %.lr.ph50
  store i64 %93, ptr %6, align 8, !tbaa !8
  br label %101

101:                                              ; preds = %100, %.lr.ph50
  %102 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  %103 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  br i1 %103, label %.lr.ph50, label %._crit_edge51

104:                                              ; preds = %.preheader
  %105 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #8
  %106 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %105)
          to label %107 unwind label %.loopexit.split-lp

107:                                              ; preds = %104
  %108 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %106, i8 noundef signext 10)
          to label %109 unwind label %.loopexit.split-lp

109:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  %110 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #8
  store ptr %110, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #8
  %111 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #8
  store ptr %111, ptr %10, align 8
  %112 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #8
  br i1 %112, label %.lr.ph53, label %._crit_edge54

._crit_edge54:                                    ; preds = %120, %109
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  %113 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 10)
          to label %125 unwind label %.loopexit.split-lp

.lr.ph53:                                         ; preds = %109, %120
  %114 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  %115 = load i64, ptr %114, align 8, !tbaa !8
  %116 = add nsw i64 %115, 1
  %117 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %116)
          to label %118 unwind label %123

118:                                              ; preds = %.lr.ph53
  %119 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %117, i8 noundef signext 32)
          to label %120 unwind label %123

120:                                              ; preds = %118
  %121 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  %122 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #8
  br i1 %122, label %.lr.ph53, label %._crit_edge54

123:                                              ; preds = %118, %.lr.ph53
  %124 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  br label %129

125:                                              ; preds = %._crit_edge54
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #8
  %126 = add nuw nsw i64 %.03555, 1
  %127 = load i64, ptr @Q, align 8, !tbaa !8
  %128 = icmp slt i64 %126, %127
  br i1 %128, label %.lr.ph57, label %.loopexit39, !llvm.loop !21

129:                                              ; preds = %.loopexit, %.loopexit.split-lp, %123
  %.pn = phi { ptr, i32 } [ %124, %123 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #8
  resume { ptr, i32 } %.pn

.loopexit39:                                      ; preds = %125, %._crit_edge48.thread, %71
  ret i32 0
}

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #6

; 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 @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #7

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }

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

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


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