; LLVM IR from Aryansh-S/USACO :: USACO/2018/Dec/Gold (finedining)

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

%struct.D = type { [200005 x %"class.std::vector"], [200005 x i64] }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_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 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@d1 = external dso_local global %struct.D, align 8
@d2 = external dso_local global %struct.D, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i8, align 1
  store i32 0, ptr %1, align 4
  %12 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %13 = getelementptr i8, ptr %12, i64 -24
  %14 = load i64, ptr %13, align 8
  %15 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %14
  %16 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %15, ptr noundef null)
  %17 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %18 = call noalias ptr @fopen(ptr noundef @.str, ptr noundef @.str.3)
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %25

20:                                               ; preds = %0
  %21 = load ptr, ptr @stdin, align 8, !tbaa !8
  %22 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.3, ptr noundef %21)
  %23 = load ptr, ptr @stdout, align 8, !tbaa !8
  %24 = call ptr @freopen(ptr noundef @.str.4, ptr noundef @.str.5, ptr noundef %23)
  br label %25

25:                                               ; preds = %20, %0
  call void @_Z2reIRiJS0_S0_EEvOT_DpOT0_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) @m, ptr noundef nonnull align 4 dereferenceable(4) @k)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !11
  br label %26

26:                                               ; preds = %52, %25
  %27 = load i32, ptr %2, align 4, !tbaa !11
  %28 = load i32, ptr @m, align 4, !tbaa !11
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %55

31:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @_Z2reIRiJS0_RxEEvOT_DpOT0_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %32 = load i32, ptr %3, align 4, !tbaa !11
  %33 = add nsw i32 %32, -1
  store i32 %33, ptr %3, align 4, !tbaa !11
  %34 = load i32, ptr %4, align 4, !tbaa !11
  %35 = add nsw i32 %34, -1
  store i32 %35, ptr %4, align 4, !tbaa !11
  %36 = load i32, ptr %3, align 4, !tbaa !11
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [200005 x %"class.std::vector"], ptr @d1, i64 0, i64 %37
  %39 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIxiESaIS1_EE12emplace_backIJRxRiEEERS1_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %38, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %40 = load i32, ptr %4, align 4, !tbaa !11
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [200005 x %"class.std::vector"], ptr @d1, i64 0, i64 %41
  %43 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIxiESaIS1_EE12emplace_backIJRxRiEEERS1_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %42, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %44 = load i32, ptr %3, align 4, !tbaa !11
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [200005 x %"class.std::vector"], ptr @d2, i64 0, i64 %45
  %47 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIxiESaIS1_EE12emplace_backIJRxRiEEERS1_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %46, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %48 = load i32, ptr %4, align 4, !tbaa !11
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [200005 x %"class.std::vector"], ptr @d2, i64 0, i64 %49
  %51 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIxiESaIS1_EE12emplace_backIJRxRiEEERS1_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %50, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %52

52:                                               ; preds = %31
  %53 = load i32, ptr %2, align 4, !tbaa !11
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %2, align 4, !tbaa !11
  br label %26, !llvm.loop !13

55:                                               ; preds = %30
  %56 = load i32, ptr @n, align 4, !tbaa !11
  %57 = sub nsw i32 %56, 1
  call void @_ZN1D3updEi(ptr noundef nonnull align 8 dereferenceable(6400160) @d1, i32 noundef %57)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %58

58:                                               ; preds = %77, %55
  %59 = load i32, ptr %6, align 4, !tbaa !11
  %60 = load i32, ptr @k, align 4, !tbaa !11
  %61 = icmp slt i32 %59, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %80

63:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @_Z2reIRiJS0_EEvOT_DpOT0_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %64 = load i32, ptr %7, align 4, !tbaa !11
  %65 = add nsw i32 %64, -1
  store i32 %65, ptr %7, align 4, !tbaa !11
  %66 = load i32, ptr @n, align 4, !tbaa !11
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [200005 x %"class.std::vector"], ptr @d2, i64 0, i64 %67
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %69 = load i32, ptr %7, align 4, !tbaa !11
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [200005 x i64], ptr getelementptr inbounds (%struct.D, ptr @d1, i32 0, i32 1), i64 0, i64 %70
  %72 = load i64, ptr %71, align 8, !tbaa !15
  %73 = load i32, ptr %8, align 4, !tbaa !11
  %74 = sext i32 %73 to i64
  %75 = sub nsw i64 %72, %74
  store i64 %75, ptr %9, align 8, !tbaa !15
  %76 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIxiESaIS1_EE12emplace_backIJxRiEEERS1_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %68, ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %77

77:                                               ; preds = %63
  %78 = load i32, ptr %6, align 4, !tbaa !11
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %6, align 4, !tbaa !11
  br label %58, !llvm.loop !17

80:                                               ; preds = %62
  %81 = load i32, ptr @n, align 4, !tbaa !11
  call void @_ZN1D3updEi(ptr noundef nonnull align 8 dereferenceable(6400160) @d2, i32 noundef %81)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !11
  br label %82

82:                                               ; preds = %99, %80
  %83 = load i32, ptr %10, align 4, !tbaa !11
  %84 = load i32, ptr @n, align 4, !tbaa !11
  %85 = sub nsw i32 %84, 1
  %86 = icmp slt i32 %83, %85
  br i1 %86, label %88, label %87

87:                                               ; preds = %82
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %102

88:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #5
  %89 = load i32, ptr %10, align 4, !tbaa !11
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [200005 x i64], ptr getelementptr inbounds (%struct.D, ptr @d2, i32 0, i32 1), i64 0, i64 %90
  %92 = load i64, ptr %91, align 8, !tbaa !15
  %93 = load i32, ptr %10, align 4, !tbaa !11
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [200005 x i64], ptr getelementptr inbounds (%struct.D, ptr @d1, i32 0, i32 1), i64 0, i64 %94
  %96 = load i64, ptr %95, align 8, !tbaa !15
  %97 = icmp sle i64 %92, %96
  %98 = zext i1 %97 to i8
  store i8 %98, ptr %11, align 1, !tbaa !18
  call void @_Z2prIbJEEvOT_DpOT0_(ptr noundef nonnull align 1 dereferenceable(1) %11)
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #5
  br label %99

99:                                               ; preds = %88
  %100 = load i32, ptr %10, align 4, !tbaa !11
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %10, align 4, !tbaa !11
  br label %82, !llvm.loop !20

102:                                              ; preds = %87
  %103 = load i32, ptr %1, align 4
  ret i32 %103
}

; 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

declare noalias ptr @fopen(ptr noundef, ptr noundef) #2

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2reIRiJS0_S0_EEvOT_DpOT0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIxiESaIS1_EE12emplace_backIJRxRiEEERS1_DpOT_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #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 @_ZN1D3updEi(ptr noundef nonnull align 8 dereferenceable(6400160), i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2reIRiJS0_EEvOT_DpOT0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2prIbJEEvOT_DpOT0_(ptr noundef nonnull align 1 dereferenceable(1)) #3

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { 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 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !10, i64 0}
!17 = distinct !{!17, !14}
!18 = !{!19, !19, i64 0}
!19 = !{!"bool", !10, i64 0}
!20 = distinct !{!20, !14}


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

%struct.D = type { [200005 x %"class.std::vector"], [200005 x i64] }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<long long, int>, std::allocator<std::pair<long long, int>>>::_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 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@d1 = external dso_local global %struct.D, align 8
@d2 = external dso_local global %struct.D, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i8, align 1
  %8 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %9 = getelementptr i8, ptr %8, i64 -24
  %10 = load i64, ptr %9, align 8
  %11 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %10
  %12 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %11, ptr noundef null)
  %13 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %14 = tail call noalias ptr @fopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.3)
  %.not = icmp eq ptr %14, null
  br i1 %.not, label %20, label %15

15:                                               ; preds = %0
  %16 = load ptr, ptr @stdin, align 8, !tbaa !8
  %17 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.3, ptr noundef %16)
  %18 = load ptr, ptr @stdout, align 8, !tbaa !8
  %19 = tail call ptr @freopen(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.5, ptr noundef %18)
  br label %20

20:                                               ; preds = %15, %0
  tail call void @_Z2reIRiJS0_S0_EEvOT_DpOT0_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) @m, ptr noundef nonnull align 4 dereferenceable(4) @k)
  %21 = load i32, ptr @m, align 4, !tbaa !11
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %20
  %23 = load i32, ptr @n, align 4, !tbaa !11
  %24 = add nsw i32 %23, -1
  call void @_ZN1D3updEi(ptr noundef nonnull align 8 dereferenceable(6400160) @d1, i32 noundef %24)
  %25 = load i32, ptr @k, align 4, !tbaa !11
  %26 = icmp sgt i32 %25, 0
  br i1 %26, label %.lr.ph14, label %._crit_edge15

.lr.ph:                                           ; preds = %20, %.lr.ph
  %.01011 = phi i32 [ %46, %.lr.ph ], [ 0, %20 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  call void @_Z2reIRiJS0_RxEEvOT_DpOT0_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %27 = load i32, ptr %1, align 4, !tbaa !11
  %28 = add nsw i32 %27, -1
  store i32 %28, ptr %1, align 4, !tbaa !11
  %29 = load i32, ptr %2, align 4, !tbaa !11
  %30 = add nsw i32 %29, -1
  store i32 %30, ptr %2, align 4, !tbaa !11
  %31 = sext i32 %28 to i64
  %32 = getelementptr inbounds [200005 x %"class.std::vector"], ptr @d1, i64 0, i64 %31
  %33 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIxiESaIS1_EE12emplace_backIJRxRiEEERS1_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %32, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %34 = load i32, ptr %2, align 4, !tbaa !11
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [200005 x %"class.std::vector"], ptr @d1, i64 0, i64 %35
  %37 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIxiESaIS1_EE12emplace_backIJRxRiEEERS1_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %36, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %38 = load i32, ptr %1, align 4, !tbaa !11
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [200005 x %"class.std::vector"], ptr @d2, i64 0, i64 %39
  %41 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIxiESaIS1_EE12emplace_backIJRxRiEEERS1_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %40, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %42 = load i32, ptr %2, align 4, !tbaa !11
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [200005 x %"class.std::vector"], ptr @d2, i64 0, i64 %43
  %45 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIxiESaIS1_EE12emplace_backIJRxRiEEERS1_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %44, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %46 = add nuw nsw i32 %.01011, 1
  %47 = load i32, ptr @m, align 4, !tbaa !11
  %48 = icmp slt i32 %46, %47
  br i1 %48, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge15:                                    ; preds = %.lr.ph14, %._crit_edge
  %49 = load i32, ptr @n, align 4, !tbaa !11
  call void @_ZN1D3updEi(ptr noundef nonnull align 8 dereferenceable(6400160) @d2, i32 noundef %49)
  %50 = load i32, ptr @n, align 4, !tbaa !11
  %51 = icmp sgt i32 %50, 1
  br i1 %51, label %.lr.ph18, label %._crit_edge19

.lr.ph14:                                         ; preds = %._crit_edge, %.lr.ph14
  %.0912 = phi i32 [ %64, %.lr.ph14 ], [ 0, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  call void @_Z2reIRiJS0_EEvOT_DpOT0_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %52 = load i32, ptr %4, align 4, !tbaa !11
  %53 = add nsw i32 %52, -1
  store i32 %53, ptr %4, align 4, !tbaa !11
  %54 = load i32, ptr @n, align 4, !tbaa !11
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [200005 x %"class.std::vector"], ptr @d2, i64 0, i64 %55
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %57 = sext i32 %53 to i64
  %58 = getelementptr inbounds [200005 x i64], ptr getelementptr inbounds (i8, ptr @d1, i64 4800120), i64 0, i64 %57
  %59 = load i64, ptr %58, align 8, !tbaa !15
  %60 = load i32, ptr %5, align 4, !tbaa !11
  %61 = sext i32 %60 to i64
  %62 = sub nsw i64 %59, %61
  store i64 %62, ptr %6, align 8, !tbaa !15
  %63 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIxiESaIS1_EE12emplace_backIJxRiEEERS1_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %56, ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %64 = add nuw nsw i32 %.0912, 1
  %65 = load i32, ptr @k, align 4, !tbaa !11
  %66 = icmp slt i32 %64, %65
  br i1 %66, label %.lr.ph14, label %._crit_edge15, !llvm.loop !17

._crit_edge19:                                    ; preds = %.lr.ph18, %._crit_edge15
  ret i32 0

.lr.ph18:                                         ; preds = %._crit_edge15, %.lr.ph18
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph18 ], [ 0, %._crit_edge15 ]
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %7) #6
  %67 = getelementptr inbounds [200005 x i64], ptr getelementptr inbounds (i8, ptr @d2, i64 4800120), i64 0, i64 %indvars.iv
  %68 = load i64, ptr %67, align 8, !tbaa !15
  %69 = getelementptr inbounds [200005 x i64], ptr getelementptr inbounds (i8, ptr @d1, i64 4800120), i64 0, i64 %indvars.iv
  %70 = load i64, ptr %69, align 8, !tbaa !15
  %71 = icmp sle i64 %68, %70
  %72 = zext i1 %71 to i8
  store i8 %72, ptr %7, align 1, !tbaa !18
  call void @_Z2prIbJEEvOT_DpOT0_(ptr noundef nonnull align 1 dereferenceable(1) %7)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %73 = load i32, ptr @n, align 4, !tbaa !11
  %74 = add nsw i32 %73, -1
  %75 = sext i32 %74 to i64
  %76 = icmp slt i64 %indvars.iv.next, %75
  br i1 %76, label %.lr.ph18, label %._crit_edge19, !llvm.loop !20
}

; 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: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #3

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIxiESaIS1_EE12emplace_backIJRxRiEEERS1_DpOT_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN1D3updEi(ptr noundef nonnull align 8 dereferenceable(6400160), i32 noundef) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIxiESaIS1_EE12emplace_backIJxRiEEERS1_DpOT_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4 align 2

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

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 = { nofree nounwind "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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !10, i64 0}
!17 = distinct !{!17, !14}
!18 = !{!19, !19, i64 0}
!19 = !{!"bool", !10, i64 0}
!20 = distinct !{!20, !14}


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