; LLVM IR from AdarshGaur/Competitive-Programming :: Codeforces/Educational Codeforces Round 135 (Rated for Div. 2)/C.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::basic_istream" = type { ptr, i64, %"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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.anon = type { i8 }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_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 @_Z5solvev() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca %"class.std::priority_queue", align 8
  %3 = alloca %"class.std::priority_queue", align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca %class.anon, align 1
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #5
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  call void @llvm.lifetime.start.p0(i64 32, ptr %2) #5
  call void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %2)
  call void @llvm.lifetime.start.p0(i64 32, ptr %3) #5
  invoke void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
          to label %17 unwind label %23

17:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store i64 0, ptr %6, align 8, !tbaa !5
  br label %18

18:                                               ; preds = %31, %17
  %19 = load i64, ptr %6, align 8, !tbaa !5
  %20 = load i64, ptr %1, align 8, !tbaa !5
  %21 = icmp slt i64 %19, %20
  br i1 %21, label %27, label %22

22:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %38

23:                                               ; preds = %0
  %24 = landingpad { ptr, i32 }
          cleanup
  %25 = extractvalue { ptr, i32 } %24, 0
  store ptr %25, ptr %4, align 8
  %26 = extractvalue { ptr, i32 } %24, 1
  store i32 %26, ptr %5, align 4
  br label %125

27:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %28 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %29 unwind label %34

29:                                               ; preds = %27
  invoke void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE4pushERKl(ptr noundef nonnull align 8 dereferenceable(25) %2, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %30 unwind label %34

30:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %31

31:                                               ; preds = %30
  %32 = load i64, ptr %6, align 8, !tbaa !5
  %33 = add nsw i64 %32, 1
  store i64 %33, ptr %6, align 8, !tbaa !5
  br label %18, !llvm.loop !9

34:                                               ; preds = %29, %27
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %4, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %124

38:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store i64 0, ptr %8, align 8, !tbaa !5
  br label %39

39:                                               ; preds = %48, %38
  %40 = load i64, ptr %8, align 8, !tbaa !5
  %41 = load i64, ptr %1, align 8, !tbaa !5
  %42 = icmp slt i64 %40, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %55

44:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %45 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %46 unwind label %51

46:                                               ; preds = %44
  invoke void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE4pushERKl(ptr noundef nonnull align 8 dereferenceable(25) %3, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %47 unwind label %51

47:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %48

48:                                               ; preds = %47
  %49 = load i64, ptr %8, align 8, !tbaa !5
  %50 = add nsw i64 %49, 1
  store i64 %50, ptr %8, align 8, !tbaa !5
  br label %39, !llvm.loop !11

51:                                               ; preds = %46, %44
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %4, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %124

55:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store i64 0, ptr %11, align 8, !tbaa !5
  br label %56

56:                                               ; preds = %114, %55
  %57 = invoke noundef zeroext i1 @_ZNKSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %2)
          to label %58 unwind label %73

58:                                               ; preds = %56
  %59 = xor i1 %57, true
  br i1 %59, label %60, label %117

60:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %61 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %2)
          to label %62 unwind label %77

62:                                               ; preds = %60
  %63 = load i64, ptr %61, align 8, !tbaa !5
  store i64 %63, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %64 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
          to label %65 unwind label %81

65:                                               ; preds = %62
  %66 = load i64, ptr %64, align 8, !tbaa !5
  store i64 %66, ptr %13, align 8, !tbaa !5
  %67 = load i64, ptr %12, align 8, !tbaa !5
  %68 = load i64, ptr %13, align 8, !tbaa !5
  %69 = icmp eq i64 %67, %68
  br i1 %69, label %70, label %85

70:                                               ; preds = %65
  invoke void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %2)
          to label %71 unwind label %81

71:                                               ; preds = %70
  invoke void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
          to label %72 unwind label %81

72:                                               ; preds = %71
  br label %114

73:                                               ; preds = %120, %117, %56
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %4, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %5, align 4
  br label %123

77:                                               ; preds = %60
  %78 = landingpad { ptr, i32 }
          cleanup
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %4, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %5, align 4
  br label %116

81:                                               ; preds = %101, %89, %71, %70, %62
  %82 = landingpad { ptr, i32 }
          cleanup
  %83 = extractvalue { ptr, i32 } %82, 0
  store ptr %83, ptr %4, align 8
  %84 = extractvalue { ptr, i32 } %82, 1
  store i32 %84, ptr %5, align 4
  br label %115

85:                                               ; preds = %65
  %86 = load i64, ptr %12, align 8, !tbaa !5
  %87 = load i64, ptr %13, align 8, !tbaa !5
  %88 = icmp slt i64 %86, %87
  br i1 %88, label %89, label %101

89:                                               ; preds = %85
  %90 = load i64, ptr %11, align 8, !tbaa !5
  %91 = add nsw i64 %90, 1
  store i64 %91, ptr %11, align 8, !tbaa !5
  invoke void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
          to label %92 unwind label %81

92:                                               ; preds = %89
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %93 = load i64, ptr %13, align 8, !tbaa !5
  %94 = invoke noundef i64 @"_ZZ5solvevENK3$_0clEl"(ptr noundef nonnull align 1 dereferenceable(1) %10, i64 noundef %93)
          to label %95 unwind label %97

95:                                               ; preds = %92
  store i64 %94, ptr %14, align 8, !tbaa !5
  invoke void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE4pushEOl(ptr noundef nonnull align 8 dereferenceable(25) %3, ptr noundef nonnull align 8 dereferenceable(8) %14)
          to label %96 unwind label %97

96:                                               ; preds = %95
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %113

97:                                               ; preds = %95, %92
  %98 = landingpad { ptr, i32 }
          cleanup
  %99 = extractvalue { ptr, i32 } %98, 0
  store ptr %99, ptr %4, align 8
  %100 = extractvalue { ptr, i32 } %98, 1
  store i32 %100, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %115

101:                                              ; preds = %85
  %102 = load i64, ptr %11, align 8, !tbaa !5
  %103 = add nsw i64 %102, 1
  store i64 %103, ptr %11, align 8, !tbaa !5
  invoke void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %2)
          to label %104 unwind label %81

104:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %105 = load i64, ptr %12, align 8, !tbaa !5
  %106 = invoke noundef i64 @"_ZZ5solvevENK3$_0clEl"(ptr noundef nonnull align 1 dereferenceable(1) %10, i64 noundef %105)
          to label %107 unwind label %109

107:                                              ; preds = %104
  store i64 %106, ptr %15, align 8, !tbaa !5
  invoke void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE4pushEOl(ptr noundef nonnull align 8 dereferenceable(25) %2, ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %108 unwind label %109

108:                                              ; preds = %107
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %113

109:                                              ; preds = %107, %104
  %110 = landingpad { ptr, i32 }
          cleanup
  %111 = extractvalue { ptr, i32 } %110, 0
  store ptr %111, ptr %4, align 8
  %112 = extractvalue { ptr, i32 } %110, 1
  store i32 %112, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %115

113:                                              ; preds = %108, %96
  br label %114

114:                                              ; preds = %113, %72
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %56, !llvm.loop !12

115:                                              ; preds = %109, %97, %81
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %116

116:                                              ; preds = %115, %77
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %123

117:                                              ; preds = %58
  %118 = load i64, ptr %11, align 8, !tbaa !5
  %119 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %118)
          to label %120 unwind label %73

120:                                              ; preds = %117
  %121 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %119, ptr noundef @.str)
          to label %122 unwind label %73

122:                                              ; preds = %120
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #5
  call void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %3) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #5
  call void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %2) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  ret void

123:                                              ; preds = %116, %73
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #5
  br label %124

124:                                              ; preds = %123, %51, %34
  call void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %3) #5
  br label %125

125:                                              ; preds = %124, %23
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #5
  call void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %2) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  br label %126

126:                                              ; preds = %125
  %127 = load ptr, ptr %4, align 8
  %128 = load i32, ptr %5, align 4
  %129 = insertvalue { ptr, i32 } poison, ptr %127, 0
  %130 = insertvalue { ptr, i32 } %129, i32 %128, 1
  resume { ptr, i32 } %130
}

; 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 noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE4pushERKl(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 8 dereferenceable(8)) #0 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 @_ZNKSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) #2 align 2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef i64 @"_ZZ5solvevENK3$_0clEl"(ptr noundef nonnull align 1 dereferenceable(1), i64 noundef) #3 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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #4 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 = { 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 #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 = !{!"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}


; 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_istream" = type { ptr, i64, %"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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.anon = type { i8 }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_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 @_Z5solvev() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca %"class.std::priority_queue", align 8
  %3 = alloca %"class.std::priority_queue", align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca %class.anon, align 1
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #5
  call void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %2)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #5
  call void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
  %10 = load i64, ptr %1, align 8, !tbaa !5
  %11 = icmp sgt i64 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

.preheader:                                       ; preds = %15
  %12 = icmp sgt i64 %17, 0
  br i1 %12, label %.lr.ph32, label %._crit_edge

.lr.ph:                                           ; preds = %0, %15
  %.02030 = phi i64 [ %16, %15 ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %13 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %14 unwind label %19

14:                                               ; preds = %.lr.ph
  invoke void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE4pushERKl(ptr noundef nonnull align 8 dereferenceable(25) %2, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %15 unwind label %19

15:                                               ; preds = %14
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  %16 = add nuw nsw i64 %.02030, 1
  %17 = load i64, ptr %1, align 8, !tbaa !5
  %18 = icmp slt i64 %16, %17
  br i1 %18, label %.lr.ph, label %.preheader, !llvm.loop !9

19:                                               ; preds = %14, %.lr.ph
  %20 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %65

._crit_edge:                                      ; preds = %24, %0, %.preheader
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #5
  %21 = call noundef zeroext i1 @_ZNKSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %2)
  br i1 %21, label %._crit_edge36, label %.lr.ph35

.lr.ph32:                                         ; preds = %.preheader, %24
  %.01931 = phi i64 [ %25, %24 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %22 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %23 unwind label %28

23:                                               ; preds = %.lr.ph32
  invoke void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE4pushERKl(ptr noundef nonnull align 8 dereferenceable(25) %3, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %24 unwind label %28

24:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  %25 = add nuw nsw i64 %.01931, 1
  %26 = load i64, ptr %1, align 8, !tbaa !5
  %27 = icmp slt i64 %25, %26
  br i1 %27, label %.lr.ph32, label %._crit_edge, !llvm.loop !11

28:                                               ; preds = %23, %.lr.ph32
  %29 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br label %65

.lr.ph35:                                         ; preds = %._crit_edge, %58
  %.01733 = phi i64 [ %.118, %58 ], [ 0, %._crit_edge ]
  %30 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %2)
  %31 = load i64, ptr %30, align 8, !tbaa !5
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
  %33 = load i64, ptr %32, align 8, !tbaa !5
  %34 = icmp eq i64 %31, %33
  br i1 %34, label %35, label %41

35:                                               ; preds = %.lr.ph35
  invoke void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %2)
          to label %36 unwind label %39

36:                                               ; preds = %35
  invoke void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
          to label %58 unwind label %39

37:                                               ; preds = %61, %._crit_edge36
  %38 = landingpad { ptr, i32 }
          cleanup
  br label %64

39:                                               ; preds = %51, %44, %36, %35
  %40 = landingpad { ptr, i32 }
          cleanup
  br label %64

41:                                               ; preds = %.lr.ph35
  %42 = icmp slt i64 %31, %33
  %43 = add nsw i64 %.01733, 1
  br i1 %42, label %44, label %51

44:                                               ; preds = %41
  invoke void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
          to label %45 unwind label %39

45:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  %46 = invoke noundef i64 @"_ZZ5solvevENK3$_0clEl"(ptr noundef nonnull align 1 dereferenceable(1) %6, i64 noundef %33)
          to label %47 unwind label %49

47:                                               ; preds = %45
  store i64 %46, ptr %7, align 8, !tbaa !5
  invoke void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE4pushEOl(ptr noundef nonnull align 8 dereferenceable(25) %3, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %48 unwind label %49

48:                                               ; preds = %47
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br label %58

49:                                               ; preds = %47, %45
  %50 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br label %64

51:                                               ; preds = %41
  invoke void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %2)
          to label %52 unwind label %39

52:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  %53 = invoke noundef i64 @"_ZZ5solvevENK3$_0clEl"(ptr noundef nonnull align 1 dereferenceable(1) %6, i64 noundef %31)
          to label %54 unwind label %56

54:                                               ; preds = %52
  store i64 %53, ptr %8, align 8, !tbaa !5
  invoke void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE4pushEOl(ptr noundef nonnull align 8 dereferenceable(25) %2, ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %55 unwind label %56

55:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  br label %58

56:                                               ; preds = %54, %52
  %57 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  br label %64

58:                                               ; preds = %48, %55, %36
  %.118 = phi i64 [ %.01733, %36 ], [ %43, %48 ], [ %43, %55 ]
  %59 = call noundef zeroext i1 @_ZNKSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %2)
  br i1 %59, label %._crit_edge36, label %.lr.ph35, !llvm.loop !12

._crit_edge36:                                    ; preds = %58, %._crit_edge
  %.017.lcssa = phi i64 [ 0, %._crit_edge ], [ %.118, %58 ]
  %60 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.017.lcssa)
          to label %61 unwind label %37

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

63:                                               ; preds = %61
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #5
  call void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %3) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #5
  call void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %2) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret void

64:                                               ; preds = %39, %49, %56, %37
  %.pn.pn = phi { ptr, i32 } [ %38, %37 ], [ %40, %39 ], [ %50, %49 ], [ %57, %56 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #5
  br label %65

65:                                               ; preds = %64, %28, %19
  %.pn25 = phi { ptr, i32 } [ %20, %19 ], [ %29, %28 ], [ %.pn.pn, %64 ]
  call void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %3) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #5
  call void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %2) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  resume { ptr, i32 } %.pn25
}

; 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 noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE4pushERKl(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 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 @_ZNKSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #2 align 2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef i64 @"_ZZ5solvevENK3$_0clEl"(ptr noundef nonnull align 1 dereferenceable(1), i64 noundef) local_unnamed_addr #3 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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueIlSt6vectorIlSaIlEESt4lessIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #4 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 = { 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 #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 = !{!"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: GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass