; LLVM IR from ShahjalalShohag/code-library :: Math/Matrix Exponentiation With Polynomial Coefficients.ll (Z3nttRSt6vectorIiSaIiEEi)

; 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.__gnu_cxx::__normal_iterator" = type { ptr }

@lim = external dso_local global i32, align 4
@rev = external dso_local global [65536 x i32], align 16
@w = external dso_local global [65536 x i32], align 16
@wn = external dso_local global [65536 x i32], align 16
@inv_lim = external dso_local global i32, align 4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z6reduceRi(ptr noundef nonnull align 4 dereferenceable(4)) #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 @_Z3nttRSt6vectorIiSaIiEEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %1) #2 {
  %3 = alloca ptr, align 8
  %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
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %16 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %17 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %18 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %44, %2
  %20 = load i32, ptr %5, align 4, !tbaa !9
  %21 = load i32, ptr @lim, align 4, !tbaa !9
  %22 = icmp slt i32 %20, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %47

24:                                               ; preds = %19
  %25 = load i32, ptr %5, align 4, !tbaa !9
  %26 = load i32, ptr %5, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [65536 x i32], ptr @rev, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !9
  %30 = icmp slt i32 %25, %29
  br i1 %30, label %31, label %43

31:                                               ; preds = %24
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = load i32, ptr %5, align 4, !tbaa !9
  %34 = sext i32 %33 to i64
  %35 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %32, i64 noundef %34) #5
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = load i32, ptr %5, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [65536 x i32], ptr @rev, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %36, i64 noundef %41) #5
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %35, ptr noundef nonnull align 4 dereferenceable(4) %42) #5
  br label %43

43:                                               ; preds = %31, %24
  br label %44

44:                                               ; preds = %43
  %45 = load i32, ptr %5, align 4, !tbaa !9
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %5, align 4, !tbaa !9
  br label %19, !llvm.loop !11

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

48:                                               ; preds = %145, %47
  %49 = load i32, ptr %6, align 4, !tbaa !9
  %50 = load i32, ptr @lim, align 4, !tbaa !9
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %53, label %52

52:                                               ; preds = %48
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %148

53:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %54 = load i32, ptr @lim, align 4, !tbaa !9
  %55 = load i32, ptr %6, align 4, !tbaa !9
  %56 = sdiv i32 %54, %55
  %57 = sdiv i32 %56, 2
  store i32 %57, ptr %9, align 4, !tbaa !9
  br label %58

58:                                               ; preds = %73, %53
  %59 = load i32, ptr %8, align 4, !tbaa !9
  %60 = load i32, ptr %6, align 4, !tbaa !9
  %61 = icmp slt i32 %59, %60
  br i1 %61, label %63, label %62

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

63:                                               ; preds = %58
  %64 = load i32, ptr %8, align 4, !tbaa !9
  %65 = load i32, ptr %9, align 4, !tbaa !9
  %66 = mul nsw i32 %64, %65
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [65536 x i32], ptr @wn, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !9
  %70 = load i32, ptr %8, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [65536 x i32], ptr @w, i64 0, i64 %71
  store i32 %69, ptr %72, align 4, !tbaa !9
  br label %73

73:                                               ; preds = %63
  %74 = load i32, ptr %8, align 4, !tbaa !9
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %8, align 4, !tbaa !9
  br label %58, !llvm.loop !13

76:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %77

77:                                               ; preds = %139, %76
  %78 = load i32, ptr %10, align 4, !tbaa !9
  %79 = load i32, ptr @lim, align 4, !tbaa !9
  %80 = icmp slt i32 %78, %79
  br i1 %80, label %82, label %81

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

82:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %83

83:                                               ; preds = %135, %82
  %84 = load i32, ptr %11, align 4, !tbaa !9
  %85 = load i32, ptr %6, align 4, !tbaa !9
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %88, label %87

87:                                               ; preds = %83
  store i32 14, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %138

88:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %89 = load ptr, ptr %3, align 8, !tbaa !5
  %90 = load i32, ptr %11, align 4, !tbaa !9
  %91 = load i32, ptr %10, align 4, !tbaa !9
  %92 = add nsw i32 %90, %91
  %93 = sext i32 %92 to i64
  %94 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %89, i64 noundef %93) #5
  %95 = load i32, ptr %94, align 4, !tbaa !9
  store i32 %95, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %96 = load ptr, ptr %3, align 8, !tbaa !5
  %97 = load i32, ptr %11, align 4, !tbaa !9
  %98 = load i32, ptr %10, align 4, !tbaa !9
  %99 = add nsw i32 %97, %98
  %100 = load i32, ptr %6, align 4, !tbaa !9
  %101 = add nsw i32 %99, %100
  %102 = sext i32 %101 to i64
  %103 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %96, i64 noundef %102) #5
  %104 = load i32, ptr %103, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = load i32, ptr %11, align 4, !tbaa !9
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [65536 x i32], ptr @w, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !9
  %110 = sext i32 %109 to i64
  %111 = mul nsw i64 %105, %110
  %112 = srem i64 %111, 998244353
  %113 = trunc i64 %112 to i32
  store i32 %113, ptr %13, align 4, !tbaa !9
  %114 = load i32, ptr %13, align 4, !tbaa !9
  %115 = sub nsw i32 %114, 998244353
  %116 = load ptr, ptr %3, align 8, !tbaa !5
  %117 = load i32, ptr %11, align 4, !tbaa !9
  %118 = load i32, ptr %10, align 4, !tbaa !9
  %119 = add nsw i32 %117, %118
  %120 = sext i32 %119 to i64
  %121 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %116, i64 noundef %120) #5
  %122 = load i32, ptr %121, align 4, !tbaa !9
  %123 = add nsw i32 %122, %115
  store i32 %123, ptr %121, align 4, !tbaa !9
  call void @_Z6reduceRi(ptr noundef nonnull align 4 dereferenceable(4) %121)
  %124 = load i32, ptr %12, align 4, !tbaa !9
  %125 = load i32, ptr %13, align 4, !tbaa !9
  %126 = sub nsw i32 %124, %125
  %127 = load ptr, ptr %3, align 8, !tbaa !5
  %128 = load i32, ptr %11, align 4, !tbaa !9
  %129 = load i32, ptr %10, align 4, !tbaa !9
  %130 = add nsw i32 %128, %129
  %131 = load i32, ptr %6, align 4, !tbaa !9
  %132 = add nsw i32 %130, %131
  %133 = sext i32 %132 to i64
  %134 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %127, i64 noundef %133) #5
  store i32 %126, ptr %134, align 4, !tbaa !9
  call void @_Z6reduceRi(ptr noundef nonnull align 4 dereferenceable(4) %134)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %135

135:                                              ; preds = %88
  %136 = load i32, ptr %11, align 4, !tbaa !9
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %11, align 4, !tbaa !9
  br label %83, !llvm.loop !14

138:                                              ; preds = %87
  br label %139

139:                                              ; preds = %138
  %140 = load i32, ptr %6, align 4, !tbaa !9
  %141 = shl i32 %140, 1
  %142 = load i32, ptr %10, align 4, !tbaa !9
  %143 = add nsw i32 %142, %141
  store i32 %143, ptr %10, align 4, !tbaa !9
  br label %77, !llvm.loop !15

144:                                              ; preds = %81
  br label %145

145:                                              ; preds = %144
  %146 = load i32, ptr %6, align 4, !tbaa !9
  %147 = shl i32 %146, 1
  store i32 %147, ptr %6, align 4, !tbaa !9
  br label %48, !llvm.loop !16

148:                                              ; preds = %52
  %149 = load i32, ptr %4, align 4, !tbaa !9
  %150 = icmp ne i32 %149, 0
  br i1 %150, label %193, label %151

151:                                              ; preds = %148
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %152 = load ptr, ptr %3, align 8, !tbaa !5
  %153 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %152) #5
  %154 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %15, i32 0, i32 0
  store ptr %153, ptr %154, align 8
  %155 = call ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEplEl(ptr noundef nonnull align 8 dereferenceable(8) %15, i64 noundef 1) #5
  %156 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  store ptr %155, ptr %156, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %157 = load ptr, ptr %3, align 8, !tbaa !5
  %158 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %157) #5
  %159 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  store ptr %158, ptr %159, align 8
  %160 = load i32, ptr @lim, align 4, !tbaa !9
  %161 = sext i32 %160 to i64
  %162 = call ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEplEl(ptr noundef nonnull align 8 dereferenceable(8) %17, i64 noundef %161) #5
  %163 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  store ptr %162, ptr %163, align 8
  %164 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  %165 = load ptr, ptr %164, align 8
  %166 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  %167 = load ptr, ptr %166, align 8
  call void @_ZSt7reverseIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_(ptr %165, ptr %167)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %168

168:                                              ; preds = %189, %151
  %169 = load i32, ptr %18, align 4, !tbaa !9
  %170 = load i32, ptr @lim, align 4, !tbaa !9
  %171 = icmp slt i32 %169, %170
  br i1 %171, label %173, label %172

172:                                              ; preds = %168
  store i32 17, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %192

173:                                              ; preds = %168
  %174 = load ptr, ptr %3, align 8, !tbaa !5
  %175 = load i32, ptr %18, align 4, !tbaa !9
  %176 = sext i32 %175 to i64
  %177 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %174, i64 noundef %176) #5
  %178 = load i32, ptr %177, align 4, !tbaa !9
  %179 = sext i32 %178 to i64
  %180 = load i32, ptr @inv_lim, align 4, !tbaa !9
  %181 = sext i32 %180 to i64
  %182 = mul nsw i64 %179, %181
  %183 = srem i64 %182, 998244353
  %184 = trunc i64 %183 to i32
  %185 = load ptr, ptr %3, align 8, !tbaa !5
  %186 = load i32, ptr %18, align 4, !tbaa !9
  %187 = sext i32 %186 to i64
  %188 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %185, i64 noundef %187) #5
  store i32 %184, ptr %188, align 4, !tbaa !9
  br label %189

189:                                              ; preds = %173
  %190 = load i32, ptr %18, align 4, !tbaa !9
  %191 = add nsw i32 %190, 1
  store i32 %191, ptr %18, align 4, !tbaa !9
  br label %168, !llvm.loop !17

192:                                              ; preds = %172
  br label %193

193:                                              ; preds = %192, %148
  ret void
}

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

; 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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7reverseIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_(ptr, ptr) #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEplEl(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #0 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 = { 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 = { 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 #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 = !{!"any pointer", !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.__gnu_cxx::__normal_iterator" = type { ptr }

@lim = external dso_local local_unnamed_addr global i32, align 4
@rev = external dso_local local_unnamed_addr global [65536 x i32], align 16
@w = external dso_local local_unnamed_addr global [65536 x i32], align 16
@wn = external dso_local local_unnamed_addr global [65536 x i32], align 16
@inv_lim = external dso_local local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z6reduceRi(ptr noundef nonnull align 4 dereferenceable(4)) 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 @_Z3nttRSt6vectorIiSaIiEEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %1) local_unnamed_addr #2 {
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = load i32, ptr @lim, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge

.preheader57:                                     ; preds = %18
  %7 = icmp sgt i32 %19, 1
  br i1 %7, label %.lr.ph67, label %._crit_edge

.lr.ph:                                           ; preds = %2, %18
  %8 = phi i32 [ %19, %18 ], [ %5, %2 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %18 ], [ 0, %2 ]
  %9 = getelementptr inbounds [65536 x i32], ptr @rev, i64 0, i64 %indvars.iv
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = icmp slt i64 %indvars.iv, %11
  br i1 %12, label %13, label %18

13:                                               ; preds = %.lr.ph
  %14 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv) #5
  %15 = load i32, ptr %9, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %16) #5
  tail call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %17) #5
  %.pre = load i32, ptr @lim, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %.lr.ph, %13
  %19 = phi i32 [ %8, %.lr.ph ], [ %.pre, %13 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = sext i32 %19 to i64
  %21 = icmp slt i64 %indvars.iv.next, %20
  br i1 %21, label %.lr.ph, label %.preheader57, !llvm.loop !9

._crit_edge:                                      ; preds = %._crit_edge64, %2, %.preheader57
  %.not = icmp eq i32 %1, 0
  br i1 %.not, label %86, label %.loopexit

.lr.ph67:                                         ; preds = %.preheader57, %._crit_edge64
  %22 = phi i32 [ %84, %._crit_edge64 ], [ %19, %.preheader57 ]
  %.05165 = phi i32 [ %.pre-phi, %._crit_edge64 ], [ 1, %.preheader57 ]
  %23 = icmp sgt i32 %.05165, 0
  br i1 %23, label %.lr.ph60.preheader, label %.preheader56.thread

.lr.ph60.preheader:                               ; preds = %.lr.ph67
  %24 = sdiv i32 %22, %.05165
  %25 = sdiv i32 %24, 2
  %26 = sext i32 %25 to i64
  %wide.trip.count = zext nneg i32 %.05165 to i64
  %min.iters.check = icmp ugt i32 %.05165, 7
  %27 = and i32 %24, -2
  %ident.check.not = icmp eq i32 %27, 2
  %or.cond = and i1 %min.iters.check, %ident.check.not
  br i1 %or.cond, label %vector.ph, label %.lr.ph60.preheader91

.lr.ph60.preheader91:                             ; preds = %middle.block, %.lr.ph60.preheader
  %indvars.iv73.ph = phi i64 [ 0, %.lr.ph60.preheader ], [ %n.vec, %middle.block ]
  %xtraiter = and i64 %wide.trip.count, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph60.prol.loopexit, label %.lr.ph60.prol

.lr.ph60.prol:                                    ; preds = %.lr.ph60.preheader91, %.lr.ph60.prol
  %indvars.iv73.prol = phi i64 [ %indvars.iv.next74.prol, %.lr.ph60.prol ], [ %indvars.iv73.ph, %.lr.ph60.preheader91 ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph60.prol ], [ 0, %.lr.ph60.preheader91 ]
  %28 = mul nsw i64 %indvars.iv73.prol, %26
  %29 = getelementptr inbounds [65536 x i32], ptr @wn, i64 0, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = getelementptr inbounds [65536 x i32], ptr @w, i64 0, i64 %indvars.iv73.prol
  store i32 %30, ptr %31, align 4, !tbaa !5
  %indvars.iv.next74.prol = add nuw nsw i64 %indvars.iv73.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph60.prol.loopexit, label %.lr.ph60.prol, !llvm.loop !11

.lr.ph60.prol.loopexit:                           ; preds = %.lr.ph60.prol, %.lr.ph60.preheader91
  %indvars.iv73.unr = phi i64 [ %indvars.iv73.ph, %.lr.ph60.preheader91 ], [ %indvars.iv.next74.prol, %.lr.ph60.prol ]
  %32 = sub nsw i64 %indvars.iv73.ph, %wide.trip.count
  %33 = icmp ugt i64 %32, -4
  br i1 %33, label %.preheader56, label %.lr.ph60

vector.ph:                                        ; preds = %.lr.ph60.preheader
  %n.vec = and i64 %wide.trip.count, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %34 = getelementptr inbounds [65536 x i32], ptr @wn, i64 0, i64 %index
  %35 = getelementptr inbounds i8, ptr %34, i64 16
  %wide.load = load <4 x i32>, ptr %34, align 16, !tbaa !5
  %wide.load90 = load <4 x i32>, ptr %35, align 16, !tbaa !5
  %36 = getelementptr inbounds [65536 x i32], ptr @w, i64 0, i64 %index
  %37 = getelementptr inbounds i8, ptr %36, i64 16
  store <4 x i32> %wide.load, ptr %36, align 16, !tbaa !5
  store <4 x i32> %wide.load90, ptr %37, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %38 = icmp eq i64 %index.next, %n.vec
  br i1 %38, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %.preheader56, label %.lr.ph60.preheader91

.preheader56:                                     ; preds = %.lr.ph60.prol.loopexit, %.lr.ph60, %middle.block
  %39 = icmp sgt i32 %22, 0
  br i1 %39, label %.preheader.lr.ph, label %.preheader56.._crit_edge64_crit_edge

.preheader56.thread:                              ; preds = %.lr.ph67
  %40 = icmp sgt i32 %22, 0
  br i1 %40, label %.preheader.lr.ph.thread, label %.preheader56.._crit_edge64_crit_edge

.preheader.lr.ph.thread:                          ; preds = %.preheader56.thread
  %41 = shl i32 %.05165, 1
  br label %._crit_edge64

.preheader56.._crit_edge64_crit_edge:             ; preds = %.preheader56.thread, %.preheader56
  %.pre87 = shl i32 %.05165, 1
  br label %._crit_edge64

.preheader.lr.ph:                                 ; preds = %.preheader56
  %42 = shl nuw i32 %.05165, 1
  br i1 %23, label %.preheader.us.preheader, label %._crit_edge64

.preheader.us.preheader:                          ; preds = %.preheader.lr.ph
  %43 = zext nneg i32 %.05165 to i64
  %44 = sext i32 %42 to i64
  %wide.trip.count79 = zext nneg i32 %.05165 to i64
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge.us
  %indvars.iv81 = phi i64 [ 0, %.preheader.us.preheader ], [ %indvars.iv.next82, %._crit_edge.us ]
  br label %45

45:                                               ; preds = %.preheader.us, %45
  %indvars.iv76 = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next77, %45 ]
  %46 = add nsw i64 %indvars.iv76, %indvars.iv81
  %47 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %46) #5
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = add nsw i64 %46, %43
  %50 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %49) #5
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [65536 x i32], ptr @w, i64 0, i64 %indvars.iv76
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = mul nsw i64 %55, %52
  %57 = srem i64 %56, 998244353
  %58 = trunc nsw i64 %57 to i32
  %59 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %46) #5
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = add i32 %60, -998244353
  %62 = add i32 %61, %58
  store i32 %62, ptr %59, align 4, !tbaa !5
  tail call void @_Z6reduceRi(ptr noundef nonnull align 4 dereferenceable(4) %59)
  %63 = sub nsw i32 %48, %58
  %64 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %49) #5
  store i32 %63, ptr %64, align 4, !tbaa !5
  tail call void @_Z6reduceRi(ptr noundef nonnull align 4 dereferenceable(4) %64)
  %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
  %exitcond80.not = icmp eq i64 %indvars.iv.next77, %wide.trip.count79
  br i1 %exitcond80.not, label %._crit_edge.us, label %45, !llvm.loop !16

._crit_edge.us:                                   ; preds = %45
  %indvars.iv.next82 = add nsw i64 %indvars.iv81, %44
  %65 = load i32, ptr @lim, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = icmp slt i64 %indvars.iv.next82, %66
  br i1 %67, label %.preheader.us, label %._crit_edge64, !llvm.loop !17

.lr.ph60:                                         ; preds = %.lr.ph60.prol.loopexit, %.lr.ph60
  %indvars.iv73 = phi i64 [ %indvars.iv.next74.3, %.lr.ph60 ], [ %indvars.iv73.unr, %.lr.ph60.prol.loopexit ]
  %68 = mul nsw i64 %indvars.iv73, %26
  %69 = getelementptr inbounds [65536 x i32], ptr @wn, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = getelementptr inbounds [65536 x i32], ptr @w, i64 0, i64 %indvars.iv73
  store i32 %70, ptr %71, align 4, !tbaa !5
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %72 = mul nsw i64 %indvars.iv.next74, %26
  %73 = getelementptr inbounds [65536 x i32], ptr @wn, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = getelementptr inbounds [65536 x i32], ptr @w, i64 0, i64 %indvars.iv.next74
  store i32 %74, ptr %75, align 4, !tbaa !5
  %indvars.iv.next74.1 = add nuw nsw i64 %indvars.iv73, 2
  %76 = mul nsw i64 %indvars.iv.next74.1, %26
  %77 = getelementptr inbounds [65536 x i32], ptr @wn, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = getelementptr inbounds [65536 x i32], ptr @w, i64 0, i64 %indvars.iv.next74.1
  store i32 %78, ptr %79, align 4, !tbaa !5
  %indvars.iv.next74.2 = add nuw nsw i64 %indvars.iv73, 3
  %80 = mul nsw i64 %indvars.iv.next74.2, %26
  %81 = getelementptr inbounds [65536 x i32], ptr @wn, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = getelementptr inbounds [65536 x i32], ptr @w, i64 0, i64 %indvars.iv.next74.2
  store i32 %82, ptr %83, align 4, !tbaa !5
  %indvars.iv.next74.3 = add nuw nsw i64 %indvars.iv73, 4
  %exitcond.not.3 = icmp eq i64 %indvars.iv.next74.3, %wide.trip.count
  br i1 %exitcond.not.3, label %.preheader56, label %.lr.ph60, !llvm.loop !18

._crit_edge64:                                    ; preds = %._crit_edge.us, %.preheader.lr.ph, %.preheader.lr.ph.thread, %.preheader56.._crit_edge64_crit_edge
  %.pre-phi = phi i32 [ %.pre87, %.preheader56.._crit_edge64_crit_edge ], [ %41, %.preheader.lr.ph.thread ], [ %42, %.preheader.lr.ph ], [ %42, %._crit_edge.us ]
  %84 = phi i32 [ %22, %.preheader56.._crit_edge64_crit_edge ], [ %22, %.preheader.lr.ph.thread ], [ %22, %.preheader.lr.ph ], [ %65, %._crit_edge.us ]
  %85 = icmp slt i32 %.pre-phi, %84
  br i1 %85, label %.lr.ph67, label %._crit_edge, !llvm.loop !19

86:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %87 = tail call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  store ptr %87, ptr %3, align 8
  %88 = call ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEplEl(ptr noundef nonnull align 8 dereferenceable(8) %3, i64 noundef 1) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %89 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  store ptr %89, ptr %4, align 8
  %90 = load i32, ptr @lim, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = call ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEplEl(ptr noundef nonnull align 8 dereferenceable(8) %4, i64 noundef %91) #5
  call void @_ZSt7reverseIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_(ptr %88, ptr %92)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  %93 = load i32, ptr @lim, align 4, !tbaa !5
  %94 = icmp sgt i32 %93, 0
  br i1 %94, label %.lr.ph70, label %.loopexit

.lr.ph70:                                         ; preds = %86, %.lr.ph70
  %indvars.iv84 = phi i64 [ %indvars.iv.next85, %.lr.ph70 ], [ 0, %86 ]
  %95 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv84) #5
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = load i32, ptr @inv_lim, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = mul nsw i64 %99, %97
  %101 = srem i64 %100, 998244353
  %102 = trunc nsw i64 %101 to i32
  %103 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv84) #5
  store i32 %102, ptr %103, align 4, !tbaa !5
  %indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
  %104 = load i32, ptr @lim, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = icmp slt i64 %indvars.iv.next85, %105
  br i1 %106, label %.lr.ph70, label %.loopexit, !llvm.loop !20

.loopexit:                                        ; preds = %.lr.ph70, %86, %._crit_edge
  ret void
}

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

; 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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7reverseIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_(ptr, ptr) local_unnamed_addr #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEplEl(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #0 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 = { 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 = { 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 #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, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !14}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}


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