; LLVM IR from tangjz/acm-icpc :: zoj (3868)

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

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@mx = external dso_local global i32, align 4
@f = external dso_local global [1000001 x i32], align 16
@ans = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %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
  store i32 0, ptr %1, align 4
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %9

9:                                                ; preds = %151, %0
  %10 = load i32, ptr @t, align 4, !tbaa !5
  %11 = add nsw i32 %10, -1
  store i32 %11, ptr @t, align 4, !tbaa !5
  %12 = icmp ne i32 %10, 0
  br i1 %12, label %13, label %154

13:                                               ; preds = %9
  store i32 0, ptr @ans, align 4, !tbaa !5
  store i32 0, ptr @mx, align 4, !tbaa !5
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m)
  br label %15

15:                                               ; preds = %31, %13
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = add nsw i32 %16, -1
  store i32 %17, ptr @n, align 4, !tbaa !5
  %18 = icmp ne i32 %16, 0
  br i1 %18, label %19, label %37

19:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  br label %21

21:                                               ; preds = %26, %19
  %22 = load i32, ptr @mx, align 4, !tbaa !5
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %25, label %31

25:                                               ; preds = %21
  br label %26

26:                                               ; preds = %25
  %27 = load i32, ptr @mx, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr @mx, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %29
  store i32 0, ptr %30, align 4, !tbaa !5
  br label %21, !llvm.loop !9

31:                                               ; preds = %21
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %34, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %15, !llvm.loop !11

37:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %83, %37
  %39 = load i32, ptr %3, align 4, !tbaa !5
  %40 = load i32, ptr @mx, align 4, !tbaa !5
  %41 = icmp sle i32 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  store i32 9, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %86

43:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = add nsw i32 %44, %45
  store i32 %46, ptr %5, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %62, %43
  %48 = load i32, ptr %5, align 4, !tbaa !5
  %49 = load i32, ptr @mx, align 4, !tbaa !5
  %50 = icmp sle i32 %48, %49
  br i1 %50, label %52, label %51

51:                                               ; preds = %47
  store i32 12, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %66

52:                                               ; preds = %47
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = add nsw i32 %60, %56
  store i32 %61, ptr %59, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %52
  %63 = load i32, ptr %3, align 4, !tbaa !5
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = add nsw i32 %64, %63
  store i32 %65, ptr %5, align 4, !tbaa !5
  br label %47, !llvm.loop !12

66:                                               ; preds = %51
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %82

72:                                               ; preds = %66
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = call noundef i32 @_Z7mod_powii(i32 noundef 2, i32 noundef %76)
  %78 = sub nsw i32 %77, 1
  %79 = load i32, ptr %3, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %80
  store i32 %78, ptr %81, align 4, !tbaa !5
  br label %82

82:                                               ; preds = %72, %66
  br label %83

83:                                               ; preds = %82
  %84 = load i32, ptr %3, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %3, align 4, !tbaa !5
  br label %38, !llvm.loop !13

86:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %87 = load i32, ptr @mx, align 4, !tbaa !5
  store i32 %87, ptr %6, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %148, %86
  %89 = load i32, ptr %6, align 4, !tbaa !5
  %90 = icmp sge i32 %89, 1
  br i1 %90, label %92, label %91

91:                                               ; preds = %88
  store i32 15, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %151

92:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %93 = load i32, ptr %6, align 4, !tbaa !5
  %94 = load i32, ptr %6, align 4, !tbaa !5
  %95 = add nsw i32 %93, %94
  store i32 %95, ptr %7, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %121, %92
  %97 = load i32, ptr %7, align 4, !tbaa !5
  %98 = load i32, ptr @mx, align 4, !tbaa !5
  %99 = icmp sle i32 %97, %98
  br i1 %99, label %101, label %100

100:                                              ; preds = %96
  store i32 18, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %125

101:                                              ; preds = %96
  %102 = load i32, ptr %7, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = load i32, ptr %6, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = sub nsw i32 %109, %105
  store i32 %110, ptr %108, align 4, !tbaa !5
  %111 = icmp slt i32 %110, 0
  br i1 %111, label %112, label %119

112:                                              ; preds = %101
  %113 = load i32, ptr %6, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = add nsw i32 %116, 998244353
  store i32 %117, ptr %115, align 4, !tbaa !5
  %118 = icmp ne i32 %117, 0
  br label %119

119:                                              ; preds = %112, %101
  %120 = phi i1 [ false, %101 ], [ %118, %112 ]
  br label %121

121:                                              ; preds = %119
  %122 = load i32, ptr %6, align 4, !tbaa !5
  %123 = load i32, ptr %7, align 4, !tbaa !5
  %124 = add nsw i32 %123, %122
  store i32 %124, ptr %7, align 4, !tbaa !5
  br label %96, !llvm.loop !14

125:                                              ; preds = %100
  %126 = load i32, ptr %6, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = icmp ne i32 %129, 0
  br i1 %130, label %131, label %147

131:                                              ; preds = %125
  %132 = load i32, ptr @ans, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = load i32, ptr %6, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = load i32, ptr %6, align 4, !tbaa !5
  %140 = load i32, ptr @m, align 4, !tbaa !5
  %141 = call noundef i32 @_Z7mod_powii(i32 noundef %139, i32 noundef %140)
  %142 = sext i32 %141 to i64
  %143 = mul nsw i64 %138, %142
  %144 = add nsw i64 %133, %143
  %145 = srem i64 %144, 998244353
  %146 = trunc i64 %145 to i32
  store i32 %146, ptr @ans, align 4, !tbaa !5
  br label %147

147:                                              ; preds = %131, %125
  br label %148

148:                                              ; preds = %147
  %149 = load i32, ptr %6, align 4, !tbaa !5
  %150 = add nsw i32 %149, -1
  store i32 %150, ptr %6, align 4, !tbaa !5
  br label %88, !llvm.loop !15

151:                                              ; preds = %91
  %152 = load i32, ptr @ans, align 4, !tbaa !5
  %153 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %152)
  br label %9, !llvm.loop !16

154:                                              ; preds = %9
  ret i32 0
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_powii(i32 noundef, i32 noundef) #3

declare i32 @printf(ptr noundef, ...) #1

attributes #0 = { 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 #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !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"

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@mx = external dso_local local_unnamed_addr global i32, align 4
@f = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %3 = load i32, ptr @t, align 4, !tbaa !5
  %4 = add nsw i32 %3, -1
  store i32 %4, ptr @t, align 4, !tbaa !5
  %.not64 = icmp eq i32 %3, 0
  br i1 %.not64, label %._crit_edge67, label %.lr.ph66

.lr.ph66:                                         ; preds = %0, %._crit_edge63
  store i32 0, ptr @ans, align 4, !tbaa !5
  store i32 0, ptr @mx, align 4, !tbaa !5
  %5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %7 = add nsw i32 %6, -1
  store i32 %7, ptr @n, align 4, !tbaa !5
  %.not3443 = icmp eq i32 %6, 0
  br i1 %.not3443, label %.lr.ph66..preheader40_crit_edge, label %.lr.ph45

.lr.ph66..preheader40_crit_edge:                  ; preds = %.lr.ph66
  %.pre = load i32, ptr @mx, align 4, !tbaa !5
  br label %.preheader40

.preheader40:                                     ; preds = %.lr.ph45._crit_edge, %.lr.ph66..preheader40_crit_edge
  %8 = phi i32 [ %.pre, %.lr.ph66..preheader40_crit_edge ], [ %19, %.lr.ph45._crit_edge ]
  %.not3551 = icmp slt i32 %8, 1
  br i1 %.not3551, label %._crit_edge63, label %.lr.ph53

.lr.ph45:                                         ; preds = %.lr.ph66, %.lr.ph45._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %mx.promoted = load i32, ptr @mx, align 4, !tbaa !5
  %11 = icmp slt i32 %mx.promoted, %10
  br i1 %11, label %.lr.ph.preheader, label %.lr.ph45._crit_edge

.lr.ph.preheader:                                 ; preds = %.lr.ph45
  %12 = sext i32 %mx.promoted to i64
  %13 = shl nsw i64 %12, 2
  %scevgep = getelementptr i8, ptr getelementptr inbounds (i8, ptr @f, i64 4), i64 %13
  %14 = xor i32 %mx.promoted, -1
  %15 = add i32 %10, %14
  %16 = zext i32 %15 to i64
  %17 = shl nuw nsw i64 %16, 2
  %18 = add nuw nsw i64 %17, 4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i8 0, i64 %18, i1 false), !tbaa !5
  store i32 %10, ptr @mx, align 4, !tbaa !5
  br label %.lr.ph45._crit_edge

.lr.ph45._crit_edge:                              ; preds = %.lr.ph45, %.lr.ph.preheader
  %19 = phi i32 [ %10, %.lr.ph.preheader ], [ %mx.promoted, %.lr.ph45 ]
  %.pre-phi = sext i32 %10 to i64
  %20 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %.pre-phi
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr %20, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = add nsw i32 %23, -1
  store i32 %24, ptr @n, align 4, !tbaa !5
  %.not34 = icmp eq i32 %23, 0
  br i1 %.not34, label %.preheader40, label %.lr.ph45, !llvm.loop !9

.preheader:                                       ; preds = %41
  %25 = icmp sgt i32 %42, 0
  br i1 %25, label %.lr.ph62.preheader, label %._crit_edge63

.lr.ph62.preheader:                               ; preds = %.preheader
  %26 = shl nuw i32 %42, 1
  %27 = zext nneg i32 %42 to i64
  br label %.lr.ph62

.lr.ph53:                                         ; preds = %.preheader40, %41
  %28 = phi i32 [ %42, %41 ], [ %8, %.preheader40 ]
  %indvars.iv72 = phi i64 [ %indvars.iv.next73, %41 ], [ 1, %.preheader40 ]
  %indvars.iv70 = phi i64 [ %indvars.iv.next71, %41 ], [ 2, %.preheader40 ]
  %29 = shl nuw nsw i64 %indvars.iv72, 1
  %30 = sext i32 %28 to i64
  %.not3846 = icmp sgt i64 %29, %30
  %.phi.trans.insert = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %indvars.iv72
  %.pre86 = load i32, ptr %.phi.trans.insert, align 4, !tbaa !5
  br i1 %.not3846, label %._crit_edge50, label %.lr.ph49

._crit_edge50:                                    ; preds = %.lr.ph49, %.lr.ph53
  %31 = phi i32 [ %.pre86, %.lr.ph53 ], [ %35, %.lr.ph49 ]
  %.not39 = icmp eq i32 %31, 0
  br i1 %.not39, label %41, label %37

.lr.ph49:                                         ; preds = %.lr.ph53, %.lr.ph49
  %indvars.iv74 = phi i64 [ %indvars.iv.next75, %.lr.ph49 ], [ %indvars.iv70, %.lr.ph53 ]
  %32 = phi i32 [ %35, %.lr.ph49 ], [ %.pre86, %.lr.ph53 ]
  %33 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %indvars.iv74
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = add nsw i32 %32, %34
  store i32 %35, ptr %.phi.trans.insert, align 4, !tbaa !5
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, %indvars.iv72
  %36 = trunc nuw i64 %indvars.iv.next75 to i32
  %.not38 = icmp slt i32 %28, %36
  br i1 %.not38, label %._crit_edge50, label %.lr.ph49, !llvm.loop !11

37:                                               ; preds = %._crit_edge50
  %38 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %indvars.iv72
  %39 = call noundef i32 @_Z7mod_powii(i32 noundef 2, i32 noundef %31)
  %40 = add nsw i32 %39, -1
  store i32 %40, ptr %38, align 4, !tbaa !5
  %.pre87 = load i32, ptr @mx, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %._crit_edge50, %37
  %42 = phi i32 [ %28, %._crit_edge50 ], [ %.pre87, %37 ]
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %43 = sext i32 %42 to i64
  %.not35.not = icmp slt i64 %indvars.iv72, %43
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 2
  br i1 %.not35.not, label %.lr.ph53, label %.preheader, !llvm.loop !12

._crit_edge63:                                    ; preds = %72, %.preheader40, %.preheader
  %44 = load i32, ptr @ans, align 4, !tbaa !5
  %45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %44)
  %46 = load i32, ptr @t, align 4, !tbaa !5
  %47 = add nsw i32 %46, -1
  store i32 %47, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %46, 0
  br i1 %.not, label %._crit_edge67, label %.lr.ph66, !llvm.loop !13

.lr.ph62:                                         ; preds = %.lr.ph62.preheader, %72
  %48 = phi i32 [ %42, %.lr.ph62.preheader ], [ %73, %72 ]
  %indvars.iv80 = phi i64 [ %27, %.lr.ph62.preheader ], [ %indvars.iv.next81, %72 ]
  %indvars.iv78 = phi i32 [ %26, %.lr.ph62.preheader ], [ %indvars.iv.next79, %72 ]
  %indvars.iv80.tr = trunc i64 %indvars.iv80 to i32
  %49 = shl i32 %indvars.iv80.tr, 1
  %.not3654 = icmp sgt i32 %49, %48
  br i1 %.not3654, label %.lr.ph62.._crit_edge58_crit_edge, label %.lr.ph57

.lr.ph62.._crit_edge58_crit_edge:                 ; preds = %.lr.ph62
  %.phi.trans.insert90 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %indvars.iv80
  %.pre91 = load i32, ptr %.phi.trans.insert90, align 4, !tbaa !5
  br label %._crit_edge58

.lr.ph57:                                         ; preds = %.lr.ph62
  %50 = zext i32 %indvars.iv78 to i64
  %51 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %indvars.iv80
  %.promoted59 = load i32, ptr %51, align 4, !tbaa !5
  br label %53

._crit_edge58:                                    ; preds = %53, %.lr.ph62.._crit_edge58_crit_edge
  %52 = phi i32 [ %.pre91, %.lr.ph62.._crit_edge58_crit_edge ], [ %spec.select, %53 ]
  %.not37 = icmp eq i32 %52, 0
  br i1 %.not37, label %72, label %60

53:                                               ; preds = %.lr.ph57, %53
  %indvars.iv82 = phi i64 [ %50, %.lr.ph57 ], [ %indvars.iv.next83, %53 ]
  %spec.select60 = phi i32 [ %.promoted59, %.lr.ph57 ], [ %spec.select, %53 ]
  %54 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %indvars.iv82
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = sub nsw i32 %spec.select60, %55
  %57 = icmp slt i32 %56, 0
  %58 = add nsw i32 %56, 998244353
  %spec.select = select i1 %57, i32 %58, i32 %56
  store i32 %spec.select, ptr %51, align 4, !tbaa !5
  %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, %indvars.iv80
  %59 = trunc nuw i64 %indvars.iv.next83 to i32
  %.not36 = icmp slt i32 %48, %59
  br i1 %.not36, label %._crit_edge58, label %53, !llvm.loop !14

60:                                               ; preds = %._crit_edge58
  %61 = load i32, ptr @ans, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = sext i32 %52 to i64
  %64 = load i32, ptr @m, align 4, !tbaa !5
  %65 = trunc nuw nsw i64 %indvars.iv80 to i32
  %66 = call noundef i32 @_Z7mod_powii(i32 noundef %65, i32 noundef %64)
  %67 = sext i32 %66 to i64
  %68 = mul nsw i64 %67, %63
  %69 = add nsw i64 %68, %62
  %70 = srem i64 %69, 998244353
  %71 = trunc nsw i64 %70 to i32
  store i32 %71, ptr @ans, align 4, !tbaa !5
  %.pre88 = load i32, ptr @mx, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %._crit_edge58, %60
  %73 = phi i32 [ %48, %._crit_edge58 ], [ %.pre88, %60 ]
  %indvars.iv.next81 = add nsw i64 %indvars.iv80, -1
  %74 = icmp sgt i64 %indvars.iv80, 1
  %indvars.iv.next79 = add i32 %indvars.iv78, -2
  br i1 %74, label %.lr.ph62, label %._crit_edge63, !llvm.loop !15

._crit_edge67:                                    ; preds = %._crit_edge63, %0
  ret i32 0
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_powii(i32 noundef, i32 noundef) local_unnamed_addr #3

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

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

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


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass