; LLVM IR from tangjz/acm-icpc :: codeforces/complete (193A)

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@cnt = external dso_local global i32, align 4
@idx = external dso_local global [51 x [51 x i32]], align 16
@buf = external dso_local global [51 x [51 x i8]], align 16
@e = external dso_local global [2501 x %"class.std::vector"], align 16
@cut = external dso_local global [2501 x i8], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z6tarjanii(i32 noundef, i32 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 norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %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
  store i32 0, ptr %1, align 4
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %8

8:                                                ; preds = %19, %0
  %9 = load i32, ptr %2, align 4, !tbaa !5
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = icmp slt i32 %9, %10
  br i1 %11, label %13, label %12

12:                                               ; preds = %8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %22

13:                                               ; preds = %8
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [51 x [51 x i8]], ptr @buf, i64 0, i64 %15
  %17 = getelementptr inbounds [51 x i8], ptr %16, i64 0, i64 0
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %17)
  br label %19

19:                                               ; preds = %13
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr %2, align 4, !tbaa !5
  br label %8, !llvm.loop !9

22:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %126, %22
  %24 = load i32, ptr %3, align 4, !tbaa !5
  %25 = load i32, ptr @n, align 4, !tbaa !5
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %23
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %129

28:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %122, %28
  %30 = load i32, ptr %5, align 4, !tbaa !5
  %31 = load i32, ptr @m, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %125

34:                                               ; preds = %29
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [51 x [51 x i8]], ptr @buf, i64 0, i64 %36
  %38 = load i32, ptr %5, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [51 x i8], ptr %37, i64 0, i64 %39
  %41 = load i8, ptr %40, align 1, !tbaa !11
  %42 = sext i8 %41 to i32
  %43 = icmp eq i32 %42, 46
  br i1 %43, label %44, label %45

44:                                               ; preds = %34
  br label %122

45:                                               ; preds = %34
  %46 = load i32, ptr @cnt, align 4, !tbaa !5
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr @cnt, align 4, !tbaa !5
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [51 x [51 x i32]], ptr @idx, i64 0, i64 %49
  %51 = load i32, ptr %5, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [51 x i32], ptr %50, i64 0, i64 %52
  store i32 %47, ptr %53, align 4, !tbaa !5
  %54 = load i32, ptr %3, align 4, !tbaa !5
  %55 = icmp ne i32 %54, 0
  br i1 %55, label %56, label %87

56:                                               ; preds = %45
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = sub nsw i32 %57, 1
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [51 x [51 x i32]], ptr @idx, i64 0, i64 %59
  %61 = load i32, ptr %5, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [51 x i32], ptr %60, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %66, label %87

66:                                               ; preds = %56
  %67 = load i32, ptr @cnt, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [2501 x %"class.std::vector"], ptr @e, i64 0, i64 %68
  %70 = load i32, ptr %3, align 4, !tbaa !5
  %71 = sub nsw i32 %70, 1
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [51 x [51 x i32]], ptr @idx, i64 0, i64 %72
  %74 = load i32, ptr %5, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [51 x i32], ptr %73, i64 0, i64 %75
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %69, ptr noundef nonnull align 4 dereferenceable(4) %76)
  %77 = load i32, ptr %3, align 4, !tbaa !5
  %78 = sub nsw i32 %77, 1
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [51 x [51 x i32]], ptr @idx, i64 0, i64 %79
  %81 = load i32, ptr %5, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [51 x i32], ptr %80, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [2501 x %"class.std::vector"], ptr @e, i64 0, i64 %85
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %86, ptr noundef nonnull align 4 dereferenceable(4) @cnt)
  br label %87

87:                                               ; preds = %66, %56, %45
  %88 = load i32, ptr %5, align 4, !tbaa !5
  %89 = icmp ne i32 %88, 0
  br i1 %89, label %90, label %121

90:                                               ; preds = %87
  %91 = load i32, ptr %3, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [51 x [51 x i32]], ptr @idx, i64 0, i64 %92
  %94 = load i32, ptr %5, align 4, !tbaa !5
  %95 = sub nsw i32 %94, 1
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [51 x i32], ptr %93, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %100, label %121

100:                                              ; preds = %90
  %101 = load i32, ptr @cnt, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [2501 x %"class.std::vector"], ptr @e, i64 0, i64 %102
  %104 = load i32, ptr %3, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [51 x [51 x i32]], ptr @idx, i64 0, i64 %105
  %107 = load i32, ptr %5, align 4, !tbaa !5
  %108 = sub nsw i32 %107, 1
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [51 x i32], ptr %106, i64 0, i64 %109
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %103, ptr noundef nonnull align 4 dereferenceable(4) %110)
  %111 = load i32, ptr %3, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [51 x [51 x i32]], ptr @idx, i64 0, i64 %112
  %114 = load i32, ptr %5, align 4, !tbaa !5
  %115 = sub nsw i32 %114, 1
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [51 x i32], ptr %113, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [2501 x %"class.std::vector"], ptr @e, i64 0, i64 %119
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %120, ptr noundef nonnull align 4 dereferenceable(4) @cnt)
  br label %121

121:                                              ; preds = %100, %90, %87
  br label %122

122:                                              ; preds = %121, %44
  %123 = load i32, ptr %5, align 4, !tbaa !5
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %5, align 4, !tbaa !5
  br label %29, !llvm.loop !12

125:                                              ; preds = %33
  br label %126

126:                                              ; preds = %125
  %127 = load i32, ptr %3, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %3, align 4, !tbaa !5
  br label %23, !llvm.loop !13

129:                                              ; preds = %27
  %130 = load i32, ptr @cnt, align 4, !tbaa !5
  %131 = icmp slt i32 %130, 3
  br i1 %131, label %132, label %134

132:                                              ; preds = %129
  %133 = call i32 @puts(ptr noundef @.str.3)
  store i32 0, ptr %1, align 4
  br label %157

134:                                              ; preds = %129
  store i32 0, ptr @cnt, align 4, !tbaa !5
  %135 = call noundef i32 @_Z6tarjanii(i32 noundef 1, i32 noundef -1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %136

136:                                              ; preds = %150, %134
  %137 = load i32, ptr %6, align 4, !tbaa !5
  %138 = load i32, ptr @cnt, align 4, !tbaa !5
  %139 = icmp sle i32 %137, %138
  br i1 %139, label %141, label %140

140:                                              ; preds = %136
  store i32 11, ptr %4, align 4
  br label %153

141:                                              ; preds = %136
  %142 = load i32, ptr %6, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [2501 x i8], ptr @cut, i64 0, i64 %143
  %145 = load i8, ptr %144, align 1, !tbaa !14, !range !16, !noundef !17
  %146 = trunc i8 %145 to i1
  br i1 %146, label %147, label %149

147:                                              ; preds = %141
  %148 = call i32 @puts(ptr noundef @.str.4)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  br label %153

149:                                              ; preds = %141
  br label %150

150:                                              ; preds = %149
  %151 = load i32, ptr %6, align 4, !tbaa !5
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %6, align 4, !tbaa !5
  br label %136, !llvm.loop !18

153:                                              ; preds = %147, %140
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %154 = load i32, ptr %4, align 4
  switch i32 %154, label %159 [
    i32 11, label %155
    i32 1, label %157
  ]

155:                                              ; preds = %153
  %156 = call i32 @puts(ptr noundef @.str.5)
  store i32 0, ptr %1, align 4
  br label %157

157:                                              ; preds = %155, %153, %132
  %158 = load i32, ptr %1, align 4
  ret i32 %158

159:                                              ; preds = %153
  unreachable
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #3

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

declare i32 @puts(ptr noundef) #3

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 = { "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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !10}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@cnt = external dso_local global i32, align 4
@idx = external dso_local global [51 x [51 x i32]], align 16
@buf = external dso_local global [51 x [51 x i8]], align 16
@e = external dso_local global [2501 x %"class.std::vector"], align 16
@cut = external dso_local local_unnamed_addr global [2501 x i8], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %.lr.ph, label %._crit_edge47

.preheader42:                                     ; preds = %.lr.ph
  %4 = icmp sgt i32 %9, 0
  %5 = load i32, ptr @m, align 4
  %6 = icmp sgt i32 %5, 0
  %or.cond = select i1 %4, i1 %6, i1 false
  br i1 %or.cond, label %.preheader, label %._crit_edge47

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %7 = getelementptr inbounds [51 x [51 x i8]], ptr @buf, i64 0, i64 %indvars.iv
  %8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %7)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %9 = load i32, ptr @n, align 4, !tbaa !5
  %10 = sext i32 %9 to i64
  %11 = icmp slt i64 %indvars.iv.next, %10
  br i1 %11, label %.lr.ph, label %.preheader42, !llvm.loop !9

.preheader:                                       ; preds = %.preheader42, %._crit_edge
  %12 = phi i32 [ %65, %._crit_edge ], [ %5, %.preheader42 ]
  %13 = phi i32 [ %66, %._crit_edge ], [ %5, %.preheader42 ]
  %14 = phi i32 [ %67, %._crit_edge ], [ %5, %.preheader42 ]
  %indvars.iv64 = phi i64 [ %indvars.iv.next65, %._crit_edge ], [ 0, %.preheader42 ]
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %.lr.ph45, label %._crit_edge

.lr.ph45:                                         ; preds = %.preheader
  %.not35 = icmp eq i64 %indvars.iv64, 0
  %16 = add nsw i64 %indvars.iv64, -1
  br i1 %.not35, label %.lr.ph45.split.us.preheader, label %.lr.ph45.split.preheader

.lr.ph45.split.preheader:                         ; preds = %.lr.ph45
  %17 = getelementptr inbounds [51 x [51 x i8]], ptr @buf, i64 0, i64 %indvars.iv64, i64 0
  %18 = load i8, ptr %17, align 1, !tbaa !11
  %19 = icmp eq i8 %18, 46
  br i1 %19, label %32, label %20

20:                                               ; preds = %.lr.ph45.split.preheader
  %21 = load i32, ptr @cnt, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr @cnt, align 4, !tbaa !5
  %23 = getelementptr inbounds [51 x [51 x i32]], ptr @idx, i64 0, i64 %indvars.iv64, i64 0
  store i32 %22, ptr %23, align 4, !tbaa !5
  %24 = getelementptr inbounds [51 x [51 x i32]], ptr @idx, i64 0, i64 %16, i64 0
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %.not36.peel = icmp eq i32 %25, 0
  br i1 %.not36.peel, label %32, label %26

26:                                               ; preds = %20
  %27 = sext i32 %22 to i64
  %28 = getelementptr inbounds [2501 x %"class.std::vector"], ptr @e, i64 0, i64 %27
  tail call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %28, ptr noundef nonnull align 4 dereferenceable(4) %24)
  %29 = load i32, ptr %24, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [2501 x %"class.std::vector"], ptr @e, i64 0, i64 %30
  tail call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %31, ptr noundef nonnull align 4 dereferenceable(4) @cnt)
  br label %32

32:                                               ; preds = %20, %26, %.lr.ph45.split.preheader
  %33 = load i32, ptr @m, align 4, !tbaa !5
  %34 = icmp sgt i32 %33, 1
  br i1 %34, label %.lr.ph45.split, label %._crit_edge

.lr.ph45.split.us.preheader:                      ; preds = %.lr.ph45
  %35 = load i8, ptr @buf, align 16, !tbaa !11
  %36 = icmp eq i8 %35, 46
  br i1 %36, label %40, label %37

37:                                               ; preds = %.lr.ph45.split.us.preheader
  %38 = load i32, ptr @cnt, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr @cnt, align 4, !tbaa !5
  store i32 %39, ptr @idx, align 16, !tbaa !5
  br label %40

40:                                               ; preds = %37, %.lr.ph45.split.us.preheader
  %41 = icmp sgt i32 %13, 1
  br i1 %41, label %.lr.ph45.split.us, label %._crit_edge

.lr.ph45.split.us:                                ; preds = %40, %59
  %42 = phi i32 [ %60, %59 ], [ %12, %40 ]
  %indvars.iv60 = phi i64 [ %indvars.iv.next61, %59 ], [ 1, %40 ]
  %43 = getelementptr inbounds [51 x [51 x i8]], ptr @buf, i64 0, i64 0, i64 %indvars.iv60
  %44 = load i8, ptr %43, align 1, !tbaa !11
  %45 = icmp eq i8 %44, 46
  br i1 %45, label %59, label %46

46:                                               ; preds = %.lr.ph45.split.us
  %47 = load i32, ptr @cnt, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr @cnt, align 4, !tbaa !5
  %49 = getelementptr inbounds [51 x [51 x i32]], ptr @idx, i64 0, i64 0, i64 %indvars.iv60
  store i32 %48, ptr %49, align 4, !tbaa !5
  %50 = add nsw i64 %indvars.iv60, -1
  %51 = getelementptr inbounds [51 x [51 x i32]], ptr @idx, i64 0, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %.not38.us = icmp eq i32 %52, 0
  br i1 %.not38.us, label %59, label %53

53:                                               ; preds = %46
  %54 = sext i32 %48 to i64
  %55 = getelementptr inbounds [2501 x %"class.std::vector"], ptr @e, i64 0, i64 %54
  tail call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %55, ptr noundef nonnull align 4 dereferenceable(4) %51)
  %56 = load i32, ptr %51, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [2501 x %"class.std::vector"], ptr @e, i64 0, i64 %57
  tail call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %58, ptr noundef nonnull align 4 dereferenceable(4) @cnt)
  %.pre = load i32, ptr @m, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %53, %46, %.lr.ph45.split.us
  %60 = phi i32 [ %.pre, %53 ], [ %42, %46 ], [ %42, %.lr.ph45.split.us ]
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %61 = sext i32 %60 to i64
  %62 = icmp slt i64 %indvars.iv.next61, %61
  br i1 %62, label %.lr.ph45.split.us, label %._crit_edge, !llvm.loop !12

._crit_edge47:                                    ; preds = %._crit_edge, %0, %.preheader42
  %63 = load i32, ptr @cnt, align 4, !tbaa !5
  %64 = icmp slt i32 %63, 3
  br i1 %64, label %._crit_edge52, label %101

._crit_edge:                                      ; preds = %97, %59, %32, %40, %.preheader
  %65 = phi i32 [ %12, %.preheader ], [ %12, %40 ], [ %33, %32 ], [ %60, %59 ], [ %98, %97 ]
  %66 = phi i32 [ %13, %.preheader ], [ %13, %40 ], [ %33, %32 ], [ %60, %59 ], [ %98, %97 ]
  %67 = phi i32 [ %14, %.preheader ], [ %13, %40 ], [ %33, %32 ], [ %60, %59 ], [ %98, %97 ]
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %68 = load i32, ptr @n, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = icmp slt i64 %indvars.iv.next65, %69
  br i1 %70, label %.preheader, label %._crit_edge47, !llvm.loop !14

.lr.ph45.split:                                   ; preds = %32, %97
  %indvars.iv56 = phi i64 [ %indvars.iv.next57, %97 ], [ 1, %32 ]
  %71 = getelementptr inbounds [51 x [51 x i8]], ptr @buf, i64 0, i64 %indvars.iv64, i64 %indvars.iv56
  %72 = load i8, ptr %71, align 1, !tbaa !11
  %73 = icmp eq i8 %72, 46
  br i1 %73, label %97, label %74

74:                                               ; preds = %.lr.ph45.split
  %75 = load i32, ptr @cnt, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr @cnt, align 4, !tbaa !5
  %77 = getelementptr inbounds [51 x [51 x i32]], ptr @idx, i64 0, i64 %indvars.iv64, i64 %indvars.iv56
  store i32 %76, ptr %77, align 4, !tbaa !5
  %78 = getelementptr inbounds [51 x [51 x i32]], ptr @idx, i64 0, i64 %16, i64 %indvars.iv56
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %.not36 = icmp eq i32 %79, 0
  br i1 %.not36, label %86, label %80

80:                                               ; preds = %74
  %81 = sext i32 %76 to i64
  %82 = getelementptr inbounds [2501 x %"class.std::vector"], ptr @e, i64 0, i64 %81
  tail call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %82, ptr noundef nonnull align 4 dereferenceable(4) %78)
  %83 = load i32, ptr %78, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [2501 x %"class.std::vector"], ptr @e, i64 0, i64 %84
  tail call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %85, ptr noundef nonnull align 4 dereferenceable(4) @cnt)
  br label %86

86:                                               ; preds = %74, %80
  %87 = add nsw i64 %indvars.iv56, -1
  %88 = getelementptr inbounds [51 x [51 x i32]], ptr @idx, i64 0, i64 %indvars.iv64, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %.not38 = icmp eq i32 %89, 0
  br i1 %.not38, label %97, label %90

90:                                               ; preds = %86
  %91 = load i32, ptr @cnt, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [2501 x %"class.std::vector"], ptr @e, i64 0, i64 %92
  tail call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %93, ptr noundef nonnull align 4 dereferenceable(4) %88)
  %94 = load i32, ptr %88, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [2501 x %"class.std::vector"], ptr @e, i64 0, i64 %95
  tail call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %96, ptr noundef nonnull align 4 dereferenceable(4) @cnt)
  br label %97

97:                                               ; preds = %86, %90, %.lr.ph45.split
  %indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
  %98 = load i32, ptr @m, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = icmp slt i64 %indvars.iv.next57, %99
  br i1 %100, label %.lr.ph45.split, label %._crit_edge, !llvm.loop !16

101:                                              ; preds = %._crit_edge47
  store i32 0, ptr @cnt, align 4, !tbaa !5
  %102 = tail call noundef i32 @_Z6tarjanii(i32 noundef 1, i32 noundef -1)
  %103 = load i32, ptr @cnt, align 4, !tbaa !5
  %.not48 = icmp slt i32 %103, 1
  br i1 %.not48, label %._crit_edge52, label %.lr.ph51.preheader

.lr.ph51.preheader:                               ; preds = %101
  %104 = add nuw i32 %103, 1
  %wide.trip.count = zext i32 %104 to i64
  br label %.lr.ph51

105:                                              ; preds = %.lr.ph51
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge52, label %.lr.ph51, !llvm.loop !17

.lr.ph51:                                         ; preds = %.lr.ph51.preheader, %105
  %indvars.iv67 = phi i64 [ 1, %.lr.ph51.preheader ], [ %indvars.iv.next68, %105 ]
  %106 = getelementptr inbounds [2501 x i8], ptr @cut, i64 0, i64 %indvars.iv67
  %107 = load i8, ptr %106, align 1, !tbaa !18, !range !20, !noundef !21
  %108 = trunc nuw i8 %107 to i1
  br i1 %108, label %._crit_edge52, label %105

._crit_edge52:                                    ; preds = %105, %.lr.ph51, %101, %._crit_edge47
  %.str.4.sink = phi ptr [ @.str.3, %._crit_edge47 ], [ @.str.5, %101 ], [ @.str.4, %.lr.ph51 ], [ @.str.5, %105 ]
  %109 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.4.sink)
  ret i32 0
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #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 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 #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10, !13}
!13 = !{!"llvm.loop.peeled.count", i32 1}
!14 = distinct !{!14, !10, !15}
!15 = !{!"llvm.loop.unswitch.partial.disable"}
!16 = distinct !{!16, !10, !13}
!17 = distinct !{!17, !10}
!18 = !{!19, !19, i64 0}
!19 = !{!"bool", !7, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}


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