; LLVM IR from upupming/algorithm :: upupming/1014.ll (Z5solvev)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@t = external dso_local global [1010 x i32], align 16
@doneT = external dso_local global [1010 x i32], align 16
@serving = external dso_local global [25 x %"class.std::queue"], align 16
@sorry = external dso_local global [1010 x i8], align 16
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [70 x i8], align 1
@__PRETTY_FUNCTION__._Z5solvev = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  store i32 1, ptr %1, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %157, %0
  %12 = load i32, ptr %1, align 4, !tbaa !5
  %13 = load i32, ptr @k, align 4, !tbaa !5
  %14 = icmp sle i32 %12, %13
  br i1 %14, label %16, label %15

15:                                               ; preds = %11
  store i32 2, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  br label %160

16:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %17 = load i32, ptr @m, align 4, !tbaa !5
  store i32 %17, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 -1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %39, %16
  %19 = load i32, ptr %5, align 4, !tbaa !5
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = icmp slt i32 %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  store i32 5, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %42

23:                                               ; preds = %18
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [25 x %"class.std::queue"], ptr @serving, i64 0, i64 %25
  %27 = call noundef i64 @_ZNKSt5queueIiSt5dequeIiSaIiEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %26)
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = icmp ult i64 %27, %29
  br i1 %30, label %31, label %38

31:                                               ; preds = %23
  %32 = load i32, ptr %5, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [25 x %"class.std::queue"], ptr @serving, i64 0, i64 %33
  %35 = call noundef i64 @_ZNKSt5queueIiSt5dequeIiSaIiEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %34)
  %36 = trunc i64 %35 to i32
  store i32 %36, ptr %3, align 4, !tbaa !5
  %37 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %37, ptr %4, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %31, %23
  br label %39

39:                                               ; preds = %38
  %40 = load i32, ptr %5, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %5, align 4, !tbaa !5
  br label %18, !llvm.loop !9

42:                                               ; preds = %22
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = icmp ne i32 %43, -1
  br i1 %44, label %45, label %88

45:                                               ; preds = %42
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [25 x %"class.std::queue"], ptr @serving, i64 0, i64 %47
  %49 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %48)
  br i1 %49, label %50, label %59

50:                                               ; preds = %45
  %51 = load i32, ptr %1, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [1010 x i32], ptr @t, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = add nsw i32 480, %54
  %56 = load i32, ptr %1, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [1010 x i32], ptr @doneT, i64 0, i64 %57
  store i32 %55, ptr %58, align 4, !tbaa !5
  br label %84

59:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [25 x %"class.std::queue"], ptr @serving, i64 0, i64 %61
  %63 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE4backEv(ptr noundef nonnull align 8 dereferenceable(80) %62)
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [1010 x i32], ptr @doneT, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  store i32 %67, ptr %6, align 4, !tbaa !5
  %68 = load i32, ptr %6, align 4, !tbaa !5
  %69 = icmp sge i32 %68, 1020
  br i1 %69, label %70, label %74

70:                                               ; preds = %59
  %71 = load i32, ptr %1, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [1010 x i8], ptr @sorry, i64 0, i64 %72
  store i8 1, ptr %73, align 1, !tbaa !11
  br label %74

74:                                               ; preds = %70, %59
  %75 = load i32, ptr %6, align 4, !tbaa !5
  %76 = load i32, ptr %1, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [1010 x i32], ptr @t, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = add nsw i32 %75, %79
  %81 = load i32, ptr %1, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [1010 x i32], ptr @doneT, i64 0, i64 %82
  store i32 %80, ptr %83, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %84

84:                                               ; preds = %74, %50
  %85 = load i32, ptr %4, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [25 x %"class.std::queue"], ptr @serving, i64 0, i64 %86
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %87, ptr noundef nonnull align 4 dereferenceable(4) %1)
  br label %156

88:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 -1, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 99999999, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %116, %88
  %90 = load i32, ptr %9, align 4, !tbaa !5
  %91 = load i32, ptr @n, align 4, !tbaa !5
  %92 = icmp slt i32 %90, %91
  br i1 %92, label %94, label %93

93:                                               ; preds = %89
  store i32 8, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %119

94:                                               ; preds = %89
  %95 = load i32, ptr %9, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [25 x %"class.std::queue"], ptr @serving, i64 0, i64 %96
  %98 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %97)
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [1010 x i32], ptr @doneT, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = icmp slt i32 %102, %103
  br i1 %104, label %105, label %115

105:                                              ; preds = %94
  %106 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %106, ptr %7, align 4, !tbaa !5
  %107 = load i32, ptr %9, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [25 x %"class.std::queue"], ptr @serving, i64 0, i64 %108
  %110 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %109)
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [1010 x i32], ptr @doneT, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  store i32 %114, ptr %8, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %105, %94
  br label %116

116:                                              ; preds = %115
  %117 = load i32, ptr %9, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %9, align 4, !tbaa !5
  br label %89, !llvm.loop !13

119:                                              ; preds = %93
  %120 = load i32, ptr %7, align 4, !tbaa !5
  %121 = icmp ne i32 %120, -1
  br i1 %121, label %122, label %123

122:                                              ; preds = %119
  br label %125

123:                                              ; preds = %119
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.2, i32 noundef 44, ptr noundef @__PRETTY_FUNCTION__._Z5solvev) #5
  unreachable

124:                                              ; No predecessors!
  br label %125

125:                                              ; preds = %124, %122
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %126 = load i32, ptr %7, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [25 x %"class.std::queue"], ptr @serving, i64 0, i64 %127
  %129 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE4backEv(ptr noundef nonnull align 8 dereferenceable(80) %128)
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [1010 x i32], ptr @doneT, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  store i32 %133, ptr %10, align 4, !tbaa !5
  %134 = load i32, ptr %10, align 4, !tbaa !5
  %135 = icmp sge i32 %134, 1020
  br i1 %135, label %136, label %140

136:                                              ; preds = %125
  %137 = load i32, ptr %1, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [1010 x i8], ptr @sorry, i64 0, i64 %138
  store i8 1, ptr %139, align 1, !tbaa !11
  br label %140

140:                                              ; preds = %136, %125
  %141 = load i32, ptr %10, align 4, !tbaa !5
  %142 = load i32, ptr %1, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [1010 x i32], ptr @t, i64 0, i64 %143
  %145 = load i32, ptr %144, align 4, !tbaa !5
  %146 = add nsw i32 %141, %145
  %147 = load i32, ptr %1, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [1010 x i32], ptr @doneT, i64 0, i64 %148
  store i32 %146, ptr %149, align 4, !tbaa !5
  %150 = load i32, ptr %7, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [25 x %"class.std::queue"], ptr @serving, i64 0, i64 %151
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %152)
  %153 = load i32, ptr %7, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [25 x %"class.std::queue"], ptr @serving, i64 0, i64 %154
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %155, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %156

156:                                              ; preds = %140, %84
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %157

157:                                              ; preds = %156
  %158 = load i32, ptr %1, align 4, !tbaa !5
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %1, align 4, !tbaa !5
  br label %11, !llvm.loop !14

160:                                              ; preds = %15
  ret void
}

; 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 @_ZNKSt5queueIiSt5dequeIiSaIiEEE4sizeEv(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 zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) #2 align 2

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

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) #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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { noreturn 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


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

@n = external dso_local local_unnamed_addr global i32, align 4
@m = external dso_local local_unnamed_addr global i32, align 4
@k = external dso_local local_unnamed_addr global i32, align 4
@t = external dso_local local_unnamed_addr global [1010 x i32], align 16
@doneT = external dso_local local_unnamed_addr global [1010 x i32], align 16
@serving = external dso_local global [25 x %"class.std::queue"], align 16
@sorry = external dso_local local_unnamed_addr global [1010 x i8], align 16
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [70 x i8], align 1
@__PRETTY_FUNCTION__._Z5solvev = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  store i32 1, ptr %1, align 4, !tbaa !5
  %2 = load i32, ptr @k, align 4, !tbaa !5
  %.not43 = icmp slt i32 %2, 1
  br i1 %.not43, label %._crit_edge46, label %.lr.ph45

._crit_edge46:                                    ; preds = %74, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  ret void

.lr.ph45:                                         ; preds = %0, %74
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph.preheader, label %._crit_edge41.thread

.lr.ph.preheader:                                 ; preds = %.lr.ph45
  %5 = load i32, ptr @m, align 4, !tbaa !5
  br label %.lr.ph

._crit_edge:                                      ; preds = %15
  %.not32 = icmp eq i32 %.131, -1
  br i1 %.not32, label %.preheader, label %19

.preheader:                                       ; preds = %._crit_edge
  %6 = icmp sgt i32 %16, 0
  br i1 %6, label %.lr.ph40, label %._crit_edge41.thread

.lr.ph:                                           ; preds = %.lr.ph.preheader, %15
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %15 ]
  %.02736 = phi i32 [ %5, %.lr.ph.preheader ], [ %.128, %15 ]
  %.03034 = phi i32 [ -1, %.lr.ph.preheader ], [ %.131, %15 ]
  %7 = getelementptr inbounds [25 x %"class.std::queue"], ptr @serving, i64 0, i64 %indvars.iv
  %8 = call noundef i64 @_ZNKSt5queueIiSt5dequeIiSaIiEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  %9 = sext i32 %.02736 to i64
  %10 = icmp ult i64 %8, %9
  br i1 %10, label %11, label %15

11:                                               ; preds = %.lr.ph
  %12 = call noundef i64 @_ZNKSt5queueIiSt5dequeIiSaIiEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  %13 = trunc i64 %12 to i32
  %14 = trunc nuw nsw i64 %indvars.iv to i32
  br label %15

15:                                               ; preds = %.lr.ph, %11
  %.131 = phi i32 [ %14, %11 ], [ %.03034, %.lr.ph ]
  %.128 = phi i32 [ %13, %11 ], [ %.02736, %.lr.ph ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = icmp slt i64 %indvars.iv.next, %17
  br i1 %18, label %.lr.ph, label %._crit_edge, !llvm.loop !9

19:                                               ; preds = %._crit_edge
  %20 = sext i32 %.131 to i64
  %21 = getelementptr inbounds [25 x %"class.std::queue"], ptr @serving, i64 0, i64 %20
  %22 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %21)
  br i1 %22, label %23, label %26

23:                                               ; preds = %19
  %24 = load i32, ptr %1, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  br label %._crit_edge52

26:                                               ; preds = %19
  %27 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE4backEv(ptr noundef nonnull align 8 dereferenceable(80) %21)
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [1010 x i32], ptr @doneT, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = icmp sgt i32 %31, 1019
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  %33 = sext i32 %.pre to i64
  br i1 %32, label %34, label %._crit_edge52

34:                                               ; preds = %26
  %35 = getelementptr inbounds [1010 x i8], ptr @sorry, i64 0, i64 %33
  store i8 1, ptr %35, align 1, !tbaa !11
  br label %._crit_edge52

._crit_edge52:                                    ; preds = %34, %26, %23
  %.sink65 = phi i64 [ %25, %23 ], [ %33, %26 ], [ %33, %34 ]
  %.sink64 = phi i32 [ 480, %23 ], [ %31, %26 ], [ %31, %34 ]
  %36 = getelementptr inbounds [1010 x i32], ptr @t, i64 0, i64 %.sink65
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = add nsw i32 %37, %.sink64
  %39 = getelementptr inbounds [1010 x i32], ptr @doneT, i64 0, i64 %.sink65
  store i32 %38, ptr %39, align 4, !tbaa !5
  br label %74

._crit_edge41:                                    ; preds = %54
  %.not33 = icmp eq i32 %.126, -1
  br i1 %.not33, label %._crit_edge41.thread, label %58

.lr.ph40:                                         ; preds = %.preheader, %54
  %indvars.iv48 = phi i64 [ %indvars.iv.next49, %54 ], [ 0, %.preheader ]
  %.02438 = phi i32 [ %.1, %54 ], [ 99999999, %.preheader ]
  %.02537 = phi i32 [ %.126, %54 ], [ -1, %.preheader ]
  %40 = getelementptr inbounds [25 x %"class.std::queue"], ptr @serving, i64 0, i64 %indvars.iv48
  %41 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %40)
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [1010 x i32], ptr @doneT, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = icmp slt i32 %45, %.02438
  br i1 %46, label %47, label %54

47:                                               ; preds = %.lr.ph40
  %48 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %40)
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [1010 x i32], ptr @doneT, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = trunc nuw nsw i64 %indvars.iv48 to i32
  br label %54

54:                                               ; preds = %.lr.ph40, %47
  %.126 = phi i32 [ %53, %47 ], [ %.02537, %.lr.ph40 ]
  %.1 = phi i32 [ %52, %47 ], [ %.02438, %.lr.ph40 ]
  %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
  %55 = load i32, ptr @n, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = icmp slt i64 %indvars.iv.next49, %56
  br i1 %57, label %.lr.ph40, label %._crit_edge41, !llvm.loop !13

._crit_edge41.thread:                             ; preds = %.lr.ph45, %.preheader, %._crit_edge41
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.2, i32 noundef 44, ptr noundef nonnull @__PRETTY_FUNCTION__._Z5solvev) #5
  unreachable

58:                                               ; preds = %._crit_edge41
  %59 = sext i32 %.126 to i64
  %60 = getelementptr inbounds [25 x %"class.std::queue"], ptr @serving, i64 0, i64 %59
  %61 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE4backEv(ptr noundef nonnull align 8 dereferenceable(80) %60)
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [1010 x i32], ptr @doneT, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = icmp sgt i32 %65, 1019
  %.pre51 = load i32, ptr %1, align 4, !tbaa !5
  %67 = sext i32 %.pre51 to i64
  br i1 %66, label %68, label %._crit_edge53

68:                                               ; preds = %58
  %69 = getelementptr inbounds [1010 x i8], ptr @sorry, i64 0, i64 %67
  store i8 1, ptr %69, align 1, !tbaa !11
  br label %._crit_edge53

._crit_edge53:                                    ; preds = %58, %68
  %70 = getelementptr inbounds [1010 x i32], ptr @t, i64 0, i64 %67
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = add nsw i32 %71, %65
  %73 = getelementptr inbounds [1010 x i32], ptr @doneT, i64 0, i64 %67
  store i32 %72, ptr %73, align 4, !tbaa !5
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %60)
  br label %74

74:                                               ; preds = %._crit_edge53, %._crit_edge52
  %.sink = phi ptr [ %60, %._crit_edge53 ], [ %21, %._crit_edge52 ]
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %.sink, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %75 = load i32, ptr %1, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %1, align 4, !tbaa !5
  %77 = load i32, ptr @k, align 4, !tbaa !5
  %.not.not = icmp slt i32 %75, %77
  br i1 %.not.not, label %.lr.ph45, label %._crit_edge46, !llvm.loop !14
}

; 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 @_ZNKSt5queueIiSt5dequeIiSaIiEEE4sizeEv(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 zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #2 align 2

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

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) local_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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { noreturn 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


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