; LLVM IR from smv1999/CompetitiveProgrammingQuestionBank :: Data Structures/Graphs/Boruvka_algorithm_for_finding_MST.ll (Z16boruvkaAlgorithmv)

; 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_ostream" = type { ptr, %"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 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@min_edge = external dso_local global [100007 x i32], align 16
@g = external dso_local global [100007 x %struct.edge], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [60 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z8init_divv() #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z16boruvkaAlgorithmv() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %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
  call void @_Z8init_divv()
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  %8 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %8, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  store i64 0, ptr %2, align 8, !tbaa !9
  br label %9

9:                                                ; preds = %163, %0
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 1
  br i1 %11, label %12, label %164

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

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

17:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %25

18:                                               ; preds = %13
  %19 = load i32, ptr %3, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [100007 x i32], ptr @min_edge, i64 0, i64 %20
  store i32 -1, ptr %21, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %18
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %3, align 4, !tbaa !5
  br label %13, !llvm.loop !11

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

26:                                               ; preds = %111, %25
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = load i32, ptr @m, align 4, !tbaa !5
  %29 = icmp sle i32 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %114

31:                                               ; preds = %26
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [100007 x %struct.edge], ptr @g, i64 0, i64 %33
  %35 = getelementptr inbounds %struct.edge, ptr %34, i32 0, i32 0
  %36 = load i32, ptr %35, align 4, !tbaa !13
  %37 = call noundef i32 @_Z4rooti(i32 noundef %36)
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [100007 x %struct.edge], ptr @g, i64 0, i64 %39
  %41 = getelementptr inbounds %struct.edge, ptr %40, i32 0, i32 1
  %42 = load i32, ptr %41, align 4, !tbaa !15
  %43 = call noundef i32 @_Z4rooti(i32 noundef %42)
  %44 = icmp eq i32 %37, %43
  br i1 %44, label %45, label %46

45:                                               ; preds = %31
  br label %111

46:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [100007 x %struct.edge], ptr @g, i64 0, i64 %48
  %50 = getelementptr inbounds %struct.edge, ptr %49, i32 0, i32 0
  %51 = load i32, ptr %50, align 4, !tbaa !13
  %52 = call noundef i32 @_Z4rooti(i32 noundef %51)
  store i32 %52, ptr %5, align 4, !tbaa !5
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [100007 x i32], ptr @min_edge, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = icmp eq i32 %56, -1
  br i1 %57, label %73, label %58

58:                                               ; preds = %46
  %59 = load i32, ptr %4, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [100007 x %struct.edge], ptr @g, i64 0, i64 %60
  %62 = getelementptr inbounds %struct.edge, ptr %61, i32 0, i32 2
  %63 = load i32, ptr %62, align 4, !tbaa !16
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [100007 x i32], ptr @min_edge, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [100007 x %struct.edge], ptr @g, i64 0, i64 %68
  %70 = getelementptr inbounds %struct.edge, ptr %69, i32 0, i32 2
  %71 = load i32, ptr %70, align 4, !tbaa !16
  %72 = icmp slt i32 %63, %71
  br i1 %72, label %73, label %78

73:                                               ; preds = %58, %46
  %74 = load i32, ptr %4, align 4, !tbaa !5
  %75 = load i32, ptr %5, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [100007 x i32], ptr @min_edge, i64 0, i64 %76
  store i32 %74, ptr %77, align 4, !tbaa !5
  br label %78

78:                                               ; preds = %73, %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %79 = load i32, ptr %4, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [100007 x %struct.edge], ptr @g, i64 0, i64 %80
  %82 = getelementptr inbounds %struct.edge, ptr %81, i32 0, i32 1
  %83 = load i32, ptr %82, align 4, !tbaa !15
  %84 = call noundef i32 @_Z4rooti(i32 noundef %83)
  store i32 %84, ptr %6, align 4, !tbaa !5
  %85 = load i32, ptr %6, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [100007 x i32], ptr @min_edge, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = icmp eq i32 %88, -1
  br i1 %89, label %105, label %90

90:                                               ; preds = %78
  %91 = load i32, ptr %4, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [100007 x %struct.edge], ptr @g, i64 0, i64 %92
  %94 = getelementptr inbounds %struct.edge, ptr %93, i32 0, i32 2
  %95 = load i32, ptr %94, align 4, !tbaa !16
  %96 = load i32, ptr %5, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [100007 x i32], ptr @min_edge, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [100007 x %struct.edge], ptr @g, i64 0, i64 %100
  %102 = getelementptr inbounds %struct.edge, ptr %101, i32 0, i32 2
  %103 = load i32, ptr %102, align 4, !tbaa !16
  %104 = icmp slt i32 %95, %103
  br i1 %104, label %105, label %110

105:                                              ; preds = %90, %78
  %106 = load i32, ptr %4, align 4, !tbaa !5
  %107 = load i32, ptr %6, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100007 x i32], ptr @min_edge, i64 0, i64 %108
  store i32 %106, ptr %109, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %105, %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %111

111:                                              ; preds = %110, %45
  %112 = load i32, ptr %4, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %4, align 4, !tbaa !5
  br label %26, !llvm.loop !17

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

115:                                              ; preds = %160, %114
  %116 = load i32, ptr %7, align 4, !tbaa !5
  %117 = load i32, ptr @n, align 4, !tbaa !5
  %118 = icmp sle i32 %116, %117
  br i1 %118, label %120, label %119

119:                                              ; preds = %115
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %163

120:                                              ; preds = %115
  %121 = load i32, ptr %7, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [100007 x i32], ptr @min_edge, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %125 = icmp ne i32 %124, -1
  br i1 %125, label %126, label %159

126:                                              ; preds = %120
  %127 = load i32, ptr %7, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [100007 x i32], ptr @min_edge, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [100007 x %struct.edge], ptr @g, i64 0, i64 %131
  %133 = getelementptr inbounds %struct.edge, ptr %132, i32 0, i32 0
  %134 = load i32, ptr %133, align 4, !tbaa !13
  %135 = load i32, ptr %7, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [100007 x i32], ptr @min_edge, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [100007 x %struct.edge], ptr @g, i64 0, i64 %139
  %141 = getelementptr inbounds %struct.edge, ptr %140, i32 0, i32 1
  %142 = load i32, ptr %141, align 4, !tbaa !15
  %143 = call noundef zeroext i1 @_Z5mergeii(i32 noundef %134, i32 noundef %142)
  br i1 %143, label %144, label %158

144:                                              ; preds = %126
  %145 = load i32, ptr %7, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [100007 x i32], ptr @min_edge, i64 0, i64 %146
  %148 = load i32, ptr %147, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [100007 x %struct.edge], ptr @g, i64 0, i64 %149
  %151 = getelementptr inbounds %struct.edge, ptr %150, i32 0, i32 2
  %152 = load i32, ptr %151, align 4, !tbaa !16
  %153 = sext i32 %152 to i64
  %154 = load i64, ptr %2, align 8, !tbaa !9
  %155 = add nsw i64 %154, %153
  store i64 %155, ptr %2, align 8, !tbaa !9
  %156 = load i32, ptr %1, align 4, !tbaa !5
  %157 = add nsw i32 %156, -1
  store i32 %157, ptr %1, align 4, !tbaa !5
  br label %158

158:                                              ; preds = %144, %126
  br label %159

159:                                              ; preds = %158, %120
  br label %160

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

163:                                              ; preds = %119
  br label %9, !llvm.loop !19

164:                                              ; preds = %9
  %165 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %166 = load i64, ptr %2, align 8, !tbaa !9
  %167 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %165, i64 noundef %166)
  %168 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %167, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #0 align 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)) #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 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTS4edge", !6, i64 0, !6, i64 4, !6, i64 8}
!15 = !{!14, !6, i64 4}
!16 = !{!14, !6, i64 8}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


; 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_ostream" = type { ptr, %"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 }

@n = external dso_local local_unnamed_addr global i32, align 4
@m = external dso_local local_unnamed_addr global i32, align 4
@min_edge = external dso_local local_unnamed_addr global [100007 x i32], align 16
@g = external dso_local local_unnamed_addr global [100007 x %struct.edge], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [60 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z8init_divv() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z16boruvkaAlgorithmv() local_unnamed_addr #0 {
  tail call void @_Z8init_divv()
  %1 = load i32, ptr @n, align 4, !tbaa !5
  %2 = icmp sgt i32 %1, 1
  br i1 %2, label %.preheader41, label %._crit_edge

.loopexit:                                        ; preds = %70, %.preheader
  %3 = phi i32 [ %9, %.preheader ], [ %71, %70 ]
  %.131.lcssa = phi i64 [ %.03053, %.preheader ], [ %.232, %70 ]
  %.1.lcssa = phi i32 [ %.02954, %.preheader ], [ %.2, %70 ]
  %4 = icmp sgt i32 %.1.lcssa, 1
  br i1 %4, label %.preheader41, label %._crit_edge, !llvm.loop !9

.preheader41:                                     ; preds = %0, %.loopexit
  %5 = phi i32 [ %3, %.loopexit ], [ %1, %0 ]
  %.02954 = phi i32 [ %.1.lcssa, %.loopexit ], [ %1, %0 ]
  %.03053 = phi i64 [ %.131.lcssa, %.loopexit ], [ 0, %0 ]
  %.not42 = icmp slt i32 %5, 1
  br i1 %.not42, label %.preheader40, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader41
  %6 = zext nneg i32 %5 to i64
  %7 = shl nuw nsw i64 %6, 2
  tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @min_edge, i64 4), i8 -1, i64 %7, i1 false), !tbaa !5
  br label %.preheader40

.preheader40:                                     ; preds = %.lr.ph.preheader, %.preheader41
  %8 = load i32, ptr @m, align 4, !tbaa !5
  %.not3744 = icmp slt i32 %8, 1
  br i1 %.not3744, label %.preheader, label %.lr.ph46

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

.preheader:                                       ; preds = %.preheader.loopexit, %.preheader40
  %9 = phi i32 [ %.pre, %.preheader.loopexit ], [ %5, %.preheader40 ]
  %.not3847 = icmp slt i32 %9, 1
  br i1 %.not3847, label %.loopexit, label %.lr.ph51

.lr.ph46:                                         ; preds = %.preheader40, %50
  %indvars.iv = phi i64 [ %indvars.iv.next, %50 ], [ 1, %.preheader40 ]
  %10 = getelementptr inbounds [100007 x %struct.edge], ptr @g, i64 0, i64 %indvars.iv
  %11 = load i32, ptr %10, align 4, !tbaa !11
  %12 = tail call noundef i32 @_Z4rooti(i32 noundef %11)
  %13 = getelementptr inbounds i8, ptr %10, i64 4
  %14 = load i32, ptr %13, align 4, !tbaa !13
  %15 = tail call noundef i32 @_Z4rooti(i32 noundef %14)
  %16 = icmp eq i32 %12, %15
  br i1 %16, label %50, label %17

17:                                               ; preds = %.lr.ph46
  %18 = load i32, ptr %10, align 4, !tbaa !11
  %19 = tail call noundef i32 @_Z4rooti(i32 noundef %18)
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [100007 x i32], ptr @min_edge, i64 0, i64 %20
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = icmp eq i32 %22, -1
  br i1 %23, label %31, label %24

24:                                               ; preds = %17
  %25 = getelementptr inbounds i8, ptr %10, i64 8
  %26 = load i32, ptr %25, align 4, !tbaa !14
  %27 = sext i32 %22 to i64
  %28 = getelementptr inbounds [100007 x %struct.edge], ptr @g, i64 0, i64 %27, i32 2
  %29 = load i32, ptr %28, align 4, !tbaa !14
  %30 = icmp slt i32 %26, %29
  br i1 %30, label %31, label %33

31:                                               ; preds = %24, %17
  %32 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %32, ptr %21, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %31, %24
  %34 = load i32, ptr %13, align 4, !tbaa !13
  %35 = tail call noundef i32 @_Z4rooti(i32 noundef %34)
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [100007 x i32], ptr @min_edge, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = icmp eq i32 %38, -1
  br i1 %39, label %48, label %40

40:                                               ; preds = %33
  %41 = getelementptr inbounds i8, ptr %10, i64 8
  %42 = load i32, ptr %41, align 4, !tbaa !14
  %43 = load i32, ptr %21, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [100007 x %struct.edge], ptr @g, i64 0, i64 %44, i32 2
  %46 = load i32, ptr %45, align 4, !tbaa !14
  %47 = icmp slt i32 %42, %46
  br i1 %47, label %48, label %50

48:                                               ; preds = %40, %33
  %49 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %49, ptr %37, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %40, %48, %.lr.ph46
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %51 = load i32, ptr @m, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %.not37.not = icmp slt i64 %indvars.iv, %52
  br i1 %.not37.not, label %.lr.ph46, label %.preheader.loopexit, !llvm.loop !15

.lr.ph51:                                         ; preds = %.preheader, %70
  %indvars.iv58 = phi i64 [ %indvars.iv.next59, %70 ], [ 1, %.preheader ]
  %.149 = phi i32 [ %.2, %70 ], [ %.02954, %.preheader ]
  %.13148 = phi i64 [ %.232, %70 ], [ %.03053, %.preheader ]
  %53 = getelementptr inbounds [100007 x i32], ptr @min_edge, i64 0, i64 %indvars.iv58
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %.not39 = icmp eq i32 %54, -1
  br i1 %.not39, label %70, label %55

55:                                               ; preds = %.lr.ph51
  %56 = sext i32 %54 to i64
  %57 = getelementptr inbounds [100007 x %struct.edge], ptr @g, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !11
  %59 = getelementptr inbounds i8, ptr %57, i64 4
  %60 = load i32, ptr %59, align 4, !tbaa !13
  %61 = tail call noundef zeroext i1 @_Z5mergeii(i32 noundef %58, i32 noundef %60)
  br i1 %61, label %62, label %70

62:                                               ; preds = %55
  %63 = load i32, ptr %53, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100007 x %struct.edge], ptr @g, i64 0, i64 %64, i32 2
  %66 = load i32, ptr %65, align 4, !tbaa !14
  %67 = sext i32 %66 to i64
  %68 = add nsw i64 %.13148, %67
  %69 = add nsw i32 %.149, -1
  br label %70

70:                                               ; preds = %.lr.ph51, %62, %55
  %.232 = phi i64 [ %68, %62 ], [ %.13148, %55 ], [ %.13148, %.lr.ph51 ]
  %.2 = phi i32 [ %69, %62 ], [ %.149, %55 ], [ %.149, %.lr.ph51 ]
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %71 = load i32, ptr @n, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %.not38.not = icmp slt i64 %indvars.iv58, %72
  br i1 %.not38.not, label %.lr.ph51, label %.loopexit, !llvm.loop !16

._crit_edge:                                      ; preds = %.loopexit, %0
  %.030.lcssa = phi i64 [ 0, %0 ], [ %.131.lcssa, %.loopexit ]
  %73 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  %74 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %73, i64 noundef %.030.lcssa)
  %75 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %74, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #0 align 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)) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 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 #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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, !6, i64 8}
!13 = !{!12, !6, i64 4}
!14 = !{!12, !6, i64 8}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


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