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

; 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
  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(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) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %17

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

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

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

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

30:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %31 = 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)
  %32 = load i32, ptr %5, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  %34 = zext i32 %33 to i64
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = zext i32 %35 to i64
  %37 = call ptr @llvm.stacksave.p0()
  store ptr %37, ptr %6, align 8
  %38 = mul nuw i64 %34, %36
  %39 = alloca i32, i64 %38, align 16
  store i64 %34, ptr %7, align 8
  store i64 %36, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %40

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

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

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

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

51:                                               ; preds = %47
  store i32 8, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %63

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

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

63:                                               ; preds = %51
  br label %64

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

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

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

73:                                               ; preds = %68
  store i32 11, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %157

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

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

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

80:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %81 = load i32, ptr %12, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = mul nsw i64 %82, %36
  %84 = getelementptr inbounds i32, ptr %39, i64 %83
  %85 = load i32, ptr %13, align 4, !tbaa !5
  %86 = sub nsw i32 %85, 1
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds i32, ptr %84, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  store i32 %89, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %138, %80
  %91 = load i32, ptr %15, align 4, !tbaa !5
  %92 = load i32, ptr %13, align 4, !tbaa !5
  %93 = icmp slt i32 %91, %92
  br i1 %93, label %95, label %94

94:                                               ; preds = %90
  store i32 17, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %141

95:                                               ; preds = %90
  %96 = load i32, ptr %12, align 4, !tbaa !5
  %97 = sub nsw i32 %96, 1
  %98 = sext i32 %97 to i64
  %99 = mul nsw i64 %98, %36
  %100 = getelementptr inbounds i32, ptr %39, i64 %99
  %101 = load i32, ptr %15, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds i32, ptr %100, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = load i32, ptr %13, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [100000 x i32], ptr %3, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = load i32, ptr %15, 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 = sub nsw i32 %108, %112
  %114 = add nsw i32 %104, %113
  %115 = load i32, ptr %14, align 4, !tbaa !5
  %116 = icmp sgt i32 %114, %115
  br i1 %116, label %117, label %137

117:                                              ; preds = %95
  %118 = load i32, ptr %12, align 4, !tbaa !5
  %119 = sub nsw i32 %118, 1
  %120 = sext i32 %119 to i64
  %121 = mul nsw i64 %120, %36
  %122 = getelementptr inbounds i32, ptr %39, i64 %121
  %123 = load i32, ptr %15, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds i32, ptr %122, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = load i32, ptr %13, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [100000 x i32], ptr %3, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = load i32, ptr %15, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [100000 x i32], ptr %3, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = sub nsw i32 %130, %134
  %136 = add nsw i32 %126, %135
  store i32 %136, ptr %14, align 4, !tbaa !5
  br label %137

137:                                              ; preds = %117, %95
  br label %138

138:                                              ; preds = %137
  %139 = load i32, ptr %15, align 4, !tbaa !5
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %15, align 4, !tbaa !5
  br label %90, !llvm.loop !13

141:                                              ; preds = %94
  %142 = load i32, ptr %14, align 4, !tbaa !5
  %143 = load i32, ptr %12, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = mul nsw i64 %144, %36
  %146 = getelementptr inbounds i32, ptr %39, i64 %145
  %147 = load i32, ptr %13, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds i32, ptr %146, i64 %148
  store i32 %142, ptr %149, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %150

150:                                              ; preds = %141
  %151 = load i32, ptr %13, align 4, !tbaa !5
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %13, align 4, !tbaa !5
  br label %75, !llvm.loop !14

153:                                              ; preds = %79
  br label %154

154:                                              ; preds = %153
  %155 = load i32, ptr %12, align 4, !tbaa !5
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %12, align 4, !tbaa !5
  br label %68, !llvm.loop !15

157:                                              ; preds = %73
  %158 = load i32, ptr %5, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = mul nsw i64 %159, %36
  %161 = getelementptr inbounds i32, ptr %39, i64 %160
  %162 = load i32, ptr %2, align 4, !tbaa !5
  %163 = sub nsw i32 %162, 1
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds i32, ptr %161, i64 %164
  %166 = load i32, ptr %165, align 4, !tbaa !5
  %167 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %166)
  %168 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %167, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %169 = load ptr, ptr %6, align 8
  call void @llvm.stackrestore.p0(ptr %169)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 400000, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %170 = load i32, ptr %1, align 4
  ret i32 %170
}

; 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

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) #4 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)) #5

; 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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #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_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
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  %4 = 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
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #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) %3)
  %8 = load i32, ptr %3, align 4, !tbaa !5
  %9 = add nsw i32 %8, 1
  %10 = zext i32 %9 to i64
  %11 = load i32, ptr %1, align 4, !tbaa !5
  %12 = zext i32 %11 to i64
  %13 = call ptr @llvm.stacksave.p0()
  %14 = mul nuw i64 %10, %12
  %15 = alloca i32, i64 %14, align 16
  %16 = load i32, ptr %3, align 4, !tbaa !5
  %.not45 = icmp slt i32 %16, 0
  %.pre.pre = load i32, ptr %1, align 4, !tbaa !5
  br i1 %.not45, label %._crit_edge54, label %.preheader40.lr.ph

.preheader40.lr.ph:                               ; preds = %._crit_edge
  %17 = icmp sgt i32 %.pre.pre, 0
  br i1 %17, label %.preheader40.us.preheader, label %.preheader39

.preheader40.us.preheader:                        ; preds = %.preheader40.lr.ph
  %18 = shl nuw nsw i64 %12, 2
  %19 = zext nneg i32 %.pre.pre to i64
  %20 = shl nuw nsw i64 %19, 2
  %21 = add nuw i32 %16, 1
  %wide.trip.count = zext i32 %21 to i64
  %xtraiter = and i64 %wide.trip.count, 7
  %22 = icmp ult i32 %16, 7
  br i1 %22, label %.preheader39.loopexit.unr-lcssa, label %.preheader40.us.preheader.new

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

.preheader40.us:                                  ; preds = %.preheader40.us, %.preheader40.us.preheader.new
  %indvar = phi i64 [ 0, %.preheader40.us.preheader.new ], [ %indvar.next.7, %.preheader40.us ]
  %niter = phi i64 [ 0, %.preheader40.us.preheader.new ], [ %niter.next.7, %.preheader40.us ]
  %23 = mul nuw nsw i64 %18, %indvar
  %scevgep = getelementptr i8, ptr %15, i64 %23
  call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %20, i1 false), !tbaa !5
  %indvar.next = or disjoint i64 %indvar, 1
  %24 = mul nuw nsw i64 %18, %indvar.next
  %scevgep.1 = getelementptr i8, ptr %15, i64 %24
  call void @llvm.memset.p0.i64(ptr align 4 %scevgep.1, i8 0, i64 %20, i1 false), !tbaa !5
  %indvar.next.1 = or disjoint i64 %indvar, 2
  %25 = mul nuw nsw i64 %18, %indvar.next.1
  %scevgep.2 = getelementptr i8, ptr %15, i64 %25
  call void @llvm.memset.p0.i64(ptr align 8 %scevgep.2, i8 0, i64 %20, i1 false), !tbaa !5
  %indvar.next.2 = or disjoint i64 %indvar, 3
  %26 = mul nuw nsw i64 %18, %indvar.next.2
  %scevgep.3 = getelementptr i8, ptr %15, i64 %26
  call void @llvm.memset.p0.i64(ptr align 4 %scevgep.3, i8 0, i64 %20, i1 false), !tbaa !5
  %indvar.next.3 = or disjoint i64 %indvar, 4
  %27 = mul nuw nsw i64 %18, %indvar.next.3
  %scevgep.4 = getelementptr i8, ptr %15, i64 %27
  call void @llvm.memset.p0.i64(ptr align 16 %scevgep.4, i8 0, i64 %20, i1 false), !tbaa !5
  %indvar.next.4 = or disjoint i64 %indvar, 5
  %28 = mul nuw nsw i64 %18, %indvar.next.4
  %scevgep.5 = getelementptr i8, ptr %15, i64 %28
  call void @llvm.memset.p0.i64(ptr align 4 %scevgep.5, i8 0, i64 %20, i1 false), !tbaa !5
  %indvar.next.5 = or disjoint i64 %indvar, 6
  %29 = mul nuw nsw i64 %18, %indvar.next.5
  %scevgep.6 = getelementptr i8, ptr %15, i64 %29
  call void @llvm.memset.p0.i64(ptr align 8 %scevgep.6, i8 0, i64 %20, i1 false), !tbaa !5
  %indvar.next.6 = or disjoint i64 %indvar, 7
  %30 = mul nuw nsw i64 %18, %indvar.next.6
  %scevgep.7 = getelementptr i8, ptr %15, i64 %30
  call void @llvm.memset.p0.i64(ptr align 4 %scevgep.7, i8 0, i64 %20, 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 %.preheader39.loopexit.unr-lcssa, label %.preheader40.us, !llvm.loop !9

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %31 = getelementptr inbounds [100000 x i32], ptr %2, i64 0, i64 %indvars.iv
  %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) %31)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %33 = load i32, ptr %1, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = icmp slt i64 %indvars.iv.next, %34
  br i1 %35, label %.lr.ph, label %._crit_edge, !llvm.loop !11

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

.preheader40.us.epil:                             ; preds = %.preheader39.loopexit.unr-lcssa, %.preheader40.us.epil
  %indvar.epil = phi i64 [ %indvar.next.epil, %.preheader40.us.epil ], [ %indvar.unr, %.preheader39.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.preheader40.us.epil ], [ 0, %.preheader39.loopexit.unr-lcssa ]
  %36 = mul nuw nsw i64 %18, %indvar.epil
  %scevgep.epil = getelementptr i8, ptr %15, i64 %36
  call void @llvm.memset.p0.i64(ptr align 4 %scevgep.epil, i8 0, i64 %20, 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 %.preheader39, label %.preheader40.us.epil, !llvm.loop !12

.preheader39:                                     ; preds = %.preheader39.loopexit.unr-lcssa, %.preheader40.us.epil, %.preheader40.lr.ph
  %.not3852 = icmp ne i32 %16, 0
  %37 = icmp sgt i32 %.pre.pre, 1
  %or.cond = select i1 %.not3852, i1 %37, i1 false
  br i1 %or.cond, label %.preheader.us.preheader, label %._crit_edge54

.preheader.us.preheader:                          ; preds = %.preheader39
  %38 = add nuw i32 %16, 1
  %wide.trip.count75 = zext i32 %38 to i64
  %wide.trip.count70 = zext nneg i32 %.pre.pre to i64
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge51.us
  %indvars.iv72 = phi i64 [ 1, %.preheader.us.preheader ], [ %indvars.iv.next73, %._crit_edge51.us ]
  %39 = mul nuw nsw i64 %indvars.iv72, %12
  %40 = getelementptr inbounds i32, ptr %15, i64 %39
  %41 = add nsw i64 %indvars.iv72, -1
  %42 = mul nuw nsw i64 %41, %12
  %43 = getelementptr inbounds i32, ptr %15, i64 %42
  br label %44

44:                                               ; preds = %.preheader.us, %.loopexit
  %indvars.iv67 = phi i64 [ 1, %.preheader.us ], [ %indvars.iv.next68, %.loopexit ]
  %45 = getelementptr i32, ptr %40, i64 %indvars.iv67
  %46 = getelementptr i8, ptr %45, i64 -4
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = getelementptr inbounds [100000 x i32], ptr %2, i64 0, i64 %indvars.iv67
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %min.iters.check = icmp ult i64 %indvars.iv67, 8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %44
  %indvars.iv62.ph = phi i64 [ 0, %44 ], [ %n.vec, %middle.block ]
  %.03147.us.ph = phi i32 [ %47, %44 ], [ %61, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %44
  %n.vec = and i64 %indvars.iv67, 9223372036854775800
  %minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %47, i64 0
  %minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %49, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %58, %vector.body ]
  %vec.phi78 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %59, %vector.body ]
  %50 = getelementptr inbounds i32, ptr %43, i64 %index
  %51 = getelementptr inbounds i8, ptr %50, i64 16
  %wide.load = load <4 x i32>, ptr %50, align 4, !tbaa !5
  %wide.load79 = load <4 x i32>, ptr %51, align 4, !tbaa !5
  %52 = getelementptr inbounds [100000 x i32], ptr %2, i64 0, i64 %index
  %53 = getelementptr inbounds i8, ptr %52, i64 16
  %wide.load80 = load <4 x i32>, ptr %52, align 16, !tbaa !5
  %wide.load81 = load <4 x i32>, ptr %53, align 16, !tbaa !5
  %54 = add <4 x i32> %broadcast.splat, %wide.load
  %55 = add <4 x i32> %broadcast.splat, %wide.load79
  %56 = sub <4 x i32> %54, %wide.load80
  %57 = sub <4 x i32> %55, %wide.load81
  %58 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %56, <4 x i32> %vec.phi)
  %59 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %57, <4 x i32> %vec.phi78)
  %index.next = add nuw i64 %index, 8
  %60 = icmp eq i64 %index.next, %n.vec
  br i1 %60, label %middle.block, label %vector.body, !llvm.loop !14

middle.block:                                     ; preds = %vector.body
  %rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %58, <4 x i32> %59)
  %61 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
  %cmp.n = icmp eq i64 %indvars.iv67, %n.vec
  br i1 %cmp.n, label %.loopexit, label %scalar.ph.preheader

.loopexit:                                        ; preds = %scalar.ph, %middle.block
  %spec.select.us.lcssa = phi i32 [ %61, %middle.block ], [ %spec.select.us, %scalar.ph ]
  store i32 %spec.select.us.lcssa, ptr %45, align 4, !tbaa !5
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %exitcond71.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count70
  br i1 %exitcond71.not, label %._crit_edge51.us, label %44, !llvm.loop !17

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv62 = phi i64 [ %indvars.iv.next63, %scalar.ph ], [ %indvars.iv62.ph, %scalar.ph.preheader ]
  %.03147.us = phi i32 [ %spec.select.us, %scalar.ph ], [ %.03147.us.ph, %scalar.ph.preheader ]
  %62 = getelementptr inbounds i32, ptr %43, i64 %indvars.iv62
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = getelementptr inbounds [100000 x i32], ptr %2, i64 0, i64 %indvars.iv62
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = add i32 %49, %63
  %67 = sub i32 %66, %65
  %spec.select.us = call i32 @llvm.smax.i32(i32 %67, i32 %.03147.us)
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %exitcond66.not = icmp eq i64 %indvars.iv.next63, %indvars.iv67
  br i1 %exitcond66.not, label %.loopexit, label %scalar.ph, !llvm.loop !18

._crit_edge51.us:                                 ; preds = %.loopexit
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %exitcond76.not = icmp eq i64 %indvars.iv.next73, %wide.trip.count75
  br i1 %exitcond76.not, label %._crit_edge54, label %.preheader.us, !llvm.loop !19

._crit_edge54:                                    ; preds = %._crit_edge51.us, %._crit_edge, %.preheader39
  %68 = sext i32 %16 to i64
  %69 = mul nsw i64 %68, %12
  %70 = getelementptr inbounds i32, ptr %15, i64 %69
  %71 = sext i32 %.pre.pre to i64
  %72 = getelementptr i32, ptr %70, i64 %71
  %73 = getelementptr i8, ptr %72, i64 -4
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %74)
  %76 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %75, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.stackrestore.p0(ptr %13)
  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
}

; 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

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 #4 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)) #5

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.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 = { "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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #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, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !10, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !16, !15}
!19 = distinct !{!19, !10}


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