; LLVM IR from tangjz/acm-icpc :: loj (6254)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::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<Node, std::allocator<Node>>::_Vector_impl" }
%"struct.std::_Vector_base<Node, std::allocator<Node>>::_Vector_impl" = type { %"struct.std::_Vector_base<Node, std::allocator<Node>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Node, std::allocator<Node>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%struct.Node = type { i64, i32, i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@sz = external dso_local global [100001 x i32], align 16
@seq = external dso_local global [100001 x %"class.std::vector"], align 16
@Q = external dso_local global %"class.std::priority_queue", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpRKSt6vectorIxSaIxEES3_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i64, 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 %"class.std::vector", align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %struct.Node, align 8
  %14 = alloca i32, align 4
  %15 = alloca %struct.Node, align 8
  %16 = alloca i64, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca %struct.Node, align 8
  %21 = alloca %struct.Node, align 8
  %22 = alloca %struct.Node, align 8
  store i32 0, ptr %1, align 4
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #8
  store i64 0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %126, %0
  %25 = load i32, ptr %3, align 4, !tbaa !9
  %26 = load i32, ptr @n, align 4, !tbaa !9
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %129

29:                                               ; preds = %24
  %30 = load i32, ptr %3, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds i32, ptr @sz, i64 %31
  %33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %32)
  %34 = load i32, ptr %3, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @seq, i64 0, i64 %35
  %37 = load i32, ptr %3, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  call void @_ZNSt6vectorIxSaIxEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %36, i64 noundef %41)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %42

42:                                               ; preds = %57, %29
  %43 = load i32, ptr %5, align 4, !tbaa !9
  %44 = load i32, ptr %3, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %48 = icmp slt i32 %43, %47
  br i1 %48, label %50, label %49

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

50:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %51 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %6)
  %52 = load i32, ptr %3, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @seq, i64 0, i64 %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %55 = load i64, ptr %6, align 8, !tbaa !5
  %56 = sub nsw i64 0, %55
  store i64 %56, ptr %7, align 8, !tbaa !5
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %54, ptr noundef nonnull align 8 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  br label %57

57:                                               ; preds = %50
  %58 = load i32, ptr %5, align 4, !tbaa !9
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %5, align 4, !tbaa !9
  br label %42, !llvm.loop !11

60:                                               ; preds = %49
  %61 = load i32, ptr %3, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @seq, i64 0, i64 %62
  %64 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %63) #8
  %65 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %64, ptr %65, align 8
  %66 = load i32, ptr %3, align 4, !tbaa !9
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @seq, i64 0, i64 %67
  %69 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %68) #8
  %70 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %69, ptr %70, align 8
  %71 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8
  %73 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  %74 = load ptr, ptr %73, align 8
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr %72, ptr %74)
  %75 = load i32, ptr %3, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @seq, i64 0, i64 %76
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %77, i64 noundef 0) #8
  %79 = load i64, ptr %78, align 8, !tbaa !5
  %80 = load i64, ptr %2, align 8, !tbaa !5
  %81 = add nsw i64 %80, %79
  store i64 %81, ptr %2, align 8, !tbaa !5
  %82 = load i32, ptr %3, align 4, !tbaa !9
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !9
  %86 = icmp eq i32 %85, 1
  br i1 %86, label %87, label %94

87:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #8
  call void @llvm.memset.p0.i64(ptr align 8 %10, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #8
  %88 = load i32, ptr %3, align 4, !tbaa !9
  %89 = add nsw i32 %88, -1
  store i32 %89, ptr %3, align 4, !tbaa !9
  %90 = sext i32 %88 to i64
  %91 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @seq, i64 0, i64 %90
  call void @_ZNSt6vectorIxSaIxEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %91) #8
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #8
  %92 = load i32, ptr @n, align 4, !tbaa !9
  %93 = add nsw i32 %92, -1
  store i32 %93, ptr @n, align 4, !tbaa !9
  br label %125

94:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  %95 = load i32, ptr %3, align 4, !tbaa !9
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !9
  %99 = sub nsw i32 %98, 1
  store i32 %99, ptr %11, align 4, !tbaa !9
  br label %100

100:                                              ; preds = %121, %94
  %101 = load i32, ptr %11, align 4, !tbaa !9
  %102 = icmp sge i32 %101, 0
  br i1 %102, label %104, label %103

103:                                              ; preds = %100
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %124

104:                                              ; preds = %100
  %105 = load i32, ptr %3, align 4, !tbaa !9
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @seq, i64 0, i64 %106
  %108 = load i32, ptr %11, align 4, !tbaa !9
  %109 = sub nsw i32 %108, 1
  %110 = sext i32 %109 to i64
  %111 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %107, i64 noundef %110) #8
  %112 = load i64, ptr %111, align 8, !tbaa !5
  %113 = load i32, ptr %3, align 4, !tbaa !9
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @seq, i64 0, i64 %114
  %116 = load i32, ptr %11, align 4, !tbaa !9
  %117 = sext i32 %116 to i64
  %118 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %115, i64 noundef %117) #8
  %119 = load i64, ptr %118, align 8, !tbaa !5
  %120 = sub nsw i64 %119, %112
  store i64 %120, ptr %118, align 8, !tbaa !5
  br label %121

121:                                              ; preds = %104
  %122 = load i32, ptr %11, align 4, !tbaa !9
  %123 = add nsw i32 %122, -1
  store i32 %123, ptr %11, align 4, !tbaa !9
  br label %100, !llvm.loop !13

124:                                              ; preds = %103
  br label %125

125:                                              ; preds = %124, %87
  br label %126

126:                                              ; preds = %125
  %127 = load i32, ptr %3, align 4, !tbaa !9
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %3, align 4, !tbaa !9
  br label %24, !llvm.loop !14

129:                                              ; preds = %28
  %130 = load i32, ptr @n, align 4, !tbaa !9
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds %"class.std::vector", ptr @seq, i64 %131
  call void @_ZSt4sortIPSt6vectorIxSaIxEEPFbRKS2_S5_EEvT_S8_T0_(ptr noundef @seq, ptr noundef %132, ptr noundef @_Z3cmpRKSt6vectorIxSaIxEES3_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %133

133:                                              ; preds = %147, %129
  %134 = load i32, ptr %12, align 4, !tbaa !9
  %135 = load i32, ptr @n, align 4, !tbaa !9
  %136 = icmp slt i32 %134, %135
  br i1 %136, label %138, label %137

137:                                              ; preds = %133
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %150

138:                                              ; preds = %133
  %139 = load i32, ptr %12, align 4, !tbaa !9
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @seq, i64 0, i64 %140
  %142 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %141) #8
  %143 = trunc i64 %142 to i32
  %144 = load i32, ptr %12, align 4, !tbaa !9
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %145
  store i32 %143, ptr %146, align 4, !tbaa !9
  br label %147

147:                                              ; preds = %138
  %148 = load i32, ptr %12, align 4, !tbaa !9
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %12, align 4, !tbaa !9
  br label %133, !llvm.loop !15

150:                                              ; preds = %137
  br label %151

151:                                              ; preds = %155, %150
  %152 = call noundef zeroext i1 @_ZNKSt14priority_queueI4NodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %153 = xor i1 %152, true
  br i1 %153, label %154, label %156

154:                                              ; preds = %151
  br label %155

155:                                              ; preds = %154
  call void @_ZNSt14priority_queueI4NodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  br label %151, !llvm.loop !16

156:                                              ; preds = %151
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #8
  %157 = getelementptr inbounds %struct.Node, ptr %13, i32 0, i32 0
  %158 = load i64, ptr %2, align 8, !tbaa !5
  %159 = sub nsw i64 0, %158
  store i64 %159, ptr %157, align 8, !tbaa !17
  %160 = getelementptr inbounds %struct.Node, ptr %13, i32 0, i32 1
  store i32 0, ptr %160, align 8, !tbaa !19
  %161 = getelementptr inbounds %struct.Node, ptr %13, i32 0, i32 2
  store i32 0, ptr %161, align 4, !tbaa !20
  %162 = getelementptr inbounds %struct.Node, ptr %13, i32 0, i32 3
  store i32 0, ptr %162, align 8, !tbaa !21
  call void @_ZNSt14priority_queueI4NodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(24) %13)
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %163

163:                                              ; preds = %258, %156
  %164 = load i32, ptr %14, align 4, !tbaa !9
  %165 = load i32, ptr @m, align 4, !tbaa !9
  %166 = icmp slt i32 %164, %165
  br i1 %166, label %168, label %167

167:                                              ; preds = %163
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %261

168:                                              ; preds = %163
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #8
  %169 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt14priority_queueI4NodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 8 %169, i64 24, i1 false), !tbaa.struct !22
  call void @_ZNSt14priority_queueI4NodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %170 = getelementptr inbounds %struct.Node, ptr %15, i32 0, i32 0
  %171 = load i64, ptr %170, align 8, !tbaa !17
  store i64 %171, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  %172 = getelementptr inbounds %struct.Node, ptr %15, i32 0, i32 1
  %173 = load i32, ptr %172, align 8, !tbaa !19
  store i32 %173, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  %174 = getelementptr inbounds %struct.Node, ptr %15, i32 0, i32 2
  %175 = load i32, ptr %174, align 4, !tbaa !20
  store i32 %175, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  %176 = getelementptr inbounds %struct.Node, ptr %15, i32 0, i32 3
  %177 = load i32, ptr %176, align 8, !tbaa !21
  store i32 %177, ptr %19, align 4, !tbaa !9
  %178 = load i64, ptr %16, align 8, !tbaa !5
  %179 = load i32, ptr %14, align 4, !tbaa !9
  %180 = load i32, ptr @m, align 4, !tbaa !9
  %181 = sub nsw i32 %180, 1
  %182 = icmp eq i32 %179, %181
  %183 = zext i1 %182 to i64
  %184 = getelementptr inbounds [3 x i8], ptr @.str.6, i64 0, i64 %183
  %185 = load i8, ptr %184, align 1, !tbaa !23
  %186 = sext i8 %185 to i32
  %187 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i64 noundef %178, i32 noundef %186)
  %188 = load i32, ptr %18, align 4, !tbaa !9
  %189 = add nsw i32 %188, 1
  %190 = load i32, ptr %17, align 4, !tbaa !9
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %191
  %193 = load i32, ptr %192, align 4, !tbaa !9
  %194 = icmp slt i32 %189, %193
  br i1 %194, label %195, label %213

195:                                              ; preds = %168
  call void @llvm.lifetime.start.p0(i64 24, ptr %20) #8
  %196 = getelementptr inbounds %struct.Node, ptr %20, i32 0, i32 0
  %197 = load i64, ptr %16, align 8, !tbaa !5
  %198 = load i32, ptr %17, align 4, !tbaa !9
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @seq, i64 0, i64 %199
  %201 = load i32, ptr %18, align 4, !tbaa !9
  %202 = add nsw i32 %201, 1
  %203 = sext i32 %202 to i64
  %204 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %200, i64 noundef %203) #8
  %205 = load i64, ptr %204, align 8, !tbaa !5
  %206 = sub nsw i64 %197, %205
  store i64 %206, ptr %196, align 8, !tbaa !17
  %207 = getelementptr inbounds %struct.Node, ptr %20, i32 0, i32 1
  %208 = load i32, ptr %17, align 4, !tbaa !9
  store i32 %208, ptr %207, align 8, !tbaa !19
  %209 = getelementptr inbounds %struct.Node, ptr %20, i32 0, i32 2
  %210 = load i32, ptr %18, align 4, !tbaa !9
  %211 = add nsw i32 %210, 1
  store i32 %211, ptr %209, align 4, !tbaa !20
  %212 = getelementptr inbounds %struct.Node, ptr %20, i32 0, i32 3
  store i32 0, ptr %212, align 8, !tbaa !21
  call void @_ZNSt14priority_queueI4NodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(24) %20)
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #8
  br label %213

213:                                              ; preds = %195, %168
  %214 = load i32, ptr %17, align 4, !tbaa !9
  %215 = add nsw i32 %214, 1
  %216 = load i32, ptr @n, align 4, !tbaa !9
  %217 = icmp slt i32 %215, %216
  br i1 %217, label %218, label %257

218:                                              ; preds = %213
  call void @llvm.lifetime.start.p0(i64 24, ptr %21) #8
  %219 = getelementptr inbounds %struct.Node, ptr %21, i32 0, i32 0
  %220 = load i64, ptr %16, align 8, !tbaa !5
  %221 = load i32, ptr %17, align 4, !tbaa !9
  %222 = add nsw i32 %221, 1
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @seq, i64 0, i64 %223
  %225 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %224, i64 noundef 1) #8
  %226 = load i64, ptr %225, align 8, !tbaa !5
  %227 = sub nsw i64 %220, %226
  store i64 %227, ptr %219, align 8, !tbaa !17
  %228 = getelementptr inbounds %struct.Node, ptr %21, i32 0, i32 1
  %229 = load i32, ptr %17, align 4, !tbaa !9
  %230 = add nsw i32 %229, 1
  store i32 %230, ptr %228, align 8, !tbaa !19
  %231 = getelementptr inbounds %struct.Node, ptr %21, i32 0, i32 2
  store i32 1, ptr %231, align 4, !tbaa !20
  %232 = getelementptr inbounds %struct.Node, ptr %21, i32 0, i32 3
  store i32 1, ptr %232, align 8, !tbaa !21
  call void @_ZNSt14priority_queueI4NodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(24) %21)
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #8
  %233 = load i32, ptr %19, align 4, !tbaa !9
  %234 = icmp eq i32 %233, 1
  br i1 %234, label %235, label %256

235:                                              ; preds = %218
  call void @llvm.lifetime.start.p0(i64 24, ptr %22) #8
  %236 = getelementptr inbounds %struct.Node, ptr %22, i32 0, i32 0
  %237 = load i64, ptr %16, align 8, !tbaa !5
  %238 = load i32, ptr %17, align 4, !tbaa !9
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @seq, i64 0, i64 %239
  %241 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %240, i64 noundef 1) #8
  %242 = load i64, ptr %241, align 8, !tbaa !5
  %243 = add nsw i64 %237, %242
  %244 = load i32, ptr %17, align 4, !tbaa !9
  %245 = add nsw i32 %244, 1
  %246 = sext i32 %245 to i64
  %247 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @seq, i64 0, i64 %246
  %248 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %247, i64 noundef 1) #8
  %249 = load i64, ptr %248, align 8, !tbaa !5
  %250 = sub nsw i64 %243, %249
  store i64 %250, ptr %236, align 8, !tbaa !17
  %251 = getelementptr inbounds %struct.Node, ptr %22, i32 0, i32 1
  %252 = load i32, ptr %17, align 4, !tbaa !9
  %253 = add nsw i32 %252, 1
  store i32 %253, ptr %251, align 8, !tbaa !19
  %254 = getelementptr inbounds %struct.Node, ptr %22, i32 0, i32 2
  store i32 1, ptr %254, align 4, !tbaa !20
  %255 = getelementptr inbounds %struct.Node, ptr %22, i32 0, i32 3
  store i32 1, ptr %255, align 8, !tbaa !21
  call void @_ZNSt14priority_queueI4NodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(24) %22)
  call void @llvm.lifetime.end.p0(i64 24, ptr %22) #8
  br label %256

256:                                              ; preds = %235, %218
  br label %257

257:                                              ; preds = %256, %213
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #8
  br label %258

258:                                              ; preds = %257
  %259 = load i32, ptr %14, align 4, !tbaa !9
  %260 = add nsw i32 %259, 1
  store i32 %260, ptr %14, align 4, !tbaa !9
  br label %163, !llvm.loop !24

261:                                              ; preds = %167
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #8
  %262 = load i32, ptr %1, align 4
  ret i32 %262
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #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 uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) #4 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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr, ptr) #5

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt6vectorIxSaIxEEPFbRKS2_S5_EEvT_S8_T0_(ptr noundef, ptr noundef, ptr noundef) #5

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

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

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

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

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

declare i32 @printf(ptr noundef, ...) #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 = { mustprogress norecurse 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 = { "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 = { 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 #5 = { 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = !{!18, !6, i64 0}
!18 = !{!"_ZTS4Node", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16}
!19 = !{!18, !10, i64 8}
!20 = !{!18, !10, i64 12}
!21 = !{!18, !10, i64 16}
!22 = !{i64 0, i64 8, !5, i64 8, i64 4, !9, i64 12, i64 4, !9, i64 16, i64 4, !9}
!23 = !{!7, !7, i64 0}
!24 = distinct !{!24, !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<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::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<Node, std::allocator<Node>>::_Vector_impl" }
%"struct.std::_Vector_base<Node, std::allocator<Node>>::_Vector_impl" = type { %"struct.std::_Vector_base<Node, std::allocator<Node>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Node, std::allocator<Node>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.Node = type { i64, i32, i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@sz = external dso_local global [100001 x i32], align 16
@seq = external dso_local global [100001 x %"class.std::vector"], align 16
@Q = external dso_local global %"class.std::priority_queue", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpRKSt6vectorIxSaIxEES3_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca %"class.std::vector", align 8
  %4 = alloca %struct.Node, align 8
  %5 = alloca %struct.Node, align 8
  %6 = alloca %struct.Node, align 8
  %7 = alloca %struct.Node, align 8
  %8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %9 = load i32, ptr @n, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph66, label %._crit_edge67

._crit_edge67:                                    ; preds = %.loopexit, %0
  %.0.lcssa = phi i64 [ 0, %0 ], [ %27, %.loopexit ]
  %.lcssa = phi i32 [ %9, %0 ], [ %50, %.loopexit ]
  %11 = sext i32 %.lcssa to i64
  %12 = getelementptr inbounds %"class.std::vector", ptr @seq, i64 %11
  call void @_ZSt4sortIPSt6vectorIxSaIxEEPFbRKS2_S5_EEvT_S8_T0_(ptr noundef nonnull @seq, ptr noundef nonnull %12, ptr noundef nonnull @_Z3cmpRKSt6vectorIxSaIxEES3_)
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph71, label %.preheader

.lr.ph66:                                         ; preds = %0, %.loopexit
  %.064 = phi i64 [ %27, %.loopexit ], [ 0, %0 ]
  %.05063 = phi i32 [ %49, %.loopexit ], [ 0, %0 ]
  %15 = sext i32 %.05063 to i64
  %16 = getelementptr inbounds i32, ptr @sz, i64 %15
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %16)
  %18 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @seq, i64 0, i64 %15
  %19 = load i32, ptr %16, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  call void @_ZNSt6vectorIxSaIxEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef %20)
  %21 = load i32, ptr %16, align 4, !tbaa !5
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph66
  %23 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %18) #7
  %24 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %18) #7
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr %23, ptr %24)
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef 0) #7
  %26 = load i64, ptr %25, align 8, !tbaa !9
  %27 = add nsw i64 %26, %.064
  %28 = load i32, ptr %16, align 4, !tbaa !5
  %29 = icmp eq i32 %28, 1
  br i1 %29, label %38, label %.preheader59

.preheader59:                                     ; preds = %._crit_edge
  %30 = icmp sgt i32 %28, 0
  br i1 %30, label %.lr.ph62.preheader, label %.loopexit

.lr.ph62.preheader:                               ; preds = %.preheader59
  %31 = zext nneg i32 %28 to i64
  br label %.lr.ph62

.lr.ph:                                           ; preds = %.lr.ph66, %.lr.ph
  %.05160 = phi i32 [ %35, %.lr.ph ], [ 0, %.lr.ph66 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %1)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %33 = load i64, ptr %1, align 8, !tbaa !9
  %34 = sub nsw i64 0, %33
  store i64 %34, ptr %2, align 8, !tbaa !9
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %18, ptr noundef nonnull align 8 dereferenceable(8) %2)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  %35 = add nuw nsw i32 %.05160, 1
  %36 = load i32, ptr %16, align 4, !tbaa !5
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %.lr.ph, label %._crit_edge, !llvm.loop !11

38:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %3, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  %39 = add nsw i32 %.05063, -1
  call void @_ZNSt6vectorIxSaIxEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %18) #7
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #7
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = add nsw i32 %40, -1
  store i32 %41, ptr @n, align 4, !tbaa !5
  br label %.loopexit

.lr.ph62:                                         ; preds = %.lr.ph62.preheader, %.lr.ph62
  %indvars.iv = phi i64 [ %31, %.lr.ph62.preheader ], [ %indvars.iv.next, %.lr.ph62 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %42 = add nsw i64 %indvars.iv, -2
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef %42) #7
  %44 = load i64, ptr %43, align 8, !tbaa !9
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef %indvars.iv.next) #7
  %46 = load i64, ptr %45, align 8, !tbaa !9
  %47 = sub nsw i64 %46, %44
  store i64 %47, ptr %45, align 8, !tbaa !9
  %48 = icmp ugt i64 %indvars.iv, 1
  br i1 %48, label %.lr.ph62, label %.loopexit, !llvm.loop !13

.loopexit:                                        ; preds = %.lr.ph62, %.preheader59, %38
  %.1 = phi i32 [ %39, %38 ], [ %.05063, %.preheader59 ], [ %.05063, %.lr.ph62 ]
  %49 = add nsw i32 %.1, 1
  %50 = load i32, ptr @n, align 4, !tbaa !5
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %.lr.ph66, label %._crit_edge67, !llvm.loop !14

.preheader:                                       ; preds = %.lr.ph71, %._crit_edge67
  %52 = call noundef zeroext i1 @_ZNKSt14priority_queueI4NodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  br i1 %52, label %._crit_edge73, label %.lr.ph72

.lr.ph71:                                         ; preds = %._crit_edge67, %.lr.ph71
  %indvars.iv81 = phi i64 [ %indvars.iv.next82, %.lr.ph71 ], [ 0, %._crit_edge67 ]
  %53 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @seq, i64 0, i64 %indvars.iv81
  %54 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %53) #7
  %55 = trunc i64 %54 to i32
  %56 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %indvars.iv81
  store i32 %55, ptr %56, align 4, !tbaa !5
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %57 = load i32, ptr @n, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = icmp slt i64 %indvars.iv.next82, %58
  br i1 %59, label %.lr.ph71, label %.preheader, !llvm.loop !15

.lr.ph72:                                         ; preds = %.preheader, %.lr.ph72
  call void @_ZNSt14priority_queueI4NodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %60 = call noundef zeroext i1 @_ZNKSt14priority_queueI4NodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  br i1 %60, label %._crit_edge73, label %.lr.ph72, !llvm.loop !16

._crit_edge73:                                    ; preds = %.lr.ph72, %.preheader
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #7
  %61 = sub nsw i64 0, %.0.lcssa
  store i64 %61, ptr %4, align 8, !tbaa !17
  %62 = getelementptr inbounds i8, ptr %4, i64 8
  store i32 0, ptr %62, align 8, !tbaa !19
  %63 = getelementptr inbounds i8, ptr %4, i64 12
  store i32 0, ptr %63, align 4, !tbaa !20
  %64 = getelementptr inbounds i8, ptr %4, i64 16
  store i32 0, ptr %64, align 8, !tbaa !21
  call void @_ZNSt14priority_queueI4NodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(24) %4)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #7
  %65 = load i32, ptr @m, align 4, !tbaa !5
  %66 = icmp sgt i32 %65, 0
  br i1 %66, label %.lr.ph76, label %._crit_edge77

.lr.ph76:                                         ; preds = %._crit_edge73
  %67 = getelementptr inbounds i8, ptr %5, i64 8
  %68 = getelementptr inbounds i8, ptr %5, i64 12
  %69 = getelementptr inbounds i8, ptr %5, i64 16
  %70 = getelementptr inbounds i8, ptr %6, i64 8
  %71 = getelementptr inbounds i8, ptr %6, i64 12
  %72 = getelementptr inbounds i8, ptr %6, i64 16
  %73 = getelementptr inbounds i8, ptr %7, i64 8
  %74 = getelementptr inbounds i8, ptr %7, i64 12
  %75 = getelementptr inbounds i8, ptr %7, i64 16
  br label %76

._crit_edge77:                                    ; preds = %116, %._crit_edge73
  ret i32 0

76:                                               ; preds = %.lr.ph76, %116
  %.05474 = phi i32 [ 0, %.lr.ph76 ], [ %117, %116 ]
  %77 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt14priority_queueI4NodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %.sroa.0.0.copyload = load i64, ptr %77, align 8, !tbaa !9
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %77, i64 8
  %.sroa.4.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !5
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %77, i64 12
  %.sroa.5.0.copyload = load i32, ptr %.sroa.5.0..sroa_idx, align 4, !tbaa !5
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %77, i64 16
  %.sroa.6.0.copyload = load i32, ptr %.sroa.6.0..sroa_idx, align 8, !tbaa !5
  call void @_ZNSt14priority_queueI4NodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %78 = load i32, ptr @m, align 4, !tbaa !5
  %79 = add nsw i32 %78, -1
  %80 = icmp eq i32 %.05474, %79
  %81 = zext i1 %80 to i64
  %82 = getelementptr inbounds [3 x i8], ptr @.str.6, i64 0, i64 %81
  %83 = load i8, ptr %82, align 1, !tbaa !22
  %84 = sext i8 %83 to i32
  %85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %.sroa.0.0.copyload, i32 noundef %84)
  %86 = add nsw i32 %.sroa.5.0.copyload, 1
  %87 = sext i32 %.sroa.4.0.copyload to i64
  %88 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = icmp slt i32 %86, %89
  br i1 %90, label %91, label %97

91:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #7
  %92 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @seq, i64 0, i64 %87
  %93 = sext i32 %86 to i64
  %94 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %92, i64 noundef %93) #7
  %95 = load i64, ptr %94, align 8, !tbaa !9
  %96 = sub nsw i64 %.sroa.0.0.copyload, %95
  store i64 %96, ptr %5, align 8, !tbaa !17
  store i32 %.sroa.4.0.copyload, ptr %67, align 8, !tbaa !19
  store i32 %86, ptr %68, align 4, !tbaa !20
  store i32 0, ptr %69, align 8, !tbaa !21
  call void @_ZNSt14priority_queueI4NodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(24) %5)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #7
  br label %97

97:                                               ; preds = %91, %76
  %98 = add nsw i32 %.sroa.4.0.copyload, 1
  %99 = load i32, ptr @n, align 4, !tbaa !5
  %100 = icmp slt i32 %98, %99
  br i1 %100, label %101, label %116

101:                                              ; preds = %97
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #7
  %102 = sext i32 %98 to i64
  %103 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @seq, i64 0, i64 %102
  %104 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %103, i64 noundef 1) #7
  %105 = load i64, ptr %104, align 8, !tbaa !9
  %106 = sub nsw i64 %.sroa.0.0.copyload, %105
  store i64 %106, ptr %6, align 8, !tbaa !17
  store i32 %98, ptr %70, align 8, !tbaa !19
  store i32 1, ptr %71, align 4, !tbaa !20
  store i32 1, ptr %72, align 8, !tbaa !21
  call void @_ZNSt14priority_queueI4NodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(24) %6)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #7
  %107 = icmp eq i32 %.sroa.6.0.copyload, 1
  br i1 %107, label %108, label %116

108:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #7
  %109 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @seq, i64 0, i64 %87
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %109, i64 noundef 1) #7
  %111 = load i64, ptr %110, align 8, !tbaa !9
  %112 = add nsw i64 %111, %.sroa.0.0.copyload
  %113 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %103, i64 noundef 1) #7
  %114 = load i64, ptr %113, align 8, !tbaa !9
  %115 = sub i64 %112, %114
  store i64 %115, ptr %7, align 8, !tbaa !17
  store i32 %98, ptr %73, align 8, !tbaa !19
  store i32 1, ptr %74, align 4, !tbaa !20
  store i32 1, ptr %75, align 8, !tbaa !21
  call void @_ZNSt14priority_queueI4NodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(24) %7)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  br label %116

116:                                              ; preds = %101, %108, %97
  %117 = add nuw nsw i32 %.05474, 1
  %118 = load i32, ptr @m, align 4, !tbaa !5
  %119 = icmp slt i32 %117, %118
  br i1 %119, label %76, label %._crit_edge77, !llvm.loop !23
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr, ptr) local_unnamed_addr #5

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

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt6vectorIxSaIxEEPFbRKS2_S5_EEvT_S8_T0_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

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

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

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

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 = { mustprogress norecurse 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 = { nofree 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = !{!18, !10, i64 0}
!18 = !{!"_ZTS4Node", !10, i64 0, !6, i64 8, !6, i64 12, !6, i64 16}
!19 = !{!18, !6, i64 8}
!20 = !{!18, !6, i64 12}
!21 = !{!18, !6, i64 16}
!22 = !{!7, !7, i64 0}
!23 = distinct !{!23, !12}


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