; LLVM IR from upupming/algorithm :: acwing/算法基础课/第三讲 搜索与图论/Kruskal/859. Kruskal算法求最小生成树 (main)

; 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.P = type { i32, i32, i32 }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@edge = external dso_local global [200010 x %struct.P], align 16
@fa = external dso_local global [100010 x i32], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %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
  store i32 0, ptr %1, align 4
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 4 dereferenceable(4) @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %32, %0
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = load i32, ptr @m, align 4, !tbaa !5
  %14 = icmp sle i32 %12, %13
  br i1 %14, label %16, label %15

15:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %35

16:                                               ; preds = %11
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [200010 x %struct.P], ptr @edge, i64 0, i64 %18
  %20 = getelementptr inbounds %struct.P, ptr %19, i32 0, i32 0
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %20)
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [200010 x %struct.P], ptr @edge, i64 0, i64 %23
  %25 = getelementptr inbounds %struct.P, ptr %24, i32 0, i32 1
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 4 dereferenceable(4) %25)
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [200010 x %struct.P], ptr @edge, i64 0, i64 %28
  %30 = getelementptr inbounds %struct.P, ptr %29, i32 0, i32 2
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef nonnull align 4 dereferenceable(4) %30)
  br label %32

32:                                               ; preds = %16
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %2, align 4, !tbaa !5
  br label %11, !llvm.loop !9

35:                                               ; preds = %15
  %36 = load i32, ptr @m, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds %struct.P, ptr @edge, i64 %37
  %39 = getelementptr inbounds %struct.P, ptr %38, i64 1
  call void @_ZSt4sortIP1PEvT_S2_(ptr noundef getelementptr inbounds (%struct.P, ptr @edge, i64 1), ptr noundef %39)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %50, %35
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = load i32, ptr @n, align 4, !tbaa !5
  %43 = icmp sle i32 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %53

45:                                               ; preds = %40
  %46 = load i32, ptr %3, align 4, !tbaa !5
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [100010 x i32], ptr @fa, i64 0, i64 %48
  store i32 %46, ptr %49, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %45
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %3, align 4, !tbaa !5
  br label %40, !llvm.loop !11

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

54:                                               ; preds = %91, %53
  %55 = load i32, ptr %4, align 4, !tbaa !5
  %56 = load i32, ptr @m, align 4, !tbaa !5
  %57 = icmp sle i32 %55, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %54
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %94

59:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [200010 x %struct.P], ptr @edge, i64 0, i64 %61
  %63 = getelementptr inbounds %struct.P, ptr %62, i32 0, i32 0
  %64 = load i32, ptr %63, align 4, !tbaa !12
  %65 = call noundef i32 @_Z3geti(i32 noundef %64)
  store i32 %65, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [200010 x %struct.P], ptr @edge, i64 0, i64 %67
  %69 = getelementptr inbounds %struct.P, ptr %68, i32 0, i32 1
  %70 = load i32, ptr %69, align 4, !tbaa !14
  %71 = call noundef i32 @_Z3geti(i32 noundef %70)
  store i32 %71, ptr %7, align 4, !tbaa !5
  %72 = load i32, ptr %6, align 4, !tbaa !5
  %73 = load i32, ptr %7, align 4, !tbaa !5
  %74 = icmp eq i32 %72, %73
  br i1 %74, label %75, label %76

75:                                               ; preds = %59
  store i32 10, ptr %5, align 4
  br label %88

76:                                               ; preds = %59
  %77 = load i32, ptr %7, align 4, !tbaa !5
  %78 = load i32, ptr %6, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [100010 x i32], ptr @fa, i64 0, i64 %79
  store i32 %77, ptr %80, align 4, !tbaa !5
  %81 = load i32, ptr %4, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [200010 x %struct.P], ptr @edge, i64 0, i64 %82
  %84 = getelementptr inbounds %struct.P, ptr %83, i32 0, i32 2
  %85 = load i32, ptr %84, align 4, !tbaa !15
  %86 = load i32, ptr @ans, align 4, !tbaa !5
  %87 = add nsw i32 %86, %85
  store i32 %87, ptr @ans, align 4, !tbaa !5
  store i32 0, ptr %5, align 4
  br label %88

88:                                               ; preds = %76, %75
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %89 = load i32, ptr %5, align 4
  switch i32 %89, label %119 [
    i32 0, label %90
    i32 10, label %91
  ]

90:                                               ; preds = %88
  br label %91

91:                                               ; preds = %90, %88
  %92 = load i32, ptr %4, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %4, align 4, !tbaa !5
  br label %54, !llvm.loop !16

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

95:                                               ; preds = %108, %94
  %96 = load i32, ptr %8, align 4, !tbaa !5
  %97 = load i32, ptr @n, align 4, !tbaa !5
  %98 = icmp sle i32 %96, %97
  br i1 %98, label %100, label %99

99:                                               ; preds = %95
  store i32 11, ptr %5, align 4
  br label %111

100:                                              ; preds = %95
  %101 = load i32, ptr %8, align 4, !tbaa !5
  %102 = call noundef i32 @_Z3geti(i32 noundef %101)
  %103 = call noundef i32 @_Z3geti(i32 noundef 1)
  %104 = icmp ne i32 %102, %103
  br i1 %104, label %105, label %107

105:                                              ; preds = %100
  %106 = call i32 @puts(ptr noundef @.str)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %5, align 4
  br label %111

107:                                              ; preds = %100
  br label %108

108:                                              ; preds = %107
  %109 = load i32, ptr %8, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %8, align 4, !tbaa !5
  br label %95, !llvm.loop !17

111:                                              ; preds = %105, %99
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %112 = load i32, ptr %5, align 4
  switch i32 %112, label %119 [
    i32 11, label %113
    i32 1, label %117
  ]

113:                                              ; preds = %111
  %114 = load i32, ptr @ans, align 4, !tbaa !5
  %115 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %114)
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %115, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  br label %117

117:                                              ; preds = %113, %111
  %118 = load i32, ptr %1, align 4
  ret i32 %118

119:                                              ; preds = %111, %88
  unreachable
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP1PEvT_S2_(ptr noundef, ptr noundef) #4

declare i32 @puts(ptr noundef) #2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint 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 #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 = !{!13, !6, i64 0}
!13 = !{!"_ZTS1P", !6, i64 0, !6, i64 4, !6, i64 8}
!14 = !{!13, !6, i64 4}
!15 = !{!13, !6, i64 8}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !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.P = type { i32, i32, i32 }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@edge = external dso_local global [200010 x %struct.P], align 16
@fa = external dso_local local_unnamed_addr global [100010 x i32], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@ans = external dso_local local_unnamed_addr global i32, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %2 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %3 = load i32, ptr @m, align 4, !tbaa !5
  %.not39 = icmp slt i32 %3, 1
  br i1 %.not39, label %.._crit_edge_crit_edge, label %.lr.ph

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre60 = sext i32 %3 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre60, %.._crit_edge_crit_edge ], [ %19, %.lr.ph ]
  %4 = getelementptr inbounds %struct.P, ptr @edge, i64 %.pre-phi
  %5 = getelementptr inbounds i8, ptr %4, i64 12
  tail call void @_ZSt4sortIP1PEvT_S2_(ptr noundef nonnull getelementptr inbounds (i8, ptr @edge, i64 12), ptr noundef nonnull %5)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %.not3141 = icmp slt i32 %6, 1
  br i1 %.not3141, label %.preheader38, label %.lr.ph44.preheader

.lr.ph44.preheader:                               ; preds = %._crit_edge
  %7 = add nuw i32 %6, 1
  %wide.trip.count = zext i32 %7 to i64
  %8 = zext nneg i32 %6 to i64
  %min.iters.check = icmp ult i32 %6, 8
  br i1 %min.iters.check, label %.lr.ph44.preheader62, label %vector.ph

.lr.ph44.preheader62:                             ; preds = %middle.block, %.lr.ph44.preheader
  %indvars.iv54.ph = phi i64 [ 1, %.lr.ph44.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph44

vector.ph:                                        ; preds = %.lr.ph44.preheader
  %n.vec = and i64 %8, 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.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %offset.idx = or disjoint i64 %index, 1
  %9 = getelementptr inbounds [100010 x i32], ptr @fa, i64 0, i64 %offset.idx
  %10 = getelementptr inbounds i8, ptr %9, i64 16
  store <4 x i32> %vec.ind, ptr %9, align 4, !tbaa !5
  store <4 x i32> %step.add, ptr %10, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %11 = icmp eq i64 %index.next, %n.vec
  br i1 %11, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %8
  br i1 %cmp.n, label %.preheader38, label %.lr.ph44.preheader62

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %12 = getelementptr inbounds [200010 x %struct.P], ptr @edge, i64 0, i64 %indvars.iv
  %13 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %14 = getelementptr inbounds i8, ptr %12, i64 4
  %15 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %16 = getelementptr inbounds i8, ptr %12, i64 8
  %17 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 4 dereferenceable(4) %16)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %18 = load i32, ptr @m, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %.not.not = icmp slt i64 %indvars.iv, %19
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !13

.preheader38:                                     ; preds = %.lr.ph44, %middle.block, %._crit_edge
  %20 = load i32, ptr @m, align 4, !tbaa !5
  %.not3245 = icmp slt i32 %20, 1
  br i1 %.not3245, label %.preheader, label %.lr.ph47

.lr.ph44:                                         ; preds = %.lr.ph44.preheader62, %.lr.ph44
  %indvars.iv54 = phi i64 [ %indvars.iv.next55, %.lr.ph44 ], [ %indvars.iv54.ph, %.lr.ph44.preheader62 ]
  %21 = getelementptr inbounds [100010 x i32], ptr @fa, i64 0, i64 %indvars.iv54
  %22 = trunc nuw nsw i64 %indvars.iv54 to i32
  store i32 %22, ptr %21, align 4, !tbaa !5
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count
  br i1 %exitcond.not, label %.preheader38, label %.lr.ph44, !llvm.loop !14

.preheader.loopexit:                              ; preds = %38
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %.preheader38
  %23 = phi i32 [ %.pre, %.preheader.loopexit ], [ %6, %.preheader38 ]
  %.not3348 = icmp slt i32 %23, 2
  br i1 %.not3348, label %._crit_edge51, label %.lr.ph50

.lr.ph47:                                         ; preds = %.preheader38, %38
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %38 ], [ 1, %.preheader38 ]
  %24 = getelementptr inbounds [200010 x %struct.P], ptr @edge, i64 0, i64 %indvars.iv57
  %25 = load i32, ptr %24, align 4, !tbaa !15
  %26 = tail call noundef i32 @_Z3geti(i32 noundef %25)
  %27 = getelementptr inbounds i8, ptr %24, i64 4
  %28 = load i32, ptr %27, align 4, !tbaa !17
  %29 = tail call noundef i32 @_Z3geti(i32 noundef %28)
  %30 = icmp eq i32 %26, %29
  br i1 %30, label %38, label %31

31:                                               ; preds = %.lr.ph47
  %32 = sext i32 %26 to i64
  %33 = getelementptr inbounds [100010 x i32], ptr @fa, i64 0, i64 %32
  store i32 %29, ptr %33, align 4, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %24, i64 8
  %35 = load i32, ptr %34, align 4, !tbaa !18
  %36 = load i32, ptr @ans, align 4, !tbaa !5
  %37 = add nsw i32 %36, %35
  store i32 %37, ptr @ans, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %.lr.ph47, %31
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %39 = load i32, ptr @m, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %.not32.not = icmp slt i64 %indvars.iv57, %40
  br i1 %.not32.not, label %.lr.ph47, label %.preheader.loopexit, !llvm.loop !19

41:                                               ; preds = %.lr.ph50
  %42 = add nuw nsw i32 %.049, 1
  %43 = load i32, ptr @n, align 4, !tbaa !5
  %.not33.not = icmp slt i32 %.049, %43
  br i1 %.not33.not, label %.lr.ph50, label %._crit_edge51, !llvm.loop !20

.lr.ph50:                                         ; preds = %.preheader, %41
  %.049 = phi i32 [ %42, %41 ], [ 2, %.preheader ]
  %44 = tail call noundef i32 @_Z3geti(i32 noundef %.049)
  %45 = tail call noundef i32 @_Z3geti(i32 noundef 1)
  %.not34 = icmp eq i32 %44, %45
  br i1 %.not34, label %41, label %46

46:                                               ; preds = %.lr.ph50
  %47 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str)
  br label %51

._crit_edge51:                                    ; preds = %41, %.preheader
  %48 = load i32, ptr @ans, align 4, !tbaa !5
  %49 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %48)
  %50 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %49, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %51

51:                                               ; preds = %46, %._crit_edge51
  ret i32 0
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP1PEvT_S2_(ptr noundef, ptr noundef) local_unnamed_addr #3

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #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 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 #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 = { inlinehint 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 #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!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, !12, !11}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTS1P", !6, i64 0, !6, i64 4, !6, i64 8}
!17 = !{!16, !6, i64 4}
!18 = !{!16, !6, i64 8}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}


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