; LLVM IR from tangjz/acm-icpc :: luogu (4625)

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

@n = external dso_local global i32, align 4
@lnk = external dso_local global [100001 x i32], align 16
@deg = external dso_local global [100001 x i32], align 16
@lim = external dso_local global i32, align 4
@e = external dso_local global [200003 x %struct.Edge], align 16
@dsu = external dso_local global [100001 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [64 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z9dsu_mergeii(i32 noundef, 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 i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %struct.Edge, align 4
  %8 = alloca %struct.Edge, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  br label %13

13:                                               ; preds = %191, %0
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %15 = icmp eq i32 %14, 1
  br i1 %15, label %16, label %201

16:                                               ; preds = %13
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = icmp sle i32 1, %17
  br i1 %18, label %19, label %22

19:                                               ; preds = %16
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = icmp sle i32 %20, 100000
  br label %22

22:                                               ; preds = %19, %16
  %23 = phi i1 [ false, %16 ], [ %21, %19 ]
  br i1 %23, label %24, label %25

24:                                               ; preds = %22
  br label %27

25:                                               ; preds = %22
  call void @__assert_fail(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 104, ptr noundef @__PRETTY_FUNCTION__.main) #7
  unreachable

26:                                               ; No predecessors!
  br label %27

27:                                               ; preds = %26, %24
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = mul i64 %29, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @dsu, i64 1), i8 -1, i64 %30, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %128, %27
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = load i32, ptr @n, align 4, !tbaa !5
  %34 = icmp slt i32 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  store i32 4, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %131

36:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %4, ptr noundef %5)
  %38 = icmp eq i32 %37, 2
  br i1 %38, label %39, label %53

39:                                               ; preds = %36
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = icmp sle i32 1, %40
  br i1 %41, label %42, label %53

42:                                               ; preds = %39
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = load i32, ptr @n, align 4, !tbaa !5
  %45 = icmp sle i32 %43, %44
  br i1 %45, label %46, label %53

46:                                               ; preds = %42
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = icmp sle i32 1, %47
  br i1 %48, label %49, label %53

49:                                               ; preds = %46
  %50 = load i32, ptr %5, align 4, !tbaa !5
  %51 = load i32, ptr @n, align 4, !tbaa !5
  %52 = icmp sle i32 %50, %51
  br label %53

53:                                               ; preds = %49, %46, %42, %39, %36
  %54 = phi i1 [ false, %46 ], [ false, %42 ], [ false, %39 ], [ false, %36 ], [ %52, %49 ]
  br i1 %54, label %55, label %56

55:                                               ; preds = %53
  br label %58

56:                                               ; preds = %53
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.2, i32 noundef 108, ptr noundef @__PRETTY_FUNCTION__.main) #7
  unreachable

57:                                               ; No predecessors!
  br label %58

58:                                               ; preds = %57, %55
  %59 = load i32, ptr %4, align 4, !tbaa !5
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = icmp eq i32 %59, %60
  br i1 %61, label %62, label %76

62:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %72, %62
  %64 = load i32, ptr %6, align 4, !tbaa !5
  %65 = load i32, ptr @n, align 4, !tbaa !5
  %66 = icmp slt i32 %64, %65
  br i1 %66, label %68, label %67

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

68:                                               ; preds = %63
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = load i32, ptr %5, align 4, !tbaa !5
  %71 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %69, i32 noundef %70)
  br label %72

72:                                               ; preds = %68
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %6, align 4, !tbaa !5
  br label %63, !llvm.loop !9

75:                                               ; preds = %67
  br label %76

76:                                               ; preds = %75, %58
  %77 = load i32, ptr %4, align 4, !tbaa !5
  %78 = load i32, ptr %5, align 4, !tbaa !5
  %79 = call noundef zeroext i1 @_Z9dsu_mergeii(i32 noundef %77, i32 noundef %78)
  br i1 %79, label %80, label %81

80:                                               ; preds = %76
  br label %83

81:                                               ; preds = %76
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.2, i32 noundef 113, ptr noundef @__PRETTY_FUNCTION__.main) #7
  unreachable

82:                                               ; No predecessors!
  br label %83

83:                                               ; preds = %82, %80
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %84 = getelementptr inbounds %struct.Edge, ptr %7, i32 0, i32 0
  %85 = load i32, ptr %4, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [100001 x i32], ptr @lnk, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  store i32 %88, ptr %84, align 4, !tbaa !11
  %89 = getelementptr inbounds %struct.Edge, ptr %7, i32 0, i32 1
  %90 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %90, ptr %89, align 4, !tbaa !13
  %91 = load i32, ptr %2, align 4, !tbaa !5
  %92 = shl i32 %91, 1
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [200003 x %struct.Edge], ptr @e, i64 0, i64 %93
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %94, ptr align 4 %7, i64 8, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  %95 = load i32, ptr %2, align 4, !tbaa !5
  %96 = shl i32 %95, 1
  %97 = load i32, ptr %4, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [100001 x i32], ptr @lnk, i64 0, i64 %98
  store i32 %96, ptr %99, align 4, !tbaa !5
  %100 = load i32, ptr %4, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [100001 x i32], ptr @deg, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %102, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %105 = getelementptr inbounds %struct.Edge, ptr %8, i32 0, i32 0
  %106 = load i32, ptr %5, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [100001 x i32], ptr @lnk, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  store i32 %109, ptr %105, align 4, !tbaa !11
  %110 = getelementptr inbounds %struct.Edge, ptr %8, i32 0, i32 1
  %111 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %111, ptr %110, align 4, !tbaa !13
  %112 = load i32, ptr %2, align 4, !tbaa !5
  %113 = shl i32 %112, 1
  %114 = or i32 %113, 1
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [200003 x %struct.Edge], ptr @e, i64 0, i64 %115
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %116, ptr align 4 %8, i64 8, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  %117 = load i32, ptr %2, align 4, !tbaa !5
  %118 = shl i32 %117, 1
  %119 = or i32 %118, 1
  %120 = load i32, ptr %5, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [100001 x i32], ptr @lnk, i64 0, i64 %121
  store i32 %119, ptr %122, align 4, !tbaa !5
  %123 = load i32, ptr %5, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [100001 x i32], ptr @deg, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %125, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %128

128:                                              ; preds = %83
  %129 = load i32, ptr %2, align 4, !tbaa !5
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %2, align 4, !tbaa !5
  br label %31, !llvm.loop !15

131:                                              ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %132

132:                                              ; preds = %145, %131
  %133 = load i32, ptr %12, align 4, !tbaa !5
  %134 = load i32, ptr @n, align 4, !tbaa !5
  %135 = icmp sle i32 %133, %134
  br i1 %135, label %137, label %136

136:                                              ; preds = %132
  store i32 10, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %148

137:                                              ; preds = %132
  %138 = load i32, ptr %12, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [100001 x i32], ptr @deg, i64 0, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !5
  %142 = and i32 %141, 1
  %143 = load i32, ptr %9, align 4, !tbaa !5
  %144 = add nsw i32 %143, %142
  store i32 %144, ptr %9, align 4, !tbaa !5
  br label %145

145:                                              ; preds = %137
  %146 = load i32, ptr %12, align 4, !tbaa !5
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %12, align 4, !tbaa !5
  br label %132, !llvm.loop !16

148:                                              ; preds = %136
  %149 = load i32, ptr %9, align 4, !tbaa !5
  %150 = sdiv i32 %149, 2
  %151 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %150)
  store i32 0, ptr %10, align 4, !tbaa !5
  %152 = load i32, ptr @n, align 4, !tbaa !5
  %153 = sub nsw i32 %152, 1
  store i32 %153, ptr %11, align 4, !tbaa !5
  br label %154

154:                                              ; preds = %169, %148
  %155 = load i32, ptr %10, align 4, !tbaa !5
  %156 = load i32, ptr %11, align 4, !tbaa !5
  %157 = icmp slt i32 %155, %156
  br i1 %157, label %158, label %170

158:                                              ; preds = %154
  %159 = load i32, ptr %10, align 4, !tbaa !5
  %160 = load i32, ptr %11, align 4, !tbaa !5
  %161 = add nsw i32 %159, %160
  %162 = ashr i32 %161, 1
  store i32 %162, ptr @lim, align 4, !tbaa !5
  %163 = call noundef zeroext i1 @_Z4dfs1ii(i32 noundef 1, i32 noundef -1)
  br i1 %163, label %164, label %166

164:                                              ; preds = %158
  %165 = load i32, ptr @lim, align 4, !tbaa !5
  store i32 %165, ptr %11, align 4, !tbaa !5
  br label %169

166:                                              ; preds = %158
  %167 = load i32, ptr @lim, align 4, !tbaa !5
  %168 = add nsw i32 %167, 1
  store i32 %168, ptr %10, align 4, !tbaa !5
  br label %169

169:                                              ; preds = %166, %164
  br label %154, !llvm.loop !17

170:                                              ; preds = %154
  %171 = load i32, ptr %10, align 4, !tbaa !5
  %172 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %171)
  store i32 1, ptr %10, align 4, !tbaa !5
  %173 = load i32, ptr @n, align 4, !tbaa !5
  %174 = sub nsw i32 %173, 1
  store i32 %174, ptr %11, align 4, !tbaa !5
  br label %175

175:                                              ; preds = %190, %170
  %176 = load i32, ptr %10, align 4, !tbaa !5
  %177 = load i32, ptr %11, align 4, !tbaa !5
  %178 = icmp slt i32 %176, %177
  br i1 %178, label %179, label %191

179:                                              ; preds = %175
  %180 = load i32, ptr %10, align 4, !tbaa !5
  %181 = load i32, ptr %11, align 4, !tbaa !5
  %182 = add nsw i32 %180, %181
  %183 = ashr i32 %182, 1
  store i32 %183, ptr @lim, align 4, !tbaa !5
  %184 = call noundef zeroext i1 @_Z4dfs2ii(i32 noundef 1, i32 noundef -1)
  br i1 %184, label %185, label %187

185:                                              ; preds = %179
  %186 = load i32, ptr @lim, align 4, !tbaa !5
  store i32 %186, ptr %11, align 4, !tbaa !5
  br label %190

187:                                              ; preds = %179
  %188 = load i32, ptr @lim, align 4, !tbaa !5
  %189 = add nsw i32 %188, 1
  store i32 %189, ptr %10, align 4, !tbaa !5
  br label %190

190:                                              ; preds = %187, %185
  br label %175, !llvm.loop !18

191:                                              ; preds = %175
  %192 = load i32, ptr %10, align 4, !tbaa !5
  %193 = add nsw i32 %192, 1
  %194 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %193)
  %195 = load i32, ptr @n, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = mul i64 %196, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @lnk, i64 1), i8 0, i64 %197, i1 false)
  %198 = load i32, ptr @n, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = mul i64 %199, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @deg, i64 1), i8 0, i64 %200, i1 false)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %13, !llvm.loop !19

201:                                              ; preds = %13
  ret i32 0
}

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

; 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 @printf(ptr noundef, ...) #3

; 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) #6

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 = { noreturn 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { noreturn nounwind }
attributes #8 = { 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, !6, i64 0}
!12 = !{!"_ZTS4Edge", !6, i64 0, !6, i64 4}
!13 = !{!12, !6, i64 4}
!14 = !{i64 0, i64 4, !5, i64 4, i64 4, !5}
!15 = distinct !{!15, !10}
!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 }

@n = external dso_local global i32, align 4
@lnk = external dso_local local_unnamed_addr global [100001 x i32], align 16
@deg = external dso_local local_unnamed_addr global [100001 x i32], align 16
@lim = external dso_local local_unnamed_addr global i32, align 4
@e = external dso_local local_unnamed_addr global [200003 x %struct.Edge], align 16
@dsu = external dso_local local_unnamed_addr global [100001 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [64 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z9dsu_mergeii(i32 noundef, 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)
  %4 = icmp eq i32 %3, 1
  br i1 %4, label %.lr.ph69, label %._crit_edge70

.lr.ph69:                                         ; preds = %0, %._crit_edge66
  %5 = load i32, ptr @n, align 4
  %6 = add i32 %5, -1
  %7 = icmp ult i32 %6, 100000
  br i1 %7, label %9, label %8

8:                                                ; preds = %.lr.ph69
  call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 104, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
  unreachable

9:                                                ; preds = %.lr.ph69
  %10 = shl nuw nsw i32 %5, 2
  %11 = zext nneg i32 %10 to i64
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @dsu, i64 4), i8 -1, i64 %11, i1 false)
  %12 = icmp ugt i32 %5, 1
  br i1 %12, label %.lr.ph50, label %.lr.ph54.preheader

.preheader45:                                     ; preds = %46
  %.not51 = icmp slt i32 %69, 1
  br i1 %.not51, label %._crit_edge, label %.lr.ph54.preheader

.lr.ph54.preheader:                               ; preds = %9, %.preheader45
  %.lcssa82 = phi i32 [ %69, %.preheader45 ], [ 1, %9 ]
  %13 = add nuw i32 %.lcssa82, 1
  %wide.trip.count = zext i32 %13 to i64
  %14 = zext nneg i32 %.lcssa82 to i64
  %min.iters.check = icmp ult i32 %.lcssa82, 8
  br i1 %min.iters.check, label %.lr.ph54.preheader87, label %vector.ph

.lr.ph54.preheader87:                             ; preds = %middle.block, %.lr.ph54.preheader
  %indvars.iv76.ph = phi i64 [ 1, %.lr.ph54.preheader ], [ %ind.end, %middle.block ]
  %.03352.ph = phi i32 [ 0, %.lr.ph54.preheader ], [ %22, %middle.block ]
  br label %.lr.ph54

vector.ph:                                        ; preds = %.lr.ph54.preheader
  %n.vec = and i64 %14, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  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 ], [ %19, %vector.body ]
  %vec.phi85 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %20, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %15 = getelementptr inbounds [100001 x i32], ptr @deg, i64 0, i64 %offset.idx
  %16 = getelementptr inbounds i8, ptr %15, i64 16
  %wide.load = load <4 x i32>, ptr %15, align 4, !tbaa !5
  %wide.load86 = load <4 x i32>, ptr %16, align 4, !tbaa !5
  %17 = and <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
  %18 = and <4 x i32> %wide.load86, <i32 1, i32 1, i32 1, i32 1>
  %19 = add <4 x i32> %17, %vec.phi
  %20 = add <4 x i32> %18, %vec.phi85
  %index.next = add nuw i64 %index, 8
  %21 = icmp eq i64 %index.next, %n.vec
  br i1 %21, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %20, %19
  %22 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %14
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph54.preheader87

.lr.ph50:                                         ; preds = %9, %46
  %indvars.iv = phi i64 [ %indvars.iv.next, %46 ], [ 1, %9 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %24 = icmp eq i32 %23, 2
  %25 = load i32, ptr %1, align 4
  %26 = icmp sgt i32 %25, 0
  %or.cond = select i1 %24, i1 %26, i1 false
  br i1 %or.cond, label %27, label %.critedge

27:                                               ; preds = %.lr.ph50
  %28 = load i32, ptr @n, align 4
  %29 = icmp sgt i32 %25, %28
  %30 = load i32, ptr %2, align 4
  %31 = icmp slt i32 %30, 1
  %.not40 = icmp sgt i32 %30, %28
  %32 = or i1 %31, %.not40
  %or.cond41 = select i1 %29, i1 true, i1 %32
  br i1 %or.cond41, label %.critedge, label %33

.critedge:                                        ; preds = %27, %.lr.ph50
  call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.2, i32 noundef 108, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
  unreachable

33:                                               ; preds = %27
  %34 = icmp eq i32 %25, %30
  %35 = icmp ugt i32 %28, 1
  %or.cond72 = and i1 %34, %35
  br i1 %or.cond72, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %33, %.lr.ph
  %.03548 = phi i32 [ %39, %.lr.ph ], [ 1, %33 ]
  %36 = load i32, ptr %1, align 4, !tbaa !5
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %36, i32 noundef %37)
  %39 = add nuw nsw i32 %.03548, 1
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %.lr.ph, label %.loopexit.loopexit, !llvm.loop !13

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

.loopexit:                                        ; preds = %.loopexit.loopexit, %33
  %42 = phi i32 [ %.pre79, %.loopexit.loopexit ], [ %30, %33 ]
  %43 = phi i32 [ %.pre, %.loopexit.loopexit ], [ %25, %33 ]
  %44 = call noundef zeroext i1 @_Z9dsu_mergeii(i32 noundef %43, i32 noundef %42)
  br i1 %44, label %46, label %45

45:                                               ; preds = %.loopexit
  call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2, i32 noundef 113, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
  unreachable

46:                                               ; preds = %.loopexit
  %47 = load i32, ptr %1, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [100001 x i32], ptr @lnk, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = shl nuw i64 %indvars.iv, 1
  %53 = trunc nuw i64 %52 to i32
  %sext = shl i64 %indvars.iv, 33
  %54 = ashr exact i64 %sext, 32
  %55 = getelementptr inbounds [200003 x %struct.Edge], ptr @e, i64 0, i64 %54
  store i32 %50, ptr %55, align 16, !tbaa !5
  %.sroa.419.0..sroa_idx = getelementptr inbounds i8, ptr %55, i64 4
  store i32 %51, ptr %.sroa.419.0..sroa_idx, align 4, !tbaa !5
  store i32 %53, ptr %49, align 4, !tbaa !5
  %56 = getelementptr inbounds [100001 x i32], ptr @deg, i64 0, i64 %48
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %56, align 4, !tbaa !5
  %59 = sext i32 %51 to i64
  %60 = getelementptr inbounds [100001 x i32], ptr @lnk, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = trunc i64 %52 to i32
  %63 = or disjoint i32 %62, 1
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [200003 x %struct.Edge], ptr @e, i64 0, i64 %64
  store i32 %61, ptr %65, align 8, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %65, i64 4
  store i32 %47, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  store i32 %63, ptr %60, align 4, !tbaa !5
  %66 = getelementptr inbounds [100001 x i32], ptr @deg, i64 0, i64 %59
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %66, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %69 = load i32, ptr @n, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = icmp slt i64 %indvars.iv.next, %70
  br i1 %71, label %.lr.ph50, label %.preheader45, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph54, %middle.block, %.preheader45
  %.033.lcssa = phi i32 [ 0, %.preheader45 ], [ %22, %middle.block ], [ %80, %.lr.ph54 ]
  %72 = lshr i32 %.033.lcssa, 1
  %73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %72)
  %74 = load i32, ptr @n, align 4, !tbaa !5
  %75 = icmp sgt i32 %74, 1
  br i1 %75, label %.lr.ph59.preheader, label %._crit_edge60

.lr.ph59.preheader:                               ; preds = %._crit_edge
  %76 = add nsw i32 %74, -1
  br label %.lr.ph59

.lr.ph54:                                         ; preds = %.lr.ph54.preheader87, %.lr.ph54
  %indvars.iv76 = phi i64 [ %indvars.iv.next77, %.lr.ph54 ], [ %indvars.iv76.ph, %.lr.ph54.preheader87 ]
  %.03352 = phi i32 [ %80, %.lr.ph54 ], [ %.03352.ph, %.lr.ph54.preheader87 ]
  %77 = getelementptr inbounds [100001 x i32], ptr @deg, i64 0, i64 %indvars.iv76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = and i32 %78, 1
  %80 = add nuw nsw i32 %79, %.03352
  %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next77, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph54, !llvm.loop !15

.lr.ph59:                                         ; preds = %.lr.ph59.preheader, %.lr.ph59
  %.02857 = phi i32 [ %.1, %.lr.ph59 ], [ %76, %.lr.ph59.preheader ]
  %.02956 = phi i32 [ %.130, %.lr.ph59 ], [ 0, %.lr.ph59.preheader ]
  %81 = add nsw i32 %.02857, %.02956
  %82 = ashr i32 %81, 1
  store i32 %82, ptr @lim, align 4, !tbaa !5
  %83 = call noundef zeroext i1 @_Z4dfs1ii(i32 noundef 1, i32 noundef -1)
  %84 = load i32, ptr @lim, align 4
  %85 = add nsw i32 %84, 1
  %.130 = select i1 %83, i32 %.02956, i32 %85
  %.1 = select i1 %83, i32 %84, i32 %.02857
  %86 = icmp slt i32 %.130, %.1
  br i1 %86, label %.lr.ph59, label %._crit_edge60, !llvm.loop !16

._crit_edge60:                                    ; preds = %.lr.ph59, %._crit_edge
  %.029.lcssa = phi i32 [ 0, %._crit_edge ], [ %.130, %.lr.ph59 ]
  %87 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %.029.lcssa)
  %88 = load i32, ptr @n, align 4, !tbaa !5
  %89 = icmp sgt i32 %88, 2
  br i1 %89, label %.lr.ph65.preheader, label %._crit_edge66

.lr.ph65.preheader:                               ; preds = %._crit_edge60
  %90 = add nsw i32 %88, -1
  br label %.lr.ph65

.lr.ph65:                                         ; preds = %.lr.ph65.preheader, %.lr.ph65
  %.263 = phi i32 [ %.3, %.lr.ph65 ], [ %90, %.lr.ph65.preheader ]
  %.23162 = phi i32 [ %.332, %.lr.ph65 ], [ 1, %.lr.ph65.preheader ]
  %91 = add nsw i32 %.263, %.23162
  %92 = ashr i32 %91, 1
  store i32 %92, ptr @lim, align 4, !tbaa !5
  %93 = call noundef zeroext i1 @_Z4dfs2ii(i32 noundef 1, i32 noundef -1)
  %94 = load i32, ptr @lim, align 4
  %95 = add nsw i32 %94, 1
  %.332 = select i1 %93, i32 %.23162, i32 %95
  %.3 = select i1 %93, i32 %94, i32 %.263
  %96 = icmp slt i32 %.332, %.3
  br i1 %96, label %.lr.ph65, label %._crit_edge66, !llvm.loop !17

._crit_edge66:                                    ; preds = %.lr.ph65, %._crit_edge60
  %.231.lcssa = phi i32 [ 1, %._crit_edge60 ], [ %.332, %.lr.ph65 ]
  %97 = add nsw i32 %.231.lcssa, 1
  %98 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %97)
  %99 = load i32, ptr @n, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = shl nsw i64 %100, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @lnk, i64 4), i8 0, i64 %101, i1 false)
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @deg, i64 4), i8 0, i64 %101, i1 false)
  %102 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %103 = icmp eq i32 %102, 1
  br i1 %103, label %.lr.ph69, label %._crit_edge70, !llvm.loop !18

._crit_edge70:                                    ; preds = %._crit_edge66, %0
  ret i32 0
}

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

; 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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

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

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 = { noreturn 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { noreturn nounwind }
attributes #8 = { 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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


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