; LLVM IR from tangjz/acm-icpc :: 51nod/1297.ll (Z5buildii)

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

@m = external dso_local global i32, align 4
@lnk = external dso_local global [100001 x i32], align 16
@idx = external dso_local global [17 x [100001 x i32]], align 16
@idx2 = external dso_local global [17 x [100001 x i32]], align 16
@dis = external dso_local global [17 x [100001 x i32]], align 16
@e = external dso_local global [200003 x %struct.Edge], align 16
@ban = external dso_local global [100001 x i8], align 16
@tot = external dso_local global i32, align 4
@ord = external dso_local global [100001 x i32], align 16
@fa = external dso_local global [100001 x i32], align 16
@dep = external dso_local global [100001 x i32], align 16
@sz = external dso_local global [100001 x i32], align 16
@maxL = external dso_local global i32, align 4

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5buildii(i32 noundef %0, i32 noundef %1) #2 {
  %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 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 %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  %21 = load i32, ptr @maxL, align 4, !tbaa !5
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = icmp slt i32 %21, %22
  br i1 %23, label %24, label %26

24:                                               ; preds = %2
  %25 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %25, ptr @maxL, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %24, %2
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [100001 x i32], ptr @dep, i64 0, i64 %28
  store i32 0, ptr %29, align 4, !tbaa !5
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [100001 x i32], ptr @fa, i64 0, i64 %31
  store i32 0, ptr %32, align 4, !tbaa !5
  %33 = load i32, ptr %4, align 4, !tbaa !5
  call void @_Z3bfsi(i32 noundef %33)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 100001, ptr %5, align 4, !tbaa !5
  store i32 -1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %34 = load i32, ptr @tot, align 4, !tbaa !5
  %35 = sub nsw i32 %34, 1
  store i32 %35, ptr %6, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %115, %26
  %37 = load i32, ptr %6, align 4, !tbaa !5
  %38 = icmp sge i32 %37, 0
  br i1 %38, label %40, label %39

39:                                               ; preds = %36
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %118

40:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %41 = load i32, ptr %6, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  store i32 %44, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !5
  %45 = load i32, ptr %8, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %46
  store i32 1, ptr %47, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %48 = load i32, ptr %8, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [100001 x i32], ptr @lnk, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  store i32 %51, ptr %10, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %93, %40
  %53 = load i32, ptr %10, align 4, !tbaa !5
  %54 = icmp ne i32 %53, -1
  br i1 %54, label %56, label %55

55:                                               ; preds = %52
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %99

56:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %57 = load i32, ptr %10, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [200003 x %struct.Edge], ptr @e, i64 0, i64 %58
  %60 = getelementptr inbounds %struct.Edge, ptr %59, i32 0, i32 1
  %61 = load i32, ptr %60, align 4, !tbaa !9
  store i32 %61, ptr %11, align 4, !tbaa !5
  %62 = load i32, ptr %11, align 4, !tbaa !5
  %63 = load i32, ptr %8, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100001 x i32], ptr @fa, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = icmp eq i32 %62, %66
  br i1 %67, label %74, label %68

68:                                               ; preds = %56
  %69 = load i32, ptr %11, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [100001 x i8], ptr @ban, i64 0, i64 %70
  %72 = load i8, ptr %71, align 1, !tbaa !11, !range !13, !noundef !14
  %73 = trunc i8 %72 to i1
  br i1 %73, label %74, label %75

74:                                               ; preds = %68, %56
  store i32 7, ptr %7, align 4
  br label %90

75:                                               ; preds = %68
  %76 = load i32, ptr %11, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %77
  %79 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %78)
  %80 = load i32, ptr %79, align 4, !tbaa !5
  store i32 %80, ptr %9, align 4, !tbaa !5
  %81 = load i32, ptr %11, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = load i32, ptr %8, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = add nsw i32 %88, %84
  store i32 %89, ptr %87, align 4, !tbaa !5
  store i32 0, ptr %7, align 4
  br label %90

90:                                               ; preds = %75, %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  %91 = load i32, ptr %7, align 4
  switch i32 %91, label %264 [
    i32 0, label %92
    i32 7, label %93
  ]

92:                                               ; preds = %90
  br label %93

93:                                               ; preds = %92, %90
  %94 = load i32, ptr %10, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [200003 x %struct.Edge], ptr @e, i64 0, i64 %95
  %97 = getelementptr inbounds %struct.Edge, ptr %96, i32 0, i32 0
  %98 = load i32, ptr %97, align 8, !tbaa !15
  store i32 %98, ptr %10, align 4, !tbaa !5
  br label %52, !llvm.loop !16

99:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %100 = load i32, ptr @tot, align 4, !tbaa !5
  %101 = load i32, ptr %8, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = sub nsw i32 %100, %104
  store i32 %105, ptr %12, align 4, !tbaa !5
  %106 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %107 = load i32, ptr %106, align 4, !tbaa !5
  store i32 %107, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  %108 = load i32, ptr %9, align 4, !tbaa !5
  %109 = load i32, ptr %5, align 4, !tbaa !5
  %110 = icmp slt i32 %108, %109
  br i1 %110, label %111, label %114

111:                                              ; preds = %99
  %112 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %112, ptr %5, align 4, !tbaa !5
  %113 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %113, ptr %4, align 4, !tbaa !5
  br label %114

114:                                              ; preds = %111, %99
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %115

115:                                              ; preds = %114
  %116 = load i32, ptr %6, align 4, !tbaa !5
  %117 = add nsw i32 %116, -1
  store i32 %117, ptr %6, align 4, !tbaa !5
  br label %36, !llvm.loop !18

118:                                              ; preds = %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %119 = load i32, ptr @m, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr @m, align 4, !tbaa !5
  store i32 %119, ptr %13, align 4, !tbaa !5
  %121 = load i32, ptr %13, align 4, !tbaa !5
  %122 = load i32, ptr %3, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [17 x [100001 x i32]], ptr @idx2, i64 0, i64 %123
  %125 = load i32, ptr %4, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [100001 x i32], ptr %124, i64 0, i64 %126
  store i32 %121, ptr %127, align 4, !tbaa !5
  %128 = load i32, ptr %3, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [17 x [100001 x i32]], ptr @idx, i64 0, i64 %129
  %131 = load i32, ptr %4, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [100001 x i32], ptr %130, i64 0, i64 %132
  store i32 %121, ptr %133, align 4, !tbaa !5
  %134 = load i32, ptr %4, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [100001 x i32], ptr @dep, i64 0, i64 %135
  store i32 0, ptr %136, align 4, !tbaa !5
  %137 = load i32, ptr %4, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [100001 x i32], ptr @fa, i64 0, i64 %138
  store i32 0, ptr %139, align 4, !tbaa !5
  %140 = load i32, ptr %3, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [17 x [100001 x i32]], ptr @dis, i64 0, i64 %141
  %143 = load i32, ptr %4, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [100001 x i32], ptr %142, i64 0, i64 %144
  store i32 0, ptr %145, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %146 = load i32, ptr %4, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [100001 x i32], ptr @lnk, i64 0, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !5
  store i32 %149, ptr %14, align 4, !tbaa !5
  br label %150

150:                                              ; preds = %223, %118
  %151 = load i32, ptr %14, align 4, !tbaa !5
  %152 = icmp ne i32 %151, -1
  br i1 %152, label %154, label %153

153:                                              ; preds = %150
  store i32 8, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %229

154:                                              ; preds = %150
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %155 = load i32, ptr %14, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [200003 x %struct.Edge], ptr @e, i64 0, i64 %156
  %158 = getelementptr inbounds %struct.Edge, ptr %157, i32 0, i32 1
  %159 = load i32, ptr %158, align 4, !tbaa !9
  store i32 %159, ptr %15, align 4, !tbaa !5
  %160 = load i32, ptr %15, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [100001 x i8], ptr @ban, i64 0, i64 %161
  %163 = load i8, ptr %162, align 1, !tbaa !11, !range !13, !noundef !14
  %164 = trunc i8 %163 to i1
  br i1 %164, label %165, label %166

165:                                              ; preds = %154
  store i32 10, ptr %7, align 4
  br label %220

166:                                              ; preds = %154
  %167 = load i32, ptr %4, align 4, !tbaa !5
  %168 = load i32, ptr %15, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [100001 x i32], ptr @fa, i64 0, i64 %169
  store i32 %167, ptr %170, align 4, !tbaa !5
  %171 = load i32, ptr %4, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [100001 x i32], ptr @dep, i64 0, i64 %172
  %174 = load i32, ptr %173, align 4, !tbaa !5
  %175 = add nsw i32 %174, 1
  %176 = load i32, ptr %15, align 4, !tbaa !5
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [100001 x i32], ptr @dep, i64 0, i64 %177
  store i32 %175, ptr %178, align 4, !tbaa !5
  %179 = load i32, ptr %15, align 4, !tbaa !5
  call void @_Z3bfsi(i32 noundef %179)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %180 = load i32, ptr @m, align 4, !tbaa !5
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr @m, align 4, !tbaa !5
  store i32 %180, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %182

182:                                              ; preds = %216, %166
  %183 = load i32, ptr %17, align 4, !tbaa !5
  %184 = load i32, ptr @tot, align 4, !tbaa !5
  %185 = icmp slt i32 %183, %184
  br i1 %185, label %187, label %186

186:                                              ; preds = %182
  store i32 11, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %219

187:                                              ; preds = %182
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %188 = load i32, ptr %17, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %189
  %191 = load i32, ptr %190, align 4, !tbaa !5
  store i32 %191, ptr %18, align 4, !tbaa !5
  %192 = load i32, ptr %13, align 4, !tbaa !5
  %193 = load i32, ptr %3, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [17 x [100001 x i32]], ptr @idx, i64 0, i64 %194
  %196 = load i32, ptr %18, align 4, !tbaa !5
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [100001 x i32], ptr %195, i64 0, i64 %197
  store i32 %192, ptr %198, align 4, !tbaa !5
  %199 = load i32, ptr %16, align 4, !tbaa !5
  %200 = load i32, ptr %3, align 4, !tbaa !5
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [17 x [100001 x i32]], ptr @idx2, i64 0, i64 %201
  %203 = load i32, ptr %18, align 4, !tbaa !5
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [100001 x i32], ptr %202, i64 0, i64 %204
  store i32 %199, ptr %205, align 4, !tbaa !5
  %206 = load i32, ptr %18, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [100001 x i32], ptr @dep, i64 0, i64 %207
  %209 = load i32, ptr %208, align 4, !tbaa !5
  %210 = load i32, ptr %3, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [17 x [100001 x i32]], ptr @dis, i64 0, i64 %211
  %213 = load i32, ptr %18, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [100001 x i32], ptr %212, i64 0, i64 %214
  store i32 %209, ptr %215, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %216

216:                                              ; preds = %187
  %217 = load i32, ptr %17, align 4, !tbaa !5
  %218 = add nsw i32 %217, 1
  store i32 %218, ptr %17, align 4, !tbaa !5
  br label %182, !llvm.loop !19

219:                                              ; preds = %186
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  store i32 0, ptr %7, align 4
  br label %220

220:                                              ; preds = %219, %165
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  %221 = load i32, ptr %7, align 4
  switch i32 %221, label %264 [
    i32 0, label %222
    i32 10, label %223
  ]

222:                                              ; preds = %220
  br label %223

223:                                              ; preds = %222, %220
  %224 = load i32, ptr %14, align 4, !tbaa !5
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [200003 x %struct.Edge], ptr @e, i64 0, i64 %225
  %227 = getelementptr inbounds %struct.Edge, ptr %226, i32 0, i32 0
  %228 = load i32, ptr %227, align 8, !tbaa !15
  store i32 %228, ptr %14, align 4, !tbaa !5
  br label %150, !llvm.loop !20

229:                                              ; preds = %153
  %230 = load i32, ptr %4, align 4, !tbaa !5
  %231 = sext i32 %230 to i64
  %232 = getelementptr inbounds [100001 x i8], ptr @ban, i64 0, i64 %231
  store i8 1, ptr %232, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %233 = load i32, ptr %4, align 4, !tbaa !5
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [100001 x i32], ptr @lnk, i64 0, i64 %234
  %236 = load i32, ptr %235, align 4, !tbaa !5
  store i32 %236, ptr %19, align 4, !tbaa !5
  br label %237

237:                                              ; preds = %257, %229
  %238 = load i32, ptr %19, align 4, !tbaa !5
  %239 = icmp ne i32 %238, -1
  br i1 %239, label %241, label %240

240:                                              ; preds = %237
  store i32 14, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  br label %263

241:                                              ; preds = %237
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %242 = load i32, ptr %19, align 4, !tbaa !5
  %243 = sext i32 %242 to i64
  %244 = getelementptr inbounds [200003 x %struct.Edge], ptr @e, i64 0, i64 %243
  %245 = getelementptr inbounds %struct.Edge, ptr %244, i32 0, i32 1
  %246 = load i32, ptr %245, align 4, !tbaa !9
  store i32 %246, ptr %20, align 4, !tbaa !5
  %247 = load i32, ptr %20, align 4, !tbaa !5
  %248 = sext i32 %247 to i64
  %249 = getelementptr inbounds [100001 x i8], ptr @ban, i64 0, i64 %248
  %250 = load i8, ptr %249, align 1, !tbaa !11, !range !13, !noundef !14
  %251 = trunc i8 %250 to i1
  br i1 %251, label %256, label %252

252:                                              ; preds = %241
  %253 = load i32, ptr %3, align 4, !tbaa !5
  %254 = add nsw i32 %253, 1
  %255 = load i32, ptr %20, align 4, !tbaa !5
  call void @_Z5buildii(i32 noundef %254, i32 noundef %255)
  br label %256

256:                                              ; preds = %252, %241
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %257

257:                                              ; preds = %256
  %258 = load i32, ptr %19, align 4, !tbaa !5
  %259 = sext i32 %258 to i64
  %260 = getelementptr inbounds [200003 x %struct.Edge], ptr @e, i64 0, i64 %259
  %261 = getelementptr inbounds %struct.Edge, ptr %260, i32 0, i32 0
  %262 = load i32, ptr %261, align 8, !tbaa !15
  store i32 %262, ptr %19, align 4, !tbaa !5
  br label %237, !llvm.loop !21

263:                                              ; preds = %240
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret void

264:                                              ; preds = %220, %90
  unreachable
}

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

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


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

@m = external dso_local local_unnamed_addr global i32, align 4
@lnk = external dso_local local_unnamed_addr global [100001 x i32], align 16
@idx = external dso_local local_unnamed_addr global [17 x [100001 x i32]], align 16
@idx2 = external dso_local local_unnamed_addr global [17 x [100001 x i32]], align 16
@dis = external dso_local local_unnamed_addr global [17 x [100001 x i32]], align 16
@e = external dso_local local_unnamed_addr global [200003 x %struct.Edge], align 16
@ban = external dso_local local_unnamed_addr global [100001 x i8], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@ord = external dso_local local_unnamed_addr global [100001 x i32], align 16
@fa = external dso_local local_unnamed_addr global [100001 x i32], align 16
@dep = external dso_local local_unnamed_addr global [100001 x i32], align 16
@sz = external dso_local global [100001 x i32], align 16
@maxL = external dso_local local_unnamed_addr global i32, align 4

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z5buildii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #1 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = load i32, ptr @maxL, align 4, !tbaa !5
  %6 = icmp slt i32 %5, %0
  br i1 %6, label %7, label %8

7:                                                ; preds = %2
  store i32 %0, ptr @maxL, align 4, !tbaa !5
  br label %8

8:                                                ; preds = %7, %2
  %9 = sext i32 %1 to i64
  %10 = getelementptr inbounds [100001 x i32], ptr @dep, i64 0, i64 %9
  store i32 0, ptr %10, align 4, !tbaa !5
  %11 = getelementptr inbounds [100001 x i32], ptr @fa, i64 0, i64 %9
  store i32 0, ptr %11, align 4, !tbaa !5
  tail call void @_Z3bfsi(i32 noundef %1)
  %12 = load i32, ptr @tot, align 4, !tbaa !5
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph82.preheader, label %._crit_edge83

.lr.ph82.preheader:                               ; preds = %8
  %14 = zext nneg i32 %12 to i64
  br label %.lr.ph82

._crit_edge83:                                    ; preds = %._crit_edge, %8
  %.0.lcssa = phi i32 [ -1, %8 ], [ %spec.select73, %._crit_edge ]
  %15 = load i32, ptr @m, align 4, !tbaa !5
  %16 = add nsw i32 %15, 1
  store i32 %16, ptr @m, align 4, !tbaa !5
  %17 = sext i32 %0 to i64
  %18 = sext i32 %.0.lcssa to i64
  %19 = getelementptr inbounds [17 x [100001 x i32]], ptr @idx2, i64 0, i64 %17, i64 %18
  store i32 %15, ptr %19, align 4, !tbaa !5
  %20 = getelementptr inbounds [17 x [100001 x i32]], ptr @idx, i64 0, i64 %17, i64 %18
  store i32 %15, ptr %20, align 4, !tbaa !5
  %21 = getelementptr inbounds [100001 x i32], ptr @dep, i64 0, i64 %18
  store i32 0, ptr %21, align 4, !tbaa !5
  %22 = getelementptr inbounds [100001 x i32], ptr @fa, i64 0, i64 %18
  store i32 0, ptr %22, align 4, !tbaa !5
  %23 = getelementptr inbounds [17 x [100001 x i32]], ptr @dis, i64 0, i64 %17, i64 %18
  store i32 0, ptr %23, align 4, !tbaa !5
  %24 = getelementptr inbounds [100001 x i32], ptr @lnk, i64 0, i64 %18
  %.06687 = load i32, ptr %24, align 4, !tbaa !5
  %.not88 = icmp eq i32 %.06687, -1
  br i1 %.not88, label %._crit_edge92.thread, label %.lr.ph91

._crit_edge92.thread:                             ; preds = %._crit_edge83
  %25 = getelementptr inbounds [100001 x i8], ptr @ban, i64 0, i64 %18
  store i8 1, ptr %25, align 1, !tbaa !9
  br label %._crit_edge98

.lr.ph82:                                         ; preds = %.lr.ph82.preheader, %._crit_edge
  %indvars.iv = phi i64 [ %14, %.lr.ph82.preheader ], [ %indvars.iv.next, %._crit_edge ]
  %.079 = phi i32 [ -1, %.lr.ph82.preheader ], [ %spec.select73, %._crit_edge ]
  %.06278 = phi i32 [ 100001, %.lr.ph82.preheader ], [ %spec.select, %._crit_edge ]
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %26 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv.next
  %27 = load i32, ptr %26, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  store i32 0, ptr %3, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %28
  store i32 1, ptr %29, align 4, !tbaa !5
  %30 = getelementptr inbounds [100001 x i32], ptr @lnk, i64 0, i64 %28
  %.06774 = load i32, ptr %30, align 4, !tbaa !5
  %.not7275 = icmp eq i32 %.06774, -1
  br i1 %.not7275, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph82
  %31 = getelementptr inbounds [100001 x i32], ptr @fa, i64 0, i64 %28
  br label %39

._crit_edge:                                      ; preds = %59, %.lr.ph82
  %32 = phi i32 [ 1, %.lr.ph82 ], [ %60, %59 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  %33 = load i32, ptr @tot, align 4, !tbaa !5
  %34 = sub nsw i32 %33, %32
  store i32 %34, ptr %4, align 4, !tbaa !5
  %35 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %36 = load i32, ptr %35, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  %37 = icmp slt i32 %36, %.06278
  %spec.select = call i32 @llvm.smin.i32(i32 %36, i32 %.06278)
  %spec.select73 = select i1 %37, i32 %27, i32 %.079
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  %38 = icmp sgt i64 %indvars.iv, 1
  br i1 %38, label %.lr.ph82, label %._crit_edge83, !llvm.loop !11

39:                                               ; preds = %.lr.ph, %59
  %40 = phi i32 [ 1, %.lr.ph ], [ %60, %59 ]
  %.06776 = phi i32 [ %.06774, %.lr.ph ], [ %.067, %59 ]
  %41 = sext i32 %.06776 to i64
  %42 = getelementptr inbounds [200003 x %struct.Edge], ptr @e, i64 0, i64 %41
  %43 = getelementptr inbounds i8, ptr %42, i64 4
  %44 = load i32, ptr %43, align 4, !tbaa !13
  %45 = load i32, ptr %31, align 4, !tbaa !5
  %46 = icmp eq i32 %44, %45
  br i1 %46, label %59, label %47

47:                                               ; preds = %39
  %48 = sext i32 %44 to i64
  %49 = getelementptr inbounds [100001 x i8], ptr @ban, i64 0, i64 %48
  %50 = load i8, ptr %49, align 1, !tbaa !9, !range !15, !noundef !16
  %51 = trunc nuw i8 %50 to i1
  br i1 %51, label %59, label %52

52:                                               ; preds = %47
  %53 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %48
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %53)
  %55 = load i32, ptr %54, align 4, !tbaa !5
  store i32 %55, ptr %3, align 4, !tbaa !5
  %56 = load i32, ptr %53, align 4, !tbaa !5
  %57 = load i32, ptr %29, align 4, !tbaa !5
  %58 = add nsw i32 %57, %56
  store i32 %58, ptr %29, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %39, %47, %52
  %60 = phi i32 [ %40, %39 ], [ %40, %47 ], [ %58, %52 ]
  %.067 = load i32, ptr %42, align 8, !tbaa !5
  %.not72 = icmp eq i32 %.067, -1
  br i1 %.not72, label %._crit_edge, label %39, !llvm.loop !17

._crit_edge92:                                    ; preds = %.loopexit
  %.06193.pre = load i32, ptr %24, align 4, !tbaa !5
  %61 = getelementptr inbounds [100001 x i8], ptr @ban, i64 0, i64 %18
  store i8 1, ptr %61, align 1, !tbaa !9
  %.not7194 = icmp eq i32 %.06193.pre, -1
  br i1 %.not7194, label %._crit_edge98, label %.lr.ph97

.lr.ph97:                                         ; preds = %._crit_edge92
  %62 = add nsw i32 %0, 1
  br label %105

.lr.ph91:                                         ; preds = %._crit_edge83, %.loopexit
  %.06689 = phi i32 [ %.066, %.loopexit ], [ %.06687, %._crit_edge83 ]
  %63 = sext i32 %.06689 to i64
  %64 = getelementptr inbounds [200003 x %struct.Edge], ptr @e, i64 0, i64 %63
  %65 = getelementptr inbounds i8, ptr %64, i64 4
  %66 = load i32, ptr %65, align 4, !tbaa !13
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [100001 x i8], ptr @ban, i64 0, i64 %67
  %69 = load i8, ptr %68, align 1, !tbaa !9, !range !15, !noundef !16
  %70 = trunc nuw i8 %69 to i1
  br i1 %70, label %.loopexit, label %71

71:                                               ; preds = %.lr.ph91
  %72 = getelementptr inbounds [100001 x i32], ptr @fa, i64 0, i64 %67
  store i32 %.0.lcssa, ptr %72, align 4, !tbaa !5
  %73 = load i32, ptr %21, align 4, !tbaa !5
  %74 = add nsw i32 %73, 1
  %75 = getelementptr inbounds [100001 x i32], ptr @dep, i64 0, i64 %67
  store i32 %74, ptr %75, align 4, !tbaa !5
  call void @_Z3bfsi(i32 noundef %66)
  %76 = load i32, ptr @m, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr @m, align 4, !tbaa !5
  %78 = load i32, ptr @tot, align 4, !tbaa !5
  %79 = icmp sgt i32 %78, 0
  br i1 %79, label %.lr.ph86.preheader, label %.loopexit

.lr.ph86.preheader:                               ; preds = %71
  %wide.trip.count = zext nneg i32 %78 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %80 = icmp eq i32 %78, 1
  br i1 %80, label %.loopexit.loopexit.unr-lcssa, label %.lr.ph86.preheader.new

.lr.ph86.preheader.new:                           ; preds = %.lr.ph86.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %.lr.ph86

.lr.ph86:                                         ; preds = %.lr.ph86, %.lr.ph86.preheader.new
  %indvars.iv100 = phi i64 [ 0, %.lr.ph86.preheader.new ], [ %indvars.iv.next101.1, %.lr.ph86 ]
  %niter = phi i64 [ 0, %.lr.ph86.preheader.new ], [ %niter.next.1, %.lr.ph86 ]
  %81 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv100
  %82 = load i32, ptr %81, align 8, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [17 x [100001 x i32]], ptr @idx, i64 0, i64 %17, i64 %83
  store i32 %15, ptr %84, align 4, !tbaa !5
  %85 = getelementptr inbounds [17 x [100001 x i32]], ptr @idx2, i64 0, i64 %17, i64 %83
  store i32 %76, ptr %85, align 4, !tbaa !5
  %86 = getelementptr inbounds [100001 x i32], ptr @dep, i64 0, i64 %83
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = getelementptr inbounds [17 x [100001 x i32]], ptr @dis, i64 0, i64 %17, i64 %83
  store i32 %87, ptr %88, align 4, !tbaa !5
  %indvars.iv.next101 = or disjoint i64 %indvars.iv100, 1
  %89 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv.next101
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [17 x [100001 x i32]], ptr @idx, i64 0, i64 %17, i64 %91
  store i32 %15, ptr %92, align 4, !tbaa !5
  %93 = getelementptr inbounds [17 x [100001 x i32]], ptr @idx2, i64 0, i64 %17, i64 %91
  store i32 %76, ptr %93, align 4, !tbaa !5
  %94 = getelementptr inbounds [100001 x i32], ptr @dep, i64 0, i64 %91
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = getelementptr inbounds [17 x [100001 x i32]], ptr @dis, i64 0, i64 %17, i64 %91
  store i32 %95, ptr %96, align 4, !tbaa !5
  %indvars.iv.next101.1 = add nuw nsw i64 %indvars.iv100, 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 %.loopexit.loopexit.unr-lcssa, label %.lr.ph86, !llvm.loop !18

.loopexit.loopexit.unr-lcssa:                     ; preds = %.lr.ph86, %.lr.ph86.preheader
  %indvars.iv100.unr = phi i64 [ 0, %.lr.ph86.preheader ], [ %indvars.iv.next101.1, %.lr.ph86 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.loopexit, label %.lr.ph86.epil

.lr.ph86.epil:                                    ; preds = %.loopexit.loopexit.unr-lcssa
  %97 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv100.unr
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [17 x [100001 x i32]], ptr @idx, i64 0, i64 %17, i64 %99
  store i32 %15, ptr %100, align 4, !tbaa !5
  %101 = getelementptr inbounds [17 x [100001 x i32]], ptr @idx2, i64 0, i64 %17, i64 %99
  store i32 %76, ptr %101, align 4, !tbaa !5
  %102 = getelementptr inbounds [100001 x i32], ptr @dep, i64 0, i64 %99
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = getelementptr inbounds [17 x [100001 x i32]], ptr @dis, i64 0, i64 %17, i64 %99
  store i32 %103, ptr %104, align 4, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph86.epil, %.loopexit.loopexit.unr-lcssa, %71, %.lr.ph91
  %.066 = load i32, ptr %64, align 8, !tbaa !5
  %.not = icmp eq i32 %.066, -1
  br i1 %.not, label %._crit_edge92, label %.lr.ph91, !llvm.loop !19

._crit_edge98:                                    ; preds = %115, %._crit_edge92.thread, %._crit_edge92
  ret void

105:                                              ; preds = %.lr.ph97, %115
  %.06195 = phi i32 [ %.06193.pre, %.lr.ph97 ], [ %.061, %115 ]
  %106 = sext i32 %.06195 to i64
  %107 = getelementptr inbounds [200003 x %struct.Edge], ptr @e, i64 0, i64 %106
  %108 = getelementptr inbounds i8, ptr %107, i64 4
  %109 = load i32, ptr %108, align 4, !tbaa !13
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [100001 x i8], ptr @ban, i64 0, i64 %110
  %112 = load i8, ptr %111, align 1, !tbaa !9, !range !15, !noundef !16
  %113 = trunc nuw i8 %112 to i1
  br i1 %113, label %115, label %114

114:                                              ; preds = %105
  call void @_Z5buildii(i32 noundef %62, i32 noundef %109)
  br label %115

115:                                              ; preds = %114, %105
  %.061 = load i32, ptr %107, align 8, !tbaa !5
  %.not71 = icmp eq i32 %.061, -1
  br i1 %.not71, label %._crit_edge98, label %105, !llvm.loop !20
}

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

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

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


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