; LLVM IR from tangjz/acm-icpc :: codeforces/gym (102028K)

; 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<char, int>, std::allocator<std::pair<char, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<char, int>, std::allocator<std::pair<char, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<char, int>, std::allocator<std::pair<char, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<char, int>, std::allocator<std::pair<char, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i8, i32 }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@dep = external dso_local global [100001 x i32], align 16
@fa = external dso_local global [17 x [100001 x i32]], align 16
@e = external dso_local global [100001 x %"class.std::vector"], align 16
@sa = external dso_local global [100001 x i32], align 16
@pos = external dso_local global [100001 x i32], align 16
@nxt = external dso_local global [17 x [100001 x i32]], align 16
@buf = external dso_local global [100001 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z11SuffixArrayiPcPi(i32 noundef, ptr noundef, ptr 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::vector", align 8
  %3 = alloca i32, align 4
  %4 = alloca %"class.std::vector", align 8
  %5 = alloca i32, align 4
  %6 = alloca i8, align 1
  %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
  %17 = alloca i32, 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 @t)
  br label %22

22:                                               ; preds = %267, %0
  %23 = load i32, ptr @t, align 4, !tbaa !5
  %24 = add nsw i32 %23, -1
  store i32 %24, ptr @t, align 4, !tbaa !5
  %25 = icmp ne i32 %23, 0
  br i1 %25, label %26, label %268

26:                                               ; preds = %22
  %27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @n, ptr noundef @m, ptr noundef @q)
  call void @llvm.lifetime.start.p0(i64 24, ptr %2) #6
  call void @llvm.memset.p0.i64(ptr align 8 %2, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorISt4pairIciESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  call void @_ZNSt6vectorISt4pairIciESaIS1_EE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) @e) #6
  call void @_ZNSt6vectorISt4pairIciESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %42, %26
  %29 = load i32, ptr %3, align 4, !tbaa !5
  %30 = load i32, ptr @n, align 4, !tbaa !5
  %31 = icmp sle i32 %29, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %45

33:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #6
  call void @llvm.memset.p0.i64(ptr align 8 %4, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorISt4pairIciESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @e, i64 0, i64 %35
  call void @_ZNSt6vectorISt4pairIciESaIS1_EE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %36) #6
  call void @_ZNSt6vectorISt4pairIciESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #6
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %5, ptr noundef %6)
  %38 = load i32, ptr %5, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @e, i64 0, i64 %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %41 = call i64 @_ZSt9make_pairIRcRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 1 dereferenceable(1) %6, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i64 %41, ptr %7, align 4
  call void @_ZNSt6vectorISt4pairIciESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %40, ptr noundef nonnull align 4 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %42

42:                                               ; preds = %33
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %3, align 4, !tbaa !5
  br label %28, !llvm.loop !9

45:                                               ; preds = %32
  %46 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef @buf)
  %47 = load i32, ptr @m, align 4, !tbaa !5
  call void @_Z11SuffixArrayiPcPi(i32 noundef %47, ptr noundef @buf, ptr noundef @sa)
  store i32 0, ptr @dep, align 16, !tbaa !5
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  %50 = sext i32 %49 to i64
  %51 = mul i64 %50, 4
  call void @llvm.memset.p0.i64(ptr align 16 @fa, i8 0, i64 %51, i1 false)
  %52 = load i32, ptr @m, align 4, !tbaa !5
  %53 = sub nsw i32 %52, 1
  call void @_Z3dfsiii(i32 noundef 0, i32 noundef 0, i32 noundef %53)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %92, %45
  %55 = load i32, ptr %8, align 4, !tbaa !5
  %56 = shl i32 1, %55
  %57 = load i32, ptr @n, align 4, !tbaa !5
  %58 = icmp sle i32 %56, %57
  br i1 %58, label %60, label %59

59:                                               ; preds = %54
  store i32 7, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %95

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

61:                                               ; preds = %88, %60
  %62 = load i32, ptr %10, align 4, !tbaa !5
  %63 = load i32, ptr @n, align 4, !tbaa !5
  %64 = icmp sle i32 %62, %63
  br i1 %64, label %66, label %65

65:                                               ; preds = %61
  store i32 10, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %91

66:                                               ; preds = %61
  %67 = load i32, ptr %8, align 4, !tbaa !5
  %68 = sub nsw i32 %67, 1
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [17 x [100001 x i32]], ptr @fa, i64 0, i64 %69
  %71 = load i32, ptr %8, align 4, !tbaa !5
  %72 = sub nsw i32 %71, 1
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [17 x [100001 x i32]], ptr @fa, i64 0, i64 %73
  %75 = load i32, ptr %10, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [100001 x i32], ptr %74, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [100001 x i32], ptr %70, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = load i32, ptr %8, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [17 x [100001 x i32]], ptr @fa, i64 0, i64 %83
  %85 = load i32, ptr %10, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [100001 x i32], ptr %84, i64 0, i64 %86
  store i32 %81, ptr %87, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %66
  %89 = load i32, ptr %10, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %10, align 4, !tbaa !5
  br label %61, !llvm.loop !11

91:                                               ; preds = %65
  br label %92

92:                                               ; preds = %91
  %93 = load i32, ptr %8, align 4, !tbaa !5
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %8, align 4, !tbaa !5
  br label %54, !llvm.loop !12

95:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %115, %95
  %97 = load i32, ptr %12, align 4, !tbaa !5
  %98 = load i32, ptr @m, align 4, !tbaa !5
  %99 = icmp slt i32 %97, %98
  br i1 %99, label %101, label %100

100:                                              ; preds = %96
  store i32 13, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %118

101:                                              ; preds = %96
  %102 = load i32, ptr %12, align 4, !tbaa !5
  %103 = load i32, ptr %12, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [100001 x i32], ptr @dep, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = add nsw i32 %102, %109
  %111 = add nsw i32 %110, 1
  %112 = load i32, ptr %12, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [100001 x i32], ptr @nxt, i64 0, i64 %113
  store i32 %111, ptr %114, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %101
  %116 = load i32, ptr %12, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %12, align 4, !tbaa !5
  br label %96, !llvm.loop !13

118:                                              ; preds = %100
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %119

119:                                              ; preds = %172, %118
  %120 = load i32, ptr %11, align 4, !tbaa !5
  %121 = shl i32 1, %120
  %122 = load i32, ptr @m, align 4, !tbaa !5
  %123 = icmp sle i32 %121, %122
  br i1 %123, label %124, label %175

124:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %125

125:                                              ; preds = %168, %124
  %126 = load i32, ptr %13, align 4, !tbaa !5
  %127 = load i32, ptr @m, align 4, !tbaa !5
  %128 = icmp slt i32 %126, %127
  br i1 %128, label %130, label %129

129:                                              ; preds = %125
  store i32 19, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %171

130:                                              ; preds = %125
  %131 = load i32, ptr %11, align 4, !tbaa !5
  %132 = sub nsw i32 %131, 1
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [17 x [100001 x i32]], ptr @nxt, i64 0, i64 %133
  %135 = load i32, ptr %13, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [100001 x i32], ptr %134, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !5
  %139 = load i32, ptr @m, align 4, !tbaa !5
  %140 = icmp slt i32 %138, %139
  br i1 %140, label %141, label %157

141:                                              ; preds = %130
  %142 = load i32, ptr %11, align 4, !tbaa !5
  %143 = sub nsw i32 %142, 1
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [17 x [100001 x i32]], ptr @nxt, i64 0, i64 %144
  %146 = load i32, ptr %11, align 4, !tbaa !5
  %147 = sub nsw i32 %146, 1
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [17 x [100001 x i32]], ptr @nxt, i64 0, i64 %148
  %150 = load i32, ptr %13, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [100001 x i32], ptr %149, i64 0, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [100001 x i32], ptr %145, i64 0, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !5
  br label %160

157:                                              ; preds = %130
  %158 = load i32, ptr @m, align 4, !tbaa !5
  %159 = add nsw i32 %158, 1
  br label %160

160:                                              ; preds = %157, %141
  %161 = phi i32 [ %156, %141 ], [ %159, %157 ]
  %162 = load i32, ptr %11, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [17 x [100001 x i32]], ptr @nxt, i64 0, i64 %163
  %165 = load i32, ptr %13, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [100001 x i32], ptr %164, i64 0, i64 %166
  store i32 %161, ptr %167, align 4, !tbaa !5
  br label %168

168:                                              ; preds = %160
  %169 = load i32, ptr %13, align 4, !tbaa !5
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr %13, align 4, !tbaa !5
  br label %125, !llvm.loop !14

171:                                              ; preds = %129
  br label %172

172:                                              ; preds = %171
  %173 = load i32, ptr %11, align 4, !tbaa !5
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %11, align 4, !tbaa !5
  br label %119, !llvm.loop !15

175:                                              ; preds = %119
  br label %176

176:                                              ; preds = %266, %175
  %177 = load i32, ptr @q, align 4, !tbaa !5
  %178 = add nsw i32 %177, -1
  store i32 %178, ptr @q, align 4, !tbaa !5
  %179 = icmp ne i32 %177, 0
  br i1 %179, label %180, label %267

180:                                              ; preds = %176
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !5
  %181 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef %14, ptr noundef %15)
  %182 = load i32, ptr %14, align 4, !tbaa !5
  %183 = add nsw i32 %182, -1
  store i32 %183, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %184 = load i32, ptr %11, align 4, !tbaa !5
  %185 = sub nsw i32 %184, 1
  store i32 %185, ptr %17, align 4, !tbaa !5
  br label %186

186:                                              ; preds = %213, %180
  %187 = load i32, ptr %17, align 4, !tbaa !5
  %188 = icmp sge i32 %187, 0
  br i1 %188, label %190, label %189

189:                                              ; preds = %186
  store i32 24, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %216

190:                                              ; preds = %186
  %191 = load i32, ptr %17, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [17 x [100001 x i32]], ptr @nxt, i64 0, i64 %192
  %194 = load i32, ptr %14, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [100001 x i32], ptr %193, i64 0, i64 %195
  %197 = load i32, ptr %196, align 4, !tbaa !5
  %198 = load i32, ptr %15, align 4, !tbaa !5
  %199 = icmp slt i32 %197, %198
  br i1 %199, label %200, label %212

200:                                              ; preds = %190
  %201 = load i32, ptr %17, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [17 x [100001 x i32]], ptr @nxt, i64 0, i64 %202
  %204 = load i32, ptr %14, align 4, !tbaa !5
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds [100001 x i32], ptr %203, i64 0, i64 %205
  %207 = load i32, ptr %206, align 4, !tbaa !5
  store i32 %207, ptr %14, align 4, !tbaa !5
  %208 = load i32, ptr %17, align 4, !tbaa !5
  %209 = shl i32 1, %208
  %210 = load i32, ptr %16, align 4, !tbaa !5
  %211 = or i32 %210, %209
  store i32 %211, ptr %16, align 4, !tbaa !5
  br label %212

212:                                              ; preds = %200, %190
  br label %213

213:                                              ; preds = %212
  %214 = load i32, ptr %17, align 4, !tbaa !5
  %215 = add nsw i32 %214, -1
  store i32 %215, ptr %17, align 4, !tbaa !5
  br label %186, !llvm.loop !16

216:                                              ; preds = %189
  %217 = load i32, ptr %14, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [100001 x i32], ptr @nxt, i64 0, i64 %218
  %220 = load i32, ptr %219, align 4, !tbaa !5
  %221 = load i32, ptr %15, align 4, !tbaa !5
  %222 = icmp eq i32 %220, %221
  br i1 %222, label %223, label %227

223:                                              ; preds = %216
  %224 = load i32, ptr %16, align 4, !tbaa !5
  %225 = add nsw i32 %224, 1
  %226 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %225, i32 noundef 0)
  br label %266

227:                                              ; preds = %216
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %228 = load i32, ptr %14, align 4, !tbaa !5
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %229
  %231 = load i32, ptr %230, align 4, !tbaa !5
  store i32 %231, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %232 = load i32, ptr %18, align 4, !tbaa !5
  %233 = sext i32 %232 to i64
  %234 = getelementptr inbounds [100001 x i32], ptr @dep, i64 0, i64 %233
  %235 = load i32, ptr %234, align 4, !tbaa !5
  %236 = load i32, ptr %15, align 4, !tbaa !5
  %237 = load i32, ptr %14, align 4, !tbaa !5
  %238 = sub nsw i32 %236, %237
  %239 = sub nsw i32 %235, %238
  store i32 %239, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 0, ptr %20, align 4, !tbaa !5
  br label %240

240:                                              ; preds = %257, %227
  %241 = load i32, ptr %19, align 4, !tbaa !5
  %242 = icmp sgt i32 %241, 0
  br i1 %242, label %244, label %243

243:                                              ; preds = %240
  store i32 27, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %262

244:                                              ; preds = %240
  %245 = load i32, ptr %19, align 4, !tbaa !5
  %246 = and i32 %245, 1
  %247 = icmp ne i32 %246, 0
  br i1 %247, label %248, label %256

248:                                              ; preds = %244
  %249 = load i32, ptr %20, align 4, !tbaa !5
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds [17 x [100001 x i32]], ptr @fa, i64 0, i64 %250
  %252 = load i32, ptr %18, align 4, !tbaa !5
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds [100001 x i32], ptr %251, i64 0, i64 %253
  %255 = load i32, ptr %254, align 4, !tbaa !5
  store i32 %255, ptr %18, align 4, !tbaa !5
  br label %256

256:                                              ; preds = %248, %244
  br label %257

257:                                              ; preds = %256
  %258 = load i32, ptr %19, align 4, !tbaa !5
  %259 = ashr i32 %258, 1
  store i32 %259, ptr %19, align 4, !tbaa !5
  %260 = load i32, ptr %20, align 4, !tbaa !5
  %261 = add nsw i32 %260, 1
  store i32 %261, ptr %20, align 4, !tbaa !5
  br label %240, !llvm.loop !17

262:                                              ; preds = %243
  %263 = load i32, ptr %16, align 4, !tbaa !5
  %264 = load i32, ptr %18, align 4, !tbaa !5
  %265 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %263, i32 noundef %264)
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %266

266:                                              ; preds = %262, %223
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %176, !llvm.loop !18

267:                                              ; preds = %176
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %22, !llvm.loop !19

268:                                              ; preds = %22
  ret i32 0
}

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

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

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

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

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #4 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !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<char, int>, std::allocator<std::pair<char, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<char, int>, std::allocator<std::pair<char, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<char, int>, std::allocator<std::pair<char, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<char, int>, std::allocator<std::pair<char, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i8, i32 }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@dep = external dso_local local_unnamed_addr global [100001 x i32], align 16
@fa = external dso_local local_unnamed_addr global [17 x [100001 x i32]], align 16
@e = external dso_local global [100001 x %"class.std::vector"], align 16
@sa = external dso_local global [100001 x i32], align 16
@pos = external dso_local local_unnamed_addr global [100001 x i32], align 16
@nxt = external dso_local local_unnamed_addr global [17 x [100001 x i32]], align 16
@buf = external dso_local global [100001 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z11SuffixArrayiPcPi(i32 noundef, ptr noundef, ptr 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; 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 nounwind uwtable
declare dso_local void @_ZNSt6vectorISt4pairIciESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca %"class.std::vector", align 8
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::vector", align 8
  %4 = alloca i32, align 4
  %5 = alloca i8, align 1
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %10 = load i32, ptr @t, align 4, !tbaa !5
  %11 = add nsw i32 %10, -1
  store i32 %11, ptr @t, align 4, !tbaa !5
  %.not94 = icmp eq i32 %10, 0
  br i1 %.not94, label %._crit_edge97, label %.lr.ph96

.loopexit:                                        ; preds = %199, %.preheader64
  %12 = load i32, ptr @t, align 4, !tbaa !5
  %13 = add nsw i32 %12, -1
  store i32 %13, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %._crit_edge97, label %.lr.ph96, !llvm.loop !9

.lr.ph96:                                         ; preds = %0, %.loopexit
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @q)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %1, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorISt4pairIciESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  call void @_ZNSt6vectorISt4pairIciESaIS1_EE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) @e) #6
  call void @_ZNSt6vectorISt4pairIciESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %.not5667 = icmp slt i32 %15, 1
  br i1 %.not5667, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph96
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull @buf)
  %17 = load i32, ptr @m, align 4, !tbaa !5
  call void @_Z11SuffixArrayiPcPi(i32 noundef %17, ptr noundef nonnull @buf, ptr noundef nonnull @sa)
  store i32 0, ptr @dep, align 16, !tbaa !5
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = add nsw i32 %18, 1
  %20 = sext i32 %19 to i64
  %21 = shl nsw i64 %20, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @fa, i8 0, i64 %21, i1 false)
  %22 = load i32, ptr @m, align 4, !tbaa !5
  %23 = add nsw i32 %22, -1
  call void @_Z3dfsiii(i32 noundef 0, i32 noundef 0, i32 noundef %23)
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %.not5772 = icmp slt i32 %24, 2
  br i1 %.not5772, label %.preheader66, label %.preheader63.preheader

.preheader63.preheader:                           ; preds = %._crit_edge
  %25 = zext nneg i32 %24 to i64
  %xtraiter = and i64 %25, 1
  %unroll_iter = and i64 %25, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader63

.lr.ph:                                           ; preds = %.lr.ph96, %.lr.ph
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %3, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorISt4pairIciESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @e, i64 0, i64 %27
  call void @_ZNSt6vectorISt4pairIciESaIS1_EE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %28) #6
  call void @_ZNSt6vectorISt4pairIciESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #6
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @e, i64 0, i64 %31
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %33 = call i64 @_ZSt9make_pairIRcRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 1 dereferenceable(1) %5, ptr noundef nonnull align 4 dereferenceable(4) %2)
  store i64 %33, ptr %6, align 8
  call void @_ZNSt6vectorISt4pairIciESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %32, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %2, align 4, !tbaa !5
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %.not56.not = icmp slt i32 %34, %36
  br i1 %.not56.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader66:                                     ; preds = %._crit_edge71, %._crit_edge
  %37 = load i32, ptr @m, align 4, !tbaa !5
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %.lr.ph75.preheader, label %.preheader64

.lr.ph75.preheader:                               ; preds = %.preheader66
  %wide.trip.count106 = zext nneg i32 %37 to i64
  %xtraiter123 = and i64 %wide.trip.count106, 3
  %39 = icmp ult i32 %37, 4
  br i1 %39, label %.preheader65.unr-lcssa, label %.lr.ph75.preheader.new

.lr.ph75.preheader.new:                           ; preds = %.lr.ph75.preheader
  %unroll_iter125 = and i64 %wide.trip.count106, 2147483644
  br label %.lr.ph75

.preheader63:                                     ; preds = %.preheader63.preheader, %._crit_edge71
  %indvars.iv100 = phi i64 [ 1, %.preheader63.preheader ], [ %indvars.iv.next101, %._crit_edge71 ]
  %40 = add nsw i64 %indvars.iv100, -1
  br label %49

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

._crit_edge71.epilog-lcssa:                       ; preds = %._crit_edge71.unr-lcssa
  %41 = getelementptr inbounds [17 x [100001 x i32]], ptr @fa, i64 0, i64 %40, i64 %indvars.iv.next.1
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [17 x [100001 x i32]], ptr @fa, i64 0, i64 %40, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = getelementptr inbounds [17 x [100001 x i32]], ptr @fa, i64 0, i64 %indvars.iv100, i64 %indvars.iv.next.1
  store i32 %45, ptr %46, align 4, !tbaa !5
  br label %._crit_edge71

._crit_edge71:                                    ; preds = %._crit_edge71.unr-lcssa, %._crit_edge71.epilog-lcssa
  %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
  %47 = trunc nuw nsw i64 %indvars.iv100 to i32
  %48 = shl nuw i32 2, %47
  %.not57 = icmp sgt i32 %48, %24
  br i1 %.not57, label %.preheader66, label %.preheader63, !llvm.loop !12

49:                                               ; preds = %49, %.preheader63
  %indvars.iv = phi i64 [ 1, %.preheader63 ], [ %indvars.iv.next.1, %49 ]
  %niter = phi i64 [ 0, %.preheader63 ], [ %niter.next.1, %49 ]
  %50 = getelementptr inbounds [17 x [100001 x i32]], ptr @fa, i64 0, i64 %40, i64 %indvars.iv
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [17 x [100001 x i32]], ptr @fa, i64 0, i64 %40, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = getelementptr inbounds [17 x [100001 x i32]], ptr @fa, i64 0, i64 %indvars.iv100, i64 %indvars.iv
  store i32 %54, ptr %55, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %56 = getelementptr inbounds [17 x [100001 x i32]], ptr @fa, i64 0, i64 %40, i64 %indvars.iv.next
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [17 x [100001 x i32]], ptr @fa, i64 0, i64 %40, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = getelementptr inbounds [17 x [100001 x i32]], ptr @fa, i64 0, i64 %indvars.iv100, i64 %indvars.iv.next
  store i32 %60, ptr %61, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 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_edge71.unr-lcssa, label %49, !llvm.loop !13

.preheader65.unr-lcssa:                           ; preds = %.lr.ph75, %.lr.ph75.preheader
  %indvars.iv103.unr = phi i64 [ 0, %.lr.ph75.preheader ], [ %indvars.iv.next104.3, %.lr.ph75 ]
  %lcmp.mod124.not = icmp eq i64 %xtraiter123, 0
  br i1 %lcmp.mod124.not, label %.preheader65, label %.lr.ph75.epil

.lr.ph75.epil:                                    ; preds = %.preheader65.unr-lcssa, %.lr.ph75.epil
  %indvars.iv103.epil = phi i64 [ %indvars.iv.next104.epil, %.lr.ph75.epil ], [ %indvars.iv103.unr, %.preheader65.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph75.epil ], [ 0, %.preheader65.unr-lcssa ]
  %62 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %indvars.iv103.epil
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100001 x i32], ptr @dep, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %indvars.iv.next104.epil = add nuw nsw i64 %indvars.iv103.epil, 1
  %67 = trunc nuw nsw i64 %indvars.iv.next104.epil to i32
  %68 = add i32 %66, %67
  %69 = getelementptr inbounds [100001 x i32], ptr @nxt, i64 0, i64 %indvars.iv103.epil
  store i32 %68, ptr %69, align 4, !tbaa !5
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter123
  br i1 %epil.iter.cmp.not, label %.preheader65, label %.lr.ph75.epil, !llvm.loop !14

.preheader65:                                     ; preds = %.lr.ph75.epil, %.preheader65.unr-lcssa
  %.not5879 = icmp eq i32 %37, 1
  br i1 %.not5879, label %.preheader64, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %.preheader65
  %70 = add nuw nsw i32 %37, 1
  %xtraiter128 = and i64 %wide.trip.count106, 1
  %unroll_iter131 = and i64 %wide.trip.count106, 2147483646
  %lcmp.mod130.not = icmp eq i64 %xtraiter128, 0
  br label %.preheader.us

.preheader.us:                                    ; preds = %._crit_edge78.us, %.preheader.lr.ph
  %indvars.iv113 = phi i64 [ %indvars.iv.next114, %._crit_edge78.us ], [ 1, %.preheader.lr.ph ]
  %71 = add nsw i64 %indvars.iv113, -1
  br label %72

72:                                               ; preds = %90, %.preheader.us
  %indvars.iv108 = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next109.1, %90 ]
  %niter132 = phi i64 [ 0, %.preheader.us ], [ %niter132.next.1, %90 ]
  %73 = getelementptr inbounds [17 x [100001 x i32]], ptr @nxt, i64 0, i64 %71, i64 %indvars.iv108
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = icmp slt i32 %74, %37
  br i1 %75, label %76, label %80

76:                                               ; preds = %72
  %77 = sext i32 %74 to i64
  %78 = getelementptr inbounds [17 x [100001 x i32]], ptr @nxt, i64 0, i64 %71, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %72, %76
  %81 = phi i32 [ %79, %76 ], [ %70, %72 ]
  %82 = getelementptr inbounds [17 x [100001 x i32]], ptr @nxt, i64 0, i64 %indvars.iv113, i64 %indvars.iv108
  store i32 %81, ptr %82, align 4, !tbaa !5
  %indvars.iv.next109 = or disjoint i64 %indvars.iv108, 1
  %83 = getelementptr inbounds [17 x [100001 x i32]], ptr @nxt, i64 0, i64 %71, i64 %indvars.iv.next109
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = icmp slt i32 %84, %37
  br i1 %85, label %86, label %90

86:                                               ; preds = %80
  %87 = sext i32 %84 to i64
  %88 = getelementptr inbounds [17 x [100001 x i32]], ptr @nxt, i64 0, i64 %71, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %86, %80
  %91 = phi i32 [ %89, %86 ], [ %70, %80 ]
  %92 = getelementptr inbounds [17 x [100001 x i32]], ptr @nxt, i64 0, i64 %indvars.iv113, i64 %indvars.iv.next109
  store i32 %91, ptr %92, align 4, !tbaa !5
  %indvars.iv.next109.1 = add nuw nsw i64 %indvars.iv108, 2
  %niter132.next.1 = add i64 %niter132, 2
  %niter132.ncmp.1 = icmp eq i64 %niter132.next.1, %unroll_iter131
  br i1 %niter132.ncmp.1, label %._crit_edge78.us.unr-lcssa, label %72, !llvm.loop !16

._crit_edge78.us.unr-lcssa:                       ; preds = %90
  br i1 %lcmp.mod130.not, label %._crit_edge78.us, label %.epil.preheader127

.epil.preheader127:                               ; preds = %._crit_edge78.us.unr-lcssa
  %93 = getelementptr inbounds [17 x [100001 x i32]], ptr @nxt, i64 0, i64 %71, i64 %indvars.iv.next109.1
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = icmp slt i32 %94, %37
  br i1 %95, label %96, label %._crit_edge78.us.epilog-lcssa

96:                                               ; preds = %.epil.preheader127
  %97 = sext i32 %94 to i64
  %98 = getelementptr inbounds [17 x [100001 x i32]], ptr @nxt, i64 0, i64 %71, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  br label %._crit_edge78.us.epilog-lcssa

._crit_edge78.us.epilog-lcssa:                    ; preds = %96, %.epil.preheader127
  %100 = phi i32 [ %99, %96 ], [ %70, %.epil.preheader127 ]
  %101 = getelementptr inbounds [17 x [100001 x i32]], ptr @nxt, i64 0, i64 %indvars.iv113, i64 %indvars.iv.next109.1
  store i32 %100, ptr %101, align 4, !tbaa !5
  br label %._crit_edge78.us

._crit_edge78.us:                                 ; preds = %._crit_edge78.us.unr-lcssa, %._crit_edge78.us.epilog-lcssa
  %indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1
  %102 = trunc nuw nsw i64 %indvars.iv113 to i32
  %103 = shl nuw i32 2, %102
  %.not58.us = icmp sgt i32 %103, %37
  br i1 %.not58.us, label %.preheader64, label %.preheader.us, !llvm.loop !17

.lr.ph75:                                         ; preds = %.lr.ph75, %.lr.ph75.preheader.new
  %indvars.iv103 = phi i64 [ 0, %.lr.ph75.preheader.new ], [ %indvars.iv.next104.3, %.lr.ph75 ]
  %niter126 = phi i64 [ 0, %.lr.ph75.preheader.new ], [ %niter126.next.3, %.lr.ph75 ]
  %104 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %indvars.iv103
  %105 = load i32, ptr %104, align 16, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [100001 x i32], ptr @dep, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %indvars.iv.next104 = or disjoint i64 %indvars.iv103, 1
  %109 = trunc nuw nsw i64 %indvars.iv.next104 to i32
  %110 = add i32 %108, %109
  %111 = getelementptr inbounds [100001 x i32], ptr @nxt, i64 0, i64 %indvars.iv103
  store i32 %110, ptr %111, align 16, !tbaa !5
  %112 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %indvars.iv.next104
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [100001 x i32], ptr @dep, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %indvars.iv.next104.1 = or disjoint i64 %indvars.iv103, 2
  %117 = trunc nuw nsw i64 %indvars.iv.next104.1 to i32
  %118 = add i32 %116, %117
  %119 = getelementptr inbounds [100001 x i32], ptr @nxt, i64 0, i64 %indvars.iv.next104
  store i32 %118, ptr %119, align 4, !tbaa !5
  %120 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %indvars.iv.next104.1
  %121 = load i32, ptr %120, align 8, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [100001 x i32], ptr @dep, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %indvars.iv.next104.2 = or disjoint i64 %indvars.iv103, 3
  %125 = trunc nuw nsw i64 %indvars.iv.next104.2 to i32
  %126 = add i32 %124, %125
  %127 = getelementptr inbounds [100001 x i32], ptr @nxt, i64 0, i64 %indvars.iv.next104.1
  store i32 %126, ptr %127, align 8, !tbaa !5
  %128 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %indvars.iv.next104.2
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [100001 x i32], ptr @dep, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %indvars.iv.next104.3 = add nuw nsw i64 %indvars.iv103, 4
  %133 = trunc nuw nsw i64 %indvars.iv.next104.3 to i32
  %134 = add i32 %132, %133
  %135 = getelementptr inbounds [100001 x i32], ptr @nxt, i64 0, i64 %indvars.iv.next104.2
  store i32 %134, ptr %135, align 4, !tbaa !5
  %niter126.next.3 = add i64 %niter126, 4
  %niter126.ncmp.3 = icmp eq i64 %niter126.next.3, %unroll_iter125
  br i1 %niter126.ncmp.3, label %.preheader65.unr-lcssa, label %.lr.ph75, !llvm.loop !18

.preheader64:                                     ; preds = %._crit_edge78.us, %.preheader66, %.preheader65
  %.049.lcssa = phi i64 [ 0, %.preheader65 ], [ 0, %.preheader66 ], [ %indvars.iv113, %._crit_edge78.us ]
  %136 = load i32, ptr @q, align 4, !tbaa !5
  %137 = add nsw i32 %136, -1
  store i32 %137, ptr @q, align 4, !tbaa !5
  %.not5992 = icmp eq i32 %136, 0
  br i1 %.not5992, label %.loopexit, label %.lr.ph93

.lr.ph93:                                         ; preds = %.preheader64
  %138 = and i64 %.049.lcssa, 4294967295
  %139 = add nuw nsw i64 %138, 1
  %140 = icmp eq i64 %138, 0
  %unroll_iter139 = and i64 %139, 8589934590
  %141 = and i64 %.049.lcssa, 1
  %lcmp.mod136.not.not = icmp eq i64 %141, 0
  br label %142

142:                                              ; preds = %.lr.ph93, %199
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #6
  %143 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %144 = load i32, ptr %7, align 4, !tbaa !5
  %145 = add nsw i32 %144, -1
  store i32 %145, ptr %7, align 4, !tbaa !5
  %146 = load i32, ptr %8, align 4, !tbaa !5
  br i1 %140, label %.unr-lcssa, label %.new

.unr-lcssa:                                       ; preds = %178, %142
  %.lcssa.ph = phi i32 [ poison, %142 ], [ %179, %178 ]
  %.146.lcssa.ph = phi i32 [ poison, %142 ], [ %.146.1, %178 ]
  %indvars.iv116.unr = phi i64 [ %138, %142 ], [ %indvars.iv.next117.1, %178 ]
  %.04583.unr = phi i32 [ 0, %142 ], [ %.146.1, %178 ]
  %.unr = phi i32 [ %145, %142 ], [ %179, %178 ]
  br i1 %lcmp.mod136.not.not, label %.epil.preheader133, label %.epilog-lcssa

.epil.preheader133:                               ; preds = %.unr-lcssa
  %147 = sext i32 %.unr to i64
  %148 = getelementptr inbounds [17 x [100001 x i32]], ptr @nxt, i64 0, i64 %indvars.iv116.unr, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !5
  %150 = icmp slt i32 %149, %146
  br i1 %150, label %151, label %.epilog-lcssa

151:                                              ; preds = %.epil.preheader133
  store i32 %149, ptr %7, align 4, !tbaa !5
  %152 = trunc nuw nsw i64 %indvars.iv116.unr to i32
  %153 = shl nuw i32 1, %152
  %154 = or i32 %153, %.04583.unr
  br label %.epilog-lcssa

.epilog-lcssa:                                    ; preds = %.epil.preheader133, %151, %.unr-lcssa
  %.lcssa = phi i32 [ %.lcssa.ph, %.unr-lcssa ], [ %149, %151 ], [ %.unr, %.epil.preheader133 ]
  %.146.lcssa = phi i32 [ %.146.lcssa.ph, %.unr-lcssa ], [ %154, %151 ], [ %.04583.unr, %.epil.preheader133 ]
  %155 = sext i32 %.lcssa to i64
  %156 = getelementptr inbounds [100001 x i32], ptr @nxt, i64 0, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !5
  %158 = icmp eq i32 %157, %146
  br i1 %158, label %180, label %183

.new:                                             ; preds = %142, %178
  %indvars.iv116 = phi i64 [ %indvars.iv.next117.1, %178 ], [ %138, %142 ]
  %.04583 = phi i32 [ %.146.1, %178 ], [ 0, %142 ]
  %159 = phi i32 [ %179, %178 ], [ %145, %142 ]
  %niter140 = phi i64 [ %niter140.next.1, %178 ], [ 0, %142 ]
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [17 x [100001 x i32]], ptr @nxt, i64 0, i64 %indvars.iv116, i64 %160
  %162 = load i32, ptr %161, align 4, !tbaa !5
  %163 = icmp slt i32 %162, %146
  br i1 %163, label %164, label %168

164:                                              ; preds = %.new
  store i32 %162, ptr %7, align 4, !tbaa !5
  %165 = trunc nuw nsw i64 %indvars.iv116 to i32
  %166 = shl nuw i32 1, %165
  %167 = or i32 %166, %.04583
  br label %168

168:                                              ; preds = %.new, %164
  %169 = phi i32 [ %162, %164 ], [ %159, %.new ]
  %.146 = phi i32 [ %167, %164 ], [ %.04583, %.new ]
  %indvars.iv.next117 = add nsw i64 %indvars.iv116, -1
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [17 x [100001 x i32]], ptr @nxt, i64 0, i64 %indvars.iv.next117, i64 %170
  %172 = load i32, ptr %171, align 4, !tbaa !5
  %173 = icmp slt i32 %172, %146
  br i1 %173, label %174, label %178

174:                                              ; preds = %168
  store i32 %172, ptr %7, align 4, !tbaa !5
  %175 = trunc nuw nsw i64 %indvars.iv.next117 to i32
  %176 = shl nuw i32 1, %175
  %177 = or i32 %176, %.146
  br label %178

178:                                              ; preds = %174, %168
  %179 = phi i32 [ %172, %174 ], [ %169, %168 ]
  %.146.1 = phi i32 [ %177, %174 ], [ %.146, %168 ]
  %indvars.iv.next117.1 = add nsw i64 %indvars.iv116, -2
  %niter140.next.1 = add i64 %niter140, 2
  %niter140.ncmp.1.not = icmp eq i64 %niter140.next.1, %unroll_iter139
  br i1 %niter140.ncmp.1.not, label %.unr-lcssa, label %.new, !llvm.loop !19

180:                                              ; preds = %.epilog-lcssa
  %181 = add nsw i32 %.146.lcssa, 1
  %182 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %181, i32 noundef 0)
  br label %199

183:                                              ; preds = %.epilog-lcssa
  %184 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %155
  %185 = load i32, ptr %184, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [100001 x i32], ptr @dep, i64 0, i64 %186
  %188 = load i32, ptr %187, align 4, !tbaa !5
  %.neg = sub i32 %.lcssa, %146
  %189 = add i32 %.neg, %188
  %190 = icmp sgt i32 %189, 0
  br i1 %190, label %.lr.ph89, label %._crit_edge90

._crit_edge90:                                    ; preds = %197, %183
  %.043.lcssa = phi i32 [ %185, %183 ], [ %.1, %197 ]
  %191 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %.146.lcssa, i32 noundef %.043.lcssa)
  br label %199

.lr.ph89:                                         ; preds = %183, %197
  %indvars.iv119 = phi i64 [ %indvars.iv.next120, %197 ], [ 0, %183 ]
  %.04286 = phi i32 [ %198, %197 ], [ %189, %183 ]
  %.04385 = phi i32 [ %.1, %197 ], [ %185, %183 ]
  %192 = and i32 %.04286, 1
  %.not60 = icmp eq i32 %192, 0
  br i1 %.not60, label %197, label %193

193:                                              ; preds = %.lr.ph89
  %194 = sext i32 %.04385 to i64
  %195 = getelementptr inbounds [17 x [100001 x i32]], ptr @fa, i64 0, i64 %indvars.iv119, i64 %194
  %196 = load i32, ptr %195, align 4, !tbaa !5
  br label %197

197:                                              ; preds = %.lr.ph89, %193
  %.1 = phi i32 [ %196, %193 ], [ %.04385, %.lr.ph89 ]
  %198 = lshr i32 %.04286, 1
  %indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
  %.not98 = icmp ult i32 %.04286, 2
  br i1 %.not98, label %._crit_edge90, label %.lr.ph89, !llvm.loop !20

199:                                              ; preds = %._crit_edge90, %180
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  %200 = load i32, ptr @q, align 4, !tbaa !5
  %201 = add nsw i32 %200, -1
  store i32 %201, ptr @q, align 4, !tbaa !5
  %.not59 = icmp eq i32 %200, 0
  br i1 %.not59, label %.loopexit, label %142, !llvm.loop !21

._crit_edge97:                                    ; preds = %.loopexit, %0
  ret i32 0
}

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

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

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

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

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

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


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