; LLVM IR from tangjz/acm-icpc :: codeforces/gym (104022C)

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

@inv = external dso_local global [131073 x i32], align 16
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZ4mainE1f = external hidden global [131073 x i32], align 16
@_ZZ4mainE1g = external hidden global [131073 x i32], align 16
@_ZZ4mainE1h = external hidden global [131073 x i32], align 16
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7polyExpiPiS_(i32 noundef, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5solveiiPiS_S_(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"class.std::vector", align 8
  %5 = alloca ptr, align 8
  %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 ptr, align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %16 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %17 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %2)
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #6
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  invoke void @_ZNSt6vectorIiSaIiEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %20)
          to label %21 unwind label %27

21:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %48, %21
  %23 = load i32, ptr %7, align 4, !tbaa !5
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = icmp sle i32 %23, %24
  br i1 %25, label %31, label %26

26:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %51

27:                                               ; preds = %147, %79, %0
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %5, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %6, align 4
  br label %176

31:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %32 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %8)
          to label %33 unwind label %43

33:                                               ; preds = %31
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %34 unwind label %43

34:                                               ; preds = %33
  br label %35

35:                                               ; preds = %40, %34
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = load i32, ptr %8, align 4, !tbaa !5
  %38 = icmp sle i32 %36, %37
  br i1 %38, label %39, label %47

39:                                               ; preds = %35
  br label %40

40:                                               ; preds = %39
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = shl i32 %41, 1
  store i32 %42, ptr %3, align 4, !tbaa !5
  br label %35, !llvm.loop !9

43:                                               ; preds = %33, %31
  %44 = landingpad { ptr, i32 }
          cleanup
  %45 = extractvalue { ptr, i32 } %44, 0
  store ptr %45, ptr %5, align 8
  %46 = extractvalue { ptr, i32 } %44, 1
  store i32 %46, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %176

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

48:                                               ; preds = %47
  %49 = load i32, ptr %7, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %7, align 4, !tbaa !5
  br label %22, !llvm.loop !11

51:                                               ; preds = %26
  %52 = load i32, ptr %3, align 4, !tbaa !5
  call void @_Z7initNTTi(i32 noundef %52)
  store i32 0, ptr @_ZZ4mainE1f, align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([131073 x i32], ptr @_ZZ4mainE1f, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 2, ptr %9, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %76, %51
  %54 = load i32, ptr %9, align 4, !tbaa !5
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = icmp slt i32 %54, %55
  br i1 %56, label %58, label %57

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

58:                                               ; preds = %53
  %59 = load i32, ptr %9, align 4, !tbaa !5
  %60 = sub nsw i32 %59, 1
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [131073 x i32], ptr @_ZZ4mainE1f, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = load i32, ptr %9, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [131073 x i32], ptr @inv, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = mul nsw i64 %64, %69
  %71 = srem i64 %70, 998244353
  %72 = trunc i64 %71 to i32
  %73 = load i32, ptr %9, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [131073 x i32], ptr @_ZZ4mainE1f, i64 0, i64 %74
  store i32 %72, ptr %75, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %58
  %77 = load i32, ptr %9, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %9, align 4, !tbaa !5
  br label %53, !llvm.loop !12

79:                                               ; preds = %57
  %80 = load i32, ptr %3, align 4, !tbaa !5
  invoke void @_Z7polyExpiPiS_(i32 noundef %80, ptr noundef @_ZZ4mainE1f, ptr noundef @_ZZ4mainE1f)
          to label %81 unwind label %27

81:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 2, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %82

82:                                               ; preds = %108, %81
  %83 = load i32, ptr %10, align 4, !tbaa !5
  %84 = load i32, ptr %3, align 4, !tbaa !5
  %85 = icmp slt i32 %83, %84
  br i1 %85, label %87, label %86

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

87:                                               ; preds = %82
  %88 = load i32, ptr %11, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = load i32, ptr %10, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = mul nsw i64 %89, %91
  %93 = srem i64 %92, 998244353
  %94 = trunc i64 %93 to i32
  store i32 %94, ptr %11, align 4, !tbaa !5
  %95 = load i32, ptr %10, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [131073 x i32], ptr @_ZZ4mainE1f, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = load i32, ptr %11, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = mul nsw i64 %99, %101
  %103 = srem i64 %102, 998244353
  %104 = trunc i64 %103 to i32
  %105 = load i32, ptr %10, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [131073 x i32], ptr @_ZZ4mainE1f, i64 0, i64 %106
  store i32 %104, ptr %107, align 4, !tbaa !5
  br label %108

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

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

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

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

117:                                              ; preds = %112
  br label %118

118:                                              ; preds = %133, %117
  %119 = load i32, ptr %13, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = load i32, ptr %13, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = mul nsw i64 %120, %122
  %124 = load i32, ptr %12, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = load i32, ptr %12, align 4, !tbaa !5
  %127 = load i32, ptr %13, align 4, !tbaa !5
  %128 = add nsw i32 %126, %127
  %129 = sext i32 %128 to i64
  %130 = mul nsw i64 %125, %129
  %131 = icmp slt i64 %123, %130
  br i1 %131, label %132, label %136

132:                                              ; preds = %118
  br label %133

133:                                              ; preds = %132
  %134 = load i32, ptr %13, align 4, !tbaa !5
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %13, align 4, !tbaa !5
  br label %118, !llvm.loop !14

136:                                              ; preds = %118
  %137 = load i32, ptr %13, align 4, !tbaa !5
  %138 = load i32, ptr %12, align 4, !tbaa !5
  %139 = sub nsw i32 %137, %138
  %140 = load i32, ptr %12, align 4, !tbaa !5
  %141 = sub nsw i32 %140, 1
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [131073 x i32], ptr @_ZZ4mainE1g, i64 0, i64 %142
  store i32 %139, ptr %143, align 4, !tbaa !5
  br label %144

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

147:                                              ; preds = %116
  %148 = load i32, ptr %3, align 4, !tbaa !5
  invoke void @_Z5solveiiPiS_S_(i32 noundef 0, i32 noundef %148, ptr noundef @_ZZ4mainE1f, ptr noundef @_ZZ4mainE1g, ptr noundef @_ZZ4mainE1h)
          to label %149 unwind label %27

149:                                              ; preds = %147
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  store ptr %4, ptr %14, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %150 = load ptr, ptr %14, align 8, !tbaa !16
  %151 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %150) #6
  %152 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %15, i32 0, i32 0
  store ptr %151, ptr %152, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %153 = load ptr, ptr %14, align 8, !tbaa !16
  %154 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %153) #6
  %155 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  store ptr %154, ptr %155, align 8
  br label %156

156:                                              ; preds = %168, %149
  %157 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %16) #6
  br i1 %157, label %159, label %158

158:                                              ; preds = %156
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %174

159:                                              ; preds = %156
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %160 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  %161 = load i32, ptr %160, align 4, !tbaa !5
  store i32 %161, ptr %17, align 4, !tbaa !5
  %162 = load i32, ptr %17, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [131073 x i32], ptr @_ZZ4mainE1h, i64 0, i64 %163
  %165 = load i32, ptr %164, align 4, !tbaa !5
  %166 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %165)
          to label %167 unwind label %170

167:                                              ; preds = %159
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %168

168:                                              ; preds = %167
  %169 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  br label %156

170:                                              ; preds = %159
  %171 = landingpad { ptr, i32 }
          cleanup
  %172 = extractvalue { ptr, i32 } %171, 0
  store ptr %172, ptr %5, align 8
  %173 = extractvalue { ptr, i32 } %171, 1
  store i32 %173, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %176

174:                                              ; preds = %158
  store i32 0, ptr %1, align 4
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %175 = load i32, ptr %1, align 4
  ret i32 %175

176:                                              ; preds = %170, %43, %27
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %177

177:                                              ; preds = %176
  %178 = load ptr, ptr %5, align 8
  %179 = load i32, ptr %6, align 4
  %180 = insertvalue { ptr, i32 } poison, ptr %178, 0
  %181 = insertvalue { ptr, i32 } %180, i32 %179, 1
  resume { ptr, i32 } %181
}

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

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

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

declare i32 @__gxx_personality_v0(...)

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

; 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 @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) 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 = { 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 = { 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 #4 = { "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 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 #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = !{!17, !17, i64 0}
!17 = !{!"any pointer", !7, i64 0}


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

@inv = external dso_local local_unnamed_addr global [131073 x i32], align 16
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZ4mainE1f = external hidden global [131073 x i32], align 16
@_ZZ4mainE1g = external hidden global [131073 x i32], align 16
@_ZZ4mainE1h = external hidden global [131073 x i32], align 16
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7polyExpiPiS_(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5solveiiPiS_S_(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::vector", align 8
  %3 = alloca i32, align 4
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %1)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #6
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  %7 = load i32, ptr %1, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  invoke void @_ZNSt6vectorIiSaIiEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %8)
          to label %.preheader53 unwind label %14

.preheader53:                                     ; preds = %0
  %9 = load i32, ptr %1, align 4, !tbaa !5
  %.not55 = icmp slt i32 %9, 1
  br i1 %.not55, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %22, %.preheader53
  %.0.lcssa = phi i32 [ 1, %.preheader53 ], [ %.1, %22 ]
  call void @_Z7initNTTi(i32 noundef %.0.lcssa)
  store i32 0, ptr @_ZZ4mainE1f, align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @_ZZ4mainE1f, i64 4), align 4, !tbaa !5
  %10 = icmp sgt i32 %.0.lcssa, 2
  br i1 %10, label %.lr.ph60.preheader, label %._crit_edge61

.lr.ph60.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %.0.lcssa to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %11 = icmp eq i32 %.0.lcssa, 3
  br i1 %11, label %._crit_edge61.loopexit.unr-lcssa, label %.lr.ph60.preheader.new

.lr.ph60.preheader.new:                           ; preds = %.lr.ph60.preheader
  %12 = and i64 %wide.trip.count, 2147483646
  %13 = add nsw i64 %12, -4
  br label %.lr.ph60

14:                                               ; preds = %._crit_edge68, %._crit_edge61, %0
  %15 = landingpad { ptr, i32 }
          cleanup
  br label %80

.lr.ph:                                           ; preds = %.preheader53, %22
  %.057 = phi i32 [ %.1, %22 ], [ 1, %.preheader53 ]
  %.04456 = phi i32 [ %23, %22 ], [ 1, %.preheader53 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %3)
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %.preheader52 unwind label %20

.preheader52:                                     ; preds = %.lr.ph
  %17 = load i32, ptr %3, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %18, %.preheader52
  %.1 = phi i32 [ %19, %18 ], [ %.057, %.preheader52 ]
  %.not49 = icmp sgt i32 %.1, %17
  %19 = shl i32 %.1, 1
  br i1 %.not49, label %22, label %18, !llvm.loop !9

20:                                               ; preds = %.lr.ph
  %21 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  br label %80

22:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  %23 = add nuw nsw i32 %.04456, 1
  %24 = load i32, ptr %1, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.04456, %24
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge61.loopexit.unr-lcssa:                 ; preds = %.lr.ph60, %.lr.ph60.preheader
  %.unr = phi i64 [ 1, %.lr.ph60.preheader ], [ %44, %.lr.ph60 ]
  %indvars.iv.unr = phi i64 [ 2, %.lr.ph60.preheader ], [ %indvars.iv.next.1, %.lr.ph60 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge61, label %.lr.ph60.epil

.lr.ph60.epil:                                    ; preds = %._crit_edge61.loopexit.unr-lcssa
  %25 = getelementptr inbounds [131073 x i32], ptr @inv, i64 0, i64 %indvars.iv.unr
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = mul nsw i64 %.unr, %27
  %29 = srem i64 %28, 998244353
  %30 = trunc nsw i64 %29 to i32
  %31 = getelementptr inbounds [131073 x i32], ptr @_ZZ4mainE1f, i64 0, i64 %indvars.iv.unr
  store i32 %30, ptr %31, align 4, !tbaa !5
  br label %._crit_edge61

._crit_edge61:                                    ; preds = %.lr.ph60.epil, %._crit_edge61.loopexit.unr-lcssa, %._crit_edge
  invoke void @_Z7polyExpiPiS_(i32 noundef %.0.lcssa, ptr noundef nonnull @_ZZ4mainE1f, ptr noundef nonnull @_ZZ4mainE1f)
          to label %.preheader51 unwind label %14

.preheader51:                                     ; preds = %._crit_edge61
  br i1 %10, label %.lr.ph64.preheader, label %.preheader50

.lr.ph64.preheader:                               ; preds = %.preheader51
  %wide.trip.count76 = zext nneg i32 %.0.lcssa to i64
  br label %.lr.ph64

.lr.ph60:                                         ; preds = %.lr.ph60, %.lr.ph60.preheader.new
  %32 = phi i64 [ 1, %.lr.ph60.preheader.new ], [ %44, %.lr.ph60 ]
  %indvars.iv = phi i64 [ 2, %.lr.ph60.preheader.new ], [ %indvars.iv.next.1, %.lr.ph60 ]
  %niter = phi i64 [ 0, %.lr.ph60.preheader.new ], [ %niter.next.1, %.lr.ph60 ]
  %33 = getelementptr inbounds [131073 x i32], ptr @inv, i64 0, i64 %indvars.iv
  %34 = load i32, ptr %33, align 8, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = mul nsw i64 %32, %35
  %37 = srem i64 %36, 998244353
  %38 = trunc nsw i64 %37 to i32
  %39 = getelementptr inbounds [131073 x i32], ptr @_ZZ4mainE1f, i64 0, i64 %indvars.iv
  store i32 %38, ptr %39, align 8, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %40 = getelementptr inbounds [131073 x i32], ptr @inv, i64 0, i64 %indvars.iv.next
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = mul nsw i64 %37, %42
  %44 = srem i64 %43, 998244353
  %45 = trunc nsw i64 %44 to i32
  %46 = getelementptr inbounds [131073 x i32], ptr @_ZZ4mainE1f, i64 0, i64 %indvars.iv.next
  store i32 %45, ptr %46, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter, %13
  br i1 %niter.ncmp.1, label %._crit_edge61.loopexit.unr-lcssa, label %.lr.ph60, !llvm.loop !12

.preheader50:                                     ; preds = %.lr.ph64, %.preheader51
  %.not4765 = icmp slt i32 %.0.lcssa, 1
  br i1 %.not4765, label %._crit_edge68, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.preheader50
  %47 = add nuw i32 %.0.lcssa, 1
  %wide.trip.count84 = zext i32 %47 to i64
  br label %.preheader

.lr.ph64:                                         ; preds = %.lr.ph64.preheader, %.lr.ph64
  %indvars.iv73 = phi i64 [ 2, %.lr.ph64.preheader ], [ %indvars.iv.next74, %.lr.ph64 ]
  %.04163 = phi i64 [ 1, %.lr.ph64.preheader ], [ %49, %.lr.ph64 ]
  %48 = mul nsw i64 %.04163, %indvars.iv73
  %49 = srem i64 %48, 998244353
  %50 = getelementptr inbounds [131073 x i32], ptr @_ZZ4mainE1f, i64 0, i64 %indvars.iv73
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = mul nsw i64 %49, %52
  %54 = srem i64 %53, 998244353
  %55 = trunc nsw i64 %54 to i32
  store i32 %55, ptr %50, align 4, !tbaa !5
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %exitcond77.not = icmp eq i64 %indvars.iv.next74, %wide.trip.count76
  br i1 %exitcond77.not, label %.preheader50, label %.lr.ph64, !llvm.loop !13

.preheader:                                       ; preds = %.preheader.preheader, %62
  %indvars.iv81 = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next82, %62 ]
  %.03867 = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv78, %62 ]
  %sext = shl i64 %.03867, 32
  %56 = ashr exact i64 %sext, 32
  br label %57

._crit_edge68:                                    ; preds = %62, %.preheader50
  invoke void @_Z5solveiiPiS_S_(i32 noundef 0, i32 noundef %.0.lcssa, ptr noundef nonnull @_ZZ4mainE1f, ptr noundef nonnull @_ZZ4mainE1g, ptr noundef nonnull @_ZZ4mainE1h)
          to label %68 unwind label %14

57:                                               ; preds = %57, %.preheader
  %indvars.iv78 = phi i64 [ %indvars.iv.next79, %57 ], [ %56, %.preheader ]
  %58 = mul nsw i64 %indvars.iv78, %indvars.iv78
  %59 = add nsw i64 %indvars.iv78, %indvars.iv81
  %60 = mul nsw i64 %59, %indvars.iv81
  %61 = icmp slt i64 %58, %60
  %indvars.iv.next79 = add nsw i64 %indvars.iv78, 1
  br i1 %61, label %57, label %62, !llvm.loop !14

62:                                               ; preds = %57
  %63 = trunc nsw i64 %indvars.iv78 to i32
  %64 = trunc nuw nsw i64 %indvars.iv81 to i32
  %65 = sub nsw i32 %63, %64
  %66 = add nsw i64 %indvars.iv81, -1
  %67 = getelementptr inbounds [131073 x i32], ptr @_ZZ4mainE1g, i64 0, i64 %66
  store i32 %65, ptr %67, align 4, !tbaa !5
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %exitcond85.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count84
  br i1 %exitcond85.not, label %._crit_edge68, label %.preheader, !llvm.loop !15

68:                                               ; preds = %._crit_edge68
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %69 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  store ptr %69, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %70 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  store ptr %70, ptr %5, align 8
  %71 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  br i1 %71, label %.lr.ph70, label %._crit_edge71

._crit_edge71:                                    ; preds = %.lr.ph70, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0

.lr.ph70:                                         ; preds = %68, %.lr.ph70
  %72 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [131073 x i32], ptr @_ZZ4mainE1h, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %76)
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  %79 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  br i1 %79, label %.lr.ph70, label %._crit_edge71

80:                                               ; preds = %20, %14
  %.pn = phi { ptr, i32 } [ %21, %20 ], [ %15, %14 ]
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn
}

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

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

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

declare i32 @__gxx_personality_v0(...)

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

; 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 @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) 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 = { 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 #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


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