; LLVM IR from AdarshGaur/Competitive-Programming :: HackerEarth/November Circuits '22/Four Distinct Factors.ll (Z3prev)

; 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<long, std::allocator<long>>::_Vector_impl" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Bvector_base" }
%"struct.std::_Bvector_base" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" = type { %"struct.std::_Bit_iterator", %"struct.std::_Bit_iterator", ptr }
%"struct.std::_Bit_iterator" = type { %"struct.std::_Bit_iterator_base.base", [4 x i8] }
%"struct.std::_Bit_iterator_base.base" = type <{ ptr, i32 }>
%"struct.std::_Bit_reference" = type { ptr, i64 }

@primes = external dso_local global %"class.std::vector", align 8
@isPrime = external dso_local global %"class.std::vector.0", align 8
@ans = external dso_local global [1000007 x i64], align 16

; 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 uwtable
define dso_local void @_Z3prev() #1 {
  %1 = alloca i64, align 8
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::_Bit_reference", align 8
  %4 = alloca i64, align 8
  %5 = alloca %"struct.std::_Bit_reference", align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca %"struct.std::_Bit_reference", align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #3
  store i64 2, ptr %1, align 8, !tbaa !5
  br label %13

13:                                               ; preds = %50, %0
  %14 = load i64, ptr %1, align 8, !tbaa !5
  %15 = load i64, ptr %1, align 8, !tbaa !5
  %16 = mul nsw i64 %14, %15
  %17 = icmp sle i64 %16, 1000007
  br i1 %17, label %19, label %18

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

19:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #3
  %20 = load i64, ptr %1, align 8, !tbaa !5
  %21 = call { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) @isPrime, i64 noundef %20)
  %22 = getelementptr inbounds { ptr, i64 }, ptr %3, i32 0, i32 0
  %23 = extractvalue { ptr, i64 } %21, 0
  store ptr %23, ptr %22, align 8
  %24 = getelementptr inbounds { ptr, i64 }, ptr %3, i32 0, i32 1
  %25 = extractvalue { ptr, i64 } %21, 1
  store i64 %25, ptr %24, align 8
  %26 = call noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %3) #3
  %27 = xor i1 %26, true
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #3
  br i1 %27, label %28, label %29

28:                                               ; preds = %19
  br label %50

29:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %30 = load i64, ptr %1, align 8, !tbaa !5
  %31 = load i64, ptr %1, align 8, !tbaa !5
  %32 = mul nsw i64 %30, %31
  store i64 %32, ptr %4, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %45, %29
  %34 = load i64, ptr %4, align 8, !tbaa !5
  %35 = icmp slt i64 %34, 1000007
  br i1 %35, label %37, label %36

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

37:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #3
  %38 = load i64, ptr %4, align 8, !tbaa !5
  %39 = call { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) @isPrime, i64 noundef %38)
  %40 = getelementptr inbounds { ptr, i64 }, ptr %5, i32 0, i32 0
  %41 = extractvalue { ptr, i64 } %39, 0
  store ptr %41, ptr %40, align 8
  %42 = getelementptr inbounds { ptr, i64 }, ptr %5, i32 0, i32 1
  %43 = extractvalue { ptr, i64 } %39, 1
  store i64 %43, ptr %42, align 8
  %44 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %5, i1 noundef zeroext false) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #3
  br label %45

45:                                               ; preds = %37
  %46 = load i64, ptr %1, align 8, !tbaa !5
  %47 = load i64, ptr %4, align 8, !tbaa !5
  %48 = add nsw i64 %47, %46
  store i64 %48, ptr %4, align 8, !tbaa !5
  br label %33, !llvm.loop !9

49:                                               ; preds = %36
  br label %50

50:                                               ; preds = %49, %28
  %51 = load i64, ptr %1, align 8, !tbaa !5
  %52 = add nsw i64 %51, 1
  store i64 %52, ptr %1, align 8, !tbaa !5
  br label %13, !llvm.loop !11

53:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store i64 2, ptr %6, align 8, !tbaa !5
  call void @_ZNSt6vectorIlSaIlEE9push_backEOl(ptr noundef nonnull align 8 dereferenceable(24) @primes, ptr noundef nonnull align 8 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store i64 3, ptr %7, align 8, !tbaa !5
  br label %54

54:                                               ; preds = %68, %53
  %55 = load i64, ptr %7, align 8, !tbaa !5
  %56 = icmp slt i64 %55, 1000007
  br i1 %56, label %58, label %57

57:                                               ; preds = %54
  store i32 8, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  br label %71

58:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #3
  %59 = load i64, ptr %7, align 8, !tbaa !5
  %60 = call { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) @isPrime, i64 noundef %59)
  %61 = getelementptr inbounds { ptr, i64 }, ptr %8, i32 0, i32 0
  %62 = extractvalue { ptr, i64 } %60, 0
  store ptr %62, ptr %61, align 8
  %63 = getelementptr inbounds { ptr, i64 }, ptr %8, i32 0, i32 1
  %64 = extractvalue { ptr, i64 } %60, 1
  store i64 %64, ptr %63, align 8
  %65 = call noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %8) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #3
  br i1 %65, label %66, label %67

66:                                               ; preds = %58
  call void @_ZNSt6vectorIlSaIlEE9push_backERKl(ptr noundef nonnull align 8 dereferenceable(24) @primes, ptr noundef nonnull align 8 dereferenceable(8) %7)
  br label %67

67:                                               ; preds = %66, %58
  br label %68

68:                                               ; preds = %67
  %69 = load i64, ptr %7, align 8, !tbaa !5
  %70 = add nsw i64 %69, 2
  store i64 %70, ptr %7, align 8, !tbaa !5
  br label %54, !llvm.loop !12

71:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  store i64 0, ptr %9, align 8, !tbaa !5
  br label %72

72:                                               ; preds = %124, %71
  %73 = load i64, ptr %9, align 8, !tbaa !5
  %74 = call noundef i64 @_ZNKSt6vectorIlSaIlEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @primes) #3
  %75 = icmp slt i64 %73, %74
  br i1 %75, label %77, label %76

76:                                               ; preds = %72
  store i32 11, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %127

77:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store i64 0, ptr %10, align 8, !tbaa !5
  br label %78

78:                                               ; preds = %102, %77
  %79 = load i64, ptr %10, align 8, !tbaa !5
  %80 = load i64, ptr %9, align 8, !tbaa !5
  %81 = icmp slt i64 %79, %80
  br i1 %81, label %83, label %82

82:                                               ; preds = %78
  store i32 14, ptr %2, align 4
  br label %105

83:                                               ; preds = %78
  %84 = load i64, ptr %10, align 8, !tbaa !5
  %85 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %84) #3
  %86 = load i64, ptr %85, align 8, !tbaa !5
  %87 = load i64, ptr %9, align 8, !tbaa !5
  %88 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %87) #3
  %89 = load i64, ptr %88, align 8, !tbaa !5
  %90 = mul nsw i64 %86, %89
  %91 = icmp sge i64 %90, 1000007
  br i1 %91, label %92, label %93

92:                                               ; preds = %83
  store i32 14, ptr %2, align 4
  br label %105

93:                                               ; preds = %83
  %94 = load i64, ptr %10, align 8, !tbaa !5
  %95 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %94) #3
  %96 = load i64, ptr %95, align 8, !tbaa !5
  %97 = load i64, ptr %9, align 8, !tbaa !5
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %97) #3
  %99 = load i64, ptr %98, align 8, !tbaa !5
  %100 = mul nsw i64 %96, %99
  %101 = getelementptr inbounds [1000007 x i64], ptr @ans, i64 0, i64 %100
  store i64 1, ptr %101, align 8, !tbaa !5
  br label %102

102:                                              ; preds = %93
  %103 = load i64, ptr %10, align 8, !tbaa !5
  %104 = add nsw i64 %103, 1
  store i64 %104, ptr %10, align 8, !tbaa !5
  br label %78, !llvm.loop !13

105:                                              ; preds = %92, %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %106

106:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %107 = load i64, ptr %9, align 8, !tbaa !5
  %108 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %107) #3
  %109 = load i64, ptr %108, align 8, !tbaa !5
  %110 = load i64, ptr %9, align 8, !tbaa !5
  %111 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %110) #3
  %112 = load i64, ptr %111, align 8, !tbaa !5
  %113 = mul nsw i64 %109, %112
  %114 = load i64, ptr %9, align 8, !tbaa !5
  %115 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %114) #3
  %116 = load i64, ptr %115, align 8, !tbaa !5
  %117 = mul nsw i64 %113, %116
  store i64 %117, ptr %11, align 8, !tbaa !5
  %118 = load i64, ptr %11, align 8, !tbaa !5
  %119 = icmp slt i64 %118, 1000007
  br i1 %119, label %120, label %123

120:                                              ; preds = %106
  %121 = load i64, ptr %11, align 8, !tbaa !5
  %122 = getelementptr inbounds [1000007 x i64], ptr @ans, i64 0, i64 %121
  store i64 1, ptr %122, align 8, !tbaa !5
  br label %123

123:                                              ; preds = %120, %106
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  br label %124

124:                                              ; preds = %123
  %125 = load i64, ptr %9, align 8, !tbaa !5
  %126 = add nsw i64 %125, 1
  store i64 %126, ptr %9, align 8, !tbaa !5
  br label %72, !llvm.loop !14

127:                                              ; preds = %76
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  store i64 1, ptr %12, align 8, !tbaa !5
  br label %128

128:                                              ; preds = %141, %127
  %129 = load i64, ptr %12, align 8, !tbaa !5
  %130 = icmp slt i64 %129, 1000007
  br i1 %130, label %132, label %131

131:                                              ; preds = %128
  store i32 17, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  br label %144

132:                                              ; preds = %128
  %133 = load i64, ptr %12, align 8, !tbaa !5
  %134 = sub nsw i64 %133, 1
  %135 = getelementptr inbounds [1000007 x i64], ptr @ans, i64 0, i64 %134
  %136 = load i64, ptr %135, align 8, !tbaa !5
  %137 = load i64, ptr %12, align 8, !tbaa !5
  %138 = getelementptr inbounds [1000007 x i64], ptr @ans, i64 0, i64 %137
  %139 = load i64, ptr %138, align 8, !tbaa !5
  %140 = add nsw i64 %139, %136
  store i64 %140, ptr %138, align 8, !tbaa !5
  br label %141

141:                                              ; preds = %132
  %142 = load i64, ptr %12, align 8, !tbaa !5
  %143 = add nsw i64 %142, 1
  store i64 %143, ptr %12, align 8, !tbaa !5
  br label %128, !llvm.loop !15

144:                                              ; preds = %131
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext) #2 align 2

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

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


; 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<long, std::allocator<long>>::_Vector_impl" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Bvector_base" }
%"struct.std::_Bvector_base" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" = type { %"struct.std::_Bit_iterator", %"struct.std::_Bit_iterator", ptr }
%"struct.std::_Bit_iterator" = type { %"struct.std::_Bit_iterator_base.base", [4 x i8] }
%"struct.std::_Bit_iterator_base.base" = type <{ ptr, i32 }>
%"struct.std::_Bit_reference" = type { ptr, i64 }

@primes = external dso_local global %"class.std::vector", align 8
@isPrime = external dso_local global %"class.std::vector.0", align 8
@ans = external dso_local local_unnamed_addr global [1000007 x i64], align 16

; 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 uwtable
define dso_local void @_Z3prev() local_unnamed_addr #1 {
  %1 = alloca %"struct.std::_Bit_reference", align 8
  %2 = alloca %"struct.std::_Bit_reference", align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca %"struct.std::_Bit_reference", align 8
  %6 = getelementptr inbounds i8, ptr %1, i64 8
  %7 = getelementptr inbounds i8, ptr %2, i64 8
  br label %10

8:                                                ; preds = %.loopexit
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  store i64 2, ptr %3, align 8, !tbaa !5
  call void @_ZNSt6vectorIlSaIlEE9push_backEOl(ptr noundef nonnull align 8 dereferenceable(24) @primes, ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  store i64 3, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %5, i64 8
  br label %28

10:                                               ; preds = %0, %.loopexit
  %11 = phi i64 [ 4, %0 ], [ %24, %.loopexit ]
  %.02837 = phi i64 [ 2, %0 ], [ %23, %.loopexit ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #3
  %12 = call { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) @isPrime, i64 noundef %.02837)
  %13 = extractvalue { ptr, i64 } %12, 0
  store ptr %13, ptr %1, align 8
  %14 = extractvalue { ptr, i64 } %12, 1
  store i64 %14, ptr %6, align 8
  %15 = call noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %1) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #3
  %16 = icmp ult i64 %11, 1000007
  %or.cond = and i1 %15, %16
  br i1 %or.cond, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %10, %.lr.ph
  %.03136 = phi i64 [ %21, %.lr.ph ], [ %11, %10 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #3
  %17 = call { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) @isPrime, i64 noundef %.03136)
  %18 = extractvalue { ptr, i64 } %17, 0
  store ptr %18, ptr %2, align 8
  %19 = extractvalue { ptr, i64 } %17, 1
  store i64 %19, ptr %7, align 8
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %2, i1 noundef zeroext false) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #3
  %21 = add nuw nsw i64 %.03136, %.02837
  %22 = icmp ult i64 %21, 1000007
  br i1 %22, label %.lr.ph, label %.loopexit, !llvm.loop !9

.loopexit:                                        ; preds = %.lr.ph, %10
  %23 = add nuw nsw i64 %.02837, 1
  %24 = mul nuw nsw i64 %23, %23
  %exitcond.not = icmp eq i64 %23, 1001
  br i1 %exitcond.not, label %8, label %10, !llvm.loop !11

25:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  %26 = call noundef i64 @_ZNKSt6vectorIlSaIlEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @primes) #3
  %27 = icmp sgt i64 %26, 0
  br i1 %27, label %.preheader34, label %.preheader

28:                                               ; preds = %8, %34
  %storemerge39 = phi i64 [ 3, %8 ], [ %36, %34 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #3
  %29 = call { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) @isPrime, i64 noundef %storemerge39)
  %30 = extractvalue { ptr, i64 } %29, 0
  store ptr %30, ptr %5, align 8
  %31 = extractvalue { ptr, i64 } %29, 1
  store i64 %31, ptr %9, align 8
  %32 = call noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %5) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #3
  br i1 %32, label %33, label %34

33:                                               ; preds = %28
  call void @_ZNSt6vectorIlSaIlEE9push_backERKl(ptr noundef nonnull align 8 dereferenceable(24) @primes, ptr noundef nonnull align 8 dereferenceable(8) %4)
  br label %34

34:                                               ; preds = %28, %33
  %35 = load i64, ptr %4, align 8, !tbaa !5
  %36 = add nsw i64 %35, 2
  store i64 %36, ptr %4, align 8, !tbaa !5
  %37 = icmp slt i64 %35, 1000005
  br i1 %37, label %28, label %25, !llvm.loop !12

.preheader34:                                     ; preds = %25, %63
  %.03043 = phi i64 [ %64, %63 ], [ 0, %25 ]
  %.not = icmp eq i64 %.03043, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph41

.preheader:                                       ; preds = %63, %25
  %.pre = load i64, ptr @ans, align 16, !tbaa !5
  br label %68

.lr.ph41:                                         ; preds = %.preheader34, %44
  %.02940 = phi i64 [ %51, %44 ], [ 0, %.preheader34 ]
  %38 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %.02940) #3
  %39 = load i64, ptr %38, align 8, !tbaa !5
  %40 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %.03043) #3
  %41 = load i64, ptr %40, align 8, !tbaa !5
  %42 = mul nsw i64 %41, %39
  %43 = icmp sgt i64 %42, 1000006
  br i1 %43, label %._crit_edge, label %44

44:                                               ; preds = %.lr.ph41
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %.02940) #3
  %46 = load i64, ptr %45, align 8, !tbaa !5
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %.03043) #3
  %48 = load i64, ptr %47, align 8, !tbaa !5
  %49 = mul nsw i64 %48, %46
  %50 = getelementptr inbounds [1000007 x i64], ptr @ans, i64 0, i64 %49
  store i64 1, ptr %50, align 8, !tbaa !5
  %51 = add nuw nsw i64 %.02940, 1
  %exitcond45.not = icmp eq i64 %51, %.03043
  br i1 %exitcond45.not, label %._crit_edge, label %.lr.ph41, !llvm.loop !13

._crit_edge:                                      ; preds = %44, %.lr.ph41, %.preheader34
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %.03043) #3
  %53 = load i64, ptr %52, align 8, !tbaa !5
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %.03043) #3
  %55 = load i64, ptr %54, align 8, !tbaa !5
  %56 = mul nsw i64 %55, %53
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %.03043) #3
  %58 = load i64, ptr %57, align 8, !tbaa !5
  %59 = mul nsw i64 %56, %58
  %60 = icmp slt i64 %59, 1000007
  br i1 %60, label %61, label %63

61:                                               ; preds = %._crit_edge
  %62 = getelementptr inbounds [1000007 x i64], ptr @ans, i64 0, i64 %59
  store i64 1, ptr %62, align 8, !tbaa !5
  br label %63

63:                                               ; preds = %61, %._crit_edge
  %64 = add nuw nsw i64 %.03043, 1
  %65 = call noundef i64 @_ZNKSt6vectorIlSaIlEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @primes) #3
  %66 = icmp slt i64 %64, %65
  br i1 %66, label %.preheader34, label %.preheader, !llvm.loop !14

67:                                               ; preds = %68
  ret void

68:                                               ; preds = %68, %.preheader
  %69 = phi i64 [ %.pre, %.preheader ], [ %76, %68 ]
  %.044 = phi i64 [ 1, %.preheader ], [ %77, %68 ]
  %70 = getelementptr inbounds [1000007 x i64], ptr @ans, i64 0, i64 %.044
  %71 = load i64, ptr %70, align 8, !tbaa !5
  %72 = add nsw i64 %71, %69
  store i64 %72, ptr %70, align 8, !tbaa !5
  %73 = add nuw nsw i64 %.044, 1
  %74 = getelementptr inbounds [1000007 x i64], ptr @ans, i64 0, i64 %73
  %75 = load i64, ptr %74, align 8, !tbaa !5
  %76 = add nsw i64 %75, %72
  store i64 %76, ptr %74, align 8, !tbaa !5
  %77 = add nuw nsw i64 %.044, 2
  %exitcond46.not.1 = icmp eq i64 %77, 1000007
  br i1 %exitcond46.not.1, label %67, label %68, !llvm.loop !15
}

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext) local_unnamed_addr #2 align 2

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

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


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