; LLVM IR from abeaumont/competitive-programming :: codeforces/0869 (c)

; 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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@p = external dso_local global [5001 x i64], align 16
@inv = external dso_local global [5001 x i64], align 16
@invp = external dso_local global [5001 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z8binomialxxx(i64 noundef, i64 noundef, i64 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 i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  store i64 1, ptr @invp, align 16, !tbaa !5
  store i64 1, ptr getelementptr inbounds ([5001 x i64], ptr @inv, i64 0, i64 1), align 8, !tbaa !5
  store i64 1, ptr getelementptr inbounds ([5001 x i64], ptr @p, i64 0, i64 1), align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 2, ptr %2, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %33, %0
  %16 = load i32, ptr %2, align 4, !tbaa !9
  %17 = sext i32 %16 to i64
  %18 = icmp sle i64 %17, 5000
  br i1 %18, label %20, label %19

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

20:                                               ; preds = %15
  %21 = load i32, ptr %2, align 4, !tbaa !9
  %22 = sub nsw i32 %21, 1
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [5001 x i64], ptr @p, i64 0, i64 %23
  %25 = load i64, ptr %24, align 8, !tbaa !5
  %26 = load i32, ptr %2, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = mul nsw i64 %25, %27
  %29 = srem i64 %28, 998244353
  %30 = load i32, ptr %2, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [5001 x i64], ptr @p, i64 0, i64 %31
  store i64 %29, ptr %32, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %20
  %34 = load i32, ptr %2, align 4, !tbaa !9
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %2, align 4, !tbaa !9
  br label %15, !llvm.loop !11

36:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 2, ptr %3, align 4, !tbaa !9
  br label %37

37:                                               ; preds = %57, %36
  %38 = load i32, ptr %3, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = icmp sle i64 %39, 5000
  br i1 %40, label %42, label %41

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

42:                                               ; preds = %37
  %43 = load i32, ptr %3, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = sdiv i64 998244353, %44
  %46 = load i32, ptr %3, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = srem i64 998244353, %47
  %49 = getelementptr inbounds [5001 x i64], ptr @inv, i64 0, i64 %48
  %50 = load i64, ptr %49, align 8, !tbaa !5
  %51 = mul nsw i64 %45, %50
  %52 = srem i64 %51, 998244353
  %53 = sub nsw i64 998244353, %52
  %54 = load i32, ptr %3, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [5001 x i64], ptr @inv, i64 0, i64 %55
  store i64 %53, ptr %56, align 8, !tbaa !5
  br label %57

57:                                               ; preds = %42
  %58 = load i32, ptr %3, align 4, !tbaa !9
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %3, align 4, !tbaa !9
  br label %37, !llvm.loop !13

60:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !9
  br label %61

61:                                               ; preds = %81, %60
  %62 = load i32, ptr %4, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = icmp sle i64 %63, 5000
  br i1 %64, label %66, label %65

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

66:                                               ; preds = %61
  %67 = load i32, ptr %4, align 4, !tbaa !9
  %68 = sub nsw i32 %67, 1
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [5001 x i64], ptr @invp, i64 0, i64 %69
  %71 = load i64, ptr %70, align 8, !tbaa !5
  %72 = load i32, ptr %4, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [5001 x i64], ptr @inv, i64 0, i64 %73
  %75 = load i64, ptr %74, align 8, !tbaa !5
  %76 = mul nsw i64 %71, %75
  %77 = srem i64 %76, 998244353
  %78 = load i32, ptr %4, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [5001 x i64], ptr @invp, i64 0, i64 %79
  store i64 %77, ptr %80, align 8, !tbaa !5
  br label %81

81:                                               ; preds = %66
  %82 = load i32, ptr %4, align 4, !tbaa !9
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %4, align 4, !tbaa !9
  br label %61, !llvm.loop !14

84:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %85 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %86 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %85, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %87 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %86, ptr noundef nonnull align 8 dereferenceable(8) %7)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 0, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 1, ptr %11, align 4, !tbaa !9
  br label %88

88:                                               ; preds = %116, %84
  %89 = load i32, ptr %11, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %92 = load i64, ptr %91, align 8, !tbaa !5
  %93 = icmp sle i64 %90, %92
  br i1 %93, label %95, label %94

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

95:                                               ; preds = %88
  %96 = load i64, ptr %5, align 8, !tbaa !5
  %97 = load i32, ptr %11, align 4, !tbaa !9
  %98 = sext i32 %97 to i64
  %99 = call noundef i64 @_Z8binomialxxx(i64 noundef %96, i64 noundef %98, i64 noundef 998244353)
  %100 = load i64, ptr %6, align 8, !tbaa !5
  %101 = load i32, ptr %11, align 4, !tbaa !9
  %102 = sext i32 %101 to i64
  %103 = call noundef i64 @_Z8binomialxxx(i64 noundef %100, i64 noundef %102, i64 noundef 998244353)
  %104 = mul nsw i64 %99, %103
  %105 = srem i64 %104, 998244353
  %106 = load i32, ptr %11, align 4, !tbaa !9
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [5001 x i64], ptr @p, i64 0, i64 %107
  %109 = load i64, ptr %108, align 8, !tbaa !5
  %110 = mul nsw i64 %105, %109
  %111 = srem i64 %110, 998244353
  %112 = load i64, ptr %8, align 8, !tbaa !5
  %113 = add nsw i64 %112, %111
  store i64 %113, ptr %8, align 8, !tbaa !5
  %114 = load i64, ptr %8, align 8, !tbaa !5
  %115 = srem i64 %114, 998244353
  store i64 %115, ptr %8, align 8, !tbaa !5
  br label %116

116:                                              ; preds = %95
  %117 = load i32, ptr %11, align 4, !tbaa !9
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %11, align 4, !tbaa !9
  br label %88, !llvm.loop !15

119:                                              ; preds = %94
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 1, ptr %12, align 4, !tbaa !9
  br label %120

120:                                              ; preds = %148, %119
  %121 = load i32, ptr %12, align 4, !tbaa !9
  %122 = sext i32 %121 to i64
  %123 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %124 = load i64, ptr %123, align 8, !tbaa !5
  %125 = icmp sle i64 %122, %124
  br i1 %125, label %127, label %126

126:                                              ; preds = %120
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %151

127:                                              ; preds = %120
  %128 = load i64, ptr %5, align 8, !tbaa !5
  %129 = load i32, ptr %12, align 4, !tbaa !9
  %130 = sext i32 %129 to i64
  %131 = call noundef i64 @_Z8binomialxxx(i64 noundef %128, i64 noundef %130, i64 noundef 998244353)
  %132 = load i64, ptr %7, align 8, !tbaa !5
  %133 = load i32, ptr %12, align 4, !tbaa !9
  %134 = sext i32 %133 to i64
  %135 = call noundef i64 @_Z8binomialxxx(i64 noundef %132, i64 noundef %134, i64 noundef 998244353)
  %136 = mul nsw i64 %131, %135
  %137 = srem i64 %136, 998244353
  %138 = load i32, ptr %12, align 4, !tbaa !9
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [5001 x i64], ptr @p, i64 0, i64 %139
  %141 = load i64, ptr %140, align 8, !tbaa !5
  %142 = mul nsw i64 %137, %141
  %143 = srem i64 %142, 998244353
  %144 = load i64, ptr %9, align 8, !tbaa !5
  %145 = add nsw i64 %144, %143
  store i64 %145, ptr %9, align 8, !tbaa !5
  %146 = load i64, ptr %9, align 8, !tbaa !5
  %147 = srem i64 %146, 998244353
  store i64 %147, ptr %9, align 8, !tbaa !5
  br label %148

148:                                              ; preds = %127
  %149 = load i32, ptr %12, align 4, !tbaa !9
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %12, align 4, !tbaa !9
  br label %120, !llvm.loop !16

151:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 1, ptr %13, align 4, !tbaa !9
  br label %152

152:                                              ; preds = %180, %151
  %153 = load i32, ptr %13, align 4, !tbaa !9
  %154 = sext i32 %153 to i64
  %155 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %156 = load i64, ptr %155, align 8, !tbaa !5
  %157 = icmp sle i64 %154, %156
  br i1 %157, label %159, label %158

158:                                              ; preds = %152
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %183

159:                                              ; preds = %152
  %160 = load i64, ptr %6, align 8, !tbaa !5
  %161 = load i32, ptr %13, align 4, !tbaa !9
  %162 = sext i32 %161 to i64
  %163 = call noundef i64 @_Z8binomialxxx(i64 noundef %160, i64 noundef %162, i64 noundef 998244353)
  %164 = load i64, ptr %7, align 8, !tbaa !5
  %165 = load i32, ptr %13, align 4, !tbaa !9
  %166 = sext i32 %165 to i64
  %167 = call noundef i64 @_Z8binomialxxx(i64 noundef %164, i64 noundef %166, i64 noundef 998244353)
  %168 = mul nsw i64 %163, %167
  %169 = srem i64 %168, 998244353
  %170 = load i32, ptr %13, align 4, !tbaa !9
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [5001 x i64], ptr @p, i64 0, i64 %171
  %173 = load i64, ptr %172, align 8, !tbaa !5
  %174 = mul nsw i64 %169, %173
  %175 = srem i64 %174, 998244353
  %176 = load i64, ptr %10, align 8, !tbaa !5
  %177 = add nsw i64 %176, %175
  store i64 %177, ptr %10, align 8, !tbaa !5
  %178 = load i64, ptr %10, align 8, !tbaa !5
  %179 = srem i64 %178, 998244353
  store i64 %179, ptr %10, align 8, !tbaa !5
  br label %180

180:                                              ; preds = %159
  %181 = load i32, ptr %13, align 4, !tbaa !9
  %182 = add nsw i32 %181, 1
  store i32 %182, ptr %13, align 4, !tbaa !9
  br label %152, !llvm.loop !17

183:                                              ; preds = %158
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %184 = load i64, ptr %8, align 8, !tbaa !5
  %185 = load i64, ptr %9, align 8, !tbaa !5
  %186 = add nsw i64 %184, %185
  %187 = load i64, ptr %10, align 8, !tbaa !5
  %188 = add nsw i64 %186, %187
  %189 = srem i64 %188, 998244353
  %190 = add nsw i64 1, %189
  %191 = load i64, ptr %8, align 8, !tbaa !5
  %192 = load i64, ptr %9, align 8, !tbaa !5
  %193 = mul nsw i64 %191, %192
  %194 = srem i64 %193, 998244353
  %195 = add nsw i64 %190, %194
  %196 = load i64, ptr %8, align 8, !tbaa !5
  %197 = load i64, ptr %10, align 8, !tbaa !5
  %198 = mul nsw i64 %196, %197
  %199 = srem i64 %198, 998244353
  %200 = add nsw i64 %195, %199
  %201 = load i64, ptr %9, align 8, !tbaa !5
  %202 = load i64, ptr %10, align 8, !tbaa !5
  %203 = mul nsw i64 %201, %202
  %204 = srem i64 %203, 998244353
  %205 = add nsw i64 %200, %204
  %206 = load i64, ptr %8, align 8, !tbaa !5
  %207 = load i64, ptr %9, align 8, !tbaa !5
  %208 = mul nsw i64 %206, %207
  %209 = srem i64 %208, 998244353
  %210 = load i64, ptr %10, align 8, !tbaa !5
  %211 = mul nsw i64 %209, %210
  %212 = srem i64 %211, 998244353
  %213 = add nsw i64 %205, %212
  %214 = srem i64 %213, 998244353
  store i64 %214, ptr %14, align 8, !tbaa !5
  %215 = load i64, ptr %14, align 8, !tbaa !5
  %216 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %215)
  %217 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %216, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  %218 = load i32, ptr %1, align 4
  ret i32 %218
}

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #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 = { 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 = { 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 = { 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 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !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"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@p = external dso_local local_unnamed_addr global [5001 x i64], align 16
@inv = external dso_local local_unnamed_addr global [5001 x i64], align 16
@invp = external dso_local local_unnamed_addr global [5001 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z8binomialxxx(i64 noundef, i64 noundef, i64 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 norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  store i64 1, ptr @invp, align 16, !tbaa !5
  store i64 1, ptr getelementptr inbounds (i8, ptr @inv, i64 8), align 8, !tbaa !5
  store i64 1, ptr getelementptr inbounds (i8, ptr @p, i64 8), align 8, !tbaa !5
  br label %4

4:                                                ; preds = %9, %0
  %5 = phi i64 [ 1, %0 ], [ %11, %9 ]
  %indvars.iv = phi i64 [ 2, %0 ], [ %indvars.iv.next.1, %9 ]
  %6 = mul nsw i64 %5, %indvars.iv
  %7 = srem i64 %6, 998244353
  %8 = getelementptr inbounds [5001 x i64], ptr @p, i64 0, i64 %indvars.iv
  store i64 %7, ptr %8, align 16, !tbaa !5
  %exitcond.not = icmp eq i64 %indvars.iv, 5000
  br i1 %exitcond.not, label %.preheader70, label %9, !llvm.loop !9

9:                                                ; preds = %4
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %10 = mul nsw i64 %7, %indvars.iv.next
  %11 = srem i64 %10, 998244353
  %12 = getelementptr inbounds [5001 x i64], ptr @p, i64 0, i64 %indvars.iv.next
  store i64 %11, ptr %12, align 8, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  br label %4

.preheader70:                                     ; preds = %4, %.preheader70
  %indvars.iv90 = phi i64 [ %indvars.iv.next91, %.preheader70 ], [ 2, %4 ]
  %13 = trunc nuw nsw i64 %indvars.iv90 to i32
  %14 = udiv i32 998244353, %13
  %.zext = zext nneg i32 %14 to i64
  %15 = urem i32 998244353, %13
  %.zext67 = zext nneg i32 %15 to i64
  %16 = getelementptr inbounds [5001 x i64], ptr @inv, i64 0, i64 %.zext67
  %17 = load i64, ptr %16, align 8, !tbaa !5
  %18 = mul nsw i64 %17, %.zext
  %19 = srem i64 %18, 998244353
  %20 = sub nsw i64 998244353, %19
  %21 = getelementptr inbounds [5001 x i64], ptr @inv, i64 0, i64 %indvars.iv90
  store i64 %20, ptr %21, align 8, !tbaa !5
  %indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
  %exitcond93.not = icmp eq i64 %indvars.iv.next91, 5001
  br i1 %exitcond93.not, label %.preheader69, label %.preheader70, !llvm.loop !11

22:                                               ; preds = %.preheader69
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %27 = load i64, ptr %26, align 8, !tbaa !5
  %.not74 = icmp slt i64 %27, 1
  br i1 %.not74, label %.preheader68, label %.lr.ph

.preheader69:                                     ; preds = %.preheader70, %.preheader69
  %28 = phi i64 [ %37, %.preheader69 ], [ 1, %.preheader70 ]
  %indvars.iv94 = phi i64 [ %indvars.iv.next95.1, %.preheader69 ], [ 1, %.preheader70 ]
  %29 = getelementptr inbounds [5001 x i64], ptr @inv, i64 0, i64 %indvars.iv94
  %30 = load i64, ptr %29, align 8, !tbaa !5
  %31 = mul nsw i64 %30, %28
  %32 = srem i64 %31, 998244353
  %33 = getelementptr inbounds [5001 x i64], ptr @invp, i64 0, i64 %indvars.iv94
  store i64 %32, ptr %33, align 8, !tbaa !5
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %34 = getelementptr inbounds [5001 x i64], ptr @inv, i64 0, i64 %indvars.iv.next95
  %35 = load i64, ptr %34, align 8, !tbaa !5
  %36 = mul nsw i64 %35, %32
  %37 = srem i64 %36, 998244353
  %38 = getelementptr inbounds [5001 x i64], ptr @invp, i64 0, i64 %indvars.iv.next95
  store i64 %37, ptr %38, align 8, !tbaa !5
  %indvars.iv.next95.1 = add nuw nsw i64 %indvars.iv94, 2
  %exitcond97.not.1 = icmp eq i64 %indvars.iv.next95.1, 5001
  br i1 %exitcond97.not.1, label %22, label %.preheader69, !llvm.loop !12

.preheader68:                                     ; preds = %.lr.ph, %22
  %.055.lcssa = phi i64 [ 0, %22 ], [ %52, %.lr.ph ]
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %40 = load i64, ptr %39, align 8, !tbaa !5
  %.not6477 = icmp slt i64 %40, 1
  br i1 %.not6477, label %.preheader, label %.lr.ph80

.lr.ph:                                           ; preds = %22, %.lr.ph
  %indvars.iv98 = phi i64 [ %indvars.iv.next99, %.lr.ph ], [ 1, %22 ]
  %.05575 = phi i64 [ %52, %.lr.ph ], [ 0, %22 ]
  %41 = load i64, ptr %1, align 8, !tbaa !5
  %42 = call noundef i64 @_Z8binomialxxx(i64 noundef %41, i64 noundef %indvars.iv98, i64 noundef 998244353)
  %43 = load i64, ptr %2, align 8, !tbaa !5
  %44 = call noundef i64 @_Z8binomialxxx(i64 noundef %43, i64 noundef %indvars.iv98, i64 noundef 998244353)
  %45 = mul nsw i64 %44, %42
  %46 = srem i64 %45, 998244353
  %47 = getelementptr inbounds [5001 x i64], ptr @p, i64 0, i64 %indvars.iv98
  %48 = load i64, ptr %47, align 8, !tbaa !5
  %49 = mul nsw i64 %46, %48
  %50 = srem i64 %49, 998244353
  %51 = add nsw i64 %50, %.05575
  %52 = srem i64 %51, 998244353
  %indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
  %53 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %54 = load i64, ptr %53, align 8, !tbaa !5
  %.not.not = icmp sgt i64 %54, %indvars.iv98
  br i1 %.not.not, label %.lr.ph, label %.preheader68, !llvm.loop !13

.preheader:                                       ; preds = %.lr.ph80, %.preheader68
  %.054.lcssa = phi i64 [ 0, %.preheader68 ], [ %68, %.lr.ph80 ]
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %56 = load i64, ptr %55, align 8, !tbaa !5
  %.not6582 = icmp slt i64 %56, 1
  br i1 %.not6582, label %._crit_edge, label %.lr.ph85

.lr.ph80:                                         ; preds = %.preheader68, %.lr.ph80
  %indvars.iv101 = phi i64 [ %indvars.iv.next102, %.lr.ph80 ], [ 1, %.preheader68 ]
  %.05478 = phi i64 [ %68, %.lr.ph80 ], [ 0, %.preheader68 ]
  %57 = load i64, ptr %1, align 8, !tbaa !5
  %58 = call noundef i64 @_Z8binomialxxx(i64 noundef %57, i64 noundef %indvars.iv101, i64 noundef 998244353)
  %59 = load i64, ptr %3, align 8, !tbaa !5
  %60 = call noundef i64 @_Z8binomialxxx(i64 noundef %59, i64 noundef %indvars.iv101, i64 noundef 998244353)
  %61 = mul nsw i64 %60, %58
  %62 = srem i64 %61, 998244353
  %63 = getelementptr inbounds [5001 x i64], ptr @p, i64 0, i64 %indvars.iv101
  %64 = load i64, ptr %63, align 8, !tbaa !5
  %65 = mul nsw i64 %62, %64
  %66 = srem i64 %65, 998244353
  %67 = add nsw i64 %66, %.05478
  %68 = srem i64 %67, 998244353
  %indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %70 = load i64, ptr %69, align 8, !tbaa !5
  %.not64.not = icmp sgt i64 %70, %indvars.iv101
  br i1 %.not64.not, label %.lr.ph80, label %.preheader, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph85, %.preheader
  %.053.lcssa = phi i64 [ 0, %.preheader ], [ %101, %.lr.ph85 ]
  %71 = add nsw i64 %.054.lcssa, %.055.lcssa
  %72 = add nsw i64 %71, %.053.lcssa
  %73 = srem i64 %72, 998244353
  %74 = mul nsw i64 %.054.lcssa, %.055.lcssa
  %75 = srem i64 %74, 998244353
  %76 = mul nsw i64 %.053.lcssa, %.055.lcssa
  %77 = srem i64 %76, 998244353
  %78 = mul nsw i64 %.053.lcssa, %.054.lcssa
  %79 = srem i64 %78, 998244353
  %80 = mul nsw i64 %.053.lcssa, %75
  %81 = srem i64 %80, 998244353
  %82 = add nsw i64 %75, 1
  %83 = add nsw i64 %82, %73
  %84 = add nsw i64 %83, %77
  %85 = add nsw i64 %84, %79
  %86 = add nsw i64 %85, %81
  %87 = srem i64 %86, 998244353
  %88 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %87)
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %88, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret i32 0

.lr.ph85:                                         ; preds = %.preheader, %.lr.ph85
  %indvars.iv104 = phi i64 [ %indvars.iv.next105, %.lr.ph85 ], [ 1, %.preheader ]
  %.05383 = phi i64 [ %101, %.lr.ph85 ], [ 0, %.preheader ]
  %90 = load i64, ptr %2, align 8, !tbaa !5
  %91 = call noundef i64 @_Z8binomialxxx(i64 noundef %90, i64 noundef %indvars.iv104, i64 noundef 998244353)
  %92 = load i64, ptr %3, align 8, !tbaa !5
  %93 = call noundef i64 @_Z8binomialxxx(i64 noundef %92, i64 noundef %indvars.iv104, i64 noundef 998244353)
  %94 = mul nsw i64 %93, %91
  %95 = srem i64 %94, 998244353
  %96 = getelementptr inbounds [5001 x i64], ptr @p, i64 0, i64 %indvars.iv104
  %97 = load i64, ptr %96, align 8, !tbaa !5
  %98 = mul nsw i64 %95, %97
  %99 = srem i64 %98, 998244353
  %100 = add nsw i64 %99, %.05383
  %101 = srem i64 %100, 998244353
  %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
  %102 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %103 = load i64, ptr %102, align 8, !tbaa !5
  %.not65.not = icmp sgt i64 %103, %indvars.iv104
  br i1 %.not65.not, label %.lr.ph85, label %._crit_edge, !llvm.loop !15
}

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) 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 = { 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 = { 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 = { 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 = { 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 = !{!"long long", !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,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass