; LLVM IR from Leet-Us-Code/DSA-A-Z-Practice :: Sid's Levels/Level - 1/DynamicProgramming (BestTimeToBuyAndSellKTransOpt)

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

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", 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 [100000 x i32], align 16
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %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
  %16 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  %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)
  call void @llvm.lifetime.start.p0(i64 400000, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %28, %0
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = icmp slt i32 %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %31

23:                                               ; preds = %18
  %24 = load i32, ptr %4, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [100000 x i32], ptr %3, i64 0, i64 %25
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %26)
  br label %28

28:                                               ; preds = %23
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %4, align 4, !tbaa !5
  br label %18, !llvm.loop !9

31:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  %35 = zext i32 %34 to i64
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = zext i32 %36 to i64
  %38 = call ptr @llvm.stacksave.p0()
  store ptr %38, ptr %6, align 8
  %39 = mul nuw i64 %35, %37
  %40 = alloca i32, i64 %39, align 16
  store i64 %35, ptr %7, align 8
  store i64 %37, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %65, %31
  %42 = load i32, ptr %9, align 4, !tbaa !5
  %43 = load i32, ptr %5, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  %45 = icmp slt i32 %42, %44
  br i1 %45, label %47, label %46

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

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

48:                                               ; preds = %61, %47
  %49 = load i32, ptr %11, 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 %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %64

53:                                               ; preds = %48
  %54 = load i32, ptr %9, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = mul nsw i64 %55, %37
  %57 = getelementptr inbounds i32, ptr %40, i64 %56
  %58 = load i32, ptr %11, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds i32, ptr %57, i64 %59
  store i32 0, ptr %60, align 4, !tbaa !5
  br label %61

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

64:                                               ; preds = %52
  br label %65

65:                                               ; preds = %64
  %66 = load i32, ptr %9, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %9, align 4, !tbaa !5
  br label %41, !llvm.loop !12

68:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %127, %68
  %70 = load i32, ptr %12, align 4, !tbaa !5
  %71 = load i32, ptr %5, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  %73 = icmp slt i32 %70, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %69
  store i32 11, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %130

75:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 -2147483648, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 1, ptr %14, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %123, %75
  %77 = load i32, ptr %14, align 4, !tbaa !5
  %78 = load i32, ptr %2, align 4, !tbaa !5
  %79 = icmp slt i32 %77, %78
  br i1 %79, label %81, label %80

80:                                               ; preds = %76
  store i32 14, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %126

81:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %82 = load i32, ptr %12, align 4, !tbaa !5
  %83 = sub nsw i32 %82, 1
  %84 = sext i32 %83 to i64
  %85 = mul nsw i64 %84, %37
  %86 = getelementptr inbounds i32, ptr %40, i64 %85
  %87 = load i32, ptr %14, align 4, !tbaa !5
  %88 = sub nsw i32 %87, 1
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds i32, ptr %86, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = load i32, ptr %14, align 4, !tbaa !5
  %93 = sub nsw i32 %92, 1
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [100000 x i32], ptr %3, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = sub nsw i32 %91, %96
  store i32 %97, ptr %15, align 4, !tbaa !5
  %98 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %99 = load i32, ptr %98, align 4, !tbaa !5
  store i32 %99, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  %100 = load i32, ptr %12, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = mul nsw i64 %101, %37
  %103 = getelementptr inbounds i32, ptr %40, i64 %102
  %104 = load i32, ptr %14, align 4, !tbaa !5
  %105 = sub nsw i32 %104, 1
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds i32, ptr %103, i64 %106
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %108 = load i32, ptr %13, align 4, !tbaa !5
  %109 = load i32, ptr %14, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [100000 x i32], ptr %3, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = add nsw i32 %108, %112
  store i32 %113, ptr %16, align 4, !tbaa !5
  %114 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %107, ptr noundef nonnull align 4 dereferenceable(4) %16)
  %115 = load i32, ptr %114, align 4, !tbaa !5
  %116 = load i32, ptr %12, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = mul nsw i64 %117, %37
  %119 = getelementptr inbounds i32, ptr %40, i64 %118
  %120 = load i32, ptr %14, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds i32, ptr %119, i64 %121
  store i32 %115, ptr %122, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %123

123:                                              ; preds = %81
  %124 = load i32, ptr %14, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %14, align 4, !tbaa !5
  br label %76, !llvm.loop !13

126:                                              ; preds = %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %127

127:                                              ; preds = %126
  %128 = load i32, ptr %12, align 4, !tbaa !5
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %12, align 4, !tbaa !5
  br label %69, !llvm.loop !14

130:                                              ; preds = %74
  %131 = load i32, ptr %5, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = mul nsw i64 %132, %37
  %134 = getelementptr inbounds i32, ptr %40, i64 %133
  %135 = load i32, ptr %2, align 4, !tbaa !5
  %136 = sub nsw i32 %135, 1
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds i32, ptr %134, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %139)
  %141 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %140, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %142 = load ptr, ptr %6, align 8
  call void @llvm.stackrestore.p0(ptr %142)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 400000, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %143 = load i32, ptr %1, align 4
  ret i32 %143
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 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) #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)) #6

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

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 = { "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 willreturn }
attributes #4 = { 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 #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 = { 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 #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}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !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_istream" = type { ptr, i64, %"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_ostream" = type { ptr, %"class.std::basic_ios" }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %11 = load i32, ptr %3, align 4, !tbaa !5
  %12 = add nsw i32 %11, 1
  %13 = zext i32 %12 to i64
  %14 = load i32, ptr %1, align 4, !tbaa !5
  %15 = zext i32 %14 to i64
  %16 = call ptr @llvm.stacksave.p0()
  %17 = mul nuw i64 %13, %15
  %18 = alloca i32, i64 %17, align 16
  %19 = load i32, ptr %3, align 4, !tbaa !5
  %.not32 = icmp slt i32 %19, 0
  %.pre57.pre = load i32, ptr %1, align 4, !tbaa !5
  br i1 %.not32, label %._crit_edge41, label %.preheader27.lr.ph

.preheader27.lr.ph:                               ; preds = %._crit_edge
  %20 = icmp sgt i32 %.pre57.pre, 0
  br i1 %20, label %.preheader27.us.preheader, label %.preheader

.preheader27.us.preheader:                        ; preds = %.preheader27.lr.ph
  %21 = shl nuw nsw i64 %15, 2
  %22 = zext nneg i32 %.pre57.pre to i64
  %23 = shl nuw nsw i64 %22, 2
  %24 = add nuw i32 %19, 1
  %wide.trip.count = zext i32 %24 to i64
  %xtraiter = and i64 %wide.trip.count, 7
  %25 = icmp ult i32 %19, 7
  br i1 %25, label %.preheader.loopexit.unr-lcssa, label %.preheader27.us.preheader.new

.preheader27.us.preheader.new:                    ; preds = %.preheader27.us.preheader
  %unroll_iter = and i64 %wide.trip.count, 4294967288
  br label %.preheader27.us

.preheader27.us:                                  ; preds = %.preheader27.us, %.preheader27.us.preheader.new
  %indvar = phi i64 [ 0, %.preheader27.us.preheader.new ], [ %indvar.next.7, %.preheader27.us ]
  %niter = phi i64 [ 0, %.preheader27.us.preheader.new ], [ %niter.next.7, %.preheader27.us ]
  %26 = mul nuw nsw i64 %21, %indvar
  %scevgep = getelementptr i8, ptr %18, i64 %26
  call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %23, i1 false), !tbaa !5
  %indvar.next = or disjoint i64 %indvar, 1
  %27 = mul nuw nsw i64 %21, %indvar.next
  %scevgep.1 = getelementptr i8, ptr %18, i64 %27
  call void @llvm.memset.p0.i64(ptr align 4 %scevgep.1, i8 0, i64 %23, i1 false), !tbaa !5
  %indvar.next.1 = or disjoint i64 %indvar, 2
  %28 = mul nuw nsw i64 %21, %indvar.next.1
  %scevgep.2 = getelementptr i8, ptr %18, i64 %28
  call void @llvm.memset.p0.i64(ptr align 8 %scevgep.2, i8 0, i64 %23, i1 false), !tbaa !5
  %indvar.next.2 = or disjoint i64 %indvar, 3
  %29 = mul nuw nsw i64 %21, %indvar.next.2
  %scevgep.3 = getelementptr i8, ptr %18, i64 %29
  call void @llvm.memset.p0.i64(ptr align 4 %scevgep.3, i8 0, i64 %23, i1 false), !tbaa !5
  %indvar.next.3 = or disjoint i64 %indvar, 4
  %30 = mul nuw nsw i64 %21, %indvar.next.3
  %scevgep.4 = getelementptr i8, ptr %18, i64 %30
  call void @llvm.memset.p0.i64(ptr align 16 %scevgep.4, i8 0, i64 %23, i1 false), !tbaa !5
  %indvar.next.4 = or disjoint i64 %indvar, 5
  %31 = mul nuw nsw i64 %21, %indvar.next.4
  %scevgep.5 = getelementptr i8, ptr %18, i64 %31
  call void @llvm.memset.p0.i64(ptr align 4 %scevgep.5, i8 0, i64 %23, i1 false), !tbaa !5
  %indvar.next.5 = or disjoint i64 %indvar, 6
  %32 = mul nuw nsw i64 %21, %indvar.next.5
  %scevgep.6 = getelementptr i8, ptr %18, i64 %32
  call void @llvm.memset.p0.i64(ptr align 8 %scevgep.6, i8 0, i64 %23, i1 false), !tbaa !5
  %indvar.next.6 = or disjoint i64 %indvar, 7
  %33 = mul nuw nsw i64 %21, %indvar.next.6
  %scevgep.7 = getelementptr i8, ptr %18, i64 %33
  call void @llvm.memset.p0.i64(ptr align 4 %scevgep.7, i8 0, i64 %23, i1 false), !tbaa !5
  %indvar.next.7 = add nuw nsw i64 %indvar, 8
  %niter.next.7 = add i64 %niter, 8
  %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %.preheader.loopexit.unr-lcssa, label %.preheader27.us, !llvm.loop !9

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %34 = getelementptr inbounds [100000 x i32], ptr %2, i64 0, i64 %indvars.iv
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %34)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %36 = load i32, ptr %1, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = icmp slt i64 %indvars.iv.next, %37
  br i1 %38, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader.loopexit.unr-lcssa:                    ; preds = %.preheader27.us, %.preheader27.us.preheader
  %indvar.unr = phi i64 [ 0, %.preheader27.us.preheader ], [ %indvar.next.7, %.preheader27.us ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.preheader27.us.epil

.preheader27.us.epil:                             ; preds = %.preheader.loopexit.unr-lcssa, %.preheader27.us.epil
  %indvar.epil = phi i64 [ %indvar.next.epil, %.preheader27.us.epil ], [ %indvar.unr, %.preheader.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.preheader27.us.epil ], [ 0, %.preheader.loopexit.unr-lcssa ]
  %39 = mul nuw nsw i64 %21, %indvar.epil
  %scevgep.epil = getelementptr i8, ptr %18, i64 %39
  call void @llvm.memset.p0.i64(ptr align 4 %scevgep.epil, i8 0, i64 %23, i1 false), !tbaa !5
  %indvar.next.epil = add nuw nsw i64 %indvar.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader, label %.preheader27.us.epil, !llvm.loop !12

.preheader:                                       ; preds = %.preheader.loopexit.unr-lcssa, %.preheader27.us.epil, %.preheader27.lr.ph
  %.not2638 = icmp ne i32 %19, 0
  %40 = icmp sgt i32 %.pre57.pre, 1
  %or.cond = select i1 %.not2638, i1 %40, i1 false
  br i1 %or.cond, label %.lr.ph40.split, label %._crit_edge41

._crit_edge41:                                    ; preds = %._crit_edge37, %._crit_edge, %.preheader
  %41 = phi i32 [ %.pre57.pre, %.preheader ], [ %.pre57.pre, %._crit_edge ], [ %60, %._crit_edge37 ]
  %.lcssa = phi i32 [ %19, %.preheader ], [ %19, %._crit_edge ], [ %59, %._crit_edge37 ]
  %42 = sext i32 %.lcssa to i64
  %43 = mul nsw i64 %42, %15
  %44 = getelementptr inbounds i32, ptr %18, i64 %43
  %45 = sext i32 %41 to i64
  %46 = getelementptr i32, ptr %44, i64 %45
  %47 = getelementptr i8, ptr %46, i64 -4
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %48)
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %49, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.stackrestore.p0(ptr %16)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0

.lr.ph40.split:                                   ; preds = %.preheader, %._crit_edge37
  %51 = phi i32 [ %59, %._crit_edge37 ], [ %19, %.preheader ]
  %52 = phi i32 [ %60, %._crit_edge37 ], [ %.pre57.pre, %.preheader ]
  %indvars.iv54 = phi i64 [ %indvars.iv.next55, %._crit_edge37 ], [ 1, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  store i32 -2147483648, ptr %4, align 4, !tbaa !5
  %53 = icmp sgt i32 %52, 1
  br i1 %53, label %.lr.ph36, label %._crit_edge37

.lr.ph36:                                         ; preds = %.lr.ph40.split
  %54 = add nsw i64 %indvars.iv54, -1
  %55 = mul nuw nsw i64 %54, %15
  %56 = getelementptr inbounds i32, ptr %18, i64 %55
  %57 = mul nuw nsw i64 %indvars.iv54, %15
  %58 = getelementptr inbounds i32, ptr %18, i64 %57
  br label %62

._crit_edge37.loopexit:                           ; preds = %62
  %.pre = load i32, ptr %3, align 4, !tbaa !5
  br label %._crit_edge37

._crit_edge37:                                    ; preds = %._crit_edge37.loopexit, %.lr.ph40.split
  %59 = phi i32 [ %.pre, %._crit_edge37.loopexit ], [ %51, %.lr.ph40.split ]
  %60 = phi i32 [ %78, %._crit_edge37.loopexit ], [ %52, %.lr.ph40.split ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %61 = sext i32 %59 to i64
  %.not26.not = icmp slt i64 %indvars.iv54, %61
  br i1 %.not26.not, label %.lr.ph40.split, label %._crit_edge41, !llvm.loop !14

62:                                               ; preds = %.lr.ph36, %62
  %indvars.iv51 = phi i64 [ 1, %.lr.ph36 ], [ %indvars.iv.next52, %62 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  %63 = add nsw i64 %indvars.iv51, -1
  %64 = getelementptr inbounds i32, ptr %56, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = getelementptr inbounds [100000 x i32], ptr %2, i64 0, i64 %63
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = sub nsw i32 %65, %67
  store i32 %68, ptr %5, align 4, !tbaa !5
  %69 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %70 = load i32, ptr %69, align 4, !tbaa !5
  store i32 %70, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  %71 = getelementptr inbounds i32, ptr %58, i64 %63
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  %72 = getelementptr inbounds [100000 x i32], ptr %2, i64 0, i64 %indvars.iv51
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = add nsw i32 %73, %70
  store i32 %74, ptr %6, align 4, !tbaa !5
  %75 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %71, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = getelementptr inbounds i32, ptr %58, i64 %indvars.iv51
  store i32 %76, ptr %77, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %78 = load i32, ptr %1, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = icmp slt i64 %indvars.iv.next52, %79
  br i1 %80, label %62, label %._crit_edge37.loopexit, !llvm.loop !16
}

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

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 #2

; 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 nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 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 #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)) #6

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

; 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 = { "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 nocallback nofree nosync nounwind willreturn }
attributes #4 = { 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 #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 = { 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 #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, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !10, !15}
!15 = !{!"llvm.loop.unswitch.partial.disable"}
!16 = distinct !{!16, !10}


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