; LLVM IR from kimwalisch/primesieve :: test (prev_prime2)

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

%struct.primesieve_iterator = type { i64, i64, i64, i64, ptr, ptr, i32 }

@.str.2 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [32 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @check(i32 noundef) #0

declare i32 @printf(ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca %struct.primesieve_iterator, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  store i64 0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %11 = call ptr @primesieve_generate_primes(i64 noundef 0, i64 noundef 100000, ptr noundef %2, i32 noundef 13)
  store ptr %11, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 56, ptr %4) #4
  call void @primesieve_init(ptr noundef %4)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i64 0, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %12 = load i64, ptr %2, align 8, !tbaa !5
  %13 = sub i64 %12, 1
  store i64 %13, ptr %5, align 8, !tbaa !5
  br label %14

14:                                               ; preds = %57, %0
  %15 = load i64, ptr %5, align 8, !tbaa !5
  %16 = icmp ugt i64 %15, 0
  br i1 %16, label %17, label %60

17:                                               ; preds = %14
  %18 = load ptr, ptr %3, align 8, !tbaa !9
  %19 = load i64, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds i64, ptr %18, i64 %19
  %21 = load i64, ptr %20, align 8, !tbaa !5
  call void @primesieve_jump_to(ptr noundef %4, i64 noundef %21, i64 noundef 0)
  %22 = call i64 @primesieve_prev_prime(ptr noundef %4)
  store i64 %22, ptr %6, align 8, !tbaa !5
  %23 = load ptr, ptr %3, align 8, !tbaa !9
  %24 = load i64, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds i64, ptr %23, i64 %24
  %26 = load i64, ptr %25, align 8, !tbaa !5
  %27 = load i64, ptr %6, align 8, !tbaa !5
  %28 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %26, i64 noundef %27)
  %29 = load i64, ptr %6, align 8, !tbaa !5
  %30 = load ptr, ptr %3, align 8, !tbaa !9
  %31 = load i64, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds i64, ptr %30, i64 %31
  %33 = load i64, ptr %32, align 8, !tbaa !5
  %34 = icmp eq i64 %29, %33
  %35 = zext i1 %34 to i32
  call void @check(i32 noundef %35)
  %36 = load ptr, ptr %3, align 8, !tbaa !9
  %37 = load i64, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds i64, ptr %36, i64 %37
  %39 = load i64, ptr %38, align 8, !tbaa !5
  %40 = sub i64 %39, 1
  call void @primesieve_jump_to(ptr noundef %4, i64 noundef %40, i64 noundef 0)
  %41 = call i64 @primesieve_prev_prime(ptr noundef %4)
  store i64 %41, ptr %6, align 8, !tbaa !5
  %42 = load ptr, ptr %3, align 8, !tbaa !9
  %43 = load i64, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds i64, ptr %42, i64 %43
  %45 = load i64, ptr %44, align 8, !tbaa !5
  %46 = sub i64 %45, 1
  %47 = load i64, ptr %6, align 8, !tbaa !5
  %48 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %46, i64 noundef %47)
  %49 = load i64, ptr %6, align 8, !tbaa !5
  %50 = load ptr, ptr %3, align 8, !tbaa !9
  %51 = load i64, ptr %5, align 8, !tbaa !5
  %52 = sub i64 %51, 1
  %53 = getelementptr inbounds i64, ptr %50, i64 %52
  %54 = load i64, ptr %53, align 8, !tbaa !5
  %55 = icmp eq i64 %49, %54
  %56 = zext i1 %55 to i32
  call void @check(i32 noundef %56)
  br label %57

57:                                               ; preds = %17
  %58 = load i64, ptr %5, align 8, !tbaa !5
  %59 = add i64 %58, -1
  store i64 %59, ptr %5, align 8, !tbaa !5
  br label %14, !llvm.loop !11

60:                                               ; preds = %14
  call void @primesieve_jump_to(ptr noundef %4, i64 noundef 100000000, i64 noundef 0)
  br label %61

61:                                               ; preds = %64, %60
  %62 = call i64 @primesieve_prev_prime(ptr noundef %4)
  store i64 %62, ptr %6, align 8, !tbaa !5
  %63 = icmp ugt i64 %62, 0
  br i1 %63, label %64, label %68

64:                                               ; preds = %61
  %65 = load i64, ptr %6, align 8, !tbaa !5
  %66 = load i64, ptr %7, align 8, !tbaa !5
  %67 = add i64 %66, %65
  store i64 %67, ptr %7, align 8, !tbaa !5
  br label %61, !llvm.loop !13

68:                                               ; preds = %61
  %69 = load i64, ptr %7, align 8, !tbaa !5
  %70 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %69)
  %71 = load i64, ptr %7, align 8, !tbaa !5
  %72 = icmp eq i64 %71, 279209790387276
  %73 = zext i1 %72 to i32
  call void @check(i32 noundef %73)
  call void @primesieve_jump_to(ptr noundef %4, i64 noundef 100000000, i64 noundef 5000000)
  store i64 0, ptr %7, align 8, !tbaa !5
  br label %74

74:                                               ; preds = %77, %68
  %75 = call i64 @primesieve_prev_prime(ptr noundef %4)
  store i64 %75, ptr %6, align 8, !tbaa !5
  %76 = icmp ugt i64 %75, 0
  br i1 %76, label %77, label %81

77:                                               ; preds = %74
  %78 = load i64, ptr %6, align 8, !tbaa !5
  %79 = load i64, ptr %7, align 8, !tbaa !5
  %80 = add i64 %79, %78
  store i64 %80, ptr %7, align 8, !tbaa !5
  br label %74, !llvm.loop !14

81:                                               ; preds = %74
  %82 = load i64, ptr %7, align 8, !tbaa !5
  %83 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %82)
  %84 = load i64, ptr %7, align 8, !tbaa !5
  %85 = icmp eq i64 %84, 279209790387276
  %86 = zext i1 %85 to i32
  call void @check(i32 noundef %86)
  store i64 0, ptr %5, align 8, !tbaa !5
  br label %87

87:                                               ; preds = %97, %81
  %88 = load i64, ptr %5, align 8, !tbaa !5
  %89 = icmp ult i64 %88, 1000
  br i1 %89, label %90, label %100

90:                                               ; preds = %87
  %91 = call i64 @primesieve_prev_prime(ptr noundef %4)
  store i64 %91, ptr %6, align 8, !tbaa !5
  %92 = load i64, ptr %6, align 8, !tbaa !5
  %93 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i64 noundef %92)
  %94 = load i64, ptr %6, align 8, !tbaa !5
  %95 = icmp eq i64 %94, 0
  %96 = zext i1 %95 to i32
  call void @check(i32 noundef %96)
  br label %97

97:                                               ; preds = %90
  %98 = load i64, ptr %5, align 8, !tbaa !5
  %99 = add i64 %98, 1
  store i64 %99, ptr %5, align 8, !tbaa !5
  br label %87, !llvm.loop !15

100:                                              ; preds = %87
  store i64 0, ptr %5, align 8, !tbaa !5
  br label %101

101:                                              ; preds = %117, %100
  %102 = load i64, ptr %5, align 8, !tbaa !5
  %103 = icmp ult i64 %102, 1000
  br i1 %103, label %104, label %120

104:                                              ; preds = %101
  %105 = load i64, ptr %6, align 8, !tbaa !5
  store i64 %105, ptr %8, align 8, !tbaa !5
  %106 = call i64 @primesieve_next_prime(ptr noundef %4)
  store i64 %106, ptr %6, align 8, !tbaa !5
  %107 = load i64, ptr %8, align 8, !tbaa !5
  %108 = load i64, ptr %6, align 8, !tbaa !5
  %109 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i64 noundef %107, i64 noundef %108)
  %110 = load i64, ptr %6, align 8, !tbaa !5
  %111 = load ptr, ptr %3, align 8, !tbaa !9
  %112 = load i64, ptr %5, align 8, !tbaa !5
  %113 = getelementptr inbounds i64, ptr %111, i64 %112
  %114 = load i64, ptr %113, align 8, !tbaa !5
  %115 = icmp eq i64 %110, %114
  %116 = zext i1 %115 to i32
  call void @check(i32 noundef %116)
  br label %117

117:                                              ; preds = %104
  %118 = load i64, ptr %5, align 8, !tbaa !5
  %119 = add i64 %118, 1
  store i64 %119, ptr %5, align 8, !tbaa !5
  br label %101, !llvm.loop !16

120:                                              ; preds = %101
  %121 = load ptr, ptr %3, align 8, !tbaa !9
  %122 = load i64, ptr %2, align 8, !tbaa !5
  %123 = sub i64 %122, 1
  %124 = getelementptr inbounds i64, ptr %121, i64 %123
  %125 = load i64, ptr %124, align 8, !tbaa !5
  %126 = sub i64 %125, 1
  call void @primesieve_jump_to(ptr noundef %4, i64 noundef %126, i64 noundef 0)
  store i64 0, ptr %5, align 8, !tbaa !5
  br label %127

127:                                              ; preds = %153, %120
  %128 = load i64, ptr %5, align 8, !tbaa !5
  %129 = icmp ult i64 %128, 1000
  br i1 %129, label %130, label %156

130:                                              ; preds = %127
  %131 = load ptr, ptr %3, align 8, !tbaa !9
  %132 = load i64, ptr %2, align 8, !tbaa !5
  %133 = load i64, ptr %5, align 8, !tbaa !5
  %134 = add i64 %133, 1
  %135 = sub i64 %132, %134
  %136 = getelementptr inbounds i64, ptr %131, i64 %135
  %137 = load i64, ptr %136, align 8, !tbaa !5
  store i64 %137, ptr %9, align 8, !tbaa !5
  %138 = load ptr, ptr %3, align 8, !tbaa !9
  %139 = load i64, ptr %2, align 8, !tbaa !5
  %140 = load i64, ptr %5, align 8, !tbaa !5
  %141 = add i64 %140, 2
  %142 = sub i64 %139, %141
  %143 = getelementptr inbounds i64, ptr %138, i64 %142
  %144 = load i64, ptr %143, align 8, !tbaa !5
  store i64 %144, ptr %10, align 8, !tbaa !5
  %145 = call i64 @primesieve_prev_prime(ptr noundef %4)
  store i64 %145, ptr %6, align 8, !tbaa !5
  %146 = load i64, ptr %9, align 8, !tbaa !5
  %147 = load i64, ptr %6, align 8, !tbaa !5
  %148 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %146, i64 noundef %147)
  %149 = load i64, ptr %6, align 8, !tbaa !5
  %150 = load i64, ptr %10, align 8, !tbaa !5
  %151 = icmp eq i64 %149, %150
  %152 = zext i1 %151 to i32
  call void @check(i32 noundef %152)
  br label %153

153:                                              ; preds = %130
  %154 = load i64, ptr %5, align 8, !tbaa !5
  %155 = add i64 %154, 1
  store i64 %155, ptr %5, align 8, !tbaa !5
  br label %127, !llvm.loop !17

156:                                              ; preds = %127
  store i64 0, ptr %5, align 8, !tbaa !5
  br label %157

157:                                              ; preds = %177, %156
  %158 = load i64, ptr %5, align 8, !tbaa !5
  %159 = icmp ult i64 %158, 1000
  br i1 %159, label %160, label %180

160:                                              ; preds = %157
  %161 = load i64, ptr %6, align 8, !tbaa !5
  store i64 %161, ptr %8, align 8, !tbaa !5
  %162 = load i64, ptr %2, align 8, !tbaa !5
  %163 = sub i64 %162, 1000
  %164 = load i64, ptr %5, align 8, !tbaa !5
  %165 = add i64 %163, %164
  store i64 %165, ptr %9, align 8, !tbaa !5
  %166 = call i64 @primesieve_next_prime(ptr noundef %4)
  store i64 %166, ptr %6, align 8, !tbaa !5
  %167 = load i64, ptr %8, align 8, !tbaa !5
  %168 = load i64, ptr %6, align 8, !tbaa !5
  %169 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i64 noundef %167, i64 noundef %168)
  %170 = load i64, ptr %6, align 8, !tbaa !5
  %171 = load ptr, ptr %3, align 8, !tbaa !9
  %172 = load i64, ptr %9, align 8, !tbaa !5
  %173 = getelementptr inbounds i64, ptr %171, i64 %172
  %174 = load i64, ptr %173, align 8, !tbaa !5
  %175 = icmp eq i64 %170, %174
  %176 = zext i1 %175 to i32
  call void @check(i32 noundef %176)
  br label %177

177:                                              ; preds = %160
  %178 = load i64, ptr %5, align 8, !tbaa !5
  %179 = add i64 %178, 1
  store i64 %179, ptr %5, align 8, !tbaa !5
  br label %157, !llvm.loop !18

180:                                              ; preds = %157
  %181 = load ptr, ptr %3, align 8, !tbaa !9
  call void @primesieve_free(ptr noundef %181)
  call void @primesieve_free_iterator(ptr noundef %4)
  %182 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %183 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 56, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  ret i32 0
}

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

declare ptr @primesieve_generate_primes(i64 noundef, i64 noundef, ptr noundef, i32 noundef) #1

declare void @primesieve_init(ptr noundef) #1

declare void @primesieve_jump_to(ptr noundef, i64 noundef, i64 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @primesieve_prev_prime(ptr noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @primesieve_next_prime(ptr noundef) #3

declare void @primesieve_free(ptr noundef) #1

declare void @primesieve_free_iterator(ptr noundef) #1

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

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.primesieve_iterator = type { i64, i64, i64, i64, ptr, ptr, i32 }

@.str.2 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [32 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @check(i32 noundef) local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca %struct.primesieve_iterator, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  store i64 0, ptr %1, align 8, !tbaa !5
  %3 = call ptr @primesieve_generate_primes(i64 noundef 0, i64 noundef 100000, ptr noundef nonnull %1, i32 noundef 13) #5
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %2) #5
  call void @primesieve_init(ptr noundef nonnull %2) #5
  %4 = load i64, ptr %1, align 8, !tbaa !5
  %invariant.gep = getelementptr i8, ptr %3, i64 -16
  %.070 = add i64 %4, -1
  %.not71 = icmp eq i64 %.070, 0
  br i1 %.not71, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.073 = phi i64 [ %.0, %.lr.ph ], [ %.070, %0 ]
  %.0.in72 = phi i64 [ %.073, %.lr.ph ], [ %4, %0 ]
  %5 = getelementptr inbounds i64, ptr %3, i64 %.073
  %6 = load i64, ptr %5, align 8, !tbaa !5
  call void @primesieve_jump_to(ptr noundef nonnull %2, i64 noundef %6, i64 noundef 0) #5
  %7 = call i64 @primesieve_prev_prime(ptr noundef nonnull %2)
  %8 = load i64, ptr %5, align 8, !tbaa !5
  %9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %8, i64 noundef %7)
  %10 = load i64, ptr %5, align 8, !tbaa !5
  %11 = icmp eq i64 %7, %10
  %12 = zext i1 %11 to i32
  call void @check(i32 noundef %12)
  %13 = load i64, ptr %5, align 8, !tbaa !5
  %14 = add i64 %13, -1
  call void @primesieve_jump_to(ptr noundef nonnull %2, i64 noundef %14, i64 noundef 0) #5
  %15 = call i64 @primesieve_prev_prime(ptr noundef nonnull %2)
  %16 = load i64, ptr %5, align 8, !tbaa !5
  %17 = add i64 %16, -1
  %18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %17, i64 noundef %15)
  %gep = getelementptr i64, ptr %invariant.gep, i64 %.0.in72
  %19 = load i64, ptr %gep, align 8, !tbaa !5
  %20 = icmp eq i64 %15, %19
  %21 = zext i1 %20 to i32
  call void @check(i32 noundef %21)
  %.0 = add i64 %.073, -1
  %.not = icmp eq i64 %.0, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @primesieve_jump_to(ptr noundef nonnull %2, i64 noundef 100000000, i64 noundef 0) #5
  br label %22

22:                                               ; preds = %22, %._crit_edge
  %.058 = phi i64 [ 0, %._crit_edge ], [ %24, %22 ]
  %23 = call i64 @primesieve_prev_prime(ptr noundef nonnull %2)
  %.not67 = icmp eq i64 %23, 0
  %24 = add i64 %23, %.058
  br i1 %.not67, label %25, label %22, !llvm.loop !11

25:                                               ; preds = %22
  %26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %.058)
  %27 = icmp eq i64 %.058, 279209790387276
  %28 = zext i1 %27 to i32
  call void @check(i32 noundef %28)
  call void @primesieve_jump_to(ptr noundef nonnull %2, i64 noundef 100000000, i64 noundef 5000000) #5
  br label %29

29:                                               ; preds = %29, %25
  %.159 = phi i64 [ 0, %25 ], [ %31, %29 ]
  %30 = call i64 @primesieve_prev_prime(ptr noundef nonnull %2)
  %.not68 = icmp eq i64 %30, 0
  %31 = add i64 %30, %.159
  br i1 %.not68, label %32, label %29, !llvm.loop !12

32:                                               ; preds = %29
  %33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %.159)
  %34 = icmp eq i64 %.159, 279209790387276
  %35 = zext i1 %34 to i32
  call void @check(i32 noundef %35)
  br label %36

36:                                               ; preds = %32, %36
  %.174 = phi i64 [ 0, %32 ], [ %41, %36 ]
  %37 = call i64 @primesieve_prev_prime(ptr noundef nonnull %2)
  %38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %37)
  %39 = icmp eq i64 %37, 0
  %40 = zext i1 %39 to i32
  call void @check(i32 noundef %40)
  %41 = add nuw nsw i64 %.174, 1
  %exitcond.not = icmp eq i64 %41, 1000
  br i1 %exitcond.not, label %.preheader69, label %36, !llvm.loop !13

.preheader69:                                     ; preds = %36, %.preheader69
  %.276 = phi i64 [ %48, %.preheader69 ], [ 0, %36 ]
  %.16175 = phi i64 [ %42, %.preheader69 ], [ %37, %36 ]
  %42 = call i64 @primesieve_next_prime(ptr noundef nonnull %2)
  %43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %.16175, i64 noundef %42)
  %44 = getelementptr inbounds i64, ptr %3, i64 %.276
  %45 = load i64, ptr %44, align 8, !tbaa !5
  %46 = icmp eq i64 %42, %45
  %47 = zext i1 %46 to i32
  call void @check(i32 noundef %47)
  %48 = add nuw nsw i64 %.276, 1
  %exitcond83.not = icmp eq i64 %48, 1000
  br i1 %exitcond83.not, label %49, label %.preheader69, !llvm.loop !14

49:                                               ; preds = %.preheader69
  %50 = load i64, ptr %1, align 8, !tbaa !5
  %51 = getelementptr i64, ptr %3, i64 %50
  %52 = getelementptr i8, ptr %51, i64 -8
  %53 = load i64, ptr %52, align 8, !tbaa !5
  %54 = add i64 %53, -1
  call void @primesieve_jump_to(ptr noundef nonnull %2, i64 noundef %54, i64 noundef 0) #5
  %invariant.gep87 = getelementptr i8, ptr %3, i64 -16
  br label %55

.preheader:                                       ; preds = %55
  %invariant.gep78 = getelementptr i8, ptr %3, i64 -8000
  br label %66

55:                                               ; preds = %49, %55
  %.377 = phi i64 [ 0, %49 ], [ %57, %55 ]
  %56 = load i64, ptr %1, align 8, !tbaa !5
  %57 = add nuw nsw i64 %.377, 1
  %58 = sub i64 %56, %57
  %59 = getelementptr inbounds i64, ptr %3, i64 %58
  %60 = load i64, ptr %59, align 8, !tbaa !5
  %reass.sub = sub i64 %56, %.377
  %gep88 = getelementptr i64, ptr %invariant.gep87, i64 %reass.sub
  %61 = load i64, ptr %gep88, align 8, !tbaa !5
  %62 = call i64 @primesieve_prev_prime(ptr noundef nonnull %2)
  %63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %60, i64 noundef %62)
  %64 = icmp eq i64 %62, %61
  %65 = zext i1 %64 to i32
  call void @check(i32 noundef %65)
  %exitcond84.not = icmp eq i64 %57, 1000
  br i1 %exitcond84.not, label %.preheader, label %55, !llvm.loop !15

66:                                               ; preds = %.preheader, %66
  %.481 = phi i64 [ 0, %.preheader ], [ %74, %66 ]
  %.36380 = phi i64 [ %62, %.preheader ], [ %68, %66 ]
  %67 = load i64, ptr %1, align 8, !tbaa !5
  %68 = call i64 @primesieve_next_prime(ptr noundef nonnull %2)
  %69 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %.36380, i64 noundef %68)
  %gep79 = getelementptr i64, ptr %invariant.gep78, i64 %67
  %70 = getelementptr i64, ptr %gep79, i64 %.481
  %71 = load i64, ptr %70, align 8, !tbaa !5
  %72 = icmp eq i64 %68, %71
  %73 = zext i1 %72 to i32
  call void @check(i32 noundef %73)
  %74 = add nuw nsw i64 %.481, 1
  %exitcond85.not = icmp eq i64 %74, 1000
  br i1 %exitcond85.not, label %75, label %66, !llvm.loop !16

75:                                               ; preds = %66
  call void @primesieve_free(ptr noundef nonnull %3) #5
  call void @primesieve_free_iterator(ptr noundef nonnull %2) #5
  %76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %77 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret i32 0
}

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

declare ptr @primesieve_generate_primes(i64 noundef, i64 noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

declare void @primesieve_init(ptr noundef) local_unnamed_addr #3

declare void @primesieve_jump_to(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @primesieve_prev_prime(ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @primesieve_next_prime(ptr noundef) local_unnamed_addr #4

declare void @primesieve_free(ptr noundef) local_unnamed_addr #3

declare void @primesieve_free_iterator(ptr noundef) local_unnamed_addr #3

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

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


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