; LLVM IR from eyangch/competitive-programming :: Codeforces/1611 (e2)

; 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<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 }
%"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" }

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@X = external dso_local global [200000 x i64], align 16
@F = external dso_local global [200000 x i8], align 16
@mk = external dso_local global [200000 x i8], align 16
@graph = external dso_local global [200000 x %"class.std::vector"], 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 @_Z4dfsFxxx(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 uwtable
declare dso_local noundef zeroext i1 @_Z4dfsLxx(i64 noundef, i64 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, 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
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %13 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %14 = getelementptr i8, ptr %13, i64 -24
  %15 = load i64, ptr %14, align 8
  %16 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %15
  %17 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %16, ptr noundef null)
  %18 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %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) @T)
  br label %20

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

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

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

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

32:                                               ; preds = %27
  %33 = load i64, ptr %2, align 8, !tbaa !8
  %34 = getelementptr inbounds [200000 x %"class.std::vector"], ptr @graph, i64 0, i64 %33
  call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %34) #7
  br label %35

35:                                               ; preds = %32
  %36 = load i64, ptr %2, align 8, !tbaa !8
  %37 = add nsw i64 %36, 1
  store i64 %37, ptr %2, align 8, !tbaa !8
  br label %27, !llvm.loop !11

38:                                               ; preds = %31
  %39 = load i64, ptr @N, align 8, !tbaa !8
  %40 = getelementptr inbounds i8, ptr @F, i64 %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 0, ptr %3, align 4, !tbaa !13
  call void @_ZSt4fillIPbiEvT_S1_RKT0_(ptr noundef @F, ptr noundef %40, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  %41 = load i64, ptr @N, align 8, !tbaa !8
  %42 = getelementptr inbounds i8, ptr @mk, i64 %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !13
  call void @_ZSt4fillIPbiEvT_S1_RKT0_(ptr noundef @mk, ptr noundef %42, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store i64 0, ptr %5, align 8, !tbaa !8
  br label %43

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

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

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

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

55:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 0, ptr %6, align 8, !tbaa !8
  br label %56

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

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

61:                                               ; preds = %56
  %62 = load i64, ptr %6, align 8, !tbaa !8
  %63 = getelementptr inbounds [200000 x i64], ptr @X, i64 0, i64 %62
  %64 = load i64, ptr %63, align 8, !tbaa !8
  %65 = add nsw i64 %64, -1
  store i64 %65, ptr %63, align 8, !tbaa !8
  %66 = getelementptr inbounds [200000 x i8], ptr @F, i64 0, i64 %65
  store i8 1, ptr %66, align 1, !tbaa !16
  br label %67

67:                                               ; preds = %61
  %68 = load i64, ptr %6, align 8, !tbaa !8
  %69 = add nsw i64 %68, 1
  store i64 %69, ptr %6, align 8, !tbaa !8
  br label %56, !llvm.loop !18

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

71:                                               ; preds = %90, %70
  %72 = load i64, ptr %7, align 8, !tbaa !8
  %73 = load i64, ptr @N, align 8, !tbaa !8
  %74 = sub nsw i64 %73, 1
  %75 = icmp slt i64 %72, %74
  br i1 %75, label %77, label %76

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

77:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %78 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %79 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %78, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %80 = load i64, ptr %8, align 8, !tbaa !8
  %81 = sub nsw i64 %80, 1
  %82 = getelementptr inbounds [200000 x %"class.std::vector"], ptr @graph, i64 0, i64 %81
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %83 = load i64, ptr %9, align 8, !tbaa !8
  %84 = sub nsw i64 %83, 1
  store i64 %84, ptr %10, align 8, !tbaa !8
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %82, ptr noundef nonnull align 8 dereferenceable(8) %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  %85 = load i64, ptr %9, align 8, !tbaa !8
  %86 = sub nsw i64 %85, 1
  %87 = getelementptr inbounds [200000 x %"class.std::vector"], ptr @graph, i64 0, i64 %86
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %88 = load i64, ptr %8, align 8, !tbaa !8
  %89 = sub nsw i64 %88, 1
  store i64 %89, ptr %11, align 8, !tbaa !8
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %87, ptr noundef nonnull align 8 dereferenceable(8) %11)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %90

90:                                               ; preds = %77
  %91 = load i64, ptr %7, align 8, !tbaa !8
  %92 = add nsw i64 %91, 1
  store i64 %92, ptr %7, align 8, !tbaa !8
  br label %71, !llvm.loop !19

93:                                               ; preds = %76
  call void @_Z4dfsFxxx(i64 noundef 0, i64 noundef 0, i64 noundef 0)
  %94 = call noundef zeroext i1 @_Z4dfsLxx(i64 noundef 0, i64 noundef 0)
  br i1 %94, label %95, label %98

95:                                               ; preds = %93
  %96 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  %97 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %96, i8 noundef signext 10)
  br label %106

98:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %99 = load i64, ptr @N, align 8, !tbaa !8
  %100 = getelementptr inbounds i8, ptr @mk, i64 %99
  %101 = call noundef i32 @_ZSt10accumulateIPbiET0_T_S2_S1_(ptr noundef @mk, ptr noundef %100, i32 noundef 0)
  %102 = sext i32 %101 to i64
  store i64 %102, ptr %12, align 8, !tbaa !8
  %103 = load i64, ptr %12, align 8, !tbaa !8
  %104 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %103)
  %105 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %104, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %106

106:                                              ; preds = %98, %95
  br label %20, !llvm.loop !20

107:                                              ; preds = %20
  %108 = load i32, ptr %1, align 4
  ret i32 %108
}

; 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 @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) #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) #5

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZSt10accumulateIPbiET0_T_S2_S1_(ptr noundef, ptr noundef, i32 noundef) #6

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

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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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, !14, i64 0}
!14 = !{!"int", !10, i64 0}
!15 = distinct !{!15, !12}
!16 = !{!17, !17, i64 0}
!17 = !{!"bool", !10, i64 0}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !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::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 }
%"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" }

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@X = external dso_local global [200000 x i64], align 16
@F = external dso_local global [200000 x i8], align 16
@mk = external dso_local global [200000 x i8], align 16
@graph = external dso_local global [200000 x %"class.std::vector"], 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 @_Z4dfsFxxx(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 uwtable
declare dso_local noundef zeroext i1 @_Z4dfsLxx(i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %8 = getelementptr i8, ptr %7, i64 -24
  %9 = load i64, ptr %8, align 8
  %10 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %9
  %11 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %10, ptr noundef null)
  %12 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %13 = 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)
  %14 = load i64, ptr @T, align 8, !tbaa !8
  %15 = add nsw i64 %14, -1
  store i64 %15, ptr @T, align 8, !tbaa !8
  %.not29 = icmp eq i64 %14, 0
  br i1 %.not29, label %._crit_edge32, label %.lr.ph31

.lr.ph31:                                         ; preds = %0, %77
  %16 = 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)
  %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) @K)
  %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.ph31
  %.lcssa = phi i64 [ %18, %.lr.ph31 ], [ %27, %.lr.ph ]
  %20 = getelementptr inbounds i8, ptr @F, i64 %.lcssa
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  store i32 0, ptr %1, align 4, !tbaa !11
  call void @_ZSt4fillIPbiEvT_S1_RKT0_(ptr noundef nonnull @F, ptr noundef nonnull %20, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %21 = load i64, ptr @N, align 8, !tbaa !8
  %22 = getelementptr inbounds i8, ptr @mk, i64 %21
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  store i32 0, ptr %2, align 4, !tbaa !11
  call void @_ZSt4fillIPbiEvT_S1_RKT0_(ptr noundef nonnull @mk, ptr noundef nonnull %22, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %23 = load i64, ptr @K, align 8, !tbaa !8
  %24 = icmp sgt i64 %23, 0
  br i1 %24, label %.lr.ph22, label %.preheader

.lr.ph:                                           ; preds = %.lr.ph31, %.lr.ph
  %.019 = phi i64 [ %26, %.lr.ph ], [ 0, %.lr.ph31 ]
  %25 = getelementptr inbounds [200000 x %"class.std::vector"], ptr @graph, i64 0, i64 %.019
  call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #7
  %26 = add nuw nsw i64 %.019, 1
  %27 = load i64, ptr @N, align 8, !tbaa !8
  %28 = icmp slt i64 %26, %27
  br i1 %28, label %.lr.ph, label %._crit_edge, !llvm.loop !13

.preheader17:                                     ; preds = %.lr.ph22
  %29 = icmp sgt i64 %34, 0
  br i1 %29, label %.lr.ph25.preheader, label %.preheader

.lr.ph25.preheader:                               ; preds = %.preheader17
  %xtraiter = and i64 %34, 1
  %30 = icmp eq i64 %34, 1
  br i1 %30, label %.preheader.loopexit.unr-lcssa, label %.lr.ph25.preheader.new

.lr.ph25.preheader.new:                           ; preds = %.lr.ph25.preheader
  %unroll_iter = and i64 %34, 9223372036854775806
  br label %.lr.ph25

.lr.ph22:                                         ; preds = %._crit_edge, %.lr.ph22
  %.01520 = phi i64 [ %33, %.lr.ph22 ], [ 0, %._crit_edge ]
  %31 = getelementptr inbounds [200000 x i64], ptr @X, i64 0, i64 %.01520
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %31)
  %33 = add nuw nsw i64 %.01520, 1
  %34 = load i64, ptr @K, align 8, !tbaa !8
  %35 = icmp slt i64 %33, %34
  br i1 %35, label %.lr.ph22, label %.preheader17, !llvm.loop !15

.preheader.loopexit.unr-lcssa:                    ; preds = %.lr.ph25, %.lr.ph25.preheader
  %.01424.unr = phi i64 [ 0, %.lr.ph25.preheader ], [ %51, %.lr.ph25 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph25.epil

.lr.ph25.epil:                                    ; preds = %.preheader.loopexit.unr-lcssa
  %36 = getelementptr inbounds [200000 x i64], ptr @X, i64 0, i64 %.01424.unr
  %37 = load i64, ptr %36, align 8, !tbaa !8
  %38 = add nsw i64 %37, -1
  store i64 %38, ptr %36, align 8, !tbaa !8
  %39 = getelementptr inbounds [200000 x i8], ptr @F, i64 0, i64 %38
  store i8 1, ptr %39, align 1, !tbaa !16
  br label %.preheader

.preheader:                                       ; preds = %.lr.ph25.epil, %.preheader.loopexit.unr-lcssa, %._crit_edge, %.preheader17
  %40 = load i64, ptr @N, align 8, !tbaa !8
  %41 = icmp sgt i64 %40, 1
  br i1 %41, label %.lr.ph27, label %._crit_edge28

.lr.ph25:                                         ; preds = %.lr.ph25, %.lr.ph25.preheader.new
  %.01424 = phi i64 [ 0, %.lr.ph25.preheader.new ], [ %51, %.lr.ph25 ]
  %niter = phi i64 [ 0, %.lr.ph25.preheader.new ], [ %niter.next.1, %.lr.ph25 ]
  %42 = getelementptr inbounds [200000 x i64], ptr @X, i64 0, i64 %.01424
  %43 = load i64, ptr %42, align 16, !tbaa !8
  %44 = add nsw i64 %43, -1
  store i64 %44, ptr %42, align 16, !tbaa !8
  %45 = getelementptr inbounds [200000 x i8], ptr @F, i64 0, i64 %44
  store i8 1, ptr %45, align 1, !tbaa !16
  %46 = or disjoint i64 %.01424, 1
  %47 = getelementptr inbounds [200000 x i64], ptr @X, i64 0, i64 %46
  %48 = load i64, ptr %47, align 8, !tbaa !8
  %49 = add nsw i64 %48, -1
  store i64 %49, ptr %47, align 8, !tbaa !8
  %50 = getelementptr inbounds [200000 x i8], ptr @F, i64 0, i64 %49
  store i8 1, ptr %50, align 1, !tbaa !16
  %51 = add nuw nsw i64 %.01424, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.preheader.loopexit.unr-lcssa, label %.lr.ph25, !llvm.loop !18

._crit_edge28:                                    ; preds = %.lr.ph27, %.preheader
  call void @_Z4dfsFxxx(i64 noundef 0, i64 noundef 0, i64 noundef 0)
  %52 = call noundef zeroext i1 @_Z4dfsLxx(i64 noundef 0, i64 noundef 0)
  br i1 %52, label %69, label %71

.lr.ph27:                                         ; preds = %.preheader, %.lr.ph27
  %.01326 = phi i64 [ %65, %.lr.ph27 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %53 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %54 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %53, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %55 = load i64, ptr %3, align 8, !tbaa !8
  %56 = add nsw i64 %55, -1
  %57 = getelementptr inbounds [200000 x %"class.std::vector"], ptr @graph, i64 0, i64 %56
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %58 = load i64, ptr %4, align 8, !tbaa !8
  %59 = add nsw i64 %58, -1
  store i64 %59, ptr %5, align 8, !tbaa !8
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %57, ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  %60 = load i64, ptr %4, align 8, !tbaa !8
  %61 = add nsw i64 %60, -1
  %62 = getelementptr inbounds [200000 x %"class.std::vector"], ptr @graph, i64 0, i64 %61
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %63 = load i64, ptr %3, align 8, !tbaa !8
  %64 = add nsw i64 %63, -1
  store i64 %64, ptr %6, align 8, !tbaa !8
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %62, ptr noundef nonnull align 8 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  %65 = add nuw nsw i64 %.01326, 1
  %66 = load i64, ptr @N, align 8, !tbaa !8
  %67 = add nsw i64 %66, -1
  %68 = icmp slt i64 %65, %67
  br i1 %68, label %.lr.ph27, label %._crit_edge28, !llvm.loop !19

69:                                               ; preds = %._crit_edge28
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  br label %77

71:                                               ; preds = %._crit_edge28
  %72 = load i64, ptr @N, align 8, !tbaa !8
  %73 = getelementptr inbounds i8, ptr @mk, i64 %72
  %74 = call noundef i32 @_ZSt10accumulateIPbiET0_T_S2_S1_(ptr noundef nonnull @mk, ptr noundef nonnull %73, i32 noundef 0)
  %75 = sext i32 %74 to i64
  %76 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %75)
  br label %77

77:                                               ; preds = %71, %69
  %.sink = phi ptr [ %76, %71 ], [ %70, %69 ]
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %.sink, i8 noundef signext 10)
  %79 = load i64, ptr @T, align 8, !tbaa !8
  %80 = add nsw i64 %79, -1
  store i64 %80, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %79, 0
  br i1 %.not, label %._crit_edge32, label %.lr.ph31, !llvm.loop !20

._crit_edge32:                                    ; preds = %77, %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 @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) 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 #5

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZSt10accumulateIPbiET0_T_S2_S1_(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #6

; 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

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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!17, !17, i64 0}
!17 = !{!"bool", !10, i64 0}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}


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