; LLVM IR from Aryansh-S/USACO :: algo_ds/DP/atcoder (g-longestpath)

; 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::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl" }
%"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl" = type { %"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl_data" }
%"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"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.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i64, align 8
@m = external dso_local global i64, align 8
@dp = external dso_local global [200005 x i64], align 16
@ans = external dso_local global i64, align 8
@adj = external dso_local global [200005 x %"class.std::vector"], align 16
@vis = external dso_local global [200005 x i8], align 16
@ts = external dso_local global %"class.std::stack", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsx(i64 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: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #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 nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  %14 = call noalias ptr @fopen(ptr noundef @.str, ptr noundef @.str.4)
  %15 = icmp ne ptr %14, null
  br i1 %15, label %16, label %21

16:                                               ; preds = %0
  %17 = load ptr, ptr @stdin, align 8, !tbaa !5
  %18 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.4, ptr noundef %17)
  %19 = load ptr, ptr @stdout, align 8, !tbaa !5
  %20 = call ptr @freopen(ptr noundef @.str.5, ptr noundef @.str.6, ptr noundef %19)
  br label %21

21:                                               ; preds = %16, %0
  %22 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !9
  %23 = getelementptr i8, ptr %22, i64 -24
  %24 = load i64, ptr %23, align 8
  %25 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %24
  %26 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %25, ptr noundef null)
  %27 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  call void @_Z2reIRxJS0_EEvOT_DpOT0_(ptr noundef nonnull align 8 dereferenceable(8) @n, ptr noundef nonnull align 8 dereferenceable(8) @m)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 0, ptr %2, align 8, !tbaa !11
  br label %28

28:                                               ; preds = %41, %21
  %29 = load i64, ptr %2, align 8, !tbaa !11
  %30 = load i64, ptr @m, align 8, !tbaa !11
  %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 %44

33:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  call void @_Z2reIRxJS0_EEvOT_DpOT0_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %34 = load i64, ptr %3, align 8, !tbaa !11
  %35 = add nsw i64 %34, -1
  store i64 %35, ptr %3, align 8, !tbaa !11
  %36 = load i64, ptr %4, align 8, !tbaa !11
  %37 = add nsw i64 %36, -1
  store i64 %37, ptr %4, align 8, !tbaa !11
  %38 = load i64, ptr %3, align 8, !tbaa !11
  %39 = getelementptr inbounds [200005 x %"class.std::vector"], ptr @adj, i64 0, i64 %38
  %40 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEE12emplace_backIJRxEEERiDpOT_(ptr noundef nonnull align 8 dereferenceable(24) %39, ptr noundef nonnull align 8 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  br label %41

41:                                               ; preds = %33
  %42 = load i64, ptr %2, align 8, !tbaa !11
  %43 = add nsw i64 %42, 1
  store i64 %43, ptr %2, align 8, !tbaa !11
  br label %28, !llvm.loop !13

44:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store i64 0, ptr %5, align 8, !tbaa !11
  br label %45

45:                                               ; preds = %58, %44
  %46 = load i64, ptr %5, align 8, !tbaa !11
  %47 = load i64, ptr @n, align 8, !tbaa !11
  %48 = icmp slt i64 %46, %47
  br i1 %48, label %50, label %49

49:                                               ; preds = %45
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %61

50:                                               ; preds = %45
  %51 = load i64, ptr %5, align 8, !tbaa !11
  %52 = getelementptr inbounds [200005 x i8], ptr @vis, i64 0, i64 %51
  %53 = load i8, ptr %52, align 1, !tbaa !15, !range !17, !noundef !18
  %54 = trunc i8 %53 to i1
  br i1 %54, label %57, label %55

55:                                               ; preds = %50
  %56 = load i64, ptr %5, align 8, !tbaa !11
  call void @_Z3dfsx(i64 noundef %56)
  br label %57

57:                                               ; preds = %55, %50
  br label %58

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

61:                                               ; preds = %49
  br label %62

62:                                               ; preds = %92, %61
  %63 = call noundef i64 @_ZNKSt5stackIxSt5dequeIxSaIxEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) @ts)
  %64 = icmp ne i64 %63, 0
  br i1 %64, label %65, label %93

65:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %66 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIxSt5dequeIxSaIxEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) @ts)
  %67 = load i64, ptr %66, align 8, !tbaa !11
  %68 = getelementptr inbounds [200005 x %"class.std::vector"], ptr @adj, i64 0, i64 %67
  store ptr %68, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %69) #6
  %71 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  store ptr %70, ptr %71, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %72) #6
  %74 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %73, ptr %74, align 8
  br label %75

75:                                               ; preds = %90, %65
  %76 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  br i1 %76, label %78, label %77

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

78:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %79 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  store ptr %79, ptr %9, align 8, !tbaa !5
  %80 = load ptr, ptr %9, align 8, !tbaa !5
  %81 = load i32, ptr %80, align 4, !tbaa !20
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [200005 x i64], ptr @dp, i64 0, i64 %82
  %84 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIxSt5dequeIxSaIxEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) @ts)
  %85 = load i64, ptr %84, align 8, !tbaa !11
  %86 = getelementptr inbounds [200005 x i64], ptr @dp, i64 0, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !11
  %88 = add nsw i64 %87, 1
  %89 = call noundef zeroext i1 @_Z5ckmaxIxEbRT_S0_(ptr noundef nonnull align 8 dereferenceable(8) %83, i64 noundef %88)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %90

90:                                               ; preds = %78
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  br label %75

92:                                               ; preds = %77
  call void @_ZNSt5stackIxSt5dequeIxSaIxEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) @ts)
  br label %62, !llvm.loop !22

93:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store ptr @dp, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store ptr @dp, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store ptr getelementptr inbounds (i64, ptr @dp, i64 200005), ptr %12, align 8, !tbaa !5
  br label %94

94:                                               ; preds = %104, %93
  %95 = load ptr, ptr %11, align 8, !tbaa !5
  %96 = load ptr, ptr %12, align 8, !tbaa !5
  %97 = icmp ne ptr %95, %96
  br i1 %97, label %99, label %98

98:                                               ; preds = %94
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %107

99:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %100 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %100, ptr %13, align 8, !tbaa !5
  %101 = load ptr, ptr %13, align 8, !tbaa !5
  %102 = load i64, ptr %101, align 8, !tbaa !11
  %103 = call noundef zeroext i1 @_Z5ckmaxIxEbRT_S0_(ptr noundef nonnull align 8 dereferenceable(8) @ans, i64 noundef %102)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %104

104:                                              ; preds = %99
  %105 = load ptr, ptr %11, align 8, !tbaa !5
  %106 = getelementptr inbounds i64, ptr %105, i32 1
  store ptr %106, ptr %11, align 8, !tbaa !5
  br label %94

107:                                              ; preds = %98
  call void @_Z2prIRxJEEvOT_DpOT0_(ptr noundef nonnull align 8 dereferenceable(8) @ans)
  %108 = load i32, ptr %1, align 4
  ret i32 %108
}

declare noalias ptr @fopen(ptr noundef, ptr noundef) #5

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #5

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5ckmaxIxEbRT_S0_(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #2

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

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

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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !14}
!20 = !{!21, !21, i64 0}
!21 = !{!"int", !7, i64 0}
!22 = distinct !{!22, !14}


; 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::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl" }
%"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl" = type { %"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl_data" }
%"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"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.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i64, align 8
@m = external dso_local global i64, align 8
@dp = external dso_local global [200005 x i64], align 16
@ans = external dso_local global i64, align 8
@adj = external dso_local global [200005 x %"class.std::vector"], align 16
@vis = external dso_local local_unnamed_addr global [200005 x i8], align 16
@ts = external dso_local global %"class.std::stack", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_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 nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = tail call noalias ptr @fopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.4)
  %.not = icmp eq ptr %5, null
  br i1 %.not, label %11, label %6

6:                                                ; preds = %0
  %7 = load ptr, ptr @stdin, align 8, !tbaa !5
  %8 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.4, ptr noundef %7)
  %9 = load ptr, ptr @stdout, align 8, !tbaa !5
  %10 = tail call ptr @freopen(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.6, ptr noundef %9)
  br label %11

11:                                               ; preds = %6, %0
  %12 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !9
  %13 = getelementptr i8, ptr %12, i64 -24
  %14 = load i64, ptr %13, align 8
  %15 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %14
  %16 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %15, ptr noundef null)
  %17 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  tail call void @_Z2reIRxJS0_EEvOT_DpOT0_(ptr noundef nonnull align 8 dereferenceable(8) @n, ptr noundef nonnull align 8 dereferenceable(8) @m)
  %18 = load i64, ptr @m, align 8, !tbaa !11
  %19 = icmp sgt i64 %18, 0
  br i1 %19, label %.lr.ph, label %.preheader19

.preheader19:                                     ; preds = %.lr.ph, %11
  %20 = load i64, ptr @n, align 8, !tbaa !11
  %21 = icmp sgt i64 %20, 0
  br i1 %21, label %.lr.ph22, label %.preheader18

.lr.ph:                                           ; preds = %11, %.lr.ph
  %.020 = phi i64 [ %28, %.lr.ph ], [ 0, %11 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  call void @_Z2reIRxJS0_EEvOT_DpOT0_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %22 = load i64, ptr %1, align 8, !tbaa !11
  %23 = add nsw i64 %22, -1
  store i64 %23, ptr %1, align 8, !tbaa !11
  %24 = load i64, ptr %2, align 8, !tbaa !11
  %25 = add nsw i64 %24, -1
  store i64 %25, ptr %2, align 8, !tbaa !11
  %26 = getelementptr inbounds [200005 x %"class.std::vector"], ptr @adj, i64 0, i64 %23
  %27 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEE12emplace_backIJRxEEERiDpOT_(ptr noundef nonnull align 8 dereferenceable(24) %26, ptr noundef nonnull align 8 dereferenceable(8) %2)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  %28 = add nuw nsw i64 %.020, 1
  %29 = load i64, ptr @m, align 8, !tbaa !11
  %30 = icmp slt i64 %28, %29
  br i1 %30, label %.lr.ph, label %.preheader19, !llvm.loop !13

.preheader18:                                     ; preds = %37, %.preheader19
  %31 = call noundef i64 @_ZNKSt5stackIxSt5dequeIxSaIxEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) @ts)
  %.not1624 = icmp eq i64 %31, 0
  br i1 %.not1624, label %.preheader.preheader, label %.lr.ph25

.preheader.preheader:                             ; preds = %._crit_edge, %.preheader18
  br label %.preheader

.lr.ph22:                                         ; preds = %.preheader19, %37
  %32 = phi i64 [ %38, %37 ], [ %20, %.preheader19 ]
  %.01421 = phi i64 [ %39, %37 ], [ 0, %.preheader19 ]
  %33 = getelementptr inbounds [200005 x i8], ptr @vis, i64 0, i64 %.01421
  %34 = load i8, ptr %33, align 1, !tbaa !15, !range !17, !noundef !18
  %35 = trunc nuw i8 %34 to i1
  br i1 %35, label %37, label %36

36:                                               ; preds = %.lr.ph22
  call void @_Z3dfsx(i64 noundef %.01421)
  %.pre = load i64, ptr @n, align 8, !tbaa !11
  br label %37

37:                                               ; preds = %.lr.ph22, %36
  %38 = phi i64 [ %32, %.lr.ph22 ], [ %.pre, %36 ]
  %39 = add nuw nsw i64 %.01421, 1
  %40 = icmp slt i64 %39, %38
  br i1 %40, label %.lr.ph22, label %.preheader18, !llvm.loop !19

.lr.ph25:                                         ; preds = %.preheader18, %._crit_edge
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIxSt5dequeIxSaIxEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) @ts)
  %42 = load i64, ptr %41, align 8, !tbaa !11
  %43 = getelementptr inbounds [200005 x %"class.std::vector"], ptr @adj, i64 0, i64 %42
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %44 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %43) #7
  store ptr %44, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %45 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %43) #7
  store ptr %45, ptr %4, align 8
  %46 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  br i1 %46, label %.lr.ph23, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph23, %.lr.ph25
  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 @_ZNSt5stackIxSt5dequeIxSaIxEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) @ts)
  %47 = call noundef i64 @_ZNKSt5stackIxSt5dequeIxSaIxEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) @ts)
  %.not16 = icmp eq i64 %47, 0
  br i1 %.not16, label %.preheader.preheader, label %.lr.ph25, !llvm.loop !20

.lr.ph23:                                         ; preds = %.lr.ph25, %.lr.ph23
  %48 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #7
  %49 = load i32, ptr %48, align 4, !tbaa !21
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [200005 x i64], ptr @dp, i64 0, i64 %50
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIxSt5dequeIxSaIxEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) @ts)
  %53 = load i64, ptr %52, align 8, !tbaa !11
  %54 = getelementptr inbounds [200005 x i64], ptr @dp, i64 0, i64 %53
  %55 = load i64, ptr %54, align 8, !tbaa !11
  %56 = add nsw i64 %55, 1
  %57 = call noundef zeroext i1 @_Z5ckmaxIxEbRT_S0_(ptr noundef nonnull align 8 dereferenceable(8) %51, i64 noundef %56)
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #7
  %59 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  br i1 %59, label %.lr.ph23, label %._crit_edge

60:                                               ; preds = %.preheader
  call void @_Z2prIRxJEEvOT_DpOT0_(ptr noundef nonnull align 8 dereferenceable(8) @ans)
  ret i32 0

.preheader:                                       ; preds = %.preheader.preheader, %.preheader
  %.015.idx26 = phi i64 [ %.015.add, %.preheader ], [ 0, %.preheader.preheader ]
  %.015.ptr = getelementptr inbounds i8, ptr @dp, i64 %.015.idx26
  %61 = load i64, ptr %.015.ptr, align 8, !tbaa !11
  %62 = call noundef zeroext i1 @_Z5ckmaxIxEbRT_S0_(ptr noundef nonnull align 8 dereferenceable(8) @ans, i64 noundef %61)
  %.015.add = add nuw nsw i64 %.015.idx26, 8
  %.not17 = icmp eq i64 %.015.add, 1600040
  br i1 %.not17, label %60, label %.preheader
}

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #5

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5ckmaxIxEbRT_S0_(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #2

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

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

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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = !{!22, !22, i64 0}
!22 = !{!"int", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass