; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/251 Division 2/Problem E/E.ll (Z10precomputev)

; 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 i64, align 8
@ff = external dso_local global [100100 x i64], align 16
@inv_ff = external dso_local global [100100 x i64], align 16
@prime = external dso_local global [100100 x i32], align 16
@sqr = external dso_local global [100100 x i32], align 16
@mu = external dso_local global [100100 x i32], align 16
@divi = external dso_local global [100100 x %"class.std::vector"], align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7inv_modx(i64 noundef) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z10precomputev() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %12 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  store i64 1, ptr @inv_ff, align 16, !tbaa !5
  store i64 1, ptr @ff, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  store i32 1, ptr %1, align 4, !tbaa !9
  br label %14

14:                                               ; preds = %43, %0
  %15 = load i32, ptr %1, align 4, !tbaa !9
  %16 = icmp sle i32 %15, 100099
  br i1 %16, label %18, label %17

17:                                               ; preds = %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  br label %46

18:                                               ; preds = %14
  %19 = load i32, ptr %1, align 4, !tbaa !9
  %20 = sub nsw i32 %19, 1
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [100100 x i64], ptr @ff, i64 0, i64 %21
  %23 = load i64, ptr %22, align 8, !tbaa !5
  %24 = load i32, ptr %1, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = mul nsw i64 %23, %25
  %27 = load i64, ptr @MOD, align 8, !tbaa !5
  %28 = srem i64 %26, %27
  %29 = load i32, ptr %1, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [100100 x i64], ptr @ff, i64 0, i64 %30
  store i64 %28, ptr %31, align 8, !tbaa !5
  %32 = load i32, ptr %1, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [100100 x i64], ptr @ff, i64 0, i64 %33
  %35 = load i64, ptr %34, align 8, !tbaa !5
  %36 = call noundef i64 @_Z7inv_modx(i64 noundef %35)
  %37 = load i32, ptr %1, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [100100 x i64], ptr @inv_ff, i64 0, i64 %38
  store i64 %36, ptr %39, align 8, !tbaa !5
  %40 = load i32, ptr %1, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [100100 x i32], ptr @prime, i64 0, i64 %41
  store i32 1, ptr %42, align 4, !tbaa !9
  br label %43

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

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

47:                                               ; preds = %66, %46
  %48 = load i32, ptr %2, align 4, !tbaa !9
  %49 = icmp sle i32 %48, 100099
  br i1 %49, label %51, label %50

50:                                               ; preds = %47
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %69

51:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %52 = load i32, ptr %2, align 4, !tbaa !9
  store i32 %52, ptr %4, align 4, !tbaa !9
  br label %53

53:                                               ; preds = %61, %51
  %54 = load i32, ptr %4, align 4, !tbaa !9
  %55 = icmp sle i32 %54, 100099
  br i1 %55, label %57, label %56

56:                                               ; preds = %53
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %65

57:                                               ; preds = %53
  %58 = load i32, ptr %4, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @divi, i64 0, i64 %59
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %60, ptr noundef nonnull align 4 dereferenceable(4) %2)
  br label %61

61:                                               ; preds = %57
  %62 = load i32, ptr %2, align 4, !tbaa !9
  %63 = load i32, ptr %4, align 4, !tbaa !9
  %64 = add nsw i32 %63, %62
  store i32 %64, ptr %4, align 4, !tbaa !9
  br label %53, !llvm.loop !13

65:                                               ; preds = %56
  br label %66

66:                                               ; preds = %65
  %67 = load i32, ptr %2, align 4, !tbaa !9
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %2, align 4, !tbaa !9
  br label %47, !llvm.loop !14

69:                                               ; preds = %50
  store i32 0, ptr @prime, align 16, !tbaa !9
  store i32 0, ptr getelementptr inbounds ([100100 x i32], ptr @prime, i64 0, i64 1), align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 2, ptr %5, align 4, !tbaa !9
  br label %70

70:                                               ; preds = %98, %69
  %71 = load i32, ptr %5, align 4, !tbaa !9
  %72 = icmp sle i32 %71, 100099
  br i1 %72, label %74, label %73

73:                                               ; preds = %70
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %101

74:                                               ; preds = %70
  %75 = load i32, ptr %5, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [100100 x i32], ptr @prime, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !9
  %79 = icmp eq i32 %78, 1
  br i1 %79, label %80, label %97

80:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %81 = load i32, ptr %5, align 4, !tbaa !9
  %82 = load i32, ptr %5, align 4, !tbaa !9
  %83 = add nsw i32 %81, %82
  store i32 %83, ptr %6, align 4, !tbaa !9
  br label %84

84:                                               ; preds = %92, %80
  %85 = load i32, ptr %6, align 4, !tbaa !9
  %86 = icmp sle i32 %85, 100099
  br i1 %86, label %88, label %87

87:                                               ; preds = %84
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %96

88:                                               ; preds = %84
  %89 = load i32, ptr %6, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [100100 x i32], ptr @prime, i64 0, i64 %90
  store i32 0, ptr %91, align 4, !tbaa !9
  br label %92

92:                                               ; preds = %88
  %93 = load i32, ptr %5, align 4, !tbaa !9
  %94 = load i32, ptr %6, align 4, !tbaa !9
  %95 = add nsw i32 %94, %93
  store i32 %95, ptr %6, align 4, !tbaa !9
  br label %84, !llvm.loop !15

96:                                               ; preds = %87
  br label %97

97:                                               ; preds = %96, %74
  br label %98

98:                                               ; preds = %97
  %99 = load i32, ptr %5, align 4, !tbaa !9
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %5, align 4, !tbaa !9
  br label %70, !llvm.loop !16

101:                                              ; preds = %73
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 2, ptr %7, align 4, !tbaa !9
  br label %102

102:                                              ; preds = %127, %101
  %103 = load i32, ptr %7, align 4, !tbaa !9
  %104 = load i32, ptr %7, align 4, !tbaa !9
  %105 = mul nsw i32 %103, %104
  %106 = icmp sle i32 %105, 100099
  br i1 %106, label %108, label %107

107:                                              ; preds = %102
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %130

108:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %109 = load i32, ptr %7, align 4, !tbaa !9
  %110 = load i32, ptr %7, align 4, !tbaa !9
  %111 = mul nsw i32 %109, %110
  store i32 %111, ptr %8, align 4, !tbaa !9
  br label %112

112:                                              ; preds = %120, %108
  %113 = load i32, ptr %8, align 4, !tbaa !9
  %114 = icmp sle i32 %113, 100099
  br i1 %114, label %116, label %115

115:                                              ; preds = %112
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %126

116:                                              ; preds = %112
  %117 = load i32, ptr %8, align 4, !tbaa !9
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [100100 x i32], ptr @sqr, i64 0, i64 %118
  store i32 1, ptr %119, align 4, !tbaa !9
  br label %120

120:                                              ; preds = %116
  %121 = load i32, ptr %7, align 4, !tbaa !9
  %122 = load i32, ptr %7, align 4, !tbaa !9
  %123 = mul nsw i32 %121, %122
  %124 = load i32, ptr %8, align 4, !tbaa !9
  %125 = add nsw i32 %124, %123
  store i32 %125, ptr %8, align 4, !tbaa !9
  br label %112, !llvm.loop !17

126:                                              ; preds = %115
  br label %127

127:                                              ; preds = %126
  %128 = load i32, ptr %7, align 4, !tbaa !9
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %7, align 4, !tbaa !9
  br label %102, !llvm.loop !18

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

131:                                              ; preds = %179, %130
  %132 = load i32, ptr %9, align 4, !tbaa !9
  %133 = icmp sle i32 %132, 100099
  br i1 %133, label %135, label %134

134:                                              ; preds = %131
  store i32 23, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %182

135:                                              ; preds = %131
  %136 = load i32, ptr %9, align 4, !tbaa !9
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [100100 x i32], ptr @sqr, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !9
  %140 = icmp ne i32 %139, 0
  br i1 %140, label %141, label %142

141:                                              ; preds = %135
  br label %179

142:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %143 = load i32, ptr %9, align 4, !tbaa !9
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @divi, i64 0, i64 %144
  %146 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %145) #4
  %147 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %11, i32 0, i32 0
  store ptr %146, ptr %147, align 8
  br label %148

148:                                              ; preds = %167, %142
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %149 = load i32, ptr %9, align 4, !tbaa !9
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @divi, i64 0, i64 %150
  %152 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %151) #4
  %153 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %12, i32 0, i32 0
  store ptr %152, ptr %153, align 8
  %154 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br i1 %154, label %156, label %155

155:                                              ; preds = %148
  store i32 26, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %170

156:                                              ; preds = %148
  %157 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #4
  %158 = load i32, ptr %157, align 4, !tbaa !9
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [100100 x i32], ptr @prime, i64 0, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !9
  %162 = icmp ne i32 %161, 0
  br i1 %162, label %163, label %166

163:                                              ; preds = %156
  %164 = load i32, ptr %10, align 4, !tbaa !9
  %165 = add nsw i32 %164, 1
  store i32 %165, ptr %10, align 4, !tbaa !9
  br label %166

166:                                              ; preds = %163, %156
  br label %167

167:                                              ; preds = %166
  %168 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %11, i32 noundef 0) #4
  %169 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %168, ptr %169, align 8
  br label %148, !llvm.loop !19

170:                                              ; preds = %155
  %171 = load i32, ptr %10, align 4, !tbaa !9
  %172 = srem i32 %171, 2
  %173 = icmp eq i32 %172, 1
  %174 = zext i1 %173 to i64
  %175 = select i1 %173, i32 -1, i32 1
  %176 = load i32, ptr %9, align 4, !tbaa !9
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [100100 x i32], ptr @mu, i64 0, i64 %177
  store i32 %175, ptr %178, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %179

179:                                              ; preds = %170, %141
  %180 = load i32, ptr %9, align 4, !tbaa !9
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr %9, align 4, !tbaa !9
  br label %131, !llvm.loop !20

182:                                              ; preds = %134
  ret void
}

; 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: 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)) #3

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

; 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

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

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

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


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

%"class.std::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 i64, align 8
@ff = external dso_local local_unnamed_addr global [100100 x i64], align 16
@inv_ff = external dso_local local_unnamed_addr global [100100 x i64], align 16
@prime = external dso_local local_unnamed_addr global [100100 x i32], align 16
@sqr = external dso_local local_unnamed_addr global [100100 x i32], align 16
@mu = external dso_local local_unnamed_addr global [100100 x i32], align 16
@divi = external dso_local global [100100 x %"class.std::vector"], align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7inv_modx(i64 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z10precomputev() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  store i64 1, ptr @inv_ff, align 16, !tbaa !5
  store i64 1, ptr @ff, align 16, !tbaa !5
  br label %5

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

5:                                                ; preds = %0, %5
  %indvars.iv = phi i64 [ 1, %0 ], [ %indvars.iv.next, %5 ]
  %6 = add nsw i64 %indvars.iv, -1
  %7 = getelementptr inbounds [100100 x i64], ptr @ff, i64 0, i64 %6
  %8 = load i64, ptr %7, align 8, !tbaa !5
  %9 = mul nsw i64 %8, %indvars.iv
  %10 = load i64, ptr @MOD, align 8, !tbaa !5
  %11 = srem i64 %9, %10
  %12 = getelementptr inbounds [100100 x i64], ptr @ff, i64 0, i64 %indvars.iv
  store i64 %11, ptr %12, align 8, !tbaa !5
  %13 = tail call noundef i64 @_Z7inv_modx(i64 noundef %11)
  %14 = getelementptr inbounds [100100 x i64], ptr @inv_ff, i64 0, i64 %indvars.iv
  store i64 %13, ptr %14, align 8, !tbaa !5
  %15 = getelementptr inbounds [100100 x i32], ptr @prime, i64 0, i64 %indvars.iv
  store i32 1, ptr %15, align 4, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 100100
  br i1 %exitcond.not, label %4, label %5, !llvm.loop !11

16:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  store i32 0, ptr @prime, align 16, !tbaa !9
  store i32 0, ptr getelementptr inbounds (i8, ptr @prime, i64 4), align 4, !tbaa !9
  br label %25

17:                                               ; preds = %.preheader50
  %18 = add nsw i32 %22, 1
  store i32 %18, ptr %1, align 4, !tbaa !9
  %19 = icmp slt i32 %22, 100099
  br i1 %19, label %.preheader50.backedge, label %16

.preheader50:                                     ; preds = %.preheader50.backedge, %4
  %.04452 = phi i32 [ 1, %4 ], [ %.04452.be, %.preheader50.backedge ]
  %20 = sext i32 %.04452 to i64
  %21 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @divi, i64 0, i64 %20
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %21, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %22 = load i32, ptr %1, align 4, !tbaa !9
  %23 = add nsw i32 %22, %.04452
  %24 = icmp slt i32 %23, 100100
  br i1 %24, label %.preheader50.backedge, label %17

.preheader50.backedge:                            ; preds = %.preheader50, %17
  %.04452.be = phi i32 [ %23, %.preheader50 ], [ %18, %17 ]
  br label %.preheader50, !llvm.loop !13

25:                                               ; preds = %16, %.loopexit
  %indvars.iv66 = phi i64 [ 2, %16 ], [ %indvars.iv.next67, %.loopexit ]
  %indvars.iv64 = phi i64 [ 4, %16 ], [ %indvars.iv.next65, %.loopexit ]
  %26 = getelementptr inbounds [100100 x i32], ptr @prime, i64 0, i64 %indvars.iv66
  %27 = load i32, ptr %26, align 4, !tbaa !9
  %28 = icmp eq i32 %27, 1
  %29 = icmp ult i64 %indvars.iv66, 50050
  %or.cond = and i1 %28, %29
  br i1 %or.cond, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %25, %.lr.ph
  %indvars.iv68 = phi i64 [ %indvars.iv.next69, %.lr.ph ], [ %indvars.iv64, %25 ]
  %30 = getelementptr inbounds [100100 x i32], ptr @prime, i64 0, i64 %indvars.iv68
  store i32 0, ptr %30, align 4, !tbaa !9
  %indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, %indvars.iv66
  %31 = icmp ult i64 %indvars.iv.next69, 100100
  br i1 %31, label %.lr.ph, label %.loopexit, !llvm.loop !14

.loopexit:                                        ; preds = %.lr.ph, %25
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 2
  %exitcond72.not = icmp eq i64 %indvars.iv.next67, 100100
  br i1 %exitcond72.not, label %.preheader48, label %25, !llvm.loop !15

.preheader48:                                     ; preds = %.loopexit, %.loopexit82
  %32 = phi i32 [ %46, %.loopexit82 ], [ 4, %.loopexit ]
  %.04158 = phi i32 [ %45, %.loopexit82 ], [ 2, %.loopexit ]
  %33 = zext nneg i32 %32 to i64
  %34 = shl nuw nsw i64 %33, 1
  %umax = call i64 @llvm.umax.i64(i64 %34, i64 100100)
  %35 = icmp ult i32 %32, 50050
  %umin.neg = sext i1 %35 to i64
  %36 = select i1 %35, i64 2, i64 1
  %37 = add nsw i64 %umax, %umin.neg
  %38 = sub nsw i64 %37, %34
  %umax81 = call i64 @llvm.umax.i64(i64 %33, i64 1)
  %39 = udiv i64 %38, %umax81
  %40 = add i64 %36, %39
  %min.iters.check = icmp ugt i64 %40, 7
  %ident.check.not = icmp eq i32 %32, 1
  %or.cond83 = and i1 %min.iters.check, %ident.check.not
  br i1 %or.cond83, label %vector.ph, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader48
  %indvars.iv73.ph = phi i64 [ %33, %.preheader48 ], [ %ind.end, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.preheader48
  %n.vec = and i64 %40, -8
  %41 = or disjoint i64 %n.vec, 1
  %ind.end = mul nuw i64 %41, %33
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %42 = getelementptr inbounds [100100 x i32], ptr @sqr, i64 0, i64 %offset.idx
  %43 = getelementptr inbounds i8, ptr %42, i64 16
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %42, align 4, !tbaa !9
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %43, align 4, !tbaa !9
  %index.next = add nuw i64 %index, 8
  %44 = icmp eq i64 %index.next, %n.vec
  br i1 %44, label %middle.block, label %vector.body, !llvm.loop !16

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %40, %n.vec
  br i1 %cmp.n, label %.loopexit82, label %scalar.ph.preheader

.loopexit82:                                      ; preds = %scalar.ph, %middle.block
  %45 = add nuw nsw i32 %.04158, 1
  %46 = mul nuw nsw i32 %45, %45
  %exitcond76.not = icmp eq i32 %45, 317
  br i1 %exitcond76.not, label %.preheader, label %.preheader48, !llvm.loop !19

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv73 = phi i64 [ %indvars.iv.next74, %scalar.ph ], [ %indvars.iv73.ph, %scalar.ph.preheader ]
  %47 = getelementptr inbounds [100100 x i32], ptr @sqr, i64 0, i64 %indvars.iv73
  store i32 1, ptr %47, align 4, !tbaa !9
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, %33
  %48 = icmp ult i64 %indvars.iv.next74, 100100
  br i1 %48, label %scalar.ph, label %.loopexit82, !llvm.loop !20

49:                                               ; preds = %70
  ret void

.preheader:                                       ; preds = %.loopexit82, %70
  %indvars.iv77 = phi i64 [ %indvars.iv.next78, %70 ], [ 1, %.loopexit82 ]
  %50 = getelementptr inbounds [100100 x i32], ptr @sqr, i64 0, i64 %indvars.iv77
  %51 = load i32, ptr %50, align 4, !tbaa !9
  %.not = icmp eq i32 %51, 0
  br i1 %.not, label %52, label %70

52:                                               ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %53 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @divi, i64 0, i64 %indvars.iv77
  %54 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %53) #5
  store ptr %54, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %55 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %53) #5
  store ptr %55, ptr %3, align 8
  %56 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br i1 %56, label %.lr.ph60, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph60, %52
  %.038.lcssa = phi i32 [ 0, %52 ], [ %spec.select, %.lr.ph60 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  %57 = and i32 %.038.lcssa, -2147483647
  %58 = icmp eq i32 %57, 1
  %59 = select i1 %58, i32 -1, i32 1
  %60 = getelementptr inbounds [100100 x i32], ptr @mu, i64 0, i64 %indvars.iv77
  store i32 %59, ptr %60, align 4, !tbaa !9
  br label %70

.lr.ph60:                                         ; preds = %52, %.lr.ph60
  %.03859 = phi i32 [ %spec.select, %.lr.ph60 ], [ 0, %52 ]
  %61 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #5
  %62 = load i32, ptr %61, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [100100 x i32], ptr @prime, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !9
  %.not47 = icmp ne i32 %65, 0
  %66 = zext i1 %.not47 to i32
  %spec.select = add nuw nsw i32 %.03859, %66
  %67 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef 0) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %68 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %53) #5
  store ptr %68, ptr %3, align 8
  %69 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br i1 %69, label %.lr.ph60, label %._crit_edge, !llvm.loop !21

70:                                               ; preds = %.preheader, %._crit_edge
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %exitcond80.not = icmp eq i64 %indvars.iv.next78, 100100
  br i1 %exitcond80.not, label %49, label %.preheader, !llvm.loop !22
}

; 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: 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 #3

; 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: 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: mustprogress nounwind uwtable
declare dso_local ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #4

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12, !17, !18}
!17 = !{!"llvm.loop.isvectorized", i32 1}
!18 = !{!"llvm.loop.unroll.runtime.disable"}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12, !17}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}


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