; LLVM IR from lzyrapx/Competitive-Programming :: HDUOJ (2066)

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

@map = external dso_local global [1100 x [1100 x i32]], align 16
@dist = external dso_local global [1100 x i32], align 16
@t = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@d = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z8Dijkstrai(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 [1010 x i32], align 16
  %3 = alloca [1010 x i32], align 16
  %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
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  br label %16

16:                                               ; preds = %160, %0
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t, ptr noundef @s, ptr noundef @d)
  %18 = icmp ne i32 %17, -1
  br i1 %18, label %19, label %163

19:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4040, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 4040, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %40, %19
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = icmp sle i32 %21, 1010
  br i1 %22, label %24, label %23

23:                                               ; preds = %20
  store i32 4, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %43

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

25:                                               ; preds = %36, %24
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = icmp sle i32 %26, 1010
  br i1 %27, label %29, label %28

28:                                               ; preds = %25
  store i32 7, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %39

29:                                               ; preds = %25
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [1100 x [1100 x i32]], ptr @map, i64 0, i64 %31
  %33 = load i32, ptr %6, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [1100 x i32], ptr %32, i64 0, i64 %34
  store i32 66319347, ptr %35, align 4, !tbaa !5
  br label %36

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

39:                                               ; preds = %28
  br label %40

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

43:                                               ; preds = %23
  store i32 0, ptr @n, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 9999, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %87, %43
  %45 = load i32, ptr %11, align 4, !tbaa !5
  %46 = load i32, ptr @t, align 4, !tbaa !5
  %47 = icmp sle i32 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  store i32 10, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %90

49:                                               ; preds = %44
  %50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %8, ptr noundef %9, ptr noundef %10)
  %51 = load i32, ptr %8, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [1100 x [1100 x i32]], ptr @map, i64 0, i64 %52
  %54 = load i32, ptr %9, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [1100 x i32], ptr %53, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = load i32, ptr %10, align 4, !tbaa !5
  %59 = icmp sgt i32 %57, %58
  br i1 %59, label %60, label %74

60:                                               ; preds = %49
  %61 = load i32, ptr %10, align 4, !tbaa !5
  %62 = load i32, ptr %9, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [1100 x [1100 x i32]], ptr @map, i64 0, i64 %63
  %65 = load i32, ptr %8, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [1100 x i32], ptr %64, i64 0, i64 %66
  store i32 %61, ptr %67, align 4, !tbaa !5
  %68 = load i32, ptr %8, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [1100 x [1100 x i32]], ptr @map, i64 0, i64 %69
  %71 = load i32, ptr %9, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [1100 x i32], ptr %70, i64 0, i64 %72
  store i32 %61, ptr %73, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %60, %49
  %75 = load i32, ptr %8, align 4, !tbaa !5
  %76 = load i32, ptr @n, align 4, !tbaa !5
  %77 = icmp sgt i32 %75, %76
  br i1 %77, label %78, label %80

78:                                               ; preds = %74
  %79 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %79, ptr @n, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %78, %74
  %81 = load i32, ptr %9, align 4, !tbaa !5
  %82 = load i32, ptr @n, align 4, !tbaa !5
  %83 = icmp sgt i32 %81, %82
  br i1 %83, label %84, label %86

84:                                               ; preds = %80
  %85 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %85, ptr @n, align 4, !tbaa !5
  br label %86

86:                                               ; preds = %84, %80
  br label %87

87:                                               ; preds = %86
  %88 = load i32, ptr %11, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %11, align 4, !tbaa !5
  br label %44, !llvm.loop !12

90:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %101, %90
  %92 = load i32, ptr %12, align 4, !tbaa !5
  %93 = load i32, ptr @s, align 4, !tbaa !5
  %94 = icmp slt i32 %92, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %91
  store i32 13, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %104

96:                                               ; preds = %91
  %97 = load i32, ptr %12, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [1010 x i32], ptr %2, i64 0, i64 %98
  %100 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %99)
  br label %101

101:                                              ; preds = %96
  %102 = load i32, ptr %12, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %12, align 4, !tbaa !5
  br label %91, !llvm.loop !13

104:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %105

105:                                              ; preds = %115, %104
  %106 = load i32, ptr %13, align 4, !tbaa !5
  %107 = load i32, ptr @d, align 4, !tbaa !5
  %108 = icmp slt i32 %106, %107
  br i1 %108, label %110, label %109

109:                                              ; preds = %105
  store i32 16, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %118

110:                                              ; preds = %105
  %111 = load i32, ptr %13, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [1010 x i32], ptr %3, i64 0, i64 %112
  %114 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %113)
  br label %115

115:                                              ; preds = %110
  %116 = load i32, ptr %13, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %13, align 4, !tbaa !5
  br label %105, !llvm.loop !14

118:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %119

119:                                              ; preds = %157, %118
  %120 = load i32, ptr %14, align 4, !tbaa !5
  %121 = load i32, ptr @s, align 4, !tbaa !5
  %122 = icmp slt i32 %120, %121
  br i1 %122, label %124, label %123

123:                                              ; preds = %119
  store i32 19, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %160

124:                                              ; preds = %119
  %125 = load i32, ptr %14, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [1010 x i32], ptr %2, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  call void @_Z8Dijkstrai(i32 noundef %128)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %129

129:                                              ; preds = %153, %124
  %130 = load i32, ptr %15, align 4, !tbaa !5
  %131 = load i32, ptr @d, align 4, !tbaa !5
  %132 = icmp slt i32 %130, %131
  br i1 %132, label %134, label %133

133:                                              ; preds = %129
  store i32 22, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %156

134:                                              ; preds = %129
  %135 = load i32, ptr %15, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [1010 x i32], ptr %3, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [1100 x i32], ptr @dist, i64 0, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !5
  %142 = load i32, ptr %7, align 4, !tbaa !5
  %143 = icmp slt i32 %141, %142
  br i1 %143, label %144, label %152

144:                                              ; preds = %134
  %145 = load i32, ptr %15, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [1010 x i32], ptr %3, i64 0, i64 %146
  %148 = load i32, ptr %147, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [1100 x i32], ptr @dist, i64 0, i64 %149
  %151 = load i32, ptr %150, align 4, !tbaa !5
  store i32 %151, ptr %7, align 4, !tbaa !5
  br label %152

152:                                              ; preds = %144, %134
  br label %153

153:                                              ; preds = %152
  %154 = load i32, ptr %15, align 4, !tbaa !5
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %15, align 4, !tbaa !5
  br label %129, !llvm.loop !15

156:                                              ; preds = %133
  br label %157

157:                                              ; preds = %156
  %158 = load i32, ptr %14, align 4, !tbaa !5
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %14, align 4, !tbaa !5
  br label %119, !llvm.loop !16

160:                                              ; preds = %123
  %161 = load i32, ptr %7, align 4, !tbaa !5
  %162 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %161)
  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 4040, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4040, ptr %2) #4
  br label %16, !llvm.loop !17

163:                                              ; preds = %16
  %164 = load i32, ptr %1, align 4
  ret i32 %164
}

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

declare i32 @printf(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}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !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"

@map = external dso_local local_unnamed_addr global [1100 x [1100 x i32]], align 16
@dist = external dso_local local_unnamed_addr global [1100 x i32], align 16
@t = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@d = external dso_local global i32, align 4
@n = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z8Dijkstrai(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 [1010 x i32], align 16
  %2 = alloca [1010 x i32], align 16
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t, ptr noundef nonnull @s, ptr noundef nonnull @d)
  %.not55 = icmp eq i32 %6, -1
  br i1 %.not55, label %._crit_edge58, label %.lr.ph57

.lr.ph57:                                         ; preds = %0, %._crit_edge53
  call void @llvm.lifetime.start.p0(i64 4040, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4040, ptr nonnull %2) #5
  br label %vector.ph

vector.ph:                                        ; preds = %scalar.ph, %.lr.ph57
  %indvars.iv60 = phi i64 [ 1, %.lr.ph57 ], [ %indvars.iv.next61, %scalar.ph ]
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next.2, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %7 = getelementptr inbounds [1100 x [1100 x i32]], ptr @map, i64 0, i64 %indvars.iv60, i64 %offset.idx
  %8 = getelementptr inbounds i8, ptr %7, i64 16
  store <4 x i32> <i32 66319347, i32 66319347, i32 66319347, i32 66319347>, ptr %7, align 4, !tbaa !5
  store <4 x i32> <i32 66319347, i32 66319347, i32 66319347, i32 66319347>, ptr %8, align 4, !tbaa !5
  %offset.idx.1 = add nuw nsw i64 %index, 9
  %9 = getelementptr inbounds [1100 x [1100 x i32]], ptr @map, i64 0, i64 %indvars.iv60, i64 %offset.idx.1
  %10 = getelementptr inbounds i8, ptr %9, i64 16
  store <4 x i32> <i32 66319347, i32 66319347, i32 66319347, i32 66319347>, ptr %9, align 4, !tbaa !5
  store <4 x i32> <i32 66319347, i32 66319347, i32 66319347, i32 66319347>, ptr %10, align 4, !tbaa !5
  %offset.idx.2 = add nuw nsw i64 %index, 17
  %11 = getelementptr inbounds [1100 x [1100 x i32]], ptr @map, i64 0, i64 %indvars.iv60, i64 %offset.idx.2
  %12 = getelementptr inbounds i8, ptr %11, i64 16
  store <4 x i32> <i32 66319347, i32 66319347, i32 66319347, i32 66319347>, ptr %11, align 4, !tbaa !5
  store <4 x i32> <i32 66319347, i32 66319347, i32 66319347, i32 66319347>, ptr %12, align 4, !tbaa !5
  %index.next.2 = add nuw nsw i64 %index, 24
  %13 = icmp eq i64 %index.next.2, 1008
  br i1 %13, label %scalar.ph, label %vector.body, !llvm.loop !9

14:                                               ; preds = %scalar.ph
  store i32 0, ptr @n, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %15 = load i32, ptr @t, align 4, !tbaa !5
  %.not3541 = icmp slt i32 %15, 1
  br i1 %.not3541, label %.preheader38, label %.lr.ph

scalar.ph:                                        ; preds = %vector.body
  %16 = getelementptr inbounds [1100 x [1100 x i32]], ptr @map, i64 0, i64 %indvars.iv60, i64 1009
  store i32 66319347, ptr %16, align 4, !tbaa !5
  %17 = getelementptr inbounds [1100 x [1100 x i32]], ptr @map, i64 0, i64 %indvars.iv60, i64 1010
  store i32 66319347, ptr %17, align 8, !tbaa !5
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %exitcond63.not = icmp eq i64 %indvars.iv.next61, 1011
  br i1 %exitcond63.not, label %14, label %vector.ph, !llvm.loop !13

.preheader38:                                     ; preds = %36, %14
  %18 = load i32, ptr @s, align 4, !tbaa !5
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.lr.ph44, label %.preheader37

.lr.ph:                                           ; preds = %14, %36
  %.02742 = phi i32 [ %37, %36 ], [ 1, %14 ]
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %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 [1100 x [1100 x i32]], ptr @map, i64 0, i64 %22, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = load i32, ptr %5, align 4, !tbaa !5
  %28 = icmp sgt i32 %26, %27
  br i1 %28, label %29, label %31

29:                                               ; preds = %.lr.ph
  %30 = getelementptr inbounds [1100 x [1100 x i32]], ptr @map, i64 0, i64 %24, i64 %22
  store i32 %27, ptr %30, align 4, !tbaa !5
  store i32 %27, ptr %25, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %29, %.lr.ph
  %32 = load i32, ptr @n, align 4, !tbaa !5
  %.not77 = icmp sgt i32 %21, %32
  %33 = call i32 @llvm.smax.i32(i32 %21, i32 %32)
  %.not78 = icmp sgt i32 %23, %33
  %34 = or i1 %.not77, %.not78
  br i1 %34, label %35, label %36

35:                                               ; preds = %31
  %simplifycfg.merge = call i32 @llvm.smax.i32(i32 %23, i32 %33)
  store i32 %simplifycfg.merge, ptr @n, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %31, %35
  %37 = add nuw nsw i32 %.02742, 1
  %38 = load i32, ptr @t, align 4, !tbaa !5
  %.not35.not = icmp slt i32 %.02742, %38
  br i1 %.not35.not, label %.lr.ph, label %.preheader38, !llvm.loop !14

.preheader37:                                     ; preds = %.lr.ph44, %.preheader38
  %39 = phi i32 [ %18, %.preheader38 ], [ %44, %.lr.ph44 ]
  %40 = load i32, ptr @d, align 4, !tbaa !5
  %41 = icmp sgt i32 %40, 0
  br i1 %41, label %.lr.ph46, label %.preheader36

.lr.ph44:                                         ; preds = %.preheader38, %.lr.ph44
  %indvars.iv64 = phi i64 [ %indvars.iv.next65, %.lr.ph44 ], [ 0, %.preheader38 ]
  %42 = getelementptr inbounds [1010 x i32], ptr %1, i64 0, i64 %indvars.iv64
  %43 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %42)
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %44 = load i32, ptr @s, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = icmp slt i64 %indvars.iv.next65, %45
  br i1 %46, label %.lr.ph44, label %.preheader37, !llvm.loop !15

.preheader36.loopexit:                            ; preds = %.lr.ph46
  %.pre = load i32, ptr @s, align 4, !tbaa !5
  br label %.preheader36

.preheader36:                                     ; preds = %.preheader36.loopexit, %.preheader37
  %47 = phi i32 [ %.pre, %.preheader36.loopexit ], [ %39, %.preheader37 ]
  %48 = icmp sgt i32 %47, 0
  br i1 %48, label %.lr.ph52, label %._crit_edge53

.lr.ph46:                                         ; preds = %.preheader37, %.lr.ph46
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %.lr.ph46 ], [ 0, %.preheader37 ]
  %49 = getelementptr inbounds [1010 x i32], ptr %2, i64 0, i64 %indvars.iv67
  %50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %49)
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %51 = load i32, ptr @d, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = icmp slt i64 %indvars.iv.next68, %52
  br i1 %53, label %.lr.ph46, label %.preheader36.loopexit, !llvm.loop !16

._crit_edge53:                                    ; preds = %._crit_edge, %.preheader36
  %.028.lcssa = phi i32 [ 9999, %.preheader36 ], [ %.1.lcssa, %._crit_edge ]
  %54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.028.lcssa)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4040, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4040, ptr nonnull %1) #5
  %55 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t, ptr noundef nonnull @s, ptr noundef nonnull @d)
  %.not = icmp eq i32 %55, -1
  br i1 %.not, label %._crit_edge58, label %.lr.ph57, !llvm.loop !17

.lr.ph52:                                         ; preds = %.preheader36, %._crit_edge
  %indvars.iv74 = phi i64 [ %indvars.iv.next75, %._crit_edge ], [ 0, %.preheader36 ]
  %.02850 = phi i32 [ %.1.lcssa, %._crit_edge ], [ 9999, %.preheader36 ]
  %56 = getelementptr inbounds [1010 x i32], ptr %1, i64 0, i64 %indvars.iv74
  %57 = load i32, ptr %56, align 4, !tbaa !5
  call void @_Z8Dijkstrai(i32 noundef %57)
  %58 = load i32, ptr @d, align 4, !tbaa !5
  %59 = icmp sgt i32 %58, 0
  br i1 %59, label %.lr.ph49.preheader, label %._crit_edge

.lr.ph49.preheader:                               ; preds = %.lr.ph52
  %wide.trip.count = zext nneg i32 %58 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %60 = icmp ult i32 %58, 4
  br i1 %60, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph49.preheader.new

.lr.ph49.preheader.new:                           ; preds = %.lr.ph49.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483644
  br label %.lr.ph49

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph49, %.lr.ph49.preheader
  %spec.select.lcssa.ph = phi i32 [ poison, %.lr.ph49.preheader ], [ %spec.select.3, %.lr.ph49 ]
  %indvars.iv70.unr = phi i64 [ 0, %.lr.ph49.preheader ], [ %indvars.iv.next71.3, %.lr.ph49 ]
  %.147.unr = phi i32 [ %.02850, %.lr.ph49.preheader ], [ %spec.select.3, %.lr.ph49 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph49.epil

.lr.ph49.epil:                                    ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph49.epil
  %indvars.iv70.epil = phi i64 [ %indvars.iv.next71.epil, %.lr.ph49.epil ], [ %indvars.iv70.unr, %._crit_edge.loopexit.unr-lcssa ]
  %.147.epil = phi i32 [ %spec.select.epil, %.lr.ph49.epil ], [ %.147.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph49.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %61 = getelementptr inbounds [1010 x i32], ptr %2, i64 0, i64 %indvars.iv70.epil
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [1100 x i32], ptr @dist, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %spec.select.epil = call i32 @llvm.smin.i32(i32 %65, i32 %.147.epil)
  %indvars.iv.next71.epil = add nuw nsw i64 %indvars.iv70.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.lr.ph49.epil, !llvm.loop !18

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph49.epil, %.lr.ph52
  %.1.lcssa = phi i32 [ %.02850, %.lr.ph52 ], [ %spec.select.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %spec.select.epil, %.lr.ph49.epil ]
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %66 = load i32, ptr @s, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = icmp slt i64 %indvars.iv.next75, %67
  br i1 %68, label %.lr.ph52, label %._crit_edge53, !llvm.loop !20

.lr.ph49:                                         ; preds = %.lr.ph49, %.lr.ph49.preheader.new
  %indvars.iv70 = phi i64 [ 0, %.lr.ph49.preheader.new ], [ %indvars.iv.next71.3, %.lr.ph49 ]
  %.147 = phi i32 [ %.02850, %.lr.ph49.preheader.new ], [ %spec.select.3, %.lr.ph49 ]
  %niter = phi i64 [ 0, %.lr.ph49.preheader.new ], [ %niter.next.3, %.lr.ph49 ]
  %69 = getelementptr inbounds [1010 x i32], ptr %2, i64 0, i64 %indvars.iv70
  %70 = load i32, ptr %69, align 16, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [1100 x i32], ptr @dist, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %spec.select = call i32 @llvm.smin.i32(i32 %73, i32 %.147)
  %indvars.iv.next71 = or disjoint i64 %indvars.iv70, 1
  %74 = getelementptr inbounds [1010 x i32], ptr %2, i64 0, i64 %indvars.iv.next71
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [1100 x i32], ptr @dist, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %spec.select.1 = call i32 @llvm.smin.i32(i32 %78, i32 %spec.select)
  %indvars.iv.next71.1 = or disjoint i64 %indvars.iv70, 2
  %79 = getelementptr inbounds [1010 x i32], ptr %2, i64 0, i64 %indvars.iv.next71.1
  %80 = load i32, ptr %79, align 8, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [1100 x i32], ptr @dist, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %spec.select.2 = call i32 @llvm.smin.i32(i32 %83, i32 %spec.select.1)
  %indvars.iv.next71.2 = or disjoint i64 %indvars.iv70, 3
  %84 = getelementptr inbounds [1010 x i32], ptr %2, i64 0, i64 %indvars.iv.next71.2
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [1100 x i32], ptr @dist, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %spec.select.3 = call i32 @llvm.smin.i32(i32 %88, i32 %spec.select.2)
  %indvars.iv.next71.3 = add nuw nsw i64 %indvars.iv70, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph49, !llvm.loop !21

._crit_edge58:                                    ; preds = %._crit_edge53, %0
  ret i32 0
}

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4

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 nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.unroll.disable"}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}


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