; LLVM IR from Tunghohin/Competitive_Coding :: Luogu/p4427.ll (Z3bfsi)

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

@e = external dso_local global [600010 x %struct.edge], align 16
@head = external dso_local global [300010 x i32], align 16
@depth = external dso_local global [300010 x i32], align 16
@depth_k = external dso_local global [300010 x [60 x i32]], align 16
@f = external dso_local global [300010 x [20 x i32]], align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3qmiiii(i32 noundef, 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 uwtable
define dso_local void @_Z3bfsi(i32 noundef %0) #2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::queue", align 8
  %4 = alloca ptr, align 8
  %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 i64, align 8
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 80, ptr %3) #5
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  call void @llvm.memset.p0.i64(ptr align 16 @depth, i8 63, i64 1200040, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @depth_k, i8 0, i64 72002400, i1 false)
  store i32 -1, ptr @depth, align 16, !tbaa !5
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [300010 x i32], ptr @depth, i64 0, i64 %14
  store i32 0, ptr %15, align 4, !tbaa !5
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(4) %2)
          to label %16 unwind label %34

16:                                               ; preds = %1
  br label %17

17:                                               ; preds = %152, %16
  %18 = invoke noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %19 unwind label %34

19:                                               ; preds = %17
  %20 = xor i1 %18, true
  br i1 %20, label %21, label %154

21:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %22 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %23 unwind label %38

23:                                               ; preds = %21
  %24 = load i32, ptr %22, align 4, !tbaa !5
  store i32 %24, ptr %6, align 4, !tbaa !5
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %25 unwind label %38

25:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [300010 x i32], ptr @head, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  store i32 %29, ptr %7, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %146, %25
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %42, label %33

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

34:                                               ; preds = %17, %1
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %4, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %5, align 4
  br label %155

38:                                               ; preds = %23, %21
  %39 = landingpad { ptr, i32 }
          cleanup
  %40 = extractvalue { ptr, i32 } %39, 0
  store ptr %40, ptr %4, align 8
  %41 = extractvalue { ptr, i32 } %39, 1
  store i32 %41, ptr %5, align 4
  br label %153

42:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %43 = load i32, ptr %7, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [600010 x %struct.edge], ptr @e, i64 0, i64 %44
  %46 = getelementptr inbounds %struct.edge, ptr %45, i32 0, i32 0
  %47 = load i32, ptr %46, align 8, !tbaa !9
  store i32 %47, ptr %9, align 4, !tbaa !5
  %48 = load i32, ptr %9, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [300010 x i32], ptr @depth, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = load i32, ptr %6, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [300010 x i32], ptr @depth, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  %57 = icmp sgt i32 %51, %56
  br i1 %57, label %58, label %145

58:                                               ; preds = %42
  %59 = load i32, ptr %6, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [300010 x i32], ptr @depth, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  %64 = load i32, ptr %9, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [300010 x i32], ptr @depth, i64 0, i64 %65
  store i32 %63, ptr %66, align 4, !tbaa !5
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %67 unwind label %77

67:                                               ; preds = %58
  %68 = load i32, ptr %6, align 4, !tbaa !5
  %69 = load i32, ptr %9, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %70
  %72 = getelementptr inbounds [20 x i32], ptr %71, i64 0, i64 0
  store i32 %68, ptr %72, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %103, %67
  %74 = load i32, ptr %10, align 4, !tbaa !5
  %75 = icmp sle i32 %74, 15
  br i1 %75, label %81, label %76

76:                                               ; preds = %73
  store i32 7, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %106

77:                                               ; preds = %58
  %78 = landingpad { ptr, i32 }
          cleanup
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %4, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %153

81:                                               ; preds = %73
  %82 = load i32, ptr %9, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %83
  %85 = load i32, ptr %10, align 4, !tbaa !5
  %86 = sub nsw i32 %85, 1
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [20 x i32], ptr %84, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %90
  %92 = load i32, ptr %10, align 4, !tbaa !5
  %93 = sub nsw i32 %92, 1
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [20 x i32], ptr %91, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = load i32, ptr %9, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %98
  %100 = load i32, ptr %10, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [20 x i32], ptr %99, i64 0, i64 %101
  store i32 %96, ptr %102, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %81
  %104 = load i32, ptr %10, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %10, align 4, !tbaa !5
  br label %73, !llvm.loop !11

106:                                              ; preds = %76
  %107 = load i32, ptr %9, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [300010 x [60 x i32]], ptr @depth_k, i64 0, i64 %108
  %110 = getelementptr inbounds [60 x i32], ptr %109, i64 0, i64 0
  store i32 1, ptr %110, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %141, %106
  %112 = load i32, ptr %11, align 4, !tbaa !5
  %113 = icmp sle i32 %112, 50
  br i1 %113, label %115, label %114

114:                                              ; preds = %111
  store i32 10, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %144

115:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %116 = load i32, ptr %9, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [300010 x i32], ptr @depth, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = load i32, ptr %11, align 4, !tbaa !5
  %121 = call noundef i64 @_Z3qmiiii(i32 noundef %119, i32 noundef %120, i32 noundef 998244353)
  store i64 %121, ptr %12, align 8, !tbaa !13
  %122 = load i32, ptr %6, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [300010 x [60 x i32]], ptr @depth_k, i64 0, i64 %123
  %125 = load i32, ptr %11, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [60 x i32], ptr %124, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = load i64, ptr %12, align 8, !tbaa !13
  %131 = add nsw i64 %129, %130
  %132 = add nsw i64 %131, 998244353
  %133 = srem i64 %132, 998244353
  %134 = trunc i64 %133 to i32
  %135 = load i32, ptr %9, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [300010 x [60 x i32]], ptr @depth_k, i64 0, i64 %136
  %138 = load i32, ptr %11, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [60 x i32], ptr %137, i64 0, i64 %139
  store i32 %134, ptr %140, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %141

141:                                              ; preds = %115
  %142 = load i32, ptr %11, align 4, !tbaa !5
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %11, align 4, !tbaa !5
  br label %111, !llvm.loop !15

144:                                              ; preds = %114
  br label %145

145:                                              ; preds = %144, %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %146

146:                                              ; preds = %145
  %147 = load i32, ptr %7, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [600010 x %struct.edge], ptr @e, i64 0, i64 %148
  %150 = getelementptr inbounds %struct.edge, ptr %149, i32 0, i32 1
  %151 = load i32, ptr %150, align 4, !tbaa !16
  store i32 %151, ptr %7, align 4, !tbaa !5
  br label %30, !llvm.loop !17

152:                                              ; preds = %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %17, !llvm.loop !18

153:                                              ; preds = %77, %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %155

154:                                              ; preds = %19
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #5
  ret void

155:                                              ; preds = %153, %34
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #5
  br label %156

156:                                              ; preds = %155
  %157 = load ptr, ptr %4, align 8
  %158 = load i32, ptr %5, align 4
  %159 = insertvalue { ptr, i32 } poison, ptr %157, 0
  %160 = insertvalue { ptr, i32 } %159, i32 %158, 1
  resume { ptr, i32 } %160
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { 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 = !{!10, !6, i64 0}
!10 = !{!"_ZTS4edge", !6, i64 0, !6, i64 4}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = distinct !{!15, !12}
!16 = !{!10, !6, i64 4}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !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 }
%"class.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@e = external dso_local local_unnamed_addr global [600010 x %struct.edge], align 16
@head = external dso_local local_unnamed_addr global [300010 x i32], align 16
@depth = external dso_local local_unnamed_addr global [300010 x i32], align 16
@depth_k = external dso_local local_unnamed_addr global [300010 x [60 x i32]], align 16
@f = external dso_local local_unnamed_addr global [300010 x [20 x i32]], align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3qmiiii(i32 noundef, i32 noundef, i32 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
define dso_local void @_Z3bfsi(i32 noundef %0) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::queue", align 8
  %4 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %3) #5
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1200040) @depth, i8 63, i64 1200040, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(72002400) @depth_k, i8 0, i64 72002400, i1 false)
  store i32 -1, ptr @depth, align 16, !tbaa !5
  %5 = sext i32 %0 to i64
  %6 = getelementptr inbounds [300010 x i32], ptr @depth, i64 0, i64 %5
  store i32 0, ptr %6, align 4, !tbaa !5
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(4) %2)
          to label %.preheader unwind label %15

.preheader:                                       ; preds = %1
  %7 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br i1 %7, label %._crit_edge, label %.lr.ph32

.loopexit26:                                      ; preds = %.loopexit, %.lr.ph32
  %8 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br i1 %8, label %._crit_edge, label %.lr.ph32, !llvm.loop !9

.lr.ph32:                                         ; preds = %.preheader, %.loopexit26
  %9 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %10 = load i32, ptr %9, align 4, !tbaa !5
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds [300010 x i32], ptr @head, i64 0, i64 %11
  %.02229 = load i32, ptr %12, align 4, !tbaa !5
  %.not30 = icmp eq i32 %.02229, 0
  br i1 %.not30, label %.loopexit26, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph32
  %13 = getelementptr inbounds [300010 x i32], ptr @depth, i64 0, i64 %11
  %14 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %11, i64 0
  br label %17

15:                                               ; preds = %1
  %16 = landingpad { ptr, i32 }
          cleanup
  br label %111

17:                                               ; preds = %.lr.ph, %.loopexit
  %.02231 = phi i32 [ %.02229, %.lr.ph ], [ %.022, %.loopexit ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  %18 = sext i32 %.02231 to i64
  %19 = getelementptr inbounds [600010 x %struct.edge], ptr @e, i64 0, i64 %18
  %20 = load i32, ptr %19, align 8, !tbaa !11
  store i32 %20, ptr %4, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [300010 x i32], ptr @depth, i64 0, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = load i32, ptr %13, align 4, !tbaa !5
  %25 = add nsw i32 %24, 1
  %26 = icmp sgt i32 %23, %25
  br i1 %26, label %27, label %.loopexit

27:                                               ; preds = %17
  store i32 %25, ptr %22, align 4, !tbaa !5
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %28 unwind label %91

28:                                               ; preds = %27
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %30
  store i32 %10, ptr %31, align 16, !tbaa !5
  %32 = load i32, ptr %14, align 16, !tbaa !5
  %33 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %30, i64 1
  store i32 %32, ptr %33, align 4, !tbaa !5
  %34 = sext i32 %32 to i64
  %35 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %34, i64 1
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %30, i64 2
  store i32 %36, ptr %37, align 8, !tbaa !5
  %38 = sext i32 %36 to i64
  %39 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %38, i64 2
  %40 = load i32, ptr %39, align 8, !tbaa !5
  %41 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %30, i64 3
  store i32 %40, ptr %41, align 4, !tbaa !5
  %42 = sext i32 %40 to i64
  %43 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %42, i64 3
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %30, i64 4
  store i32 %44, ptr %45, align 16, !tbaa !5
  %46 = sext i32 %44 to i64
  %47 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %46, i64 4
  %48 = load i32, ptr %47, align 16, !tbaa !5
  %49 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %30, i64 5
  store i32 %48, ptr %49, align 4, !tbaa !5
  %50 = sext i32 %48 to i64
  %51 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %50, i64 5
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %30, i64 6
  store i32 %52, ptr %53, align 8, !tbaa !5
  %54 = sext i32 %52 to i64
  %55 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %54, i64 6
  %56 = load i32, ptr %55, align 8, !tbaa !5
  %57 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %30, i64 7
  store i32 %56, ptr %57, align 4, !tbaa !5
  %58 = sext i32 %56 to i64
  %59 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %58, i64 7
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %30, i64 8
  store i32 %60, ptr %61, align 16, !tbaa !5
  %62 = sext i32 %60 to i64
  %63 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %62, i64 8
  %64 = load i32, ptr %63, align 16, !tbaa !5
  %65 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %30, i64 9
  store i32 %64, ptr %65, align 4, !tbaa !5
  %66 = sext i32 %64 to i64
  %67 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %66, i64 9
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %30, i64 10
  store i32 %68, ptr %69, align 8, !tbaa !5
  %70 = sext i32 %68 to i64
  %71 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %70, i64 10
  %72 = load i32, ptr %71, align 8, !tbaa !5
  %73 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %30, i64 11
  store i32 %72, ptr %73, align 4, !tbaa !5
  %74 = sext i32 %72 to i64
  %75 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %74, i64 11
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %30, i64 12
  store i32 %76, ptr %77, align 16, !tbaa !5
  %78 = sext i32 %76 to i64
  %79 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %78, i64 12
  %80 = load i32, ptr %79, align 16, !tbaa !5
  %81 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %30, i64 13
  store i32 %80, ptr %81, align 4, !tbaa !5
  %82 = sext i32 %80 to i64
  %83 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %82, i64 13
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %30, i64 14
  store i32 %84, ptr %85, align 8, !tbaa !5
  %86 = sext i32 %84 to i64
  %87 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %86, i64 14
  %88 = load i32, ptr %87, align 8, !tbaa !5
  %89 = getelementptr inbounds [300010 x [20 x i32]], ptr @f, i64 0, i64 %30, i64 15
  store i32 %88, ptr %89, align 4, !tbaa !5
  %90 = getelementptr inbounds [300010 x [60 x i32]], ptr @depth_k, i64 0, i64 %30
  store i32 1, ptr %90, align 16, !tbaa !5
  br label %93

91:                                               ; preds = %27
  %92 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  br label %111

93:                                               ; preds = %28, %93
  %94 = phi i32 [ %29, %28 ], [ %107, %93 ]
  %indvars.iv = phi i64 [ 1, %28 ], [ %indvars.iv.next, %93 ]
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [300010 x i32], ptr @depth, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = trunc nuw nsw i64 %indvars.iv to i32
  %99 = call noundef i64 @_Z3qmiiii(i32 noundef %97, i32 noundef %98, i32 noundef 998244353)
  %100 = getelementptr inbounds [300010 x [60 x i32]], ptr @depth_k, i64 0, i64 %11, i64 %indvars.iv
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = add i64 %99, 998244353
  %104 = add i64 %103, %102
  %105 = srem i64 %104, 998244353
  %106 = trunc nsw i64 %105 to i32
  %107 = load i32, ptr %4, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [300010 x [60 x i32]], ptr @depth_k, i64 0, i64 %108, i64 %indvars.iv
  store i32 %106, ptr %109, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 51
  br i1 %exitcond.not, label %.loopexit, label %93, !llvm.loop !13

.loopexit:                                        ; preds = %93, %17
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  %110 = getelementptr inbounds i8, ptr %19, i64 4
  %.022 = load i32, ptr %110, align 4, !tbaa !5
  %.not = icmp eq i32 %.022, 0
  br i1 %.not, label %.loopexit26, label %17, !llvm.loop !14

._crit_edge:                                      ; preds = %.loopexit26, %.preheader
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %3) #5
  ret void

111:                                              ; preds = %91, %15
  %.pn = phi { ptr, i32 } [ %92, %91 ], [ %16, %15 ]
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %3) #5
  resume { ptr, i32 } %.pn
}

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { 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 = !{!12, !6, i64 0}
!12 = !{!"_ZTS4edge", !6, i64 0, !6, i64 4}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


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