; LLVM IR from tangjz/acm-icpc :: 51nod/1367.ll (Z3dfsii)

; 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"

%struct.Edge = type { i32, i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }
%"struct.std::pair.0" = type <{ i64, i32, [4 x i8] }>
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@m = external dso_local global i32, align 4
@pre = external dso_local global [500010 x i32], align 16
@cnt = external dso_local global i32, align 4
@f = external dso_local global [500010 x i64], align 16
@e = external dso_local global [1000020 x %struct.Edge], align 16
@h = external dso_local global [500010 x %"class.std::vector"], align 16

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3dfsii(i32 noundef %0, i32 noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %"struct.std::pair", align 4
  %10 = alloca %"struct.std::pair.0", align 8
  %11 = alloca i64, align 8
  %12 = alloca { i64, i32 }, align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %19 = load i32, ptr %3, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [500010 x i32], ptr @pre, i64 0, i64 %20
  %22 = load i32, ptr %21, align 4, !tbaa !5
  store i32 %22, ptr %5, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %65, %2
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %25 = icmp ne i32 %24, -1
  br i1 %25, label %27, label %26

26:                                               ; preds = %23
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %71

27:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %28 = load i32, ptr %5, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [1000020 x %struct.Edge], ptr @e, i64 0, i64 %29
  %31 = getelementptr inbounds %struct.Edge, ptr %30, i32 0, i32 1
  store ptr %31, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %32 = load i32, ptr %5, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [1000020 x %struct.Edge], ptr @e, i64 0, i64 %33
  %35 = getelementptr inbounds %struct.Edge, ptr %34, i32 0, i32 2
  store ptr %35, ptr %8, align 8, !tbaa !9
  %36 = load ptr, ptr %7, align 8, !tbaa !9
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = icmp eq i32 %37, %38
  br i1 %39, label %44, label %40

40:                                               ; preds = %27
  %41 = load ptr, ptr %8, align 8, !tbaa !9
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %45, label %44

44:                                               ; preds = %40, %27
  store i32 4, ptr %6, align 4
  br label %62

45:                                               ; preds = %40
  %46 = load ptr, ptr %7, align 8, !tbaa !9
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = load i32, ptr %3, align 4, !tbaa !5
  call void @_Z3dfsii(i32 noundef %47, i32 noundef %48)
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [500010 x %"class.std::vector"], ptr @h, i64 0, i64 %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %52 = load ptr, ptr %7, align 8, !tbaa !9
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [500010 x i64], ptr @f, i64 0, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !11
  %57 = load ptr, ptr %8, align 8, !tbaa !9
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = add nsw i64 %56, %59
  store i64 %60, ptr %11, align 8, !tbaa !11
  %61 = call { i64, i32 } @_ZSt9make_pairIxRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store { i64, i32 } %61, ptr %12, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %12, i64 12, i1 false)
  call void @_ZNSt4pairIiiEC2IxiTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE22_MoveConstructiblePairIS3_S4_EEclsr6_PCCFPIS3_S4_EE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS_IS3_S4_E(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(12) %10)
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %51, ptr noundef nonnull align 4 dereferenceable(8) %9)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  store i32 0, ptr %6, align 4
  br label %62

62:                                               ; preds = %45, %44
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  %63 = load i32, ptr %6, align 4
  switch i32 %63, label %204 [
    i32 0, label %64
    i32 4, label %65
  ]

64:                                               ; preds = %62
  br label %65

65:                                               ; preds = %64, %62
  %66 = load i32, ptr %5, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [1000020 x %struct.Edge], ptr @e, i64 0, i64 %67
  %69 = getelementptr inbounds %struct.Edge, ptr %68, i32 0, i32 0
  %70 = load i32, ptr %69, align 4, !tbaa !13
  store i32 %70, ptr %5, align 4, !tbaa !5
  br label %23, !llvm.loop !15

71:                                               ; preds = %26
  %72 = load i32, ptr %3, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [500010 x %"class.std::vector"], ptr @h, i64 0, i64 %73
  %75 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %74) #5
  %76 = icmp ne i64 %75, 0
  br i1 %76, label %78, label %77

77:                                               ; preds = %71
  br label %203

78:                                               ; preds = %71
  %79 = load i32, ptr %3, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [500010 x %"class.std::vector"], ptr @h, i64 0, i64 %80
  %82 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %81) #5
  %83 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %82, ptr %83, align 8
  %84 = load i32, ptr %3, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [500010 x %"class.std::vector"], ptr @h, i64 0, i64 %85
  %87 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %86) #5
  %88 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  store ptr %87, ptr %88, align 8
  %89 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8
  %91 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  %92 = load ptr, ptr %91, align 8
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr %90, ptr %92)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %93 = load i32, ptr %3, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [500010 x %"class.std::vector"], ptr @h, i64 0, i64 %94
  %96 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %95) #5
  %97 = sub i64 %96, 2
  %98 = trunc i64 %97 to i32
  store i32 %98, ptr %16, align 4, !tbaa !5
  br label %99

99:                                               ; preds = %150, %78
  %100 = load i32, ptr %16, align 4, !tbaa !5
  %101 = icmp sge i32 %100, 0
  br i1 %101, label %103, label %102

102:                                              ; preds = %99
  store i32 5, ptr %6, align 4
  br label %153

103:                                              ; preds = %99
  %104 = load i32, ptr %3, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [500010 x %"class.std::vector"], ptr @h, i64 0, i64 %105
  %107 = load i32, ptr %16, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %106, i64 noundef %108) #5
  %110 = getelementptr inbounds %"struct.std::pair", ptr %109, i32 0, i32 0
  %111 = load i32, ptr %110, align 4, !tbaa !17
  %112 = load i32, ptr %3, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [500010 x %"class.std::vector"], ptr @h, i64 0, i64 %113
  %115 = load i32, ptr %16, align 4, !tbaa !5
  %116 = add nsw i32 %115, 1
  %117 = sext i32 %116 to i64
  %118 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %114, i64 noundef %117) #5
  %119 = getelementptr inbounds %"struct.std::pair", ptr %118, i32 0, i32 0
  %120 = load i32, ptr %119, align 4, !tbaa !17
  %121 = add nsw i32 %111, %120
  %122 = load i32, ptr @m, align 4, !tbaa !5
  %123 = icmp sgt i32 %121, %122
  br i1 %123, label %124, label %146

124:                                              ; preds = %103
  %125 = load i32, ptr @cnt, align 4, !tbaa !5
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr @cnt, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %127 = load i32, ptr %3, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [500010 x %"class.std::vector"], ptr @h, i64 0, i64 %128
  %130 = load i32, ptr %16, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1
  %132 = sext i32 %131 to i64
  %133 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %129, i64 noundef %132) #5
  %134 = getelementptr inbounds %"struct.std::pair", ptr %133, i32 0, i32 1
  store ptr %134, ptr %17, align 8, !tbaa !9
  %135 = load ptr, ptr %17, align 8, !tbaa !9
  %136 = load i32, ptr %135, align 4, !tbaa !5
  %137 = xor i32 %136, 1
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [1000020 x %struct.Edge], ptr @e, i64 0, i64 %138
  %140 = getelementptr inbounds %struct.Edge, ptr %139, i32 0, i32 2
  store i32 0, ptr %140, align 4, !tbaa !19
  %141 = load ptr, ptr %17, align 8, !tbaa !9
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [1000020 x %struct.Edge], ptr @e, i64 0, i64 %143
  %145 = getelementptr inbounds %struct.Edge, ptr %144, i32 0, i32 2
  store i32 0, ptr %145, align 4, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %149

146:                                              ; preds = %103
  %147 = load i32, ptr %16, align 4, !tbaa !5
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %15, align 4, !tbaa !5
  store i32 5, ptr %6, align 4
  br label %153

149:                                              ; preds = %124
  br label %150

150:                                              ; preds = %149
  %151 = load i32, ptr %16, align 4, !tbaa !5
  %152 = add nsw i32 %151, -1
  store i32 %152, ptr %16, align 4, !tbaa !5
  br label %99, !llvm.loop !20

153:                                              ; preds = %146, %102
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %154

154:                                              ; preds = %153
  %155 = load i32, ptr %15, align 4, !tbaa !5
  %156 = icmp ne i32 %155, 0
  br i1 %156, label %189, label %157

157:                                              ; preds = %154
  %158 = load i32, ptr %3, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [500010 x %"class.std::vector"], ptr @h, i64 0, i64 %159
  %161 = load i32, ptr %15, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %160, i64 noundef %162) #5
  %164 = getelementptr inbounds %"struct.std::pair", ptr %163, i32 0, i32 0
  %165 = load i32, ptr %164, align 4, !tbaa !17
  %166 = load i32, ptr @m, align 4, !tbaa !5
  %167 = icmp sgt i32 %165, %166
  br i1 %167, label %168, label %189

168:                                              ; preds = %157
  %169 = load i32, ptr @cnt, align 4, !tbaa !5
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr @cnt, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %171 = load i32, ptr %3, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [500010 x %"class.std::vector"], ptr @h, i64 0, i64 %172
  %174 = load i32, ptr %15, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %173, i64 noundef %175) #5
  %177 = getelementptr inbounds %"struct.std::pair", ptr %176, i32 0, i32 1
  store ptr %177, ptr %18, align 8, !tbaa !9
  %178 = load ptr, ptr %18, align 8, !tbaa !9
  %179 = load i32, ptr %178, align 4, !tbaa !5
  %180 = xor i32 %179, 1
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [1000020 x %struct.Edge], ptr @e, i64 0, i64 %181
  %183 = getelementptr inbounds %struct.Edge, ptr %182, i32 0, i32 2
  store i32 0, ptr %183, align 4, !tbaa !19
  %184 = load ptr, ptr %18, align 8, !tbaa !9
  %185 = load i32, ptr %184, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [1000020 x %struct.Edge], ptr @e, i64 0, i64 %186
  %188 = getelementptr inbounds %struct.Edge, ptr %187, i32 0, i32 2
  store i32 0, ptr %188, align 4, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  br label %202

189:                                              ; preds = %157, %154
  %190 = load i32, ptr %3, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [500010 x %"class.std::vector"], ptr @h, i64 0, i64 %191
  %193 = load i32, ptr %15, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %192, i64 noundef %194) #5
  %196 = getelementptr inbounds %"struct.std::pair", ptr %195, i32 0, i32 0
  %197 = load i32, ptr %196, align 4, !tbaa !17
  %198 = sext i32 %197 to i64
  %199 = load i32, ptr %3, align 4, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [500010 x i64], ptr @f, i64 0, i64 %200
  store i64 %198, ptr %201, align 8, !tbaa !11
  br label %202

202:                                              ; preds = %189, %168
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %203

203:                                              ; preds = %202, %77
  ret void

204:                                              ; preds = %62
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairIxRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IxiTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE22_MoveConstructiblePairIS3_S4_EEclsr6_PCCFPIS3_S4_EE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS_IS3_S4_E(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(12)) unnamed_addr #3 align 2

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

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

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

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

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

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

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

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


; 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"

%struct.Edge = type { i32, i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }
%"struct.std::pair.0" = type <{ i64, i32, [4 x i8] }>

@m = external dso_local local_unnamed_addr global i32, align 4
@pre = external dso_local local_unnamed_addr global [500010 x i32], align 16
@cnt = external dso_local local_unnamed_addr global i32, align 4
@f = external dso_local local_unnamed_addr global [500010 x i64], align 16
@e = external dso_local local_unnamed_addr global [1000020 x %struct.Edge], align 16
@h = external dso_local global [500010 x %"class.std::vector"], align 16

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3dfsii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #1 {
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 4
  %5 = alloca %"struct.std::pair.0", align 8
  %6 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %7 = sext i32 %0 to i64
  %8 = getelementptr inbounds [500010 x i32], ptr @pre, i64 0, i64 %7
  %storemerge45 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %storemerge45, ptr %3, align 4, !tbaa !5
  %.not46 = icmp eq i32 %storemerge45, -1
  br i1 %.not46, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2
  %9 = getelementptr inbounds [500010 x %"class.std::vector"], ptr @h, i64 0, i64 %7
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %5, i64 8
  br label %12

._crit_edge:                                      ; preds = %30, %2
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  %10 = getelementptr inbounds [500010 x %"class.std::vector"], ptr @h, i64 0, i64 %7
  %11 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #4
  %.not38 = icmp eq i64 %11, 0
  br i1 %.not38, label %82, label %32

12:                                               ; preds = %.lr.ph, %30
  %storemerge47 = phi i32 [ %storemerge45, %.lr.ph ], [ %storemerge, %30 ]
  %13 = sext i32 %storemerge47 to i64
  %14 = getelementptr inbounds [1000020 x %struct.Edge], ptr @e, i64 0, i64 %13
  %15 = getelementptr inbounds i8, ptr %14, i64 4
  %16 = getelementptr inbounds i8, ptr %14, i64 8
  %17 = load i32, ptr %15, align 4, !tbaa !5
  %18 = icmp eq i32 %17, %1
  br i1 %18, label %30, label %19

19:                                               ; preds = %12
  %20 = load i32, ptr %16, align 4, !tbaa !5
  %.not40 = icmp eq i32 %20, 0
  br i1 %.not40, label %30, label %21

21:                                               ; preds = %19
  call void @_Z3dfsii(i32 noundef %17, i32 noundef %0)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %22 = load i32, ptr %15, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [500010 x i64], ptr @f, i64 0, i64 %23
  %25 = load i64, ptr %24, align 8, !tbaa !9
  %26 = load i32, ptr %16, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = add nsw i64 %25, %27
  store i64 %28, ptr %6, align 8, !tbaa !9
  %29 = call { i64, i32 } @_ZSt9make_pairIxRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %.fca.0.extract = extractvalue { i64, i32 } %29, 0
  %.fca.1.extract = extractvalue { i64, i32 } %29, 1
  store i64 %.fca.0.extract, ptr %5, align 8
  store i32 %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  call void @_ZNSt4pairIiiEC2IxiTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE22_MoveConstructiblePairIS3_S4_EEclsr6_PCCFPIS3_S4_EE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS_IS3_S4_E(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(12) %5)
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  %.pre = load i32, ptr %3, align 4, !tbaa !5
  %.pre54 = sext i32 %.pre to i64
  br label %30

30:                                               ; preds = %12, %19, %21
  %.pre-phi = phi i64 [ %13, %12 ], [ %13, %19 ], [ %.pre54, %21 ]
  %31 = getelementptr inbounds [1000020 x %struct.Edge], ptr @e, i64 0, i64 %.pre-phi
  %storemerge = load i32, ptr %31, align 4, !tbaa !5
  store i32 %storemerge, ptr %3, align 4, !tbaa !5
  %.not = icmp eq i32 %storemerge, -1
  br i1 %.not, label %._crit_edge, label %12, !llvm.loop !11

32:                                               ; preds = %._crit_edge
  %33 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #4
  %34 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #4
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr %33, ptr %34)
  %35 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #4
  %36 = trunc i64 %35 to i32
  %37 = add i32 %36, -2
  %38 = icmp sgt i32 %37, -1
  br i1 %38, label %.lr.ph50.preheader, label %._crit_edge51

.lr.ph50.preheader:                               ; preds = %32
  %39 = zext nneg i32 %37 to i64
  br label %.lr.ph50

.lr.ph50:                                         ; preds = %.lr.ph50.preheader, %48
  %indvars.iv = phi i64 [ %39, %.lr.ph50.preheader ], [ %indvars.iv.next, %48 ]
  %40 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %indvars.iv) #4
  %41 = load i32, ptr %40, align 4, !tbaa !13
  %42 = add nuw nsw i64 %indvars.iv, 1
  %43 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %42) #4
  %44 = load i32, ptr %43, align 4, !tbaa !13
  %45 = add nsw i32 %44, %41
  %46 = load i32, ptr @m, align 4, !tbaa !5
  %47 = icmp sgt i32 %45, %46
  br i1 %47, label %48, label %.loopexit.loopexit

48:                                               ; preds = %.lr.ph50
  %49 = load i32, ptr @cnt, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr @cnt, align 4, !tbaa !5
  %51 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %42) #4
  %52 = getelementptr inbounds i8, ptr %51, i64 4
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = xor i32 %53, 1
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [1000020 x %struct.Edge], ptr @e, i64 0, i64 %55, i32 2
  store i32 0, ptr %56, align 4, !tbaa !15
  %57 = load i32, ptr %52, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [1000020 x %struct.Edge], ptr @e, i64 0, i64 %58, i32 2
  store i32 0, ptr %59, align 4, !tbaa !15
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %60 = icmp sgt i64 %indvars.iv, 0
  br i1 %60, label %.lr.ph50, label %._crit_edge51, !llvm.loop !17

._crit_edge51:                                    ; preds = %48, %32
  %61 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef 0) #4
  %62 = load i32, ptr %61, align 4, !tbaa !13
  %63 = load i32, ptr @m, align 4, !tbaa !5
  %64 = icmp sgt i32 %62, %63
  br i1 %64, label %65, label %.loopexit

65:                                               ; preds = %._crit_edge51
  %66 = load i32, ptr @cnt, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr @cnt, align 4, !tbaa !5
  %68 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef 0) #4
  %69 = getelementptr inbounds i8, ptr %68, i64 4
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = xor i32 %70, 1
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [1000020 x %struct.Edge], ptr @e, i64 0, i64 %72, i32 2
  store i32 0, ptr %73, align 4, !tbaa !15
  %74 = load i32, ptr %69, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [1000020 x %struct.Edge], ptr @e, i64 0, i64 %75, i32 2
  store i32 0, ptr %76, align 4, !tbaa !15
  br label %82

.loopexit.loopexit:                               ; preds = %.lr.ph50
  %77 = and i64 %42, 4294967295
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %._crit_edge51
  %.043 = phi i64 [ 0, %._crit_edge51 ], [ %77, %.loopexit.loopexit ]
  %78 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %.043) #4
  %79 = load i32, ptr %78, align 4, !tbaa !13
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [500010 x i64], ptr @f, i64 0, i64 %7
  store i64 %80, ptr %81, align 8, !tbaa !9
  br label %82

82:                                               ; preds = %65, %.loopexit, %._crit_edge
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairIxRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IxiTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE22_MoveConstructiblePairIS3_S4_EEclsr6_PCCFPIS3_S4_EE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS_IS3_S4_E(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(12)) unnamed_addr #2 align 2

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

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

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

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

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

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

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

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


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