; LLVM IR from tangjz/acm-icpc :: lydsy (1718)

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

@e = external dso_local global [23333 x %struct.Edge], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@lnk = external dso_local global [6666 x i32], align 16
@cnt = external dso_local global i32, align 4
@bcc = external dso_local global [6666 x i32], align 16
@d = external dso_local global [6666 x i32], align 16
@ans = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %struct.Edge, align 4
  %5 = alloca %struct.Edge, 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
  store i32 0, ptr %1, align 4
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.memset.p0.i64(ptr align 16 @lnk, i8 -1, i64 26664, i1 false)
  br label %12

12:                                               ; preds = %16, %0
  %13 = load i32, ptr @m, align 4, !tbaa !5
  %14 = add nsw i32 %13, -1
  store i32 %14, ptr @m, align 4, !tbaa !5
  %15 = icmp ne i32 %13, 0
  br i1 %15, label %16, label %48

16:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %18 = getelementptr inbounds %struct.Edge, ptr %4, i32 0, i32 0
  %19 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %19, ptr %18, align 4, !tbaa !9
  %20 = getelementptr inbounds %struct.Edge, ptr %4, i32 0, i32 1
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [6666 x i32], ptr @lnk, i64 0, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !5
  store i32 %24, ptr %20, align 4, !tbaa !11
  %25 = load i32, ptr @tot, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [23333 x %struct.Edge], ptr @e, i64 0, i64 %26
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %27, ptr align 4 %4, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  %28 = load i32, ptr @tot, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr @tot, align 4, !tbaa !5
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [6666 x i32], ptr @lnk, i64 0, i64 %31
  store i32 %28, ptr %32, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %33 = getelementptr inbounds %struct.Edge, ptr %5, i32 0, i32 0
  %34 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %34, ptr %33, align 4, !tbaa !9
  %35 = getelementptr inbounds %struct.Edge, ptr %5, i32 0, i32 1
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [6666 x i32], ptr @lnk, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  store i32 %39, ptr %35, align 4, !tbaa !11
  %40 = load i32, ptr @tot, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [23333 x %struct.Edge], ptr @e, i64 0, i64 %41
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %42, ptr align 4 %5, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  %43 = load i32, ptr @tot, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr @tot, align 4, !tbaa !5
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [6666 x i32], ptr @lnk, i64 0, i64 %46
  store i32 %43, ptr %47, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %12, !llvm.loop !13

48:                                               ; preds = %12
  store i32 0, ptr @tot, align 4, !tbaa !5
  %49 = call noundef i32 @_Z6tarjanii(i32 noundef 1, i32 noundef -1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %66, %48
  %51 = load i32, ptr %6, align 4, !tbaa !5
  %52 = load i32, ptr @n, align 4, !tbaa !5
  %53 = icmp sle i32 %51, %52
  br i1 %53, label %55, label %54

54:                                               ; preds = %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %69

55:                                               ; preds = %50
  %56 = load i32, ptr %6, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [6666 x i32], ptr @bcc, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %65, label %61

61:                                               ; preds = %55
  %62 = load i32, ptr @cnt, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr @cnt, align 4, !tbaa !5
  %64 = load i32, ptr %6, align 4, !tbaa !5
  call void @_Z3dfsi(i32 noundef %64)
  br label %65

65:                                               ; preds = %61, %55
  br label %66

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

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

70:                                               ; preds = %115, %69
  %71 = load i32, ptr %7, align 4, !tbaa !5
  %72 = load i32, ptr @n, align 4, !tbaa !5
  %73 = icmp sle i32 %71, %72
  br i1 %73, label %75, label %74

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

75:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %76 = load i32, ptr %7, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [6666 x i32], ptr @lnk, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  store i32 %79, ptr %9, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %108, %75
  %81 = load i32, ptr %9, align 4, !tbaa !5
  %82 = icmp ne i32 %81, -1
  br i1 %82, label %84, label %83

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

84:                                               ; preds = %80
  %85 = load i32, ptr %7, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [6666 x i32], ptr @bcc, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = load i32, ptr %9, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [23333 x %struct.Edge], ptr @e, i64 0, i64 %90
  %92 = getelementptr inbounds %struct.Edge, ptr %91, i32 0, i32 0
  %93 = load i32, ptr %92, align 8, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [6666 x i32], ptr @bcc, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = icmp ne i32 %88, %96
  br i1 %97, label %98, label %107

98:                                               ; preds = %84
  %99 = load i32, ptr %7, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [6666 x i32], ptr @bcc, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [6666 x i32], ptr @d, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %104, align 4, !tbaa !5
  br label %107

107:                                              ; preds = %98, %84
  br label %108

108:                                              ; preds = %107
  %109 = load i32, ptr %9, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [23333 x %struct.Edge], ptr @e, i64 0, i64 %110
  %112 = getelementptr inbounds %struct.Edge, ptr %111, i32 0, i32 1
  %113 = load i32, ptr %112, align 4, !tbaa !11
  store i32 %113, ptr %9, align 4, !tbaa !5
  br label %80, !llvm.loop !16

114:                                              ; preds = %83
  br label %115

115:                                              ; preds = %114
  %116 = load i32, ptr %7, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %7, align 4, !tbaa !5
  br label %70, !llvm.loop !17

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

119:                                              ; preds = %134, %118
  %120 = load i32, ptr %10, align 4, !tbaa !5
  %121 = load i32, ptr @cnt, align 4, !tbaa !5
  %122 = icmp sle i32 %120, %121
  br i1 %122, label %124, label %123

123:                                              ; preds = %119
  store i32 13, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %137

124:                                              ; preds = %119
  %125 = load i32, ptr %10, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [6666 x i32], ptr @d, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = icmp eq i32 %128, 1
  br i1 %129, label %130, label %133

130:                                              ; preds = %124
  %131 = load i32, ptr @ans, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr @ans, align 4, !tbaa !5
  br label %133

133:                                              ; preds = %130, %124
  br label %134

134:                                              ; preds = %133
  %135 = load i32, ptr %10, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %10, align 4, !tbaa !5
  br label %119, !llvm.loop !18

137:                                              ; preds = %123
  %138 = load i32, ptr @ans, align 4, !tbaa !5
  %139 = add nsw i32 %138, 1
  %140 = ashr i32 %139, 1
  %141 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %140)
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

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

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

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

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


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

%struct.Edge = type { i32, i32 }

@e = external dso_local local_unnamed_addr global [23333 x %struct.Edge], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@lnk = external dso_local local_unnamed_addr global [6666 x i32], align 16
@cnt = external dso_local local_unnamed_addr global i32, align 4
@bcc = external dso_local local_unnamed_addr global [6666 x i32], align 16
@d = external dso_local local_unnamed_addr global [6666 x i32], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(26664) @lnk, i8 -1, i64 26664, i1 false)
  %4 = load i32, ptr @m, align 4, !tbaa !5
  %5 = add nsw i32 %4, -1
  store i32 %5, ptr @m, align 4, !tbaa !5
  %.not28 = icmp eq i32 %4, 0
  br i1 %.not28, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %0, %.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %7 = load i32, ptr %2, align 4, !tbaa !5
  %8 = load i32, ptr %1, align 4, !tbaa !5
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds [6666 x i32], ptr @lnk, i64 0, i64 %9
  %11 = load i32, ptr %10, align 4, !tbaa !5
  %12 = load i32, ptr @tot, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds [23333 x %struct.Edge], ptr @e, i64 0, i64 %13
  store i32 %7, ptr %14, align 8, !tbaa !5
  %.sroa.416.0..sroa_idx = getelementptr inbounds i8, ptr %14, i64 4
  store i32 %11, ptr %.sroa.416.0..sroa_idx, align 4, !tbaa !5
  %15 = add nsw i32 %12, 1
  store i32 %12, ptr %10, align 4, !tbaa !5
  %16 = sext i32 %7 to i64
  %17 = getelementptr inbounds [6666 x i32], ptr @lnk, i64 0, i64 %16
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = sext i32 %15 to i64
  %20 = getelementptr inbounds [23333 x %struct.Edge], ptr @e, i64 0, i64 %19
  store i32 %8, ptr %20, align 8, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %20, i64 4
  store i32 %18, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  %21 = add nsw i32 %12, 2
  store i32 %21, ptr @tot, align 4, !tbaa !5
  store i32 %15, ptr %17, align 4, !tbaa !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
  %22 = load i32, ptr @m, align 4, !tbaa !5
  %23 = add nsw i32 %22, -1
  store i32 %23, ptr @m, align 4, !tbaa !5
  %.not = icmp eq i32 %22, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %0
  store i32 0, ptr @tot, align 4, !tbaa !5
  %24 = call noundef i32 @_Z6tarjanii(i32 noundef 1, i32 noundef -1)
  %25 = load i32, ptr @n, align 4, !tbaa !5
  %.not2129 = icmp slt i32 %25, 1
  br i1 %.not2129, label %.preheader, label %.lr.ph32

.preheader27:                                     ; preds = %34
  %.not2239 = icmp slt i32 %35, 1
  br i1 %.not2239, label %.preheader, label %.lr.ph41.preheader

.lr.ph41.preheader:                               ; preds = %.preheader27
  %26 = add nuw i32 %35, 1
  %wide.trip.count = zext i32 %26 to i64
  br label %.lr.ph41

.lr.ph32:                                         ; preds = %._crit_edge, %34
  %27 = phi i32 [ %35, %34 ], [ %25, %._crit_edge ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %34 ], [ 1, %._crit_edge ]
  %28 = getelementptr inbounds [6666 x i32], ptr @bcc, i64 0, i64 %indvars.iv
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %.not26 = icmp eq i32 %29, 0
  br i1 %.not26, label %30, label %34

30:                                               ; preds = %.lr.ph32
  %31 = load i32, ptr @cnt, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr @cnt, align 4, !tbaa !5
  %33 = trunc nuw nsw i64 %indvars.iv to i32
  call void @_Z3dfsi(i32 noundef %33)
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %.lr.ph32, %30
  %35 = phi i32 [ %27, %.lr.ph32 ], [ %.pre, %30 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %36 = sext i32 %35 to i64
  %.not21.not = icmp slt i64 %indvars.iv, %36
  br i1 %.not21.not, label %.lr.ph32, label %.preheader27, !llvm.loop !11

.preheader:                                       ; preds = %._crit_edge38, %._crit_edge, %.preheader27
  %37 = load i32, ptr @cnt, align 4, !tbaa !5
  %ans.promoted = load i32, ptr @ans, align 4, !tbaa !5
  %.not2342 = icmp slt i32 %37, 1
  br i1 %.not2342, label %._crit_edge45, label %.lr.ph44.preheader

.lr.ph44.preheader:                               ; preds = %.preheader
  %38 = zext nneg i32 %37 to i64
  %xtraiter = and i64 %38, 1
  %39 = icmp eq i32 %37, 1
  br i1 %39, label %._crit_edge45.loopexit.unr-lcssa, label %.lr.ph44.preheader.new

.lr.ph44.preheader.new:                           ; preds = %.lr.ph44.preheader
  %unroll_iter = and i64 %38, 2147483646
  br label %.lr.ph44

.lr.ph41:                                         ; preds = %.lr.ph41.preheader, %._crit_edge38
  %indvars.iv48 = phi i64 [ 1, %.lr.ph41.preheader ], [ %indvars.iv.next49, %._crit_edge38 ]
  %40 = getelementptr inbounds [6666 x i32], ptr @lnk, i64 0, i64 %indvars.iv48
  %.01733 = load i32, ptr %40, align 4, !tbaa !5
  %.not2434 = icmp eq i32 %.01733, -1
  br i1 %.not2434, label %._crit_edge38, label %.lr.ph37

.lr.ph37:                                         ; preds = %.lr.ph41
  %41 = getelementptr inbounds [6666 x i32], ptr @bcc, i64 0, i64 %indvars.iv48
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [6666 x i32], ptr @d, i64 0, i64 %43
  br label %45

._crit_edge38:                                    ; preds = %55, %.lr.ph41
  %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next49, %wide.trip.count
  br i1 %exitcond.not, label %.preheader, label %.lr.ph41, !llvm.loop !12

45:                                               ; preds = %.lr.ph37, %55
  %.01735 = phi i32 [ %.01733, %.lr.ph37 ], [ %.017, %55 ]
  %46 = sext i32 %.01735 to i64
  %47 = getelementptr inbounds [23333 x %struct.Edge], ptr @e, i64 0, i64 %46
  %48 = load i32, ptr %47, align 8, !tbaa !13
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [6666 x i32], ptr @bcc, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %.not25 = icmp eq i32 %42, %51
  br i1 %.not25, label %55, label %52

52:                                               ; preds = %45
  %53 = load i32, ptr %44, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %44, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %45, %52
  %56 = getelementptr inbounds i8, ptr %47, i64 4
  %.017 = load i32, ptr %56, align 4, !tbaa !5
  %.not24 = icmp eq i32 %.017, -1
  br i1 %.not24, label %._crit_edge38, label %45, !llvm.loop !15

._crit_edge45.loopexit.unr-lcssa:                 ; preds = %78, %.lr.ph44.preheader
  %.lcssa.ph = phi i32 [ poison, %.lr.ph44.preheader ], [ %79, %78 ]
  %indvars.iv51.unr = phi i64 [ 1, %.lr.ph44.preheader ], [ %indvars.iv.next52.1, %78 ]
  %.unr = phi i32 [ %ans.promoted, %.lr.ph44.preheader ], [ %79, %78 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge45, label %.lr.ph44.epil

.lr.ph44.epil:                                    ; preds = %._crit_edge45.loopexit.unr-lcssa
  %57 = getelementptr inbounds [6666 x i32], ptr @d, i64 0, i64 %indvars.iv51.unr
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = icmp eq i32 %58, 1
  br i1 %59, label %60, label %._crit_edge45

60:                                               ; preds = %.lr.ph44.epil
  %61 = add nsw i32 %.unr, 1
  store i32 %61, ptr @ans, align 4, !tbaa !5
  br label %._crit_edge45

._crit_edge45:                                    ; preds = %._crit_edge45.loopexit.unr-lcssa, %60, %.lr.ph44.epil, %.preheader
  %62 = phi i32 [ %ans.promoted, %.preheader ], [ %.lcssa.ph, %._crit_edge45.loopexit.unr-lcssa ], [ %.unr, %.lr.ph44.epil ], [ %61, %60 ]
  %63 = add nsw i32 %62, 1
  %64 = ashr i32 %63, 1
  %65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %64)
  ret i32 0

.lr.ph44:                                         ; preds = %78, %.lr.ph44.preheader.new
  %indvars.iv51 = phi i64 [ 1, %.lr.ph44.preheader.new ], [ %indvars.iv.next52.1, %78 ]
  %66 = phi i32 [ %ans.promoted, %.lr.ph44.preheader.new ], [ %79, %78 ]
  %niter = phi i64 [ 0, %.lr.ph44.preheader.new ], [ %niter.next.1, %78 ]
  %67 = getelementptr inbounds [6666 x i32], ptr @d, i64 0, i64 %indvars.iv51
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = icmp eq i32 %68, 1
  br i1 %69, label %70, label %.lr.ph44.1

70:                                               ; preds = %.lr.ph44
  %71 = add nsw i32 %66, 1
  store i32 %71, ptr @ans, align 4, !tbaa !5
  br label %.lr.ph44.1

.lr.ph44.1:                                       ; preds = %.lr.ph44, %70
  %72 = phi i32 [ %66, %.lr.ph44 ], [ %71, %70 ]
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %73 = getelementptr inbounds [6666 x i32], ptr @d, i64 0, i64 %indvars.iv.next52
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = icmp eq i32 %74, 1
  br i1 %75, label %76, label %78

76:                                               ; preds = %.lr.ph44.1
  %77 = add nsw i32 %72, 1
  store i32 %77, ptr @ans, align 4, !tbaa !5
  br label %78

78:                                               ; preds = %76, %.lr.ph44.1
  %79 = phi i32 [ %72, %.lr.ph44.1 ], [ %77, %76 ]
  %indvars.iv.next52.1 = add nuw nsw i64 %indvars.iv51, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge45.loopexit.unr-lcssa, label %.lr.ph44, !llvm.loop !16
}

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

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

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

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 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 #3 = { 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 #4 = { mustprogress 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++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTS4Edge", !6, i64 0, !6, i64 4}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


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