; LLVM IR from TheAlgorithms/C-Plus-Plus :: data_structures/linked_list.ll (ZN15data_structures11linked_list4list5eraseEi)

; 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.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.data_structures::linked_list::list" = type { %"class.std::shared_ptr", %"class.std::shared_ptr" }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [19 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN15data_structures11linked_list4list5eraseEi(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef %1) #3 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::shared_ptr", align 8
  %6 = alloca %"class.std::shared_ptr", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"class.std::shared_ptr", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %11 = load ptr, ptr %3, align 8
  %12 = call noundef zeroext i1 @_ZN15data_structures11linked_list4list7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(32) %11)
  br i1 %12, label %13, label %15

13:                                               ; preds = %2
  %14 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  br label %78

15:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #5
  %16 = getelementptr inbounds %"class.data_structures::linked_list::list", ptr %11, i32 0, i32 0
  call void @_ZNSt10shared_ptrIN15data_structures11linked_list4linkEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %16) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #5
  call void @_ZNSt10shared_ptrIN15data_structures11linked_list4linkEEC2EDn(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr null) #5
  br label %17

17:                                               ; preds = %34, %15
  %18 = getelementptr inbounds %"class.data_structures::linked_list::list", ptr %11, i32 0, i32 1
  %19 = call noundef zeroext i1 @_ZStneIN15data_structures11linked_list4linkES2_EbRKSt10shared_ptrIT_ERKS3_IT0_E(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %18) #5
  br i1 %19, label %20, label %29

20:                                               ; preds = %17
  %21 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  %22 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN15data_structures11linked_list4link4succEv(ptr noundef nonnull align 8 dereferenceable(24) %21)
          to label %23 unwind label %36

23:                                               ; preds = %20
  %24 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %22) #5
  %25 = invoke noundef i32 @_ZN15data_structures11linked_list4link3valEv(ptr noundef nonnull align 8 dereferenceable(24) %24)
          to label %26 unwind label %36

26:                                               ; preds = %23
  %27 = load i32, ptr %4, align 4, !tbaa !9
  %28 = icmp ne i32 %25, %27
  br label %29

29:                                               ; preds = %26, %17
  %30 = phi i1 [ false, %17 ], [ %28, %26 ]
  br i1 %30, label %31, label %40

31:                                               ; preds = %29
  %32 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  %33 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN15data_structures11linked_list4link4succEv(ptr noundef nonnull align 8 dereferenceable(24) %32)
          to label %34 unwind label %36

34:                                               ; preds = %31
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN15data_structures11linked_list4linkEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %33) #5
  br label %17, !llvm.loop !11

36:                                               ; preds = %59, %56, %53, %49, %46, %43, %31, %23, %20
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %7, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %8, align 4
  call void @_ZNSt12__shared_ptrIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #5
  call void @_ZNSt12__shared_ptrIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #5
  br label %79

40:                                               ; preds = %29
  %41 = getelementptr inbounds %"class.data_structures::linked_list::list", ptr %11, i32 0, i32 1
  %42 = call noundef zeroext i1 @_ZSteqIN15data_structures11linked_list4linkES2_EbRKSt10shared_ptrIT_ERKS3_IT0_E(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %41) #5
  br i1 %42, label %43, label %46

43:                                               ; preds = %40
  %44 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
          to label %45 unwind label %36

45:                                               ; preds = %43
  store i32 1, ptr %9, align 4
  br label %76

46:                                               ; preds = %40
  %47 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  %48 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN15data_structures11linked_list4link4succEv(ptr noundef nonnull align 8 dereferenceable(24) %47)
          to label %49 unwind label %36

49:                                               ; preds = %46
  %50 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN15data_structures11linked_list4linkEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %48) #5
  %51 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  %52 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN15data_structures11linked_list4link4succEv(ptr noundef nonnull align 8 dereferenceable(24) %51)
          to label %53 unwind label %36

53:                                               ; preds = %49
  %54 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %52) #5
  %55 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN15data_structures11linked_list4link4succEv(ptr noundef nonnull align 8 dereferenceable(24) %54)
          to label %56 unwind label %36

56:                                               ; preds = %53
  %57 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  %58 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN15data_structures11linked_list4link4succEv(ptr noundef nonnull align 8 dereferenceable(24) %57)
          to label %59 unwind label %36

59:                                               ; preds = %56
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN15data_structures11linked_list4linkEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %58, ptr noundef nonnull align 8 dereferenceable(16) %55) #5
  call void @_ZNSt12__shared_ptrIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2EE5resetEv(ptr noundef nonnull align 8 dereferenceable(16) %6) #5
  %61 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  %62 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN15data_structures11linked_list4link4succEv(ptr noundef nonnull align 8 dereferenceable(24) %61)
          to label %63 unwind label %36

63:                                               ; preds = %59
  %64 = call noundef zeroext i1 @_ZSteqIN15data_structures11linked_list4linkEEbRKSt10shared_ptrIT_EDn(ptr noundef nonnull align 8 dereferenceable(16) %62, ptr null) #5
  br i1 %64, label %65, label %68

65:                                               ; preds = %63
  %66 = getelementptr inbounds %"class.data_structures::linked_list::list", ptr %11, i32 0, i32 1
  %67 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN15data_structures11linked_list4linkEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %66, ptr noundef nonnull align 8 dereferenceable(16) %5) #5
  br label %68

68:                                               ; preds = %65, %63
  %69 = getelementptr inbounds %"class.data_structures::linked_list::list", ptr %11, i32 0, i32 0
  %70 = getelementptr inbounds %"class.data_structures::linked_list::list", ptr %11, i32 0, i32 1
  %71 = call noundef zeroext i1 @_ZSteqIN15data_structures11linked_list4linkES2_EbRKSt10shared_ptrIT_ERKS3_IT0_E(ptr noundef nonnull align 8 dereferenceable(16) %69, ptr noundef nonnull align 8 dereferenceable(16) %70) #5
  br i1 %71, label %72, label %75

72:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #5
  call void @_ZNSt10shared_ptrIN15data_structures11linked_list4linkEEC2EDn(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr null) #5
  %73 = getelementptr inbounds %"class.data_structures::linked_list::list", ptr %11, i32 0, i32 1
  %74 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN15data_structures11linked_list4linkEEaSEOS3_(ptr noundef nonnull align 8 dereferenceable(16) %73, ptr noundef nonnull align 8 dereferenceable(16) %10) #5
  call void @_ZNSt12__shared_ptrIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #5
  br label %75

75:                                               ; preds = %72, %68
  store i32 0, ptr %9, align 4
  br label %76

76:                                               ; preds = %75, %45
  call void @_ZNSt12__shared_ptrIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #5
  call void @_ZNSt12__shared_ptrIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #5
  %77 = load i32, ptr %9, align 4
  switch i32 %77, label %84 [
    i32 0, label %78
    i32 1, label %78
  ]

78:                                               ; preds = %76, %76, %13
  ret void

79:                                               ; preds = %36
  %80 = load ptr, ptr %7, align 8
  %81 = load i32, ptr %8, align 4
  %82 = insertvalue { ptr, i32 } poison, ptr %80, 0
  %83 = insertvalue { ptr, i32 } %82, i32 %81, 1
  resume { ptr, i32 } %83

84:                                               ; preds = %76
  unreachable
}

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

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

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

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

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

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

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

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

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 = { 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 #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 = { inlinehint 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 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [19 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN15data_structures11linked_list4list5eraseEi(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef %1) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::shared_ptr", align 8
  %4 = alloca %"class.std::shared_ptr", align 8
  %5 = alloca %"class.std::shared_ptr", align 8
  %6 = tail call noundef zeroext i1 @_ZN15data_structures11linked_list4list7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  br i1 %6, label %7, label %9

7:                                                ; preds = %2
  %8 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  br label %47

9:                                                ; preds = %2
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #5
  call void @_ZNSt10shared_ptrIN15data_structures11linked_list4linkEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %0) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  call void @_ZNSt10shared_ptrIN15data_structures11linked_list4linkEEC2EDn(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr null) #5
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  %11 = call noundef zeroext i1 @_ZStneIN15data_structures11linked_list4linkES2_EbRKSt10shared_ptrIT_ERKS3_IT0_E(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %10) #5
  br i1 %11, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %9, %16
  %12 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN15data_structures11linked_list4link4succEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
  %14 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %13) #5
  %15 = call noundef i32 @_ZN15data_structures11linked_list4link3valEv(ptr noundef nonnull align 8 dereferenceable(24) %14)
  %.not = icmp eq i32 %15, %1
  br i1 %.not, label %.critedge, label %16

16:                                               ; preds = %.lr.ph
  %17 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN15data_structures11linked_list4link4succEv(ptr noundef nonnull align 8 dereferenceable(24) %17)
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN15data_structures11linked_list4linkEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %18) #5
  %20 = call noundef zeroext i1 @_ZStneIN15data_structures11linked_list4linkES2_EbRKSt10shared_ptrIT_ERKS3_IT0_E(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %10) #5
  br i1 %20, label %.lr.ph, label %.critedge, !llvm.loop !5

21:                                               ; preds = %24
  %22 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt12__shared_ptrIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  call void @_ZNSt12__shared_ptrIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #5
  resume { ptr, i32 } %22

.critedge:                                        ; preds = %.lr.ph, %16, %9
  %23 = call noundef zeroext i1 @_ZSteqIN15data_structures11linked_list4linkES2_EbRKSt10shared_ptrIT_ERKS3_IT0_E(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %10) #5
  br i1 %23, label %24, label %26

24:                                               ; preds = %.critedge
  %25 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.1)
          to label %46 unwind label %21

26:                                               ; preds = %.critedge
  %27 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN15data_structures11linked_list4link4succEv(ptr noundef nonnull align 8 dereferenceable(24) %27)
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN15data_structures11linked_list4linkEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(16) %28) #5
  %30 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN15data_structures11linked_list4link4succEv(ptr noundef nonnull align 8 dereferenceable(24) %30)
  %32 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %31) #5
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN15data_structures11linked_list4link4succEv(ptr noundef nonnull align 8 dereferenceable(24) %32)
  %34 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN15data_structures11linked_list4link4succEv(ptr noundef nonnull align 8 dereferenceable(24) %34)
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN15data_structures11linked_list4linkEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %35, ptr noundef nonnull align 8 dereferenceable(16) %33) #5
  call void @_ZNSt12__shared_ptrIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2EE5resetEv(ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  %37 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  %38 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN15data_structures11linked_list4link4succEv(ptr noundef nonnull align 8 dereferenceable(24) %37)
  %39 = call noundef zeroext i1 @_ZSteqIN15data_structures11linked_list4linkEEbRKSt10shared_ptrIT_EDn(ptr noundef nonnull align 8 dereferenceable(16) %38, ptr null) #5
  br i1 %39, label %40, label %42

40:                                               ; preds = %26
  %41 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN15data_structures11linked_list4linkEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(16) %3) #5
  br label %42

42:                                               ; preds = %40, %26
  %43 = call noundef zeroext i1 @_ZSteqIN15data_structures11linked_list4linkES2_EbRKSt10shared_ptrIT_ERKS3_IT0_E(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %10) #5
  br i1 %43, label %44, label %46

44:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #5
  call void @_ZNSt10shared_ptrIN15data_structures11linked_list4linkEEC2EDn(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr null) #5
  %45 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN15data_structures11linked_list4linkEEaSEOS3_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(16) %5) #5
  call void @_ZNSt12__shared_ptrIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  br label %46

46:                                               ; preds = %42, %44, %24
  call void @_ZNSt12__shared_ptrIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  call void @_ZNSt12__shared_ptrIN15data_structures11linked_list4linkELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #5
  br label %47

47:                                               ; preds = %46, %7
  ret void
}

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

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

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

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

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

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

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

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

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 = { 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 #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 = { inlinehint 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 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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