; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2019-20/Feb/Plat/help_NKlogN+NK^2.ll (Z2adii)

; 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::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::array" = type { [11 x %struct.mi] }
%struct.mi = type { i32 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@N = external dso_local global i32, align 4
@K = external dso_local global i32, align 4
@y = external dso_local global %"class.std::vector.3", align 8

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i32 @_Zpl2miS_(i32, i32) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3advSt5arrayI2miLm11EE(ptr dead_on_unwind noalias writable sret(%"struct.std::array") align 4, ptr noundef byval(%"struct.std::array") align 8) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayI2miLm11EEixEm(ptr noundef nonnull align 4 dereferenceable(44), i64 noundef) #2 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt5arrayI2miLm11EEC2Ev(ptr noundef nonnull align 4 dereferenceable(44)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3muliiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3updiRKSt5arrayI2miLm11EEiii(i32 noundef, ptr noundef nonnull align 4 dereferenceable(44), i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5queryiiRSt5arrayI2miLm11EEiii(i32 noundef, i32 noundef, ptr noundef nonnull align 4 dereferenceable(44), i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z2adii(i32 noundef %0, i32 noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca i64, align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %12 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %15 = alloca %"struct.std::array", align 4
  %16 = alloca %"struct.std::array", align 4
  %17 = alloca %"struct.std::array", align 8
  %18 = alloca %"struct.std::array", align 4
  %19 = alloca i32, align 4
  %20 = alloca %struct.mi, align 4
  %21 = alloca %struct.mi, align 4
  %22 = alloca %struct.mi, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %23 = call ptr @_ZSt5beginISt6vectorIiSaIiEEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(24) @y)
  %24 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  store ptr %23, ptr %24, align 8
  %25 = call ptr @_ZSt3endISt6vectorIiSaIiEEEDTcldtfp_3endEERT_(ptr noundef nonnull align 8 dereferenceable(24) @y)
  %26 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %25, ptr %26, align 8
  %27 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8
  %29 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8
  %31 = call ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %28, ptr %30, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %32 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %6, i32 0, i32 0
  store ptr %31, ptr %32, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %33 = call ptr @_ZSt5beginISt6vectorIiSaIiEEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(24) @y)
  %34 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %33, ptr %34, align 8
  %35 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  %36 = sub nsw i64 %35, 1
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  store i64 %36, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %37 = call ptr @_ZSt5beginISt6vectorIiSaIiEEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(24) @y)
  %38 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %12, i32 0, i32 0
  store ptr %37, ptr %38, align 8
  %39 = call ptr @_ZSt3endISt6vectorIiSaIiEEEDTcldtfp_3endEERT_(ptr noundef nonnull align 8 dereferenceable(24) @y)
  %40 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %39, ptr %40, align 8
  %41 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %12, i32 0, i32 0
  %42 = load ptr, ptr %41, align 8
  %43 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8
  %45 = call ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %42, ptr %44, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %46 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %11, i32 0, i32 0
  store ptr %45, ptr %46, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %47 = call ptr @_ZSt5beginISt6vectorIiSaIiEEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(24) @y)
  %48 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  store ptr %47, ptr %48, align 8
  %49 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  store i64 %49, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 44, ptr %15) #7
  call void @llvm.memset.p0.i64(ptr align 4 %15, i8 0, i64 44, i1 false)
  call void @_ZNSt5arrayI2miLm11EEC2Ev(ptr noundef nonnull align 4 dereferenceable(44) %15)
  %50 = load i64, ptr %5, align 8, !tbaa !9
  %51 = trunc i64 %50 to i32
  %52 = load i32, ptr @N, align 4, !tbaa !5
  call void @_Z5queryiiRSt5arrayI2miLm11EEiii(i32 noundef 0, i32 noundef %51, ptr noundef nonnull align 4 dereferenceable(44) %15, i32 noundef 1, i32 noundef 0, i32 noundef %52)
  call void @llvm.lifetime.start.p0(i64 44, ptr %16) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 4 %15, i64 44, i1 false), !tbaa.struct !11
  call void @_Z3advSt5arrayI2miLm11EE(ptr dead_on_unwind writable sret(%"struct.std::array") align 4 %16, ptr noundef byval(%"struct.std::array") align 8 %17)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %16, i64 44, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 44, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 44, ptr %18) #7
  call void @llvm.memset.p0.i64(ptr align 4 %18, i8 0, i64 44, i1 false)
  call void @_ZNSt5arrayI2miLm11EEC2Ev(ptr noundef nonnull align 4 dereferenceable(44) %18)
  %53 = load i64, ptr %5, align 8, !tbaa !9
  %54 = add nsw i64 %53, 1
  %55 = trunc i64 %54 to i32
  %56 = load i64, ptr %10, align 8, !tbaa !9
  %57 = trunc i64 %56 to i32
  %58 = load i32, ptr @N, align 4, !tbaa !5
  call void @_Z5queryiiRSt5arrayI2miLm11EEiii(i32 noundef %55, i32 noundef %57, ptr noundef nonnull align 4 dereferenceable(44) %18, i32 noundef 1, i32 noundef 0, i32 noundef %58)
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %80, %2
  %60 = load i32, ptr %19, align 4, !tbaa !5
  %61 = load i32, ptr @K, align 4, !tbaa !5
  %62 = icmp sle i32 %60, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %59
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %83

64:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  %65 = load i32, ptr %19, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayI2miLm11EEixEm(ptr noundef nonnull align 4 dereferenceable(44) %15, i64 noundef %66) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 4 %67, i64 4, i1 false), !tbaa.struct !13
  %68 = load i32, ptr %19, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayI2miLm11EEixEm(ptr noundef nonnull align 4 dereferenceable(44) %18, i64 noundef %69) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %70, i64 4, i1 false), !tbaa.struct !13
  %71 = getelementptr inbounds %struct.mi, ptr %21, i32 0, i32 0
  %72 = load i32, ptr %71, align 4
  %73 = getelementptr inbounds %struct.mi, ptr %22, i32 0, i32 0
  %74 = load i32, ptr %73, align 4
  %75 = call i32 @_Zpl2miS_(i32 %72, i32 %74)
  %76 = getelementptr inbounds %struct.mi, ptr %20, i32 0, i32 0
  store i32 %75, ptr %76, align 4
  %77 = load i32, ptr %19, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayI2miLm11EEixEm(ptr noundef nonnull align 4 dereferenceable(44) %15, i64 noundef %78) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %79, ptr align 4 %20, i64 4, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %80

80:                                               ; preds = %64
  %81 = load i32, ptr %19, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %19, align 4, !tbaa !5
  br label %59, !llvm.loop !14

83:                                               ; preds = %63
  %84 = load i64, ptr %10, align 8, !tbaa !9
  %85 = trunc i64 %84 to i32
  %86 = load i32, ptr @N, align 4, !tbaa !5
  call void @_Z3updiRKSt5arrayI2miLm11EEiii(i32 noundef %85, ptr noundef nonnull align 4 dereferenceable(44) %15, i32 noundef 1, i32 noundef 0, i32 noundef %86)
  %87 = load i64, ptr %10, align 8, !tbaa !9
  %88 = add nsw i64 %87, 1
  %89 = trunc i64 %88 to i32
  %90 = load i32, ptr @N, align 4, !tbaa !5
  call void @_Z3muliiii(i32 noundef %89, i32 noundef 1, i32 noundef 0, i32 noundef %90)
  call void @llvm.lifetime.end.p0(i64 44, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 44, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local ptr @_ZSt5beginISt6vectorIiSaIiEEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(24)) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local ptr @_ZSt3endISt6vectorIiSaIiEEEDTcldtfp_3endEERT_(ptr noundef nonnull align 8 dereferenceable(24)) #5

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{i64 0, i64 44, !12}
!12 = !{!7, !7, i64 0}
!13 = !{i64 0, i64 4, !5}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


; 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::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::array" = type { [11 x %struct.mi] }
%struct.mi = type { i32 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@N = external dso_local local_unnamed_addr global i32, align 4
@K = external dso_local local_unnamed_addr global i32, align 4
@y = external dso_local global %"class.std::vector.3", align 8

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i32 @_Zpl2miS_(i32, i32) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3advSt5arrayI2miLm11EE(ptr dead_on_unwind noalias writable sret(%"struct.std::array") align 4, ptr noundef byval(%"struct.std::array") align 8) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayI2miLm11EEixEm(ptr noundef nonnull align 4 dereferenceable(44), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt5arrayI2miLm11EEC2Ev(ptr noundef nonnull align 4 dereferenceable(44)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3muliiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3updiRKSt5arrayI2miLm11EEiii(i32 noundef, ptr noundef nonnull align 4 dereferenceable(44), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5queryiiRSt5arrayI2miLm11EEiii(i32 noundef, i32 noundef, ptr noundef nonnull align 4 dereferenceable(44), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z2adii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #1 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"struct.std::array", align 8
  %10 = alloca %"struct.std::array", align 4
  %11 = alloca %"struct.std::array", align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %12 = tail call ptr @_ZSt5beginISt6vectorIiSaIiEEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(24) @y)
  %13 = tail call ptr @_ZSt3endISt6vectorIiSaIiEEEDTcldtfp_3endEERT_(ptr noundef nonnull align 8 dereferenceable(24) @y)
  %14 = call ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %12, ptr %13, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store ptr %14, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %15 = call ptr @_ZSt5beginISt6vectorIiSaIiEEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(24) @y)
  store ptr %15, ptr %6, align 8
  %16 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %17 = call ptr @_ZSt5beginISt6vectorIiSaIiEEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(24) @y)
  %18 = call ptr @_ZSt3endISt6vectorIiSaIiEEEDTcldtfp_3endEERT_(ptr noundef nonnull align 8 dereferenceable(24) @y)
  %19 = call ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %17, ptr %18, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store ptr %19, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %20 = call ptr @_ZSt5beginISt6vectorIiSaIiEEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(24) @y)
  store ptr %20, ptr %8, align 8
  %21 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 44, ptr nonnull %9) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(44) %9, i8 0, i64 44, i1 false)
  call void @_ZNSt5arrayI2miLm11EEC2Ev(ptr noundef nonnull align 4 dereferenceable(44) %9)
  %22 = trunc i64 %16 to i32
  %23 = add i32 %22, -1
  %24 = load i32, ptr @N, align 4, !tbaa !5
  call void @_Z5queryiiRSt5arrayI2miLm11EEiii(i32 noundef 0, i32 noundef %23, ptr noundef nonnull align 4 dereferenceable(44) %9, i32 noundef 1, i32 noundef 0, i32 noundef %24)
  call void @llvm.lifetime.start.p0(i64 44, ptr nonnull %10) #7
  call void @_Z3advSt5arrayI2miLm11EE(ptr dead_on_unwind nonnull writable sret(%"struct.std::array") align 4 %10, ptr noundef nonnull byval(%"struct.std::array") align 8 %9)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(44) %9, ptr noundef nonnull align 4 dereferenceable(44) %10, i64 44, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 44, ptr nonnull %10) #7
  call void @llvm.lifetime.start.p0(i64 44, ptr nonnull %11) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(44) %11, i8 0, i64 44, i1 false)
  call void @_ZNSt5arrayI2miLm11EEC2Ev(ptr noundef nonnull align 4 dereferenceable(44) %11)
  %25 = trunc i64 %21 to i32
  %26 = load i32, ptr @N, align 4, !tbaa !5
  call void @_Z5queryiiRSt5arrayI2miLm11EEiii(i32 noundef %22, i32 noundef %25, ptr noundef nonnull align 4 dereferenceable(44) %11, i32 noundef 1, i32 noundef 0, i32 noundef %26)
  %27 = load i32, ptr @K, align 4, !tbaa !5
  %.not16 = icmp slt i32 %27, 0
  br i1 %.not16, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %2
  %28 = load i32, ptr @N, align 4, !tbaa !5
  call void @_Z3updiRKSt5arrayI2miLm11EEiii(i32 noundef %25, ptr noundef nonnull align 4 dereferenceable(44) %9, i32 noundef 1, i32 noundef 0, i32 noundef %28)
  %29 = add i32 %25, 1
  %30 = load i32, ptr @N, align 4, !tbaa !5
  call void @_Z3muliiii(i32 noundef %29, i32 noundef 1, i32 noundef 0, i32 noundef %30)
  call void @llvm.lifetime.end.p0(i64 44, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 44, ptr nonnull %9) #7
  ret void

.lr.ph:                                           ; preds = %2, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %2 ]
  %31 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayI2miLm11EEixEm(ptr noundef nonnull align 4 dereferenceable(44) %9, i64 noundef %indvars.iv) #7
  %.sroa.01.0.copyload = load i32, ptr %31, align 4, !tbaa !5
  %32 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayI2miLm11EEixEm(ptr noundef nonnull align 4 dereferenceable(44) %11, i64 noundef %indvars.iv) #7
  %.sroa.0.0.copyload = load i32, ptr %32, align 4, !tbaa !5
  %33 = call i32 @_Zpl2miS_(i32 %.sroa.01.0.copyload, i32 %.sroa.0.0.copyload)
  %34 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayI2miLm11EEixEm(ptr noundef nonnull align 4 dereferenceable(44) %9, i64 noundef %indvars.iv) #7
  store i32 %33, ptr %34, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %35 = load i32, ptr @K, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %.not.not = icmp slt i64 %indvars.iv, %36
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local ptr @_ZSt5beginISt6vectorIiSaIiEEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local ptr @_ZSt3endISt6vectorIiSaIiEEEDTcldtfp_3endEERT_(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #5

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{i64 0, i64 44, !10}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass