; LLVM IR from NervanaSystems/ngraph :: src/ngraph/pass/memory_layout.ll (ZN6ngraph4pass13MemoryManager8best_fitEm)

; 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.std::_List_iterator" = type { ptr }
%"struct.std::_List_const_iterator" = type { ptr }
%"class.ngraph::pass::MemoryManager::node" = type <{ i64, i32, [4 x i8] }>
%"class.ngraph::pass::MemoryManager" = type { %"class.std::__cxx11::list", i64, i32, i64 }
%"class.std::__cxx11::list" = type { %"class.std::__cxx11::_List_base" }
%"class.std::__cxx11::_List_base" = type { %"struct.std::__cxx11::_List_base<ngraph::pass::MemoryManager::node, std::allocator<ngraph::pass::MemoryManager::node>>::_List_impl" }
%"struct.std::__cxx11::_List_base<ngraph::pass::MemoryManager::node, std::allocator<ngraph::pass::MemoryManager::node>>::_List_impl" = type { %"struct.std::__detail::_List_node_header" }
%"struct.std::__detail::_List_node_header" = type { %"struct.std::__detail::_List_node_base", i64 }
%"struct.std::__detail::_List_node_base" = type { ptr, ptr }

@_ZTISt9bad_alloc = external constant 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

declare ptr @__cxa_allocate_exception(i64)

declare void @__cxa_throw(ptr, ptr, ptr)

; 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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNSt14numeric_limitsImE3maxEv() #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN6ngraph4pass13MemoryManager8best_fitEm(ptr noundef nonnull align 8 dereferenceable(48) %0, i64 noundef %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca %"struct.std::_List_iterator", align 8
  %8 = alloca i64, align 8
  %9 = alloca %"struct.std::_List_iterator", align 8
  %10 = alloca %"struct.std::_List_iterator", align 8
  %11 = alloca i64, align 8
  %12 = alloca %"struct.std::_List_iterator", align 8
  %13 = alloca %"struct.std::_List_const_iterator", align 8
  %14 = alloca %"class.ngraph::pass::MemoryManager::node", align 8
  %15 = alloca %"struct.std::_List_iterator", align 8
  %16 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !9
  %17 = load ptr, ptr %3, align 8
  %18 = load i64, ptr %4, align 8, !tbaa !9
  %19 = getelementptr inbounds %"class.ngraph::pass::MemoryManager", ptr %17, i32 0, i32 1
  %20 = load i64, ptr %19, align 8, !tbaa !11
  %21 = call noundef i64 @_ZN6ngraph4pass13MemoryManager5alignEmm(i64 noundef %18, i64 noundef %20)
  store i64 %21, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store i64 0, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %22 = call noundef i64 @_ZNSt14numeric_limitsImE3maxEv() #6
  store i64 %22, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %23 = getelementptr inbounds %"class.ngraph::pass::MemoryManager", ptr %17, i32 0, i32 0
  %24 = call ptr @_ZNSt7__cxx114listIN6ngraph4pass13MemoryManager4nodeESaIS4_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %23) #6
  %25 = getelementptr inbounds %"struct.std::_List_iterator", ptr %7, i32 0, i32 0
  store ptr %24, ptr %25, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %26 = load i64, ptr %5, align 8, !tbaa !9
  store i64 %26, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %27 = getelementptr inbounds %"class.ngraph::pass::MemoryManager", ptr %17, i32 0, i32 0
  %28 = call ptr @_ZNSt7__cxx114listIN6ngraph4pass13MemoryManager4nodeESaIS4_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %27) #6
  %29 = getelementptr inbounds %"struct.std::_List_iterator", ptr %9, i32 0, i32 0
  store ptr %28, ptr %29, align 8
  br label %30

30:                                               ; preds = %66, %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %31 = getelementptr inbounds %"class.ngraph::pass::MemoryManager", ptr %17, i32 0, i32 0
  %32 = call ptr @_ZNSt7__cxx114listIN6ngraph4pass13MemoryManager4nodeESaIS4_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %31) #6
  %33 = getelementptr inbounds %"struct.std::_List_iterator", ptr %10, i32 0, i32 0
  store ptr %32, ptr %33, align 8
  %34 = call noundef zeroext i1 @_ZStneRKSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEES6_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br i1 %34, label %36, label %35

35:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %68

36:                                               ; preds = %30
  %37 = call noundef ptr @_ZNKSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  %38 = getelementptr inbounds %"class.ngraph::pass::MemoryManager::node", ptr %37, i32 0, i32 1
  %39 = load i32, ptr %38, align 8, !tbaa !19
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %41, label %60

41:                                               ; preds = %36
  %42 = call noundef ptr @_ZNKSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  %43 = getelementptr inbounds %"class.ngraph::pass::MemoryManager::node", ptr %42, i32 0, i32 0
  %44 = load i64, ptr %43, align 8, !tbaa !22
  %45 = load i64, ptr %4, align 8, !tbaa !9
  %46 = icmp uge i64 %44, %45
  br i1 %46, label %47, label %60

47:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %48 = call noundef ptr @_ZNKSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  %49 = getelementptr inbounds %"class.ngraph::pass::MemoryManager::node", ptr %48, i32 0, i32 0
  %50 = load i64, ptr %49, align 8, !tbaa !22
  %51 = load i64, ptr %4, align 8, !tbaa !9
  %52 = sub i64 %50, %51
  store i64 %52, ptr %11, align 8, !tbaa !9
  %53 = load i64, ptr %11, align 8, !tbaa !9
  %54 = load i64, ptr %6, align 8, !tbaa !9
  %55 = icmp ult i64 %53, %54
  br i1 %55, label %56, label %59

56:                                               ; preds = %47
  %57 = load i64, ptr %11, align 8, !tbaa !9
  store i64 %57, ptr %6, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %7, ptr align 8 %9, i64 8, i1 false), !tbaa.struct !23
  %58 = load i64, ptr %5, align 8, !tbaa !9
  store i64 %58, ptr %8, align 8, !tbaa !9
  br label %59

59:                                               ; preds = %56, %47
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %60

60:                                               ; preds = %59, %41, %36
  %61 = call noundef ptr @_ZNKSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  %62 = getelementptr inbounds %"class.ngraph::pass::MemoryManager::node", ptr %61, i32 0, i32 0
  %63 = load i64, ptr %62, align 8, !tbaa !22
  %64 = load i64, ptr %5, align 8, !tbaa !9
  %65 = add i64 %64, %63
  store i64 %65, ptr %5, align 8, !tbaa !9
  br label %66

66:                                               ; preds = %60
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  br label %30, !llvm.loop !24

68:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %69 = getelementptr inbounds %"class.ngraph::pass::MemoryManager", ptr %17, i32 0, i32 0
  %70 = call ptr @_ZNSt7__cxx114listIN6ngraph4pass13MemoryManager4nodeESaIS4_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %69) #6
  %71 = getelementptr inbounds %"struct.std::_List_iterator", ptr %12, i32 0, i32 0
  store ptr %70, ptr %71, align 8
  %72 = call noundef zeroext i1 @_ZSteqRKSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEES6_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br i1 %72, label %73, label %75

73:                                               ; preds = %68
  %74 = call ptr @__cxa_allocate_exception(i64 8) #6
  call void @_ZNSt9bad_allocC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %74) #6
  call void @__cxa_throw(ptr %74, ptr @_ZTISt9bad_alloc, ptr @_ZNSt9bad_allocD1Ev) #7
  unreachable

75:                                               ; preds = %68
  %76 = load i64, ptr %6, align 8, !tbaa !9
  %77 = icmp eq i64 %76, 0
  br i1 %77, label %78, label %81

78:                                               ; preds = %75
  %79 = call noundef ptr @_ZNKSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  %80 = getelementptr inbounds %"class.ngraph::pass::MemoryManager::node", ptr %79, i32 0, i32 1
  store i32 1, ptr %80, align 8, !tbaa !19
  br label %93

81:                                               ; preds = %75
  %82 = getelementptr inbounds %"class.ngraph::pass::MemoryManager", ptr %17, i32 0, i32 0
  call void @_ZNSt20_List_const_iteratorIN6ngraph4pass13MemoryManager4nodeEEC2ERKSt14_List_iteratorIS3_E(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #6
  %83 = load i64, ptr %4, align 8, !tbaa !9
  call void @_ZN6ngraph4pass13MemoryManager4nodeC1EmNS1_11block_stateE(ptr noundef nonnull align 8 dereferenceable(12) %14, i64 noundef %83, i32 noundef 1)
  %84 = getelementptr inbounds %"struct.std::_List_const_iterator", ptr %13, i32 0, i32 0
  %85 = load ptr, ptr %84, align 8
  %86 = call ptr @_ZNSt7__cxx114listIN6ngraph4pass13MemoryManager4nodeESaIS4_EE6insertESt20_List_const_iteratorIS4_EOS4_(ptr noundef nonnull align 8 dereferenceable(24) %82, ptr %85, ptr noundef nonnull align 8 dereferenceable(12) %14)
  %87 = getelementptr inbounds %"struct.std::_List_iterator", ptr %15, i32 0, i32 0
  store ptr %86, ptr %87, align 8
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #6
  %88 = load i64, ptr %4, align 8, !tbaa !9
  %89 = call noundef ptr @_ZNKSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  %90 = getelementptr inbounds %"class.ngraph::pass::MemoryManager::node", ptr %89, i32 0, i32 0
  %91 = load i64, ptr %90, align 8, !tbaa !22
  %92 = sub i64 %91, %88
  store i64 %92, ptr %90, align 8, !tbaa !22
  br label %93

93:                                               ; preds = %81, %78
  %94 = getelementptr inbounds %"class.ngraph::pass::MemoryManager", ptr %17, i32 0, i32 3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %95 = load i64, ptr %8, align 8, !tbaa !9
  %96 = load i64, ptr %4, align 8, !tbaa !9
  %97 = add i64 %95, %96
  store i64 %97, ptr %16, align 8, !tbaa !9
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %94, ptr noundef nonnull align 8 dereferenceable(8) %16)
  %99 = load i64, ptr %98, align 8, !tbaa !9
  %100 = getelementptr inbounds %"class.ngraph::pass::MemoryManager", ptr %17, i32 0, i32 3
  store i64 %99, ptr %100, align 8, !tbaa !26
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  %101 = load i64, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  ret i64 %101
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN6ngraph4pass13MemoryManager5alignEmm(i64 noundef, i64 noundef) #3 align 2

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt9bad_allocC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

; Function Attrs: nounwind
declare void @_ZNSt9bad_allocD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt7__cxx114listIN6ngraph4pass13MemoryManager4nodeESaIS4_EE6insertESt20_List_const_iteratorIS4_EOS4_(ptr noundef nonnull align 8 dereferenceable(24), ptr, ptr noundef nonnull align 8 dereferenceable(12)) #3 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

declare void @_ZN6ngraph4pass13MemoryManager4nodeC1EmNS1_11block_stateE(ptr, i64, i32)

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { 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 #5 = { inlinehint 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 #6 = { nounwind }
attributes #7 = { noreturn }

!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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 24}
!12 = !{!"_ZTSN6ngraph4pass13MemoryManagerE", !13, i64 0, !10, i64 24, !18, i64 32, !10, i64 40}
!13 = !{!"_ZTSNSt7__cxx114listIN6ngraph4pass13MemoryManager4nodeESaIS4_EEE", !14, i64 0}
!14 = !{!"_ZTSNSt7__cxx1110_List_baseIN6ngraph4pass13MemoryManager4nodeESaIS4_EEE", !15, i64 0}
!15 = !{!"_ZTSNSt7__cxx1110_List_baseIN6ngraph4pass13MemoryManager4nodeESaIS4_EE10_List_implE", !16, i64 0}
!16 = !{!"_ZTSNSt8__detail17_List_node_headerE", !17, i64 0, !10, i64 16}
!17 = !{!"_ZTSNSt8__detail15_List_node_baseE", !6, i64 0, !6, i64 8}
!18 = !{!"_ZTSN6ngraph4pass13MemoryManager17allocation_schemeE", !7, i64 0}
!19 = !{!20, !21, i64 8}
!20 = !{!"_ZTSN6ngraph4pass13MemoryManager4nodeE", !10, i64 0, !21, i64 8}
!21 = !{!"_ZTSN6ngraph4pass13MemoryManager11block_stateE", !7, i64 0}
!22 = !{!20, !10, i64 0}
!23 = !{i64 0, i64 8, !5}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!12, !10, i64 40}


; 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.std::_List_iterator" = type { ptr }
%"struct.std::_List_const_iterator" = type { ptr }
%"class.ngraph::pass::MemoryManager::node" = type <{ i64, i32, [4 x i8] }>

@_ZTISt9bad_alloc = external constant ptr

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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNSt14numeric_limitsImE3maxEv() local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN6ngraph4pass13MemoryManager8best_fitEm(ptr noundef nonnull align 8 dereferenceable(48) %0, i64 noundef %1) local_unnamed_addr #2 align 2 {
  %3 = alloca %"struct.std::_List_iterator", align 8
  %4 = alloca %"struct.std::_List_iterator", align 8
  %5 = alloca %"struct.std::_List_iterator", align 8
  %6 = alloca %"struct.std::_List_iterator", align 8
  %7 = alloca %"struct.std::_List_const_iterator", align 8
  %8 = alloca %"class.ngraph::pass::MemoryManager::node", align 8
  %9 = alloca i64, align 8
  %10 = getelementptr inbounds i8, ptr %0, i64 24
  %11 = load i64, ptr %10, align 8, !tbaa !5
  %12 = tail call noundef i64 @_ZN6ngraph4pass13MemoryManager5alignEmm(i64 noundef %1, i64 noundef %11)
  %13 = tail call noundef i64 @_ZNSt14numeric_limitsImE3maxEv() #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %14 = tail call ptr @_ZNSt7__cxx114listIN6ngraph4pass13MemoryManager4nodeESaIS4_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  store ptr %14, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %15 = tail call ptr @_ZNSt7__cxx114listIN6ngraph4pass13MemoryManager4nodeESaIS4_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  store ptr %15, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %16 = tail call ptr @_ZNSt7__cxx114listIN6ngraph4pass13MemoryManager4nodeESaIS4_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  store ptr %16, ptr %5, align 8
  %17 = call noundef zeroext i1 @_ZStneRKSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEES6_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br i1 %17, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %34, %2
  %.016.lcssa = phi i64 [ %13, %2 ], [ %.218, %34 ]
  %.015.lcssa = phi i64 [ 0, %2 ], [ %.2, %34 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %18 = call ptr @_ZNSt7__cxx114listIN6ngraph4pass13MemoryManager4nodeESaIS4_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  store ptr %18, ptr %6, align 8
  %19 = call noundef zeroext i1 @_ZSteqRKSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEES6_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br i1 %19, label %41, label %43

.lr.ph:                                           ; preds = %2, %34
  %.023 = phi i64 [ %37, %34 ], [ 0, %2 ]
  %.01522 = phi i64 [ %.2, %34 ], [ 0, %2 ]
  %.01621 = phi i64 [ %.218, %34 ], [ %13, %2 ]
  %20 = call noundef ptr @_ZNKSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  %21 = getelementptr inbounds i8, ptr %20, i64 8
  %22 = load i32, ptr %21, align 8, !tbaa !17
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %34

24:                                               ; preds = %.lr.ph
  %25 = call noundef ptr @_ZNKSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  %26 = load i64, ptr %25, align 8, !tbaa !20
  %.not = icmp ult i64 %26, %12
  br i1 %.not, label %34, label %27

27:                                               ; preds = %24
  %28 = call noundef ptr @_ZNKSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  %29 = load i64, ptr %28, align 8, !tbaa !20
  %30 = sub i64 %29, %12
  %31 = icmp ult i64 %30, %.01621
  br i1 %31, label %32, label %34

32:                                               ; preds = %27
  %33 = load i64, ptr %4, align 8, !tbaa !21
  store i64 %33, ptr %3, align 8, !tbaa !21
  br label %34

34:                                               ; preds = %27, %32, %24, %.lr.ph
  %.218 = phi i64 [ %.01621, %24 ], [ %.01621, %.lr.ph ], [ %30, %32 ], [ %.01621, %27 ]
  %.2 = phi i64 [ %.01522, %24 ], [ %.01522, %.lr.ph ], [ %.023, %32 ], [ %.01522, %27 ]
  %35 = call noundef ptr @_ZNKSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  %36 = load i64, ptr %35, align 8, !tbaa !20
  %37 = add i64 %36, %.023
  %38 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %39 = call ptr @_ZNSt7__cxx114listIN6ngraph4pass13MemoryManager4nodeESaIS4_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  store ptr %39, ptr %5, align 8
  %40 = call noundef zeroext i1 @_ZStneRKSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEES6_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br i1 %40, label %.lr.ph, label %._crit_edge, !llvm.loop !22

41:                                               ; preds = %._crit_edge
  %42 = call ptr @__cxa_allocate_exception(i64 8) #5
  call void @_ZNSt9bad_allocC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %42) #5
  call void @__cxa_throw(ptr nonnull %42, ptr nonnull @_ZTISt9bad_alloc, ptr nonnull @_ZNSt9bad_allocD1Ev) #6
  unreachable

43:                                               ; preds = %._crit_edge
  %44 = icmp eq i64 %.016.lcssa, 0
  br i1 %44, label %45, label %48

45:                                               ; preds = %43
  %46 = call noundef ptr @_ZNKSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %47 = getelementptr inbounds i8, ptr %46, i64 8
  store i32 1, ptr %47, align 8, !tbaa !17
  br label %54

48:                                               ; preds = %43
  call void @_ZNSt20_List_const_iteratorIN6ngraph4pass13MemoryManager4nodeEEC2ERKSt14_List_iteratorIS3_E(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #5
  call void @_ZN6ngraph4pass13MemoryManager4nodeC1EmNS1_11block_stateE(ptr noundef nonnull align 8 dereferenceable(12) %8, i64 noundef %12, i32 noundef 1)
  %49 = load ptr, ptr %7, align 8
  %50 = call ptr @_ZNSt7__cxx114listIN6ngraph4pass13MemoryManager4nodeESaIS4_EE6insertESt20_List_const_iteratorIS4_EOS4_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr %49, ptr noundef nonnull align 8 dereferenceable(12) %8)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #5
  %51 = call noundef ptr @_ZNKSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %52 = load i64, ptr %51, align 8, !tbaa !20
  %53 = sub i64 %52, %12
  store i64 %53, ptr %51, align 8, !tbaa !20
  br label %54

54:                                               ; preds = %48, %45
  %55 = getelementptr inbounds i8, ptr %0, i64 40
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #5
  %56 = add i64 %.015.lcssa, %12
  store i64 %56, ptr %9, align 8, !tbaa !24
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %55, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %58 = load i64, ptr %57, align 8, !tbaa !24
  store i64 %58, ptr %55, align 8, !tbaa !25
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  ret i64 %.015.lcssa
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN6ngraph4pass13MemoryManager5alignEmm(i64 noundef, i64 noundef) local_unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEES6_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSteqRKSt14_List_iteratorIN6ngraph4pass13MemoryManager4nodeEES6_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt9bad_allocC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

; Function Attrs: nounwind
declare void @_ZNSt9bad_allocD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt7__cxx114listIN6ngraph4pass13MemoryManager4nodeESaIS4_EE6insertESt20_List_const_iteratorIS4_EOS4_(ptr noundef nonnull align 8 dereferenceable(24), ptr, ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt20_List_const_iteratorIN6ngraph4pass13MemoryManager4nodeEEC2ERKSt14_List_iteratorIS3_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

declare void @_ZN6ngraph4pass13MemoryManager4nodeC1EmNS1_11block_stateE(ptr, i64, i32) local_unnamed_addr

attributes #0 = { mustprogress 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 = { 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 #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 = { inlinehint 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 #5 = { nounwind }
attributes #6 = { noreturn }

!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, !15, i64 24}
!6 = !{!"_ZTSN6ngraph4pass13MemoryManagerE", !7, i64 0, !15, i64 24, !16, i64 32, !15, i64 40}
!7 = !{!"_ZTSNSt7__cxx114listIN6ngraph4pass13MemoryManager4nodeESaIS4_EEE", !8, i64 0}
!8 = !{!"_ZTSNSt7__cxx1110_List_baseIN6ngraph4pass13MemoryManager4nodeESaIS4_EEE", !9, i64 0}
!9 = !{!"_ZTSNSt7__cxx1110_List_baseIN6ngraph4pass13MemoryManager4nodeESaIS4_EE10_List_implE", !10, i64 0}
!10 = !{!"_ZTSNSt8__detail17_List_node_headerE", !11, i64 0, !15, i64 16}
!11 = !{!"_ZTSNSt8__detail15_List_node_baseE", !12, i64 0, !12, i64 8}
!12 = !{!"any pointer", !13, i64 0}
!13 = !{!"omnipotent char", !14, i64 0}
!14 = !{!"Simple C++ TBAA"}
!15 = !{!"long", !13, i64 0}
!16 = !{!"_ZTSN6ngraph4pass13MemoryManager17allocation_schemeE", !13, i64 0}
!17 = !{!18, !19, i64 8}
!18 = !{!"_ZTSN6ngraph4pass13MemoryManager4nodeE", !15, i64 0, !19, i64 8}
!19 = !{!"_ZTSN6ngraph4pass13MemoryManager11block_stateE", !13, i64 0}
!20 = !{!18, !15, i64 0}
!21 = !{!12, !12, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!15, !15, i64 0}
!25 = !{!6, !15, i64 40}


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