; LLVM IR from jermp/2i_bench :: external/CRoaring/src/containers (mixed_intersection)

; 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.rle16_s = type { i16, i16 }
%struct.bitset_container_s = type { i32, ptr }
%struct.run_container_s = type { i32, i32, ptr }
%struct.array_container_s = type { i32, i32, ptr }

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

; Function Attrs: inlinehint nounwind uwtable
declare zeroext i1 @bitset_container_contains(ptr noundef, i16 noundef zeroext) #1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @run_container_is_full(ptr noundef) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @run_bitset_container_intersection(ptr noundef %0, ptr noundef %1, ptr noundef %2) #3 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %struct.rle16_s, align 2
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %struct.rle16_s, align 2
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca %struct.rle16_s, align 2
  %25 = alloca i32, align 4
  %26 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = call zeroext i1 @run_container_is_full(ptr noundef %27)
  br i1 %28, label %29, label %39

29:                                               ; preds = %3
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = load ptr, ptr %30, align 8, !tbaa !5
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = icmp ne ptr %31, %32
  br i1 %33, label %34, label %38

34:                                               ; preds = %29
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = call ptr @bitset_container_clone(ptr noundef %35)
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %36, ptr %37, align 8, !tbaa !5
  br label %38

38:                                               ; preds = %34, %29
  store i1 true, ptr %4, align 1
  br label %257

39:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = call i32 @run_container_cardinality(ptr noundef %40)
  store i32 %41, ptr %8, align 4, !tbaa !9
  %42 = load i32, ptr %8, align 4, !tbaa !9
  %43 = icmp sle i32 %42, 4096
  br i1 %43, label %44, label %122

44:                                               ; preds = %39
  %45 = load i32, ptr %8, align 4, !tbaa !9
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.bitset_container_s, ptr %46, i32 0, i32 0
  %48 = load i32, ptr %47, align 8, !tbaa !11
  %49 = icmp sgt i32 %45, %48
  br i1 %49, label %50, label %54

50:                                               ; preds = %44
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.bitset_container_s, ptr %51, i32 0, i32 0
  %53 = load i32, ptr %52, align 8, !tbaa !11
  store i32 %53, ptr %8, align 4, !tbaa !9
  br label %54

54:                                               ; preds = %50, %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %55 = load i32, ptr %8, align 4, !tbaa !9
  %56 = call ptr @array_container_create_given_capacity(i32 noundef %55)
  store ptr %56, ptr %9, align 8, !tbaa !5
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %57, ptr %58, align 8, !tbaa !5
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = load ptr, ptr %59, align 8, !tbaa !5
  %61 = icmp eq ptr %60, null
  br i1 %61, label %62, label %63

62:                                               ; preds = %54
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %121

63:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %64

64:                                               ; preds = %117, %63
  %65 = load i32, ptr %11, align 4, !tbaa !9
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.run_container_s, ptr %66, i32 0, i32 0
  %68 = load i32, ptr %67, align 8, !tbaa !13
  %69 = icmp slt i32 %65, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %64
  store i32 2, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %120

71:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.run_container_s, ptr %72, i32 0, i32 2
  %74 = load ptr, ptr %73, align 8, !tbaa !15
  %75 = load i32, ptr %11, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds %struct.rle16_s, ptr %74, i64 %76
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %12, ptr align 2 %77, i64 4, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %78 = getelementptr inbounds %struct.rle16_s, ptr %12, i32 0, i32 0
  %79 = load i16, ptr %78, align 2, !tbaa !19
  %80 = zext i16 %79 to i32
  %81 = getelementptr inbounds %struct.rle16_s, ptr %12, i32 0, i32 1
  %82 = load i16, ptr %81, align 2, !tbaa !21
  %83 = zext i16 %82 to i32
  %84 = add i32 %80, %83
  store i32 %84, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %85 = getelementptr inbounds %struct.rle16_s, ptr %12, i32 0, i32 0
  %86 = load i16, ptr %85, align 2, !tbaa !19
  %87 = zext i16 %86 to i32
  store i32 %87, ptr %14, align 4, !tbaa !9
  br label %88

88:                                               ; preds = %113, %71
  %89 = load i32, ptr %14, align 4, !tbaa !9
  %90 = load i32, ptr %13, align 4, !tbaa !9
  %91 = icmp ule i32 %89, %90
  br i1 %91, label %93, label %92

92:                                               ; preds = %88
  store i32 5, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %116

93:                                               ; preds = %88
  %94 = load i32, ptr %14, align 4, !tbaa !9
  %95 = trunc i32 %94 to i16
  %96 = load ptr, ptr %9, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.array_container_s, ptr %96, i32 0, i32 2
  %98 = load ptr, ptr %97, align 8, !tbaa !22
  %99 = load ptr, ptr %9, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.array_container_s, ptr %99, i32 0, i32 0
  %101 = load i32, ptr %100, align 8, !tbaa !24
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds i16, ptr %98, i64 %102
  store i16 %95, ptr %103, align 2, !tbaa !17
  %104 = load ptr, ptr %6, align 8, !tbaa !5
  %105 = load i32, ptr %14, align 4, !tbaa !9
  %106 = trunc i32 %105 to i16
  %107 = call zeroext i1 @bitset_container_contains(ptr noundef %104, i16 noundef zeroext %106)
  %108 = zext i1 %107 to i32
  %109 = load ptr, ptr %9, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.array_container_s, ptr %109, i32 0, i32 0
  %111 = load i32, ptr %110, align 8, !tbaa !24
  %112 = add nsw i32 %111, %108
  store i32 %112, ptr %110, align 8, !tbaa !24
  br label %113

113:                                              ; preds = %93
  %114 = load i32, ptr %14, align 4, !tbaa !9
  %115 = add i32 %114, 1
  store i32 %115, ptr %14, align 4, !tbaa !9
  br label %88, !llvm.loop !25

116:                                              ; preds = %92
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %117

117:                                              ; preds = %116
  %118 = load i32, ptr %11, align 4, !tbaa !9
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %11, align 4, !tbaa !9
  br label %64, !llvm.loop !27

120:                                              ; preds = %70
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %121

121:                                              ; preds = %120, %62
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %256

122:                                              ; preds = %39
  %123 = load ptr, ptr %7, align 8, !tbaa !5
  %124 = load ptr, ptr %123, align 8, !tbaa !5
  %125 = load ptr, ptr %6, align 8, !tbaa !5
  %126 = icmp eq ptr %124, %125
  br i1 %126, label %127, label %187

127:                                              ; preds = %122
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %128 = load ptr, ptr %7, align 8, !tbaa !5
  %129 = load ptr, ptr %128, align 8, !tbaa !5
  store ptr %129, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %130

130:                                              ; preds = %158, %127
  %131 = load i32, ptr %17, align 4, !tbaa !9
  %132 = load ptr, ptr %5, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.run_container_s, ptr %132, i32 0, i32 0
  %134 = load i32, ptr %133, align 8, !tbaa !13
  %135 = icmp slt i32 %131, %134
  br i1 %135, label %137, label %136

136:                                              ; preds = %130
  store i32 8, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %161

137:                                              ; preds = %130
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %138 = load ptr, ptr %5, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.run_container_s, ptr %138, i32 0, i32 2
  %140 = load ptr, ptr %139, align 8, !tbaa !15
  %141 = load i32, ptr %17, align 4, !tbaa !9
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds %struct.rle16_s, ptr %140, i64 %142
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %18, ptr align 2 %143, i64 4, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %144 = getelementptr inbounds %struct.rle16_s, ptr %18, i32 0, i32 0
  %145 = load i16, ptr %144, align 2, !tbaa !19
  %146 = zext i16 %145 to i32
  store i32 %146, ptr %19, align 4, !tbaa !9
  %147 = load ptr, ptr %6, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.bitset_container_s, ptr %147, i32 0, i32 1
  %149 = load ptr, ptr %148, align 8, !tbaa !28
  %150 = load i32, ptr %16, align 4, !tbaa !9
  %151 = load i32, ptr %19, align 4, !tbaa !9
  call void @bitset_reset_range(ptr noundef %149, i32 noundef %150, i32 noundef %151)
  %152 = load i32, ptr %19, align 4, !tbaa !9
  %153 = getelementptr inbounds %struct.rle16_s, ptr %18, i32 0, i32 1
  %154 = load i16, ptr %153, align 2, !tbaa !21
  %155 = zext i16 %154 to i32
  %156 = add i32 %152, %155
  %157 = add i32 %156, 1
  store i32 %157, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %158

158:                                              ; preds = %137
  %159 = load i32, ptr %17, align 4, !tbaa !9
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %17, align 4, !tbaa !9
  br label %130, !llvm.loop !29

161:                                              ; preds = %136
  %162 = load ptr, ptr %6, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.bitset_container_s, ptr %162, i32 0, i32 1
  %164 = load ptr, ptr %163, align 8, !tbaa !28
  %165 = load i32, ptr %16, align 4, !tbaa !9
  call void @bitset_reset_range(ptr noundef %164, i32 noundef %165, i32 noundef 65536)
  %166 = load ptr, ptr %15, align 8, !tbaa !5
  %167 = call i32 @bitset_container_compute_cardinality(ptr noundef %166)
  %168 = load ptr, ptr %15, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.bitset_container_s, ptr %168, i32 0, i32 0
  store i32 %167, ptr %169, align 8, !tbaa !11
  %170 = load ptr, ptr %6, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.bitset_container_s, ptr %170, i32 0, i32 0
  %172 = load i32, ptr %171, align 8, !tbaa !11
  %173 = icmp sgt i32 %172, 4096
  br i1 %173, label %174, label %175

174:                                              ; preds = %161
  store i1 true, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %186

175:                                              ; preds = %161
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %176 = load ptr, ptr %6, align 8, !tbaa !5
  %177 = call ptr @array_container_from_bitset(ptr noundef %176)
  store ptr %177, ptr %20, align 8, !tbaa !5
  %178 = load ptr, ptr %20, align 8, !tbaa !5
  %179 = icmp eq ptr %178, null
  br i1 %179, label %180, label %182

180:                                              ; preds = %175
  %181 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr null, ptr %181, align 8, !tbaa !5
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %185

182:                                              ; preds = %175
  %183 = load ptr, ptr %20, align 8, !tbaa !5
  %184 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %183, ptr %184, align 8, !tbaa !5
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %185

185:                                              ; preds = %182, %180
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  br label %186

186:                                              ; preds = %185, %174
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %256

187:                                              ; preds = %122
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %188 = load ptr, ptr %6, align 8, !tbaa !5
  %189 = call ptr @bitset_container_clone(ptr noundef %188)
  store ptr %189, ptr %21, align 8, !tbaa !5
  %190 = load ptr, ptr %21, align 8, !tbaa !5
  %191 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %190, ptr %191, align 8, !tbaa !5
  %192 = load ptr, ptr %21, align 8, !tbaa !5
  %193 = icmp eq ptr %192, null
  br i1 %193, label %194, label %195

194:                                              ; preds = %187
  store i1 true, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %255

195:                                              ; preds = %187
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  store i32 0, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  store i32 0, ptr %23, align 4, !tbaa !9
  br label %196

196:                                              ; preds = %224, %195
  %197 = load i32, ptr %23, align 4, !tbaa !9
  %198 = load ptr, ptr %5, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.run_container_s, ptr %198, i32 0, i32 0
  %200 = load i32, ptr %199, align 8, !tbaa !13
  %201 = icmp slt i32 %197, %200
  br i1 %201, label %203, label %202

202:                                              ; preds = %196
  store i32 11, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  br label %227

203:                                              ; preds = %196
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  %204 = load ptr, ptr %5, align 8, !tbaa !5
  %205 = getelementptr inbounds %struct.run_container_s, ptr %204, i32 0, i32 2
  %206 = load ptr, ptr %205, align 8, !tbaa !15
  %207 = load i32, ptr %23, align 4, !tbaa !9
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds %struct.rle16_s, ptr %206, i64 %208
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %24, ptr align 2 %209, i64 4, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  %210 = getelementptr inbounds %struct.rle16_s, ptr %24, i32 0, i32 0
  %211 = load i16, ptr %210, align 2, !tbaa !19
  %212 = zext i16 %211 to i32
  store i32 %212, ptr %25, align 4, !tbaa !9
  %213 = load ptr, ptr %21, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.bitset_container_s, ptr %213, i32 0, i32 1
  %215 = load ptr, ptr %214, align 8, !tbaa !28
  %216 = load i32, ptr %22, align 4, !tbaa !9
  %217 = load i32, ptr %25, align 4, !tbaa !9
  call void @bitset_reset_range(ptr noundef %215, i32 noundef %216, i32 noundef %217)
  %218 = load i32, ptr %25, align 4, !tbaa !9
  %219 = getelementptr inbounds %struct.rle16_s, ptr %24, i32 0, i32 1
  %220 = load i16, ptr %219, align 2, !tbaa !21
  %221 = zext i16 %220 to i32
  %222 = add i32 %218, %221
  %223 = add i32 %222, 1
  store i32 %223, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  br label %224

224:                                              ; preds = %203
  %225 = load i32, ptr %23, align 4, !tbaa !9
  %226 = add nsw i32 %225, 1
  store i32 %226, ptr %23, align 4, !tbaa !9
  br label %196, !llvm.loop !30

227:                                              ; preds = %202
  %228 = load ptr, ptr %21, align 8, !tbaa !5
  %229 = getelementptr inbounds %struct.bitset_container_s, ptr %228, i32 0, i32 1
  %230 = load ptr, ptr %229, align 8, !tbaa !28
  %231 = load i32, ptr %22, align 4, !tbaa !9
  call void @bitset_reset_range(ptr noundef %230, i32 noundef %231, i32 noundef 65536)
  %232 = load ptr, ptr %21, align 8, !tbaa !5
  %233 = call i32 @bitset_container_compute_cardinality(ptr noundef %232)
  %234 = load ptr, ptr %21, align 8, !tbaa !5
  %235 = getelementptr inbounds %struct.bitset_container_s, ptr %234, i32 0, i32 0
  store i32 %233, ptr %235, align 8, !tbaa !11
  %236 = load ptr, ptr %21, align 8, !tbaa !5
  %237 = getelementptr inbounds %struct.bitset_container_s, ptr %236, i32 0, i32 0
  %238 = load i32, ptr %237, align 8, !tbaa !11
  %239 = icmp sgt i32 %238, 4096
  br i1 %239, label %240, label %241

240:                                              ; preds = %227
  store i1 true, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %254

241:                                              ; preds = %227
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #5
  %242 = load ptr, ptr %21, align 8, !tbaa !5
  %243 = call ptr @array_container_from_bitset(ptr noundef %242)
  store ptr %243, ptr %26, align 8, !tbaa !5
  %244 = load ptr, ptr %7, align 8, !tbaa !5
  %245 = load ptr, ptr %244, align 8, !tbaa !5
  call void @bitset_container_free(ptr noundef %245)
  %246 = load ptr, ptr %26, align 8, !tbaa !5
  %247 = icmp eq ptr %246, null
  br i1 %247, label %248, label %250

248:                                              ; preds = %241
  %249 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr null, ptr %249, align 8, !tbaa !5
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %253

250:                                              ; preds = %241
  %251 = load ptr, ptr %26, align 8, !tbaa !5
  %252 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %251, ptr %252, align 8, !tbaa !5
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %253

253:                                              ; preds = %250, %248
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #5
  br label %254

254:                                              ; preds = %253, %240
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  br label %255

255:                                              ; preds = %254, %194
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  br label %256

256:                                              ; preds = %255, %186, %121
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %257

257:                                              ; preds = %256, %38
  %258 = load i1, ptr %4, align 1
  ret i1 %258
}

declare ptr @bitset_container_clone(ptr noundef) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @run_container_cardinality(ptr noundef) #1

declare ptr @array_container_create_given_capacity(i32 noundef) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @bitset_reset_range(ptr noundef, i32 noundef, i32 noundef) #1

declare i32 @bitset_container_compute_cardinality(ptr noundef) #4

declare ptr @array_container_from_bitset(ptr noundef) #4

declare void @bitset_container_free(ptr noundef) #4

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!12, !10, i64 0}
!12 = !{!"bitset_container_s", !10, i64 0, !6, i64 8}
!13 = !{!14, !10, i64 0}
!14 = !{!"run_container_s", !10, i64 0, !10, i64 4, !6, i64 8}
!15 = !{!14, !6, i64 8}
!16 = !{i64 0, i64 2, !17, i64 2, i64 2, !17}
!17 = !{!18, !18, i64 0}
!18 = !{!"short", !7, i64 0}
!19 = !{!20, !18, i64 0}
!20 = !{!"rle16_s", !18, i64 0, !18, i64 2}
!21 = !{!20, !18, i64 2}
!22 = !{!23, !6, i64 8}
!23 = !{!"array_container_s", !10, i64 0, !10, i64 4, !6, i64 8}
!24 = !{!23, !10, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = distinct !{!27, !26}
!28 = !{!12, !6, i64 8}
!29 = distinct !{!29, !26}
!30 = distinct !{!30, !26}


; 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.rle16_s = type { i16, i16 }

; Function Attrs: inlinehint nounwind uwtable
declare zeroext i1 @bitset_container_contains(ptr noundef, i16 noundef zeroext) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @run_container_is_full(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @run_bitset_container_intersection(ptr noundef %0, ptr noundef %1, ptr nocapture noundef %2) local_unnamed_addr #1 {
  %4 = tail call zeroext i1 @run_container_is_full(ptr noundef %0)
  br i1 %4, label %5, label %9

5:                                                ; preds = %3
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %.not94 = icmp eq ptr %6, %1
  br i1 %.not94, label %.loopexit, label %7

7:                                                ; preds = %5
  %8 = tail call ptr @bitset_container_clone(ptr noundef %1) #4
  br label %.loopexit.sink.split

9:                                                ; preds = %3
  %10 = tail call i32 @run_container_cardinality(ptr noundef %0)
  %11 = icmp slt i32 %10, 4097
  br i1 %11, label %12, label %41

12:                                               ; preds = %9
  %13 = load i32, ptr %1, align 8, !tbaa !9
  %spec.select = tail call i32 @llvm.smin.i32(i32 %10, i32 %13)
  %14 = tail call ptr @array_container_create_given_capacity(i32 noundef %spec.select) #4
  store ptr %14, ptr %2, align 8, !tbaa !5
  %15 = icmp eq ptr %14, null
  br i1 %15, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %12
  %16 = load i32, ptr %0, align 8, !tbaa !12
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph107, label %.loopexit

.lr.ph107:                                        ; preds = %.preheader
  %18 = getelementptr inbounds i8, ptr %0, i64 8
  %19 = getelementptr inbounds i8, ptr %14, i64 8
  %.pre.pre = load i32, ptr %14, align 8, !tbaa !14
  br label %20

20:                                               ; preds = %.lr.ph107, %26
  %.pre = phi i32 [ %.pre.pre, %.lr.ph107 ], [ %39, %26 ]
  %indvars.iv113 = phi i64 [ 0, %.lr.ph107 ], [ %indvars.iv.next114, %26 ]
  %21 = load ptr, ptr %18, align 8, !tbaa !16
  %22 = getelementptr inbounds %struct.rle16_s, ptr %21, i64 %indvars.iv113
  %.sroa.034.0.copyload = load i16, ptr %22, align 2, !tbaa !17
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %22, i64 2
  %.sroa.5.0.copyload = load i16, ptr %.sroa.5.0..sroa_idx, align 2, !tbaa !17
  %23 = zext i16 %.sroa.034.0.copyload to i32
  %24 = zext i16 %.sroa.5.0.copyload to i32
  %25 = add nuw nsw i32 %24, %23
  br label %30

26:                                               ; preds = %30
  %indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1
  %27 = load i32, ptr %0, align 8, !tbaa !12
  %28 = sext i32 %27 to i64
  %29 = icmp slt i64 %indvars.iv.next114, %28
  br i1 %29, label %20, label %.loopexit, !llvm.loop !19

30:                                               ; preds = %20, %30
  %31 = phi i32 [ %.pre, %20 ], [ %39, %30 ]
  %.082105 = phi i32 [ %23, %20 ], [ %40, %30 ]
  %32 = trunc i32 %.082105 to i16
  %33 = load ptr, ptr %19, align 8, !tbaa !21
  %34 = sext i32 %31 to i64
  %35 = getelementptr inbounds i16, ptr %33, i64 %34
  store i16 %32, ptr %35, align 2, !tbaa !17
  %36 = tail call zeroext i1 @bitset_container_contains(ptr noundef nonnull %1, i16 noundef zeroext %32)
  %37 = zext i1 %36 to i32
  %38 = load i32, ptr %14, align 8, !tbaa !14
  %39 = add nsw i32 %38, %37
  store i32 %39, ptr %14, align 8, !tbaa !14
  %40 = add nuw nsw i32 %.082105, 1
  %exitcond.not = icmp eq i32 %.082105, %25
  br i1 %exitcond.not, label %26, label %30, !llvm.loop !22

41:                                               ; preds = %9
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = icmp eq ptr %42, %1
  br i1 %43, label %.preheader96, label %66

.preheader96:                                     ; preds = %41
  %44 = load i32, ptr %0, align 8, !tbaa !12
  %45 = icmp sgt i32 %44, 0
  br i1 %45, label %.lr.ph102, label %._crit_edge103

.lr.ph102:                                        ; preds = %.preheader96
  %46 = getelementptr inbounds i8, ptr %0, i64 8
  %47 = getelementptr inbounds i8, ptr %1, i64 8
  br label %53

._crit_edge103:                                   ; preds = %53, %.preheader96
  %.083.lcssa = phi i32 [ 0, %.preheader96 ], [ %60, %53 ]
  %48 = getelementptr inbounds i8, ptr %1, i64 8
  %49 = load ptr, ptr %48, align 8, !tbaa !23
  tail call void @bitset_reset_range(ptr noundef %49, i32 noundef %.083.lcssa, i32 noundef 65536)
  %50 = tail call i32 @bitset_container_compute_cardinality(ptr noundef %42) #4
  store i32 %50, ptr %42, align 8, !tbaa !9
  %51 = load i32, ptr %1, align 8, !tbaa !9
  %52 = icmp sgt i32 %51, 4096
  br i1 %52, label %.loopexit, label %64

53:                                               ; preds = %.lr.ph102, %53
  %indvars.iv110 = phi i64 [ 0, %.lr.ph102 ], [ %indvars.iv.next111, %53 ]
  %.083101 = phi i32 [ 0, %.lr.ph102 ], [ %60, %53 ]
  %54 = load ptr, ptr %46, align 8, !tbaa !16
  %55 = getelementptr inbounds %struct.rle16_s, ptr %54, i64 %indvars.iv110
  %.sroa.020.0.copyload = load i16, ptr %55, align 2, !tbaa !17
  %.sroa.421.0..sroa_idx = getelementptr inbounds i8, ptr %55, i64 2
  %.sroa.421.0.copyload = load i16, ptr %.sroa.421.0..sroa_idx, align 2, !tbaa !17
  %56 = zext i16 %.sroa.020.0.copyload to i32
  %57 = load ptr, ptr %47, align 8, !tbaa !23
  tail call void @bitset_reset_range(ptr noundef %57, i32 noundef %.083101, i32 noundef %56)
  %58 = zext i16 %.sroa.421.0.copyload to i32
  %59 = add nuw nsw i32 %56, 1
  %60 = add nuw nsw i32 %59, %58
  %indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
  %61 = load i32, ptr %0, align 8, !tbaa !12
  %62 = sext i32 %61 to i64
  %63 = icmp slt i64 %indvars.iv.next111, %62
  br i1 %63, label %53, label %._crit_edge103, !llvm.loop !24

64:                                               ; preds = %._crit_edge103
  %65 = tail call ptr @array_container_from_bitset(ptr noundef nonnull %1) #4
  br label %.loopexit.sink.split

66:                                               ; preds = %41
  %67 = tail call ptr @bitset_container_clone(ptr noundef %1) #4
  store ptr %67, ptr %2, align 8, !tbaa !5
  %68 = icmp eq ptr %67, null
  br i1 %68, label %.loopexit, label %.preheader97

.preheader97:                                     ; preds = %66
  %69 = load i32, ptr %0, align 8, !tbaa !12
  %70 = icmp sgt i32 %69, 0
  br i1 %70, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader97
  %71 = getelementptr inbounds i8, ptr %0, i64 8
  %72 = getelementptr inbounds i8, ptr %67, i64 8
  br label %77

._crit_edge:                                      ; preds = %77, %.preheader97
  %.081.lcssa = phi i32 [ 0, %.preheader97 ], [ %84, %77 ]
  %73 = getelementptr inbounds i8, ptr %67, i64 8
  %74 = load ptr, ptr %73, align 8, !tbaa !23
  tail call void @bitset_reset_range(ptr noundef %74, i32 noundef %.081.lcssa, i32 noundef 65536)
  %75 = tail call i32 @bitset_container_compute_cardinality(ptr noundef nonnull %67) #4
  store i32 %75, ptr %67, align 8, !tbaa !9
  %76 = icmp sgt i32 %75, 4096
  br i1 %76, label %.loopexit, label %88

77:                                               ; preds = %.lr.ph, %77
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %77 ]
  %.08198 = phi i32 [ 0, %.lr.ph ], [ %84, %77 ]
  %78 = load ptr, ptr %71, align 8, !tbaa !16
  %79 = getelementptr inbounds %struct.rle16_s, ptr %78, i64 %indvars.iv
  %.sroa.0.0.copyload = load i16, ptr %79, align 2, !tbaa !17
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %79, i64 2
  %.sroa.4.0.copyload = load i16, ptr %.sroa.4.0..sroa_idx, align 2, !tbaa !17
  %80 = zext i16 %.sroa.0.0.copyload to i32
  %81 = load ptr, ptr %72, align 8, !tbaa !23
  tail call void @bitset_reset_range(ptr noundef %81, i32 noundef %.08198, i32 noundef %80)
  %82 = zext i16 %.sroa.4.0.copyload to i32
  %83 = add nuw nsw i32 %80, 1
  %84 = add nuw nsw i32 %83, %82
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %85 = load i32, ptr %0, align 8, !tbaa !12
  %86 = sext i32 %85 to i64
  %87 = icmp slt i64 %indvars.iv.next, %86
  br i1 %87, label %77, label %._crit_edge, !llvm.loop !25

88:                                               ; preds = %._crit_edge
  %89 = tail call ptr @array_container_from_bitset(ptr noundef nonnull %67) #4
  %90 = load ptr, ptr %2, align 8, !tbaa !5
  tail call void @bitset_container_free(ptr noundef %90) #4
  br label %.loopexit.sink.split

.loopexit.sink.split:                             ; preds = %7, %88, %64
  %.sink = phi ptr [ %65, %64 ], [ %89, %88 ], [ %8, %7 ]
  store ptr %.sink, ptr %2, align 8, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %26, %.loopexit.sink.split, %.preheader, %12, %._crit_edge103, %._crit_edge, %66, %5
  %.7 = phi i1 [ true, %5 ], [ false, %12 ], [ true, %._crit_edge103 ], [ true, %66 ], [ true, %._crit_edge ], [ false, %.preheader ], [ %4, %.loopexit.sink.split ], [ false, %26 ]
  ret i1 %.7
}

declare ptr @bitset_container_clone(ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @run_container_cardinality(ptr noundef) local_unnamed_addr #0

declare ptr @array_container_create_given_capacity(i32 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @bitset_reset_range(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

declare i32 @bitset_container_compute_cardinality(ptr noundef) local_unnamed_addr #2

declare ptr @array_container_from_bitset(ptr noundef) local_unnamed_addr #2

declare void @bitset_container_free(ptr noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3

attributes #0 = { 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 #1 = { 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 #2 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }

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

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


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