; LLVM IR from VastoLorde95/Competitive-Programming :: Timus/1580 (brute)

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

@L = external dso_local global [1000 x %"class.std::vector"], align 16
@visited = external dso_local global [1000 x [2 x i8]], align 16
@value = external dso_local global [1000 x [2 x i32]], align 16
@calc = external dso_local global [1000 x double], align 16
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsiii(i32 noundef, 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: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI4edgeSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI4edgeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 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 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 %struct.edge, align 4
  %9 = alloca %struct.edge, align 4
  %10 = alloca i32, align 4
  %11 = alloca i8, align 1
  %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
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  br label %20

20:                                               ; preds = %41, %0
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = icmp slt i32 %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %44

25:                                               ; preds = %20
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %5, ptr noundef %6, ptr noundef %7)
  %27 = load i32, ptr %5, align 4, !tbaa !5
  %28 = add nsw i32 %27, -1
  store i32 %28, ptr %5, align 4, !tbaa !5
  %29 = load i32, ptr %6, align 4, !tbaa !5
  %30 = add nsw i32 %29, -1
  store i32 %30, ptr %6, align 4, !tbaa !5
  %31 = load i32, ptr %5, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [1000 x %"class.std::vector"], ptr @L, i64 0, i64 %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %34 = load i32, ptr %6, align 4, !tbaa !5
  %35 = load i32, ptr %7, align 4, !tbaa !5
  call void @_ZN4edgeC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %8, i32 noundef %34, i32 noundef %35)
  call void @_ZNSt6vectorI4edgeSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %33, ptr noundef nonnull align 4 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %36 = load i32, ptr %6, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [1000 x %"class.std::vector"], ptr @L, i64 0, i64 %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = load i32, ptr %7, align 4, !tbaa !5
  call void @_ZN4edgeC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %9, i32 noundef %39, i32 noundef %40)
  call void @_ZNSt6vectorI4edgeSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %38, ptr noundef nonnull align 4 dereferenceable(8) %9)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %41

41:                                               ; preds = %25
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %4, align 4, !tbaa !5
  br label %20, !llvm.loop !9

44:                                               ; preds = %24
  call void @llvm.memset.p0.i64(ptr align 16 @visited, i8 0, i64 2000, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %67, %44
  %46 = load i32, ptr %10, align 4, !tbaa !5
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = icmp slt i32 %46, %47
  br i1 %48, label %50, label %49

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

50:                                               ; preds = %45
  %51 = load i32, ptr %10, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [1000 x [2 x i8]], ptr @visited, i64 0, i64 %52
  %54 = getelementptr inbounds [2 x i8], ptr %53, i64 0, i64 0
  %55 = load i8, ptr %54, align 2, !tbaa !11, !range !13, !noundef !14
  %56 = trunc i8 %55 to i1
  br i1 %56, label %66, label %57

57:                                               ; preds = %50
  %58 = load i32, ptr %10, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [1000 x [2 x i8]], ptr @visited, i64 0, i64 %59
  %61 = getelementptr inbounds [2 x i8], ptr %60, i64 0, i64 1
  %62 = load i8, ptr %61, align 1, !tbaa !11, !range !13, !noundef !14
  %63 = trunc i8 %62 to i1
  br i1 %63, label %66, label %64

64:                                               ; preds = %57
  %65 = load i32, ptr %10, align 4, !tbaa !5
  call void @_Z3dfsiii(i32 noundef %65, i32 noundef 0, i32 noundef 0)
  br label %66

66:                                               ; preds = %64, %57, %50
  br label %67

67:                                               ; preds = %66
  %68 = load i32, ptr %10, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %10, align 4, !tbaa !5
  br label %45, !llvm.loop !15

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

71:                                               ; preds = %103, %70
  %72 = load i32, ptr %12, align 4, !tbaa !5
  %73 = load i32, ptr %2, align 4, !tbaa !5
  %74 = icmp slt i32 %72, %73
  br i1 %74, label %75, label %78

75:                                               ; preds = %71
  %76 = load i8, ptr %11, align 1, !tbaa !11, !range !13, !noundef !14
  %77 = trunc i8 %76 to i1
  br label %78

78:                                               ; preds = %75, %71
  %79 = phi i1 [ false, %71 ], [ %77, %75 ]
  br i1 %79, label %81, label %80

80:                                               ; preds = %78
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %106

81:                                               ; preds = %78
  %82 = load i32, ptr %12, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [1000 x [2 x i8]], ptr @visited, i64 0, i64 %83
  %85 = getelementptr inbounds [2 x i8], ptr %84, i64 0, i64 0
  %86 = load i8, ptr %85, align 2, !tbaa !11, !range !13, !noundef !14
  %87 = trunc i8 %86 to i1
  br i1 %87, label %88, label %95

88:                                               ; preds = %81
  %89 = load i32, ptr %12, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [1000 x [2 x i8]], ptr @visited, i64 0, i64 %90
  %92 = getelementptr inbounds [2 x i8], ptr %91, i64 0, i64 1
  %93 = load i8, ptr %92, align 1, !tbaa !11, !range !13, !noundef !14
  %94 = trunc i8 %93 to i1
  br i1 %94, label %96, label %95

95:                                               ; preds = %88, %81
  store i8 0, ptr %11, align 1, !tbaa !11
  br label %102

96:                                               ; preds = %88
  %97 = load i32, ptr %12, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [1000 x double], ptr @calc, i64 0, i64 %98
  %100 = load double, ptr %99, align 8, !tbaa !16
  %101 = fdiv double %100, 2.000000e+00
  store double %101, ptr %99, align 8, !tbaa !16
  br label %102

102:                                              ; preds = %96, %95
  br label %103

103:                                              ; preds = %102
  %104 = load i32, ptr %12, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %12, align 4, !tbaa !5
  br label %71, !llvm.loop !18

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

107:                                              ; preds = %202, %106
  %108 = load i32, ptr %13, align 4, !tbaa !5
  %109 = load i32, ptr %2, align 4, !tbaa !5
  %110 = icmp slt i32 %108, %109
  br i1 %110, label %112, label %111

111:                                              ; preds = %107
  store i32 11, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %205

112:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %113 = load i32, ptr %13, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [1000 x %"class.std::vector"], ptr @L, i64 0, i64 %114
  %116 = call noundef i64 @_ZNKSt6vectorI4edgeSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %115) #6
  %117 = sub i64 %116, 1
  %118 = trunc i64 %117 to i32
  store i32 %118, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  br label %119

119:                                              ; preds = %198, %112
  %120 = load i32, ptr %15, align 4, !tbaa !5
  %121 = icmp sge i32 %120, 0
  br i1 %121, label %123, label %122

122:                                              ; preds = %119
  store i32 14, ptr %14, align 4
  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 %201

123:                                              ; preds = %119
  %124 = load i32, ptr %13, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [1000 x %"class.std::vector"], ptr @L, i64 0, i64 %125
  %127 = load i32, ptr %15, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI4edgeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %126, i64 noundef %128) #6
  %130 = getelementptr inbounds %struct.edge, ptr %129, i32 0, i32 0
  %131 = load i32, ptr %130, align 4, !tbaa !19
  store i32 %131, ptr %16, align 4, !tbaa !5
  %132 = load i32, ptr %13, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [1000 x %"class.std::vector"], ptr @L, i64 0, i64 %133
  %135 = load i32, ptr %15, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI4edgeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %134, i64 noundef %136) #6
  %138 = getelementptr inbounds %struct.edge, ptr %137, i32 0, i32 1
  %139 = load i32, ptr %138, align 4, !tbaa !21
  store i32 %139, ptr %17, align 4, !tbaa !5
  %140 = load i32, ptr %13, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [1000 x [2 x i8]], ptr @visited, i64 0, i64 %141
  %143 = getelementptr inbounds [2 x i8], ptr %142, i64 0, i64 0
  %144 = load i8, ptr %143, align 2, !tbaa !11, !range !13, !noundef !14
  %145 = trunc i8 %144 to i1
  br i1 %145, label %146, label %168

146:                                              ; preds = %123
  %147 = load i32, ptr %16, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [1000 x [2 x i8]], ptr @visited, i64 0, i64 %148
  %150 = getelementptr inbounds [2 x i8], ptr %149, i64 0, i64 1
  %151 = load i8, ptr %150, align 1, !tbaa !11, !range !13, !noundef !14
  %152 = trunc i8 %151 to i1
  br i1 %152, label %153, label %168

153:                                              ; preds = %146
  %154 = load i32, ptr %17, align 4, !tbaa !5
  %155 = load i32, ptr %13, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [1000 x [2 x i32]], ptr @value, i64 0, i64 %156
  %158 = getelementptr inbounds [2 x i32], ptr %157, i64 0, i64 0
  %159 = load i32, ptr %158, align 8, !tbaa !5
  %160 = load i32, ptr %16, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [1000 x [2 x i32]], ptr @value, i64 0, i64 %161
  %163 = getelementptr inbounds [2 x i32], ptr %162, i64 0, i64 1
  %164 = load i32, ptr %163, align 4, !tbaa !5
  %165 = add nsw i32 %159, %164
  %166 = icmp ne i32 %154, %165
  br i1 %166, label %167, label %168

167:                                              ; preds = %153
  store i8 0, ptr %11, align 1, !tbaa !11
  br label %168

168:                                              ; preds = %167, %153, %146, %123
  %169 = load i32, ptr %13, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [1000 x [2 x i8]], ptr @visited, i64 0, i64 %170
  %172 = getelementptr inbounds [2 x i8], ptr %171, i64 0, i64 1
  %173 = load i8, ptr %172, align 1, !tbaa !11, !range !13, !noundef !14
  %174 = trunc i8 %173 to i1
  br i1 %174, label %175, label %197

175:                                              ; preds = %168
  %176 = load i32, ptr %16, align 4, !tbaa !5
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [1000 x [2 x i8]], ptr @visited, i64 0, i64 %177
  %179 = getelementptr inbounds [2 x i8], ptr %178, i64 0, i64 0
  %180 = load i8, ptr %179, align 2, !tbaa !11, !range !13, !noundef !14
  %181 = trunc i8 %180 to i1
  br i1 %181, label %182, label %197

182:                                              ; preds = %175
  %183 = load i32, ptr %17, align 4, !tbaa !5
  %184 = load i32, ptr %13, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [1000 x [2 x i32]], ptr @value, i64 0, i64 %185
  %187 = getelementptr inbounds [2 x i32], ptr %186, i64 0, i64 1
  %188 = load i32, ptr %187, align 4, !tbaa !5
  %189 = load i32, ptr %16, align 4, !tbaa !5
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [1000 x [2 x i32]], ptr @value, i64 0, i64 %190
  %192 = getelementptr inbounds [2 x i32], ptr %191, i64 0, i64 0
  %193 = load i32, ptr %192, align 8, !tbaa !5
  %194 = add nsw i32 %188, %193
  %195 = icmp ne i32 %183, %194
  br i1 %195, label %196, label %197

196:                                              ; preds = %182
  store i8 0, ptr %11, align 1, !tbaa !11
  br label %197

197:                                              ; preds = %196, %182, %175, %168
  br label %198

198:                                              ; preds = %197
  %199 = load i32, ptr %15, align 4, !tbaa !5
  %200 = add nsw i32 %199, -1
  store i32 %200, ptr %15, align 4, !tbaa !5
  br label %119, !llvm.loop !22

201:                                              ; preds = %122
  br label %202

202:                                              ; preds = %201
  %203 = load i32, ptr %13, align 4, !tbaa !5
  %204 = add nsw i32 %203, 1
  store i32 %204, ptr %13, align 4, !tbaa !5
  br label %107, !llvm.loop !23

205:                                              ; preds = %111
  %206 = load i8, ptr %11, align 1, !tbaa !11, !range !13, !noundef !14
  %207 = trunc i8 %206 to i1
  br i1 %207, label %210, label %208

208:                                              ; preds = %205
  %209 = call i32 @puts(ptr noundef @.str.2)
  br label %226

210:                                              ; preds = %205
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %211

211:                                              ; preds = %222, %210
  %212 = load i32, ptr %18, align 4, !tbaa !5
  %213 = load i32, ptr %2, align 4, !tbaa !5
  %214 = icmp slt i32 %212, %213
  br i1 %214, label %216, label %215

215:                                              ; preds = %211
  store i32 17, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %225

216:                                              ; preds = %211
  %217 = load i32, ptr %18, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [1000 x double], ptr @calc, i64 0, i64 %218
  %220 = load double, ptr %219, align 8, !tbaa !16
  %221 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, double noundef %220)
  br label %222

222:                                              ; preds = %216
  %223 = load i32, ptr %18, align 4, !tbaa !5
  %224 = add nsw i32 %223, 1
  store i32 %224, ptr %18, align 4, !tbaa !5
  br label %211, !llvm.loop !24

225:                                              ; preds = %215
  br label %226

226:                                              ; preds = %225, %208
  store i32 0, ptr %1, align 4
  store i32 1, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %227 = load i32, ptr %1, align 4
  ret i32 %227
}

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

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

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

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

declare i32 @puts(ptr noundef) #4

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !10}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !7, i64 0}
!18 = distinct !{!18, !10}
!19 = !{!20, !6, i64 0}
!20 = !{!"_ZTS4edge", !6, i64 0, !6, i64 4}
!21 = !{!20, !6, i64 4}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !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<edge, std::allocator<edge>>::_Vector_impl" }
%"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl" = type { %"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl_data" }
%"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.edge = type { i32, i32 }

@L = external dso_local global [1000 x %"class.std::vector"], align 16
@visited = external dso_local local_unnamed_addr global [1000 x [2 x i8]], align 16
@value = external dso_local local_unnamed_addr global [1000 x [2 x i32]], align 16
@calc = external dso_local local_unnamed_addr global [1000 x double], align 16
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsiii(i32 noundef, 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 nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI4edgeSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI4edgeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 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 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 %struct.edge, align 4
  %7 = alloca %struct.edge, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %9 = load i32, ptr %2, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2000) @visited, i8 0, i64 2000, i1 false)
  %11 = load i32, ptr %1, align 4, !tbaa !5
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph50, label %.loopexit

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.03747 = phi i32 [ %26, %.lr.ph ], [ 0, %0 ]
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %14 = load i32, ptr %3, align 4, !tbaa !5
  %15 = add nsw i32 %14, -1
  store i32 %15, ptr %3, align 4, !tbaa !5
  %16 = load i32, ptr %4, align 4, !tbaa !5
  %17 = add nsw i32 %16, -1
  store i32 %17, ptr %4, align 4, !tbaa !5
  %18 = sext i32 %15 to i64
  %19 = getelementptr inbounds [1000 x %"class.std::vector"], ptr @L, i64 0, i64 %18
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %20 = load i32, ptr %5, align 4, !tbaa !5
  call void @_ZN4edgeC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %6, i32 noundef %17, i32 noundef %20)
  call void @_ZNSt6vectorI4edgeSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [1000 x %"class.std::vector"], ptr @L, i64 0, i64 %22
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %24 = load i32, ptr %3, align 4, !tbaa !5
  %25 = load i32, ptr %5, align 4, !tbaa !5
  call void @_ZN4edgeC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %7, i32 noundef %24, i32 noundef %25)
  call void @_ZNSt6vectorI4edgeSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %23, ptr noundef nonnull align 4 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  %26 = add nuw nsw i32 %.03747, 1
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader46:                                     ; preds = %41
  %29 = icmp sgt i32 %42, 0
  br i1 %29, label %.lr.ph53.preheader, label %.loopexit

.lr.ph53.preheader:                               ; preds = %.preheader46
  %30 = zext nneg i32 %42 to i64
  br label %.lr.ph53

.lr.ph50:                                         ; preds = %._crit_edge, %41
  %31 = phi i32 [ %42, %41 ], [ %11, %._crit_edge ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %41 ], [ 0, %._crit_edge ]
  %32 = getelementptr inbounds [1000 x [2 x i8]], ptr @visited, i64 0, i64 %indvars.iv
  %33 = load i8, ptr %32, align 2, !tbaa !11, !range !13, !noundef !14
  %34 = trunc nuw i8 %33 to i1
  br i1 %34, label %41, label %35

35:                                               ; preds = %.lr.ph50
  %36 = getelementptr inbounds i8, ptr %32, i64 1
  %37 = load i8, ptr %36, align 1, !tbaa !11, !range !13, !noundef !14
  %38 = trunc nuw i8 %37 to i1
  br i1 %38, label %41, label %39

39:                                               ; preds = %35
  %40 = trunc nuw nsw i64 %indvars.iv to i32
  call void @_Z3dfsiii(i32 noundef %40, i32 noundef 0, i32 noundef 0)
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %.lr.ph50, %35, %39
  %42 = phi i32 [ %31, %.lr.ph50 ], [ %31, %35 ], [ %.pre, %39 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %43 = sext i32 %42 to i64
  %44 = icmp slt i64 %indvars.iv.next, %43
  br i1 %44, label %.lr.ph50, label %.preheader46, !llvm.loop !15

.preheader45:                                     ; preds = %52
  br i1 %29, label %.lr.ph64.preheader, label %._crit_edge65

.lr.ph64.preheader:                               ; preds = %.thread, %.preheader45
  %.262.ph = phi i8 [ 1, %.preheader45 ], [ 0, %.thread ]
  br label %.lr.ph64

.lr.ph53:                                         ; preds = %.lr.ph53.preheader, %52
  %indvars.iv71 = phi i64 [ 0, %.lr.ph53.preheader ], [ %indvars.iv.next72, %52 ]
  %45 = getelementptr inbounds [1000 x [2 x i8]], ptr @visited, i64 0, i64 %indvars.iv71
  %46 = load i8, ptr %45, align 2, !tbaa !11, !range !13, !noundef !14
  %47 = trunc nuw i8 %46 to i1
  br i1 %47, label %48, label %.thread

48:                                               ; preds = %.lr.ph53
  %49 = getelementptr inbounds i8, ptr %45, i64 1
  %50 = load i8, ptr %49, align 1, !tbaa !11, !range !13, !noundef !14
  %51 = trunc nuw i8 %50 to i1
  br i1 %51, label %52, label %.thread

.thread:                                          ; preds = %48, %.lr.ph53
  br i1 %29, label %.lr.ph64.preheader, label %._crit_edge65.thread85

52:                                               ; preds = %48
  %53 = getelementptr inbounds [1000 x double], ptr @calc, i64 0, i64 %indvars.iv71
  %54 = load double, ptr %53, align 8, !tbaa !16
  %55 = fmul double %54, 5.000000e-01
  store double %55, ptr %53, align 8, !tbaa !16
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %56 = icmp ult i64 %indvars.iv.next72, %30
  br i1 %56, label %.lr.ph53, label %.preheader45, !llvm.loop !18

._crit_edge65.loopexit:                           ; preds = %._crit_edge60
  %57 = icmp sgt i32 %69, 0
  %58 = trunc nuw i8 %.3.lcssa to i1
  br label %._crit_edge65

._crit_edge65:                                    ; preds = %._crit_edge65.loopexit, %.preheader45
  %59 = phi i1 [ false, %.preheader45 ], [ %57, %._crit_edge65.loopexit ]
  %.2.lcssa = phi i1 [ true, %.preheader45 ], [ %58, %._crit_edge65.loopexit ]
  br i1 %.2.lcssa, label %.preheader, label %._crit_edge65.thread85

.preheader:                                       ; preds = %._crit_edge65
  br i1 %59, label %.lr.ph68, label %.loopexit

.lr.ph64:                                         ; preds = %.lr.ph64.preheader, %._crit_edge60
  %indvars.iv75 = phi i64 [ %indvars.iv.next76, %._crit_edge60 ], [ 0, %.lr.ph64.preheader ]
  %.262 = phi i8 [ %.3.lcssa, %._crit_edge60 ], [ %.262.ph, %.lr.ph64.preheader ]
  %60 = getelementptr inbounds [1000 x %"class.std::vector"], ptr @L, i64 0, i64 %indvars.iv75
  %61 = call noundef i64 @_ZNKSt6vectorI4edgeSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %60) #6
  %62 = trunc i64 %61 to i32
  %.03855 = add i32 %62, -1
  %63 = icmp sgt i32 %.03855, -1
  br i1 %63, label %.lr.ph59, label %._crit_edge60

.lr.ph59:                                         ; preds = %.lr.ph64
  %64 = getelementptr inbounds [1000 x [2 x i8]], ptr @visited, i64 0, i64 %indvars.iv75
  %65 = getelementptr inbounds [1000 x [2 x i32]], ptr @value, i64 0, i64 %indvars.iv75
  %66 = getelementptr inbounds i8, ptr %64, i64 1
  %67 = getelementptr inbounds [1000 x [2 x i32]], ptr @value, i64 0, i64 %indvars.iv75, i64 1
  %68 = zext nneg i32 %.03855 to i64
  br label %72

._crit_edge60:                                    ; preds = %103, %.lr.ph64
  %.3.lcssa = phi i8 [ %.262, %.lr.ph64 ], [ %.5, %103 ]
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %69 = load i32, ptr %1, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = icmp slt i64 %indvars.iv.next76, %70
  br i1 %71, label %.lr.ph64, label %._crit_edge65.loopexit, !llvm.loop !19

72:                                               ; preds = %.lr.ph59, %103
  %indvars.iv73 = phi i64 [ %68, %.lr.ph59 ], [ %indvars.iv.next74, %103 ]
  %.356 = phi i8 [ %.262, %.lr.ph59 ], [ %.5, %103 ]
  %73 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI4edgeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %60, i64 noundef %indvars.iv73) #6
  %74 = load i32, ptr %73, align 4, !tbaa !20
  %75 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI4edgeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %60, i64 noundef %indvars.iv73) #6
  %76 = getelementptr inbounds i8, ptr %75, i64 4
  %77 = load i32, ptr %76, align 4, !tbaa !22
  %78 = load i8, ptr %64, align 2, !tbaa !11, !range !13, !noundef !14
  %79 = trunc nuw i8 %78 to i1
  br i1 %79, label %80, label %90

80:                                               ; preds = %72
  %81 = sext i32 %74 to i64
  %82 = getelementptr inbounds [1000 x [2 x i8]], ptr @visited, i64 0, i64 %81, i64 1
  %83 = load i8, ptr %82, align 1, !tbaa !11, !range !13, !noundef !14
  %84 = trunc nuw i8 %83 to i1
  br i1 %84, label %85, label %90

85:                                               ; preds = %80
  %86 = load i32, ptr %65, align 8, !tbaa !5
  %87 = getelementptr inbounds [1000 x [2 x i32]], ptr @value, i64 0, i64 %81, i64 1
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = add nsw i32 %88, %86
  %.not = icmp eq i32 %77, %89
  %spec.select = select i1 %.not, i8 %.356, i8 0
  br label %90

90:                                               ; preds = %85, %80, %72
  %.4 = phi i8 [ %.356, %80 ], [ %.356, %72 ], [ %spec.select, %85 ]
  %91 = load i8, ptr %66, align 1, !tbaa !11, !range !13, !noundef !14
  %92 = trunc nuw i8 %91 to i1
  br i1 %92, label %93, label %103

93:                                               ; preds = %90
  %94 = sext i32 %74 to i64
  %95 = getelementptr inbounds [1000 x [2 x i8]], ptr @visited, i64 0, i64 %94
  %96 = load i8, ptr %95, align 2, !tbaa !11, !range !13, !noundef !14
  %97 = trunc nuw i8 %96 to i1
  br i1 %97, label %98, label %103

98:                                               ; preds = %93
  %99 = load i32, ptr %67, align 4, !tbaa !5
  %100 = getelementptr inbounds [1000 x [2 x i32]], ptr @value, i64 0, i64 %94
  %101 = load i32, ptr %100, align 8, !tbaa !5
  %102 = add nsw i32 %101, %99
  %.not43 = icmp eq i32 %77, %102
  %spec.select44 = select i1 %.not43, i8 %.4, i8 0
  br label %103

103:                                              ; preds = %98, %90, %93
  %.5 = phi i8 [ %.4, %93 ], [ %.4, %90 ], [ %spec.select44, %98 ]
  %indvars.iv.next74 = add nsw i64 %indvars.iv73, -1
  %104 = icmp sgt i64 %indvars.iv73, 0
  br i1 %104, label %72, label %._crit_edge60, !llvm.loop !23

._crit_edge65.thread85:                           ; preds = %.thread, %._crit_edge65
  %105 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %.loopexit

.lr.ph68:                                         ; preds = %.preheader, %.lr.ph68
  %indvars.iv77 = phi i64 [ %indvars.iv.next78, %.lr.ph68 ], [ 0, %.preheader ]
  %106 = getelementptr inbounds [1000 x double], ptr @calc, i64 0, i64 %indvars.iv77
  %107 = load double, ptr %106, align 8, !tbaa !16
  %108 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %107)
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %109 = load i32, ptr %1, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = icmp slt i64 %indvars.iv.next78, %110
  br i1 %111, label %.lr.ph68, label %.loopexit, !llvm.loop !24

.loopexit:                                        ; preds = %.lr.ph68, %._crit_edge, %.preheader46, %.preheader, %._crit_edge65.thread85
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0
}

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

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

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

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

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !10}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !7, i64 0}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = !{!21, !6, i64 0}
!21 = !{!"_ZTS4edge", !6, i64 0, !6, i64 4}
!22 = !{!21, !6, i64 4}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}


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