; LLVM IR from sgtlaugh/algovault :: code_library/fast_prime_counting.ll (Z3phixi)

; 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.anon = type { i8 }

@primes = external dso_local global %"class.std::vector", align 8
@prod = external dso_local global [7 x i32], align 16
@pi = external dso_local global [20000010 x i32], align 16
@dp = external dso_local global [50 x [510510 x i32]], align 16
@_ZL8fast_div = external hidden constant %class.anon, align 1

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @"_ZNK3$_0clERKxRKi"(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z3phixi(i64 noundef %0, i32 noundef %1) #3 {
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  store i64 %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %12 = load i32, ptr %5, align 4, !tbaa !9
  %13 = icmp ne i32 %12, 0
  br i1 %13, label %16, label %14

14:                                               ; preds = %2
  %15 = load i64, ptr %4, align 8, !tbaa !5
  store i64 %15, ptr %3, align 8
  br label %159

16:                                               ; preds = %2
  %17 = load i32, ptr %5, align 4, !tbaa !9
  %18 = icmp slt i32 %17, 50
  br i1 %18, label %19, label %30

19:                                               ; preds = %16
  %20 = load i64, ptr %4, align 8, !tbaa !5
  %21 = icmp slt i64 %20, 510510
  br i1 %21, label %22, label %30

22:                                               ; preds = %19
  %23 = load i32, ptr %5, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [50 x [510510 x i32]], ptr @dp, i64 0, i64 %24
  %26 = load i64, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds [510510 x i32], ptr %25, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  store i64 %29, ptr %3, align 8
  br label %159

30:                                               ; preds = %19, %16
  %31 = load i32, ptr %5, align 4, !tbaa !9
  %32 = icmp slt i32 %31, 7
  br i1 %32, label %33, label %67

33:                                               ; preds = %30
  %34 = load i32, ptr %5, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [50 x [510510 x i32]], ptr @dp, i64 0, i64 %35
  %37 = load i64, ptr %4, align 8, !tbaa !5
  %38 = load i32, ptr %5, align 4, !tbaa !9
  %39 = sub nsw i32 %38, 1
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [7 x i32], ptr @prod, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = srem i64 %37, %43
  %45 = getelementptr inbounds [510510 x i32], ptr %36, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = load i32, ptr %5, align 4, !tbaa !9
  %49 = sub nsw i32 %48, 1
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [7 x i32], ptr @prod, i64 0, i64 %50
  %52 = call noundef i64 @"_ZNK3$_0clERKxRKi"(ptr noundef nonnull align 1 dereferenceable(1) @_ZL8fast_div, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %51)
  %53 = load i32, ptr %5, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [50 x [510510 x i32]], ptr @dp, i64 0, i64 %54
  %56 = load i32, ptr %5, align 4, !tbaa !9
  %57 = sub nsw i32 %56, 1
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [7 x i32], ptr @prod, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !9
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [510510 x i32], ptr %55, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !9
  %64 = sext i32 %63 to i64
  %65 = mul nsw i64 %52, %64
  %66 = add nsw i64 %47, %65
  store i64 %66, ptr %3, align 8
  br label %159

67:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %68 = load i32, ptr %5, align 4, !tbaa !9
  %69 = sub nsw i32 %68, 1
  %70 = sext i32 %69 to i64
  %71 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %70) #5
  %72 = load i32, ptr %71, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  store i64 %73, ptr %6, align 8, !tbaa !5
  %74 = load i64, ptr %4, align 8, !tbaa !5
  %75 = icmp slt i64 %74, 20000010
  br i1 %75, label %76, label %90

76:                                               ; preds = %67
  %77 = load i64, ptr %6, align 8, !tbaa !5
  %78 = load i64, ptr %6, align 8, !tbaa !5
  %79 = mul nsw i64 %77, %78
  %80 = load i64, ptr %4, align 8, !tbaa !5
  %81 = icmp sge i64 %79, %80
  br i1 %81, label %82, label %90

82:                                               ; preds = %76
  %83 = load i64, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds [20000010 x i32], ptr @pi, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !9
  %86 = load i32, ptr %5, align 4, !tbaa !9
  %87 = sub nsw i32 %85, %86
  %88 = add nsw i32 %87, 1
  %89 = sext i32 %88 to i64
  store i64 %89, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %158

90:                                               ; preds = %76, %67
  %91 = load i64, ptr %6, align 8, !tbaa !5
  %92 = load i64, ptr %6, align 8, !tbaa !5
  %93 = mul nsw i64 %91, %92
  %94 = load i64, ptr %6, align 8, !tbaa !5
  %95 = mul nsw i64 %93, %94
  %96 = load i64, ptr %4, align 8, !tbaa !5
  %97 = icmp slt i64 %95, %96
  br i1 %97, label %101, label %98

98:                                               ; preds = %90
  %99 = load i64, ptr %4, align 8, !tbaa !5
  %100 = icmp sge i64 %99, 20000010
  br i1 %100, label %101, label %113

101:                                              ; preds = %98, %90
  %102 = load i64, ptr %4, align 8, !tbaa !5
  %103 = load i32, ptr %5, align 4, !tbaa !9
  %104 = sub nsw i32 %103, 1
  %105 = call noundef i64 @_Z3phixi(i64 noundef %102, i32 noundef %104)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %106 = load i64, ptr %6, align 8, !tbaa !5
  %107 = trunc i64 %106 to i32
  store i32 %107, ptr %8, align 4, !tbaa !9
  %108 = call noundef i64 @"_ZNK3$_0clERKxRKi"(ptr noundef nonnull align 1 dereferenceable(1) @_ZL8fast_div, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %109 = load i32, ptr %5, align 4, !tbaa !9
  %110 = sub nsw i32 %109, 1
  %111 = call noundef i64 @_Z3phixi(i64 noundef %108, i32 noundef %110)
  %112 = sub i64 %105, %111
  store i64 %112, ptr %3, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  store i32 1, ptr %7, align 4
  br label %158

113:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %114 = load i64, ptr %4, align 8, !tbaa !5
  %115 = sitofp i64 %114 to double
  %116 = fadd double 5.000000e-01, %115
  %117 = call double @sqrt(double noundef %116) #5
  %118 = fptosi double %117 to i32
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [20000010 x i32], ptr @pi, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !9
  store i32 %121, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %122 = load i64, ptr %4, align 8, !tbaa !5
  %123 = getelementptr inbounds [20000010 x i32], ptr @pi, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !9
  %125 = load i32, ptr %9, align 4, !tbaa !9
  %126 = load i32, ptr %5, align 4, !tbaa !9
  %127 = add nsw i32 %125, %126
  %128 = sub nsw i32 %127, 2
  %129 = load i32, ptr %9, align 4, !tbaa !9
  %130 = load i32, ptr %5, align 4, !tbaa !9
  %131 = sub nsw i32 %129, %130
  %132 = add nsw i32 %131, 1
  %133 = mul nsw i32 %128, %132
  %134 = sdiv i32 %133, 2
  %135 = sub nsw i32 %124, %134
  %136 = sext i32 %135 to i64
  store i64 %136, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %137 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %137, ptr %11, align 4, !tbaa !9
  br label %138

138:                                              ; preds = %153, %113
  %139 = load i32, ptr %11, align 4, !tbaa !9
  %140 = load i32, ptr %9, align 4, !tbaa !9
  %141 = icmp slt i32 %139, %140
  br i1 %141, label %143, label %142

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

143:                                              ; preds = %138
  %144 = load i32, ptr %11, align 4, !tbaa !9
  %145 = sext i32 %144 to i64
  %146 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %145) #5
  %147 = call noundef i64 @"_ZNK3$_0clERKxRKi"(ptr noundef nonnull align 1 dereferenceable(1) @_ZL8fast_div, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %146)
  %148 = getelementptr inbounds [20000010 x i32], ptr @pi, i64 0, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !9
  %150 = sext i32 %149 to i64
  %151 = load i64, ptr %10, align 8, !tbaa !11
  %152 = add i64 %151, %150
  store i64 %152, ptr %10, align 8, !tbaa !11
  br label %153

153:                                              ; preds = %143
  %154 = load i32, ptr %11, align 4, !tbaa !9
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %11, align 4, !tbaa !9
  br label %138, !llvm.loop !13

156:                                              ; preds = %142
  %157 = load i64, ptr %10, align 8, !tbaa !11
  store i64 %157, ptr %3, align 8
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %158

158:                                              ; preds = %156, %101, %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %159

159:                                              ; preds = %158, %33, %22, %14
  %160 = load i64, ptr %3, align 8
  ret i64 %160
}

; Function Attrs: nounwind
declare double @sqrt(double noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 #4 = { 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 = { 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 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; 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.anon = type { i8 }

@primes = external dso_local global %"class.std::vector", align 8
@prod = external dso_local global [7 x i32], align 16
@pi = external dso_local local_unnamed_addr global [20000010 x i32], align 16
@dp = external dso_local local_unnamed_addr global [50 x [510510 x i32]], align 16
@_ZL8fast_div = external hidden constant %class.anon, align 1

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @"_ZNK3$_0clERKxRKi"(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i64 @_Z3phixi(i64 noundef %0, i32 noundef %1) local_unnamed_addr #1 {
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  store i64 %0, ptr %3, align 8, !tbaa !5
  %.not = icmp eq i32 %1, 0
  br i1 %.not, label %.loopexit, label %5

5:                                                ; preds = %2
  %6 = icmp slt i32 %1, 50
  %7 = icmp slt i64 %0, 510510
  %or.cond = and i1 %7, %6
  br i1 %or.cond, label %8, label %13

8:                                                ; preds = %5
  %9 = sext i32 %1 to i64
  %10 = getelementptr inbounds [50 x [510510 x i32]], ptr @dp, i64 0, i64 %9, i64 %0
  %11 = load i32, ptr %10, align 4, !tbaa !9
  %12 = sext i32 %11 to i64
  br label %.loopexit

13:                                               ; preds = %5
  %14 = icmp slt i32 %1, 7
  br i1 %14, label %15, label %34

15:                                               ; preds = %13
  %16 = sext i32 %1 to i64
  %17 = add nsw i32 %1, -1
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [7 x i32], ptr @prod, i64 0, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = srem i64 %0, %21
  %23 = getelementptr inbounds [50 x [510510 x i32]], ptr @dp, i64 0, i64 %16, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = call noundef i64 @"_ZNK3$_0clERKxRKi"(ptr noundef nonnull align 1 dereferenceable(1) @_ZL8fast_div, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(4) %19)
  %27 = load i32, ptr %19, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [50 x [510510 x i32]], ptr @dp, i64 0, i64 %16, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = mul nsw i64 %26, %31
  %33 = add nsw i64 %32, %25
  br label %.loopexit

34:                                               ; preds = %13
  %35 = add nsw i32 %1, -1
  %36 = zext nneg i32 %35 to i64
  %37 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %36) #4
  %38 = load i32, ptr %37, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = icmp sgt i64 %0, 20000009
  %41 = mul nsw i64 %39, %39
  %.not40 = icmp slt i64 %41, %0
  %or.cond41 = select i1 %40, i1 true, i1 %.not40
  br i1 %or.cond41, label %47, label %42

42:                                               ; preds = %34
  %43 = getelementptr inbounds [20000010 x i32], ptr @pi, i64 0, i64 %0
  %44 = load i32, ptr %43, align 4, !tbaa !9
  %reass.sub = sub i32 %44, %1
  %45 = add i32 %reass.sub, 1
  %46 = sext i32 %45 to i64
  br label %.loopexit

47:                                               ; preds = %34
  %48 = mul nsw i64 %41, %39
  %49 = icmp slt i64 %48, %0
  %or.cond3 = or i1 %40, %49
  br i1 %or.cond3, label %50, label %55

50:                                               ; preds = %47
  %51 = tail call noundef i64 @_Z3phixi(i64 noundef %0, i32 noundef %35)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  store i32 %38, ptr %4, align 4, !tbaa !9
  %52 = call noundef i64 @"_ZNK3$_0clERKxRKi"(ptr noundef nonnull align 1 dereferenceable(1) @_ZL8fast_div, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %53 = call noundef i64 @_Z3phixi(i64 noundef %52, i32 noundef %35)
  %54 = sub i64 %51, %53
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  br label %.loopexit

55:                                               ; preds = %47
  %56 = sitofp i64 %0 to double
  %57 = fadd double %56, 5.000000e-01
  %58 = tail call double @sqrt(double noundef %57) #4
  %59 = fptosi double %58 to i32
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [20000010 x i32], ptr @pi, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !9
  %63 = getelementptr inbounds [20000010 x i32], ptr @pi, i64 0, i64 %0
  %64 = load i32, ptr %63, align 4, !tbaa !9
  %65 = add nsw i32 %1, -2
  %66 = add i32 %65, %62
  %reass.sub45 = sub i32 %62, %1
  %67 = add i32 %reass.sub45, 1
  %68 = mul nsw i32 %66, %67
  %.neg = sdiv i32 %68, -2
  %69 = add i32 %.neg, %64
  %70 = sext i32 %69 to i64
  %71 = icmp sgt i32 %62, %1
  br i1 %71, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %55
  %72 = zext nneg i32 %1 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ %72, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %.03443 = phi i64 [ %70, %.lr.ph.preheader ], [ %78, %.lr.ph ]
  %73 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %indvars.iv) #4
  %74 = call noundef i64 @"_ZNK3$_0clERKxRKi"(ptr noundef nonnull align 1 dereferenceable(1) @_ZL8fast_div, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(4) %73)
  %75 = getelementptr inbounds [20000010 x i32], ptr @pi, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %78 = add i64 %.03443, %77
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %79 = trunc nuw i64 %indvars.iv.next to i32
  %80 = icmp sgt i32 %62, %79
  br i1 %80, label %.lr.ph, label %.loopexit, !llvm.loop !11

.loopexit:                                        ; preds = %.lr.ph, %55, %42, %50, %2, %15, %8
  %.1 = phi i64 [ %12, %8 ], [ %33, %15 ], [ %0, %2 ], [ %46, %42 ], [ %54, %50 ], [ %70, %55 ], [ %78, %.lr.ph ]
  ret i64 %.1
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { mustprogress nofree nounwind willreturn memory(write) "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"}


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