; LLVM IR from tangjz/acm-icpc :: lydsy (3771)

; 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.fastIO::Output" = type { [1048577 x i8], ptr, ptr }
%"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 }

@_ZN6fastIO3outE = external dso_local global %"struct.fastIO::Output", align 8
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [50001 x i32], align 16
@f = external dso_local global [3 x %"class.std::vector"], align 16
@g = external dso_local global %"class.std::vector", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z7initNTTi(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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_addii(i32 noundef, i32 noundef) #2

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

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

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

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

11:                                               ; preds = %25, %0
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = icmp slt i32 %12, %13
  br i1 %14, label %16, label %15

15:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %28

16:                                               ; preds = %11
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [50001 x i32], ptr @a, i64 0, i64 %18
  call void @_ZN6fastIO7nextIntERi(ptr noundef nonnull align 4 dereferenceable(4) %19)
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [50001 x i32], ptr @a, i64 0, i64 %21
  %23 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @m, ptr noundef nonnull align 4 dereferenceable(4) %22)
  %24 = load i32, ptr %23, align 4, !tbaa !5
  store i32 %24, ptr @m, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %16
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %2, align 4, !tbaa !5
  br label %11, !llvm.loop !9

28:                                               ; preds = %15
  %29 = load i32, ptr @m, align 4, !tbaa !5
  %30 = mul nsw i32 %29, 3
  %31 = add nsw i32 %30, 1
  call void @_Z7initNTTi(i32 noundef %31)
  %32 = load i32, ptr @m, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  %34 = sext i32 %33 to i64
  call void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @f, i64 noundef %34)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %49, %28
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = load i32, ptr @n, align 4, !tbaa !5
  %38 = icmp slt i32 %36, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %52

40:                                               ; preds = %35
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [50001 x i32], ptr @a, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @f, i64 noundef %45) #6
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %46, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %40
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %3, align 4, !tbaa !5
  br label %35, !llvm.loop !11

52:                                               ; preds = %39
  call void @_Z7polyMulRKSt6vectorIiSaIiEES3_RS1_(ptr noundef nonnull align 8 dereferenceable(24) @f, ptr noundef nonnull align 8 dereferenceable(24) @f, ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds ([3 x %"class.std::vector"], ptr @f, i64 0, i64 1))
  call void @_Z7polyMulRKSt6vectorIiSaIiEES3_RS1_(ptr noundef nonnull align 8 dereferenceable(24) @f, ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds ([3 x %"class.std::vector"], ptr @f, i64 0, i64 1), ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds ([3 x %"class.std::vector"], ptr @f, i64 0, i64 2))
  %53 = load i32, ptr @m, align 4, !tbaa !5
  %54 = shl i32 %53, 1
  %55 = or i32 %54, 1
  %56 = sext i32 %55 to i64
  call void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @g, i64 noundef %56)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %89, %52
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = load i32, ptr @m, align 4, !tbaa !5
  %60 = icmp sle i32 %58, %59
  br i1 %60, label %62, label %61

61:                                               ; preds = %57
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %92

62:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %63 = load i32, ptr %4, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @f, i64 noundef %64) #6
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = shl i32 %67, 1
  %69 = sext i32 %68 to i64
  %70 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @g, i64 noundef %69) #6
  store i32 %66, ptr %70, align 4, !tbaa !5
  store i32 %66, ptr %5, align 4, !tbaa !5
  %71 = load i32, ptr %4, align 4, !tbaa !5
  %72 = shl i32 %71, 1
  %73 = sext i32 %72 to i64
  %74 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds ([3 x %"class.std::vector"], ptr @f, i64 0, i64 1), i64 noundef %73) #6
  %75 = load i32, ptr %5, align 4, !tbaa !5
  %76 = sub nsw i32 998244353, %75
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %74, i32 noundef %76)
  %77 = load i32, ptr %5, align 4, !tbaa !5
  %78 = load i32, ptr %5, align 4, !tbaa !5
  %79 = call noundef i32 @_Z7mod_addii(i32 noundef %77, i32 noundef %78)
  store i32 %79, ptr %5, align 4, !tbaa !5
  %80 = load i32, ptr %4, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds ([3 x %"class.std::vector"], ptr @f, i64 0, i64 1), i64 noundef %81) #6
  %83 = load i32, ptr %5, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %82, i32 noundef %83)
  %84 = load i32, ptr %4, align 4, !tbaa !5
  %85 = mul nsw i32 %84, 3
  %86 = sext i32 %85 to i64
  %87 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds ([3 x %"class.std::vector"], ptr @f, i64 0, i64 2), i64 noundef %86) #6
  %88 = load i32, ptr %5, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %87, i32 noundef %88)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %89

89:                                               ; preds = %62
  %90 = load i32, ptr %4, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %4, align 4, !tbaa !5
  br label %57, !llvm.loop !12

92:                                               ; preds = %61
  call void @_Z7polyMulRKSt6vectorIiSaIiEES3_RS1_(ptr noundef nonnull align 8 dereferenceable(24) @f, ptr noundef nonnull align 8 dereferenceable(24) @g, ptr noundef nonnull align 8 dereferenceable(24) @g)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %108, %92
  %94 = load i32, ptr %6, align 4, !tbaa !5
  %95 = load i32, ptr @m, align 4, !tbaa !5
  %96 = shl i32 %95, 1
  %97 = icmp sle i32 %94, %96
  br i1 %97, label %99, label %98

98:                                               ; preds = %93
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %111

99:                                               ; preds = %93
  %100 = load i32, ptr %6, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @g, i64 noundef %101) #6
  %103 = load i32, ptr %6, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds ([3 x %"class.std::vector"], ptr @f, i64 0, i64 1), i64 noundef %104) #6
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = sub nsw i32 998244353, %106
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %102, i32 noundef %107)
  br label %108

108:                                              ; preds = %99
  %109 = load i32, ptr %6, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %6, align 4, !tbaa !5
  br label %93, !llvm.loop !13

111:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 166374059, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %144, %111
  %113 = load i32, ptr %8, align 4, !tbaa !5
  %114 = load i32, ptr @m, align 4, !tbaa !5
  %115 = mul nsw i32 %114, 3
  %116 = icmp sle i32 %113, %115
  br i1 %116, label %118, label %117

117:                                              ; preds = %112
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %147

118:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %119 = load i32, ptr %8, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @g, i64 noundef %120) #6
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = sub nsw i32 998244353, %122
  store i32 %123, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %124 = load i32, ptr %8, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds ([3 x %"class.std::vector"], ptr @f, i64 0, i64 2), i64 noundef %125) #6
  %127 = load i32, ptr %126, align 4, !tbaa !5
  store i32 %127, ptr %10, align 4, !tbaa !5
  %128 = load i32, ptr %9, align 4, !tbaa !5
  %129 = load i32, ptr %9, align 4, !tbaa !5
  %130 = load i32, ptr %9, align 4, !tbaa !5
  %131 = call noundef i32 @_Z7mod_addii(i32 noundef %129, i32 noundef %130)
  %132 = call noundef i32 @_Z7mod_addii(i32 noundef %128, i32 noundef %131)
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %10, i32 noundef %132)
  %133 = load i32, ptr %10, align 4, !tbaa !5
  %134 = icmp ne i32 %133, 0
  br i1 %134, label %135, label %143

135:                                              ; preds = %118
  %136 = load i32, ptr %10, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = mul nsw i64 %137, 166374059
  %139 = srem i64 %138, 998244353
  %140 = trunc i64 %139 to i32
  store i32 %140, ptr %10, align 4, !tbaa !5
  %141 = load i32, ptr %8, align 4, !tbaa !5
  call void @_ZN6fastIO6Output5printEic(ptr noundef nonnull align 8 dereferenceable(1048600) @_ZN6fastIO3outE, i32 noundef %141, i8 noundef signext 32)
  %142 = load i32, ptr %10, align 4, !tbaa !5
  call void @_ZN6fastIO6Output5printEic(ptr noundef nonnull align 8 dereferenceable(1048600) @_ZN6fastIO3outE, i32 noundef %142, i8 noundef signext 10)
  br label %143

143:                                              ; preds = %135, %118
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %8, align 4, !tbaa !5
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %8, align 4, !tbaa !5
  br label %112, !llvm.loop !14

147:                                              ; preds = %117
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  ret i32 0
}

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

; 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)) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6fastIO6Output5printEic(ptr noundef nonnull align 8 dereferenceable(1048600), i32 noundef, i8 noundef signext) #3 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 = { 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 #3 = { 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 #4 = { 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 #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 = { 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 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !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"

%"struct.fastIO::Output" = type { [1048577 x i8], ptr, ptr }
%"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 }

@_ZN6fastIO3outE = external dso_local global %"struct.fastIO::Output", align 8
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [50001 x i32], align 16
@f = external dso_local global [3 x %"class.std::vector"], align 16
@g = external dso_local global %"class.std::vector", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z7initNTTi(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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_addii(i32 noundef, i32 noundef) local_unnamed_addr #2

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

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

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

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

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre = load i32, ptr @m, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %4 = phi i32 [ %.pre, %.._crit_edge_crit_edge ], [ %14, %.lr.ph ]
  %5 = mul nsw i32 %4, 3
  %6 = add nsw i32 %5, 1
  tail call void @_Z7initNTTi(i32 noundef %6)
  %7 = load i32, ptr @m, align 4, !tbaa !5
  %8 = add nsw i32 %7, 1
  %9 = sext i32 %8 to i64
  tail call void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @f, i64 noundef %9)
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph42, label %._crit_edge43

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %12 = getelementptr inbounds [50001 x i32], ptr @a, i64 0, i64 %indvars.iv
  tail call void @_ZN6fastIO7nextIntERi(ptr noundef nonnull align 4 dereferenceable(4) %12)
  %13 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @m, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %14 = load i32, ptr %13, align 4, !tbaa !5
  store i32 %14, ptr @m, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = icmp slt i64 %indvars.iv.next, %16
  br i1 %17, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge43:                                    ; preds = %.lr.ph42, %._crit_edge
  tail call void @_Z7polyMulRKSt6vectorIiSaIiEES3_RS1_(ptr noundef nonnull align 8 dereferenceable(24) @f, ptr noundef nonnull align 8 dereferenceable(24) @f, ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds (i8, ptr @f, i64 24))
  tail call void @_Z7polyMulRKSt6vectorIiSaIiEES3_RS1_(ptr noundef nonnull align 8 dereferenceable(24) @f, ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds (i8, ptr @f, i64 24), ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds (i8, ptr @f, i64 48))
  %18 = load i32, ptr @m, align 4, !tbaa !5
  %19 = shl i32 %18, 1
  %20 = or disjoint i32 %19, 1
  %21 = sext i32 %20 to i64
  tail call void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @g, i64 noundef %21)
  %22 = load i32, ptr @m, align 4, !tbaa !5
  %.not44 = icmp slt i32 %22, 0
  br i1 %.not44, label %._crit_edge48, label %.lr.ph47

.lr.ph42:                                         ; preds = %._crit_edge, %.lr.ph42
  %indvars.iv58 = phi i64 [ %indvars.iv.next59, %.lr.ph42 ], [ 0, %._crit_edge ]
  %23 = getelementptr inbounds [50001 x i32], ptr @a, i64 0, i64 %indvars.iv58
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @f, i64 noundef %25) #6
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %26, align 4, !tbaa !5
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = icmp slt i64 %indvars.iv.next59, %30
  br i1 %31, label %.lr.ph42, label %._crit_edge43, !llvm.loop !11

._crit_edge48:                                    ; preds = %.lr.ph47, %._crit_edge43
  tail call void @_Z7polyMulRKSt6vectorIiSaIiEES3_RS1_(ptr noundef nonnull align 8 dereferenceable(24) @f, ptr noundef nonnull align 8 dereferenceable(24) @g, ptr noundef nonnull align 8 dereferenceable(24) @g)
  %32 = load i32, ptr @m, align 4, !tbaa !5
  %.mask = and i32 %32, 1073741824
  %.not3649.not = icmp eq i32 %.mask, 0
  br i1 %.not3649.not, label %.lr.ph52, label %.preheader

.lr.ph47:                                         ; preds = %._crit_edge43, %.lr.ph47
  %indvars.iv61 = phi i64 [ %indvars.iv.next62, %.lr.ph47 ], [ 0, %._crit_edge43 ]
  %33 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @f, i64 noundef %indvars.iv61) #6
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %indvars.iv61.tr = trunc i64 %indvars.iv61 to i32
  %35 = shl i32 %indvars.iv61.tr, 1
  %36 = sext i32 %35 to i64
  %37 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @g, i64 noundef %36) #6
  store i32 %34, ptr %37, align 4, !tbaa !5
  %38 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds (i8, ptr @f, i64 24), i64 noundef %36) #6
  %39 = sub nsw i32 998244353, %34
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %38, i32 noundef %39)
  %40 = tail call noundef i32 @_Z7mod_addii(i32 noundef %34, i32 noundef %34)
  %41 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds (i8, ptr @f, i64 24), i64 noundef %indvars.iv61) #6
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %41, i32 noundef %40)
  %42 = mul nuw nsw i64 %indvars.iv61, 3
  %43 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds (i8, ptr @f, i64 48), i64 noundef %42) #6
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %43, i32 noundef %40)
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %44 = load i32, ptr @m, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %.not.not = icmp slt i64 %indvars.iv61, %45
  br i1 %.not.not, label %.lr.ph47, label %._crit_edge48, !llvm.loop !12

.preheader:                                       ; preds = %.lr.ph52, %._crit_edge48
  %46 = phi i32 [ %32, %._crit_edge48 ], [ %51, %.lr.ph52 ]
  %.not3753 = icmp slt i32 %46, 0
  br i1 %.not3753, label %._crit_edge56, label %.lr.ph55

.lr.ph52:                                         ; preds = %._crit_edge48, %.lr.ph52
  %indvars.iv64 = phi i64 [ %indvars.iv.next65, %.lr.ph52 ], [ 0, %._crit_edge48 ]
  %47 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @g, i64 noundef %indvars.iv64) #6
  %48 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds (i8, ptr @f, i64 24), i64 noundef %indvars.iv64) #6
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = sub nsw i32 998244353, %49
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %47, i32 noundef %50)
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %51 = load i32, ptr @m, align 4, !tbaa !5
  %52 = shl i32 %51, 1
  %53 = sext i32 %52 to i64
  %.not36.not = icmp slt i64 %indvars.iv64, %53
  br i1 %.not36.not, label %.lr.ph52, label %.preheader, !llvm.loop !13

._crit_edge56:                                    ; preds = %69, %.preheader
  ret i32 0

.lr.ph55:                                         ; preds = %.preheader, %69
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %69 ], [ 0, %.preheader ]
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @g, i64 noundef %indvars.iv67) #6
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = sub nsw i32 998244353, %55
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %57 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds (i8, ptr @f, i64 48), i64 noundef %indvars.iv67) #6
  %58 = load i32, ptr %57, align 4, !tbaa !5
  store i32 %58, ptr %1, align 4, !tbaa !5
  %59 = call noundef i32 @_Z7mod_addii(i32 noundef %56, i32 noundef %56)
  %60 = call noundef i32 @_Z7mod_addii(i32 noundef %56, i32 noundef %59)
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %1, i32 noundef %60)
  %61 = load i32, ptr %1, align 4, !tbaa !5
  %.not38 = icmp eq i32 %61, 0
  br i1 %.not38, label %69, label %62

62:                                               ; preds = %.lr.ph55
  %63 = sext i32 %61 to i64
  %64 = mul nsw i64 %63, 166374059
  %65 = srem i64 %64, 998244353
  %66 = trunc nsw i64 %65 to i32
  store i32 %66, ptr %1, align 4, !tbaa !5
  %67 = trunc nuw nsw i64 %indvars.iv67 to i32
  call void @_ZN6fastIO6Output5printEic(ptr noundef nonnull align 8 dereferenceable(1048600) @_ZN6fastIO3outE, i32 noundef %67, i8 noundef signext 32)
  %68 = load i32, ptr %1, align 4, !tbaa !5
  call void @_ZN6fastIO6Output5printEic(ptr noundef nonnull align 8 dereferenceable(1048600) @_ZN6fastIO3outE, i32 noundef %68, i8 noundef signext 10)
  br label %69

69:                                               ; preds = %62, %.lr.ph55
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %70 = load i32, ptr @m, align 4, !tbaa !5
  %71 = mul nsw i32 %70, 3
  %72 = sext i32 %71 to i64
  %.not37.not = icmp slt i64 %indvars.iv67, %72
  br i1 %.not37.not, label %.lr.ph55, label %._crit_edge56, !llvm.loop !14
}

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

; 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 #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6fastIO6Output5printEic(ptr noundef nonnull align 8 dereferenceable(1048600), i32 noundef, i8 noundef signext) local_unnamed_addr #3 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 = { 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 #3 = { 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 #4 = { 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 #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 = { 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 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


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