; LLVM IR from seppo0010/rlite :: src (type_set)

; 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.rl_btree = type { ptr, i64, i64, ptr, i64, i64 }

; Function Attrs: nounwind uwtable
declare dso_local i32 @rl_set_get_objects(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) #0

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

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

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

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

declare i32 @rl_btree_iterator_next(ptr noundef, ptr noundef, ptr noundef) #4

declare i32 @rl_multi_string_get(ptr noundef, i64 noundef, ptr noundef, ptr noundef) #4

declare i32 @rl_btree_iterator_create(ptr noundef, ptr noundef, ptr noundef) #4

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #5

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_sunion(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) #0 {
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  %25 = alloca i64, align 8
  %26 = alloca ptr, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !9
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  store ptr %6, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  store ptr null, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  store ptr null, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  store ptr null, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  store i64 0, ptr %24, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  store i64 0, ptr %25, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #7
  %27 = load i32, ptr %9, align 4, !tbaa !9
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %29, label %30

29:                                               ; preds = %7
  store i32 3, ptr %15, align 4, !tbaa !9
  br label %233

30:                                               ; preds = %7
  %31 = load i32, ptr %9, align 4, !tbaa !9
  %32 = sext i32 %31 to i64
  %33 = mul i64 8, %32
  %34 = call noalias ptr @malloc(i64 noundef %33) #8
  store ptr %34, ptr %17, align 8, !tbaa !5
  %35 = load ptr, ptr %17, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %38, label %37

37:                                               ; preds = %30
  store i32 4, ptr %15, align 4, !tbaa !9
  br label %233

38:                                               ; preds = %30
  store i64 0, ptr %21, align 8, !tbaa !11
  br label %39

39:                                               ; preds = %79, %38
  %40 = load i64, ptr %21, align 8, !tbaa !11
  %41 = load i32, ptr %9, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = icmp slt i64 %40, %42
  br i1 %43, label %44, label %82

44:                                               ; preds = %39
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = load i64, ptr %21, align 8, !tbaa !11
  %48 = getelementptr inbounds ptr, ptr %46, i64 %47
  %49 = load ptr, ptr %48, align 8, !tbaa !5
  %50 = load ptr, ptr %11, align 8, !tbaa !5
  %51 = load i64, ptr %21, align 8, !tbaa !11
  %52 = getelementptr inbounds i64, ptr %50, i64 %51
  %53 = load i64, ptr %52, align 8, !tbaa !11
  %54 = load ptr, ptr %17, align 8, !tbaa !5
  %55 = load i64, ptr %21, align 8, !tbaa !11
  %56 = getelementptr inbounds ptr, ptr %54, i64 %55
  %57 = call i32 @rl_set_get_objects(ptr noundef %45, ptr noundef %49, i64 noundef %53, ptr noundef null, ptr noundef %56, i32 noundef 0, i32 noundef 0)
  store i32 %57, ptr %15, align 4, !tbaa !9
  %58 = load i32, ptr %15, align 4, !tbaa !9
  %59 = icmp eq i32 %58, 3
  br i1 %59, label %60, label %64

60:                                               ; preds = %44
  %61 = load ptr, ptr %17, align 8, !tbaa !5
  %62 = load i64, ptr %21, align 8, !tbaa !11
  %63 = getelementptr inbounds ptr, ptr %61, i64 %62
  store ptr null, ptr %63, align 8, !tbaa !5
  br label %78

64:                                               ; preds = %44
  %65 = load i32, ptr %15, align 4, !tbaa !9
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %67, label %68

67:                                               ; preds = %64
  br label %233

68:                                               ; preds = %64
  %69 = load ptr, ptr %17, align 8, !tbaa !5
  %70 = load i64, ptr %21, align 8, !tbaa !11
  %71 = getelementptr inbounds ptr, ptr %69, i64 %70
  %72 = load ptr, ptr %71, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.rl_btree, ptr %72, i32 0, i32 5
  %74 = load i64, ptr %73, align 8, !tbaa !13
  %75 = load i64, ptr %25, align 8, !tbaa !11
  %76 = add nsw i64 %75, %74
  store i64 %76, ptr %25, align 8, !tbaa !11
  br label %77

77:                                               ; preds = %68
  br label %78

78:                                               ; preds = %77, %60
  br label %79

79:                                               ; preds = %78
  %80 = load i64, ptr %21, align 8, !tbaa !11
  %81 = add nsw i64 %80, 1
  store i64 %81, ptr %21, align 8, !tbaa !11
  br label %39, !llvm.loop !15

82:                                               ; preds = %39
  %83 = load i64, ptr %25, align 8, !tbaa !11
  %84 = icmp eq i64 %83, 0
  br i1 %84, label %85, label %87

85:                                               ; preds = %82
  %86 = load ptr, ptr %12, align 8, !tbaa !5
  store i64 0, ptr %86, align 8, !tbaa !11
  store i32 3, ptr %15, align 4, !tbaa !9
  br label %233

87:                                               ; preds = %82
  %88 = load i64, ptr %25, align 8, !tbaa !11
  %89 = mul i64 8, %88
  %90 = call noalias ptr @malloc(i64 noundef %89) #8
  store ptr %90, ptr %19, align 8, !tbaa !5
  %91 = load ptr, ptr %19, align 8, !tbaa !5
  %92 = icmp ne ptr %91, null
  br i1 %92, label %94, label %93

93:                                               ; preds = %87
  store i32 4, ptr %15, align 4, !tbaa !9
  br label %233

94:                                               ; preds = %87
  %95 = load i64, ptr %25, align 8, !tbaa !11
  %96 = mul i64 8, %95
  %97 = call noalias ptr @malloc(i64 noundef %96) #8
  store ptr %97, ptr %20, align 8, !tbaa !5
  %98 = load ptr, ptr %20, align 8, !tbaa !5
  %99 = icmp ne ptr %98, null
  br i1 %99, label %101, label %100

100:                                              ; preds = %94
  store i32 4, ptr %15, align 4, !tbaa !9
  br label %233

101:                                              ; preds = %94
  store i64 0, ptr %21, align 8, !tbaa !11
  br label %102

102:                                              ; preds = %197, %101
  %103 = load i64, ptr %21, align 8, !tbaa !11
  %104 = load i32, ptr %9, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = icmp slt i64 %103, %105
  br i1 %106, label %107, label %200

107:                                              ; preds = %102
  %108 = load ptr, ptr %17, align 8, !tbaa !5
  %109 = load i64, ptr %21, align 8, !tbaa !11
  %110 = getelementptr inbounds ptr, ptr %108, i64 %109
  %111 = load ptr, ptr %110, align 8, !tbaa !5
  %112 = icmp ne ptr %111, null
  br i1 %112, label %114, label %113

113:                                              ; preds = %107
  br label %197

114:                                              ; preds = %107
  %115 = load ptr, ptr %8, align 8, !tbaa !5
  %116 = load ptr, ptr %17, align 8, !tbaa !5
  %117 = load i64, ptr %21, align 8, !tbaa !11
  %118 = getelementptr inbounds ptr, ptr %116, i64 %117
  %119 = load ptr, ptr %118, align 8, !tbaa !5
  %120 = call i32 @rl_btree_iterator_create(ptr noundef %115, ptr noundef %119, ptr noundef %18)
  store i32 %120, ptr %15, align 4, !tbaa !9
  %121 = load i32, ptr %15, align 4, !tbaa !9
  %122 = icmp ne i32 0, %121
  br i1 %122, label %123, label %124

123:                                              ; preds = %114
  br label %233

124:                                              ; preds = %114
  br label %125

125:                                              ; preds = %191, %124
  %126 = load ptr, ptr %18, align 8, !tbaa !5
  %127 = call i32 @rl_btree_iterator_next(ptr noundef %126, ptr noundef null, ptr noundef %26)
  store i32 %127, ptr %15, align 4, !tbaa !9
  %128 = icmp eq i32 %127, 0
  br i1 %128, label %129, label %192

129:                                              ; preds = %125
  %130 = load ptr, ptr %26, align 8, !tbaa !5
  %131 = load i64, ptr %130, align 8, !tbaa !11
  store i64 %131, ptr %23, align 8, !tbaa !11
  %132 = load ptr, ptr %26, align 8, !tbaa !5
  call void @free(ptr noundef %132) #7
  %133 = load ptr, ptr %8, align 8, !tbaa !5
  %134 = load i64, ptr %23, align 8, !tbaa !11
  %135 = load ptr, ptr %19, align 8, !tbaa !5
  %136 = load i64, ptr %24, align 8, !tbaa !11
  %137 = getelementptr inbounds ptr, ptr %135, i64 %136
  %138 = load ptr, ptr %20, align 8, !tbaa !5
  %139 = load i64, ptr %24, align 8, !tbaa !11
  %140 = getelementptr inbounds i64, ptr %138, i64 %139
  %141 = call i32 @rl_multi_string_get(ptr noundef %133, i64 noundef %134, ptr noundef %137, ptr noundef %140)
  store i32 %141, ptr %15, align 4, !tbaa !9
  %142 = load i32, ptr %15, align 4, !tbaa !9
  %143 = icmp ne i32 0, %142
  br i1 %143, label %144, label %145

144:                                              ; preds = %129
  br label %233

145:                                              ; preds = %129
  store i32 0, ptr %16, align 4, !tbaa !9
  store i64 0, ptr %22, align 8, !tbaa !11
  br label %146

146:                                              ; preds = %177, %145
  %147 = load i64, ptr %22, align 8, !tbaa !11
  %148 = load i64, ptr %24, align 8, !tbaa !11
  %149 = icmp slt i64 %147, %148
  br i1 %149, label %150, label %180

150:                                              ; preds = %146
  %151 = load ptr, ptr %20, align 8, !tbaa !5
  %152 = load i64, ptr %24, align 8, !tbaa !11
  %153 = getelementptr inbounds i64, ptr %151, i64 %152
  %154 = load i64, ptr %153, align 8, !tbaa !11
  %155 = load ptr, ptr %20, align 8, !tbaa !5
  %156 = load i64, ptr %22, align 8, !tbaa !11
  %157 = getelementptr inbounds i64, ptr %155, i64 %156
  %158 = load i64, ptr %157, align 8, !tbaa !11
  %159 = icmp eq i64 %154, %158
  br i1 %159, label %160, label %176

160:                                              ; preds = %150
  %161 = load ptr, ptr %19, align 8, !tbaa !5
  %162 = load i64, ptr %24, align 8, !tbaa !11
  %163 = getelementptr inbounds ptr, ptr %161, i64 %162
  %164 = load ptr, ptr %163, align 8, !tbaa !5
  %165 = load ptr, ptr %19, align 8, !tbaa !5
  %166 = load i64, ptr %22, align 8, !tbaa !11
  %167 = getelementptr inbounds ptr, ptr %165, i64 %166
  %168 = load ptr, ptr %167, align 8, !tbaa !5
  %169 = load ptr, ptr %20, align 8, !tbaa !5
  %170 = load i64, ptr %24, align 8, !tbaa !11
  %171 = getelementptr inbounds i64, ptr %169, i64 %170
  %172 = load i64, ptr %171, align 8, !tbaa !11
  %173 = call i32 @memcmp(ptr noundef %164, ptr noundef %168, i64 noundef %172) #9
  %174 = icmp eq i32 %173, 0
  br i1 %174, label %175, label %176

175:                                              ; preds = %160
  store i32 1, ptr %16, align 4, !tbaa !9
  br label %180

176:                                              ; preds = %160, %150
  br label %177

177:                                              ; preds = %176
  %178 = load i64, ptr %22, align 8, !tbaa !11
  %179 = add nsw i64 %178, 1
  store i64 %179, ptr %22, align 8, !tbaa !11
  br label %146, !llvm.loop !17

180:                                              ; preds = %175, %146
  %181 = load i32, ptr %16, align 4, !tbaa !9
  %182 = icmp ne i32 %181, 0
  br i1 %182, label %183, label %188

183:                                              ; preds = %180
  %184 = load ptr, ptr %19, align 8, !tbaa !5
  %185 = load i64, ptr %24, align 8, !tbaa !11
  %186 = getelementptr inbounds ptr, ptr %184, i64 %185
  %187 = load ptr, ptr %186, align 8, !tbaa !5
  call void @free(ptr noundef %187) #7
  br label %191

188:                                              ; preds = %180
  %189 = load i64, ptr %24, align 8, !tbaa !11
  %190 = add nsw i64 %189, 1
  store i64 %190, ptr %24, align 8, !tbaa !11
  br label %191

191:                                              ; preds = %188, %183
  br label %125, !llvm.loop !18

192:                                              ; preds = %125
  store ptr null, ptr %18, align 8, !tbaa !5
  %193 = load i32, ptr %15, align 4, !tbaa !9
  %194 = icmp ne i32 %193, 9
  br i1 %194, label %195, label %196

195:                                              ; preds = %192
  br label %233

196:                                              ; preds = %192
  br label %197

197:                                              ; preds = %196, %113
  %198 = load i64, ptr %21, align 8, !tbaa !11
  %199 = add nsw i64 %198, 1
  store i64 %199, ptr %21, align 8, !tbaa !11
  br label %102, !llvm.loop !19

200:                                              ; preds = %102
  %201 = load i64, ptr %24, align 8, !tbaa !11
  %202 = load ptr, ptr %12, align 8, !tbaa !5
  store i64 %201, ptr %202, align 8, !tbaa !11
  %203 = load i64, ptr %24, align 8, !tbaa !11
  %204 = load i64, ptr %25, align 8, !tbaa !11
  %205 = icmp eq i64 %203, %204
  br i1 %205, label %206, label %211

206:                                              ; preds = %200
  %207 = load ptr, ptr %19, align 8, !tbaa !5
  %208 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %207, ptr %208, align 8, !tbaa !5
  %209 = load ptr, ptr %20, align 8, !tbaa !5
  %210 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %209, ptr %210, align 8, !tbaa !5
  br label %232

211:                                              ; preds = %200
  %212 = load ptr, ptr %19, align 8, !tbaa !5
  %213 = load i64, ptr %24, align 8, !tbaa !11
  %214 = mul i64 8, %213
  %215 = call ptr @realloc(ptr noundef %212, i64 noundef %214) #10
  %216 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %215, ptr %216, align 8, !tbaa !5
  %217 = load ptr, ptr %13, align 8, !tbaa !5
  %218 = load ptr, ptr %217, align 8, !tbaa !5
  %219 = icmp eq ptr %218, null
  br i1 %219, label %220, label %221

220:                                              ; preds = %211
  store i32 4, ptr %15, align 4, !tbaa !9
  br label %233

221:                                              ; preds = %211
  %222 = load ptr, ptr %20, align 8, !tbaa !5
  %223 = load i64, ptr %24, align 8, !tbaa !11
  %224 = mul i64 8, %223
  %225 = call ptr @realloc(ptr noundef %222, i64 noundef %224) #10
  %226 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %225, ptr %226, align 8, !tbaa !5
  %227 = load ptr, ptr %14, align 8, !tbaa !5
  %228 = load ptr, ptr %227, align 8, !tbaa !5
  %229 = icmp eq ptr %228, null
  br i1 %229, label %230, label %231

230:                                              ; preds = %221
  store i32 4, ptr %15, align 4, !tbaa !9
  br label %233

231:                                              ; preds = %221
  br label %232

232:                                              ; preds = %231, %206
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %233

233:                                              ; preds = %232, %230, %220, %195, %144, %123, %100, %93, %85, %67, %37, %29
  %234 = load i32, ptr %15, align 4, !tbaa !9
  %235 = icmp ne i32 %234, 0
  br i1 %235, label %236, label %239

236:                                              ; preds = %233
  %237 = load ptr, ptr %19, align 8, !tbaa !5
  call void @free(ptr noundef %237) #7
  %238 = load ptr, ptr %20, align 8, !tbaa !5
  call void @free(ptr noundef %238) #7
  br label %239

239:                                              ; preds = %236, %233
  %240 = load ptr, ptr %17, align 8, !tbaa !5
  call void @free(ptr noundef %240) #7
  %241 = load i32, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  ret i32 %241
}

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #6

attributes #0 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 = { "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 allocsize(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 #6 = { nounwind willreturn memory(read) "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 #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { nounwind allocsize(1) }

!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, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 40}
!14 = !{!"rl_btree", !6, i64 0, !12, i64 8, !12, i64 16, !6, i64 24, !12, i64 32, !12, i64 40}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}


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

; Function Attrs: nounwind uwtable
declare dso_local i32 @rl_set_get_objects(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

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

declare i32 @rl_multi_string_get(ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

declare i32 @rl_btree_iterator_create(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_sunion(ptr noundef %0, i32 noundef %1, ptr nocapture noundef readonly %2, ptr nocapture noundef readonly %3, ptr nocapture noundef writeonly %4, ptr nocapture noundef writeonly %5, ptr nocapture noundef writeonly %6) local_unnamed_addr #0 {
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #7
  %10 = icmp eq i32 %1, 0
  br i1 %10, label %.loopexit, label %11

11:                                               ; preds = %7
  %12 = sext i32 %1 to i64
  %13 = shl nsw i64 %12, 3
  %14 = tail call noalias ptr @malloc(i64 noundef %13) #8
  %.not = icmp eq ptr %14, null
  br i1 %.not, label %.loopexit, label %.preheader128

.preheader128:                                    ; preds = %11
  %15 = icmp sgt i32 %1, 0
  br i1 %15, label %.lr.ph, label %._crit_edge.thread

.lr.ph:                                           ; preds = %.preheader128, %28
  %.0139 = phi i64 [ %.1, %28 ], [ 0, %.preheader128 ]
  %.084138 = phi i64 [ %29, %28 ], [ 0, %.preheader128 ]
  %16 = getelementptr inbounds ptr, ptr %2, i64 %.084138
  %17 = load ptr, ptr %16, align 8, !tbaa !5
  %18 = getelementptr inbounds i64, ptr %3, i64 %.084138
  %19 = load i64, ptr %18, align 8, !tbaa !9
  %20 = getelementptr inbounds ptr, ptr %14, i64 %.084138
  %21 = tail call i32 @rl_set_get_objects(ptr noundef %0, ptr noundef %17, i64 noundef %19, ptr noundef null, ptr noundef nonnull %20, i32 noundef 0, i32 noundef 0)
  switch i32 %21, label %.loopexit [
    i32 3, label %22
    i32 0, label %23
  ]

22:                                               ; preds = %.lr.ph
  store ptr null, ptr %20, align 8, !tbaa !5
  br label %28

23:                                               ; preds = %.lr.ph
  %24 = load ptr, ptr %20, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %24, i64 40
  %26 = load i64, ptr %25, align 8, !tbaa !11
  %27 = add nsw i64 %26, %.0139
  br label %28

28:                                               ; preds = %22, %23
  %.1 = phi i64 [ %.0139, %22 ], [ %27, %23 ]
  %29 = add nuw nsw i64 %.084138, 1
  %exitcond.not = icmp eq i64 %29, %12
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !13

._crit_edge:                                      ; preds = %28
  %30 = icmp eq i64 %.1, 0
  br i1 %30, label %._crit_edge.thread, label %31

._crit_edge.thread:                               ; preds = %.preheader128, %._crit_edge
  store i64 0, ptr %4, align 8, !tbaa !9
  br label %.loopexit

31:                                               ; preds = %._crit_edge
  %32 = shl i64 %.1, 3
  %33 = tail call noalias ptr @malloc(i64 noundef %32) #8
  %.not104 = icmp eq ptr %33, null
  br i1 %.not104, label %.loopexit, label %34

34:                                               ; preds = %31
  %35 = tail call noalias ptr @malloc(i64 noundef %32) #8
  %.not105 = icmp eq ptr %35, null
  br i1 %.not105, label %.loopexit, label %.preheader126

.preheader126:                                    ; preds = %34
  br i1 %15, label %.lr.ph150, label %._crit_edge151

.lr.ph150:                                        ; preds = %.preheader126, %66
  %.080149 = phi i64 [ %.3, %66 ], [ 0, %.preheader126 ]
  %.185148 = phi i64 [ %67, %66 ], [ 0, %.preheader126 ]
  %36 = getelementptr inbounds ptr, ptr %14, i64 %.185148
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  %.not106 = icmp eq ptr %37, null
  br i1 %.not106, label %66, label %38

38:                                               ; preds = %.lr.ph150
  %39 = call i32 @rl_btree_iterator_create(ptr noundef %0, ptr noundef nonnull %37, ptr noundef nonnull %8) #7
  %.not107 = icmp eq i32 %39, 0
  br i1 %.not107, label %.preheader125, label %.loopexit

.preheader125:                                    ; preds = %38
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = call i32 @rl_btree_iterator_next(ptr noundef %40, ptr noundef null, ptr noundef nonnull %9) #7
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %.lr.ph144, label %._crit_edge145

.lr.ph144:                                        ; preds = %.preheader125, %62
  %.181143 = phi i64 [ %.2, %62 ], [ %.080149, %.preheader125 ]
  %43 = load ptr, ptr %9, align 8, !tbaa !5
  %44 = load i64, ptr %43, align 8, !tbaa !9
  call void @free(ptr noundef %43) #7
  %45 = getelementptr inbounds ptr, ptr %33, i64 %.181143
  %46 = getelementptr inbounds i64, ptr %35, i64 %.181143
  %47 = call i32 @rl_multi_string_get(ptr noundef %0, i64 noundef %44, ptr noundef nonnull %45, ptr noundef nonnull %46) #7
  %.not109 = icmp eq i32 %47, 0
  br i1 %.not109, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %.lr.ph144
  %.not111140 = icmp sgt i64 %.181143, 0
  br i1 %.not111140, label %.lr.ph142, label %.critedge

.lr.ph142:                                        ; preds = %.preheader
  %48 = load i64, ptr %46, align 8, !tbaa !9
  br label %49

49:                                               ; preds = %.lr.ph142, %58
  %.083141 = phi i64 [ 0, %.lr.ph142 ], [ %59, %58 ]
  %50 = getelementptr inbounds i64, ptr %35, i64 %.083141
  %51 = load i64, ptr %50, align 8, !tbaa !9
  %52 = icmp eq i64 %48, %51
  br i1 %52, label %53, label %58

53:                                               ; preds = %49
  %54 = load ptr, ptr %45, align 8, !tbaa !5
  %55 = getelementptr inbounds ptr, ptr %33, i64 %.083141
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  %bcmp = call i32 @bcmp(ptr %54, ptr %56, i64 %48)
  %57 = icmp eq i32 %bcmp, 0
  br i1 %57, label %60, label %58

58:                                               ; preds = %49, %53
  %59 = add nuw nsw i64 %.083141, 1
  %exitcond160.not = icmp eq i64 %59, %.181143
  br i1 %exitcond160.not, label %.critedge, label %49, !llvm.loop !15

60:                                               ; preds = %53
  call void @free(ptr noundef %54) #7
  br label %62

.critedge:                                        ; preds = %58, %.preheader
  %61 = add nsw i64 %.181143, 1
  br label %62

62:                                               ; preds = %.critedge, %60
  %.2 = phi i64 [ %.181143, %60 ], [ %61, %.critedge ]
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = call i32 @rl_btree_iterator_next(ptr noundef %63, ptr noundef null, ptr noundef nonnull %9) #7
  %65 = icmp eq i32 %64, 0
  br i1 %65, label %.lr.ph144, label %._crit_edge145, !llvm.loop !16

._crit_edge145:                                   ; preds = %62, %.preheader125
  %.181.lcssa = phi i64 [ %.080149, %.preheader125 ], [ %.2, %62 ]
  %.lcssa130 = phi i32 [ %41, %.preheader125 ], [ %64, %62 ]
  store ptr null, ptr %8, align 8, !tbaa !5
  %.not108 = icmp eq i32 %.lcssa130, 9
  br i1 %.not108, label %66, label %.loopexit

66:                                               ; preds = %._crit_edge145, %.lr.ph150
  %.3 = phi i64 [ %.181.lcssa, %._crit_edge145 ], [ %.080149, %.lr.ph150 ]
  %67 = add nuw nsw i64 %.185148, 1
  %exitcond161.not = icmp eq i64 %67, %12
  br i1 %exitcond161.not, label %._crit_edge151, label %.lr.ph150, !llvm.loop !17

._crit_edge151:                                   ; preds = %66, %.preheader126
  %.080.lcssa = phi i64 [ 0, %.preheader126 ], [ %.3, %66 ]
  store i64 %.080.lcssa, ptr %4, align 8, !tbaa !9
  %68 = icmp eq i64 %.080.lcssa, %.1
  br i1 %68, label %69, label %70

69:                                               ; preds = %._crit_edge151
  store ptr %33, ptr %5, align 8, !tbaa !5
  store ptr %35, ptr %6, align 8, !tbaa !5
  br label %77

70:                                               ; preds = %._crit_edge151
  %71 = shl i64 %.080.lcssa, 3
  %72 = call ptr @realloc(ptr noundef nonnull %33, i64 noundef %71) #9
  store ptr %72, ptr %5, align 8, !tbaa !5
  %73 = icmp eq ptr %72, null
  br i1 %73, label %.loopexit, label %74

74:                                               ; preds = %70
  %75 = call ptr @realloc(ptr noundef nonnull %35, i64 noundef %71) #9
  store ptr %75, ptr %6, align 8, !tbaa !5
  %76 = icmp eq ptr %75, null
  br i1 %76, label %.loopexit, label %77

.loopexit:                                        ; preds = %.lr.ph, %38, %._crit_edge145, %.lr.ph144, %._crit_edge.thread, %7, %11, %31, %34, %70, %74
  %.088.ph = phi ptr [ %14, %74 ], [ %14, %70 ], [ %14, %34 ], [ %14, %31 ], [ null, %11 ], [ null, %7 ], [ %14, %._crit_edge.thread ], [ %14, %.lr.ph144 ], [ %14, %._crit_edge145 ], [ %14, %38 ], [ %14, %.lr.ph ]
  %.087.ph = phi ptr [ %33, %74 ], [ %33, %70 ], [ %33, %34 ], [ null, %31 ], [ null, %11 ], [ null, %7 ], [ null, %._crit_edge.thread ], [ %33, %.lr.ph144 ], [ %33, %._crit_edge145 ], [ %33, %38 ], [ null, %.lr.ph ]
  %.086.ph = phi ptr [ %35, %74 ], [ %35, %70 ], [ null, %34 ], [ null, %31 ], [ null, %11 ], [ null, %7 ], [ null, %._crit_edge.thread ], [ %35, %.lr.ph144 ], [ %35, %._crit_edge145 ], [ %35, %38 ], [ null, %.lr.ph ]
  %.082.ph = phi i32 [ 4, %74 ], [ 4, %70 ], [ 4, %34 ], [ 4, %31 ], [ 4, %11 ], [ 3, %7 ], [ 3, %._crit_edge.thread ], [ %47, %.lr.ph144 ], [ %39, %38 ], [ %.lcssa130, %._crit_edge145 ], [ %21, %.lr.ph ]
  call void @free(ptr noundef %.087.ph) #7
  call void @free(ptr noundef %.086.ph) #7
  br label %77

77:                                               ; preds = %74, %69, %.loopexit
  %.082124 = phi i32 [ %.082.ph, %.loopexit ], [ 0, %69 ], [ 0, %74 ]
  %.088120 = phi ptr [ %.088.ph, %.loopexit ], [ %14, %69 ], [ %14, %74 ]
  call void @free(ptr noundef %.088120) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  ret i32 %.082124
}

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #6

attributes #0 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind willreturn memory(argmem: read) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { nounwind allocsize(1) }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 40}
!12 = !{!"rl_btree", !6, i64 0, !10, i64 8, !10, i64 16, !6, i64 24, !10, i64 32, !10, i64 40}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}


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