; LLVM IR from eyangch/competitive-programming :: Codeforces/1704 (d)

; 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 }
%"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" }

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@C = external dso_local global [100000 x %"class.std::vector"], align 16
@P = external dso_local global [100000 x %"class.std::vector"], align 16
@D = external dso_local global [100000 x %"class.std::vector"], 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 i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %11 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %13
  %15 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %14, ptr noundef null)
  %16 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @T)
  br label %18

18:                                               ; preds = %116, %0
  %19 = load i64, ptr @T, align 8, !tbaa !8
  %20 = add nsw i64 %19, -1
  store i64 %20, ptr @T, align 8, !tbaa !8
  %21 = icmp ne i64 %19, 0
  br i1 %21, label %22, label %123

22:                                               ; preds = %18
  %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) @N)
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(8) @M)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %25

25:                                               ; preds = %68, %22
  %26 = load i64, ptr %2, align 8, !tbaa !8
  %27 = load i64, ptr @N, align 8, !tbaa !8
  %28 = icmp slt i64 %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  store i32 4, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %71

30:                                               ; preds = %25
  %31 = load i64, ptr %2, align 8, !tbaa !8
  %32 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @C, i64 0, i64 %31
  call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %32) #6
  %33 = load i64, ptr %2, align 8, !tbaa !8
  %34 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @P, i64 0, i64 %33
  call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %34) #6
  %35 = load i64, ptr %2, align 8, !tbaa !8
  %36 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @D, i64 0, i64 %35
  call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %36) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 0, ptr %4, align 8, !tbaa !8
  br label %37

37:                                               ; preds = %64, %30
  %38 = load i64, ptr %4, align 8, !tbaa !8
  %39 = load i64, ptr @M, align 8, !tbaa !8
  %40 = icmp slt i64 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  store i32 7, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %67

42:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %43 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %44 = load i64, ptr %2, align 8, !tbaa !8
  %45 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @C, i64 0, i64 %44
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %45, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %46 = load i64, ptr %2, align 8, !tbaa !8
  %47 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @P, i64 0, i64 %46
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %47, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %48 = load i64, ptr %4, align 8, !tbaa !8
  %49 = icmp sgt i64 %48, 0
  br i1 %49, label %50, label %63

50:                                               ; preds = %42
  %51 = load i64, ptr %2, align 8, !tbaa !8
  %52 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @P, i64 0, i64 %51
  %53 = load i64, ptr %4, align 8, !tbaa !8
  %54 = sub nsw i64 %53, 1
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %52, i64 noundef %54) #6
  %56 = load i64, ptr %55, align 8, !tbaa !8
  %57 = load i64, ptr %2, align 8, !tbaa !8
  %58 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @P, i64 0, i64 %57
  %59 = load i64, ptr %4, align 8, !tbaa !8
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %58, i64 noundef %59) #6
  %61 = load i64, ptr %60, align 8, !tbaa !8
  %62 = add nsw i64 %61, %56
  store i64 %62, ptr %60, align 8, !tbaa !8
  br label %63

63:                                               ; preds = %50, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %64

64:                                               ; preds = %63
  %65 = load i64, ptr %4, align 8, !tbaa !8
  %66 = add nsw i64 %65, 1
  store i64 %66, ptr %4, align 8, !tbaa !8
  br label %37, !llvm.loop !11

67:                                               ; preds = %41
  br label %68

68:                                               ; preds = %67
  %69 = load i64, ptr %2, align 8, !tbaa !8
  %70 = add nsw i64 %69, 1
  store i64 %70, ptr %2, align 8, !tbaa !8
  br label %25, !llvm.loop !13

71:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 0, ptr %6, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store i64 0, ptr %7, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 1, ptr %8, align 8, !tbaa !8
  br label %72

72:                                               ; preds = %113, %71
  %73 = load i64, ptr %8, align 8, !tbaa !8
  %74 = load i64, ptr @N, align 8, !tbaa !8
  %75 = icmp slt i64 %73, %74
  br i1 %75, label %77, label %76

76:                                               ; preds = %72
  store i32 10, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %116

77:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 0, ptr %9, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !8
  br label %78

78:                                               ; preds = %95, %77
  %79 = load i64, ptr %10, align 8, !tbaa !8
  %80 = load i64, ptr @M, align 8, !tbaa !8
  %81 = icmp slt i64 %79, %80
  br i1 %81, label %83, label %82

82:                                               ; preds = %78
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %98

83:                                               ; preds = %78
  %84 = load i64, ptr %10, align 8, !tbaa !8
  %85 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @P, i64 noundef %84) #6
  %86 = load i64, ptr %85, align 8, !tbaa !8
  %87 = load i64, ptr %8, align 8, !tbaa !8
  %88 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @P, i64 0, i64 %87
  %89 = load i64, ptr %10, align 8, !tbaa !8
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %88, i64 noundef %89) #6
  %91 = load i64, ptr %90, align 8, !tbaa !8
  %92 = sub nsw i64 %86, %91
  %93 = load i64, ptr %9, align 8, !tbaa !8
  %94 = add nsw i64 %93, %92
  store i64 %94, ptr %9, align 8, !tbaa !8
  br label %95

95:                                               ; preds = %83
  %96 = load i64, ptr %10, align 8, !tbaa !8
  %97 = add nsw i64 %96, 1
  store i64 %97, ptr %10, align 8, !tbaa !8
  br label %78, !llvm.loop !14

98:                                               ; preds = %82
  %99 = load i64, ptr %9, align 8, !tbaa !8
  %100 = icmp slt i64 %99, 0
  br i1 %100, label %101, label %104

101:                                              ; preds = %98
  store i64 1, ptr %6, align 8, !tbaa !8
  %102 = load i64, ptr %9, align 8, !tbaa !8
  %103 = sub nsw i64 0, %102
  store i64 %103, ptr %7, align 8, !tbaa !8
  br label %112

104:                                              ; preds = %98
  %105 = load i64, ptr %9, align 8, !tbaa !8
  %106 = icmp sgt i64 %105, 0
  br i1 %106, label %107, label %111

107:                                              ; preds = %104
  %108 = load i64, ptr %8, align 8, !tbaa !8
  %109 = add nsw i64 %108, 1
  store i64 %109, ptr %6, align 8, !tbaa !8
  %110 = load i64, ptr %9, align 8, !tbaa !8
  store i64 %110, ptr %7, align 8, !tbaa !8
  br label %111

111:                                              ; preds = %107, %104
  br label %112

112:                                              ; preds = %111, %101
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %113

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

116:                                              ; preds = %76
  %117 = load i64, ptr %6, align 8, !tbaa !8
  %118 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %117)
  %119 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %118, i8 noundef signext 32)
  %120 = load i64, ptr %7, align 8, !tbaa !8
  %121 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %119, 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)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %18, !llvm.loop !16

123:                                              ; preds = %18
  %124 = load i32, ptr %1, align 4
  ret i32 %124
}

; 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 void @_ZNSt6vectorIxSaIxEE5clearEv(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: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 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: 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}
!16 = distinct !{!16, !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 }
%"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" }

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@C = external dso_local global [100000 x %"class.std::vector"], align 16
@P = external dso_local global [100000 x %"class.std::vector"], align 16
@D = external dso_local global [100000 x %"class.std::vector"], 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) @T)
  %9 = load i64, ptr @T, align 8, !tbaa !8
  %10 = add nsw i64 %9, -1
  store i64 %10, ptr @T, align 8, !tbaa !8
  %.not56 = icmp eq i64 %9, 0
  br i1 %.not56, label %._crit_edge59, label %.lr.ph58

.lr.ph58:                                         ; preds = %0, %._crit_edge52
  %11 = 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)
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %13 = load i64, ptr @N, align 8, !tbaa !8
  %14 = icmp sgt i64 %13, 0
  br i1 %14, label %.lr.ph44, label %._crit_edge52

.preheader40:                                     ; preds = %._crit_edge
  %15 = icmp sgt i64 %27, 1
  %16 = load i64, ptr @M, align 8
  %17 = icmp sgt i64 %16, 0
  %or.cond = select i1 %15, i1 %17, i1 false
  br i1 %or.cond, label %.preheader, label %._crit_edge52

.lr.ph44:                                         ; preds = %.lr.ph58, %._crit_edge
  %.03642 = phi i64 [ %26, %._crit_edge ], [ 0, %.lr.ph58 ]
  %18 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @C, i64 0, i64 %.03642
  call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %18) #6
  %19 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @P, i64 0, i64 %.03642
  call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #6
  %20 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @D, i64 0, i64 %.03642
  call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #6
  %21 = load i64, ptr @M, align 8, !tbaa !8
  %22 = icmp sgt i64 %21, 0
  br i1 %22, label %23, label %._crit_edge

23:                                               ; preds = %.lr.ph44
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %24 = 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)
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %18, ptr noundef nonnull align 8 dereferenceable(8) %1)
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %.pre = load i64, ptr @M, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  %25 = icmp sgt i64 %.pre, 1
  br i1 %25, label %.lr.ph.peel.next, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.peel.next, %23, %.lr.ph44
  %26 = add nuw nsw i64 %.03642, 1
  %27 = load i64, ptr @N, align 8, !tbaa !8
  %28 = icmp slt i64 %26, %27
  br i1 %28, label %.lr.ph44, label %.preheader40, !llvm.loop !11

.lr.ph.peel.next:                                 ; preds = %23, %.lr.ph.peel.next
  %.03541 = phi i64 [ %36, %.lr.ph.peel.next ], [ 1, %23 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %29 = 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)
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %18, ptr noundef nonnull align 8 dereferenceable(8) %1)
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %30 = add nsw i64 %.03541, -1
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %19, i64 noundef %30) #6
  %32 = load i64, ptr %31, align 8, !tbaa !8
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %19, i64 noundef %.03541) #6
  %34 = load i64, ptr %33, align 8, !tbaa !8
  %35 = add nsw i64 %34, %32
  store i64 %35, ptr %33, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  %36 = add nuw nsw i64 %.03541, 1
  %37 = load i64, ptr @M, align 8, !tbaa !8
  %38 = icmp slt i64 %36, %37
  br i1 %38, label %.lr.ph.peel.next, label %._crit_edge, !llvm.loop !13

.preheader:                                       ; preds = %.preheader40, %63
  %39 = phi i64 [ %64, %63 ], [ %16, %.preheader40 ]
  %.03151 = phi i64 [ %.pre-phi, %63 ], [ 1, %.preheader40 ]
  %.03250 = phi i64 [ %.1, %63 ], [ 0, %.preheader40 ]
  %.03349 = phi i64 [ %.134, %63 ], [ 0, %.preheader40 ]
  %40 = icmp sgt i64 %39, 0
  br i1 %40, label %.lr.ph47, label %._crit_edge48.thread

.lr.ph47:                                         ; preds = %.preheader
  %41 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @P, i64 0, i64 %.03151
  br label %49

._crit_edge52:                                    ; preds = %63, %.lr.ph58, %.preheader40
  %.033.lcssa = phi i64 [ 0, %.preheader40 ], [ 0, %.lr.ph58 ], [ %.134, %63 ]
  %.032.lcssa = phi i64 [ 0, %.preheader40 ], [ 0, %.lr.ph58 ], [ %.1, %63 ]
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.033.lcssa)
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %42, i8 noundef signext 32)
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %43, i64 noundef %.032.lcssa)
  %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)
  %46 = load i64, ptr @T, align 8, !tbaa !8
  %47 = add nsw i64 %46, -1
  store i64 %47, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %46, 0
  br i1 %.not, label %._crit_edge59, label %.lr.ph58, !llvm.loop !15

._crit_edge48:                                    ; preds = %49
  %48 = icmp slt i64 %55, 0
  br i1 %48, label %59, label %._crit_edge48.thread

49:                                               ; preds = %.lr.ph47, %49
  %.046 = phi i64 [ 0, %.lr.ph47 ], [ %56, %49 ]
  %.03045 = phi i64 [ 0, %.lr.ph47 ], [ %55, %49 ]
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @P, i64 noundef %.046) #6
  %51 = load i64, ptr %50, align 8, !tbaa !8
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %41, i64 noundef %.046) #6
  %53 = load i64, ptr %52, align 8, !tbaa !8
  %54 = add i64 %51, %.03045
  %55 = sub i64 %54, %53
  %56 = add nuw nsw i64 %.046, 1
  %57 = load i64, ptr @M, align 8, !tbaa !8
  %58 = icmp slt i64 %56, %57
  br i1 %58, label %49, label %._crit_edge48, !llvm.loop !16

59:                                               ; preds = %._crit_edge48
  %60 = sub nsw i64 0, %55
  %.pre62 = add nuw nsw i64 %.03151, 1
  br label %63

._crit_edge48.thread:                             ; preds = %.preheader, %._crit_edge48
  %.030.lcssa64 = phi i64 [ %55, %._crit_edge48 ], [ 0, %.preheader ]
  %61 = phi i64 [ %57, %._crit_edge48 ], [ %39, %.preheader ]
  %.not37 = icmp eq i64 %.030.lcssa64, 0
  %62 = add nuw nsw i64 %.03151, 1
  %spec.select = select i1 %.not37, i64 %.03349, i64 %62
  %spec.select39 = select i1 %.not37, i64 %.03250, i64 %.030.lcssa64
  br label %63

63:                                               ; preds = %._crit_edge48.thread, %59
  %64 = phi i64 [ %61, %._crit_edge48.thread ], [ %57, %59 ]
  %.pre-phi = phi i64 [ %62, %._crit_edge48.thread ], [ %.pre62, %59 ]
  %.134 = phi i64 [ %spec.select, %._crit_edge48.thread ], [ 1, %59 ]
  %.1 = phi i64 [ %spec.select39, %._crit_edge48.thread ], [ %60, %59 ]
  %65 = load i64, ptr @N, align 8, !tbaa !8
  %66 = icmp slt i64 %.pre-phi, %65
  br i1 %66, label %.preheader, label %._crit_edge52, !llvm.loop !17

._crit_edge59:                                    ; preds = %._crit_edge52, %0
  ret i32 0
}

; 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 void @_ZNSt6vectorIxSaIxEE5clearEv(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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 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: 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}
!14 = !{!"llvm.loop.peeled.count", i32 1}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12, !18}
!18 = !{!"llvm.loop.unswitch.partial.disable"}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass