; LLVM IR from eyangch/competitive-programming :: teamscode/2022 (e)

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

%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<std::vector<long long>, std::allocator<std::vector<long long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<long long>, std::allocator<std::vector<long long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<long long>, std::allocator<std::vector<long long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<long long>, std::allocator<std::vector<long long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@A = external dso_local global i64, align 8
@B = external dso_local global i64, align 8
@vis = external dso_local global [200000 x i64], align 16
@graph = external dso_local global [200000 x %"class.std::unordered_map"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsxxRSt6vectorIS_IxSaIxEESaIS1_EE(i64 noundef, i64 noundef, ptr noundef nonnull align 8 dereferenceable(24)) #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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca %"class.std::vector.5", align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %12 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %13 = getelementptr i8, ptr %12, i64 -24
  %14 = load i64, ptr %13, align 8
  %15 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %14
  %16 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %15, ptr noundef null)
  %17 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @T)
  br label %19

19:                                               ; preds = %106, %0
  %20 = load i64, ptr @T, align 8, !tbaa !8
  %21 = add nsw i64 %20, -1
  store i64 %21, ptr @T, align 8, !tbaa !8
  %22 = icmp ne i64 %20, 0
  br i1 %22, label %23, label %112

23:                                               ; preds = %19
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(8) @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) @A)
  %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) @B)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %28

28:                                               ; preds = %38, %23
  %29 = load i64, ptr %2, align 8, !tbaa !8
  %30 = load i64, ptr @N, align 8, !tbaa !8
  %31 = icmp slt i64 %29, %30
  br i1 %31, label %33, label %32

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

33:                                               ; preds = %28
  %34 = load i64, ptr %2, align 8, !tbaa !8
  %35 = getelementptr inbounds [200000 x %"class.std::unordered_map"], ptr @graph, i64 0, i64 %34
  call void @_ZNSt13unordered_mapIxx11custom_hashSt8equal_toIxESaISt4pairIKxxEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(56) %35) #6
  %36 = load i64, ptr %2, align 8, !tbaa !8
  %37 = getelementptr inbounds [200000 x i64], ptr @vis, i64 0, i64 %36
  store i64 0, ptr %37, align 8, !tbaa !8
  br label %38

38:                                               ; preds = %33
  %39 = load i64, ptr %2, align 8, !tbaa !8
  %40 = add nsw i64 %39, 1
  store i64 %40, ptr %2, align 8, !tbaa !8
  br label %28, !llvm.loop !11

41:                                               ; preds = %32
  %42 = load i64, ptr @A, align 8, !tbaa !8
  %43 = add nsw i64 %42, -1
  store i64 %43, ptr @A, align 8, !tbaa !8
  %44 = load i64, ptr @B, align 8, !tbaa !8
  %45 = add nsw i64 %44, -1
  store i64 %45, ptr @B, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 24, ptr %3) #6
  call void @_ZNSt6vectorIS_IxSaIxEESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 0, ptr %4, align 8, !tbaa !8
  br label %46

46:                                               ; preds = %72, %41
  %47 = load i64, ptr %4, align 8, !tbaa !8
  %48 = load i64, ptr @M, align 8, !tbaa !8
  %49 = icmp slt i64 %47, %48
  br i1 %49, label %51, label %50

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

51:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %52 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %53 unwind label %75

53:                                               ; preds = %51
  %54 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %52, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %55 unwind label %75

55:                                               ; preds = %53
  %56 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %54, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %57 unwind label %75

57:                                               ; preds = %55
  %58 = load i64, ptr %5, align 8, !tbaa !8
  %59 = add nsw i64 %58, -1
  store i64 %59, ptr %5, align 8, !tbaa !8
  %60 = load i64, ptr %6, align 8, !tbaa !8
  %61 = add nsw i64 %60, -1
  store i64 %61, ptr %6, align 8, !tbaa !8
  %62 = load i64, ptr %7, align 8, !tbaa !8
  %63 = add nsw i64 %62, -1
  store i64 %63, ptr %7, align 8, !tbaa !8
  %64 = load i64, ptr %5, align 8, !tbaa !8
  %65 = load i64, ptr %6, align 8, !tbaa !8
  %66 = load i64, ptr %7, align 8, !tbaa !8
  invoke void @_Z3addxxxRSt6vectorIS_IxSaIxEESaIS1_EE(i64 noundef %64, i64 noundef %65, i64 noundef %66, ptr noundef nonnull align 8 dereferenceable(24) %3)
          to label %67 unwind label %75

67:                                               ; preds = %57
  %68 = load i64, ptr %6, align 8, !tbaa !8
  %69 = load i64, ptr %5, align 8, !tbaa !8
  %70 = load i64, ptr %7, align 8, !tbaa !8
  invoke void @_Z3addxxxRSt6vectorIS_IxSaIxEESaIS1_EE(i64 noundef %68, i64 noundef %69, i64 noundef %70, ptr noundef nonnull align 8 dereferenceable(24) %3)
          to label %71 unwind label %75

71:                                               ; preds = %67
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %72

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

75:                                               ; preds = %67, %57, %55, %53, %51
  %76 = landingpad { ptr, i32 }
          cleanup
  %77 = extractvalue { ptr, i32 } %76, 0
  store ptr %77, ptr %8, align 8
  %78 = extractvalue { ptr, i32 } %76, 1
  store i32 %78, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %111

79:                                               ; preds = %50
  %80 = load i64, ptr @A, align 8, !tbaa !8
  %81 = load i64, ptr @B, align 8, !tbaa !8
  invoke void @_Z3dfsxxRSt6vectorIS_IxSaIxEESaIS1_EE(i64 noundef %80, i64 noundef %81, ptr noundef nonnull align 8 dereferenceable(24) %3)
          to label %82 unwind label %88

82:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store i64 0, ptr %11, align 8, !tbaa !8
  br label %83

83:                                               ; preds = %98, %82
  %84 = load i64, ptr %11, align 8, !tbaa !8
  %85 = load i64, ptr @N, align 8, !tbaa !8
  %86 = icmp slt i64 %84, %85
  br i1 %86, label %92, label %87

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

88:                                               ; preds = %79
  %89 = landingpad { ptr, i32 }
          cleanup
  %90 = extractvalue { ptr, i32 } %89, 0
  store ptr %90, ptr %8, align 8
  %91 = extractvalue { ptr, i32 } %89, 1
  store i32 %91, ptr %9, align 4
  br label %111

92:                                               ; preds = %83
  %93 = load i64, ptr %11, align 8, !tbaa !8
  %94 = getelementptr inbounds [200000 x i64], ptr @vis, i64 0, i64 %93
  %95 = load i64, ptr %94, align 8, !tbaa !8
  %96 = load i64, ptr %10, align 8, !tbaa !8
  %97 = add nsw i64 %96, %95
  store i64 %97, ptr %10, align 8, !tbaa !8
  br label %98

98:                                               ; preds = %92
  %99 = load i64, ptr %11, align 8, !tbaa !8
  %100 = add nsw i64 %99, 1
  store i64 %100, ptr %11, align 8, !tbaa !8
  br label %83, !llvm.loop !14

101:                                              ; preds = %87
  %102 = load i64, ptr %10, align 8, !tbaa !8
  %103 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %102)
          to label %104 unwind label %107

104:                                              ; preds = %101
  %105 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %103, i8 noundef signext 10)
          to label %106 unwind label %107

106:                                              ; preds = %104
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @_ZNSt6vectorIS_IxSaIxEESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %3) #6
  br label %19, !llvm.loop !15

107:                                              ; preds = %104, %101
  %108 = landingpad { ptr, i32 }
          cleanup
  %109 = extractvalue { ptr, i32 } %108, 0
  store ptr %109, ptr %8, align 8
  %110 = extractvalue { ptr, i32 } %108, 1
  store i32 %110, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %111

111:                                              ; preds = %107, %88, %75
  call void @_ZNSt6vectorIS_IxSaIxEESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %3) #6
  br label %114

112:                                              ; preds = %19
  %113 = load i32, ptr %1, align 4
  ret i32 %113

114:                                              ; preds = %111
  %115 = load ptr, ptr %8, align 8
  %116 = load i32, ptr %9, align 4
  %117 = insertvalue { ptr, i32 } poison, ptr %115, 0
  %118 = insertvalue { ptr, i32 } %117, i32 %116, 1
  resume { ptr, i32 } %118
}

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

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

; 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: mustprogress nounwind uwtable
declare dso_local void @_ZNSt13unordered_mapIxx11custom_hashSt8equal_toIxESaISt4pairIKxxEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(56)) #3 align 2

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

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

; 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 @_ZNSt6vectorIS_IxSaIxEESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 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 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 #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


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

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@A = external dso_local global i64, align 8
@B = external dso_local global i64, align 8
@vis = external dso_local local_unnamed_addr global [200000 x i64], align 16
@graph = external dso_local global [200000 x %"class.std::unordered_map"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsxxRSt6vectorIS_IxSaIxEESaIS1_EE(i64 noundef, i64 noundef, ptr noundef nonnull align 8 dereferenceable(24)) 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::vector.5", align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %6 = getelementptr i8, ptr %5, i64 -24
  %7 = load i64, ptr %6, align 8
  %8 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %7
  %9 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %8, ptr noundef null)
  %10 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %11 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @T)
  %12 = load i64, ptr @T, align 8, !tbaa !8
  %13 = add nsw i64 %12, -1
  store i64 %13, ptr @T, align 8, !tbaa !8
  %.not28 = icmp eq i64 %12, 0
  br i1 %.not28, label %._crit_edge31, label %.lr.ph30

.lr.ph30:                                         ; preds = %0, %72
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 8 dereferenceable(8) @A)
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 8 dereferenceable(8) @B)
  %18 = load i64, ptr @N, align 8, !tbaa !8
  %19 = icmp sgt i64 %18, 0
  br i1 %19, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph30
  %20 = load i64, ptr @A, align 8, !tbaa !8
  %21 = add nsw i64 %20, -1
  store i64 %21, ptr @A, align 8, !tbaa !8
  %22 = load i64, ptr @B, align 8, !tbaa !8
  %23 = add nsw i64 %22, -1
  store i64 %23, ptr @B, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #7
  call void @_ZNSt6vectorIS_IxSaIxEESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  %24 = load i64, ptr @M, align 8, !tbaa !8
  %25 = icmp sgt i64 %24, 0
  br i1 %25, label %.lr.ph22, label %._crit_edge23

.lr.ph:                                           ; preds = %.lr.ph30, %.lr.ph
  %.01719 = phi i64 [ %28, %.lr.ph ], [ 0, %.lr.ph30 ]
  %26 = getelementptr inbounds [200000 x %"class.std::unordered_map"], ptr @graph, i64 0, i64 %.01719
  call void @_ZNSt13unordered_mapIxx11custom_hashSt8equal_toIxESaISt4pairIKxxEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(56) %26) #7
  %27 = getelementptr inbounds [200000 x i64], ptr @vis, i64 0, i64 %.01719
  store i64 0, ptr %27, align 8, !tbaa !8
  %28 = add nuw nsw i64 %.01719, 1
  %29 = load i64, ptr @N, align 8, !tbaa !8
  %30 = icmp slt i64 %28, %29
  br i1 %30, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge23:                                    ; preds = %57, %._crit_edge
  %31 = load i64, ptr @A, align 8, !tbaa !8
  %32 = load i64, ptr @B, align 8, !tbaa !8
  invoke void @_Z3dfsxxRSt6vectorIS_IxSaIxEESaIS1_EE(i64 noundef %31, i64 noundef %32, ptr noundef nonnull align 8 dereferenceable(24) %1)
          to label %.preheader unwind label %64

.preheader:                                       ; preds = %._crit_edge23
  %33 = load i64, ptr @N, align 8, !tbaa !8
  %34 = icmp sgt i64 %33, 0
  br i1 %34, label %.lr.ph26.preheader, label %._crit_edge27

.lr.ph26.preheader:                               ; preds = %.preheader
  %min.iters.check = icmp ult i64 %33, 4
  br i1 %min.iters.check, label %.lr.ph26.preheader34, label %vector.ph

.lr.ph26.preheader34:                             ; preds = %middle.block, %.lr.ph26.preheader
  %.025.ph = phi i64 [ 0, %.lr.ph26.preheader ], [ %n.vec, %middle.block ]
  %.01324.ph = phi i64 [ 0, %.lr.ph26.preheader ], [ %40, %middle.block ]
  br label %.lr.ph26

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

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %37, %vector.body ]
  %vec.phi32 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %38, %vector.body ]
  %35 = getelementptr inbounds [200000 x i64], ptr @vis, i64 0, i64 %index
  %36 = getelementptr inbounds i8, ptr %35, i64 16
  %wide.load = load <2 x i64>, ptr %35, align 16, !tbaa !8
  %wide.load33 = load <2 x i64>, ptr %36, align 16, !tbaa !8
  %37 = add <2 x i64> %wide.load, %vec.phi
  %38 = add <2 x i64> %wide.load33, %vec.phi32
  %index.next = add nuw i64 %index, 4
  %39 = icmp eq i64 %index.next, %n.vec
  br i1 %39, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %38, %37
  %40 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %33, %n.vec
  br i1 %cmp.n, label %._crit_edge27, label %.lr.ph26.preheader34

.lr.ph22:                                         ; preds = %._crit_edge, %57
  %.01620 = phi i64 [ %58, %57 ], [ 0, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %41 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %42 unwind label %61

42:                                               ; preds = %.lr.ph22
  %43 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %41, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %44 unwind label %61

44:                                               ; preds = %42
  %45 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %43, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %46 unwind label %61

46:                                               ; preds = %44
  %47 = load i64, ptr %2, align 8, !tbaa !8
  %48 = add nsw i64 %47, -1
  store i64 %48, ptr %2, align 8, !tbaa !8
  %49 = load i64, ptr %3, align 8, !tbaa !8
  %50 = add nsw i64 %49, -1
  store i64 %50, ptr %3, align 8, !tbaa !8
  %51 = load i64, ptr %4, align 8, !tbaa !8
  %52 = add nsw i64 %51, -1
  store i64 %52, ptr %4, align 8, !tbaa !8
  invoke void @_Z3addxxxRSt6vectorIS_IxSaIxEESaIS1_EE(i64 noundef %48, i64 noundef %50, i64 noundef %52, ptr noundef nonnull align 8 dereferenceable(24) %1)
          to label %53 unwind label %61

53:                                               ; preds = %46
  %54 = load i64, ptr %3, align 8, !tbaa !8
  %55 = load i64, ptr %2, align 8, !tbaa !8
  %56 = load i64, ptr %4, align 8, !tbaa !8
  invoke void @_Z3addxxxRSt6vectorIS_IxSaIxEESaIS1_EE(i64 noundef %54, i64 noundef %55, i64 noundef %56, ptr noundef nonnull align 8 dereferenceable(24) %1)
          to label %57 unwind label %61

57:                                               ; preds = %53
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  %58 = add nuw nsw i64 %.01620, 1
  %59 = load i64, ptr @M, align 8, !tbaa !8
  %60 = icmp slt i64 %58, %59
  br i1 %60, label %.lr.ph22, label %._crit_edge23, !llvm.loop !16

61:                                               ; preds = %53, %46, %44, %42, %.lr.ph22
  %62 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  br label %77

._crit_edge27:                                    ; preds = %.lr.ph26, %middle.block, %.preheader
  %.013.lcssa = phi i64 [ 0, %.preheader ], [ %40, %middle.block ], [ %68, %.lr.ph26 ]
  %63 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.013.lcssa)
          to label %70 unwind label %75

64:                                               ; preds = %._crit_edge23
  %65 = landingpad { ptr, i32 }
          cleanup
  br label %77

.lr.ph26:                                         ; preds = %.lr.ph26.preheader34, %.lr.ph26
  %.025 = phi i64 [ %69, %.lr.ph26 ], [ %.025.ph, %.lr.ph26.preheader34 ]
  %.01324 = phi i64 [ %68, %.lr.ph26 ], [ %.01324.ph, %.lr.ph26.preheader34 ]
  %66 = getelementptr inbounds [200000 x i64], ptr @vis, i64 0, i64 %.025
  %67 = load i64, ptr %66, align 8, !tbaa !8
  %68 = add nsw i64 %67, %.01324
  %69 = add nuw nsw i64 %.025, 1
  %exitcond.not = icmp eq i64 %69, %33
  br i1 %exitcond.not, label %._crit_edge27, label %.lr.ph26, !llvm.loop !17

70:                                               ; preds = %._crit_edge27
  %71 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %63, i8 noundef signext 10)
          to label %72 unwind label %75

72:                                               ; preds = %70
  call void @_ZNSt6vectorIS_IxSaIxEESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #7
  %73 = load i64, ptr @T, align 8, !tbaa !8
  %74 = add nsw i64 %73, -1
  store i64 %74, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %73, 0
  br i1 %.not, label %._crit_edge31, label %.lr.ph30, !llvm.loop !18

75:                                               ; preds = %70, %._crit_edge27
  %76 = landingpad { ptr, i32 }
          cleanup
  br label %77

77:                                               ; preds = %75, %64, %61
  %.pn = phi { ptr, i32 } [ %62, %61 ], [ %76, %75 ], [ %65, %64 ]
  call void @_ZNSt6vectorIS_IxSaIxEESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #7
  resume { ptr, i32 } %.pn

._crit_edge31:                                    ; preds = %72, %0
  ret i32 0
}

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

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

; 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: mustprogress nounwind uwtable
declare dso_local void @_ZNSt13unordered_mapIxx11custom_hashSt8equal_toIxESaISt4pairIKxxEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #3 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #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 @_ZNSt6vectorIS_IxSaIxEESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

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

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

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

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


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