; LLVM IR from Leet-Us-Code/DSA-A-Z-Practice :: Sid's Levels/Level - 1/Stacks_Queue_Dequeue (LargestRectangularArea)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"class.std::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl" }
%"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl" = type { %"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl_data" }
%"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

; Function Attrs: mustprogress uwtable
define dso_local void @_Z20getNextSmallestRightSt6vectorIxSaIxEE(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8 %0, ptr noundef %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i1, align 1
  %7 = alloca i64, align 8
  %8 = alloca %"class.std::allocator", align 1
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %"class.std::stack", align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %15 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #4
  %16 = trunc i64 %15 to i32
  store i32 %16, ptr %5, align 4, !tbaa !9
  store i1 false, ptr %6, align 1
  %17 = load i32, ptr %5, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i64 -1, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #4
  call void @_ZNSaIxEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #4
  invoke void @_ZNSt6vectorIxSaIxEEC2EmRKxRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %18, ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 1 dereferenceable(1) %8)
          to label %19 unwind label %27

19:                                               ; preds = %2
  call void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 80, ptr %11) #4
  invoke void @_ZNSt5stackIxSt5dequeIxSaIxEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %20 unwind label %31

20:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store i64 0, ptr %12, align 8, !tbaa !11
  invoke void @_ZNSt5stackIxSt5dequeIxSaIxEEE4pushEOx(ptr noundef nonnull align 8 dereferenceable(80) %11, ptr noundef nonnull align 8 dereferenceable(8) %12)
          to label %21 unwind label %35

21:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 1, ptr %13, align 4, !tbaa !9
  br label %22

22:                                               ; preds = %72, %21
  %23 = load i32, ptr %13, align 4, !tbaa !9
  %24 = load i32, ptr %5, align 4, !tbaa !9
  %25 = icmp slt i32 %23, %24
  br i1 %25, label %39, label %26

26:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %80

27:                                               ; preds = %2
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %9, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %10, align 4
  call void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %104

31:                                               ; preds = %19
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %9, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %10, align 4
  br label %101

35:                                               ; preds = %20
  %36 = landingpad { ptr, i32 }
          cleanup
  %37 = extractvalue { ptr, i32 } %36, 0
  store ptr %37, ptr %9, align 8
  %38 = extractvalue { ptr, i32 } %36, 1
  store i32 %38, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %100

39:                                               ; preds = %22
  br label %40

40:                                               ; preds = %63, %39
  %41 = invoke noundef zeroext i1 @_ZNKSt5stackIxSt5dequeIxSaIxEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %42 unwind label %64

42:                                               ; preds = %40
  br i1 %41, label %54, label %43

43:                                               ; preds = %42
  %44 = load i32, ptr %13, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %45) #4
  %47 = load i64, ptr %46, align 8, !tbaa !11
  %48 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIxSt5dequeIxSaIxEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %49 unwind label %64

49:                                               ; preds = %43
  %50 = load i64, ptr %48, align 8, !tbaa !11
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %50) #4
  %52 = load i64, ptr %51, align 8, !tbaa !11
  %53 = icmp slt i64 %47, %52
  br label %54

54:                                               ; preds = %49, %42
  %55 = phi i1 [ false, %42 ], [ %53, %49 ]
  br i1 %55, label %56, label %68

56:                                               ; preds = %54
  %57 = load i32, ptr %13, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIxSt5dequeIxSaIxEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %60 unwind label %64

60:                                               ; preds = %56
  %61 = load i64, ptr %59, align 8, !tbaa !11
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %61) #4
  store i64 %58, ptr %62, align 8, !tbaa !11
  invoke void @_ZNSt5stackIxSt5dequeIxSaIxEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %63 unwind label %64

63:                                               ; preds = %60
  br label %40, !llvm.loop !13

64:                                               ; preds = %60, %56, %43, %40
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %9, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %10, align 4
  br label %79

68:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %69 = load i32, ptr %13, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  store i64 %70, ptr %14, align 8, !tbaa !11
  invoke void @_ZNSt5stackIxSt5dequeIxSaIxEEE4pushEOx(ptr noundef nonnull align 8 dereferenceable(80) %11, ptr noundef nonnull align 8 dereferenceable(8) %14)
          to label %71 unwind label %75

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

72:                                               ; preds = %71
  %73 = load i32, ptr %13, align 4, !tbaa !9
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %13, align 4, !tbaa !9
  br label %22, !llvm.loop !15

75:                                               ; preds = %68
  %76 = landingpad { ptr, i32 }
          cleanup
  %77 = extractvalue { ptr, i32 } %76, 0
  store ptr %77, ptr %9, align 8
  %78 = extractvalue { ptr, i32 } %76, 1
  store i32 %78, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %79

79:                                               ; preds = %75, %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %100

80:                                               ; preds = %26
  br label %81

81:                                               ; preds = %93, %80
  %82 = invoke noundef zeroext i1 @_ZNKSt5stackIxSt5dequeIxSaIxEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %83 unwind label %94

83:                                               ; preds = %81
  %84 = xor i1 %82, true
  br i1 %84, label %85, label %98

85:                                               ; preds = %83
  %86 = load i32, ptr %5, align 4, !tbaa !9
  %87 = sub nsw i32 %86, 1
  %88 = sext i32 %87 to i64
  %89 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIxSt5dequeIxSaIxEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %90 unwind label %94

90:                                               ; preds = %85
  %91 = load i64, ptr %89, align 8, !tbaa !11
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %91) #4
  store i64 %88, ptr %92, align 8, !tbaa !11
  invoke void @_ZNSt5stackIxSt5dequeIxSaIxEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %93 unwind label %94

93:                                               ; preds = %90
  br label %81, !llvm.loop !16

94:                                               ; preds = %90, %85, %81
  %95 = landingpad { ptr, i32 }
          cleanup
  %96 = extractvalue { ptr, i32 } %95, 0
  store ptr %96, ptr %9, align 8
  %97 = extractvalue { ptr, i32 } %95, 1
  store i32 %97, ptr %10, align 4
  br label %100

98:                                               ; preds = %83
  store i1 true, ptr %6, align 1
  call void @_ZNSt5stackIxSt5dequeIxSaIxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %11) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr %11) #4
  %99 = load i1, ptr %6, align 1
  br i1 %99, label %103, label %102

100:                                              ; preds = %94, %79, %35
  call void @_ZNSt5stackIxSt5dequeIxSaIxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %11) #4
  br label %101

101:                                              ; preds = %100, %31
  call void @llvm.lifetime.end.p0(i64 80, ptr %11) #4
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %104

102:                                              ; preds = %98
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %103

103:                                              ; preds = %102, %98
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret void

104:                                              ; preds = %101, %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %105

105:                                              ; preds = %104
  %106 = load ptr, ptr %9, align 8
  %107 = load i32, ptr %10, align 4
  %108 = insertvalue { ptr, i32 } poison, ptr %106, 0
  %109 = insertvalue { ptr, i32 } %108, i32 %107, 1
  resume { ptr, i32 } %109
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEEC2EmRKxRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5stackIxSt5dequeIxSaIxEEE4pushEOx(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 zeroext i1 @_ZNKSt5stackIxSt5dequeIxSaIxEEE5emptyEv(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 @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) 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 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 #4 = { 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 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"class.std::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl" }
%"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl" = type { %"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl_data" }
%"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

; Function Attrs: mustprogress uwtable
define dso_local void @_Z20getNextSmallestRightSt6vectorIxSaIxEE(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8 %0, ptr noundef nonnull %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca i64, align 8
  %4 = alloca %"class.std::allocator", align 1
  %5 = alloca %"class.std::stack", align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = tail call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #4
  %9 = trunc i64 %8 to i32
  %sext = shl i64 %8, 32
  %10 = ashr exact i64 %sext, 32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  store i64 -1, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #4
  call void @_ZNSaIxEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #4
  invoke void @_ZNSt6vectorIxSaIxEEC2EmRKxRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %10, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %11 unwind label %18

11:                                               ; preds = %2
  call void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %5) #4
  invoke void @_ZNSt5stackIxSt5dequeIxSaIxEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
          to label %12 unwind label %20

12:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  store i64 0, ptr %6, align 8, !tbaa !5
  invoke void @_ZNSt5stackIxSt5dequeIxSaIxEEE4pushEOx(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %13 unwind label %22

13:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  %14 = icmp sgt i32 %9, 1
  br i1 %14, label %.preheader19.preheader, label %.preheader

.preheader19.preheader:                           ; preds = %13
  %wide.trip.count = and i64 %8, 2147483647
  br label %.preheader19

.preheader19:                                     ; preds = %.preheader19.preheader, %36
  %indvars.iv = phi i64 [ 1, %.preheader19.preheader ], [ %indvars.iv.next, %36 ]
  %15 = call noundef zeroext i1 @_ZNKSt5stackIxSt5dequeIxSaIxEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  br i1 %15, label %.critedge, label %.lr.ph

.preheader:                                       ; preds = %36, %13
  %16 = call noundef zeroext i1 @_ZNKSt5stackIxSt5dequeIxSaIxEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  br i1 %16, label %._crit_edge, label %.lr.ph22

.lr.ph22:                                         ; preds = %.preheader
  %sext15 = add i64 %sext, -4294967296
  %17 = ashr exact i64 %sext15, 32
  br label %39

18:                                               ; preds = %2
  %19 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  br label %46

20:                                               ; preds = %11
  %21 = landingpad { ptr, i32 }
          cleanup
  br label %45

22:                                               ; preds = %12
  %23 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  br label %44

.lr.ph:                                           ; preds = %.preheader19, %31
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %indvars.iv) #4
  %25 = load i64, ptr %24, align 8, !tbaa !5
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIxSt5dequeIxSaIxEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %27 = load i64, ptr %26, align 8, !tbaa !5
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %27) #4
  %29 = load i64, ptr %28, align 8, !tbaa !5
  %30 = icmp slt i64 %25, %29
  br i1 %30, label %31, label %.critedge

31:                                               ; preds = %.lr.ph
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIxSt5dequeIxSaIxEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %33 = load i64, ptr %32, align 8, !tbaa !5
  %34 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %33) #4
  store i64 %indvars.iv, ptr %34, align 8, !tbaa !5
  call void @_ZNSt5stackIxSt5dequeIxSaIxEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %35 = call noundef zeroext i1 @_ZNKSt5stackIxSt5dequeIxSaIxEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  br i1 %35, label %.critedge, label %.lr.ph, !llvm.loop !9

.critedge:                                        ; preds = %.lr.ph, %31, %.preheader19
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  store i64 %indvars.iv, ptr %7, align 8, !tbaa !5
  invoke void @_ZNSt5stackIxSt5dequeIxSaIxEEE4pushEOx(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %36 unwind label %37

36:                                               ; preds = %.critedge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader, label %.preheader19, !llvm.loop !11

37:                                               ; preds = %.critedge
  %38 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  br label %44

39:                                               ; preds = %.lr.ph22, %39
  %40 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIxSt5dequeIxSaIxEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %41 = load i64, ptr %40, align 8, !tbaa !5
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %41) #4
  store i64 %17, ptr %42, align 8, !tbaa !5
  call void @_ZNSt5stackIxSt5dequeIxSaIxEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %43 = call noundef zeroext i1 @_ZNKSt5stackIxSt5dequeIxSaIxEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  br i1 %43, label %._crit_edge, label %39, !llvm.loop !12

._crit_edge:                                      ; preds = %39, %.preheader
  call void @_ZNSt5stackIxSt5dequeIxSaIxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %5) #4
  ret void

44:                                               ; preds = %37, %22
  %.pn = phi { ptr, i32 } [ %38, %37 ], [ %23, %22 ]
  call void @_ZNSt5stackIxSt5dequeIxSaIxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #4
  br label %45

45:                                               ; preds = %44, %20
  %.pn.pn = phi { ptr, i32 } [ %.pn, %44 ], [ %21, %20 ]
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %5) #4
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %46

46:                                               ; preds = %45, %18
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %45 ], [ %19, %18 ]
  resume { ptr, i32 } %.pn.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 nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEEC2EmRKxRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; 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 uwtable
declare dso_local void @_ZNSt5stackIxSt5dequeIxSaIxEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5stackIxSt5dequeIxSaIxEEE4pushEOx(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 zeroext i1 @_ZNKSt5stackIxSt5dequeIxSaIxEEE5emptyEv(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 @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) 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 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 #4 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}


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