; LLVM IR from eyangch/competitive-programming :: DMOJ/DMOPC22nov (4_subtask1)

; 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 }
%"struct.std::pair" = type { i64, i64 }
%struct.DSU = type { [300000 x i64], [300000 x i64] }
%"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 }

@MOD = external dso_local global i64, align 8
@f = external dso_local global [300001 x i64], align 16
@fi = external dso_local global [300001 x i64], align 16
@N = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@A = external dso_local global [300000 x i64], align 16
@G = external dso_local global [300000 x %"class.std::vector"], align 16
@E = external dso_local global [300000 x %"struct.std::pair"], align 16
@dsu = external dso_local global %struct.DSU, align 8
@bc = external dso_local global %"class.std::vector", align 8
@bcp = external dso_local global %"class.std::vector", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3invx(i64 noundef) #0

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6dfs_bcxxx(i64 noundef, i64 noundef, i64 noundef) #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)) #2 align 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 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 { i64, i64 } @_Z3dfsxx(i64 noundef, i64 noundef) #2

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

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

; 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 %"struct.std::pair", align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca %"class.std::vector", align 8
  %18 = alloca i64, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %23 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %24 = alloca i64, align 8
  %25 = alloca i64, align 8
  %26 = alloca i64, align 8
  %27 = alloca i64, align 8
  %28 = alloca %"struct.std::pair", align 8
  %29 = alloca i64, align 8
  %30 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %31 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %32 = getelementptr i8, ptr %31, i64 -24
  %33 = load i64, ptr %32, align 8
  %34 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %33
  %35 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %34, ptr noundef null)
  %36 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %37 = 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)
  %38 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %37, ptr noundef nonnull align 8 dereferenceable(8) @K)
  store i64 1, ptr @f, align 16, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store i64 1, ptr %2, align 8, !tbaa !8
  br label %39

39:                                               ; preds = %55, %0
  %40 = load i64, ptr %2, align 8, !tbaa !8
  %41 = load i64, ptr @N, align 8, !tbaa !8
  %42 = icmp sle i64 %40, %41
  br i1 %42, label %44, label %43

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

44:                                               ; preds = %39
  %45 = load i64, ptr %2, align 8, !tbaa !8
  %46 = sub nsw i64 %45, 1
  %47 = getelementptr inbounds [300001 x i64], ptr @f, i64 0, i64 %46
  %48 = load i64, ptr %47, align 8, !tbaa !8
  %49 = load i64, ptr %2, align 8, !tbaa !8
  %50 = mul nsw i64 %48, %49
  %51 = load i64, ptr @MOD, align 8, !tbaa !8
  %52 = srem i64 %50, %51
  %53 = load i64, ptr %2, align 8, !tbaa !8
  %54 = getelementptr inbounds [300001 x i64], ptr @f, i64 0, i64 %53
  store i64 %52, ptr %54, align 8, !tbaa !8
  br label %55

55:                                               ; preds = %44
  %56 = load i64, ptr %2, align 8, !tbaa !8
  %57 = add nsw i64 %56, 1
  store i64 %57, ptr %2, align 8, !tbaa !8
  br label %39, !llvm.loop !11

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

59:                                               ; preds = %71, %58
  %60 = load i64, ptr %3, align 8, !tbaa !8
  %61 = load i64, ptr @N, align 8, !tbaa !8
  %62 = icmp sle i64 %60, %61
  br i1 %62, label %64, label %63

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

64:                                               ; preds = %59
  %65 = load i64, ptr %3, align 8, !tbaa !8
  %66 = getelementptr inbounds [300001 x i64], ptr @f, i64 0, i64 %65
  %67 = load i64, ptr %66, align 8, !tbaa !8
  %68 = call noundef i64 @_Z3invx(i64 noundef %67)
  %69 = load i64, ptr %3, align 8, !tbaa !8
  %70 = getelementptr inbounds [300001 x i64], ptr @fi, i64 0, i64 %69
  store i64 %68, ptr %70, align 8, !tbaa !8
  br label %71

71:                                               ; preds = %64
  %72 = load i64, ptr %3, align 8, !tbaa !8
  %73 = add nsw i64 %72, 1
  store i64 %73, ptr %3, align 8, !tbaa !8
  br label %59, !llvm.loop !13

74:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  store i64 0, ptr %4, align 8, !tbaa !8
  br label %75

75:                                               ; preds = %88, %74
  %76 = load i64, ptr %4, align 8, !tbaa !8
  %77 = load i64, ptr @N, align 8, !tbaa !8
  %78 = icmp slt i64 %76, %77
  br i1 %78, label %80, label %79

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

80:                                               ; preds = %75
  %81 = load i64, ptr %4, align 8, !tbaa !8
  %82 = getelementptr inbounds [300000 x i64], ptr @A, i64 0, i64 %81
  %83 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %82)
  %84 = load i64, ptr %4, align 8, !tbaa !8
  %85 = getelementptr inbounds [300000 x i64], ptr @A, i64 0, i64 %84
  %86 = load i64, ptr %85, align 8, !tbaa !8
  %87 = add nsw i64 %86, -1
  store i64 %87, ptr %85, align 8, !tbaa !8
  br label %88

88:                                               ; preds = %80
  %89 = load i64, ptr %4, align 8, !tbaa !8
  %90 = add nsw i64 %89, 1
  store i64 %90, ptr %4, align 8, !tbaa !8
  br label %75, !llvm.loop !14

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

92:                                               ; preds = %112, %91
  %93 = load i64, ptr %5, align 8, !tbaa !8
  %94 = load i64, ptr @N, align 8, !tbaa !8
  %95 = sub nsw i64 %94, 1
  %96 = icmp slt i64 %93, %95
  br i1 %96, label %98, label %97

97:                                               ; preds = %92
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  br label %115

98:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %99 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %100 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %99, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %101 = load i64, ptr %6, align 8, !tbaa !8
  %102 = add nsw i64 %101, -1
  store i64 %102, ptr %6, align 8, !tbaa !8
  %103 = load i64, ptr %7, align 8, !tbaa !8
  %104 = add nsw i64 %103, -1
  store i64 %104, ptr %7, align 8, !tbaa !8
  %105 = load i64, ptr %6, align 8, !tbaa !8
  %106 = getelementptr inbounds [300000 x %"class.std::vector"], ptr @G, i64 0, i64 %105
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %106, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %107 = load i64, ptr %7, align 8, !tbaa !8
  %108 = getelementptr inbounds [300000 x %"class.std::vector"], ptr @G, i64 0, i64 %107
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %108, ptr noundef nonnull align 8 dereferenceable(8) %6)
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #7
  call void @_ZNSt4pairIxxEC2IRxS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %109 = load i64, ptr %5, align 8, !tbaa !8
  %110 = getelementptr inbounds [300000 x %"struct.std::pair"], ptr @E, i64 0, i64 %109
  %111 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %110, ptr noundef nonnull align 8 dereferenceable(16) %8) #7
  call void @llvm.lifetime.end.p0(i64 16, 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 %112

112:                                              ; preds = %98
  %113 = load i64, ptr %5, align 8, !tbaa !8
  %114 = add nsw i64 %113, 1
  store i64 %114, ptr %5, align 8, !tbaa !8
  br label %92, !llvm.loop !15

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

116:                                              ; preds = %300, %115
  %117 = load i64, ptr %9, align 8, !tbaa !8
  %118 = load i64, ptr @K, align 8, !tbaa !8
  %119 = icmp slt i64 %117, %118
  br i1 %119, label %121, label %120

120:                                              ; preds = %116
  store i32 14, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %308

121:                                              ; preds = %116
  %122 = load i64, ptr @N, align 8, !tbaa !8
  call void @_ZN3DSU4initEx(ptr noundef nonnull align 8 dereferenceable(4800000) @dsu, i64 noundef %122)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  store i64 0, ptr %11, align 8, !tbaa !8
  br label %123

123:                                              ; preds = %156, %121
  %124 = load i64, ptr %11, align 8, !tbaa !8
  %125 = load i64, ptr @N, align 8, !tbaa !8
  %126 = sub nsw i64 %125, 1
  %127 = icmp slt i64 %124, %126
  br i1 %127, label %129, label %128

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

129:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %130 = load i64, ptr %11, align 8, !tbaa !8
  %131 = getelementptr inbounds [300000 x %"struct.std::pair"], ptr @E, i64 0, i64 %130
  %132 = getelementptr inbounds %"struct.std::pair", ptr %131, i32 0, i32 0
  %133 = load i64, ptr %132, align 16, !tbaa !16
  store i64 %133, ptr %12, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %134 = load i64, ptr %11, align 8, !tbaa !8
  %135 = getelementptr inbounds [300000 x %"struct.std::pair"], ptr @E, i64 0, i64 %134
  %136 = getelementptr inbounds %"struct.std::pair", ptr %135, i32 0, i32 1
  %137 = load i64, ptr %136, align 8, !tbaa !18
  store i64 %137, ptr %13, align 8, !tbaa !8
  %138 = load i64, ptr %12, align 8, !tbaa !8
  %139 = getelementptr inbounds [300000 x i64], ptr @A, i64 0, i64 %138
  %140 = load i64, ptr %139, align 8, !tbaa !8
  %141 = load i64, ptr %9, align 8, !tbaa !8
  %142 = icmp eq i64 %140, %141
  br i1 %142, label %149, label %143

143:                                              ; preds = %129
  %144 = load i64, ptr %13, align 8, !tbaa !8
  %145 = getelementptr inbounds [300000 x i64], ptr @A, i64 0, i64 %144
  %146 = load i64, ptr %145, align 8, !tbaa !8
  %147 = load i64, ptr %9, align 8, !tbaa !8
  %148 = icmp eq i64 %146, %147
  br i1 %148, label %149, label %150

149:                                              ; preds = %143, %129
  store i32 19, ptr %10, align 4
  br label %153

150:                                              ; preds = %143
  %151 = load i64, ptr %12, align 8, !tbaa !8
  %152 = load i64, ptr %13, align 8, !tbaa !8
  call void @_ZN3DSU2unExx(ptr noundef nonnull align 8 dereferenceable(4800000) @dsu, i64 noundef %151, i64 noundef %152)
  store i32 0, ptr %10, align 4
  br label %153

153:                                              ; preds = %150, %149
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  %154 = load i32, ptr %10, align 4
  switch i32 %154, label %315 [
    i32 0, label %155
    i32 19, label %156
  ]

155:                                              ; preds = %153
  br label %156

156:                                              ; preds = %155, %153
  %157 = load i64, ptr %11, align 8, !tbaa !8
  %158 = add nsw i64 %157, 1
  store i64 %158, ptr %11, align 8, !tbaa !8
  br label %123, !llvm.loop !19

159:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  store i64 0, ptr %14, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  store i64 0, ptr %15, align 8, !tbaa !8
  br label %160

160:                                              ; preds = %182, %159
  %161 = load i64, ptr %15, align 8, !tbaa !8
  %162 = load i64, ptr @N, align 8, !tbaa !8
  %163 = icmp slt i64 %161, %162
  br i1 %163, label %165, label %164

164:                                              ; preds = %160
  store i32 20, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  br label %185

165:                                              ; preds = %160
  %166 = load i64, ptr %15, align 8, !tbaa !8
  %167 = getelementptr inbounds [300000 x i64], ptr @A, i64 0, i64 %166
  %168 = load i64, ptr %167, align 8, !tbaa !8
  %169 = load i64, ptr %9, align 8, !tbaa !8
  %170 = icmp ne i64 %168, %169
  br i1 %170, label %171, label %181

171:                                              ; preds = %165
  %172 = load i64, ptr %15, align 8, !tbaa !8
  %173 = getelementptr inbounds [300000 x i64], ptr getelementptr inbounds (%struct.DSU, ptr @dsu, i32 0, i32 1), i64 0, i64 %172
  %174 = load i64, ptr %173, align 8, !tbaa !8
  %175 = load i64, ptr %14, align 8, !tbaa !8
  %176 = icmp sgt i64 %174, %175
  br i1 %176, label %177, label %181

177:                                              ; preds = %171
  %178 = load i64, ptr %15, align 8, !tbaa !8
  %179 = getelementptr inbounds [300000 x i64], ptr getelementptr inbounds (%struct.DSU, ptr @dsu, i32 0, i32 1), i64 0, i64 %178
  %180 = load i64, ptr %179, align 8, !tbaa !8
  store i64 %180, ptr %14, align 8, !tbaa !8
  br label %181

181:                                              ; preds = %177, %171, %165
  br label %182

182:                                              ; preds = %181
  %183 = load i64, ptr %15, align 8, !tbaa !8
  %184 = add nsw i64 %183, 1
  store i64 %184, ptr %15, align 8, !tbaa !8
  br label %160, !llvm.loop !20

185:                                              ; preds = %164
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  store i64 0, ptr %16, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #7
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  store i64 0, ptr %18, align 8, !tbaa !8
  br label %186

186:                                              ; preds = %210, %185
  %187 = load i64, ptr %18, align 8, !tbaa !8
  %188 = load i64, ptr @N, align 8, !tbaa !8
  %189 = icmp slt i64 %187, %188
  br i1 %189, label %191, label %190

190:                                              ; preds = %186
  store i32 23, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %213

191:                                              ; preds = %186
  %192 = load i64, ptr %18, align 8, !tbaa !8
  %193 = getelementptr inbounds [300000 x i64], ptr @A, i64 0, i64 %192
  %194 = load i64, ptr %193, align 8, !tbaa !8
  %195 = load i64, ptr %9, align 8, !tbaa !8
  %196 = icmp ne i64 %194, %195
  br i1 %196, label %197, label %209

197:                                              ; preds = %191
  %198 = load i64, ptr %18, align 8, !tbaa !8
  %199 = getelementptr inbounds [300000 x i64], ptr getelementptr inbounds (%struct.DSU, ptr @dsu, i32 0, i32 1), i64 0, i64 %198
  %200 = load i64, ptr %199, align 8, !tbaa !8
  %201 = load i64, ptr %14, align 8, !tbaa !8
  %202 = icmp eq i64 %200, %201
  br i1 %202, label %203, label %209

203:                                              ; preds = %197
  invoke void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(8) %18)
          to label %204 unwind label %205

204:                                              ; preds = %203
  br label %209

205:                                              ; preds = %203
  %206 = landingpad { ptr, i32 }
          cleanup
  %207 = extractvalue { ptr, i32 } %206, 0
  store ptr %207, ptr %19, align 8
  %208 = extractvalue { ptr, i32 } %206, 1
  store i32 %208, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %307

209:                                              ; preds = %204, %197, %191
  br label %210

210:                                              ; preds = %209
  %211 = load i64, ptr %18, align 8, !tbaa !8
  %212 = add nsw i64 %211, 1
  store i64 %212, ptr %18, align 8, !tbaa !8
  br label %186, !llvm.loop !21

213:                                              ; preds = %190
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  store ptr %17, ptr %21, align 8, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %214 = load ptr, ptr %21, align 8, !tbaa !22
  %215 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %214) #7
  %216 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %22, i32 0, i32 0
  store ptr %215, ptr %216, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %217 = load ptr, ptr %21, align 8, !tbaa !22
  %218 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %217) #7
  %219 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %23, i32 0, i32 0
  store ptr %218, ptr %219, align 8
  br label %220

220:                                              ; preds = %289, %213
  %221 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef nonnull align 8 dereferenceable(8) %23) #7
  br i1 %221, label %223, label %222

222:                                              ; preds = %220
  store i32 26, ptr %10, 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
  br label %292

223:                                              ; preds = %220
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %224 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %22) #7
  %225 = load i64, ptr %224, align 8, !tbaa !8
  store i64 %225, ptr %24, align 8, !tbaa !8
  call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @bc) #7
  call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @bcp) #7
  %226 = load i64, ptr %24, align 8, !tbaa !8
  %227 = load i64, ptr %9, align 8, !tbaa !8
  invoke void @_Z6dfs_bcxxx(i64 noundef %226, i64 noundef -1, i64 noundef %227)
          to label %228 unwind label %232

228:                                              ; preds = %223
  %229 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @bc) #7
  %230 = icmp eq i64 %229, 0
  br i1 %230, label %231, label %236

231:                                              ; preds = %228
  store i32 27, ptr %10, align 4
  br label %286

232:                                              ; preds = %223
  %233 = landingpad { ptr, i32 }
          cleanup
  %234 = extractvalue { ptr, i32 } %233, 0
  store ptr %234, ptr %19, align 8
  %235 = extractvalue { ptr, i32 } %233, 1
  store i32 %235, ptr %20, align 4
  br label %291

236:                                              ; preds = %228
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  store i64 1, ptr %25, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #7
  store i64 0, ptr %26, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #7
  store i64 0, ptr %27, align 8, !tbaa !8
  br label %237

237:                                              ; preds = %275, %236
  %238 = load i64, ptr %27, align 8, !tbaa !8
  %239 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @bc) #7
  %240 = icmp ult i64 %238, %239
  br i1 %240, label %242, label %241

241:                                              ; preds = %237
  store i32 28, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #7
  br label %282

242:                                              ; preds = %237
  call void @llvm.lifetime.start.p0(i64 16, ptr %28) #7
  %243 = load i64, ptr %27, align 8, !tbaa !8
  %244 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @bc, i64 noundef %243) #7
  %245 = load i64, ptr %244, align 8, !tbaa !8
  %246 = load i64, ptr %27, align 8, !tbaa !8
  %247 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @bcp, i64 noundef %246) #7
  %248 = load i64, ptr %247, align 8, !tbaa !8
  %249 = invoke { i64, i64 } @_Z3dfsxx(i64 noundef %245, i64 noundef %248)
          to label %250 unwind label %278

250:                                              ; preds = %242
  %251 = getelementptr inbounds { i64, i64 }, ptr %28, i32 0, i32 0
  %252 = extractvalue { i64, i64 } %249, 0
  store i64 %252, ptr %251, align 8
  %253 = getelementptr inbounds { i64, i64 }, ptr %28, i32 0, i32 1
  %254 = extractvalue { i64, i64 } %249, 1
  store i64 %254, ptr %253, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #7
  %255 = getelementptr inbounds %"struct.std::pair", ptr %28, i32 0, i32 0
  %256 = load i64, ptr %255, align 8, !tbaa !16
  store i64 %256, ptr %29, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #7
  %257 = getelementptr inbounds %"struct.std::pair", ptr %28, i32 0, i32 1
  %258 = load i64, ptr %257, align 8, !tbaa !18
  store i64 %258, ptr %30, align 8, !tbaa !8
  %259 = load i64, ptr %25, align 8, !tbaa !8
  %260 = load i64, ptr %29, align 8, !tbaa !8
  %261 = mul nsw i64 %259, %260
  %262 = load i64, ptr @MOD, align 8, !tbaa !8
  %263 = srem i64 %261, %262
  %264 = load i64, ptr %26, align 8, !tbaa !8
  %265 = load i64, ptr %30, align 8, !tbaa !8
  %266 = add nsw i64 %264, %265
  %267 = load i64, ptr %26, align 8, !tbaa !8
  %268 = call noundef i64 @_Z3nCrxx(i64 noundef %266, i64 noundef %267)
  %269 = mul nsw i64 %263, %268
  %270 = load i64, ptr @MOD, align 8, !tbaa !8
  %271 = srem i64 %269, %270
  store i64 %271, ptr %25, align 8, !tbaa !8
  %272 = load i64, ptr %30, align 8, !tbaa !8
  %273 = load i64, ptr %26, align 8, !tbaa !8
  %274 = add nsw i64 %273, %272
  store i64 %274, ptr %26, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %28) #7
  br label %275

275:                                              ; preds = %250
  %276 = load i64, ptr %27, align 8, !tbaa !8
  %277 = add nsw i64 %276, 1
  store i64 %277, ptr %27, align 8, !tbaa !8
  br label %237, !llvm.loop !24

278:                                              ; preds = %242
  %279 = landingpad { ptr, i32 }
          cleanup
  %280 = extractvalue { ptr, i32 } %279, 0
  store ptr %280, ptr %19, align 8
  %281 = extractvalue { ptr, i32 } %279, 1
  store i32 %281, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %28) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  br label %291

282:                                              ; preds = %241
  %283 = load i64, ptr %25, align 8, !tbaa !8
  %284 = load i64, ptr %16, align 8, !tbaa !8
  %285 = add nsw i64 %284, %283
  store i64 %285, ptr %16, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  store i32 0, ptr %10, align 4
  br label %286

286:                                              ; preds = %282, %231
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  %287 = load i32, ptr %10, align 4
  switch i32 %287, label %315 [
    i32 0, label %288
    i32 27, label %289
  ]

288:                                              ; preds = %286
  br label %289

289:                                              ; preds = %288, %286
  %290 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %22) #7
  br label %220

291:                                              ; preds = %278, %232
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  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
  br label %307

292:                                              ; preds = %222
  %293 = load i64, ptr %16, align 8, !tbaa !8
  %294 = load i64, ptr @MOD, align 8, !tbaa !8
  %295 = srem i64 %293, %294
  %296 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %295)
          to label %297 unwind label %303

297:                                              ; preds = %292
  %298 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %296, i8 noundef signext 10)
          to label %299 unwind label %303

299:                                              ; preds = %297
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %300

300:                                              ; preds = %299
  %301 = load i64, ptr %9, align 8, !tbaa !8
  %302 = add nsw i64 %301, 1
  store i64 %302, ptr %9, align 8, !tbaa !8
  br label %116, !llvm.loop !25

303:                                              ; preds = %297, %292
  %304 = landingpad { ptr, i32 }
          cleanup
  %305 = extractvalue { ptr, i32 } %304, 0
  store ptr %305, ptr %19, align 8
  %306 = extractvalue { ptr, i32 } %304, 1
  store i32 %306, ptr %20, align 4
  br label %307

307:                                              ; preds = %303, %291, %205
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %310

308:                                              ; preds = %120
  %309 = load i32, ptr %1, align 4
  ret i32 %309

310:                                              ; preds = %307
  %311 = load ptr, ptr %19, align 8
  %312 = load i32, ptr %20, align 4
  %313 = insertvalue { ptr, i32 } poison, ptr %311, 0
  %314 = insertvalue { ptr, i32 } %313, i32 %312, 1
  resume { ptr, i32 } %314

315:                                              ; preds = %286, %153
  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)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3DSU4initEx(ptr noundef nonnull align 8 dereferenceable(4800000), i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3DSU2unExx(ptr noundef nonnull align 8 dereferenceable(4800000), i64 noundef, i64 noundef) #2 align 2

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0 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: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #2 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = distinct !{!15, !12}
!16 = !{!17, !9, i64 0}
!17 = !{!"_ZTSSt4pairIxxE", !9, i64 0, !9, i64 8}
!18 = !{!17, !9, i64 8}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = !{!23, !23, i64 0}
!23 = !{!"any pointer", !10, i64 0}
!24 = distinct !{!24, !12}
!25 = distinct !{!25, !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 }
%"struct.std::pair" = type { i64, i64 }
%struct.DSU = type { [300000 x i64], [300000 x i64] }
%"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 }

@MOD = external dso_local local_unnamed_addr global i64, align 8
@f = external dso_local local_unnamed_addr global [300001 x i64], align 16
@fi = external dso_local local_unnamed_addr global [300001 x i64], align 16
@N = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@A = external dso_local global [300000 x i64], align 16
@G = external dso_local global [300000 x %"class.std::vector"], align 16
@E = external dso_local global [300000 x %"struct.std::pair"], align 16
@dsu = external dso_local global %struct.DSU, align 8
@bc = external dso_local global %"class.std::vector", align 8
@bcp = external dso_local global %"class.std::vector", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3invx(i64 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6dfs_bcxxx(i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #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 #2 align 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 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 { i64, i64 } @_Z3dfsxx(i64 noundef, i64 noundef) local_unnamed_addr #2

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

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

; 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 %"struct.std::pair", align 8
  %4 = alloca %"class.std::vector", align 8
  %5 = alloca i64, align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %9 = getelementptr i8, ptr %8, i64 -24
  %10 = load i64, ptr %9, align 8
  %11 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %10
  %12 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %11, ptr noundef null)
  %13 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %14 = 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)
  %15 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(8) @K)
  store i64 1, ptr @f, align 16, !tbaa !8
  %16 = load i64, ptr @N, align 8, !tbaa !8
  %.not89 = icmp slt i64 %16, 1
  br i1 %.not89, label %.preheader85, label %.lr.ph

.lr.ph:                                           ; preds = %0
  %17 = load i64, ptr @MOD, align 8, !tbaa !8
  %xtraiter = and i64 %16, 1
  %18 = icmp eq i64 %16, 1
  br i1 %18, label %.preheader85.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %16, 9223372036854775806
  br label %22

.preheader85.loopexit.unr-lcssa:                  ; preds = %22, %.lr.ph
  %.unr = phi i64 [ 1, %.lr.ph ], [ %29, %22 ]
  %.090.unr = phi i64 [ 1, %.lr.ph ], [ %31, %22 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader85, label %.preheader85.loopexit.epilog-lcssa

.preheader85.loopexit.epilog-lcssa:               ; preds = %.preheader85.loopexit.unr-lcssa
  %19 = mul nsw i64 %.unr, %.090.unr
  %20 = srem i64 %19, %17
  %21 = getelementptr inbounds [300001 x i64], ptr @f, i64 0, i64 %.090.unr
  store i64 %20, ptr %21, align 8, !tbaa !8
  br label %.preheader85

.preheader85:                                     ; preds = %.preheader85.loopexit.epilog-lcssa, %.preheader85.loopexit.unr-lcssa, %0
  %.not7591 = icmp slt i64 %16, 0
  br i1 %.not7591, label %.preheader82, label %.lr.ph93

22:                                               ; preds = %22, %.lr.ph.new
  %23 = phi i64 [ 1, %.lr.ph.new ], [ %29, %22 ]
  %.090 = phi i64 [ 1, %.lr.ph.new ], [ %31, %22 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %22 ]
  %24 = mul nsw i64 %23, %.090
  %25 = srem i64 %24, %17
  %26 = getelementptr inbounds [300001 x i64], ptr @f, i64 0, i64 %.090
  store i64 %25, ptr %26, align 8, !tbaa !8
  %27 = add nuw i64 %.090, 1
  %28 = mul nsw i64 %25, %27
  %29 = srem i64 %28, %17
  %30 = getelementptr inbounds [300001 x i64], ptr @f, i64 0, i64 %27
  store i64 %29, ptr %30, align 8, !tbaa !8
  %31 = add nuw i64 %.090, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.preheader85.loopexit.unr-lcssa, label %22, !llvm.loop !11

.preheader84:                                     ; preds = %.lr.ph93
  %32 = icmp sgt i64 %38, 0
  br i1 %32, label %.lr.ph95, label %.preheader82

.lr.ph93:                                         ; preds = %.preheader85, %.lr.ph93
  %.05792 = phi i64 [ %37, %.lr.ph93 ], [ 0, %.preheader85 ]
  %33 = getelementptr inbounds [300001 x i64], ptr @f, i64 0, i64 %.05792
  %34 = load i64, ptr %33, align 8, !tbaa !8
  %35 = tail call noundef i64 @_Z3invx(i64 noundef %34)
  %36 = getelementptr inbounds [300001 x i64], ptr @fi, i64 0, i64 %.05792
  store i64 %35, ptr %36, align 8, !tbaa !8
  %37 = add nuw nsw i64 %.05792, 1
  %38 = load i64, ptr @N, align 8, !tbaa !8
  %.not75.not = icmp slt i64 %.05792, %38
  br i1 %.not75.not, label %.lr.ph93, label %.preheader84, !llvm.loop !13

.preheader83:                                     ; preds = %.lr.ph95
  %39 = icmp sgt i64 %45, 1
  br i1 %39, label %.lr.ph97, label %.preheader82

.lr.ph95:                                         ; preds = %.preheader84, %.lr.ph95
  %.05894 = phi i64 [ %44, %.lr.ph95 ], [ 0, %.preheader84 ]
  %40 = getelementptr inbounds [300000 x i64], ptr @A, i64 0, i64 %.05894
  %41 = 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) %40)
  %42 = load i64, ptr %40, align 8, !tbaa !8
  %43 = add nsw i64 %42, -1
  store i64 %43, ptr %40, align 8, !tbaa !8
  %44 = add nuw nsw i64 %.05894, 1
  %45 = load i64, ptr @N, align 8, !tbaa !8
  %46 = icmp slt i64 %44, %45
  br i1 %46, label %.lr.ph95, label %.preheader83, !llvm.loop !14

.preheader82:                                     ; preds = %.lr.ph97, %.preheader85, %.preheader84, %.preheader83
  %47 = load i64, ptr @K, align 8, !tbaa !8
  %48 = icmp sgt i64 %47, 0
  br i1 %48, label %.lr.ph120, label %._crit_edge121

.lr.ph97:                                         ; preds = %.preheader83, %.lr.ph97
  %.05996 = phi i64 [ %60, %.lr.ph97 ], [ 0, %.preheader83 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  %49 = 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)
  %50 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %49, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %51 = load i64, ptr %1, align 8, !tbaa !8
  %52 = add nsw i64 %51, -1
  store i64 %52, ptr %1, align 8, !tbaa !8
  %53 = load i64, ptr %2, align 8, !tbaa !8
  %54 = add nsw i64 %53, -1
  store i64 %54, ptr %2, align 8, !tbaa !8
  %55 = getelementptr inbounds [300000 x %"class.std::vector"], ptr @G, i64 0, i64 %52
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %55, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %56 = load i64, ptr %2, align 8, !tbaa !8
  %57 = getelementptr inbounds [300000 x %"class.std::vector"], ptr @G, i64 0, i64 %56
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %57, ptr noundef nonnull align 8 dereferenceable(8) %1)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #8
  call void @_ZNSt4pairIxxEC2IRxS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %58 = getelementptr inbounds [300000 x %"struct.std::pair"], ptr @E, i64 0, i64 %.05996
  %59 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %58, ptr noundef nonnull align 8 dereferenceable(16) %3) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #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
  %60 = add nuw nsw i64 %.05996, 1
  %61 = load i64, ptr @N, align 8, !tbaa !8
  %62 = add nsw i64 %61, -1
  %63 = icmp slt i64 %60, %62
  br i1 %63, label %.lr.ph97, label %.preheader82, !llvm.loop !15

._crit_edge121:                                   ; preds = %164, %.preheader82
  ret i32 0

.lr.ph120:                                        ; preds = %.preheader82, %164
  %.063119 = phi i64 [ %165, %164 ], [ 0, %.preheader82 ]
  %64 = load i64, ptr @N, align 8, !tbaa !8
  call void @_ZN3DSU4initEx(ptr noundef nonnull align 8 dereferenceable(4800000) @dsu, i64 noundef %64)
  %65 = load i64, ptr @N, align 8, !tbaa !8
  %66 = icmp sgt i64 %65, 1
  br i1 %66, label %.lr.ph99, label %.preheader81

.preheader81:                                     ; preds = %82, %.lr.ph120
  %.lcssa = phi i64 [ %65, %.lr.ph120 ], [ %83, %82 ]
  %67 = icmp sgt i64 %.lcssa, 0
  br i1 %67, label %.lr.ph102.preheader, label %._crit_edge

.lr.ph102.preheader:                              ; preds = %.preheader81
  %xtraiter140 = and i64 %.lcssa, 1
  %68 = icmp eq i64 %.lcssa, 1
  br i1 %68, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph102.preheader.new

.lr.ph102.preheader.new:                          ; preds = %.lr.ph102.preheader
  %unroll_iter143 = and i64 %.lcssa, 9223372036854775806
  br label %.lr.ph102

.lr.ph99:                                         ; preds = %.lr.ph120, %82
  %69 = phi i64 [ %83, %82 ], [ %65, %.lr.ph120 ]
  %.07298 = phi i64 [ %84, %82 ], [ 0, %.lr.ph120 ]
  %70 = getelementptr inbounds [300000 x %"struct.std::pair"], ptr @E, i64 0, i64 %.07298
  %71 = load i64, ptr %70, align 16, !tbaa !16
  %72 = getelementptr inbounds i8, ptr %70, i64 8
  %73 = load i64, ptr %72, align 8, !tbaa !18
  %74 = getelementptr inbounds [300000 x i64], ptr @A, i64 0, i64 %71
  %75 = load i64, ptr %74, align 8, !tbaa !8
  %76 = icmp eq i64 %75, %.063119
  br i1 %76, label %82, label %77

77:                                               ; preds = %.lr.ph99
  %78 = getelementptr inbounds [300000 x i64], ptr @A, i64 0, i64 %73
  %79 = load i64, ptr %78, align 8, !tbaa !8
  %80 = icmp eq i64 %79, %.063119
  br i1 %80, label %82, label %81

81:                                               ; preds = %77
  call void @_ZN3DSU2unExx(ptr noundef nonnull align 8 dereferenceable(4800000) @dsu, i64 noundef %71, i64 noundef %73)
  %.pre = load i64, ptr @N, align 8, !tbaa !8
  br label %82

82:                                               ; preds = %.lr.ph99, %77, %81
  %83 = phi i64 [ %69, %.lr.ph99 ], [ %69, %77 ], [ %.pre, %81 ]
  %84 = add nuw nsw i64 %.07298, 1
  %85 = add nsw i64 %83, -1
  %86 = icmp slt i64 %84, %85
  br i1 %86, label %.lr.ph99, label %.preheader81, !llvm.loop !19

._crit_edge.loopexit.unr-lcssa:                   ; preds = %105, %.lr.ph102.preheader
  %.171.lcssa.ph = phi i64 [ poison, %.lr.ph102.preheader ], [ %.171.1, %105 ]
  %.069101.unr = phi i64 [ 0, %.lr.ph102.preheader ], [ %106, %105 ]
  %.070100.unr = phi i64 [ 0, %.lr.ph102.preheader ], [ %.171.1, %105 ]
  %lcmp.mod141.not = icmp eq i64 %xtraiter140, 0
  br i1 %lcmp.mod141.not, label %._crit_edge, label %.lr.ph102.epil

.lr.ph102.epil:                                   ; preds = %._crit_edge.loopexit.unr-lcssa
  %87 = getelementptr inbounds [300000 x i64], ptr @A, i64 0, i64 %.069101.unr
  %88 = load i64, ptr %87, align 8, !tbaa !8
  %.not80.epil = icmp eq i64 %88, %.063119
  br i1 %.not80.epil, label %._crit_edge, label %89

89:                                               ; preds = %.lr.ph102.epil
  %90 = getelementptr inbounds [300000 x i64], ptr getelementptr inbounds (i8, ptr @dsu, i64 2400000), i64 0, i64 %.069101.unr
  %91 = load i64, ptr %90, align 8, !tbaa !8
  %spec.select.epil = call i64 @llvm.smax.i64(i64 %91, i64 %.070100.unr)
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %89, %.lr.ph102.epil, %.preheader81
  %.070.lcssa = phi i64 [ 0, %.preheader81 ], [ %.171.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %.070100.unr, %.lr.ph102.epil ], [ %spec.select.epil, %89 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #8
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  store i64 0, ptr %5, align 8, !tbaa !8
  %92 = load i64, ptr @N, align 8, !tbaa !8
  %93 = icmp sgt i64 %92, 0
  br i1 %93, label %.lr.ph106, label %._crit_edge107

.lr.ph102:                                        ; preds = %105, %.lr.ph102.preheader.new
  %.069101 = phi i64 [ 0, %.lr.ph102.preheader.new ], [ %106, %105 ]
  %.070100 = phi i64 [ 0, %.lr.ph102.preheader.new ], [ %.171.1, %105 ]
  %niter144 = phi i64 [ 0, %.lr.ph102.preheader.new ], [ %niter144.next.1, %105 ]
  %94 = getelementptr inbounds [300000 x i64], ptr @A, i64 0, i64 %.069101
  %95 = load i64, ptr %94, align 16, !tbaa !8
  %.not80 = icmp eq i64 %95, %.063119
  br i1 %.not80, label %.lr.ph102.1, label %96

96:                                               ; preds = %.lr.ph102
  %97 = getelementptr inbounds [300000 x i64], ptr getelementptr inbounds (i8, ptr @dsu, i64 2400000), i64 0, i64 %.069101
  %98 = load i64, ptr %97, align 8, !tbaa !8
  %spec.select = call i64 @llvm.smax.i64(i64 %98, i64 %.070100)
  br label %.lr.ph102.1

.lr.ph102.1:                                      ; preds = %96, %.lr.ph102
  %.171 = phi i64 [ %.070100, %.lr.ph102 ], [ %spec.select, %96 ]
  %99 = or disjoint i64 %.069101, 1
  %100 = getelementptr inbounds [300000 x i64], ptr @A, i64 0, i64 %99
  %101 = load i64, ptr %100, align 8, !tbaa !8
  %.not80.1 = icmp eq i64 %101, %.063119
  br i1 %.not80.1, label %105, label %102

102:                                              ; preds = %.lr.ph102.1
  %103 = getelementptr inbounds [300000 x i64], ptr getelementptr inbounds (i8, ptr @dsu, i64 2400000), i64 0, i64 %99
  %104 = load i64, ptr %103, align 8, !tbaa !8
  %spec.select.1 = call i64 @llvm.smax.i64(i64 %104, i64 %.171)
  br label %105

105:                                              ; preds = %102, %.lr.ph102.1
  %.171.1 = phi i64 [ %.171, %.lr.ph102.1 ], [ %spec.select.1, %102 ]
  %106 = add nuw nsw i64 %.069101, 2
  %niter144.next.1 = add i64 %niter144, 2
  %niter144.ncmp.1 = icmp eq i64 %niter144.next.1, %unroll_iter143
  br i1 %niter144.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph102, !llvm.loop !20

._crit_edge107:                                   ; preds = %120, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  %107 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  store ptr %107, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %108 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  store ptr %108, ptr %7, align 8
  %109 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  br i1 %109, label %.lr.ph116, label %._crit_edge117

.lr.ph106:                                        ; preds = %._crit_edge, %120
  %110 = phi i64 [ %121, %120 ], [ %92, %._crit_edge ]
  %storemerge104 = phi i64 [ %123, %120 ], [ 0, %._crit_edge ]
  %111 = getelementptr inbounds [300000 x i64], ptr @A, i64 0, i64 %storemerge104
  %112 = load i64, ptr %111, align 8, !tbaa !8
  %.not77 = icmp eq i64 %112, %.063119
  br i1 %.not77, label %120, label %113

113:                                              ; preds = %.lr.ph106
  %114 = getelementptr inbounds [300000 x i64], ptr getelementptr inbounds (i8, ptr @dsu, i64 2400000), i64 0, i64 %storemerge104
  %115 = load i64, ptr %114, align 8, !tbaa !8
  %116 = icmp eq i64 %115, %.070.lcssa
  br i1 %116, label %117, label %120

117:                                              ; preds = %113
  invoke void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %._crit_edge125 unwind label %118

._crit_edge125:                                   ; preds = %117
  %.pre126 = load i64, ptr %5, align 8, !tbaa !8
  %.pre127 = load i64, ptr @N, align 8, !tbaa !8
  br label %120

118:                                              ; preds = %117
  %119 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  br label %170

120:                                              ; preds = %._crit_edge125, %.lr.ph106, %113
  %121 = phi i64 [ %.pre127, %._crit_edge125 ], [ %110, %.lr.ph106 ], [ %110, %113 ]
  %122 = phi i64 [ %.pre126, %._crit_edge125 ], [ %storemerge104, %.lr.ph106 ], [ %storemerge104, %113 ]
  %123 = add nsw i64 %122, 1
  store i64 %123, ptr %5, align 8, !tbaa !8
  %124 = icmp slt i64 %123, %121
  br i1 %124, label %.lr.ph106, label %._crit_edge107, !llvm.loop !21

._crit_edge117:                                   ; preds = %158, %._crit_edge107
  %.067.lcssa = phi i64 [ 0, %._crit_edge107 ], [ %.168, %158 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  %125 = load i64, ptr @MOD, align 8, !tbaa !8
  %126 = srem i64 %.067.lcssa, %125
  %127 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %126)
          to label %162 unwind label %168

.lr.ph116:                                        ; preds = %._crit_edge107, %158
  %.067114 = phi i64 [ %.168, %158 ], [ 0, %._crit_edge107 ]
  %128 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  %129 = load i64, ptr %128, align 8, !tbaa !8
  call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @bc) #8
  call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @bcp) #8
  invoke void @_Z6dfs_bcxxx(i64 noundef %129, i64 noundef -1, i64 noundef %.063119)
          to label %130 unwind label %134

130:                                              ; preds = %.lr.ph116
  %131 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @bc) #8
  %132 = icmp eq i64 %131, 0
  br i1 %132, label %158, label %.preheader

.preheader:                                       ; preds = %130
  %133 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @bc) #8
  %.not = icmp eq i64 %133, 0
  br i1 %.not, label %._crit_edge112, label %.lr.ph111

134:                                              ; preds = %.lr.ph116
  %135 = landingpad { ptr, i32 }
          cleanup
  br label %161

._crit_edge112:                                   ; preds = %142, %.preheader
  %.062.lcssa = phi i64 [ 1, %.preheader ], [ %152, %142 ]
  %136 = add nsw i64 %.062.lcssa, %.067114
  br label %158

.lr.ph111:                                        ; preds = %.preheader, %142
  %.060110 = phi i64 [ %153, %142 ], [ 0, %.preheader ]
  %.061109 = phi i64 [ %148, %142 ], [ 0, %.preheader ]
  %.062108 = phi i64 [ %152, %142 ], [ 1, %.preheader ]
  %137 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @bc, i64 noundef %.060110) #8
  %138 = load i64, ptr %137, align 8, !tbaa !8
  %139 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @bcp, i64 noundef %.060110) #8
  %140 = load i64, ptr %139, align 8, !tbaa !8
  %141 = invoke { i64, i64 } @_Z3dfsxx(i64 noundef %138, i64 noundef %140)
          to label %142 unwind label %156

142:                                              ; preds = %.lr.ph111
  %143 = extractvalue { i64, i64 } %141, 0
  %144 = extractvalue { i64, i64 } %141, 1
  %145 = mul nsw i64 %143, %.062108
  %146 = load i64, ptr @MOD, align 8, !tbaa !8
  %147 = srem i64 %145, %146
  %148 = add nsw i64 %144, %.061109
  %149 = call noundef i64 @_Z3nCrxx(i64 noundef %148, i64 noundef %.061109)
  %150 = mul nsw i64 %149, %147
  %151 = load i64, ptr @MOD, align 8, !tbaa !8
  %152 = srem i64 %150, %151
  %153 = add nuw nsw i64 %.060110, 1
  %154 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @bc) #8
  %155 = icmp ult i64 %153, %154
  br i1 %155, label %.lr.ph111, label %._crit_edge112, !llvm.loop !22

156:                                              ; preds = %.lr.ph111
  %157 = landingpad { ptr, i32 }
          cleanup
  br label %161

158:                                              ; preds = %130, %._crit_edge112
  %.168 = phi i64 [ %136, %._crit_edge112 ], [ %.067114, %130 ]
  %159 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  %160 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  br i1 %160, label %.lr.ph116, label %._crit_edge117

161:                                              ; preds = %156, %134
  %.pn = phi { ptr, i32 } [ %157, %156 ], [ %135, %134 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  br label %170

162:                                              ; preds = %._crit_edge117
  %163 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %127, i8 noundef signext 10)
          to label %164 unwind label %168

164:                                              ; preds = %162
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #8
  %165 = add nuw nsw i64 %.063119, 1
  %166 = load i64, ptr @K, align 8, !tbaa !8
  %167 = icmp slt i64 %165, %166
  br i1 %167, label %.lr.ph120, label %._crit_edge121, !llvm.loop !23

168:                                              ; preds = %162, %._crit_edge117
  %169 = landingpad { ptr, i32 }
          cleanup
  br label %170

170:                                              ; preds = %168, %161, %118
  %.pn78 = phi { ptr, i32 } [ %119, %118 ], [ %.pn, %161 ], [ %169, %168 ]
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #8
  resume { ptr, i32 } %.pn78
}

; 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 #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3DSU4initEx(ptr noundef nonnull align 8 dereferenceable(4800000), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3DSU2unExx(ptr noundef nonnull align 8 dereferenceable(4800000), i64 noundef, i64 noundef) local_unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 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: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 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: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = !{!17, !9, i64 0}
!17 = !{!"_ZTSSt4pairIxxE", !9, i64 0, !9, i64 8}
!18 = !{!17, !9, i64 8}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}


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