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

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

@.str.1 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@__PRETTY_FUNCTION__.convert_run_optimize = external hidden unnamed_addr constant [55 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @array_container_cardinality(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 i32 @array_container_number_of_runs(ptr noundef) #2

declare ptr @run_container_create_given_capacity(i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @add_run(ptr noundef, i32 noundef, i32 noundef) #3

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @convert_run_to_efficient_container(ptr noundef, ptr noundef) #3

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @bitset_container_serialized_size_in_bytes() #1

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

; Function Attrs: nounwind uwtable
define dso_local ptr @convert_run_optimize(ptr noundef %0, i8 noundef zeroext %1, ptr noundef %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %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 i32, align 4
  %19 = alloca i16, align 2
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca ptr, align 8
  %25 = alloca i32, align 4
  %26 = alloca i64, align 8
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca i64, align 8
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i8 %1, ptr %6, align 1, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  %33 = load i8, ptr %6, align 1, !tbaa !9
  %34 = zext i8 %33 to i32
  %35 = icmp eq i32 %34, 3
  br i1 %35, label %36, label %48

36:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = call ptr @convert_run_to_efficient_container(ptr noundef %37, ptr noundef %38)
  store ptr %39, ptr %8, align 8, !tbaa !5
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = icmp ne ptr %40, %41
  br i1 %42, label %43, label %46

43:                                               ; preds = %36
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = load i8, ptr %6, align 1, !tbaa !9
  call void @container_free(ptr noundef %44, i8 noundef zeroext %45)
  br label %46

46:                                               ; preds = %43, %36
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %47, ptr %4, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %253

48:                                               ; preds = %3
  %49 = load i8, ptr %6, align 1, !tbaa !9
  %50 = zext i8 %49 to i32
  %51 = icmp eq i32 %50, 2
  br i1 %51, label %52, label %129

52:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %53, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %54 = load ptr, ptr %9, align 8, !tbaa !5
  %55 = call i32 @array_container_number_of_runs(ptr noundef %54)
  store i32 %55, ptr %10, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %56 = load i32, ptr %10, align 4, !tbaa !10
  %57 = call i32 @run_container_serialized_size_in_bytes(i32 noundef %56)
  store i32 %57, ptr %11, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %58 = load ptr, ptr %9, align 8, !tbaa !5
  %59 = call i32 @array_container_cardinality(ptr noundef %58)
  store i32 %59, ptr %12, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %60 = load i32, ptr %12, align 4, !tbaa !10
  %61 = call i32 @array_container_serialized_size_in_bytes(i32 noundef %60)
  store i32 %61, ptr %13, align 4, !tbaa !10
  %62 = load i32, ptr %11, align 4, !tbaa !10
  %63 = load i32, ptr %13, align 4, !tbaa !10
  %64 = icmp sge i32 %62, %63
  br i1 %64, label %65, label %68

65:                                               ; preds = %52
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  store i8 2, ptr %66, align 1, !tbaa !9
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %67, ptr %4, align 8
  store i32 1, ptr %14, align 4
  br label %128

68:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %69 = load i32, ptr %10, align 4, !tbaa !10
  %70 = call ptr @run_container_create_given_capacity(i32 noundef %69)
  store ptr %70, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 -2, ptr %16, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 -1, ptr %17, align 4, !tbaa !10
  %71 = load i32, ptr %12, align 4, !tbaa !10
  %72 = icmp sgt i32 %71, 0
  br i1 %72, label %73, label %74

73:                                               ; preds = %68
  br label %75

74:                                               ; preds = %68
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 215, ptr noundef @__PRETTY_FUNCTION__.convert_run_optimize) #7
  unreachable

75:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !10
  br label %76

76:                                               ; preds = %113, %75
  %77 = load i32, ptr %18, align 4, !tbaa !10
  %78 = load i32, ptr %12, align 4, !tbaa !10
  %79 = icmp slt i32 %77, %78
  br i1 %79, label %81, label %80

80:                                               ; preds = %76
  store i32 2, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %116

81:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 2, ptr %19) #6
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.array_container_s, ptr %82, i32 0, i32 2
  %84 = load ptr, ptr %83, align 8, !tbaa !12
  %85 = load i32, ptr %18, align 4, !tbaa !10
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds i16, ptr %84, i64 %86
  %88 = load i16, ptr %87, align 2, !tbaa !14
  store i16 %88, ptr %19, align 2, !tbaa !14
  %89 = load i16, ptr %19, align 2, !tbaa !14
  %90 = zext i16 %89 to i32
  %91 = load i32, ptr %16, align 4, !tbaa !10
  %92 = add nsw i32 %91, 1
  %93 = icmp ne i32 %90, %92
  br i1 %93, label %94, label %104

94:                                               ; preds = %81
  %95 = load i32, ptr %17, align 4, !tbaa !10
  %96 = icmp ne i32 %95, -1
  br i1 %96, label %97, label %101

97:                                               ; preds = %94
  %98 = load ptr, ptr %15, align 8, !tbaa !5
  %99 = load i32, ptr %17, align 4, !tbaa !10
  %100 = load i32, ptr %16, align 4, !tbaa !10
  call void @add_run(ptr noundef %98, i32 noundef %99, i32 noundef %100)
  br label %101

101:                                              ; preds = %97, %94
  %102 = load i16, ptr %19, align 2, !tbaa !14
  %103 = zext i16 %102 to i32
  store i32 %103, ptr %17, align 4, !tbaa !10
  br label %104

104:                                              ; preds = %101, %81
  %105 = load ptr, ptr %9, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.array_container_s, ptr %105, i32 0, i32 2
  %107 = load ptr, ptr %106, align 8, !tbaa !12
  %108 = load i32, ptr %18, align 4, !tbaa !10
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds i16, ptr %107, i64 %109
  %111 = load i16, ptr %110, align 2, !tbaa !14
  %112 = zext i16 %111 to i32
  store i32 %112, ptr %16, align 4, !tbaa !10
  call void @llvm.lifetime.end.p0(i64 2, ptr %19) #6
  br label %113

113:                                              ; preds = %104
  %114 = load i32, ptr %18, align 4, !tbaa !10
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %18, align 4, !tbaa !10
  br label %76, !llvm.loop !16

116:                                              ; preds = %80
  %117 = load i32, ptr %17, align 4, !tbaa !10
  %118 = icmp sge i32 %117, 0
  br i1 %118, label %119, label %120

119:                                              ; preds = %116
  br label %121

120:                                              ; preds = %116
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 225, ptr noundef @__PRETTY_FUNCTION__.convert_run_optimize) #7
  unreachable

121:                                              ; preds = %119
  %122 = load ptr, ptr %15, align 8, !tbaa !5
  %123 = load i32, ptr %17, align 4, !tbaa !10
  %124 = load i32, ptr %16, align 4, !tbaa !10
  call void @add_run(ptr noundef %122, i32 noundef %123, i32 noundef %124)
  %125 = load ptr, ptr %7, align 8, !tbaa !5
  store i8 3, ptr %125, align 1, !tbaa !9
  %126 = load ptr, ptr %9, align 8, !tbaa !5
  call void @array_container_free(ptr noundef %126)
  %127 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %127, ptr %4, align 8
  store i32 1, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %128

128:                                              ; preds = %121, %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %253

129:                                              ; preds = %48
  %130 = load i8, ptr %6, align 1, !tbaa !9
  %131 = zext i8 %130 to i32
  %132 = icmp eq i32 %131, 1
  br i1 %132, label %133, label %252

133:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %134 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %134, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  %135 = load ptr, ptr %20, align 8, !tbaa !5
  %136 = call i32 @bitset_container_number_of_runs(ptr noundef %135)
  store i32 %136, ptr %21, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  %137 = load i32, ptr %21, align 4, !tbaa !10
  %138 = call i32 @run_container_serialized_size_in_bytes(i32 noundef %137)
  store i32 %138, ptr %22, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  %139 = call i32 @bitset_container_serialized_size_in_bytes()
  store i32 %139, ptr %23, align 4, !tbaa !10
  %140 = load i32, ptr %23, align 4, !tbaa !10
  %141 = load i32, ptr %22, align 4, !tbaa !10
  %142 = icmp sle i32 %140, %141
  br i1 %142, label %143, label %146

143:                                              ; preds = %133
  %144 = load ptr, ptr %7, align 8, !tbaa !5
  store i8 1, ptr %144, align 1, !tbaa !9
  %145 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %145, ptr %4, align 8
  store i32 1, ptr %14, align 4
  br label %251

146:                                              ; preds = %133
  %147 = load i32, ptr %21, align 4, !tbaa !10
  %148 = icmp sgt i32 %147, 0
  br i1 %148, label %149, label %150

149:                                              ; preds = %146
  br label %151

150:                                              ; preds = %146
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 248, ptr noundef @__PRETTY_FUNCTION__.convert_run_optimize) #7
  unreachable

151:                                              ; preds = %149
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  %152 = load i32, ptr %21, align 4, !tbaa !10
  %153 = call ptr @run_container_create_given_capacity(i32 noundef %152)
  store ptr %153, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #6
  store i32 0, ptr %25, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #6
  %154 = load ptr, ptr %20, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.bitset_container_s, ptr %154, i32 0, i32 1
  %156 = load ptr, ptr %155, align 8, !tbaa !18
  %157 = getelementptr inbounds i64, ptr %156, i64 0
  %158 = load i64, ptr %157, align 8, !tbaa !20
  store i64 %158, ptr %26, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #6
  store i32 0, ptr %27, align 4, !tbaa !10
  br label %159

159:                                              ; preds = %249, %151
  br label %160

160:                                              ; preds = %159
  br label %161

161:                                              ; preds = %169, %160
  %162 = load i64, ptr %26, align 8, !tbaa !20
  %163 = icmp eq i64 %162, 0
  br i1 %163, label %164, label %167

164:                                              ; preds = %161
  %165 = load i32, ptr %25, align 4, !tbaa !10
  %166 = icmp slt i32 %165, 1023
  br label %167

167:                                              ; preds = %164, %161
  %168 = phi i1 [ false, %161 ], [ %166, %164 ]
  br i1 %168, label %169, label %178

169:                                              ; preds = %167
  %170 = load ptr, ptr %20, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.bitset_container_s, ptr %170, i32 0, i32 1
  %172 = load ptr, ptr %171, align 8, !tbaa !18
  %173 = load i32, ptr %25, align 4, !tbaa !10
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %25, align 4, !tbaa !10
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds i64, ptr %172, i64 %175
  %177 = load i64, ptr %176, align 8, !tbaa !20
  store i64 %177, ptr %26, align 8, !tbaa !20
  br label %161, !llvm.loop !22

178:                                              ; preds = %167
  %179 = load i64, ptr %26, align 8, !tbaa !20
  %180 = icmp eq i64 %179, 0
  br i1 %180, label %181, label %185

181:                                              ; preds = %178
  %182 = load ptr, ptr %20, align 8, !tbaa !5
  call void @bitset_container_free(ptr noundef %182)
  %183 = load ptr, ptr %7, align 8, !tbaa !5
  store i8 3, ptr %183, align 1, !tbaa !9
  %184 = load ptr, ptr %24, align 8, !tbaa !5
  store ptr %184, ptr %4, align 8
  store i32 1, ptr %14, align 4
  br label %250

185:                                              ; preds = %178
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #6
  %186 = load i64, ptr %26, align 8, !tbaa !20
  %187 = call i64 @llvm.cttz.i64(i64 %186, i1 true)
  %188 = trunc i64 %187 to i32
  store i32 %188, ptr %28, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #6
  %189 = load i32, ptr %28, align 4, !tbaa !10
  %190 = load i32, ptr %25, align 4, !tbaa !10
  %191 = mul nsw i32 64, %190
  %192 = add nsw i32 %189, %191
  store i32 %192, ptr %29, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #6
  %193 = load i64, ptr %26, align 8, !tbaa !20
  %194 = load i64, ptr %26, align 8, !tbaa !20
  %195 = sub i64 %194, 1
  %196 = or i64 %193, %195
  store i64 %196, ptr %30, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #6
  store i32 0, ptr %31, align 4, !tbaa !10
  br label %197

197:                                              ; preds = %205, %185
  %198 = load i64, ptr %30, align 8, !tbaa !20
  %199 = icmp eq i64 %198, -1
  br i1 %199, label %200, label %203

200:                                              ; preds = %197
  %201 = load i32, ptr %25, align 4, !tbaa !10
  %202 = icmp slt i32 %201, 1023
  br label %203

203:                                              ; preds = %200, %197
  %204 = phi i1 [ false, %197 ], [ %202, %200 ]
  br i1 %204, label %205, label %214

205:                                              ; preds = %203
  %206 = load ptr, ptr %20, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.bitset_container_s, ptr %206, i32 0, i32 1
  %208 = load ptr, ptr %207, align 8, !tbaa !18
  %209 = load i32, ptr %25, align 4, !tbaa !10
  %210 = add nsw i32 %209, 1
  store i32 %210, ptr %25, align 4, !tbaa !10
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds i64, ptr %208, i64 %211
  %213 = load i64, ptr %212, align 8, !tbaa !20
  store i64 %213, ptr %30, align 8, !tbaa !20
  br label %197, !llvm.loop !23

214:                                              ; preds = %203
  %215 = load i64, ptr %30, align 8, !tbaa !20
  %216 = icmp eq i64 %215, -1
  br i1 %216, label %217, label %228

217:                                              ; preds = %214
  %218 = load i32, ptr %25, align 4, !tbaa !10
  %219 = mul nsw i32 %218, 64
  %220 = add nsw i32 64, %219
  store i32 %220, ptr %31, align 4, !tbaa !10
  %221 = load ptr, ptr %24, align 8, !tbaa !5
  %222 = load i32, ptr %29, align 4, !tbaa !10
  %223 = load i32, ptr %31, align 4, !tbaa !10
  %224 = sub nsw i32 %223, 1
  call void @add_run(ptr noundef %221, i32 noundef %222, i32 noundef %224)
  %225 = load ptr, ptr %20, align 8, !tbaa !5
  call void @bitset_container_free(ptr noundef %225)
  %226 = load ptr, ptr %7, align 8, !tbaa !5
  store i8 3, ptr %226, align 1, !tbaa !9
  %227 = load ptr, ptr %24, align 8, !tbaa !5
  store ptr %227, ptr %4, align 8
  store i32 1, ptr %14, align 4
  br label %247

228:                                              ; preds = %214
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #6
  %229 = load i64, ptr %30, align 8, !tbaa !20
  %230 = xor i64 %229, -1
  %231 = call i64 @llvm.cttz.i64(i64 %230, i1 true)
  %232 = trunc i64 %231 to i32
  store i32 %232, ptr %32, align 4, !tbaa !10
  %233 = load i32, ptr %32, align 4, !tbaa !10
  %234 = load i32, ptr %25, align 4, !tbaa !10
  %235 = mul nsw i32 %234, 64
  %236 = add nsw i32 %233, %235
  store i32 %236, ptr %31, align 4, !tbaa !10
  %237 = load ptr, ptr %24, align 8, !tbaa !5
  %238 = load i32, ptr %29, align 4, !tbaa !10
  %239 = load i32, ptr %31, align 4, !tbaa !10
  %240 = sub nsw i32 %239, 1
  call void @add_run(ptr noundef %237, i32 noundef %238, i32 noundef %240)
  %241 = load i32, ptr %27, align 4, !tbaa !10
  %242 = add nsw i32 %241, 1
  store i32 %242, ptr %27, align 4, !tbaa !10
  %243 = load i64, ptr %30, align 8, !tbaa !20
  %244 = load i64, ptr %30, align 8, !tbaa !20
  %245 = add i64 %244, 1
  %246 = and i64 %243, %245
  store i64 %246, ptr %26, align 8, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #6
  store i32 0, ptr %14, align 4
  br label %247

247:                                              ; preds = %228, %217
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #6
  %248 = load i32, ptr %14, align 4
  switch i32 %248, label %250 [
    i32 0, label %249
  ]

249:                                              ; preds = %247
  br label %159

250:                                              ; preds = %247, %181
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  br label %251

251:                                              ; preds = %250, %143
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  br label %253

252:                                              ; preds = %129
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 289, ptr noundef @__PRETTY_FUNCTION__.convert_run_optimize) #7
  unreachable

253:                                              ; preds = %251, %128, %46
  %254 = load ptr, ptr %4, align 8
  ret ptr %254
}

declare void @container_free(ptr noundef, i8 noundef zeroext) #2

declare void @array_container_free(ptr noundef) #2

declare i32 @bitset_container_number_of_runs(ptr noundef) #2

declare void @bitset_container_free(ptr noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.cttz.i64(i64, i1 immarg) #5

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 = { "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 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 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { noreturn nounwind }

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

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


; 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.1 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@__PRETTY_FUNCTION__.convert_run_optimize = external hidden unnamed_addr constant [55 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1

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

declare i32 @array_container_number_of_runs(ptr noundef) local_unnamed_addr #1

declare ptr @run_container_create_given_capacity(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @add_run(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @convert_run_to_efficient_container(ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @convert_run_optimize(ptr noundef %0, i8 noundef zeroext %1, ptr noundef %2) local_unnamed_addr #2 {
  switch i8 %1, label %89 [
    i8 3, label %4
    i8 2, label %7
    i8 1, label %32
  ]

4:                                                ; preds = %3
  %5 = tail call ptr @convert_run_to_efficient_container(ptr noundef %0, ptr noundef %2)
  %.not109 = icmp eq ptr %5, %0
  br i1 %.not109, label %90, label %6

6:                                                ; preds = %4
  tail call void @container_free(ptr noundef %0, i8 noundef zeroext 3) #5
  br label %90

7:                                                ; preds = %3
  %8 = tail call i32 @array_container_number_of_runs(ptr noundef %0) #5
  %9 = tail call i32 @run_container_serialized_size_in_bytes(i32 noundef %8)
  %10 = tail call i32 @array_container_cardinality(ptr noundef %0)
  %11 = tail call i32 @array_container_serialized_size_in_bytes(i32 noundef %10)
  %.not106 = icmp slt i32 %9, %11
  br i1 %.not106, label %13, label %12

12:                                               ; preds = %7
  store i8 2, ptr %2, align 1, !tbaa !5
  br label %90

13:                                               ; preds = %7
  %14 = tail call ptr @run_container_create_given_capacity(i32 noundef %8) #5
  %15 = icmp sgt i32 %10, 0
  br i1 %15, label %.preheader, label %17

.preheader:                                       ; preds = %13
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  %wide.trip.count = zext nneg i32 %10 to i64
  %.pre = load ptr, ptr %16, align 8, !tbaa !8
  br label %20

17:                                               ; preds = %13
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 215, ptr noundef nonnull @__PRETTY_FUNCTION__.convert_run_optimize) #6
  unreachable

18:                                               ; preds = %28
  %19 = icmp sgt i32 %.199, -1
  br i1 %19, label %31, label %30

20:                                               ; preds = %.preheader, %28
  %21 = phi ptr [ %.pre, %.preheader ], [ %29, %28 ]
  %indvars.iv140 = phi i64 [ 0, %.preheader ], [ %indvars.iv.next141, %28 ]
  %.089127 = phi i32 [ -2, %.preheader ], [ %.pre-phi, %28 ]
  %.098126 = phi i32 [ -1, %.preheader ], [ %.199, %28 ]
  %22 = getelementptr inbounds i16, ptr %21, i64 %indvars.iv140
  %23 = load i16, ptr %22, align 2, !tbaa !12
  %24 = zext i16 %23 to i32
  %25 = add nsw i32 %.089127, 1
  %.not107 = icmp eq i32 %25, %24
  br i1 %.not107, label %28, label %26

26:                                               ; preds = %20
  %.not108 = icmp eq i32 %.098126, -1
  br i1 %.not108, label %28, label %27

27:                                               ; preds = %26
  tail call void @add_run(ptr noundef %14, i32 noundef %.098126, i32 noundef %.089127)
  %.pre143 = load ptr, ptr %16, align 8, !tbaa !8
  %.phi.trans.insert = getelementptr inbounds i16, ptr %.pre143, i64 %indvars.iv140
  %.pre144 = load i16, ptr %.phi.trans.insert, align 2, !tbaa !12
  %.pre145 = zext i16 %.pre144 to i32
  br label %28

28:                                               ; preds = %26, %27, %20
  %.pre-phi = phi i32 [ %24, %26 ], [ %.pre145, %27 ], [ %24, %20 ]
  %29 = phi ptr [ %21, %26 ], [ %.pre143, %27 ], [ %21, %20 ]
  %.199 = phi i32 [ %24, %26 ], [ %24, %27 ], [ %.098126, %20 ]
  %indvars.iv.next141 = add nuw nsw i64 %indvars.iv140, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next141, %wide.trip.count
  br i1 %exitcond.not, label %18, label %20, !llvm.loop !14

30:                                               ; preds = %18
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 225, ptr noundef nonnull @__PRETTY_FUNCTION__.convert_run_optimize) #6
  unreachable

31:                                               ; preds = %18
  tail call void @add_run(ptr noundef %14, i32 noundef %.199, i32 noundef %.pre-phi)
  store i8 3, ptr %2, align 1, !tbaa !5
  tail call void @array_container_free(ptr noundef %0) #5
  br label %90

32:                                               ; preds = %3
  %33 = tail call i32 @bitset_container_number_of_runs(ptr noundef %0) #5
  %34 = tail call i32 @run_container_serialized_size_in_bytes(i32 noundef %33)
  %35 = tail call i32 @bitset_container_serialized_size_in_bytes()
  %.not = icmp sgt i32 %35, %34
  br i1 %.not, label %37, label %36

36:                                               ; preds = %32
  store i8 1, ptr %2, align 1, !tbaa !5
  br label %90

37:                                               ; preds = %32
  %38 = icmp sgt i32 %33, 0
  br i1 %38, label %40, label %39

39:                                               ; preds = %37
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 248, ptr noundef nonnull @__PRETTY_FUNCTION__.convert_run_optimize) #6
  unreachable

40:                                               ; preds = %37
  %41 = tail call ptr @run_container_create_given_capacity(i32 noundef %33) #5
  %42 = getelementptr inbounds i8, ptr %0, i64 8
  %43 = load ptr, ptr %42, align 8, !tbaa !16
  %44 = load i64, ptr %43, align 8, !tbaa !18
  br label %45

45:                                               ; preds = %80, %40
  %.095 = phi i32 [ 0, %40 ], [ %.297.lcssa148, %80 ]
  %.092 = phi i64 [ %44, %40 ], [ %88, %80 ]
  %46 = icmp eq i64 %.092, 0
  %47 = icmp slt i32 %.095, 1023
  %48 = and i1 %46, %47
  br i1 %48, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %45
  %49 = load ptr, ptr %42, align 8, !tbaa !16
  %50 = sext i32 %.095 to i64
  br label %51

51:                                               ; preds = %.lr.ph, %51
  %indvars.iv = phi i64 [ %50, %.lr.ph ], [ %indvars.iv.next, %51 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %52 = getelementptr inbounds i64, ptr %49, i64 %indvars.iv.next
  %53 = load i64, ptr %52, align 8, !tbaa !18
  %54 = icmp eq i64 %53, 0
  %55 = icmp slt i64 %indvars.iv, 1022
  %56 = and i1 %54, %55
  br i1 %56, label %51, label %._crit_edge.loopexit, !llvm.loop !20

._crit_edge.loopexit:                             ; preds = %51
  %57 = trunc nsw i64 %indvars.iv.next to i32
  br i1 %54, label %58, label %59

._crit_edge:                                      ; preds = %45
  br i1 %46, label %58, label %59

58:                                               ; preds = %._crit_edge.loopexit, %._crit_edge
  tail call void @bitset_container_free(ptr noundef %0) #5
  store i8 3, ptr %2, align 1, !tbaa !5
  br label %90

59:                                               ; preds = %._crit_edge.loopexit, %._crit_edge
  %.193.lcssa147 = phi i64 [ %53, %._crit_edge.loopexit ], [ %.092, %._crit_edge ]
  %.196.lcssa146 = phi i32 [ %57, %._crit_edge.loopexit ], [ %.095, %._crit_edge ]
  %60 = tail call range(i64 0, 65) i64 @llvm.cttz.i64(i64 %.193.lcssa147, i1 true)
  %61 = trunc nuw nsw i64 %60 to i32
  %62 = shl nsw i32 %.196.lcssa146, 6
  %63 = or disjoint i32 %62, %61
  %64 = add i64 %.193.lcssa147, -1
  %65 = or i64 %64, %.193.lcssa147
  %66 = icmp eq i64 %65, -1
  %67 = icmp slt i32 %.196.lcssa146, 1023
  %68 = select i1 %66, i1 %67, i1 false
  br i1 %68, label %.lr.ph120, label %._crit_edge121

.lr.ph120:                                        ; preds = %59
  %69 = load ptr, ptr %42, align 8, !tbaa !16
  %70 = sext i32 %.196.lcssa146 to i64
  br label %71

71:                                               ; preds = %.lr.ph120, %71
  %indvars.iv137 = phi i64 [ %70, %.lr.ph120 ], [ %indvars.iv.next138, %71 ]
  %indvars.iv.next138 = add nsw i64 %indvars.iv137, 1
  %72 = getelementptr inbounds i64, ptr %69, i64 %indvars.iv.next138
  %73 = load i64, ptr %72, align 8, !tbaa !18
  %74 = icmp eq i64 %73, -1
  %75 = icmp slt i64 %indvars.iv137, 1022
  %76 = and i1 %74, %75
  br i1 %76, label %71, label %._crit_edge121.loopexit, !llvm.loop !21

._crit_edge121.loopexit:                          ; preds = %71
  %77 = trunc nsw i64 %indvars.iv.next138 to i32
  br i1 %74, label %.thread, label %80

._crit_edge121:                                   ; preds = %59
  br i1 %66, label %.thread, label %80

.thread:                                          ; preds = %._crit_edge121.loopexit, %._crit_edge121
  %.297.lcssa149 = phi i32 [ %77, %._crit_edge121.loopexit ], [ %.196.lcssa146, %._crit_edge121 ]
  %78 = shl nsw i32 %.297.lcssa149, 6
  %79 = or disjoint i32 %78, 63
  tail call void @add_run(ptr noundef %41, i32 noundef %63, i32 noundef %79)
  tail call void @bitset_container_free(ptr noundef %0) #5
  store i8 3, ptr %2, align 1, !tbaa !5
  br label %90

80:                                               ; preds = %._crit_edge121.loopexit, %._crit_edge121
  %.087.lcssa150 = phi i64 [ %73, %._crit_edge121.loopexit ], [ %65, %._crit_edge121 ]
  %.297.lcssa148 = phi i32 [ %77, %._crit_edge121.loopexit ], [ %.196.lcssa146, %._crit_edge121 ]
  %81 = xor i64 %.087.lcssa150, -1
  %82 = tail call range(i64 0, 65) i64 @llvm.cttz.i64(i64 %81, i1 true)
  %83 = trunc nuw nsw i64 %82 to i32
  %84 = shl nsw i32 %.297.lcssa148, 6
  %85 = add i32 %84, -1
  %86 = add i32 %85, %83
  tail call void @add_run(ptr noundef %41, i32 noundef %63, i32 noundef %86)
  %87 = add nuw i64 %.087.lcssa150, 1
  %88 = and i64 %87, %.087.lcssa150
  br label %45

89:                                               ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 289, ptr noundef nonnull @__PRETTY_FUNCTION__.convert_run_optimize) #6
  unreachable

90:                                               ; preds = %.thread, %36, %58, %12, %31, %4, %6
  %.5 = phi ptr [ %5, %6 ], [ %5, %4 ], [ %0, %12 ], [ %14, %31 ], [ %0, %36 ], [ %41, %58 ], [ %41, %.thread ]
  ret ptr %.5
}

declare void @container_free(ptr noundef, i8 noundef zeroext) local_unnamed_addr #1

declare void @array_container_free(ptr noundef) local_unnamed_addr #1

declare i32 @bitset_container_number_of_runs(ptr noundef) local_unnamed_addr #1

declare void @bitset_container_free(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.cttz.i64(i64, i1 immarg) #4

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 = { "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 = { 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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { 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 = !{!9, !11, i64 8}
!9 = !{!"array_container_s", !10, i64 0, !10, i64 4, !11, i64 8}
!10 = !{!"int", !6, i64 0}
!11 = !{!"any pointer", !6, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"short", !6, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !11, i64 8}
!17 = !{!"bitset_container_s", !10, i64 0, !11, i64 8}
!18 = !{!19, !19, i64 0}
!19 = !{!"long", !6, i64 0}
!20 = distinct !{!20, !15}
!21 = distinct !{!21, !15}


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