; LLVM IR from Tunghohin/Competitive_Coding :: Hdu (hdu4612)

; 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.edge = type { i32, i32, i32 }
%"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" }

@e = external dso_local global [6000020 x %struct.edge], align 16
@head = external dso_local global [200010 x i32], align 16
@head_bcc = external dso_local global [200010 x i32], align 16
@tot = external dso_local global i32, align 4
@dfn = external dso_local global [200010 x i32], align 16
@timestamp = external dso_local global i32, align 4
@top = external dso_local global i32, align 4
@bcc_id = external dso_local global [200010 x i32], align 16
@bcc_cnt = external dso_local global i32, align 4
@mx = external dso_local global [200010 x i32], align 16
@smx = external dso_local global [200010 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6tarjanii(i32 noundef, i32 noundef) #1

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsii(i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %16 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %17 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %18 = getelementptr i8, ptr %17, i64 -24
  %19 = load i64, ptr %18, align 8
  %20 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %19
  %21 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %20, ptr noundef null)
  %22 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %23 = getelementptr i8, ptr %22, i64 -24
  %24 = load i64, ptr %23, align 8
  %25 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %24
  %26 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %25, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  br label %27

27:                                               ; preds = %130, %60, %0
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %28, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %30 = load i32, ptr %2, align 4, !tbaa !8
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %35, label %32

32:                                               ; preds = %27
  %33 = load i32, ptr %3, align 4, !tbaa !8
  %34 = icmp ne i32 %33, 0
  br label %35

35:                                               ; preds = %32, %27
  %36 = phi i1 [ true, %27 ], [ %34, %32 ]
  br i1 %36, label %37, label %137

37:                                               ; preds = %35
  %38 = load i32, ptr %2, align 4, !tbaa !8
  call void @_Z4initPii(ptr noundef @head, i32 noundef %38)
  %39 = load i32, ptr %2, align 4, !tbaa !8
  call void @_Z4initPii(ptr noundef @head_bcc, i32 noundef %39)
  %40 = load i32, ptr %2, align 4, !tbaa !8
  call void @_Z4initPii(ptr noundef @dfn, i32 noundef %40)
  %41 = load i32, ptr %2, align 4, !tbaa !8
  call void @_Z4initPii(ptr noundef @bcc_id, i32 noundef %41)
  store i32 0, ptr @top, align 4, !tbaa !8
  store i32 0, ptr @bcc_cnt, align 4, !tbaa !8
  store i32 0, ptr @timestamp, align 4, !tbaa !8
  store i32 0, ptr @tot, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 1, ptr %4, align 4, !tbaa !8
  br label %42

42:                                               ; preds = %54, %37
  %43 = load i32, ptr %4, align 4, !tbaa !8
  %44 = load i32, ptr %3, align 4, !tbaa !8
  %45 = icmp sle i32 %43, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %57

47:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %48 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %49 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %48, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %50 = load i32, ptr %5, align 4, !tbaa !8
  %51 = load i32, ptr %6, align 4, !tbaa !8
  call void @_Z8add_edgePiii(ptr noundef @head, i32 noundef %50, i32 noundef %51)
  %52 = load i32, ptr %6, align 4, !tbaa !8
  %53 = load i32, ptr %5, align 4, !tbaa !8
  call void @_Z8add_edgePiii(ptr noundef @head, i32 noundef %52, i32 noundef %53)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %54

54:                                               ; preds = %47
  %55 = load i32, ptr %4, align 4, !tbaa !8
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %4, align 4, !tbaa !8
  br label %42, !llvm.loop !11

57:                                               ; preds = %46
  call void @_Z6tarjanii(i32 noundef 1, i32 noundef -1)
  %58 = load i32, ptr @bcc_cnt, align 4, !tbaa !8
  %59 = icmp eq i32 %58, 1
  br i1 %59, label %60, label %63

60:                                               ; preds = %57
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %61, i8 noundef signext 10)
  br label %27, !llvm.loop !13

63:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 1, ptr %7, align 4, !tbaa !8
  br label %64

64:                                               ; preds = %106, %63
  %65 = load i32, ptr %7, align 4, !tbaa !8
  %66 = load i32, ptr %2, align 4, !tbaa !8
  %67 = icmp sle i32 %65, %66
  br i1 %67, label %69, label %68

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

69:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %70 = load i32, ptr %7, align 4, !tbaa !8
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [200010 x i32], ptr @head, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !8
  store i32 %73, ptr %9, align 4, !tbaa !8
  br label %74

74:                                               ; preds = %99, %69
  %75 = load i32, ptr %9, align 4, !tbaa !8
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %78, label %77

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

78:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %79 = load i32, ptr %9, align 4, !tbaa !8
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [6000020 x %struct.edge], ptr @e, i64 0, i64 %80
  %82 = getelementptr inbounds %struct.edge, ptr %81, i32 0, i32 1
  %83 = load i32, ptr %82, align 4, !tbaa !14
  store i32 %83, ptr %10, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %84 = load i32, ptr %7, align 4, !tbaa !8
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [200010 x i32], ptr @bcc_id, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !8
  store i32 %87, ptr %11, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %88 = load i32, ptr %10, align 4, !tbaa !8
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [200010 x i32], ptr @bcc_id, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !8
  store i32 %91, ptr %12, align 4, !tbaa !8
  %92 = load i32, ptr %11, align 4, !tbaa !8
  %93 = load i32, ptr %12, align 4, !tbaa !8
  %94 = icmp ne i32 %92, %93
  br i1 %94, label %95, label %98

95:                                               ; preds = %78
  %96 = load i32, ptr %11, align 4, !tbaa !8
  %97 = load i32, ptr %12, align 4, !tbaa !8
  call void @_Z8add_edgePiii(ptr noundef @head_bcc, i32 noundef %96, i32 noundef %97)
  br label %98

98:                                               ; preds = %95, %78
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %99

99:                                               ; preds = %98
  %100 = load i32, ptr %9, align 4, !tbaa !8
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [6000020 x %struct.edge], ptr @e, i64 0, i64 %101
  %103 = getelementptr inbounds %struct.edge, ptr %102, i32 0, i32 2
  %104 = load i32, ptr %103, align 4, !tbaa !16
  store i32 %104, ptr %9, align 4, !tbaa !8
  br label %74, !llvm.loop !17

105:                                              ; preds = %77
  br label %106

106:                                              ; preds = %105
  %107 = load i32, ptr %7, align 4, !tbaa !8
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %7, align 4, !tbaa !8
  br label %64, !llvm.loop !18

109:                                              ; preds = %68
  call void @_Z3dfsii(i32 noundef 1, i32 noundef -1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 -1, ptr %13, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 1, ptr %14, align 4, !tbaa !8
  br label %110

110:                                              ; preds = %127, %109
  %111 = load i32, ptr %14, align 4, !tbaa !8
  %112 = load i32, ptr @bcc_cnt, align 4, !tbaa !8
  %113 = icmp sle i32 %111, %112
  br i1 %113, label %115, label %114

114:                                              ; preds = %110
  store i32 13, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %130

115:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %116 = load i32, ptr %14, align 4, !tbaa !8
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [200010 x i32], ptr @mx, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !8
  %120 = load i32, ptr %14, align 4, !tbaa !8
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [200010 x i32], ptr @smx, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !8
  %124 = add nsw i32 %119, %123
  store i32 %124, ptr %15, align 4, !tbaa !8
  %125 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %126 = load i32, ptr %125, align 4, !tbaa !8
  store i32 %126, ptr %13, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %127

127:                                              ; preds = %115
  %128 = load i32, ptr %14, align 4, !tbaa !8
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %14, align 4, !tbaa !8
  br label %110, !llvm.loop !19

130:                                              ; preds = %114
  %131 = load i32, ptr @bcc_cnt, align 4, !tbaa !8
  %132 = sub nsw i32 %131, 1
  %133 = load i32, ptr %13, align 4, !tbaa !8
  %134 = sub nsw i32 %132, %133
  %135 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %134)
  %136 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %135, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %27, !llvm.loop !13

137:                                              ; preds = %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %138 = load i32, ptr %1, align 4
  ret i32 %138
}

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #4

; 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 nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #6

attributes #0 = { 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 #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !9, i64 4}
!15 = !{!"_ZTS4edge", !9, i64 0, !9, i64 4, !9, i64 8}
!16 = !{!15, !9, i64 8}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !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.edge = type { i32, i32, i32 }
%"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" }

@e = external dso_local local_unnamed_addr global [6000020 x %struct.edge], align 16
@head = external dso_local global [200010 x i32], align 16
@head_bcc = external dso_local global [200010 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@dfn = external dso_local global [200010 x i32], align 16
@timestamp = external dso_local local_unnamed_addr global i32, align 4
@top = external dso_local local_unnamed_addr global i32, align 4
@bcc_id = external dso_local global [200010 x i32], align 16
@bcc_cnt = external dso_local local_unnamed_addr global i32, align 4
@mx = external dso_local local_unnamed_addr global [200010 x i32], align 16
@smx = external dso_local local_unnamed_addr global [200010 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6tarjanii(i32 noundef, i32 noundef) local_unnamed_addr #1

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsii(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %8 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %9 = getelementptr i8, ptr %8, i64 -24
  %10 = load i64, ptr %9, align 8
  %11 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %10
  %12 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %11, ptr noundef null)
  %13 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %14 = getelementptr i8, ptr %13, i64 -24
  %15 = load i64, ptr %14, align 8
  %16 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %15
  %17 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %16, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %20 = load i32, ptr %1, align 4, !tbaa !8
  %21 = icmp ne i32 %20, 0
  %22 = load i32, ptr %2, align 4
  %23 = icmp ne i32 %22, 0
  %24 = select i1 %21, i1 true, i1 %23
  br i1 %24, label %.lr.ph47, label %._crit_edge48

.lr.ph47:                                         ; preds = %0, %.backedge
  %25 = phi i32 [ %46, %.backedge ], [ %20, %0 ]
  call void @_Z4initPii(ptr noundef nonnull @head, i32 noundef %25)
  %26 = load i32, ptr %1, align 4, !tbaa !8
  call void @_Z4initPii(ptr noundef nonnull @head_bcc, i32 noundef %26)
  %27 = load i32, ptr %1, align 4, !tbaa !8
  call void @_Z4initPii(ptr noundef nonnull @dfn, i32 noundef %27)
  %28 = load i32, ptr %1, align 4, !tbaa !8
  call void @_Z4initPii(ptr noundef nonnull @bcc_id, i32 noundef %28)
  store i32 0, ptr @top, align 4, !tbaa !8
  store i32 0, ptr @bcc_cnt, align 4, !tbaa !8
  store i32 0, ptr @timestamp, align 4, !tbaa !8
  store i32 0, ptr @tot, align 4, !tbaa !8
  %29 = load i32, ptr %2, align 4, !tbaa !8
  %.not29 = icmp slt i32 %29, 1
  br i1 %.not29, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph47
  call void @_Z6tarjanii(i32 noundef 1, i32 noundef -1)
  %30 = load i32, ptr @bcc_cnt, align 4, !tbaa !8
  %31 = icmp eq i32 %30, 1
  br i1 %31, label %41, label %.preheader

.preheader:                                       ; preds = %._crit_edge
  %32 = load i32, ptr %1, align 4, !tbaa !8
  %.not2537 = icmp slt i32 %32, 1
  br i1 %.not2537, label %._crit_edge40, label %.lr.ph39

.lr.ph:                                           ; preds = %.lr.ph47, %.lr.ph
  %.01930 = phi i32 [ %39, %.lr.ph ], [ 1, %.lr.ph47 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %33, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %35 = load i32, ptr %3, align 4, !tbaa !8
  %36 = load i32, ptr %4, align 4, !tbaa !8
  call void @_Z8add_edgePiii(ptr noundef nonnull @head, i32 noundef %35, i32 noundef %36)
  %37 = load i32, ptr %4, align 4, !tbaa !8
  %38 = load i32, ptr %3, align 4, !tbaa !8
  call void @_Z8add_edgePiii(ptr noundef nonnull @head, i32 noundef %37, i32 noundef %38)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %39 = add nuw nsw i32 %.01930, 1
  %40 = load i32, ptr %2, align 4, !tbaa !8
  %.not.not = icmp slt i32 %.01930, %40
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

41:                                               ; preds = %._crit_edge
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %42, i8 noundef signext 10)
  br label %.backedge

.backedge:                                        ; preds = %41, %._crit_edge45
  %44 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %45 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %44, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %46 = load i32, ptr %1, align 4, !tbaa !8
  %47 = icmp ne i32 %46, 0
  %48 = load i32, ptr %2, align 4
  %49 = icmp ne i32 %48, 0
  %50 = select i1 %47, i1 true, i1 %49
  br i1 %50, label %.lr.ph47, label %._crit_edge48, !llvm.loop !13

._crit_edge40:                                    ; preds = %._crit_edge36, %.preheader
  call void @_Z3dfsii(i32 noundef 1, i32 noundef -1)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  store i32 -1, ptr %5, align 4, !tbaa !8
  %51 = load i32, ptr @bcc_cnt, align 4, !tbaa !8
  %.not2641 = icmp slt i32 %51, 1
  br i1 %.not2641, label %._crit_edge45, label %.lr.ph44

.lr.ph39:                                         ; preds = %.preheader, %._crit_edge36
  %52 = phi i32 [ %55, %._crit_edge36 ], [ %32, %.preheader ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge36 ], [ 1, %.preheader ]
  %53 = getelementptr inbounds [200010 x i32], ptr @head, i64 0, i64 %indvars.iv
  %.02131 = load i32, ptr %53, align 4, !tbaa !8
  %.not2732 = icmp eq i32 %.02131, 0
  br i1 %.not2732, label %._crit_edge36, label %.lr.ph35

.lr.ph35:                                         ; preds = %.lr.ph39
  %54 = getelementptr inbounds [200010 x i32], ptr @bcc_id, i64 0, i64 %indvars.iv
  br label %57

._crit_edge36.loopexit:                           ; preds = %67
  %.pre = load i32, ptr %1, align 4, !tbaa !8
  br label %._crit_edge36

._crit_edge36:                                    ; preds = %._crit_edge36.loopexit, %.lr.ph39
  %55 = phi i32 [ %.pre, %._crit_edge36.loopexit ], [ %52, %.lr.ph39 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %56 = sext i32 %55 to i64
  %.not25.not = icmp slt i64 %indvars.iv, %56
  br i1 %.not25.not, label %.lr.ph39, label %._crit_edge40, !llvm.loop !14

57:                                               ; preds = %.lr.ph35, %67
  %.02133 = phi i32 [ %.02131, %.lr.ph35 ], [ %.021, %67 ]
  %58 = sext i32 %.02133 to i64
  %59 = getelementptr inbounds [6000020 x %struct.edge], ptr @e, i64 0, i64 %58
  %60 = getelementptr inbounds i8, ptr %59, i64 4
  %61 = load i32, ptr %60, align 4, !tbaa !15
  %62 = load i32, ptr %54, align 4, !tbaa !8
  %63 = sext i32 %61 to i64
  %64 = getelementptr inbounds [200010 x i32], ptr @bcc_id, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !8
  %.not28 = icmp eq i32 %62, %65
  br i1 %.not28, label %67, label %66

66:                                               ; preds = %57
  call void @_Z8add_edgePiii(ptr noundef nonnull @head_bcc, i32 noundef %62, i32 noundef %65)
  br label %67

67:                                               ; preds = %66, %57
  %68 = getelementptr inbounds i8, ptr %59, i64 8
  %.021 = load i32, ptr %68, align 4, !tbaa !8
  %.not27 = icmp eq i32 %.021, 0
  br i1 %.not27, label %._crit_edge36.loopexit, label %57, !llvm.loop !17

._crit_edge45:                                    ; preds = %.lr.ph44, %._crit_edge40
  %69 = phi i32 [ -1, %._crit_edge40 ], [ %80, %.lr.ph44 ]
  %.lcssa = phi i32 [ %51, %._crit_edge40 ], [ %81, %.lr.ph44 ]
  %70 = xor i32 %69, -1
  %71 = add i32 %.lcssa, %70
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %71)
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %72, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  br label %.backedge

.lr.ph44:                                         ; preds = %._crit_edge40, %.lr.ph44
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %.lr.ph44 ], [ 1, %._crit_edge40 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %74 = getelementptr inbounds [200010 x i32], ptr @mx, i64 0, i64 %indvars.iv51
  %75 = load i32, ptr %74, align 4, !tbaa !8
  %76 = getelementptr inbounds [200010 x i32], ptr @smx, i64 0, i64 %indvars.iv51
  %77 = load i32, ptr %76, align 4, !tbaa !8
  %78 = add nsw i32 %77, %75
  store i32 %78, ptr %6, align 4, !tbaa !8
  %79 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %80 = load i32, ptr %79, align 4, !tbaa !8
  store i32 %80, ptr %5, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %81 = load i32, ptr @bcc_cnt, align 4, !tbaa !8
  %82 = sext i32 %81 to i64
  %.not26.not = icmp slt i64 %indvars.iv51, %82
  br i1 %.not26.not, label %.lr.ph44, label %._crit_edge45, !llvm.loop !18

._crit_edge48:                                    ; preds = %.backedge, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0
}

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; 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 nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{!16, !9, i64 4}
!16 = !{!"_ZTS4edge", !9, i64 0, !9, i64 4, !9, i64 8}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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