; LLVM IR from fritzsedlazeck/SURVIVOR :: src/merge_vcf/IntervallTree.ll (ZN13IntervallTree3srlERP5TNode)

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

%class.TNode = type { ptr, i32, ptr, ptr, ptr }

; 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN13IntervallTree8bsheightEP5TNode(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN13IntervallTree3srlERP5TNode(ptr noundef nonnull align 1 dereferenceable(1) %0, ptr noundef nonnull align 8 dereferenceable(8) %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  %9 = getelementptr inbounds %class.TNode, ptr %8, i32 0, i32 3
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  store ptr %10, ptr %5, align 8, !tbaa !5
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = getelementptr inbounds %class.TNode, ptr %11, i32 0, i32 4
  %13 = load ptr, ptr %12, align 8, !tbaa !12
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  %16 = getelementptr inbounds %class.TNode, ptr %15, i32 0, i32 3
  store ptr %13, ptr %16, align 8, !tbaa !9
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = load ptr, ptr %17, align 8, !tbaa !5
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %class.TNode, ptr %19, i32 0, i32 4
  store ptr %18, ptr %20, align 8, !tbaa !12
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = load ptr, ptr %23, align 8, !tbaa !5
  %25 = getelementptr inbounds %class.TNode, ptr %24, i32 0, i32 3
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  %27 = call noundef i32 @_ZN13IntervallTree8bsheightEP5TNode(ptr noundef nonnull align 1 dereferenceable(1) %6, ptr noundef %26)
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = load ptr, ptr %28, align 8, !tbaa !5
  %30 = getelementptr inbounds %class.TNode, ptr %29, i32 0, i32 4
  %31 = load ptr, ptr %30, align 8, !tbaa !12
  %32 = call noundef i32 @_ZN13IntervallTree8bsheightEP5TNode(ptr noundef nonnull align 1 dereferenceable(1) %6, ptr noundef %31)
  %33 = call noundef i32 @_ZN13IntervallTree3maxEii(ptr noundef nonnull align 1 dereferenceable(1) %6, i32 noundef %27, i32 noundef %32)
  %34 = add nsw i32 %33, 1
  call void @_ZN5TNode10set_heightEi(ptr noundef nonnull align 8 dereferenceable(40) %22, i32 noundef %34)
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %class.TNode, ptr %36, i32 0, i32 3
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  %39 = call noundef i32 @_ZN13IntervallTree8bsheightEP5TNode(ptr noundef nonnull align 1 dereferenceable(1) %6, ptr noundef %38)
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = load ptr, ptr %40, align 8, !tbaa !5
  %42 = call noundef i32 @_ZN5TNode10get_heightEv(ptr noundef nonnull align 8 dereferenceable(40) %41)
  %43 = call noundef i32 @_ZN13IntervallTree3maxEii(ptr noundef nonnull align 1 dereferenceable(1) %6, i32 noundef %39, i32 noundef %42)
  %44 = add nsw i32 %43, 1
  call void @_ZN5TNode10set_heightEi(ptr noundef nonnull align 8 dereferenceable(40) %35, i32 noundef %44)
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret ptr %45
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN13IntervallTree3maxEii(ptr noundef nonnull align 1 dereferenceable(1), i32 noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5TNode10set_heightEi(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN5TNode10get_heightEv(ptr noundef nonnull align 8 dereferenceable(40)) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 = !{!10, !6, i64 24}
!10 = !{!"_ZTS5TNode", !6, i64 0, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, 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"

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN13IntervallTree8bsheightEP5TNode(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN13IntervallTree3srlERP5TNode(ptr noundef nonnull align 1 dereferenceable(1) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %1) local_unnamed_addr #0 align 2 {
  %3 = load ptr, ptr %1, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %3, i64 24
  %5 = load ptr, ptr %4, align 8, !tbaa !9
  %6 = getelementptr inbounds i8, ptr %5, i64 32
  %7 = load ptr, ptr %6, align 8, !tbaa !12
  store ptr %7, ptr %4, align 8, !tbaa !9
  %8 = load ptr, ptr %1, align 8, !tbaa !5
  store ptr %8, ptr %6, align 8, !tbaa !12
  %9 = getelementptr inbounds i8, ptr %8, i64 24
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = tail call noundef i32 @_ZN13IntervallTree8bsheightEP5TNode(ptr noundef nonnull align 1 dereferenceable(1) %0, ptr noundef %10)
  %12 = load ptr, ptr %1, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %12, i64 32
  %14 = load ptr, ptr %13, align 8, !tbaa !12
  %15 = tail call noundef i32 @_ZN13IntervallTree8bsheightEP5TNode(ptr noundef nonnull align 1 dereferenceable(1) %0, ptr noundef %14)
  %16 = tail call noundef i32 @_ZN13IntervallTree3maxEii(ptr noundef nonnull align 1 dereferenceable(1) %0, i32 noundef %11, i32 noundef %15)
  %17 = add nsw i32 %16, 1
  tail call void @_ZN5TNode10set_heightEi(ptr noundef nonnull align 8 dereferenceable(40) %8, i32 noundef %17)
  %18 = getelementptr inbounds i8, ptr %5, i64 24
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  %20 = tail call noundef i32 @_ZN13IntervallTree8bsheightEP5TNode(ptr noundef nonnull align 1 dereferenceable(1) %0, ptr noundef %19)
  %21 = load ptr, ptr %1, align 8, !tbaa !5
  %22 = tail call noundef i32 @_ZN5TNode10get_heightEv(ptr noundef nonnull align 8 dereferenceable(40) %21)
  %23 = tail call noundef i32 @_ZN13IntervallTree3maxEii(ptr noundef nonnull align 1 dereferenceable(1) %0, i32 noundef %20, i32 noundef %22)
  %24 = add nsw i32 %23, 1
  tail call void @_ZN5TNode10set_heightEi(ptr noundef nonnull align 8 dereferenceable(40) %5, i32 noundef %24)
  ret ptr %5
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN13IntervallTree3maxEii(ptr noundef nonnull align 1 dereferenceable(1), i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5TNode10set_heightEi(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN5TNode10get_heightEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #1 align 2

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

!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 = !{!10, !6, i64 24}
!10 = !{!"_ZTS5TNode", !6, i64 0, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 32}


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