; LLVM IR from tangjz/acm-icpc :: codeforces/gym (101194G)

; 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"

%"struct.std::pair" = type { i32, i32 }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%struct.Edge = type { i32, i32, i32 }
%"struct.std::pair.0" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@dsu = external dso_local global [200001 x i32], align 16
@low = external dso_local global [200001 x i32], align 16
@mx = external dso_local global i32, align 4
@fa = external dso_local global [18 x [200001 x i32]], align 16
@ans = external dso_local global [200001 x %"struct.std::pair"], align 16
@sp = external dso_local global [200001 x %"class.std::set"], align 16
@e = external dso_local global [200001 x %struct.Edge], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z7getRooti(i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9mergeRootiii(i32 noundef, i32 noundef, i32 noundef) #1

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) #1 align 2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 4
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::pair.0", align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %"class.std::set", align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  store i32 1061109567, ptr @low, align 16, !tbaa !5
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %227, %0
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = load i32, ptr @t, align 4, !tbaa !5
  %27 = icmp sle i32 %25, %26
  br i1 %27, label %29, label %28

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

29:                                               ; preds = %24
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %63, %29
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = load i32, ptr @n, align 4, !tbaa !5
  %34 = icmp sle i32 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %66

36:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %5)
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [200001 x i32], ptr @low, i64 0, i64 %39
  store i32 0, ptr %40, align 4, !tbaa !5
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [200001 x i32], ptr @fa, i64 0, i64 %42
  store i32 0, ptr %43, align 4, !tbaa !5
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [200001 x i32], ptr @dsu, i64 0, i64 %45
  store i32 0, ptr %46, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 1, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = sub nsw i32 0, %47
  store i32 %48, ptr %8, align 4, !tbaa !5
  %49 = call i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  store i64 %49, ptr %6, align 4
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [200001 x %"struct.std::pair"], ptr @ans, i64 0, i64 %51
  %53 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %52, ptr noundef nonnull align 4 dereferenceable(8) %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [200001 x %"class.std::set"], ptr @sp, i64 0, i64 %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 1, ptr %10, align 4, !tbaa !5
  %57 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %10)
  store i64 %57, ptr %9, align 4
  %58 = call { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %56, ptr noundef nonnull align 4 dereferenceable(8) %9)
  %59 = getelementptr inbounds { ptr, i8 }, ptr %11, i32 0, i32 0
  %60 = extractvalue { ptr, i8 } %58, 0
  store ptr %60, ptr %59, align 8
  %61 = getelementptr inbounds { ptr, i8 }, ptr %11, i32 0, i32 1
  %62 = extractvalue { ptr, i8 } %58, 1
  store i8 %62, ptr %61, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %63

63:                                               ; preds = %36
  %64 = load i32, ptr %4, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %4, align 4, !tbaa !5
  br label %31, !llvm.loop !9

66:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %76, %66
  %68 = load i32, ptr %12, align 4, !tbaa !5
  %69 = load i32, ptr @m, align 4, !tbaa !5
  %70 = icmp sle i32 %68, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %67
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %79

72:                                               ; preds = %67
  %73 = load i32, ptr %12, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [200001 x %struct.Edge], ptr @e, i64 0, i64 %74
  call void @_ZN4Edge4readEv(ptr noundef nonnull align 4 dereferenceable(12) %75)
  br label %76

76:                                               ; preds = %72
  %77 = load i32, ptr %12, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %12, align 4, !tbaa !5
  br label %67, !llvm.loop !11

79:                                               ; preds = %71
  %80 = load i32, ptr @m, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds %struct.Edge, ptr @e, i64 %81
  %83 = getelementptr inbounds %struct.Edge, ptr %82, i64 1
  call void @_ZSt4sortIP4EdgeEvT_S2_(ptr noundef getelementptr inbounds (%struct.Edge, ptr @e, i64 1), ptr noundef %83)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %114, %79
  %85 = load i32, ptr %13, align 4, !tbaa !5
  %86 = load i32, ptr @m, align 4, !tbaa !5
  %87 = icmp sle i32 %85, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %84
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %117

89:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %90 = load i32, ptr %13, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [200001 x %struct.Edge], ptr @e, i64 0, i64 %91
  %93 = getelementptr inbounds %struct.Edge, ptr %92, i32 0, i32 0
  %94 = load i32, ptr %93, align 4, !tbaa !12
  %95 = call noundef i32 @_Z7getRooti(i32 noundef %94)
  store i32 %95, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %96 = load i32, ptr %13, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [200001 x %struct.Edge], ptr @e, i64 0, i64 %97
  %99 = getelementptr inbounds %struct.Edge, ptr %98, i32 0, i32 1
  %100 = load i32, ptr %99, align 4, !tbaa !14
  %101 = call noundef i32 @_Z7getRooti(i32 noundef %100)
  store i32 %101, ptr %15, align 4, !tbaa !5
  %102 = load i32, ptr %14, align 4, !tbaa !5
  %103 = load i32, ptr %15, align 4, !tbaa !5
  %104 = icmp ne i32 %102, %103
  br i1 %104, label %105, label %113

105:                                              ; preds = %89
  %106 = load i32, ptr %14, align 4, !tbaa !5
  %107 = load i32, ptr %15, align 4, !tbaa !5
  %108 = load i32, ptr %13, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [200001 x %struct.Edge], ptr @e, i64 0, i64 %109
  %111 = getelementptr inbounds %struct.Edge, ptr %110, i32 0, i32 2
  %112 = load i32, ptr %111, align 4, !tbaa !15
  call void @_Z9mergeRootiii(i32 noundef %106, i32 noundef %107, i32 noundef %112)
  br label %113

113:                                              ; preds = %105, %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %114

114:                                              ; preds = %113
  %115 = load i32, ptr %13, align 4, !tbaa !5
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %13, align 4, !tbaa !5
  br label %84, !llvm.loop !16

117:                                              ; preds = %88
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 1, ptr %16, align 4, !tbaa !5
  br label %118

118:                                              ; preds = %127, %117
  %119 = load i32, ptr %16, align 4, !tbaa !5
  %120 = load i32, ptr @n, align 4, !tbaa !5
  %121 = icmp sle i32 %119, %120
  br i1 %121, label %123, label %122

122:                                              ; preds = %118
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %130

123:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 48, ptr %17) #7
  call void @llvm.memset.p0.i64(ptr align 8 %17, i8 0, i64 48, i1 false)
  call void @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %17) #7
  %124 = load i32, ptr %16, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [200001 x %"class.std::set"], ptr @sp, i64 0, i64 %125
  call void @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE4swapERS5_(ptr noundef nonnull align 8 dereferenceable(48) %17, ptr noundef nonnull align 8 dereferenceable(48) %126) #7
  call void @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %17) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %17) #7
  br label %127

127:                                              ; preds = %123
  %128 = load i32, ptr %16, align 4, !tbaa !5
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %16, align 4, !tbaa !5
  br label %118, !llvm.loop !17

130:                                              ; preds = %122
  store i32 1, ptr @mx, align 4, !tbaa !5
  br label %131

131:                                              ; preds = %168, %130
  %132 = load i32, ptr @mx, align 4, !tbaa !5
  %133 = shl i32 1, %132
  %134 = load i32, ptr @n, align 4, !tbaa !5
  %135 = icmp sle i32 %133, %134
  br i1 %135, label %136, label %171

136:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  store i32 1, ptr %18, align 4, !tbaa !5
  br label %137

137:                                              ; preds = %164, %136
  %138 = load i32, ptr %18, align 4, !tbaa !5
  %139 = load i32, ptr @n, align 4, !tbaa !5
  %140 = icmp sle i32 %138, %139
  br i1 %140, label %142, label %141

141:                                              ; preds = %137
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  br label %167

142:                                              ; preds = %137
  %143 = load i32, ptr @mx, align 4, !tbaa !5
  %144 = sub nsw i32 %143, 1
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [18 x [200001 x i32]], ptr @fa, i64 0, i64 %145
  %147 = load i32, ptr @mx, align 4, !tbaa !5
  %148 = sub nsw i32 %147, 1
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [18 x [200001 x i32]], ptr @fa, i64 0, i64 %149
  %151 = load i32, ptr %18, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [200001 x i32], ptr %150, i64 0, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [200001 x i32], ptr %146, i64 0, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !5
  %158 = load i32, ptr @mx, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [18 x [200001 x i32]], ptr @fa, i64 0, i64 %159
  %161 = load i32, ptr %18, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [200001 x i32], ptr %160, i64 0, i64 %162
  store i32 %157, ptr %163, align 4, !tbaa !5
  br label %164

164:                                              ; preds = %142
  %165 = load i32, ptr %18, align 4, !tbaa !5
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr %18, align 4, !tbaa !5
  br label %137, !llvm.loop !18

167:                                              ; preds = %141
  br label %168

168:                                              ; preds = %167
  %169 = load i32, ptr @mx, align 4, !tbaa !5
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr @mx, align 4, !tbaa !5
  br label %131, !llvm.loop !19

171:                                              ; preds = %131
  %172 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @m)
  %173 = load i32, ptr %2, align 4, !tbaa !5
  %174 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %173)
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %175

175:                                              ; preds = %218, %171
  %176 = load i32, ptr @m, align 4, !tbaa !5
  %177 = add nsw i32 %176, -1
  store i32 %177, ptr @m, align 4, !tbaa !5
  %178 = icmp ne i32 %176, 0
  br i1 %178, label %179, label %226

179:                                              ; preds = %175
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  %180 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %20, ptr noundef %21)
  %181 = load i32, ptr %19, align 4, !tbaa !5
  %182 = load i32, ptr %20, align 4, !tbaa !5
  %183 = xor i32 %182, %181
  store i32 %183, ptr %20, align 4, !tbaa !5
  %184 = load i32, ptr %19, align 4, !tbaa !5
  %185 = load i32, ptr %21, align 4, !tbaa !5
  %186 = xor i32 %185, %184
  store i32 %186, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  %187 = load i32, ptr @mx, align 4, !tbaa !5
  %188 = sub nsw i32 %187, 1
  store i32 %188, ptr %22, align 4, !tbaa !5
  br label %189

189:                                              ; preds = %215, %179
  %190 = load i32, ptr %22, align 4, !tbaa !5
  %191 = icmp sge i32 %190, 0
  br i1 %191, label %193, label %192

192:                                              ; preds = %189
  store i32 25, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %218

193:                                              ; preds = %189
  %194 = load i32, ptr %22, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [18 x [200001 x i32]], ptr @fa, i64 0, i64 %195
  %197 = load i32, ptr %20, align 4, !tbaa !5
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [200001 x i32], ptr %196, i64 0, i64 %198
  %200 = load i32, ptr %199, align 4, !tbaa !5
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [200001 x i32], ptr @low, i64 0, i64 %201
  %203 = load i32, ptr %202, align 4, !tbaa !5
  %204 = load i32, ptr %21, align 4, !tbaa !5
  %205 = icmp sle i32 %203, %204
  br i1 %205, label %206, label %214

206:                                              ; preds = %193
  %207 = load i32, ptr %22, align 4, !tbaa !5
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [18 x [200001 x i32]], ptr @fa, i64 0, i64 %208
  %210 = load i32, ptr %20, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [200001 x i32], ptr %209, i64 0, i64 %211
  %213 = load i32, ptr %212, align 4, !tbaa !5
  store i32 %213, ptr %20, align 4, !tbaa !5
  br label %214

214:                                              ; preds = %206, %193
  br label %215

215:                                              ; preds = %214
  %216 = load i32, ptr %22, align 4, !tbaa !5
  %217 = add nsw i32 %216, -1
  store i32 %217, ptr %22, align 4, !tbaa !5
  br label %189, !llvm.loop !20

218:                                              ; preds = %192
  %219 = load i32, ptr %20, align 4, !tbaa !5
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [200001 x %"struct.std::pair"], ptr @ans, i64 0, i64 %220
  %222 = getelementptr inbounds %"struct.std::pair", ptr %221, i32 0, i32 1
  %223 = load i32, ptr %222, align 4, !tbaa !21
  %224 = sub nsw i32 0, %223
  store i32 %224, ptr %19, align 4, !tbaa !5
  %225 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %224)
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %175, !llvm.loop !23

226:                                              ; preds = %175
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %227

227:                                              ; preds = %226
  %228 = load i32, ptr %2, align 4, !tbaa !5
  %229 = add nsw i32 %228, 1
  store i32 %229, ptr %2, align 4, !tbaa !5
  br label %24, !llvm.loop !24

230:                                              ; preds = %28
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #5

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Edge4readEv(ptr noundef nonnull align 4 dereferenceable(12)) #1 align 2

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

declare i32 @printf(ptr noundef, ...) #5

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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { "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 = { 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 #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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !6, i64 0}
!13 = !{!"_ZTS4Edge", !6, i64 0, !6, i64 4, !6, i64 8}
!14 = !{!13, !6, i64 4}
!15 = !{!13, !6, i64 8}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = !{!22, !6, i64 4}
!22 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"struct.std::pair" = type { i32, i32 }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%struct.Edge = type { i32, i32, i32 }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@dsu = external dso_local local_unnamed_addr global [200001 x i32], align 16
@low = external dso_local local_unnamed_addr global [200001 x i32], align 16
@mx = external dso_local local_unnamed_addr global i32, align 4
@fa = external dso_local local_unnamed_addr global [18 x [200001 x i32]], align 16
@ans = external dso_local global [200001 x %"struct.std::pair"], align 16
@sp = external dso_local global [200001 x %"class.std::set"], align 16
@e = external dso_local global [200001 x %struct.Edge], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z7getRooti(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9mergeRootiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca i32, align 4
  %2 = alloca %"struct.std::pair", align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca i32, align 4
  %7 = alloca %"class.std::set", align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 1061109567, ptr @low, align 16, !tbaa !5
  %10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %11 = load i32, ptr @t, align 4, !tbaa !5
  %.not89 = icmp slt i32 %11, 1
  br i1 %.not89, label %._crit_edge93, label %.lr.ph92

._crit_edge93:                                    ; preds = %._crit_edge88, %0
  ret i32 0

.lr.ph92:                                         ; preds = %0, %._crit_edge88
  %.03890 = phi i32 [ %120, %._crit_edge88 ], [ 1, %0 ]
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %.not4558 = icmp slt i32 %13, 1
  br i1 %.not4558, label %.preheader56, label %.lr.ph

.preheader56:                                     ; preds = %.lr.ph, %.lr.ph92
  %14 = load i32, ptr @m, align 4, !tbaa !5
  %.not4660 = icmp slt i32 %14, 1
  br i1 %.not4660, label %.preheader56.._crit_edge_crit_edge, label %.lr.ph62

.preheader56.._crit_edge_crit_edge:               ; preds = %.preheader56
  %.pre = sext i32 %14 to i64
  br label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph92, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.lr.ph92 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %16 = getelementptr inbounds [200001 x i32], ptr @low, i64 0, i64 %indvars.iv
  store i32 0, ptr %16, align 4, !tbaa !5
  %17 = getelementptr inbounds [200001 x i32], ptr @fa, i64 0, i64 %indvars.iv
  store i32 0, ptr %17, align 4, !tbaa !5
  %18 = getelementptr inbounds [200001 x i32], ptr @dsu, i64 0, i64 %indvars.iv
  store i32 0, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  store i32 1, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %19 = load i32, ptr %1, align 4, !tbaa !5
  %20 = sub nsw i32 0, %19
  store i32 %20, ptr %4, align 4, !tbaa !5
  %21 = call i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %21, ptr %2, align 8
  %22 = getelementptr inbounds [200001 x %"struct.std::pair"], ptr @ans, i64 0, i64 %indvars.iv
  %23 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %22, ptr noundef nonnull align 4 dereferenceable(8) %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  %24 = getelementptr inbounds [200001 x %"class.std::set"], ptr @sp, i64 0, i64 %indvars.iv
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  store i32 1, ptr %6, align 4, !tbaa !5
  %25 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %6)
  store i64 %25, ptr %5, align 8
  %26 = call { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %24, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %.not45.not = icmp slt i64 %indvars.iv, %28
  br i1 %.not45.not, label %.lr.ph, label %.preheader56, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph62, %.preheader56.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader56.._crit_edge_crit_edge ], [ %32, %.lr.ph62 ]
  %gep = getelementptr %struct.Edge, ptr getelementptr inbounds (i8, ptr @e, i64 12), i64 %.pre-phi
  call void @_ZSt4sortIP4EdgeEvT_S2_(ptr noundef nonnull getelementptr inbounds (i8, ptr @e, i64 12), ptr noundef nonnull %gep)
  %29 = load i32, ptr @m, align 4, !tbaa !5
  %.not4763 = icmp slt i32 %29, 1
  br i1 %.not4763, label %.preheader55, label %.lr.ph66

.lr.ph62:                                         ; preds = %.preheader56, %.lr.ph62
  %indvars.iv98 = phi i64 [ %indvars.iv.next99, %.lr.ph62 ], [ 1, %.preheader56 ]
  %30 = getelementptr inbounds [200001 x %struct.Edge], ptr @e, i64 0, i64 %indvars.iv98
  call void @_ZN4Edge4readEv(ptr noundef nonnull align 4 dereferenceable(12) %30)
  %indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
  %31 = load i32, ptr @m, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %.not46.not = icmp slt i64 %indvars.iv98, %32
  br i1 %.not46.not, label %.lr.ph62, label %._crit_edge, !llvm.loop !11

.preheader55:                                     ; preds = %43, %._crit_edge
  %33 = load i32, ptr @n, align 4, !tbaa !5
  %.not4867 = icmp slt i32 %33, 1
  br i1 %.not4867, label %._crit_edge77.split, label %.lr.ph69

.lr.ph66:                                         ; preds = %._crit_edge, %43
  %indvars.iv101 = phi i64 [ %indvars.iv.next102, %43 ], [ 1, %._crit_edge ]
  %34 = getelementptr inbounds [200001 x %struct.Edge], ptr @e, i64 0, i64 %indvars.iv101
  %35 = load i32, ptr %34, align 4, !tbaa !12
  %36 = call noundef i32 @_Z7getRooti(i32 noundef %35)
  %37 = getelementptr inbounds i8, ptr %34, i64 4
  %38 = load i32, ptr %37, align 4, !tbaa !14
  %39 = call noundef i32 @_Z7getRooti(i32 noundef %38)
  %.not53 = icmp eq i32 %36, %39
  br i1 %.not53, label %43, label %40

40:                                               ; preds = %.lr.ph66
  %41 = getelementptr inbounds i8, ptr %34, i64 8
  %42 = load i32, ptr %41, align 4, !tbaa !15
  call void @_Z9mergeRootiii(i32 noundef %36, i32 noundef %39, i32 noundef %42)
  br label %43

43:                                               ; preds = %40, %.lr.ph66
  %indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
  %44 = load i32, ptr @m, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %.not47.not = icmp slt i64 %indvars.iv101, %45
  br i1 %.not47.not, label %.lr.ph66, label %.preheader55, !llvm.loop !16

.preheader54:                                     ; preds = %.lr.ph69
  %.not4975 = icmp slt i32 %48, 2
  br i1 %.not4975, label %._crit_edge77.split, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.preheader54
  %46 = zext nneg i32 %48 to i64
  %xtraiter = and i64 %46, 1
  %unroll_iter = and i64 %46, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader

.lr.ph69:                                         ; preds = %.preheader55, %.lr.ph69
  %indvars.iv104 = phi i64 [ %indvars.iv.next105, %.lr.ph69 ], [ 1, %.preheader55 ]
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %7) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %7, i8 0, i64 48, i1 false)
  call void @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #7
  %47 = getelementptr inbounds [200001 x %"class.std::set"], ptr @sp, i64 0, i64 %indvars.iv104
  call void @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE4swapERS5_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(48) %47) #7
  call void @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %7) #7
  %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %.not48.not = icmp slt i64 %indvars.iv104, %49
  br i1 %.not48.not, label %.lr.ph69, label %.preheader54, !llvm.loop !17

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge74
  %indvars.iv110 = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next111, %._crit_edge74 ]
  %50 = add nsw i64 %indvars.iv110, -1
  br label %59

._crit_edge74.unr-lcssa:                          ; preds = %59
  br i1 %lcmp.mod.not, label %._crit_edge74, label %._crit_edge74.epilog-lcssa

._crit_edge74.epilog-lcssa:                       ; preds = %._crit_edge74.unr-lcssa
  %51 = getelementptr inbounds [18 x [200001 x i32]], ptr @fa, i64 0, i64 %50, i64 %indvars.iv.next108.1
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [18 x [200001 x i32]], ptr @fa, i64 0, i64 %50, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = getelementptr inbounds [18 x [200001 x i32]], ptr @fa, i64 0, i64 %indvars.iv110, i64 %indvars.iv.next108.1
  store i32 %55, ptr %56, align 4, !tbaa !5
  br label %._crit_edge74

._crit_edge74:                                    ; preds = %._crit_edge74.unr-lcssa, %._crit_edge74.epilog-lcssa
  %indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
  %57 = trunc nuw nsw i64 %indvars.iv110 to i32
  %58 = shl nuw i32 2, %57
  %.not49 = icmp sgt i32 %58, %48
  br i1 %.not49, label %._crit_edge77.split.loopexit, label %.preheader, !llvm.loop !18

59:                                               ; preds = %59, %.preheader
  %indvars.iv107 = phi i64 [ 1, %.preheader ], [ %indvars.iv.next108.1, %59 ]
  %niter = phi i64 [ 0, %.preheader ], [ %niter.next.1, %59 ]
  %60 = getelementptr inbounds [18 x [200001 x i32]], ptr @fa, i64 0, i64 %50, i64 %indvars.iv107
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [18 x [200001 x i32]], ptr @fa, i64 0, i64 %50, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = getelementptr inbounds [18 x [200001 x i32]], ptr @fa, i64 0, i64 %indvars.iv110, i64 %indvars.iv107
  store i32 %64, ptr %65, align 4, !tbaa !5
  %indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
  %66 = getelementptr inbounds [18 x [200001 x i32]], ptr @fa, i64 0, i64 %50, i64 %indvars.iv.next108
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [18 x [200001 x i32]], ptr @fa, i64 0, i64 %50, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = getelementptr inbounds [18 x [200001 x i32]], ptr @fa, i64 0, i64 %indvars.iv110, i64 %indvars.iv.next108
  store i32 %70, ptr %71, align 4, !tbaa !5
  %indvars.iv.next108.1 = add nuw nsw i64 %indvars.iv107, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge74.unr-lcssa, label %59, !llvm.loop !19

._crit_edge77.split.loopexit:                     ; preds = %._crit_edge74
  %72 = trunc nsw i64 %indvars.iv.next111 to i32
  br label %._crit_edge77.split

._crit_edge77.split:                              ; preds = %.preheader55, %._crit_edge77.split.loopexit, %.preheader54
  %storemerge.lcssa = phi i32 [ 1, %.preheader54 ], [ %72, %._crit_edge77.split.loopexit ], [ 1, %.preheader55 ]
  store i32 %storemerge.lcssa, ptr @mx, align 4, !tbaa !5
  %73 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m)
  %74 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.03890)
  %75 = load i32, ptr @m, align 4, !tbaa !5
  %76 = add nsw i32 %75, -1
  store i32 %76, ptr @m, align 4, !tbaa !5
  %.not5084 = icmp eq i32 %75, 0
  br i1 %.not5084, label %._crit_edge88, label %.lr.ph87

.lr.ph87:                                         ; preds = %._crit_edge77.split, %._crit_edge83
  %.03585 = phi i32 [ %97, %._crit_edge83 ], [ 0, %._crit_edge77.split ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  %77 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %8, ptr noundef nonnull %9)
  %78 = load i32, ptr %8, align 4, !tbaa !5
  %79 = xor i32 %78, %.03585
  store i32 %79, ptr %8, align 4, !tbaa !5
  %80 = load i32, ptr %9, align 4, !tbaa !5
  %81 = xor i32 %80, %.03585
  store i32 %81, ptr %9, align 4, !tbaa !5
  %82 = load i32, ptr @mx, align 4, !tbaa !5
  %83 = icmp sgt i32 %82, 0
  br i1 %83, label %.lr.ph82.preheader, label %._crit_edge83

.lr.ph82.preheader:                               ; preds = %.lr.ph87
  %84 = zext nneg i32 %82 to i64
  %xtraiter124 = and i64 %84, 1
  %lcmp.mod125.not = icmp eq i64 %xtraiter124, 0
  br i1 %lcmp.mod125.not, label %.lr.ph82.prol.loopexit, label %.lr.ph82.prol

.lr.ph82.prol:                                    ; preds = %.lr.ph82.preheader
  %indvars.iv.next114.prol = add nsw i64 %84, -1
  %85 = sext i32 %79 to i64
  %86 = getelementptr inbounds [18 x [200001 x i32]], ptr @fa, i64 0, i64 %indvars.iv.next114.prol, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [200001 x i32], ptr @low, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %.not51.prol = icmp sgt i32 %90, %81
  br i1 %.not51.prol, label %.lr.ph82.prol.loopexit, label %91

91:                                               ; preds = %.lr.ph82.prol
  store i32 %87, ptr %8, align 4, !tbaa !5
  br label %.lr.ph82.prol.loopexit

.lr.ph82.prol.loopexit:                           ; preds = %.lr.ph82.prol, %91, %.lr.ph82.preheader
  %indvars.iv113.unr = phi i64 [ %84, %.lr.ph82.preheader ], [ %indvars.iv.next114.prol, %91 ], [ %indvars.iv.next114.prol, %.lr.ph82.prol ]
  %.unr = phi i32 [ %79, %.lr.ph82.preheader ], [ %79, %.lr.ph82.prol ], [ %87, %91 ]
  %.lcssa123.unr = phi i32 [ poison, %.lr.ph82.preheader ], [ %79, %.lr.ph82.prol ], [ %87, %91 ]
  %92 = icmp eq i32 %82, 1
  br i1 %92, label %._crit_edge83, label %.lr.ph82

._crit_edge83:                                    ; preds = %.lr.ph82.prol.loopexit, %117, %.lr.ph87
  %93 = phi i32 [ %79, %.lr.ph87 ], [ %.lcssa123.unr, %.lr.ph82.prol.loopexit ], [ %118, %117 ]
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [200001 x %"struct.std::pair"], ptr @ans, i64 0, i64 %94, i32 1
  %96 = load i32, ptr %95, align 4, !tbaa !20
  %97 = sub nsw i32 0, %96
  %98 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %97)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  %99 = load i32, ptr @m, align 4, !tbaa !5
  %100 = add nsw i32 %99, -1
  store i32 %100, ptr @m, align 4, !tbaa !5
  %.not50 = icmp eq i32 %99, 0
  br i1 %.not50, label %._crit_edge88, label %.lr.ph87, !llvm.loop !22

.lr.ph82:                                         ; preds = %.lr.ph82.prol.loopexit, %117
  %indvars.iv113 = phi i64 [ %indvars.iv.next114.1, %117 ], [ %indvars.iv113.unr, %.lr.ph82.prol.loopexit ]
  %101 = phi i32 [ %118, %117 ], [ %.unr, %.lr.ph82.prol.loopexit ]
  %indvars.iv.next114 = add nsw i64 %indvars.iv113, -1
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [18 x [200001 x i32]], ptr @fa, i64 0, i64 %indvars.iv.next114, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [200001 x i32], ptr @low, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %.not51 = icmp sgt i32 %107, %81
  br i1 %.not51, label %.lr.ph82.1, label %108

108:                                              ; preds = %.lr.ph82
  store i32 %104, ptr %8, align 4, !tbaa !5
  br label %.lr.ph82.1

.lr.ph82.1:                                       ; preds = %.lr.ph82, %108
  %109 = phi i32 [ %101, %.lr.ph82 ], [ %104, %108 ]
  %indvars.iv.next114.1 = add nsw i64 %indvars.iv113, -2
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [18 x [200001 x i32]], ptr @fa, i64 0, i64 %indvars.iv.next114.1, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [200001 x i32], ptr @low, i64 0, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !5
  %.not51.1 = icmp sgt i32 %115, %81
  br i1 %.not51.1, label %117, label %116

116:                                              ; preds = %.lr.ph82.1
  store i32 %112, ptr %8, align 4, !tbaa !5
  br label %117

117:                                              ; preds = %116, %.lr.ph82.1
  %118 = phi i32 [ %109, %.lr.ph82.1 ], [ %112, %116 ]
  %119 = icmp ugt i64 %indvars.iv.next114, 1
  br i1 %119, label %.lr.ph82, label %._crit_edge83, !llvm.loop !23

._crit_edge88:                                    ; preds = %._crit_edge83, %._crit_edge77.split
  %120 = add nuw nsw i32 %.03890, 1
  %121 = load i32, ptr @t, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.03890, %121
  br i1 %.not.not, label %.lr.ph92, label %._crit_edge93, !llvm.loop !24
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(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 noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Edge4readEv(ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #1 align 2

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

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 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { 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 #6 = { 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 #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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !6, i64 0}
!13 = !{!"_ZTS4Edge", !6, i64 0, !6, i64 4, !6, i64 8}
!14 = !{!13, !6, i64 4}
!15 = !{!13, !6, i64 8}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = !{!21, !6, i64 4}
!21 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}


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