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

@.str.2 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.122 = external hidden unnamed_addr constant [12 x i8], align 1
@__PRETTY_FUNCTION__.select_test = external hidden unnamed_addr constant [19 x i8], align 1
@.str.127 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.128 = external hidden unnamed_addr constant [62 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

declare void @_assert_true(i64 noundef, ptr noundef, ptr noundef, i32 noundef) #1

declare i64 @roaring_bitmap_get_cardinality(ptr noundef) #1

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

declare ptr @roaring_bitmap_copy(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 allocsize(0)
declare noalias ptr @malloc(i64 noundef) #4

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

declare zeroext i1 @roaring_bitmap_run_optimize(ptr noundef) #1

declare void @_assert_int_equal(i64 noundef, i64 noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind
declare void @srand(i32 noundef) #5

; Function Attrs: nounwind uwtable
define dso_local void @select_test() #7 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  %17 = alloca [2 x ptr], align 16
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  call void @srand(i32 noundef 1234) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #8
  store i32 1, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 2000000, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #8
  %23 = call noalias ptr @malloc(i64 noundef 2000000) #9
  store ptr %23, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 2, ptr %4, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %177, %0
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = icmp slt i32 %25, 1000000
  br i1 %26, label %28, label %27

27:                                               ; preds = %24
  store i32 2, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %180

28:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %29 = call ptr @roaring_bitmap_create()
  store ptr %29, ptr %6, align 8, !tbaa !9
  %30 = load ptr, ptr %3, align 8, !tbaa !9
  call void @llvm.memset.p0.i64(ptr align 1 %30, i8 0, i64 2000000, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %64, %28
  %32 = load i32, ptr %7, align 4, !tbaa !5
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = icmp slt i32 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %67

36:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %37 = call i32 @our_rand()
  %38 = uitofp i32 %37 to double
  %39 = fdiv double %38, 0x41CFFFFFFF800000
  store double %39, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %40 = call i32 @our_rand()
  %41 = uitofp i32 %40 to double
  %42 = fdiv double %41, 0x41CFFFFFFF800000
  store double %42, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %43 = call i32 @our_rand()
  %44 = uitofp i32 %43 to double
  %45 = fdiv double %44, 0x41CFFFFFFF800000
  store double %45, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  %46 = load double, ptr %8, align 8, !tbaa !11
  %47 = load double, ptr %9, align 8, !tbaa !11
  %48 = fmul double %46, %47
  %49 = load double, ptr %10, align 8, !tbaa !11
  %50 = fmul double %48, %49
  %51 = fmul double %50, 2.000000e+06
  %52 = fptoui double %51 to i32
  store i32 %52, ptr %11, align 4, !tbaa !5
  %53 = load i32, ptr %11, align 4, !tbaa !5
  %54 = icmp ult i32 %53, 2000000
  br i1 %54, label %55, label %56

55:                                               ; preds = %36
  br label %57

56:                                               ; preds = %36
  call void @__assert_fail(ptr noundef @.str.122, ptr noundef @.str.2, i32 noundef 3101, ptr noundef @__PRETTY_FUNCTION__.select_test) #10
  unreachable

57:                                               ; preds = %55
  %58 = load ptr, ptr %6, align 8, !tbaa !9
  %59 = load i32, ptr %11, align 4, !tbaa !5
  call void @roaring_bitmap_add(ptr noundef %58, i32 noundef %59)
  %60 = load ptr, ptr %3, align 8, !tbaa !9
  %61 = load i32, ptr %11, align 4, !tbaa !5
  %62 = zext i32 %61 to i64
  %63 = getelementptr inbounds i8, ptr %60, i64 %62
  store i8 1, ptr %63, align 1, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  br label %64

64:                                               ; preds = %57
  %65 = load i32, ptr %7, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %7, align 4, !tbaa !5
  br label %31, !llvm.loop !14

67:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %98, %67
  %69 = load i32, ptr %12, align 4, !tbaa !5
  %70 = icmp slt i32 %69, 1
  br i1 %70, label %72, label %71

71:                                               ; preds = %68
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %101

72:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  %73 = call i32 @our_rand()
  %74 = urem i32 %73, 1000000
  store i32 %74, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  %75 = load i32, ptr %13, align 4, !tbaa !5
  store i32 %75, ptr %14, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %94, %72
  %77 = load i32, ptr %14, align 4, !tbaa !5
  %78 = load i32, ptr %13, align 4, !tbaa !5
  %79 = add nsw i32 %78, 131072
  %80 = icmp slt i32 %77, %79
  br i1 %80, label %82, label %81

81:                                               ; preds = %76
  store i32 11, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %97

82:                                               ; preds = %76
  %83 = load i32, ptr %14, align 4, !tbaa !5
  %84 = srem i32 %83, 147
  %85 = icmp slt i32 %84, 100
  br i1 %85, label %86, label %93

86:                                               ; preds = %82
  %87 = load ptr, ptr %6, align 8, !tbaa !9
  %88 = load i32, ptr %14, align 4, !tbaa !5
  call void @roaring_bitmap_add(ptr noundef %87, i32 noundef %88)
  %89 = load ptr, ptr %3, align 8, !tbaa !9
  %90 = load i32, ptr %14, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds i8, ptr %89, i64 %91
  store i8 1, ptr %92, align 1, !tbaa !13
  br label %93

93:                                               ; preds = %86, %82
  br label %94

94:                                               ; preds = %93
  %95 = load i32, ptr %14, align 4, !tbaa !5
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %14, align 4, !tbaa !5
  br label %76, !llvm.loop !16

97:                                               ; preds = %81
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %98

98:                                               ; preds = %97
  %99 = load i32, ptr %12, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %12, align 4, !tbaa !5
  br label %68, !llvm.loop !17

101:                                              ; preds = %71
  %102 = load ptr, ptr %6, align 8, !tbaa !9
  %103 = call zeroext i1 @roaring_bitmap_run_optimize(ptr noundef %102)
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %104 = load ptr, ptr %6, align 8, !tbaa !9
  %105 = call i64 @roaring_bitmap_get_cardinality(ptr noundef %104)
  store i64 %105, ptr %15, align 8, !tbaa !18
  %106 = load ptr, ptr %6, align 8, !tbaa !9
  call void @roaring_bitmap_set_copy_on_write(ptr noundef %106, i1 noundef zeroext true)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %107 = load ptr, ptr %6, align 8, !tbaa !9
  %108 = call ptr @roaring_bitmap_copy(ptr noundef %107)
  store ptr %108, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #8
  %109 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %109, ptr %17, align 8, !tbaa !9
  %110 = getelementptr inbounds ptr, ptr %17, i64 1
  %111 = load ptr, ptr %16, align 8, !tbaa !9
  store ptr %111, ptr %110, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %171, %101
  %113 = load i32, ptr %18, align 4, !tbaa !5
  %114 = icmp ult i32 %113, 2
  br i1 %114, label %116, label %115

115:                                              ; preds = %112
  store i32 14, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  br label %174

116:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  store i32 0, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #8
  store i32 0, ptr %21, align 4, !tbaa !5
  br label %117

117:                                              ; preds = %145, %116
  %118 = load i32, ptr %21, align 4, !tbaa !5
  %119 = zext i32 %118 to i64
  %120 = load i64, ptr %15, align 8, !tbaa !18
  %121 = icmp ult i64 %119, %120
  br i1 %121, label %123, label %122

122:                                              ; preds = %117
  store i32 17, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  br label %148

123:                                              ; preds = %117
  %124 = load ptr, ptr %3, align 8, !tbaa !9
  %125 = load i32, ptr %21, align 4, !tbaa !5
  %126 = zext i32 %125 to i64
  %127 = getelementptr inbounds i8, ptr %124, i64 %126
  %128 = load i8, ptr %127, align 1, !tbaa !13
  %129 = icmp ne i8 %128, 0
  br i1 %129, label %130, label %144

130:                                              ; preds = %123
  %131 = load i32, ptr %18, align 4, !tbaa !5
  %132 = zext i32 %131 to i64
  %133 = getelementptr inbounds [2 x ptr], ptr %17, i64 0, i64 %132
  %134 = load ptr, ptr %133, align 8, !tbaa !9
  %135 = load i32, ptr %19, align 4, !tbaa !5
  %136 = call zeroext i1 @roaring_bitmap_select(ptr noundef %134, i32 noundef %135, ptr noundef %20)
  %137 = zext i1 %136 to i64
  call void @_assert_true(i64 noundef %137, ptr noundef @.str.127, ptr noundef @.str.2, i32 noundef 3126)
  %138 = load i32, ptr %21, align 4, !tbaa !5
  %139 = zext i32 %138 to i64
  %140 = load i32, ptr %20, align 4, !tbaa !5
  %141 = zext i32 %140 to i64
  call void @_assert_int_equal(i64 noundef %139, i64 noundef %141, ptr noundef @.str.2, i32 noundef 3127)
  %142 = load i32, ptr %19, align 4, !tbaa !5
  %143 = add i32 %142, 1
  store i32 %143, ptr %19, align 4, !tbaa !5
  br label %144

144:                                              ; preds = %130, %123
  br label %145

145:                                              ; preds = %144
  %146 = load i32, ptr %21, align 4, !tbaa !5
  %147 = add i32 %146, 1
  store i32 %147, ptr %21, align 4, !tbaa !5
  br label %117, !llvm.loop !20

148:                                              ; preds = %122
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #8
  store i32 0, ptr %22, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %167, %148
  %150 = load i32, ptr %22, align 4, !tbaa !5
  %151 = icmp ult i32 %150, 10
  br i1 %151, label %153, label %152

152:                                              ; preds = %149
  store i32 20, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #8
  br label %170

153:                                              ; preds = %149
  %154 = load i32, ptr %18, align 4, !tbaa !5
  %155 = zext i32 %154 to i64
  %156 = getelementptr inbounds [2 x ptr], ptr %17, i64 0, i64 %155
  %157 = load ptr, ptr %156, align 8, !tbaa !9
  %158 = load i64, ptr %15, align 8, !tbaa !18
  %159 = load i32, ptr %22, align 4, !tbaa !5
  %160 = zext i32 %159 to i64
  %161 = add i64 %158, %160
  %162 = trunc i64 %161 to i32
  %163 = call zeroext i1 @roaring_bitmap_select(ptr noundef %157, i32 noundef %162, ptr noundef %20)
  %164 = xor i1 %163, true
  %165 = zext i1 %164 to i32
  %166 = sext i32 %165 to i64
  call void @_assert_true(i64 noundef %166, ptr noundef @.str.128, ptr noundef @.str.2, i32 noundef 3133)
  br label %167

167:                                              ; preds = %153
  %168 = load i32, ptr %22, align 4, !tbaa !5
  %169 = add i32 %168, 1
  store i32 %169, ptr %22, align 4, !tbaa !5
  br label %149, !llvm.loop !21

170:                                              ; preds = %152
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %171

171:                                              ; preds = %170
  %172 = load i32, ptr %18, align 4, !tbaa !5
  %173 = add i32 %172, 1
  store i32 %173, ptr %18, align 4, !tbaa !5
  br label %112, !llvm.loop !22

174:                                              ; preds = %115
  %175 = load ptr, ptr %6, align 8, !tbaa !9
  call void @roaring_bitmap_free(ptr noundef %175)
  %176 = load ptr, ptr %16, align 8, !tbaa !9
  call void @roaring_bitmap_free(ptr noundef %176)
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  br label %177

177:                                              ; preds = %174
  %178 = load i32, ptr %4, align 4, !tbaa !5
  %179 = mul nsw i32 %178, 8
  store i32 %179, ptr %4, align 4, !tbaa !5
  br label %24, !llvm.loop !23

180:                                              ; preds = %27
  %181 = load ptr, ptr %3, align 8, !tbaa !9
  call void @free(ptr noundef %181) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #8
  ret void
}

declare zeroext i1 @roaring_bitmap_select(ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @our_rand() #2

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 allocsize(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 "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
attributes #10 = { 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 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = !{!19, !19, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = distinct !{!20, !15}
!21 = distinct !{!21, !15}
!22 = distinct !{!22, !15}
!23 = distinct !{!23, !15}


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

@.str.2 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.122 = external hidden unnamed_addr constant [12 x i8], align 1
@__PRETTY_FUNCTION__.select_test = external hidden unnamed_addr constant [19 x i8], align 1
@.str.127 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.128 = external hidden unnamed_addr constant [62 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

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

declare i64 @roaring_bitmap_get_cardinality(ptr noundef) local_unnamed_addr #1

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

declare ptr @roaring_bitmap_copy(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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

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

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

; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #7

; Function Attrs: nounwind uwtable
define dso_local void @select_test() local_unnamed_addr #8 {
  %1 = alloca i32, align 4
  tail call void @srand(i32 noundef 1234) #9
  %2 = tail call noalias dereferenceable_or_null(2000000) ptr @malloc(i64 noundef 2000000) #10
  br label %4

3:                                                ; preds = %.preheader.1
  call void @free(ptr noundef %2) #9
  ret void

4:                                                ; preds = %0, %.preheader.1
  %.05265 = phi i32 [ 2, %0 ], [ %129, %.preheader.1 ]
  %5 = call ptr @roaring_bitmap_create() #9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(2000000) %2, i8 0, i64 2000000, i1 false)
  br label %6

6:                                                ; preds = %4, %24
  %.05459 = phi i32 [ 0, %4 ], [ %27, %24 ]
  %7 = call i32 @our_rand()
  %8 = call i32 @our_rand()
  %9 = uitofp i32 %8 to double
  %10 = fdiv double %9, 0x41CFFFFFFF800000
  %11 = call i32 @our_rand()
  %12 = insertelement <2 x i32> poison, i32 %7, i64 0
  %13 = insertelement <2 x i32> %12, i32 %11, i64 1
  %14 = uitofp <2 x i32> %13 to <2 x double>
  %15 = fdiv <2 x double> %14, <double 0x41CFFFFFFF800000, double 0x41CFFFFFFF800000>
  %16 = extractelement <2 x double> %15, i64 0
  %17 = fmul double %16, %10
  %18 = extractelement <2 x double> %15, i64 1
  %19 = fmul double %17, %18
  %20 = fmul double %19, 2.000000e+06
  %21 = fptoui double %20 to i32
  %22 = icmp ult i32 %21, 2000000
  br i1 %22, label %24, label %23

23:                                               ; preds = %6
  call void @__assert_fail(ptr noundef nonnull @.str.122, ptr noundef nonnull @.str.2, i32 noundef 3101, ptr noundef nonnull @__PRETTY_FUNCTION__.select_test) #11
  unreachable

24:                                               ; preds = %6
  call void @roaring_bitmap_add(ptr noundef %5, i32 noundef %21) #9
  %25 = zext nneg i32 %21 to i64
  %26 = getelementptr inbounds i8, ptr %2, i64 %25
  store i8 1, ptr %26, align 1, !tbaa !5
  %27 = add nuw nsw i32 %.05459, 1
  %exitcond.not = icmp eq i32 %27, %.05265
  br i1 %exitcond.not, label %28, label %6, !llvm.loop !8

28:                                               ; preds = %24
  %29 = call i32 @our_rand()
  %.fr71 = freeze i32 %29
  %30 = urem i32 %.fr71, 1000000
  %31 = add nuw nsw i32 %30, 131072
  %32 = urem i32 %.fr71, 1000000
  %33 = zext nneg i32 %32 to i64
  %34 = zext nneg i32 %31 to i64
  br label %48

.critedge:                                        ; preds = %54
  %35 = call zeroext i1 @roaring_bitmap_run_optimize(ptr noundef %5) #9
  %36 = call i64 @roaring_bitmap_get_cardinality(ptr noundef %5) #9
  call void @roaring_bitmap_set_copy_on_write(ptr noundef %5, i1 noundef zeroext true)
  %37 = call ptr @roaring_bitmap_copy(ptr noundef %5) #9
  %.not66 = icmp eq i64 %36, 0
  %38 = trunc i64 %36 to i32
  %39 = add i32 %38, 1
  %40 = add i32 %38, 2
  %41 = add i32 %38, 3
  %42 = add i32 %38, 4
  %43 = add i32 %38, 5
  %44 = add i32 %38, 6
  %45 = add i32 %38, 7
  %46 = add i32 %38, 8
  %47 = add i32 %38, 9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #9
  br i1 %.not66, label %.preheader, label %.lr.ph

48:                                               ; preds = %28, %54
  %indvars.iv = phi i64 [ %33, %28 ], [ %indvars.iv.next, %54 ]
  %49 = trunc nuw i64 %indvars.iv to i32
  %50 = urem i32 %49, 147
  %51 = icmp ult i32 %50, 100
  br i1 %51, label %52, label %54

52:                                               ; preds = %48
  call void @roaring_bitmap_add(ptr noundef %5, i32 noundef %49) #9
  %53 = getelementptr inbounds i8, ptr %2, i64 %indvars.iv
  store i8 1, ptr %53, align 1, !tbaa !5
  br label %54

54:                                               ; preds = %48, %52
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %55 = icmp ult i64 %indvars.iv.next, %34
  br i1 %55, label %48, label %.critedge, !llvm.loop !10

.preheader:                                       ; preds = %140, %.critedge
  %56 = call zeroext i1 @roaring_bitmap_select(ptr noundef %5, i32 noundef %38, ptr noundef nonnull %1) #9
  %57 = xor i1 %56, true
  %58 = zext i1 %57 to i64
  call void @_assert_true(i64 noundef %58, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  %59 = call zeroext i1 @roaring_bitmap_select(ptr noundef %5, i32 noundef %39, ptr noundef nonnull %1) #9
  %60 = xor i1 %59, true
  %61 = zext i1 %60 to i64
  call void @_assert_true(i64 noundef %61, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  %62 = call zeroext i1 @roaring_bitmap_select(ptr noundef %5, i32 noundef %40, ptr noundef nonnull %1) #9
  %63 = xor i1 %62, true
  %64 = zext i1 %63 to i64
  call void @_assert_true(i64 noundef %64, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  %65 = call zeroext i1 @roaring_bitmap_select(ptr noundef %5, i32 noundef %41, ptr noundef nonnull %1) #9
  %66 = xor i1 %65, true
  %67 = zext i1 %66 to i64
  call void @_assert_true(i64 noundef %67, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  %68 = call zeroext i1 @roaring_bitmap_select(ptr noundef %5, i32 noundef %42, ptr noundef nonnull %1) #9
  %69 = xor i1 %68, true
  %70 = zext i1 %69 to i64
  call void @_assert_true(i64 noundef %70, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  %71 = call zeroext i1 @roaring_bitmap_select(ptr noundef %5, i32 noundef %43, ptr noundef nonnull %1) #9
  %72 = xor i1 %71, true
  %73 = zext i1 %72 to i64
  call void @_assert_true(i64 noundef %73, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  %74 = call zeroext i1 @roaring_bitmap_select(ptr noundef %5, i32 noundef %44, ptr noundef nonnull %1) #9
  %75 = xor i1 %74, true
  %76 = zext i1 %75 to i64
  call void @_assert_true(i64 noundef %76, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  %77 = call zeroext i1 @roaring_bitmap_select(ptr noundef %5, i32 noundef %45, ptr noundef nonnull %1) #9
  %78 = xor i1 %77, true
  %79 = zext i1 %78 to i64
  call void @_assert_true(i64 noundef %79, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  %80 = call zeroext i1 @roaring_bitmap_select(ptr noundef %5, i32 noundef %46, ptr noundef nonnull %1) #9
  %81 = xor i1 %80, true
  %82 = zext i1 %81 to i64
  call void @_assert_true(i64 noundef %82, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  %83 = call zeroext i1 @roaring_bitmap_select(ptr noundef %5, i32 noundef %47, ptr noundef nonnull %1) #9
  %84 = xor i1 %83, true
  %85 = zext i1 %84 to i64
  call void @_assert_true(i64 noundef %85, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #9
  br i1 %.not66, label %.preheader.1, label %.lr.ph.1

.lr.ph.1:                                         ; preds = %.preheader, %95
  %86 = phi i64 [ %97, %95 ], [ 0, %.preheader ]
  %.04962.1 = phi i32 [ %96, %95 ], [ 0, %.preheader ]
  %.05061.1 = phi i32 [ %.1.1, %95 ], [ 0, %.preheader ]
  %87 = getelementptr inbounds i8, ptr %2, i64 %86
  %88 = load i8, ptr %87, align 1, !tbaa !5
  %.not.1 = icmp eq i8 %88, 0
  br i1 %.not.1, label %95, label %89

89:                                               ; preds = %.lr.ph.1
  %90 = call zeroext i1 @roaring_bitmap_select(ptr noundef %37, i32 noundef %.05061.1, ptr noundef nonnull %1) #9
  %91 = zext i1 %90 to i64
  call void @_assert_true(i64 noundef %91, ptr noundef nonnull @.str.127, ptr noundef nonnull @.str.2, i32 noundef 3126) #9
  %92 = load i32, ptr %1, align 4, !tbaa !11
  %93 = zext i32 %92 to i64
  call void @_assert_int_equal(i64 noundef %86, i64 noundef %93, ptr noundef nonnull @.str.2, i32 noundef 3127) #9
  %94 = add i32 %.05061.1, 1
  br label %95

95:                                               ; preds = %89, %.lr.ph.1
  %.1.1 = phi i32 [ %94, %89 ], [ %.05061.1, %.lr.ph.1 ]
  %96 = add i32 %.04962.1, 1
  %97 = zext i32 %96 to i64
  %98 = icmp ugt i64 %36, %97
  br i1 %98, label %.lr.ph.1, label %.preheader.1, !llvm.loop !13

.preheader.1:                                     ; preds = %95, %.preheader
  %99 = call zeroext i1 @roaring_bitmap_select(ptr noundef %37, i32 noundef %38, ptr noundef nonnull %1) #9
  %100 = xor i1 %99, true
  %101 = zext i1 %100 to i64
  call void @_assert_true(i64 noundef %101, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  %102 = call zeroext i1 @roaring_bitmap_select(ptr noundef %37, i32 noundef %39, ptr noundef nonnull %1) #9
  %103 = xor i1 %102, true
  %104 = zext i1 %103 to i64
  call void @_assert_true(i64 noundef %104, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  %105 = call zeroext i1 @roaring_bitmap_select(ptr noundef %37, i32 noundef %40, ptr noundef nonnull %1) #9
  %106 = xor i1 %105, true
  %107 = zext i1 %106 to i64
  call void @_assert_true(i64 noundef %107, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  %108 = call zeroext i1 @roaring_bitmap_select(ptr noundef %37, i32 noundef %41, ptr noundef nonnull %1) #9
  %109 = xor i1 %108, true
  %110 = zext i1 %109 to i64
  call void @_assert_true(i64 noundef %110, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  %111 = call zeroext i1 @roaring_bitmap_select(ptr noundef %37, i32 noundef %42, ptr noundef nonnull %1) #9
  %112 = xor i1 %111, true
  %113 = zext i1 %112 to i64
  call void @_assert_true(i64 noundef %113, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  %114 = call zeroext i1 @roaring_bitmap_select(ptr noundef %37, i32 noundef %43, ptr noundef nonnull %1) #9
  %115 = xor i1 %114, true
  %116 = zext i1 %115 to i64
  call void @_assert_true(i64 noundef %116, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  %117 = call zeroext i1 @roaring_bitmap_select(ptr noundef %37, i32 noundef %44, ptr noundef nonnull %1) #9
  %118 = xor i1 %117, true
  %119 = zext i1 %118 to i64
  call void @_assert_true(i64 noundef %119, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  %120 = call zeroext i1 @roaring_bitmap_select(ptr noundef %37, i32 noundef %45, ptr noundef nonnull %1) #9
  %121 = xor i1 %120, true
  %122 = zext i1 %121 to i64
  call void @_assert_true(i64 noundef %122, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  %123 = call zeroext i1 @roaring_bitmap_select(ptr noundef %37, i32 noundef %46, ptr noundef nonnull %1) #9
  %124 = xor i1 %123, true
  %125 = zext i1 %124 to i64
  call void @_assert_true(i64 noundef %125, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  %126 = call zeroext i1 @roaring_bitmap_select(ptr noundef %37, i32 noundef %47, ptr noundef nonnull %1) #9
  %127 = xor i1 %126, true
  %128 = zext i1 %127 to i64
  call void @_assert_true(i64 noundef %128, ptr noundef nonnull @.str.128, ptr noundef nonnull @.str.2, i32 noundef 3133) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #9
  call void @roaring_bitmap_free(ptr noundef %5) #9
  call void @roaring_bitmap_free(ptr noundef %37) #9
  %129 = shl nuw nsw i32 %.05265, 3
  %130 = icmp ult i32 %.05265, 125000
  br i1 %130, label %4, label %3, !llvm.loop !14

.lr.ph:                                           ; preds = %.critedge, %140
  %131 = phi i64 [ %142, %140 ], [ 0, %.critedge ]
  %.04962 = phi i32 [ %141, %140 ], [ 0, %.critedge ]
  %.05061 = phi i32 [ %.1, %140 ], [ 0, %.critedge ]
  %132 = getelementptr inbounds i8, ptr %2, i64 %131
  %133 = load i8, ptr %132, align 1, !tbaa !5
  %.not = icmp eq i8 %133, 0
  br i1 %.not, label %140, label %134

134:                                              ; preds = %.lr.ph
  %135 = call zeroext i1 @roaring_bitmap_select(ptr noundef %5, i32 noundef %.05061, ptr noundef nonnull %1) #9
  %136 = zext i1 %135 to i64
  call void @_assert_true(i64 noundef %136, ptr noundef nonnull @.str.127, ptr noundef nonnull @.str.2, i32 noundef 3126) #9
  %137 = load i32, ptr %1, align 4, !tbaa !11
  %138 = zext i32 %137 to i64
  call void @_assert_int_equal(i64 noundef %131, i64 noundef %138, ptr noundef nonnull @.str.2, i32 noundef 3127) #9
  %139 = add i32 %.05061, 1
  br label %140

140:                                              ; preds = %.lr.ph, %134
  %.1 = phi i32 [ %139, %134 ], [ %.05061, %.lr.ph ]
  %141 = add i32 %.04962, 1
  %142 = zext i32 %141 to i64
  %143 = icmp ugt i64 %36, %142
  br i1 %143, label %.lr.ph, label %.preheader, !llvm.loop !13
}

declare zeroext i1 @roaring_bitmap_select(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @our_rand() local_unnamed_addr #2

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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(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 = { 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 #8 = { 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 #9 = { nounwind }
attributes #10 = { nounwind allocsize(0) }
attributes #11 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = distinct !{!13, !9}
!14 = distinct !{!14, !9}


; Effective O3 passes: ADCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass