; LLVM IR from kimwalisch/primesieve :: src/nthPrime.ll (ZN10primesieve10PrimeSieve8nthPrimeElm)

; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.0 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.0 = type { i64, [8 x i8] }
%"class.std::chrono::time_point" = type { %"class.std::chrono::duration" }
%"class.std::chrono::duration" = type { i64 }
%"struct.primesieve::iterator" = type { i64, i64, i64, i64, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"class.std::chrono::duration.1" = type { double }
%"class.primesieve::PrimeSieve" = type { ptr, i64, i64, double, double, %"class.primesieve::Array", i64, i64, i32, i32, ptr }
%"class.primesieve::Array" = type { [6 x i64] }

@.str = external hidden unnamed_addr constant [28 x i8], align 1
@_ZTIN10primesieve16primesieve_errorE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZN12_GLOBAL__N_15max_nE = external hidden constant i64, align 8
@.str.1 = external hidden unnamed_addr constant [54 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN10primesieve10PrimeSieve8nthPrimeElm(ptr noundef nonnull align 8 dereferenceable(120) %0, i64 noundef %1, i64 noundef %2) #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca %"class.std::__cxx11::basic_string", align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i1, align 1
  %13 = alloca %"class.std::chrono::time_point", align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca %"struct.primesieve::iterator", align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca %"struct.primesieve::iterator", align 8
  %25 = alloca i64, align 8
  %26 = alloca %"class.std::__cxx11::basic_string", align 8
  %27 = alloca %"class.std::allocator", align 1
  %28 = alloca i1, align 1
  %29 = alloca %"class.std::chrono::time_point", align 8
  %30 = alloca %"class.std::chrono::duration.1", align 8
  %31 = alloca %"class.std::chrono::duration", align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store i64 %2, ptr %7, align 8, !tbaa !9
  %32 = load ptr, ptr %5, align 8
  %33 = load i64, ptr %6, align 8, !tbaa !9
  %34 = icmp slt i64 %33, 0
  br i1 %34, label %35, label %39

35:                                               ; preds = %3
  %36 = load i64, ptr %6, align 8, !tbaa !9
  %37 = load i64, ptr %7, align 8, !tbaa !9
  %38 = call noundef i64 @_ZN10primesieve10PrimeSieve16negativeNthPrimeElm(ptr noundef nonnull align 8 dereferenceable(120) %32, i64 noundef %36, i64 noundef %37)
  store i64 %38, ptr %4, align 8
  br label %200

39:                                               ; preds = %3
  %40 = load i64, ptr %6, align 8, !tbaa !9
  %41 = icmp eq i64 %40, 0
  br i1 %41, label %42, label %43

42:                                               ; preds = %39
  store i64 1, ptr %6, align 8, !tbaa !9
  br label %69

43:                                               ; preds = %39
  %44 = load i64, ptr %6, align 8, !tbaa !9
  %45 = icmp ugt i64 %44, 425656284035217743
  br i1 %45, label %46, label %68

46:                                               ; preds = %43
  store i1 true, ptr %12, align 1
  %47 = call ptr @__cxa_allocate_exception(i64 16) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #8
  invoke void @_ZNSt7__cxx119to_stringEm(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %9, i64 noundef 425656284035217743)
          to label %48 unwind label %51

48:                                               ; preds = %46
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_OS8_(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %8, ptr noundef @.str, ptr noundef nonnull align 8 dereferenceable(32) %9)
          to label %49 unwind label %55

49:                                               ; preds = %48
  invoke void @_ZN10primesieve16primesieve_errorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %47, ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %50 unwind label %59

50:                                               ; preds = %49
  store i1 false, ptr %12, align 1
  invoke void @__cxa_throw(ptr %47, ptr @_ZTIN10primesieve16primesieve_errorE, ptr @_ZNSt13runtime_errorD2Ev) #9
          to label %207 unwind label %59

51:                                               ; preds = %46
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %10, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %11, align 4
  br label %64

55:                                               ; preds = %48
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %10, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %11, align 4
  br label %63

59:                                               ; preds = %50, %49
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %10, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %11, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #8
  br label %63

63:                                               ; preds = %59, %55
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #8
  br label %64

64:                                               ; preds = %63, %51
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #8
  %65 = load i1, ptr %12, align 1
  br i1 %65, label %66, label %67

66:                                               ; preds = %64
  call void @__cxa_free_exception(ptr %47) #8
  br label %67

67:                                               ; preds = %66, %64
  br label %202

68:                                               ; preds = %43
  br label %69

69:                                               ; preds = %68, %42
  br label %70

70:                                               ; preds = %69
  %71 = load i64, ptr %7, align 8, !tbaa !9
  call void @_ZN10primesieve10PrimeSieve8setStartEm(ptr noundef nonnull align 8 dereferenceable(120) %32, i64 noundef %71)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %72 = call i64 @_ZNSt6chrono3_V212system_clock3nowEv() #8
  %73 = getelementptr inbounds %"class.std::chrono::time_point", ptr %13, i32 0, i32 0
  %74 = getelementptr inbounds %"class.std::chrono::duration", ptr %73, i32 0, i32 0
  store i64 %72, ptr %74, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %75 = load i64, ptr %7, align 8, !tbaa !9
  %76 = call noundef i64 @_ZN10primesieve13primePiApproxEm(i64 noundef %75)
  %77 = load i64, ptr %6, align 8, !tbaa !9
  %78 = call noundef i64 @_ZN12_GLOBAL__N_110checkedAddEmm(i64 noundef %76, i64 noundef %77)
  store i64 %78, ptr %14, align 8, !tbaa !9
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) @_ZN12_GLOBAL__N_15max_nE)
  %80 = load i64, ptr %79, align 8, !tbaa !9
  store i64 %80, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %81 = load i64, ptr %14, align 8, !tbaa !9
  %82 = call noundef i64 @_ZN10primesieve14nthPrimeApproxEm(i64 noundef %81)
  store i64 %82, ptr %15, align 8, !tbaa !9
  %83 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %84 = load i64, ptr %83, align 8, !tbaa !9
  store i64 %84, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  store i64 0, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  store i64 0, ptr %17, align 8, !tbaa !9
  %85 = load i64, ptr %15, align 8, !tbaa !9
  %86 = load i64, ptr %7, align 8, !tbaa !9
  %87 = sub i64 %85, %86
  %88 = load i64, ptr %15, align 8, !tbaa !9
  %89 = call noundef i64 @_ZN12_GLOBAL__N_15isqrtImEET_S1_(i64 noundef %88)
  %90 = udiv i64 %89, 10
  %91 = icmp ugt i64 %87, %90
  br i1 %91, label %92, label %101

92:                                               ; preds = %70
  %93 = load i64, ptr %7, align 8, !tbaa !9
  %94 = call noundef i64 @_ZN12_GLOBAL__N_110checkedAddEmm(i64 noundef %93, i64 noundef 1)
  store i64 %94, ptr %7, align 8, !tbaa !9
  %95 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %15)
  %96 = load i64, ptr %95, align 8, !tbaa !9
  store i64 %96, ptr %15, align 8, !tbaa !9
  %97 = load i64, ptr %7, align 8, !tbaa !9
  %98 = load i64, ptr %15, align 8, !tbaa !9
  %99 = call noundef i64 @_ZN10primesieve10PrimeSieve11countPrimesEmm(ptr noundef nonnull align 8 dereferenceable(120) %32, i64 noundef %97, i64 noundef %98)
  store i64 %99, ptr %16, align 8, !tbaa !9
  %100 = load i64, ptr %15, align 8, !tbaa !9
  store i64 %100, ptr %7, align 8, !tbaa !9
  br label %101

101:                                              ; preds = %92, %70
  %102 = load i64, ptr %16, align 8, !tbaa !9
  %103 = load i64, ptr %6, align 8, !tbaa !9
  %104 = icmp slt i64 %102, %103
  br i1 %104, label %105, label %136

105:                                              ; preds = %101
  %106 = load i64, ptr %7, align 8, !tbaa !9
  %107 = call noundef i64 @_ZN12_GLOBAL__N_110checkedAddEmm(i64 noundef %106, i64 noundef 1)
  store i64 %107, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %108 = load i64, ptr %6, align 8, !tbaa !9
  %109 = load i64, ptr %16, align 8, !tbaa !9
  %110 = sub nsw i64 %108, %109
  %111 = load i64, ptr %15, align 8, !tbaa !9
  %112 = call noundef i64 @_ZN12_GLOBAL__N_111avgPrimeGapEm(i64 noundef %111)
  %113 = mul i64 %110, %112
  store i64 %113, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %114 = load i64, ptr %7, align 8, !tbaa !9
  %115 = load i64, ptr %18, align 8, !tbaa !9
  %116 = call noundef i64 @_ZN12_GLOBAL__N_110checkedAddEmm(i64 noundef %114, i64 noundef %115)
  store i64 %116, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 48, ptr %20) #8
  %117 = load i64, ptr %7, align 8, !tbaa !9
  %118 = load i64, ptr %19, align 8, !tbaa !9
  call void @_ZN10primesieve8iteratorC1Emm(ptr noundef nonnull align 8 dereferenceable(48) %20, i64 noundef %117, i64 noundef %118) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %119 = load i64, ptr %16, align 8, !tbaa !9
  store i64 %119, ptr %21, align 8, !tbaa !9
  br label %120

120:                                              ; preds = %128, %105
  %121 = load i64, ptr %21, align 8, !tbaa !9
  %122 = load i64, ptr %6, align 8, !tbaa !9
  %123 = icmp slt i64 %121, %122
  br i1 %123, label %125, label %124

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

125:                                              ; preds = %120
  %126 = invoke noundef i64 @_ZN10primesieve8iterator10next_primeEv(ptr noundef nonnull align 8 dereferenceable(48) %20)
          to label %127 unwind label %131

127:                                              ; preds = %125
  store i64 %126, ptr %17, align 8, !tbaa !9
  br label %128

128:                                              ; preds = %127
  %129 = load i64, ptr %21, align 8, !tbaa !9
  %130 = add nsw i64 %129, 1
  store i64 %130, ptr %21, align 8, !tbaa !9
  br label %120, !llvm.loop !11

131:                                              ; preds = %125
  %132 = landingpad { ptr, i32 }
          cleanup
  %133 = extractvalue { ptr, i32 } %132, 0
  store ptr %133, ptr %10, align 8
  %134 = extractvalue { ptr, i32 } %132, 1
  store i32 %134, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  call void @_ZN10primesieve8iteratorD1Ev(ptr noundef nonnull align 8 dereferenceable(48) %20) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  br label %199

135:                                              ; preds = %124
  call void @_ZN10primesieve8iteratorD1Ev(ptr noundef nonnull align 8 dereferenceable(48) %20) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  br label %190

136:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  %137 = load i64, ptr %16, align 8, !tbaa !9
  %138 = load i64, ptr %6, align 8, !tbaa !9
  %139 = sub nsw i64 %137, %138
  %140 = load i64, ptr %15, align 8, !tbaa !9
  %141 = call noundef i64 @_ZN12_GLOBAL__N_111avgPrimeGapEm(i64 noundef %140)
  %142 = mul i64 %139, %141
  store i64 %142, ptr %22, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #8
  %143 = load i64, ptr %7, align 8, !tbaa !9
  %144 = load i64, ptr %22, align 8, !tbaa !9
  %145 = call noundef i64 @_ZN12_GLOBAL__N_110checkedSubEmm(i64 noundef %143, i64 noundef %144)
  store i64 %145, ptr %23, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 48, ptr %24) #8
  %146 = load i64, ptr %7, align 8, !tbaa !9
  %147 = load i64, ptr %23, align 8, !tbaa !9
  call void @_ZN10primesieve8iteratorC1Emm(ptr noundef nonnull align 8 dereferenceable(48) %24, i64 noundef %146, i64 noundef %147) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #8
  %148 = load i64, ptr %16, align 8, !tbaa !9
  store i64 %148, ptr %25, align 8, !tbaa !9
  br label %149

149:                                              ; preds = %185, %136
  %150 = load i64, ptr %25, align 8, !tbaa !9
  %151 = load i64, ptr %6, align 8, !tbaa !9
  %152 = icmp sge i64 %150, %151
  br i1 %152, label %154, label %153

153:                                              ; preds = %149
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  br label %189

154:                                              ; preds = %149
  %155 = invoke noundef i64 @_ZN10primesieve8iterator10prev_primeEv(ptr noundef nonnull align 8 dereferenceable(48) %24)
          to label %156 unwind label %168

156:                                              ; preds = %154
  store i64 %155, ptr %17, align 8, !tbaa !9
  %157 = load i64, ptr %17, align 8, !tbaa !9
  %158 = icmp eq i64 %157, 0
  %159 = xor i1 %158, true
  %160 = xor i1 %159, true
  %161 = zext i1 %160 to i64
  %162 = call i64 @llvm.expect.i64(i64 %161, i64 0)
  %163 = icmp ne i64 %162, 0
  br i1 %163, label %164, label %184

164:                                              ; preds = %156
  store i1 true, ptr %28, align 1
  %165 = call ptr @__cxa_allocate_exception(i64 16) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %26) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %27) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %27) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %26, ptr noundef @.str.1, ptr noundef nonnull align 1 dereferenceable(1) %27)
          to label %166 unwind label %172

166:                                              ; preds = %164
  invoke void @_ZN10primesieve16primesieve_errorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %165, ptr noundef nonnull align 8 dereferenceable(32) %26)
          to label %167 unwind label %176

167:                                              ; preds = %166
  store i1 false, ptr %28, align 1
  invoke void @__cxa_throw(ptr %165, ptr @_ZTIN10primesieve16primesieve_errorE, ptr @_ZNSt13runtime_errorD2Ev) #9
          to label %207 unwind label %176

168:                                              ; preds = %154
  %169 = landingpad { ptr, i32 }
          cleanup
  %170 = extractvalue { ptr, i32 } %169, 0
  store ptr %170, ptr %10, align 8
  %171 = extractvalue { ptr, i32 } %169, 1
  store i32 %171, ptr %11, align 4
  br label %188

172:                                              ; preds = %164
  %173 = landingpad { ptr, i32 }
          cleanup
  %174 = extractvalue { ptr, i32 } %173, 0
  store ptr %174, ptr %10, align 8
  %175 = extractvalue { ptr, i32 } %173, 1
  store i32 %175, ptr %11, align 4
  br label %180

176:                                              ; preds = %167, %166
  %177 = landingpad { ptr, i32 }
          cleanup
  %178 = extractvalue { ptr, i32 } %177, 0
  store ptr %178, ptr %10, align 8
  %179 = extractvalue { ptr, i32 } %177, 1
  store i32 %179, ptr %11, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %26) #8
  br label %180

180:                                              ; preds = %176, %172
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %27) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %27) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %26) #8
  %181 = load i1, ptr %28, align 1
  br i1 %181, label %182, label %183

182:                                              ; preds = %180
  call void @__cxa_free_exception(ptr %165) #8
  br label %183

183:                                              ; preds = %182, %180
  br label %188

184:                                              ; preds = %156
  br label %185

185:                                              ; preds = %184
  %186 = load i64, ptr %25, align 8, !tbaa !9
  %187 = add nsw i64 %186, -1
  store i64 %187, ptr %25, align 8, !tbaa !9
  br label %149, !llvm.loop !13

188:                                              ; preds = %183, %168
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  call void @_ZN10primesieve8iteratorD1Ev(ptr noundef nonnull align 8 dereferenceable(48) %24) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  br label %199

189:                                              ; preds = %153
  call void @_ZN10primesieve8iteratorD1Ev(ptr noundef nonnull align 8 dereferenceable(48) %24) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  br label %190

190:                                              ; preds = %189, %135
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #8
  %191 = call i64 @_ZNSt6chrono3_V212system_clock3nowEv() #8
  %192 = getelementptr inbounds %"class.std::chrono::time_point", ptr %29, i32 0, i32 0
  %193 = getelementptr inbounds %"class.std::chrono::duration", ptr %192, i32 0, i32 0
  store i64 %191, ptr %193, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #8
  %194 = call i64 @_ZNSt6chronomiINS_3_V212system_clockENS_8durationIlSt5ratioILl1ELl1000000000EEEES6_EENSt11common_typeIJT0_T1_EE4typeERKNS_10time_pointIT_S8_EERKNSC_ISD_S9_EE(ptr noundef nonnull align 8 dereferenceable(8) %29, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %195 = getelementptr inbounds %"class.std::chrono::duration", ptr %31, i32 0, i32 0
  store i64 %194, ptr %195, align 8
  call void @_ZNSt6chrono8durationIdSt5ratioILl1ELl1EEEC2IlS1_ILl1ELl1000000000EEvEERKNS0_IT_T0_EE(ptr noundef nonnull align 8 dereferenceable(8) %30, ptr noundef nonnull align 8 dereferenceable(8) %31)
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #8
  %196 = call noundef double @_ZNKSt6chrono8durationIdSt5ratioILl1ELl1EEE5countEv(ptr noundef nonnull align 8 dereferenceable(8) %30)
  %197 = getelementptr inbounds %"class.primesieve::PrimeSieve", ptr %32, i32 0, i32 3
  store double %196, ptr %197, align 8, !tbaa !14
  %198 = load i64, ptr %17, align 8, !tbaa !9
  store i64 %198, ptr %4, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %200

199:                                              ; preds = %188, %131
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %202

200:                                              ; preds = %190, %35
  %201 = load i64, ptr %4, align 8
  ret i64 %201

202:                                              ; preds = %199, %67
  %203 = load ptr, ptr %10, align 8
  %204 = load i32, ptr %11, align 4
  %205 = insertvalue { ptr, i32 } poison, ptr %203, 0
  %206 = insertvalue { ptr, i32 } %205, i32 %204, 1
  resume { ptr, i32 } %206

207:                                              ; preds = %167, %50
  unreachable
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN10primesieve10PrimeSieve16negativeNthPrimeElm(ptr noundef nonnull align 8 dereferenceable(120), i64 noundef, i64 noundef) #0 align 2

declare ptr @__cxa_allocate_exception(i64)

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_OS8_(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef, ptr noundef nonnull align 8 dereferenceable(32)) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt7__cxx119to_stringEm(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, i64 noundef) #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10primesieve16primesieve_errorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: nounwind
declare void @_ZNSt13runtime_errorD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

declare void @__cxa_throw(ptr, ptr, ptr)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #4 align 2

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

declare void @__cxa_free_exception(ptr)

declare void @_ZN10primesieve10PrimeSieve8setStartEm(ptr noundef nonnull align 8 dereferenceable(120), i64 noundef) #5

; Function Attrs: nounwind
declare i64 @_ZNSt6chrono3_V212system_clock3nowEv() #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN12_GLOBAL__N_110checkedAddEmm(i64 noundef, i64 noundef) #6

declare noundef i64 @_ZN10primesieve13primePiApproxEm(i64 noundef) #5

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

declare noundef i64 @_ZN10primesieve14nthPrimeApproxEm(i64 noundef) #5

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN12_GLOBAL__N_15isqrtImEET_S1_(i64 noundef) #6

declare noundef i64 @_ZN10primesieve10PrimeSieve11countPrimesEmm(ptr noundef nonnull align 8 dereferenceable(120), i64 noundef, i64 noundef) #5

; Function Attrs: mustprogress uwtable
declare hidden noundef i64 @_ZN12_GLOBAL__N_111avgPrimeGapEm(i64 noundef) #0

; Function Attrs: nounwind
declare void @_ZN10primesieve8iteratorC1Emm(ptr noundef nonnull align 8 dereferenceable(48), i64 noundef, i64 noundef) unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN10primesieve8iterator10next_primeEv(ptr noundef nonnull align 8 dereferenceable(48)) #0 align 2

; Function Attrs: nounwind
declare void @_ZN10primesieve8iteratorD1Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN12_GLOBAL__N_110checkedSubEmm(i64 noundef, i64 noundef) #6

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN10primesieve8iterator10prev_primeEv(ptr noundef nonnull align 8 dereferenceable(48)) #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZNSt6chronomiINS_3_V212system_clockENS_8durationIlSt5ratioILl1ELl1000000000EEEES6_EENSt11common_typeIJT0_T1_EE4typeERKNS_10time_pointIT_S8_EERKNSC_ISD_S9_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6chrono8durationIdSt5ratioILl1ELl1EEEC2IlS1_ILl1ELl1000000000EEvEERKNS0_IT_T0_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 2

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

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

!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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !16, i64 24}
!15 = !{!"_ZTSN10primesieve10PrimeSieveE", !10, i64 8, !10, i64 16, !16, i64 24, !16, i64 32, !17, i64 40, !10, i64 88, !10, i64 96, !18, i64 104, !18, i64 108, !6, i64 112}
!16 = !{!"double", !7, i64 0}
!17 = !{!"_ZTSN10primesieve5ArrayImLm6EEE", !7, i64 0}
!18 = !{!"int", !7, i64 0}


; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.0 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.0 = type { i64, [8 x i8] }
%"class.std::chrono::time_point" = type { %"class.std::chrono::duration" }
%"class.std::chrono::duration" = type { i64 }
%"struct.primesieve::iterator" = type { i64, i64, i64, i64, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"class.std::chrono::duration.1" = type { double }

@.str = external hidden unnamed_addr constant [28 x i8], align 1
@_ZTIN10primesieve16primesieve_errorE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZN12_GLOBAL__N_15max_nE = external hidden constant i64, align 8
@.str.1 = external hidden unnamed_addr constant [54 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN10primesieve10PrimeSieve8nthPrimeElm(ptr noundef nonnull align 8 dereferenceable(120) %0, i64 noundef %1, i64 noundef %2) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i64, align 8
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  %7 = alloca %"class.std::chrono::time_point", align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca %"struct.primesieve::iterator", align 8
  %11 = alloca %"struct.primesieve::iterator", align 8
  %12 = alloca %"class.std::__cxx11::basic_string", align 8
  %13 = alloca %"class.std::allocator", align 1
  %14 = alloca %"class.std::chrono::time_point", align 8
  %15 = alloca %"class.std::chrono::duration.1", align 8
  %16 = alloca %"class.std::chrono::duration", align 8
  store i64 %2, ptr %4, align 8, !tbaa !5
  %17 = icmp slt i64 %1, 0
  br i1 %17, label %18, label %20

18:                                               ; preds = %3
  %19 = tail call noundef i64 @_ZN10primesieve10PrimeSieve16negativeNthPrimeElm(ptr noundef nonnull align 8 dereferenceable(120) %0, i64 noundef %1, i64 noundef %2)
  br label %107

20:                                               ; preds = %3
  %21 = icmp eq i64 %1, 0
  br i1 %21, label %34, label %22

22:                                               ; preds = %20
  %23 = icmp ugt i64 %1, 425656284035217743
  br i1 %23, label %24, label %34

24:                                               ; preds = %22
  %25 = tail call ptr @__cxa_allocate_exception(i64 16) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #7
  invoke void @_ZNSt7__cxx119to_stringEm(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %6, i64 noundef 425656284035217743)
          to label %26 unwind label %.thread

26:                                               ; preds = %24
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_OS8_(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %5, ptr noundef nonnull @.str, ptr noundef nonnull align 8 dereferenceable(32) %6)
          to label %27 unwind label %.thread63

27:                                               ; preds = %26
  invoke void @_ZN10primesieve16primesieve_errorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %28 unwind label %31

28:                                               ; preds = %27
  invoke void @__cxa_throw(ptr nonnull %25, ptr nonnull @_ZTIN10primesieve16primesieve_errorE, ptr nonnull @_ZNSt13runtime_errorD2Ev) #8
          to label %109 unwind label %31

.thread:                                          ; preds = %24
  %29 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #7
  br label %33

.thread63:                                        ; preds = %26
  %30 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #7
  br label %33

31:                                               ; preds = %27, %28
  %.046 = phi i1 [ false, %28 ], [ true, %27 ]
  %32 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #7
  br i1 %.046, label %33, label %108

33:                                               ; preds = %.thread63, %.thread, %31
  %.pn.pn62 = phi { ptr, i32 } [ %29, %.thread ], [ %32, %31 ], [ %30, %.thread63 ]
  call void @__cxa_free_exception(ptr %25) #7
  br label %108

34:                                               ; preds = %20, %22
  %.032 = phi i64 [ %1, %22 ], [ 1, %20 ]
  tail call void @_ZN10primesieve10PrimeSieve8setStartEm(ptr noundef nonnull align 8 dereferenceable(120) %0, i64 noundef %2)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %35 = tail call i64 @_ZNSt6chrono3_V212system_clock3nowEv() #7
  store i64 %35, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %36 = tail call noundef i64 @_ZN10primesieve13primePiApproxEm(i64 noundef %2)
  %37 = tail call noundef i64 @_ZN12_GLOBAL__N_110checkedAddEmm(i64 noundef %36, i64 noundef %.032)
  store i64 %37, ptr %8, align 8, !tbaa !5
  %38 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) @_ZN12_GLOBAL__N_15max_nE)
  %39 = load i64, ptr %38, align 8, !tbaa !5
  store i64 %39, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #7
  %40 = call noundef i64 @_ZN10primesieve14nthPrimeApproxEm(i64 noundef %39)
  store i64 %40, ptr %9, align 8, !tbaa !5
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %42 = load i64, ptr %41, align 8, !tbaa !5
  store i64 %42, ptr %9, align 8, !tbaa !5
  %43 = load i64, ptr %4, align 8, !tbaa !5
  %44 = sub i64 %42, %43
  %45 = call noundef i64 @_ZN12_GLOBAL__N_15isqrtImEET_S1_(i64 noundef %42)
  %46 = udiv i64 %45, 10
  %47 = icmp ugt i64 %44, %46
  br i1 %47, label %48, label %56

48:                                               ; preds = %34
  %49 = load i64, ptr %4, align 8, !tbaa !5
  %50 = call noundef i64 @_ZN12_GLOBAL__N_110checkedAddEmm(i64 noundef %49, i64 noundef 1)
  store i64 %50, ptr %4, align 8, !tbaa !5
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %52 = load i64, ptr %51, align 8, !tbaa !5
  store i64 %52, ptr %9, align 8, !tbaa !5
  %53 = load i64, ptr %4, align 8, !tbaa !5
  %54 = call noundef i64 @_ZN10primesieve10PrimeSieve11countPrimesEmm(ptr noundef nonnull align 8 dereferenceable(120) %0, i64 noundef %53, i64 noundef %52)
  %55 = load i64, ptr %9, align 8, !tbaa !5
  store i64 %55, ptr %4, align 8, !tbaa !5
  br label %56

56:                                               ; preds = %48, %34
  %.045 = phi i64 [ %54, %48 ], [ 0, %34 ]
  %57 = icmp slt i64 %.045, %.032
  br i1 %57, label %58, label %75

58:                                               ; preds = %56
  %59 = load i64, ptr %4, align 8, !tbaa !5
  %60 = call noundef i64 @_ZN12_GLOBAL__N_110checkedAddEmm(i64 noundef %59, i64 noundef 1)
  store i64 %60, ptr %4, align 8, !tbaa !5
  %61 = sub nsw i64 %.032, %.045
  %62 = load i64, ptr %9, align 8, !tbaa !5
  %63 = call noundef i64 @_ZN12_GLOBAL__N_111avgPrimeGapEm(i64 noundef %62)
  %64 = mul i64 %63, %61
  %65 = load i64, ptr %4, align 8, !tbaa !5
  %66 = call noundef i64 @_ZN12_GLOBAL__N_110checkedAddEmm(i64 noundef %65, i64 noundef %64)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %10) #7
  %67 = load i64, ptr %4, align 8, !tbaa !5
  call void @_ZN10primesieve8iteratorC1Emm(ptr noundef nonnull align 8 dereferenceable(48) %10, i64 noundef %67, i64 noundef %66) #7
  br label %69

68:                                               ; preds = %71
  call void @_ZN10primesieve8iteratorD1Ev(ptr noundef nonnull align 8 dereferenceable(48) %10) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %10) #7
  br label %101

69:                                               ; preds = %58, %71
  %.03374 = phi i64 [ %.045, %58 ], [ %72, %71 ]
  %70 = invoke noundef i64 @_ZN10primesieve8iterator10next_primeEv(ptr noundef nonnull align 8 dereferenceable(48) %10)
          to label %71 unwind label %73

71:                                               ; preds = %69
  %72 = add i64 %.03374, 1
  %exitcond.not = icmp eq i64 %72, %.032
  br i1 %exitcond.not, label %68, label %69, !llvm.loop !9

73:                                               ; preds = %69
  %74 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN10primesieve8iteratorD1Ev(ptr noundef nonnull align 8 dereferenceable(48) %10) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %10) #7
  br label %106

75:                                               ; preds = %56
  %76 = sub nsw i64 %.045, %.032
  %77 = load i64, ptr %9, align 8, !tbaa !5
  %78 = call noundef i64 @_ZN12_GLOBAL__N_111avgPrimeGapEm(i64 noundef %77)
  %79 = mul i64 %78, %76
  %80 = load i64, ptr %4, align 8, !tbaa !5
  %81 = call noundef i64 @_ZN12_GLOBAL__N_110checkedSubEmm(i64 noundef %80, i64 noundef %79)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %11) #7
  %82 = load i64, ptr %4, align 8, !tbaa !5
  call void @_ZN10primesieve8iteratorC1Emm(ptr noundef nonnull align 8 dereferenceable(48) %11, i64 noundef %82, i64 noundef %81) #7
  br label %86

83:                                               ; preds = %88
  %84 = add nsw i64 %.03073, -1
  %.not.not = icmp sgt i64 %.03073, %.032
  br i1 %.not.not, label %86, label %85, !llvm.loop !11

85:                                               ; preds = %83
  call void @_ZN10primesieve8iteratorD1Ev(ptr noundef nonnull align 8 dereferenceable(48) %11) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %11) #7
  br label %101

86:                                               ; preds = %75, %83
  %.03073 = phi i64 [ %.045, %75 ], [ %84, %83 ]
  %87 = invoke noundef i64 @_ZN10primesieve8iterator10prev_primeEv(ptr noundef nonnull align 8 dereferenceable(48) %11)
          to label %88 unwind label %94

88:                                               ; preds = %86
  %89 = icmp eq i64 %87, 0
  br i1 %89, label %90, label %83, !prof !12

90:                                               ; preds = %88
  %91 = call ptr @__cxa_allocate_exception(i64 16) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %12) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %13) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull @.str.1, ptr noundef nonnull align 1 dereferenceable(1) %13)
          to label %92 unwind label %.thread66

92:                                               ; preds = %90
  invoke void @_ZN10primesieve16primesieve_errorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %91, ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %93 unwind label %97

93:                                               ; preds = %92
  invoke void @__cxa_throw(ptr nonnull %91, ptr nonnull @_ZTIN10primesieve16primesieve_errorE, ptr nonnull @_ZNSt13runtime_errorD2Ev) #8
          to label %109 unwind label %97

94:                                               ; preds = %86
  %95 = landingpad { ptr, i32 }
          cleanup
  br label %100

.thread66:                                        ; preds = %90
  %96 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %13) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #7
  br label %99

97:                                               ; preds = %92, %93
  %.0 = phi i1 [ false, %93 ], [ true, %92 ]
  %98 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #7
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %13) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #7
  br i1 %.0, label %99, label %100

99:                                               ; preds = %.thread66, %97
  %.pn5469 = phi { ptr, i32 } [ %96, %.thread66 ], [ %98, %97 ]
  call void @__cxa_free_exception(ptr %91) #7
  br label %100

100:                                              ; preds = %97, %99, %94
  %.pn54.pn = phi { ptr, i32 } [ %.pn5469, %99 ], [ %98, %97 ], [ %95, %94 ]
  call void @_ZN10primesieve8iteratorD1Ev(ptr noundef nonnull align 8 dereferenceable(48) %11) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %11) #7
  br label %106

101:                                              ; preds = %85, %68
  %.244 = phi i64 [ %70, %68 ], [ %87, %85 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #7
  %102 = call i64 @_ZNSt6chrono3_V212system_clock3nowEv() #7
  store i64 %102, ptr %14, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #7
  %103 = call i64 @_ZNSt6chronomiINS_3_V212system_clockENS_8durationIlSt5ratioILl1ELl1000000000EEEES6_EENSt11common_typeIJT0_T1_EE4typeERKNS_10time_pointIT_S8_EERKNSC_ISD_S9_EE(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %7)
  store i64 %103, ptr %16, align 8
  call void @_ZNSt6chrono8durationIdSt5ratioILl1ELl1EEEC2IlS1_ILl1ELl1000000000EEvEERKNS0_IT_T0_EE(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %16)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #7
  %104 = call noundef double @_ZNKSt6chrono8durationIdSt5ratioILl1ELl1EEE5countEv(ptr noundef nonnull align 8 dereferenceable(8) %15)
  %105 = getelementptr inbounds i8, ptr %0, i64 24
  store double %104, ptr %105, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  br label %107

106:                                              ; preds = %100, %73
  %.pn57 = phi { ptr, i32 } [ %74, %73 ], [ %.pn54.pn, %100 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  br label %108

107:                                              ; preds = %101, %18
  %.031 = phi i64 [ %19, %18 ], [ %.244, %101 ]
  ret i64 %.031

108:                                              ; preds = %31, %33, %106
  %.pn57.pn = phi { ptr, i32 } [ %.pn57, %106 ], [ %.pn.pn62, %33 ], [ %32, %31 ]
  resume { ptr, i32 } %.pn57.pn

109:                                              ; preds = %93, %28
  unreachable
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN10primesieve10PrimeSieve16negativeNthPrimeElm(ptr noundef nonnull align 8 dereferenceable(120), i64 noundef, i64 noundef) local_unnamed_addr #0 align 2

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_OS8_(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt7__cxx119to_stringEm(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, i64 noundef) local_unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10primesieve16primesieve_errorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: nounwind
declare void @_ZNSt13runtime_errorD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #4 align 2

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

declare void @__cxa_free_exception(ptr) local_unnamed_addr

declare void @_ZN10primesieve10PrimeSieve8setStartEm(ptr noundef nonnull align 8 dereferenceable(120), i64 noundef) local_unnamed_addr #5

; Function Attrs: nounwind
declare i64 @_ZNSt6chrono3_V212system_clock3nowEv() local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN12_GLOBAL__N_110checkedAddEmm(i64 noundef, i64 noundef) local_unnamed_addr #6

declare noundef i64 @_ZN10primesieve13primePiApproxEm(i64 noundef) local_unnamed_addr #5

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

declare noundef i64 @_ZN10primesieve14nthPrimeApproxEm(i64 noundef) local_unnamed_addr #5

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN12_GLOBAL__N_15isqrtImEET_S1_(i64 noundef) local_unnamed_addr #6

declare noundef i64 @_ZN10primesieve10PrimeSieve11countPrimesEmm(ptr noundef nonnull align 8 dereferenceable(120), i64 noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare hidden noundef i64 @_ZN12_GLOBAL__N_111avgPrimeGapEm(i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind
declare void @_ZN10primesieve8iteratorC1Emm(ptr noundef nonnull align 8 dereferenceable(48), i64 noundef, i64 noundef) unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN10primesieve8iterator10next_primeEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #0 align 2

; Function Attrs: nounwind
declare void @_ZN10primesieve8iteratorD1Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN12_GLOBAL__N_110checkedSubEmm(i64 noundef, i64 noundef) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN10primesieve8iterator10prev_primeEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZNSt6chronomiINS_3_V212system_clockENS_8durationIlSt5ratioILl1ELl1000000000EEEES6_EENSt11common_typeIJT0_T1_EE4typeERKNS_10time_pointIT_S8_EERKNSC_ISD_S9_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6chrono8durationIdSt5ratioILl1ELl1EEEC2IlS1_ILl1ELl1000000000EEvEERKNS0_IT_T0_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 2

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

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

!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 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!13 = !{!14, !15, i64 24}
!14 = !{!"_ZTSN10primesieve10PrimeSieveE", !6, i64 8, !6, i64 16, !15, i64 24, !15, i64 32, !16, i64 40, !6, i64 88, !6, i64 96, !17, i64 104, !17, i64 108, !18, i64 112}
!15 = !{!"double", !7, i64 0}
!16 = !{!"_ZTSN10primesieve5ArrayImLm6EEE", !7, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{!"any pointer", !7, i64 0}


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