; LLVM IR from sbshah97/DS-Algo-Handbook :: Algorithms/Graph_Algorithms/Prim's_MST (MST_PRIM)

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

@ne = external dso_local global i32, align 4
@visited = external dso_local global [10 x i32], align 16
@mincost = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [29 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@n = external dso_local global i32, align 4
@.str.2 = external hidden unnamed_addr constant [31 x i8], align 1
@i = external dso_local global i32, align 4
@j = external dso_local global i32, align 4
@cost = external dso_local global [10 x [10 x i32]], align 16
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@min = external dso_local global i32, align 4
@u = external dso_local global i32, align 4
@a = external dso_local global i32, align 4
@v = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@.str.4 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @main() #0 {
  %1 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n)
  %3 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  store i32 1, ptr @i, align 4, !tbaa !5
  br label %4

4:                                                ; preds = %41, %0
  %5 = load i32, ptr @i, align 4, !tbaa !5
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %7 = icmp sle i32 %5, %6
  br i1 %7, label %8, label %44

8:                                                ; preds = %4
  store i32 1, ptr @j, align 4, !tbaa !5
  br label %9

9:                                                ; preds = %37, %8
  %10 = load i32, ptr @j, align 4, !tbaa !5
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = icmp sle i32 %10, %11
  br i1 %12, label %13, label %40

13:                                               ; preds = %9
  %14 = load i32, ptr @i, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [10 x [10 x i32]], ptr @cost, i64 0, i64 %15
  %17 = load i32, ptr @j, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [10 x i32], ptr %16, i64 0, i64 %18
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %19)
  %21 = load i32, ptr @i, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [10 x [10 x i32]], ptr @cost, i64 0, i64 %22
  %24 = load i32, ptr @j, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [10 x i32], ptr %23, i64 0, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %29, label %36

29:                                               ; preds = %13
  %30 = load i32, ptr @i, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [10 x [10 x i32]], ptr @cost, i64 0, i64 %31
  %33 = load i32, ptr @j, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [10 x i32], ptr %32, i64 0, i64 %34
  store i32 999, ptr %35, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %29, %13
  br label %37

37:                                               ; preds = %36
  %38 = load i32, ptr @j, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr @j, align 4, !tbaa !5
  br label %9, !llvm.loop !9

40:                                               ; preds = %9
  br label %41

41:                                               ; preds = %40
  %42 = load i32, ptr @i, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr @i, align 4, !tbaa !5
  br label %4, !llvm.loop !11

44:                                               ; preds = %4
  store i32 1, ptr getelementptr inbounds ([10 x i32], ptr @visited, i64 0, i64 2), align 8, !tbaa !5
  %45 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %46

46:                                               ; preds = %120, %44
  %47 = load i32, ptr @ne, align 4, !tbaa !5
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %49 = icmp slt i32 %47, %48
  br i1 %49, label %50, label %133

50:                                               ; preds = %46
  store i32 1, ptr @i, align 4, !tbaa !5
  store i32 999, ptr @min, align 4, !tbaa !5
  br label %51

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

55:                                               ; preds = %51
  store i32 1, ptr @j, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %88, %55
  %57 = load i32, ptr @j, align 4, !tbaa !5
  %58 = load i32, ptr @n, align 4, !tbaa !5
  %59 = icmp sle i32 %57, %58
  br i1 %59, label %60, label %91

60:                                               ; preds = %56
  %61 = load i32, ptr @i, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [10 x [10 x i32]], ptr @cost, i64 0, i64 %62
  %64 = load i32, ptr @j, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [10 x i32], ptr %63, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = load i32, ptr @min, align 4, !tbaa !5
  %69 = icmp slt i32 %67, %68
  br i1 %69, label %70, label %87

70:                                               ; preds = %60
  %71 = load i32, ptr @i, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [10 x i32], ptr @visited, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %86

76:                                               ; preds = %70
  %77 = load i32, ptr @i, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [10 x [10 x i32]], ptr @cost, i64 0, i64 %78
  %80 = load i32, ptr @j, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [10 x i32], ptr %79, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  store i32 %83, ptr @min, align 4, !tbaa !5
  %84 = load i32, ptr @i, align 4, !tbaa !5
  store i32 %84, ptr @u, align 4, !tbaa !5
  store i32 %84, ptr @a, align 4, !tbaa !5
  %85 = load i32, ptr @j, align 4, !tbaa !5
  store i32 %85, ptr @v, align 4, !tbaa !5
  store i32 %85, ptr @b, align 4, !tbaa !5
  br label %86

86:                                               ; preds = %76, %70
  br label %87

87:                                               ; preds = %86, %60
  br label %88

88:                                               ; preds = %87
  %89 = load i32, ptr @j, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr @j, align 4, !tbaa !5
  br label %56, !llvm.loop !12

91:                                               ; preds = %56
  br label %92

92:                                               ; preds = %91
  %93 = load i32, ptr @i, align 4, !tbaa !5
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr @i, align 4, !tbaa !5
  br label %51, !llvm.loop !13

95:                                               ; preds = %51
  %96 = load i32, ptr @u, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [10 x i32], ptr @visited, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = icmp eq i32 %99, 0
  br i1 %100, label %107, label %101

101:                                              ; preds = %95
  %102 = load i32, ptr @v, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [10 x i32], ptr @visited, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = icmp eq i32 %105, 0
  br i1 %106, label %107, label %120

107:                                              ; preds = %101, %95
  %108 = load i32, ptr @ne, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr @ne, align 4, !tbaa !5
  %110 = load i32, ptr @a, align 4, !tbaa !5
  %111 = load i32, ptr @b, align 4, !tbaa !5
  %112 = load i32, ptr @min, align 4, !tbaa !5
  %113 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %108, i32 noundef %110, i32 noundef %111, i32 noundef %112)
  %114 = load i32, ptr @min, align 4, !tbaa !5
  %115 = load i32, ptr @mincost, align 4, !tbaa !5
  %116 = add nsw i32 %115, %114
  store i32 %116, ptr @mincost, align 4, !tbaa !5
  %117 = load i32, ptr @b, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [10 x i32], ptr @visited, i64 0, i64 %118
  store i32 1, ptr %119, align 4, !tbaa !5
  br label %120

120:                                              ; preds = %107, %101
  %121 = load i32, ptr @b, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [10 x [10 x i32]], ptr @cost, i64 0, i64 %122
  %124 = load i32, ptr @a, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [10 x i32], ptr %123, i64 0, i64 %125
  store i32 999, ptr %126, align 4, !tbaa !5
  %127 = load i32, ptr @a, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [10 x [10 x i32]], ptr @cost, i64 0, i64 %128
  %130 = load i32, ptr @b, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [10 x i32], ptr %129, i64 0, i64 %131
  store i32 999, ptr %132, align 4, !tbaa !5
  br label %46, !llvm.loop !14

133:                                              ; preds = %46
  %134 = load i32, ptr @mincost, align 4, !tbaa !5
  %135 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %134)
  ret void
}

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

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

attributes #0 = { 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 #1 = { "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/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !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"

@ne = external dso_local local_unnamed_addr global i32, align 4
@visited = external dso_local local_unnamed_addr global [10 x i32], align 16
@mincost = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [29 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@n = external dso_local global i32, align 4
@.str.2 = external hidden unnamed_addr constant [31 x i8], align 1
@i = external dso_local local_unnamed_addr global i32, align 4
@j = external dso_local local_unnamed_addr global i32, align 4
@cost = external dso_local global [10 x [10 x i32]], align 16
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@min = external dso_local local_unnamed_addr global i32, align 4
@u = external dso_local local_unnamed_addr global i32, align 4
@a = external dso_local local_unnamed_addr global i32, align 4
@v = external dso_local local_unnamed_addr global i32, align 4
@b = external dso_local local_unnamed_addr global i32, align 4
@.str.4 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: nofree nounwind uwtable
define dso_local void @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  store i32 1, ptr @i, align 4, !tbaa !5
  %4 = load i32, ptr @n, align 4, !tbaa !5
  %.not12 = icmp slt i32 %4, 1
  br i1 %.not12, label %._crit_edge13, label %.preheader9

.preheader9:                                      ; preds = %0, %._crit_edge
  %5 = phi i32 [ %23, %._crit_edge ], [ %4, %0 ]
  %6 = phi i32 [ %25, %._crit_edge ], [ 1, %0 ]
  store i32 1, ptr @j, align 4, !tbaa !5
  %.not810 = icmp slt i32 %5, 1
  br i1 %.not810, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader9, %20
  %7 = phi i32 [ %12, %20 ], [ %6, %.preheader9 ]
  %storemerge711 = phi i32 [ %21, %20 ], [ 1, %.preheader9 ]
  %8 = sext i32 %7 to i64
  %9 = sext i32 %storemerge711 to i64
  %10 = getelementptr inbounds [10 x [10 x i32]], ptr @cost, i64 0, i64 %8, i64 %9
  %11 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %10)
  %12 = load i32, ptr @i, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = load i32, ptr @j, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [10 x [10 x i32]], ptr @cost, i64 0, i64 %13, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %19, label %20

19:                                               ; preds = %.lr.ph
  store i32 999, ptr %16, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %.lr.ph, %19
  %21 = add nsw i32 %14, 1
  store i32 %21, ptr @j, align 4, !tbaa !5
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %.not8.not = icmp slt i32 %14, %22
  br i1 %.not8.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %20, %.preheader9
  %23 = phi i32 [ %5, %.preheader9 ], [ %22, %20 ]
  %24 = phi i32 [ %6, %.preheader9 ], [ %12, %20 ]
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr @i, align 4, !tbaa !5
  %.not.not = icmp slt i32 %24, %23
  br i1 %.not.not, label %.preheader9, label %._crit_edge13, !llvm.loop !11

._crit_edge13:                                    ; preds = %._crit_edge, %0
  store i32 1, ptr getelementptr inbounds (i8, ptr @visited, i64 8), align 8, !tbaa !5
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %27 = load i32, ptr @ne, align 4, !tbaa !5
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %.lr.ph30, label %._crit_edge31

.lr.ph30:                                         ; preds = %._crit_edge13, %70
  %30 = phi i32 [ %71, %70 ], [ %28, %._crit_edge13 ]
  %31 = phi i32 [ %72, %70 ], [ %27, %._crit_edge13 ]
  store i32 1, ptr @i, align 4, !tbaa !5
  store i32 999, ptr @min, align 4, !tbaa !5
  %.not324 = icmp slt i32 %30, 1
  br i1 %.not324, label %46, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.lr.ph30
  %32 = add nuw i32 %30, 1
  %wide.trip.count39 = zext i32 %32 to i64
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge17
  %indvars.iv36 = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next37, %._crit_edge17 ]
  %min.promoted2325 = phi i32 [ 999, %.preheader.preheader ], [ %min.promoted20, %._crit_edge17 ]
  %33 = getelementptr inbounds [10 x i32], ptr @visited, i64 0, i64 %indvars.iv36
  %34 = trunc nuw nsw i64 %indvars.iv36 to i32
  br label %35

35:                                               ; preds = %.preheader, %44
  %indvars.iv = phi i64 [ 1, %.preheader ], [ %indvars.iv.next, %44 ]
  %min.promoted21 = phi i32 [ %min.promoted2325, %.preheader ], [ %min.promoted20, %44 ]
  %36 = phi i32 [ %min.promoted2325, %.preheader ], [ %45, %44 ]
  %37 = getelementptr inbounds [10 x [10 x i32]], ptr @cost, i64 0, i64 %indvars.iv36, i64 %indvars.iv
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = icmp slt i32 %38, %36
  br i1 %39, label %40, label %44

40:                                               ; preds = %35
  %41 = load i32, ptr %33, align 4, !tbaa !5
  %.not6 = icmp eq i32 %41, 0
  br i1 %.not6, label %44, label %42

42:                                               ; preds = %40
  store i32 %38, ptr @min, align 4, !tbaa !5
  store i32 %34, ptr @u, align 4, !tbaa !5
  store i32 %34, ptr @a, align 4, !tbaa !5
  %43 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %43, ptr @v, align 4, !tbaa !5
  store i32 %43, ptr @b, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %35, %42, %40
  %min.promoted20 = phi i32 [ %min.promoted21, %35 ], [ %38, %42 ], [ %min.promoted21, %40 ]
  %45 = phi i32 [ %36, %35 ], [ %38, %42 ], [ %36, %40 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count39
  br i1 %exitcond.not, label %._crit_edge17, label %35, !llvm.loop !13

._crit_edge17:                                    ; preds = %44
  %indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
  %exitcond40.not = icmp eq i64 %indvars.iv.next37, %wide.trip.count39
  br i1 %exitcond40.not, label %._crit_edge26, label %.preheader, !llvm.loop !14

._crit_edge26:                                    ; preds = %._crit_edge17
  store i32 %32, ptr @j, align 4, !tbaa !5
  store i32 %32, ptr @i, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %._crit_edge26, %.lr.ph30
  %47 = phi i32 [ %min.promoted20, %._crit_edge26 ], [ 999, %.lr.ph30 ]
  %48 = load i32, ptr @u, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [10 x i32], ptr @visited, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = icmp eq i32 %51, 0
  br i1 %52, label %._crit_edge44, label %53

._crit_edge44:                                    ; preds = %46
  %.pre45 = load i32, ptr @b, align 4, !tbaa !5
  br label %59

53:                                               ; preds = %46
  %54 = load i32, ptr @v, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [10 x i32], ptr @visited, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = icmp eq i32 %57, 0
  %.pre46 = load i32, ptr @b, align 4, !tbaa !5
  br i1 %58, label %59, label %._crit_edge41

._crit_edge41:                                    ; preds = %53
  %.pre = sext i32 %.pre46 to i64
  br label %70

59:                                               ; preds = %._crit_edge44, %53
  %60 = phi i32 [ %.pre45, %._crit_edge44 ], [ %.pre46, %53 ]
  %61 = add nsw i32 %31, 1
  store i32 %61, ptr @ne, align 4, !tbaa !5
  %62 = load i32, ptr @a, align 4, !tbaa !5
  %63 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %31, i32 noundef %62, i32 noundef %60, i32 noundef %47)
  %64 = load i32, ptr @min, align 4, !tbaa !5
  %65 = load i32, ptr @mincost, align 4, !tbaa !5
  %66 = add nsw i32 %65, %64
  store i32 %66, ptr @mincost, align 4, !tbaa !5
  %67 = load i32, ptr @b, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [10 x i32], ptr @visited, i64 0, i64 %68
  store i32 1, ptr %69, align 4, !tbaa !5
  %.pre42 = load i32, ptr @ne, align 4, !tbaa !5
  %.pre43 = load i32, ptr @n, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %._crit_edge41, %59
  %.pre-phi = phi i64 [ %.pre, %._crit_edge41 ], [ %68, %59 ]
  %71 = phi i32 [ %30, %._crit_edge41 ], [ %.pre43, %59 ]
  %72 = phi i32 [ %31, %._crit_edge41 ], [ %.pre42, %59 ]
  %73 = load i32, ptr @a, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [10 x [10 x i32]], ptr @cost, i64 0, i64 %.pre-phi, i64 %74
  store i32 999, ptr %75, align 4, !tbaa !5
  %76 = getelementptr inbounds [10 x [10 x i32]], ptr @cost, i64 0, i64 %74, i64 %.pre-phi
  store i32 999, ptr %76, align 4, !tbaa !5
  %77 = icmp slt i32 %72, %71
  br i1 %77, label %.lr.ph30, label %._crit_edge31, !llvm.loop !15

._crit_edge31:                                    ; preds = %70, %._crit_edge13
  %78 = load i32, ptr @mincost, align 4, !tbaa !5
  %79 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %78)
  ret void
}

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

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

attributes #0 = { nofree 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 #1 = { 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/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SCCPPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass