; LLVM IR from tangjz/acm-icpc :: lydsy (1093)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@mod = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@pre = external dso_local global [100001 x i32], align 16
@suf = external dso_local global [100001 x i32], align 16
@que = external dso_local global [100001 x i32], align 16
@scc_tot = external dso_local global i32, align 4
@scc = external dso_local global [100001 x i32], align 16
@e = external dso_local global [1000001 x %"struct.std::pair"], align 16
@g = external dso_local global [2000002 x %"struct.std::pair"], align 16
@f = external dso_local global [100001 x %"struct.std::pair"], align 16
@ans = external dso_local global %"struct.std::pair", align 4
@vis = external dso_local global [100001 x i8], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4dfs1i(i32 noundef) #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4dfs2i(i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4dfs3i(i32 noundef) #0

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

; 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)) #2 align 2

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

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

22:                                               ; preds = %75, %0
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = load i32, ptr @m, align 4, !tbaa !5
  %25 = icmp slt i32 %23, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %78

27:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @e, i64 0, i64 %29
  %31 = getelementptr inbounds %"struct.std::pair", ptr %30, i32 0, i32 0
  store ptr %31, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @e, i64 0, i64 %33
  %35 = getelementptr inbounds %"struct.std::pair", ptr %34, i32 0, i32 1
  store ptr %35, ptr %4, align 8, !tbaa !9
  %36 = load ptr, ptr %3, align 8, !tbaa !9
  %37 = load ptr, ptr %4, align 8, !tbaa !9
  %38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %36, ptr noundef %37)
  %39 = load ptr, ptr %3, align 8, !tbaa !9
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = add nsw i32 %40, -1
  store i32 %41, ptr %39, align 4, !tbaa !5
  %42 = load ptr, ptr %4, align 8, !tbaa !9
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = add nsw i32 %43, -1
  store i32 %44, ptr %42, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %45 = load ptr, ptr %3, align 8, !tbaa !9
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [100001 x i32], ptr @pre, i64 0, i64 %47
  %49 = load ptr, ptr %4, align 8, !tbaa !9
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %48, ptr noundef nonnull align 4 dereferenceable(4) %49)
  %50 = load i32, ptr @tot, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr @tot, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [2000002 x %"struct.std::pair"], ptr @g, i64 0, i64 %52
  %54 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %53, ptr noundef nonnull align 4 dereferenceable(8) %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  %55 = load i32, ptr @tot, align 4, !tbaa !5
  %56 = load ptr, ptr %3, align 8, !tbaa !9
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [100001 x i32], ptr @pre, i64 0, i64 %58
  store i32 %55, ptr %59, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %60 = load ptr, ptr %4, align 8, !tbaa !9
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [100001 x i32], ptr @suf, i64 0, i64 %62
  %64 = load ptr, ptr %3, align 8, !tbaa !9
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(4) %63, ptr noundef nonnull align 4 dereferenceable(4) %64)
  %65 = load i32, ptr @tot, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr @tot, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [2000002 x %"struct.std::pair"], ptr @g, i64 0, i64 %67
  %69 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %68, ptr noundef nonnull align 4 dereferenceable(8) %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  %70 = load i32, ptr @tot, align 4, !tbaa !5
  %71 = load ptr, ptr %4, align 8, !tbaa !9
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [100001 x i32], ptr @suf, i64 0, i64 %73
  store i32 %70, ptr %74, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  br label %75

75:                                               ; preds = %27
  %76 = load i32, ptr %2, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %2, align 4, !tbaa !5
  br label %22, !llvm.loop !11

78:                                               ; preds = %26
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %93, %78
  %80 = load i32, ptr %7, align 4, !tbaa !5
  %81 = load i32, ptr @n, align 4, !tbaa !5
  %82 = icmp slt i32 %80, %81
  br i1 %82, label %84, label %83

83:                                               ; preds = %79
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %96

84:                                               ; preds = %79
  %85 = load i32, ptr %7, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [100001 x i8], ptr @vis, i64 0, i64 %86
  %88 = load i8, ptr %87, align 1, !tbaa !13, !range !15, !noundef !16
  %89 = trunc i8 %88 to i1
  br i1 %89, label %92, label %90

90:                                               ; preds = %84
  %91 = load i32, ptr %7, align 4, !tbaa !5
  call void @_Z4dfs1i(i32 noundef %91)
  br label %92

92:                                               ; preds = %90, %84
  br label %93

93:                                               ; preds = %92
  %94 = load i32, ptr %7, align 4, !tbaa !5
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %7, align 4, !tbaa !5
  br label %79, !llvm.loop !17

96:                                               ; preds = %83
  %97 = load i32, ptr @n, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = mul i64 %98, 1
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 %99, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %100 = load i32, ptr @n, align 4, !tbaa !5
  %101 = sub nsw i32 %100, 1
  store i32 %101, ptr %8, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %123, %96
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = icmp sge i32 %103, 0
  br i1 %104, label %106, label %105

105:                                              ; preds = %102
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %126

106:                                              ; preds = %102
  %107 = load i32, ptr %8, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100001 x i32], ptr @que, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [100001 x i8], ptr @vis, i64 0, i64 %111
  %113 = load i8, ptr %112, align 1, !tbaa !13, !range !15, !noundef !16
  %114 = trunc i8 %113 to i1
  br i1 %114, label %122, label %115

115:                                              ; preds = %106
  %116 = load i32, ptr %8, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [100001 x i32], ptr @que, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  call void @_Z4dfs2i(i32 noundef %119)
  %120 = load i32, ptr @scc_tot, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr @scc_tot, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %115, %106
  br label %123

123:                                              ; preds = %122
  %124 = load i32, ptr %8, align 4, !tbaa !5
  %125 = add nsw i32 %124, -1
  store i32 %125, ptr %8, align 4, !tbaa !5
  br label %102, !llvm.loop !18

126:                                              ; preds = %105
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %127

127:                                              ; preds = %167, %126
  %128 = load i32, ptr %9, align 4, !tbaa !5
  %129 = load i32, ptr @m, align 4, !tbaa !5
  %130 = icmp slt i32 %128, %129
  br i1 %130, label %132, label %131

131:                                              ; preds = %127
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %170

132:                                              ; preds = %127
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %133 = load i32, ptr %9, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @e, i64 0, i64 %134
  %136 = getelementptr inbounds %"struct.std::pair", ptr %135, i32 0, i32 0
  store ptr %136, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %137 = load i32, ptr %9, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @e, i64 0, i64 %138
  %140 = getelementptr inbounds %"struct.std::pair", ptr %139, i32 0, i32 1
  store ptr %140, ptr %11, align 8, !tbaa !9
  %141 = load ptr, ptr %10, align 8, !tbaa !9
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [100001 x i32], ptr @scc, i64 0, i64 %143
  %145 = load i32, ptr %144, align 4, !tbaa !5
  %146 = load ptr, ptr %11, align 8, !tbaa !9
  %147 = load i32, ptr %146, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [100001 x i32], ptr @scc, i64 0, i64 %148
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = icmp ne i32 %145, %150
  br i1 %151, label %152, label %166

152:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %153 = load ptr, ptr %10, align 8, !tbaa !9
  %154 = load i32, ptr %153, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [100001 x i32], ptr @scc, i64 0, i64 %155
  %157 = load ptr, ptr %11, align 8, !tbaa !9
  %158 = load i32, ptr %157, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [100001 x i32], ptr @scc, i64 0, i64 %159
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %12, ptr noundef nonnull align 4 dereferenceable(4) %156, ptr noundef nonnull align 4 dereferenceable(4) %160)
  %161 = load i32, ptr @tot, align 4, !tbaa !5
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr @tot, align 4, !tbaa !5
  %163 = sext i32 %161 to i64
  %164 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @e, i64 0, i64 %163
  %165 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %164, ptr noundef nonnull align 4 dereferenceable(8) %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %166

166:                                              ; preds = %152, %132
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %167

167:                                              ; preds = %166
  %168 = load i32, ptr %9, align 4, !tbaa !5
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %9, align 4, !tbaa !5
  br label %127, !llvm.loop !19

170:                                              ; preds = %131
  %171 = load i32, ptr @tot, align 4, !tbaa !5
  store i32 %171, ptr @m, align 4, !tbaa !5
  %172 = load i32, ptr @m, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds %"struct.std::pair", ptr @e, i64 %173
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef @e, ptr noundef %174)
  %175 = load i32, ptr @m, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds %"struct.std::pair", ptr @e, i64 %176
  %178 = call noundef ptr @_ZSt6uniqueIPSt4pairIiiEET_S3_S3_(ptr noundef @e, ptr noundef %177)
  %179 = ptrtoint ptr %178 to i64
  %180 = sub i64 %179, ptrtoint (ptr @e to i64)
  %181 = sdiv exact i64 %180, 8
  %182 = trunc i64 %181 to i32
  store i32 %182, ptr @m, align 4, !tbaa !5
  store i32 0, ptr @tot, align 4, !tbaa !5
  %183 = load i32, ptr @scc_tot, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = mul i64 %184, 4
  call void @llvm.memset.p0.i64(ptr align 16 @suf, i8 0, i64 %185, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %186

186:                                              ; preds = %215, %170
  %187 = load i32, ptr %13, align 4, !tbaa !5
  %188 = load i32, ptr @m, align 4, !tbaa !5
  %189 = icmp slt i32 %187, %188
  br i1 %189, label %191, label %190

190:                                              ; preds = %186
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %218

191:                                              ; preds = %186
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %192 = load i32, ptr %13, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @e, i64 0, i64 %193
  %195 = getelementptr inbounds %"struct.std::pair", ptr %194, i32 0, i32 0
  store ptr %195, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %196 = load i32, ptr %13, align 4, !tbaa !5
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @e, i64 0, i64 %197
  %199 = getelementptr inbounds %"struct.std::pair", ptr %198, i32 0, i32 1
  store ptr %199, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %200 = load ptr, ptr %15, align 8, !tbaa !9
  %201 = load i32, ptr %200, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [100001 x i32], ptr @suf, i64 0, i64 %202
  %204 = load ptr, ptr %14, align 8, !tbaa !9
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %16, ptr noundef nonnull align 4 dereferenceable(4) %203, ptr noundef nonnull align 4 dereferenceable(4) %204)
  %205 = load i32, ptr @tot, align 4, !tbaa !5
  %206 = add nsw i32 %205, 1
  store i32 %206, ptr @tot, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [2000002 x %"struct.std::pair"], ptr @g, i64 0, i64 %207
  %209 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %208, ptr noundef nonnull align 4 dereferenceable(8) %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  %210 = load i32, ptr @tot, align 4, !tbaa !5
  %211 = load ptr, ptr %15, align 8, !tbaa !9
  %212 = load i32, ptr %211, align 4, !tbaa !5
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [100001 x i32], ptr @suf, i64 0, i64 %213
  store i32 %210, ptr %214, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %215

215:                                              ; preds = %191
  %216 = load i32, ptr %13, align 4, !tbaa !5
  %217 = add nsw i32 %216, 1
  store i32 %217, ptr %13, align 4, !tbaa !5
  br label %186, !llvm.loop !20

218:                                              ; preds = %190
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  store i32 0, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 1, ptr %19, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %17, ptr noundef nonnull align 4 dereferenceable(4) %18, ptr noundef nonnull align 4 dereferenceable(4) %19)
  %219 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) @ans, ptr noundef nonnull align 4 dereferenceable(8) %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  %220 = load i32, ptr @scc_tot, align 4, !tbaa !5
  %221 = sext i32 %220 to i64
  %222 = mul i64 %221, 1
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 %222, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  store i32 0, ptr %20, align 4, !tbaa !5
  br label %223

223:                                              ; preds = %275, %218
  %224 = load i32, ptr %20, align 4, !tbaa !5
  %225 = load i32, ptr @scc_tot, align 4, !tbaa !5
  %226 = icmp slt i32 %224, %225
  br i1 %226, label %228, label %227

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

228:                                              ; preds = %223
  %229 = load i32, ptr %20, align 4, !tbaa !5
  %230 = sext i32 %229 to i64
  %231 = getelementptr inbounds [100001 x i8], ptr @vis, i64 0, i64 %230
  %232 = load i8, ptr %231, align 1, !tbaa !13, !range !15, !noundef !16
  %233 = trunc i8 %232 to i1
  br i1 %233, label %274, label %234

234:                                              ; preds = %228
  %235 = load i32, ptr %20, align 4, !tbaa !5
  call void @_Z4dfs3i(i32 noundef %235)
  %236 = load i32, ptr @ans, align 4, !tbaa !21
  %237 = load i32, ptr %20, align 4, !tbaa !5
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @f, i64 0, i64 %238
  %240 = getelementptr inbounds %"struct.std::pair", ptr %239, i32 0, i32 0
  %241 = load i32, ptr %240, align 8, !tbaa !21
  %242 = icmp slt i32 %236, %241
  br i1 %242, label %243, label %248

243:                                              ; preds = %234
  %244 = load i32, ptr %20, align 4, !tbaa !5
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @f, i64 0, i64 %245
  %247 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) @ans, ptr noundef nonnull align 4 dereferenceable(8) %246)
  br label %273

248:                                              ; preds = %234
  %249 = load i32, ptr @ans, align 4, !tbaa !21
  %250 = load i32, ptr %20, align 4, !tbaa !5
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @f, i64 0, i64 %251
  %253 = getelementptr inbounds %"struct.std::pair", ptr %252, i32 0, i32 0
  %254 = load i32, ptr %253, align 8, !tbaa !21
  %255 = icmp eq i32 %249, %254
  br i1 %255, label %256, label %272

256:                                              ; preds = %248
  %257 = load i32, ptr %20, align 4, !tbaa !5
  %258 = sext i32 %257 to i64
  %259 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @f, i64 0, i64 %258
  %260 = getelementptr inbounds %"struct.std::pair", ptr %259, i32 0, i32 1
  %261 = load i32, ptr %260, align 4, !tbaa !23
  %262 = load i32, ptr getelementptr inbounds (%"struct.std::pair", ptr @ans, i32 0, i32 1), align 4, !tbaa !23
  %263 = add nsw i32 %262, %261
  store i32 %263, ptr getelementptr inbounds (%"struct.std::pair", ptr @ans, i32 0, i32 1), align 4, !tbaa !23
  %264 = load i32, ptr getelementptr inbounds (%"struct.std::pair", ptr @ans, i32 0, i32 1), align 4, !tbaa !23
  %265 = load i32, ptr @mod, align 4, !tbaa !5
  %266 = icmp sge i32 %264, %265
  br i1 %266, label %267, label %271

267:                                              ; preds = %256
  %268 = load i32, ptr @mod, align 4, !tbaa !5
  %269 = load i32, ptr getelementptr inbounds (%"struct.std::pair", ptr @ans, i32 0, i32 1), align 4, !tbaa !23
  %270 = sub nsw i32 %269, %268
  store i32 %270, ptr getelementptr inbounds (%"struct.std::pair", ptr @ans, i32 0, i32 1), align 4, !tbaa !23
  br label %271

271:                                              ; preds = %267, %256
  br label %272

272:                                              ; preds = %271, %248
  br label %273

273:                                              ; preds = %272, %243
  br label %274

274:                                              ; preds = %273, %228
  br label %275

275:                                              ; preds = %274
  %276 = load i32, ptr %20, align 4, !tbaa !5
  %277 = add nsw i32 %276, 1
  store i32 %277, ptr %20, align 4, !tbaa !5
  br label %223, !llvm.loop !24

278:                                              ; preds = %227
  %279 = load i32, ptr @ans, align 4, !tbaa !21
  %280 = load i32, ptr getelementptr inbounds (%"struct.std::pair", ptr @ans, i32 0, i32 1), align 4, !tbaa !23
  %281 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %279, i32 noundef %280)
  ret i32 0
}

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

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

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

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

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = !{!22, !6, i64 0}
!22 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!23 = !{!22, !6, i64 4}
!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"

%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@mod = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@pre = external dso_local global [100001 x i32], align 16
@suf = external dso_local global [100001 x i32], align 16
@que = external dso_local local_unnamed_addr global [100001 x i32], align 16
@scc_tot = external dso_local local_unnamed_addr global i32, align 4
@scc = external dso_local global [100001 x i32], align 16
@e = external dso_local global [1000001 x %"struct.std::pair"], align 16
@g = external dso_local global [2000002 x %"struct.std::pair"], align 16
@f = external dso_local global [100001 x %"struct.std::pair"], align 16
@ans = external dso_local global %"struct.std::pair", align 4
@vis = external dso_local local_unnamed_addr global [100001 x i8], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4dfs1i(i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4dfs2i(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4dfs3i(i32 noundef) local_unnamed_addr #0

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

; 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 #2 align 2

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

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

._crit_edge:                                      ; preds = %.lr.ph, %0
  store i32 0, ptr @tot, align 4, !tbaa !5
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph58, label %._crit_edge59.thread

._crit_edge59.thread:                             ; preds = %._crit_edge
  %.pre96 = sext i32 %11 to i64
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @vis, i8 0, i64 %.pre96, i1 false)
  br label %._crit_edge64

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %13 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @e, i64 0, i64 %indvars.iv
  %14 = getelementptr inbounds i8, ptr %13, i64 4
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %13, ptr noundef nonnull %14)
  %16 = load <2 x i32>, ptr %13, align 8, !tbaa !5
  %17 = add nsw <2 x i32> %16, <i32 -1, i32 -1>
  store <2 x i32> %17, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  %18 = extractelement <2 x i32> %17, i64 0
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [100001 x i32], ptr @pre, i64 0, i64 %19
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(4) %20, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %21 = load i32, ptr @tot, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr @tot, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [2000002 x %"struct.std::pair"], ptr @g, i64 0, i64 %23
  %25 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %24, ptr noundef nonnull align 4 dereferenceable(8) %1) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  %26 = load i32, ptr @tot, align 4, !tbaa !5
  %27 = load i32, ptr %13, align 8, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [100001 x i32], ptr @pre, i64 0, i64 %28
  store i32 %26, ptr %29, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %30 = load i32, ptr %14, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [100001 x i32], ptr @suf, i64 0, i64 %31
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(4) %32, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %33 = load i32, ptr @tot, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr @tot, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [2000002 x %"struct.std::pair"], ptr @g, i64 0, i64 %35
  %37 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %36, ptr noundef nonnull align 4 dereferenceable(8) %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  %38 = load i32, ptr @tot, align 4, !tbaa !5
  %39 = load i32, ptr %14, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [100001 x i32], ptr @suf, i64 0, i64 %40
  store i32 %38, ptr %41, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %42 = load i32, ptr @m, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = icmp slt i64 %indvars.iv.next, %43
  br i1 %44, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge59:                                    ; preds = %53
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @vis, i8 0, i64 %55, i1 false)
  %45 = icmp sgt i32 %54, 0
  br i1 %45, label %.lr.ph63.preheader, label %._crit_edge64

.lr.ph63.preheader:                               ; preds = %._crit_edge59
  %46 = zext nneg i32 %54 to i64
  br label %.lr.ph63

.lr.ph58:                                         ; preds = %._crit_edge, %53
  %47 = phi i32 [ %54, %53 ], [ %11, %._crit_edge ]
  %indvars.iv79 = phi i64 [ %indvars.iv.next80, %53 ], [ 0, %._crit_edge ]
  %48 = getelementptr inbounds [100001 x i8], ptr @vis, i64 0, i64 %indvars.iv79
  %49 = load i8, ptr %48, align 1, !tbaa !11, !range !13, !noundef !14
  %50 = trunc nuw i8 %49 to i1
  br i1 %50, label %53, label %51

51:                                               ; preds = %.lr.ph58
  %52 = trunc nuw nsw i64 %indvars.iv79 to i32
  call void @_Z4dfs1i(i32 noundef %52)
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %.lr.ph58, %51
  %54 = phi i32 [ %47, %.lr.ph58 ], [ %.pre, %51 ]
  %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
  %55 = sext i32 %54 to i64
  %56 = icmp slt i64 %indvars.iv.next80, %55
  br i1 %56, label %.lr.ph58, label %._crit_edge59, !llvm.loop !15

._crit_edge64:                                    ; preds = %68, %._crit_edge59.thread, %._crit_edge59
  store i32 0, ptr @tot, align 4, !tbaa !5
  %57 = load i32, ptr @m, align 4, !tbaa !5
  %58 = icmp sgt i32 %57, 0
  br i1 %58, label %.lr.ph67, label %._crit_edge68

.lr.ph63:                                         ; preds = %.lr.ph63.preheader, %68
  %indvars.iv82 = phi i64 [ %46, %.lr.ph63.preheader ], [ %indvars.iv.next83, %68 ]
  %indvars.iv.next83 = add nsw i64 %indvars.iv82, -1
  %59 = getelementptr inbounds [100001 x i32], ptr @que, i64 0, i64 %indvars.iv.next83
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [100001 x i8], ptr @vis, i64 0, i64 %61
  %63 = load i8, ptr %62, align 1, !tbaa !11, !range !13, !noundef !14
  %64 = trunc nuw i8 %63 to i1
  br i1 %64, label %68, label %65

65:                                               ; preds = %.lr.ph63
  call void @_Z4dfs2i(i32 noundef %60)
  %66 = load i32, ptr @scc_tot, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr @scc_tot, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %.lr.ph63, %65
  %69 = icmp ugt i64 %indvars.iv82, 1
  br i1 %69, label %.lr.ph63, label %._crit_edge64, !llvm.loop !16

._crit_edge68.loopexit:                           ; preds = %102
  %.pre95 = load i32, ptr @tot, align 4, !tbaa !5
  br label %._crit_edge68

._crit_edge68:                                    ; preds = %._crit_edge68.loopexit, %._crit_edge64
  %70 = phi i32 [ %.pre95, %._crit_edge68.loopexit ], [ 0, %._crit_edge64 ]
  store i32 %70, ptr @m, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds %"struct.std::pair", ptr @e, i64 %71
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef nonnull @e, ptr noundef nonnull %72)
  %73 = load i32, ptr @m, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds %"struct.std::pair", ptr @e, i64 %74
  %76 = call noundef ptr @_ZSt6uniqueIPSt4pairIiiEET_S3_S3_(ptr noundef nonnull @e, ptr noundef nonnull %75)
  %77 = ptrtoint ptr %76 to i64
  %78 = sub i64 %77, ptrtoint (ptr @e to i64)
  %79 = lshr exact i64 %78, 3
  %80 = trunc i64 %79 to i32
  store i32 %80, ptr @m, align 4, !tbaa !5
  store i32 0, ptr @tot, align 4, !tbaa !5
  %81 = load i32, ptr @scc_tot, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = shl nsw i64 %82, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @suf, i8 0, i64 %83, i1 false)
  %84 = icmp sgt i32 %80, 0
  br i1 %84, label %.lr.ph71, label %._crit_edge72

.lr.ph67:                                         ; preds = %._crit_edge64, %102
  %85 = phi i32 [ %103, %102 ], [ %57, %._crit_edge64 ]
  %indvars.iv85 = phi i64 [ %indvars.iv.next86, %102 ], [ 0, %._crit_edge64 ]
  %86 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @e, i64 0, i64 %indvars.iv85
  %87 = getelementptr inbounds i8, ptr %86, i64 4
  %88 = load i32, ptr %86, align 8, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [100001 x i32], ptr @scc, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = load i32, ptr %87, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [100001 x i32], ptr @scc, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %.not54 = icmp eq i32 %91, %95
  br i1 %.not54, label %102, label %96

96:                                               ; preds = %.lr.ph67
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(4) %90, ptr noundef nonnull align 4 dereferenceable(4) %94)
  %97 = load i32, ptr @tot, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr @tot, align 4, !tbaa !5
  %99 = sext i32 %97 to i64
  %100 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @e, i64 0, i64 %99
  %101 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %100, ptr noundef nonnull align 4 dereferenceable(8) %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  %.pre94 = load i32, ptr @m, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %96, %.lr.ph67
  %103 = phi i32 [ %.pre94, %96 ], [ %85, %.lr.ph67 ]
  %indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
  %104 = sext i32 %103 to i64
  %105 = icmp slt i64 %indvars.iv.next86, %104
  br i1 %105, label %.lr.ph67, label %._crit_edge68.loopexit, !llvm.loop !17

._crit_edge72:                                    ; preds = %.lr.ph71, %._crit_edge68
  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 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  store i32 1, ptr %7, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %106 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) @ans, ptr noundef nonnull align 4 dereferenceable(8) %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  %107 = load i32, ptr @scc_tot, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @vis, i8 0, i64 %108, i1 false)
  %109 = icmp sgt i32 %107, 0
  br i1 %109, label %.lr.ph75, label %._crit_edge76

.lr.ph71:                                         ; preds = %._crit_edge68, %.lr.ph71
  %indvars.iv88 = phi i64 [ %indvars.iv.next89, %.lr.ph71 ], [ 0, %._crit_edge68 ]
  %110 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @e, i64 0, i64 %indvars.iv88
  %111 = getelementptr inbounds i8, ptr %110, i64 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [100001 x i32], ptr @suf, i64 0, i64 %113
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %114, ptr noundef nonnull align 4 dereferenceable(4) %110)
  %115 = load i32, ptr @tot, align 4, !tbaa !5
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr @tot, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [2000002 x %"struct.std::pair"], ptr @g, i64 0, i64 %117
  %119 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %118, ptr noundef nonnull align 4 dereferenceable(8) %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  %120 = load i32, ptr @tot, align 4, !tbaa !5
  %121 = load i32, ptr %111, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [100001 x i32], ptr @suf, i64 0, i64 %122
  store i32 %120, ptr %123, align 4, !tbaa !5
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %124 = load i32, ptr @m, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = icmp slt i64 %indvars.iv.next89, %125
  br i1 %126, label %.lr.ph71, label %._crit_edge72, !llvm.loop !18

._crit_edge76:                                    ; preds = %151, %._crit_edge72
  %127 = load i32, ptr @ans, align 4, !tbaa !19
  %128 = load i32, ptr getelementptr inbounds (i8, ptr @ans, i64 4), align 4, !tbaa !21
  %129 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %127, i32 noundef %128)
  ret i32 0

.lr.ph75:                                         ; preds = %._crit_edge72, %151
  %indvars.iv91 = phi i64 [ %indvars.iv.next92, %151 ], [ 0, %._crit_edge72 ]
  %130 = getelementptr inbounds [100001 x i8], ptr @vis, i64 0, i64 %indvars.iv91
  %131 = load i8, ptr %130, align 1, !tbaa !11, !range !13, !noundef !14
  %132 = trunc nuw i8 %131 to i1
  br i1 %132, label %151, label %133

133:                                              ; preds = %.lr.ph75
  %134 = trunc nuw nsw i64 %indvars.iv91 to i32
  call void @_Z4dfs3i(i32 noundef %134)
  %135 = load i32, ptr @ans, align 4, !tbaa !19
  %136 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @f, i64 0, i64 %indvars.iv91
  %137 = load i32, ptr %136, align 8, !tbaa !19
  %138 = icmp slt i32 %135, %137
  br i1 %138, label %139, label %141

139:                                              ; preds = %133
  %140 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) @ans, ptr noundef nonnull align 4 dereferenceable(8) %136)
  br label %151

141:                                              ; preds = %133
  %142 = icmp eq i32 %135, %137
  br i1 %142, label %143, label %151

143:                                              ; preds = %141
  %144 = getelementptr inbounds i8, ptr %136, i64 4
  %145 = load i32, ptr %144, align 4, !tbaa !21
  %146 = load i32, ptr getelementptr inbounds (i8, ptr @ans, i64 4), align 4, !tbaa !21
  %147 = add nsw i32 %146, %145
  store i32 %147, ptr getelementptr inbounds (i8, ptr @ans, i64 4), align 4, !tbaa !21
  %148 = load i32, ptr @mod, align 4, !tbaa !5
  %.not = icmp slt i32 %147, %148
  br i1 %.not, label %151, label %149

149:                                              ; preds = %143
  %150 = sub nsw i32 %147, %148
  store i32 %150, ptr getelementptr inbounds (i8, ptr @ans, i64 4), align 4, !tbaa !21
  br label %151

151:                                              ; preds = %.lr.ph75, %141, %149, %143, %139
  %indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
  %152 = load i32, ptr @scc_tot, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = icmp slt i64 %indvars.iv.next92, %153
  br i1 %154, label %.lr.ph75, label %._crit_edge76, !llvm.loop !22
}

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

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

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

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = !{!20, !6, i64 0}
!20 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!21 = !{!20, !6, i64 4}
!22 = distinct !{!22, !10}


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