; LLVM IR from eyangch/competitive-programming :: Codeforces/1527 (e)

; 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" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.lazy_segtree = type { [140005 x i64], [140005 x i64] }
%"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" }

@N = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@A = external dso_local global [35000 x i64], align 16
@P = external dso_local global [35000 x i64], align 16
@dp = external dso_local global [101 x [35001 x i64]], align 16
@O = external dso_local global [35000 x %"class.std::vector"], align 16
@LZ_S = external dso_local global [101 x %struct.lazy_segtree], align 16
@_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 i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %7 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %8 = getelementptr i8, ptr %7, i64 -24
  %9 = load i64, ptr %8, align 8
  %10 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %9
  %11 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %10, ptr noundef null)
  %12 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %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) @N)
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(8) @K)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %15

15:                                               ; preds = %51, %0
  %16 = load i64, ptr %2, align 8, !tbaa !8
  %17 = load i64, ptr @N, align 8, !tbaa !8
  %18 = icmp slt i64 %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %54

20:                                               ; preds = %15
  %21 = load i64, ptr %2, align 8, !tbaa !8
  %22 = getelementptr inbounds [35000 x i64], ptr @A, i64 0, i64 %21
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %22)
  %24 = load i64, ptr %2, align 8, !tbaa !8
  %25 = getelementptr inbounds [35000 x i64], ptr @A, i64 0, i64 %24
  %26 = load i64, ptr %25, align 8, !tbaa !8
  %27 = add nsw i64 %26, -1
  store i64 %27, ptr %25, align 8, !tbaa !8
  %28 = load i64, ptr %2, align 8, !tbaa !8
  %29 = getelementptr inbounds [35000 x i64], ptr @A, i64 0, i64 %28
  %30 = load i64, ptr %29, align 8, !tbaa !8
  %31 = getelementptr inbounds [35000 x %"class.std::vector"], ptr @O, i64 0, i64 %30
  %32 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %31) #6
  %33 = icmp ne i64 %32, 0
  br i1 %33, label %34, label %43

34:                                               ; preds = %20
  %35 = load i64, ptr %2, align 8, !tbaa !8
  %36 = getelementptr inbounds [35000 x i64], ptr @A, i64 0, i64 %35
  %37 = load i64, ptr %36, align 8, !tbaa !8
  %38 = getelementptr inbounds [35000 x %"class.std::vector"], ptr @O, i64 0, i64 %37
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %38) #6
  %40 = load i64, ptr %39, align 8, !tbaa !8
  %41 = load i64, ptr %2, align 8, !tbaa !8
  %42 = getelementptr inbounds [35000 x i64], ptr @P, i64 0, i64 %41
  store i64 %40, ptr %42, align 8, !tbaa !8
  br label %46

43:                                               ; preds = %20
  %44 = load i64, ptr %2, align 8, !tbaa !8
  %45 = getelementptr inbounds [35000 x i64], ptr @P, i64 0, i64 %44
  store i64 -2, ptr %45, align 8, !tbaa !8
  br label %46

46:                                               ; preds = %43, %34
  %47 = load i64, ptr %2, align 8, !tbaa !8
  %48 = getelementptr inbounds [35000 x i64], ptr @A, i64 0, i64 %47
  %49 = load i64, ptr %48, align 8, !tbaa !8
  %50 = getelementptr inbounds [35000 x %"class.std::vector"], ptr @O, i64 0, i64 %49
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %50, ptr noundef nonnull align 8 dereferenceable(8) %2)
  br label %51

51:                                               ; preds = %46
  %52 = load i64, ptr %2, align 8, !tbaa !8
  %53 = add nsw i64 %52, 1
  store i64 %53, ptr %2, align 8, !tbaa !8
  br label %15, !llvm.loop !11

54:                                               ; preds = %19
  call void @_ZN12lazy_segtree3addExxxxxx(ptr noundef nonnull align 8 dereferenceable(2240080) @LZ_S, i64 noundef 1, i64 noundef 35000, i64 noundef 1000000000000000, i64 noundef 0, i64 noundef 35000, i64 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  store i64 1, ptr %3, align 8, !tbaa !8
  br label %55

55:                                               ; preds = %112, %54
  %56 = load i64, ptr %3, align 8, !tbaa !8
  %57 = load i64, ptr @N, align 8, !tbaa !8
  %58 = icmp sle i64 %56, %57
  br i1 %58, label %60, label %59

59:                                               ; preds = %55
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  br label %115

60:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store i64 0, ptr %5, align 8, !tbaa !8
  br label %61

61:                                               ; preds = %80, %60
  %62 = load i64, ptr %5, align 8, !tbaa !8
  %63 = load i64, ptr @K, align 8, !tbaa !8
  %64 = icmp sle i64 %62, %63
  br i1 %64, label %66, label %65

65:                                               ; preds = %61
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %83

66:                                               ; preds = %61
  %67 = load i64, ptr %5, align 8, !tbaa !8
  %68 = getelementptr inbounds [101 x %struct.lazy_segtree], ptr @LZ_S, i64 0, i64 %67
  %69 = load i64, ptr %3, align 8, !tbaa !8
  %70 = sub nsw i64 %69, 1
  %71 = getelementptr inbounds [35000 x i64], ptr @P, i64 0, i64 %70
  %72 = load i64, ptr %71, align 8, !tbaa !8
  %73 = load i64, ptr %3, align 8, !tbaa !8
  %74 = load i64, ptr %3, align 8, !tbaa !8
  %75 = sub nsw i64 %74, 1
  %76 = getelementptr inbounds [35000 x i64], ptr @P, i64 0, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !8
  %78 = sub nsw i64 %73, %77
  %79 = sub nsw i64 %78, 1
  call void @_ZN12lazy_segtree3addExxxxxx(ptr noundef nonnull align 8 dereferenceable(2240080) %68, i64 noundef 0, i64 noundef %72, i64 noundef %79, i64 noundef 0, i64 noundef 35000, i64 noundef 1)
  br label %80

80:                                               ; preds = %66
  %81 = load i64, ptr %5, align 8, !tbaa !8
  %82 = add nsw i64 %81, 1
  store i64 %82, ptr %5, align 8, !tbaa !8
  br label %61, !llvm.loop !13

83:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 1, ptr %6, align 8, !tbaa !8
  br label %84

84:                                               ; preds = %108, %83
  %85 = load i64, ptr %6, align 8, !tbaa !8
  %86 = load i64, ptr @K, align 8, !tbaa !8
  %87 = icmp sle i64 %85, %86
  br i1 %87, label %89, label %88

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

89:                                               ; preds = %84
  %90 = load i64, ptr %6, align 8, !tbaa !8
  %91 = sub nsw i64 %90, 1
  %92 = getelementptr inbounds [101 x %struct.lazy_segtree], ptr @LZ_S, i64 0, i64 %91
  %93 = load i64, ptr %3, align 8, !tbaa !8
  %94 = sub nsw i64 %93, 1
  %95 = call noundef i64 @_ZN12lazy_segtree3qryExxxxx(ptr noundef nonnull align 8 dereferenceable(2240080) %92, i64 noundef 0, i64 noundef %94, i64 noundef 0, i64 noundef 35000, i64 noundef 1)
  %96 = load i64, ptr %6, align 8, !tbaa !8
  %97 = getelementptr inbounds [101 x [35001 x i64]], ptr @dp, i64 0, i64 %96
  %98 = load i64, ptr %3, align 8, !tbaa !8
  %99 = getelementptr inbounds [35001 x i64], ptr %97, i64 0, i64 %98
  store i64 %95, ptr %99, align 8, !tbaa !8
  %100 = load i64, ptr %6, align 8, !tbaa !8
  %101 = getelementptr inbounds [101 x %struct.lazy_segtree], ptr @LZ_S, i64 0, i64 %100
  %102 = load i64, ptr %3, align 8, !tbaa !8
  %103 = load i64, ptr %6, align 8, !tbaa !8
  %104 = getelementptr inbounds [101 x [35001 x i64]], ptr @dp, i64 0, i64 %103
  %105 = load i64, ptr %3, align 8, !tbaa !8
  %106 = getelementptr inbounds [35001 x i64], ptr %104, i64 0, i64 %105
  %107 = load i64, ptr %106, align 8, !tbaa !8
  call void @_ZN12lazy_segtree3setExxxxx(ptr noundef nonnull align 8 dereferenceable(2240080) %101, i64 noundef %102, i64 noundef %107, i64 noundef 0, i64 noundef 35000, i64 noundef 1)
  br label %108

108:                                              ; preds = %89
  %109 = load i64, ptr %6, align 8, !tbaa !8
  %110 = add nsw i64 %109, 1
  store i64 %110, ptr %6, align 8, !tbaa !8
  br label %84, !llvm.loop !14

111:                                              ; preds = %88
  br label %112

112:                                              ; preds = %111
  %113 = load i64, ptr %3, align 8, !tbaa !8
  %114 = add nsw i64 %113, 1
  store i64 %114, ptr %3, align 8, !tbaa !8
  br label %55, !llvm.loop !15

115:                                              ; preds = %59
  %116 = load i64, ptr @K, align 8, !tbaa !8
  %117 = getelementptr inbounds [101 x [35001 x i64]], ptr @dp, i64 0, i64 %116
  %118 = load i64, ptr @N, align 8, !tbaa !8
  %119 = getelementptr inbounds [35001 x i64], ptr %117, i64 0, i64 %118
  %120 = load i64, ptr %119, align 8, !tbaa !8
  %121 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %120)
  %122 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %121, i8 noundef signext 10)
  %123 = load i32, ptr %1, align 4
  ret i32 %123
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEE4backEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12lazy_segtree3addExxxxxx(ptr noundef nonnull align 8 dereferenceable(2240080), i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef) #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12lazy_segtree3setExxxxx(ptr noundef nonnull align 8 dereferenceable(2240080), i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #5

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

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 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 #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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


; 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" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.lazy_segtree = type { [140005 x i64], [140005 x i64] }
%"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" }

@N = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@A = external dso_local global [35000 x i64], align 16
@P = external dso_local local_unnamed_addr global [35000 x i64], align 16
@dp = external dso_local local_unnamed_addr global [101 x [35001 x i64]], align 16
@O = external dso_local global [35000 x %"class.std::vector"], align 16
@LZ_S = external dso_local global [101 x %struct.lazy_segtree], align 16
@_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 i64, align 8
  %2 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %4
  %6 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %5, ptr noundef null)
  %7 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %8 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %9 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(8) @K)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  store i64 0, ptr %1, align 8, !tbaa !8
  %10 = load i64, ptr @N, align 8, !tbaa !8
  %11 = icmp sgt i64 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %29, %0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  call void @_ZN12lazy_segtree3addExxxxxx(ptr noundef nonnull align 8 dereferenceable(2240080) @LZ_S, i64 noundef 1, i64 noundef 35000, i64 noundef 1000000000000000, i64 noundef 0, i64 noundef 35000, i64 noundef 1)
  %12 = load i64, ptr @N, align 8, !tbaa !8
  %.not35 = icmp slt i64 %12, 1
  %.pre39 = load i64, ptr @K, align 8, !tbaa !8
  br i1 %.not35, label %._crit_edge37, label %.preheader26

.lr.ph:                                           ; preds = %0, %29
  %storemerge27 = phi i64 [ %35, %29 ], [ 0, %0 ]
  %13 = getelementptr inbounds [35000 x i64], ptr @A, i64 0, i64 %storemerge27
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %15 = load i64, ptr %1, align 8, !tbaa !8
  %16 = getelementptr inbounds [35000 x i64], ptr @A, i64 0, i64 %15
  %17 = load i64, ptr %16, align 8, !tbaa !8
  %18 = add nsw i64 %17, -1
  store i64 %18, ptr %16, align 8, !tbaa !8
  %19 = getelementptr inbounds [35000 x %"class.std::vector"], ptr @O, i64 0, i64 %18
  %20 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #6
  %.not25 = icmp eq i64 %20, 0
  %21 = load i64, ptr %1, align 8, !tbaa !8
  br i1 %.not25, label %29, label %22

22:                                               ; preds = %.lr.ph
  %23 = getelementptr inbounds [35000 x i64], ptr @A, i64 0, i64 %21
  %24 = load i64, ptr %23, align 8, !tbaa !8
  %25 = getelementptr inbounds [35000 x %"class.std::vector"], ptr @O, i64 0, i64 %24
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #6
  %27 = load i64, ptr %26, align 8, !tbaa !8
  %28 = load i64, ptr %1, align 8, !tbaa !8
  br label %29

29:                                               ; preds = %.lr.ph, %22
  %.sink46 = phi i64 [ %28, %22 ], [ %21, %.lr.ph ]
  %.sink = phi i64 [ %27, %22 ], [ -2, %.lr.ph ]
  %30 = getelementptr inbounds [35000 x i64], ptr @P, i64 0, i64 %.sink46
  store i64 %.sink, ptr %30, align 8, !tbaa !8
  %31 = getelementptr inbounds [35000 x i64], ptr @A, i64 0, i64 %.sink46
  %32 = load i64, ptr %31, align 8, !tbaa !8
  %33 = getelementptr inbounds [35000 x %"class.std::vector"], ptr @O, i64 0, i64 %32
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %33, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %34 = load i64, ptr %1, align 8, !tbaa !8
  %35 = add nsw i64 %34, 1
  store i64 %35, ptr %1, align 8, !tbaa !8
  %36 = load i64, ptr @N, align 8, !tbaa !8
  %37 = icmp slt i64 %35, %36
  br i1 %37, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader26:                                     ; preds = %._crit_edge, %._crit_edge34
  %38 = phi i64 [ %54, %._crit_edge34 ], [ %.pre39, %._crit_edge ]
  %.02036 = phi i64 [ %55, %._crit_edge34 ], [ 1, %._crit_edge ]
  %.not2328 = icmp slt i64 %38, 0
  br i1 %.not2328, label %._crit_edge34, label %.lr.ph30

.lr.ph30:                                         ; preds = %.preheader26
  %39 = add nsw i64 %.02036, -1
  %40 = getelementptr inbounds [35000 x i64], ptr @P, i64 0, i64 %39
  br label %47

._crit_edge37:                                    ; preds = %._crit_edge34, %._crit_edge
  %41 = phi i64 [ %.pre39, %._crit_edge ], [ %54, %._crit_edge34 ]
  %.lcssa = phi i64 [ %12, %._crit_edge ], [ %56, %._crit_edge34 ]
  %42 = getelementptr inbounds [101 x [35001 x i64]], ptr @dp, i64 0, i64 %41, i64 %.lcssa
  %43 = load i64, ptr %42, align 8, !tbaa !8
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %43)
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %44, i8 noundef signext 10)
  ret i32 0

.preheader:                                       ; preds = %47
  %.not2431 = icmp slt i64 %53, 1
  br i1 %.not2431, label %._crit_edge34, label %.lr.ph33

.lr.ph33:                                         ; preds = %.preheader
  %46 = add nsw i64 %.02036, -1
  br label %57

47:                                               ; preds = %.lr.ph30, %47
  %.01929 = phi i64 [ 0, %.lr.ph30 ], [ %52, %47 ]
  %48 = getelementptr inbounds [101 x %struct.lazy_segtree], ptr @LZ_S, i64 0, i64 %.01929
  %49 = load i64, ptr %40, align 8, !tbaa !8
  %50 = xor i64 %49, -1
  %51 = add i64 %.02036, %50
  call void @_ZN12lazy_segtree3addExxxxxx(ptr noundef nonnull align 8 dereferenceable(2240080) %48, i64 noundef 0, i64 noundef %49, i64 noundef %51, i64 noundef 0, i64 noundef 35000, i64 noundef 1)
  %52 = add nuw nsw i64 %.01929, 1
  %53 = load i64, ptr @K, align 8, !tbaa !8
  %.not23.not = icmp slt i64 %.01929, %53
  br i1 %.not23.not, label %47, label %.preheader, !llvm.loop !13

._crit_edge34:                                    ; preds = %57, %.preheader26, %.preheader
  %54 = phi i64 [ %53, %.preheader ], [ %38, %.preheader26 ], [ %64, %57 ]
  %55 = add nuw nsw i64 %.02036, 1
  %56 = load i64, ptr @N, align 8, !tbaa !8
  %.not.not = icmp slt i64 %.02036, %56
  br i1 %.not.not, label %.preheader26, label %._crit_edge37, !llvm.loop !14

57:                                               ; preds = %.lr.ph33, %57
  %.032 = phi i64 [ 1, %.lr.ph33 ], [ %63, %57 ]
  %58 = add nsw i64 %.032, -1
  %59 = getelementptr inbounds [101 x %struct.lazy_segtree], ptr @LZ_S, i64 0, i64 %58
  %60 = call noundef i64 @_ZN12lazy_segtree3qryExxxxx(ptr noundef nonnull align 8 dereferenceable(2240080) %59, i64 noundef 0, i64 noundef %46, i64 noundef 0, i64 noundef 35000, i64 noundef 1)
  %61 = getelementptr inbounds [101 x [35001 x i64]], ptr @dp, i64 0, i64 %.032, i64 %.02036
  store i64 %60, ptr %61, align 8, !tbaa !8
  %62 = getelementptr inbounds [101 x %struct.lazy_segtree], ptr @LZ_S, i64 0, i64 %.032
  call void @_ZN12lazy_segtree3setExxxxx(ptr noundef nonnull align 8 dereferenceable(2240080) %62, i64 noundef %.02036, i64 noundef %60, i64 noundef 0, i64 noundef 35000, i64 noundef 1)
  %63 = add nuw nsw i64 %.032, 1
  %64 = load i64, ptr @K, align 8, !tbaa !8
  %.not24.not = icmp slt i64 %.032, %64
  br i1 %.not24.not, label %57, label %._crit_edge34, !llvm.loop !15
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEE4backEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12lazy_segtree3addExxxxxx(ptr noundef nonnull align 8 dereferenceable(2240080), i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12lazy_segtree3setExxxxx(ptr noundef nonnull align 8 dereferenceable(2240080), i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #5

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

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 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 #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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


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