; LLVM IR from devparthgarg/Data-Structures-and-Algorithms :: 15. Binary Tree/19 Tree Traversal in Spiral Form/19b.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::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::deque", align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 80, ptr %3) #5
  call void @_ZNSt5dequeIP4NodeSaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3)
  invoke void @_ZNSt5dequeIP4NodeSaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %9 unwind label %26

9:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #5
  store i8 1, ptr %6, align 1, !tbaa !9
  br label %10

10:                                               ; preds = %118, %9
  %11 = call noundef i64 @_ZNKSt5dequeIP4NodeSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %12 = icmp ne i64 %11, 0
  br i1 %12, label %13, label %120

13:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %14 = call noundef i64 @_ZNKSt5dequeIP4NodeSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %15 = trunc i64 %14 to i32
  store i32 %15, ptr %7, align 4, !tbaa !11
  %16 = load i8, ptr %6, align 1, !tbaa !9, !range !13, !noundef !14
  %17 = trunc i8 %16 to i1
  %18 = zext i1 %17 to i32
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %20, label %73

20:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %21

21:                                               ; preds = %65, %20
  %22 = load i32, ptr %8, align 4, !tbaa !11
  %23 = load i32, ptr %7, align 4, !tbaa !11
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %30, label %25

25:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %68

26:                                               ; preds = %1
  %27 = landingpad { ptr, i32 }
          cleanup
  %28 = extractvalue { ptr, i32 } %27, 0
  store ptr %28, ptr %4, align 8
  %29 = extractvalue { ptr, i32 } %27, 1
  store i32 %29, ptr %5, align 4
  br label %121

30:                                               ; preds = %21
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %32 = load ptr, ptr %31, align 8, !tbaa !5
  %33 = getelementptr inbounds %class.Node, ptr %32, i32 0, i32 1
  %34 = load ptr, ptr %33, align 8, !tbaa !15
  %35 = icmp ne ptr %34, null
  br i1 %35, label %36, label %45

36:                                               ; preds = %30
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %38 = load ptr, ptr %37, align 8, !tbaa !5
  %39 = getelementptr inbounds %class.Node, ptr %38, i32 0, i32 1
  invoke void @_ZNSt5dequeIP4NodeSaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %39)
          to label %40 unwind label %41

40:                                               ; preds = %36
  br label %45

41:                                               ; preds = %62, %56, %51, %36
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %4, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %119

45:                                               ; preds = %40, %30
  %46 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %47 = load ptr, ptr %46, align 8, !tbaa !5
  %48 = getelementptr inbounds %class.Node, ptr %47, i32 0, i32 2
  %49 = load ptr, ptr %48, align 8, !tbaa !17
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %56

51:                                               ; preds = %45
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %53 = load ptr, ptr %52, align 8, !tbaa !5
  %54 = getelementptr inbounds %class.Node, ptr %53, i32 0, i32 2
  invoke void @_ZNSt5dequeIP4NodeSaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %54)
          to label %55 unwind label %41

55:                                               ; preds = %51
  br label %56

56:                                               ; preds = %55, %45
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %58 = load ptr, ptr %57, align 8, !tbaa !5
  %59 = getelementptr inbounds %class.Node, ptr %58, i32 0, i32 0
  %60 = load i32, ptr %59, align 8, !tbaa !18
  %61 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %60)
          to label %62 unwind label %41

62:                                               ; preds = %56
  %63 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %61, ptr noundef @.str)
          to label %64 unwind label %41

64:                                               ; preds = %62
  call void @_ZNSt5dequeIP4NodeSaIS1_EE9pop_frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  br label %65

65:                                               ; preds = %64
  %66 = load i32, ptr %8, align 4, !tbaa !11
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %8, align 4, !tbaa !11
  br label %21, !llvm.loop !19

68:                                               ; preds = %25
  %69 = load i8, ptr %6, align 1, !tbaa !9, !range !13, !noundef !14
  %70 = trunc i8 %69 to i1
  %71 = xor i1 %70, true
  %72 = zext i1 %71 to i8
  store i8 %72, ptr %6, align 1, !tbaa !9
  br label %118

73:                                               ; preds = %13
  br label %74

74:                                               ; preds = %112, %73
  %75 = load i32, ptr %7, align 4, !tbaa !11
  %76 = add nsw i32 %75, -1
  store i32 %76, ptr %7, align 4, !tbaa !11
  %77 = icmp ne i32 %75, 0
  br i1 %77, label %78, label %113

78:                                               ; preds = %74
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE4backEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %80 = load ptr, ptr %79, align 8, !tbaa !5
  %81 = getelementptr inbounds %class.Node, ptr %80, i32 0, i32 2
  %82 = load ptr, ptr %81, align 8, !tbaa !17
  %83 = icmp ne ptr %82, null
  br i1 %83, label %84, label %93

84:                                               ; preds = %78
  %85 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE4backEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %86 = load ptr, ptr %85, align 8, !tbaa !5
  %87 = getelementptr inbounds %class.Node, ptr %86, i32 0, i32 2
  invoke void @_ZNSt5dequeIP4NodeSaIS1_EE10push_frontERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %87)
          to label %88 unwind label %89

88:                                               ; preds = %84
  br label %93

89:                                               ; preds = %110, %104, %99, %84
  %90 = landingpad { ptr, i32 }
          cleanup
  %91 = extractvalue { ptr, i32 } %90, 0
  store ptr %91, ptr %4, align 8
  %92 = extractvalue { ptr, i32 } %90, 1
  store i32 %92, ptr %5, align 4
  br label %119

93:                                               ; preds = %88, %78
  %94 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE4backEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %95 = load ptr, ptr %94, align 8, !tbaa !5
  %96 = getelementptr inbounds %class.Node, ptr %95, i32 0, i32 1
  %97 = load ptr, ptr %96, align 8, !tbaa !15
  %98 = icmp ne ptr %97, null
  br i1 %98, label %99, label %104

99:                                               ; preds = %93
  %100 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE4backEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %101 = load ptr, ptr %100, align 8, !tbaa !5
  %102 = getelementptr inbounds %class.Node, ptr %101, i32 0, i32 1
  invoke void @_ZNSt5dequeIP4NodeSaIS1_EE10push_frontERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %102)
          to label %103 unwind label %89

103:                                              ; preds = %99
  br label %104

104:                                              ; preds = %103, %93
  %105 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE4backEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %106 = load ptr, ptr %105, align 8, !tbaa !5
  %107 = getelementptr inbounds %class.Node, ptr %106, i32 0, i32 0
  %108 = load i32, ptr %107, align 8, !tbaa !18
  %109 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %108)
          to label %110 unwind label %89

110:                                              ; preds = %104
  %111 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %109, ptr noundef @.str)
          to label %112 unwind label %89

112:                                              ; preds = %110
  call void @_ZNSt5dequeIP4NodeSaIS1_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  br label %74, !llvm.loop !21

113:                                              ; preds = %74
  %114 = load i8, ptr %6, align 1, !tbaa !9, !range !13, !noundef !14
  %115 = trunc i8 %114 to i1
  %116 = xor i1 %115, true
  %117 = zext i1 %116 to i8
  store i8 %117, ptr %6, align 1, !tbaa !9
  br label %118

118:                                              ; preds = %113, %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %10, !llvm.loop !22

119:                                              ; preds = %89, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #5
  br label %121

120:                                              ; preds = %10
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #5
  call void @_ZNSt5dequeIP4NodeSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #5
  ret void

121:                                              ; preds = %119, %26
  call void @_ZNSt5dequeIP4NodeSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #5
  br label %122

122:                                              ; preds = %121
  %123 = load ptr, ptr %4, align 8
  %124 = load i32, ptr %5, align 4
  %125 = insertvalue { ptr, i32 } poison, ptr %123, 0
  %126 = insertvalue { ptr, i32 } %125, i32 %124, 1
  resume { ptr, i32 } %126
}

; 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 @_ZNSt5dequeIP4NodeSaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #0 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt5dequeIP4NodeSaIS1_EE4sizeEv(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 @_ZNSt5dequeIP4NodeSaIS1_EE5frontEv(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: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5dequeIP4NodeSaIS1_EE9pop_frontEv(ptr noundef nonnull align 8 dereferenceable(80)) #2 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5dequeIP4NodeSaIS1_EE10push_frontERKS1_(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 void @_ZNSt5dequeIP4NodeSaIS1_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5dequeIP4NodeSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #2 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 = { 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 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !6, i64 8}
!16 = !{!"_ZTS4Node", !12, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!16, !6, i64 16}
!18 = !{!16, !12, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}
!22 = distinct !{!22, !20}


; 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::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::deque", align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %3) #5
  call void @_ZNSt5dequeIP4NodeSaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3)
  invoke void @_ZNSt5dequeIP4NodeSaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %.preheader23 unwind label %8

.preheader23:                                     ; preds = %1
  %4 = call noundef i64 @_ZNKSt5dequeIP4NodeSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %.not27 = icmp eq i64 %4, 0
  br i1 %.not27, label %._crit_edge, label %.lr.ph29

.lr.ph29:                                         ; preds = %.preheader23, %.loopexit
  %.0928 = phi i1 [ %.1, %.loopexit ], [ true, %.preheader23 ]
  %5 = call noundef i64 @_ZNKSt5dequeIP4NodeSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %6 = trunc i64 %5 to i32
  br i1 %.0928, label %.preheader, label %.preheader21

.preheader21:                                     ; preds = %.lr.ph29
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph, label %.loopexit

.preheader:                                       ; preds = %.lr.ph29
  %.not1425 = icmp eq i32 %6, 0
  br i1 %.not1425, label %.loopexit, label %.lr.ph26

8:                                                ; preds = %1
  %9 = landingpad { ptr, i32 }
          cleanup
  br label %67

.lr.ph:                                           ; preds = %.preheader21, %36
  %.024 = phi i32 [ %37, %36 ], [ 0, %.preheader21 ]
  %10 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %11, i64 8
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %.not17 = icmp eq ptr %13, null
  br i1 %.not17, label %20, label %14

14:                                               ; preds = %.lr.ph
  %15 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %16 = load ptr, ptr %15, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %16, i64 8
  invoke void @_ZNSt5dequeIP4NodeSaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %17)
          to label %20 unwind label %18

18:                                               ; preds = %34, %29, %25, %14
  %19 = landingpad { ptr, i32 }
          cleanup
  br label %67

20:                                               ; preds = %14, %.lr.ph
  %21 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %22, i64 16
  %24 = load ptr, ptr %23, align 8, !tbaa !12
  %.not18 = icmp eq ptr %24, null
  br i1 %.not18, label %29, label %25

25:                                               ; preds = %20
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %27, i64 16
  invoke void @_ZNSt5dequeIP4NodeSaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %28)
          to label %29 unwind label %18

29:                                               ; preds = %25, %20
  %30 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %31 = load ptr, ptr %30, align 8, !tbaa !5
  %32 = load i32, ptr %31, align 8, !tbaa !13
  %33 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %32)
          to label %34 unwind label %18

34:                                               ; preds = %29
  %35 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %33, ptr noundef nonnull @.str)
          to label %36 unwind label %18

36:                                               ; preds = %34
  call void @_ZNSt5dequeIP4NodeSaIS1_EE9pop_frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %37 = add nuw nsw i32 %.024, 1
  %exitcond.not = icmp eq i32 %37, %6
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph, !llvm.loop !14

.lr.ph26:                                         ; preds = %.preheader, %65
  %.in = phi i32 [ %38, %65 ], [ %6, %.preheader ]
  %38 = add nsw i32 %.in, -1
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE4backEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %40 = load ptr, ptr %39, align 8, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %40, i64 16
  %42 = load ptr, ptr %41, align 8, !tbaa !12
  %.not15 = icmp eq ptr %42, null
  br i1 %.not15, label %49, label %43

43:                                               ; preds = %.lr.ph26
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE4backEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  %46 = getelementptr inbounds i8, ptr %45, i64 16
  invoke void @_ZNSt5dequeIP4NodeSaIS1_EE10push_frontERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %46)
          to label %49 unwind label %47

47:                                               ; preds = %63, %58, %54, %43
  %48 = landingpad { ptr, i32 }
          cleanup
  br label %67

49:                                               ; preds = %43, %.lr.ph26
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE4backEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %51 = load ptr, ptr %50, align 8, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %51, i64 8
  %53 = load ptr, ptr %52, align 8, !tbaa !9
  %.not16 = icmp eq ptr %53, null
  br i1 %.not16, label %58, label %54

54:                                               ; preds = %49
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE4backEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  %57 = getelementptr inbounds i8, ptr %56, i64 8
  invoke void @_ZNSt5dequeIP4NodeSaIS1_EE10push_frontERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %57)
          to label %58 unwind label %47

58:                                               ; preds = %54, %49
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIP4NodeSaIS1_EE4backEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %60 = load ptr, ptr %59, align 8, !tbaa !5
  %61 = load i32, ptr %60, align 8, !tbaa !13
  %62 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %61)
          to label %63 unwind label %47

63:                                               ; preds = %58
  %64 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %62, ptr noundef nonnull @.str)
          to label %65 unwind label %47

65:                                               ; preds = %63
  call void @_ZNSt5dequeIP4NodeSaIS1_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %.not14 = icmp eq i32 %38, 0
  br i1 %.not14, label %.loopexit, label %.lr.ph26, !llvm.loop !16

.loopexit:                                        ; preds = %36, %65, %.preheader21, %.preheader
  %.1 = xor i1 %.0928, true
  %66 = call noundef i64 @_ZNKSt5dequeIP4NodeSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  %.not = icmp eq i64 %66, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph29, !llvm.loop !17

._crit_edge:                                      ; preds = %.loopexit, %.preheader23
  call void @_ZNSt5dequeIP4NodeSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %3) #5
  ret void

67:                                               ; preds = %18, %47, %8
  %.pn.pn = phi { ptr, i32 } [ %9, %8 ], [ %19, %18 ], [ %48, %47 ]
  call void @_ZNSt5dequeIP4NodeSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %3) #5
  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 @_ZNSt5dequeIP4NodeSaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #0 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt5dequeIP4NodeSaIS1_EE4sizeEv(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 @_ZNSt5dequeIP4NodeSaIS1_EE5frontEv(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 nounwind uwtable
declare dso_local void @_ZNSt5dequeIP4NodeSaIS1_EE9pop_frontEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5dequeIP4NodeSaIS1_EE10push_frontERKS1_(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 void @_ZNSt5dequeIP4NodeSaIS1_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5dequeIP4NodeSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #2 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 = { 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 8}
!10 = !{!"_ZTS4Node", !11, i64 0, !6, i64 8, !6, i64 16}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 16}
!13 = !{!10, !11, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}


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