; LLVM IR from 4N1Z/Sorting-Searching-Algorithms :: Sorting/CyclicSort/in_C++.ll (Z9cycleSortPii)

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

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

12:                                               ; preds = %136, %2
  %13 = load i32, ptr %6, align 4, !tbaa !9
  %14 = load i32, ptr %4, align 4, !tbaa !9
  %15 = sub nsw i32 %14, 2
  %16 = icmp sle i32 %13, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %12
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %139

18:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = load i32, ptr %6, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds i32, ptr %19, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !9
  store i32 %23, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %24 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %24, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %25 = load i32, ptr %6, align 4, !tbaa !9
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %10, align 4, !tbaa !9
  br label %27

27:                                               ; preds = %44, %18
  %28 = load i32, ptr %10, align 4, !tbaa !9
  %29 = load i32, ptr %4, align 4, !tbaa !9
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %47

32:                                               ; preds = %27
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = load i32, ptr %10, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds i32, ptr %33, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !9
  %38 = load i32, ptr %8, align 4, !tbaa !9
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %40, label %43

40:                                               ; preds = %32
  %41 = load i32, ptr %9, align 4, !tbaa !9
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %9, align 4, !tbaa !9
  br label %43

43:                                               ; preds = %40, %32
  br label %44

44:                                               ; preds = %43
  %45 = load i32, ptr %10, align 4, !tbaa !9
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %10, align 4, !tbaa !9
  br label %27, !llvm.loop !11

47:                                               ; preds = %31
  %48 = load i32, ptr %9, align 4, !tbaa !9
  %49 = load i32, ptr %6, align 4, !tbaa !9
  %50 = icmp eq i32 %48, %49
  br i1 %50, label %51, label %52

51:                                               ; preds = %47
  store i32 4, ptr %7, align 4
  br label %133

52:                                               ; preds = %47
  br label %53

53:                                               ; preds = %61, %52
  %54 = load i32, ptr %8, align 4, !tbaa !9
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = load i32, ptr %9, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds i32, ptr %55, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !9
  %60 = icmp eq i32 %54, %59
  br i1 %60, label %61, label %64

61:                                               ; preds = %53
  %62 = load i32, ptr %9, align 4, !tbaa !9
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %9, align 4, !tbaa !9
  br label %53, !llvm.loop !13

64:                                               ; preds = %53
  %65 = load i32, ptr %9, align 4, !tbaa !9
  %66 = load i32, ptr %6, align 4, !tbaa !9
  %67 = icmp ne i32 %65, %66
  br i1 %67, label %68, label %75

68:                                               ; preds = %64
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = load i32, ptr %9, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds i32, ptr %69, i64 %71
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %72) #3
  %73 = load i32, ptr %5, align 4, !tbaa !9
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %5, align 4, !tbaa !9
  br label %75

75:                                               ; preds = %68, %64
  br label %76

76:                                               ; preds = %131, %75
  %77 = load i32, ptr %9, align 4, !tbaa !9
  %78 = load i32, ptr %6, align 4, !tbaa !9
  %79 = icmp ne i32 %77, %78
  br i1 %79, label %80, label %132

80:                                               ; preds = %76
  %81 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %81, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %82 = load i32, ptr %6, align 4, !tbaa !9
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %11, align 4, !tbaa !9
  br label %84

84:                                               ; preds = %101, %80
  %85 = load i32, ptr %11, align 4, !tbaa !9
  %86 = load i32, ptr %4, align 4, !tbaa !9
  %87 = icmp slt i32 %85, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %84
  store i32 12, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  br label %104

89:                                               ; preds = %84
  %90 = load ptr, ptr %3, align 8, !tbaa !5
  %91 = load i32, ptr %11, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds i32, ptr %90, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !9
  %95 = load i32, ptr %8, align 4, !tbaa !9
  %96 = icmp slt i32 %94, %95
  br i1 %96, label %97, label %100

97:                                               ; preds = %89
  %98 = load i32, ptr %9, align 4, !tbaa !9
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %9, align 4, !tbaa !9
  br label %100

100:                                              ; preds = %97, %89
  br label %101

101:                                              ; preds = %100
  %102 = load i32, ptr %11, align 4, !tbaa !9
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %11, align 4, !tbaa !9
  br label %84, !llvm.loop !14

104:                                              ; preds = %88
  br label %105

105:                                              ; preds = %113, %104
  %106 = load i32, ptr %8, align 4, !tbaa !9
  %107 = load ptr, ptr %3, align 8, !tbaa !5
  %108 = load i32, ptr %9, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds i32, ptr %107, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !9
  %112 = icmp eq i32 %106, %111
  br i1 %112, label %113, label %116

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

116:                                              ; preds = %105
  %117 = load i32, ptr %8, align 4, !tbaa !9
  %118 = load ptr, ptr %3, align 8, !tbaa !5
  %119 = load i32, ptr %9, align 4, !tbaa !9
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds i32, ptr %118, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !9
  %123 = icmp ne i32 %117, %122
  br i1 %123, label %124, label %131

124:                                              ; preds = %116
  %125 = load ptr, ptr %3, align 8, !tbaa !5
  %126 = load i32, ptr %9, align 4, !tbaa !9
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds i32, ptr %125, i64 %127
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %128) #3
  %129 = load i32, ptr %5, align 4, !tbaa !9
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %5, align 4, !tbaa !9
  br label %131

131:                                              ; preds = %124, %116
  br label %76, !llvm.loop !16

132:                                              ; preds = %76
  store i32 0, ptr %7, align 4
  br label %133

133:                                              ; preds = %132, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  %134 = load i32, ptr %7, align 4
  switch i32 %134, label %140 [
    i32 0, label %135
    i32 4, label %136
  ]

135:                                              ; preds = %133
  br label %136

136:                                              ; preds = %135, %133
  %137 = load i32, ptr %6, align 4, !tbaa !9
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %6, align 4, !tbaa !9
  br label %12, !llvm.loop !17

139:                                              ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret void

140:                                              ; preds = %133
  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 nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #3 = { 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 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!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"

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z9cycleSortPii(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = alloca i32, align 4
  %.not65 = icmp slt i32 %1, 2
  br i1 %.not65, label %._crit_edge70, label %.lr.ph69.preheader

.lr.ph69.preheader:                               ; preds = %2
  %4 = add nsw i32 %1, -1
  %wide.trip.count96 = zext nneg i32 %4 to i64
  %wide.trip.count = zext nneg i32 %1 to i64
  %wide.trip.count90 = zext nneg i32 %1 to i64
  br label %.lr.ph.preheader

._crit_edge70:                                    ; preds = %.loopexit, %2
  ret void

.lr.ph.preheader:                                 ; preds = %.loopexit, %.lr.ph69.preheader
  %indvars.iv82 = phi i64 [ 0, %.lr.ph69.preheader ], [ %indvars.iv.next83, %.loopexit ]
  %indvars.iv = phi i64 [ 1, %.lr.ph69.preheader ], [ %indvars.iv.next, %.loopexit ]
  %5 = xor i64 %indvars.iv82, -1
  %6 = add nsw i64 %5, %wide.trip.count
  %7 = xor i64 %indvars.iv82, -1
  %8 = add nsw i64 %7, %wide.trip.count
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %9 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv82
  %10 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %10, ptr %3, align 4, !tbaa !5
  %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
  %11 = trunc nuw nsw i64 %indvars.iv82 to i32
  %min.iters.check105 = icmp ult i64 %6, 8
  br i1 %min.iters.check105, label %.lr.ph.preheader124, label %vector.ph106

.lr.ph.preheader124:                              ; preds = %middle.block103, %.lr.ph.preheader
  %indvars.iv76.ph = phi i64 [ %indvars.iv, %.lr.ph.preheader ], [ %ind.end109, %middle.block103 ]
  %.04155.ph = phi i32 [ %11, %.lr.ph.preheader ], [ %23, %middle.block103 ]
  br label %.lr.ph

vector.ph106:                                     ; preds = %.lr.ph.preheader
  %n.vec108 = and i64 %6, -8
  %ind.end109 = add i64 %indvars.iv, %n.vec108
  %12 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %11, i64 0
  %broadcast.splatinsert118 = insertelement <4 x i32> poison, i32 %10, i64 0
  %broadcast.splat119 = shufflevector <4 x i32> %broadcast.splatinsert118, <4 x i32> poison, <4 x i32> zeroinitializer
  %13 = getelementptr i32, ptr %0, i64 %indvars.iv
  br label %vector.body111

vector.body111:                                   ; preds = %vector.body111, %vector.ph106
  %index112 = phi i64 [ 0, %vector.ph106 ], [ %index.next120, %vector.body111 ]
  %vec.phi113 = phi <4 x i32> [ %12, %vector.ph106 ], [ %20, %vector.body111 ]
  %vec.phi114 = phi <4 x i32> [ zeroinitializer, %vector.ph106 ], [ %21, %vector.body111 ]
  %14 = getelementptr i32, ptr %13, i64 %index112
  %15 = getelementptr inbounds i8, ptr %14, i64 16
  %wide.load116 = load <4 x i32>, ptr %14, align 4, !tbaa !5
  %wide.load117 = load <4 x i32>, ptr %15, align 4, !tbaa !5
  %16 = icmp slt <4 x i32> %wide.load116, %broadcast.splat119
  %17 = icmp slt <4 x i32> %wide.load117, %broadcast.splat119
  %18 = zext <4 x i1> %16 to <4 x i32>
  %19 = zext <4 x i1> %17 to <4 x i32>
  %20 = add <4 x i32> %vec.phi113, %18
  %21 = add <4 x i32> %vec.phi114, %19
  %index.next120 = add nuw i64 %index112, 8
  %22 = icmp eq i64 %index.next120, %n.vec108
  br i1 %22, label %middle.block103, label %vector.body111, !llvm.loop !9

middle.block103:                                  ; preds = %vector.body111
  %bin.rdx121 = add <4 x i32> %21, %20
  %23 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx121)
  %cmp.n122 = icmp eq i64 %6, %n.vec108
  br i1 %cmp.n122, label %._crit_edge, label %.lr.ph.preheader124

._crit_edge:                                      ; preds = %.lr.ph, %middle.block103
  %spec.select.lcssa = phi i32 [ %23, %middle.block103 ], [ %spec.select, %.lr.ph ]
  %24 = zext i32 %spec.select.lcssa to i64
  %25 = icmp eq i64 %indvars.iv82, %24
  br i1 %25, label %.loopexit, label %.preheader53.preheader

.preheader53.preheader:                           ; preds = %._crit_edge
  %26 = sext i32 %spec.select.lcssa to i64
  br label %.preheader53

.lr.ph:                                           ; preds = %.lr.ph.preheader124, %.lr.ph
  %indvars.iv76 = phi i64 [ %indvars.iv.next77, %.lr.ph ], [ %indvars.iv76.ph, %.lr.ph.preheader124 ]
  %.04155 = phi i32 [ %spec.select, %.lr.ph ], [ %.04155.ph, %.lr.ph.preheader124 ]
  %27 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv76
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = icmp slt i32 %28, %10
  %30 = zext i1 %29 to i32
  %spec.select = add nuw nsw i32 %.04155, %30
  %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next77, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !13

.preheader53:                                     ; preds = %.preheader53.preheader, %.preheader53
  %indvars.iv79 = phi i64 [ %26, %.preheader53.preheader ], [ %indvars.iv.next80, %.preheader53 ]
  %31 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv79
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = icmp eq i32 %10, %32
  %indvars.iv.next80 = add nsw i64 %indvars.iv79, 1
  br i1 %33, label %.preheader53, label %34, !llvm.loop !14

34:                                               ; preds = %.preheader53
  %35 = and i64 %indvars.iv79, 4294967295
  %.not49 = icmp eq i64 %35, %indvars.iv82
  br i1 %.not49, label %.loopexit, label %.preheader52.us.preheader

.preheader52.us.preheader:                        ; preds = %34
  %36 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv79
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %36) #4
  %min.iters.check = icmp ult i64 %8, 8
  %n.vec = and i64 %8, -8
  %ind.end = add i64 %indvars.iv, %n.vec
  %37 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %11, i64 0
  %38 = getelementptr i32, ptr %0, i64 %indvars.iv
  %cmp.n = icmp eq i64 %8, %n.vec
  br label %.preheader52.us

.preheader52.us:                                  ; preds = %.preheader52.us.preheader, %54
  %39 = load i32, ptr %3, align 4, !tbaa !5
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader52.us
  %indvars.iv87.ph = phi i64 [ %indvars.iv, %.preheader52.us ], [ %ind.end, %middle.block ]
  %.458.us.ph = phi i32 [ %11, %.preheader52.us ], [ %49, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.preheader52.us
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %39, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ %37, %vector.ph ], [ %46, %vector.body ]
  %vec.phi101 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %47, %vector.body ]
  %40 = getelementptr i32, ptr %38, i64 %index
  %41 = getelementptr inbounds i8, ptr %40, i64 16
  %wide.load = load <4 x i32>, ptr %40, align 4, !tbaa !5
  %wide.load102 = load <4 x i32>, ptr %41, align 4, !tbaa !5
  %42 = icmp slt <4 x i32> %wide.load, %broadcast.splat
  %43 = icmp slt <4 x i32> %wide.load102, %broadcast.splat
  %44 = zext <4 x i1> %42 to <4 x i32>
  %45 = zext <4 x i1> %43 to <4 x i32>
  %46 = add <4 x i32> %vec.phi, %44
  %47 = add <4 x i32> %vec.phi101, %45
  %index.next = add nuw i64 %index, 8
  %48 = icmp eq i64 %index.next, %n.vec
  br i1 %48, label %middle.block, label %vector.body, !llvm.loop !15

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %47, %46
  %49 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  br i1 %cmp.n, label %..preheader_crit_edge.us, label %scalar.ph.preheader

50:                                               ; preds = %..preheader_crit_edge.us, %50
  %indvars.iv92 = phi i64 [ %61, %..preheader_crit_edge.us ], [ %indvars.iv.next93, %50 ]
  %51 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv92
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = icmp eq i32 %39, %52
  %indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
  br i1 %53, label %50, label %54, !llvm.loop !16

54:                                               ; preds = %50
  %55 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv92
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %55) #4
  %56 = and i64 %indvars.iv92, 4294967295
  %.not50.us = icmp eq i64 %56, %indvars.iv82
  br i1 %.not50.us, label %.loopexit, label %.preheader52.us, !llvm.loop !17

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv87 = phi i64 [ %indvars.iv.next88, %scalar.ph ], [ %indvars.iv87.ph, %scalar.ph.preheader ]
  %.458.us = phi i32 [ %spec.select51.us, %scalar.ph ], [ %.458.us.ph, %scalar.ph.preheader ]
  %57 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv87
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = icmp slt i32 %58, %39
  %60 = zext i1 %59 to i32
  %spec.select51.us = add i32 %.458.us, %60
  %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
  %exitcond91.not = icmp eq i64 %indvars.iv.next88, %wide.trip.count90
  br i1 %exitcond91.not, label %..preheader_crit_edge.us, label %scalar.ph, !llvm.loop !18

..preheader_crit_edge.us:                         ; preds = %scalar.ph, %middle.block
  %spec.select51.us.lcssa = phi i32 [ %49, %middle.block ], [ %spec.select51.us, %scalar.ph ]
  %61 = zext i32 %spec.select51.us.lcssa to i64
  br label %50

.loopexit:                                        ; preds = %54, %34, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond97.not = icmp eq i64 %indvars.iv.next83, %wide.trip.count96
  br i1 %exitcond97.not, label %._crit_edge70, label %.lr.ph.preheader, !llvm.loop !19
}

; 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 nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !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 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !12, !11}
!19 = distinct !{!19, !10}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass