; LLVM IR from ShahjalalShohag/code-library :: Number Theory/K Divisors.ll (Z9backtrackxii)

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

@_ZN3pcf3lenE = external dso_local global i32, align 4
@_ZN3pcf6primesE = external dso_local global [1000010 x i32], align 16
@s = external dso_local global [2020 x i32], align 16
@d = external dso_local global [2020 x %"class.std::vector"], 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
declare dso_local noundef i64 @_ZN3pcf6LehmerEx(i64 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z5powerxi(i64 noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z9backtrackxii(i64 noundef %0, i32 noundef %1, i32 noundef %2) #1 {
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  %17 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %18 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i64, align 8
  store i64 %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = icmp sge i32 %23, 2020
  br i1 %24, label %25, label %26

25:                                               ; preds = %3
  store i64 0, ptr %4, align 8
  br label %220

26:                                               ; preds = %3
  %27 = load i64, ptr %5, align 8, !tbaa !5
  %28 = icmp sle i64 %27, 0
  br i1 %28, label %29, label %30

29:                                               ; preds = %26
  store i64 0, ptr %4, align 8
  br label %220

30:                                               ; preds = %26
  %31 = load i32, ptr %6, align 4, !tbaa !9
  %32 = icmp eq i32 %31, 1
  br i1 %32, label %33, label %34

33:                                               ; preds = %30
  store i64 1, ptr %4, align 8
  br label %220

34:                                               ; preds = %30
  %35 = load i64, ptr %5, align 8, !tbaa !5
  %36 = icmp eq i64 %35, 1
  br i1 %36, label %37, label %38

37:                                               ; preds = %34
  store i64 0, ptr %4, align 8
  br label %220

38:                                               ; preds = %34
  %39 = load i32, ptr %6, align 4, !tbaa !9
  %40 = icmp eq i32 %39, 2
  br i1 %40, label %41, label %49

41:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store i64 0, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %42 = load i64, ptr %5, align 8, !tbaa !5
  %43 = call noundef i64 @_ZN3pcf6LehmerEx(i64 noundef %42)
  %44 = load i32, ptr %7, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = sub nsw i64 %43, %45
  store i64 %46, ptr %9, align 8, !tbaa !5
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %48 = load i64, ptr %47, align 8, !tbaa !5
  store i64 %48, ptr %4, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %220

49:                                               ; preds = %38
  %50 = load i32, ptr %6, align 4, !tbaa !9
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [2020 x %"class.std::vector"], ptr @d, i64 0, i64 %51
  %53 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %52) #4
  %54 = icmp eq i64 %53, 1
  br i1 %54, label %55, label %134

55:                                               ; preds = %49
  %56 = load i32, ptr %6, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [2020 x %"class.std::vector"], ptr @d, i64 0, i64 %57
  %59 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %58, i64 noundef 0) #4
  %60 = load i32, ptr %59, align 4, !tbaa !9
  %61 = sub nsw i32 %60, 1
  %62 = icmp sge i32 %61, 41
  br i1 %62, label %63, label %64

63:                                               ; preds = %55
  store i64 0, ptr %4, align 8
  br label %220

64:                                               ; preds = %55
  %65 = load i32, ptr %7, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [1000010 x i32], ptr @_ZN3pcf6primesE, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = load i32, ptr %6, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [2020 x %"class.std::vector"], ptr @d, i64 0, i64 %71
  %73 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %72, i64 noundef 0) #4
  %74 = load i32, ptr %73, align 4, !tbaa !9
  %75 = sub nsw i32 %74, 1
  %76 = call noundef i64 @_Z5powerxi(i64 noundef %69, i32 noundef %75)
  %77 = load i64, ptr %5, align 8, !tbaa !5
  %78 = icmp sgt i64 %76, %77
  br i1 %78, label %79, label %80

79:                                               ; preds = %64
  store i64 0, ptr %4, align 8
  br label %220

80:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %81 = load i32, ptr %7, align 4, !tbaa !9
  %82 = sub nsw i32 %81, 1
  store i32 %82, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %83 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %83, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %84 = load i64, ptr %5, align 8, !tbaa !5
  %85 = load i32, ptr %6, align 4, !tbaa !9
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [2020 x %"class.std::vector"], ptr @d, i64 0, i64 %86
  %88 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %87, i64 noundef 0) #4
  %89 = load i32, ptr %88, align 4, !tbaa !9
  %90 = sub nsw i32 %89, 1
  %91 = sitofp i32 %90 to double
  %92 = fdiv double 1.000000e+00, %91
  %93 = call noundef double @_ZSt3powIxdEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i64 noundef %84, double noundef %92)
  %94 = fadd double %93, 1.000000e+00
  %95 = fptosi double %94 to i32
  store i32 %95, ptr %12, align 4, !tbaa !9
  br label %96

96:                                               ; preds = %127, %80
  %97 = load i32, ptr %11, align 4, !tbaa !9
  %98 = load i32, ptr %12, align 4, !tbaa !9
  %99 = icmp sle i32 %97, %98
  br i1 %99, label %100, label %128

100:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %101 = load i32, ptr %11, align 4, !tbaa !9
  %102 = load i32, ptr %12, align 4, !tbaa !9
  %103 = add nsw i32 %101, %102
  %104 = ashr i32 %103, 1
  store i32 %104, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %105 = load i32, ptr %13, align 4, !tbaa !9
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [1000010 x i32], ptr @_ZN3pcf6primesE, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  %110 = load i32, ptr %6, align 4, !tbaa !9
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [2020 x %"class.std::vector"], ptr @d, i64 0, i64 %111
  %113 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %112, i64 noundef 0) #4
  %114 = load i32, ptr %113, align 4, !tbaa !9
  %115 = sub nsw i32 %114, 1
  %116 = call noundef i64 @_Z5powerxi(i64 noundef %109, i32 noundef %115)
  store i64 %116, ptr %14, align 8, !tbaa !5
  %117 = load i64, ptr %14, align 8, !tbaa !5
  %118 = load i64, ptr %5, align 8, !tbaa !5
  %119 = icmp sgt i64 %117, %118
  br i1 %119, label %120, label %123

120:                                              ; preds = %100
  %121 = load i32, ptr %13, align 4, !tbaa !9
  %122 = sub nsw i32 %121, 1
  store i32 %122, ptr %12, align 4, !tbaa !9
  br label %127

123:                                              ; preds = %100
  %124 = load i32, ptr %13, align 4, !tbaa !9
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %11, align 4, !tbaa !9
  %126 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %126, ptr %10, align 4, !tbaa !9
  br label %127

127:                                              ; preds = %123, %120
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %96, !llvm.loop !11

128:                                              ; preds = %96
  %129 = load i32, ptr %10, align 4, !tbaa !9
  %130 = load i32, ptr %7, align 4, !tbaa !9
  %131 = sub nsw i32 %129, %130
  %132 = add nsw i32 %131, 1
  %133 = sext i32 %132 to i64
  store i64 %133, ptr %4, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %220

134:                                              ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  store i64 0, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %135 = load i32, ptr %6, align 4, !tbaa !9
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [2020 x %"class.std::vector"], ptr @d, i64 0, i64 %136
  store ptr %137, ptr %16, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %138 = load ptr, ptr %16, align 8, !tbaa !13
  %139 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %138) #4
  %140 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  store ptr %139, ptr %140, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %141 = load ptr, ptr %16, align 8, !tbaa !13
  %142 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %141) #4
  %143 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %18, i32 0, i32 0
  store ptr %142, ptr %143, align 8
  br label %144

144:                                              ; preds = %216, %134
  %145 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %18) #4
  br i1 %145, label %147, label %146

146:                                              ; preds = %144
  store i32 4, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  br label %218

147:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %148 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #4
  %149 = load i32, ptr %148, align 4, !tbaa !9
  store i32 %149, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  %150 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %150, ptr %21, align 4, !tbaa !9
  br label %151

151:                                              ; preds = %211, %147
  %152 = load i32, ptr %21, align 4, !tbaa !9
  %153 = load i32, ptr @_ZN3pcf3lenE, align 4, !tbaa !9
  %154 = icmp slt i32 %152, %153
  br i1 %154, label %156, label %155

155:                                              ; preds = %151
  store i32 6, ptr %19, align 4
  br label %214

156:                                              ; preds = %151
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  %157 = load i32, ptr %21, align 4, !tbaa !9
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [1000010 x i32], ptr @_ZN3pcf6primesE, i64 0, i64 %158
  %160 = load i32, ptr %159, align 4, !tbaa !9
  %161 = sext i32 %160 to i64
  %162 = load i32, ptr %20, align 4, !tbaa !9
  %163 = sub nsw i32 %162, 1
  %164 = call noundef i64 @_Z5powerxi(i64 noundef %161, i32 noundef %163)
  store i64 %164, ptr %22, align 8, !tbaa !5
  %165 = load i64, ptr %22, align 8, !tbaa !5
  %166 = load i64, ptr %5, align 8, !tbaa !5
  %167 = icmp sgt i64 %165, %166
  br i1 %167, label %168, label %169

168:                                              ; preds = %156
  store i32 6, ptr %19, align 4
  br label %208

169:                                              ; preds = %156
  %170 = load i32, ptr %6, align 4, !tbaa !9
  %171 = load i32, ptr %20, align 4, !tbaa !9
  %172 = sdiv i32 %170, %171
  %173 = icmp eq i32 %172, 1
  br i1 %173, label %174, label %177

174:                                              ; preds = %169
  %175 = load i64, ptr %15, align 8, !tbaa !5
  %176 = add nsw i64 %175, 1
  store i64 %176, ptr %15, align 8, !tbaa !5
  store i32 8, ptr %19, align 4
  br label %208

177:                                              ; preds = %169
  %178 = load i32, ptr %21, align 4, !tbaa !9
  %179 = add nsw i32 %178, 1
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [1000010 x i32], ptr @_ZN3pcf6primesE, i64 0, i64 %180
  %182 = load i32, ptr %181, align 4, !tbaa !9
  %183 = sext i32 %182 to i64
  %184 = load i32, ptr %6, align 4, !tbaa !9
  %185 = load i32, ptr %20, align 4, !tbaa !9
  %186 = sdiv i32 %184, %185
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [2020 x i32], ptr @s, i64 0, i64 %187
  %189 = load i32, ptr %188, align 4, !tbaa !9
  %190 = call noundef i64 @_Z5powerxi(i64 noundef %183, i32 noundef %189)
  %191 = load i64, ptr %5, align 8, !tbaa !5
  %192 = load i64, ptr %22, align 8, !tbaa !5
  %193 = sdiv i64 %191, %192
  %194 = icmp sgt i64 %190, %193
  br i1 %194, label %195, label %196

195:                                              ; preds = %177
  store i32 6, ptr %19, align 4
  br label %208

196:                                              ; preds = %177
  %197 = load i64, ptr %5, align 8, !tbaa !5
  %198 = load i64, ptr %22, align 8, !tbaa !5
  %199 = sdiv i64 %197, %198
  %200 = load i32, ptr %6, align 4, !tbaa !9
  %201 = load i32, ptr %20, align 4, !tbaa !9
  %202 = sdiv i32 %200, %201
  %203 = load i32, ptr %21, align 4, !tbaa !9
  %204 = add nsw i32 %203, 1
  %205 = call noundef i64 @_Z9backtrackxii(i64 noundef %199, i32 noundef %202, i32 noundef %204)
  %206 = load i64, ptr %15, align 8, !tbaa !5
  %207 = add nsw i64 %206, %205
  store i64 %207, ptr %15, align 8, !tbaa !5
  store i32 0, ptr %19, align 4
  br label %208

208:                                              ; preds = %196, %195, %174, %168
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  %209 = load i32, ptr %19, align 4
  switch i32 %209, label %214 [
    i32 0, label %210
    i32 8, label %211
  ]

210:                                              ; preds = %208
  br label %211

211:                                              ; preds = %210, %208
  %212 = load i32, ptr %21, align 4, !tbaa !9
  %213 = add nsw i32 %212, 1
  store i32 %213, ptr %21, align 4, !tbaa !9
  br label %151, !llvm.loop !15

214:                                              ; preds = %208, %155
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  br label %215

215:                                              ; preds = %214
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %216

216:                                              ; preds = %215
  %217 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #4
  br label %144

218:                                              ; preds = %146
  %219 = load i64, ptr %15, align 8, !tbaa !5
  store i64 %219, ptr %4, align 8
  store i32 1, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  br label %220

220:                                              ; preds = %218, %128, %79, %63, %41, %37, %33, %29, %25
  %221 = load i64, ptr %4, align 8
  ret i64 %221
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3powIxdEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i64 noundef, double 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)) #3

; 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: 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 = { 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 = { 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 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = distinct !{!15, !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 }

@_ZN3pcf3lenE = external dso_local local_unnamed_addr global i32, align 4
@_ZN3pcf6primesE = external dso_local local_unnamed_addr global [1000010 x i32], align 16
@s = external dso_local local_unnamed_addr global [2020 x i32], align 16
@d = external dso_local global [2020 x %"class.std::vector"], 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
declare dso_local noundef i64 @_ZN3pcf6LehmerEx(i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z5powerxi(i64 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z9backtrackxii(i64 noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = icmp sgt i32 %1, 2019
  %9 = icmp slt i64 %0, 1
  %or.cond = or i1 %9, %8
  br i1 %or.cond, label %108, label %10

10:                                               ; preds = %3
  %11 = icmp eq i32 %1, 1
  br i1 %11, label %108, label %12

12:                                               ; preds = %10
  %13 = icmp eq i64 %0, 1
  br i1 %13, label %108, label %14

14:                                               ; preds = %12
  %15 = icmp eq i32 %1, 2
  br i1 %15, label %16, label %22

16:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  store i64 0, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  %17 = tail call noundef i64 @_ZN3pcf6LehmerEx(i64 noundef %0)
  %18 = sext i32 %2 to i64
  %19 = sub nsw i64 %17, %18
  store i64 %19, ptr %5, align 8, !tbaa !5
  %20 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %21 = load i64, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  br label %108

22:                                               ; preds = %14
  %23 = sext i32 %1 to i64
  %24 = getelementptr inbounds [2020 x %"class.std::vector"], ptr @d, i64 0, i64 %23
  %25 = tail call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %24) #4
  %26 = icmp eq i64 %25, 1
  br i1 %26, label %27, label %66

27:                                               ; preds = %22
  %28 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %24, i64 noundef 0) #4
  %29 = load i32, ptr %28, align 4, !tbaa !9
  %30 = icmp sgt i32 %29, 41
  br i1 %30, label %108, label %31

31:                                               ; preds = %27
  %32 = sext i32 %2 to i64
  %33 = getelementptr inbounds [1000010 x i32], ptr @_ZN3pcf6primesE, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %24, i64 noundef 0) #4
  %37 = load i32, ptr %36, align 4, !tbaa !9
  %38 = add nsw i32 %37, -1
  %39 = tail call noundef i64 @_Z5powerxi(i64 noundef %35, i32 noundef %38)
  %40 = icmp sgt i64 %39, %0
  br i1 %40, label %108, label %41

41:                                               ; preds = %31
  %42 = add nsw i32 %2, -1
  %43 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %24, i64 noundef 0) #4
  %44 = load i32, ptr %43, align 4, !tbaa !9
  %45 = add nsw i32 %44, -1
  %46 = sitofp i32 %45 to double
  %47 = fdiv double 1.000000e+00, %46
  %48 = tail call noundef double @_ZSt3powIxdEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i64 noundef %0, double noundef %47)
  %49 = fadd double %48, 1.000000e+00
  %50 = fptosi double %49 to i32
  %.not80 = icmp slt i32 %50, %2
  br i1 %.not80, label %._crit_edge86, label %.lr.ph85

.lr.ph85:                                         ; preds = %41, %.lr.ph85
  %.05683 = phi i32 [ %.1, %.lr.ph85 ], [ %42, %41 ]
  %.05882 = phi i32 [ %.159, %.lr.ph85 ], [ %2, %41 ]
  %.06281 = phi i32 [ %.163, %.lr.ph85 ], [ %50, %41 ]
  %51 = add nsw i32 %.05882, %.06281
  %52 = ashr i32 %51, 1
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [1000010 x i32], ptr @_ZN3pcf6primesE, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %24, i64 noundef 0) #4
  %58 = load i32, ptr %57, align 4, !tbaa !9
  %59 = add nsw i32 %58, -1
  %60 = tail call noundef i64 @_Z5powerxi(i64 noundef %56, i32 noundef %59)
  %61 = icmp sgt i64 %60, %0
  %62 = add nsw i32 %52, -1
  %63 = add nsw i32 %52, 1
  %.163 = select i1 %61, i32 %62, i32 %.06281
  %.159 = select i1 %61, i32 %.05882, i32 %63
  %.1 = select i1 %61, i32 %.05683, i32 %52
  %.not = icmp sgt i32 %.159, %.163
  br i1 %.not, label %._crit_edge86, label %.lr.ph85, !llvm.loop !11

._crit_edge86:                                    ; preds = %.lr.ph85, %41
  %.056.lcssa = phi i32 [ %42, %41 ], [ %.1, %.lr.ph85 ]
  %reass.sub = sub i32 %.056.lcssa, %2
  %64 = add i32 %reass.sub, 1
  %65 = sext i32 %64 to i64
  br label %108

66:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %67 = tail call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %24) #4
  store ptr %67, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %68 = tail call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %24) #4
  store ptr %68, ptr %7, align 8
  %69 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  br i1 %69, label %.lr.ph78.preheader, label %._crit_edge

.lr.ph78.preheader:                               ; preds = %66
  %70 = sext i32 %2 to i64
  br label %.lr.ph78

._crit_edge:                                      ; preds = %.thread, %66
  %.060.lcssa = phi i64 [ 0, %66 ], [ %.161.lcssa, %.thread ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  br label %108

.lr.ph78:                                         ; preds = %.lr.ph78.preheader, %.thread
  %.06077 = phi i64 [ %.161.lcssa, %.thread ], [ 0, %.lr.ph78.preheader ]
  %71 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #4
  %72 = load i32, ptr %71, align 4, !tbaa !9
  %73 = load i32, ptr @_ZN3pcf3lenE, align 4, !tbaa !9
  %74 = icmp sgt i32 %73, %2
  br i1 %74, label %.lr.ph, label %.thread

.lr.ph:                                           ; preds = %.lr.ph78
  %75 = add nsw i32 %72, -1
  br label %76

76:                                               ; preds = %.lr.ph, %102
  %indvars.iv = phi i64 [ %70, %.lr.ph ], [ %indvars.iv.next.pre-phi, %102 ]
  %.16171 = phi i64 [ %.06077, %.lr.ph ], [ %.2, %102 ]
  %77 = getelementptr inbounds [1000010 x i32], ptr @_ZN3pcf6primesE, i64 0, i64 %indvars.iv
  %78 = load i32, ptr %77, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = call noundef i64 @_Z5powerxi(i64 noundef %79, i32 noundef %75)
  %81 = icmp sgt i64 %80, %0
  br i1 %81, label %.thread, label %82

82:                                               ; preds = %76
  %83 = sdiv i32 %1, %72
  %84 = icmp eq i32 %83, 1
  br i1 %84, label %85, label %87

85:                                               ; preds = %82
  %86 = add nsw i64 %.16171, 1
  %.pre = add nsw i64 %indvars.iv, 1
  br label %102

87:                                               ; preds = %82
  %88 = add nsw i64 %indvars.iv, 1
  %89 = getelementptr inbounds [1000010 x i32], ptr @_ZN3pcf6primesE, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !9
  %91 = sext i32 %90 to i64
  %92 = sext i32 %83 to i64
  %93 = getelementptr inbounds [2020 x i32], ptr @s, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !9
  %95 = call noundef i64 @_Z5powerxi(i64 noundef %91, i32 noundef %94)
  %96 = sdiv i64 %0, %80
  %97 = icmp sgt i64 %95, %96
  br i1 %97, label %.thread, label %98

98:                                               ; preds = %87
  %99 = trunc nsw i64 %88 to i32
  %100 = call noundef i64 @_Z9backtrackxii(i64 noundef %96, i32 noundef %83, i32 noundef %99)
  %101 = add nsw i64 %100, %.16171
  br label %102

102:                                              ; preds = %85, %98
  %indvars.iv.next.pre-phi = phi i64 [ %.pre, %85 ], [ %88, %98 ]
  %.2 = phi i64 [ %86, %85 ], [ %101, %98 ]
  %103 = load i32, ptr @_ZN3pcf3lenE, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = icmp slt i64 %indvars.iv.next.pre-phi, %104
  br i1 %105, label %76, label %.thread, !llvm.loop !13

.thread:                                          ; preds = %102, %76, %87, %.lr.ph78
  %.161.lcssa = phi i64 [ %.06077, %.lr.ph78 ], [ %.16171, %87 ], [ %.16171, %76 ], [ %.2, %102 ]
  %106 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #4
  %107 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  br i1 %107, label %.lr.ph78, label %._crit_edge

108:                                              ; preds = %31, %27, %12, %10, %3, %._crit_edge, %._crit_edge86, %16
  %.0 = phi i64 [ %21, %16 ], [ %65, %._crit_edge86 ], [ %.060.lcssa, %._crit_edge ], [ 0, %3 ], [ 1, %10 ], [ 0, %12 ], [ 0, %27 ], [ 0, %31 ]
  ret i64 %.0
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3powIxdEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i64 noundef, double 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 #3

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

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 = { 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}


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