; LLVM IR from FOSS-UCSC/FOSSALGO :: data-structures/ds-dlinklst/cpp (doublelinkedlist)

; 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.Node = type { i32, %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", ptr, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@head = external dso_local global ptr, align 8

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

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

; 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
define dso_local void @_Z6DeleteNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %6 = load ptr, ptr @head, align 8, !tbaa !5
  store ptr %6, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  store ptr null, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = icmp ne ptr %7, null
  br i1 %8, label %9, label %32

9:                                                ; preds = %1
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %class.Node, ptr %10, i32 0, i32 1
  %12 = call noundef zeroext i1 @_ZSteqIcEN9__gnu_cxx11__enable_ifIXsr9__is_charIT_EE7__valueEbE6__typeERKNSt7__cxx1112basic_stringIS2_St11char_traitsIS2_ESaIS2_EEESC_(ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef nonnull align 8 dereferenceable(32) %0) #4
  br i1 %12, label %13, label %32

13:                                               ; preds = %9
  %14 = load ptr, ptr @head, align 8, !tbaa !5
  %15 = getelementptr inbounds %class.Node, ptr %14, i32 0, i32 4
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = icmp ne ptr %16, null
  br i1 %17, label %18, label %30

18:                                               ; preds = %13
  %19 = load ptr, ptr @head, align 8, !tbaa !5
  %20 = getelementptr inbounds %class.Node, ptr %19, i32 0, i32 4
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  %22 = getelementptr inbounds %class.Node, ptr %21, i32 0, i32 5
  store ptr null, ptr %22, align 8, !tbaa !15
  %23 = load ptr, ptr @head, align 8, !tbaa !5
  %24 = getelementptr inbounds %class.Node, ptr %23, i32 0, i32 4
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  store ptr %25, ptr @head, align 8, !tbaa !5
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = icmp eq ptr %26, null
  br i1 %27, label %29, label %28

28:                                               ; preds = %18
  call void @_ZN4NodeD2Ev(ptr noundef nonnull align 8 dereferenceable(120) %26) #4
  call void @_ZdlPvm(ptr noundef %26, i64 noundef 120) #5
  br label %29

29:                                               ; preds = %28, %18
  store i32 1, ptr %5, align 4
  br label %78

30:                                               ; preds = %13
  store ptr null, ptr @head, align 8, !tbaa !5
  br label %31

31:                                               ; preds = %30
  br label %32

32:                                               ; preds = %31, %9, %1
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %35, label %77

35:                                               ; preds = %32
  br label %36

36:                                               ; preds = %45, %35
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %class.Node, ptr %37, i32 0, i32 1
  %39 = call noundef zeroext i1 @_ZStneIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32) %38, ptr noundef nonnull align 8 dereferenceable(32) %0) #4
  br i1 %39, label %40, label %43

40:                                               ; preds = %36
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = icmp ne ptr %41, null
  br label %43

43:                                               ; preds = %40, %36
  %44 = phi i1 [ false, %36 ], [ %42, %40 ]
  br i1 %44, label %45, label %50

45:                                               ; preds = %43
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %46, ptr %4, align 8, !tbaa !5
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %class.Node, ptr %47, i32 0, i32 4
  %49 = load ptr, ptr %48, align 8, !tbaa !9
  store ptr %49, ptr %3, align 8, !tbaa !5
  br label %36, !llvm.loop !16

50:                                               ; preds = %43
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %class.Node, ptr %51, i32 0, i32 4
  %53 = load ptr, ptr %52, align 8, !tbaa !9
  %54 = icmp ne ptr %53, null
  br i1 %54, label %55, label %70

55:                                               ; preds = %50
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %class.Node, ptr %56, i32 0, i32 4
  %58 = load ptr, ptr %57, align 8, !tbaa !9
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %class.Node, ptr %59, i32 0, i32 4
  store ptr %58, ptr %60, align 8, !tbaa !9
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %class.Node, ptr %62, i32 0, i32 4
  %64 = load ptr, ptr %63, align 8, !tbaa !9
  %65 = getelementptr inbounds %class.Node, ptr %64, i32 0, i32 5
  store ptr %61, ptr %65, align 8, !tbaa !15
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = icmp eq ptr %66, null
  br i1 %67, label %69, label %68

68:                                               ; preds = %55
  call void @_ZN4NodeD2Ev(ptr noundef nonnull align 8 dereferenceable(120) %66) #4
  call void @_ZdlPvm(ptr noundef %66, i64 noundef 120) #5
  br label %69

69:                                               ; preds = %68, %55
  store i32 1, ptr %5, align 4
  br label %78

70:                                               ; preds = %50
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %class.Node, ptr %71, i32 0, i32 4
  store ptr null, ptr %72, align 8, !tbaa !9
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  %74 = icmp eq ptr %73, null
  br i1 %74, label %76, label %75

75:                                               ; preds = %70
  call void @_ZN4NodeD2Ev(ptr noundef nonnull align 8 dereferenceable(120) %73) #4
  call void @_ZdlPvm(ptr noundef %73, i64 noundef 120) #5
  br label %76

76:                                               ; preds = %75, %70
  store i32 1, ptr %5, align 4
  br label %78

77:                                               ; preds = %32
  store i32 0, ptr %5, align 4
  br label %78

78:                                               ; preds = %77, %76, %69, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  %79 = load i32, ptr %5, align 4
  switch i32 %79, label %81 [
    i32 0, label %80
    i32 1, label %80
  ]

80:                                               ; preds = %78, %78
  ret void

81:                                               ; preds = %78
  unreachable
}

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #4 = { nounwind }
attributes #5 = { 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 = !{!10, !6, i64 104}
!10 = !{!"_ZTS4Node", !11, i64 0, !12, i64 8, !12, i64 40, !12, i64 72, !6, i64 104, !6, i64 112}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !13, i64 0, !14, i64 8, !7, i64 16}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!10, !6, i64 112}
!16 = distinct !{!16, !17}
!17 = !{!"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"

@head = external dso_local local_unnamed_addr global ptr, align 8

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z6DeleteNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef %0) local_unnamed_addr #1 {
  %2 = load ptr, ptr @head, align 8, !tbaa !5
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %.critedge, label %3

3:                                                ; preds = %1
  %4 = getelementptr inbounds i8, ptr %2, i64 8
  %5 = tail call noundef zeroext i1 @_ZSteqIcEN9__gnu_cxx11__enable_ifIXsr9__is_charIT_EE7__valueEbE6__typeERKNSt7__cxx1112basic_stringIS2_St11char_traitsIS2_ESaIS2_EEESC_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 8 dereferenceable(32) %0) #3
  br i1 %5, label %6, label %13

6:                                                ; preds = %3
  %7 = load ptr, ptr @head, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 104
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  %.not20 = icmp eq ptr %9, null
  br i1 %.not20, label %12, label %10

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %9, i64 112
  store ptr null, ptr %11, align 8, !tbaa !15
  store ptr %9, ptr @head, align 8, !tbaa !5
  br label %.critedge.sink.split

12:                                               ; preds = %6
  store ptr null, ptr @head, align 8, !tbaa !5
  br label %13

13:                                               ; preds = %12, %3
  %14 = tail call noundef zeroext i1 @_ZStneIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 8 dereferenceable(32) %0) #3
  br i1 %14, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %13, %.lr.ph
  %.01622 = phi ptr [ %16, %.lr.ph ], [ %2, %13 ]
  %15 = getelementptr inbounds i8, ptr %.01622, i64 104
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = getelementptr inbounds i8, ptr %16, i64 8
  %18 = tail call noundef zeroext i1 @_ZStneIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32) %17, ptr noundef nonnull align 8 dereferenceable(32) %0) #3
  %19 = icmp ne ptr %16, null
  %20 = and i1 %19, %18
  br i1 %20, label %.lr.ph, label %._crit_edge, !llvm.loop !16

._crit_edge:                                      ; preds = %.lr.ph, %13
  %.016.lcssa = phi ptr [ %2, %13 ], [ %16, %.lr.ph ]
  %.0.lcssa = phi ptr [ null, %13 ], [ %.01622, %.lr.ph ]
  %21 = getelementptr inbounds i8, ptr %.016.lcssa, i64 104
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  %.not21 = icmp eq ptr %22, null
  %23 = getelementptr inbounds i8, ptr %.0.lcssa, i64 104
  br i1 %.not21, label %27, label %24

24:                                               ; preds = %._crit_edge
  store ptr %22, ptr %23, align 8, !tbaa !9
  %25 = load ptr, ptr %21, align 8, !tbaa !9
  %26 = getelementptr inbounds i8, ptr %25, i64 112
  store ptr %.0.lcssa, ptr %26, align 8, !tbaa !15
  br label %.critedge.sink.split

27:                                               ; preds = %._crit_edge
  store ptr null, ptr %23, align 8, !tbaa !9
  br label %.critedge.sink.split

.critedge.sink.split:                             ; preds = %10, %24, %27
  %.016.lcssa.sink24 = phi ptr [ %.016.lcssa, %27 ], [ %.016.lcssa, %24 ], [ %2, %10 ]
  tail call void @_ZN4NodeD2Ev(ptr noundef nonnull align 8 dereferenceable(120) %.016.lcssa.sink24) #3
  tail call void @_ZdlPvm(ptr noundef nonnull %.016.lcssa.sink24, i64 noundef 120) #4
  br label %.critedge

.critedge:                                        ; preds = %.critedge.sink.split, %1
  ret void
}

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

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

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

attributes #0 = { 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 #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 = { 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)"}
!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 104}
!10 = !{!"_ZTS4Node", !11, i64 0, !12, i64 8, !12, i64 40, !12, i64 72, !6, i64 104, !6, i64 112}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !13, i64 0, !14, i64 8, !7, i64 16}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!10, !6, i64 112}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


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