; LLVM IR from HarshCasper/NeoAlgo :: C/ds (bellman_ford)

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

@.str = external hidden unnamed_addr constant [37 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [30 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @Bellman_Ford(i32 noundef, ptr noundef, ptr 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: nounwind uwtable
define dso_local i32 @main() #0 {
  %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 ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %13 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %2)
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = zext i32 %15 to i64
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = zext i32 %17 to i64
  %19 = call ptr @llvm.stacksave.p0()
  store ptr %19, ptr %7, align 8
  %20 = mul nuw i64 %16, %18
  %21 = alloca i32, i64 %20, align 16
  store i64 %16, ptr %8, align 8
  store i64 %18, ptr %9, align 8
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = add nsw i32 %22, 2
  %24 = zext i32 %23 to i64
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = zext i32 %25 to i64
  %27 = mul nuw i64 %24, %26
  %28 = alloca i32, i64 %27, align 16
  store i64 %24, ptr %10, align 8
  store i64 %26, ptr %11, align 8
  %29 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %53, %0
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %34, label %56

34:                                               ; preds = %30
  %35 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %49, %34
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %40, label %52

40:                                               ; preds = %36
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = mul nsw i64 %42, %18
  %44 = getelementptr inbounds i32, ptr %21, i64 %43
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds i32, ptr %44, i64 %46
  %48 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %47)
  br label %49

49:                                               ; preds = %40
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %4, align 4, !tbaa !5
  br label %36, !llvm.loop !9

52:                                               ; preds = %36
  br label %53

53:                                               ; preds = %52
  %54 = load i32, ptr %3, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %3, align 4, !tbaa !5
  br label %30, !llvm.loop !11

56:                                               ; preds = %30
  %57 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  %58 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %6)
  %59 = load i32, ptr %6, align 4, !tbaa !5
  %60 = sub nsw i32 %59, 1
  %61 = mul nsw i64 0, %26
  %62 = getelementptr inbounds i32, ptr %28, i64 %61
  %63 = getelementptr inbounds i32, ptr %62, i64 0
  store i32 %60, ptr %63, align 4, !tbaa !5
  %64 = mul nsw i64 1, %26
  %65 = getelementptr inbounds i32, ptr %28, i64 %64
  %66 = getelementptr inbounds i32, ptr %65, i64 0
  store i32 0, ptr %66, align 4, !tbaa !5
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %92, %56
  %68 = load i32, ptr %4, align 4, !tbaa !5
  %69 = load i32, ptr %2, align 4, !tbaa !5
  %70 = icmp slt i32 %68, %69
  br i1 %70, label %71, label %95

71:                                               ; preds = %67
  %72 = load i32, ptr %4, align 4, !tbaa !5
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = sub nsw i32 %73, 1
  %75 = icmp sgt i32 %72, %74
  br i1 %75, label %76, label %83

76:                                               ; preds = %71
  %77 = load i32, ptr %4, align 4, !tbaa !5
  %78 = mul nsw i64 0, %26
  %79 = getelementptr inbounds i32, ptr %28, i64 %78
  %80 = load i32, ptr %4, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds i32, ptr %79, i64 %81
  store i32 %77, ptr %82, align 4, !tbaa !5
  br label %91

83:                                               ; preds = %71
  %84 = load i32, ptr %4, align 4, !tbaa !5
  %85 = sub nsw i32 %84, 1
  %86 = mul nsw i64 0, %26
  %87 = getelementptr inbounds i32, ptr %28, i64 %86
  %88 = load i32, ptr %4, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds i32, ptr %87, i64 %89
  store i32 %85, ptr %90, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %83, %76
  br label %92

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

95:                                               ; preds = %67
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %106, %95
  %97 = load i32, ptr %4, align 4, !tbaa !5
  %98 = load i32, ptr %2, align 4, !tbaa !5
  %99 = icmp slt i32 %97, %98
  br i1 %99, label %100, label %109

100:                                              ; preds = %96
  %101 = mul nsw i64 1, %26
  %102 = getelementptr inbounds i32, ptr %28, i64 %101
  %103 = load i32, ptr %4, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds i32, ptr %102, i64 %104
  store i32 99, ptr %105, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %100
  %107 = load i32, ptr %4, align 4, !tbaa !5
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %4, align 4, !tbaa !5
  br label %96, !llvm.loop !13

109:                                              ; preds = %96
  %110 = load i32, ptr %2, align 4, !tbaa !5
  %111 = call i32 @Bellman_Ford(i32 noundef 1, ptr noundef %21, ptr noundef %28, i32 noundef %110)
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %138, %109
  %113 = load i32, ptr %3, align 4, !tbaa !5
  %114 = load i32, ptr %2, align 4, !tbaa !5
  %115 = icmp slt i32 %113, %114
  br i1 %115, label %116, label %141

116:                                              ; preds = %112
  %117 = load i32, ptr %2, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  %119 = sext i32 %118 to i64
  %120 = mul nsw i64 %119, %26
  %121 = getelementptr inbounds i32, ptr %28, i64 %120
  %122 = load i32, ptr %3, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds i32, ptr %121, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = load i32, ptr %2, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = mul nsw i64 %127, %26
  %129 = getelementptr inbounds i32, ptr %28, i64 %128
  %130 = load i32, ptr %3, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds i32, ptr %129, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = icmp ne i32 %125, %133
  br i1 %134, label %135, label %137

135:                                              ; preds = %116
  %136 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %12, align 4
  br label %169

137:                                              ; preds = %116
  br label %138

138:                                              ; preds = %137
  %139 = load i32, ptr %3, align 4, !tbaa !5
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %3, align 4, !tbaa !5
  br label %112, !llvm.loop !14

141:                                              ; preds = %112
  %142 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %143

143:                                              ; preds = %165, %141
  %144 = load i32, ptr %3, align 4, !tbaa !5
  %145 = load i32, ptr %2, align 4, !tbaa !5
  %146 = icmp slt i32 %144, %145
  br i1 %146, label %147, label %168

147:                                              ; preds = %143
  %148 = mul nsw i64 0, %26
  %149 = getelementptr inbounds i32, ptr %28, i64 %148
  %150 = load i32, ptr %3, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds i32, ptr %149, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = add nsw i32 %153, 1
  %155 = load i32, ptr %2, align 4, !tbaa !5
  %156 = add nsw i32 %155, 1
  %157 = sext i32 %156 to i64
  %158 = mul nsw i64 %157, %26
  %159 = getelementptr inbounds i32, ptr %28, i64 %158
  %160 = load i32, ptr %3, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds i32, ptr %159, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !5
  %164 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %154, i32 noundef %163)
  br label %165

165:                                              ; preds = %147
  %166 = load i32, ptr %3, align 4, !tbaa !5
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr %3, align 4, !tbaa !5
  br label %143, !llvm.loop !15

168:                                              ; preds = %143
  store i32 0, ptr %12, align 4
  br label %169

169:                                              ; preds = %168, %135
  %170 = load ptr, ptr %7, align 8
  call void @llvm.stackrestore.p0(ptr %170)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  %171 = load i32, ptr %12, align 4
  switch i32 %171, label %174 [
    i32 0, label %172
    i32 1, label %172
  ]

172:                                              ; preds = %169, %169
  %173 = load i32, ptr %1, align 4
  ret i32 %173

174:                                              ; preds = %169
  unreachable
}

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

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

; 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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn }
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/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}
!15 = distinct !{!15, !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"

@.str = external hidden unnamed_addr constant [37 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [30 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @Bellman_Ford(i32 noundef, ptr noundef, ptr 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: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1)
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = zext i32 %5 to i64
  %7 = call ptr @llvm.stacksave.p0()
  %8 = mul nuw i64 %6, %6
  %9 = alloca i32, i64 %8, align 16
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %11 = add nsw i32 %10, 2
  %12 = zext i32 %11 to i64
  %13 = zext i32 %10 to i64
  %14 = mul nuw i64 %12, %13
  %15 = alloca i32, i64 %14, align 16
  %16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %17 = load i32, ptr %1, align 4, !tbaa !5
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph35, label %._crit_edge36

.lr.ph35:                                         ; preds = %0, %._crit_edge
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %._crit_edge ], [ 0, %0 ]
  %19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %20 = load i32, ptr %1, align 4, !tbaa !5
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph, label %.lr.ph35.._crit_edge_crit_edge

.lr.ph35.._crit_edge_crit_edge:                   ; preds = %.lr.ph35
  %.pre = sext i32 %20 to i64
  br label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph35
  %22 = mul nuw nsw i64 %indvars.iv51, %6
  %23 = getelementptr inbounds i32, ptr %9, i64 %22
  br label %24

24:                                               ; preds = %.lr.ph, %24
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %24 ]
  %25 = getelementptr inbounds i32, ptr %23, i64 %indvars.iv
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %25)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %27 = load i32, ptr %1, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = icmp slt i64 %indvars.iv.next, %28
  br i1 %29, label %24, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %24, %.lr.ph35.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.lr.ph35.._crit_edge_crit_edge ], [ %28, %24 ]
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %30 = icmp slt i64 %indvars.iv.next52, %.pre-phi
  br i1 %30, label %.lr.ph35, label %._crit_edge36, !llvm.loop !11

._crit_edge36:                                    ; preds = %._crit_edge, %0
  %31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2)
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = add nsw i32 %33, -1
  store i32 %34, ptr %15, align 16, !tbaa !5
  %35 = getelementptr inbounds i32, ptr %15, i64 %13
  store i32 0, ptr %35, align 4, !tbaa !5
  %36 = load i32, ptr %1, align 4, !tbaa !5
  %37 = icmp sgt i32 %36, 1
  br i1 %37, label %.lr.ph39.preheader, label %._crit_edge42

.lr.ph39.preheader:                               ; preds = %._crit_edge36
  %38 = sext i32 %33 to i64
  %wide.trip.count = zext nneg i32 %36 to i64
  %39 = add nsw i64 %wide.trip.count, -1
  %min.iters.check = icmp ult i32 %36, 9
  br i1 %min.iters.check, label %.lr.ph39.preheader89, label %vector.ph

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

vector.ph:                                        ; preds = %.lr.ph39.preheader
  %n.vec = and i64 %39, -8
  %ind.end = or disjoint i64 %n.vec, 1
  %broadcast.splatinsert = insertelement <4 x i64> poison, i64 %38, i64 0
  %broadcast.splat = shufflevector <4 x i64> %broadcast.splatinsert, <4 x i64> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i64> [ <i64 1, i64 2, i64 3, i64 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %vec.ind71 = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next74, %vector.body ]
  %step.add = add <4 x i64> %vec.ind, <i64 4, i64 4, i64 4, i64 4>
  %step.add72 = add <4 x i32> %vec.ind71, <i32 4, i32 4, i32 4, i32 4>
  %offset.idx = or disjoint i64 %index, 1
  %40 = icmp slt <4 x i64> %vec.ind, %broadcast.splat
  %41 = icmp slt <4 x i64> %step.add, %broadcast.splat
  %42 = sext <4 x i1> %40 to <4 x i32>
  %43 = sext <4 x i1> %41 to <4 x i32>
  %44 = add <4 x i32> %vec.ind71, %42
  %45 = add <4 x i32> %step.add72, %43
  %46 = getelementptr inbounds i32, ptr %15, i64 %offset.idx
  %47 = getelementptr inbounds i8, ptr %46, i64 16
  store <4 x i32> %44, ptr %46, align 4
  store <4 x i32> %45, ptr %47, align 4
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
  %vec.ind.next74 = add <4 x i32> %vec.ind71, <i32 8, i32 8, i32 8, i32 8>
  %48 = icmp eq i64 %index.next, %n.vec
  br i1 %48, label %middle.block, label %vector.body, !llvm.loop !12

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %39, %n.vec
  br i1 %cmp.n, label %.preheader, label %.lr.ph39.preheader89

.preheader:                                       ; preds = %.lr.ph39, %middle.block
  br i1 %37, label %.lr.ph41.preheader, label %._crit_edge42

.lr.ph41.preheader:                               ; preds = %.preheader
  %wide.trip.count60 = zext nneg i32 %36 to i64
  %49 = add nsw i64 %wide.trip.count, -1
  %min.iters.check77 = icmp ult i32 %36, 9
  br i1 %min.iters.check77, label %.lr.ph41.preheader88, label %vector.ph78

.lr.ph41.preheader88:                             ; preds = %middle.block75, %.lr.ph41.preheader
  %indvars.iv57.ph = phi i64 [ 1, %.lr.ph41.preheader ], [ %ind.end81, %middle.block75 ]
  br label %.lr.ph41

vector.ph78:                                      ; preds = %.lr.ph41.preheader
  %n.vec80 = and i64 %49, -8
  %ind.end81 = or disjoint i64 %n.vec80, 1
  br label %vector.body83

vector.body83:                                    ; preds = %vector.body83, %vector.ph78
  %index84 = phi i64 [ 0, %vector.ph78 ], [ %index.next86, %vector.body83 ]
  %offset.idx85 = or disjoint i64 %index84, 1
  %50 = getelementptr inbounds i32, ptr %35, i64 %offset.idx85
  %51 = getelementptr inbounds i8, ptr %50, i64 16
  store <4 x i32> <i32 99, i32 99, i32 99, i32 99>, ptr %50, align 4, !tbaa !5
  store <4 x i32> <i32 99, i32 99, i32 99, i32 99>, ptr %51, align 4, !tbaa !5
  %index.next86 = add nuw i64 %index84, 8
  %52 = icmp eq i64 %index.next86, %n.vec80
  br i1 %52, label %middle.block75, label %vector.body83, !llvm.loop !15

middle.block75:                                   ; preds = %vector.body83
  %cmp.n87 = icmp eq i64 %49, %n.vec80
  br i1 %cmp.n87, label %._crit_edge42, label %.lr.ph41.preheader88

.lr.ph39:                                         ; preds = %.lr.ph39.preheader89, %.lr.ph39
  %indvars.iv54 = phi i64 [ %indvars.iv.next55, %.lr.ph39 ], [ %indvars.iv54.ph, %.lr.ph39.preheader89 ]
  %.not31 = icmp slt i64 %indvars.iv54, %38
  %53 = trunc i64 %indvars.iv54 to i32
  %54 = sext i1 %.not31 to i32
  %.sink = add i32 %53, %54
  %55 = getelementptr inbounds i32, ptr %15, i64 %indvars.iv54
  store i32 %.sink, ptr %55, align 4
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count
  br i1 %exitcond.not, label %.preheader, label %.lr.ph39, !llvm.loop !16

.lr.ph41:                                         ; preds = %.lr.ph41.preheader88, %.lr.ph41
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %.lr.ph41 ], [ %indvars.iv57.ph, %.lr.ph41.preheader88 ]
  %56 = getelementptr inbounds i32, ptr %35, i64 %indvars.iv57
  store i32 99, ptr %56, align 4, !tbaa !5
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %exitcond61.not = icmp eq i64 %indvars.iv.next58, %wide.trip.count60
  br i1 %exitcond61.not, label %._crit_edge42, label %.lr.ph41, !llvm.loop !17

._crit_edge42:                                    ; preds = %.lr.ph41, %middle.block75, %._crit_edge36, %.preheader
  %57 = call i32 @Bellman_Ford(i32 noundef 1, ptr noundef nonnull %9, ptr noundef nonnull %15, i32 noundef %36)
  %58 = load i32, ptr %1, align 4, !tbaa !5
  %59 = icmp sgt i32 %58, 0
  br i1 %59, label %.lr.ph45, label %._crit_edge46

.lr.ph45:                                         ; preds = %._crit_edge42
  %60 = add nuw nsw i32 %58, 1
  %61 = zext nneg i32 %60 to i64
  %62 = mul nuw nsw i64 %61, %13
  %63 = getelementptr inbounds i32, ptr %15, i64 %62
  %64 = zext nneg i32 %58 to i64
  %65 = mul nuw nsw i64 %64, %13
  %66 = getelementptr inbounds i32, ptr %15, i64 %65
  br label %68

67:                                               ; preds = %68
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %exitcond66.not = icmp eq i64 %indvars.iv.next63, %64
  br i1 %exitcond66.not, label %._crit_edge46, label %68, !llvm.loop !18

68:                                               ; preds = %.lr.ph45, %67
  %indvars.iv62 = phi i64 [ 0, %.lr.ph45 ], [ %indvars.iv.next63, %67 ]
  %69 = getelementptr inbounds i32, ptr %63, i64 %indvars.iv62
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = getelementptr inbounds i32, ptr %66, i64 %indvars.iv62
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %.not = icmp eq i32 %70, %72
  br i1 %.not, label %67, label %73

73:                                               ; preds = %68
  %74 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  br label %.loopexit

._crit_edge46:                                    ; preds = %67, %._crit_edge42
  %75 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %76 = load i32, ptr %1, align 4, !tbaa !5
  %77 = icmp sgt i32 %76, 1
  br i1 %77, label %.lr.ph49, label %.loopexit

.lr.ph49:                                         ; preds = %._crit_edge46, %.lr.ph49
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %.lr.ph49 ], [ 1, %._crit_edge46 ]
  %78 = phi i32 [ %89, %.lr.ph49 ], [ %76, %._crit_edge46 ]
  %79 = getelementptr inbounds i32, ptr %15, i64 %indvars.iv67
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  %82 = add nsw i32 %78, 1
  %83 = sext i32 %82 to i64
  %84 = mul nsw i64 %83, %13
  %85 = getelementptr inbounds i32, ptr %15, i64 %84
  %86 = getelementptr inbounds i32, ptr %85, i64 %indvars.iv67
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %81, i32 noundef %87)
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %89 = load i32, ptr %1, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = icmp slt i64 %indvars.iv.next68, %90
  br i1 %91, label %.lr.ph49, label %.loopexit, !llvm.loop !19

.loopexit:                                        ; preds = %.lr.ph49, %._crit_edge46, %73
  call void @llvm.stackrestore.p0(ptr %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  ret i32 0
}

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

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

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

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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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" }
attributes #3 = { mustprogress 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 = !{!"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, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !13, !14}
!16 = distinct !{!16, !10, !14, !13}
!17 = distinct !{!17, !10, !14, !13}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}


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