; LLVM IR from yudi-matsuzake/libgenerics :: doc/examples (rbtree0)

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

@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @print_rbt(ptr 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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @swap(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca %struct.redblacktree_t, align 8
  %3 = alloca i32, align 4
  %4 = alloca [10 x i32], align 16
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %8 = call i64 @time(ptr noundef null) #4
  %9 = trunc i64 %8 to i32
  call void @srand(i32 noundef %9) #4
  call void @llvm.lifetime.start.p0(i64 48, ptr %2) #4
  %10 = call i32 @rbtree_create(ptr noundef %2, i64 noundef 4)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr %4) #4
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %19, %0
  %12 = load i32, ptr %3, align 4, !tbaa !5
  %13 = icmp slt i32 %12, 10
  br i1 %13, label %14, label %22

14:                                               ; preds = %11
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = load i32, ptr %3, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [10 x i32], ptr %4, i64 0, i64 %17
  store i32 %15, ptr %18, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %14
  %20 = load i32, ptr %3, align 4, !tbaa !5
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr %3, align 4, !tbaa !5
  br label %11, !llvm.loop !9

22:                                               ; preds = %11
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %34, %22
  %24 = load i32, ptr %3, align 4, !tbaa !5
  %25 = icmp slt i32 %24, 10
  br i1 %25, label %26, label %37

26:                                               ; preds = %23
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [10 x i32], ptr %4, i64 0, i64 %28
  %30 = call i32 @rand() #4
  %31 = srem i32 %30, 10
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [10 x i32], ptr %4, i64 0, i64 %32
  call void @swap(ptr noundef %29, ptr noundef %33)
  br label %34

34:                                               ; preds = %26
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %3, align 4, !tbaa !5
  br label %23, !llvm.loop !11

37:                                               ; preds = %23
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %47, %37
  %39 = load i32, ptr %3, align 4, !tbaa !5
  %40 = icmp slt i32 %39, 10
  br i1 %40, label %41, label %50

41:                                               ; preds = %38
  %42 = load i32, ptr %3, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [10 x i32], ptr %4, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %45)
  br label %47

47:                                               ; preds = %41
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %3, align 4, !tbaa !5
  br label %38, !llvm.loop !12

50:                                               ; preds = %38
  %51 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %60, %50
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = icmp slt i32 %53, 10
  br i1 %54, label %55, label %63

55:                                               ; preds = %52
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [10 x i32], ptr %4, i64 0, i64 %57
  %59 = call i32 @rbtree_add(ptr noundef %2, ptr noundef %58)
  br label %60

60:                                               ; preds = %55
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %3, align 4, !tbaa !5
  br label %52, !llvm.loop !13

63:                                               ; preds = %52
  %64 = getelementptr inbounds %struct.redblacktree_t, ptr %2, i32 0, i32 5
  %65 = load ptr, ptr %64, align 8, !tbaa !14
  call void @print_rbt(ptr noundef %65, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %66 = call i32 @rand() #4
  %67 = srem i32 %66, 10
  store i32 %67, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %68 = load i32, ptr %5, align 4, !tbaa !5
  %69 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %68)
  %70 = call i32 @rbtree_find_node(ptr noundef %2, ptr noundef %5, ptr noundef %6)
  store i32 %70, ptr %7, align 4, !tbaa !5
  %71 = icmp eq i32 %70, 0
  br i1 %71, label %72, label %98

72:                                               ; preds = %63
  %73 = load i32, ptr %5, align 4, !tbaa !5
  %74 = load ptr, ptr %6, align 8, !tbaa !18
  %75 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, i32 noundef %73, ptr noundef %74)
  %76 = load ptr, ptr %6, align 8, !tbaa !18
  %77 = getelementptr inbounds %struct.redblacknode_t, ptr %76, i32 0, i32 3
  %78 = load i32, ptr %77, align 8, !tbaa !19
  %79 = icmp eq i32 %78, 0
  %80 = zext i1 %79 to i64
  %81 = select i1 %79, ptr @.str.3, ptr @.str.2
  %82 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, ptr noundef %81)
  %83 = load ptr, ptr %6, align 8, !tbaa !18
  %84 = getelementptr inbounds %struct.redblacknode_t, ptr %83, i32 0, i32 2
  %85 = load ptr, ptr %84, align 8, !tbaa !21
  %86 = icmp ne ptr %85, null
  br i1 %86, label %87, label %95

87:                                               ; preds = %72
  %88 = load ptr, ptr %6, align 8, !tbaa !18
  %89 = getelementptr inbounds %struct.redblacknode_t, ptr %88, i32 0, i32 2
  %90 = load ptr, ptr %89, align 8, !tbaa !21
  %91 = getelementptr inbounds %struct.redblacknode_t, ptr %90, i32 0, i32 4
  %92 = load ptr, ptr %91, align 8, !tbaa !22
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, i32 noundef %93)
  br label %97

95:                                               ; preds = %72
  %96 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  br label %97

97:                                               ; preds = %95, %87
  br label %102

98:                                               ; preds = %63
  %99 = load i32, ptr %7, align 4, !tbaa !5
  %100 = call ptr @gerror_to_str(i32 noundef %99)
  %101 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, ptr noundef %100)
  br label %102

102:                                              ; preds = %98, %97
  %103 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  %104 = call i32 @rbtree_min_value(ptr noundef %2, ptr noundef %5)
  store i32 %104, ptr %7, align 4, !tbaa !5
  %105 = icmp eq i32 %104, 0
  br i1 %105, label %106, label %109

106:                                              ; preds = %102
  %107 = load i32, ptr %5, align 4, !tbaa !5
  %108 = call i32 (ptr, ...) @printf(ptr noundef @.str.14, i32 noundef %107)
  br label %113

109:                                              ; preds = %102
  %110 = load i32, ptr %7, align 4, !tbaa !5
  %111 = call ptr @gerror_to_str(i32 noundef %110)
  %112 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, ptr noundef %111)
  br label %113

113:                                              ; preds = %109, %106
  %114 = call i32 (ptr, ...) @printf(ptr noundef @.str.15)
  %115 = call i32 @rbtree_max_value(ptr noundef %2, ptr noundef %5)
  store i32 %115, ptr %7, align 4, !tbaa !5
  %116 = icmp eq i32 %115, 0
  br i1 %116, label %117, label %120

117:                                              ; preds = %113
  %118 = load i32, ptr %5, align 4, !tbaa !5
  %119 = call i32 (ptr, ...) @printf(ptr noundef @.str.14, i32 noundef %118)
  br label %124

120:                                              ; preds = %113
  %121 = load i32, ptr %7, align 4, !tbaa !5
  %122 = call ptr @gerror_to_str(i32 noundef %121)
  %123 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, ptr noundef %122)
  br label %124

124:                                              ; preds = %120, %117
  store i32 0, ptr %5, align 4, !tbaa !5
  %125 = getelementptr inbounds %struct.redblacktree_t, ptr %2, i32 0, i32 5
  %126 = load ptr, ptr %125, align 8, !tbaa !14
  %127 = call i32 @is_a_valid_rbtree(ptr noundef %126, i32 noundef 0, ptr noundef %5)
  %128 = icmp ne i32 %127, 0
  %129 = zext i1 %128 to i64
  %130 = select i1 %128, ptr @.str.17, ptr @.str.18
  %131 = call i32 (ptr, ...) @printf(ptr noundef @.str.16, ptr noundef %130)
  %132 = call i32 @rbtree_destroy(ptr noundef %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 48, ptr %2) #4
  ret i32 0
}

; Function Attrs: nounwind
declare void @srand(i32 noundef) #3

; Function Attrs: nounwind
declare i64 @time(ptr noundef) #3

declare i32 @rbtree_create(ptr noundef, i64 noundef) #2

; Function Attrs: nounwind
declare i32 @rand() #3

declare i32 @rbtree_add(ptr noundef, ptr noundef) #2

declare i32 @rbtree_find_node(ptr noundef, ptr noundef, ptr noundef) #2

declare ptr @gerror_to_str(i32 noundef) #2

declare i32 @rbtree_min_value(ptr noundef, ptr noundef) #2

declare i32 @rbtree_max_value(ptr noundef, ptr noundef) #2

declare i32 @rbtree_destroy(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 = { 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 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!15, !17, i64 40}
!15 = !{!"redblacktree_t", !16, i64 0, !16, i64 8, !17, i64 16, !17, i64 24, !16, i64 32, !17, i64 40}
!16 = !{!"long", !7, i64 0}
!17 = !{!"any pointer", !7, i64 0}
!18 = !{!17, !17, i64 0}
!19 = !{!20, !6, i64 24}
!20 = !{!"redblacknode_t", !17, i64 0, !17, i64 8, !17, i64 16, !6, i64 24, !17, i64 32}
!21 = !{!20, !17, i64 16}
!22 = !{!20, !17, i64 32}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.redblacktree_t = type { i64, i64, ptr, ptr, i64, ptr }

@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @print_rbt(ptr 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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @swap(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
.preheader21.preheader:
  %0 = alloca %struct.redblacktree_t, align 8
  %1 = alloca [10 x i32], align 16
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = tail call i64 @time(ptr noundef null) #5
  %5 = trunc i64 %4 to i32
  tail call void @srand(i32 noundef %5) #5
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %0) #5
  %6 = call i32 @rbtree_create(ptr noundef nonnull %0, i64 noundef 4) #5
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %1) #5
  %7 = getelementptr inbounds i8, ptr %1, i64 4
  %8 = getelementptr inbounds i8, ptr %1, i64 8
  %9 = getelementptr inbounds i8, ptr %1, i64 12
  store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, ptr %1, align 16, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %1, i64 16
  %11 = getelementptr inbounds i8, ptr %1, i64 20
  %12 = getelementptr inbounds i8, ptr %1, i64 24
  %13 = getelementptr inbounds i8, ptr %1, i64 28
  store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, ptr %10, align 16, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %1, i64 32
  store i32 8, ptr %14, align 16, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %1, i64 36
  store i32 9, ptr %15, align 4, !tbaa !5
  %16 = call i32 @rand() #5
  %17 = srem i32 %16, 10
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [10 x i32], ptr %1, i64 0, i64 %18
  call void @swap(ptr noundef nonnull %1, ptr noundef nonnull %19)
  %20 = call i32 @rand() #5
  %21 = srem i32 %20, 10
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [10 x i32], ptr %1, i64 0, i64 %22
  call void @swap(ptr noundef nonnull %7, ptr noundef nonnull %23)
  %24 = call i32 @rand() #5
  %25 = srem i32 %24, 10
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [10 x i32], ptr %1, i64 0, i64 %26
  call void @swap(ptr noundef nonnull %8, ptr noundef nonnull %27)
  %28 = call i32 @rand() #5
  %29 = srem i32 %28, 10
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [10 x i32], ptr %1, i64 0, i64 %30
  call void @swap(ptr noundef nonnull %9, ptr noundef nonnull %31)
  %32 = call i32 @rand() #5
  %33 = srem i32 %32, 10
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [10 x i32], ptr %1, i64 0, i64 %34
  call void @swap(ptr noundef nonnull %10, ptr noundef nonnull %35)
  %36 = call i32 @rand() #5
  %37 = srem i32 %36, 10
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [10 x i32], ptr %1, i64 0, i64 %38
  call void @swap(ptr noundef nonnull %11, ptr noundef nonnull %39)
  %40 = call i32 @rand() #5
  %41 = srem i32 %40, 10
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [10 x i32], ptr %1, i64 0, i64 %42
  call void @swap(ptr noundef nonnull %12, ptr noundef nonnull %43)
  %44 = call i32 @rand() #5
  %45 = srem i32 %44, 10
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [10 x i32], ptr %1, i64 0, i64 %46
  call void @swap(ptr noundef nonnull %13, ptr noundef nonnull %47)
  %48 = call i32 @rand() #5
  %49 = srem i32 %48, 10
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [10 x i32], ptr %1, i64 0, i64 %50
  call void @swap(ptr noundef nonnull %14, ptr noundef nonnull %51)
  %52 = call i32 @rand() #5
  %53 = srem i32 %52, 10
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [10 x i32], ptr %1, i64 0, i64 %54
  call void @swap(ptr noundef nonnull %15, ptr noundef nonnull %55)
  %56 = load i32, ptr %1, align 16, !tbaa !5
  %57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %56)
  %58 = load i32, ptr %7, align 4, !tbaa !5
  %59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %58)
  %60 = load i32, ptr %8, align 8, !tbaa !5
  %61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %60)
  %62 = load i32, ptr %9, align 4, !tbaa !5
  %63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %62)
  %64 = load i32, ptr %10, align 16, !tbaa !5
  %65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %64)
  %66 = load i32, ptr %11, align 4, !tbaa !5
  %67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %66)
  %68 = load i32, ptr %12, align 8, !tbaa !5
  %69 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %68)
  %70 = load i32, ptr %13, align 4, !tbaa !5
  %71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %70)
  %72 = load i32, ptr %14, align 16, !tbaa !5
  %73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %72)
  %74 = load i32, ptr %15, align 4, !tbaa !5
  %75 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %74)
  %76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %77 = call i32 @rbtree_add(ptr noundef nonnull %0, ptr noundef nonnull %1) #5
  %78 = call i32 @rbtree_add(ptr noundef nonnull %0, ptr noundef nonnull %7) #5
  %79 = call i32 @rbtree_add(ptr noundef nonnull %0, ptr noundef nonnull %8) #5
  %80 = call i32 @rbtree_add(ptr noundef nonnull %0, ptr noundef nonnull %9) #5
  %81 = call i32 @rbtree_add(ptr noundef nonnull %0, ptr noundef nonnull %10) #5
  %82 = call i32 @rbtree_add(ptr noundef nonnull %0, ptr noundef nonnull %11) #5
  %83 = call i32 @rbtree_add(ptr noundef nonnull %0, ptr noundef nonnull %12) #5
  %84 = call i32 @rbtree_add(ptr noundef nonnull %0, ptr noundef nonnull %13) #5
  %85 = call i32 @rbtree_add(ptr noundef nonnull %0, ptr noundef nonnull %14) #5
  %86 = call i32 @rbtree_add(ptr noundef nonnull %0, ptr noundef nonnull %15) #5
  %87 = getelementptr inbounds i8, ptr %0, i64 40
  %88 = load ptr, ptr %87, align 8, !tbaa !9
  call void @print_rbt(ptr noundef %88, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %89 = call i32 @rand() #5
  %90 = srem i32 %89, 10
  store i32 %90, ptr %2, align 4, !tbaa !5
  %91 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %90)
  %92 = call i32 @rbtree_find_node(ptr noundef nonnull %0, ptr noundef nonnull %2, ptr noundef nonnull %3) #5
  %93 = icmp eq i32 %92, 0
  br i1 %93, label %94, label %114

94:                                               ; preds = %.preheader21.preheader
  %95 = load i32, ptr %2, align 4, !tbaa !5
  %96 = load ptr, ptr %3, align 8, !tbaa !13
  %97 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %95, ptr noundef %96)
  %98 = load ptr, ptr %3, align 8, !tbaa !13
  %99 = getelementptr inbounds i8, ptr %98, i64 24
  %100 = load i32, ptr %99, align 8, !tbaa !14
  %101 = icmp eq i32 %100, 0
  %102 = select i1 %101, ptr @.str.3, ptr @.str.2
  %103 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, ptr noundef nonnull %102)
  %104 = load ptr, ptr %3, align 8, !tbaa !13
  %105 = getelementptr inbounds i8, ptr %104, i64 16
  %106 = load ptr, ptr %105, align 8, !tbaa !16
  %.not = icmp eq ptr %106, null
  br i1 %.not, label %112, label %107

107:                                              ; preds = %94
  %108 = getelementptr inbounds i8, ptr %106, i64 32
  %109 = load ptr, ptr %108, align 8, !tbaa !17
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, i32 noundef %110)
  br label %117

112:                                              ; preds = %94
  %113 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  br label %117

114:                                              ; preds = %.preheader21.preheader
  %115 = call ptr @gerror_to_str(i32 noundef %92) #5
  %116 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, ptr noundef %115)
  br label %117

117:                                              ; preds = %107, %112, %114
  %118 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13)
  %119 = call i32 @rbtree_min_value(ptr noundef nonnull %0, ptr noundef nonnull %2) #5
  %120 = icmp eq i32 %119, 0
  br i1 %120, label %121, label %124

121:                                              ; preds = %117
  %122 = load i32, ptr %2, align 4, !tbaa !5
  %123 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14, i32 noundef %122)
  br label %127

124:                                              ; preds = %117
  %125 = call ptr @gerror_to_str(i32 noundef %119) #5
  %126 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, ptr noundef %125)
  br label %127

127:                                              ; preds = %124, %121
  %128 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15)
  %129 = call i32 @rbtree_max_value(ptr noundef nonnull %0, ptr noundef nonnull %2) #5
  %130 = icmp eq i32 %129, 0
  br i1 %130, label %131, label %134

131:                                              ; preds = %127
  %132 = load i32, ptr %2, align 4, !tbaa !5
  %133 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14, i32 noundef %132)
  br label %137

134:                                              ; preds = %127
  %135 = call ptr @gerror_to_str(i32 noundef %129) #5
  %136 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, ptr noundef %135)
  br label %137

137:                                              ; preds = %134, %131
  store i32 0, ptr %2, align 4, !tbaa !5
  %138 = load ptr, ptr %87, align 8, !tbaa !9
  %139 = call i32 @is_a_valid_rbtree(ptr noundef %138, i32 noundef 0, ptr noundef nonnull %2)
  %.not20 = icmp eq i32 %139, 0
  %140 = select i1 %.not20, ptr @.str.18, ptr @.str.17
  %141 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16, ptr noundef nonnull %140)
  %142 = call i32 @rbtree_destroy(ptr noundef nonnull %0) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %1) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %0) #5
  ret i32 0
}

; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #3

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

; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #3

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

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

declare ptr @gerror_to_str(i32 noundef) local_unnamed_addr #4

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

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

declare i32 @rbtree_destroy(ptr noundef) local_unnamed_addr #4

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 = { 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 #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 }

!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, !12, i64 40}
!10 = !{!"redblacktree_t", !11, i64 0, !11, i64 8, !12, i64 16, !12, i64 24, !11, i64 32, !12, i64 40}
!11 = !{!"long", !7, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!12, !12, i64 0}
!14 = !{!15, !6, i64 24}
!15 = !{!"redblacknode_t", !12, i64 0, !12, i64 8, !12, i64 16, !6, i64 24, !12, i64 32}
!16 = !{!15, !12, i64 16}
!17 = !{!15, !12, i64 32}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass