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

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@p = external dso_local global [500010 x i32], align 16
@f = external dso_local global [500010 x i32], align 16
@tot = external dso_local global i32, align 4
@que = external dso_local global [500010 x i32], align 16
@dis = external dso_local global [500010 x i32], align 16
@pre = external dso_local global [500010 x i32], align 16
@suf = external dso_local global [500010 x i32], align 16
@deq = external dso_local global [500010 x i32], align 16
@l = external dso_local global i32, align 4
@r = external dso_local global i32, align 4
@e = external dso_local global [500010 x %"class.std::vector"], align 16
@inq = external dso_local global [500010 x i8], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsii(i32 noundef, 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 norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %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 %"struct.std::pair", align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %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
  store i32 0, ptr %1, align 4
  store i32 0, ptr @tot, align 4, !tbaa !5
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @s)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %33, %0
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = icmp slt i32 %19, %20
  br i1 %21, label %23, label %22

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

23:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %3, ptr noundef %4, ptr noundef %5)
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [500010 x %"class.std::vector"], ptr @e, i64 0, i64 %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %28 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i64 %28, ptr %6, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %27, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [500010 x %"class.std::vector"], ptr @e, i64 0, i64 %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %32 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i64 %32, ptr %7, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %31, ptr noundef nonnull align 4 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %33

33:                                               ; preds = %23
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %2, align 4, !tbaa !5
  br label %18, !llvm.loop !9

36:                                               ; preds = %22
  call void @_Z3dfsii(i32 noundef 1, i32 noundef -1)
  %37 = load i32, ptr @tot, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr @tot, align 4, !tbaa !5
  %39 = sext i32 %37 to i64
  %40 = getelementptr inbounds [500010 x i32], ptr @que, i64 0, i64 %39
  store i32 1, ptr %40, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %48, %36
  %42 = load i32, ptr @que, align 16, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [500010 x i32], ptr @f, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %47, label %53

47:                                               ; preds = %41
  br label %48

48:                                               ; preds = %47
  %49 = load i32, ptr @que, align 16, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [500010 x i32], ptr @p, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  store i32 %52, ptr @que, align 16, !tbaa !5
  br label %41, !llvm.loop !11

53:                                               ; preds = %41
  %54 = load i32, ptr @que, align 16, !tbaa !5
  call void @_Z3dfsii(i32 noundef %54, i32 noundef -1)
  %55 = load i32, ptr @que, align 16, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [500010 x i8], ptr @inq, i64 0, i64 %56
  store i8 1, ptr %57, align 1, !tbaa !12
  %58 = load i32, ptr @que, align 16, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [500010 x i32], ptr @f, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  store i32 %61, ptr @dis, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %62 = load i32, ptr @que, align 16, !tbaa !5
  store i32 %62, ptr %8, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %95, %53
  %64 = load i32, ptr %8, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [500010 x i32], ptr @f, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %70, label %69

69:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %100

70:                                               ; preds = %63
  %71 = load i32, ptr %8, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [500010 x i32], ptr @p, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [500010 x i8], ptr @inq, i64 0, i64 %75
  store i8 1, ptr %76, align 1, !tbaa !12
  %77 = load i32, ptr %8, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [500010 x i32], ptr @p, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [500010 x i32], ptr @f, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = load i32, ptr @tot, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %85
  store i32 %83, ptr %86, align 4, !tbaa !5
  %87 = load i32, ptr %8, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [500010 x i32], ptr @p, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = load i32, ptr @tot, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr @tot, align 4, !tbaa !5
  %93 = sext i32 %91 to i64
  %94 = getelementptr inbounds [500010 x i32], ptr @que, i64 0, i64 %93
  store i32 %90, ptr %94, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %70
  %96 = load i32, ptr %8, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [500010 x i32], ptr @p, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  store i32 %99, ptr %8, align 4, !tbaa !5
  br label %63, !llvm.loop !14

100:                                              ; preds = %69
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %124, %100
  %102 = load i32, ptr %9, align 4, !tbaa !5
  %103 = load i32, ptr @tot, align 4, !tbaa !5
  %104 = icmp slt i32 %102, %103
  br i1 %104, label %106, label %105

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

106:                                              ; preds = %101
  %107 = load i32, ptr %9, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [500010 x i32], ptr @que, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  call void @_Z3dfsii(i32 noundef %110, i32 noundef -1)
  %111 = load i32, ptr %9, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [500010 x i32], ptr @que, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [500010 x i32], ptr @f, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = load i32, ptr %9, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [500010 x i32], ptr @suf, i64 0, i64 %119
  store i32 %117, ptr %120, align 4, !tbaa !5
  %121 = load i32, ptr %9, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [500010 x i32], ptr @pre, i64 0, i64 %122
  store i32 %117, ptr %123, align 4, !tbaa !5
  br label %124

124:                                              ; preds = %106
  %125 = load i32, ptr %9, align 4, !tbaa !5
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %9, align 4, !tbaa !5
  br label %101, !llvm.loop !15

127:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %128

128:                                              ; preds = %176, %127
  %129 = load i32, ptr %10, align 4, !tbaa !5
  %130 = load i32, ptr @tot, align 4, !tbaa !5
  %131 = icmp slt i32 %129, %130
  br i1 %131, label %133, label %132

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

133:                                              ; preds = %128
  %134 = load i32, ptr %10, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [500010 x i32], ptr @pre, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = load i32, ptr %10, align 4, !tbaa !5
  %139 = sub nsw i32 %138, 1
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [500010 x i32], ptr @pre, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = load i32, ptr %10, align 4, !tbaa !5
  %144 = sub nsw i32 %143, 1
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !5
  %148 = add nsw i32 %142, %147
  %149 = load i32, ptr %10, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %150
  %152 = load i32, ptr %151, align 4, !tbaa !5
  %153 = sub nsw i32 %148, %152
  %154 = icmp slt i32 %137, %153
  br i1 %154, label %155, label %175

155:                                              ; preds = %133
  %156 = load i32, ptr %10, align 4, !tbaa !5
  %157 = sub nsw i32 %156, 1
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [500010 x i32], ptr @pre, i64 0, i64 %158
  %160 = load i32, ptr %159, align 4, !tbaa !5
  %161 = load i32, ptr %10, align 4, !tbaa !5
  %162 = sub nsw i32 %161, 1
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %163
  %165 = load i32, ptr %164, align 4, !tbaa !5
  %166 = add nsw i32 %160, %165
  %167 = load i32, ptr %10, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !5
  %171 = sub nsw i32 %166, %170
  %172 = load i32, ptr %10, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [500010 x i32], ptr @pre, i64 0, i64 %173
  store i32 %171, ptr %174, align 4, !tbaa !5
  br label %175

175:                                              ; preds = %155, %133
  br label %176

176:                                              ; preds = %175
  %177 = load i32, ptr %10, align 4, !tbaa !5
  %178 = add nsw i32 %177, 1
  store i32 %178, ptr %10, align 4, !tbaa !5
  br label %128, !llvm.loop !16

179:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %180 = load i32, ptr @tot, align 4, !tbaa !5
  %181 = sub nsw i32 %180, 2
  store i32 %181, ptr %11, align 4, !tbaa !5
  br label %182

182:                                              ; preds = %229, %179
  %183 = load i32, ptr %11, align 4, !tbaa !5
  %184 = icmp sge i32 %183, 0
  br i1 %184, label %186, label %185

185:                                              ; preds = %182
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %232

186:                                              ; preds = %182
  %187 = load i32, ptr %11, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [500010 x i32], ptr @suf, i64 0, i64 %188
  %190 = load i32, ptr %189, align 4, !tbaa !5
  %191 = load i32, ptr %11, align 4, !tbaa !5
  %192 = add nsw i32 %191, 1
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [500010 x i32], ptr @suf, i64 0, i64 %193
  %195 = load i32, ptr %194, align 4, !tbaa !5
  %196 = load i32, ptr %11, align 4, !tbaa !5
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %197
  %199 = load i32, ptr %198, align 4, !tbaa !5
  %200 = add nsw i32 %195, %199
  %201 = load i32, ptr %11, align 4, !tbaa !5
  %202 = add nsw i32 %201, 1
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %203
  %205 = load i32, ptr %204, align 4, !tbaa !5
  %206 = sub nsw i32 %200, %205
  %207 = icmp slt i32 %190, %206
  br i1 %207, label %208, label %228

208:                                              ; preds = %186
  %209 = load i32, ptr %11, align 4, !tbaa !5
  %210 = add nsw i32 %209, 1
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [500010 x i32], ptr @suf, i64 0, i64 %211
  %213 = load i32, ptr %212, align 4, !tbaa !5
  %214 = load i32, ptr %11, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %215
  %217 = load i32, ptr %216, align 4, !tbaa !5
  %218 = add nsw i32 %213, %217
  %219 = load i32, ptr %11, align 4, !tbaa !5
  %220 = add nsw i32 %219, 1
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %221
  %223 = load i32, ptr %222, align 4, !tbaa !5
  %224 = sub nsw i32 %218, %223
  %225 = load i32, ptr %11, align 4, !tbaa !5
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [500010 x i32], ptr @suf, i64 0, i64 %226
  store i32 %224, ptr %227, align 4, !tbaa !5
  br label %228

228:                                              ; preds = %208, %186
  br label %229

229:                                              ; preds = %228
  %230 = load i32, ptr %11, align 4, !tbaa !5
  %231 = add nsw i32 %230, -1
  store i32 %231, ptr %11, align 4, !tbaa !5
  br label %182, !llvm.loop !17

232:                                              ; preds = %185
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 2147483647, ptr %12, align 4, !tbaa !5
  store i32 0, ptr @r, align 4, !tbaa !5
  store i32 0, ptr @l, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %233

233:                                              ; preds = %348, %232
  %234 = load i32, ptr %13, align 4, !tbaa !5
  %235 = load i32, ptr @tot, align 4, !tbaa !5
  %236 = icmp slt i32 %234, %235
  br i1 %236, label %238, label %237

237:                                              ; preds = %233
  store i32 20, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %351

238:                                              ; preds = %233
  %239 = load i32, ptr %14, align 4, !tbaa !5
  %240 = load i32, ptr %13, align 4, !tbaa !5
  %241 = icmp slt i32 %239, %240
  br i1 %241, label %242, label %244

242:                                              ; preds = %238
  %243 = load i32, ptr %13, align 4, !tbaa !5
  br label %246

244:                                              ; preds = %238
  %245 = load i32, ptr %14, align 4, !tbaa !5
  br label %246

246:                                              ; preds = %244, %242
  %247 = phi i32 [ %243, %242 ], [ %245, %244 ]
  store i32 %247, ptr %14, align 4, !tbaa !5
  br label %248

248:                                              ; preds = %344, %246
  %249 = load i32, ptr %14, align 4, !tbaa !5
  %250 = load i32, ptr @tot, align 4, !tbaa !5
  %251 = icmp slt i32 %249, %250
  br i1 %251, label %252, label %264

252:                                              ; preds = %248
  %253 = load i32, ptr %13, align 4, !tbaa !5
  %254 = sext i32 %253 to i64
  %255 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %254
  %256 = load i32, ptr %255, align 4, !tbaa !5
  %257 = load i32, ptr %14, align 4, !tbaa !5
  %258 = sext i32 %257 to i64
  %259 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %258
  %260 = load i32, ptr %259, align 4, !tbaa !5
  %261 = sub nsw i32 %256, %260
  %262 = load i32, ptr @s, align 4, !tbaa !5
  %263 = icmp sle i32 %261, %262
  br label %264

264:                                              ; preds = %252, %248
  %265 = phi i1 [ false, %248 ], [ %263, %252 ]
  br i1 %265, label %266, label %347

266:                                              ; preds = %264
  br label %267

267:                                              ; preds = %290, %266
  %268 = load i32, ptr @l, align 4, !tbaa !5
  %269 = load i32, ptr @r, align 4, !tbaa !5
  %270 = icmp slt i32 %268, %269
  br i1 %270, label %271, label %288

271:                                              ; preds = %267
  %272 = load i32, ptr @r, align 4, !tbaa !5
  %273 = sub nsw i32 %272, 1
  %274 = sext i32 %273 to i64
  %275 = getelementptr inbounds [500010 x i32], ptr @deq, i64 0, i64 %274
  %276 = load i32, ptr %275, align 4, !tbaa !5
  %277 = sext i32 %276 to i64
  %278 = getelementptr inbounds [500010 x i32], ptr @f, i64 0, i64 %277
  %279 = load i32, ptr %278, align 4, !tbaa !5
  %280 = load i32, ptr %14, align 4, !tbaa !5
  %281 = sext i32 %280 to i64
  %282 = getelementptr inbounds [500010 x i32], ptr @que, i64 0, i64 %281
  %283 = load i32, ptr %282, align 4, !tbaa !5
  %284 = sext i32 %283 to i64
  %285 = getelementptr inbounds [500010 x i32], ptr @f, i64 0, i64 %284
  %286 = load i32, ptr %285, align 4, !tbaa !5
  %287 = icmp sle i32 %279, %286
  br label %288

288:                                              ; preds = %271, %267
  %289 = phi i1 [ false, %267 ], [ %287, %271 ]
  br i1 %289, label %290, label %293

290:                                              ; preds = %288
  %291 = load i32, ptr @r, align 4, !tbaa !5
  %292 = add nsw i32 %291, -1
  store i32 %292, ptr @r, align 4, !tbaa !5
  br label %267, !llvm.loop !18

293:                                              ; preds = %288
  %294 = load i32, ptr %14, align 4, !tbaa !5
  %295 = sext i32 %294 to i64
  %296 = getelementptr inbounds [500010 x i32], ptr @que, i64 0, i64 %295
  %297 = load i32, ptr %296, align 4, !tbaa !5
  %298 = load i32, ptr @r, align 4, !tbaa !5
  %299 = add nsw i32 %298, 1
  store i32 %299, ptr @r, align 4, !tbaa !5
  %300 = sext i32 %298 to i64
  %301 = getelementptr inbounds [500010 x i32], ptr @deq, i64 0, i64 %300
  store i32 %297, ptr %301, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %302 = load i32, ptr %13, align 4, !tbaa !5
  %303 = sext i32 %302 to i64
  %304 = getelementptr inbounds [500010 x i32], ptr @pre, i64 0, i64 %303
  %305 = load i32, ptr %14, align 4, !tbaa !5
  %306 = sext i32 %305 to i64
  %307 = getelementptr inbounds [500010 x i32], ptr @suf, i64 0, i64 %306
  %308 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %304, ptr noundef nonnull align 4 dereferenceable(4) %307)
  %309 = load i32, ptr @l, align 4, !tbaa !5
  %310 = sext i32 %309 to i64
  %311 = getelementptr inbounds [500010 x i32], ptr @deq, i64 0, i64 %310
  %312 = load i32, ptr %311, align 4, !tbaa !5
  %313 = sext i32 %312 to i64
  %314 = getelementptr inbounds [500010 x i32], ptr @f, i64 0, i64 %313
  %315 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %308, ptr noundef nonnull align 4 dereferenceable(4) %314)
  %316 = load i32, ptr %315, align 4, !tbaa !5
  store i32 %316, ptr %16, align 4, !tbaa !5
  %317 = load i32, ptr %12, align 4, !tbaa !5
  %318 = load i32, ptr %16, align 4, !tbaa !5
  %319 = icmp sge i32 %317, %318
  br i1 %319, label %320, label %322

320:                                              ; preds = %293
  %321 = load i32, ptr %16, align 4, !tbaa !5
  store i32 %321, ptr %12, align 4, !tbaa !5
  br label %340

322:                                              ; preds = %293
  %323 = load i32, ptr @l, align 4, !tbaa !5
  %324 = load i32, ptr @r, align 4, !tbaa !5
  %325 = icmp slt i32 %323, %324
  br i1 %325, label %326, label %339

326:                                              ; preds = %322
  %327 = load i32, ptr @l, align 4, !tbaa !5
  %328 = sext i32 %327 to i64
  %329 = getelementptr inbounds [500010 x i32], ptr @deq, i64 0, i64 %328
  %330 = load i32, ptr %329, align 4, !tbaa !5
  %331 = load i32, ptr %13, align 4, !tbaa !5
  %332 = sext i32 %331 to i64
  %333 = getelementptr inbounds [500010 x i32], ptr @que, i64 0, i64 %332
  %334 = load i32, ptr %333, align 4, !tbaa !5
  %335 = icmp eq i32 %330, %334
  br i1 %335, label %336, label %339

336:                                              ; preds = %326
  %337 = load i32, ptr @l, align 4, !tbaa !5
  %338 = add nsw i32 %337, 1
  store i32 %338, ptr @l, align 4, !tbaa !5
  br label %339

339:                                              ; preds = %336, %326, %322
  store i32 23, ptr %15, align 4
  br label %341

340:                                              ; preds = %320
  store i32 0, ptr %15, align 4
  br label %341

341:                                              ; preds = %340, %339
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  %342 = load i32, ptr %15, align 4
  switch i32 %342, label %355 [
    i32 0, label %343
    i32 23, label %347
  ]

343:                                              ; preds = %341
  br label %344

344:                                              ; preds = %343
  %345 = load i32, ptr %14, align 4, !tbaa !5
  %346 = add nsw i32 %345, 1
  store i32 %346, ptr %14, align 4, !tbaa !5
  br label %248, !llvm.loop !19

347:                                              ; preds = %341, %264
  br label %348

348:                                              ; preds = %347
  %349 = load i32, ptr %13, align 4, !tbaa !5
  %350 = add nsw i32 %349, 1
  store i32 %350, ptr %13, align 4, !tbaa !5
  br label %233, !llvm.loop !20

351:                                              ; preds = %237
  %352 = load i32, ptr %12, align 4, !tbaa !5
  %353 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %352)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  %354 = load i32, ptr %1, align 4
  ret i32 %354

355:                                              ; preds = %341
  unreachable
}

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

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

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

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

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

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 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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, !13, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}


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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@p = external dso_local local_unnamed_addr global [500010 x i32], align 16
@f = external dso_local global [500010 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@que = external dso_local local_unnamed_addr global [500010 x i32], align 16
@dis = external dso_local local_unnamed_addr global [500010 x i32], align 16
@pre = external dso_local global [500010 x i32], align 16
@suf = external dso_local global [500010 x i32], align 16
@deq = external dso_local local_unnamed_addr global [500010 x i32], align 16
@l = external dso_local local_unnamed_addr global i32, align 4
@r = external dso_local local_unnamed_addr global i32, align 4
@e = external dso_local global [500010 x %"class.std::vector"], align 16
@inq = external dso_local local_unnamed_addr global [500010 x i8], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsii(i32 noundef, 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 norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca %"struct.std::pair", align 8
  store i32 0, ptr @tot, align 4, !tbaa !5
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @s)
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 1
  br i1 %8, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @_Z3dfsii(i32 noundef 1, i32 noundef -1)
  %9 = load i32, ptr @tot, align 4, !tbaa !5
  %10 = add nsw i32 %9, 1
  store i32 %10, ptr @tot, align 4, !tbaa !5
  %11 = sext i32 %9 to i64
  %12 = getelementptr inbounds [500010 x i32], ptr @que, i64 0, i64 %11
  store i32 1, ptr %12, align 4, !tbaa !5
  %que.promoted = load i32, ptr @que, align 16, !tbaa !5
  %13 = sext i32 %que.promoted to i64
  %14 = getelementptr inbounds [500010 x i32], ptr @f, i64 0, i64 %13
  %15 = load i32, ptr %14, align 4, !tbaa !5
  %.not89 = icmp eq i32 %15, 0
  br i1 %.not89, label %34, label %.lr.ph91

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.06488 = phi i32 [ %25, %.lr.ph ], [ 1, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %17 = load i32, ptr %1, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [500010 x %"class.std::vector"], ptr @e, i64 0, i64 %18
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %20 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i64 %20, ptr %4, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [500010 x %"class.std::vector"], ptr @e, i64 0, i64 %22
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %24 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__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) %3)
  store i64 %24, ptr %5, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %23, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %25 = add nuw nsw i32 %.06488, 1
  %26 = load i32, ptr @n, align 4, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.lr.ph91:                                         ; preds = %._crit_edge, %.lr.ph91
  %28 = phi i64 [ %31, %.lr.ph91 ], [ %13, %._crit_edge ]
  %29 = getelementptr inbounds [500010 x i32], ptr @p, i64 0, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [500010 x i32], ptr @f, i64 0, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %.not = icmp eq i32 %33, 0
  br i1 %.not, label %._crit_edge92, label %.lr.ph91, !llvm.loop !11

._crit_edge92:                                    ; preds = %.lr.ph91
  store i32 %30, ptr @que, align 16, !tbaa !5
  br label %34

34:                                               ; preds = %._crit_edge92, %._crit_edge
  %.lcssa87 = phi i32 [ %30, %._crit_edge92 ], [ %que.promoted, %._crit_edge ]
  call void @_Z3dfsii(i32 noundef %.lcssa87, i32 noundef -1)
  %35 = load i32, ptr @que, align 16, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [500010 x i8], ptr @inq, i64 0, i64 %36
  store i8 1, ptr %37, align 1, !tbaa !12
  %38 = getelementptr inbounds [500010 x i32], ptr @f, i64 0, i64 %36
  %39 = load i32, ptr %38, align 4, !tbaa !5
  store i32 %39, ptr @dis, align 16, !tbaa !5
  %tot.promoted = load i32, ptr @tot, align 4, !tbaa !5
  %.not7195 = icmp eq i32 %39, 0
  br i1 %.not7195, label %.preheader80, label %.lr.ph97.preheader

.lr.ph97.preheader:                               ; preds = %34
  %40 = sext i32 %tot.promoted to i64
  br label %.lr.ph97

..preheader80_crit_edge:                          ; preds = %.lr.ph97
  %41 = trunc nsw i64 %indvars.iv.next to i32
  store i32 %41, ptr @tot, align 4, !tbaa !5
  br label %.preheader80

.preheader80:                                     ; preds = %..preheader80_crit_edge, %34
  %42 = phi i32 [ %41, %..preheader80_crit_edge ], [ %tot.promoted, %34 ]
  %43 = icmp sgt i32 %42, 0
  br i1 %43, label %.lr.ph100, label %._crit_edge108.thread

._crit_edge108.thread:                            ; preds = %.preheader80
  store i32 0, ptr @r, align 4, !tbaa !5
  store i32 0, ptr @l, align 4, !tbaa !5
  br label %._crit_edge128

.lr.ph97:                                         ; preds = %.lr.ph97.preheader, %.lr.ph97
  %indvars.iv = phi i64 [ %40, %.lr.ph97.preheader ], [ %indvars.iv.next, %.lr.ph97 ]
  %44 = phi i64 [ %36, %.lr.ph97.preheader ], [ %47, %.lr.ph97 ]
  %45 = getelementptr inbounds [500010 x i32], ptr @p, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [500010 x i8], ptr @inq, i64 0, i64 %47
  store i8 1, ptr %48, align 1, !tbaa !12
  %49 = getelementptr inbounds [500010 x i32], ptr @f, i64 0, i64 %47
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %indvars.iv
  store i32 %50, ptr %51, align 4, !tbaa !5
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %52 = getelementptr inbounds [500010 x i32], ptr @que, i64 0, i64 %indvars.iv
  store i32 %46, ptr %52, align 4, !tbaa !5
  %.not71 = icmp eq i32 %50, 0
  br i1 %.not71, label %..preheader80_crit_edge, label %.lr.ph97, !llvm.loop !14

.preheader79:                                     ; preds = %.lr.ph100
  %53 = icmp sgt i32 %64, 1
  br i1 %53, label %.lr.ph103.preheader, label %._crit_edge108

.lr.ph103.preheader:                              ; preds = %.preheader79
  %wide.trip.count = zext nneg i32 %64 to i64
  %.pre = load i32, ptr @pre, align 16, !tbaa !5
  %.pre155 = load i32, ptr @dis, align 16, !tbaa !5
  %54 = add nsw i64 %wide.trip.count, -1
  %xtraiter = and i64 %54, 1
  %55 = icmp eq i32 %64, 2
  br i1 %55, label %._crit_edge104.unr-lcssa, label %.lr.ph103.preheader.new

.lr.ph103.preheader.new:                          ; preds = %.lr.ph103.preheader
  %unroll_iter = and i64 %54, -2
  br label %.lr.ph103

.lr.ph100:                                        ; preds = %.preheader80, %.lr.ph100
  %indvars.iv136 = phi i64 [ %indvars.iv.next137, %.lr.ph100 ], [ 0, %.preheader80 ]
  %56 = getelementptr inbounds [500010 x i32], ptr @que, i64 0, i64 %indvars.iv136
  %57 = load i32, ptr %56, align 4, !tbaa !5
  call void @_Z3dfsii(i32 noundef %57, i32 noundef -1)
  %58 = load i32, ptr %56, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [500010 x i32], ptr @f, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = getelementptr inbounds [500010 x i32], ptr @suf, i64 0, i64 %indvars.iv136
  store i32 %61, ptr %62, align 4, !tbaa !5
  %63 = getelementptr inbounds [500010 x i32], ptr @pre, i64 0, i64 %indvars.iv136
  store i32 %61, ptr %63, align 4, !tbaa !5
  %indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
  %64 = load i32, ptr @tot, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = icmp slt i64 %indvars.iv.next137, %65
  br i1 %66, label %.lr.ph100, label %.preheader79, !llvm.loop !15

._crit_edge104.unr-lcssa:                         ; preds = %111, %.lr.ph103.preheader
  %.unr = phi i32 [ %.pre155, %.lr.ph103.preheader ], [ %107, %111 ]
  %.unr187 = phi i32 [ %.pre, %.lr.ph103.preheader ], [ %112, %111 ]
  %indvars.iv139.unr = phi i64 [ 1, %.lr.ph103.preheader ], [ %indvars.iv.next140.1, %111 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge104, label %.lr.ph103.epil

.lr.ph103.epil:                                   ; preds = %._crit_edge104.unr-lcssa
  %67 = getelementptr inbounds [500010 x i32], ptr @pre, i64 0, i64 %indvars.iv139.unr
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = add nsw i32 %.unr, %.unr187
  %70 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %indvars.iv139.unr
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = sub i32 %69, %71
  %73 = icmp slt i32 %68, %72
  br i1 %73, label %74, label %._crit_edge104

74:                                               ; preds = %.lr.ph103.epil
  store i32 %72, ptr %67, align 4, !tbaa !5
  br label %._crit_edge104

._crit_edge104:                                   ; preds = %.lr.ph103.epil, %74, %._crit_edge104.unr-lcssa
  br i1 %53, label %.lr.ph107.preheader, label %._crit_edge108

.lr.ph107.preheader:                              ; preds = %._crit_edge104
  %75 = add nsw i32 %64, -2
  %76 = zext i32 %75 to i64
  %77 = and i64 %76, 1
  %lcmp.mod189.not.not = icmp eq i64 %77, 0
  br i1 %lcmp.mod189.not.not, label %.lr.ph107.prol, label %.lr.ph107.prol.loopexit

.lr.ph107.prol:                                   ; preds = %.lr.ph107.preheader
  %78 = getelementptr inbounds [500010 x i32], ptr @suf, i64 0, i64 %76
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = or disjoint i64 %76, 1
  %81 = getelementptr inbounds [500010 x i32], ptr @suf, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %76
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = add nsw i32 %84, %82
  %86 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %80
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = sub i32 %85, %87
  %89 = icmp slt i32 %79, %88
  br i1 %89, label %90, label %.lr.ph107.prol.loopexit.unr-lcssa

90:                                               ; preds = %.lr.ph107.prol
  store i32 %88, ptr %78, align 4, !tbaa !5
  br label %.lr.ph107.prol.loopexit.unr-lcssa

.lr.ph107.prol.loopexit.unr-lcssa:                ; preds = %90, %.lr.ph107.prol
  %indvars.iv.next143.prol = add nsw i64 %76, -1
  br label %.lr.ph107.prol.loopexit

.lr.ph107.prol.loopexit:                          ; preds = %.lr.ph107.prol.loopexit.unr-lcssa, %.lr.ph107.preheader
  %indvars.iv142.unr = phi i64 [ %76, %.lr.ph107.preheader ], [ %indvars.iv.next143.prol, %.lr.ph107.prol.loopexit.unr-lcssa ]
  %91 = icmp eq i32 %75, 0
  br i1 %91, label %._crit_edge108, label %.lr.ph107

.lr.ph103:                                        ; preds = %111, %.lr.ph103.preheader.new
  %92 = phi i32 [ %.pre155, %.lr.ph103.preheader.new ], [ %107, %111 ]
  %93 = phi i32 [ %.pre, %.lr.ph103.preheader.new ], [ %112, %111 ]
  %indvars.iv139 = phi i64 [ 1, %.lr.ph103.preheader.new ], [ %indvars.iv.next140.1, %111 ]
  %niter = phi i64 [ 0, %.lr.ph103.preheader.new ], [ %niter.next.1, %111 ]
  %94 = getelementptr inbounds [500010 x i32], ptr @pre, i64 0, i64 %indvars.iv139
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = add nsw i32 %92, %93
  %97 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %indvars.iv139
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = sub i32 %96, %98
  %100 = icmp slt i32 %95, %99
  br i1 %100, label %101, label %.lr.ph103.1

101:                                              ; preds = %.lr.ph103
  store i32 %99, ptr %94, align 4, !tbaa !5
  br label %.lr.ph103.1

.lr.ph103.1:                                      ; preds = %.lr.ph103, %101
  %102 = phi i32 [ %95, %.lr.ph103 ], [ %99, %101 ]
  %indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1
  %103 = getelementptr inbounds [500010 x i32], ptr @pre, i64 0, i64 %indvars.iv.next140
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = add nsw i32 %98, %102
  %106 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %indvars.iv.next140
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = sub i32 %105, %107
  %109 = icmp slt i32 %104, %108
  br i1 %109, label %110, label %111

110:                                              ; preds = %.lr.ph103.1
  store i32 %108, ptr %103, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %110, %.lr.ph103.1
  %112 = phi i32 [ %104, %.lr.ph103.1 ], [ %108, %110 ]
  %indvars.iv.next140.1 = add nuw nsw i64 %indvars.iv139, 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_edge104.unr-lcssa, label %.lr.ph103, !llvm.loop !16

._crit_edge108:                                   ; preds = %.lr.ph107.prol.loopexit, %137, %.preheader79, %._crit_edge104
  store i32 0, ptr @r, align 4, !tbaa !5
  store i32 0, ptr @l, align 4, !tbaa !5
  %113 = icmp sgt i32 %64, 0
  br i1 %113, label %.lr.ph127, label %._crit_edge128

.lr.ph107:                                        ; preds = %.lr.ph107.prol.loopexit, %137
  %indvars.iv142 = phi i64 [ %indvars.iv.next143.1, %137 ], [ %indvars.iv142.unr, %.lr.ph107.prol.loopexit ]
  %114 = getelementptr inbounds [500010 x i32], ptr @suf, i64 0, i64 %indvars.iv142
  %115 = load i32, ptr %114, align 4, !tbaa !5
  %116 = add nuw nsw i64 %indvars.iv142, 1
  %117 = getelementptr inbounds [500010 x i32], ptr @suf, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %indvars.iv142
  %120 = load i32, ptr %119, align 4, !tbaa !5
  %121 = add nsw i32 %120, %118
  %122 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %116
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = sub i32 %121, %123
  %125 = icmp slt i32 %115, %124
  br i1 %125, label %126, label %.lr.ph107.1

126:                                              ; preds = %.lr.ph107
  store i32 %124, ptr %114, align 4, !tbaa !5
  br label %.lr.ph107.1

.lr.ph107.1:                                      ; preds = %.lr.ph107, %126
  %indvars.iv.next143 = add nsw i64 %indvars.iv142, -1
  %127 = getelementptr inbounds [500010 x i32], ptr @suf, i64 0, i64 %indvars.iv.next143
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = getelementptr inbounds [500010 x i32], ptr @suf, i64 0, i64 %indvars.iv142
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %indvars.iv.next143
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = add nsw i32 %132, %130
  %134 = sub i32 %133, %120
  %135 = icmp slt i32 %128, %134
  br i1 %135, label %136, label %137

136:                                              ; preds = %.lr.ph107.1
  store i32 %134, ptr %127, align 4, !tbaa !5
  br label %137

137:                                              ; preds = %136, %.lr.ph107.1
  %indvars.iv.next143.1 = add nsw i64 %indvars.iv142, -2
  %138 = icmp sgt i64 %indvars.iv142, 1
  br i1 %138, label %.lr.ph107, label %._crit_edge108, !llvm.loop !17

._crit_edge128:                                   ; preds = %.critedge, %._crit_edge108.thread, %._crit_edge108
  %.058.lcssa = phi i32 [ 2147483647, %._crit_edge108 ], [ 2147483647, %._crit_edge108.thread ], [ %.15984, %.critedge ]
  %139 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.058.lcssa)
  ret i32 0

.lr.ph127:                                        ; preds = %._crit_edge108, %.critedge
  %140 = phi i32 [ %202, %.critedge ], [ %64, %._crit_edge108 ]
  %indvars.iv151 = phi i64 [ %indvars.iv.next152, %.critedge ], [ 0, %._crit_edge108 ]
  %.056125 = phi i32 [ %.182, %.critedge ], [ 0, %._crit_edge108 ]
  %.058122 = phi i32 [ %.15984, %.critedge ], [ 2147483647, %._crit_edge108 ]
  %141 = trunc nuw nsw i64 %indvars.iv151 to i32
  %142 = call i32 @llvm.smax.i32(i32 %.056125, i32 %141)
  %143 = icmp slt i32 %142, %140
  br i1 %143, label %.lr.ph116, label %.critedge

.lr.ph116:                                        ; preds = %.lr.ph127
  %144 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %indvars.iv151
  %145 = getelementptr inbounds [500010 x i32], ptr @pre, i64 0, i64 %indvars.iv151
  %146 = zext nneg i32 %142 to i64
  br label %147

147:                                              ; preds = %.lr.ph116, %198
  %indvars.iv148 = phi i64 [ %146, %.lr.ph116 ], [ %indvars.iv.next149, %198 ]
  %.159113 = phi i32 [ %.058122, %.lr.ph116 ], [ %183, %198 ]
  %148 = load i32, ptr %144, align 4, !tbaa !5
  %149 = getelementptr inbounds [500010 x i32], ptr @dis, i64 0, i64 %indvars.iv148
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = sub nsw i32 %148, %150
  %152 = load i32, ptr @s, align 4, !tbaa !5
  %.not72 = icmp sgt i32 %151, %152
  br i1 %.not72, label %.critedge.loopexit.split.loop.exit, label %.preheader

.preheader:                                       ; preds = %147
  %153 = load i32, ptr @l, align 4, !tbaa !5
  %r.promoted = load i32, ptr @r, align 4, !tbaa !5
  %154 = icmp slt i32 %153, %r.promoted
  %155 = getelementptr inbounds [500010 x i32], ptr @que, i64 0, i64 %indvars.iv148
  %156 = load i32, ptr %155, align 4, !tbaa !5
  br i1 %154, label %.lr.ph109, label %.critedge2

.lr.ph109:                                        ; preds = %.preheader
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [500010 x i32], ptr @f, i64 0, i64 %157
  %159 = load i32, ptr %158, align 4, !tbaa !5
  %160 = sext i32 %r.promoted to i64
  %161 = sext i32 %153 to i64
  br label %162

162:                                              ; preds = %.lr.ph109, %168
  %indvars.iv145 = phi i64 [ %160, %.lr.ph109 ], [ %indvars.iv.next146, %168 ]
  %indvars.iv.next146 = add nsw i64 %indvars.iv145, -1
  %163 = getelementptr inbounds [500010 x i32], ptr @deq, i64 0, i64 %indvars.iv.next146
  %164 = load i32, ptr %163, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [500010 x i32], ptr @f, i64 0, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %.not73 = icmp sgt i32 %167, %159
  br i1 %.not73, label %.critedge2.loopexit.split.loop.exit163, label %168

168:                                              ; preds = %162
  %169 = icmp sgt i64 %indvars.iv.next146, %161
  br i1 %169, label %162, label %.critedge2, !llvm.loop !18

.critedge2.loopexit.split.loop.exit163:           ; preds = %162
  %170 = trunc nsw i64 %indvars.iv145 to i32
  br label %.critedge2

.critedge2:                                       ; preds = %168, %.critedge2.loopexit.split.loop.exit163, %.preheader
  %.lcssa = phi i32 [ %r.promoted, %.preheader ], [ %170, %.critedge2.loopexit.split.loop.exit163 ], [ %153, %168 ]
  %171 = add nsw i32 %.lcssa, 1
  store i32 %171, ptr @r, align 4, !tbaa !5
  %172 = sext i32 %.lcssa to i64
  %173 = getelementptr inbounds [500010 x i32], ptr @deq, i64 0, i64 %172
  store i32 %156, ptr %173, align 4, !tbaa !5
  %174 = getelementptr inbounds [500010 x i32], ptr @suf, i64 0, i64 %indvars.iv148
  %175 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %145, ptr noundef nonnull align 4 dereferenceable(4) %174)
  %176 = load i32, ptr @l, align 4, !tbaa !5
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [500010 x i32], ptr @deq, i64 0, i64 %177
  %179 = load i32, ptr %178, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [500010 x i32], ptr @f, i64 0, i64 %180
  %182 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %175, ptr noundef nonnull align 4 dereferenceable(4) %181)
  %183 = load i32, ptr %182, align 4, !tbaa !5
  %.not74 = icmp slt i32 %.159113, %183
  br i1 %.not74, label %184, label %198

184:                                              ; preds = %.critedge2
  %185 = trunc nuw nsw i64 %indvars.iv148 to i32
  %186 = load i32, ptr @l, align 4, !tbaa !5
  %187 = load i32, ptr @r, align 4, !tbaa !5
  %188 = icmp slt i32 %186, %187
  br i1 %188, label %189, label %.critedge

189:                                              ; preds = %184
  %190 = sext i32 %186 to i64
  %191 = getelementptr inbounds [500010 x i32], ptr @deq, i64 0, i64 %190
  %192 = load i32, ptr %191, align 4, !tbaa !5
  %193 = getelementptr inbounds [500010 x i32], ptr @que, i64 0, i64 %indvars.iv151
  %194 = load i32, ptr %193, align 4, !tbaa !5
  %195 = icmp eq i32 %192, %194
  br i1 %195, label %196, label %.critedge

196:                                              ; preds = %189
  %197 = add nsw i32 %186, 1
  store i32 %197, ptr @l, align 4, !tbaa !5
  br label %.critedge

198:                                              ; preds = %.critedge2
  %indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1
  %indvars = trunc i64 %indvars.iv.next149 to i32
  %199 = load i32, ptr @tot, align 4, !tbaa !5
  %200 = icmp sgt i32 %199, %indvars
  br i1 %200, label %147, label %.critedge, !llvm.loop !19

.critedge.loopexit.split.loop.exit:               ; preds = %147
  %201 = trunc nuw nsw i64 %indvars.iv148 to i32
  br label %.critedge

.critedge:                                        ; preds = %198, %.critedge.loopexit.split.loop.exit, %.lr.ph127, %184, %189, %196
  %.15984 = phi i32 [ %.159113, %184 ], [ %.159113, %189 ], [ %.159113, %196 ], [ %.058122, %.lr.ph127 ], [ %.159113, %.critedge.loopexit.split.loop.exit ], [ %183, %198 ]
  %.182 = phi i32 [ %185, %184 ], [ %185, %189 ], [ %185, %196 ], [ %142, %.lr.ph127 ], [ %201, %.critedge.loopexit.split.loop.exit ], [ %indvars, %198 ]
  %indvars.iv.next152 = add nuw nsw i64 %indvars.iv151, 1
  %202 = load i32, ptr @tot, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = icmp slt i64 %indvars.iv.next152, %203
  br i1 %204, label %.lr.ph127, label %._crit_edge128, !llvm.loop !20
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__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 #0

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5

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


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