; LLVM IR from upupming/algorithm :: wheel/prim.ll (Z4primv)

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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@graph = external dso_local global [5 x [5 x i32]], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z4primv() #0 {
  %1 = alloca [5 x i32], align 16
  %2 = alloca [5 x i32], align 16
  %3 = alloca [5 x i8], align 1
  %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
  call void @llvm.lifetime.start.p0(i64 20, ptr %1) #4
  call void @llvm.lifetime.start.p0(i64 20, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 5, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %22, %0
  %12 = load i32, ptr %4, align 4, !tbaa !5
  %13 = icmp slt i32 %12, 5
  br i1 %13, label %15, label %14

14:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %25

15:                                               ; preds = %11
  %16 = load i32, ptr %4, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [5 x i8], ptr %3, i64 0, i64 %17
  store i8 0, ptr %18, align 1, !tbaa !9
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [5 x i32], ptr %2, i64 0, i64 %20
  store i32 2147483647, ptr %21, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %15
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %4, align 4, !tbaa !5
  br label %11, !llvm.loop !11

25:                                               ; preds = %14
  %26 = getelementptr inbounds [5 x i32], ptr %2, i64 0, i64 0
  store i32 0, ptr %26, align 16, !tbaa !5
  %27 = getelementptr inbounds [5 x i32], ptr %1, i64 0, i64 0
  store i32 0, ptr %27, align 16, !tbaa !5
  br label %28

28:                                               ; preds = %119, %25
  br label %29

29:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 -1, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 2147483647, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %54, %29
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = icmp slt i32 %31, 5
  br i1 %32, label %34, label %33

33:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %57

34:                                               ; preds = %30
  %35 = load i32, ptr %7, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [5 x i8], ptr %3, i64 0, i64 %36
  %38 = load i8, ptr %37, align 1, !tbaa !9, !range !13, !noundef !14
  %39 = trunc i8 %38 to i1
  br i1 %39, label %53, label %40

40:                                               ; preds = %34
  %41 = load i32, ptr %7, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [5 x i32], ptr %2, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = load i32, ptr %6, align 4, !tbaa !5
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %47, label %53

47:                                               ; preds = %40
  %48 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %48, ptr %5, align 4, !tbaa !5
  %49 = load i32, ptr %7, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [5 x i32], ptr %2, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  store i32 %52, ptr %6, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %47, %40, %34
  br label %54

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

57:                                               ; preds = %33
  %58 = load i32, ptr %5, align 4, !tbaa !5
  %59 = icmp eq i32 %58, -1
  br i1 %59, label %60, label %61

60:                                               ; preds = %57
  store i32 6, ptr %8, align 4
  br label %117

61:                                               ; preds = %57
  %62 = load i32, ptr %5, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [5 x i8], ptr %3, i64 0, i64 %63
  store i8 1, ptr %64, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %113, %61
  %66 = load i32, ptr %9, align 4, !tbaa !5
  %67 = icmp slt i32 %66, 5
  br i1 %67, label %69, label %68

68:                                               ; preds = %65
  store i32 10, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %116

69:                                               ; preds = %65
  %70 = load i32, ptr %9, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [5 x i8], ptr %3, i64 0, i64 %71
  %73 = load i8, ptr %72, align 1, !tbaa !9, !range !13, !noundef !14
  %74 = trunc i8 %73 to i1
  br i1 %74, label %112, label %75

75:                                               ; preds = %69
  %76 = load i32, ptr %5, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [5 x [5 x i32]], ptr @graph, i64 0, i64 %77
  %79 = load i32, ptr %9, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [5 x i32], ptr %78, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = icmp ne i32 %82, 0
  br i1 %83, label %84, label %112

84:                                               ; preds = %75
  %85 = load i32, ptr %5, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [5 x [5 x i32]], ptr @graph, i64 0, i64 %86
  %88 = load i32, ptr %9, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [5 x i32], ptr %87, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = load i32, ptr %9, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [5 x i32], ptr %2, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = icmp slt i32 %91, %95
  br i1 %96, label %97, label %112

97:                                               ; preds = %84
  %98 = load i32, ptr %5, align 4, !tbaa !5
  %99 = load i32, ptr %9, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [5 x i32], ptr %1, i64 0, i64 %100
  store i32 %98, ptr %101, align 4, !tbaa !5
  %102 = load i32, ptr %5, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [5 x [5 x i32]], ptr @graph, i64 0, i64 %103
  %105 = load i32, ptr %9, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [5 x i32], ptr %104, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = load i32, ptr %9, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [5 x i32], ptr %2, i64 0, i64 %110
  store i32 %108, ptr %111, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %97, %84, %75, %69
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %9, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %9, align 4, !tbaa !5
  br label %65, !llvm.loop !16

116:                                              ; preds = %68
  store i32 0, ptr %8, align 4
  br label %117

117:                                              ; preds = %116, %60
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  %118 = load i32, ptr %8, align 4
  switch i32 %118, label %145 [
    i32 0, label %119
    i32 6, label %120
  ]

119:                                              ; preds = %117
  br label %28, !llvm.loop !17

120:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %141, %120
  %122 = load i32, ptr %10, align 4, !tbaa !5
  %123 = icmp slt i32 %122, 5
  br i1 %123, label %125, label %124

124:                                              ; preds = %121
  store i32 13, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %144

125:                                              ; preds = %121
  %126 = load i32, ptr %10, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [5 x i32], ptr %1, i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %129)
  %131 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %130, ptr noundef @.str)
  %132 = load i32, ptr %10, align 4, !tbaa !5
  %133 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %131, i32 noundef %132)
  %134 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %133, ptr noundef @.str.1)
  %135 = load i32, ptr %10, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [5 x i32], ptr %2, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !5
  %139 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %134, i32 noundef %138)
  %140 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %139, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %141

141:                                              ; preds = %125
  %142 = load i32, ptr %10, align 4, !tbaa !5
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %10, align 4, !tbaa !5
  br label %121, !llvm.loop !18

144:                                              ; preds = %124
  call void @llvm.lifetime.end.p0(i64 5, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 20, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 20, ptr %1) #4
  ret void

145:                                              ; preds = %117
  unreachable
}

; 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: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 = { "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 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@graph = external dso_local local_unnamed_addr global [5 x [5 x i32]], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z4primv() local_unnamed_addr #0 {
  %1 = alloca [5 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %1) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) %1, i8 0, i64 5, i1 false), !tbaa !5
  %2 = getelementptr inbounds i8, ptr %1, i64 1
  %3 = getelementptr inbounds i8, ptr %1, i64 2
  %4 = getelementptr inbounds i8, ptr %1, i64 3
  %5 = getelementptr inbounds i8, ptr %1, i64 4
  br label %.outer

.outer:                                           ; preds = %60, %0
  %.ph = phi i8 [ %58, %60 ], [ 0, %0 ]
  %.ph83 = phi i8 [ %51, %60 ], [ 0, %0 ]
  %.ph84 = phi i8 [ %44, %60 ], [ 0, %0 ]
  %.ph85 = phi i8 [ %37, %60 ], [ 0, %0 ]
  %.ph86 = phi i8 [ %30, %60 ], [ 0, %0 ]
  %.sroa.10.0.ph = phi i32 [ %spec.select80, %60 ], [ undef, %0 ]
  %.sroa.8.0.ph = phi i32 [ %.sroa.8.1, %60 ], [ undef, %0 ]
  %.sroa.6.0.ph = phi i32 [ %.sroa.6.1, %60 ], [ undef, %0 ]
  %.sroa.4.0.ph = phi i32 [ %.sroa.4.1, %60 ], [ undef, %0 ]
  %.sroa.22.0.ph = phi i32 [ %spec.select81, %60 ], [ 2147483647, %0 ]
  %.sroa.17.0.ph = phi i32 [ %.sroa.17.1, %60 ], [ 2147483647, %0 ]
  %.sroa.12.0.ph = phi i32 [ %.sroa.12.1, %60 ], [ 2147483647, %0 ]
  %.sroa.7.0.ph = phi i32 [ %.sroa.7.1, %60 ], [ 2147483647, %0 ]
  %.sroa.0.0.ph = phi i32 [ %.sroa.0.1, %60 ], [ 0, %0 ]
  br label %6

6:                                                ; preds = %.outer, %57
  %7 = phi i8 [ %58, %57 ], [ %.ph, %.outer ]
  %8 = phi i8 [ %51, %57 ], [ %.ph83, %.outer ]
  %9 = phi i8 [ %44, %57 ], [ %.ph84, %.outer ]
  %10 = phi i8 [ %37, %57 ], [ %.ph85, %.outer ]
  %11 = phi i8 [ %30, %57 ], [ %.ph86, %.outer ]
  %.sroa.8.0 = phi i32 [ %.sroa.8.1, %57 ], [ %.sroa.8.0.ph, %.outer ]
  %.sroa.6.0 = phi i32 [ %.sroa.6.1, %57 ], [ %.sroa.6.0.ph, %.outer ]
  %.sroa.4.0 = phi i32 [ %.sroa.4.1, %57 ], [ %.sroa.4.0.ph, %.outer ]
  %.sroa.17.0 = phi i32 [ %.sroa.17.1, %57 ], [ %.sroa.17.0.ph, %.outer ]
  %.sroa.12.0 = phi i32 [ %.sroa.12.1, %57 ], [ %.sroa.12.0.ph, %.outer ]
  %.sroa.7.0 = phi i32 [ %.sroa.7.1, %57 ], [ %.sroa.7.0.ph, %.outer ]
  %.sroa.0.0 = phi i32 [ %.sroa.0.1, %57 ], [ %.sroa.0.0.ph, %.outer ]
  %12 = trunc nuw i8 %11 to i1
  %.not63 = icmp eq i32 %.sroa.0.0, 2147483647
  %narrow = select i1 %12, i1 true, i1 %.not63
  %.137 = sext i1 %narrow to i32
  %.1 = select i1 %12, i32 2147483647, i32 %.sroa.0.0
  %13 = trunc nuw i8 %10 to i1
  br i1 %13, label %16, label %14

14:                                               ; preds = %6
  %15 = icmp slt i32 %.sroa.7.0, %.1
  %spec.select.1 = select i1 %15, i32 1, i32 %.137
  %spec.select41.1 = tail call i32 @llvm.smin.i32(i32 %.sroa.7.0, i32 %.1)
  br label %16

16:                                               ; preds = %14, %6
  %.137.1 = phi i32 [ %.137, %6 ], [ %spec.select.1, %14 ]
  %.1.1 = phi i32 [ %.1, %6 ], [ %spec.select41.1, %14 ]
  %17 = trunc nuw i8 %9 to i1
  br i1 %17, label %20, label %18

18:                                               ; preds = %16
  %19 = icmp slt i32 %.sroa.12.0, %.1.1
  %spec.select.2 = select i1 %19, i32 2, i32 %.137.1
  %spec.select41.2 = tail call i32 @llvm.smin.i32(i32 %.sroa.12.0, i32 %.1.1)
  br label %20

20:                                               ; preds = %18, %16
  %.137.2 = phi i32 [ %.137.1, %16 ], [ %spec.select.2, %18 ]
  %.1.2 = phi i32 [ %.1.1, %16 ], [ %spec.select41.2, %18 ]
  %21 = trunc nuw i8 %8 to i1
  br i1 %21, label %24, label %22

22:                                               ; preds = %20
  %23 = icmp slt i32 %.sroa.17.0, %.1.2
  %spec.select.3 = select i1 %23, i32 3, i32 %.137.2
  %spec.select41.3 = tail call i32 @llvm.smin.i32(i32 %.sroa.17.0, i32 %.1.2)
  br label %24

24:                                               ; preds = %22, %20
  %.137.3 = phi i32 [ %.137.2, %20 ], [ %spec.select.3, %22 ]
  %.1.3 = phi i32 [ %.1.2, %20 ], [ %spec.select41.3, %22 ]
  %25 = trunc nuw i8 %7 to i1
  %26 = icmp sge i32 %.sroa.22.0.ph, %.1.3
  %or.cond.not = select i1 %25, i1 true, i1 %26
  br i1 %or.cond.not, label %27, label %.thread

27:                                               ; preds = %24
  %.not42 = icmp eq i32 %.137.3, -1
  br i1 %.not42, label %.critedge.preheader, label %.thread

.thread:                                          ; preds = %24, %27
  %.137.466 = phi i32 [ %.137.3, %27 ], [ 4, %24 ]
  %28 = zext nneg i32 %.137.466 to i64
  %29 = getelementptr inbounds [5 x i8], ptr %1, i64 0, i64 %28
  store i8 1, ptr %29, align 1, !tbaa !5
  %30 = load i8, ptr %1, align 1, !tbaa !5, !range !9, !noundef !10
  %31 = trunc nuw i8 %30 to i1
  br i1 %31, label %36, label %32

32:                                               ; preds = %.thread
  %33 = getelementptr inbounds [5 x [5 x i32]], ptr @graph, i64 0, i64 %28, i64 0
  %34 = load i32, ptr %33, align 4, !tbaa !11
  %.not.not = icmp eq i32 %34, 0
  %35 = tail call i32 @llvm.smin.i32(i32 %34, i32 %.sroa.0.0)
  %spec.select73 = select i1 %.not.not, i32 %.sroa.0.0, i32 %35
  br label %36

36:                                               ; preds = %32, %.thread
  %.sroa.0.1 = phi i32 [ %.sroa.0.0, %.thread ], [ %spec.select73, %32 ]
  %37 = load i8, ptr %2, align 1, !tbaa !5, !range !9, !noundef !10
  %38 = trunc nuw i8 %37 to i1
  br i1 %38, label %43, label %39

39:                                               ; preds = %36
  %40 = getelementptr inbounds [5 x [5 x i32]], ptr @graph, i64 0, i64 %28, i64 1
  %41 = load i32, ptr %40, align 4, !tbaa !11
  %.not.1 = icmp ne i32 %41, 0
  %42 = icmp slt i32 %41, %.sroa.7.0
  %or.cond69 = select i1 %.not.1, i1 %42, i1 false
  %spec.select74 = select i1 %or.cond69, i32 %.137.466, i32 %.sroa.4.0
  %spec.select75 = select i1 %or.cond69, i32 %41, i32 %.sroa.7.0
  br label %43

43:                                               ; preds = %39, %36
  %.sroa.4.1 = phi i32 [ %.sroa.4.0, %36 ], [ %spec.select74, %39 ]
  %.sroa.7.1 = phi i32 [ %.sroa.7.0, %36 ], [ %spec.select75, %39 ]
  %44 = load i8, ptr %3, align 1, !tbaa !5, !range !9, !noundef !10
  %45 = trunc nuw i8 %44 to i1
  br i1 %45, label %50, label %46

46:                                               ; preds = %43
  %47 = getelementptr inbounds [5 x [5 x i32]], ptr @graph, i64 0, i64 %28, i64 2
  %48 = load i32, ptr %47, align 4, !tbaa !11
  %.not.2 = icmp ne i32 %48, 0
  %49 = icmp slt i32 %48, %.sroa.12.0
  %or.cond70 = select i1 %.not.2, i1 %49, i1 false
  %spec.select76 = select i1 %or.cond70, i32 %.137.466, i32 %.sroa.6.0
  %spec.select77 = select i1 %or.cond70, i32 %48, i32 %.sroa.12.0
  br label %50

50:                                               ; preds = %46, %43
  %.sroa.6.1 = phi i32 [ %.sroa.6.0, %43 ], [ %spec.select76, %46 ]
  %.sroa.12.1 = phi i32 [ %.sroa.12.0, %43 ], [ %spec.select77, %46 ]
  %51 = load i8, ptr %4, align 1, !tbaa !5, !range !9, !noundef !10
  %52 = trunc nuw i8 %51 to i1
  br i1 %52, label %57, label %53

53:                                               ; preds = %50
  %54 = getelementptr inbounds [5 x [5 x i32]], ptr @graph, i64 0, i64 %28, i64 3
  %55 = load i32, ptr %54, align 4, !tbaa !11
  %.not.3 = icmp ne i32 %55, 0
  %56 = icmp slt i32 %55, %.sroa.17.0
  %or.cond71 = select i1 %.not.3, i1 %56, i1 false
  %spec.select78 = select i1 %or.cond71, i32 %.137.466, i32 %.sroa.8.0
  %spec.select79 = select i1 %or.cond71, i32 %55, i32 %.sroa.17.0
  br label %57

57:                                               ; preds = %53, %50
  %.sroa.8.1 = phi i32 [ %.sroa.8.0, %50 ], [ %spec.select78, %53 ]
  %.sroa.17.1 = phi i32 [ %.sroa.17.0, %50 ], [ %spec.select79, %53 ]
  %58 = load i8, ptr %5, align 1, !tbaa !5, !range !9, !noundef !10
  %59 = trunc nuw i8 %58 to i1
  br i1 %59, label %6, label %60

60:                                               ; preds = %57
  %61 = getelementptr inbounds [5 x [5 x i32]], ptr @graph, i64 0, i64 %28, i64 4
  %62 = load i32, ptr %61, align 4, !tbaa !11
  %.not.4 = icmp ne i32 %62, 0
  %63 = icmp slt i32 %62, %.sroa.22.0.ph
  %or.cond72 = select i1 %.not.4, i1 %63, i1 false
  %spec.select80 = select i1 %or.cond72, i32 %.137.466, i32 %.sroa.10.0.ph
  %spec.select81 = select i1 %or.cond72, i32 %62, i32 %.sroa.22.0.ph
  br label %.outer

.critedge.preheader:                              ; preds = %27
  %64 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.sroa.4.0)
  %65 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %64, ptr noundef nonnull @.str)
  %66 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %65, i32 noundef 1)
  %67 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %66, ptr noundef nonnull @.str.1)
  %68 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %67, i32 noundef %.sroa.7.0)
  %69 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %68, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %70 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.sroa.6.0)
  %71 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %70, ptr noundef nonnull @.str)
  %72 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %71, i32 noundef 2)
  %73 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %72, ptr noundef nonnull @.str.1)
  %74 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %73, i32 noundef %.sroa.12.0)
  %75 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %74, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %76 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.sroa.8.0)
  %77 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %76, ptr noundef nonnull @.str)
  %78 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %77, i32 noundef 3)
  %79 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %78, ptr noundef nonnull @.str.1)
  %80 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %79, i32 noundef %.sroa.17.0)
  %81 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %80, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %82 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.sroa.10.0.ph)
  %83 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %82, ptr noundef nonnull @.str)
  %84 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %83, i32 noundef 4)
  %85 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %84, ptr noundef nonnull @.str.1)
  %86 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %85, i32 noundef %.sroa.22.0.ph)
  %87 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %86, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %1) #6
  ret void
}

; 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: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #2

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{i8 0, i8 2}
!10 = !{}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass