; LLVM IR from eyangch/competitive-programming :: Codeforces/1707 (c)

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

%"struct.std::pair" = type { i64, i64 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.DSU = type { [100000 x i64], [100000 x 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" }

@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@dep = external dso_local global [100000 x i64], align 16
@add = external dso_local global [100000 x i64], align 16
@ans = external dso_local global [100000 x i8], align 16
@E = external dso_local global [200000 x %"struct.std::pair"], align 16
@graph = external dso_local global [100000 x %"class.std::vector"], align 16
@dsu = external dso_local global %struct.DSU, align 8
@_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 @_Z3dfsxxx(i64 noundef, i64 noundef, 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: 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 i64 @_Z4jumpxx(i64 noundef, i64 noundef) #2

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %11 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %13
  %15 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %14, ptr noundef null)
  %16 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %17 = 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)
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %19 = load i64, ptr @N, align 8, !tbaa !8
  call void @_ZN3DSU4initEx(ptr noundef nonnull align 8 dereferenceable(1600000) @dsu, i64 noundef %19)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %20

20:                                               ; preds = %50, %0
  %21 = load i64, ptr %2, align 8, !tbaa !8
  %22 = load i64, ptr @M, align 8, !tbaa !8
  %23 = icmp slt i64 %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  br label %53

25:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %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) %4)
  %28 = load i64, ptr %3, align 8, !tbaa !8
  %29 = add nsw i64 %28, -1
  store i64 %29, ptr %3, align 8, !tbaa !8
  %30 = load i64, ptr %4, align 8, !tbaa !8
  %31 = add nsw i64 %30, -1
  store i64 %31, ptr %4, align 8, !tbaa !8
  %32 = load i64, ptr %3, align 8, !tbaa !8
  %33 = call noundef i64 @_ZN3DSU4findEx(ptr noundef nonnull align 8 dereferenceable(1600000) @dsu, i64 noundef %32)
  %34 = load i64, ptr %4, align 8, !tbaa !8
  %35 = call noundef i64 @_ZN3DSU4findEx(ptr noundef nonnull align 8 dereferenceable(1600000) @dsu, i64 noundef %34)
  %36 = icmp ne i64 %33, %35
  br i1 %36, label %37, label %44

37:                                               ; preds = %25
  %38 = load i64, ptr %3, align 8, !tbaa !8
  %39 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @graph, i64 0, i64 %38
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %39, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %40 = load i64, ptr %4, align 8, !tbaa !8
  %41 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @graph, i64 0, i64 %40
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %41, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %42 = load i64, ptr %3, align 8, !tbaa !8
  %43 = load i64, ptr %4, align 8, !tbaa !8
  call void @_ZN3DSU2unExx(ptr noundef nonnull align 8 dereferenceable(1600000) @dsu, i64 noundef %42, i64 noundef %43)
  br label %49

44:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #7
  call void @_ZNSt4pairIxxEC2IRxS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %45 = load i64, ptr @K, align 8, !tbaa !8
  %46 = add nsw i64 %45, 1
  store i64 %46, ptr @K, align 8, !tbaa !8
  %47 = getelementptr inbounds [200000 x %"struct.std::pair"], ptr @E, i64 0, i64 %45
  %48 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %47, ptr noundef nonnull align 8 dereferenceable(16) %5) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #7
  br label %49

49:                                               ; preds = %44, %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  br label %50

50:                                               ; preds = %49
  %51 = load i64, ptr %2, align 8, !tbaa !8
  %52 = add nsw i64 %51, 1
  store i64 %52, ptr %2, align 8, !tbaa !8
  br label %20, !llvm.loop !11

53:                                               ; preds = %24
  call void @_Z3dfsxxx(i64 noundef 0, i64 noundef -1, i64 noundef 0)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 0, ptr %6, align 8, !tbaa !8
  br label %54

54:                                               ; preds = %113, %53
  %55 = load i64, ptr %6, align 8, !tbaa !8
  %56 = load i64, ptr @K, align 8, !tbaa !8
  %57 = icmp slt i64 %55, %56
  br i1 %57, label %59, label %58

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

59:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %60 = load i64, ptr %6, align 8, !tbaa !8
  %61 = getelementptr inbounds [200000 x %"struct.std::pair"], ptr @E, i64 0, i64 %60
  %62 = getelementptr inbounds %"struct.std::pair", ptr %61, i32 0, i32 0
  %63 = load i64, ptr %62, align 16, !tbaa !13
  store i64 %63, ptr %7, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %64 = load i64, ptr %6, align 8, !tbaa !8
  %65 = getelementptr inbounds [200000 x %"struct.std::pair"], ptr @E, i64 0, i64 %64
  %66 = getelementptr inbounds %"struct.std::pair", ptr %65, i32 0, i32 1
  %67 = load i64, ptr %66, align 8, !tbaa !15
  store i64 %67, ptr %8, align 8, !tbaa !8
  %68 = load i64, ptr %7, align 8, !tbaa !8
  %69 = getelementptr inbounds [100000 x i64], ptr @dep, i64 0, i64 %68
  %70 = load i64, ptr %69, align 8, !tbaa !8
  %71 = load i64, ptr %8, align 8, !tbaa !8
  %72 = getelementptr inbounds [100000 x i64], ptr @dep, i64 0, i64 %71
  %73 = load i64, ptr %72, align 8, !tbaa !8
  %74 = icmp sgt i64 %70, %73
  br i1 %74, label %75, label %76

75:                                               ; preds = %59
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  br label %76

76:                                               ; preds = %75, %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %77 = load i64, ptr %8, align 8, !tbaa !8
  %78 = getelementptr inbounds [100000 x i64], ptr @dep, i64 0, i64 %77
  %79 = load i64, ptr %78, align 8, !tbaa !8
  %80 = load i64, ptr %7, align 8, !tbaa !8
  %81 = getelementptr inbounds [100000 x i64], ptr @dep, i64 0, i64 %80
  %82 = load i64, ptr %81, align 8, !tbaa !8
  %83 = sub nsw i64 %79, %82
  store i64 %83, ptr %9, align 8, !tbaa !8
  %84 = load i64, ptr %8, align 8, !tbaa !8
  %85 = load i64, ptr %9, align 8, !tbaa !8
  %86 = call noundef i64 @_Z4jumpxx(i64 noundef %84, i64 noundef %85)
  %87 = load i64, ptr %7, align 8, !tbaa !8
  %88 = icmp eq i64 %86, %87
  br i1 %88, label %89, label %103

89:                                               ; preds = %76
  %90 = load i64, ptr @add, align 16, !tbaa !8
  %91 = add nsw i64 %90, 1
  store i64 %91, ptr @add, align 16, !tbaa !8
  %92 = load i64, ptr %8, align 8, !tbaa !8
  %93 = load i64, ptr %9, align 8, !tbaa !8
  %94 = sub nsw i64 %93, 1
  %95 = call noundef i64 @_Z4jumpxx(i64 noundef %92, i64 noundef %94)
  %96 = getelementptr inbounds [100000 x i64], ptr @add, i64 0, i64 %95
  %97 = load i64, ptr %96, align 8, !tbaa !8
  %98 = add nsw i64 %97, -1
  store i64 %98, ptr %96, align 8, !tbaa !8
  %99 = load i64, ptr %8, align 8, !tbaa !8
  %100 = getelementptr inbounds [100000 x i64], ptr @add, i64 0, i64 %99
  %101 = load i64, ptr %100, align 8, !tbaa !8
  %102 = add nsw i64 %101, 1
  store i64 %102, ptr %100, align 8, !tbaa !8
  br label %112

103:                                              ; preds = %76
  %104 = load i64, ptr %7, align 8, !tbaa !8
  %105 = getelementptr inbounds [100000 x i64], ptr @add, i64 0, i64 %104
  %106 = load i64, ptr %105, align 8, !tbaa !8
  %107 = add nsw i64 %106, 1
  store i64 %107, ptr %105, align 8, !tbaa !8
  %108 = load i64, ptr %8, align 8, !tbaa !8
  %109 = getelementptr inbounds [100000 x i64], ptr @add, i64 0, i64 %108
  %110 = load i64, ptr %109, align 8, !tbaa !8
  %111 = add nsw i64 %110, 1
  store i64 %111, ptr %109, align 8, !tbaa !8
  br label %112

112:                                              ; preds = %103, %89
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %113

113:                                              ; preds = %112
  %114 = load i64, ptr %6, align 8, !tbaa !8
  %115 = add nsw i64 %114, 1
  store i64 %115, ptr %6, align 8, !tbaa !8
  br label %54, !llvm.loop !16

116:                                              ; preds = %58
  call void @_Z4dfs2xxx(i64 noundef 0, i64 noundef -1, i64 noundef 0)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  store i64 0, ptr %10, align 8, !tbaa !8
  br label %117

117:                                              ; preds = %128, %116
  %118 = load i64, ptr %10, align 8, !tbaa !8
  %119 = load i64, ptr @N, align 8, !tbaa !8
  %120 = icmp slt i64 %118, %119
  br i1 %120, label %122, label %121

121:                                              ; preds = %117
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %131

122:                                              ; preds = %117
  %123 = load i64, ptr %10, align 8, !tbaa !8
  %124 = getelementptr inbounds [100000 x i8], ptr @ans, i64 0, i64 %123
  %125 = load i8, ptr %124, align 1, !tbaa !17, !range !19, !noundef !20
  %126 = trunc i8 %125 to i1
  %127 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEb(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i1 noundef zeroext %126)
  br label %128

128:                                              ; preds = %122
  %129 = load i64, ptr %10, align 8, !tbaa !8
  %130 = add nsw i64 %129, 1
  store i64 %130, ptr %10, align 8, !tbaa !8
  br label %117, !llvm.loop !21

131:                                              ; preds = %121
  %132 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 10)
  %133 = load i32, ptr %1, align 4
  ret i32 %133
}

; 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) #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 uwtable
declare dso_local void @_ZN3DSU4initEx(ptr noundef nonnull align 8 dereferenceable(1600000), i64 noundef) #0 align 2

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEb(ptr noundef nonnull align 8 dereferenceable(8), i1 noundef zeroext) #0 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) #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 = { 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 = { "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 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 #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 = !{!"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 = !{!14, !9, i64 0}
!14 = !{!"_ZTSSt4pairIxxE", !9, i64 0, !9, i64 8}
!15 = !{!14, !9, i64 8}
!16 = distinct !{!16, !12}
!17 = !{!18, !18, i64 0}
!18 = !{!"bool", !10, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !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"

%"struct.std::pair" = type { i64, i64 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.DSU = type { [100000 x i64], [100000 x 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" }

@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@K = external dso_local local_unnamed_addr global i64, align 8
@dep = external dso_local local_unnamed_addr global [100000 x i64], align 16
@add = external dso_local local_unnamed_addr global [100000 x i64], align 16
@ans = external dso_local local_unnamed_addr global [100000 x i8], align 16
@E = external dso_local global [200000 x %"struct.std::pair"], align 16
@graph = external dso_local global [100000 x %"class.std::vector"], align 16
@dsu = external dso_local global %struct.DSU, align 8
@_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 @_Z3dfsxxx(i64 noundef, i64 noundef, 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 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 i64 @_Z4jumpxx(i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4dfs2xxx(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 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca %"struct.std::pair", align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %7 = getelementptr i8, ptr %6, i64 -24
  %8 = load i64, ptr %7, align 8
  %9 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %8
  %10 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %9, ptr noundef null)
  %11 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %12 = 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) @N)
  %13 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %14 = load i64, ptr @N, align 8, !tbaa !8
  tail call void @_ZN3DSU4initEx(ptr noundef nonnull align 8 dereferenceable(1600000) @dsu, i64 noundef %14)
  %15 = load i64, ptr @M, align 8, !tbaa !8
  %16 = icmp sgt i64 %15, 0
  br i1 %16, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %40, %0
  call void @_Z3dfsxxx(i64 noundef 0, i64 noundef -1, i64 noundef 0)
  %17 = load i64, ptr @K, align 8, !tbaa !8
  %18 = icmp sgt i64 %17, 0
  br i1 %18, label %.lr.ph18, label %._crit_edge19

.lr.ph:                                           ; preds = %0, %40
  %.01215 = phi i64 [ %41, %40 ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %21 = load i64, ptr %1, align 8, !tbaa !8
  %22 = add nsw i64 %21, -1
  store i64 %22, ptr %1, align 8, !tbaa !8
  %23 = load i64, ptr %2, align 8, !tbaa !8
  %24 = add nsw i64 %23, -1
  store i64 %24, ptr %2, align 8, !tbaa !8
  %25 = call noundef i64 @_ZN3DSU4findEx(ptr noundef nonnull align 8 dereferenceable(1600000) @dsu, i64 noundef %22)
  %26 = load i64, ptr %2, align 8, !tbaa !8
  %27 = call noundef i64 @_ZN3DSU4findEx(ptr noundef nonnull align 8 dereferenceable(1600000) @dsu, i64 noundef %26)
  %.not = icmp eq i64 %25, %27
  br i1 %.not, label %35, label %28

28:                                               ; preds = %.lr.ph
  %29 = load i64, ptr %1, align 8, !tbaa !8
  %30 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @graph, i64 0, i64 %29
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %30, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %31 = load i64, ptr %2, align 8, !tbaa !8
  %32 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @graph, i64 0, i64 %31
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %32, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %33 = load i64, ptr %1, align 8, !tbaa !8
  %34 = load i64, ptr %2, align 8, !tbaa !8
  call void @_ZN3DSU2unExx(ptr noundef nonnull align 8 dereferenceable(1600000) @dsu, i64 noundef %33, i64 noundef %34)
  br label %40

35:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #7
  call void @_ZNSt4pairIxxEC2IRxS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %36 = load i64, ptr @K, align 8, !tbaa !8
  %37 = add nsw i64 %36, 1
  store i64 %37, ptr @K, align 8, !tbaa !8
  %38 = getelementptr inbounds [200000 x %"struct.std::pair"], ptr @E, i64 0, i64 %36
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %38, ptr noundef nonnull align 8 dereferenceable(16) %3) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  br label %40

40:                                               ; preds = %35, %28
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  %41 = add nuw nsw i64 %.01215, 1
  %42 = load i64, ptr @M, align 8, !tbaa !8
  %43 = icmp slt i64 %41, %42
  br i1 %43, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge19:                                    ; preds = %70, %._crit_edge
  call void @_Z4dfs2xxx(i64 noundef 0, i64 noundef -1, i64 noundef 0)
  %44 = load i64, ptr @N, align 8, !tbaa !8
  %45 = icmp sgt i64 %44, 0
  br i1 %45, label %.lr.ph22, label %._crit_edge23

.lr.ph18:                                         ; preds = %._crit_edge, %70
  %.01316 = phi i64 [ %77, %70 ], [ 0, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %46 = getelementptr inbounds [200000 x %"struct.std::pair"], ptr @E, i64 0, i64 %.01316
  %47 = load i64, ptr %46, align 16, !tbaa !13
  store i64 %47, ptr %4, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %48 = getelementptr inbounds i8, ptr %46, i64 8
  %49 = load i64, ptr %48, align 8, !tbaa !15
  store i64 %49, ptr %5, align 8, !tbaa !8
  %50 = getelementptr inbounds [100000 x i64], ptr @dep, i64 0, i64 %47
  %51 = load i64, ptr %50, align 8, !tbaa !8
  %52 = getelementptr inbounds [100000 x i64], ptr @dep, i64 0, i64 %49
  %53 = load i64, ptr %52, align 8, !tbaa !8
  %54 = icmp sgt i64 %51, %53
  br i1 %54, label %55, label %56

55:                                               ; preds = %.lr.ph18
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  %.pre = load i64, ptr %5, align 8, !tbaa !8
  %.phi.trans.insert = getelementptr inbounds [100000 x i64], ptr @dep, i64 0, i64 %.pre
  %.pre24 = load i64, ptr %.phi.trans.insert, align 8, !tbaa !8
  %.pre25 = load i64, ptr %4, align 8, !tbaa !8
  %.phi.trans.insert26 = getelementptr inbounds [100000 x i64], ptr @dep, i64 0, i64 %.pre25
  %.pre27 = load i64, ptr %.phi.trans.insert26, align 8, !tbaa !8
  br label %56

56:                                               ; preds = %55, %.lr.ph18
  %57 = phi i64 [ %.pre27, %55 ], [ %51, %.lr.ph18 ]
  %58 = phi i64 [ %.pre24, %55 ], [ %53, %.lr.ph18 ]
  %59 = phi i64 [ %.pre, %55 ], [ %49, %.lr.ph18 ]
  %60 = sub nsw i64 %58, %57
  %61 = call noundef i64 @_Z4jumpxx(i64 noundef %59, i64 noundef %60)
  %62 = load i64, ptr %4, align 8, !tbaa !8
  %63 = icmp eq i64 %61, %62
  br i1 %63, label %64, label %70

64:                                               ; preds = %56
  %65 = load i64, ptr @add, align 16, !tbaa !8
  %66 = add nsw i64 %65, 1
  store i64 %66, ptr @add, align 16, !tbaa !8
  %67 = load i64, ptr %5, align 8, !tbaa !8
  %68 = add nsw i64 %60, -1
  %69 = call noundef i64 @_Z4jumpxx(i64 noundef %67, i64 noundef %68)
  br label %70

70:                                               ; preds = %56, %64
  %.sink34 = phi i64 [ %69, %64 ], [ %62, %56 ]
  %.sink33 = phi i64 [ -1, %64 ], [ 1, %56 ]
  %71 = getelementptr inbounds [100000 x i64], ptr @add, i64 0, i64 %.sink34
  %72 = load i64, ptr %71, align 8, !tbaa !8
  %73 = add nsw i64 %72, %.sink33
  store i64 %73, ptr %71, align 8, !tbaa !8
  %.sink30 = load i64, ptr %5, align 8, !tbaa !8
  %74 = getelementptr inbounds [100000 x i64], ptr @add, i64 0, i64 %.sink30
  %75 = load i64, ptr %74, align 8, !tbaa !8
  %76 = add nsw i64 %75, 1
  store i64 %76, ptr %74, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  %77 = add nuw nsw i64 %.01316, 1
  %78 = load i64, ptr @K, align 8, !tbaa !8
  %79 = icmp slt i64 %77, %78
  br i1 %79, label %.lr.ph18, label %._crit_edge19, !llvm.loop !16

._crit_edge23:                                    ; preds = %.lr.ph22, %._crit_edge19
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 10)
  ret i32 0

.lr.ph22:                                         ; preds = %._crit_edge19, %.lr.ph22
  %.020 = phi i64 [ %85, %.lr.ph22 ], [ 0, %._crit_edge19 ]
  %81 = getelementptr inbounds [100000 x i8], ptr @ans, i64 0, i64 %.020
  %82 = load i8, ptr %81, align 1, !tbaa !17, !range !19, !noundef !20
  %83 = trunc nuw i8 %82 to i1
  %84 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEb(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i1 noundef zeroext %83)
  %85 = add nuw nsw i64 %.020, 1
  %86 = load i64, ptr @N, align 8, !tbaa !8
  %87 = icmp slt i64 %85, %86
  br i1 %87, label %.lr.ph22, label %._crit_edge23, !llvm.loop !21
}

; 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 #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 uwtable
declare dso_local void @_ZN3DSU4initEx(ptr noundef nonnull align 8 dereferenceable(1600000), i64 noundef) local_unnamed_addr #0 align 2

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEb(ptr noundef nonnull align 8 dereferenceable(8), i1 noundef zeroext) local_unnamed_addr #0 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 #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 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 = { "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 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 #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 = !{!"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 = !{!14, !9, i64 0}
!14 = !{!"_ZTSSt4pairIxxE", !9, i64 0, !9, i64 8}
!15 = !{!14, !9, i64 8}
!16 = distinct !{!16, !12}
!17 = !{!18, !18, i64 0}
!18 = !{!"bool", !10, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !12}


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