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

; 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::allocator" = type { 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::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] }

@_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
@.str.2 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [33 x i8], align 1

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

40:                                               ; preds = %3
  store i1 true, ptr %11, align 1
  %41 = call ptr @__cxa_allocate_exception(i64 16) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef @.str.2, ptr noundef nonnull align 1 dereferenceable(1) %8)
          to label %42 unwind label %44

42:                                               ; preds = %40
  invoke void @_ZN10primesieve16primesieve_errorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %41, ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %43 unwind label %48

43:                                               ; preds = %42
  store i1 false, ptr %11, align 1
  invoke void @__cxa_throw(ptr %41, ptr @_ZTIN10primesieve16primesieve_errorE, ptr @_ZNSt13runtime_errorD2Ev) #9
          to label %217 unwind label %48

44:                                               ; preds = %40
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %9, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %10, align 4
  br label %52

48:                                               ; preds = %43, %42
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %9, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %10, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #8
  br label %52

52:                                               ; preds = %48, %44
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #8
  %53 = load i1, ptr %11, align 1
  br i1 %53, label %54, label %55

54:                                               ; preds = %52
  call void @__cxa_free_exception(ptr %41) #8
  br label %55

55:                                               ; preds = %54, %52
  br label %212

56:                                               ; preds = %3
  %57 = load i64, ptr %5, align 8, !tbaa !9
  %58 = icmp ugt i64 %57, 425656284035217743
  br i1 %58, label %59, label %81

59:                                               ; preds = %56
  store i1 true, ptr %14, align 1
  %60 = call ptr @__cxa_allocate_exception(i64 16) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #8
  invoke void @_ZNSt7__cxx119to_stringEm(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %13, i64 noundef 425656284035217743)
          to label %61 unwind label %64

61:                                               ; preds = %59
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_OS8_(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %12, ptr noundef @.str.3, ptr noundef nonnull align 8 dereferenceable(32) %13)
          to label %62 unwind label %68

62:                                               ; preds = %61
  invoke void @_ZN10primesieve16primesieve_errorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %60, ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %63 unwind label %72

63:                                               ; preds = %62
  store i1 false, ptr %14, align 1
  invoke void @__cxa_throw(ptr %60, ptr @_ZTIN10primesieve16primesieve_errorE, ptr @_ZNSt13runtime_errorD2Ev) #9
          to label %217 unwind label %72

64:                                               ; preds = %59
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %9, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %10, align 4
  br label %77

68:                                               ; preds = %61
  %69 = landingpad { ptr, i32 }
          cleanup
  %70 = extractvalue { ptr, i32 } %69, 0
  store ptr %70, ptr %9, align 8
  %71 = extractvalue { ptr, i32 } %69, 1
  store i32 %71, ptr %10, align 4
  br label %76

72:                                               ; preds = %63, %62
  %73 = landingpad { ptr, i32 }
          cleanup
  %74 = extractvalue { ptr, i32 } %73, 0
  store ptr %74, ptr %9, align 8
  %75 = extractvalue { ptr, i32 } %73, 1
  store i32 %75, ptr %10, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #8
  br label %76

76:                                               ; preds = %72, %68
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #8
  br label %77

77:                                               ; preds = %76, %64
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #8
  %78 = load i1, ptr %14, align 1
  br i1 %78, label %79, label %80

79:                                               ; preds = %77
  call void @__cxa_free_exception(ptr %60) #8
  br label %80

80:                                               ; preds = %79, %77
  br label %212

81:                                               ; preds = %56
  br label %82

82:                                               ; preds = %81
  %83 = load i64, ptr %6, align 8, !tbaa !9
  call void @_ZN10primesieve10PrimeSieve8setStartEm(ptr noundef nonnull align 8 dereferenceable(120) %34, i64 noundef %83)
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %84 = call i64 @_ZNSt6chrono3_V212system_clock3nowEv() #8
  %85 = getelementptr inbounds %"class.std::chrono::time_point", ptr %15, i32 0, i32 0
  %86 = getelementptr inbounds %"class.std::chrono::duration", ptr %85, i32 0, i32 0
  store i64 %84, ptr %86, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %87 = load i64, ptr %6, align 8, !tbaa !9
  %88 = call noundef i64 @_ZN10primesieve13primePiApproxEm(i64 noundef %87)
  %89 = load i64, ptr %5, align 8, !tbaa !9
  %90 = call noundef i64 @_ZN12_GLOBAL__N_110checkedSubEmm(i64 noundef %88, i64 noundef %89)
  store i64 %90, ptr %16, align 8, !tbaa !9
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) @_ZN12_GLOBAL__N_15max_nE)
  %92 = load i64, ptr %91, align 8, !tbaa !9
  store i64 %92, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %93 = load i64, ptr %16, align 8, !tbaa !9
  %94 = call noundef i64 @_ZN10primesieve14nthPrimeApproxEm(i64 noundef %93)
  store i64 %94, ptr %17, align 8, !tbaa !9
  %95 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %96 = load i64, ptr %95, align 8, !tbaa !9
  store i64 %96, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  store i64 0, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  store i64 0, ptr %19, align 8, !tbaa !9
  %97 = load i64, ptr %6, align 8, !tbaa !9
  %98 = load i64, ptr %17, align 8, !tbaa !9
  %99 = sub i64 %97, %98
  %100 = load i64, ptr %6, align 8, !tbaa !9
  %101 = call noundef i64 @_ZN12_GLOBAL__N_15isqrtImEET_S1_(i64 noundef %100)
  %102 = udiv i64 %101, 10
  %103 = icmp ugt i64 %99, %102
  br i1 %103, label %104, label %113

104:                                              ; preds = %82
  %105 = load i64, ptr %6, align 8, !tbaa !9
  %106 = call noundef i64 @_ZN12_GLOBAL__N_110checkedSubEmm(i64 noundef %105, i64 noundef 1)
  store i64 %106, ptr %6, align 8, !tbaa !9
  %107 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %108 = load i64, ptr %107, align 8, !tbaa !9
  store i64 %108, ptr %17, align 8, !tbaa !9
  %109 = load i64, ptr %17, align 8, !tbaa !9
  %110 = load i64, ptr %6, align 8, !tbaa !9
  %111 = call noundef i64 @_ZN10primesieve10PrimeSieve11countPrimesEmm(ptr noundef nonnull align 8 dereferenceable(120) %34, i64 noundef %109, i64 noundef %110)
  store i64 %111, ptr %19, align 8, !tbaa !9
  %112 = load i64, ptr %17, align 8, !tbaa !9
  store i64 %112, ptr %6, align 8, !tbaa !9
  br label %113

113:                                              ; preds = %104, %82
  %114 = load i64, ptr %19, align 8, !tbaa !9
  %115 = load i64, ptr %5, align 8, !tbaa !9
  %116 = icmp sge i64 %114, %115
  br i1 %116, label %117, label %146

117:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  %118 = load i64, ptr %19, align 8, !tbaa !9
  %119 = load i64, ptr %5, align 8, !tbaa !9
  %120 = sub nsw i64 %118, %119
  %121 = load i64, ptr %6, align 8, !tbaa !9
  %122 = call noundef i64 @_ZN12_GLOBAL__N_111avgPrimeGapEm(i64 noundef %121)
  %123 = mul i64 %120, %122
  store i64 %123, ptr %20, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %124 = load i64, ptr %6, align 8, !tbaa !9
  %125 = load i64, ptr %20, align 8, !tbaa !9
  %126 = call noundef i64 @_ZN12_GLOBAL__N_110checkedAddEmm(i64 noundef %124, i64 noundef %125)
  store i64 %126, ptr %21, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 48, ptr %22) #8
  %127 = load i64, ptr %6, align 8, !tbaa !9
  %128 = load i64, ptr %21, align 8, !tbaa !9
  call void @_ZN10primesieve8iteratorC1Emm(ptr noundef nonnull align 8 dereferenceable(48) %22, i64 noundef %127, i64 noundef %128) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #8
  %129 = load i64, ptr %19, align 8, !tbaa !9
  store i64 %129, ptr %23, align 8, !tbaa !9
  br label %130

130:                                              ; preds = %138, %117
  %131 = load i64, ptr %23, align 8, !tbaa !9
  %132 = load i64, ptr %5, align 8, !tbaa !9
  %133 = icmp sge i64 %131, %132
  br i1 %133, label %135, label %134

134:                                              ; preds = %130
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  br label %145

135:                                              ; preds = %130
  %136 = invoke noundef i64 @_ZN10primesieve8iterator10next_primeEv(ptr noundef nonnull align 8 dereferenceable(48) %22)
          to label %137 unwind label %141

137:                                              ; preds = %135
  store i64 %136, ptr %18, align 8, !tbaa !9
  br label %138

138:                                              ; preds = %137
  %139 = load i64, ptr %23, align 8, !tbaa !9
  %140 = add nsw i64 %139, -1
  store i64 %140, ptr %23, align 8, !tbaa !9
  br label %130, !llvm.loop !11

141:                                              ; preds = %135
  %142 = landingpad { ptr, i32 }
          cleanup
  %143 = extractvalue { ptr, i32 } %142, 0
  store ptr %143, ptr %9, align 8
  %144 = extractvalue { ptr, i32 } %142, 1
  store i32 %144, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  call void @_ZN10primesieve8iteratorD1Ev(ptr noundef nonnull align 8 dereferenceable(48) %22) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %211

145:                                              ; preds = %134
  call void @_ZN10primesieve8iteratorD1Ev(ptr noundef nonnull align 8 dereferenceable(48) %22) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %202

146:                                              ; preds = %113
  %147 = load i64, ptr %6, align 8, !tbaa !9
  %148 = call noundef i64 @_ZN12_GLOBAL__N_110checkedSubEmm(i64 noundef %147, i64 noundef 1)
  store i64 %148, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #8
  %149 = load i64, ptr %5, align 8, !tbaa !9
  %150 = load i64, ptr %19, align 8, !tbaa !9
  %151 = sub nsw i64 %149, %150
  %152 = load i64, ptr %6, align 8, !tbaa !9
  %153 = call noundef i64 @_ZN12_GLOBAL__N_111avgPrimeGapEm(i64 noundef %152)
  %154 = mul i64 %151, %153
  store i64 %154, ptr %24, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #8
  %155 = load i64, ptr %6, align 8, !tbaa !9
  %156 = load i64, ptr %24, align 8, !tbaa !9
  %157 = call noundef i64 @_ZN12_GLOBAL__N_110checkedSubEmm(i64 noundef %155, i64 noundef %156)
  store i64 %157, ptr %25, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 48, ptr %26) #8
  %158 = load i64, ptr %6, align 8, !tbaa !9
  %159 = load i64, ptr %25, align 8, !tbaa !9
  call void @_ZN10primesieve8iteratorC1Emm(ptr noundef nonnull align 8 dereferenceable(48) %26, i64 noundef %158, i64 noundef %159) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #8
  %160 = load i64, ptr %19, align 8, !tbaa !9
  store i64 %160, ptr %27, align 8, !tbaa !9
  br label %161

161:                                              ; preds = %197, %146
  %162 = load i64, ptr %27, align 8, !tbaa !9
  %163 = load i64, ptr %5, align 8, !tbaa !9
  %164 = icmp slt i64 %162, %163
  br i1 %164, label %166, label %165

165:                                              ; preds = %161
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #8
  br label %201

166:                                              ; preds = %161
  %167 = invoke noundef i64 @_ZN10primesieve8iterator10prev_primeEv(ptr noundef nonnull align 8 dereferenceable(48) %26)
          to label %168 unwind label %180

168:                                              ; preds = %166
  store i64 %167, ptr %18, align 8, !tbaa !9
  %169 = load i64, ptr %18, align 8, !tbaa !9
  %170 = icmp eq i64 %169, 0
  %171 = xor i1 %170, true
  %172 = xor i1 %171, true
  %173 = zext i1 %172 to i64
  %174 = call i64 @llvm.expect.i64(i64 %173, i64 0)
  %175 = icmp ne i64 %174, 0
  br i1 %175, label %176, label %196

176:                                              ; preds = %168
  store i1 true, ptr %30, align 1
  %177 = call ptr @__cxa_allocate_exception(i64 16) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %28) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %29) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %29) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %28, ptr noundef @.str.1, ptr noundef nonnull align 1 dereferenceable(1) %29)
          to label %178 unwind label %184

178:                                              ; preds = %176
  invoke void @_ZN10primesieve16primesieve_errorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %177, ptr noundef nonnull align 8 dereferenceable(32) %28)
          to label %179 unwind label %188

179:                                              ; preds = %178
  store i1 false, ptr %30, align 1
  invoke void @__cxa_throw(ptr %177, ptr @_ZTIN10primesieve16primesieve_errorE, ptr @_ZNSt13runtime_errorD2Ev) #9
          to label %217 unwind label %188

180:                                              ; preds = %166
  %181 = landingpad { ptr, i32 }
          cleanup
  %182 = extractvalue { ptr, i32 } %181, 0
  store ptr %182, ptr %9, align 8
  %183 = extractvalue { ptr, i32 } %181, 1
  store i32 %183, ptr %10, align 4
  br label %200

184:                                              ; preds = %176
  %185 = landingpad { ptr, i32 }
          cleanup
  %186 = extractvalue { ptr, i32 } %185, 0
  store ptr %186, ptr %9, align 8
  %187 = extractvalue { ptr, i32 } %185, 1
  store i32 %187, ptr %10, align 4
  br label %192

188:                                              ; preds = %179, %178
  %189 = landingpad { ptr, i32 }
          cleanup
  %190 = extractvalue { ptr, i32 } %189, 0
  store ptr %190, ptr %9, align 8
  %191 = extractvalue { ptr, i32 } %189, 1
  store i32 %191, ptr %10, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %28) #8
  br label %192

192:                                              ; preds = %188, %184
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %29) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %29) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %28) #8
  %193 = load i1, ptr %30, align 1
  br i1 %193, label %194, label %195

194:                                              ; preds = %192
  call void @__cxa_free_exception(ptr %177) #8
  br label %195

195:                                              ; preds = %194, %192
  br label %200

196:                                              ; preds = %168
  br label %197

197:                                              ; preds = %196
  %198 = load i64, ptr %27, align 8, !tbaa !9
  %199 = add nsw i64 %198, 1
  store i64 %199, ptr %27, align 8, !tbaa !9
  br label %161, !llvm.loop !13

200:                                              ; preds = %195, %180
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #8
  call void @_ZN10primesieve8iteratorD1Ev(ptr noundef nonnull align 8 dereferenceable(48) %26) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #8
  br label %211

201:                                              ; preds = %165
  call void @_ZN10primesieve8iteratorD1Ev(ptr noundef nonnull align 8 dereferenceable(48) %26) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #8
  br label %202

202:                                              ; preds = %201, %145
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #8
  %203 = call i64 @_ZNSt6chrono3_V212system_clock3nowEv() #8
  %204 = getelementptr inbounds %"class.std::chrono::time_point", ptr %31, i32 0, i32 0
  %205 = getelementptr inbounds %"class.std::chrono::duration", ptr %204, i32 0, i32 0
  store i64 %203, ptr %205, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #8
  %206 = 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) %31, ptr noundef nonnull align 8 dereferenceable(8) %15)
  %207 = getelementptr inbounds %"class.std::chrono::duration", ptr %33, i32 0, i32 0
  store i64 %206, ptr %207, align 8
  call void @_ZNSt6chrono8durationIdSt5ratioILl1ELl1EEEC2IlS1_ILl1ELl1000000000EEvEERKNS0_IT_T0_EE(ptr noundef nonnull align 8 dereferenceable(8) %32, ptr noundef nonnull align 8 dereferenceable(8) %33)
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #8
  %208 = call noundef double @_ZNKSt6chrono8durationIdSt5ratioILl1ELl1EEE5countEv(ptr noundef nonnull align 8 dereferenceable(8) %32)
  %209 = getelementptr inbounds %"class.primesieve::PrimeSieve", ptr %34, i32 0, i32 3
  store double %208, ptr %209, align 8, !tbaa !14
  %210 = load i64, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #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
  ret i64 %210

211:                                              ; preds = %200, %141
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #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
  br label %212

212:                                              ; preds = %211, %80, %55
  %213 = load ptr, ptr %9, align 8
  %214 = load i32, ptr %10, align 4
  %215 = insertvalue { ptr, i32 } poison, ptr %213, 0
  %216 = insertvalue { ptr, i32 } %215, i32 %214, 1
  resume { ptr, i32 } %216

217:                                              ; preds = %179, %63, %43
  unreachable
}

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 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::allocator" = type { 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::chrono::duration.1" = type { double }

@_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
@.str.2 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [33 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN10primesieve10PrimeSieve16negativeNthPrimeElm(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::allocator", align 1
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca %"class.std::chrono::time_point", align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca %"struct.primesieve::iterator", align 8
  %13 = alloca %"struct.primesieve::iterator", align 8
  %14 = alloca %"class.std::__cxx11::basic_string", align 8
  %15 = alloca %"class.std::allocator", align 1
  %16 = alloca %"class.std::chrono::time_point", align 8
  %17 = alloca %"class.std::chrono::duration.1", align 8
  %18 = alloca %"class.std::chrono::duration", align 8
  store i64 %2, ptr %4, align 8, !tbaa !5
  %19 = sub nsw i64 0, %1
  %.not = icmp ult i64 %19, %2
  br i1 %.not, label %28, label %20

20:                                               ; preds = %3
  %21 = 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 1, ptr nonnull %6) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull @.str.2, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %22 unwind label %.thread

22:                                               ; preds = %20
  invoke void @_ZN10primesieve16primesieve_errorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %23 unwind label %25

23:                                               ; preds = %22
  invoke void @__cxa_throw(ptr nonnull %21, ptr nonnull @_ZTIN10primesieve16primesieve_errorE, ptr nonnull @_ZNSt13runtime_errorD2Ev) #8
          to label %112 unwind label %25

.thread:                                          ; preds = %20
  %24 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #7
  br label %27

25:                                               ; preds = %22, %23
  %.040 = phi i1 [ false, %23 ], [ true, %22 ]
  %26 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #7
  br i1 %.040, label %27, label %111

27:                                               ; preds = %.thread, %25
  %.pn6166 = phi { ptr, i32 } [ %24, %.thread ], [ %26, %25 ]
  call void @__cxa_free_exception(ptr %21) #7
  br label %111

28:                                               ; preds = %3
  %29 = icmp ugt i64 %19, 425656284035217743
  br i1 %29, label %30, label %40

30:                                               ; preds = %28
  %31 = tail call ptr @__cxa_allocate_exception(i64 16) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #7
  invoke void @_ZNSt7__cxx119to_stringEm(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %8, i64 noundef 425656284035217743)
          to label %32 unwind label %.thread67

32:                                               ; preds = %30
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_OS8_(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %7, ptr noundef nonnull @.str.3, ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %33 unwind label %.thread71

33:                                               ; preds = %32
  invoke void @_ZN10primesieve16primesieve_errorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %31, ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %34 unwind label %37

34:                                               ; preds = %33
  invoke void @__cxa_throw(ptr nonnull %31, ptr nonnull @_ZTIN10primesieve16primesieve_errorE, ptr nonnull @_ZNSt13runtime_errorD2Ev) #8
          to label %112 unwind label %37

.thread67:                                        ; preds = %30
  %35 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #7
  br label %39

.thread71:                                        ; preds = %32
  %36 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #7
  br label %39

37:                                               ; preds = %33, %34
  %.046 = phi i1 [ false, %34 ], [ true, %33 ]
  %38 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #7
  br i1 %.046, label %39, label %111

39:                                               ; preds = %.thread71, %.thread67, %37
  %.pn58.pn70 = phi { ptr, i32 } [ %35, %.thread67 ], [ %38, %37 ], [ %36, %.thread71 ]
  call void @__cxa_free_exception(ptr %31) #7
  br label %111

40:                                               ; preds = %28
  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 %9) #7
  %41 = tail call i64 @_ZNSt6chrono3_V212system_clock3nowEv() #7
  store i64 %41, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  %42 = tail call noundef i64 @_ZN10primesieve13primePiApproxEm(i64 noundef %2)
  %43 = tail call noundef i64 @_ZN12_GLOBAL__N_110checkedSubEmm(i64 noundef %42, i64 noundef %19)
  store i64 %43, ptr %10, align 8, !tbaa !5
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) @_ZN12_GLOBAL__N_15max_nE)
  %45 = load i64, ptr %44, align 8, !tbaa !5
  store i64 %45, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #7
  %46 = call noundef i64 @_ZN10primesieve14nthPrimeApproxEm(i64 noundef %45)
  store i64 %46, ptr %11, align 8, !tbaa !5
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %48 = load i64, ptr %47, align 8, !tbaa !5
  store i64 %48, ptr %11, align 8, !tbaa !5
  %49 = load i64, ptr %4, align 8, !tbaa !5
  %50 = sub i64 %49, %48
  %51 = call noundef i64 @_ZN12_GLOBAL__N_15isqrtImEET_S1_(i64 noundef %49)
  %52 = udiv i64 %51, 10
  %53 = icmp ugt i64 %50, %52
  br i1 %53, label %54, label %62

54:                                               ; preds = %40
  %55 = load i64, ptr %4, align 8, !tbaa !5
  %56 = call noundef i64 @_ZN12_GLOBAL__N_110checkedSubEmm(i64 noundef %55, i64 noundef 1)
  store i64 %56, ptr %4, align 8, !tbaa !5
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %58 = load i64, ptr %57, align 8, !tbaa !5
  store i64 %58, ptr %11, align 8, !tbaa !5
  %59 = load i64, ptr %4, align 8, !tbaa !5
  %60 = call noundef i64 @_ZN10primesieve10PrimeSieve11countPrimesEmm(ptr noundef nonnull align 8 dereferenceable(120) %0, i64 noundef %58, i64 noundef %59)
  %61 = load i64, ptr %11, align 8, !tbaa !5
  store i64 %61, ptr %4, align 8, !tbaa !5
  br label %62

62:                                               ; preds = %54, %40
  %.042 = phi i64 [ %60, %54 ], [ 0, %40 ]
  %.not52 = icmp slt i64 %.042, %19
  br i1 %.not52, label %78, label %63

63:                                               ; preds = %62
  %64 = add nsw i64 %.042, %1
  %65 = load i64, ptr %4, align 8, !tbaa !5
  %66 = call noundef i64 @_ZN12_GLOBAL__N_111avgPrimeGapEm(i64 noundef %65)
  %67 = mul i64 %66, %64
  %68 = load i64, ptr %4, align 8, !tbaa !5
  %69 = call noundef i64 @_ZN12_GLOBAL__N_110checkedAddEmm(i64 noundef %68, i64 noundef %67)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %12) #7
  %70 = load i64, ptr %4, align 8, !tbaa !5
  call void @_ZN10primesieve8iteratorC1Emm(ptr noundef nonnull align 8 dereferenceable(48) %12, i64 noundef %70, i64 noundef %69) #7
  br label %72

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

72:                                               ; preds = %63, %74
  %.03281 = phi i64 [ %.042, %63 ], [ %75, %74 ]
  %73 = invoke noundef i64 @_ZN10primesieve8iterator10next_primeEv(ptr noundef nonnull align 8 dereferenceable(48) %12)
          to label %74 unwind label %76

74:                                               ; preds = %72
  %75 = add nsw i64 %.03281, -1
  %.not55.not = icmp sgt i64 %.03281, %19
  br i1 %.not55.not, label %72, label %71, !llvm.loop !9

76:                                               ; preds = %72
  %77 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN10primesieve8iteratorD1Ev(ptr noundef nonnull align 8 dereferenceable(48) %12) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %12) #7
  br label %110

78:                                               ; preds = %62
  %79 = load i64, ptr %4, align 8, !tbaa !5
  %80 = call noundef i64 @_ZN12_GLOBAL__N_110checkedSubEmm(i64 noundef %79, i64 noundef 1)
  store i64 %80, ptr %4, align 8, !tbaa !5
  %81 = sub nsw i64 %19, %.042
  %82 = call noundef i64 @_ZN12_GLOBAL__N_111avgPrimeGapEm(i64 noundef %80)
  %83 = mul i64 %82, %81
  %84 = load i64, ptr %4, align 8, !tbaa !5
  %85 = call noundef i64 @_ZN12_GLOBAL__N_110checkedSubEmm(i64 noundef %84, i64 noundef %83)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %13) #7
  %86 = load i64, ptr %4, align 8, !tbaa !5
  call void @_ZN10primesieve8iteratorC1Emm(ptr noundef nonnull align 8 dereferenceable(48) %13, i64 noundef %86, i64 noundef %85) #7
  br label %90

87:                                               ; preds = %92
  %88 = add i64 %.02982, 1
  %exitcond.not = icmp eq i64 %88, %19
  br i1 %exitcond.not, label %89, label %90, !llvm.loop !11

89:                                               ; preds = %87
  call void @_ZN10primesieve8iteratorD1Ev(ptr noundef nonnull align 8 dereferenceable(48) %13) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %13) #7
  br label %105

90:                                               ; preds = %78, %87
  %.02982 = phi i64 [ %.042, %78 ], [ %88, %87 ]
  %91 = invoke noundef i64 @_ZN10primesieve8iterator10prev_primeEv(ptr noundef nonnull align 8 dereferenceable(48) %13)
          to label %92 unwind label %98

92:                                               ; preds = %90
  %93 = icmp eq i64 %91, 0
  br i1 %93, label %94, label %87, !prof !12

94:                                               ; preds = %92
  %95 = call ptr @__cxa_allocate_exception(i64 16) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %14) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %15) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %15) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %14, ptr noundef nonnull @.str.1, ptr noundef nonnull align 1 dereferenceable(1) %15)
          to label %96 unwind label %.thread74

96:                                               ; preds = %94
  invoke void @_ZN10primesieve16primesieve_errorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %95, ptr noundef nonnull align 8 dereferenceable(32) %14)
          to label %97 unwind label %101

97:                                               ; preds = %96
  invoke void @__cxa_throw(ptr nonnull %95, ptr nonnull @_ZTIN10primesieve16primesieve_errorE, ptr nonnull @_ZNSt13runtime_errorD2Ev) #8
          to label %112 unwind label %101

98:                                               ; preds = %90
  %99 = landingpad { ptr, i32 }
          cleanup
  br label %104

.thread74:                                        ; preds = %94
  %100 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %15) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %15) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %14) #7
  br label %103

101:                                              ; preds = %96, %97
  %.0 = phi i1 [ false, %97 ], [ true, %96 ]
  %102 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #7
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %15) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %15) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %14) #7
  br i1 %.0, label %103, label %104

103:                                              ; preds = %.thread74, %101
  %.pn77 = phi { ptr, i32 } [ %100, %.thread74 ], [ %102, %101 ]
  call void @__cxa_free_exception(ptr %95) #7
  br label %104

104:                                              ; preds = %101, %103, %98
  %.pn.pn = phi { ptr, i32 } [ %.pn77, %103 ], [ %102, %101 ], [ %99, %98 ]
  call void @_ZN10primesieve8iteratorD1Ev(ptr noundef nonnull align 8 dereferenceable(48) %13) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %13) #7
  br label %110

105:                                              ; preds = %89, %71
  %.245 = phi i64 [ %73, %71 ], [ %91, %89 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #7
  %106 = call i64 @_ZNSt6chrono3_V212system_clock3nowEv() #7
  store i64 %106, ptr %16, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %17) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %18) #7
  %107 = 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) %16, ptr noundef nonnull align 8 dereferenceable(8) %9)
  store i64 %107, ptr %18, align 8
  call void @_ZNSt6chrono8durationIdSt5ratioILl1ELl1EEEC2IlS1_ILl1ELl1000000000EEvEERKNS0_IT_T0_EE(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %18)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #7
  %108 = call noundef double @_ZNKSt6chrono8durationIdSt5ratioILl1ELl1EEE5countEv(ptr noundef nonnull align 8 dereferenceable(8) %17)
  %109 = getelementptr inbounds i8, ptr %0, i64 24
  store double %108, ptr %109, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  ret i64 %.245

110:                                              ; preds = %104, %76
  %.pn56 = phi { ptr, i32 } [ %77, %76 ], [ %.pn.pn, %104 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  br label %111

111:                                              ; preds = %37, %39, %25, %27, %110
  %.pn61.pn = phi { ptr, i32 } [ %.pn6166, %27 ], [ %26, %25 ], [ %.pn58.pn70, %39 ], [ %38, %37 ], [ %.pn56, %110 ]
  resume { ptr, i32 } %.pn61.pn

112:                                              ; preds = %97, %34, %23
  unreachable
}

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