; LLVM IR from eyangch/competitive-programming :: USACOcontests/gold/2014.01 (skilevel)

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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl" }
%"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl" = type { %"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl_data" }
%"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%struct.edge = type { i64, i64, i64 }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@M = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@T = external dso_local global i64, align 8
@b = external dso_local global [500 x [500 x i64]], align 16
@g = external dso_local global %"class.std::vector", align 8
@par = external dso_local global [250000 x i64], align 16
@sz = external dso_local global [250000 x i64], align 16
@hstart = external dso_local global [250000 x i64], align 16
@ans = external dso_local global i64, align 8
@.str.6 = external hidden unnamed_addr constant [9 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5setIONSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef) #0

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4cmpe4edgeS_(ptr noundef byval(%struct.edge) align 8, ptr noundef byval(%struct.edge) align 8) #2

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::__cxx11::basic_string", align 8
  %3 = alloca %"class.std::allocator", align 1
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca %struct.edge, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca %struct.edge, align 8
  %15 = alloca %struct.edge, align 8
  %16 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %17 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %21 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %22 = alloca %struct.edge, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef @.str.6, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %23 unwind label %33

23:                                               ; preds = %0
  invoke void @_Z5setIONSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef %2)
          to label %24 unwind label %37

24:                                               ; preds = %23
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #7
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #7
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef nonnull align 8 dereferenceable(8) @T)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 0, ptr %6, align 8, !tbaa !5
  br label %28

28:                                               ; preds = %58, %24
  %29 = load i64, ptr %6, align 8, !tbaa !5
  %30 = load i64, ptr @M, align 8, !tbaa !5
  %31 = icmp slt i64 %29, %30
  br i1 %31, label %42, label %32

32:                                               ; preds = %28
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %61

33:                                               ; preds = %0
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %4, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %5, align 4
  br label %41

37:                                               ; preds = %23
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %4, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %5, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #7
  br label %41

41:                                               ; preds = %37, %33
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #7
  br label %199

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

43:                                               ; preds = %54, %42
  %44 = load i64, ptr %8, align 8, !tbaa !5
  %45 = load i64, ptr @N, align 8, !tbaa !5
  %46 = icmp slt i64 %44, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %43
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %57

48:                                               ; preds = %43
  %49 = load i64, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds [500 x [500 x i64]], ptr @b, i64 0, i64 %49
  %51 = load i64, ptr %8, align 8, !tbaa !5
  %52 = getelementptr inbounds [500 x i64], ptr %50, i64 0, i64 %51
  %53 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %52)
  br label %54

54:                                               ; preds = %48
  %55 = load i64, ptr %8, align 8, !tbaa !5
  %56 = add nsw i64 %55, 1
  store i64 %56, ptr %8, align 8, !tbaa !5
  br label %43, !llvm.loop !9

57:                                               ; preds = %47
  br label %58

58:                                               ; preds = %57
  %59 = load i64, ptr %6, align 8, !tbaa !5
  %60 = add nsw i64 %59, 1
  store i64 %60, ptr %6, align 8, !tbaa !5
  br label %28, !llvm.loop !11

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

62:                                               ; preds = %83, %61
  %63 = load i64, ptr %9, align 8, !tbaa !5
  %64 = load i64, ptr @M, align 8, !tbaa !5
  %65 = icmp slt i64 %63, %64
  br i1 %65, label %67, label %66

66:                                               ; preds = %62
  store i32 8, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %86

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

68:                                               ; preds = %79, %67
  %69 = load i64, ptr %10, align 8, !tbaa !5
  %70 = load i64, ptr @N, align 8, !tbaa !5
  %71 = icmp slt i64 %69, %70
  br i1 %71, label %73, label %72

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

73:                                               ; preds = %68
  %74 = load i64, ptr %9, align 8, !tbaa !5
  %75 = load i64, ptr %10, align 8, !tbaa !5
  %76 = call noundef i64 @_Z3cvtxx(i64 noundef %74, i64 noundef %75)
  %77 = getelementptr inbounds [250000 x i64], ptr @hstart, i64 0, i64 %76
  %78 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %77)
  br label %79

79:                                               ; preds = %73
  %80 = load i64, ptr %10, align 8, !tbaa !5
  %81 = add nsw i64 %80, 1
  store i64 %81, ptr %10, align 8, !tbaa !5
  br label %68, !llvm.loop !12

82:                                               ; preds = %72
  br label %83

83:                                               ; preds = %82
  %84 = load i64, ptr %9, align 8, !tbaa !5
  %85 = add nsw i64 %84, 1
  store i64 %85, ptr %9, align 8, !tbaa !5
  br label %62, !llvm.loop !13

86:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store i64 0, ptr %12, align 8, !tbaa !5
  br label %87

87:                                               ; preds = %157, %86
  %88 = load i64, ptr %12, align 8, !tbaa !5
  %89 = load i64, ptr @M, align 8, !tbaa !5
  %90 = icmp slt i64 %88, %89
  br i1 %90, label %92, label %91

91:                                               ; preds = %87
  store i32 14, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %160

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

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

97:                                               ; preds = %93
  store i32 17, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %156

98:                                               ; preds = %93
  %99 = load i64, ptr %12, align 8, !tbaa !5
  %100 = icmp sgt i64 %99, 0
  br i1 %100, label %101, label %125

101:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #7
  %102 = getelementptr inbounds %struct.edge, ptr %14, i32 0, i32 0
  %103 = load i64, ptr %12, align 8, !tbaa !5
  %104 = load i64, ptr %13, align 8, !tbaa !5
  %105 = call noundef i64 @_Z3cvtxx(i64 noundef %103, i64 noundef %104)
  store i64 %105, ptr %102, align 8, !tbaa !14
  %106 = getelementptr inbounds %struct.edge, ptr %14, i32 0, i32 1
  %107 = load i64, ptr %12, align 8, !tbaa !5
  %108 = sub nsw i64 %107, 1
  %109 = load i64, ptr %13, align 8, !tbaa !5
  %110 = call noundef i64 @_Z3cvtxx(i64 noundef %108, i64 noundef %109)
  store i64 %110, ptr %106, align 8, !tbaa !16
  %111 = getelementptr inbounds %struct.edge, ptr %14, i32 0, i32 2
  %112 = load i64, ptr %12, align 8, !tbaa !5
  %113 = getelementptr inbounds [500 x [500 x i64]], ptr @b, i64 0, i64 %112
  %114 = load i64, ptr %13, align 8, !tbaa !5
  %115 = getelementptr inbounds [500 x i64], ptr %113, i64 0, i64 %114
  %116 = load i64, ptr %115, align 8, !tbaa !5
  %117 = load i64, ptr %12, align 8, !tbaa !5
  %118 = sub nsw i64 %117, 1
  %119 = getelementptr inbounds [500 x [500 x i64]], ptr @b, i64 0, i64 %118
  %120 = load i64, ptr %13, align 8, !tbaa !5
  %121 = getelementptr inbounds [500 x i64], ptr %119, i64 0, i64 %120
  %122 = load i64, ptr %121, align 8, !tbaa !5
  %123 = sub nsw i64 %116, %122
  %124 = call noundef i64 @_ZSt3absx(i64 noundef %123)
  store i64 %124, ptr %111, align 8, !tbaa !17
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %14, i64 24, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #7
  call void @_ZNSt6vectorI4edgeSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24) @g, ptr noundef nonnull align 8 dereferenceable(24) %11)
  br label %125

125:                                              ; preds = %101, %98
  %126 = load i64, ptr %13, align 8, !tbaa !5
  %127 = icmp sgt i64 %126, 0
  br i1 %127, label %128, label %152

128:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #7
  %129 = getelementptr inbounds %struct.edge, ptr %15, i32 0, i32 0
  %130 = load i64, ptr %12, align 8, !tbaa !5
  %131 = load i64, ptr %13, align 8, !tbaa !5
  %132 = call noundef i64 @_Z3cvtxx(i64 noundef %130, i64 noundef %131)
  store i64 %132, ptr %129, align 8, !tbaa !14
  %133 = getelementptr inbounds %struct.edge, ptr %15, i32 0, i32 1
  %134 = load i64, ptr %12, align 8, !tbaa !5
  %135 = load i64, ptr %13, align 8, !tbaa !5
  %136 = sub nsw i64 %135, 1
  %137 = call noundef i64 @_Z3cvtxx(i64 noundef %134, i64 noundef %136)
  store i64 %137, ptr %133, align 8, !tbaa !16
  %138 = getelementptr inbounds %struct.edge, ptr %15, i32 0, i32 2
  %139 = load i64, ptr %12, align 8, !tbaa !5
  %140 = getelementptr inbounds [500 x [500 x i64]], ptr @b, i64 0, i64 %139
  %141 = load i64, ptr %13, align 8, !tbaa !5
  %142 = getelementptr inbounds [500 x i64], ptr %140, i64 0, i64 %141
  %143 = load i64, ptr %142, align 8, !tbaa !5
  %144 = load i64, ptr %12, align 8, !tbaa !5
  %145 = getelementptr inbounds [500 x [500 x i64]], ptr @b, i64 0, i64 %144
  %146 = load i64, ptr %13, align 8, !tbaa !5
  %147 = sub nsw i64 %146, 1
  %148 = getelementptr inbounds [500 x i64], ptr %145, i64 0, i64 %147
  %149 = load i64, ptr %148, align 8, !tbaa !5
  %150 = sub nsw i64 %143, %149
  %151 = call noundef i64 @_ZSt3absx(i64 noundef %150)
  store i64 %151, ptr %138, align 8, !tbaa !17
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %15, i64 24, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #7
  call void @_ZNSt6vectorI4edgeSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24) @g, ptr noundef nonnull align 8 dereferenceable(24) %11)
  br label %152

152:                                              ; preds = %128, %125
  br label %153

153:                                              ; preds = %152
  %154 = load i64, ptr %13, align 8, !tbaa !5
  %155 = add nsw i64 %154, 1
  store i64 %155, ptr %13, align 8, !tbaa !5
  br label %93, !llvm.loop !19

156:                                              ; preds = %97
  br label %157

157:                                              ; preds = %156
  %158 = load i64, ptr %12, align 8, !tbaa !5
  %159 = add nsw i64 %158, 1
  store i64 %159, ptr %12, align 8, !tbaa !5
  br label %87, !llvm.loop !20

160:                                              ; preds = %91
  %161 = call ptr @_ZNSt6vectorI4edgeSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @g) #7
  %162 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  store ptr %161, ptr %162, align 8
  %163 = call ptr @_ZNSt6vectorI4edgeSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @g) #7
  %164 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  store ptr %163, ptr %164, align 8
  %165 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  %166 = load ptr, ptr %165, align 8
  %167 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  %168 = load ptr, ptr %167, align 8
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIP4edgeSt6vectorIS2_SaIS2_EEEEPFbS2_S2_EEvT_SA_T0_(ptr %166, ptr %168, ptr noundef @_Z4cmpe4edgeS_)
  %169 = load i64, ptr @N, align 8, !tbaa !5
  %170 = load i64, ptr @M, align 8, !tbaa !5
  %171 = mul nsw i64 %169, %170
  %172 = getelementptr inbounds i64, ptr @sz, i64 %171
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  store i32 1, ptr %18, align 4, !tbaa !21
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @sz, ptr noundef %172, ptr noundef nonnull align 4 dereferenceable(4) %18)
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  %173 = load i64, ptr @N, align 8, !tbaa !5
  %174 = load i64, ptr @M, align 8, !tbaa !5
  %175 = mul nsw i64 %173, %174
  %176 = getelementptr inbounds i64, ptr @par, i64 %175
  call void @_ZSt4iotaIPxiEvT_S1_T0_(ptr noundef @par, ptr noundef %176, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  store ptr @g, ptr %19, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %177 = call ptr @_ZNSt6vectorI4edgeSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @g) #7
  %178 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %20, i32 0, i32 0
  store ptr %177, ptr %178, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %179 = call ptr @_ZNSt6vectorI4edgeSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @g) #7
  %180 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %21, i32 0, i32 0
  store ptr %179, ptr %180, align 8
  br label %181

181:                                              ; preds = %192, %160
  %182 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP4edgeSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  br i1 %182, label %184, label %183

183:                                              ; preds = %181
  store i32 20, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  br label %194

184:                                              ; preds = %181
  call void @llvm.lifetime.start.p0(i64 24, ptr %22) #7
  %185 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP4edgeSt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %20) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %22, ptr align 8 %185, i64 24, i1 false), !tbaa.struct !18
  %186 = getelementptr inbounds %struct.edge, ptr %22, i32 0, i32 0
  %187 = load i64, ptr %186, align 8, !tbaa !14
  %188 = getelementptr inbounds %struct.edge, ptr %22, i32 0, i32 1
  %189 = load i64, ptr %188, align 8, !tbaa !16
  %190 = getelementptr inbounds %struct.edge, ptr %22, i32 0, i32 2
  %191 = load i64, ptr %190, align 8, !tbaa !17
  call void @_Z2unxxx(i64 noundef %187, i64 noundef %189, i64 noundef %191)
  call void @llvm.lifetime.end.p0(i64 24, ptr %22) #7
  br label %192

192:                                              ; preds = %184
  %193 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIP4edgeSt6vectorIS1_SaIS1_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %20) #7
  br label %181

194:                                              ; preds = %183
  %195 = load i64, ptr @ans, align 8, !tbaa !5
  %196 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %195)
  %197 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %196, ptr noundef @.str.7)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #7
  %198 = load i32, ptr %1, align 4
  ret i32 %198

199:                                              ; preds = %41
  %200 = load ptr, ptr %4, align 8
  %201 = load i32, ptr %5, align 4
  %202 = insertvalue { ptr, i32 } poison, ptr %200, 0
  %203 = insertvalue { ptr, i32 } %202, i32 %201, 1
  resume { ptr, i32 } %203
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt3absx(i64 noundef) #4

; 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) #5

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZSt4iotaIPxiEvT_S1_T0_(ptr noundef, ptr noundef, i32 noundef) #2

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

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

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

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

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

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

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

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl" }
%"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl" = type { %"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl_data" }
%"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%struct.edge = type { i64, i64, i64 }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@M = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@T = external dso_local global i64, align 8
@b = external dso_local global [500 x [500 x i64]], align 16
@g = external dso_local global %"class.std::vector", align 8
@par = external dso_local global [250000 x i64], align 16
@sz = external dso_local global [250000 x i64], align 16
@hstart = external dso_local global [250000 x i64], align 16
@ans = external dso_local local_unnamed_addr global i64, align 8
@.str.6 = external hidden unnamed_addr constant [9 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5setIONSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4cmpe4edgeS_(ptr noundef byval(%struct.edge) align 8, ptr noundef byval(%struct.edge) align 8) #2

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::__cxx11::basic_string", align 8
  %2 = alloca %"class.std::allocator", align 1
  %3 = alloca %struct.edge, align 8
  %4 = alloca i32, align 4
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull @.str.6, ptr noundef nonnull align 1 dereferenceable(1) %2)
          to label %7 unwind label %21

7:                                                ; preds = %0
  invoke void @_Z5setIONSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull %1)
          to label %8 unwind label %23

8:                                                ; preds = %7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #6
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(8) @T)
  %12 = load i64, ptr @M, align 8, !tbaa !5
  %13 = icmp sgt i64 %12, 0
  br i1 %13, label %.preheader55.lr.ph, label %._crit_edge62.thread83

.preheader55.lr.ph:                               ; preds = %8
  %14 = load i64, ptr @N, align 8, !tbaa !5
  %15 = icmp sgt i64 %14, 0
  br i1 %15, label %.preheader55, label %._crit_edge62.thread

.preheader55:                                     ; preds = %.preheader55.lr.ph, %._crit_edge
  %16 = phi i64 [ %26, %._crit_edge ], [ %12, %.preheader55.lr.ph ]
  %17 = phi i64 [ %27, %._crit_edge ], [ %14, %.preheader55.lr.ph ]
  %.04557 = phi i64 [ %28, %._crit_edge ], [ 0, %.preheader55.lr.ph ]
  %18 = icmp sgt i64 %17, 0
  br i1 %18, label %.lr.ph, label %._crit_edge

.preheader54:                                     ; preds = %._crit_edge
  %19 = icmp sgt i64 %26, 0
  br i1 %19, label %.preheader53.lr.ph, label %._crit_edge62.thread83

.preheader53.lr.ph:                               ; preds = %.preheader54
  %.pr = load i64, ptr @N, align 8, !tbaa !5
  %20 = icmp sgt i64 %.pr, 0
  br i1 %20, label %.preheader53, label %._crit_edge62.thread

21:                                               ; preds = %0
  %22 = landingpad { ptr, i32 }
          cleanup
  br label %25

23:                                               ; preds = %7
  %24 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #6
  br label %25

25:                                               ; preds = %23, %21
  %.pn = phi { ptr, i32 } [ %24, %23 ], [ %22, %21 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #6
  resume { ptr, i32 } %.pn

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i64, ptr @M, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader55
  %26 = phi i64 [ %.pre, %._crit_edge.loopexit ], [ %16, %.preheader55 ]
  %27 = phi i64 [ %33, %._crit_edge.loopexit ], [ %17, %.preheader55 ]
  %28 = add nuw nsw i64 %.04557, 1
  %29 = icmp slt i64 %28, %26
  br i1 %29, label %.preheader55, label %.preheader54, !llvm.loop !9

.lr.ph:                                           ; preds = %.preheader55, %.lr.ph
  %.04656 = phi i64 [ %32, %.lr.ph ], [ 0, %.preheader55 ]
  %30 = getelementptr inbounds [500 x [500 x i64]], ptr @b, i64 0, i64 %.04557, i64 %.04656
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %30)
  %32 = add nuw nsw i64 %.04656, 1
  %33 = load i64, ptr @N, align 8, !tbaa !5
  %34 = icmp slt i64 %32, %33
  br i1 %34, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !12

.preheader53:                                     ; preds = %.preheader53.lr.ph, %._crit_edge60
  %35 = phi i64 [ %41, %._crit_edge60 ], [ %26, %.preheader53.lr.ph ]
  %36 = phi i64 [ %42, %._crit_edge60 ], [ %.pr, %.preheader53.lr.ph ]
  %.04761 = phi i64 [ %43, %._crit_edge60 ], [ 0, %.preheader53.lr.ph ]
  %37 = icmp sgt i64 %36, 0
  br i1 %37, label %.lr.ph59, label %._crit_edge60

._crit_edge62.thread:                             ; preds = %.preheader53.lr.ph, %.preheader55.lr.ph
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  br label %.preheader.lr.ph

._crit_edge62.thread83:                           ; preds = %.preheader54, %8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  br label %._crit_edge68

._crit_edge62:                                    ; preds = %._crit_edge60
  %38 = icmp sgt i64 %41, 0
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  br i1 %38, label %.preheader.lr.ph, label %._crit_edge68

.preheader.lr.ph:                                 ; preds = %._crit_edge62.thread, %._crit_edge62
  %.sroa.47.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  %.sroa.58.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 16
  %39 = load i64, ptr @N, align 8, !tbaa !5
  %40 = icmp sgt i64 %39, 0
  br i1 %40, label %.preheader, label %._crit_edge68

._crit_edge60.loopexit:                           ; preds = %.lr.ph59
  %.pre78 = load i64, ptr @M, align 8, !tbaa !5
  br label %._crit_edge60

._crit_edge60:                                    ; preds = %._crit_edge60.loopexit, %.preheader53
  %41 = phi i64 [ %.pre78, %._crit_edge60.loopexit ], [ %35, %.preheader53 ]
  %42 = phi i64 [ %49, %._crit_edge60.loopexit ], [ %36, %.preheader53 ]
  %43 = add nuw nsw i64 %.04761, 1
  %44 = icmp slt i64 %43, %41
  br i1 %44, label %.preheader53, label %._crit_edge62, !llvm.loop !13

.lr.ph59:                                         ; preds = %.preheader53, %.lr.ph59
  %.04858 = phi i64 [ %48, %.lr.ph59 ], [ 0, %.preheader53 ]
  %45 = call noundef i64 @_Z3cvtxx(i64 noundef %.04761, i64 noundef %.04858)
  %46 = getelementptr inbounds [250000 x i64], ptr @hstart, i64 0, i64 %45
  %47 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %46)
  %48 = add nuw nsw i64 %.04858, 1
  %49 = load i64, ptr @N, align 8, !tbaa !5
  %50 = icmp slt i64 %48, %49
  br i1 %50, label %.lr.ph59, label %._crit_edge60.loopexit, !llvm.loop !14

.preheader:                                       ; preds = %.preheader.lr.ph, %._crit_edge65
  %51 = phi i64 [ %90, %._crit_edge65 ], [ %39, %.preheader.lr.ph ]
  %52 = phi i64 [ %91, %._crit_edge65 ], [ %39, %.preheader.lr.ph ]
  %.04966 = phi i64 [ %92, %._crit_edge65 ], [ 0, %.preheader.lr.ph ]
  %53 = icmp sgt i64 %52, 0
  br i1 %53, label %.lr.ph64, label %._crit_edge65

.lr.ph64:                                         ; preds = %.preheader
  %.not = icmp eq i64 %.04966, 0
  %54 = add nsw i64 %.04966, -1
  br i1 %.not, label %.lr.ph64.split.us.preheader, label %55

55:                                               ; preds = %.lr.ph64
  %56 = call noundef i64 @_Z3cvtxx(i64 noundef %.04966, i64 noundef 0)
  %57 = call noundef i64 @_Z3cvtxx(i64 noundef %54, i64 noundef 0)
  %58 = getelementptr inbounds [500 x [500 x i64]], ptr @b, i64 0, i64 %.04966, i64 0
  %59 = load i64, ptr %58, align 16, !tbaa !5
  %60 = getelementptr inbounds [500 x [500 x i64]], ptr @b, i64 0, i64 %54, i64 0
  %61 = load i64, ptr %60, align 16, !tbaa !5
  %62 = sub nsw i64 %59, %61
  %63 = call noundef i64 @_ZSt3absx(i64 noundef %62)
  store i64 %56, ptr %3, align 8, !tbaa !5
  store i64 %57, ptr %.sroa.47.0..sroa_idx, align 8, !tbaa !5
  store i64 %63, ptr %.sroa.58.0..sroa_idx, align 8, !tbaa !5
  call void @_ZNSt6vectorI4edgeSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24) @g, ptr noundef nonnull align 8 dereferenceable(24) %3)
  %.pre79 = load i64, ptr @N, align 8, !tbaa !5
  %64 = icmp sgt i64 %.pre79, 1
  br i1 %64, label %.lr.ph64.split.peel.next, label %._crit_edge65

.lr.ph64.split.us.preheader:                      ; preds = %.lr.ph64
  %65 = icmp sgt i64 %51, 1
  br i1 %65, label %.lr.ph64.split.us.peel.next, label %._crit_edge65

.lr.ph64.split.us.peel.next:                      ; preds = %.lr.ph64.split.us.preheader, %.lr.ph64.split.us.peel.next
  %.05063.us = phi i64 [ %75, %.lr.ph64.split.us.peel.next ], [ 1, %.lr.ph64.split.us.preheader ]
  %66 = call noundef i64 @_Z3cvtxx(i64 noundef 0, i64 noundef %.05063.us)
  %67 = add nsw i64 %.05063.us, -1
  %68 = call noundef i64 @_Z3cvtxx(i64 noundef 0, i64 noundef %67)
  %69 = getelementptr inbounds [500 x [500 x i64]], ptr @b, i64 0, i64 0, i64 %.05063.us
  %70 = load i64, ptr %69, align 8, !tbaa !5
  %71 = getelementptr inbounds [500 x [500 x i64]], ptr @b, i64 0, i64 0, i64 %67
  %72 = load i64, ptr %71, align 8, !tbaa !5
  %73 = sub nsw i64 %70, %72
  %74 = call noundef i64 @_ZSt3absx(i64 noundef %73)
  store i64 %66, ptr %3, align 8, !tbaa !5
  store i64 %68, ptr %.sroa.47.0..sroa_idx, align 8, !tbaa !5
  store i64 %74, ptr %.sroa.58.0..sroa_idx, align 8, !tbaa !5
  call void @_ZNSt6vectorI4edgeSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24) @g, ptr noundef nonnull align 8 dereferenceable(24) %3)
  %.pre80 = load i64, ptr @N, align 8, !tbaa !5
  %75 = add nuw nsw i64 %.05063.us, 1
  %76 = icmp slt i64 %75, %.pre80
  br i1 %76, label %.lr.ph64.split.us.peel.next, label %._crit_edge65, !llvm.loop !15

._crit_edge68:                                    ; preds = %._crit_edge65, %.preheader.lr.ph, %._crit_edge62.thread83, %._crit_edge62
  %77 = call ptr @_ZNSt6vectorI4edgeSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @g) #6
  %78 = call ptr @_ZNSt6vectorI4edgeSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @g) #6
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIP4edgeSt6vectorIS2_SaIS2_EEEEPFbS2_S2_EEvT_SA_T0_(ptr %77, ptr %78, ptr noundef nonnull @_Z4cmpe4edgeS_)
  %79 = load i64, ptr @N, align 8, !tbaa !5
  %80 = load i64, ptr @M, align 8, !tbaa !5
  %81 = mul nsw i64 %80, %79
  %82 = getelementptr inbounds i64, ptr @sz, i64 %81
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  store i32 1, ptr %4, align 4, !tbaa !17
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @sz, ptr noundef nonnull %82, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %83 = load i64, ptr @N, align 8, !tbaa !5
  %84 = load i64, ptr @M, align 8, !tbaa !5
  %85 = mul nsw i64 %84, %83
  %86 = getelementptr inbounds i64, ptr @par, i64 %85
  call void @_ZSt4iotaIPxiEvT_S1_T0_(ptr noundef nonnull @par, ptr noundef nonnull %86, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %87 = call ptr @_ZNSt6vectorI4edgeSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @g) #6
  store ptr %87, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %88 = call ptr @_ZNSt6vectorI4edgeSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @g) #6
  store ptr %88, ptr %6, align 8
  %89 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP4edgeSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  br i1 %89, label %.lr.ph70, label %._crit_edge71

._crit_edge65:                                    ; preds = %.lr.ph64.split.peel.next, %.lr.ph64.split.us.peel.next, %55, %.lr.ph64.split.us.preheader, %.preheader
  %90 = phi i64 [ %51, %.preheader ], [ %51, %.lr.ph64.split.us.preheader ], [ %.pre79, %55 ], [ %.pre80, %.lr.ph64.split.us.peel.next ], [ %112, %.lr.ph64.split.peel.next ]
  %91 = phi i64 [ %52, %.preheader ], [ %51, %.lr.ph64.split.us.preheader ], [ %.pre79, %55 ], [ %.pre80, %.lr.ph64.split.us.peel.next ], [ %112, %.lr.ph64.split.peel.next ]
  %92 = add nuw nsw i64 %.04966, 1
  %93 = load i64, ptr @M, align 8, !tbaa !5
  %94 = icmp slt i64 %92, %93
  br i1 %94, label %.preheader, label %._crit_edge68, !llvm.loop !19

.lr.ph64.split.peel.next:                         ; preds = %55, %.lr.ph64.split.peel.next
  %.05063 = phi i64 [ %111, %.lr.ph64.split.peel.next ], [ 1, %55 ]
  %95 = call noundef i64 @_Z3cvtxx(i64 noundef %.04966, i64 noundef %.05063)
  %96 = call noundef i64 @_Z3cvtxx(i64 noundef %54, i64 noundef %.05063)
  %97 = getelementptr inbounds [500 x [500 x i64]], ptr @b, i64 0, i64 %.04966, i64 %.05063
  %98 = load i64, ptr %97, align 8, !tbaa !5
  %99 = getelementptr inbounds [500 x [500 x i64]], ptr @b, i64 0, i64 %54, i64 %.05063
  %100 = load i64, ptr %99, align 8, !tbaa !5
  %101 = sub nsw i64 %98, %100
  %102 = call noundef i64 @_ZSt3absx(i64 noundef %101)
  store i64 %95, ptr %3, align 8, !tbaa !5
  store i64 %96, ptr %.sroa.47.0..sroa_idx, align 8, !tbaa !5
  store i64 %102, ptr %.sroa.58.0..sroa_idx, align 8, !tbaa !5
  call void @_ZNSt6vectorI4edgeSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24) @g, ptr noundef nonnull align 8 dereferenceable(24) %3)
  %103 = call noundef i64 @_Z3cvtxx(i64 noundef %.04966, i64 noundef %.05063)
  %104 = add nsw i64 %.05063, -1
  %105 = call noundef i64 @_Z3cvtxx(i64 noundef %.04966, i64 noundef %104)
  %106 = load i64, ptr %97, align 8, !tbaa !5
  %107 = getelementptr inbounds [500 x [500 x i64]], ptr @b, i64 0, i64 %.04966, i64 %104
  %108 = load i64, ptr %107, align 8, !tbaa !5
  %109 = sub nsw i64 %106, %108
  %110 = call noundef i64 @_ZSt3absx(i64 noundef %109)
  store i64 %103, ptr %3, align 8, !tbaa !5
  store i64 %105, ptr %.sroa.47.0..sroa_idx, align 8, !tbaa !5
  store i64 %110, ptr %.sroa.58.0..sroa_idx, align 8, !tbaa !5
  call void @_ZNSt6vectorI4edgeSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24) @g, ptr noundef nonnull align 8 dereferenceable(24) %3)
  %111 = add nuw nsw i64 %.05063, 1
  %112 = load i64, ptr @N, align 8, !tbaa !5
  %113 = icmp slt i64 %111, %112
  br i1 %113, label %.lr.ph64.split.peel.next, label %._crit_edge65, !llvm.loop !20

._crit_edge71:                                    ; preds = %.lr.ph70, %._crit_edge68
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %114 = load i64, ptr @ans, align 8, !tbaa !5
  %115 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %114)
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %115, ptr noundef nonnull @.str.7)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  ret i32 0

.lr.ph70:                                         ; preds = %._crit_edge68, %.lr.ph70
  %117 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP4edgeSt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  %.sroa.0.0.copyload = load i64, ptr %117, align 8, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %117, i64 8
  %.sroa.4.0.copyload = load i64, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !5
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %117, i64 16
  %.sroa.5.0.copyload = load i64, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !5
  call void @_Z2unxxx(i64 noundef %.sroa.0.0.copyload, i64 noundef %.sroa.4.0.copyload, i64 noundef %.sroa.5.0.copyload)
  %118 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIP4edgeSt6vectorIS1_SaIS1_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  %119 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP4edgeSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  br i1 %119, label %.lr.ph70, label %._crit_edge71
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt3absx(i64 noundef) local_unnamed_addr #4

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZSt4iotaIPxiEvT_S1_T0_(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5

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

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

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

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

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


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