; LLVM IR from CodersForLife/Data-Structures-Algorithms :: Sorting (CountingSort)

; 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 [37 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.1 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1

; 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 i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %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
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  %15 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %16 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %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 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
  %23 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %34, %0
  %25 = load i32, ptr %5, align 4, !tbaa !5
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

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

29:                                               ; preds = %24
  %30 = load i32, ptr %5, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds i32, ptr %21, i64 %31
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %32)
  br label %34

34:                                               ; preds = %29
  %35 = load i32, ptr %5, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %5, align 4, !tbaa !5
  br label %24, !llvm.loop !9

37:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %38 = getelementptr inbounds i32, ptr %21, i64 0
  %39 = load i32, ptr %38, align 16, !tbaa !5
  store i32 %39, ptr %7, align 4, !tbaa !5
  store i32 %39, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %71, %37
  %41 = load i32, ptr %8, align 4, !tbaa !5
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %74

45:                                               ; preds = %40
  %46 = load i32, ptr %8, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds i32, ptr %21, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = load i32, ptr %6, align 4, !tbaa !5
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %52, label %57

52:                                               ; preds = %45
  %53 = load i32, ptr %8, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i32, ptr %21, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  store i32 %56, ptr %6, align 4, !tbaa !5
  br label %70

57:                                               ; preds = %45
  %58 = load i32, ptr %8, 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 = load i32, ptr %7, align 4, !tbaa !5
  %63 = icmp sgt i32 %61, %62
  br i1 %63, label %64, label %69

64:                                               ; preds = %57
  %65 = load i32, ptr %8, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds i32, ptr %21, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  store i32 %68, ptr %7, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %64, %57
  br label %70

70:                                               ; preds = %69, %52
  br label %71

71:                                               ; preds = %70
  %72 = load i32, ptr %8, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %8, align 4, !tbaa !5
  br label %40, !llvm.loop !11

74:                                               ; preds = %44
  %75 = load i32, ptr %7, align 4, !tbaa !5
  %76 = load i32, ptr %6, align 4, !tbaa !5
  %77 = sub nsw i32 %75, %76
  %78 = add nsw i32 %77, 1
  %79 = zext i32 %78 to i64
  %80 = alloca i32, i64 %79, align 16
  store i64 %79, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %81 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %81, ptr %10, align 4, !tbaa !5
  br label %82

82:                                               ; preds = %91, %74
  %83 = load i32, ptr %10, align 4, !tbaa !5
  %84 = load i32, ptr %7, align 4, !tbaa !5
  %85 = icmp sle i32 %83, %84
  br i1 %85, label %87, label %86

86:                                               ; preds = %82
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %94

87:                                               ; preds = %82
  %88 = load i32, ptr %10, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds i32, ptr %80, i64 %89
  store i32 0, ptr %90, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %87
  %92 = load i32, ptr %10, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %10, align 4, !tbaa !5
  br label %82, !llvm.loop !12

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

95:                                               ; preds = %111, %94
  %96 = load i32, ptr %11, align 4, !tbaa !5
  %97 = load i32, ptr %2, align 4, !tbaa !5
  %98 = icmp slt i32 %96, %97
  br i1 %98, label %100, label %99

99:                                               ; preds = %95
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %114

100:                                              ; preds = %95
  %101 = load i32, ptr %11, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds i32, ptr %21, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = load i32, ptr %6, align 4, !tbaa !5
  %106 = sub nsw i32 %104, %105
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds i32, ptr %80, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %108, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %100
  %112 = load i32, ptr %11, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %11, align 4, !tbaa !5
  br label %95, !llvm.loop !13

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

118:                                              ; preds = %140, %114
  %119 = load i32, ptr %12, align 4, !tbaa !5
  %120 = load i32, ptr %7, align 4, !tbaa !5
  %121 = icmp sle i32 %119, %120
  br i1 %121, label %123, label %122

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

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

124:                                              ; preds = %136, %123
  %125 = load i32, ptr %14, align 4, !tbaa !5
  %126 = load i32, ptr %12, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds i32, ptr %80, 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 %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %139

132:                                              ; preds = %124
  %133 = load i32, ptr %12, align 4, !tbaa !5
  %134 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %133)
  %135 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %134, ptr noundef @.str.3)
  br label %136

136:                                              ; preds = %132
  %137 = load i32, ptr %14, align 4, !tbaa !5
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %14, align 4, !tbaa !5
  br label %124, !llvm.loop !14

139:                                              ; preds = %131
  br label %140

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

143:                                              ; preds = %122
  %144 = 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_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %145 = load ptr, ptr %3, align 8
  call void @llvm.stackrestore.p0(ptr %145)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %146 = load i32, ptr %1, align 4
  ret i32 %146
}

; 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

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

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

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

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

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

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 = { 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 #4 = { "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 = { nocallback nofree nosync nounwind willreturn }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


; 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 [37 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.1 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca [0 x i32], align 16
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  %3 = 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)
  %4 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %5 = 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)
  %6 = load i32, ptr %2, align 4, !tbaa !5
  %7 = zext i32 %6 to i64
  %8 = call ptr @llvm.stacksave.p0()
  %9 = alloca i32, i64 %7, align 16
  %10 = 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.1)
  %11 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph, label %._crit_edge58

._crit_edge:                                      ; preds = %.lr.ph
  %.pre = load i32, ptr %9, align 16, !tbaa !5
  %14 = icmp sgt i32 %22, 0
  br i1 %14, label %.lr.ph48.preheader, label %.lr.ph55.preheader.thread

.lr.ph55.preheader.thread:                        ; preds = %._crit_edge
  %15 = alloca i32, align 16
  %16 = sext i32 %.pre to i64
  %17 = shl nsw i64 %16, 2
  %scevgep121 = getelementptr i8, ptr %15, i64 %17
  store i32 0, ptr %scevgep121, align 4
  br label %._crit_edge58

.lr.ph48.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %22 to i64
  %18 = add nsw i64 %wide.trip.count, -1
  %xtraiter = and i64 %wide.trip.count, 1
  %19 = icmp eq i64 %18, 0
  br i1 %19, label %._crit_edge49.unr-lcssa, label %.lr.ph48.preheader.new

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

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %20 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %20)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = icmp slt i64 %indvars.iv.next, %23
  br i1 %24, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge49.unr-lcssa:                          ; preds = %.lr.ph48, %.lr.ph48.preheader
  %.137.lcssa.ph = phi i32 [ poison, %.lr.ph48.preheader ], [ %.137.1, %.lr.ph48 ]
  %.1.lcssa.ph = phi i32 [ poison, %.lr.ph48.preheader ], [ %.1.1, %.lr.ph48 ]
  %indvars.iv67.unr = phi i64 [ 0, %.lr.ph48.preheader ], [ %indvars.iv.next68.1, %.lr.ph48 ]
  %.03545.unr = phi i32 [ %.pre, %.lr.ph48.preheader ], [ %.1.1, %.lr.ph48 ]
  %.03644.unr = phi i32 [ %.pre, %.lr.ph48.preheader ], [ %.137.1, %.lr.ph48 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge49, label %.lr.ph48.epil

.lr.ph48.epil:                                    ; preds = %._crit_edge49.unr-lcssa
  %25 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv67.unr
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = icmp slt i32 %26, %.03644.unr
  %spec.select.epil = call i32 @llvm.smax.i32(i32 %26, i32 %.03545.unr)
  %.137.epil = call i32 @llvm.smin.i32(i32 %26, i32 %.03644.unr)
  %.1.epil = select i1 %27, i32 %.03545.unr, i32 %spec.select.epil
  br label %._crit_edge49

._crit_edge49:                                    ; preds = %._crit_edge49.unr-lcssa, %.lr.ph48.epil
  %.137.lcssa = phi i32 [ %.137.lcssa.ph, %._crit_edge49.unr-lcssa ], [ %.137.epil, %.lr.ph48.epil ]
  %.1.lcssa = phi i32 [ %.1.lcssa.ph, %._crit_edge49.unr-lcssa ], [ %.1.epil, %.lr.ph48.epil ]
  %reass.sub = sub i32 %.1.lcssa, %.137.lcssa
  %28 = add i32 %reass.sub, 1
  %29 = zext i32 %28 to i64
  %30 = alloca i32, i64 %29, align 16
  %.not52 = icmp sgt i32 %.137.lcssa, %.1.lcssa
  br i1 %.not52, label %.preheader42, label %.lr.ph55.preheader

.lr.ph55.preheader:                               ; preds = %._crit_edge49
  %31 = sext i32 %.137.lcssa to i64
  %32 = shl nsw i64 %31, 2
  %scevgep = getelementptr i8, ptr %30, i64 %32
  %33 = zext i32 %reass.sub to i64
  %34 = shl nuw nsw i64 %33, 2
  %35 = add nuw nsw i64 %34, 4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i8 0, i64 %35, i1 false), !tbaa !5
  br i1 %14, label %.lr.ph57.preheader, label %._crit_edge58

.lr.ph48:                                         ; preds = %.lr.ph48, %.lr.ph48.preheader.new
  %indvars.iv67 = phi i64 [ 0, %.lr.ph48.preheader.new ], [ %indvars.iv.next68.1, %.lr.ph48 ]
  %.03545 = phi i32 [ %.pre, %.lr.ph48.preheader.new ], [ %.1.1, %.lr.ph48 ]
  %.03644 = phi i32 [ %.pre, %.lr.ph48.preheader.new ], [ %.137.1, %.lr.ph48 ]
  %niter = phi i64 [ 0, %.lr.ph48.preheader.new ], [ %niter.next.1, %.lr.ph48 ]
  %36 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv67
  %37 = load i32, ptr %36, align 8, !tbaa !5
  %38 = icmp slt i32 %37, %.03644
  %spec.select = call i32 @llvm.smax.i32(i32 %37, i32 %.03545)
  %.137 = call i32 @llvm.smin.i32(i32 %37, i32 %.03644)
  %.1 = select i1 %38, i32 %.03545, i32 %spec.select
  %indvars.iv.next68 = or disjoint i64 %indvars.iv67, 1
  %39 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv.next68
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = icmp slt i32 %40, %.137
  %spec.select.1 = call i32 @llvm.smax.i32(i32 %40, i32 %.1)
  %.137.1 = call i32 @llvm.smin.i32(i32 %40, i32 %.137)
  %.1.1 = select i1 %41, i32 %.1, i32 %spec.select.1
  %indvars.iv.next68.1 = add nuw nsw i64 %indvars.iv67, 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 %._crit_edge49.unr-lcssa, label %.lr.ph48, !llvm.loop !11

.preheader42:                                     ; preds = %._crit_edge49
  br i1 %14, label %.lr.ph57.preheader, label %._crit_edge58

.lr.ph57.preheader:                               ; preds = %.lr.ph55.preheader, %.preheader42
  %xtraiter124 = and i64 %wide.trip.count, 1
  %42 = icmp eq i64 %18, 0
  br i1 %42, label %._crit_edge58.loopexit.unr-lcssa, label %.lr.ph57.preheader.new

.lr.ph57.preheader.new:                           ; preds = %.lr.ph57.preheader
  %unroll_iter126 = and i64 %wide.trip.count, 2147483646
  br label %.lr.ph57

._crit_edge58.loopexit.unr-lcssa:                 ; preds = %.lr.ph57, %.lr.ph57.preheader
  %indvars.iv73.unr = phi i64 [ 0, %.lr.ph57.preheader ], [ %indvars.iv.next74.1, %.lr.ph57 ]
  %lcmp.mod125.not = icmp eq i64 %xtraiter124, 0
  br i1 %lcmp.mod125.not, label %._crit_edge58, label %.lr.ph57.epil

.lr.ph57.epil:                                    ; preds = %._crit_edge58.loopexit.unr-lcssa
  %43 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv73.unr
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = sub nsw i32 %44, %.137.lcssa
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds i32, ptr %30, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %47, align 4, !tbaa !5
  br label %._crit_edge58

._crit_edge58:                                    ; preds = %.lr.ph57.epil, %._crit_edge58.loopexit.unr-lcssa, %0, %.lr.ph55.preheader.thread, %.lr.ph55.preheader, %.preheader42
  %.036.lcssa93111 = phi i32 [ %.137.lcssa, %.preheader42 ], [ %.137.lcssa, %.lr.ph55.preheader ], [ %.pre, %.lr.ph55.preheader.thread ], [ undef, %0 ], [ %.137.lcssa, %._crit_edge58.loopexit.unr-lcssa ], [ %.137.lcssa, %.lr.ph57.epil ]
  %.035.lcssa95110 = phi i32 [ %.1.lcssa, %.preheader42 ], [ %.1.lcssa, %.lr.ph55.preheader ], [ %.pre, %.lr.ph55.preheader.thread ], [ undef, %0 ], [ %.1.lcssa, %._crit_edge58.loopexit.unr-lcssa ], [ %.1.lcssa, %.lr.ph57.epil ]
  %50 = phi ptr [ %30, %.preheader42 ], [ %30, %.lr.ph55.preheader ], [ %15, %.lr.ph55.preheader.thread ], [ %1, %0 ], [ %30, %._crit_edge58.loopexit.unr-lcssa ], [ %30, %.lr.ph57.epil ]
  %.not5298109 = phi i1 [ true, %.preheader42 ], [ false, %.lr.ph55.preheader ], [ false, %.lr.ph55.preheader.thread ], [ undef, %0 ], [ %.not52, %._crit_edge58.loopexit.unr-lcssa ], [ %.not52, %.lr.ph57.epil ]
  %51 = 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.2)
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %51, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br i1 %.not5298109, label %._crit_edge64, label %.preheader.preheader

.preheader.preheader:                             ; preds = %._crit_edge58
  %53 = sext i32 %.036.lcssa93111 to i64
  %54 = add i32 %.035.lcssa95110, 1
  br label %.preheader

.lr.ph57:                                         ; preds = %.lr.ph57, %.lr.ph57.preheader.new
  %indvars.iv73 = phi i64 [ 0, %.lr.ph57.preheader.new ], [ %indvars.iv.next74.1, %.lr.ph57 ]
  %niter127 = phi i64 [ 0, %.lr.ph57.preheader.new ], [ %niter127.next.1, %.lr.ph57 ]
  %55 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv73
  %56 = load i32, ptr %55, align 8, !tbaa !5
  %57 = sub nsw i32 %56, %.137.lcssa
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds i32, ptr %30, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %59, align 4, !tbaa !5
  %indvars.iv.next74 = or disjoint i64 %indvars.iv73, 1
  %62 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv.next74
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = sub nsw i32 %63, %.137.lcssa
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds i32, ptr %30, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %66, align 4, !tbaa !5
  %indvars.iv.next74.1 = add nuw nsw i64 %indvars.iv73, 2
  %niter127.next.1 = add i64 %niter127, 2
  %niter127.ncmp.1 = icmp eq i64 %niter127.next.1, %unroll_iter126
  br i1 %niter127.ncmp.1, label %._crit_edge58.loopexit.unr-lcssa, label %.lr.ph57, !llvm.loop !12

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge61
  %indvars.iv79 = phi i64 [ %53, %.preheader.preheader ], [ %indvars.iv.next80, %._crit_edge61 ]
  %69 = getelementptr inbounds i32, ptr %50, i64 %indvars.iv79
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = icmp sgt i32 %70, 0
  br i1 %71, label %.lr.ph60.preheader, label %._crit_edge61

.lr.ph60.preheader:                               ; preds = %.preheader
  %72 = trunc nsw i64 %indvars.iv79 to i32
  br label %.lr.ph60

._crit_edge64:                                    ; preds = %._crit_edge61, %._crit_edge58
  %73 = 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_)
  call void @llvm.stackrestore.p0(ptr %8)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  ret i32 0

._crit_edge61:                                    ; preds = %.lr.ph60, %.preheader
  %indvars.iv.next80 = add nsw i64 %indvars.iv79, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next80 to i32
  %exitcond82.not = icmp eq i32 %54, %lftr.wideiv
  br i1 %exitcond82.not, label %._crit_edge64, label %.preheader, !llvm.loop !13

.lr.ph60:                                         ; preds = %.lr.ph60.preheader, %.lr.ph60
  %.059 = phi i32 [ %76, %.lr.ph60 ], [ 0, %.lr.ph60.preheader ]
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %72)
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %74, ptr noundef nonnull @.str.3)
  %76 = add nuw nsw i32 %.059, 1
  %exitcond78.not = icmp eq i32 %76, %70
  br i1 %exitcond78.not, label %._crit_edge61, label %.lr.ph60, !llvm.loop !14
}

; 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

; 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 #3 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(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

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

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

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

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

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

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

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

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 = { 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 #4 = { "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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


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