; LLVM IR from hutusi/rethink-c :: test (test_bstree)

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

@.str = external hidden unnamed_addr constant [35 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [69 x i8], align 1
@__const.test_bstree_remove.entries = external hidden unnamed_addr constant [20 x i32], align 16
@__PRETTY_FUNCTION__.test_bstree_remove = external hidden unnamed_addr constant [26 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [21 x i8], align 1

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

declare ptr @bs_tree_new(ptr noundef) #2

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

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

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

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

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

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

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

declare void @alloc_test_free(ptr noundef) #2

declare void @bs_tree_free(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @test_bstree_remove() #4 {
  %1 = alloca [20 x i32], align 16
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 80, ptr %1) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %1, ptr align 16 @__const.test_bstree_remove.entries, i64 80, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 20, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %9 = call ptr @bs_tree_new(ptr noundef @int_compare)
  store ptr %9, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %10

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

14:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %35

15:                                               ; preds = %10
  %16 = load ptr, ptr %3, align 8, !tbaa !9
  %17 = load i32, ptr %5, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [20 x i32], ptr %1, i64 0, i64 %18
  %20 = call ptr @bs_tree_insert(ptr noundef %16, ptr noundef %19)
  store ptr %20, ptr %4, align 8, !tbaa !9
  %21 = load ptr, ptr %4, align 8, !tbaa !9
  %22 = getelementptr inbounds %struct._BSTreeNode, ptr %21, i32 0, i32 0
  %23 = load ptr, ptr %22, align 8, !tbaa !11
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [20 x i32], ptr %1, i64 0, i64 %25
  %27 = call i32 @int_equal(ptr noundef %23, ptr noundef %26)
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %30

29:                                               ; preds = %15
  br label %31

30:                                               ; preds = %15
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 98, ptr noundef @__PRETTY_FUNCTION__.test_bstree_remove) #6
  unreachable

31:                                               ; preds = %29
  br label %32

32:                                               ; preds = %31
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %5, align 4, !tbaa !5
  br label %10, !llvm.loop !13

35:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 2, ptr %6, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %50, %35
  %37 = load i32, ptr %6, align 4, !tbaa !5
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %53

41:                                               ; preds = %36
  %42 = load ptr, ptr %3, align 8, !tbaa !9
  %43 = load ptr, ptr %3, align 8, !tbaa !9
  %44 = load i32, ptr %6, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [20 x i32], ptr %1, i64 0, i64 %45
  %47 = call ptr @bs_tree_lookup_data(ptr noundef %43, ptr noundef %46)
  %48 = call ptr @bs_tree_remove_node(ptr noundef %42, ptr noundef %47)
  store ptr %48, ptr %4, align 8, !tbaa !9
  %49 = load ptr, ptr %4, align 8, !tbaa !9
  call void @alloc_test_free(ptr noundef %49)
  br label %50

50:                                               ; preds = %41
  %51 = load i32, ptr %6, align 4, !tbaa !5
  %52 = add nsw i32 %51, 3
  store i32 %52, ptr %6, align 4, !tbaa !5
  br label %36, !llvm.loop !15

53:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %68, %53
  %55 = load i32, ptr %7, align 4, !tbaa !5
  %56 = load i32, ptr %2, align 4, !tbaa !5
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %71

59:                                               ; preds = %54
  %60 = load ptr, ptr %3, align 8, !tbaa !9
  %61 = load ptr, ptr %3, align 8, !tbaa !9
  %62 = load i32, ptr %7, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [20 x i32], ptr %1, i64 0, i64 %63
  %65 = call ptr @bs_tree_lookup_data(ptr noundef %61, ptr noundef %64)
  %66 = call ptr @bs_tree_remove_node(ptr noundef %60, ptr noundef %65)
  store ptr %66, ptr %4, align 8, !tbaa !9
  %67 = load ptr, ptr %4, align 8, !tbaa !9
  call void @alloc_test_free(ptr noundef %67)
  br label %68

68:                                               ; preds = %59
  %69 = load i32, ptr %7, align 4, !tbaa !5
  %70 = add nsw i32 %69, 3
  store i32 %70, ptr %7, align 4, !tbaa !5
  br label %54, !llvm.loop !16

71:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %86, %71
  %73 = load i32, ptr %8, align 4, !tbaa !5
  %74 = load i32, ptr %2, align 4, !tbaa !5
  %75 = icmp slt i32 %73, %74
  br i1 %75, label %77, label %76

76:                                               ; preds = %72
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %89

77:                                               ; preds = %72
  %78 = load ptr, ptr %3, align 8, !tbaa !9
  %79 = load ptr, ptr %3, align 8, !tbaa !9
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [20 x i32], ptr %1, i64 0, i64 %81
  %83 = call ptr @bs_tree_lookup_data(ptr noundef %79, ptr noundef %82)
  %84 = call ptr @bs_tree_remove_node(ptr noundef %78, ptr noundef %83)
  store ptr %84, ptr %4, align 8, !tbaa !9
  %85 = load ptr, ptr %4, align 8, !tbaa !9
  call void @alloc_test_free(ptr noundef %85)
  br label %86

86:                                               ; preds = %77
  %87 = load i32, ptr %8, align 4, !tbaa !5
  %88 = add nsw i32 %87, 3
  store i32 %88, ptr %8, align 4, !tbaa !5
  br label %72, !llvm.loop !17

89:                                               ; preds = %76
  %90 = load ptr, ptr %3, align 8, !tbaa !9
  %91 = getelementptr inbounds %struct._BSTree, ptr %90, i32 0, i32 2
  %92 = load i32, ptr %91, align 8, !tbaa !18
  %93 = icmp eq i32 %92, 0
  br i1 %93, label %94, label %95

94:                                               ; preds = %89
  br label %96

95:                                               ; preds = %89
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 144, ptr noundef @__PRETTY_FUNCTION__.test_bstree_remove) #6
  unreachable

96:                                               ; preds = %94
  %97 = load ptr, ptr %3, align 8, !tbaa !9
  call void @bs_tree_free(ptr noundef %97)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %1) #5
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree 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 = { 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 0}
!12 = !{!"_BSTreeNode", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = !{!19, !6, i64 16}
!19 = !{!"_BSTree", !10, i64 0, !10, i64 8, !6, i64 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"

@.str = external hidden unnamed_addr constant [35 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [69 x i8], align 1
@__const.test_bstree_remove.entries = external hidden unnamed_addr constant [20 x i32], align 16
@__PRETTY_FUNCTION__.test_bstree_remove = external hidden unnamed_addr constant [26 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [21 x i8], align 1

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

declare ptr @bs_tree_new(ptr noundef) local_unnamed_addr #2

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

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

declare i32 @int_equal(ptr noundef, 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

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

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

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

declare void @alloc_test_free(ptr noundef) local_unnamed_addr #2

declare void @bs_tree_free(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @test_bstree_remove() local_unnamed_addr #4 {
  %1 = alloca [20 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %1) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(80) %1, ptr noundef nonnull align 16 dereferenceable(80) @__const.test_bstree_remove.entries, i64 80, i1 false)
  %2 = tail call ptr @bs_tree_new(ptr noundef nonnull @int_compare) #5
  %3 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %1) #5
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = call i32 @int_equal(ptr noundef %4, ptr noundef nonnull %1) #5
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %144, label %6

6:                                                ; preds = %0
  %7 = getelementptr inbounds i8, ptr %1, i64 4
  %8 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %7) #5
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = call i32 @int_equal(ptr noundef %9, ptr noundef nonnull %7) #5
  %.not.1 = icmp eq i32 %10, 0
  br i1 %.not.1, label %144, label %11

11:                                               ; preds = %6
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  %13 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %12) #5
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  %15 = call i32 @int_equal(ptr noundef %14, ptr noundef nonnull %12) #5
  %.not.2 = icmp eq i32 %15, 0
  br i1 %.not.2, label %144, label %16

16:                                               ; preds = %11
  %17 = getelementptr inbounds i8, ptr %1, i64 12
  %18 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %17) #5
  %19 = load ptr, ptr %18, align 8, !tbaa !5
  %20 = call i32 @int_equal(ptr noundef %19, ptr noundef nonnull %17) #5
  %.not.3 = icmp eq i32 %20, 0
  br i1 %.not.3, label %144, label %21

21:                                               ; preds = %16
  %22 = getelementptr inbounds i8, ptr %1, i64 16
  %23 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %22) #5
  %24 = load ptr, ptr %23, align 8, !tbaa !5
  %25 = call i32 @int_equal(ptr noundef %24, ptr noundef nonnull %22) #5
  %.not.4 = icmp eq i32 %25, 0
  br i1 %.not.4, label %144, label %26

26:                                               ; preds = %21
  %27 = getelementptr inbounds i8, ptr %1, i64 20
  %28 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %27) #5
  %29 = load ptr, ptr %28, align 8, !tbaa !5
  %30 = call i32 @int_equal(ptr noundef %29, ptr noundef nonnull %27) #5
  %.not.5 = icmp eq i32 %30, 0
  br i1 %.not.5, label %144, label %31

31:                                               ; preds = %26
  %32 = getelementptr inbounds i8, ptr %1, i64 24
  %33 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %32) #5
  %34 = load ptr, ptr %33, align 8, !tbaa !5
  %35 = call i32 @int_equal(ptr noundef %34, ptr noundef nonnull %32) #5
  %.not.6 = icmp eq i32 %35, 0
  br i1 %.not.6, label %144, label %36

36:                                               ; preds = %31
  %37 = getelementptr inbounds i8, ptr %1, i64 28
  %38 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %37) #5
  %39 = load ptr, ptr %38, align 8, !tbaa !5
  %40 = call i32 @int_equal(ptr noundef %39, ptr noundef nonnull %37) #5
  %.not.7 = icmp eq i32 %40, 0
  br i1 %.not.7, label %144, label %41

41:                                               ; preds = %36
  %42 = getelementptr inbounds i8, ptr %1, i64 32
  %43 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %42) #5
  %44 = load ptr, ptr %43, align 8, !tbaa !5
  %45 = call i32 @int_equal(ptr noundef %44, ptr noundef nonnull %42) #5
  %.not.8 = icmp eq i32 %45, 0
  br i1 %.not.8, label %144, label %46

46:                                               ; preds = %41
  %47 = getelementptr inbounds i8, ptr %1, i64 36
  %48 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %47) #5
  %49 = load ptr, ptr %48, align 8, !tbaa !5
  %50 = call i32 @int_equal(ptr noundef %49, ptr noundef nonnull %47) #5
  %.not.9 = icmp eq i32 %50, 0
  br i1 %.not.9, label %144, label %51

51:                                               ; preds = %46
  %52 = getelementptr inbounds i8, ptr %1, i64 40
  %53 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %52) #5
  %54 = load ptr, ptr %53, align 8, !tbaa !5
  %55 = call i32 @int_equal(ptr noundef %54, ptr noundef nonnull %52) #5
  %.not.10 = icmp eq i32 %55, 0
  br i1 %.not.10, label %144, label %56

56:                                               ; preds = %51
  %57 = getelementptr inbounds i8, ptr %1, i64 44
  %58 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %57) #5
  %59 = load ptr, ptr %58, align 8, !tbaa !5
  %60 = call i32 @int_equal(ptr noundef %59, ptr noundef nonnull %57) #5
  %.not.11 = icmp eq i32 %60, 0
  br i1 %.not.11, label %144, label %61

61:                                               ; preds = %56
  %62 = getelementptr inbounds i8, ptr %1, i64 48
  %63 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %62) #5
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = call i32 @int_equal(ptr noundef %64, ptr noundef nonnull %62) #5
  %.not.12 = icmp eq i32 %65, 0
  br i1 %.not.12, label %144, label %66

66:                                               ; preds = %61
  %67 = getelementptr inbounds i8, ptr %1, i64 52
  %68 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %67) #5
  %69 = load ptr, ptr %68, align 8, !tbaa !5
  %70 = call i32 @int_equal(ptr noundef %69, ptr noundef nonnull %67) #5
  %.not.13 = icmp eq i32 %70, 0
  br i1 %.not.13, label %144, label %71

71:                                               ; preds = %66
  %72 = getelementptr inbounds i8, ptr %1, i64 56
  %73 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %72) #5
  %74 = load ptr, ptr %73, align 8, !tbaa !5
  %75 = call i32 @int_equal(ptr noundef %74, ptr noundef nonnull %72) #5
  %.not.14 = icmp eq i32 %75, 0
  br i1 %.not.14, label %144, label %76

76:                                               ; preds = %71
  %77 = getelementptr inbounds i8, ptr %1, i64 60
  %78 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %77) #5
  %79 = load ptr, ptr %78, align 8, !tbaa !5
  %80 = call i32 @int_equal(ptr noundef %79, ptr noundef nonnull %77) #5
  %.not.15 = icmp eq i32 %80, 0
  br i1 %.not.15, label %144, label %81

81:                                               ; preds = %76
  %82 = getelementptr inbounds i8, ptr %1, i64 64
  %83 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %82) #5
  %84 = load ptr, ptr %83, align 8, !tbaa !5
  %85 = call i32 @int_equal(ptr noundef %84, ptr noundef nonnull %82) #5
  %.not.16 = icmp eq i32 %85, 0
  br i1 %.not.16, label %144, label %86

86:                                               ; preds = %81
  %87 = getelementptr inbounds i8, ptr %1, i64 68
  %88 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %87) #5
  %89 = load ptr, ptr %88, align 8, !tbaa !5
  %90 = call i32 @int_equal(ptr noundef %89, ptr noundef nonnull %87) #5
  %.not.17 = icmp eq i32 %90, 0
  br i1 %.not.17, label %144, label %91

91:                                               ; preds = %86
  %92 = getelementptr inbounds i8, ptr %1, i64 72
  %93 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %92) #5
  %94 = load ptr, ptr %93, align 8, !tbaa !5
  %95 = call i32 @int_equal(ptr noundef %94, ptr noundef nonnull %92) #5
  %.not.18 = icmp eq i32 %95, 0
  br i1 %.not.18, label %144, label %96

96:                                               ; preds = %91
  %97 = getelementptr inbounds i8, ptr %1, i64 76
  %98 = call ptr @bs_tree_insert(ptr noundef %2, ptr noundef nonnull %97) #5
  %99 = load ptr, ptr %98, align 8, !tbaa !5
  %100 = call i32 @int_equal(ptr noundef %99, ptr noundef nonnull %97) #5
  %.not.19 = icmp eq i32 %100, 0
  br i1 %.not.19, label %144, label %.preheader33.preheader

.preheader33.preheader:                           ; preds = %96
  %101 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %12) #5
  %102 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %101) #5
  call void @alloc_test_free(ptr noundef %102) #5
  %103 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %27) #5
  %104 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %103) #5
  call void @alloc_test_free(ptr noundef %104) #5
  %105 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %42) #5
  %106 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %105) #5
  call void @alloc_test_free(ptr noundef %106) #5
  %107 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %57) #5
  %108 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %107) #5
  call void @alloc_test_free(ptr noundef %108) #5
  %109 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %72) #5
  %110 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %109) #5
  call void @alloc_test_free(ptr noundef %110) #5
  %111 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %87) #5
  %112 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %111) #5
  call void @alloc_test_free(ptr noundef %112) #5
  %113 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %1) #5
  %114 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %113) #5
  call void @alloc_test_free(ptr noundef %114) #5
  %115 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %17) #5
  %116 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %115) #5
  call void @alloc_test_free(ptr noundef %116) #5
  %117 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %32) #5
  %118 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %117) #5
  call void @alloc_test_free(ptr noundef %118) #5
  %119 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %47) #5
  %120 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %119) #5
  call void @alloc_test_free(ptr noundef %120) #5
  %121 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %62) #5
  %122 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %121) #5
  call void @alloc_test_free(ptr noundef %122) #5
  %123 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %77) #5
  %124 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %123) #5
  call void @alloc_test_free(ptr noundef %124) #5
  %125 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %92) #5
  %126 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %125) #5
  call void @alloc_test_free(ptr noundef %126) #5
  %127 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %7) #5
  %128 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %127) #5
  call void @alloc_test_free(ptr noundef %128) #5
  %129 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %22) #5
  %130 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %129) #5
  call void @alloc_test_free(ptr noundef %130) #5
  %131 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %37) #5
  %132 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %131) #5
  call void @alloc_test_free(ptr noundef %132) #5
  %133 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %52) #5
  %134 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %133) #5
  call void @alloc_test_free(ptr noundef %134) #5
  %135 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %67) #5
  %136 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %135) #5
  call void @alloc_test_free(ptr noundef %136) #5
  %137 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %82) #5
  %138 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %137) #5
  call void @alloc_test_free(ptr noundef %138) #5
  %139 = call ptr @bs_tree_lookup_data(ptr noundef %2, ptr noundef nonnull %97) #5
  %140 = call ptr @bs_tree_remove_node(ptr noundef %2, ptr noundef %139) #5
  call void @alloc_test_free(ptr noundef %140) #5
  %141 = getelementptr inbounds i8, ptr %2, i64 16
  %142 = load i32, ptr %141, align 8, !tbaa !10
  %143 = icmp eq i32 %142, 0
  br i1 %143, label %146, label %145

144:                                              ; preds = %96, %91, %86, %81, %76, %71, %66, %61, %56, %51, %46, %41, %36, %31, %26, %21, %16, %11, %6, %0
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 98, ptr noundef nonnull @__PRETTY_FUNCTION__.test_bstree_remove) #6
  unreachable

145:                                              ; preds = %.preheader33.preheader
  call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 144, ptr noundef nonnull @__PRETTY_FUNCTION__.test_bstree_remove) #6
  unreachable

146:                                              ; preds = %.preheader33.preheader
  call void @bs_tree_free(ptr noundef nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %1) #5
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree 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 = { 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, !7, i64 0}
!6 = !{!"_BSTreeNode", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !12, i64 16}
!11 = !{!"_BSTree", !7, i64 0, !7, i64 8, !12, i64 16}
!12 = !{!"int", !8, i64 0}


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