; 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

declare i32 @rl_btree_find_score(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_sdiff(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 ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  %25 = alloca i64, align 8
  %26 = alloca i64, align 8
  %27 = 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) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  store ptr null, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  store ptr null, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  store ptr null, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  store ptr null, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #6
  store i64 0, ptr %25, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #6
  store i64 0, ptr %26, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #6
  %28 = load i32, ptr %9, align 4, !tbaa !9
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %30, label %31

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

31:                                               ; preds = %7
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  %34 = getelementptr inbounds ptr, ptr %33, i64 0
  %35 = load ptr, ptr %34, align 8, !tbaa !5
  %36 = load ptr, ptr %11, align 8, !tbaa !5
  %37 = getelementptr inbounds i64, ptr %36, i64 0
  %38 = load i64, ptr %37, align 8, !tbaa !11
  %39 = call i32 @rl_set_get_objects(ptr noundef %32, ptr noundef %35, i64 noundef %38, ptr noundef null, ptr noundef %17, i32 noundef 0, i32 noundef 0)
  store i32 %39, ptr %15, align 4, !tbaa !9
  %40 = load i32, ptr %15, align 4, !tbaa !9
  %41 = icmp ne i32 0, %40
  br i1 %41, label %42, label %43

42:                                               ; preds = %31
  br label %202

43:                                               ; preds = %31
  %44 = load ptr, ptr %17, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.rl_btree, ptr %44, i32 0, i32 5
  %46 = load i64, ptr %45, align 8, !tbaa !13
  %47 = mul i64 8, %46
  %48 = call noalias ptr @malloc(i64 noundef %47) #7
  store ptr %48, ptr %20, align 8, !tbaa !5
  %49 = load ptr, ptr %20, align 8, !tbaa !5
  %50 = icmp ne ptr %49, null
  br i1 %50, label %52, label %51

51:                                               ; preds = %43
  store i32 4, ptr %15, align 4, !tbaa !9
  br label %202

52:                                               ; preds = %43
  %53 = load ptr, ptr %17, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.rl_btree, ptr %53, i32 0, i32 5
  %55 = load i64, ptr %54, align 8, !tbaa !13
  %56 = mul i64 8, %55
  %57 = call noalias ptr @malloc(i64 noundef %56) #7
  store ptr %57, ptr %22, align 8, !tbaa !5
  %58 = load ptr, ptr %22, align 8, !tbaa !5
  %59 = icmp ne ptr %58, null
  br i1 %59, label %61, label %60

60:                                               ; preds = %52
  store i32 4, ptr %15, align 4, !tbaa !9
  br label %202

61:                                               ; preds = %52
  %62 = load i32, ptr %9, align 4, !tbaa !9
  %63 = sub nsw i32 %62, 1
  %64 = sext i32 %63 to i64
  %65 = mul i64 8, %64
  %66 = call noalias ptr @malloc(i64 noundef %65) #7
  store ptr %66, ptr %18, align 8, !tbaa !5
  %67 = load ptr, ptr %18, align 8, !tbaa !5
  %68 = icmp ne ptr %67, null
  br i1 %68, label %70, label %69

69:                                               ; preds = %61
  store i32 4, ptr %15, align 4, !tbaa !9
  br label %202

70:                                               ; preds = %61
  store i64 1, ptr %23, align 8, !tbaa !11
  br label %71

71:                                               ; preds = %101, %70
  %72 = load i64, ptr %23, align 8, !tbaa !11
  %73 = load i32, ptr %9, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = icmp slt i64 %72, %74
  br i1 %75, label %76, label %104

76:                                               ; preds = %71
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = load ptr, ptr %10, align 8, !tbaa !5
  %79 = load i64, ptr %23, align 8, !tbaa !11
  %80 = getelementptr inbounds ptr, ptr %78, i64 %79
  %81 = load ptr, ptr %80, align 8, !tbaa !5
  %82 = load ptr, ptr %11, align 8, !tbaa !5
  %83 = load i64, ptr %23, align 8, !tbaa !11
  %84 = getelementptr inbounds i64, ptr %82, i64 %83
  %85 = load i64, ptr %84, align 8, !tbaa !11
  %86 = load ptr, ptr %18, align 8, !tbaa !5
  %87 = load i64, ptr %25, align 8, !tbaa !11
  %88 = getelementptr inbounds ptr, ptr %86, i64 %87
  %89 = call i32 @rl_set_get_objects(ptr noundef %77, ptr noundef %81, i64 noundef %85, ptr noundef null, ptr noundef %88, i32 noundef 0, i32 noundef 0)
  store i32 %89, ptr %15, align 4, !tbaa !9
  %90 = load i32, ptr %15, align 4, !tbaa !9
  %91 = icmp eq i32 %90, 0
  br i1 %91, label %92, label %95

92:                                               ; preds = %76
  %93 = load i64, ptr %25, align 8, !tbaa !11
  %94 = add nsw i64 %93, 1
  store i64 %94, ptr %25, align 8, !tbaa !11
  br label %100

95:                                               ; preds = %76
  %96 = load i32, ptr %15, align 4, !tbaa !9
  %97 = icmp ne i32 %96, 3
  br i1 %97, label %98, label %99

98:                                               ; preds = %95
  br label %202

99:                                               ; preds = %95
  br label %100

100:                                              ; preds = %99, %92
  br label %101

101:                                              ; preds = %100
  %102 = load i64, ptr %23, align 8, !tbaa !11
  %103 = add nsw i64 %102, 1
  store i64 %103, ptr %23, align 8, !tbaa !11
  br label %71, !llvm.loop !15

104:                                              ; preds = %71
  %105 = load ptr, ptr %8, align 8, !tbaa !5
  %106 = load ptr, ptr %17, align 8, !tbaa !5
  %107 = call i32 @rl_btree_iterator_create(ptr noundef %105, ptr noundef %106, ptr noundef %19)
  store i32 %107, ptr %15, align 4, !tbaa !9
  %108 = load i32, ptr %15, align 4, !tbaa !9
  %109 = icmp ne i32 0, %108
  br i1 %109, label %110, label %111

110:                                              ; preds = %104
  br label %202

111:                                              ; preds = %104
  br label %112

112:                                              ; preds = %157, %111
  %113 = load ptr, ptr %19, align 8, !tbaa !5
  %114 = call i32 @rl_btree_iterator_next(ptr noundef %113, ptr noundef %21, ptr noundef %27)
  store i32 %114, ptr %15, align 4, !tbaa !9
  %115 = icmp eq i32 %114, 0
  br i1 %115, label %116, label %160

116:                                              ; preds = %112
  store i32 0, ptr %16, align 4, !tbaa !9
  store i64 0, ptr %23, align 8, !tbaa !11
  br label %117

117:                                              ; preds = %133, %116
  %118 = load i64, ptr %23, align 8, !tbaa !11
  %119 = load i64, ptr %25, align 8, !tbaa !11
  %120 = icmp slt i64 %118, %119
  br i1 %120, label %121, label %136

121:                                              ; preds = %117
  %122 = load ptr, ptr %8, align 8, !tbaa !5
  %123 = load ptr, ptr %18, align 8, !tbaa !5
  %124 = load i64, ptr %23, align 8, !tbaa !11
  %125 = getelementptr inbounds ptr, ptr %123, i64 %124
  %126 = load ptr, ptr %125, align 8, !tbaa !5
  %127 = load ptr, ptr %21, align 8, !tbaa !5
  %128 = call i32 @rl_btree_find_score(ptr noundef %122, ptr noundef %126, ptr noundef %127, ptr noundef null, ptr noundef null, ptr noundef null)
  store i32 %128, ptr %15, align 4, !tbaa !9
  %129 = load i32, ptr %15, align 4, !tbaa !9
  %130 = icmp eq i32 %129, 2
  br i1 %130, label %131, label %132

131:                                              ; preds = %121
  store i32 1, ptr %16, align 4, !tbaa !9
  br label %136

132:                                              ; preds = %121
  br label %133

133:                                              ; preds = %132
  %134 = load i64, ptr %23, align 8, !tbaa !11
  %135 = add nsw i64 %134, 1
  store i64 %135, ptr %23, align 8, !tbaa !11
  br label %117, !llvm.loop !17

136:                                              ; preds = %131, %117
  %137 = load i32, ptr %16, align 4, !tbaa !9
  %138 = icmp ne i32 %137, 0
  br i1 %138, label %157, label %139

139:                                              ; preds = %136
  %140 = load ptr, ptr %27, align 8, !tbaa !5
  %141 = load i64, ptr %140, align 8, !tbaa !11
  store i64 %141, ptr %24, align 8, !tbaa !11
  %142 = load ptr, ptr %8, align 8, !tbaa !5
  %143 = load i64, ptr %24, align 8, !tbaa !11
  %144 = load ptr, ptr %20, align 8, !tbaa !5
  %145 = load i64, ptr %26, align 8, !tbaa !11
  %146 = getelementptr inbounds ptr, ptr %144, i64 %145
  %147 = load ptr, ptr %22, align 8, !tbaa !5
  %148 = load i64, ptr %26, align 8, !tbaa !11
  %149 = getelementptr inbounds i64, ptr %147, i64 %148
  %150 = call i32 @rl_multi_string_get(ptr noundef %142, i64 noundef %143, ptr noundef %146, ptr noundef %149)
  store i32 %150, ptr %15, align 4, !tbaa !9
  %151 = load i32, ptr %15, align 4, !tbaa !9
  %152 = icmp ne i32 0, %151
  br i1 %152, label %153, label %154

153:                                              ; preds = %139
  br label %202

154:                                              ; preds = %139
  %155 = load i64, ptr %26, align 8, !tbaa !11
  %156 = add nsw i64 %155, 1
  store i64 %156, ptr %26, align 8, !tbaa !11
  br label %157

157:                                              ; preds = %154, %136
  %158 = load ptr, ptr %21, align 8, !tbaa !5
  call void @free(ptr noundef %158) #6
  %159 = load ptr, ptr %27, align 8, !tbaa !5
  call void @free(ptr noundef %159) #6
  br label %112, !llvm.loop !18

160:                                              ; preds = %112
  store ptr null, ptr %19, align 8, !tbaa !5
  %161 = load i32, ptr %15, align 4, !tbaa !9
  %162 = icmp ne i32 %161, 9
  br i1 %162, label %163, label %164

163:                                              ; preds = %160
  br label %202

164:                                              ; preds = %160
  %165 = load i64, ptr %26, align 8, !tbaa !11
  %166 = icmp eq i64 %165, 0
  br i1 %166, label %167, label %168

167:                                              ; preds = %164
  store i32 3, ptr %15, align 4, !tbaa !9
  br label %202

168:                                              ; preds = %164
  %169 = load i64, ptr %26, align 8, !tbaa !11
  %170 = load ptr, ptr %17, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.rl_btree, ptr %170, i32 0, i32 5
  %172 = load i64, ptr %171, align 8, !tbaa !13
  %173 = icmp eq i64 %169, %172
  br i1 %173, label %174, label %179

174:                                              ; preds = %168
  %175 = load ptr, ptr %20, align 8, !tbaa !5
  %176 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %175, ptr %176, align 8, !tbaa !5
  %177 = load ptr, ptr %22, align 8, !tbaa !5
  %178 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %177, ptr %178, align 8, !tbaa !5
  br label %200

179:                                              ; preds = %168
  %180 = load ptr, ptr %20, align 8, !tbaa !5
  %181 = load i64, ptr %26, align 8, !tbaa !11
  %182 = mul i64 8, %181
  %183 = call ptr @realloc(ptr noundef %180, i64 noundef %182) #8
  %184 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %183, ptr %184, align 8, !tbaa !5
  %185 = load ptr, ptr %13, align 8, !tbaa !5
  %186 = load ptr, ptr %185, align 8, !tbaa !5
  %187 = icmp eq ptr %186, null
  br i1 %187, label %188, label %189

188:                                              ; preds = %179
  store i32 4, ptr %15, align 4, !tbaa !9
  br label %202

189:                                              ; preds = %179
  %190 = load ptr, ptr %22, align 8, !tbaa !5
  %191 = load i64, ptr %26, align 8, !tbaa !11
  %192 = mul i64 8, %191
  %193 = call ptr @realloc(ptr noundef %190, i64 noundef %192) #8
  %194 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %193, ptr %194, align 8, !tbaa !5
  %195 = load ptr, ptr %14, align 8, !tbaa !5
  %196 = load ptr, ptr %195, align 8, !tbaa !5
  %197 = icmp eq ptr %196, null
  br i1 %197, label %198, label %199

198:                                              ; preds = %189
  store i32 4, ptr %15, align 4, !tbaa !9
  br label %202

199:                                              ; preds = %189
  br label %200

200:                                              ; preds = %199, %174
  br label %201

201:                                              ; preds = %200
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %202

202:                                              ; preds = %201, %198, %188, %167, %163, %153, %110, %98, %69, %60, %51, %42, %30
  %203 = load i64, ptr %26, align 8, !tbaa !11
  %204 = load ptr, ptr %12, align 8, !tbaa !5
  store i64 %203, ptr %204, align 8, !tbaa !11
  %205 = load i32, ptr %15, align 4, !tbaa !9
  %206 = icmp ne i32 %205, 0
  br i1 %206, label %207, label %210

207:                                              ; preds = %202
  %208 = load ptr, ptr %20, align 8, !tbaa !5
  call void @free(ptr noundef %208) #6
  %209 = load ptr, ptr %22, align 8, !tbaa !5
  call void @free(ptr noundef %209) #6
  br label %210

210:                                              ; preds = %207, %202
  %211 = load ptr, ptr %18, align 8, !tbaa !5
  call void @free(ptr noundef %211) #6
  %212 = load i32, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  ret i32 %212
}

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

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind 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 }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { 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}


; 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

declare i32 @rl_btree_find_score(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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

declare i32 @rl_btree_iterator_next(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_sdiff(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
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  store ptr null, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #6
  %12 = icmp eq i32 %1, 0
  br i1 %12, label %.thread, label %13

13:                                               ; preds = %7
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = load i64, ptr %3, align 8, !tbaa !9
  %16 = call i32 @rl_set_get_objects(ptr noundef %0, ptr noundef %14, i64 noundef %15, ptr noundef null, ptr noundef nonnull %8, i32 noundef 0, i32 noundef 0)
  %.not = icmp eq i32 %16, 0
  br i1 %.not, label %17, label %.thread

17:                                               ; preds = %13
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %18, i64 40
  %20 = load i64, ptr %19, align 8, !tbaa !11
  %21 = shl i64 %20, 3
  %22 = call noalias ptr @malloc(i64 noundef %21) #7
  %.not82 = icmp eq ptr %22, null
  br i1 %.not82, label %.thread, label %23

23:                                               ; preds = %17
  %24 = call noalias ptr @malloc(i64 noundef %21) #7
  %.not83 = icmp eq ptr %24, null
  br i1 %.not83, label %.thread, label %25

25:                                               ; preds = %23
  %26 = add nsw i32 %1, -1
  %27 = sext i32 %26 to i64
  %28 = shl nsw i64 %27, 3
  %29 = call noalias ptr @malloc(i64 noundef %28) #7
  %.not84 = icmp eq ptr %29, null
  br i1 %.not84, label %.thread, label %.preheader112

.preheader112:                                    ; preds = %25
  %30 = sext i32 %1 to i64
  %31 = icmp sgt i32 %1, 1
  br i1 %31, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader112, %40
  %.061120 = phi i64 [ %.162, %40 ], [ 0, %.preheader112 ]
  %.064119 = phi i64 [ %41, %40 ], [ 1, %.preheader112 ]
  %32 = getelementptr inbounds ptr, ptr %2, i64 %.064119
  %33 = load ptr, ptr %32, align 8, !tbaa !5
  %34 = getelementptr inbounds i64, ptr %3, i64 %.064119
  %35 = load i64, ptr %34, align 8, !tbaa !9
  %36 = getelementptr inbounds ptr, ptr %29, i64 %.061120
  %37 = call i32 @rl_set_get_objects(ptr noundef %0, ptr noundef %33, i64 noundef %35, ptr noundef null, ptr noundef nonnull %36, i32 noundef 0, i32 noundef 0)
  switch i32 %37, label %.thread [
    i32 0, label %38
    i32 3, label %40
  ]

38:                                               ; preds = %.lr.ph
  %39 = add nsw i64 %.061120, 1
  br label %40

40:                                               ; preds = %.lr.ph, %38
  %.162 = phi i64 [ %39, %38 ], [ %.061120, %.lr.ph ]
  %41 = add nuw nsw i64 %.064119, 1
  %exitcond.not = icmp eq i64 %41, %30
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !13

._crit_edge.loopexit:                             ; preds = %40
  %.pre = load ptr, ptr %8, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader112
  %42 = phi ptr [ %18, %.preheader112 ], [ %.pre, %._crit_edge.loopexit ]
  %.061.lcssa = phi i64 [ 0, %.preheader112 ], [ %.162, %._crit_edge.loopexit ]
  %43 = call i32 @rl_btree_iterator_create(ptr noundef %0, ptr noundef %42, ptr noundef nonnull %9) #6
  %.not85 = icmp eq i32 %43, 0
  br i1 %.not85, label %.preheader111, label %.thread

.preheader111:                                    ; preds = %._crit_edge
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = call i32 @rl_btree_iterator_next(ptr noundef %44, ptr noundef nonnull %10, ptr noundef nonnull %11) #6
  %46 = icmp eq i32 %45, 0
  br i1 %46, label %.preheader.lr.ph, label %._crit_edge125.thread

.preheader.lr.ph:                                 ; preds = %.preheader111
  %.not88121 = icmp sgt i64 %.061.lcssa, 0
  br i1 %.not88121, label %.preheader.us, label %.preheader

.preheader.us:                                    ; preds = %.preheader.lr.ph, %.loopexit.us
  %.0124.us = phi i64 [ %.1.us, %.loopexit.us ], [ 0, %.preheader.lr.ph ]
  br label %51

47:                                               ; preds = %51
  %48 = add nuw nsw i64 %.165122.us, 1
  %exitcond144.not = icmp eq i64 %48, %.061.lcssa
  br i1 %exitcond144.not, label %..critedge_crit_edge.us, label %51, !llvm.loop !15

49:                                               ; preds = %..critedge_crit_edge.us
  %50 = add nsw i64 %.0124.us, 1
  br label %.loopexit.us

51:                                               ; preds = %.preheader.us, %47
  %.165122.us = phi i64 [ 0, %.preheader.us ], [ %48, %47 ]
  %52 = getelementptr inbounds ptr, ptr %29, i64 %.165122.us
  %53 = load ptr, ptr %52, align 8, !tbaa !5
  %54 = load ptr, ptr %10, align 8, !tbaa !5
  %55 = call i32 @rl_btree_find_score(ptr noundef %0, ptr noundef %53, ptr noundef %54, ptr noundef null, ptr noundef null, ptr noundef null) #6
  %56 = icmp eq i32 %55, 2
  br i1 %56, label %.loopexit.us, label %47

.loopexit.us:                                     ; preds = %51, %49
  %.1.us = phi i64 [ %50, %49 ], [ %.0124.us, %51 ]
  %57 = load ptr, ptr %10, align 8, !tbaa !5
  call void @free(ptr noundef %57) #6
  %58 = load ptr, ptr %11, align 8, !tbaa !5
  call void @free(ptr noundef %58) #6
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = call i32 @rl_btree_iterator_next(ptr noundef %59, ptr noundef nonnull %10, ptr noundef nonnull %11) #6
  %61 = icmp eq i32 %60, 0
  br i1 %61, label %.preheader.us, label %._crit_edge125, !llvm.loop !16

..critedge_crit_edge.us:                          ; preds = %47
  %62 = load ptr, ptr %11, align 8, !tbaa !5
  %63 = load i64, ptr %62, align 8, !tbaa !9
  %64 = getelementptr inbounds ptr, ptr %22, i64 %.0124.us
  %65 = getelementptr inbounds i64, ptr %24, i64 %.0124.us
  %66 = call i32 @rl_multi_string_get(ptr noundef %0, i64 noundef %63, ptr noundef nonnull %64, ptr noundef nonnull %65) #6
  %.not89.us = icmp eq i32 %66, 0
  br i1 %.not89.us, label %49, label %.thread

.preheader:                                       ; preds = %.preheader.lr.ph, %72
  %.0124 = phi i64 [ %73, %72 ], [ 0, %.preheader.lr.ph ]
  %67 = load ptr, ptr %11, align 8, !tbaa !5
  %68 = load i64, ptr %67, align 8, !tbaa !9
  %69 = getelementptr inbounds ptr, ptr %22, i64 %.0124
  %70 = getelementptr inbounds i64, ptr %24, i64 %.0124
  %71 = call i32 @rl_multi_string_get(ptr noundef %0, i64 noundef %68, ptr noundef nonnull %69, ptr noundef nonnull %70) #6
  %.not89 = icmp eq i32 %71, 0
  br i1 %.not89, label %72, label %.thread

72:                                               ; preds = %.preheader
  %73 = add nuw nsw i64 %.0124, 1
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  call void @free(ptr noundef %74) #6
  %75 = load ptr, ptr %11, align 8, !tbaa !5
  call void @free(ptr noundef %75) #6
  %76 = load ptr, ptr %9, align 8, !tbaa !5
  %77 = call i32 @rl_btree_iterator_next(ptr noundef %76, ptr noundef nonnull %10, ptr noundef nonnull %11) #6
  %78 = icmp eq i32 %77, 0
  br i1 %78, label %.preheader, label %._crit_edge125, !llvm.loop !16

._crit_edge125:                                   ; preds = %72, %.loopexit.us
  %.0.lcssa = phi i64 [ %.1.us, %.loopexit.us ], [ %73, %72 ]
  %.lcssa = phi i32 [ %60, %.loopexit.us ], [ %77, %72 ]
  store ptr null, ptr %9, align 8, !tbaa !5
  %.not86 = icmp eq i32 %.lcssa, 9
  br i1 %.not86, label %79, label %.thread

._crit_edge125.thread:                            ; preds = %.preheader111
  store ptr null, ptr %9, align 8, !tbaa !5
  %.not86147 = icmp eq i32 %45, 9
  %spec.select = select i1 %.not86147, i32 3, i32 %45
  br label %.thread

79:                                               ; preds = %._crit_edge125
  %80 = icmp eq i64 %.0.lcssa, 0
  br i1 %80, label %.thread, label %81

81:                                               ; preds = %79
  %82 = load ptr, ptr %8, align 8, !tbaa !5
  %83 = getelementptr inbounds i8, ptr %82, i64 40
  %84 = load i64, ptr %83, align 8, !tbaa !11
  %85 = icmp eq i64 %.0.lcssa, %84
  br i1 %85, label %86, label %87

86:                                               ; preds = %81
  store ptr %22, ptr %5, align 8, !tbaa !5
  store ptr %24, ptr %6, align 8, !tbaa !5
  br label %.thread104

87:                                               ; preds = %81
  %88 = shl i64 %.0.lcssa, 3
  %89 = call ptr @realloc(ptr noundef nonnull %22, i64 noundef %88) #8
  store ptr %89, ptr %5, align 8, !tbaa !5
  %90 = icmp eq ptr %89, null
  br i1 %90, label %.thread, label %91

91:                                               ; preds = %87
  %92 = call ptr @realloc(ptr noundef nonnull %24, i64 noundef %88) #8
  store ptr %92, ptr %6, align 8, !tbaa !5
  %93 = icmp eq ptr %92, null
  br i1 %93, label %.thread, label %.thread104

.thread104:                                       ; preds = %91, %86
  store i64 %.0.lcssa, ptr %4, align 8, !tbaa !9
  br label %94

.thread:                                          ; preds = %.lr.ph, %.preheader, %..critedge_crit_edge.us, %._crit_edge125.thread, %91, %87, %79, %25, %23, %17, %7, %._crit_edge125, %._crit_edge, %13
  %storemerge = phi i64 [ %.0.lcssa, %91 ], [ %.0.lcssa, %87 ], [ 0, %79 ], [ 0, %25 ], [ 0, %23 ], [ 0, %17 ], [ 0, %7 ], [ %.0.lcssa, %._crit_edge125 ], [ 0, %._crit_edge ], [ 0, %13 ], [ 0, %._crit_edge125.thread ], [ %.0124.us, %..critedge_crit_edge.us ], [ %.0124, %.preheader ], [ 0, %.lr.ph ]
  %.063102 = phi i32 [ 4, %91 ], [ 4, %87 ], [ 3, %79 ], [ 4, %25 ], [ 4, %23 ], [ 4, %17 ], [ 3, %7 ], [ %.lcssa, %._crit_edge125 ], [ %43, %._crit_edge ], [ %16, %13 ], [ %spec.select, %._crit_edge125.thread ], [ %66, %..critedge_crit_edge.us ], [ %71, %.preheader ], [ %37, %.lr.ph ]
  %.066101 = phi ptr [ %24, %91 ], [ %24, %87 ], [ %24, %79 ], [ %24, %25 ], [ null, %23 ], [ null, %17 ], [ null, %7 ], [ %24, %._crit_edge125 ], [ %24, %._crit_edge ], [ null, %13 ], [ %24, %._crit_edge125.thread ], [ %24, %..critedge_crit_edge.us ], [ %24, %.preheader ], [ %24, %.lr.ph ]
  %.067100 = phi ptr [ %22, %91 ], [ %22, %87 ], [ %22, %79 ], [ %22, %25 ], [ %22, %23 ], [ null, %17 ], [ null, %7 ], [ %22, %._crit_edge125 ], [ %22, %._crit_edge ], [ null, %13 ], [ %22, %._crit_edge125.thread ], [ %22, %..critedge_crit_edge.us ], [ %22, %.preheader ], [ %22, %.lr.ph ]
  %.06898 = phi ptr [ %29, %91 ], [ %29, %87 ], [ %29, %79 ], [ null, %25 ], [ null, %23 ], [ null, %17 ], [ null, %7 ], [ %29, %._crit_edge125 ], [ %29, %._crit_edge ], [ null, %13 ], [ %29, %._crit_edge125.thread ], [ %29, %..critedge_crit_edge.us ], [ %29, %.preheader ], [ %29, %.lr.ph ]
  store i64 %storemerge, ptr %4, align 8, !tbaa !9
  call void @free(ptr noundef %.067100) #6
  call void @free(ptr noundef %.066101) #6
  br label %94

94:                                               ; preds = %.thread104, %.thread
  %.063103 = phi i32 [ %.063102, %.thread ], [ 0, %.thread104 ]
  %.06899 = phi ptr [ %.06898, %.thread ], [ %29, %.thread104 ]
  call void @free(ptr noundef %.06899) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  ret i32 %.063103
}

; 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

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 = { "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 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 #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 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { 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}


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