; LLVM IR from ravireddy07/cpp-book :: src/Searching-and-Sorting (SortingAccordingToTheirOccurances)

; 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 }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [30 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i8, align 1
  %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
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  %16 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = zext i32 %18 to i64
  %20 = call ptr @llvm.stacksave.p0()
  store ptr %20, ptr %3, align 8
  %21 = alloca i32, i64 %19, align 16
  store i64 %19, ptr %4, align 8
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = zext i32 %22 to i64
  %24 = alloca i32, i64 %23, align 16
  store i64 %23, ptr %5, align 8
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = zext i32 %25 to i64
  %27 = alloca i32, i64 %26, align 16
  store i64 %26, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #6
  store i8 0, ptr %8, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %38, %0
  %29 = load i32, ptr %9, align 4, !tbaa !5
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %41

33:                                               ; preds = %28
  %34 = load i32, ptr %9, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds i32, ptr %21, i64 %35
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %36)
  br label %38

38:                                               ; preds = %33
  %39 = load i32, ptr %9, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %9, align 4, !tbaa !5
  br label %28, !llvm.loop !11

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

42:                                               ; preds = %112, %41
  %43 = load i32, ptr %10, align 4, !tbaa !5
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %47, label %46

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

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

48:                                               ; preds = %67, %47
  %49 = load i32, ptr %12, align 4, !tbaa !5
  %50 = load i32, ptr %2, align 4, !tbaa !5
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %53, label %52

52:                                               ; preds = %48
  store i32 8, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %70

53:                                               ; preds = %48
  %54 = load i32, ptr %10, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i32, ptr %21, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = load i32, ptr %12, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds i32, ptr %21, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = icmp eq i32 %57, %61
  br i1 %62, label %63, label %66

63:                                               ; preds = %53
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %7, align 4, !tbaa !5
  br label %66

66:                                               ; preds = %63, %53
  br label %67

67:                                               ; preds = %66
  %68 = load i32, ptr %12, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %12, align 4, !tbaa !5
  br label %48, !llvm.loop !13

70:                                               ; preds = %52
  %71 = load i32, ptr %10, align 4, !tbaa !5
  %72 = icmp sgt i32 %71, 1
  br i1 %72, label %73, label %96

73:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %74 = load i32, ptr %10, align 4, !tbaa !5
  %75 = sub nsw i32 %74, 1
  store i32 %75, ptr %13, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %92, %73
  %77 = load i32, ptr %13, align 4, !tbaa !5
  %78 = icmp sgt i32 %77, 0
  br i1 %78, label %80, label %79

79:                                               ; preds = %76
  store i32 11, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %95

80:                                               ; preds = %76
  %81 = load i32, ptr %10, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds i32, ptr %21, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = load i32, ptr %13, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds i32, ptr %21, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = icmp eq i32 %84, %88
  br i1 %89, label %90, label %91

90:                                               ; preds = %80
  store i8 1, ptr %8, align 1, !tbaa !9
  br label %91

91:                                               ; preds = %90, %80
  br label %92

92:                                               ; preds = %91
  %93 = load i32, ptr %13, align 4, !tbaa !5
  %94 = add nsw i32 %93, -1
  store i32 %94, ptr %13, align 4, !tbaa !5
  br label %76, !llvm.loop !14

95:                                               ; preds = %79
  br label %96

96:                                               ; preds = %95, %70
  %97 = load i8, ptr %8, align 1, !tbaa !9, !range !15, !noundef !16
  %98 = trunc i8 %97 to i1
  br i1 %98, label %111, label %99

99:                                               ; preds = %96
  %100 = load i32, ptr %10, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds i32, ptr %21, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = load i32, ptr %10, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds i32, ptr %24, i64 %105
  store i32 %103, ptr %106, align 4, !tbaa !5
  %107 = load i32, ptr %7, align 4, !tbaa !5
  %108 = load i32, ptr %10, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds i32, ptr %27, i64 %109
  store i32 %107, ptr %110, align 4, !tbaa !5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %99, %96
  br label %112

112:                                              ; preds = %111
  %113 = load i32, ptr %10, align 4, !tbaa !5
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %10, align 4, !tbaa !5
  br label %42, !llvm.loop !17

115:                                              ; preds = %46
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %117 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %116, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %118

118:                                              ; preds = %143, %115
  %119 = load i32, ptr %14, align 4, !tbaa !5
  %120 = load i32, ptr %2, align 4, !tbaa !5
  %121 = icmp slt i32 %119, %120
  br i1 %121, label %123, label %122

122:                                              ; preds = %118
  store i32 14, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %146

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

124:                                              ; preds = %139, %123
  %125 = load i32, ptr %15, align 4, !tbaa !5
  %126 = load i32, ptr %14, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds i32, ptr %27, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = icmp slt i32 %125, %129
  br i1 %130, label %132, label %131

131:                                              ; preds = %124
  store i32 17, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %142

132:                                              ; preds = %124
  %133 = load i32, ptr %14, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds i32, ptr %24, i64 %134
  %136 = load i32, ptr %135, align 4, !tbaa !5
  %137 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %136)
  %138 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %137, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %139

139:                                              ; preds = %132
  %140 = load i32, ptr %15, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %15, align 4, !tbaa !5
  br label %124, !llvm.loop !18

142:                                              ; preds = %131
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %14, align 4, !tbaa !5
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %14, align 4, !tbaa !5
  br label %118, !llvm.loop !19

146:                                              ; preds = %122
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  %147 = load ptr, ptr %3, align 8
  call void @llvm.stackrestore.p0(ptr %147)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %148 = load i32, ptr %1, align 4
  ret i32 %148
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.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(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5 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

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

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

attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind willreturn }
attributes #5 = { 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 #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !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 }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [30 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %2 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  %3 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %4 = load i32, ptr %1, align 4, !tbaa !5
  %5 = zext i32 %4 to i64
  %6 = call ptr @llvm.stacksave.p0()
  %7 = alloca i32, i64 %5, align 16
  %8 = load i32, ptr %1, align 4, !tbaa !5
  %9 = zext i32 %8 to i64
  %10 = alloca i32, i64 %9, align 16
  %11 = alloca i32, i64 %9, align 16
  %12 = icmp sgt i32 %8, 0
  br i1 %12, label %.lr.ph, label %._crit_edge55

.preheader41:                                     ; preds = %.lr.ph
  %13 = icmp sgt i32 %61, 0
  br i1 %13, label %.preheader40.us.preheader, label %._crit_edge55

.preheader40.us.preheader:                        ; preds = %.preheader41
  %wide.trip.count70 = zext nneg i32 %61 to i64
  %min.iters.check82 = icmp ult i32 %61, 8
  %n.vec85 = and i64 %wide.trip.count70, 2147483640
  %cmp.n97 = icmp eq i64 %n.vec85, %wide.trip.count70
  br label %.preheader40.us

.preheader40.us:                                  ; preds = %.preheader40.us.preheader, %31
  %indvars.iv66 = phi i64 [ 0, %.preheader40.us.preheader ], [ %indvars.iv.next67, %31 ]
  %.03352.us = phi i1 [ false, %.preheader40.us.preheader ], [ %.3.us, %31 ]
  %.03451.us = phi i32 [ 0, %.preheader40.us.preheader ], [ %.337.us, %31 ]
  %14 = add nsw i64 %indvars.iv66, -1
  %15 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv66
  %16 = load i32, ptr %15, align 4, !tbaa !5
  br i1 %min.iters.check82, label %scalar.ph81.preheader, label %vector.ph83

scalar.ph81.preheader:                            ; preds = %middle.block80, %.preheader40.us
  %indvars.iv63.ph = phi i64 [ 0, %.preheader40.us ], [ %n.vec85, %middle.block80 ]
  %.13543.us.ph = phi i32 [ %.03451.us, %.preheader40.us ], [ %27, %middle.block80 ]
  br label %scalar.ph81

vector.ph83:                                      ; preds = %.preheader40.us
  %17 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %.03451.us, i64 0
  %broadcast.splatinsert93 = insertelement <4 x i32> poison, i32 %16, i64 0
  %broadcast.splat94 = shufflevector <4 x i32> %broadcast.splatinsert93, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body87

vector.body87:                                    ; preds = %vector.body87, %vector.ph83
  %index88 = phi i64 [ 0, %vector.ph83 ], [ %index.next95, %vector.body87 ]
  %vec.phi89 = phi <4 x i32> [ %17, %vector.ph83 ], [ %24, %vector.body87 ]
  %vec.phi90 = phi <4 x i32> [ zeroinitializer, %vector.ph83 ], [ %25, %vector.body87 ]
  %18 = getelementptr inbounds i32, ptr %7, i64 %index88
  %19 = getelementptr inbounds i8, ptr %18, i64 16
  %wide.load91 = load <4 x i32>, ptr %18, align 16, !tbaa !5
  %wide.load92 = load <4 x i32>, ptr %19, align 16, !tbaa !5
  %20 = icmp eq <4 x i32> %broadcast.splat94, %wide.load91
  %21 = icmp eq <4 x i32> %broadcast.splat94, %wide.load92
  %22 = zext <4 x i1> %20 to <4 x i32>
  %23 = zext <4 x i1> %21 to <4 x i32>
  %24 = add <4 x i32> %vec.phi89, %22
  %25 = add <4 x i32> %vec.phi90, %23
  %index.next95 = add nuw i64 %index88, 8
  %26 = icmp eq i64 %index.next95, %n.vec85
  br i1 %26, label %middle.block80, label %vector.body87, !llvm.loop !9

middle.block80:                                   ; preds = %vector.body87
  %bin.rdx96 = add <4 x i32> %25, %24
  %27 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx96)
  br i1 %cmp.n97, label %._crit_edge.us, label %scalar.ph81.preheader

.loopexit.us:                                     ; preds = %.lr.ph49.us, %middle.block, %._crit_edge.us
  %.3.us = phi i1 [ %.03352.us, %._crit_edge.us ], [ %rdx.select, %middle.block ], [ %spec.select38.us, %.lr.ph49.us ]
  br i1 %.3.us, label %31, label %28

28:                                               ; preds = %.loopexit.us
  %29 = getelementptr inbounds i32, ptr %10, i64 %indvars.iv66
  store i32 %16, ptr %29, align 4, !tbaa !5
  %30 = getelementptr inbounds i32, ptr %11, i64 %indvars.iv66
  store i32 %spec.select.us.lcssa, ptr %30, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %28, %.loopexit.us
  %.337.us = phi i32 [ %spec.select.us.lcssa, %.loopexit.us ], [ 0, %28 ]
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %exitcond71.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count70
  br i1 %exitcond71.not, label %._crit_edge55, label %.preheader40.us, !llvm.loop !13

.lr.ph49.us:                                      ; preds = %.lr.ph49.us.preheader99, %.lr.ph49.us
  %indvars.iv68 = phi i64 [ %indvars.iv.next69, %.lr.ph49.us ], [ %indvars.iv68.ph, %.lr.ph49.us.preheader99 ]
  %.147.us = phi i1 [ %spec.select38.us, %.lr.ph49.us ], [ %.147.us.ph, %.lr.ph49.us.preheader99 ]
  %.029.us = add i64 %indvars.iv68, 4294967295
  %32 = and i64 %.029.us, 4294967295
  %33 = getelementptr inbounds i32, ptr %7, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = icmp eq i32 %16, %34
  %spec.select38.us = select i1 %35, i1 true, i1 %.147.us
  %36 = icmp sgt i64 %indvars.iv68, 2
  %indvars.iv.next69 = add nsw i64 %indvars.iv68, -1
  br i1 %36, label %.lr.ph49.us, label %.loopexit.us, !llvm.loop !14

scalar.ph81:                                      ; preds = %scalar.ph81.preheader, %scalar.ph81
  %indvars.iv63 = phi i64 [ %indvars.iv.next64, %scalar.ph81 ], [ %indvars.iv63.ph, %scalar.ph81.preheader ]
  %.13543.us = phi i32 [ %spec.select.us, %scalar.ph81 ], [ %.13543.us.ph, %scalar.ph81.preheader ]
  %37 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv63
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = icmp eq i32 %16, %38
  %40 = zext i1 %39 to i32
  %spec.select.us = add nsw i32 %.13543.us, %40
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next64, %wide.trip.count70
  br i1 %exitcond.not, label %._crit_edge.us, label %scalar.ph81, !llvm.loop !15

._crit_edge.us:                                   ; preds = %scalar.ph81, %middle.block80
  %spec.select.us.lcssa = phi i32 [ %27, %middle.block80 ], [ %spec.select.us, %scalar.ph81 ]
  %41 = icmp ugt i64 %indvars.iv66, 1
  br i1 %41, label %.lr.ph49.us.preheader, label %.loopexit.us

.lr.ph49.us.preheader:                            ; preds = %._crit_edge.us
  %min.iters.check = icmp ult i64 %indvars.iv66, 13
  br i1 %min.iters.check, label %.lr.ph49.us.preheader99, label %vector.scevcheck

.lr.ph49.us.preheader99:                          ; preds = %middle.block, %vector.scevcheck, %.lr.ph49.us.preheader
  %indvars.iv68.ph = phi i64 [ %indvars.iv66, %vector.scevcheck ], [ %indvars.iv66, %.lr.ph49.us.preheader ], [ %ind.end, %middle.block ]
  %.147.us.ph = phi i1 [ %.03352.us, %vector.scevcheck ], [ %.03352.us, %.lr.ph49.us.preheader ], [ %rdx.select, %middle.block ]
  br label %.lr.ph49.us

vector.scevcheck:                                 ; preds = %.lr.ph49.us.preheader
  %42 = and i64 %indvars.iv66, 4294967295
  %43 = icmp eq i64 %42, 1
  %44 = add nsw i64 %indvars.iv66, -4294967298
  %45 = icmp ult i64 %44, -4294967296
  %46 = or i1 %43, %45
  br i1 %46, label %.lr.ph49.us.preheader99, label %vector.ph

vector.ph:                                        ; preds = %vector.scevcheck
  %n.vec = and i64 %14, -8
  %ind.end = sub i64 %indvars.iv66, %n.vec
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %16, 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 i1> [ zeroinitializer, %vector.ph ], [ %54, %vector.body ]
  %vec.phi77 = phi <4 x i1> [ zeroinitializer, %vector.ph ], [ %55, %vector.body ]
  %offset.idx = sub i64 %indvars.iv66, %index
  %47 = add i64 %offset.idx, 4294967295
  %48 = and i64 %47, 4294967295
  %49 = getelementptr inbounds i32, ptr %7, i64 %48
  %50 = getelementptr inbounds i8, ptr %49, i64 -12
  %51 = getelementptr inbounds i8, ptr %49, i64 -28
  %wide.load = load <4 x i32>, ptr %50, align 4, !tbaa !5
  %reverse = shufflevector <4 x i32> %wide.load, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  %wide.load78 = load <4 x i32>, ptr %51, align 4, !tbaa !5
  %reverse79 = shufflevector <4 x i32> %wide.load78, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  %52 = icmp eq <4 x i32> %broadcast.splat, %reverse
  %53 = icmp eq <4 x i32> %broadcast.splat, %reverse79
  %54 = or <4 x i1> %vec.phi, %52
  %55 = or <4 x i1> %vec.phi77, %53
  %index.next = add nuw i64 %index, 8
  %56 = icmp eq i64 %index.next, %n.vec
  br i1 %56, label %middle.block, label %vector.body, !llvm.loop !16

middle.block:                                     ; preds = %vector.body
  %bin.rdx = or <4 x i1> %55, %54
  %bin.rdx.fr = freeze <4 x i1> %bin.rdx
  %57 = bitcast <4 x i1> %bin.rdx.fr to i4
  %58 = icmp ne i4 %57, 0
  %rdx.select = or i1 %58, %.03352.us
  %cmp.n = icmp eq i64 %14, %n.vec
  br i1 %cmp.n, label %.loopexit.us, label %.lr.ph49.us.preheader99

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %59 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %59)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %61 = load i32, ptr %1, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = icmp slt i64 %indvars.iv.next, %62
  br i1 %63, label %.lr.ph, label %.preheader41, !llvm.loop !17

._crit_edge55:                                    ; preds = %31, %0, %.preheader41
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %64, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %66 = load i32, ptr %1, align 4, !tbaa !5
  %67 = icmp sgt i32 %66, 0
  br i1 %67, label %.preheader, label %._crit_edge59

.preheader:                                       ; preds = %._crit_edge55, %._crit_edge
  %68 = phi i32 [ %74, %._crit_edge ], [ %66, %._crit_edge55 ]
  %indvars.iv73 = phi i64 [ %indvars.iv.next74, %._crit_edge ], [ 0, %._crit_edge55 ]
  %69 = getelementptr inbounds i32, ptr %11, i64 %indvars.iv73
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = icmp sgt i32 %70, 0
  br i1 %71, label %.lr.ph57, label %._crit_edge

.lr.ph57:                                         ; preds = %.preheader
  %72 = getelementptr inbounds i32, ptr %10, i64 %indvars.iv73
  %73 = load i32, ptr %72, align 4, !tbaa !5
  br label %77

._crit_edge59:                                    ; preds = %._crit_edge, %._crit_edge55
  call void @llvm.stackrestore.p0(ptr %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0

._crit_edge.loopexit:                             ; preds = %77
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %74 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %68, %.preheader ]
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %75 = sext i32 %74 to i64
  %76 = icmp slt i64 %indvars.iv.next74, %75
  br i1 %76, label %.preheader, label %._crit_edge59, !llvm.loop !18

77:                                               ; preds = %.lr.ph57, %77
  %.056 = phi i32 [ 0, %.lr.ph57 ], [ %80, %77 ]
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %73)
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %78, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %80 = add nuw nsw i32 %.056, 1
  %exitcond72.not = icmp eq i32 %80, %70
  br i1 %exitcond72.not, label %._crit_edge.loopexit, label %77, !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: 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(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

; 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 uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5 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

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 nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

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

attributes #0 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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, !11}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !10, !11, !12}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}


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