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

; 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 [35 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
  %22 = add i64 %21, 1
  call void @primesieve_skipto(ptr noundef %4, i64 noundef %22, i64 noundef 0)
  %23 = call i64 @primesieve_prev_prime(ptr noundef %4)
  store i64 %23, ptr %6, align 8, !tbaa !5
  %24 = load ptr, ptr %3, align 8, !tbaa !9
  %25 = load i64, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds i64, ptr %24, i64 %25
  %27 = load i64, ptr %26, align 8, !tbaa !5
  %28 = add i64 %27, 1
  %29 = load i64, ptr %6, align 8, !tbaa !5
  %30 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %28, i64 noundef %29)
  %31 = load i64, ptr %6, align 8, !tbaa !5
  %32 = load ptr, ptr %3, align 8, !tbaa !9
  %33 = load i64, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds i64, ptr %32, i64 %33
  %35 = load i64, ptr %34, align 8, !tbaa !5
  %36 = icmp eq i64 %31, %35
  %37 = zext i1 %36 to i32
  call void @check(i32 noundef %37)
  %38 = load ptr, ptr %3, align 8, !tbaa !9
  %39 = load i64, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds i64, ptr %38, i64 %39
  %41 = load i64, ptr %40, align 8, !tbaa !5
  call void @primesieve_skipto(ptr noundef %4, i64 noundef %41, i64 noundef 0)
  %42 = call i64 @primesieve_prev_prime(ptr noundef %4)
  store i64 %42, ptr %6, align 8, !tbaa !5
  %43 = load ptr, ptr %3, align 8, !tbaa !9
  %44 = load i64, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds i64, ptr %43, i64 %44
  %46 = load i64, ptr %45, align 8, !tbaa !5
  %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_skipto(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)
  store i64 0, ptr %5, align 8, !tbaa !5
  br label %74

74:                                               ; preds = %84, %68
  %75 = load i64, ptr %5, align 8, !tbaa !5
  %76 = icmp ult i64 %75, 1000
  br i1 %76, label %77, label %87

77:                                               ; preds = %74
  %78 = call i64 @primesieve_prev_prime(ptr noundef %4)
  store i64 %78, ptr %6, align 8, !tbaa !5
  %79 = load i64, ptr %6, align 8, !tbaa !5
  %80 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i64 noundef %79)
  %81 = load i64, ptr %6, align 8, !tbaa !5
  %82 = icmp eq i64 %81, 0
  %83 = zext i1 %82 to i32
  call void @check(i32 noundef %83)
  br label %84

84:                                               ; preds = %77
  %85 = load i64, ptr %5, align 8, !tbaa !5
  %86 = add i64 %85, 1
  store i64 %86, ptr %5, align 8, !tbaa !5
  br label %74, !llvm.loop !14

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

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

91:                                               ; preds = %88
  %92 = load i64, ptr %6, align 8, !tbaa !5
  store i64 %92, ptr %8, align 8, !tbaa !5
  %93 = call i64 @primesieve_next_prime(ptr noundef %4)
  store i64 %93, ptr %6, align 8, !tbaa !5
  %94 = load i64, ptr %8, align 8, !tbaa !5
  %95 = load i64, ptr %6, align 8, !tbaa !5
  %96 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i64 noundef %94, i64 noundef %95)
  %97 = load i64, ptr %6, align 8, !tbaa !5
  %98 = load ptr, ptr %3, align 8, !tbaa !9
  %99 = load i64, ptr %5, align 8, !tbaa !5
  %100 = getelementptr inbounds i64, ptr %98, i64 %99
  %101 = load i64, ptr %100, align 8, !tbaa !5
  %102 = icmp eq i64 %97, %101
  %103 = zext i1 %102 to i32
  call void @check(i32 noundef %103)
  br label %104

104:                                              ; preds = %91
  %105 = load i64, ptr %5, align 8, !tbaa !5
  %106 = add i64 %105, 1
  store i64 %106, ptr %5, align 8, !tbaa !5
  br label %88, !llvm.loop !15

107:                                              ; preds = %88
  %108 = load ptr, ptr %3, align 8, !tbaa !9
  %109 = load i64, ptr %2, align 8, !tbaa !5
  %110 = sub i64 %109, 1
  %111 = getelementptr inbounds i64, ptr %108, i64 %110
  %112 = load i64, ptr %111, align 8, !tbaa !5
  call void @primesieve_skipto(ptr noundef %4, i64 noundef %112, i64 noundef 0)
  store i64 0, ptr %5, align 8, !tbaa !5
  br label %113

113:                                              ; preds = %139, %107
  %114 = load i64, ptr %5, align 8, !tbaa !5
  %115 = icmp ult i64 %114, 1000
  br i1 %115, label %116, label %142

116:                                              ; preds = %113
  %117 = load ptr, ptr %3, align 8, !tbaa !9
  %118 = load i64, ptr %2, align 8, !tbaa !5
  %119 = load i64, ptr %5, align 8, !tbaa !5
  %120 = add i64 %119, 1
  %121 = sub i64 %118, %120
  %122 = getelementptr inbounds i64, ptr %117, i64 %121
  %123 = load i64, ptr %122, align 8, !tbaa !5
  store i64 %123, ptr %9, align 8, !tbaa !5
  %124 = load ptr, ptr %3, align 8, !tbaa !9
  %125 = load i64, ptr %2, align 8, !tbaa !5
  %126 = load i64, ptr %5, align 8, !tbaa !5
  %127 = add i64 %126, 2
  %128 = sub i64 %125, %127
  %129 = getelementptr inbounds i64, ptr %124, i64 %128
  %130 = load i64, ptr %129, align 8, !tbaa !5
  store i64 %130, ptr %10, align 8, !tbaa !5
  %131 = call i64 @primesieve_prev_prime(ptr noundef %4)
  store i64 %131, ptr %6, align 8, !tbaa !5
  %132 = load i64, ptr %9, align 8, !tbaa !5
  %133 = load i64, ptr %6, align 8, !tbaa !5
  %134 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %132, i64 noundef %133)
  %135 = load i64, ptr %6, align 8, !tbaa !5
  %136 = load i64, ptr %10, align 8, !tbaa !5
  %137 = icmp eq i64 %135, %136
  %138 = zext i1 %137 to i32
  call void @check(i32 noundef %138)
  br label %139

139:                                              ; preds = %116
  %140 = load i64, ptr %5, align 8, !tbaa !5
  %141 = add i64 %140, 1
  store i64 %141, ptr %5, align 8, !tbaa !5
  br label %113, !llvm.loop !16

142:                                              ; preds = %113
  store i64 0, ptr %5, align 8, !tbaa !5
  br label %143

143:                                              ; preds = %163, %142
  %144 = load i64, ptr %5, align 8, !tbaa !5
  %145 = icmp ult i64 %144, 1000
  br i1 %145, label %146, label %166

146:                                              ; preds = %143
  %147 = load i64, ptr %6, align 8, !tbaa !5
  store i64 %147, ptr %8, align 8, !tbaa !5
  %148 = load i64, ptr %2, align 8, !tbaa !5
  %149 = sub i64 %148, 1000
  %150 = load i64, ptr %5, align 8, !tbaa !5
  %151 = add i64 %149, %150
  store i64 %151, ptr %9, align 8, !tbaa !5
  %152 = call i64 @primesieve_next_prime(ptr noundef %4)
  store i64 %152, ptr %6, align 8, !tbaa !5
  %153 = load i64, ptr %8, align 8, !tbaa !5
  %154 = load i64, ptr %6, align 8, !tbaa !5
  %155 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i64 noundef %153, i64 noundef %154)
  %156 = load i64, ptr %6, align 8, !tbaa !5
  %157 = load ptr, ptr %3, align 8, !tbaa !9
  %158 = load i64, ptr %9, align 8, !tbaa !5
  %159 = getelementptr inbounds i64, ptr %157, i64 %158
  %160 = load i64, ptr %159, align 8, !tbaa !5
  %161 = icmp eq i64 %156, %160
  %162 = zext i1 %161 to i32
  call void @check(i32 noundef %162)
  br label %163

163:                                              ; preds = %146
  %164 = load i64, ptr %5, align 8, !tbaa !5
  %165 = add i64 %164, 1
  store i64 %165, ptr %5, align 8, !tbaa !5
  br label %143, !llvm.loop !17

166:                                              ; preds = %143
  %167 = load ptr, ptr %3, align 8, !tbaa !9
  call void @primesieve_free(ptr noundef %167)
  call void @primesieve_free_iterator(ptr noundef %4)
  %168 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %169 = 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_skipto(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}


; 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 [35 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
  %.063 = add i64 %4, -1
  %.not64 = icmp eq i64 %.063, 0
  br i1 %.not64, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.066 = phi i64 [ %.0, %.lr.ph ], [ %.063, %0 ]
  %.0.in65 = phi i64 [ %.066, %.lr.ph ], [ %4, %0 ]
  %5 = getelementptr inbounds i64, ptr %3, i64 %.066
  %6 = load i64, ptr %5, align 8, !tbaa !5
  %7 = add i64 %6, 1
  call void @primesieve_skipto(ptr noundef nonnull %2, i64 noundef %7, i64 noundef 0) #5
  %8 = call i64 @primesieve_prev_prime(ptr noundef nonnull %2)
  %9 = load i64, ptr %5, align 8, !tbaa !5
  %10 = add i64 %9, 1
  %11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %10, i64 noundef %8)
  %12 = load i64, ptr %5, align 8, !tbaa !5
  %13 = icmp eq i64 %8, %12
  %14 = zext i1 %13 to i32
  call void @check(i32 noundef %14)
  %15 = load i64, ptr %5, align 8, !tbaa !5
  call void @primesieve_skipto(ptr noundef nonnull %2, i64 noundef %15, i64 noundef 0) #5
  %16 = call i64 @primesieve_prev_prime(ptr noundef nonnull %2)
  %17 = load i64, ptr %5, align 8, !tbaa !5
  %18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %17, i64 noundef %16)
  %gep = getelementptr i64, ptr %invariant.gep, i64 %.0.in65
  %19 = load i64, ptr %gep, align 8, !tbaa !5
  %20 = icmp eq i64 %16, %19
  %21 = zext i1 %20 to i32
  call void @check(i32 noundef %21)
  %.0 = add i64 %.066, -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_skipto(ptr noundef nonnull %2, i64 noundef 100000000, i64 noundef 0) #5
  br label %22

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

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

29:                                               ; preds = %25, %29
  %.167 = phi i64 [ 0, %25 ], [ %34, %29 ]
  %30 = call i64 @primesieve_prev_prime(ptr noundef nonnull %2)
  %31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %30)
  %32 = icmp eq i64 %30, 0
  %33 = zext i1 %32 to i32
  call void @check(i32 noundef %33)
  %34 = add nuw nsw i64 %.167, 1
  %exitcond.not = icmp eq i64 %34, 1000
  br i1 %exitcond.not, label %.preheader62, label %29, !llvm.loop !12

.preheader62:                                     ; preds = %29, %.preheader62
  %.269 = phi i64 [ %41, %.preheader62 ], [ 0, %29 ]
  %.15668 = phi i64 [ %35, %.preheader62 ], [ %30, %29 ]
  %35 = call i64 @primesieve_next_prime(ptr noundef nonnull %2)
  %36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %.15668, i64 noundef %35)
  %37 = getelementptr inbounds i64, ptr %3, i64 %.269
  %38 = load i64, ptr %37, align 8, !tbaa !5
  %39 = icmp eq i64 %35, %38
  %40 = zext i1 %39 to i32
  call void @check(i32 noundef %40)
  %41 = add nuw nsw i64 %.269, 1
  %exitcond76.not = icmp eq i64 %41, 1000
  br i1 %exitcond76.not, label %42, label %.preheader62, !llvm.loop !13

42:                                               ; preds = %.preheader62
  %43 = load i64, ptr %1, align 8, !tbaa !5
  %44 = getelementptr i64, ptr %3, i64 %43
  %45 = getelementptr i8, ptr %44, i64 -8
  %46 = load i64, ptr %45, align 8, !tbaa !5
  call void @primesieve_skipto(ptr noundef nonnull %2, i64 noundef %46, i64 noundef 0) #5
  %invariant.gep80 = getelementptr i8, ptr %3, i64 -16
  br label %47

.preheader:                                       ; preds = %47
  %invariant.gep71 = getelementptr i8, ptr %3, i64 -8000
  br label %58

47:                                               ; preds = %42, %47
  %.370 = phi i64 [ 0, %42 ], [ %49, %47 ]
  %48 = load i64, ptr %1, align 8, !tbaa !5
  %49 = add nuw nsw i64 %.370, 1
  %50 = sub i64 %48, %49
  %51 = getelementptr inbounds i64, ptr %3, i64 %50
  %52 = load i64, ptr %51, align 8, !tbaa !5
  %reass.sub = sub i64 %48, %.370
  %gep81 = getelementptr i64, ptr %invariant.gep80, i64 %reass.sub
  %53 = load i64, ptr %gep81, align 8, !tbaa !5
  %54 = call i64 @primesieve_prev_prime(ptr noundef nonnull %2)
  %55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %52, i64 noundef %54)
  %56 = icmp eq i64 %54, %53
  %57 = zext i1 %56 to i32
  call void @check(i32 noundef %57)
  %exitcond77.not = icmp eq i64 %49, 1000
  br i1 %exitcond77.not, label %.preheader, label %47, !llvm.loop !14

58:                                               ; preds = %.preheader, %58
  %.474 = phi i64 [ 0, %.preheader ], [ %66, %58 ]
  %.35873 = phi i64 [ %54, %.preheader ], [ %60, %58 ]
  %59 = load i64, ptr %1, align 8, !tbaa !5
  %60 = call i64 @primesieve_next_prime(ptr noundef nonnull %2)
  %61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %.35873, i64 noundef %60)
  %gep72 = getelementptr i64, ptr %invariant.gep71, i64 %59
  %62 = getelementptr i64, ptr %gep72, i64 %.474
  %63 = load i64, ptr %62, align 8, !tbaa !5
  %64 = icmp eq i64 %60, %63
  %65 = zext i1 %64 to i32
  call void @check(i32 noundef %65)
  %66 = add nuw nsw i64 %.474, 1
  %exitcond78.not = icmp eq i64 %66, 1000
  br i1 %exitcond78.not, label %67, label %58, !llvm.loop !15

67:                                               ; preds = %58
  call void @primesieve_free(ptr noundef nonnull %3) #5
  call void @primesieve_free_iterator(ptr noundef nonnull %2) #5
  %68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %69 = 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_skipto(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}


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