; LLVM IR from VAR-solutions/Algorithms :: Graphs/Prims Algorithm/C++ (prims)

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

@g = external dso_local global [1000 x [1000 x i32]], align 16
@d = external dso_local global [1000 x i32], align 16
@pi = external dso_local global [1000 x i32], align 16
@visited = external dso_local global [1000 x i32], align 16
@.str = external hidden unnamed_addr constant [27 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = 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
  %11 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %2, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %34, %0
  %14 = load i32, ptr %7, align 4, !tbaa !5
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = icmp slt i32 %14, %15
  br i1 %16, label %17, label %37

17:                                               ; preds = %13
  %18 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %4, ptr noundef %5, ptr noundef %6)
  %20 = load i32, ptr %6, align 4, !tbaa !5
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [1000 x [1000 x i32]], ptr @g, i64 0, i64 %22
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [1000 x i32], ptr %23, i64 0, i64 %25
  store i32 %20, ptr %26, align 4, !tbaa !5
  %27 = load i32, ptr %6, align 4, !tbaa !5
  %28 = load i32, ptr %5, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [1000 x [1000 x i32]], ptr @g, i64 0, i64 %29
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [1000 x i32], ptr %30, i64 0, i64 %32
  store i32 %27, ptr %33, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %17
  %35 = load i32, ptr %7, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %7, align 4, !tbaa !5
  br label %13, !llvm.loop !9

37:                                               ; preds = %13
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %38

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

42:                                               ; preds = %38
  %43 = load i32, ptr %7, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %44
  store i32 999999, ptr %45, align 4, !tbaa !5
  %46 = load i32, ptr %7, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [1000 x i32], ptr @pi, i64 0, i64 %47
  store i32 -1, ptr %48, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %42
  %50 = load i32, ptr %7, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %7, align 4, !tbaa !5
  br label %38, !llvm.loop !11

52:                                               ; preds = %38
  %53 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  %54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef %9)
  %55 = load i32, ptr %9, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %56
  store i32 0, ptr %57, align 4, !tbaa !5
  %58 = load i32, ptr %9, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [1000 x i32], ptr @pi, i64 0, i64 %59
  store i32 -1, ptr %60, align 4, !tbaa !5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %124, %52
  %62 = load i32, ptr %7, align 4, !tbaa !5
  %63 = load i32, ptr %2, align 4, !tbaa !5
  %64 = sub nsw i32 %63, 1
  %65 = icmp slt i32 %62, %64
  br i1 %65, label %66, label %127

66:                                               ; preds = %61
  %67 = load i32, ptr %2, align 4, !tbaa !5
  %68 = call noundef i32 @_Z6getMini(i32 noundef %67)
  store i32 %68, ptr %4, align 4, !tbaa !5
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [1000 x i32], ptr @visited, i64 0, i64 %70
  store i32 1, ptr %71, align 4, !tbaa !5
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %120, %66
  %73 = load i32, ptr %8, align 4, !tbaa !5
  %74 = load i32, ptr %2, align 4, !tbaa !5
  %75 = icmp slt i32 %73, %74
  br i1 %75, label %76, label %123

76:                                               ; preds = %72
  %77 = load i32, ptr %4, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [1000 x [1000 x i32]], ptr @g, i64 0, i64 %78
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [1000 x i32], ptr %79, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %119

85:                                               ; preds = %76
  %86 = load i32, ptr %8, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [1000 x i32], ptr @visited, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = icmp eq i32 %89, 0
  br i1 %90, label %91, label %119

91:                                               ; preds = %85
  %92 = load i32, ptr %4, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [1000 x [1000 x i32]], ptr @g, i64 0, i64 %93
  %95 = load i32, ptr %8, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [1000 x i32], ptr %94, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = load i32, ptr %8, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = icmp slt i32 %98, %102
  br i1 %103, label %104, label %119

104:                                              ; preds = %91
  %105 = load i32, ptr %4, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [1000 x [1000 x i32]], ptr @g, i64 0, i64 %106
  %108 = load i32, ptr %8, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [1000 x i32], ptr %107, i64 0, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = load i32, ptr %8, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %113
  store i32 %111, ptr %114, align 4, !tbaa !5
  %115 = load i32, ptr %4, align 4, !tbaa !5
  %116 = load i32, ptr %8, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [1000 x i32], ptr @pi, i64 0, i64 %117
  store i32 %115, ptr %118, align 4, !tbaa !5
  br label %119

119:                                              ; preds = %104, %91, %85, %76
  br label %120

120:                                              ; preds = %119
  %121 = load i32, ptr %8, align 4, !tbaa !5
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %8, align 4, !tbaa !5
  br label %72, !llvm.loop !12

123:                                              ; preds = %72
  br label %124

124:                                              ; preds = %123
  %125 = load i32, ptr %7, align 4, !tbaa !5
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %7, align 4, !tbaa !5
  br label %61, !llvm.loop !13

127:                                              ; preds = %61
  %128 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %129

129:                                              ; preds = %140, %127
  %130 = load i32, ptr %7, align 4, !tbaa !5
  %131 = load i32, ptr %2, align 4, !tbaa !5
  %132 = icmp slt i32 %130, %131
  br i1 %132, label %133, label %143

133:                                              ; preds = %129
  %134 = load i32, ptr %7, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [1000 x i32], ptr @pi, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = load i32, ptr %7, align 4, !tbaa !5
  %139 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %137, i32 noundef %138)
  br label %140

140:                                              ; preds = %133
  %141 = load i32, ptr %7, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %7, align 4, !tbaa !5
  br label %129, !llvm.loop !14

143:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %144

144:                                              ; preds = %155, %143
  %145 = load i32, ptr %7, align 4, !tbaa !5
  %146 = load i32, ptr %2, align 4, !tbaa !5
  %147 = icmp slt i32 %145, %146
  br i1 %147, label %148, label %158

148:                                              ; preds = %144
  %149 = load i32, ptr %7, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %150
  %152 = load i32, ptr %151, align 4, !tbaa !5
  %153 = load i32, ptr %10, align 4, !tbaa !5
  %154 = add nsw i32 %153, %152
  store i32 %154, ptr %10, align 4, !tbaa !5
  br label %155

155:                                              ; preds = %148
  %156 = load i32, ptr %7, align 4, !tbaa !5
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %7, align 4, !tbaa !5
  br label %144, !llvm.loop !15

158:                                              ; preds = %144
  %159 = load i32, ptr %10, align 4, !tbaa !5
  %160 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, i32 noundef %159)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  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
  %161 = load i32, ptr %1, align 4
  ret i32 %161
}

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

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = 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"

@g = external dso_local local_unnamed_addr global [1000 x [1000 x i32]], align 16
@d = external dso_local local_unnamed_addr global [1000 x i32], align 16
@pi = external dso_local local_unnamed_addr global [1000 x i32], align 16
@visited = external dso_local local_unnamed_addr global [1000 x i32], align 16
@.str = external hidden unnamed_addr constant [27 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1, ptr noundef nonnull %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  %9 = load i32, ptr %2, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph, label %.preheader30

.preheader30:                                     ; preds = %.lr.ph, %0
  %11 = load i32, ptr %1, align 4, !tbaa !5
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph33.preheader, label %._crit_edge

.lr.ph33.preheader:                               ; preds = %.preheader30
  %13 = zext nneg i32 %11 to i64
  %14 = shl nuw nsw i64 %13, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @pi, i8 -1, i64 %14, i1 false), !tbaa !5
  %min.iters.check = icmp ult i32 %11, 8
  br i1 %min.iters.check, label %.lr.ph33.preheader88, label %vector.ph

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

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

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

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %13
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph33.preheader88

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.02831 = phi i32 [ %27, %.lr.ph ], [ 0, %0 ]
  %18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %20 = load i32, ptr %5, align 4, !tbaa !5
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [1000 x [1000 x i32]], ptr @g, i64 0, i64 %22, i64 %24
  store i32 %20, ptr %25, align 4, !tbaa !5
  %26 = getelementptr inbounds [1000 x [1000 x i32]], ptr @g, i64 0, i64 %24, i64 %22
  store i32 %20, ptr %26, align 4, !tbaa !5
  %27 = add nuw nsw i32 %.02831, 1
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %.lr.ph, label %.preheader30, !llvm.loop !13

.lr.ph33:                                         ; preds = %.lr.ph33.preheader88, %.lr.ph33
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph33 ], [ %indvars.iv.ph, %.lr.ph33.preheader88 ]
  %30 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %indvars.iv
  store i32 999999, ptr %30, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %13
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph33, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph33, %middle.block, %.preheader30
  %31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %6)
  %33 = load i32, ptr %6, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %34
  store i32 0, ptr %35, align 4, !tbaa !5
  %36 = getelementptr inbounds [1000 x i32], ptr @pi, i64 0, i64 %34
  store i32 -1, ptr %36, align 4, !tbaa !5
  %37 = load i32, ptr %1, align 4, !tbaa !5
  %38 = icmp sgt i32 %37, 1
  br i1 %38, label %.lr.ph40, label %._crit_edge41

.lr.ph40:                                         ; preds = %._crit_edge, %._crit_edge37
  %39 = phi i32 [ %43, %._crit_edge37 ], [ %37, %._crit_edge ]
  %.238 = phi i32 [ %58, %._crit_edge37 ], [ 0, %._crit_edge ]
  %40 = call noundef i32 @_Z6getMini(i32 noundef %39)
  store i32 %40, ptr %3, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [1000 x i32], ptr @visited, i64 0, i64 %41
  store i32 1, ptr %42, align 4, !tbaa !5
  %43 = load i32, ptr %1, align 4, !tbaa !5
  %44 = icmp sgt i32 %43, 0
  br i1 %44, label %.lr.ph36.preheader, label %._crit_edge37

.lr.ph36.preheader:                               ; preds = %.lr.ph40
  %wide.trip.count56 = zext nneg i32 %43 to i64
  br label %.lr.ph36

.lr.ph36:                                         ; preds = %.lr.ph36.preheader, %57
  %indvars.iv53 = phi i64 [ 0, %.lr.ph36.preheader ], [ %indvars.iv.next54, %57 ]
  %45 = getelementptr inbounds [1000 x [1000 x i32]], ptr @g, i64 0, i64 %41, i64 %indvars.iv53
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %.not = icmp eq i32 %46, 0
  br i1 %.not, label %57, label %47

47:                                               ; preds = %.lr.ph36
  %48 = getelementptr inbounds [1000 x i32], ptr @visited, i64 0, i64 %indvars.iv53
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %51, label %57

51:                                               ; preds = %47
  %52 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %indvars.iv53
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = icmp slt i32 %46, %53
  br i1 %54, label %55, label %57

55:                                               ; preds = %51
  store i32 %46, ptr %52, align 4, !tbaa !5
  %56 = getelementptr inbounds [1000 x i32], ptr @pi, i64 0, i64 %indvars.iv53
  store i32 %40, ptr %56, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %.lr.ph36, %47, %51, %55
  %indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
  %exitcond57.not = icmp eq i64 %indvars.iv.next54, %wide.trip.count56
  br i1 %exitcond57.not, label %._crit_edge37, label %.lr.ph36, !llvm.loop !15

._crit_edge37:                                    ; preds = %57, %.lr.ph40
  %58 = add nuw nsw i32 %.238, 1
  %59 = add nsw i32 %43, -1
  %60 = icmp slt i32 %58, %59
  br i1 %60, label %.lr.ph40, label %._crit_edge41, !llvm.loop !16

._crit_edge41:                                    ; preds = %._crit_edge37, %._crit_edge
  %61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %62 = load i32, ptr %1, align 4, !tbaa !5
  %63 = icmp sgt i32 %62, 1
  br i1 %63, label %.lr.ph44, label %.preheader

.preheader:                                       ; preds = %.lr.ph44, %._crit_edge41
  %.lcssa = phi i32 [ %62, %._crit_edge41 ], [ %75, %.lr.ph44 ]
  %64 = icmp sgt i32 %.lcssa, 0
  br i1 %64, label %.lr.ph47.preheader, label %._crit_edge48

.lr.ph47.preheader:                               ; preds = %.preheader
  %wide.trip.count64 = zext nneg i32 %.lcssa to i64
  %min.iters.check72 = icmp ult i32 %.lcssa, 8
  br i1 %min.iters.check72, label %.lr.ph47.preheader83, label %vector.ph73

.lr.ph47.preheader83:                             ; preds = %middle.block70, %.lr.ph47.preheader
  %indvars.iv61.ph = phi i64 [ 0, %.lr.ph47.preheader ], [ %n.vec75, %middle.block70 ]
  %.046.ph = phi i32 [ 0, %.lr.ph47.preheader ], [ %70, %middle.block70 ]
  br label %.lr.ph47

vector.ph73:                                      ; preds = %.lr.ph47.preheader
  %n.vec75 = and i64 %wide.trip.count64, 2147483640
  br label %vector.body77

vector.body77:                                    ; preds = %vector.body77, %vector.ph73
  %index78 = phi i64 [ 0, %vector.ph73 ], [ %index.next81, %vector.body77 ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph73 ], [ %67, %vector.body77 ]
  %vec.phi79 = phi <4 x i32> [ zeroinitializer, %vector.ph73 ], [ %68, %vector.body77 ]
  %65 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %index78
  %66 = getelementptr inbounds i8, ptr %65, i64 16
  %wide.load = load <4 x i32>, ptr %65, align 16, !tbaa !5
  %wide.load80 = load <4 x i32>, ptr %66, align 16, !tbaa !5
  %67 = add <4 x i32> %wide.load, %vec.phi
  %68 = add <4 x i32> %wide.load80, %vec.phi79
  %index.next81 = add nuw i64 %index78, 8
  %69 = icmp eq i64 %index.next81, %n.vec75
  br i1 %69, label %middle.block70, label %vector.body77, !llvm.loop !17

middle.block70:                                   ; preds = %vector.body77
  %bin.rdx = add <4 x i32> %68, %67
  %70 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n82 = icmp eq i64 %n.vec75, %wide.trip.count64
  br i1 %cmp.n82, label %._crit_edge48, label %.lr.ph47.preheader83

.lr.ph44:                                         ; preds = %._crit_edge41, %.lr.ph44
  %indvars.iv58 = phi i64 [ %indvars.iv.next59, %.lr.ph44 ], [ 1, %._crit_edge41 ]
  %71 = getelementptr inbounds [1000 x i32], ptr @pi, i64 0, i64 %indvars.iv58
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = trunc nuw nsw i64 %indvars.iv58 to i32
  %74 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %72, i32 noundef %73)
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %75 = load i32, ptr %1, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = icmp slt i64 %indvars.iv.next59, %76
  br i1 %77, label %.lr.ph44, label %.preheader, !llvm.loop !18

.lr.ph47:                                         ; preds = %.lr.ph47.preheader83, %.lr.ph47
  %indvars.iv61 = phi i64 [ %indvars.iv.next62, %.lr.ph47 ], [ %indvars.iv61.ph, %.lr.ph47.preheader83 ]
  %.046 = phi i32 [ %80, %.lr.ph47 ], [ %.046.ph, %.lr.ph47.preheader83 ]
  %78 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %indvars.iv61
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = add nsw i32 %79, %.046
  %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_edge48, label %.lr.ph47, !llvm.loop !19

._crit_edge48:                                    ; preds = %.lr.ph47, %middle.block70, %.preheader
  %.0.lcssa = phi i32 [ 0, %.preheader ], [ %70, %middle.block70 ], [ %80, %.lr.ph47 ]
  %81 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %.0.lcssa)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0
}

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5

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


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