; LLVM IR from Water-Melon/Melon :: t (rbtree)

; 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.rbtree_s = type { ptr, ptr, ptr, ptr, ptr, %struct.mln_rbtree_node_s, ptr, ptr, ptr, ptr, ptr, i64, i8 }
%struct.mln_rbtree_node_s = type { ptr, ptr, ptr, ptr, ptr, ptr, i32 }

@.str = external hidden unnamed_addr constant [35 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [62 x i8], align 1
@__PRETTY_FUNCTION__.test1 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @test1() #0 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #5
  store i32 10, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %12 = call ptr @mln_rbtree_new(ptr noundef null)
  store ptr %12, ptr %2, align 8, !tbaa !9
  %13 = icmp ne ptr %12, null
  br i1 %13, label %14, label %15

14:                                               ; preds = %0
  br label %16

15:                                               ; preds = %0
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 17, ptr noundef @__PRETTY_FUNCTION__.test1) #6
  unreachable

16:                                               ; preds = %14
  %17 = load ptr, ptr %2, align 8, !tbaa !9
  %18 = call ptr @mln_rbtree_node_new(ptr noundef %17, ptr noundef %1)
  store ptr %18, ptr %3, align 8, !tbaa !9
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %16
  br label %22

21:                                               ; preds = %16
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 18, ptr noundef @__PRETTY_FUNCTION__.test1) #6
  unreachable

22:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %23 = load ptr, ptr %2, align 8, !tbaa !9
  store ptr %23, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %24 = load ptr, ptr %4, align 8, !tbaa !9
  %25 = getelementptr inbounds %struct.rbtree_s, ptr %24, i32 0, i32 5
  store ptr %25, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %26 = load ptr, ptr %4, align 8, !tbaa !9
  %27 = getelementptr inbounds %struct.rbtree_s, ptr %26, i32 0, i32 6
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  store ptr %28, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %29 = load ptr, ptr %4, align 8, !tbaa !9
  %30 = getelementptr inbounds %struct.rbtree_s, ptr %29, i32 0, i32 5
  store ptr %30, ptr %7, align 8, !tbaa !9
  br label %31

31:                                               ; preds = %53, %22
  %32 = load ptr, ptr %6, align 8, !tbaa !9
  %33 = load ptr, ptr %7, align 8, !tbaa !9
  %34 = icmp ne ptr %32, %33
  br i1 %34, label %35, label %54

35:                                               ; preds = %31
  %36 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %36, ptr %5, align 8, !tbaa !9
  %37 = load ptr, ptr %3, align 8, !tbaa !9
  %38 = getelementptr inbounds %struct.mln_rbtree_node_s, ptr %37, i32 0, i32 0
  %39 = load ptr, ptr %38, align 8, !tbaa !15
  %40 = load ptr, ptr %6, align 8, !tbaa !9
  %41 = getelementptr inbounds %struct.mln_rbtree_node_s, ptr %40, i32 0, i32 0
  %42 = load ptr, ptr %41, align 8, !tbaa !15
  %43 = call i32 @cmp_handler(ptr noundef %39, ptr noundef %42)
  %44 = icmp slt i32 %43, 0
  br i1 %44, label %45, label %49

45:                                               ; preds = %35
  %46 = load ptr, ptr %6, align 8, !tbaa !9
  %47 = getelementptr inbounds %struct.mln_rbtree_node_s, ptr %46, i32 0, i32 4
  %48 = load ptr, ptr %47, align 8, !tbaa !16
  store ptr %48, ptr %6, align 8, !tbaa !9
  br label %53

49:                                               ; preds = %35
  %50 = load ptr, ptr %6, align 8, !tbaa !9
  %51 = getelementptr inbounds %struct.mln_rbtree_node_s, ptr %50, i32 0, i32 5
  %52 = load ptr, ptr %51, align 8, !tbaa !17
  store ptr %52, ptr %6, align 8, !tbaa !9
  br label %53

53:                                               ; preds = %49, %45
  br label %31, !llvm.loop !18

54:                                               ; preds = %31
  %55 = load ptr, ptr %5, align 8, !tbaa !9
  %56 = load ptr, ptr %3, align 8, !tbaa !9
  %57 = getelementptr inbounds %struct.mln_rbtree_node_s, ptr %56, i32 0, i32 3
  store ptr %55, ptr %57, align 8, !tbaa !20
  %58 = load ptr, ptr %5, align 8, !tbaa !9
  %59 = load ptr, ptr %7, align 8, !tbaa !9
  %60 = icmp eq ptr %58, %59
  br i1 %60, label %61, label %65

61:                                               ; preds = %54
  %62 = load ptr, ptr %3, align 8, !tbaa !9
  %63 = load ptr, ptr %4, align 8, !tbaa !9
  %64 = getelementptr inbounds %struct.rbtree_s, ptr %63, i32 0, i32 6
  store ptr %62, ptr %64, align 8, !tbaa !11
  br label %83

65:                                               ; preds = %54
  %66 = load ptr, ptr %3, align 8, !tbaa !9
  %67 = getelementptr inbounds %struct.mln_rbtree_node_s, ptr %66, i32 0, i32 0
  %68 = load ptr, ptr %67, align 8, !tbaa !15
  %69 = load ptr, ptr %5, align 8, !tbaa !9
  %70 = getelementptr inbounds %struct.mln_rbtree_node_s, ptr %69, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8, !tbaa !15
  %72 = call i32 @cmp_handler(ptr noundef %68, ptr noundef %71)
  %73 = icmp slt i32 %72, 0
  br i1 %73, label %74, label %78

74:                                               ; preds = %65
  %75 = load ptr, ptr %3, align 8, !tbaa !9
  %76 = load ptr, ptr %5, align 8, !tbaa !9
  %77 = getelementptr inbounds %struct.mln_rbtree_node_s, ptr %76, i32 0, i32 4
  store ptr %75, ptr %77, align 8, !tbaa !16
  br label %82

78:                                               ; preds = %65
  %79 = load ptr, ptr %3, align 8, !tbaa !9
  %80 = load ptr, ptr %5, align 8, !tbaa !9
  %81 = getelementptr inbounds %struct.mln_rbtree_node_s, ptr %80, i32 0, i32 5
  store ptr %79, ptr %81, align 8, !tbaa !17
  br label %82

82:                                               ; preds = %78, %74
  br label %83

83:                                               ; preds = %82, %61
  %84 = load ptr, ptr %7, align 8, !tbaa !9
  %85 = load ptr, ptr %3, align 8, !tbaa !9
  %86 = getelementptr inbounds %struct.mln_rbtree_node_s, ptr %85, i32 0, i32 5
  store ptr %84, ptr %86, align 8, !tbaa !17
  %87 = load ptr, ptr %3, align 8, !tbaa !9
  %88 = getelementptr inbounds %struct.mln_rbtree_node_s, ptr %87, i32 0, i32 4
  store ptr %84, ptr %88, align 8, !tbaa !16
  %89 = load ptr, ptr %3, align 8, !tbaa !9
  %90 = getelementptr inbounds %struct.mln_rbtree_node_s, ptr %89, i32 0, i32 6
  %91 = load i32, ptr %90, align 8
  %92 = and i32 %91, 1
  %93 = or i32 %92, 0
  store i32 %93, ptr %90, align 8
  %94 = load ptr, ptr %4, align 8, !tbaa !9
  %95 = load ptr, ptr %3, align 8, !tbaa !9
  call void @rbtree_insert_fixup(ptr noundef %94, ptr noundef %95)
  %96 = load ptr, ptr %4, align 8, !tbaa !9
  %97 = getelementptr inbounds %struct.rbtree_s, ptr %96, i32 0, i32 7
  %98 = load ptr, ptr %97, align 8, !tbaa !21
  %99 = load ptr, ptr %7, align 8, !tbaa !9
  %100 = icmp eq ptr %98, %99
  br i1 %100, label %101, label %105

101:                                              ; preds = %83
  %102 = load ptr, ptr %3, align 8, !tbaa !9
  %103 = load ptr, ptr %4, align 8, !tbaa !9
  %104 = getelementptr inbounds %struct.rbtree_s, ptr %103, i32 0, i32 7
  store ptr %102, ptr %104, align 8, !tbaa !21
  br label %121

105:                                              ; preds = %83
  %106 = load ptr, ptr %3, align 8, !tbaa !9
  %107 = getelementptr inbounds %struct.mln_rbtree_node_s, ptr %106, i32 0, i32 0
  %108 = load ptr, ptr %107, align 8, !tbaa !15
  %109 = load ptr, ptr %4, align 8, !tbaa !9
  %110 = getelementptr inbounds %struct.rbtree_s, ptr %109, i32 0, i32 7
  %111 = load ptr, ptr %110, align 8, !tbaa !21
  %112 = getelementptr inbounds %struct.mln_rbtree_node_s, ptr %111, i32 0, i32 0
  %113 = load ptr, ptr %112, align 8, !tbaa !15
  %114 = call i32 @cmp_handler(ptr noundef %108, ptr noundef %113)
  %115 = icmp slt i32 %114, 0
  br i1 %115, label %116, label %120

116:                                              ; preds = %105
  %117 = load ptr, ptr %3, align 8, !tbaa !9
  %118 = load ptr, ptr %4, align 8, !tbaa !9
  %119 = getelementptr inbounds %struct.rbtree_s, ptr %118, i32 0, i32 7
  store ptr %117, ptr %119, align 8, !tbaa !21
  br label %120

120:                                              ; preds = %116, %105
  br label %121

121:                                              ; preds = %120, %101
  %122 = load ptr, ptr %4, align 8, !tbaa !9
  %123 = getelementptr inbounds %struct.rbtree_s, ptr %122, i32 0, i32 11
  %124 = load i64, ptr %123, align 8, !tbaa !22
  %125 = add i64 %124, 1
  store i64 %125, ptr %123, align 8, !tbaa !22
  %126 = load ptr, ptr %4, align 8, !tbaa !9
  %127 = getelementptr inbounds %struct.rbtree_s, ptr %126, i32 0, i32 8
  %128 = load ptr, ptr %4, align 8, !tbaa !9
  %129 = getelementptr inbounds %struct.rbtree_s, ptr %128, i32 0, i32 9
  %130 = load ptr, ptr %3, align 8, !tbaa !9
  call void @mln_rbtree_chain_add(ptr noundef %127, ptr noundef %129, ptr noundef %130)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %131 = load ptr, ptr %2, align 8, !tbaa !9
  store ptr %131, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %132 = load ptr, ptr %8, align 8, !tbaa !9
  %133 = getelementptr inbounds %struct.rbtree_s, ptr %132, i32 0, i32 6
  %134 = load ptr, ptr %133, align 8, !tbaa !11
  store ptr %134, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  br label %135

135:                                              ; preds = %159, %121
  %136 = load ptr, ptr %9, align 8, !tbaa !9
  %137 = load ptr, ptr %8, align 8, !tbaa !9
  %138 = getelementptr inbounds %struct.rbtree_s, ptr %137, i32 0, i32 5
  %139 = icmp ne ptr %136, %138
  br i1 %139, label %140, label %146

140:                                              ; preds = %135
  %141 = load ptr, ptr %9, align 8, !tbaa !9
  %142 = getelementptr inbounds %struct.mln_rbtree_node_s, ptr %141, i32 0, i32 0
  %143 = load ptr, ptr %142, align 8, !tbaa !15
  %144 = call i32 @cmp_handler(ptr noundef %1, ptr noundef %143)
  store i32 %144, ptr %10, align 4, !tbaa !5
  %145 = icmp ne i32 %144, 0
  br label %146

146:                                              ; preds = %140, %135
  %147 = phi i1 [ false, %135 ], [ %145, %140 ]
  br i1 %147, label %148, label %160

148:                                              ; preds = %146
  %149 = load i32, ptr %10, align 4, !tbaa !5
  %150 = icmp slt i32 %149, 0
  br i1 %150, label %151, label %155

151:                                              ; preds = %148
  %152 = load ptr, ptr %9, align 8, !tbaa !9
  %153 = getelementptr inbounds %struct.mln_rbtree_node_s, ptr %152, i32 0, i32 4
  %154 = load ptr, ptr %153, align 8, !tbaa !16
  store ptr %154, ptr %9, align 8, !tbaa !9
  br label %159

155:                                              ; preds = %148
  %156 = load ptr, ptr %9, align 8, !tbaa !9
  %157 = getelementptr inbounds %struct.mln_rbtree_node_s, ptr %156, i32 0, i32 5
  %158 = load ptr, ptr %157, align 8, !tbaa !17
  store ptr %158, ptr %9, align 8, !tbaa !9
  br label %159

159:                                              ; preds = %155, %151
  br label %135, !llvm.loop !23

160:                                              ; preds = %146
  %161 = load ptr, ptr %9, align 8, !tbaa !9
  store ptr %161, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %162 = load ptr, ptr %11, align 8, !tbaa !9
  store ptr %162, ptr %3, align 8, !tbaa !9
  %163 = load ptr, ptr %3, align 8, !tbaa !9
  %164 = load ptr, ptr %2, align 8, !tbaa !9
  %165 = getelementptr inbounds %struct.rbtree_s, ptr %164, i32 0, i32 5
  %166 = icmp eq ptr %163, %165
  br i1 %166, label %168, label %167

167:                                              ; preds = %160
  br label %169

168:                                              ; preds = %160
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 22, ptr noundef @__PRETTY_FUNCTION__.test1) #6
  unreachable

169:                                              ; preds = %167
  %170 = load ptr, ptr %3, align 8, !tbaa !9
  %171 = getelementptr inbounds %struct.mln_rbtree_node_s, ptr %170, i32 0, i32 0
  %172 = load ptr, ptr %171, align 8, !tbaa !15
  %173 = load i32, ptr %172, align 4, !tbaa !5
  %174 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %173)
  %175 = load ptr, ptr %2, align 8, !tbaa !9
  %176 = load ptr, ptr %3, align 8, !tbaa !9
  call void @mln_rbtree_delete(ptr noundef %175, ptr noundef %176)
  %177 = load ptr, ptr %2, align 8, !tbaa !9
  %178 = load ptr, ptr %3, align 8, !tbaa !9
  call void @mln_rbtree_node_free(ptr noundef %177, ptr noundef %178)
  %179 = load ptr, ptr %2, align 8, !tbaa !9
  call void @mln_rbtree_free(ptr noundef %179)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  ret i32 0
}

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

declare ptr @mln_rbtree_new(ptr noundef) #2

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

declare ptr @mln_rbtree_node_new(ptr noundef, ptr noundef) #2

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @rbtree_insert_fixup(ptr noundef, ptr noundef) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @mln_rbtree_chain_add(ptr noundef, ptr noundef, ptr noundef) #4

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

declare i32 @printf(ptr noundef, ...) #2

declare void @mln_rbtree_delete(ptr noundef, ptr noundef) #2

declare void @mln_rbtree_node_free(ptr noundef, ptr noundef) #2

declare void @mln_rbtree_free(ptr noundef) #2

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 = { "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 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 96}
!12 = !{!"rbtree_s", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !13, i64 40, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !14, i64 136, !6, i64 144}
!13 = !{!"mln_rbtree_node_s", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !6, i64 48, !6, i64 48}
!14 = !{!"long", !7, i64 0}
!15 = !{!13, !10, i64 0}
!16 = !{!13, !10, i64 32}
!17 = !{!13, !10, i64 40}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!13, !10, i64 24}
!21 = !{!12, !10, i64 104}
!22 = !{!12, !14, i64 136}
!23 = distinct !{!23, !19}


; 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 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [62 x i8], align 1
@__PRETTY_FUNCTION__.test1 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @test1() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 10, ptr %1, align 4, !tbaa !5
  %2 = tail call ptr @mln_rbtree_new(ptr noundef null) #6
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %3, label %4

3:                                                ; preds = %0
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 17, ptr noundef nonnull @__PRETTY_FUNCTION__.test1) #7
  unreachable

4:                                                ; preds = %0
  %5 = call ptr @mln_rbtree_node_new(ptr noundef nonnull %2, ptr noundef nonnull %1) #6
  %.not67 = icmp eq ptr %5, null
  br i1 %.not67, label %6, label %7

6:                                                ; preds = %4
  call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 18, ptr noundef nonnull @__PRETTY_FUNCTION__.test1) #7
  unreachable

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %2, i64 40
  %9 = getelementptr inbounds i8, ptr %2, i64 96
  %.06072 = load ptr, ptr %9, align 8, !tbaa !9
  %.not6873 = icmp eq ptr %.06072, %8
  br i1 %.not6873, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %7
  %10 = getelementptr inbounds i8, ptr %5, i64 24
  store ptr %8, ptr %10, align 8, !tbaa !11
  br label %26

.lr.ph:                                           ; preds = %7, %.lr.ph
  %.06074 = phi ptr [ %.060, %.lr.ph ], [ %.06072, %7 ]
  %11 = load ptr, ptr %5, align 8, !tbaa !13
  %12 = load ptr, ptr %.06074, align 8, !tbaa !13
  %13 = call i32 @cmp_handler(ptr noundef %11, ptr noundef %12)
  %14 = icmp slt i32 %13, 0
  %.161.in.v = select i1 %14, i64 32, i64 40
  %.161.in = getelementptr inbounds i8, ptr %.06074, i64 %.161.in.v
  %.060 = load ptr, ptr %.161.in, align 8, !tbaa !9
  %.not68 = icmp eq ptr %.060, %8
  br i1 %.not68, label %._crit_edge, label %.lr.ph, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph
  %15 = getelementptr inbounds i8, ptr %5, i64 24
  store ptr %.06074, ptr %15, align 8, !tbaa !11
  %16 = icmp eq ptr %.06074, %8
  br i1 %16, label %26, label %17

17:                                               ; preds = %._crit_edge
  %18 = load ptr, ptr %5, align 8, !tbaa !13
  %19 = load ptr, ptr %.06074, align 8, !tbaa !13
  %20 = call i32 @cmp_handler(ptr noundef %18, ptr noundef %19)
  %21 = icmp slt i32 %20, 0
  br i1 %21, label %22, label %24

22:                                               ; preds = %17
  %23 = getelementptr inbounds i8, ptr %.06074, i64 32
  br label %26

24:                                               ; preds = %17
  %25 = getelementptr inbounds i8, ptr %.06074, i64 40
  br label %26

26:                                               ; preds = %._crit_edge, %._crit_edge.thread, %22, %24
  %.sink = phi ptr [ %23, %22 ], [ %25, %24 ], [ %9, %._crit_edge.thread ], [ %9, %._crit_edge ]
  store ptr %5, ptr %.sink, align 8, !tbaa !9
  %27 = getelementptr inbounds i8, ptr %5, i64 40
  store ptr %8, ptr %27, align 8, !tbaa !16
  %28 = getelementptr inbounds i8, ptr %5, i64 32
  store ptr %8, ptr %28, align 8, !tbaa !17
  %29 = getelementptr inbounds i8, ptr %5, i64 48
  %30 = load i32, ptr %29, align 8
  %31 = and i32 %30, 1
  store i32 %31, ptr %29, align 8
  call void @rbtree_insert_fixup(ptr noundef nonnull %2, ptr noundef nonnull %5)
  %32 = getelementptr inbounds i8, ptr %2, i64 104
  %33 = load ptr, ptr %32, align 8, !tbaa !18
  %34 = icmp eq ptr %33, %8
  br i1 %34, label %.sink.split, label %35

35:                                               ; preds = %26
  %36 = load ptr, ptr %5, align 8, !tbaa !13
  %37 = load ptr, ptr %33, align 8, !tbaa !13
  %38 = call i32 @cmp_handler(ptr noundef %36, ptr noundef %37)
  %39 = icmp slt i32 %38, 0
  br i1 %39, label %.sink.split, label %40

.sink.split:                                      ; preds = %35, %26
  store ptr %5, ptr %32, align 8, !tbaa !18
  br label %40

40:                                               ; preds = %.sink.split, %35
  %41 = getelementptr inbounds i8, ptr %2, i64 136
  %42 = load i64, ptr %41, align 8, !tbaa !21
  %43 = add i64 %42, 1
  store i64 %43, ptr %41, align 8, !tbaa !21
  %44 = getelementptr inbounds i8, ptr %2, i64 112
  %45 = getelementptr inbounds i8, ptr %2, i64 120
  call void @mln_rbtree_chain_add(ptr noundef nonnull %44, ptr noundef nonnull %45, ptr noundef nonnull %5)
  %.05975 = load ptr, ptr %9, align 8, !tbaa !9
  %.not6976 = icmp eq ptr %.05975, %8
  br i1 %.not6976, label %._crit_edge80, label %.lr.ph79

.lr.ph79:                                         ; preds = %40, %48
  %.05977 = phi ptr [ %.059, %48 ], [ %.05975, %40 ]
  %46 = load ptr, ptr %.05977, align 8, !tbaa !13
  %47 = call i32 @cmp_handler(ptr noundef nonnull %1, ptr noundef %46)
  %.not70 = icmp eq i32 %47, 0
  br i1 %.not70, label %.critedge, label %48

48:                                               ; preds = %.lr.ph79
  %49 = icmp slt i32 %47, 0
  %.1.in.v = select i1 %49, i64 32, i64 40
  %.1.in = getelementptr inbounds i8, ptr %.05977, i64 %.1.in.v
  %.059 = load ptr, ptr %.1.in, align 8, !tbaa !9
  %.not69 = icmp eq ptr %.059, %8
  br i1 %.not69, label %._crit_edge80, label %.lr.ph79, !llvm.loop !22

._crit_edge80:                                    ; preds = %48, %40
  call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 22, ptr noundef nonnull @__PRETTY_FUNCTION__.test1) #7
  unreachable

.critedge:                                        ; preds = %.lr.ph79
  %50 = load ptr, ptr %.05977, align 8, !tbaa !13
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %51)
  call void @mln_rbtree_delete(ptr noundef nonnull %2, ptr noundef nonnull %.05977) #6
  call void @mln_rbtree_node_free(ptr noundef nonnull %2, ptr noundef nonnull %.05977) #6
  call void @mln_rbtree_free(ptr noundef nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0
}

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

declare ptr @mln_rbtree_new(ptr 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

declare ptr @mln_rbtree_node_new(ptr noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @rbtree_insert_fixup(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @mln_rbtree_chain_add(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

declare void @mln_rbtree_delete(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @mln_rbtree_node_free(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @mln_rbtree_free(ptr noundef) local_unnamed_addr #2

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 = { "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 = { 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 #5 = { nofree 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 24}
!12 = !{!"mln_rbtree_node_s", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !6, i64 48, !6, i64 48}
!13 = !{!12, !10, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!12, !10, i64 40}
!17 = !{!12, !10, i64 32}
!18 = !{!19, !10, i64 104}
!19 = !{!"rbtree_s", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !12, i64 40, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !20, i64 136, !6, i64 144}
!20 = !{!"long", !7, i64 0}
!21 = !{!19, !20, i64 136}
!22 = distinct !{!22, !15}


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