; LLVM IR from tangjz/acm-icpc :: uoj/200.ll (Z8NTT_initi)

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

@mod = external dso_local global i32, align 4
@w = external dso_local global [131075 x i32], align 16
@.str = external hidden unnamed_addr constant [70 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [61 x i8], align 1
@__PRETTY_FUNCTION__._Z8NTT_initi = external hidden unnamed_addr constant [25 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9factorizei(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8, i32 noundef) #0

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z8NTT_initi(i32 noundef %0) #0 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::vector", align 8
  %4 = alloca %"class.std::vector", align 8
  %5 = alloca i32, align 4
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %3) #5
  %19 = load i32, ptr @mod, align 4, !tbaa !5
  call void @_Z9factorizei(ptr dead_on_unwind writable sret(%"class.std::vector") align 8 %3, i32 noundef %19)
  %20 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #5
  %21 = trunc i64 %20 to i32
  %22 = icmp eq i32 %21, 1
  br i1 %22, label %23, label %32

23:                                               ; preds = %1
  %24 = load i32, ptr @mod, align 4, !tbaa !5
  %25 = sub nsw i32 %24, 1
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = shl i32 1, %26
  %28 = sub nsw i32 %27, 1
  %29 = and i32 %25, %28
  %30 = icmp ne i32 %29, 0
  %31 = xor i1 %30, true
  br label %32

32:                                               ; preds = %23, %1
  %33 = phi i1 [ false, %1 ], [ %31, %23 ]
  br i1 %33, label %34, label %35

34:                                               ; preds = %32
  br label %37

35:                                               ; preds = %32
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 54, ptr noundef @__PRETTY_FUNCTION__._Z8NTT_initi) #6
  unreachable

36:                                               ; No predecessors!
  br label %37

37:                                               ; preds = %36, %34
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #5
  %38 = load i32, ptr @mod, align 4, !tbaa !5
  %39 = sub nsw i32 %38, 1
  call void @_Z9factorizei(ptr dead_on_unwind writable sret(%"class.std::vector") align 8 %4, i32 noundef %39)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 2, ptr %5, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %82, %37
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #5
  store i8 1, ptr %6, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store ptr %4, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %41 = load ptr, ptr %7, align 8, !tbaa !11
  %42 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %41) #5
  %43 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %42, ptr %43, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %44 = load ptr, ptr %7, align 8, !tbaa !11
  %45 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %44) #5
  %46 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %45, ptr %46, align 8
  br label %47

47:                                               ; preds = %68, %40
  %48 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  br i1 %48, label %50, label %49

49:                                               ; preds = %47
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %74

50:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %51 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #5
  %52 = load i32, ptr %51, align 4, !tbaa !5
  store i32 %52, ptr %10, align 4, !tbaa !5
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = load i32, ptr @mod, align 4, !tbaa !5
  %55 = sub nsw i32 %54, 1
  %56 = load i32, ptr %10, align 4, !tbaa !5
  %57 = sdiv i32 %55, %56
  %58 = invoke noundef i32 @_Z7mod_powii(i32 noundef %53, i32 noundef %57)
          to label %59 unwind label %70

59:                                               ; preds = %50
  %60 = icmp ne i32 %58, 1
  %61 = zext i1 %60 to i32
  %62 = load i8, ptr %6, align 1, !tbaa !9, !range !13, !noundef !14
  %63 = trunc i8 %62 to i1
  %64 = zext i1 %63 to i32
  %65 = and i32 %64, %61
  %66 = icmp ne i32 %65, 0
  %67 = zext i1 %66 to i8
  store i8 %67, ptr %6, align 1, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %68

68:                                               ; preds = %59
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #5
  br label %47

70:                                               ; preds = %50
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %11, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #5
  br label %181

74:                                               ; preds = %49
  %75 = load i8, ptr %6, align 1, !tbaa !9, !range !13, !noundef !14
  %76 = trunc i8 %75 to i1
  br i1 %76, label %77, label %78

77:                                               ; preds = %74
  store i32 2, ptr %13, align 4
  br label %79

78:                                               ; preds = %74
  store i32 0, ptr %13, align 4
  br label %79

79:                                               ; preds = %78, %77
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #5
  %80 = load i32, ptr %13, align 4
  switch i32 %80, label %187 [
    i32 0, label %81
    i32 2, label %85
  ]

81:                                               ; preds = %79
  br label %82

82:                                               ; preds = %81
  %83 = load i32, ptr %5, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %5, align 4, !tbaa !5
  br label %40, !llvm.loop !15

85:                                               ; preds = %79
  %86 = load i32, ptr %5, align 4, !tbaa !5
  %87 = icmp eq i32 %86, 3
  br i1 %87, label %88, label %89

88:                                               ; preds = %85
  br label %91

89:                                               ; preds = %85
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 64, ptr noundef @__PRETTY_FUNCTION__._Z8NTT_initi) #6
  unreachable

90:                                               ; No predecessors!
  br label %91

91:                                               ; preds = %90, %88
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %92 = load i32, ptr %2, align 4, !tbaa !5
  %93 = shl i32 1, %92
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds i32, ptr @w, i64 %94
  store ptr %95, ptr %14, align 8, !tbaa !11
  %96 = load ptr, ptr %14, align 8, !tbaa !11
  %97 = getelementptr inbounds i32, ptr %96, i64 0
  store i32 1, ptr %97, align 4, !tbaa !5
  %98 = load i32, ptr %5, align 4, !tbaa !5
  %99 = load i32, ptr @mod, align 4, !tbaa !5
  %100 = sub nsw i32 %99, 1
  %101 = load i32, ptr %2, align 4, !tbaa !5
  %102 = ashr i32 %100, %101
  %103 = invoke noundef i32 @_Z7mod_powii(i32 noundef %98, i32 noundef %102)
          to label %104 unwind label %113

104:                                              ; preds = %91
  %105 = load ptr, ptr %14, align 8, !tbaa !11
  %106 = getelementptr inbounds i32, ptr %105, i64 1
  store i32 %103, ptr %106, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 2, ptr %15, align 4, !tbaa !5
  br label %107

107:                                              ; preds = %138, %104
  %108 = load i32, ptr %15, align 4, !tbaa !5
  %109 = load i32, ptr %2, align 4, !tbaa !5
  %110 = shl i32 1, %109
  %111 = icmp slt i32 %108, %110
  br i1 %111, label %117, label %112

112:                                              ; preds = %107
  store i32 7, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %141

113:                                              ; preds = %91
  %114 = landingpad { ptr, i32 }
          cleanup
  %115 = extractvalue { ptr, i32 } %114, 0
  store ptr %115, ptr %11, align 8
  %116 = extractvalue { ptr, i32 } %114, 1
  store i32 %116, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %181

117:                                              ; preds = %107
  %118 = load ptr, ptr %14, align 8, !tbaa !11
  %119 = load i32, ptr %15, align 4, !tbaa !5
  %120 = sub nsw i32 %119, 1
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds i32, ptr %118, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = load ptr, ptr %14, align 8, !tbaa !11
  %126 = getelementptr inbounds i32, ptr %125, i64 1
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = mul nsw i64 %124, %128
  %130 = load i32, ptr @mod, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = srem i64 %129, %131
  %133 = trunc i64 %132 to i32
  %134 = load ptr, ptr %14, align 8, !tbaa !11
  %135 = load i32, ptr %15, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds i32, ptr %134, i64 %136
  store i32 %133, ptr %137, align 4, !tbaa !5
  br label %138

138:                                              ; preds = %117
  %139 = load i32, ptr %15, align 4, !tbaa !5
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %15, align 4, !tbaa !5
  br label %107, !llvm.loop !17

141:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %142 = load i32, ptr %2, align 4, !tbaa !5
  %143 = sub nsw i32 %142, 1
  %144 = shl i32 1, %143
  store i32 %144, ptr %16, align 4, !tbaa !5
  br label %145

145:                                              ; preds = %177, %141
  %146 = load i32, ptr %16, align 4, !tbaa !5
  %147 = icmp sgt i32 %146, 0
  br i1 %147, label %149, label %148

148:                                              ; preds = %145
  store i32 10, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %180

149:                                              ; preds = %145
  %150 = load i32, ptr %16, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds i32, ptr @w, i64 %151
  store ptr %152, ptr %14, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %153 = load ptr, ptr %14, align 8, !tbaa !11
  %154 = load i32, ptr %16, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds i32, ptr %153, i64 %155
  store ptr %156, ptr %17, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %157

157:                                              ; preds = %173, %149
  %158 = load i32, ptr %18, align 4, !tbaa !5
  %159 = load i32, ptr %16, align 4, !tbaa !5
  %160 = icmp slt i32 %158, %159
  br i1 %160, label %162, label %161

161:                                              ; preds = %157
  store i32 13, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %176

162:                                              ; preds = %157
  %163 = load ptr, ptr %17, align 8, !tbaa !11
  %164 = load i32, ptr %18, align 4, !tbaa !5
  %165 = shl i32 %164, 1
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds i32, ptr %163, i64 %166
  %168 = load i32, ptr %167, align 4, !tbaa !5
  %169 = load ptr, ptr %14, align 8, !tbaa !11
  %170 = load i32, ptr %18, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds i32, ptr %169, i64 %171
  store i32 %168, ptr %172, align 4, !tbaa !5
  br label %173

173:                                              ; preds = %162
  %174 = load i32, ptr %18, align 4, !tbaa !5
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %18, align 4, !tbaa !5
  br label %157, !llvm.loop !18

176:                                              ; preds = %161
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %177

177:                                              ; preds = %176
  %178 = load i32, ptr %16, align 4, !tbaa !5
  %179 = ashr i32 %178, 1
  store i32 %179, ptr %16, align 4, !tbaa !5
  br label %145, !llvm.loop !19

180:                                              ; preds = %148
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #5
  ret void

181:                                              ; preds = %113, %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #5
  br label %182

182:                                              ; preds = %181
  %183 = load ptr, ptr %11, align 8
  %184 = load i32, ptr %12, align 4
  %185 = insertvalue { ptr, i32 } poison, ptr %183, 0
  %186 = insertvalue { ptr, i32 } %185, i32 %184, 1
  resume { ptr, i32 } %186

187:                                              ; preds = %79
  unreachable
}

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 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)) #4

; 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)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_powii(i32 noundef, i32 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)) #2 align 2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { noreturn 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 #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { noreturn 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 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}


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

@mod = external dso_local local_unnamed_addr global i32, align 4
@w = external dso_local local_unnamed_addr global [131075 x i32], align 16
@.str = external hidden unnamed_addr constant [70 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [61 x i8], align 1
@__PRETTY_FUNCTION__._Z8NTT_initi = external hidden unnamed_addr constant [25 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9factorizei(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8, 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

declare i32 @__gxx_personality_v0(...)

; 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 nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z8NTT_initi(i32 noundef %0) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::vector", align 8
  %3 = alloca %"class.std::vector", align 8
  %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 24, ptr nonnull %2) #6
  %6 = load i32, ptr @mod, align 4, !tbaa !5
  call void @_Z9factorizei(ptr dead_on_unwind nonnull writable sret(%"class.std::vector") align 8 %2, i32 noundef %6)
  %7 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  %8 = and i64 %7, 4294967295
  %9 = icmp eq i64 %8, 1
  br i1 %9, label %10, label %.critedge

10:                                               ; preds = %1
  %11 = load i32, ptr @mod, align 4, !tbaa !5
  %12 = add nsw i32 %11, -1
  %13 = shl nuw i32 1, %0
  %14 = add nsw i32 %13, -1
  %15 = and i32 %12, %14
  %.not = icmp eq i32 %15, 0
  br i1 %.not, label %16, label %.critedge

.critedge:                                        ; preds = %1, %10
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 54, ptr noundef nonnull @__PRETTY_FUNCTION__._Z8NTT_initi) #7
  unreachable

16:                                               ; preds = %10
  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.start.p0(i64 24, ptr nonnull %3) #6
  %17 = load i32, ptr @mod, align 4, !tbaa !5
  %18 = add nsw i32 %17, -1
  call void @_Z9factorizei(ptr dead_on_unwind nonnull writable sret(%"class.std::vector") align 8 %3, i32 noundef %18)
  br label %19

19:                                               ; preds = %._crit_edge, %16
  %.035 = phi i32 [ 2, %16 ], [ %23, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %20 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  store ptr %20, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %21 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  store ptr %21, ptr %5, align 8
  %22 = 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 %22, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br label %.loopexit

._crit_edge:                                      ; preds = %.lr.ph
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %23 = add nuw nsw i32 %.035, 1
  br i1 %31, label %.loopexit, label %19, !llvm.loop !9

.lr.ph:                                           ; preds = %19, %.lr.ph
  %.03940 = phi i1 [ %31, %.lr.ph ], [ true, %19 ]
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = load i32, ptr @mod, align 4, !tbaa !5
  %27 = add nsw i32 %26, -1
  %28 = sdiv i32 %27, %25
  %29 = call noundef i32 @_Z7mod_powii(i32 noundef %.035, i32 noundef %28)
  %30 = icmp ne i32 %29, 1
  %31 = and i1 %.03940, %30
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  %33 = 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 %33, label %.lr.ph, label %._crit_edge

.loopexit:                                        ; preds = %._crit_edge, %._crit_edge.thread
  %34 = icmp eq i32 %.035, 3
  br i1 %34, label %36, label %35

35:                                               ; preds = %.loopexit
  call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 64, ptr noundef nonnull @__PRETTY_FUNCTION__._Z8NTT_initi) #7
  unreachable

36:                                               ; preds = %.loopexit
  %37 = sext i32 %13 to i64
  %38 = getelementptr inbounds i32, ptr @w, i64 %37
  store i32 1, ptr %38, align 4, !tbaa !5
  %39 = load i32, ptr @mod, align 4, !tbaa !5
  %40 = add nsw i32 %39, -1
  %41 = ashr i32 %40, %0
  %42 = call noundef i32 @_Z7mod_powii(i32 noundef 3, i32 noundef %41)
  %43 = getelementptr inbounds i8, ptr %38, i64 4
  store i32 %42, ptr %43, align 4, !tbaa !5
  %44 = icmp sgt i32 %13, 2
  br i1 %44, label %.lr.ph43, label %._crit_edge44

.lr.ph43:                                         ; preds = %36
  %45 = load i32, ptr @mod, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %wide.trip.count = zext nneg i32 %13 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %load_initial = load i32, ptr %43, align 4
  %47 = and i64 %wide.trip.count, 2147483646
  %48 = add nsw i64 %47, -4
  br label %58

._crit_edge44.loopexit.unr-lcssa.loopexit:        ; preds = %58
  %sext70 = shl i64 %71, 32
  %49 = ashr exact i64 %sext70, 32
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge44, label %._crit_edge44.loopexit.epilog-lcssa

._crit_edge44.loopexit.epilog-lcssa:              ; preds = %._crit_edge44.loopexit.unr-lcssa.loopexit
  %50 = getelementptr i32, ptr %38, i64 %indvars.iv.next.1
  %51 = load i32, ptr %43, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = mul nsw i64 %49, %52
  %54 = srem i64 %53, %46
  %55 = trunc nsw i64 %54 to i32
  store i32 %55, ptr %50, align 4, !tbaa !5
  br label %._crit_edge44

._crit_edge44:                                    ; preds = %._crit_edge44.loopexit.epilog-lcssa, %._crit_edge44.loopexit.unr-lcssa.loopexit, %36
  %56 = add nsw i32 %0, -1
  %.not50 = icmp eq i32 %56, 31
  br i1 %.not50, label %._crit_edge49, label %.lr.ph48.preheader

.lr.ph48.preheader:                               ; preds = %._crit_edge44
  %57 = shl nuw i32 1, %56
  br label %.lr.ph48

58:                                               ; preds = %58, %.lr.ph43
  %store_forwarded = phi i32 [ %load_initial, %.lr.ph43 ], [ %72, %58 ]
  %indvars.iv = phi i64 [ 2, %.lr.ph43 ], [ %indvars.iv.next.1, %58 ]
  %niter = phi i64 [ 0, %.lr.ph43 ], [ %niter.next.1, %58 ]
  %59 = getelementptr i32, ptr %38, i64 %indvars.iv
  %60 = sext i32 %store_forwarded to i64
  %61 = load i32, ptr %43, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = mul nsw i64 %62, %60
  %64 = srem i64 %63, %46
  %65 = trunc nsw i64 %64 to i32
  store i32 %65, ptr %59, align 4, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %66 = getelementptr i32, ptr %38, i64 %indvars.iv.next
  %sext = shl i64 %64, 32
  %67 = ashr exact i64 %sext, 32
  %68 = load i32, ptr %43, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = mul nsw i64 %67, %69
  %71 = srem i64 %70, %46
  %72 = trunc nsw i64 %71 to i32
  store i32 %72, ptr %66, 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, %48
  br i1 %niter.ncmp.1, label %._crit_edge44.loopexit.unr-lcssa.loopexit, label %58, !llvm.loop !11

._crit_edge49:                                    ; preds = %.epilog-lcssa, %._crit_edge44
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  ret void

.lr.ph48:                                         ; preds = %.lr.ph48.preheader, %.epilog-lcssa
  %.03646 = phi i32 [ %82, %.epilog-lcssa ], [ %57, %.lr.ph48.preheader ]
  %73 = zext nneg i32 %.03646 to i64
  %74 = getelementptr inbounds i32, ptr @w, i64 %73
  %75 = getelementptr inbounds i32, ptr %74, i64 %73
  %smax = call i32 @llvm.smax.i32(i32 %.03646, i32 1)
  %wide.trip.count56 = zext nneg i32 %smax to i64
  %xtraiter66 = and i64 %wide.trip.count56, 3
  %76 = icmp slt i32 %.03646, 4
  br i1 %76, label %.unr-lcssa, label %.lr.ph48.new

.lr.ph48.new:                                     ; preds = %.lr.ph48
  %unroll_iter68 = and i64 %wide.trip.count56, 2147483644
  br label %83

.unr-lcssa:                                       ; preds = %83, %.lr.ph48
  %indvars.iv53.unr = phi i64 [ 0, %.lr.ph48 ], [ %indvars.iv.next54.3, %83 ]
  %lcmp.mod67.not = icmp eq i64 %xtraiter66, 0
  br i1 %lcmp.mod67.not, label %.epilog-lcssa, label %.epil.preheader65

.epil.preheader65:                                ; preds = %.unr-lcssa, %.epil.preheader65
  %indvars.iv53.epil = phi i64 [ %indvars.iv.next54.epil, %.epil.preheader65 ], [ %indvars.iv53.unr, %.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader65 ], [ 0, %.unr-lcssa ]
  %indvars.iv53.tr.epil = trunc i64 %indvars.iv53.epil to i32
  %77 = shl i32 %indvars.iv53.tr.epil, 1
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds i32, ptr %75, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = getelementptr inbounds i32, ptr %74, i64 %indvars.iv53.epil
  store i32 %80, ptr %81, align 4, !tbaa !5
  %indvars.iv.next54.epil = add nuw nsw i64 %indvars.iv53.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter66
  br i1 %epil.iter.cmp.not, label %.epilog-lcssa, label %.epil.preheader65, !llvm.loop !12

.epilog-lcssa:                                    ; preds = %.epil.preheader65, %.unr-lcssa
  %82 = lshr i32 %.03646, 1
  %.not51 = icmp ult i32 %.03646, 2
  br i1 %.not51, label %._crit_edge49, label %.lr.ph48, !llvm.loop !14

83:                                               ; preds = %83, %.lr.ph48.new
  %indvars.iv53 = phi i64 [ 0, %.lr.ph48.new ], [ %indvars.iv.next54.3, %83 ]
  %niter69 = phi i64 [ 0, %.lr.ph48.new ], [ %niter69.next.3, %83 ]
  %indvars.iv53.tr = trunc i64 %indvars.iv53 to i32
  %84 = shl i32 %indvars.iv53.tr, 1
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds i32, ptr %75, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = getelementptr inbounds i32, ptr %74, i64 %indvars.iv53
  store i32 %87, ptr %88, align 4, !tbaa !5
  %indvars.iv.next54 = or disjoint i64 %indvars.iv53, 1
  %indvars.iv53.tr.1 = trunc i64 %indvars.iv.next54 to i32
  %89 = shl i32 %indvars.iv53.tr.1, 1
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds i32, ptr %75, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = getelementptr inbounds i32, ptr %74, i64 %indvars.iv.next54
  store i32 %92, ptr %93, align 4, !tbaa !5
  %indvars.iv.next54.1 = or disjoint i64 %indvars.iv53, 2
  %indvars.iv53.tr.2 = trunc i64 %indvars.iv.next54.1 to i32
  %94 = shl i32 %indvars.iv53.tr.2, 1
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds i32, ptr %75, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = getelementptr inbounds i32, ptr %74, i64 %indvars.iv.next54.1
  store i32 %97, ptr %98, align 4, !tbaa !5
  %indvars.iv.next54.2 = or disjoint i64 %indvars.iv53, 3
  %indvars.iv53.tr.3 = trunc i64 %indvars.iv.next54.2 to i32
  %99 = shl i32 %indvars.iv53.tr.3, 1
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds i32, ptr %75, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = getelementptr inbounds i32, ptr %74, i64 %indvars.iv.next54.2
  store i32 %102, ptr %103, align 4, !tbaa !5
  %indvars.iv.next54.3 = add nuw nsw i64 %indvars.iv53, 4
  %niter69.next.3 = add i64 %niter69, 4
  %niter69.ncmp.3 = icmp eq i64 %niter69.next.3, %unroll_iter68
  br i1 %niter69.ncmp.3, label %.unr-lcssa, label %83, !llvm.loop !15
}

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 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 #4

; 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 #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_powii(i32 noundef, i32 noundef) 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 #2 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { noreturn 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 #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { noreturn 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, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


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