; LLVM IR from VastoLorde95/Competitive-Programming :: Hackerrank/Codesprints 2016/Codesprint June/Problem G/G.ll (Z5solvev)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, %"struct.std::pair.5" }
%"struct.std::pair.5" = type { i32, i32 }
%"class.__gnu_cxx::__normal_iterator.7" = type { ptr }

@g = external dso_local global [500100 x %"class.std::vector"], align 16
@paths = external dso_local global %"class.std::vector.0", align 8
@edges = external dso_local global %"class.std::vector.0", align 8
@bad = external dso_local global [1010 x i32], align 16
@l = external dso_local global [500100 x i32], align 16
@r = external dso_local global [500100 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsii(i32 noundef, i32 noundef) #0

; 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 zeroext i1 @_Z3cmpRKSt4pairIiS_IiiEES3_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"struct.std::pair", align 4
  %9 = alloca %"struct.std::pair.5", align 4
  %10 = alloca { i64, i32 }, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %"struct.std::pair", align 4
  %16 = alloca %"struct.std::pair.5", align 4
  %17 = alloca { i64, i32 }, align 8
  %18 = alloca %"class.__gnu_cxx::__normal_iterator.7", align 8
  %19 = alloca %"class.__gnu_cxx::__normal_iterator.7", align 8
  %20 = alloca i64, align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i8, align 1
  %25 = alloca i64, align 8
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca i32, align 4
  %34 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  %35 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %1, ptr noundef %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %45, %0
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = load i32, ptr %1, align 4, !tbaa !5
  %39 = icmp sle i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %48

41:                                               ; preds = %36
  %42 = load i32, ptr %3, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [500100 x %"class.std::vector"], ptr @g, i64 0, i64 %43
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %44) #8
  br label %45

45:                                               ; preds = %41
  %46 = load i32, ptr %3, align 4, !tbaa !5
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %3, align 4, !tbaa !5
  br label %36, !llvm.loop !9

48:                                               ; preds = %40
  call void @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @edges) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %64, %48
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = load i32, ptr %1, align 4, !tbaa !5
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %54, label %53

53:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %67

54:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  %55 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %5, ptr noundef %6, ptr noundef %7)
  %56 = load i32, ptr %5, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [500100 x %"class.std::vector"], ptr @g, i64 0, i64 %57
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %58, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %59 = load i32, ptr %6, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [500100 x %"class.std::vector"], ptr @g, i64 0, i64 %60
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %61, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.start.p0(i64 12, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %62 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  store i64 %62, ptr %9, align 4
  %63 = call { i64, i32 } @_ZSt9make_pairIRiSt4pairIiiEES1_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(8) %9)
  store { i64, i32 } %63, ptr %10, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 8 %10, i64 12, i1 false)
  call void @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) @edges, ptr noundef nonnull align 4 dereferenceable(12) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  br label %64

64:                                               ; preds = %54
  %65 = load i32, ptr %4, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %4, align 4, !tbaa !5
  br label %49, !llvm.loop !11

67:                                               ; preds = %53
  call void @_Z3dfsii(i32 noundef 1, i32 noundef -1)
  call void @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @paths) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %80, %67
  %69 = load i32, ptr %11, align 4, !tbaa !5
  %70 = load i32, ptr %2, align 4, !tbaa !5
  %71 = icmp slt i32 %69, %70
  br i1 %71, label %73, label %72

72:                                               ; preds = %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %83

73:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  %74 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %12, ptr noundef %13, ptr noundef %14)
  call void @llvm.lifetime.start.p0(i64 12, ptr %15) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %75 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %13)
  store i64 %75, ptr %16, align 4
  %76 = call { i64, i32 } @_ZSt9make_pairIRiSt4pairIiiEES1_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(8) %16)
  store { i64, i32 } %76, ptr %17, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 8 %17, i64 12, i1 false)
  call void @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) @paths, ptr noundef nonnull align 4 dereferenceable(12) %15)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %15) #8
  %77 = load i32, ptr %11, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [1010 x i32], ptr @bad, i64 0, i64 %78
  store i32 0, ptr %79, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %80

80:                                               ; preds = %73
  %81 = load i32, ptr %11, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %11, align 4, !tbaa !5
  br label %68, !llvm.loop !12

83:                                               ; preds = %72
  %84 = call ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @paths) #8
  %85 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.7", ptr %18, i32 0, i32 0
  store ptr %84, ptr %85, align 8
  %86 = call ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @paths) #8
  %87 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.7", ptr %19, i32 0, i32 0
  store ptr %86, ptr %87, align 8
  %88 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.7", ptr %18, i32 0, i32 0
  %89 = load ptr, ptr %88, align 8
  %90 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.7", ptr %19, i32 0, i32 0
  %91 = load ptr, ptr %90, align 8
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIiS2_IiiEESt6vectorIS4_SaIS4_EEEEPFbRKS4_SB_EEvT_SE_T0_(ptr %89, ptr %91, ptr noundef @_Z3cmpRKSt4pairIiS_IiiEES3_)
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  store i64 0, ptr %20, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #8
  store i32 1, ptr %21, align 4, !tbaa !5
  br label %92

92:                                               ; preds = %267, %83
  %93 = load i32, ptr %21, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = load i32, ptr %2, align 4, !tbaa !5
  %96 = zext i32 %95 to i64
  %97 = shl i64 1, %96
  %98 = icmp slt i64 %94, %97
  br i1 %98, label %100, label %99

99:                                               ; preds = %92
  store i32 11, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  br label %270

100:                                              ; preds = %92
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #8
  %101 = load i32, ptr %21, align 4, !tbaa !5
  %102 = call i32 @llvm.ctpop.i32(i32 %101)
  store i32 %102, ptr %23, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %24) #8
  store i8 1, ptr %24, align 1, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #8
  store i64 0, ptr %25, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #8
  store i32 0, ptr %26, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %126, %100
  %104 = load i32, ptr %26, align 4, !tbaa !5
  %105 = load i32, ptr %2, align 4, !tbaa !5
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %103
  store i32 14, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #8
  br label %129

108:                                              ; preds = %103
  %109 = load i32, ptr %21, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = load i32, ptr %26, align 4, !tbaa !5
  %112 = zext i32 %111 to i64
  %113 = shl i64 1, %112
  %114 = and i64 %110, %113
  %115 = icmp ne i64 %114, 0
  br i1 %115, label %116, label %125

116:                                              ; preds = %108
  %117 = load i32, ptr %26, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @paths, i64 noundef %118) #8
  %120 = getelementptr inbounds %"struct.std::pair", ptr %119, i32 0, i32 0
  %121 = load i32, ptr %120, align 4, !tbaa !17
  %122 = sext i32 %121 to i64
  %123 = load i64, ptr %25, align 8, !tbaa !13
  %124 = add nsw i64 %123, %122
  store i64 %124, ptr %25, align 8, !tbaa !13
  br label %125

125:                                              ; preds = %116, %108
  br label %126

126:                                              ; preds = %125
  %127 = load i32, ptr %26, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %26, align 4, !tbaa !5
  br label %103, !llvm.loop !20

129:                                              ; preds = %107
  %130 = load i64, ptr %25, align 8, !tbaa !13
  %131 = load i64, ptr %20, align 8, !tbaa !13
  %132 = icmp sle i64 %130, %131
  br i1 %132, label %133, label %134

133:                                              ; preds = %129
  store i32 13, ptr %22, align 4
  br label %264

134:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #8
  store i32 0, ptr %27, align 4, !tbaa !5
  br label %135

135:                                              ; preds = %254, %134
  %136 = load i32, ptr %27, align 4, !tbaa !5
  %137 = load i32, ptr %1, align 4, !tbaa !5
  %138 = sub nsw i32 %137, 1
  %139 = icmp slt i32 %136, %138
  br i1 %139, label %141, label %140

140:                                              ; preds = %135
  store i32 17, ptr %22, align 4
  br label %257

141:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #8
  store i32 0, ptr %28, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #8
  %142 = load i32, ptr %27, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @edges, i64 noundef %143) #8
  %145 = getelementptr inbounds %"struct.std::pair", ptr %144, i32 0, i32 0
  %146 = load i32, ptr %145, align 4, !tbaa !17
  store i32 %146, ptr %29, align 4, !tbaa !5
  %147 = load i32, ptr %29, align 4, !tbaa !5
  %148 = load i32, ptr %23, align 4, !tbaa !5
  %149 = icmp sge i32 %147, %148
  br i1 %149, label %150, label %151

150:                                              ; preds = %141
  store i32 19, ptr %22, align 4
  br label %251

151:                                              ; preds = %141
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #8
  %152 = load i32, ptr %27, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @edges, i64 noundef %153) #8
  %155 = getelementptr inbounds %"struct.std::pair", ptr %154, i32 0, i32 1
  %156 = getelementptr inbounds %"struct.std::pair.5", ptr %155, i32 0, i32 0
  %157 = load i32, ptr %156, align 4, !tbaa !21
  store i32 %157, ptr %30, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #8
  %158 = load i32, ptr %27, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @edges, i64 noundef %159) #8
  %161 = getelementptr inbounds %"struct.std::pair", ptr %160, i32 0, i32 1
  %162 = getelementptr inbounds %"struct.std::pair.5", ptr %161, i32 0, i32 1
  %163 = load i32, ptr %162, align 4, !tbaa !22
  store i32 %163, ptr %31, align 4, !tbaa !5
  %164 = load i32, ptr %30, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [500100 x i32], ptr @l, i64 0, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = load i32, ptr %31, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [500100 x i32], ptr @l, i64 0, i64 %169
  %171 = load i32, ptr %170, align 4, !tbaa !5
  %172 = icmp sgt i32 %167, %171
  br i1 %172, label %173, label %174

173:                                              ; preds = %151
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %30, ptr noundef nonnull align 4 dereferenceable(4) %31) #8
  br label %174

174:                                              ; preds = %173, %151
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #8
  store i32 0, ptr %32, align 4, !tbaa !5
  br label %175

175:                                              ; preds = %241, %174
  %176 = load i32, ptr %32, align 4, !tbaa !5
  %177 = load i32, ptr %2, align 4, !tbaa !5
  %178 = icmp slt i32 %176, %177
  br i1 %178, label %179, label %183

179:                                              ; preds = %175
  %180 = load i32, ptr %28, align 4, !tbaa !5
  %181 = load i32, ptr %29, align 4, !tbaa !5
  %182 = icmp sle i32 %180, %181
  br label %183

183:                                              ; preds = %179, %175
  %184 = phi i1 [ false, %175 ], [ %182, %179 ]
  br i1 %184, label %186, label %185

185:                                              ; preds = %183
  store i32 20, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #8
  br label %244

186:                                              ; preds = %183
  %187 = load i32, ptr %21, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = load i32, ptr %32, align 4, !tbaa !5
  %190 = zext i32 %189 to i64
  %191 = shl i64 1, %190
  %192 = and i64 %188, %191
  %193 = icmp eq i64 %192, 0
  br i1 %193, label %194, label %195

194:                                              ; preds = %186
  br label %241

195:                                              ; preds = %186
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #8
  %196 = load i32, ptr %32, align 4, !tbaa !5
  %197 = sext i32 %196 to i64
  %198 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @paths, i64 noundef %197) #8
  %199 = getelementptr inbounds %"struct.std::pair", ptr %198, i32 0, i32 1
  %200 = getelementptr inbounds %"struct.std::pair.5", ptr %199, i32 0, i32 0
  %201 = load i32, ptr %200, align 4, !tbaa !21
  store i32 %201, ptr %33, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #8
  %202 = load i32, ptr %32, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @paths, i64 noundef %203) #8
  %205 = getelementptr inbounds %"struct.std::pair", ptr %204, i32 0, i32 1
  %206 = getelementptr inbounds %"struct.std::pair.5", ptr %205, i32 0, i32 1
  %207 = load i32, ptr %206, align 4, !tbaa !22
  store i32 %207, ptr %34, align 4, !tbaa !5
  %208 = load i32, ptr %33, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [500100 x i32], ptr @l, i64 0, i64 %209
  %211 = load i32, ptr %210, align 4, !tbaa !5
  %212 = load i32, ptr %30, align 4, !tbaa !5
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [500100 x i32], ptr @l, i64 0, i64 %213
  %215 = load i32, ptr %214, align 4, !tbaa !5
  %216 = icmp sle i32 %211, %215
  br i1 %216, label %217, label %240

217:                                              ; preds = %195
  %218 = load i32, ptr %31, align 4, !tbaa !5
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [500100 x i32], ptr @l, i64 0, i64 %219
  %221 = load i32, ptr %220, align 4, !tbaa !5
  %222 = load i32, ptr %34, align 4, !tbaa !5
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [500100 x i32], ptr @l, i64 0, i64 %223
  %225 = load i32, ptr %224, align 4, !tbaa !5
  %226 = icmp sle i32 %221, %225
  br i1 %226, label %227, label %240

227:                                              ; preds = %217
  %228 = load i32, ptr %34, align 4, !tbaa !5
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [500100 x i32], ptr @l, i64 0, i64 %229
  %231 = load i32, ptr %230, align 4, !tbaa !5
  %232 = load i32, ptr %31, align 4, !tbaa !5
  %233 = sext i32 %232 to i64
  %234 = getelementptr inbounds [500100 x i32], ptr @r, i64 0, i64 %233
  %235 = load i32, ptr %234, align 4, !tbaa !5
  %236 = icmp slt i32 %231, %235
  br i1 %236, label %237, label %240

237:                                              ; preds = %227
  %238 = load i32, ptr %28, align 4, !tbaa !5
  %239 = add nsw i32 %238, 1
  store i32 %239, ptr %28, align 4, !tbaa !5
  br label %240

240:                                              ; preds = %237, %227, %217, %195
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #8
  br label %241

241:                                              ; preds = %240, %194
  %242 = load i32, ptr %32, align 4, !tbaa !5
  %243 = add nsw i32 %242, 1
  store i32 %243, ptr %32, align 4, !tbaa !5
  br label %175, !llvm.loop !23

244:                                              ; preds = %185
  %245 = load i32, ptr %28, align 4, !tbaa !5
  %246 = load i32, ptr %29, align 4, !tbaa !5
  %247 = icmp sgt i32 %245, %246
  br i1 %247, label %248, label %249

248:                                              ; preds = %244
  store i8 0, ptr %24, align 1, !tbaa !15
  store i32 17, ptr %22, align 4
  br label %250

249:                                              ; preds = %244
  store i32 0, ptr %22, align 4
  br label %250

250:                                              ; preds = %249, %248
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #8
  br label %251

251:                                              ; preds = %250, %150
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #8
  %252 = load i32, ptr %22, align 4
  switch i32 %252, label %257 [
    i32 0, label %253
    i32 19, label %254
  ]

253:                                              ; preds = %251
  br label %254

254:                                              ; preds = %253, %251
  %255 = load i32, ptr %27, align 4, !tbaa !5
  %256 = add nsw i32 %255, 1
  store i32 %256, ptr %27, align 4, !tbaa !5
  br label %135, !llvm.loop !24

257:                                              ; preds = %251, %140
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #8
  br label %258

258:                                              ; preds = %257
  %259 = load i8, ptr %24, align 1, !tbaa !15, !range !25, !noundef !26
  %260 = trunc i8 %259 to i1
  br i1 %260, label %261, label %263

261:                                              ; preds = %258
  %262 = load i64, ptr %25, align 8, !tbaa !13
  store i64 %262, ptr %20, align 8, !tbaa !13
  br label %263

263:                                              ; preds = %261, %258
  store i32 0, ptr %22, align 4
  br label %264

264:                                              ; preds = %263, %133
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  %265 = load i32, ptr %22, align 4
  switch i32 %265, label %273 [
    i32 0, label %266
    i32 13, label %267
  ]

266:                                              ; preds = %264
  br label %267

267:                                              ; preds = %266, %264
  %268 = load i32, ptr %21, align 4, !tbaa !5
  %269 = add nsw i32 %268, 1
  store i32 %269, ptr %21, align 4, !tbaa !5
  br label %92, !llvm.loop !27

270:                                              ; preds = %99
  %271 = load i64, ptr %20, align 8, !tbaa !13
  %272 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i64 noundef %271)
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #8
  ret void

273:                                              ; preds = %264
  unreachable
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #3

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #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) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIiS2_IiiEESt6vectorIS4_SaIS4_EEEEPFbRKS4_SB_EEvT_SE_T0_(ptr, ptr, ptr noundef) #5

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.ctpop.i32(i32) #6

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #7

declare i32 @printf(ptr noundef, ...) #3

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


; 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<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, %"struct.std::pair.5" }
%"struct.std::pair.5" = type { i32, i32 }

@g = external dso_local global [500100 x %"class.std::vector"], align 16
@paths = external dso_local global %"class.std::vector.0", align 8
@edges = external dso_local global %"class.std::vector.0", align 8
@bad = external dso_local local_unnamed_addr global [1010 x i32], align 16
@l = external dso_local local_unnamed_addr global [500100 x i32], align 16
@r = external dso_local local_unnamed_addr global [500100 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsii(i32 noundef, i32 noundef) local_unnamed_addr #0

; 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 zeroext i1 @_Z3cmpRKSt4pairIiS_IiiEES3_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca %"struct.std::pair.5", align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::pair", align 8
  %12 = alloca %"struct.std::pair.5", align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %16 = load i32, ptr %1, align 4, !tbaa !5
  %.not80 = icmp slt i32 %16, 1
  br i1 %.not80, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @edges) #7
  %17 = load i32, ptr %1, align 4, !tbaa !5
  %18 = icmp sgt i32 %17, 1
  br i1 %18, label %.lr.ph84, label %._crit_edge85

.lr.ph84:                                         ; preds = %._crit_edge
  %.sroa.244.0..sroa_idx = getelementptr inbounds i8, ptr %6, i64 8
  br label %24

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %19 = getelementptr inbounds [500100 x %"class.std::vector"], ptr @g, i64 0, i64 %indvars.iv
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = load i32, ptr %1, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %.not.not = icmp slt i64 %indvars.iv, %21
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge85:                                    ; preds = %24, %._crit_edge
  call void @_Z3dfsii(i32 noundef 1, i32 noundef -1)
  call void @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @paths) #7
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = icmp sgt i32 %22, 0
  br i1 %23, label %.lr.ph88, label %._crit_edge89

.lr.ph88:                                         ; preds = %._crit_edge85
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %11, i64 8
  br label %43

24:                                               ; preds = %.lr.ph84, %24
  %.05082 = phi i32 [ 1, %.lr.ph84 ], [ %34, %24 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [500100 x %"class.std::vector"], ptr @g, i64 0, i64 %27
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %28, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [500100 x %"class.std::vector"], ptr @g, i64 0, i64 %30
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %31, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %32 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %32, ptr %7, align 8
  %33 = call { i64, i32 } @_ZSt9make_pairIRiSt4pairIiiEES1_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(8) %7)
  %.fca.0.extract41 = extractvalue { i64, i32 } %33, 0
  %.fca.1.extract42 = extractvalue { i64, i32 } %33, 1
  store i64 %.fca.0.extract41, ptr %6, align 8
  store i32 %.fca.1.extract42, ptr %.sroa.244.0..sroa_idx, align 8
  call void @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) @edges, ptr noundef nonnull align 4 dereferenceable(12) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %34 = add nuw nsw i32 %.05082, 1
  %35 = load i32, ptr %1, align 4, !tbaa !5
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %24, label %._crit_edge85, !llvm.loop !11

._crit_edge89:                                    ; preds = %43, %._crit_edge85
  %37 = call ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @paths) #7
  %38 = call ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @paths) #7
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIiS2_IiiEESt6vectorIS4_SaIS4_EEEEPFbRKS4_SB_EEvT_SE_T0_(ptr %37, ptr %38, ptr noundef nonnull @_Z3cmpRKSt4pairIiS_IiiEES3_)
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = zext nneg i32 %39 to i64
  %41 = shl nuw i64 1, %40
  %42 = icmp sgt i64 %41, 1
  br i1 %42, label %.lr.ph110, label %._crit_edge111

43:                                               ; preds = %.lr.ph88, %43
  %indvars.iv114 = phi i64 [ 0, %.lr.ph88 ], [ %indvars.iv.next115, %43 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #7
  %44 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %10)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %11) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #7
  %45 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
  store i64 %45, ptr %12, align 8
  %46 = call { i64, i32 } @_ZSt9make_pairIRiSt4pairIiiEES1_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(8) %12)
  %.fca.0.extract = extractvalue { i64, i32 } %46, 0
  %.fca.1.extract = extractvalue { i64, i32 } %46, 1
  store i64 %.fca.0.extract, ptr %11, align 8
  store i32 %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  call void @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) @paths, ptr noundef nonnull align 4 dereferenceable(12) %11)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %11) #7
  %47 = getelementptr inbounds [1010 x i32], ptr @bad, i64 0, i64 %indvars.iv114
  store i32 0, ptr %47, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  %indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = icmp slt i64 %indvars.iv.next115, %49
  br i1 %50, label %43, label %._crit_edge89, !llvm.loop !12

._crit_edge111:                                   ; preds = %.loopexit, %._crit_edge89
  %.061.lcssa = phi i64 [ 0, %._crit_edge89 ], [ %.263, %.loopexit ]
  %51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %.061.lcssa)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret void

.lr.ph110:                                        ; preds = %._crit_edge89, %.loopexit
  %52 = phi i32 [ %136, %.loopexit ], [ %39, %._crit_edge89 ]
  %indvars.iv126 = phi i64 [ %indvars.iv.next127, %.loopexit ], [ 1, %._crit_edge89 ]
  %.061108 = phi i64 [ %.263, %.loopexit ], [ 0, %._crit_edge89 ]
  %53 = trunc nuw nsw i64 %indvars.iv126 to i32
  %54 = call range(i32 0, 32) i32 @llvm.ctpop.i32(i32 %53)
  %55 = icmp sgt i32 %52, 0
  br i1 %55, label %.lr.ph93, label %._crit_edge94

._crit_edge94:                                    ; preds = %67, %.lr.ph110
  %56 = phi i32 [ %52, %.lr.ph110 ], [ %68, %67 ]
  %.056.lcssa = phi i64 [ 0, %.lr.ph110 ], [ %.157, %67 ]
  %.not70 = icmp sgt i64 %.056.lcssa, %.061108
  br i1 %.not70, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %._crit_edge94
  %57 = load i32, ptr %1, align 4, !tbaa !5
  %.not79101 = icmp sgt i32 %57, 1
  br i1 %.not79101, label %.lr.ph103, label %.loopexit

.lr.ph93:                                         ; preds = %.lr.ph110, %67
  %58 = phi i32 [ %68, %67 ], [ %52, %.lr.ph110 ]
  %59 = phi i32 [ %69, %67 ], [ %52, %.lr.ph110 ]
  %indvars.iv117 = phi i64 [ %indvars.iv.next118, %67 ], [ 0, %.lr.ph110 ]
  %.05690 = phi i64 [ %.157, %67 ], [ 0, %.lr.ph110 ]
  %60 = shl nuw i64 1, %indvars.iv117
  %61 = and i64 %60, %indvars.iv126
  %.not74 = icmp eq i64 %61, 0
  br i1 %.not74, label %67, label %62

62:                                               ; preds = %.lr.ph93
  %63 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @paths, i64 noundef %indvars.iv117) #7
  %64 = load i32, ptr %63, align 4, !tbaa !13
  %65 = sext i32 %64 to i64
  %66 = add nsw i64 %.05690, %65
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %.lr.ph93, %62
  %68 = phi i32 [ %.pre, %62 ], [ %58, %.lr.ph93 ]
  %69 = phi i32 [ %.pre, %62 ], [ %59, %.lr.ph93 ]
  %.157 = phi i64 [ %66, %62 ], [ %.05690, %.lr.ph93 ]
  %indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
  %70 = sext i32 %69 to i64
  %71 = icmp slt i64 %indvars.iv.next118, %70
  br i1 %71, label %.lr.ph93, label %._crit_edge94, !llvm.loop !16

.lr.ph103:                                        ; preds = %.preheader, %132
  %indvars.iv123 = phi i64 [ %indvars.iv.next124, %132 ], [ 0, %.preheader ]
  %72 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @edges, i64 noundef %indvars.iv123) #7
  %73 = load i32, ptr %72, align 4, !tbaa !13
  %.not71 = icmp slt i32 %73, %54
  br i1 %.not71, label %74, label %132

74:                                               ; preds = %.lr.ph103
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #7
  %75 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @edges, i64 noundef %indvars.iv123) #7
  %76 = getelementptr inbounds i8, ptr %75, i64 4
  %77 = load i32, ptr %76, align 4, !tbaa !17
  store i32 %77, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %14) #7
  %78 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @edges, i64 noundef %indvars.iv123) #7
  %79 = getelementptr inbounds i8, ptr %78, i64 8
  %80 = load i32, ptr %79, align 4, !tbaa !18
  store i32 %80, ptr %14, align 4, !tbaa !5
  %81 = load i32, ptr %13, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [500100 x i32], ptr @l, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = sext i32 %80 to i64
  %86 = getelementptr inbounds [500100 x i32], ptr @l, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = icmp sgt i32 %84, %87
  br i1 %88, label %89, label %90

89:                                               ; preds = %74
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %14) #7
  br label %90

90:                                               ; preds = %89, %74
  %91 = load i32, ptr %2, align 4, !tbaa !5
  %92 = icmp sgt i32 %91, 0
  %93 = icmp sgt i32 %73, -1
  %94 = and i1 %92, %93
  br i1 %94, label %.lr.ph98, label %._crit_edge99

._crit_edge99:                                    ; preds = %126, %90
  %.pre129131 = phi i32 [ %91, %90 ], [ %127, %126 ]
  %.053.lcssa = phi i32 [ 0, %90 ], [ %.2, %126 ]
  %95 = icmp sgt i32 %.053.lcssa, %73
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #7
  br i1 %95, label %.loopexit, label %132

.lr.ph98:                                         ; preds = %90, %126
  %indvars.iv120 = phi i64 [ %indvars.iv.next121, %126 ], [ 0, %90 ]
  %.05395 = phi i32 [ %.2, %126 ], [ 0, %90 ]
  %96 = shl nuw i64 1, %indvars.iv120
  %97 = and i64 %96, %indvars.iv126
  %98 = icmp eq i64 %97, 0
  br i1 %98, label %126, label %99

99:                                               ; preds = %.lr.ph98
  %100 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @paths, i64 noundef %indvars.iv120) #7
  %101 = getelementptr inbounds i8, ptr %100, i64 4
  %102 = load i32, ptr %101, align 4, !tbaa !17
  %103 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @paths, i64 noundef %indvars.iv120) #7
  %104 = sext i32 %102 to i64
  %105 = getelementptr inbounds [500100 x i32], ptr @l, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = load i32, ptr %13, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [500100 x i32], ptr @l, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %.not72 = icmp sgt i32 %106, %110
  br i1 %.not72, label %126, label %111

111:                                              ; preds = %99
  %112 = getelementptr inbounds i8, ptr %103, i64 8
  %113 = load i32, ptr %112, align 4, !tbaa !18
  %114 = load i32, ptr %14, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [500100 x i32], ptr @l, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = sext i32 %113 to i64
  %119 = getelementptr inbounds [500100 x i32], ptr @l, i64 0, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !5
  %.not73 = icmp sgt i32 %117, %120
  br i1 %.not73, label %126, label %121

121:                                              ; preds = %111
  %122 = getelementptr inbounds [500100 x i32], ptr @r, i64 0, i64 %115
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = icmp slt i32 %120, %123
  %125 = zext i1 %124 to i32
  %spec.select = add nsw i32 %.05395, %125
  br label %126

126:                                              ; preds = %121, %99, %111, %.lr.ph98
  %.2 = phi i32 [ %.05395, %.lr.ph98 ], [ %.05395, %111 ], [ %.05395, %99 ], [ %spec.select, %121 ]
  %indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
  %127 = load i32, ptr %2, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = icmp slt i64 %indvars.iv.next121, %128
  %130 = icmp sle i32 %.2, %73
  %131 = select i1 %129, i1 %130, i1 false
  br i1 %131, label %.lr.ph98, label %._crit_edge99, !llvm.loop !19

132:                                              ; preds = %._crit_edge99, %.lr.ph103
  %indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
  %133 = load i32, ptr %1, align 4, !tbaa !5
  %134 = add nsw i32 %133, -1
  %135 = sext i32 %134 to i64
  %.not79 = icmp slt i64 %indvars.iv.next124, %135
  br i1 %.not79, label %.lr.ph103, label %..loopexit.loopexit_crit_edge, !llvm.loop !20

..loopexit.loopexit_crit_edge:                    ; preds = %132
  %.pre129.pre = load i32, ptr %2, align 4, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %._crit_edge99, %..loopexit.loopexit_crit_edge, %.preheader, %._crit_edge94
  %136 = phi i32 [ %56, %._crit_edge94 ], [ %56, %.preheader ], [ %.pre129.pre, %..loopexit.loopexit_crit_edge ], [ %.pre129131, %._crit_edge99 ]
  %.263 = phi i64 [ %.061108, %._crit_edge94 ], [ %.056.lcssa, %.preheader ], [ %.056.lcssa, %..loopexit.loopexit_crit_edge ], [ %.061108, %._crit_edge99 ]
  %indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
  %137 = zext nneg i32 %136 to i64
  %138 = shl nuw i64 1, %137
  %139 = icmp sgt i64 %138, %indvars.iv.next127
  br i1 %139, label %.lr.ph110, label %._crit_edge111, !llvm.loop !21
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

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

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.ctpop.i32(i32) #5

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

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


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