; LLVM IR from tangjz/acm-icpc :: leetcode/extra/bytedance_016-最短移动距离.ll (Z3dfsii)

; 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<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::priority_queue" = type <{ %"class.std::vector.0", [8 x i8] }>
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = 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.__gnu_cxx::__normal_iterator" = type { ptr }
%"struct.std::pair" = type { i32, i32 }

@cap = external dso_local global [100001 x i32], align 16
@rem = external dso_local global [100001 x i32], align 16
@e = external dso_local global [100001 x %"class.std::vector"], align 16
@tag = external dso_local global [2 x [100001 x i64]], align 16
@que = external dso_local global [2 x [100001 x %"class.std::priority_queue"]], align 16

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

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z3dfsii(i32 noundef %0, i32 noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::priority_queue", align 8
  %9 = alloca %"class.std::priority_queue", align 8
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %15 = alloca i32, align 4
  %16 = alloca %"struct.std::pair", align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store i64 0, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [100001 x i32], ptr @cap, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = sub nsw i32 0, %28
  store i32 %29, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  %30 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [100001 x i32], ptr @rem, i64 0, i64 %33
  store i32 %31, ptr %34, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [100001 x i64], ptr getelementptr inbounds ([2 x [100001 x i64]], ptr @tag, i64 0, i64 1), i64 0, i64 %36
  store i64 0, ptr %37, align 8, !tbaa !9
  %38 = load i32, ptr %3, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [100001 x i64], ptr @tag, i64 0, i64 %39
  store i64 0, ptr %40, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #5
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %8)
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr @que, i64 0, i64 %42
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4swapERS5_(ptr noundef nonnull align 8 dereferenceable(25) %8, ptr noundef nonnull align 8 dereferenceable(25) %43) #5
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %8) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #5
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %9)
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr getelementptr inbounds ([2 x [100001 x %"class.std::priority_queue"]], ptr @que, i64 0, i64 1), i64 0, i64 %45
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4swapERS5_(ptr noundef nonnull align 8 dereferenceable(25) %9, ptr noundef nonnull align 8 dereferenceable(25) %46) #5
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %9) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %59, %2
  %48 = load i32, ptr %10, align 4, !tbaa !5
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [100001 x i32], ptr @cap, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = icmp slt i32 %48, %52
  br i1 %53, label %55, label %54

54:                                               ; preds = %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %62

55:                                               ; preds = %47
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr @que, i64 0, i64 %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store i64 0, ptr %11, align 8, !tbaa !9
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4pushEOx(ptr noundef nonnull align 8 dereferenceable(25) %58, ptr noundef nonnull align 8 dereferenceable(8) %11)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %59

59:                                               ; preds = %55
  %60 = load i32, ptr %10, align 4, !tbaa !5
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %10, align 4, !tbaa !5
  br label %47, !llvm.loop !11

62:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %63 = load i32, ptr %3, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @e, i64 0, i64 %64
  store ptr %65, ptr %12, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %66 = load ptr, ptr %12, align 8, !tbaa !13
  %67 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %66) #5
  %68 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %67, ptr %68, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %69 = load ptr, ptr %12, align 8, !tbaa !13
  %70 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %69) #5
  %71 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  store ptr %70, ptr %71, align 8
  br label %72

72:                                               ; preds = %147, %62
  %73 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14) #5
  br i1 %73, label %75, label %74

74:                                               ; preds = %72
  store i32 5, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %149

75:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %76 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 4 %76, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %77 = getelementptr inbounds %"struct.std::pair", ptr %16, i32 0, i32 0
  %78 = load i32, ptr %77, align 4, !tbaa !15
  store i32 %78, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %79 = getelementptr inbounds %"struct.std::pair", ptr %16, i32 0, i32 1
  %80 = load i32, ptr %79, align 4, !tbaa !17
  store i32 %80, ptr %18, align 4, !tbaa !5
  %81 = load i32, ptr %17, align 4, !tbaa !5
  %82 = load i32, ptr %4, align 4, !tbaa !5
  %83 = icmp eq i32 %81, %82
  br i1 %83, label %84, label %85

84:                                               ; preds = %75
  store i32 6, ptr %15, align 4
  br label %141

85:                                               ; preds = %75
  %86 = load i32, ptr %17, align 4, !tbaa !5
  %87 = load i32, ptr %3, align 4, !tbaa !5
  %88 = call noundef i64 @_Z3dfsii(i32 noundef %86, i32 noundef %87)
  %89 = load i32, ptr %17, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [100001 x i32], ptr @rem, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = load i32, ptr %18, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = mul nsw i64 %93, %95
  %97 = add nsw i64 %88, %96
  %98 = load i64, ptr %5, align 8, !tbaa !9
  %99 = add nsw i64 %98, %97
  store i64 %99, ptr %5, align 8, !tbaa !9
  %100 = load i32, ptr %17, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [100001 x i32], ptr @rem, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = load i32, ptr %3, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [100001 x i32], ptr @rem, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = add nsw i32 %107, %103
  store i32 %108, ptr %106, align 4, !tbaa !5
  %109 = load i32, ptr %3, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [100001 x i64], ptr @tag, i64 0, i64 %110
  %112 = load i32, ptr %3, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr @que, i64 0, i64 %113
  %115 = load i32, ptr %18, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = load i32, ptr %17, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [100001 x i64], ptr @tag, i64 0, i64 %118
  %120 = load i64, ptr %119, align 8, !tbaa !9
  %121 = add nsw i64 %120, %116
  store i64 %121, ptr %119, align 8, !tbaa !9
  %122 = load i32, ptr %17, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr @que, i64 0, i64 %123
  call void @_Z5mergeRxRSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEES_S7_(ptr noundef nonnull align 8 dereferenceable(8) %111, ptr noundef nonnull align 8 dereferenceable(25) %114, ptr noundef nonnull align 8 dereferenceable(8) %119, ptr noundef nonnull align 8 dereferenceable(25) %124)
  %125 = load i32, ptr %3, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [100001 x i64], ptr getelementptr inbounds ([2 x [100001 x i64]], ptr @tag, i64 0, i64 1), i64 0, i64 %126
  %128 = load i32, ptr %3, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr getelementptr inbounds ([2 x [100001 x %"class.std::priority_queue"]], ptr @que, i64 0, i64 1), i64 0, i64 %129
  %131 = load i32, ptr %18, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = load i32, ptr %17, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [100001 x i64], ptr getelementptr inbounds ([2 x [100001 x i64]], ptr @tag, i64 0, i64 1), i64 0, i64 %134
  %136 = load i64, ptr %135, align 8, !tbaa !9
  %137 = add nsw i64 %136, %132
  store i64 %137, ptr %135, align 8, !tbaa !9
  %138 = load i32, ptr %17, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr getelementptr inbounds ([2 x [100001 x %"class.std::priority_queue"]], ptr @que, i64 0, i64 1), i64 0, i64 %139
  call void @_Z5mergeRxRSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEES_S7_(ptr noundef nonnull align 8 dereferenceable(8) %127, ptr noundef nonnull align 8 dereferenceable(25) %130, ptr noundef nonnull align 8 dereferenceable(8) %135, ptr noundef nonnull align 8 dereferenceable(25) %140)
  store i32 0, ptr %15, align 4
  br label %141

141:                                              ; preds = %85, %84
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  %142 = load i32, ptr %15, align 4
  switch i32 %142, label %144 [
    i32 0, label %143
  ]

143:                                              ; preds = %141
  store i32 0, ptr %15, align 4
  br label %144

144:                                              ; preds = %143, %141
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  %145 = load i32, ptr %15, align 4
  switch i32 %145, label %266 [
    i32 0, label %146
    i32 6, label %147
  ]

146:                                              ; preds = %144
  br label %147

147:                                              ; preds = %146, %144
  %148 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #5
  br label %72

149:                                              ; preds = %74
  br label %150

150:                                              ; preds = %164, %149
  %151 = load i32, ptr %3, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [100001 x i32], ptr @rem, i64 0, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !5
  %155 = icmp ne i32 %154, 0
  br i1 %155, label %156, label %162

156:                                              ; preds = %150
  %157 = load i32, ptr %3, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr @que, i64 0, i64 %158
  %160 = call noundef zeroext i1 @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %159)
  %161 = xor i1 %160, true
  br label %162

162:                                              ; preds = %156, %150
  %163 = phi i1 [ false, %150 ], [ %161, %156 ]
  br i1 %163, label %164, label %196

164:                                              ; preds = %162
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %165 = load i32, ptr %3, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr @que, i64 0, i64 %166
  %168 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %167)
  %169 = load i64, ptr %168, align 8, !tbaa !9
  %170 = load i32, ptr %3, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [100001 x i64], ptr @tag, i64 0, i64 %171
  %173 = load i64, ptr %172, align 8, !tbaa !9
  %174 = add nsw i64 %169, %173
  store i64 %174, ptr %19, align 8, !tbaa !9
  %175 = load i32, ptr %3, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr @que, i64 0, i64 %176
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %177)
  %178 = load i32, ptr %3, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr getelementptr inbounds ([2 x [100001 x %"class.std::priority_queue"]], ptr @que, i64 0, i64 1), i64 0, i64 %179
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %181 = load i64, ptr %19, align 8, !tbaa !9
  %182 = sub nsw i64 0, %181
  %183 = load i32, ptr %3, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [100001 x i64], ptr getelementptr inbounds ([2 x [100001 x i64]], ptr @tag, i64 0, i64 1), i64 0, i64 %184
  %186 = load i64, ptr %185, align 8, !tbaa !9
  %187 = sub nsw i64 %182, %186
  store i64 %187, ptr %20, align 8, !tbaa !9
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4pushEOx(ptr noundef nonnull align 8 dereferenceable(25) %180, ptr noundef nonnull align 8 dereferenceable(8) %20)
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  %188 = load i32, ptr %3, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [100001 x i32], ptr @rem, i64 0, i64 %189
  %191 = load i32, ptr %190, align 4, !tbaa !5
  %192 = add nsw i32 %191, -1
  store i32 %192, ptr %190, align 4, !tbaa !5
  %193 = load i64, ptr %19, align 8, !tbaa !9
  %194 = load i64, ptr %5, align 8, !tbaa !9
  %195 = add nsw i64 %194, %193
  store i64 %195, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  br label %150, !llvm.loop !18

196:                                              ; preds = %162
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  br label %197

197:                                              ; preds = %232, %196
  %198 = load i32, ptr %3, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr @que, i64 0, i64 %199
  %201 = call noundef zeroext i1 @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %200)
  br i1 %201, label %230, label %202

202:                                              ; preds = %197
  %203 = load i32, ptr %3, align 4, !tbaa !5
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr getelementptr inbounds ([2 x [100001 x %"class.std::priority_queue"]], ptr @que, i64 0, i64 1), i64 0, i64 %204
  %206 = call noundef zeroext i1 @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %205)
  br i1 %206, label %230, label %207

207:                                              ; preds = %202
  %208 = load i32, ptr %3, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr @que, i64 0, i64 %209
  %211 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %210)
  %212 = load i64, ptr %211, align 8, !tbaa !9
  %213 = load i32, ptr %3, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [100001 x i64], ptr @tag, i64 0, i64 %214
  %216 = load i64, ptr %215, align 8, !tbaa !9
  %217 = add nsw i64 %212, %216
  store i64 %217, ptr %21, align 8, !tbaa !9
  %218 = load i32, ptr %3, align 4, !tbaa !5
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr getelementptr inbounds ([2 x [100001 x %"class.std::priority_queue"]], ptr @que, i64 0, i64 1), i64 0, i64 %219
  %221 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %220)
  %222 = load i64, ptr %221, align 8, !tbaa !9
  %223 = load i32, ptr %3, align 4, !tbaa !5
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds [100001 x i64], ptr getelementptr inbounds ([2 x [100001 x i64]], ptr @tag, i64 0, i64 1), i64 0, i64 %224
  %226 = load i64, ptr %225, align 8, !tbaa !9
  %227 = add nsw i64 %222, %226
  store i64 %227, ptr %22, align 8, !tbaa !9
  %228 = add nsw i64 %217, %227
  %229 = icmp slt i64 %228, 0
  br label %230

230:                                              ; preds = %207, %202, %197
  %231 = phi i1 [ false, %202 ], [ false, %197 ], [ %229, %207 ]
  br i1 %231, label %232, label %264

232:                                              ; preds = %230
  %233 = load i64, ptr %21, align 8, !tbaa !9
  %234 = load i64, ptr %22, align 8, !tbaa !9
  %235 = add nsw i64 %233, %234
  %236 = load i64, ptr %5, align 8, !tbaa !9
  %237 = add nsw i64 %236, %235
  store i64 %237, ptr %5, align 8, !tbaa !9
  %238 = load i32, ptr %3, align 4, !tbaa !5
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr @que, i64 0, i64 %239
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %240)
  %241 = load i32, ptr %3, align 4, !tbaa !5
  %242 = sext i32 %241 to i64
  %243 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr getelementptr inbounds ([2 x [100001 x %"class.std::priority_queue"]], ptr @que, i64 0, i64 1), i64 0, i64 %242
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %243)
  %244 = load i32, ptr %3, align 4, !tbaa !5
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr @que, i64 0, i64 %245
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #5
  %247 = load i64, ptr %22, align 8, !tbaa !9
  %248 = sub nsw i64 0, %247
  %249 = load i32, ptr %3, align 4, !tbaa !5
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds [100001 x i64], ptr @tag, i64 0, i64 %250
  %252 = load i64, ptr %251, align 8, !tbaa !9
  %253 = sub nsw i64 %248, %252
  store i64 %253, ptr %23, align 8, !tbaa !9
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4pushEOx(ptr noundef nonnull align 8 dereferenceable(25) %246, ptr noundef nonnull align 8 dereferenceable(8) %23)
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  %254 = load i32, ptr %3, align 4, !tbaa !5
  %255 = sext i32 %254 to i64
  %256 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr getelementptr inbounds ([2 x [100001 x %"class.std::priority_queue"]], ptr @que, i64 0, i64 1), i64 0, i64 %255
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #5
  %257 = load i64, ptr %21, align 8, !tbaa !9
  %258 = sub nsw i64 0, %257
  %259 = load i32, ptr %3, align 4, !tbaa !5
  %260 = sext i32 %259 to i64
  %261 = getelementptr inbounds [100001 x i64], ptr getelementptr inbounds ([2 x [100001 x i64]], ptr @tag, i64 0, i64 1), i64 0, i64 %260
  %262 = load i64, ptr %261, align 8, !tbaa !9
  %263 = sub nsw i64 %258, %262
  store i64 %263, ptr %24, align 8, !tbaa !9
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4pushEOx(ptr noundef nonnull align 8 dereferenceable(25) %256, ptr noundef nonnull align 8 dereferenceable(8) %24)
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  br label %197, !llvm.loop !19

264:                                              ; preds = %230
  %265 = load i64, ptr %5, align 8, !tbaa !9
  store i32 1, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  ret i64 %265

266:                                              ; preds = %144
  unreachable
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #1

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #1

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

attributes #0 = { 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 #1 = { 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 #2 = { 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!17 = !{!16, !6, i64 4}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


; 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<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::priority_queue" = type <{ %"class.std::vector.0", [8 x i8] }>
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = 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.__gnu_cxx::__normal_iterator" = type { ptr }

@cap = external dso_local local_unnamed_addr global [100001 x i32], align 16
@rem = external dso_local local_unnamed_addr global [100001 x i32], align 16
@e = external dso_local global [100001 x %"class.std::vector"], align 16
@tag = external dso_local global [2 x [100001 x i64]], align 16
@que = external dso_local global [2 x [100001 x %"class.std::priority_queue"]], align 16

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3topEv(ptr noundef nonnull align 8 dereferenceable(25)) 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) #3

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z3dfsii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #2 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::priority_queue", align 8
  %6 = alloca %"class.std::priority_queue", align 8
  %7 = alloca i64, align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %13 = sext i32 %0 to i64
  %14 = getelementptr inbounds [100001 x i32], ptr @cap, i64 0, i64 %13
  %15 = load i32, ptr %14, align 4, !tbaa !5
  %16 = sub nsw i32 0, %15
  store i32 %16, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  %17 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = getelementptr inbounds [100001 x i32], ptr @rem, i64 0, i64 %13
  store i32 %18, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  %20 = getelementptr inbounds [100001 x i64], ptr getelementptr inbounds (i8, ptr @tag, i64 800008), i64 0, i64 %13
  store i64 0, ptr %20, align 8, !tbaa !9
  %21 = getelementptr inbounds [100001 x i64], ptr @tag, i64 0, i64 %13
  store i64 0, ptr %21, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #4
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %5)
  %22 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr @que, i64 0, i64 %13
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4swapERS5_(ptr noundef nonnull align 8 dereferenceable(25) %5, ptr noundef nonnull align 8 dereferenceable(25) %22) #4
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %5) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #4
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %6)
  %23 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr getelementptr inbounds (i8, ptr @que, i64 3200032), i64 0, i64 %13
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4swapERS5_(ptr noundef nonnull align 8 dereferenceable(25) %6, ptr noundef nonnull align 8 dereferenceable(25) %23) #4
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %6) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #4
  %24 = load i32, ptr %14, align 4, !tbaa !5
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %2
  %26 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @e, i64 0, i64 %13
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  %27 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %26) #4
  store ptr %27, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  %28 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %26) #4
  store ptr %28, ptr %9, align 8
  %29 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #4
  br i1 %29, label %.lr.ph69, label %._crit_edge70

.lr.ph:                                           ; preds = %2, %.lr.ph
  %.06366 = phi i32 [ %30, %.lr.ph ], [ 0, %2 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  store i64 0, ptr %7, align 8, !tbaa !9
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4pushEOx(ptr noundef nonnull align 8 dereferenceable(25) %22, ptr noundef nonnull align 8 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  %30 = add nuw nsw i32 %.06366, 1
  %31 = load i32, ptr %14, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge70:                                    ; preds = %55, %._crit_edge
  %.0.lcssa = phi i64 [ 0, %._crit_edge ], [ %.1, %55 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  %.pr = load i32, ptr %19, align 4, !tbaa !5
  %.not71 = icmp eq i32 %.pr, 0
  br i1 %.not71, label %.critedge, label %.lr.ph74

.lr.ph69:                                         ; preds = %._crit_edge, %55
  %.067 = phi i64 [ %.1, %55 ], [ 0, %._crit_edge ]
  %33 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  %.sroa.0.0.copyload = load i32, ptr %33, align 4
  %34 = icmp eq i32 %.sroa.0.0.copyload, %1
  br i1 %34, label %55, label %35

35:                                               ; preds = %.lr.ph69
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %33, i64 4
  %.sroa.4.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 4
  %36 = call noundef i64 @_Z3dfsii(i32 noundef %.sroa.0.0.copyload, i32 noundef %0)
  %37 = sext i32 %.sroa.0.0.copyload to i64
  %38 = getelementptr inbounds [100001 x i32], ptr @rem, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = sext i32 %.sroa.4.0.copyload to i64
  %42 = mul nsw i64 %40, %41
  %43 = add i64 %36, %.067
  %44 = add i64 %43, %42
  %45 = load i32, ptr %19, align 4, !tbaa !5
  %46 = add nsw i32 %45, %39
  store i32 %46, ptr %19, align 4, !tbaa !5
  %47 = getelementptr inbounds [100001 x i64], ptr @tag, i64 0, i64 %37
  %48 = load i64, ptr %47, align 8, !tbaa !9
  %49 = add nsw i64 %48, %41
  store i64 %49, ptr %47, align 8, !tbaa !9
  %50 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr @que, i64 0, i64 %37
  call void @_Z5mergeRxRSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEES_S7_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 8 dereferenceable(25) %22, ptr noundef nonnull align 8 dereferenceable(8) %47, ptr noundef nonnull align 8 dereferenceable(25) %50)
  %51 = getelementptr inbounds [100001 x i64], ptr getelementptr inbounds (i8, ptr @tag, i64 800008), i64 0, i64 %37
  %52 = load i64, ptr %51, align 8, !tbaa !9
  %53 = add nsw i64 %52, %41
  store i64 %53, ptr %51, align 8, !tbaa !9
  %54 = getelementptr inbounds [100001 x %"class.std::priority_queue"], ptr getelementptr inbounds (i8, ptr @que, i64 3200032), i64 0, i64 %37
  call void @_Z5mergeRxRSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEES_S7_(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull align 8 dereferenceable(25) %23, ptr noundef nonnull align 8 dereferenceable(8) %51, ptr noundef nonnull align 8 dereferenceable(25) %54)
  br label %55

55:                                               ; preds = %.lr.ph69, %35
  %.1 = phi i64 [ %44, %35 ], [ %.067, %.lr.ph69 ]
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  %57 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #4
  br i1 %57, label %.lr.ph69, label %._crit_edge70

.lr.ph74:                                         ; preds = %._crit_edge70, %59
  %.272 = phi i64 [ %69, %59 ], [ %.0.lcssa, %._crit_edge70 ]
  %58 = call noundef zeroext i1 @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %22)
  br i1 %58, label %.critedge, label %59

59:                                               ; preds = %.lr.ph74
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %22)
  %61 = load i64, ptr %60, align 8, !tbaa !9
  %62 = load i64, ptr %21, align 8, !tbaa !9
  %63 = add nsw i64 %62, %61
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %22)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #4
  %64 = load i64, ptr %20, align 8, !tbaa !9
  %65 = add i64 %63, %64
  %66 = sub i64 0, %65
  store i64 %66, ptr %10, align 8, !tbaa !9
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4pushEOx(ptr noundef nonnull align 8 dereferenceable(25) %23, ptr noundef nonnull align 8 dereferenceable(8) %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #4
  %67 = load i32, ptr %19, align 4, !tbaa !5
  %68 = add nsw i32 %67, -1
  store i32 %68, ptr %19, align 4, !tbaa !5
  %69 = add nsw i64 %63, %.272
  %.not = icmp eq i32 %68, 0
  br i1 %.not, label %.critedge, label %.lr.ph74, !llvm.loop !13

.critedge:                                        ; preds = %.lr.ph74, %59, %._crit_edge70
  %.2.lcssa = phi i64 [ %.0.lcssa, %._crit_edge70 ], [ %69, %59 ], [ %.272, %.lr.ph74 ]
  %70 = call noundef zeroext i1 @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %22)
  br i1 %70, label %.critedge2, label %.lr.ph79

.lr.ph79:                                         ; preds = %.critedge, %83
  %.378 = phi i64 [ %84, %83 ], [ %.2.lcssa, %.critedge ]
  %71 = call noundef zeroext i1 @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %23)
  br i1 %71, label %.critedge2, label %72

72:                                               ; preds = %.lr.ph79
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %22)
  %74 = load i64, ptr %73, align 8, !tbaa !9
  %75 = load i64, ptr %21, align 8, !tbaa !9
  %76 = add nsw i64 %75, %74
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %23)
  %78 = load i64, ptr %77, align 8, !tbaa !9
  %79 = load i64, ptr %20, align 8, !tbaa !9
  %80 = add nsw i64 %79, %78
  %81 = add nsw i64 %80, %76
  %82 = icmp slt i64 %81, 0
  br i1 %82, label %83, label %.critedge2

83:                                               ; preds = %72
  %84 = add nsw i64 %81, %.378
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %22)
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %23)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #4
  %85 = load i64, ptr %21, align 8, !tbaa !9
  %86 = add i64 %80, %85
  %87 = sub i64 0, %86
  store i64 %87, ptr %11, align 8, !tbaa !9
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4pushEOx(ptr noundef nonnull align 8 dereferenceable(25) %22, ptr noundef nonnull align 8 dereferenceable(8) %11)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #4
  %88 = load i64, ptr %20, align 8, !tbaa !9
  %89 = add i64 %76, %88
  %90 = sub i64 0, %89
  store i64 %90, ptr %12, align 8, !tbaa !9
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4pushEOx(ptr noundef nonnull align 8 dereferenceable(25) %23, ptr noundef nonnull align 8 dereferenceable(8) %12)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #4
  %91 = call noundef zeroext i1 @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %22)
  br i1 %91, label %.critedge2, label %.lr.ph79, !llvm.loop !14

.critedge2:                                       ; preds = %72, %83, %.lr.ph79, %.critedge
  %.3.lcssa = phi i64 [ %.2.lcssa, %.critedge ], [ %.378, %.lr.ph79 ], [ %84, %83 ], [ %.378, %72 ]
  ret i64 %.3.lcssa
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1

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

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

attributes #0 = { 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 #1 = { 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 #2 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}


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