; LLVM IR from manishbisht/Competitive-Programming :: Codechef/KGP16MOS (Optimal Partition)

; 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
@.str = 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 i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca [100005 x i64], align 16
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 800040, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %2)
  store i64 0, ptr %6, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %168, %0
  %12 = load i64, ptr %6, align 8, !tbaa !5
  %13 = load i64, ptr %2, align 8, !tbaa !5
  %14 = icmp slt i64 %12, %13
  br i1 %14, label %15, label %171

15:                                               ; preds = %11
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 8 dereferenceable(8) %4)
  store i64 0, ptr %7, align 8, !tbaa !5
  br label %18

18:                                               ; preds = %26, %15
  %19 = load i64, ptr %7, align 8, !tbaa !5
  %20 = load i64, ptr %3, align 8, !tbaa !5
  %21 = icmp slt i64 %19, %20
  br i1 %21, label %22, label %29

22:                                               ; preds = %18
  %23 = load i64, ptr %7, align 8, !tbaa !5
  %24 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 %23
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %24)
  br label %26

26:                                               ; preds = %22
  %27 = load i64, ptr %7, align 8, !tbaa !5
  %28 = add nsw i64 %27, 1
  store i64 %28, ptr %7, align 8, !tbaa !5
  br label %18, !llvm.loop !9

29:                                               ; preds = %18
  store i64 0, ptr %9, align 8, !tbaa !5
  %30 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %31 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %32 = load i64, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds i64, ptr %31, i64 %32
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef %30, ptr noundef %33)
  %34 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %35 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %36 = load i64, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds i64, ptr %35, i64 %36
  call void @_ZSt7reverseIPxEvT_S1_(ptr noundef %34, ptr noundef %37)
  %38 = load i64, ptr %3, align 8, !tbaa !5
  %39 = load i64, ptr %4, align 8, !tbaa !5
  %40 = sdiv i64 %38, %39
  store i64 %40, ptr %8, align 8, !tbaa !5
  %41 = load i64, ptr %8, align 8, !tbaa !5
  %42 = load i64, ptr %4, align 8, !tbaa !5
  %43 = mul nsw i64 %41, %42
  %44 = load i64, ptr %3, align 8, !tbaa !5
  %45 = icmp ne i64 %43, %44
  br i1 %45, label %46, label %96

46:                                               ; preds = %29
  %47 = load i64, ptr %4, align 8, !tbaa !5
  %48 = add nsw i64 %47, -1
  store i64 %48, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %50 = load i64, ptr %4, align 8, !tbaa !5
  %51 = load i64, ptr %8, align 8, !tbaa !5
  %52 = mul nsw i64 %50, %51
  %53 = getelementptr inbounds i64, ptr %49, i64 %52
  %54 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %55 = load i64, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds i64, ptr %54, i64 %55
  %57 = call noundef ptr @_ZSt11max_elementIPxET_S1_S1_(ptr noundef %53, ptr noundef %56)
  %58 = load i64, ptr %57, align 8, !tbaa !5
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %58)
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %59, ptr noundef @.str)
  %61 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %62 = load i64, ptr %4, align 8, !tbaa !5
  %63 = load i64, ptr %8, align 8, !tbaa !5
  %64 = mul nsw i64 %62, %63
  %65 = getelementptr inbounds i64, ptr %61, i64 %64
  %66 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %67 = load i64, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds i64, ptr %66, i64 %67
  %69 = call noundef ptr @_ZSt11min_elementIPxET_S1_S1_(ptr noundef %65, ptr noundef %68)
  %70 = load i64, ptr %69, align 8, !tbaa !5
  %71 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %60, i64 noundef %70)
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %71, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %73 = load i64, ptr %9, align 8, !tbaa !5
  %74 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %75 = load i64, ptr %4, align 8, !tbaa !5
  %76 = load i64, ptr %8, align 8, !tbaa !5
  %77 = mul nsw i64 %75, %76
  %78 = getelementptr inbounds i64, ptr %74, i64 %77
  %79 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %80 = load i64, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds i64, ptr %79, i64 %80
  %82 = call noundef ptr @_ZSt11max_elementIPxET_S1_S1_(ptr noundef %78, ptr noundef %81)
  %83 = load i64, ptr %82, align 8, !tbaa !5
  %84 = add nsw i64 %73, %83
  %85 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %86 = load i64, ptr %4, align 8, !tbaa !5
  %87 = load i64, ptr %8, align 8, !tbaa !5
  %88 = mul nsw i64 %86, %87
  %89 = getelementptr inbounds i64, ptr %85, i64 %88
  %90 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %91 = load i64, ptr %3, align 8, !tbaa !5
  %92 = getelementptr inbounds i64, ptr %90, i64 %91
  %93 = call noundef ptr @_ZSt11min_elementIPxET_S1_S1_(ptr noundef %89, ptr noundef %92)
  %94 = load i64, ptr %93, align 8, !tbaa !5
  %95 = sub nsw i64 %84, %94
  store i64 %95, ptr %9, align 8, !tbaa !5
  br label %96

96:                                               ; preds = %46, %29
  store i64 0, ptr %7, align 8, !tbaa !5
  br label %97

97:                                               ; preds = %161, %96
  %98 = load i64, ptr %7, align 8, !tbaa !5
  %99 = load i64, ptr %4, align 8, !tbaa !5
  %100 = icmp slt i64 %98, %99
  br i1 %100, label %101, label %164

101:                                              ; preds = %97
  %102 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %103 = load i64, ptr %7, align 8, !tbaa !5
  %104 = load i64, ptr %8, align 8, !tbaa !5
  %105 = mul nsw i64 %103, %104
  %106 = getelementptr inbounds i64, ptr %102, i64 %105
  %107 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %108 = load i64, ptr %7, align 8, !tbaa !5
  %109 = add nsw i64 %108, 1
  %110 = load i64, ptr %8, align 8, !tbaa !5
  %111 = mul nsw i64 %109, %110
  %112 = getelementptr inbounds i64, ptr %107, i64 %111
  %113 = call noundef ptr @_ZSt11max_elementIPxET_S1_S1_(ptr noundef %106, ptr noundef %112)
  %114 = load i64, ptr %113, align 8, !tbaa !5
  %115 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %114)
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %115, ptr noundef @.str)
  %117 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %118 = load i64, ptr %7, align 8, !tbaa !5
  %119 = load i64, ptr %8, align 8, !tbaa !5
  %120 = mul nsw i64 %118, %119
  %121 = getelementptr inbounds i64, ptr %117, i64 %120
  %122 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %123 = load i64, ptr %7, align 8, !tbaa !5
  %124 = add nsw i64 %123, 1
  %125 = load i64, ptr %8, align 8, !tbaa !5
  %126 = mul nsw i64 %124, %125
  %127 = getelementptr inbounds i64, ptr %122, i64 %126
  %128 = call noundef ptr @_ZSt11min_elementIPxET_S1_S1_(ptr noundef %121, ptr noundef %127)
  %129 = load i64, ptr %128, align 8, !tbaa !5
  %130 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %116, i64 noundef %129)
  %131 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %130, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %132 = load i64, ptr %9, align 8, !tbaa !5
  %133 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %134 = load i64, ptr %7, align 8, !tbaa !5
  %135 = load i64, ptr %8, align 8, !tbaa !5
  %136 = mul nsw i64 %134, %135
  %137 = getelementptr inbounds i64, ptr %133, i64 %136
  %138 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %139 = load i64, ptr %7, align 8, !tbaa !5
  %140 = add nsw i64 %139, 1
  %141 = load i64, ptr %8, align 8, !tbaa !5
  %142 = mul nsw i64 %140, %141
  %143 = getelementptr inbounds i64, ptr %138, i64 %142
  %144 = call noundef ptr @_ZSt11max_elementIPxET_S1_S1_(ptr noundef %137, ptr noundef %143)
  %145 = load i64, ptr %144, align 8, !tbaa !5
  %146 = add nsw i64 %132, %145
  %147 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %148 = load i64, ptr %7, align 8, !tbaa !5
  %149 = load i64, ptr %8, align 8, !tbaa !5
  %150 = mul nsw i64 %148, %149
  %151 = getelementptr inbounds i64, ptr %147, i64 %150
  %152 = getelementptr inbounds [100005 x i64], ptr %5, i64 0, i64 0
  %153 = load i64, ptr %7, align 8, !tbaa !5
  %154 = add nsw i64 %153, 1
  %155 = load i64, ptr %8, align 8, !tbaa !5
  %156 = mul nsw i64 %154, %155
  %157 = getelementptr inbounds i64, ptr %152, i64 %156
  %158 = call noundef ptr @_ZSt11min_elementIPxET_S1_S1_(ptr noundef %151, ptr noundef %157)
  %159 = load i64, ptr %158, align 8, !tbaa !5
  %160 = sub nsw i64 %146, %159
  store i64 %160, ptr %9, align 8, !tbaa !5
  br label %161

161:                                              ; preds = %101
  %162 = load i64, ptr %7, align 8, !tbaa !5
  %163 = add nsw i64 %162, 1
  store i64 %163, ptr %7, align 8, !tbaa !5
  br label %97, !llvm.loop !11

164:                                              ; preds = %97
  %165 = load i64, ptr %9, align 8, !tbaa !5
  %166 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %165)
  %167 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %166, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %168

168:                                              ; preds = %164
  %169 = load i64, ptr %6, align 8, !tbaa !5
  %170 = add nsw i64 %169, 1
  store i64 %170, ptr %6, align 8, !tbaa !5
  br label %11, !llvm.loop !12

171:                                              ; preds = %11
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 800040, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  ret i32 0
}

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7reverseIPxEvT_S1_(ptr noundef, ptr noundef) #3

; 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) #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11max_elementIPxET_S1_S1_(ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11min_elementIPxET_S1_S1_(ptr noundef, ptr noundef) #3

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

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

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 = { 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 = { 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 #4 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !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}


; 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
@.str = 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 i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca [100005 x i64], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 800040, ptr nonnull %4) #4
  %5 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %6 = load i64, ptr %1, align 8, !tbaa !5
  %7 = icmp sgt i64 %6, 0
  br i1 %7, label %.lr.ph44, label %._crit_edge45

.lr.ph44:                                         ; preds = %0, %._crit_edge40
  %.03142 = phi i64 [ %83, %._crit_edge40 ], [ 0, %0 ]
  %8 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %10 = load i64, ptr %2, align 8, !tbaa !5
  %11 = icmp sgt i64 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph44, %.lr.ph
  %.03235 = phi i64 [ %14, %.lr.ph ], [ 0, %.lr.ph44 ]
  %12 = getelementptr inbounds [100005 x i64], ptr %4, i64 0, i64 %.03235
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %14 = add nuw nsw i64 %.03235, 1
  %15 = load i64, ptr %2, align 8, !tbaa !5
  %16 = icmp slt i64 %14, %15
  br i1 %16, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph44
  %.lcssa = phi i64 [ %10, %.lr.ph44 ], [ %15, %.lr.ph ]
  %17 = getelementptr inbounds i64, ptr %4, i64 %.lcssa
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull %4, ptr noundef nonnull %17)
  %18 = load i64, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds i64, ptr %4, i64 %18
  call void @_ZSt7reverseIPxEvT_S1_(ptr noundef nonnull %4, ptr noundef nonnull %19)
  %20 = load i64, ptr %2, align 8, !tbaa !5
  %21 = load i64, ptr %3, align 8, !tbaa !5
  %22 = sdiv i64 %20, %21
  %23 = mul nsw i64 %22, %21
  %.not = icmp eq i64 %23, %20
  br i1 %.not, label %57, label %24

24:                                               ; preds = %._crit_edge
  %25 = add nsw i64 %21, -1
  store i64 %25, ptr %3, align 8, !tbaa !5
  %26 = mul nsw i64 %25, %22
  %27 = getelementptr inbounds i64, ptr %4, i64 %26
  %28 = getelementptr inbounds i64, ptr %4, i64 %20
  %29 = call noundef ptr @_ZSt11max_elementIPxET_S1_S1_(ptr noundef nonnull %27, ptr noundef nonnull %28)
  %30 = load i64, ptr %29, align 8, !tbaa !5
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %30)
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %31, ptr noundef nonnull @.str)
  %33 = load i64, ptr %3, align 8, !tbaa !5
  %34 = mul nsw i64 %33, %22
  %35 = getelementptr inbounds i64, ptr %4, i64 %34
  %36 = load i64, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds i64, ptr %4, i64 %36
  %38 = call noundef ptr @_ZSt11min_elementIPxET_S1_S1_(ptr noundef nonnull %35, ptr noundef nonnull %37)
  %39 = load i64, ptr %38, align 8, !tbaa !5
  %40 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %32, i64 noundef %39)
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %40, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %42 = load i64, ptr %3, align 8, !tbaa !5
  %43 = mul nsw i64 %42, %22
  %44 = getelementptr inbounds i64, ptr %4, i64 %43
  %45 = load i64, ptr %2, align 8, !tbaa !5
  %46 = getelementptr inbounds i64, ptr %4, i64 %45
  %47 = call noundef ptr @_ZSt11max_elementIPxET_S1_S1_(ptr noundef nonnull %44, ptr noundef nonnull %46)
  %48 = load i64, ptr %47, align 8, !tbaa !5
  %49 = load i64, ptr %3, align 8, !tbaa !5
  %50 = mul nsw i64 %49, %22
  %51 = getelementptr inbounds i64, ptr %4, i64 %50
  %52 = load i64, ptr %2, align 8, !tbaa !5
  %53 = getelementptr inbounds i64, ptr %4, i64 %52
  %54 = call noundef ptr @_ZSt11min_elementIPxET_S1_S1_(ptr noundef nonnull %51, ptr noundef nonnull %53)
  %55 = load i64, ptr %54, align 8, !tbaa !5
  %56 = sub nsw i64 %48, %55
  %.pre = load i64, ptr %3, align 8, !tbaa !5
  br label %57

57:                                               ; preds = %24, %._crit_edge
  %58 = phi i64 [ %.pre, %24 ], [ %21, %._crit_edge ]
  %.0 = phi i64 [ %56, %24 ], [ 0, %._crit_edge ]
  %59 = icmp sgt i64 %58, 0
  br i1 %59, label %.lr.ph39, label %._crit_edge40

.lr.ph39:                                         ; preds = %57, %.lr.ph39
  %.137 = phi i64 [ %78, %.lr.ph39 ], [ %.0, %57 ]
  %.13336 = phi i64 [ %62, %.lr.ph39 ], [ 0, %57 ]
  %60 = mul nsw i64 %.13336, %22
  %61 = getelementptr inbounds i64, ptr %4, i64 %60
  %62 = add nuw nsw i64 %.13336, 1
  %63 = mul nsw i64 %62, %22
  %64 = getelementptr inbounds i64, ptr %4, i64 %63
  %65 = call noundef ptr @_ZSt11max_elementIPxET_S1_S1_(ptr noundef nonnull %61, ptr noundef nonnull %64)
  %66 = load i64, ptr %65, align 8, !tbaa !5
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %66)
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %67, ptr noundef nonnull @.str)
  %69 = call noundef ptr @_ZSt11min_elementIPxET_S1_S1_(ptr noundef nonnull %61, ptr noundef nonnull %64)
  %70 = load i64, ptr %69, align 8, !tbaa !5
  %71 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %68, i64 noundef %70)
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %71, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %73 = call noundef ptr @_ZSt11max_elementIPxET_S1_S1_(ptr noundef nonnull %61, ptr noundef nonnull %64)
  %74 = load i64, ptr %73, align 8, !tbaa !5
  %75 = add nsw i64 %74, %.137
  %76 = call noundef ptr @_ZSt11min_elementIPxET_S1_S1_(ptr noundef nonnull %61, ptr noundef nonnull %64)
  %77 = load i64, ptr %76, align 8, !tbaa !5
  %78 = sub i64 %75, %77
  %79 = load i64, ptr %3, align 8, !tbaa !5
  %80 = icmp slt i64 %62, %79
  br i1 %80, label %.lr.ph39, label %._crit_edge40, !llvm.loop !11

._crit_edge40:                                    ; preds = %.lr.ph39, %57
  %.1.lcssa = phi i64 [ %.0, %57 ], [ %78, %.lr.ph39 ]
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.1.lcssa)
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %81, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %83 = add nuw nsw i64 %.03142, 1
  %84 = load i64, ptr %1, align 8, !tbaa !5
  %85 = icmp slt i64 %83, %84
  br i1 %85, label %.lr.ph44, label %._crit_edge45, !llvm.loop !12

._crit_edge45:                                    ; preds = %._crit_edge40, %0
  call void @llvm.lifetime.end.p0(i64 800040, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7reverseIPxEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

; 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 #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11max_elementIPxET_S1_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11min_elementIPxET_S1_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

; 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 #2 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)) #3

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

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 = { 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 = { 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 #4 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !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}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass