; LLVM IR from reyadussalahin/problem-solving :: graph/scc/loj/F1210 (Solution)

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

@edges = external dso_local global [50000 x %struct.Edge], align 16
@ec = external dso_local global i32, align 4
@list = external dso_local global [20000 x i32], align 16
@visited = external dso_local global [20000 x i32], align 16
@inPath = external dso_local global [20000 x i32], align 16
@top = external dso_local global i32, align 4
@timer = external dso_local global i32, align 4
@nscc = external dso_local global i32, align 4
@component = external dso_local global [20000 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @dfs(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: nounwind uwtable
define dso_local i32 @main() #0 {
  %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 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 [20000 x i32], align 16
  %15 = alloca [20000 x i32], align 16
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 80000, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 80000, ptr %15) #3
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %4)
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %181, %0
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %21, label %184

21:                                               ; preds = %17
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %5, ptr noundef %6)
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %43, %21
  %24 = load i32, ptr %7, align 4, !tbaa !5
  %25 = load i32, ptr %5, align 4, !tbaa !5
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %27, label %46

27:                                               ; preds = %23
  %28 = load i32, ptr %7, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [20000 x i32], ptr @list, i64 0, i64 %29
  store i32 -1, ptr %30, align 4, !tbaa !5
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [20000 x i32], ptr @visited, i64 0, i64 %32
  store i32 0, ptr %33, align 4, !tbaa !5
  %34 = load i32, ptr %7, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [20000 x i32], ptr @inPath, i64 0, i64 %35
  store i32 1, ptr %36, align 4, !tbaa !5
  %37 = load i32, ptr %7, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [20000 x i32], ptr %14, i64 0, i64 %38
  store i32 0, ptr %39, align 4, !tbaa !5
  %40 = load i32, ptr %7, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [20000 x i32], ptr %15, i64 0, i64 %41
  store i32 0, ptr %42, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %27
  %44 = load i32, ptr %7, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %7, align 4, !tbaa !5
  br label %23, !llvm.loop !9

46:                                               ; preds = %23
  store i32 0, ptr @ec, align 4, !tbaa !5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %57, %46
  %48 = load i32, ptr %7, align 4, !tbaa !5
  %49 = load i32, ptr %6, align 4, !tbaa !5
  %50 = icmp slt i32 %48, %49
  br i1 %50, label %51, label %60

51:                                               ; preds = %47
  %52 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %9, ptr noundef %10)
  %53 = load i32, ptr %9, align 4, !tbaa !5
  %54 = sub nsw i32 %53, 1
  %55 = load i32, ptr %10, align 4, !tbaa !5
  %56 = sub nsw i32 %55, 1
  call void @add_edge(i32 noundef %54, i32 noundef %56)
  br label %57

57:                                               ; preds = %51
  %58 = load i32, ptr %7, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %7, align 4, !tbaa !5
  br label %47, !llvm.loop !11

60:                                               ; preds = %47
  store i32 0, ptr @nscc, align 4, !tbaa !5
  store i32 0, ptr @timer, align 4, !tbaa !5
  store i32 0, ptr @top, align 4, !tbaa !5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %75, %60
  %62 = load i32, ptr %7, align 4, !tbaa !5
  %63 = load i32, ptr %5, align 4, !tbaa !5
  %64 = icmp slt i32 %62, %63
  br i1 %64, label %65, label %78

65:                                               ; preds = %61
  %66 = load i32, ptr %7, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [20000 x i32], ptr @visited, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = icmp ne i32 %69, 0
  br i1 %70, label %74, label %71

71:                                               ; preds = %65
  %72 = load i32, ptr %7, align 4, !tbaa !5
  %73 = call i32 @dfs(i32 noundef %72)
  br label %74

74:                                               ; preds = %71, %65
  br label %75

75:                                               ; preds = %74
  %76 = load i32, ptr %7, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %7, align 4, !tbaa !5
  br label %61, !llvm.loop !12

78:                                               ; preds = %61
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %133, %78
  %80 = load i32, ptr %7, align 4, !tbaa !5
  %81 = load i32, ptr %5, align 4, !tbaa !5
  %82 = icmp slt i32 %80, %81
  br i1 %82, label %83, label %136

83:                                               ; preds = %79
  %84 = load i32, ptr %7, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [20000 x i32], ptr @list, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  store i32 %87, ptr %13, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %126, %83
  %89 = load i32, ptr %13, align 4, !tbaa !5
  %90 = icmp ne i32 %89, -1
  br i1 %90, label %91, label %132

91:                                               ; preds = %88
  %92 = load i32, ptr %7, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [20000 x i32], ptr @component, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = load i32, ptr %13, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [50000 x %struct.Edge], ptr @edges, i64 0, i64 %97
  %99 = getelementptr inbounds %struct.Edge, ptr %98, i32 0, i32 0
  %100 = load i32, ptr %99, align 8, !tbaa !13
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [20000 x i32], ptr @component, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = icmp ne i32 %95, %103
  br i1 %104, label %105, label %126

105:                                              ; preds = %91
  %106 = load i32, ptr %7, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [20000 x i32], ptr @component, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [20000 x i32], ptr %15, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %111, align 4, !tbaa !5
  %114 = load i32, ptr %13, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [50000 x %struct.Edge], ptr @edges, i64 0, i64 %115
  %117 = getelementptr inbounds %struct.Edge, ptr %116, i32 0, i32 0
  %118 = load i32, ptr %117, align 8, !tbaa !13
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [20000 x i32], ptr @component, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [20000 x i32], ptr %14, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %123, align 4, !tbaa !5
  br label %126

126:                                              ; preds = %105, %91
  %127 = load i32, ptr %13, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [50000 x %struct.Edge], ptr @edges, i64 0, i64 %128
  %130 = getelementptr inbounds %struct.Edge, ptr %129, i32 0, i32 1
  %131 = load i32, ptr %130, align 4, !tbaa !15
  store i32 %131, ptr %13, align 4, !tbaa !5
  br label %88, !llvm.loop !16

132:                                              ; preds = %88
  br label %133

133:                                              ; preds = %132
  %134 = load i32, ptr %7, align 4, !tbaa !5
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %7, align 4, !tbaa !5
  br label %79, !llvm.loop !17

136:                                              ; preds = %79
  store i32 0, ptr %12, align 4, !tbaa !5
  store i32 0, ptr %11, align 4, !tbaa !5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %137

137:                                              ; preds = %160, %136
  %138 = load i32, ptr %7, align 4, !tbaa !5
  %139 = load i32, ptr @nscc, align 4, !tbaa !5
  %140 = icmp slt i32 %138, %139
  br i1 %140, label %141, label %163

141:                                              ; preds = %137
  %142 = load i32, ptr %7, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [20000 x i32], ptr %14, i64 0, i64 %143
  %145 = load i32, ptr %144, align 4, !tbaa !5
  %146 = icmp eq i32 %145, 0
  br i1 %146, label %147, label %150

147:                                              ; preds = %141
  %148 = load i32, ptr %11, align 4, !tbaa !5
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %11, align 4, !tbaa !5
  br label %150

150:                                              ; preds = %147, %141
  %151 = load i32, ptr %7, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [20000 x i32], ptr %15, i64 0, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !5
  %155 = icmp eq i32 %154, 0
  br i1 %155, label %156, label %159

156:                                              ; preds = %150
  %157 = load i32, ptr %12, align 4, !tbaa !5
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr %12, align 4, !tbaa !5
  br label %159

159:                                              ; preds = %156, %150
  br label %160

160:                                              ; preds = %159
  %161 = load i32, ptr %7, align 4, !tbaa !5
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %7, align 4, !tbaa !5
  br label %137, !llvm.loop !18

163:                                              ; preds = %137
  %164 = load i32, ptr %11, align 4, !tbaa !5
  %165 = load i32, ptr %12, align 4, !tbaa !5
  %166 = icmp sgt i32 %164, %165
  br i1 %166, label %167, label %169

167:                                              ; preds = %163
  %168 = load i32, ptr %11, align 4, !tbaa !5
  br label %171

169:                                              ; preds = %163
  %170 = load i32, ptr %12, align 4, !tbaa !5
  br label %171

171:                                              ; preds = %169, %167
  %172 = phi i32 [ %168, %167 ], [ %170, %169 ]
  store i32 %172, ptr %2, align 4, !tbaa !5
  %173 = load i32, ptr @nscc, align 4, !tbaa !5
  %174 = icmp eq i32 %173, 1
  br i1 %174, label %175, label %176

175:                                              ; preds = %171
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %176

176:                                              ; preds = %175, %171
  %177 = load i32, ptr %3, align 4, !tbaa !5
  %178 = add nsw i32 %177, 1
  %179 = load i32, ptr %2, align 4, !tbaa !5
  %180 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %178, i32 noundef %179)
  br label %181

181:                                              ; preds = %176
  %182 = load i32, ptr %3, align 4, !tbaa !5
  %183 = add nsw i32 %182, 1
  store i32 %183, ptr %3, align 4, !tbaa !5
  br label %17, !llvm.loop !19

184:                                              ; preds = %17
  call void @llvm.lifetime.end.p0(i64 80000, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 80000, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  ret i32 0
}

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

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

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


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

%struct.Edge = type { i32, i32 }

@edges = external dso_local local_unnamed_addr global [50000 x %struct.Edge], align 16
@ec = external dso_local local_unnamed_addr global i32, align 4
@list = external dso_local local_unnamed_addr global [20000 x i32], align 16
@visited = external dso_local local_unnamed_addr global [20000 x i32], align 16
@inPath = external dso_local local_unnamed_addr global [20000 x i32], align 16
@top = external dso_local local_unnamed_addr global i32, align 4
@timer = external dso_local local_unnamed_addr global i32, align 4
@nscc = external dso_local local_unnamed_addr global i32, align 4
@component = external dso_local local_unnamed_addr global [20000 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @dfs(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: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %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 [20000 x i32], align 16
  %7 = alloca [20000 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  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 @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 80000, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 80000, ptr nonnull %7) #5
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %9 = load i32, ptr %1, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph74, label %._crit_edge75

.lr.ph74:                                         ; preds = %0, %._crit_edge68.thread
  %.03972 = phi i32 [ %95, %._crit_edge68.thread ], [ 0, %0 ]
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.lr.ph74
  %14 = zext nneg i32 %12 to i64
  %15 = shl nuw nsw i64 %14, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @list, i8 -1, i64 %15, i1 false), !tbaa !5
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @visited, i8 0, i64 %15, i1 false), !tbaa !5
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %6, i8 0, i64 %15, i1 false), !tbaa !5
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %7, i8 0, i64 %15, i1 false), !tbaa !5
  %min.iters.check107 = icmp ult i32 %12, 8
  br i1 %min.iters.check107, label %.lr.ph.preheader117, label %vector.ph108

vector.ph108:                                     ; preds = %.lr.ph.preheader
  %n.vec110 = and i64 %14, 2147483640
  br label %vector.body112

vector.body112:                                   ; preds = %vector.body112, %vector.ph108
  %index113 = phi i64 [ 0, %vector.ph108 ], [ %index.next114, %vector.body112 ]
  %16 = getelementptr inbounds [20000 x i32], ptr @inPath, i64 0, i64 %index113
  %17 = getelementptr inbounds i8, ptr %16, i64 16
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %16, align 16, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %17, align 16, !tbaa !5
  %index.next114 = add nuw i64 %index113, 8
  %18 = icmp eq i64 %index.next114, %n.vec110
  br i1 %18, label %middle.block105, label %vector.body112, !llvm.loop !9

middle.block105:                                  ; preds = %vector.body112
  %cmp.n115 = icmp eq i64 %n.vec110, %14
  br i1 %cmp.n115, label %._crit_edge, label %.lr.ph.preheader117

.lr.ph.preheader117:                              ; preds = %middle.block105, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec110, %middle.block105 ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader117, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader117 ]
  %19 = getelementptr inbounds [20000 x i32], ptr @inPath, i64 0, i64 %indvars.iv
  store i32 1, ptr %19, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %14
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph, %middle.block105, %.lr.ph74
  store i32 0, ptr @ec, align 4, !tbaa !5
  %20 = load i32, ptr %3, align 4, !tbaa !5
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph51, label %._crit_edge52

.lr.ph51:                                         ; preds = %._crit_edge, %.lr.ph51
  %.14149 = phi i32 [ %27, %.lr.ph51 ], [ 0, %._crit_edge ]
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = add nsw i32 %23, -1
  %25 = load i32, ptr %5, align 4, !tbaa !5
  %26 = add nsw i32 %25, -1
  call void @add_edge(i32 noundef %24, i32 noundef %26)
  %27 = add nuw nsw i32 %.14149, 1
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %.lr.ph51, label %._crit_edge52.loopexit, !llvm.loop !14

._crit_edge52.loopexit:                           ; preds = %.lr.ph51
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  br label %._crit_edge52

._crit_edge52:                                    ; preds = %._crit_edge52.loopexit, %._crit_edge
  %30 = phi i32 [ %.pre, %._crit_edge52.loopexit ], [ %12, %._crit_edge ]
  store i32 0, ptr @nscc, align 4, !tbaa !5
  store i32 0, ptr @timer, align 4, !tbaa !5
  store i32 0, ptr @top, align 4, !tbaa !5
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.lr.ph55, label %._crit_edge68.thread

.preheader46:                                     ; preds = %39
  %32 = icmp sgt i32 %40, 0
  br i1 %32, label %.lr.ph63.preheader, label %.preheader

.lr.ph63.preheader:                               ; preds = %.preheader46
  %wide.trip.count84 = zext nneg i32 %40 to i64
  br label %.lr.ph63

.lr.ph55:                                         ; preds = %._crit_edge52, %39
  %33 = phi i32 [ %40, %39 ], [ %30, %._crit_edge52 ]
  %indvars.iv78 = phi i64 [ %indvars.iv.next79, %39 ], [ 0, %._crit_edge52 ]
  %34 = getelementptr inbounds [20000 x i32], ptr @visited, i64 0, i64 %indvars.iv78
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %.not45 = icmp eq i32 %35, 0
  br i1 %.not45, label %36, label %39

36:                                               ; preds = %.lr.ph55
  %37 = trunc nuw nsw i64 %indvars.iv78 to i32
  %38 = call i32 @dfs(i32 noundef %37)
  %.pre91 = load i32, ptr %2, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %.lr.ph55, %36
  %40 = phi i32 [ %33, %.lr.ph55 ], [ %.pre91, %36 ]
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %41 = sext i32 %40 to i64
  %42 = icmp slt i64 %indvars.iv.next79, %41
  br i1 %42, label %.lr.ph55, label %.preheader46, !llvm.loop !15

.preheader:                                       ; preds = %._crit_edge61, %.preheader46
  %.pr = load i32, ptr @nscc, align 4, !tbaa !5
  %.pr.fr = freeze i32 %.pr
  %43 = icmp sgt i32 %.pr.fr, 0
  br i1 %43, label %.lr.ph67.preheader, label %._crit_edge68.thread

.lr.ph67.preheader:                               ; preds = %.preheader
  %wide.trip.count89 = zext nneg i32 %.pr.fr to i64
  %min.iters.check = icmp ult i32 %.pr.fr, 8
  br i1 %min.iters.check, label %.lr.ph67.preheader116, label %vector.ph

.lr.ph67.preheader116:                            ; preds = %middle.block, %.lr.ph67.preheader
  %indvars.iv86.ph = phi i64 [ 0, %.lr.ph67.preheader ], [ %n.vec, %middle.block ]
  %.03666.ph = phi i32 [ 0, %.lr.ph67.preheader ], [ %61, %middle.block ]
  %.03765.ph = phi i32 [ 0, %.lr.ph67.preheader ], [ %62, %middle.block ]
  br label %.lr.ph67

vector.ph:                                        ; preds = %.lr.ph67.preheader
  %n.vec = and i64 %wide.trip.count89, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %58, %vector.body ]
  %vec.phi97 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %59, %vector.body ]
  %vec.phi98 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %50, %vector.body ]
  %vec.phi99 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %51, %vector.body ]
  %44 = getelementptr inbounds [20000 x i32], ptr %6, i64 0, i64 %index
  %45 = getelementptr inbounds i8, ptr %44, i64 16
  %wide.load = load <4 x i32>, ptr %44, align 16, !tbaa !5
  %wide.load100 = load <4 x i32>, ptr %45, align 16, !tbaa !5
  %46 = icmp eq <4 x i32> %wide.load, zeroinitializer
  %47 = icmp eq <4 x i32> %wide.load100, zeroinitializer
  %48 = zext <4 x i1> %46 to <4 x i32>
  %49 = zext <4 x i1> %47 to <4 x i32>
  %50 = add <4 x i32> %vec.phi98, %48
  %51 = add <4 x i32> %vec.phi99, %49
  %52 = getelementptr inbounds [20000 x i32], ptr %7, i64 0, i64 %index
  %53 = getelementptr inbounds i8, ptr %52, i64 16
  %wide.load101 = load <4 x i32>, ptr %52, align 16, !tbaa !5
  %wide.load102 = load <4 x i32>, ptr %53, align 16, !tbaa !5
  %54 = icmp eq <4 x i32> %wide.load101, zeroinitializer
  %55 = icmp eq <4 x i32> %wide.load102, zeroinitializer
  %56 = zext <4 x i1> %54 to <4 x i32>
  %57 = zext <4 x i1> %55 to <4 x i32>
  %58 = add <4 x i32> %vec.phi, %56
  %59 = add <4 x i32> %vec.phi97, %57
  %index.next = add nuw i64 %index, 8
  %60 = icmp eq i64 %index.next, %n.vec
  br i1 %60, label %middle.block, label %vector.body, !llvm.loop !16

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %59, %58
  %61 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %bin.rdx103 = add <4 x i32> %51, %50
  %62 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx103)
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count89
  br i1 %cmp.n, label %._crit_edge68, label %.lr.ph67.preheader116

.lr.ph63:                                         ; preds = %.lr.ph63.preheader, %._crit_edge61
  %indvars.iv81 = phi i64 [ 0, %.lr.ph63.preheader ], [ %indvars.iv.next82, %._crit_edge61 ]
  %63 = getelementptr inbounds [20000 x i32], ptr @list, i64 0, i64 %indvars.iv81
  %.056 = load i32, ptr %63, align 4, !tbaa !5
  %.not57 = icmp eq i32 %.056, -1
  br i1 %.not57, label %._crit_edge61, label %.lr.ph60

.lr.ph60:                                         ; preds = %.lr.ph63
  %64 = getelementptr inbounds [20000 x i32], ptr @component, i64 0, i64 %indvars.iv81
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [20000 x i32], ptr %7, i64 0, i64 %66
  br label %68

68:                                               ; preds = %.lr.ph60, %82
  %.058 = phi i32 [ %.056, %.lr.ph60 ], [ %.0, %82 ]
  %69 = sext i32 %.058 to i64
  %70 = getelementptr inbounds [50000 x %struct.Edge], ptr @edges, i64 0, i64 %69
  %71 = load i32, ptr %70, align 8, !tbaa !17
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [20000 x i32], ptr @component, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %.not44 = icmp eq i32 %65, %74
  br i1 %.not44, label %82, label %75

75:                                               ; preds = %68
  %76 = load i32, ptr %67, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %67, align 4, !tbaa !5
  %78 = sext i32 %74 to i64
  %79 = getelementptr inbounds [20000 x i32], ptr %6, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %79, align 4, !tbaa !5
  br label %82

82:                                               ; preds = %75, %68
  %83 = getelementptr inbounds i8, ptr %70, i64 4
  %.0 = load i32, ptr %83, align 4, !tbaa !5
  %.not = icmp eq i32 %.0, -1
  br i1 %.not, label %._crit_edge61, label %68, !llvm.loop !19

._crit_edge61:                                    ; preds = %82, %.lr.ph63
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %exitcond85.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count84
  br i1 %exitcond85.not, label %.preheader, label %.lr.ph63, !llvm.loop !20

.lr.ph67:                                         ; preds = %.lr.ph67.preheader116, %.lr.ph67
  %indvars.iv86 = phi i64 [ %indvars.iv.next87, %.lr.ph67 ], [ %indvars.iv86.ph, %.lr.ph67.preheader116 ]
  %.03666 = phi i32 [ %.1, %.lr.ph67 ], [ %.03666.ph, %.lr.ph67.preheader116 ]
  %.03765 = phi i32 [ %spec.select, %.lr.ph67 ], [ %.03765.ph, %.lr.ph67.preheader116 ]
  %84 = getelementptr inbounds [20000 x i32], ptr %6, i64 0, i64 %indvars.iv86
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = icmp eq i32 %85, 0
  %87 = zext i1 %86 to i32
  %spec.select = add nuw nsw i32 %.03765, %87
  %88 = getelementptr inbounds [20000 x i32], ptr %7, i64 0, i64 %indvars.iv86
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = icmp eq i32 %89, 0
  %91 = zext i1 %90 to i32
  %.1 = add nuw nsw i32 %.03666, %91
  %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
  %exitcond90.not = icmp eq i64 %indvars.iv.next87, %wide.trip.count89
  br i1 %exitcond90.not, label %._crit_edge68, label %.lr.ph67, !llvm.loop !21

._crit_edge68:                                    ; preds = %.lr.ph67, %middle.block
  %spec.select.lcssa = phi i32 [ %62, %middle.block ], [ %spec.select, %.lr.ph67 ]
  %.1.lcssa = phi i32 [ %61, %middle.block ], [ %.1, %.lr.ph67 ]
  %92 = call i32 @llvm.smax.i32(i32 %spec.select.lcssa, i32 %.1.lcssa)
  %93 = icmp eq i32 %.pr.fr, 1
  %spec.select96 = select i1 %93, i32 0, i32 %92
  br label %._crit_edge68.thread

._crit_edge68.thread:                             ; preds = %._crit_edge68, %._crit_edge52, %.preheader
  %94 = phi i32 [ 0, %.preheader ], [ 0, %._crit_edge52 ], [ %spec.select96, %._crit_edge68 ]
  %95 = add nuw nsw i32 %.03972, 1
  %96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %95, i32 noundef %94)
  %97 = load i32, ptr %1, align 4, !tbaa !5
  %98 = icmp slt i32 %95, %97
  br i1 %98, label %.lr.ph74, label %._crit_edge75, !llvm.loop !22

._crit_edge75:                                    ; preds = %._crit_edge68.thread, %0
  call void @llvm.lifetime.end.p0(i64 80000, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 80000, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  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
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0
}

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3

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

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

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


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass