; LLVM IR from jermp/2i_bench :: external/CRoaring/tests (toplevel_unit)

; 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.roaring_uint32_iterator_s = type { ptr, i32, i32, i32, i32, i8, ptr, i8, i32 }

@.str.2 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.146 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.150 = external hidden unnamed_addr constant [39 x i8], align 1
@__PRETTY_FUNCTION__.test_iterator_reuse_retry_count = external hidden unnamed_addr constant [42 x i8], align 1
@.str.151 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.152 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.153 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.154 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.155 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.156 = external hidden unnamed_addr constant [38 x i8], align 1

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

declare void @roaring_bitmap_free(ptr noundef) #1

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

declare ptr @roaring_bitmap_create() #1

; Function Attrs: inlinehint nounwind uwtable
declare zeroext i1 @roaring_bitmap_contains(ptr noundef, i32 noundef) #2

declare i64 @roaring_bitmap_get_cardinality(ptr noundef) #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

declare void @roaring_bitmap_add(ptr noundef, i32 noundef) #1

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

declare void @roaring_init_iterator(ptr noundef, ptr noundef) #1

declare zeroext i1 @roaring_advance_uint32_iterator(ptr noundef) #1

declare zeroext i1 @roaring_previous_uint32_iterator(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @test_iterator_generate_data(ptr noundef, ptr noundef) #5

; Function Attrs: nounwind uwtable
define dso_local void @test_iterator_reuse_retry_count(i32 noundef %0) #5 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca [2 x ptr], align 16
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %struct.roaring_uint32_iterator_s, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @test_iterator_generate_data(ptr noundef %3, ptr noundef %4)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %17 = call ptr @roaring_bitmap_create()
  store ptr %17, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %18 = call ptr @roaring_bitmap_create()
  store ptr %18, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %46, %1
  %20 = load i32, ptr %7, align 4, !tbaa !5
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = icmp ult i32 %20, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %49

24:                                               ; preds = %19
  %25 = load ptr, ptr %5, align 8, !tbaa !9
  %26 = load ptr, ptr %3, align 8, !tbaa !9
  %27 = load i32, ptr %7, align 4, !tbaa !5
  %28 = zext i32 %27 to i64
  %29 = getelementptr inbounds i32, ptr %26, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !5
  call void @roaring_bitmap_add(ptr noundef %25, i32 noundef %30)
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %45

33:                                               ; preds = %24
  %34 = load i32, ptr %7, align 4, !tbaa !5
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = sub i32 %35, 1
  %37 = icmp ne i32 %34, %36
  br i1 %37, label %38, label %45

38:                                               ; preds = %33
  %39 = load ptr, ptr %6, align 8, !tbaa !9
  %40 = load ptr, ptr %3, align 8, !tbaa !9
  %41 = load i32, ptr %7, align 4, !tbaa !5
  %42 = zext i32 %41 to i64
  %43 = getelementptr inbounds i32, ptr %40, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  call void @roaring_bitmap_add(ptr noundef %39, i32 noundef %44)
  br label %45

45:                                               ; preds = %38, %33, %24
  br label %46

46:                                               ; preds = %45
  %47 = load i32, ptr %7, align 4, !tbaa !5
  %48 = add i32 %47, 1
  store i32 %48, ptr %7, align 4, !tbaa !5
  br label %19, !llvm.loop !11

49:                                               ; preds = %23
  %50 = load ptr, ptr %5, align 8, !tbaa !9
  %51 = call zeroext i1 @roaring_bitmap_contains(ptr noundef %50, i32 noundef 0)
  br i1 %51, label %52, label %53

52:                                               ; preds = %49
  br label %54

53:                                               ; preds = %49
  call void @__assert_fail(ptr noundef @.str.150, ptr noundef @.str.2, i32 noundef 3534, ptr noundef @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

54:                                               ; preds = %52
  %55 = load ptr, ptr %5, align 8, !tbaa !9
  %56 = call zeroext i1 @roaring_bitmap_contains(ptr noundef %55, i32 noundef -1)
  br i1 %56, label %57, label %58

57:                                               ; preds = %54
  br label %59

58:                                               ; preds = %54
  call void @__assert_fail(ptr noundef @.str.151, ptr noundef @.str.2, i32 noundef 3535, ptr noundef @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

59:                                               ; preds = %57
  %60 = load ptr, ptr %6, align 8, !tbaa !9
  %61 = call zeroext i1 @roaring_bitmap_contains(ptr noundef %60, i32 noundef 0)
  br i1 %61, label %63, label %62

62:                                               ; preds = %59
  br label %64

63:                                               ; preds = %59
  call void @__assert_fail(ptr noundef @.str.152, ptr noundef @.str.2, i32 noundef 3536, ptr noundef @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

64:                                               ; preds = %62
  %65 = load ptr, ptr %6, align 8, !tbaa !9
  %66 = call zeroext i1 @roaring_bitmap_contains(ptr noundef %65, i32 noundef -1)
  br i1 %66, label %68, label %67

67:                                               ; preds = %64
  br label %69

68:                                               ; preds = %64
  call void @__assert_fail(ptr noundef @.str.153, ptr noundef @.str.2, i32 noundef 3537, ptr noundef @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

69:                                               ; preds = %67
  %70 = load ptr, ptr %5, align 8, !tbaa !9
  %71 = call i64 @roaring_bitmap_get_cardinality(ptr noundef %70)
  %72 = sub i64 %71, 2
  %73 = load ptr, ptr %6, align 8, !tbaa !9
  %74 = call i64 @roaring_bitmap_get_cardinality(ptr noundef %73)
  %75 = icmp eq i64 %72, %74
  br i1 %75, label %76, label %77

76:                                               ; preds = %69
  br label %78

77:                                               ; preds = %69
  call void @__assert_fail(ptr noundef @.str.154, ptr noundef @.str.2, i32 noundef 3538, ptr noundef @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

78:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #6
  %79 = load ptr, ptr %5, align 8, !tbaa !9
  store ptr %79, ptr %8, align 8, !tbaa !9
  %80 = getelementptr inbounds ptr, ptr %8, i64 1
  %81 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %81, ptr %80, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 2, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %82

82:                                               ; preds = %177, %78
  %83 = load i32, ptr %10, align 4, !tbaa !5
  %84 = load i32, ptr %9, align 4, !tbaa !5
  %85 = icmp slt i32 %83, %84
  br i1 %85, label %87, label %86

86:                                               ; preds = %82
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %180

87:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 48, ptr %12) #6
  %88 = load i32, ptr %10, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [2 x ptr], ptr %8, i64 0, i64 %89
  %91 = load ptr, ptr %90, align 8, !tbaa !9
  call void @roaring_init_iterator(ptr noundef %91, ptr noundef %12)
  %92 = getelementptr inbounds %struct.roaring_uint32_iterator_s, ptr %12, i32 0, i32 5
  %93 = load i8, ptr %92, align 8, !tbaa !13, !range !16, !noundef !17
  %94 = trunc i8 %93 to i1
  br i1 %94, label %95, label %96

95:                                               ; preds = %87
  br label %97

96:                                               ; preds = %87
  call void @__assert_fail(ptr noundef @.str.146, ptr noundef @.str.2, i32 noundef 3546, ptr noundef @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

97:                                               ; preds = %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %98 = getelementptr inbounds %struct.roaring_uint32_iterator_s, ptr %12, i32 0, i32 4
  %99 = load i32, ptr %98, align 4, !tbaa !18
  store i32 %99, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %100

100:                                              ; preds = %104, %97
  %101 = getelementptr inbounds %struct.roaring_uint32_iterator_s, ptr %12, i32 0, i32 5
  %102 = load i8, ptr %101, align 8, !tbaa !13, !range !16, !noundef !17
  %103 = trunc i8 %102 to i1
  br i1 %103, label %104, label %108

104:                                              ; preds = %100
  %105 = load i32, ptr %14, align 4, !tbaa !5
  %106 = add i32 %105, 1
  store i32 %106, ptr %14, align 4, !tbaa !5
  %107 = call zeroext i1 @roaring_advance_uint32_iterator(ptr noundef %12)
  br label %100, !llvm.loop !19

108:                                              ; preds = %100
  %109 = load i32, ptr %14, align 4, !tbaa !5
  %110 = zext i32 %109 to i64
  %111 = load i32, ptr %10, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [2 x ptr], ptr %8, i64 0, i64 %112
  %114 = load ptr, ptr %113, align 8, !tbaa !9
  %115 = call i64 @roaring_bitmap_get_cardinality(ptr noundef %114)
  %116 = icmp eq i64 %110, %115
  br i1 %116, label %117, label %118

117:                                              ; preds = %108
  br label %119

118:                                              ; preds = %108
  call void @__assert_fail(ptr noundef @.str.155, ptr noundef @.str.2, i32 noundef 3554, ptr noundef @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

119:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %120

120:                                              ; preds = %127, %119
  %121 = load i32, ptr %15, align 4, !tbaa !5
  %122 = load i32, ptr %2, align 4, !tbaa !5
  %123 = icmp slt i32 %121, %122
  br i1 %123, label %125, label %124

124:                                              ; preds = %120
  store i32 10, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %130

125:                                              ; preds = %120
  %126 = call zeroext i1 @roaring_advance_uint32_iterator(ptr noundef %12)
  br label %127

127:                                              ; preds = %125
  %128 = load i32, ptr %15, align 4, !tbaa !5
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %15, align 4, !tbaa !5
  br label %120, !llvm.loop !20

130:                                              ; preds = %124
  %131 = call zeroext i1 @roaring_previous_uint32_iterator(ptr noundef %12)
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %132

132:                                              ; preds = %136, %130
  %133 = getelementptr inbounds %struct.roaring_uint32_iterator_s, ptr %12, i32 0, i32 5
  %134 = load i8, ptr %133, align 8, !tbaa !13, !range !16, !noundef !17
  %135 = trunc i8 %134 to i1
  br i1 %135, label %136, label %140

136:                                              ; preds = %132
  %137 = load i32, ptr %14, align 4, !tbaa !5
  %138 = add i32 %137, 1
  store i32 %138, ptr %14, align 4, !tbaa !5
  %139 = call zeroext i1 @roaring_previous_uint32_iterator(ptr noundef %12)
  br label %132, !llvm.loop !21

140:                                              ; preds = %132
  %141 = load i32, ptr %14, align 4, !tbaa !5
  %142 = zext i32 %141 to i64
  %143 = load i32, ptr %10, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [2 x ptr], ptr %8, i64 0, i64 %144
  %146 = load ptr, ptr %145, align 8, !tbaa !9
  %147 = call i64 @roaring_bitmap_get_cardinality(ptr noundef %146)
  %148 = icmp eq i64 %142, %147
  br i1 %148, label %149, label %150

149:                                              ; preds = %140
  br label %151

150:                                              ; preds = %140
  call void @__assert_fail(ptr noundef @.str.155, ptr noundef @.str.2, i32 noundef 3568, ptr noundef @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

151:                                              ; preds = %149
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %152

152:                                              ; preds = %159, %151
  %153 = load i32, ptr %16, align 4, !tbaa !5
  %154 = load i32, ptr %2, align 4, !tbaa !5
  %155 = icmp slt i32 %153, %154
  br i1 %155, label %157, label %156

156:                                              ; preds = %152
  store i32 15, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %162

157:                                              ; preds = %152
  %158 = call zeroext i1 @roaring_previous_uint32_iterator(ptr noundef %12)
  br label %159

159:                                              ; preds = %157
  %160 = load i32, ptr %16, align 4, !tbaa !5
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %16, align 4, !tbaa !5
  br label %152, !llvm.loop !22

162:                                              ; preds = %156
  %163 = call zeroext i1 @roaring_advance_uint32_iterator(ptr noundef %12)
  %164 = getelementptr inbounds %struct.roaring_uint32_iterator_s, ptr %12, i32 0, i32 5
  %165 = load i8, ptr %164, align 8, !tbaa !13, !range !16, !noundef !17
  %166 = trunc i8 %165 to i1
  br i1 %166, label %167, label %168

167:                                              ; preds = %162
  br label %169

168:                                              ; preds = %162
  call void @__assert_fail(ptr noundef @.str.146, ptr noundef @.str.2, i32 noundef 3576, ptr noundef @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

169:                                              ; preds = %167
  %170 = load i32, ptr %13, align 4, !tbaa !5
  %171 = getelementptr inbounds %struct.roaring_uint32_iterator_s, ptr %12, i32 0, i32 4
  %172 = load i32, ptr %171, align 4, !tbaa !18
  %173 = icmp eq i32 %170, %172
  br i1 %173, label %174, label %175

174:                                              ; preds = %169
  br label %176

175:                                              ; preds = %169
  call void @__assert_fail(ptr noundef @.str.156, ptr noundef @.str.2, i32 noundef 3577, ptr noundef @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

176:                                              ; preds = %174
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %12) #6
  br label %177

177:                                              ; preds = %176
  %178 = load i32, ptr %10, align 4, !tbaa !5
  %179 = add nsw i32 %178, 1
  store i32 %179, ptr %10, align 4, !tbaa !5
  br label %82, !llvm.loop !23

180:                                              ; preds = %86
  %181 = load ptr, ptr %6, align 8, !tbaa !9
  call void @roaring_bitmap_free(ptr noundef %181)
  %182 = load ptr, ptr %5, align 8, !tbaa !9
  call void @roaring_bitmap_free(ptr noundef %182)
  %183 = load ptr, ptr %3, align 8, !tbaa !9
  call void @free(ptr noundef %183) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { noreturn 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 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { noreturn 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 = !{!"int", !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 = !{!14, !15, i64 24}
!14 = !{!"roaring_uint32_iterator_s", !10, i64 0, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !15, i64 24, !10, i64 32, !7, i64 40, !6, i64 44}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!14, !6, i64 20}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !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.roaring_uint32_iterator_s = type { ptr, i32, i32, i32, i32, i8, ptr, i8, i32 }

@.str.2 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.146 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.150 = external hidden unnamed_addr constant [39 x i8], align 1
@__PRETTY_FUNCTION__.test_iterator_reuse_retry_count = external hidden unnamed_addr constant [42 x i8], align 1
@.str.151 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.152 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.153 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.154 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.155 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.156 = external hidden unnamed_addr constant [38 x i8], align 1

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

declare void @roaring_bitmap_free(ptr noundef) local_unnamed_addr #1

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

declare ptr @roaring_bitmap_create() local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare zeroext i1 @roaring_bitmap_contains(ptr noundef, i32 noundef) local_unnamed_addr #2

declare i64 @roaring_bitmap_get_cardinality(ptr noundef) local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

declare void @roaring_bitmap_add(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

declare void @roaring_init_iterator(ptr noundef, ptr noundef) local_unnamed_addr #1

declare zeroext i1 @roaring_advance_uint32_iterator(ptr noundef) local_unnamed_addr #1

declare zeroext i1 @roaring_previous_uint32_iterator(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @test_iterator_generate_data(ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: nounwind uwtable
define dso_local void @test_iterator_reuse_retry_count(i32 noundef %0) local_unnamed_addr #5 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca %struct.roaring_uint32_iterator_s, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  call void @test_iterator_generate_data(ptr noundef nonnull %2, ptr noundef nonnull %3)
  %5 = call ptr @roaring_bitmap_create() #6
  %6 = call ptr @roaring_bitmap_create() #6
  %7 = load i32, ptr %3, align 4, !tbaa !5
  %.not58 = icmp eq i32 %7, 0
  br i1 %.not58, label %._crit_edge, label %8

8:                                                ; preds = %1
  %9 = load ptr, ptr %2, align 8, !tbaa !9
  %10 = load i32, ptr %9, align 4, !tbaa !5
  call void @roaring_bitmap_add(ptr noundef %5, i32 noundef %10) #6
  %.pre = load i32, ptr %3, align 4, !tbaa !5
  %11 = icmp ugt i32 %.pre, 1
  br i1 %11, label %.lr.ph.peel.next, label %._crit_edge

._crit_edge:                                      ; preds = %23, %8, %1
  %12 = call zeroext i1 @roaring_bitmap_contains(ptr noundef %5, i32 noundef 0)
  br i1 %12, label %28, label %27

.lr.ph.peel.next:                                 ; preds = %8, %23
  %indvars.iv = phi i64 [ %indvars.iv.next, %23 ], [ 1, %8 ]
  %13 = load ptr, ptr %2, align 8, !tbaa !9
  %14 = getelementptr inbounds i32, ptr %13, i64 %indvars.iv
  %15 = load i32, ptr %14, align 4, !tbaa !5
  call void @roaring_bitmap_add(ptr noundef %5, i32 noundef %15) #6
  %16 = load i32, ptr %3, align 4, !tbaa !5
  %17 = add i32 %16, -1
  %18 = zext i32 %17 to i64
  %.not39 = icmp eq i64 %indvars.iv, %18
  br i1 %.not39, label %23, label %19

19:                                               ; preds = %.lr.ph.peel.next
  %20 = load ptr, ptr %2, align 8, !tbaa !9
  %21 = getelementptr inbounds i32, ptr %20, i64 %indvars.iv
  %22 = load i32, ptr %21, align 4, !tbaa !5
  call void @roaring_bitmap_add(ptr noundef %6, i32 noundef %22) #6
  br label %23

23:                                               ; preds = %.lr.ph.peel.next, %19
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %24 = load i32, ptr %3, align 4, !tbaa !5
  %25 = zext i32 %24 to i64
  %26 = icmp ult i64 %indvars.iv.next, %25
  br i1 %26, label %.lr.ph.peel.next, label %._crit_edge, !llvm.loop !11

27:                                               ; preds = %._crit_edge
  call void @__assert_fail(ptr noundef nonnull @.str.150, ptr noundef nonnull @.str.2, i32 noundef 3534, ptr noundef nonnull @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

28:                                               ; preds = %._crit_edge
  %29 = call zeroext i1 @roaring_bitmap_contains(ptr noundef %5, i32 noundef -1)
  br i1 %29, label %31, label %30

30:                                               ; preds = %28
  call void @__assert_fail(ptr noundef nonnull @.str.151, ptr noundef nonnull @.str.2, i32 noundef 3535, ptr noundef nonnull @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

31:                                               ; preds = %28
  %32 = call zeroext i1 @roaring_bitmap_contains(ptr noundef %6, i32 noundef 0)
  br i1 %32, label %33, label %34

33:                                               ; preds = %31
  call void @__assert_fail(ptr noundef nonnull @.str.152, ptr noundef nonnull @.str.2, i32 noundef 3536, ptr noundef nonnull @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

34:                                               ; preds = %31
  %35 = call zeroext i1 @roaring_bitmap_contains(ptr noundef %6, i32 noundef -1)
  br i1 %35, label %36, label %37

36:                                               ; preds = %34
  call void @__assert_fail(ptr noundef nonnull @.str.153, ptr noundef nonnull @.str.2, i32 noundef 3537, ptr noundef nonnull @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

37:                                               ; preds = %34
  %38 = call i64 @roaring_bitmap_get_cardinality(ptr noundef %5) #6
  %39 = add i64 %38, -2
  %40 = call i64 @roaring_bitmap_get_cardinality(ptr noundef %6) #6
  %41 = icmp eq i64 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %37
  call void @__assert_fail(ptr noundef nonnull @.str.154, ptr noundef nonnull @.str.2, i32 noundef 3538, ptr noundef nonnull @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

43:                                               ; preds = %37
  %44 = getelementptr inbounds i8, ptr %4, i64 24
  %45 = getelementptr inbounds i8, ptr %4, i64 20
  %46 = icmp sgt i32 %0, 0
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #6
  call void @roaring_init_iterator(ptr noundef %5, ptr noundef nonnull %4) #6
  %47 = load i8, ptr %44, align 8, !tbaa !14, !range !17, !noundef !18
  %48 = trunc nuw i8 %47 to i1
  br i1 %48, label %.lr.ph44.preheader, label %49

49:                                               ; preds = %82, %43
  call void @__assert_fail(ptr noundef nonnull @.str.146, ptr noundef nonnull @.str.2, i32 noundef 3546, ptr noundef nonnull @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

.lr.ph44.preheader:                               ; preds = %43
  %50 = load i32, ptr %45, align 4, !tbaa !19
  br label %.lr.ph44

.lr.ph44:                                         ; preds = %.lr.ph44.preheader, %.lr.ph44
  %.03542 = phi i32 [ %51, %.lr.ph44 ], [ 0, %.lr.ph44.preheader ]
  %51 = add i32 %.03542, 1
  %52 = call zeroext i1 @roaring_advance_uint32_iterator(ptr noundef nonnull %4) #6
  %53 = load i8, ptr %44, align 8, !tbaa !14, !range !17, !noundef !18
  %54 = trunc nuw i8 %53 to i1
  br i1 %54, label %.lr.ph44, label %._crit_edge45, !llvm.loop !20

._crit_edge45:                                    ; preds = %.lr.ph44
  %55 = zext i32 %51 to i64
  %56 = call i64 @roaring_bitmap_get_cardinality(ptr noundef %5) #6
  %57 = icmp eq i64 %56, %55
  br i1 %57, label %.preheader40, label %58

.preheader40:                                     ; preds = %._crit_edge45
  br i1 %46, label %.lr.ph47, label %._crit_edge48

58:                                               ; preds = %._crit_edge45.1, %._crit_edge45
  call void @__assert_fail(ptr noundef nonnull @.str.155, ptr noundef nonnull @.str.2, i32 noundef 3554, ptr noundef nonnull @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

._crit_edge48:                                    ; preds = %.lr.ph47, %.preheader40
  %59 = call zeroext i1 @roaring_previous_uint32_iterator(ptr noundef nonnull %4) #6
  %60 = load i8, ptr %44, align 8, !tbaa !14, !range !17, !noundef !18
  %61 = trunc nuw i8 %60 to i1
  br i1 %61, label %.lr.ph51, label %._crit_edge52

.lr.ph47:                                         ; preds = %.preheader40, %.lr.ph47
  %.03446 = phi i32 [ %63, %.lr.ph47 ], [ 0, %.preheader40 ]
  %62 = call zeroext i1 @roaring_advance_uint32_iterator(ptr noundef nonnull %4) #6
  %63 = add nuw nsw i32 %.03446, 1
  %exitcond.not = icmp eq i32 %63, %0
  br i1 %exitcond.not, label %._crit_edge48, label %.lr.ph47, !llvm.loop !21

.lr.ph51:                                         ; preds = %._crit_edge48, %.lr.ph51
  %.149 = phi i32 [ %64, %.lr.ph51 ], [ 0, %._crit_edge48 ]
  %64 = add i32 %.149, 1
  %65 = call zeroext i1 @roaring_previous_uint32_iterator(ptr noundef nonnull %4) #6
  %66 = load i8, ptr %44, align 8, !tbaa !14, !range !17, !noundef !18
  %67 = trunc nuw i8 %66 to i1
  br i1 %67, label %.lr.ph51, label %._crit_edge52, !llvm.loop !22

._crit_edge52:                                    ; preds = %.lr.ph51, %._crit_edge48
  %.1.lcssa = phi i32 [ 0, %._crit_edge48 ], [ %64, %.lr.ph51 ]
  %68 = zext i32 %.1.lcssa to i64
  %69 = call i64 @roaring_bitmap_get_cardinality(ptr noundef %5) #6
  %70 = icmp eq i64 %69, %68
  br i1 %70, label %.preheader, label %71

.preheader:                                       ; preds = %._crit_edge52
  br i1 %46, label %.lr.ph55, label %._crit_edge56

71:                                               ; preds = %._crit_edge52.1, %._crit_edge52
  call void @__assert_fail(ptr noundef nonnull @.str.155, ptr noundef nonnull @.str.2, i32 noundef 3568, ptr noundef nonnull @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

._crit_edge56:                                    ; preds = %.lr.ph55, %.preheader
  %72 = call zeroext i1 @roaring_advance_uint32_iterator(ptr noundef nonnull %4) #6
  %73 = load i8, ptr %44, align 8, !tbaa !14, !range !17, !noundef !18
  %74 = trunc nuw i8 %73 to i1
  br i1 %74, label %78, label %77

.lr.ph55:                                         ; preds = %.preheader, %.lr.ph55
  %.054 = phi i32 [ %76, %.lr.ph55 ], [ 0, %.preheader ]
  %75 = call zeroext i1 @roaring_previous_uint32_iterator(ptr noundef nonnull %4) #6
  %76 = add nuw nsw i32 %.054, 1
  %exitcond62.not = icmp eq i32 %76, %0
  br i1 %exitcond62.not, label %._crit_edge56, label %.lr.ph55, !llvm.loop !23

77:                                               ; preds = %._crit_edge56.1, %._crit_edge56
  call void @__assert_fail(ptr noundef nonnull @.str.146, ptr noundef nonnull @.str.2, i32 noundef 3576, ptr noundef nonnull @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

78:                                               ; preds = %._crit_edge56
  %79 = load i32, ptr %45, align 4, !tbaa !19
  %80 = icmp eq i32 %50, %79
  br i1 %80, label %82, label %81

81:                                               ; preds = %110, %78
  call void @__assert_fail(ptr noundef nonnull @.str.156, ptr noundef nonnull @.str.2, i32 noundef 3577, ptr noundef nonnull @__PRETTY_FUNCTION__.test_iterator_reuse_retry_count) #7
  unreachable

82:                                               ; preds = %78
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #6
  call void @roaring_init_iterator(ptr noundef %6, ptr noundef nonnull %4) #6
  %83 = load i8, ptr %44, align 8, !tbaa !14, !range !17, !noundef !18
  %84 = trunc nuw i8 %83 to i1
  br i1 %84, label %.lr.ph44.preheader.1, label %49

.lr.ph44.preheader.1:                             ; preds = %82
  %85 = load i32, ptr %45, align 4, !tbaa !19
  br label %.lr.ph44.1

.lr.ph44.1:                                       ; preds = %.lr.ph44.1, %.lr.ph44.preheader.1
  %.03542.1 = phi i32 [ %86, %.lr.ph44.1 ], [ 0, %.lr.ph44.preheader.1 ]
  %86 = add i32 %.03542.1, 1
  %87 = call zeroext i1 @roaring_advance_uint32_iterator(ptr noundef nonnull %4) #6
  %88 = load i8, ptr %44, align 8, !tbaa !14, !range !17, !noundef !18
  %89 = trunc nuw i8 %88 to i1
  br i1 %89, label %.lr.ph44.1, label %._crit_edge45.1, !llvm.loop !20

._crit_edge45.1:                                  ; preds = %.lr.ph44.1
  %90 = zext i32 %86 to i64
  %91 = call i64 @roaring_bitmap_get_cardinality(ptr noundef %6) #6
  %92 = icmp eq i64 %91, %90
  br i1 %92, label %.preheader40.1, label %58

.preheader40.1:                                   ; preds = %._crit_edge45.1
  br i1 %46, label %.lr.ph47.1, label %._crit_edge48.1

.lr.ph47.1:                                       ; preds = %.preheader40.1, %.lr.ph47.1
  %.03446.1 = phi i32 [ %94, %.lr.ph47.1 ], [ 0, %.preheader40.1 ]
  %93 = call zeroext i1 @roaring_advance_uint32_iterator(ptr noundef nonnull %4) #6
  %94 = add nuw nsw i32 %.03446.1, 1
  %exitcond.1.not = icmp eq i32 %94, %0
  br i1 %exitcond.1.not, label %._crit_edge48.1, label %.lr.ph47.1, !llvm.loop !21

._crit_edge48.1:                                  ; preds = %.lr.ph47.1, %.preheader40.1
  %95 = call zeroext i1 @roaring_previous_uint32_iterator(ptr noundef nonnull %4) #6
  %96 = load i8, ptr %44, align 8, !tbaa !14, !range !17, !noundef !18
  %97 = trunc nuw i8 %96 to i1
  br i1 %97, label %.lr.ph51.1, label %._crit_edge52.1

.lr.ph51.1:                                       ; preds = %._crit_edge48.1, %.lr.ph51.1
  %.149.1 = phi i32 [ %98, %.lr.ph51.1 ], [ 0, %._crit_edge48.1 ]
  %98 = add i32 %.149.1, 1
  %99 = call zeroext i1 @roaring_previous_uint32_iterator(ptr noundef nonnull %4) #6
  %100 = load i8, ptr %44, align 8, !tbaa !14, !range !17, !noundef !18
  %101 = trunc nuw i8 %100 to i1
  br i1 %101, label %.lr.ph51.1, label %._crit_edge52.loopexit.1, !llvm.loop !22

._crit_edge52.loopexit.1:                         ; preds = %.lr.ph51.1
  %102 = zext i32 %98 to i64
  br label %._crit_edge52.1

._crit_edge52.1:                                  ; preds = %._crit_edge52.loopexit.1, %._crit_edge48.1
  %.1.lcssa.1 = phi i64 [ 0, %._crit_edge48.1 ], [ %102, %._crit_edge52.loopexit.1 ]
  %103 = call i64 @roaring_bitmap_get_cardinality(ptr noundef %6) #6
  %104 = icmp eq i64 %103, %.1.lcssa.1
  br i1 %104, label %.preheader.1, label %71

.preheader.1:                                     ; preds = %._crit_edge52.1
  br i1 %46, label %.lr.ph55.1, label %._crit_edge56.1

.lr.ph55.1:                                       ; preds = %.preheader.1, %.lr.ph55.1
  %.054.1 = phi i32 [ %106, %.lr.ph55.1 ], [ 0, %.preheader.1 ]
  %105 = call zeroext i1 @roaring_previous_uint32_iterator(ptr noundef nonnull %4) #6
  %106 = add nuw nsw i32 %.054.1, 1
  %exitcond62.1.not = icmp eq i32 %106, %0
  br i1 %exitcond62.1.not, label %._crit_edge56.1, label %.lr.ph55.1, !llvm.loop !23

._crit_edge56.1:                                  ; preds = %.lr.ph55.1, %.preheader.1
  %107 = call zeroext i1 @roaring_advance_uint32_iterator(ptr noundef nonnull %4) #6
  %108 = load i8, ptr %44, align 8, !tbaa !14, !range !17, !noundef !18
  %109 = trunc nuw i8 %108 to i1
  br i1 %109, label %110, label %77

110:                                              ; preds = %._crit_edge56.1
  %111 = load i32, ptr %45, align 4, !tbaa !19
  %112 = icmp eq i32 %85, %111
  br i1 %112, label %113, label %81

113:                                              ; preds = %110
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #6
  call void @roaring_bitmap_free(ptr noundef %6) #6
  call void @roaring_bitmap_free(ptr noundef %5) #6
  %114 = load ptr, ptr %2, align 8, !tbaa !9
  call void @free(ptr noundef %114) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { noreturn 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 willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 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 #6 = { nounwind }
attributes #7 = { noreturn 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 = !{!"int", !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, !13}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.peeled.count", i32 1}
!14 = !{!15, !16, i64 24}
!15 = !{!"roaring_uint32_iterator_s", !10, i64 0, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !16, i64 24, !10, i64 32, !7, i64 40, !6, i64 44}
!16 = !{!"_Bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!15, !6, i64 20}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}


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