; LLVM IR from devparthgarg/Data-Structures-and-Algorithms :: 15. Binary Tree/19 Tree Traversal in Spiral Form/19a.ll (Z6spiralP4Node)

; 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::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<Node *, std::allocator<Node *>>::_Deque_impl" }
%"struct.std::_Deque_base<Node *, std::allocator<Node *>>::_Deque_impl" = type { %"struct.std::_Deque_base<Node *, std::allocator<Node *>>::_Deque_impl_data" }
%"struct.std::_Deque_base<Node *, std::allocator<Node *>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%class.Node = type { i32, ptr, ptr }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6spiralP4Node(ptr noundef %0) #0 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %"class.std::stack", align 8
  %4 = alloca %"class.std::stack", align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = icmp eq ptr %9, null
  br i1 %10, label %11, label %12

11:                                               ; preds = %1
  br label %113

12:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 80, ptr %3) #6
  call void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  call void @llvm.lifetime.start.p0(i64 80, ptr %4) #6
  invoke void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
          to label %13 unwind label %50

13:                                               ; preds = %12
  invoke void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %14 unwind label %54

14:                                               ; preds = %13
  br label %15

15:                                               ; preds = %111, %14
  %16 = invoke noundef i64 @_ZNKSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %17 unwind label %54

17:                                               ; preds = %15
  %18 = icmp ne i64 %16, 0
  br i1 %18, label %23, label %19

19:                                               ; preds = %17
  %20 = invoke noundef i64 @_ZNKSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
          to label %21 unwind label %54

21:                                               ; preds = %19
  %22 = icmp ne i64 %20, 0
  br label %23

23:                                               ; preds = %21, %17
  %24 = phi i1 [ true, %17 ], [ %22, %21 ]
  br i1 %24, label %25, label %112

25:                                               ; preds = %23
  br label %26

26:                                               ; preds = %71, %25
  %27 = invoke noundef i64 @_ZNKSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %28 unwind label %54

28:                                               ; preds = %26
  %29 = icmp ne i64 %27, 0
  br i1 %29, label %30, label %72

30:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %31 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %32 unwind label %58

32:                                               ; preds = %30
  %33 = load ptr, ptr %31, align 8, !tbaa !5
  store ptr %33, ptr %7, align 8, !tbaa !5
  invoke void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %34 unwind label %58

34:                                               ; preds = %32
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = getelementptr inbounds %class.Node, ptr %35, i32 0, i32 0
  %37 = load i32, ptr %36, align 8, !tbaa !9
  %38 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %37)
          to label %39 unwind label %58

39:                                               ; preds = %34
  %40 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %38, ptr noundef @.str)
          to label %41 unwind label %58

41:                                               ; preds = %39
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = getelementptr inbounds %class.Node, ptr %42, i32 0, i32 2
  %44 = load ptr, ptr %43, align 8, !tbaa !12
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %62

46:                                               ; preds = %41
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = getelementptr inbounds %class.Node, ptr %47, i32 0, i32 2
  invoke void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %4, ptr noundef nonnull align 8 dereferenceable(8) %48)
          to label %49 unwind label %58

49:                                               ; preds = %46
  br label %62

50:                                               ; preds = %12
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %5, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %6, align 4
  br label %115

54:                                               ; preds = %73, %26, %19, %15, %13
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %5, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %6, align 4
  br label %114

58:                                               ; preds = %67, %46, %39, %34, %32, %30
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %5, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %114

62:                                               ; preds = %49, %41
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  %64 = getelementptr inbounds %class.Node, ptr %63, i32 0, i32 1
  %65 = load ptr, ptr %64, align 8, !tbaa !13
  %66 = icmp ne ptr %65, null
  br i1 %66, label %67, label %71

67:                                               ; preds = %62
  %68 = load ptr, ptr %7, align 8, !tbaa !5
  %69 = getelementptr inbounds %class.Node, ptr %68, i32 0, i32 1
  invoke void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %4, ptr noundef nonnull align 8 dereferenceable(8) %69)
          to label %70 unwind label %58

70:                                               ; preds = %67
  br label %71

71:                                               ; preds = %70, %62
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %26, !llvm.loop !14

72:                                               ; preds = %28
  br label %73

73:                                               ; preds = %110, %72
  %74 = invoke noundef i64 @_ZNKSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
          to label %75 unwind label %54

75:                                               ; preds = %73
  %76 = icmp ne i64 %74, 0
  br i1 %76, label %77, label %111

77:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %78 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
          to label %79 unwind label %97

79:                                               ; preds = %77
  %80 = load ptr, ptr %78, align 8, !tbaa !5
  store ptr %80, ptr %8, align 8, !tbaa !5
  invoke void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
          to label %81 unwind label %97

81:                                               ; preds = %79
  %82 = load ptr, ptr %8, align 8, !tbaa !5
  %83 = getelementptr inbounds %class.Node, ptr %82, i32 0, i32 0
  %84 = load i32, ptr %83, align 8, !tbaa !9
  %85 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %84)
          to label %86 unwind label %97

86:                                               ; preds = %81
  %87 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %85, ptr noundef @.str)
          to label %88 unwind label %97

88:                                               ; preds = %86
  %89 = load ptr, ptr %8, align 8, !tbaa !5
  %90 = getelementptr inbounds %class.Node, ptr %89, i32 0, i32 1
  %91 = load ptr, ptr %90, align 8, !tbaa !13
  %92 = icmp ne ptr %91, null
  br i1 %92, label %93, label %101

93:                                               ; preds = %88
  %94 = load ptr, ptr %8, align 8, !tbaa !5
  %95 = getelementptr inbounds %class.Node, ptr %94, i32 0, i32 1
  invoke void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %95)
          to label %96 unwind label %97

96:                                               ; preds = %93
  br label %101

97:                                               ; preds = %106, %93, %86, %81, %79, %77
  %98 = landingpad { ptr, i32 }
          cleanup
  %99 = extractvalue { ptr, i32 } %98, 0
  store ptr %99, ptr %5, align 8
  %100 = extractvalue { ptr, i32 } %98, 1
  store i32 %100, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %114

101:                                              ; preds = %96, %88
  %102 = load ptr, ptr %8, align 8, !tbaa !5
  %103 = getelementptr inbounds %class.Node, ptr %102, i32 0, i32 2
  %104 = load ptr, ptr %103, align 8, !tbaa !12
  %105 = icmp ne ptr %104, null
  br i1 %105, label %106, label %110

106:                                              ; preds = %101
  %107 = load ptr, ptr %8, align 8, !tbaa !5
  %108 = getelementptr inbounds %class.Node, ptr %107, i32 0, i32 2
  invoke void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %108)
          to label %109 unwind label %97

109:                                              ; preds = %106
  br label %110

110:                                              ; preds = %109, %101
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %73, !llvm.loop !16

111:                                              ; preds = %75
  br label %15, !llvm.loop !17

112:                                              ; preds = %23
  call void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %4) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %4) #6
  call void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #6
  br label %113

113:                                              ; preds = %112, %11
  ret void

114:                                              ; preds = %97, %58, %54
  call void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %4) #6
  br label %115

115:                                              ; preds = %114, %50
  call void @llvm.lifetime.end.p0(i64 80, ptr %4) #6
  call void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #6
  br label %116

116:                                              ; preds = %115
  %117 = load ptr, ptr %5, align 8
  %118 = load i32, ptr %6, align 4
  %119 = insertvalue { ptr, i32 } poison, ptr %117, 0
  %120 = insertvalue { ptr, i32 } %119, i32 %118, 1
  resume { ptr, i32 } %120
}

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

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

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

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

; 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) #3

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #5 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 = { nocallback nofree nosync 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 = { 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 #4 = { "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 }

!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, !11, i64 0}
!10 = !{!"_ZTS4Node", !11, i64 0, !6, i64 8, !6, i64 16}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 16}
!13 = !{!10, !6, i64 8}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}


; 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::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<Node *, std::allocator<Node *>>::_Deque_impl" }
%"struct.std::_Deque_base<Node *, std::allocator<Node *>>::_Deque_impl" = type { %"struct.std::_Deque_base<Node *, std::allocator<Node *>>::_Deque_impl_data" }
%"struct.std::_Deque_base<Node *, std::allocator<Node *>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6spiralP4Node(ptr noundef %0) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %"class.std::stack", align 8
  %4 = alloca %"class.std::stack", align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = icmp eq ptr %0, null
  br i1 %5, label %54, label %6

6:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %3) #6
  call void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %4) #6
  invoke void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
          to label %7 unwind label %23

7:                                                ; preds = %6
  invoke void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %.preheader22 unwind label %25

.loopexit:                                        ; preds = %51, %.preheader
  br label %.preheader22, !llvm.loop !9

.preheader22:                                     ; preds = %7, %.loopexit
  %8 = call noundef i64 @_ZNKSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %.not = icmp eq i64 %8, 0
  br i1 %.not, label %9, label %.critedge

9:                                                ; preds = %.preheader22
  %10 = call noundef i64 @_ZNKSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
  %.not13 = icmp eq i64 %10, 0
  br i1 %.not13, label %53, label %.critedge

.critedge:                                        ; preds = %.preheader22, %9
  %11 = call noundef i64 @_ZNKSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %.not1423 = icmp eq i64 %11, 0
  br i1 %.not1423, label %.preheader, label %.lr.ph

.preheader:                                       ; preds = %33, %.critedge
  %12 = call noundef i64 @_ZNKSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
  %.not1524 = icmp eq i64 %12, 0
  br i1 %.not1524, label %.loopexit, label %.lr.ph25

.lr.ph:                                           ; preds = %.critedge, %33
  %13 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  call void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %15 = load i32, ptr %14, align 8, !tbaa !11
  %16 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %15)
          to label %17 unwind label %27

17:                                               ; preds = %.lr.ph
  %18 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull @.str)
          to label %19 unwind label %27

19:                                               ; preds = %17
  %20 = getelementptr inbounds i8, ptr %14, i64 16
  %21 = load ptr, ptr %20, align 8, !tbaa !14
  %.not18 = icmp eq ptr %21, null
  br i1 %.not18, label %29, label %22

22:                                               ; preds = %19
  invoke void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %4, ptr noundef nonnull align 8 dereferenceable(8) %20)
          to label %29 unwind label %27

23:                                               ; preds = %6
  %24 = landingpad { ptr, i32 }
          cleanup
  br label %56

25:                                               ; preds = %7
  %26 = landingpad { ptr, i32 }
          cleanup
  br label %55

27:                                               ; preds = %32, %22, %17, %.lr.ph
  %28 = landingpad { ptr, i32 }
          cleanup
  br label %55

29:                                               ; preds = %22, %19
  %30 = getelementptr inbounds i8, ptr %14, i64 8
  %31 = load ptr, ptr %30, align 8, !tbaa !15
  %.not19 = icmp eq ptr %31, null
  br i1 %.not19, label %33, label %32

32:                                               ; preds = %29
  invoke void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %4, ptr noundef nonnull align 8 dereferenceable(8) %30)
          to label %33 unwind label %27

33:                                               ; preds = %32, %29
  %34 = call noundef i64 @_ZNKSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %.not14 = icmp eq i64 %34, 0
  br i1 %.not14, label %.preheader, label %.lr.ph, !llvm.loop !16

.lr.ph25:                                         ; preds = %.preheader, %51
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
  %36 = load ptr, ptr %35, align 8, !tbaa !5
  call void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
  %37 = load i32, ptr %36, align 8, !tbaa !11
  %38 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %37)
          to label %39 unwind label %45

39:                                               ; preds = %.lr.ph25
  %40 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %38, ptr noundef nonnull @.str)
          to label %41 unwind label %45

41:                                               ; preds = %39
  %42 = getelementptr inbounds i8, ptr %36, i64 8
  %43 = load ptr, ptr %42, align 8, !tbaa !15
  %.not16 = icmp eq ptr %43, null
  br i1 %.not16, label %47, label %44

44:                                               ; preds = %41
  invoke void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %42)
          to label %47 unwind label %45

45:                                               ; preds = %50, %44, %39, %.lr.ph25
  %46 = landingpad { ptr, i32 }
          cleanup
  br label %55

47:                                               ; preds = %44, %41
  %48 = getelementptr inbounds i8, ptr %36, i64 16
  %49 = load ptr, ptr %48, align 8, !tbaa !14
  %.not17 = icmp eq ptr %49, null
  br i1 %.not17, label %51, label %50

50:                                               ; preds = %47
  invoke void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %48)
          to label %51 unwind label %45

51:                                               ; preds = %50, %47
  %52 = call noundef i64 @_ZNKSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
  %.not15 = icmp eq i64 %52, 0
  br i1 %.not15, label %.loopexit, label %.lr.ph25, !llvm.loop !17

53:                                               ; preds = %9
  call void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %4) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %4) #6
  call void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %3) #6
  br label %54

54:                                               ; preds = %1, %53
  ret void

55:                                               ; preds = %45, %27, %25
  %.pn = phi { ptr, i32 } [ %28, %27 ], [ %46, %45 ], [ %26, %25 ]
  call void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %4) #6
  br label %56

56:                                               ; preds = %55, %23
  %.pn.pn = phi { ptr, i32 } [ %.pn, %55 ], [ %24, %23 ]
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %4) #6
  call void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %3) #6
  resume { ptr, i32 } %.pn.pn
}

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

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

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

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

; 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 #3

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5stackIP4NodeSt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #5 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 nocallback nofree nosync 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 = { 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 #4 = { "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 }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTS4Node", !13, i64 0, !6, i64 8, !6, i64 16}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !6, i64 16}
!15 = !{!12, !6, i64 8}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


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