; LLVM IR from TheAlgorithms/C-Plus-Plus :: data_structures/tree_234.ll (ZN15data_structures8tree_2347Tree2345MergeEPNS0_4NodeEa)

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

@.str.2 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [7 x i8], align 1
@__PRETTY_FUNCTION__._ZN15data_structures8tree_2347Tree2345MergeEPNS0_4NodeEa = external hidden unnamed_addr constant [64 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [48 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: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN15data_structures8tree_2344Node8GetChildEa(ptr noundef nonnull align 8 dereferenceable(57), i8 noundef signext) #1 align 2

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN15data_structures8tree_2344Node7GetItemEa(ptr noundef nonnull align 8 dereferenceable(57), i8 noundef signext) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN15data_structures8tree_2344Node7Is2NodeEv(ptr noundef nonnull align 8 dereferenceable(57)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15data_structures8tree_2344Node8SetChildEaPS1_(ptr noundef nonnull align 8 dereferenceable(57), i8 noundef signext, ptr noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15data_structures8tree_2344Node8SetCountEa(ptr noundef nonnull align 8 dereferenceable(57), i8 noundef signext) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN15data_structures8tree_2344Node16GetItemLeftChildEa(ptr noundef nonnull align 8 dereferenceable(57), i8 noundef signext) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN15data_structures8tree_2344Node17GetItemRightChildEa(ptr noundef nonnull align 8 dereferenceable(57), i8 noundef signext) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15data_structures8tree_2344Node7SetItemEal(ptr noundef nonnull align 8 dereferenceable(57), i8 noundef signext, i64 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN15data_structures8tree_2344Node17RemoveItemByIndexEab(ptr noundef nonnull align 8 dereferenceable(57), i8 noundef signext, i1 noundef zeroext) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN15data_structures8tree_2347Tree2345MergeEPNS0_4NodeEa(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %1, i8 noundef signext %2) #4 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i8 %2, ptr %6, align 1, !tbaa !9
  %10 = load ptr, ptr %4, align 8
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = icmp ne ptr %11, null
  br i1 %12, label %13, label %14

13:                                               ; preds = %3
  br label %16

14:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.2, i32 noundef 896, ptr noundef @__PRETTY_FUNCTION__._ZN15data_structures8tree_2347Tree2345MergeEPNS0_4NodeEa) #5
  unreachable

15:                                               ; No predecessors!
  br label %16

16:                                               ; preds = %15, %13
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = load i8, ptr %6, align 1, !tbaa !9
  %19 = call noundef ptr @_ZN15data_structures8tree_2344Node16GetItemLeftChildEa(ptr noundef nonnull align 8 dereferenceable(57) %17, i8 noundef signext %18)
  store ptr %19, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = load i8, ptr %6, align 1, !tbaa !9
  %22 = call noundef ptr @_ZN15data_structures8tree_2344Node17GetItemRightChildEa(ptr noundef nonnull align 8 dereferenceable(57) %20, i8 noundef signext %21)
  store ptr %22, ptr %8, align 8, !tbaa !5
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = call noundef zeroext i1 @_ZN15data_structures8tree_2344Node7Is2NodeEv(ptr noundef nonnull align 8 dereferenceable(57) %23)
  br i1 %24, label %25, label %28

25:                                               ; preds = %16
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = call noundef zeroext i1 @_ZN15data_structures8tree_2344Node7Is2NodeEv(ptr noundef nonnull align 8 dereferenceable(57) %26)
  br label %28

28:                                               ; preds = %25, %16
  %29 = phi i1 [ false, %16 ], [ %27, %25 ]
  br i1 %29, label %30, label %31

30:                                               ; preds = %28
  br label %33

31:                                               ; preds = %28
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.2, i32 noundef 903, ptr noundef @__PRETTY_FUNCTION__._ZN15data_structures8tree_2347Tree2345MergeEPNS0_4NodeEa) #5
  unreachable

32:                                               ; No predecessors!
  br label %33

33:                                               ; preds = %32, %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = load i8, ptr %6, align 1, !tbaa !9
  %36 = call noundef i64 @_ZN15data_structures8tree_2344Node7GetItemEa(ptr noundef nonnull align 8 dereferenceable(57) %34, i8 noundef signext %35)
  store i64 %36, ptr %9, align 8, !tbaa !10
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = load i64, ptr %9, align 8, !tbaa !10
  call void @_ZN15data_structures8tree_2344Node7SetItemEal(ptr noundef nonnull align 8 dereferenceable(57) %37, i8 noundef signext 1, i64 noundef %38)
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = call noundef i64 @_ZN15data_structures8tree_2344Node7GetItemEa(ptr noundef nonnull align 8 dereferenceable(57) %40, i8 noundef signext 0)
  call void @_ZN15data_structures8tree_2344Node7SetItemEal(ptr noundef nonnull align 8 dereferenceable(57) %39, i8 noundef signext 2, i64 noundef %41)
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = call noundef ptr @_ZN15data_structures8tree_2344Node8GetChildEa(ptr noundef nonnull align 8 dereferenceable(57) %43, i8 noundef signext 0)
  call void @_ZN15data_structures8tree_2344Node8SetChildEaPS1_(ptr noundef nonnull align 8 dereferenceable(57) %42, i8 noundef signext 2, ptr noundef %44)
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = call noundef ptr @_ZN15data_structures8tree_2344Node8GetChildEa(ptr noundef nonnull align 8 dereferenceable(57) %46, i8 noundef signext 1)
  call void @_ZN15data_structures8tree_2344Node8SetChildEaPS1_(ptr noundef nonnull align 8 dereferenceable(57) %45, i8 noundef signext 3, ptr noundef %47)
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN15data_structures8tree_2344Node8SetCountEa(ptr noundef nonnull align 8 dereferenceable(57) %48, i8 noundef signext 3)
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = load i8, ptr %6, align 1, !tbaa !9
  %51 = call noundef ptr @_ZN15data_structures8tree_2344Node17RemoveItemByIndexEab(ptr noundef nonnull align 8 dereferenceable(57) %49, i8 noundef signext %50, i1 noundef zeroext true)
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = icmp eq ptr %52, null
  br i1 %53, label %55, label %54

54:                                               ; preds = %33
  call void @_ZdlPvm(ptr noundef %52, i64 noundef 64) #7
  br label %55

55:                                               ; preds = %54, %33
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  ret ptr %56
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 #2 = { nobuiltin 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 = { 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 = { mustprogress 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 = { noreturn nounwind }
attributes #6 = { nounwind }
attributes #7 = { builtin 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !7, i64 0}


; 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.2 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [7 x i8], align 1
@__PRETTY_FUNCTION__._ZN15data_structures8tree_2347Tree2345MergeEPNS0_4NodeEa = external hidden unnamed_addr constant [64 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [48 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN15data_structures8tree_2344Node8GetChildEa(ptr noundef nonnull align 8 dereferenceable(57), i8 noundef signext) local_unnamed_addr #0 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN15data_structures8tree_2344Node7GetItemEa(ptr noundef nonnull align 8 dereferenceable(57), i8 noundef signext) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN15data_structures8tree_2344Node7Is2NodeEv(ptr noundef nonnull align 8 dereferenceable(57)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15data_structures8tree_2344Node8SetChildEaPS1_(ptr noundef nonnull align 8 dereferenceable(57), i8 noundef signext, ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15data_structures8tree_2344Node8SetCountEa(ptr noundef nonnull align 8 dereferenceable(57), i8 noundef signext) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN15data_structures8tree_2344Node16GetItemLeftChildEa(ptr noundef nonnull align 8 dereferenceable(57), i8 noundef signext) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN15data_structures8tree_2344Node17GetItemRightChildEa(ptr noundef nonnull align 8 dereferenceable(57), i8 noundef signext) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15data_structures8tree_2344Node7SetItemEal(ptr noundef nonnull align 8 dereferenceable(57), i8 noundef signext, i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN15data_structures8tree_2344Node17RemoveItemByIndexEab(ptr noundef nonnull align 8 dereferenceable(57), i8 noundef signext, i1 noundef zeroext) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef ptr @_ZN15data_structures8tree_2347Tree2345MergeEPNS0_4NodeEa(ptr nocapture noundef nonnull readnone align 8 dereferenceable(8) %0, ptr noundef %1, i8 noundef signext %2) local_unnamed_addr #0 align 2 {
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %4, label %5

4:                                                ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.2, i32 noundef 896, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN15data_structures8tree_2347Tree2345MergeEPNS0_4NodeEa) #3
  unreachable

5:                                                ; preds = %3
  %6 = tail call noundef ptr @_ZN15data_structures8tree_2344Node16GetItemLeftChildEa(ptr noundef nonnull align 8 dereferenceable(57) %1, i8 noundef signext %2)
  %7 = tail call noundef ptr @_ZN15data_structures8tree_2344Node17GetItemRightChildEa(ptr noundef nonnull align 8 dereferenceable(57) %1, i8 noundef signext %2)
  %8 = tail call noundef zeroext i1 @_ZN15data_structures8tree_2344Node7Is2NodeEv(ptr noundef nonnull align 8 dereferenceable(57) %6)
  br i1 %8, label %9, label %.critedge

9:                                                ; preds = %5
  %10 = tail call noundef zeroext i1 @_ZN15data_structures8tree_2344Node7Is2NodeEv(ptr noundef nonnull align 8 dereferenceable(57) %7)
  br i1 %10, label %11, label %.critedge

.critedge:                                        ; preds = %5, %9
  tail call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.2, i32 noundef 903, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN15data_structures8tree_2347Tree2345MergeEPNS0_4NodeEa) #3
  unreachable

11:                                               ; preds = %9
  %12 = tail call noundef i64 @_ZN15data_structures8tree_2344Node7GetItemEa(ptr noundef nonnull align 8 dereferenceable(57) %1, i8 noundef signext %2)
  tail call void @_ZN15data_structures8tree_2344Node7SetItemEal(ptr noundef nonnull align 8 dereferenceable(57) %6, i8 noundef signext 1, i64 noundef %12)
  %13 = tail call noundef i64 @_ZN15data_structures8tree_2344Node7GetItemEa(ptr noundef nonnull align 8 dereferenceable(57) %7, i8 noundef signext 0)
  tail call void @_ZN15data_structures8tree_2344Node7SetItemEal(ptr noundef nonnull align 8 dereferenceable(57) %6, i8 noundef signext 2, i64 noundef %13)
  %14 = tail call noundef ptr @_ZN15data_structures8tree_2344Node8GetChildEa(ptr noundef nonnull align 8 dereferenceable(57) %7, i8 noundef signext 0)
  tail call void @_ZN15data_structures8tree_2344Node8SetChildEaPS1_(ptr noundef nonnull align 8 dereferenceable(57) %6, i8 noundef signext 2, ptr noundef %14)
  %15 = tail call noundef ptr @_ZN15data_structures8tree_2344Node8GetChildEa(ptr noundef nonnull align 8 dereferenceable(57) %7, i8 noundef signext 1)
  tail call void @_ZN15data_structures8tree_2344Node8SetChildEaPS1_(ptr noundef nonnull align 8 dereferenceable(57) %6, i8 noundef signext 3, ptr noundef %15)
  tail call void @_ZN15data_structures8tree_2344Node8SetCountEa(ptr noundef nonnull align 8 dereferenceable(57) %6, i8 noundef signext 3)
  %16 = tail call noundef ptr @_ZN15data_structures8tree_2344Node17RemoveItemByIndexEab(ptr noundef nonnull align 8 dereferenceable(57) %1, i8 noundef signext %2, i1 noundef zeroext true)
  tail call void @_ZdlPvm(ptr noundef %7, i64 noundef 64) #4
  ret ptr %6
}

attributes #0 = { mustprogress 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 = { nobuiltin 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 #2 = { 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 #3 = { noreturn nounwind }
attributes #4 = { builtin 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)"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass