; LLVM IR from Tunghohin/Competitive_Coding :: Uva (uva1395)

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

@e = external dso_local global [10010 x %struct.edge], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #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 i32, 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
  %13 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %14 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %15 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %16 = getelementptr i8, ptr %15, i64 -24
  %17 = load i64, ptr %16, align 8
  %18 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %17
  %19 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %18, ptr noundef null)
  %20 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %21 = getelementptr i8, ptr %20, i64 -24
  %22 = load i64, ptr %21, align 8
  %23 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %22
  %24 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %23, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  br label %25

25:                                               ; preds = %111, %0
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %28 = load i32, ptr %2, align 4, !tbaa !8
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %33, label %30

30:                                               ; preds = %25
  %31 = load i32, ptr %3, align 4, !tbaa !8
  %32 = icmp ne i32 %31, 0
  br label %33

33:                                               ; preds = %30, %25
  %34 = phi i1 [ true, %25 ], [ %32, %30 ]
  br i1 %34, label %35, label %112

35:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 1, ptr %4, align 4, !tbaa !8
  br label %36

36:                                               ; preds = %54, %35
  %37 = load i32, ptr %4, align 4, !tbaa !8
  %38 = load i32, ptr %3, align 4, !tbaa !8
  %39 = icmp sle i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %57

41:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  %42 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %43 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %42, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %44 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %43, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.start.p0(i64 12, ptr %8) #8
  %45 = getelementptr inbounds %struct.edge, ptr %8, i32 0, i32 0
  %46 = load i32, ptr %5, align 4, !tbaa !8
  store i32 %46, ptr %45, align 4, !tbaa !11
  %47 = getelementptr inbounds %struct.edge, ptr %8, i32 0, i32 1
  %48 = load i32, ptr %6, align 4, !tbaa !8
  store i32 %48, ptr %47, align 4, !tbaa !13
  %49 = getelementptr inbounds %struct.edge, ptr %8, i32 0, i32 2
  %50 = load i32, ptr %7, align 4, !tbaa !8
  store i32 %50, ptr %49, align 4, !tbaa !14
  %51 = load i32, ptr %4, align 4, !tbaa !8
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [10010 x %struct.edge], ptr @e, i64 0, i64 %52
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %53, ptr align 4 %8, i64 12, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 12, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  br label %54

54:                                               ; preds = %41
  %55 = load i32, ptr %4, align 4, !tbaa !8
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %4, align 4, !tbaa !8
  br label %36, !llvm.loop !16

57:                                               ; preds = %40
  %58 = load i32, ptr %3, align 4, !tbaa !8
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds %struct.edge, ptr getelementptr inbounds (%struct.edge, ptr @e, i64 1), i64 %59
  call void @_ZSt4sortIP4edgeEvT_S2_(ptr noundef getelementptr inbounds (%struct.edge, ptr @e, i64 1), ptr noundef %60)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 1061109567, ptr %9, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 1, ptr %10, align 4, !tbaa !8
  br label %61

61:                                               ; preds = %98, %57
  %62 = load i32, ptr %10, align 4, !tbaa !8
  %63 = load i32, ptr %3, align 4, !tbaa !8
  %64 = icmp sle i32 %62, %63
  br i1 %64, label %66, label %65

65:                                               ; preds = %61
  store i32 7, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %101

66:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %67 = load i32, ptr %10, align 4, !tbaa !8
  store i32 %67, ptr %12, align 4, !tbaa !8
  br label %68

68:                                               ; preds = %93, %66
  %69 = load i32, ptr %12, align 4, !tbaa !8
  %70 = load i32, ptr %3, align 4, !tbaa !8
  %71 = icmp sle i32 %69, %70
  br i1 %71, label %73, label %72

72:                                               ; preds = %68
  store i32 10, ptr %11, align 4
  br label %96

73:                                               ; preds = %68
  %74 = load i32, ptr %10, align 4, !tbaa !8
  %75 = load i32, ptr %12, align 4, !tbaa !8
  %76 = load i32, ptr %2, align 4, !tbaa !8
  %77 = call noundef zeroext i1 @_Z7kruskaliii(i32 noundef %74, i32 noundef %75, i32 noundef %76)
  br i1 %77, label %78, label %92

78:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  %79 = load i32, ptr %12, align 4, !tbaa !8
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [10010 x %struct.edge], ptr @e, i64 0, i64 %80
  %82 = getelementptr inbounds %struct.edge, ptr %81, i32 0, i32 2
  %83 = load i32, ptr %82, align 4, !tbaa !14
  %84 = load i32, ptr %10, align 4, !tbaa !8
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [10010 x %struct.edge], ptr @e, i64 0, i64 %85
  %87 = getelementptr inbounds %struct.edge, ptr %86, i32 0, i32 2
  %88 = load i32, ptr %87, align 4, !tbaa !14
  %89 = sub nsw i32 %83, %88
  store i32 %89, ptr %13, align 4, !tbaa !8
  %90 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %91 = load i32, ptr %90, align 4, !tbaa !8
  store i32 %91, ptr %9, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  store i32 10, ptr %11, align 4
  br label %96

92:                                               ; preds = %73
  br label %93

93:                                               ; preds = %92
  %94 = load i32, ptr %12, align 4, !tbaa !8
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %12, align 4, !tbaa !8
  br label %68, !llvm.loop !18

96:                                               ; preds = %78, %72
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %97

97:                                               ; preds = %96
  br label %98

98:                                               ; preds = %97
  %99 = load i32, ptr %10, align 4, !tbaa !8
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %10, align 4, !tbaa !8
  br label %61, !llvm.loop !19

101:                                              ; preds = %65
  %102 = load i32, ptr %9, align 4, !tbaa !8
  %103 = icmp eq i32 %102, 1061109567
  br i1 %103, label %104, label %107

104:                                              ; preds = %101
  %105 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  %106 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %105, i8 noundef signext 10)
  br label %111

107:                                              ; preds = %101
  %108 = load i32, ptr %9, align 4, !tbaa !8
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %108)
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %109, i8 noundef signext 10)
  br label %111

111:                                              ; preds = %107, %104
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %25, !llvm.loop !20

112:                                              ; preds = %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  %113 = load i32, ptr %1, align 4
  ret i32 %113
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #3

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #4 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #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) #5

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #7

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #6

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !9, i64 0}
!12 = !{!"_ZTS4edge", !9, i64 0, !9, i64 4, !9, i64 8}
!13 = !{!12, !9, i64 4}
!14 = !{!12, !9, i64 8}
!15 = !{i64 0, i64 4, !8, i64 4, i64 4, !8, i64 8, i64 4, !8}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !17}
!20 = distinct !{!20, !17}


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

@e = external dso_local global [10010 x %struct.edge], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #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 i32, align 4
  %8 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %9 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %11
  %13 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  %14 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %15 = getelementptr i8, ptr %14, i64 -24
  %16 = load i64, ptr %15, align 8
  %17 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %16
  %18 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %17, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %21 = load i32, ptr %1, align 4, !tbaa !8
  %22 = icmp ne i32 %21, 0
  %23 = load i32, ptr %2, align 4
  %24 = icmp ne i32 %23, 0
  %25 = select i1 %22, i1 true, i1 %24
  br i1 %25, label %.preheader19, label %._crit_edge30

.preheader19:                                     ; preds = %0, %._crit_edge29.thread
  %26 = phi i32 [ %64, %._crit_edge29.thread ], [ %23, %0 ]
  %.not21 = icmp slt i32 %26, 1
  br i1 %.not21, label %.preheader19.._crit_edge_crit_edge, label %.lr.ph

.preheader19.._crit_edge_crit_edge:               ; preds = %.preheader19
  %.pre38 = sext i32 %26 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.preheader19.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre38, %.preheader19.._crit_edge_crit_edge ], [ %37, %.lr.ph ]
  %27 = getelementptr inbounds %struct.edge, ptr getelementptr inbounds (i8, ptr @e, i64 12), i64 %.pre-phi
  call void @_ZSt4sortIP4edgeEvT_S2_(ptr noundef nonnull getelementptr inbounds (i8, ptr @e, i64 12), ptr noundef nonnull %27)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  store i32 1061109567, ptr %6, align 4, !tbaa !8
  %28 = load i32, ptr %2, align 4, !tbaa !8
  %.not1726 = icmp slt i32 %28, 1
  br i1 %.not1726, label %._crit_edge29.thread, label %.preheader

.lr.ph:                                           ; preds = %.preheader19, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.preheader19 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %29, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %32 = load i32, ptr %3, align 4, !tbaa !8
  %33 = load i32, ptr %4, align 4, !tbaa !8
  %34 = load i32, ptr %5, align 4, !tbaa !8
  %35 = getelementptr inbounds [10010 x %struct.edge], ptr @e, i64 0, i64 %indvars.iv
  store i32 %32, ptr %35, align 4, !tbaa !8
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %35, i64 4
  store i32 %33, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !8
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %35, i64 8
  store i32 %34, ptr %.sroa.5.0..sroa_idx, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %36 = load i32, ptr %2, align 4, !tbaa !8
  %37 = sext i32 %36 to i64
  %.not.not = icmp slt i64 %indvars.iv, %37
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader:                                       ; preds = %._crit_edge, %.loopexit
  %38 = phi i32 [ %56, %.loopexit ], [ %28, %._crit_edge ]
  %indvars.iv34 = phi i64 [ %indvars.iv.next35, %.loopexit ], [ 1, %._crit_edge ]
  %39 = sext i32 %38 to i64
  %.not1823 = icmp sgt i64 %indvars.iv34, %39
  br i1 %.not1823, label %.loopexit, label %.lr.ph25.preheader

.lr.ph25.preheader:                               ; preds = %.preheader
  %40 = trunc nuw nsw i64 %indvars.iv34 to i32
  br label %.lr.ph25

._crit_edge29:                                    ; preds = %.loopexit
  %.pre37 = load i32, ptr %6, align 4, !tbaa !8
  %41 = icmp eq i32 %.pre37, 1061109567
  %spec.select = select i1 %41, i32 -1, i32 %.pre37
  br label %._crit_edge29.thread

.lr.ph25:                                         ; preds = %.lr.ph25.preheader, %53
  %.024 = phi i32 [ %54, %53 ], [ %40, %.lr.ph25.preheader ]
  %42 = load i32, ptr %1, align 4, !tbaa !8
  %43 = call noundef zeroext i1 @_Z7kruskaliii(i32 noundef %40, i32 noundef %.024, i32 noundef %42)
  br i1 %43, label %44, label %53

44:                                               ; preds = %.lr.ph25
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  %45 = zext nneg i32 %.024 to i64
  %46 = getelementptr inbounds [10010 x %struct.edge], ptr @e, i64 0, i64 %45, i32 2
  %47 = load i32, ptr %46, align 4, !tbaa !13
  %48 = getelementptr inbounds [10010 x %struct.edge], ptr @e, i64 0, i64 %indvars.iv34, i32 2
  %49 = load i32, ptr %48, align 4, !tbaa !13
  %50 = sub nsw i32 %47, %49
  store i32 %50, ptr %7, align 4, !tbaa !8
  %51 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %52 = load i32, ptr %51, align 4, !tbaa !8
  store i32 %52, ptr %6, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  %.pre = load i32, ptr %2, align 4, !tbaa !8
  br label %.loopexit

53:                                               ; preds = %.lr.ph25
  %54 = add nuw nsw i32 %.024, 1
  %55 = load i32, ptr %2, align 4, !tbaa !8
  %.not18.not = icmp slt i32 %.024, %55
  br i1 %.not18.not, label %.lr.ph25, label %.loopexit, !llvm.loop !15

.loopexit:                                        ; preds = %53, %.preheader, %44
  %56 = phi i32 [ %38, %.preheader ], [ %.pre, %44 ], [ %55, %53 ]
  %indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1
  %57 = sext i32 %56 to i64
  %.not17.not = icmp slt i64 %indvars.iv34, %57
  br i1 %.not17.not, label %.preheader, label %._crit_edge29, !llvm.loop !16

._crit_edge29.thread:                             ; preds = %._crit_edge29, %._crit_edge
  %.pre37.sink = phi i32 [ -1, %._crit_edge ], [ %spec.select, %._crit_edge29 ]
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.pre37.sink)
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %58, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %61 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %60, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %62 = load i32, ptr %1, align 4, !tbaa !8
  %63 = icmp ne i32 %62, 0
  %64 = load i32, ptr %2, align 4
  %65 = icmp ne i32 %64, 0
  %66 = select i1 %63, i1 true, i1 %65
  br i1 %66, label %.preheader19, label %._crit_edge30, !llvm.loop !17

._crit_edge30:                                    ; preds = %._crit_edge29.thread, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #4 align 2

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 #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #5

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) 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 = { "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 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 #5 = { 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 #6 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !9, i64 8}
!14 = !{!"_ZTS4edge", !9, i64 0, !9, i64 4, !9, i64 8}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


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