; LLVM IR from div-bargali/Data-Structures-and-Algorithms :: C++/Algorithms/Dynamic-Programming/Building_bridges.ll (Z10maxBridgesP9CityPairsi)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.CityPairs = type { i32, i32 }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z7compare9CityPairsS_(i64, i64) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z10maxBridgesP9CityPairsi(ptr noundef %0, i32 noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %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
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %13 = load i32, ptr %4, align 4, !tbaa !9
  %14 = zext i32 %13 to i64
  %15 = call ptr @llvm.stacksave.p0()
  store ptr %15, ptr %5, align 8
  %16 = alloca i32, i64 %14, align 16
  store i64 %14, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %17

17:                                               ; preds = %26, %2
  %18 = load i32, ptr %7, align 4, !tbaa !9
  %19 = load i32, ptr %4, align 4, !tbaa !9
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %29

22:                                               ; preds = %17
  %23 = load i32, ptr %7, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds i32, ptr %16, i64 %24
  store i32 1, ptr %25, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %22
  %27 = load i32, ptr %7, align 4, !tbaa !9
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %7, align 4, !tbaa !9
  br label %17, !llvm.loop !11

29:                                               ; preds = %21
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = load i32, ptr %4, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds %struct.CityPairs, ptr %31, i64 %33
  call void @_ZSt4sortIP9CityPairsPFbS0_S0_EEvT_S4_T0_(ptr noundef %30, ptr noundef %34, ptr noundef @_Z7compare9CityPairsS_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !9
  br label %35

35:                                               ; preds = %85, %29
  %36 = load i32, ptr %8, align 4, !tbaa !9
  %37 = load i32, ptr %4, align 4, !tbaa !9
  %38 = icmp slt i32 %36, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  store i32 5, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %88

40:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %81, %40
  %42 = load i32, ptr %10, align 4, !tbaa !9
  %43 = load i32, ptr %8, align 4, !tbaa !9
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %46, label %45

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

46:                                               ; preds = %41
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = load i32, ptr %8, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds %struct.CityPairs, ptr %47, i64 %49
  %51 = getelementptr inbounds %struct.CityPairs, ptr %50, i32 0, i32 0
  %52 = load i32, ptr %51, align 4, !tbaa !13
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = load i32, ptr %10, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds %struct.CityPairs, ptr %53, i64 %55
  %57 = getelementptr inbounds %struct.CityPairs, ptr %56, i32 0, i32 0
  %58 = load i32, ptr %57, align 4, !tbaa !13
  %59 = icmp sge i32 %52, %58
  br i1 %59, label %60, label %80

60:                                               ; preds = %46
  %61 = load i32, ptr %8, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds i32, ptr %16, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !9
  %65 = load i32, ptr %10, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds i32, ptr %16, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !9
  %69 = add nsw i32 1, %68
  %70 = icmp slt i32 %64, %69
  br i1 %70, label %71, label %80

71:                                               ; preds = %60
  %72 = load i32, ptr %10, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds i32, ptr %16, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !9
  %76 = add nsw i32 1, %75
  %77 = load i32, ptr %8, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds i32, ptr %16, i64 %78
  store i32 %76, ptr %79, align 4, !tbaa !9
  br label %80

80:                                               ; preds = %71, %60, %46
  br label %81

81:                                               ; preds = %80
  %82 = load i32, ptr %10, align 4, !tbaa !9
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %10, align 4, !tbaa !9
  br label %41, !llvm.loop !15

84:                                               ; preds = %45
  br label %85

85:                                               ; preds = %84
  %86 = load i32, ptr %8, align 4, !tbaa !9
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %8, align 4, !tbaa !9
  br label %35, !llvm.loop !16

88:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %89 = getelementptr inbounds i32, ptr %16, i64 0
  %90 = load i32, ptr %89, align 16, !tbaa !9
  store i32 %90, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 1, ptr %12, align 4, !tbaa !9
  br label %91

91:                                               ; preds = %109, %88
  %92 = load i32, ptr %12, align 4, !tbaa !9
  %93 = load i32, ptr %4, align 4, !tbaa !9
  %94 = icmp slt i32 %92, %93
  br i1 %94, label %96, label %95

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

96:                                               ; preds = %91
  %97 = load i32, ptr %11, align 4, !tbaa !9
  %98 = load i32, ptr %12, align 4, !tbaa !9
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds i32, ptr %16, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !9
  %102 = icmp slt i32 %97, %101
  br i1 %102, label %103, label %108

103:                                              ; preds = %96
  %104 = load i32, ptr %12, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds i32, ptr %16, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !9
  store i32 %107, ptr %11, align 4, !tbaa !9
  br label %108

108:                                              ; preds = %103, %96
  br label %109

109:                                              ; preds = %108
  %110 = load i32, ptr %12, align 4, !tbaa !9
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %12, align 4, !tbaa !9
  br label %91, !llvm.loop !17

112:                                              ; preds = %95
  %113 = load i32, ptr %11, align 4, !tbaa !9
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  %114 = load ptr, ptr %5, align 8
  call void @llvm.stackrestore.p0(ptr %114)
  ret i32 %113
}

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP9CityPairsPFbS0_S0_EEvT_S4_T0_(ptr noundef, ptr noundef, ptr noundef) #4

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !10, i64 0}
!14 = !{!"_ZTS9CityPairs", !10, i64 0, !10, i64 4}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !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"

%struct.CityPairs = type { i32, i32 }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z7compare9CityPairsS_(i64, i64) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z10maxBridgesP9CityPairsi(ptr noundef %0, i32 noundef %1) local_unnamed_addr #1 {
  %3 = zext i32 %1 to i64
  %4 = alloca i32, i64 %3, align 16
  %5 = icmp sgt i32 %1, 0
  br i1 %5, label %.lr.ph.preheader, label %._crit_edge.thread

.lr.ph.preheader:                                 ; preds = %2
  %min.iters.check = icmp ult i32 %1, 8
  br i1 %min.iters.check, label %.lr.ph.preheader78, label %vector.ph

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

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

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

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

._crit_edge.thread:                               ; preds = %2
  %9 = sext i32 %1 to i64
  %10 = getelementptr inbounds %struct.CityPairs, ptr %0, i64 %9
  tail call void @_ZSt4sortIP9CityPairsPFbS0_S0_EEvT_S4_T0_(ptr noundef %0, ptr noundef %10, ptr noundef nonnull @_Z7compare9CityPairsS_)
  br label %._crit_edge40.thread

._crit_edge:                                      ; preds = %.lr.ph, %middle.block
  %11 = zext nneg i32 %1 to i64
  %12 = getelementptr inbounds %struct.CityPairs, ptr %0, i64 %11
  tail call void @_ZSt4sortIP9CityPairsPFbS0_S0_EEvT_S4_T0_(ptr noundef %0, ptr noundef nonnull %12, ptr noundef nonnull @_Z7compare9CityPairsS_)
  %.not62 = icmp eq i32 %1, 1
  br i1 %.not62, label %._crit_edge40.thread, label %.preheader

.lr.ph:                                           ; preds = %.lr.ph.preheader78, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader78 ]
  %13 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv
  store i32 1, ptr %13, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %3
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !13

.preheader:                                       ; preds = %._crit_edge, %.epilog-lcssa
  %indvar = phi i64 [ %indvar.next, %.epilog-lcssa ], [ 0, %._crit_edge ]
  %indvars.iv52 = phi i64 [ %indvars.iv.next53, %.epilog-lcssa ], [ 1, %._crit_edge ]
  %14 = getelementptr inbounds %struct.CityPairs, ptr %0, i64 %indvars.iv52
  %15 = load i32, ptr %14, align 4, !tbaa !14
  %16 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv52
  %xtraiter = and i64 %indvars.iv52, 1
  %17 = icmp eq i64 %indvar, 0
  br i1 %17, label %.unr-lcssa, label %.preheader.new

.preheader.new:                                   ; preds = %.preheader
  %unroll_iter = and i64 %indvars.iv52, 9223372036854775806
  br label %35

._crit_edge40.thread:                             ; preds = %._crit_edge.thread, %._crit_edge
  %18 = load i32, ptr %4, align 16, !tbaa !5
  br label %._crit_edge45

._crit_edge40:                                    ; preds = %.epilog-lcssa
  %19 = load i32, ptr %4, align 16, !tbaa !5
  br i1 %.not62, label %._crit_edge45, label %.lr.ph44.preheader

.lr.ph44.preheader:                               ; preds = %._crit_edge40
  %20 = add nsw i64 %3, -1
  %min.iters.check65 = icmp ult i32 %1, 9
  br i1 %min.iters.check65, label %.lr.ph44.preheader76, label %vector.ph66

.lr.ph44.preheader76:                             ; preds = %middle.block63, %.lr.ph44.preheader
  %indvars.iv57.ph = phi i64 [ 1, %.lr.ph44.preheader ], [ %ind.end, %middle.block63 ]
  %.02941.ph = phi i32 [ %19, %.lr.ph44.preheader ], [ %26, %middle.block63 ]
  br label %.lr.ph44

vector.ph66:                                      ; preds = %.lr.ph44.preheader
  %n.vec68 = and i64 %20, -8
  %ind.end = or disjoint i64 %n.vec68, 1
  %minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %19, i64 0
  %minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body70

vector.body70:                                    ; preds = %vector.body70, %vector.ph66
  %index71 = phi i64 [ 0, %vector.ph66 ], [ %index.next74, %vector.body70 ]
  %vec.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph66 ], [ %23, %vector.body70 ]
  %vec.phi72 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph66 ], [ %24, %vector.body70 ]
  %offset.idx = or disjoint i64 %index71, 1
  %21 = getelementptr inbounds i32, ptr %4, i64 %offset.idx
  %22 = getelementptr inbounds i8, ptr %21, i64 16
  %wide.load = load <4 x i32>, ptr %21, align 4, !tbaa !5
  %wide.load73 = load <4 x i32>, ptr %22, align 4, !tbaa !5
  %23 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load)
  %24 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi72, <4 x i32> %wide.load73)
  %index.next74 = add nuw i64 %index71, 8
  %25 = icmp eq i64 %index.next74, %n.vec68
  br i1 %25, label %middle.block63, label %vector.body70, !llvm.loop !16

middle.block63:                                   ; preds = %vector.body70
  %rdx.minmax = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %23, <4 x i32> %24)
  %26 = tail call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
  %cmp.n75 = icmp eq i64 %20, %n.vec68
  br i1 %cmp.n75, label %._crit_edge45, label %.lr.ph44.preheader76

.unr-lcssa:                                       ; preds = %53, %.preheader
  %indvars.iv47.unr = phi i64 [ 0, %.preheader ], [ %indvars.iv.next48.1, %53 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.epilog-lcssa, label %.epil.preheader

.epil.preheader:                                  ; preds = %.unr-lcssa
  %27 = getelementptr inbounds %struct.CityPairs, ptr %0, i64 %indvars.iv47.unr
  %28 = load i32, ptr %27, align 4, !tbaa !14
  %.not.epil = icmp slt i32 %15, %28
  br i1 %.not.epil, label %.epilog-lcssa, label %29

29:                                               ; preds = %.epil.preheader
  %30 = load i32, ptr %16, align 4, !tbaa !5
  %31 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv47.unr
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %.not36.epil = icmp sgt i32 %30, %32
  br i1 %.not36.epil, label %.epilog-lcssa, label %33

33:                                               ; preds = %29
  %34 = add nsw i32 %32, 1
  store i32 %34, ptr %16, align 4, !tbaa !5
  br label %.epilog-lcssa

.epilog-lcssa:                                    ; preds = %.epil.preheader, %29, %33, %.unr-lcssa
  %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
  %exitcond56.not = icmp eq i64 %indvars.iv.next53, %3
  %indvar.next = add i64 %indvar, 1
  br i1 %exitcond56.not, label %._crit_edge40, label %.preheader, !llvm.loop !17

35:                                               ; preds = %53, %.preheader.new
  %indvars.iv47 = phi i64 [ 0, %.preheader.new ], [ %indvars.iv.next48.1, %53 ]
  %niter = phi i64 [ 0, %.preheader.new ], [ %niter.next.1, %53 ]
  %36 = getelementptr inbounds %struct.CityPairs, ptr %0, i64 %indvars.iv47
  %37 = load i32, ptr %36, align 4, !tbaa !14
  %.not = icmp slt i32 %15, %37
  br i1 %.not, label %44, label %38

38:                                               ; preds = %35
  %39 = load i32, ptr %16, align 4, !tbaa !5
  %40 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv47
  %41 = load i32, ptr %40, align 8, !tbaa !5
  %.not36 = icmp sgt i32 %39, %41
  br i1 %.not36, label %44, label %42

42:                                               ; preds = %38
  %43 = add nsw i32 %41, 1
  store i32 %43, ptr %16, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %35, %38, %42
  %indvars.iv.next48 = or disjoint i64 %indvars.iv47, 1
  %45 = getelementptr inbounds %struct.CityPairs, ptr %0, i64 %indvars.iv.next48
  %46 = load i32, ptr %45, align 4, !tbaa !14
  %.not.1 = icmp slt i32 %15, %46
  br i1 %.not.1, label %53, label %47

47:                                               ; preds = %44
  %48 = load i32, ptr %16, align 4, !tbaa !5
  %49 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv.next48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %.not36.1 = icmp sgt i32 %48, %50
  br i1 %.not36.1, label %53, label %51

51:                                               ; preds = %47
  %52 = add nsw i32 %50, 1
  store i32 %52, ptr %16, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %51, %47, %44
  %indvars.iv.next48.1 = add nuw nsw i64 %indvars.iv47, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.unr-lcssa, label %35, !llvm.loop !18

._crit_edge45:                                    ; preds = %.lr.ph44, %middle.block63, %._crit_edge40.thread, %._crit_edge40
  %.029.lcssa = phi i32 [ %19, %._crit_edge40 ], [ %18, %._crit_edge40.thread ], [ %26, %middle.block63 ], [ %spec.select, %.lr.ph44 ]
  ret i32 %.029.lcssa

.lr.ph44:                                         ; preds = %.lr.ph44.preheader76, %.lr.ph44
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %.lr.ph44 ], [ %indvars.iv57.ph, %.lr.ph44.preheader76 ]
  %.02941 = phi i32 [ %spec.select, %.lr.ph44 ], [ %.02941.ph, %.lr.ph44.preheader76 ]
  %54 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv57
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %spec.select = tail call i32 @llvm.smax.i32(i32 %.02941, i32 %55)
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %exitcond61.not = icmp eq i64 %indvars.iv.next58, %3
  br i1 %exitcond61.not, label %._crit_edge45, label %.lr.ph44, !llvm.loop !19
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP9CityPairsPFbS0_S0_EEvT_S4_T0_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !12, !11}
!14 = !{!15, !6, i64 0}
!15 = !{!"_ZTS9CityPairs", !6, i64 0, !6, i64 4}
!16 = distinct !{!16, !10, !11, !12}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !12, !11}


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