; LLVM IR from lzyrapx/Competitive-Programming :: Codeforces/Math/1257G.ll (Z8poly_pow4polyii)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.poly = type <{ %"class.std::vector", i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z5mypowii(i32 noundef, i32 noundef) #0

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10scalar_mul4polyi(ptr dead_on_unwind noalias writable sret(%struct.poly) align 8, ptr noundef, i32 noundef) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4polyC2ERKS_(ptr noundef nonnull align 8 dereferenceable(28), ptr noundef nonnull align 8 dereferenceable(28)) unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(28) ptr @_ZN4polyaSEOS_(ptr noundef nonnull align 8 dereferenceable(28), ptr noundef nonnull align 8 dereferenceable(28)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7poly_ln4polyi(ptr dead_on_unwind noalias writable sret(%struct.poly) align 8, ptr noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8poly_exp4polyi(ptr dead_on_unwind noalias writable sret(%struct.poly) align 8, ptr noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z8poly_pow4polyii(ptr dead_on_unwind noalias writable sret(%struct.poly) align 8 %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) #2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %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 i1, align 1
  %15 = alloca %struct.poly, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca %struct.poly, align 8
  %20 = alloca %struct.poly, align 8
  %21 = alloca %struct.poly, align 8
  %22 = alloca %struct.poly, align 8
  store ptr %0, ptr %5, align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i1 false, ptr %14, align 1
  call void @_ZN4polyC2Ev(ptr noundef nonnull align 8 dereferenceable(28) %0)
  call void @llvm.lifetime.start.p0(i64 32, ptr %15) #5
  invoke void @_ZN4polyC2Ev(ptr noundef nonnull align 8 dereferenceable(28) %15)
          to label %23 unwind label %43

23:                                               ; preds = %4
  %24 = getelementptr inbounds %struct.poly, ptr %1, i32 0, i32 1
  %25 = load i32, ptr %24, align 8, !tbaa !11
  store i32 %25, ptr %10, align 4, !tbaa !9
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %40, %23
  %27 = load i32, ptr %9, align 4, !tbaa !9
  %28 = load i32, ptr %10, align 4, !tbaa !9
  %29 = icmp sle i32 %27, %28
  br i1 %29, label %30, label %37

30:                                               ; preds = %26
  %31 = getelementptr inbounds %struct.poly, ptr %1, i32 0, i32 0
  %32 = load i32, ptr %9, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %31, i64 noundef %33) #5
  %35 = load i32, ptr %34, align 4, !tbaa !9
  %36 = icmp eq i32 %35, 0
  br label %37

37:                                               ; preds = %30, %26
  %38 = phi i1 [ false, %26 ], [ %36, %30 ]
  br i1 %38, label %39, label %47

39:                                               ; preds = %37
  br label %40

40:                                               ; preds = %39
  %41 = load i32, ptr %9, align 4, !tbaa !9
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %9, align 4, !tbaa !9
  br label %26, !llvm.loop !17

43:                                               ; preds = %4
  %44 = landingpad { ptr, i32 }
          cleanup
  %45 = extractvalue { ptr, i32 } %44, 0
  store ptr %45, ptr %16, align 8
  %46 = extractvalue { ptr, i32 } %44, 1
  store i32 %46, ptr %17, align 4
  br label %193

47:                                               ; preds = %37
  %48 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %48, ptr %11, align 4, !tbaa !9
  %49 = load i32, ptr %9, align 4, !tbaa !9
  %50 = load i32, ptr %8, align 4, !tbaa !9
  %51 = icmp sgt i32 %49, %50
  br i1 %51, label %52, label %53

52:                                               ; preds = %47
  store i1 true, ptr %14, align 1
  store i32 1, ptr %18, align 4
  br label %190

53:                                               ; preds = %47
  %54 = getelementptr inbounds %struct.poly, ptr %1, i32 0, i32 0
  %55 = load i32, ptr %11, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %54, i64 noundef %56) #5
  %58 = load i32, ptr %57, align 4, !tbaa !9
  %59 = call noundef i32 @_Z5mypowii(i32 noundef %58, i32 noundef 998244351)
  store i32 %59, ptr %12, align 4, !tbaa !9
  %60 = getelementptr inbounds %struct.poly, ptr %1, i32 0, i32 0
  %61 = load i32, ptr %11, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %60, i64 noundef %62) #5
  %64 = load i32, ptr %63, align 4, !tbaa !9
  %65 = load i32, ptr %7, align 4, !tbaa !9
  %66 = call noundef i32 @_Z5mypowii(i32 noundef %64, i32 noundef %65)
  store i32 %66, ptr %13, align 4, !tbaa !9
  %67 = load i32, ptr %10, align 4, !tbaa !9
  %68 = load i32, ptr %11, align 4, !tbaa !9
  %69 = sub nsw i32 %67, %68
  %70 = getelementptr inbounds %struct.poly, ptr %15, i32 0, i32 1
  store i32 %69, ptr %70, align 8, !tbaa !11
  %71 = getelementptr inbounds %struct.poly, ptr %15, i32 0, i32 0
  %72 = getelementptr inbounds %struct.poly, ptr %15, i32 0, i32 1
  %73 = load i32, ptr %72, align 8, !tbaa !11
  %74 = add nsw i32 %73, 1
  %75 = sext i32 %74 to i64
  invoke void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %71, i64 noundef %75)
          to label %76 unwind label %104

76:                                               ; preds = %53
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %77

77:                                               ; preds = %101, %76
  %78 = load i32, ptr %9, align 4, !tbaa !9
  %79 = getelementptr inbounds %struct.poly, ptr %15, i32 0, i32 1
  %80 = load i32, ptr %79, align 8, !tbaa !11
  %81 = icmp sle i32 %78, %80
  br i1 %81, label %82, label %108

82:                                               ; preds = %77
  %83 = load i32, ptr %12, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = mul nsw i64 1, %84
  %86 = getelementptr inbounds %struct.poly, ptr %1, i32 0, i32 0
  %87 = load i32, ptr %9, align 4, !tbaa !9
  %88 = load i32, ptr %11, align 4, !tbaa !9
  %89 = add nsw i32 %87, %88
  %90 = sext i32 %89 to i64
  %91 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %86, i64 noundef %90) #5
  %92 = load i32, ptr %91, align 4, !tbaa !9
  %93 = sext i32 %92 to i64
  %94 = mul nsw i64 %85, %93
  %95 = srem i64 %94, 998244353
  %96 = trunc i64 %95 to i32
  %97 = getelementptr inbounds %struct.poly, ptr %15, i32 0, i32 0
  %98 = load i32, ptr %9, align 4, !tbaa !9
  %99 = sext i32 %98 to i64
  %100 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %97, i64 noundef %99) #5
  store i32 %96, ptr %100, align 4, !tbaa !9
  br label %101

101:                                              ; preds = %82
  %102 = load i32, ptr %9, align 4, !tbaa !9
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %9, align 4, !tbaa !9
  br label %77, !llvm.loop !19

104:                                              ; preds = %115, %53
  %105 = landingpad { ptr, i32 }
          cleanup
  %106 = extractvalue { ptr, i32 } %105, 0
  store ptr %106, ptr %16, align 8
  %107 = extractvalue { ptr, i32 } %105, 1
  store i32 %107, ptr %17, align 4
  br label %192

108:                                              ; preds = %77
  call void @llvm.lifetime.start.p0(i64 32, ptr %19) #5
  invoke void @_ZN4polyC2ERKS_(ptr noundef nonnull align 8 dereferenceable(28) %22, ptr noundef nonnull align 8 dereferenceable(28) %15)
          to label %109 unwind label %170

109:                                              ; preds = %108
  %110 = load i32, ptr %8, align 4, !tbaa !9
  invoke void @_Z7poly_ln4polyi(ptr dead_on_unwind writable sret(%struct.poly) align 8 %21, ptr noundef %22, i32 noundef %110)
          to label %111 unwind label %174

111:                                              ; preds = %109
  %112 = load i32, ptr %7, align 4, !tbaa !9
  invoke void @_Z10scalar_mul4polyi(ptr dead_on_unwind writable sret(%struct.poly) align 8 %20, ptr noundef %21, i32 noundef %112)
          to label %113 unwind label %178

113:                                              ; preds = %111
  %114 = load i32, ptr %8, align 4, !tbaa !9
  invoke void @_Z8poly_exp4polyi(ptr dead_on_unwind writable sret(%struct.poly) align 8 %19, ptr noundef %20, i32 noundef %114)
          to label %115 unwind label %182

115:                                              ; preds = %113
  %116 = call noundef nonnull align 8 dereferenceable(28) ptr @_ZN4polyaSEOS_(ptr noundef nonnull align 8 dereferenceable(28) %15, ptr noundef nonnull align 8 dereferenceable(28) %19) #5
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %19) #5
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %20) #5
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %21) #5
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %22) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %19) #5
  %117 = getelementptr inbounds %struct.poly, ptr %0, i32 0, i32 0
  %118 = load i32, ptr %8, align 4, !tbaa !9
  %119 = sext i32 %118 to i64
  invoke void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %117, i64 noundef %119)
          to label %120 unwind label %104

120:                                              ; preds = %115
  %121 = load i32, ptr %8, align 4, !tbaa !9
  %122 = sub nsw i32 %121, 1
  %123 = getelementptr inbounds %struct.poly, ptr %0, i32 0, i32 1
  store i32 %122, ptr %123, align 8, !tbaa !11
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %124

124:                                              ; preds = %167, %120
  %125 = load i32, ptr %9, align 4, !tbaa !9
  %126 = getelementptr inbounds %struct.poly, ptr %15, i32 0, i32 1
  %127 = load i32, ptr %126, align 8, !tbaa !11
  %128 = icmp sle i32 %125, %127
  br i1 %128, label %129, label %144

129:                                              ; preds = %124
  %130 = load i32, ptr %9, align 4, !tbaa !9
  %131 = sext i32 %130 to i64
  %132 = mul nsw i64 1, %131
  %133 = load i32, ptr %7, align 4, !tbaa !9
  %134 = sext i32 %133 to i64
  %135 = mul nsw i64 1, %134
  %136 = load i32, ptr %11, align 4, !tbaa !9
  %137 = sext i32 %136 to i64
  %138 = mul nsw i64 %135, %137
  %139 = add nsw i64 %132, %138
  %140 = getelementptr inbounds %struct.poly, ptr %0, i32 0, i32 1
  %141 = load i32, ptr %140, align 8, !tbaa !11
  %142 = sext i32 %141 to i64
  %143 = icmp sle i64 %139, %142
  br label %144

144:                                              ; preds = %129, %124
  %145 = phi i1 [ false, %124 ], [ %143, %129 ]
  br i1 %145, label %146, label %189

146:                                              ; preds = %144
  %147 = load i32, ptr %13, align 4, !tbaa !9
  %148 = sext i32 %147 to i64
  %149 = mul nsw i64 1, %148
  %150 = getelementptr inbounds %struct.poly, ptr %15, i32 0, i32 0
  %151 = load i32, ptr %9, align 4, !tbaa !9
  %152 = sext i32 %151 to i64
  %153 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %150, i64 noundef %152) #5
  %154 = load i32, ptr %153, align 4, !tbaa !9
  %155 = sext i32 %154 to i64
  %156 = mul nsw i64 %149, %155
  %157 = srem i64 %156, 998244353
  %158 = trunc i64 %157 to i32
  %159 = getelementptr inbounds %struct.poly, ptr %0, i32 0, i32 0
  %160 = load i32, ptr %9, align 4, !tbaa !9
  %161 = load i32, ptr %7, align 4, !tbaa !9
  %162 = load i32, ptr %11, align 4, !tbaa !9
  %163 = mul nsw i32 %161, %162
  %164 = add nsw i32 %160, %163
  %165 = sext i32 %164 to i64
  %166 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %159, i64 noundef %165) #5
  store i32 %158, ptr %166, align 4, !tbaa !9
  br label %167

167:                                              ; preds = %146
  %168 = load i32, ptr %9, align 4, !tbaa !9
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %9, align 4, !tbaa !9
  br label %124, !llvm.loop !20

170:                                              ; preds = %108
  %171 = landingpad { ptr, i32 }
          cleanup
  %172 = extractvalue { ptr, i32 } %171, 0
  store ptr %172, ptr %16, align 8
  %173 = extractvalue { ptr, i32 } %171, 1
  store i32 %173, ptr %17, align 4
  br label %188

174:                                              ; preds = %109
  %175 = landingpad { ptr, i32 }
          cleanup
  %176 = extractvalue { ptr, i32 } %175, 0
  store ptr %176, ptr %16, align 8
  %177 = extractvalue { ptr, i32 } %175, 1
  store i32 %177, ptr %17, align 4
  br label %187

178:                                              ; preds = %111
  %179 = landingpad { ptr, i32 }
          cleanup
  %180 = extractvalue { ptr, i32 } %179, 0
  store ptr %180, ptr %16, align 8
  %181 = extractvalue { ptr, i32 } %179, 1
  store i32 %181, ptr %17, align 4
  br label %186

182:                                              ; preds = %113
  %183 = landingpad { ptr, i32 }
          cleanup
  %184 = extractvalue { ptr, i32 } %183, 0
  store ptr %184, ptr %16, align 8
  %185 = extractvalue { ptr, i32 } %183, 1
  store i32 %185, ptr %17, align 4
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %20) #5
  br label %186

186:                                              ; preds = %182, %178
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %21) #5
  br label %187

187:                                              ; preds = %186, %174
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %22) #5
  br label %188

188:                                              ; preds = %187, %170
  call void @llvm.lifetime.end.p0(i64 32, ptr %19) #5
  br label %192

189:                                              ; preds = %144
  store i1 true, ptr %14, align 1
  store i32 1, ptr %18, align 4
  br label %190

190:                                              ; preds = %189, %52
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %15) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #5
  %191 = load i1, ptr %14, align 1
  br i1 %191, label %195, label %194

192:                                              ; preds = %188, %104
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %15) #5
  br label %193

193:                                              ; preds = %192, %43
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #5
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %0) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %196

194:                                              ; preds = %190
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %0) #5
  br label %195

195:                                              ; preds = %194, %190
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  ret void

196:                                              ; preds = %193
  %197 = load ptr, ptr %16, align 8
  %198 = load i32, ptr %17, align 4
  %199 = insertvalue { ptr, i32 } poison, ptr %197, 0
  %200 = insertvalue { ptr, i32 } %199, i32 %198, 1
  resume { ptr, i32 } %200
}

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 = !{!12, !10, i64 24}
!12 = !{!"_ZTS4poly", !13, i64 0, !10, i64 24}
!13 = !{!"_ZTSSt6vectorIiSaIiEE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = distinct !{!20, !18}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.poly = type <{ %"class.std::vector", i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z5mypowii(i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10scalar_mul4polyi(ptr dead_on_unwind noalias writable sret(%struct.poly) align 8, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4polyC2ERKS_(ptr noundef nonnull align 8 dereferenceable(28), ptr noundef nonnull align 8 dereferenceable(28)) unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(28) ptr @_ZN4polyaSEOS_(ptr noundef nonnull align 8 dereferenceable(28), ptr noundef nonnull align 8 dereferenceable(28)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7poly_ln4polyi(ptr dead_on_unwind noalias writable sret(%struct.poly) align 8, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8poly_exp4polyi(ptr dead_on_unwind noalias writable sret(%struct.poly) align 8, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z8poly_pow4polyii(ptr dead_on_unwind noalias nonnull writable sret(%struct.poly) align 8 %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %struct.poly, align 8
  %6 = alloca %struct.poly, align 8
  %7 = alloca %struct.poly, align 8
  %8 = alloca %struct.poly, align 8
  %9 = alloca %struct.poly, align 8
  tail call void @_ZN4polyC2Ev(ptr noundef nonnull align 8 dereferenceable(28) %0)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #5
  invoke void @_ZN4polyC2Ev(ptr noundef nonnull align 8 dereferenceable(28) %5)
          to label %10 unwind label %18

10:                                               ; preds = %4
  %11 = getelementptr inbounds i8, ptr %1, i64 24
  %12 = load i32, ptr %11, align 8, !tbaa !5
  %.not56 = icmp slt i32 %12, 0
  br i1 %.not56, label %.critedge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %10
  %13 = add nuw i32 %12, 1
  %wide.trip.count = zext i32 %13 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %17
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %17 ]
  %14 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %indvars.iv) #5
  %15 = load i32, ptr %14, align 4, !tbaa !15
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %.critedge.loopexit.split.loop.exit75

17:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.critedge, label %.lr.ph, !llvm.loop !16

18:                                               ; preds = %4
  %19 = landingpad { ptr, i32 }
          cleanup
  br label %91

.critedge.loopexit.split.loop.exit75:             ; preds = %.lr.ph
  %20 = trunc nuw nsw i64 %indvars.iv to i32
  br label %.critedge

.critedge:                                        ; preds = %17, %.critedge.loopexit.split.loop.exit75, %10
  %.043.lcssa = phi i32 [ 0, %10 ], [ %20, %.critedge.loopexit.split.loop.exit75 ], [ %13, %17 ]
  %21 = icmp sgt i32 %.043.lcssa, %3
  br i1 %21, label %.critedge2, label %22

22:                                               ; preds = %.critedge
  %23 = zext i32 %.043.lcssa to i64
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %23) #5
  %25 = load i32, ptr %24, align 4, !tbaa !15
  %26 = call noundef i32 @_Z5mypowii(i32 noundef %25, i32 noundef 998244351)
  %27 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %23) #5
  %28 = load i32, ptr %27, align 4, !tbaa !15
  %29 = call noundef i32 @_Z5mypowii(i32 noundef %28, i32 noundef %2)
  %30 = sub nsw i32 %12, %.043.lcssa
  %31 = getelementptr inbounds i8, ptr %5, i64 24
  store i32 %30, ptr %31, align 8, !tbaa !5
  %32 = add nsw i32 %30, 1
  %33 = sext i32 %32 to i64
  invoke void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %33)
          to label %.preheader unwind label %47

.preheader:                                       ; preds = %22
  %34 = load i32, ptr %31, align 8, !tbaa !5
  %.not4760 = icmp slt i32 %34, 0
  br i1 %.not4760, label %._crit_edge, label %.lr.ph62

.lr.ph62:                                         ; preds = %.preheader
  %35 = sext i32 %26 to i64
  br label %36

36:                                               ; preds = %.lr.ph62, %36
  %indvars.iv69 = phi i64 [ 0, %.lr.ph62 ], [ %indvars.iv.next70, %36 ]
  %37 = add nuw nsw i64 %indvars.iv69, %23
  %38 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %37) #5
  %39 = load i32, ptr %38, align 4, !tbaa !15
  %40 = sext i32 %39 to i64
  %41 = mul nsw i64 %40, %35
  %42 = srem i64 %41, 998244353
  %43 = trunc nsw i64 %42 to i32
  %44 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %indvars.iv69) #5
  store i32 %43, ptr %44, align 4, !tbaa !15
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %45 = load i32, ptr %31, align 8, !tbaa !5
  %46 = sext i32 %45 to i64
  %.not47.not = icmp slt i64 %indvars.iv69, %46
  br i1 %.not47.not, label %36, label %._crit_edge, !llvm.loop !18

47:                                               ; preds = %52, %22
  %48 = landingpad { ptr, i32 }
          cleanup
  br label %90

._crit_edge:                                      ; preds = %36, %.preheader
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #5
  invoke void @_ZN4polyC2ERKS_(ptr noundef nonnull align 8 dereferenceable(28) %9, ptr noundef nonnull align 8 dereferenceable(28) %5)
          to label %49 unwind label %79

49:                                               ; preds = %._crit_edge
  invoke void @_Z7poly_ln4polyi(ptr dead_on_unwind nonnull writable sret(%struct.poly) align 8 %8, ptr noundef nonnull %9, i32 noundef %3)
          to label %50 unwind label %81

50:                                               ; preds = %49
  invoke void @_Z10scalar_mul4polyi(ptr dead_on_unwind nonnull writable sret(%struct.poly) align 8 %7, ptr noundef nonnull %8, i32 noundef %2)
          to label %51 unwind label %83

51:                                               ; preds = %50
  invoke void @_Z8poly_exp4polyi(ptr dead_on_unwind nonnull writable sret(%struct.poly) align 8 %6, ptr noundef nonnull %7, i32 noundef %3)
          to label %52 unwind label %85

52:                                               ; preds = %51
  %53 = call noundef nonnull align 8 dereferenceable(28) ptr @_ZN4polyaSEOS_(ptr noundef nonnull align 8 dereferenceable(28) %5, ptr noundef nonnull align 8 dereferenceable(28) %6) #5
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %6) #5
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %7) #5
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %8) #5
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %9) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #5
  %54 = sext i32 %3 to i64
  invoke void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %54)
          to label %55 unwind label %47

55:                                               ; preds = %52
  %56 = add nsw i32 %3, -1
  %57 = getelementptr inbounds i8, ptr %0, i64 24
  store i32 %56, ptr %57, align 8, !tbaa !5
  %58 = load i32, ptr %31, align 8, !tbaa !5
  %.not5463 = icmp slt i32 %58, 0
  br i1 %.not5463, label %.critedge2, label %.lr.ph66

.lr.ph66:                                         ; preds = %55
  %59 = sext i32 %2 to i64
  %60 = mul nsw i64 %23, %59
  %61 = sext i32 %29 to i64
  %62 = mul nsw i32 %.043.lcssa, %2
  %63 = sext i32 %62 to i64
  br label %64

64:                                               ; preds = %.lr.ph66, %68
  %indvars.iv72 = phi i64 [ 0, %.lr.ph66 ], [ %indvars.iv.next73, %68 ]
  %65 = add nsw i64 %60, %indvars.iv72
  %66 = load i32, ptr %57, align 8, !tbaa !5
  %67 = sext i32 %66 to i64
  %.not55 = icmp sgt i64 %65, %67
  br i1 %.not55, label %.critedge2, label %68

68:                                               ; preds = %64
  %69 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %indvars.iv72) #5
  %70 = load i32, ptr %69, align 4, !tbaa !15
  %71 = sext i32 %70 to i64
  %72 = mul nsw i64 %71, %61
  %73 = srem i64 %72, 998244353
  %74 = trunc nsw i64 %73 to i32
  %75 = add nsw i64 %indvars.iv72, %63
  %76 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %75) #5
  store i32 %74, ptr %76, align 4, !tbaa !15
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %77 = load i32, ptr %31, align 8, !tbaa !5
  %78 = sext i32 %77 to i64
  %.not54.not = icmp slt i64 %indvars.iv72, %78
  br i1 %.not54.not, label %64, label %.critedge2, !llvm.loop !19

79:                                               ; preds = %._crit_edge
  %80 = landingpad { ptr, i32 }
          cleanup
  br label %89

81:                                               ; preds = %49
  %82 = landingpad { ptr, i32 }
          cleanup
  br label %88

83:                                               ; preds = %50
  %84 = landingpad { ptr, i32 }
          cleanup
  br label %87

85:                                               ; preds = %51
  %86 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %7) #5
  br label %87

87:                                               ; preds = %85, %83
  %.pn = phi { ptr, i32 } [ %86, %85 ], [ %84, %83 ]
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %8) #5
  br label %88

88:                                               ; preds = %87, %81
  %.pn.pn = phi { ptr, i32 } [ %.pn, %87 ], [ %82, %81 ]
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %9) #5
  br label %89

89:                                               ; preds = %88, %79
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %88 ], [ %80, %79 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #5
  br label %90

.critedge2:                                       ; preds = %68, %64, %55, %.critedge
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %5) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  ret void

90:                                               ; preds = %89, %47
  %.pn51 = phi { ptr, i32 } [ %48, %47 ], [ %.pn.pn.pn, %89 ]
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %5) #5
  br label %91

91:                                               ; preds = %90, %18
  %.pn51.pn = phi { ptr, i32 } [ %.pn51, %90 ], [ %19, %18 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  call void @_ZN4polyD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %0) #5
  resume { ptr, i32 } %.pn51.pn
}

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, !14, i64 24}
!6 = !{!"_ZTS4poly", !7, i64 0, !14, i64 24}
!7 = !{!"_ZTSSt6vectorIiSaIiEE", !8, i64 0}
!8 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !9, i64 0}
!9 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !10, i64 0}
!10 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"int", !12, i64 0}
!15 = !{!14, !14, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !17}


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