; LLVM IR from tangjz/acm-icpc :: hdu (6039)

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

%struct.Edge = type { i32, i32 }

@_ZL5log_2 = external hidden global double, align 8
@_ZN6fastIO7IOerrorE = external dso_local global i8, align 1
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@a = external dso_local global [100001 x i32], align 16
@dsu = external dso_local global [100001 x i32], align 16
@tot = external dso_local global i32, align 4
@lnk = external dso_local global [100001 x i32], align 16
@lst = external dso_local global [100001 x i32], align 16
@rt = external dso_local global i32, align 4
@idx = external dso_local global [100001 x i32], align 16
@in = external dso_local global [100001 x i32], align 16
@out = external dso_local global [100001 x i32], align 16
@pL = external dso_local global [100001 x i32], align 16
@pR = external dso_local global [100001 x i32], align 16
@qL = external dso_local global [100001 x i32], align 16
@qR = external dso_local global [100001 x i32], align 16
@e = external dso_local global [200003 x %struct.Edge], align 16
@g = external dso_local global [200003 x %struct.Edge], align 16
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9seg_buildii(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 uwtable
declare dso_local noundef i32 @_Z7seg_getiii(i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z7seg_maxiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z8dsu_findi(i32 noundef) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %struct.Edge, align 4
  %10 = alloca %struct.Edge, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %struct.Edge, 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
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %283, %0
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) @n)
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) @m)
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) @q)
  %20 = load i8, ptr @_ZN6fastIO7IOerrorE, align 1, !tbaa !9, !range !11, !noundef !12
  %21 = trunc i8 %20 to i1
  %22 = xor i1 %21, true
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %286

24:                                               ; preds = %19
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  br label %25

25:                                               ; preds = %74, %24
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %28 = icmp sle i32 %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %77

30:                                               ; preds = %25
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %5)
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %32
  store i32 0, ptr %33, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %43, %30
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = shl i32 1, %38
  %40 = load i32, ptr %5, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %42, label %49

42:                                               ; preds = %34
  br label %43

43:                                               ; preds = %42
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %46, align 4, !tbaa !5
  br label %34, !llvm.loop !13

49:                                               ; preds = %34
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [100001 x i32], ptr @qR, i64 0, i64 %51
  store i32 -1, ptr %52, align 4, !tbaa !5
  %53 = load i32, ptr %4, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [100001 x i32], ptr @pR, i64 0, i64 %54
  store i32 -1, ptr %55, align 4, !tbaa !5
  %56 = load i32, ptr %4, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %57
  store i32 -1, ptr %58, align 4, !tbaa !5
  %59 = load i32, ptr %4, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [100001 x i32], ptr @lst, i64 0, i64 %60
  store i32 -1, ptr %61, align 4, !tbaa !5
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [100001 x i32], ptr @lnk, i64 0, i64 %63
  store i32 -1, ptr %64, align 4, !tbaa !5
  %65 = load i32, ptr %4, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [100001 x i32], ptr @dsu, i64 0, i64 %66
  store i32 -1, ptr %67, align 4, !tbaa !5
  %68 = load i32, ptr %4, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [100001 x i32], ptr @qL, i64 0, i64 %69
  store i32 0, ptr %70, align 4, !tbaa !5
  %71 = load i32, ptr %4, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [100001 x i32], ptr @pL, i64 0, i64 %72
  store i32 0, ptr %73, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %49
  %75 = load i32, ptr %4, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %4, align 4, !tbaa !5
  br label %25, !llvm.loop !15

77:                                               ; preds = %29
  br label %78

78:                                               ; preds = %119, %77
  %79 = load i32, ptr @m, align 4, !tbaa !5
  %80 = add nsw i32 %79, -1
  store i32 %80, ptr @m, align 4, !tbaa !5
  %81 = icmp ne i32 %79, 0
  br i1 %81, label %82, label %120

82:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %8)
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = icmp eq i32 %83, 1
  br i1 %84, label %85, label %116

85:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %86 = getelementptr inbounds %struct.Edge, ptr %9, i32 0, i32 0
  %87 = load i32, ptr %7, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [100001 x i32], ptr @lnk, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !5
  store i32 %90, ptr %86, align 4, !tbaa !16
  %91 = getelementptr inbounds %struct.Edge, ptr %9, i32 0, i32 1
  %92 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %92, ptr %91, align 4, !tbaa !18
  %93 = load i32, ptr @tot, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [200003 x %struct.Edge], ptr @e, i64 0, i64 %94
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %95, ptr align 4 %9, i64 8, i1 false), !tbaa.struct !19
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  %96 = load i32, ptr @tot, align 4, !tbaa !5
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr @tot, align 4, !tbaa !5
  %98 = load i32, ptr %7, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [100001 x i32], ptr @lnk, i64 0, i64 %99
  store i32 %96, ptr %100, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %101 = getelementptr inbounds %struct.Edge, ptr %10, i32 0, i32 0
  %102 = load i32, ptr %8, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [100001 x i32], ptr @lnk, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  store i32 %105, ptr %101, align 4, !tbaa !16
  %106 = getelementptr inbounds %struct.Edge, ptr %10, i32 0, i32 1
  %107 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %107, ptr %106, align 4, !tbaa !18
  %108 = load i32, ptr @tot, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [200003 x %struct.Edge], ptr @e, i64 0, i64 %109
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %110, ptr align 4 %10, i64 8, i1 false), !tbaa.struct !19
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  %111 = load i32, ptr @tot, align 4, !tbaa !5
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr @tot, align 4, !tbaa !5
  %113 = load i32, ptr %8, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [100001 x i32], ptr @lnk, i64 0, i64 %114
  store i32 %111, ptr %115, align 4, !tbaa !5
  br label %119

116:                                              ; preds = %82
  %117 = load i32, ptr %7, align 4, !tbaa !5
  %118 = load i32, ptr %8, align 4, !tbaa !5
  call void @_Z9dsu_mergeii(i32 noundef %117, i32 noundef %118)
  br label %119

119:                                              ; preds = %116, %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %78, !llvm.loop !20

120:                                              ; preds = %78
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %144, %120
  %122 = load i32, ptr %11, align 4, !tbaa !5
  %123 = load i32, ptr @n, align 4, !tbaa !5
  %124 = icmp sle i32 %122, %123
  br i1 %124, label %126, label %125

125:                                              ; preds = %121
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %147

126:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %127 = load i32, ptr %11, align 4, !tbaa !5
  %128 = call noundef i32 @_Z8dsu_findi(i32 noundef %127)
  store i32 %128, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %129 = getelementptr inbounds %struct.Edge, ptr %13, i32 0, i32 0
  %130 = load i32, ptr %12, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [100001 x i32], ptr @lst, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  store i32 %133, ptr %129, align 4, !tbaa !16
  %134 = getelementptr inbounds %struct.Edge, ptr %13, i32 0, i32 1
  %135 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %135, ptr %134, align 4, !tbaa !18
  %136 = load i32, ptr @tot, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [200003 x %struct.Edge], ptr @g, i64 0, i64 %137
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %138, ptr align 4 %13, i64 8, i1 false), !tbaa.struct !19
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  %139 = load i32, ptr @tot, align 4, !tbaa !5
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr @tot, align 4, !tbaa !5
  %141 = load i32, ptr %12, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [100001 x i32], ptr @lst, i64 0, i64 %142
  store i32 %139, ptr %143, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %144

144:                                              ; preds = %126
  %145 = load i32, ptr %11, align 4, !tbaa !5
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %11, align 4, !tbaa !5
  br label %121, !llvm.loop !21

147:                                              ; preds = %125
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 1, ptr %14, align 4, !tbaa !5
  br label %148

148:                                              ; preds = %169, %147
  %149 = load i32, ptr %14, align 4, !tbaa !5
  %150 = load i32, ptr @n, align 4, !tbaa !5
  %151 = icmp sle i32 %149, %150
  br i1 %151, label %153, label %152

152:                                              ; preds = %148
  store i32 16, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %172

153:                                              ; preds = %148
  %154 = load i32, ptr %14, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [100001 x i32], ptr @dsu, i64 0, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !5
  %158 = icmp slt i32 %157, 0
  br i1 %158, label %159, label %168

159:                                              ; preds = %153
  %160 = load i32, ptr %14, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !5
  %164 = icmp eq i32 %163, -1
  br i1 %164, label %165, label %168

165:                                              ; preds = %159
  %166 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %166, ptr @rt, align 4, !tbaa !5
  %167 = load i32, ptr %14, align 4, !tbaa !5
  call void @_Z3dfsiii(i32 noundef %167, i32 noundef -1, i32 noundef 0)
  br label %168

168:                                              ; preds = %165, %159, %153
  br label %169

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

172:                                              ; preds = %152
  %173 = load i32, ptr @tot, align 4, !tbaa !5
  call void @_Z9seg_buildii(i32 noundef 1, i32 noundef %173)
  %174 = load i32, ptr %2, align 4, !tbaa !5
  %175 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %174)
  br label %176

176:                                              ; preds = %281, %172
  %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 %282

180:                                              ; preds = %176
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %15)
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %16)
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %18)
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %181

181:                                              ; preds = %187, %180
  %182 = load i32, ptr %17, align 4, !tbaa !5
  %183 = shl i32 1, %182
  %184 = load i32, ptr %18, align 4, !tbaa !5
  %185 = icmp slt i32 %183, %184
  br i1 %185, label %186, label %190

186:                                              ; preds = %181
  br label %187

187:                                              ; preds = %186
  %188 = load i32, ptr %17, align 4, !tbaa !5
  %189 = add nsw i32 %188, 1
  store i32 %189, ptr %17, align 4, !tbaa !5
  br label %181, !llvm.loop !23

190:                                              ; preds = %181
  %191 = load i32, ptr %15, align 4, !tbaa !5
  %192 = icmp eq i32 %191, 1
  br i1 %192, label %193, label %249

193:                                              ; preds = %190
  %194 = load i32, ptr %16, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %195
  %197 = load i32, ptr %196, align 4, !tbaa !5
  %198 = load i32, ptr %17, align 4, !tbaa !5
  %199 = sub nsw i32 %198, %197
  store i32 %199, ptr %17, align 4, !tbaa !5
  %200 = load i32, ptr %17, align 4, !tbaa !5
  %201 = load i32, ptr %16, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %202
  %204 = load i32, ptr %203, align 4, !tbaa !5
  %205 = add nsw i32 %204, %200
  store i32 %205, ptr %203, align 4, !tbaa !5
  %206 = load i32, ptr %16, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [100001 x i32], ptr @pL, i64 0, i64 %207
  %209 = load i32, ptr %208, align 4, !tbaa !5
  %210 = load i32, ptr %16, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [100001 x i32], ptr @pR, i64 0, i64 %211
  %213 = load i32, ptr %212, align 4, !tbaa !5
  %214 = icmp sle i32 %209, %213
  br i1 %214, label %215, label %226

215:                                              ; preds = %193
  %216 = load i32, ptr @tot, align 4, !tbaa !5
  %217 = load i32, ptr %16, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [100001 x i32], ptr @pL, i64 0, i64 %218
  %220 = load i32, ptr %219, align 4, !tbaa !5
  %221 = load i32, ptr %16, align 4, !tbaa !5
  %222 = sext i32 %221 to i64
  %223 = getelementptr inbounds [100001 x i32], ptr @pR, i64 0, i64 %222
  %224 = load i32, ptr %223, align 4, !tbaa !5
  %225 = load i32, ptr %17, align 4, !tbaa !5
  call void @_Z7seg_updiiiii(i32 noundef 1, i32 noundef %216, i32 noundef %220, i32 noundef %224, i32 noundef %225)
  br label %226

226:                                              ; preds = %215, %193
  %227 = load i32, ptr %16, align 4, !tbaa !5
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [100001 x i32], ptr @qL, i64 0, i64 %228
  %230 = load i32, ptr %229, align 4, !tbaa !5
  %231 = load i32, ptr %16, align 4, !tbaa !5
  %232 = sext i32 %231 to i64
  %233 = getelementptr inbounds [100001 x i32], ptr @qR, i64 0, i64 %232
  %234 = load i32, ptr %233, align 4, !tbaa !5
  %235 = icmp sle i32 %230, %234
  br i1 %235, label %236, label %248

236:                                              ; preds = %226
  %237 = load i32, ptr @tot, align 4, !tbaa !5
  %238 = load i32, ptr %16, align 4, !tbaa !5
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds [100001 x i32], ptr @qL, i64 0, i64 %239
  %241 = load i32, ptr %240, align 4, !tbaa !5
  %242 = load i32, ptr %16, align 4, !tbaa !5
  %243 = sext i32 %242 to i64
  %244 = getelementptr inbounds [100001 x i32], ptr @qR, i64 0, i64 %243
  %245 = load i32, ptr %244, align 4, !tbaa !5
  %246 = load i32, ptr %17, align 4, !tbaa !5
  %247 = sub nsw i32 0, %246
  call void @_Z7seg_updiiiii(i32 noundef 1, i32 noundef %237, i32 noundef %241, i32 noundef %245, i32 noundef %247)
  br label %248

248:                                              ; preds = %236, %226
  br label %281

249:                                              ; preds = %190
  %250 = load i32, ptr %16, align 4, !tbaa !5
  %251 = call noundef i32 @_Z8dsu_findi(i32 noundef %250)
  store i32 %251, ptr %16, align 4, !tbaa !5
  %252 = load i32, ptr %17, align 4, !tbaa !5
  %253 = load i32, ptr @tot, align 4, !tbaa !5
  %254 = load i32, ptr %16, align 4, !tbaa !5
  %255 = sext i32 %254 to i64
  %256 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %255
  %257 = load i32, ptr %256, align 4, !tbaa !5
  %258 = call noundef i32 @_Z7seg_getiii(i32 noundef 1, i32 noundef %253, i32 noundef %257)
  %259 = sub nsw i32 %252, %258
  %260 = load i32, ptr @tot, align 4, !tbaa !5
  %261 = load i32, ptr %16, align 4, !tbaa !5
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds [100001 x i32], ptr @idx, i64 0, i64 %262
  %264 = load i32, ptr %263, align 4, !tbaa !5
  %265 = sext i32 %264 to i64
  %266 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %265
  %267 = load i32, ptr %266, align 4, !tbaa !5
  %268 = load i32, ptr %16, align 4, !tbaa !5
  %269 = sext i32 %268 to i64
  %270 = getelementptr inbounds [100001 x i32], ptr @idx, i64 0, i64 %269
  %271 = load i32, ptr %270, align 4, !tbaa !5
  %272 = sext i32 %271 to i64
  %273 = getelementptr inbounds [100001 x i32], ptr @out, i64 0, i64 %272
  %274 = load i32, ptr %273, align 4, !tbaa !5
  %275 = call noundef i32 @_Z7seg_maxiiii(i32 noundef 1, i32 noundef %260, i32 noundef %267, i32 noundef %274)
  %276 = add nsw i32 %259, %275
  %277 = sitofp i32 %276 to double
  %278 = load double, ptr @_ZL5log_2, align 8, !tbaa !24
  %279 = fmul double %277, %278
  %280 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %279)
  br label %281

281:                                              ; preds = %249, %248
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %176, !llvm.loop !26

282:                                              ; preds = %176
  br label %283

283:                                              ; preds = %282
  %284 = load i32, ptr %2, align 4, !tbaa !5
  %285 = add nsw i32 %284, 1
  store i32 %285, ptr %2, align 4, !tbaa !5
  br label %19, !llvm.loop !27

286:                                              ; preds = %23
  ret i32 0
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z9dsu_mergeii(i32 noundef, i32 noundef) #2

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


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

%struct.Edge = type { i32, i32 }

@_ZL5log_2 = external hidden local_unnamed_addr global double, align 8
@_ZN6fastIO7IOerrorE = external dso_local local_unnamed_addr global i8, align 1
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@a = external dso_local local_unnamed_addr global [100001 x i32], align 16
@dsu = external dso_local local_unnamed_addr global [100001 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@lnk = external dso_local local_unnamed_addr global [100001 x i32], align 16
@lst = external dso_local local_unnamed_addr global [100001 x i32], align 16
@rt = external dso_local local_unnamed_addr global i32, align 4
@idx = external dso_local local_unnamed_addr global [100001 x i32], align 16
@in = external dso_local local_unnamed_addr global [100001 x i32], align 16
@out = external dso_local local_unnamed_addr global [100001 x i32], align 16
@pL = external dso_local local_unnamed_addr global [100001 x i32], align 16
@pR = external dso_local local_unnamed_addr global [100001 x i32], align 16
@qL = external dso_local local_unnamed_addr global [100001 x i32], align 16
@qR = external dso_local local_unnamed_addr global [100001 x i32], align 16
@e = external dso_local local_unnamed_addr global [200003 x %struct.Edge], align 16
@g = external dso_local local_unnamed_addr global [200003 x %struct.Edge], align 16
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9seg_buildii(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 uwtable
declare dso_local noundef i32 @_Z7seg_getiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z8dsu_findi(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %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 i32, align 4
  %7 = alloca i32, align 4
  tail call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) @n)
  tail call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) @m)
  tail call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) @q)
  %8 = load i8, ptr @_ZN6fastIO7IOerrorE, align 1, !tbaa !5, !range !9, !noundef !10
  %9 = trunc nuw i8 %8 to i1
  br i1 %9, label %._crit_edge75, label %.lr.ph74

._crit_edge75:                                    ; preds = %._crit_edge71, %0
  ret i32 0

.lr.ph74:                                         ; preds = %0, %._crit_edge71
  %.03972 = phi i32 [ %137, %._crit_edge71 ], [ 1, %0 ]
  store i32 0, ptr @tot, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %10 = load i32, ptr @n, align 4, !tbaa !11
  %.not52 = icmp slt i32 %10, 1
  br i1 %.not52, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %19, %.lr.ph74
  %11 = phi i32 [ %10, %.lr.ph74 ], [ %29, %19 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %12 = load i32, ptr @m, align 4, !tbaa !11
  %13 = add nsw i32 %12, -1
  store i32 %13, ptr @m, align 4, !tbaa !11
  %.not4654 = icmp eq i32 %12, 0
  br i1 %.not4654, label %._crit_edge57, label %.lr.ph56

.lr.ph:                                           ; preds = %.lr.ph74, %19
  %indvars.iv = phi i64 [ %indvars.iv.next, %19 ], [ 1, %.lr.ph74 ]
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %1)
  %14 = load i32, ptr %1, align 4, !tbaa !11
  br label %15

15:                                               ; preds = %15, %.lr.ph
  %storemerge = phi i32 [ 0, %.lr.ph ], [ %18, %15 ]
  %16 = shl nuw i32 1, %storemerge
  %17 = icmp slt i32 %16, %14
  %18 = add nuw nsw i32 %storemerge, 1
  br i1 %17, label %15, label %19, !llvm.loop !13

19:                                               ; preds = %15
  %20 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %indvars.iv
  store i32 %storemerge, ptr %20, align 4, !tbaa !11
  %21 = getelementptr inbounds [100001 x i32], ptr @qR, i64 0, i64 %indvars.iv
  store i32 -1, ptr %21, align 4, !tbaa !11
  %22 = getelementptr inbounds [100001 x i32], ptr @pR, i64 0, i64 %indvars.iv
  store i32 -1, ptr %22, align 4, !tbaa !11
  %23 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %indvars.iv
  store i32 -1, ptr %23, align 4, !tbaa !11
  %24 = getelementptr inbounds [100001 x i32], ptr @lst, i64 0, i64 %indvars.iv
  store i32 -1, ptr %24, align 4, !tbaa !11
  %25 = getelementptr inbounds [100001 x i32], ptr @lnk, i64 0, i64 %indvars.iv
  store i32 -1, ptr %25, align 4, !tbaa !11
  %26 = getelementptr inbounds [100001 x i32], ptr @dsu, i64 0, i64 %indvars.iv
  store i32 -1, ptr %26, align 4, !tbaa !11
  %27 = getelementptr inbounds [100001 x i32], ptr @qL, i64 0, i64 %indvars.iv
  store i32 0, ptr %27, align 4, !tbaa !11
  %28 = getelementptr inbounds [100001 x i32], ptr @pL, i64 0, i64 %indvars.iv
  store i32 0, ptr %28, align 4, !tbaa !11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %29 = load i32, ptr @n, align 4, !tbaa !11
  %30 = sext i32 %29 to i64
  %.not.not = icmp slt i64 %indvars.iv, %30
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !15

.lr.ph56:                                         ; preds = %._crit_edge, %51
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %4)
  %31 = load i32, ptr %2, align 4, !tbaa !11
  %32 = icmp eq i32 %31, 1
  %33 = load i32, ptr %3, align 4, !tbaa !11
  br i1 %32, label %34, label %49

34:                                               ; preds = %.lr.ph56
  %35 = sext i32 %33 to i64
  %36 = getelementptr inbounds [100001 x i32], ptr @lnk, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !11
  %38 = load i32, ptr %4, align 4, !tbaa !11
  %39 = load i32, ptr @tot, align 4, !tbaa !11
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [200003 x %struct.Edge], ptr @e, i64 0, i64 %40
  store i32 %37, ptr %41, align 8, !tbaa !11
  %.sroa.422.0..sroa_idx = getelementptr inbounds i8, ptr %41, i64 4
  store i32 %38, ptr %.sroa.422.0..sroa_idx, align 4, !tbaa !11
  %42 = add nsw i32 %39, 1
  store i32 %39, ptr %36, align 4, !tbaa !11
  %43 = sext i32 %38 to i64
  %44 = getelementptr inbounds [100001 x i32], ptr @lnk, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !11
  %46 = sext i32 %42 to i64
  %47 = getelementptr inbounds [200003 x %struct.Edge], ptr @e, i64 0, i64 %46
  store i32 %45, ptr %47, align 8, !tbaa !11
  %.sroa.420.0..sroa_idx = getelementptr inbounds i8, ptr %47, i64 4
  store i32 %33, ptr %.sroa.420.0..sroa_idx, align 4, !tbaa !11
  %48 = add nsw i32 %39, 2
  store i32 %48, ptr @tot, align 4, !tbaa !11
  store i32 %42, ptr %44, align 4, !tbaa !11
  br label %51

49:                                               ; preds = %.lr.ph56
  %50 = load i32, ptr %4, align 4, !tbaa !11
  call void @_Z9dsu_mergeii(i32 noundef %33, i32 noundef %50)
  br label %51

51:                                               ; preds = %49, %34
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  %52 = load i32, ptr @m, align 4, !tbaa !11
  %53 = add nsw i32 %52, -1
  store i32 %53, ptr @m, align 4, !tbaa !11
  %.not46 = icmp eq i32 %52, 0
  br i1 %.not46, label %._crit_edge57.loopexit, label %.lr.ph56, !llvm.loop !16

._crit_edge57.loopexit:                           ; preds = %51
  %.pre = load i32, ptr @n, align 4, !tbaa !11
  br label %._crit_edge57

._crit_edge57:                                    ; preds = %._crit_edge57.loopexit, %._crit_edge
  %54 = phi i32 [ %.pre, %._crit_edge57.loopexit ], [ %11, %._crit_edge ]
  store i32 0, ptr @tot, align 4, !tbaa !11
  %.not4758 = icmp slt i32 %54, 1
  br i1 %.not4758, label %._crit_edge67, label %.lr.ph61

._crit_edge62:                                    ; preds = %.lr.ph61
  store i32 0, ptr @tot, align 4, !tbaa !11
  %.not4863 = icmp slt i32 %64, 1
  br i1 %.not4863, label %._crit_edge67, label %.lr.ph66

.lr.ph61:                                         ; preds = %._crit_edge57, %.lr.ph61
  %.04159 = phi i32 [ %63, %.lr.ph61 ], [ 1, %._crit_edge57 ]
  %55 = call noundef i32 @_Z8dsu_findi(i32 noundef %.04159)
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [100001 x i32], ptr @lst, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !11
  %59 = load i32, ptr @tot, align 4, !tbaa !11
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [200003 x %struct.Edge], ptr @g, i64 0, i64 %60
  store i32 %58, ptr %61, align 8, !tbaa !11
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %61, i64 4
  store i32 %.04159, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !11
  %62 = add nsw i32 %59, 1
  store i32 %62, ptr @tot, align 4, !tbaa !11
  store i32 %59, ptr %57, align 4, !tbaa !11
  %63 = add nuw nsw i32 %.04159, 1
  %64 = load i32, ptr @n, align 4, !tbaa !11
  %.not47.not = icmp slt i32 %.04159, %64
  br i1 %.not47.not, label %.lr.ph61, label %._crit_edge62, !llvm.loop !17

._crit_edge67.loopexit:                           ; preds = %79
  %.pre81 = load i32, ptr @tot, align 4, !tbaa !11
  br label %._crit_edge67

._crit_edge67:                                    ; preds = %._crit_edge57, %._crit_edge67.loopexit, %._crit_edge62
  %65 = phi i32 [ %.pre81, %._crit_edge67.loopexit ], [ 0, %._crit_edge62 ], [ 0, %._crit_edge57 ]
  call void @_Z9seg_buildii(i32 noundef 1, i32 noundef %65)
  %66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.03972)
  %67 = load i32, ptr @q, align 4, !tbaa !11
  %68 = add nsw i32 %67, -1
  store i32 %68, ptr @q, align 4, !tbaa !11
  %.not4968 = icmp eq i32 %67, 0
  br i1 %.not4968, label %._crit_edge71, label %.lr.ph70

.lr.ph66:                                         ; preds = %._crit_edge62, %79
  %69 = phi i32 [ %80, %79 ], [ %64, %._crit_edge62 ]
  %indvars.iv77 = phi i64 [ %indvars.iv.next78, %79 ], [ 1, %._crit_edge62 ]
  %70 = getelementptr inbounds [100001 x i32], ptr @dsu, i64 0, i64 %indvars.iv77
  %71 = load i32, ptr %70, align 4, !tbaa !11
  %72 = icmp slt i32 %71, 0
  br i1 %72, label %73, label %79

73:                                               ; preds = %.lr.ph66
  %74 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %indvars.iv77
  %75 = load i32, ptr %74, align 4, !tbaa !11
  %76 = icmp eq i32 %75, -1
  br i1 %76, label %77, label %79

77:                                               ; preds = %73
  %78 = trunc nuw nsw i64 %indvars.iv77 to i32
  store i32 %78, ptr @rt, align 4, !tbaa !11
  call void @_Z3dfsiii(i32 noundef %78, i32 noundef -1, i32 noundef 0)
  %.pre80 = load i32, ptr @n, align 4, !tbaa !11
  br label %79

79:                                               ; preds = %.lr.ph66, %73, %77
  %80 = phi i32 [ %69, %.lr.ph66 ], [ %69, %73 ], [ %.pre80, %77 ]
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %81 = sext i32 %80 to i64
  %.not48.not = icmp slt i64 %indvars.iv77, %81
  br i1 %.not48.not, label %.lr.ph66, label %._crit_edge67.loopexit, !llvm.loop !18

.lr.ph70:                                         ; preds = %._crit_edge67, %134
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %7)
  %82 = load i32, ptr %7, align 4, !tbaa !11
  br label %83

83:                                               ; preds = %83, %.lr.ph70
  %.0 = phi i32 [ 0, %.lr.ph70 ], [ %86, %83 ]
  %84 = shl nuw i32 1, %.0
  %85 = icmp slt i32 %84, %82
  %86 = add nuw nsw i32 %.0, 1
  br i1 %85, label %83, label %87, !llvm.loop !19

87:                                               ; preds = %83
  %88 = load i32, ptr %5, align 4, !tbaa !11
  %89 = icmp eq i32 %88, 1
  %90 = load i32, ptr %6, align 4, !tbaa !11
  br i1 %89, label %91, label %110

91:                                               ; preds = %87
  %92 = sext i32 %90 to i64
  %93 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !11
  %95 = sub nsw i32 %.0, %94
  store i32 %.0, ptr %93, align 4, !tbaa !11
  %96 = getelementptr inbounds [100001 x i32], ptr @pL, i64 0, i64 %92
  %97 = load i32, ptr %96, align 4, !tbaa !11
  %98 = getelementptr inbounds [100001 x i32], ptr @pR, i64 0, i64 %92
  %99 = load i32, ptr %98, align 4, !tbaa !11
  %.not50 = icmp sgt i32 %97, %99
  br i1 %.not50, label %102, label %100

100:                                              ; preds = %91
  %101 = load i32, ptr @tot, align 4, !tbaa !11
  call void @_Z7seg_updiiiii(i32 noundef 1, i32 noundef %101, i32 noundef %97, i32 noundef %99, i32 noundef %95)
  %.pre82 = load i32, ptr %6, align 4, !tbaa !11
  %.pre83 = sext i32 %.pre82 to i64
  br label %102

102:                                              ; preds = %100, %91
  %.pre-phi = phi i64 [ %.pre83, %100 ], [ %92, %91 ]
  %103 = getelementptr inbounds [100001 x i32], ptr @qL, i64 0, i64 %.pre-phi
  %104 = load i32, ptr %103, align 4, !tbaa !11
  %105 = getelementptr inbounds [100001 x i32], ptr @qR, i64 0, i64 %.pre-phi
  %106 = load i32, ptr %105, align 4, !tbaa !11
  %.not51 = icmp sgt i32 %104, %106
  br i1 %.not51, label %134, label %107

107:                                              ; preds = %102
  %108 = load i32, ptr @tot, align 4, !tbaa !11
  %109 = sub nsw i32 0, %95
  call void @_Z7seg_updiiiii(i32 noundef 1, i32 noundef %108, i32 noundef %104, i32 noundef %106, i32 noundef %109)
  br label %134

110:                                              ; preds = %87
  %111 = call noundef i32 @_Z8dsu_findi(i32 noundef %90)
  store i32 %111, ptr %6, align 4, !tbaa !11
  %112 = load i32, ptr @tot, align 4, !tbaa !11
  %113 = sext i32 %111 to i64
  %114 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !11
  %116 = call noundef i32 @_Z7seg_getiii(i32 noundef 1, i32 noundef %112, i32 noundef %115)
  %117 = sub i32 %.0, %116
  %118 = load i32, ptr @tot, align 4, !tbaa !11
  %119 = load i32, ptr %6, align 4, !tbaa !11
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [100001 x i32], ptr @idx, i64 0, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !11
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !11
  %126 = getelementptr inbounds [100001 x i32], ptr @out, i64 0, i64 %123
  %127 = load i32, ptr %126, align 4, !tbaa !11
  %128 = call noundef i32 @_Z7seg_maxiiii(i32 noundef 1, i32 noundef %118, i32 noundef %125, i32 noundef %127)
  %129 = add nsw i32 %117, %128
  %130 = sitofp i32 %129 to double
  %131 = load double, ptr @_ZL5log_2, align 8, !tbaa !20
  %132 = fmul double %131, %130
  %133 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %132)
  br label %134

134:                                              ; preds = %102, %107, %110
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  %135 = load i32, ptr @q, align 4, !tbaa !11
  %136 = add nsw i32 %135, -1
  store i32 %136, ptr @q, align 4, !tbaa !11
  %.not49 = icmp eq i32 %135, 0
  br i1 %.not49, label %._crit_edge71, label %.lr.ph70, !llvm.loop !22

._crit_edge71:                                    ; preds = %134, %._crit_edge67
  %137 = add nuw nsw i32 %.03972, 1
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) @n)
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) @m)
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) @q)
  %138 = load i8, ptr @_ZN6fastIO7IOerrorE, align 1, !tbaa !5, !range !9, !noundef !10
  %139 = trunc nuw i8 %138 to i1
  br i1 %139, label %._crit_edge75, label %.lr.ph74, !llvm.loop !23
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z9dsu_mergeii(i32 noundef, i32 noundef) local_unnamed_addr #2

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

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


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