; 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.23 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.79 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.80 = external hidden unnamed_addr constant [30 x i8], align 1
@__PRETTY_FUNCTION__.test_portable_serialize = external hidden unnamed_addr constant [31 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @array_equals(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #5

declare zeroext i1 @roaring_bitmap_equals(ptr noundef, ptr noundef) #1

declare ptr @roaring_bitmap_of(i64 noundef, ...) #1

declare zeroext i1 @roaring_bitmap_run_optimize(ptr noundef) #1

declare i64 @roaring_bitmap_portable_size_in_bytes(ptr noundef) #1

declare i64 @roaring_bitmap_portable_serialize(ptr noundef, ptr noundef) #1

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

declare ptr @roaring_bitmap_portable_deserialize(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @test_portable_serialize() #5 {
  %1 = alloca ptr, align 8
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #6
  %13 = call ptr (i64, ...) @roaring_bitmap_of(i64 noundef 8, i32 noundef 1, i32 noundef 2, i32 noundef 3, i32 noundef 100, i32 noundef 1000, i32 noundef 10000, i32 noundef 1000000, i32 noundef 20000000)
  store ptr %13, ptr %1, align 8, !tbaa !5
  %14 = load ptr, ptr %1, align 8, !tbaa !5
  %15 = ptrtoint ptr %14 to i64
  call void @_assert_true(i64 noundef %15, ptr noundef @.str.23, ptr noundef @.str.2, i32 noundef 1017)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 384000, ptr %5, align 4, !tbaa !9
  br label %16

16:                                               ; preds = %25, %0
  %17 = load i32, ptr %4, align 4, !tbaa !9
  %18 = load i32, ptr %5, align 4, !tbaa !9
  %19 = icmp slt i32 %17, %18
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %28

21:                                               ; preds = %16
  %22 = load ptr, ptr %1, align 8, !tbaa !5
  %23 = load i32, ptr %4, align 4, !tbaa !9
  %24 = mul nsw i32 3, %23
  call void @roaring_bitmap_add(ptr noundef %22, i32 noundef %24)
  br label %25

25:                                               ; preds = %21
  %26 = load i32, ptr %4, align 4, !tbaa !9
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %4, align 4, !tbaa !9
  br label %16, !llvm.loop !11

28:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %29 = load ptr, ptr %1, align 8, !tbaa !5
  %30 = call i64 @roaring_bitmap_portable_size_in_bytes(ptr noundef %29)
  %31 = trunc i64 %30 to i32
  store i32 %31, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %32 = load i32, ptr %6, align 4, !tbaa !9
  %33 = zext i32 %32 to i64
  %34 = call noalias ptr @malloc(i64 noundef %33) #7
  store ptr %34, ptr %7, align 8, !tbaa !5
  %35 = load ptr, ptr %1, align 8, !tbaa !5
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = call i64 @roaring_bitmap_portable_serialize(ptr noundef %35, ptr noundef %36)
  %38 = trunc i64 %37 to i32
  store i32 %38, ptr %2, align 4, !tbaa !9
  %39 = load i32, ptr %2, align 4, !tbaa !9
  %40 = zext i32 %39 to i64
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = zext i32 %41 to i64
  call void @_assert_int_equal(i64 noundef %40, i64 noundef %42, ptr noundef @.str.2, i32 noundef 1028)
  %43 = load i32, ptr %2, align 4, !tbaa !9
  %44 = zext i32 %43 to i64
  %45 = load i32, ptr %6, align 4, !tbaa !9
  %46 = zext i32 %45 to i64
  call void @_assert_int_equal(i64 noundef %44, i64 noundef %46, ptr noundef @.str.2, i32 noundef 1029)
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = call ptr @roaring_bitmap_portable_deserialize(ptr noundef %47)
  store ptr %48, ptr %3, align 8, !tbaa !5
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = ptrtoint ptr %49 to i64
  call void @_assert_true(i64 noundef %50, ptr noundef @.str.48, ptr noundef @.str.2, i32 noundef 1031)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %51 = load ptr, ptr %1, align 8, !tbaa !5
  %52 = call i64 @roaring_bitmap_get_cardinality(ptr noundef %51)
  store i64 %52, ptr %8, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %53 = load i64, ptr %8, align 8, !tbaa !13
  %54 = mul i64 %53, 4
  %55 = call noalias ptr @malloc(i64 noundef %54) #7
  store ptr %55, ptr %9, align 8, !tbaa !5
  %56 = load ptr, ptr %1, align 8, !tbaa !5
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  call void @roaring_bitmap_to_uint32_array(ptr noundef %56, ptr noundef %57)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = call i64 @roaring_bitmap_get_cardinality(ptr noundef %58)
  store i64 %59, ptr %10, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %60 = load i64, ptr %10, align 8, !tbaa !13
  %61 = mul i64 %60, 4
  %62 = call noalias ptr @malloc(i64 noundef %61) #7
  store ptr %62, ptr %11, align 8, !tbaa !5
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = load ptr, ptr %11, align 8, !tbaa !5
  call void @roaring_bitmap_to_uint32_array(ptr noundef %63, ptr noundef %64)
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  %66 = load i64, ptr %8, align 8, !tbaa !13
  %67 = trunc i64 %66 to i32
  %68 = load ptr, ptr %11, align 8, !tbaa !5
  %69 = load i64, ptr %10, align 8, !tbaa !13
  %70 = trunc i64 %69 to i32
  %71 = call i32 @array_equals(ptr noundef %65, i32 noundef %67, ptr noundef %68, i32 noundef %70)
  %72 = sext i32 %71 to i64
  call void @_assert_true(i64 noundef %72, ptr noundef @.str.79, ptr noundef @.str.2, i32 noundef 1041)
  %73 = load ptr, ptr %1, align 8, !tbaa !5
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = call zeroext i1 @roaring_bitmap_equals(ptr noundef %73, ptr noundef %74)
  %76 = zext i1 %75 to i64
  call void @_assert_true(i64 noundef %76, ptr noundef @.str.80, ptr noundef @.str.2, i32 noundef 1042)
  %77 = load ptr, ptr %9, align 8, !tbaa !5
  call void @free(ptr noundef %77) #6
  %78 = load ptr, ptr %11, align 8, !tbaa !5
  call void @free(ptr noundef %78) #6
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %79) #6
  %80 = load ptr, ptr %1, align 8, !tbaa !5
  call void @roaring_bitmap_free(ptr noundef %80)
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  call void @roaring_bitmap_free(ptr noundef %81)
  %82 = call ptr (i64, ...) @roaring_bitmap_of(i64 noundef 6, i32 noundef 2946000, i32 noundef 2997491, i32 noundef 10478289, i32 noundef 10490227, i32 noundef 10502444, i32 noundef 19866827)
  store ptr %82, ptr %1, align 8, !tbaa !5
  %83 = load ptr, ptr %1, align 8, !tbaa !5
  %84 = call i64 @roaring_bitmap_portable_size_in_bytes(ptr noundef %83)
  %85 = trunc i64 %84 to i32
  store i32 %85, ptr %6, align 4, !tbaa !9
  %86 = load i32, ptr %6, align 4, !tbaa !9
  %87 = zext i32 %86 to i64
  %88 = call noalias ptr @malloc(i64 noundef %87) #7
  store ptr %88, ptr %7, align 8, !tbaa !5
  %89 = load ptr, ptr %1, align 8, !tbaa !5
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = call i64 @roaring_bitmap_portable_serialize(ptr noundef %89, ptr noundef %90)
  %92 = trunc i64 %91 to i32
  store i32 %92, ptr %2, align 4, !tbaa !9
  %93 = load i32, ptr %2, align 4, !tbaa !9
  %94 = zext i32 %93 to i64
  %95 = load i32, ptr %6, align 4, !tbaa !9
  %96 = zext i32 %95 to i64
  call void @_assert_int_equal(i64 noundef %94, i64 noundef %96, ptr noundef @.str.2, i32 noundef 1054)
  %97 = load i32, ptr %2, align 4, !tbaa !9
  %98 = zext i32 %97 to i64
  %99 = load i32, ptr %6, align 4, !tbaa !9
  %100 = zext i32 %99 to i64
  call void @_assert_int_equal(i64 noundef %98, i64 noundef %100, ptr noundef @.str.2, i32 noundef 1055)
  %101 = load ptr, ptr %7, align 8, !tbaa !5
  %102 = call ptr @roaring_bitmap_portable_deserialize(ptr noundef %101)
  store ptr %102, ptr %3, align 8, !tbaa !5
  %103 = load ptr, ptr %3, align 8, !tbaa !5
  %104 = ptrtoint ptr %103 to i64
  call void @_assert_true(i64 noundef %104, ptr noundef @.str.48, ptr noundef @.str.2, i32 noundef 1058)
  %105 = load ptr, ptr %1, align 8, !tbaa !5
  %106 = call i64 @roaring_bitmap_get_cardinality(ptr noundef %105)
  store i64 %106, ptr %8, align 8, !tbaa !13
  %107 = load i64, ptr %8, align 8, !tbaa !13
  %108 = mul i64 %107, 4
  %109 = call noalias ptr @malloc(i64 noundef %108) #7
  store ptr %109, ptr %9, align 8, !tbaa !5
  %110 = load ptr, ptr %1, align 8, !tbaa !5
  %111 = load ptr, ptr %9, align 8, !tbaa !5
  call void @roaring_bitmap_to_uint32_array(ptr noundef %110, ptr noundef %111)
  %112 = load ptr, ptr %3, align 8, !tbaa !5
  %113 = call i64 @roaring_bitmap_get_cardinality(ptr noundef %112)
  store i64 %113, ptr %10, align 8, !tbaa !13
  %114 = load i64, ptr %10, align 8, !tbaa !13
  %115 = mul i64 %114, 4
  %116 = call noalias ptr @malloc(i64 noundef %115) #7
  store ptr %116, ptr %11, align 8, !tbaa !5
  %117 = load ptr, ptr %3, align 8, !tbaa !5
  %118 = load ptr, ptr %11, align 8, !tbaa !5
  call void @roaring_bitmap_to_uint32_array(ptr noundef %117, ptr noundef %118)
  %119 = load ptr, ptr %9, align 8, !tbaa !5
  %120 = load i64, ptr %8, align 8, !tbaa !13
  %121 = trunc i64 %120 to i32
  %122 = load ptr, ptr %11, align 8, !tbaa !5
  %123 = load i64, ptr %10, align 8, !tbaa !13
  %124 = trunc i64 %123 to i32
  %125 = call i32 @array_equals(ptr noundef %119, i32 noundef %121, ptr noundef %122, i32 noundef %124)
  %126 = sext i32 %125 to i64
  call void @_assert_true(i64 noundef %126, ptr noundef @.str.79, ptr noundef @.str.2, i32 noundef 1068)
  %127 = load ptr, ptr %1, align 8, !tbaa !5
  %128 = load ptr, ptr %3, align 8, !tbaa !5
  %129 = call zeroext i1 @roaring_bitmap_equals(ptr noundef %127, ptr noundef %128)
  %130 = zext i1 %129 to i64
  call void @_assert_true(i64 noundef %130, ptr noundef @.str.80, ptr noundef @.str.2, i32 noundef 1069)
  %131 = load ptr, ptr %9, align 8, !tbaa !5
  call void @free(ptr noundef %131) #6
  %132 = load ptr, ptr %11, align 8, !tbaa !5
  call void @free(ptr noundef %132) #6
  %133 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %133) #6
  %134 = load ptr, ptr %1, align 8, !tbaa !5
  call void @roaring_bitmap_free(ptr noundef %134)
  %135 = load ptr, ptr %3, align 8, !tbaa !5
  call void @roaring_bitmap_free(ptr noundef %135)
  %136 = call ptr @roaring_bitmap_create()
  store ptr %136, ptr %1, align 8, !tbaa !5
  %137 = load ptr, ptr %1, align 8, !tbaa !5
  %138 = ptrtoint ptr %137 to i64
  call void @_assert_true(i64 noundef %138, ptr noundef @.str.23, ptr noundef @.str.2, i32 noundef 1077)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 100, ptr %12, align 4, !tbaa !9
  br label %139

139:                                              ; preds = %146, %28
  %140 = load i32, ptr %12, align 4, !tbaa !9
  %141 = icmp ult i32 %140, 100000
  br i1 %141, label %143, label %142

142:                                              ; preds = %139
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %149

143:                                              ; preds = %139
  %144 = load ptr, ptr %1, align 8, !tbaa !5
  %145 = load i32, ptr %12, align 4, !tbaa !9
  call void @roaring_bitmap_add(ptr noundef %144, i32 noundef %145)
  br label %146

146:                                              ; preds = %143
  %147 = load i32, ptr %12, align 4, !tbaa !9
  %148 = add i32 %147, 1
  store i32 %148, ptr %12, align 4, !tbaa !9
  br label %139, !llvm.loop !15

149:                                              ; preds = %142
  %150 = load ptr, ptr %1, align 8, !tbaa !5
  %151 = call zeroext i1 @roaring_bitmap_run_optimize(ptr noundef %150)
  %152 = load ptr, ptr %1, align 8, !tbaa !5
  %153 = call i64 @roaring_bitmap_portable_size_in_bytes(ptr noundef %152)
  %154 = trunc i64 %153 to i32
  store i32 %154, ptr %6, align 4, !tbaa !9
  %155 = load i32, ptr %6, align 4, !tbaa !9
  %156 = zext i32 %155 to i64
  %157 = call noalias ptr @malloc(i64 noundef %156) #7
  store ptr %157, ptr %7, align 8, !tbaa !5
  %158 = load ptr, ptr %1, align 8, !tbaa !5
  %159 = load ptr, ptr %7, align 8, !tbaa !5
  %160 = call i64 @roaring_bitmap_portable_serialize(ptr noundef %158, ptr noundef %159)
  %161 = trunc i64 %160 to i32
  store i32 %161, ptr %2, align 4, !tbaa !9
  %162 = load i32, ptr %2, align 4, !tbaa !9
  %163 = zext i32 %162 to i64
  %164 = load i32, ptr %6, align 4, !tbaa !9
  %165 = zext i32 %164 to i64
  call void @_assert_int_equal(i64 noundef %163, i64 noundef %165, ptr noundef @.str.2, i32 noundef 1087)
  %166 = load ptr, ptr %7, align 8, !tbaa !5
  %167 = call ptr @roaring_bitmap_portable_deserialize(ptr noundef %166)
  store ptr %167, ptr %3, align 8, !tbaa !5
  %168 = load ptr, ptr %3, align 8, !tbaa !5
  %169 = ptrtoint ptr %168 to i64
  call void @_assert_true(i64 noundef %169, ptr noundef @.str.48, ptr noundef @.str.2, i32 noundef 1090)
  %170 = load ptr, ptr %1, align 8, !tbaa !5
  %171 = call i64 @roaring_bitmap_get_cardinality(ptr noundef %170)
  store i64 %171, ptr %8, align 8, !tbaa !13
  %172 = load i64, ptr %8, align 8, !tbaa !13
  %173 = mul i64 %172, 4
  %174 = call noalias ptr @malloc(i64 noundef %173) #7
  store ptr %174, ptr %9, align 8, !tbaa !5
  %175 = load ptr, ptr %1, align 8, !tbaa !5
  %176 = load ptr, ptr %9, align 8, !tbaa !5
  call void @roaring_bitmap_to_uint32_array(ptr noundef %175, ptr noundef %176)
  %177 = load ptr, ptr %3, align 8, !tbaa !5
  %178 = call i64 @roaring_bitmap_get_cardinality(ptr noundef %177)
  store i64 %178, ptr %10, align 8, !tbaa !13
  %179 = load i64, ptr %10, align 8, !tbaa !13
  %180 = mul i64 %179, 4
  %181 = call noalias ptr @malloc(i64 noundef %180) #7
  store ptr %181, ptr %11, align 8, !tbaa !5
  %182 = load ptr, ptr %3, align 8, !tbaa !5
  %183 = load ptr, ptr %11, align 8, !tbaa !5
  call void @roaring_bitmap_to_uint32_array(ptr noundef %182, ptr noundef %183)
  %184 = load ptr, ptr %9, align 8, !tbaa !5
  %185 = load i64, ptr %8, align 8, !tbaa !13
  %186 = trunc i64 %185 to i32
  %187 = load ptr, ptr %11, align 8, !tbaa !5
  %188 = load i64, ptr %10, align 8, !tbaa !13
  %189 = trunc i64 %188 to i32
  %190 = call i32 @array_equals(ptr noundef %184, i32 noundef %186, ptr noundef %187, i32 noundef %189)
  %191 = icmp ne i32 %190, 0
  br i1 %191, label %192, label %193

192:                                              ; preds = %149
  br label %194

193:                                              ; preds = %149
  call void @__assert_fail(ptr noundef @.str.79, ptr noundef @.str.2, i32 noundef 1100, ptr noundef @__PRETTY_FUNCTION__.test_portable_serialize) #8
  unreachable

194:                                              ; preds = %192
  %195 = load ptr, ptr %1, align 8, !tbaa !5
  %196 = load ptr, ptr %3, align 8, !tbaa !5
  %197 = call zeroext i1 @roaring_bitmap_equals(ptr noundef %195, ptr noundef %196)
  br i1 %197, label %198, label %199

198:                                              ; preds = %194
  br label %200

199:                                              ; preds = %194
  call void @__assert_fail(ptr noundef @.str.80, ptr noundef @.str.2, i32 noundef 1101, ptr noundef @__PRETTY_FUNCTION__.test_portable_serialize) #8
  unreachable

200:                                              ; preds = %198
  %201 = load ptr, ptr %9, align 8, !tbaa !5
  call void @free(ptr noundef %201) #6
  %202 = load ptr, ptr %11, align 8, !tbaa !5
  call void @free(ptr noundef %202) #6
  %203 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %203) #6
  %204 = load ptr, ptr %1, align 8, !tbaa !5
  call void @roaring_bitmap_free(ptr noundef %204)
  %205 = load ptr, ptr %3, align 8, !tbaa !5
  call void @roaring_bitmap_free(ptr noundef %205)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #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 = { 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 #3 = { 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 #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 = { nounwind allocsize(0) }
attributes #8 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !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"

@.str.2 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.79 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.80 = external hidden unnamed_addr constant [30 x i8], align 1
@__PRETTY_FUNCTION__.test_portable_serialize = external hidden unnamed_addr constant [31 x i8], align 1

declare void @roaring_bitmap_free(ptr noundef) local_unnamed_addr #0

declare ptr @roaring_bitmap_create() local_unnamed_addr #0

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

declare i64 @roaring_bitmap_get_cardinality(ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

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

declare void @roaring_bitmap_to_uint32_array(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @array_equals(ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

declare zeroext i1 @roaring_bitmap_equals(ptr noundef, ptr noundef) local_unnamed_addr #0

declare ptr @roaring_bitmap_of(i64 noundef, ...) local_unnamed_addr #0

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

declare i64 @roaring_bitmap_portable_size_in_bytes(ptr noundef) local_unnamed_addr #0

declare i64 @roaring_bitmap_portable_serialize(ptr noundef, ptr noundef) local_unnamed_addr #0

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

declare ptr @roaring_bitmap_portable_deserialize(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @test_portable_serialize() local_unnamed_addr #4 {
  %1 = tail call ptr (i64, ...) @roaring_bitmap_of(i64 noundef 8, i32 noundef 1, i32 noundef 2, i32 noundef 3, i32 noundef 100, i32 noundef 1000, i32 noundef 10000, i32 noundef 1000000, i32 noundef 20000000) #5
  %2 = ptrtoint ptr %1 to i64
  tail call void @_assert_true(i64 noundef %2, ptr noundef nonnull @.str.23, ptr noundef nonnull @.str.2, i32 noundef 1017) #5
  br label %45

3:                                                ; preds = %45
  %4 = tail call i64 @roaring_bitmap_portable_size_in_bytes(ptr noundef %1) #5
  %5 = and i64 %4, 4294967295
  %6 = tail call noalias ptr @malloc(i64 noundef %5) #6
  %7 = tail call i64 @roaring_bitmap_portable_serialize(ptr noundef %1, ptr noundef %6) #5
  %8 = and i64 %7, 4294967295
  tail call void @_assert_int_equal(i64 noundef %8, i64 noundef %5, ptr noundef nonnull @.str.2, i32 noundef 1028) #5
  tail call void @_assert_int_equal(i64 noundef %8, i64 noundef %5, ptr noundef nonnull @.str.2, i32 noundef 1029) #5
  %9 = tail call ptr @roaring_bitmap_portable_deserialize(ptr noundef %6) #5
  %10 = ptrtoint ptr %9 to i64
  tail call void @_assert_true(i64 noundef %10, ptr noundef nonnull @.str.48, ptr noundef nonnull @.str.2, i32 noundef 1031) #5
  %11 = tail call i64 @roaring_bitmap_get_cardinality(ptr noundef %1) #5
  %12 = shl i64 %11, 2
  %13 = tail call noalias ptr @malloc(i64 noundef %12) #6
  tail call void @roaring_bitmap_to_uint32_array(ptr noundef %1, ptr noundef %13) #5
  %14 = tail call i64 @roaring_bitmap_get_cardinality(ptr noundef %9) #5
  %15 = shl i64 %14, 2
  %16 = tail call noalias ptr @malloc(i64 noundef %15) #6
  tail call void @roaring_bitmap_to_uint32_array(ptr noundef %9, ptr noundef %16) #5
  %17 = trunc i64 %11 to i32
  %18 = trunc i64 %14 to i32
  %19 = tail call i32 @array_equals(ptr noundef %13, i32 noundef %17, ptr noundef %16, i32 noundef %18)
  %20 = sext i32 %19 to i64
  tail call void @_assert_true(i64 noundef %20, ptr noundef nonnull @.str.79, ptr noundef nonnull @.str.2, i32 noundef 1041) #5
  %21 = tail call zeroext i1 @roaring_bitmap_equals(ptr noundef %1, ptr noundef %9) #5
  %22 = zext i1 %21 to i64
  tail call void @_assert_true(i64 noundef %22, ptr noundef nonnull @.str.80, ptr noundef nonnull @.str.2, i32 noundef 1042) #5
  tail call void @free(ptr noundef %13) #5
  tail call void @free(ptr noundef %16) #5
  tail call void @free(ptr noundef %6) #5
  tail call void @roaring_bitmap_free(ptr noundef %1) #5
  tail call void @roaring_bitmap_free(ptr noundef %9) #5
  %23 = tail call ptr (i64, ...) @roaring_bitmap_of(i64 noundef 6, i32 noundef 2946000, i32 noundef 2997491, i32 noundef 10478289, i32 noundef 10490227, i32 noundef 10502444, i32 noundef 19866827) #5
  %24 = tail call i64 @roaring_bitmap_portable_size_in_bytes(ptr noundef %23) #5
  %25 = and i64 %24, 4294967295
  %26 = tail call noalias ptr @malloc(i64 noundef %25) #6
  %27 = tail call i64 @roaring_bitmap_portable_serialize(ptr noundef %23, ptr noundef %26) #5
  %28 = and i64 %27, 4294967295
  tail call void @_assert_int_equal(i64 noundef %28, i64 noundef %25, ptr noundef nonnull @.str.2, i32 noundef 1054) #5
  tail call void @_assert_int_equal(i64 noundef %28, i64 noundef %25, ptr noundef nonnull @.str.2, i32 noundef 1055) #5
  %29 = tail call ptr @roaring_bitmap_portable_deserialize(ptr noundef %26) #5
  %30 = ptrtoint ptr %29 to i64
  tail call void @_assert_true(i64 noundef %30, ptr noundef nonnull @.str.48, ptr noundef nonnull @.str.2, i32 noundef 1058) #5
  %31 = tail call i64 @roaring_bitmap_get_cardinality(ptr noundef %23) #5
  %32 = shl i64 %31, 2
  %33 = tail call noalias ptr @malloc(i64 noundef %32) #6
  tail call void @roaring_bitmap_to_uint32_array(ptr noundef %23, ptr noundef %33) #5
  %34 = tail call i64 @roaring_bitmap_get_cardinality(ptr noundef %29) #5
  %35 = shl i64 %34, 2
  %36 = tail call noalias ptr @malloc(i64 noundef %35) #6
  tail call void @roaring_bitmap_to_uint32_array(ptr noundef %29, ptr noundef %36) #5
  %37 = trunc i64 %31 to i32
  %38 = trunc i64 %34 to i32
  %39 = tail call i32 @array_equals(ptr noundef %33, i32 noundef %37, ptr noundef %36, i32 noundef %38)
  %40 = sext i32 %39 to i64
  tail call void @_assert_true(i64 noundef %40, ptr noundef nonnull @.str.79, ptr noundef nonnull @.str.2, i32 noundef 1068) #5
  %41 = tail call zeroext i1 @roaring_bitmap_equals(ptr noundef %23, ptr noundef %29) #5
  %42 = zext i1 %41 to i64
  tail call void @_assert_true(i64 noundef %42, ptr noundef nonnull @.str.80, ptr noundef nonnull @.str.2, i32 noundef 1069) #5
  tail call void @free(ptr noundef %33) #5
  tail call void @free(ptr noundef %36) #5
  tail call void @free(ptr noundef %26) #5
  tail call void @roaring_bitmap_free(ptr noundef %23) #5
  tail call void @roaring_bitmap_free(ptr noundef %29) #5
  %43 = tail call ptr @roaring_bitmap_create() #5
  %44 = ptrtoint ptr %43 to i64
  tail call void @_assert_true(i64 noundef %44, ptr noundef nonnull @.str.23, ptr noundef nonnull @.str.2, i32 noundef 1077) #5
  br label %66

45:                                               ; preds = %0, %45
  %.09697 = phi i32 [ 0, %0 ], [ %47, %45 ]
  %46 = mul nuw nsw i32 %.09697, 3
  tail call void @roaring_bitmap_add(ptr noundef %1, i32 noundef %46) #5
  %47 = add nuw nsw i32 %.09697, 1
  %exitcond.not = icmp eq i32 %47, 384000
  br i1 %exitcond.not, label %3, label %45, !llvm.loop !5

48:                                               ; preds = %66
  %49 = tail call zeroext i1 @roaring_bitmap_run_optimize(ptr noundef %43) #5
  %50 = tail call i64 @roaring_bitmap_portable_size_in_bytes(ptr noundef %43) #5
  %51 = and i64 %50, 4294967295
  %52 = tail call noalias ptr @malloc(i64 noundef %51) #6
  %53 = tail call i64 @roaring_bitmap_portable_serialize(ptr noundef %43, ptr noundef %52) #5
  %54 = and i64 %53, 4294967295
  tail call void @_assert_int_equal(i64 noundef %54, i64 noundef %51, ptr noundef nonnull @.str.2, i32 noundef 1087) #5
  %55 = tail call ptr @roaring_bitmap_portable_deserialize(ptr noundef %52) #5
  %56 = ptrtoint ptr %55 to i64
  tail call void @_assert_true(i64 noundef %56, ptr noundef nonnull @.str.48, ptr noundef nonnull @.str.2, i32 noundef 1090) #5
  %57 = tail call i64 @roaring_bitmap_get_cardinality(ptr noundef %43) #5
  %58 = shl i64 %57, 2
  %59 = tail call noalias ptr @malloc(i64 noundef %58) #6
  tail call void @roaring_bitmap_to_uint32_array(ptr noundef %43, ptr noundef %59) #5
  %60 = tail call i64 @roaring_bitmap_get_cardinality(ptr noundef %55) #5
  %61 = shl i64 %60, 2
  %62 = tail call noalias ptr @malloc(i64 noundef %61) #6
  tail call void @roaring_bitmap_to_uint32_array(ptr noundef %55, ptr noundef %62) #5
  %63 = trunc i64 %57 to i32
  %64 = trunc i64 %60 to i32
  %65 = tail call i32 @array_equals(ptr noundef %59, i32 noundef %63, ptr noundef %62, i32 noundef %64)
  %.not = icmp eq i32 %65, 0
  br i1 %.not, label %68, label %69

66:                                               ; preds = %3, %66
  %.098 = phi i32 [ 100, %3 ], [ %67, %66 ]
  tail call void @roaring_bitmap_add(ptr noundef %43, i32 noundef %.098) #5
  %67 = add nuw nsw i32 %.098, 1
  %exitcond99.not = icmp eq i32 %67, 100000
  br i1 %exitcond99.not, label %48, label %66, !llvm.loop !7

68:                                               ; preds = %48
  tail call void @__assert_fail(ptr noundef nonnull @.str.79, ptr noundef nonnull @.str.2, i32 noundef 1100, ptr noundef nonnull @__PRETTY_FUNCTION__.test_portable_serialize) #7
  unreachable

69:                                               ; preds = %48
  %70 = tail call zeroext i1 @roaring_bitmap_equals(ptr noundef %43, ptr noundef %55) #5
  br i1 %70, label %72, label %71

71:                                               ; preds = %69
  tail call void @__assert_fail(ptr noundef nonnull @.str.80, ptr noundef nonnull @.str.2, i32 noundef 1101, ptr noundef nonnull @__PRETTY_FUNCTION__.test_portable_serialize) #7
  unreachable

72:                                               ; preds = %69
  tail call void @free(ptr noundef %59) #5
  tail call void @free(ptr noundef %62) #5
  tail call void @free(ptr noundef %52) #5
  tail call void @roaring_bitmap_free(ptr noundef %43) #5
  tail call void @roaring_bitmap_free(ptr noundef %55) #5
  ret void
}

attributes #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 = { 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 #2 = { 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 #3 = { 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 #4 = { 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 }
attributes #6 = { nounwind allocsize(0) }
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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass