; LLVM IR from ahampriyanshu/algo-ds-101 :: Algorithms/Graph/Johnson_algorithm (Johnson_algorithm)

; 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.Graph = type { i32, i32, ptr }
%struct.Edge = type { i32, i32, i32 }

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z13printSolutionPi(ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z11minDistancePiPbi(ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z8dijkstraP5GraphiSt6vectorIiSaIiEE(ptr noundef %0, i32 noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.Graph, ptr %21, i32 0, i32 0
  %23 = load i32, ptr %22, align 8, !tbaa !11
  store i32 %23, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.Graph, ptr %24, i32 0, i32 1
  %26 = load i32, ptr %25, align 4, !tbaa !13
  store i32 %26, ptr %8, align 4, !tbaa !9
  %27 = load i32, ptr %7, align 4, !tbaa !9
  %28 = zext i32 %27 to i64
  %29 = call ptr @llvm.stacksave.p0()
  store ptr %29, ptr %9, align 8
  %30 = alloca i32, i64 %28, align 16
  store i64 %28, ptr %10, align 8
  %31 = load i32, ptr %7, align 4, !tbaa !9
  %32 = zext i32 %31 to i64
  %33 = alloca i8, i64 %32, align 16
  store i64 %32, ptr %11, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %46, %3
  %35 = load i32, ptr %12, align 4, !tbaa !9
  %36 = load i32, ptr %7, align 4, !tbaa !9
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %49

39:                                               ; preds = %34
  %40 = load i32, ptr %12, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds i32, ptr %30, i64 %41
  store i32 2147483647, ptr %42, align 4, !tbaa !9
  %43 = load i32, ptr %12, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds i8, ptr %33, i64 %44
  store i8 0, ptr %45, align 1, !tbaa !14
  br label %46

46:                                               ; preds = %39
  %47 = load i32, ptr %12, align 4, !tbaa !9
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %12, align 4, !tbaa !9
  br label %34, !llvm.loop !16

49:                                               ; preds = %38
  %50 = load i32, ptr %5, align 4, !tbaa !9
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds i32, ptr %30, i64 %51
  store i32 0, ptr %52, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %53

53:                                               ; preds = %135, %49
  %54 = load i32, ptr %13, align 4, !tbaa !9
  %55 = load i32, ptr %7, align 4, !tbaa !9
  %56 = sub nsw i32 %55, 1
  %57 = icmp slt i32 %54, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %53
  store i32 5, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %138

59:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %60 = load i32, ptr %7, align 4, !tbaa !9
  %61 = call noundef i32 @_Z11minDistancePiPbi(ptr noundef %30, ptr noundef %33, i32 noundef %60)
  store i32 %61, ptr %15, align 4, !tbaa !9
  %62 = load i32, ptr %15, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds i8, ptr %33, i64 %63
  store i8 1, ptr %64, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %65

65:                                               ; preds = %131, %59
  %66 = load i32, ptr %16, align 4, !tbaa !9
  %67 = load i32, ptr %8, align 4, !tbaa !9
  %68 = load i32, ptr %7, align 4, !tbaa !9
  %69 = sub nsw i32 %67, %68
  %70 = icmp slt i32 %66, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %65
  store i32 8, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %134

72:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.Graph, ptr %73, i32 0, i32 2
  %75 = load ptr, ptr %74, align 8, !tbaa !18
  %76 = load i32, ptr %16, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds %struct.Edge, ptr %75, i64 %77
  %79 = getelementptr inbounds %struct.Edge, ptr %78, i32 0, i32 0
  %80 = load i32, ptr %79, align 4, !tbaa !19
  store i32 %80, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.Graph, ptr %81, i32 0, i32 2
  %83 = load ptr, ptr %82, align 8, !tbaa !18
  %84 = load i32, ptr %16, align 4, !tbaa !9
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds %struct.Edge, ptr %83, i64 %85
  %87 = getelementptr inbounds %struct.Edge, ptr %86, i32 0, i32 1
  %88 = load i32, ptr %87, align 4, !tbaa !21
  store i32 %88, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.Graph, ptr %89, i32 0, i32 2
  %91 = load ptr, ptr %90, align 8, !tbaa !18
  %92 = load i32, ptr %16, align 4, !tbaa !9
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds %struct.Edge, ptr %91, i64 %93
  %95 = getelementptr inbounds %struct.Edge, ptr %94, i32 0, i32 2
  %96 = load i32, ptr %95, align 4, !tbaa !22
  store i32 %96, ptr %19, align 4, !tbaa !9
  %97 = load i32, ptr %18, align 4, !tbaa !9
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds i8, ptr %33, i64 %98
  %100 = load i8, ptr %99, align 1, !tbaa !14, !range !23, !noundef !24
  %101 = trunc i8 %100 to i1
  br i1 %101, label %130, label %102

102:                                              ; preds = %72
  %103 = load i32, ptr %17, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds i32, ptr %30, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !9
  %107 = icmp ne i32 %106, 2147483647
  br i1 %107, label %108, label %130

108:                                              ; preds = %102
  %109 = load i32, ptr %17, align 4, !tbaa !9
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds i32, ptr %30, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !9
  %113 = load i32, ptr %19, align 4, !tbaa !9
  %114 = add nsw i32 %112, %113
  %115 = load i32, ptr %18, align 4, !tbaa !9
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds i32, ptr %30, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !9
  %119 = icmp slt i32 %114, %118
  br i1 %119, label %120, label %130

120:                                              ; preds = %108
  %121 = load i32, ptr %17, align 4, !tbaa !9
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds i32, ptr %30, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !9
  %125 = load i32, ptr %19, align 4, !tbaa !9
  %126 = add nsw i32 %124, %125
  %127 = load i32, ptr %18, align 4, !tbaa !9
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds i32, ptr %30, i64 %128
  store i32 %126, ptr %129, align 4, !tbaa !9
  br label %130

130:                                              ; preds = %120, %108, %102, %72
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %131

131:                                              ; preds = %130
  %132 = load i32, ptr %16, align 4, !tbaa !9
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %16, align 4, !tbaa !9
  br label %65, !llvm.loop !25

134:                                              ; preds = %71
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %135

135:                                              ; preds = %134
  %136 = load i32, ptr %13, align 4, !tbaa !9
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %13, align 4, !tbaa !9
  br label %53, !llvm.loop !26

138:                                              ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %139

139:                                              ; preds = %162, %138
  %140 = load i32, ptr %20, align 4, !tbaa !9
  %141 = load i32, ptr %7, align 4, !tbaa !9
  %142 = icmp slt i32 %140, %141
  br i1 %142, label %144, label %143

143:                                              ; preds = %139
  store i32 11, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %165

144:                                              ; preds = %139
  %145 = load i32, ptr %20, align 4, !tbaa !9
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds i32, ptr %30, i64 %146
  %148 = load i32, ptr %147, align 4, !tbaa !9
  %149 = load i32, ptr %20, align 4, !tbaa !9
  %150 = sext i32 %149 to i64
  %151 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %150) #4
  %152 = load i32, ptr %151, align 4, !tbaa !9
  %153 = add nsw i32 %148, %152
  %154 = load i32, ptr %5, align 4, !tbaa !9
  %155 = sext i32 %154 to i64
  %156 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %155) #4
  %157 = load i32, ptr %156, align 4, !tbaa !9
  %158 = sub nsw i32 %153, %157
  %159 = load i32, ptr %20, align 4, !tbaa !9
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds i32, ptr %30, i64 %160
  store i32 %158, ptr %161, align 4, !tbaa !9
  br label %162

162:                                              ; preds = %144
  %163 = load i32, ptr %20, align 4, !tbaa !9
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr %20, align 4, !tbaa !9
  br label %139, !llvm.loop !27

165:                                              ; preds = %143
  call void @_Z13printSolutionPi(ptr noundef %30)
  %166 = load ptr, ptr %9, align 8
  call void @llvm.stackrestore.p0(ptr %166)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 nosync nounwind willreturn }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTS5Graph", !10, i64 0, !10, i64 4, !6, i64 8}
!13 = !{!12, !10, i64 4}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!12, !6, i64 8}
!19 = !{!20, !10, i64 0}
!20 = !{!"_ZTS4Edge", !10, i64 0, !10, i64 4, !10, i64 8}
!21 = !{!20, !10, i64 4}
!22 = !{!20, !10, i64 8}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = distinct !{!25, !17}
!26 = distinct !{!26, !17}
!27 = distinct !{!27, !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 }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z13printSolutionPi(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z11minDistancePiPbi(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z8dijkstraP5GraphiSt6vectorIiSaIiEE(ptr nocapture noundef readonly %0, i32 noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = load i32, ptr %0, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 4
  %6 = load i32, ptr %5, align 4, !tbaa !11
  %7 = zext i32 %4 to i64
  %8 = alloca i32, i64 %7, align 16
  %9 = alloca i8, i64 %7, align 16
  %10 = icmp sgt i32 %4, 0
  br i1 %10, label %.lr.ph.preheader, label %.preheader.thread

.preheader.thread:                                ; preds = %3
  %11 = sext i32 %1 to i64
  %12 = getelementptr inbounds i32, ptr %8, i64 %11
  store i32 0, ptr %12, align 4, !tbaa !12
  br label %._crit_edge56

.lr.ph.preheader:                                 ; preds = %3
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %9, i8 0, i64 %7, i1 false), !tbaa !13
  %min.iters.check = icmp ult i32 %4, 8
  br i1 %min.iters.check, label %.lr.ph.preheader75, label %vector.ph

.lr.ph.preheader75:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %7, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %13 = getelementptr inbounds i32, ptr %8, i64 %index
  %14 = getelementptr inbounds i8, ptr %13, i64 16
  store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, ptr %13, align 16, !tbaa !12
  store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, ptr %14, align 16, !tbaa !12
  %index.next = add nuw i64 %index, 8
  %15 = icmp eq i64 %index.next, %n.vec
  br i1 %15, label %middle.block, label %vector.body, !llvm.loop !15

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %7
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader75

._crit_edge:                                      ; preds = %.lr.ph, %middle.block
  %16 = sext i32 %1 to i64
  %17 = getelementptr inbounds i32, ptr %8, i64 %16
  store i32 0, ptr %17, align 4, !tbaa !12
  %18 = add nsw i32 %4, -1
  %.not = icmp eq i32 %4, 1
  br i1 %.not, label %.preheader, label %.lr.ph53

.lr.ph53:                                         ; preds = %._crit_edge
  %19 = sub nsw i32 %6, %4
  %.fr57 = freeze i32 %19
  %20 = icmp sgt i32 %.fr57, 0
  %21 = getelementptr inbounds i8, ptr %0, i64 8
  br i1 %20, label %.lr.ph49.us.preheader, label %.lr.ph53.split

.lr.ph49.us.preheader:                            ; preds = %.lr.ph53
  %wide.trip.count64 = zext nneg i32 %.fr57 to i64
  br label %.lr.ph49.us

.lr.ph49.us:                                      ; preds = %.lr.ph49.us.preheader, %._crit_edge50.us
  %.04151.us = phi i32 [ %48, %._crit_edge50.us ], [ 0, %.lr.ph49.us.preheader ]
  %22 = call noundef i32 @_Z11minDistancePiPbi(ptr noundef nonnull %8, ptr noundef nonnull %9, i32 noundef %4)
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds i8, ptr %9, i64 %23
  store i8 1, ptr %24, align 1, !tbaa !13
  %25 = load ptr, ptr %21, align 8, !tbaa !19
  br label %26

26:                                               ; preds = %.lr.ph49.us, %47
  %indvars.iv61 = phi i64 [ 0, %.lr.ph49.us ], [ %indvars.iv.next62, %47 ]
  %27 = getelementptr inbounds %struct.Edge, ptr %25, i64 %indvars.iv61
  %28 = getelementptr inbounds i8, ptr %27, i64 4
  %29 = load i32, ptr %28, align 4, !tbaa !20
  %30 = getelementptr inbounds i8, ptr %27, i64 8
  %31 = load i32, ptr %30, align 4, !tbaa !22
  %32 = sext i32 %29 to i64
  %33 = getelementptr inbounds i8, ptr %9, i64 %32
  %34 = load i8, ptr %33, align 1, !tbaa !13, !range !23, !noundef !24
  %35 = trunc nuw i8 %34 to i1
  br i1 %35, label %47, label %36

36:                                               ; preds = %26
  %37 = load i32, ptr %27, align 4, !tbaa !25
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds i32, ptr %8, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !12
  %.not.us = icmp eq i32 %40, 2147483647
  br i1 %.not.us, label %47, label %41

41:                                               ; preds = %36
  %42 = add nsw i32 %40, %31
  %43 = getelementptr inbounds i32, ptr %8, i64 %32
  %44 = load i32, ptr %43, align 4, !tbaa !12
  %45 = icmp slt i32 %42, %44
  br i1 %45, label %46, label %47

46:                                               ; preds = %41
  store i32 %42, ptr %43, align 4, !tbaa !12
  br label %47

47:                                               ; preds = %46, %41, %36, %26
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %exitcond65.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count64
  br i1 %exitcond65.not, label %._crit_edge50.us, label %26, !llvm.loop !26

._crit_edge50.us:                                 ; preds = %47
  %48 = add nuw nsw i32 %.04151.us, 1
  %exitcond66.not = icmp eq i32 %48, %18
  br i1 %exitcond66.not, label %.preheader, label %.lr.ph49.us, !llvm.loop !27

.lr.ph:                                           ; preds = %.lr.ph.preheader75, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader75 ]
  %49 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv
  store i32 2147483647, ptr %49, align 4, !tbaa !12
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %7
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !28

.preheader:                                       ; preds = %.lr.ph53.split, %._crit_edge50.us, %._crit_edge
  br i1 %10, label %.lr.ph55, label %._crit_edge56

.lr.ph53.split:                                   ; preds = %.lr.ph53, %.lr.ph53.split
  %.04151 = phi i32 [ %53, %.lr.ph53.split ], [ 0, %.lr.ph53 ]
  %50 = call noundef i32 @_Z11minDistancePiPbi(ptr noundef nonnull %8, ptr noundef nonnull %9, i32 noundef %4)
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds i8, ptr %9, i64 %51
  store i8 1, ptr %52, align 1, !tbaa !13
  %53 = add nuw nsw i32 %.04151, 1
  %exitcond60.not = icmp eq i32 %53, %18
  br i1 %exitcond60.not, label %.preheader, label %.lr.ph53.split, !llvm.loop !27

._crit_edge56:                                    ; preds = %.lr.ph55, %.preheader.thread, %.preheader
  call void @_Z13printSolutionPi(ptr noundef nonnull %8)
  ret void

.lr.ph55:                                         ; preds = %.preheader, %.lr.ph55
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %.lr.ph55 ], [ 0, %.preheader ]
  %54 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv67
  %55 = load i32, ptr %54, align 4, !tbaa !12
  %56 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %indvars.iv67) #3
  %57 = load i32, ptr %56, align 4, !tbaa !12
  %58 = add nsw i32 %57, %55
  %59 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %16) #3
  %60 = load i32, ptr %59, align 4, !tbaa !12
  %61 = sub i32 %58, %60
  store i32 %61, ptr %54, align 4, !tbaa !12
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %exitcond71.not = icmp eq i64 %indvars.iv.next68, %7
  br i1 %exitcond71.not, label %._crit_edge56, label %.lr.ph55, !llvm.loop !29
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

attributes #0 = { 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 #1 = { 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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, !7, i64 0}
!6 = !{!"_ZTS5Graph", !7, i64 0, !7, i64 4, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !8, i64 0}
!15 = distinct !{!15, !16, !17, !18}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!"llvm.loop.isvectorized", i32 1}
!18 = !{!"llvm.loop.unroll.runtime.disable"}
!19 = !{!6, !10, i64 8}
!20 = !{!21, !7, i64 4}
!21 = !{!"_ZTS4Edge", !7, i64 0, !7, i64 4, !7, i64 8}
!22 = !{!21, !7, i64 8}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = !{!21, !7, i64 0}
!26 = distinct !{!26, !16}
!27 = distinct !{!27, !16}
!28 = distinct !{!28, !16, !18, !17}
!29 = distinct !{!29, !16}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopIdiomRecognizePass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass