; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/344 Division 2/Problem D (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::basic_ostream" = type { ptr, %"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::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<long long, char>, std::allocator<std::pair<long long, char>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<long long, char>, std::allocator<std::pair<long long, char>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<long long, char>, std::allocator<std::pair<long long, char>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<long long, char>, std::allocator<std::pair<long long, char>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"struct.std::pair.8" = type <{ i32, i8, [3 x i8] }>
%"struct.std::pair" = type <{ i64, i8, [7 x i8] }>

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@answer = external dso_local global i64, align 8
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@_Z1tB5cxx11 = external dso_local global %"class.std::vector.0", align 8
@_Z1sB5cxx11 = external dso_local global %"class.std::vector.0", align 8
@x = external dso_local global %"class.std::vector", align 8
@y = external dso_local global %"class.std::vector", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #1

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5matchRSt6vectorISt4pairIxcESaIS1_EES4_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #2

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair.8", align 4
  %5 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %6 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %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 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %13 = getelementptr i8, ptr %12, i64 -24
  %14 = load i64, ptr %13, align 8
  %15 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %14
  %16 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %15, ptr noundef null)
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %19 = load i32, ptr @n, align 4, !tbaa !8
  %20 = sext i32 %19 to i64
  call void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z1tB5cxx11, i64 noundef %20)
  %21 = load i32, ptr @m, align 4, !tbaa !8
  %22 = sext i32 %21 to i64
  call void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z1sB5cxx11, i64 noundef %22)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %23

23:                                               ; preds = %33, %0
  %24 = load i32, ptr %2, align 4, !tbaa !8
  %25 = load i32, ptr @n, align 4, !tbaa !8
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %36

28:                                               ; preds = %23
  %29 = load i32, ptr %2, align 4, !tbaa !8
  %30 = sext i32 %29 to i64
  %31 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z1tB5cxx11, i64 noundef %30) #6
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %31)
  br label %33

33:                                               ; preds = %28
  %34 = load i32, ptr %2, align 4, !tbaa !8
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %2, align 4, !tbaa !8
  br label %23, !llvm.loop !11

36:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !8
  br label %37

37:                                               ; preds = %47, %36
  %38 = load i32, ptr %3, align 4, !tbaa !8
  %39 = load i32, ptr @m, align 4, !tbaa !8
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %50

42:                                               ; preds = %37
  %43 = load i32, ptr %3, align 4, !tbaa !8
  %44 = sext i32 %43 to i64
  %45 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z1sB5cxx11, i64 noundef %44) #6
  %46 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %45)
  br label %47

47:                                               ; preds = %42
  %48 = load i32, ptr %3, align 4, !tbaa !8
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %3, align 4, !tbaa !8
  br label %37, !llvm.loop !13

50:                                               ; preds = %41
  call void @_Z5parseRSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EERS_ISt4pairIxcESaISA_EE(ptr noundef nonnull align 8 dereferenceable(24) @_Z1tB5cxx11, ptr noundef nonnull align 8 dereferenceable(24) @x)
  call void @_Z5parseRSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EERS_ISt4pairIxcESaISA_EE(ptr noundef nonnull align 8 dereferenceable(24) @_Z1sB5cxx11, ptr noundef nonnull align 8 dereferenceable(24) @y)
  %51 = call noundef i64 @_ZNKSt6vectorISt4pairIxcESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @y) #6
  %52 = icmp ugt i64 %51, 1
  br i1 %52, label %53, label %55

53:                                               ; preds = %50
  call void @_Z7build_fRSt6vectorISt4pairIxcESaIS1_EE(ptr noundef nonnull align 8 dereferenceable(24) @y)
  %54 = call noundef zeroext i1 @_Z5matchRSt6vectorISt4pairIxcESaIS1_EES4_(ptr noundef nonnull align 8 dereferenceable(24) @y, ptr noundef nonnull align 8 dereferenceable(24) @x)
  br label %106

55:                                               ; preds = %50
  %56 = call noundef i64 @_ZNKSt6vectorISt4pairIxcESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @y) #6
  %57 = icmp eq i64 %56, 1
  br i1 %57, label %58, label %105

58:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %59 = call noundef nonnull align 8 dereferenceable(9) ptr @_ZNSt6vectorISt4pairIxcESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @y, i64 noundef 0) #6
  call void @_ZNSt4pairIicEC2IxcTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE18_ConstructiblePairIS3_S4_EEclsr6_PCCFPIS3_S4_EE26_ImplicitlyConvertiblePairIS3_S4_EEEbE4typeELb1EEERKS_IS3_S4_E(ptr noundef nonnull align 4 dereferenceable(5) %4, ptr noundef nonnull align 8 dereferenceable(9) %59)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !8
  br label %60

60:                                               ; preds = %101, %58
  %61 = load i32, ptr %5, align 4, !tbaa !8
  %62 = sext i32 %61 to i64
  %63 = call noundef i64 @_ZNKSt6vectorISt4pairIxcESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @x) #6
  %64 = icmp ult i64 %62, %63
  br i1 %64, label %66, label %65

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

66:                                               ; preds = %60
  %67 = getelementptr inbounds %"struct.std::pair.8", ptr %4, i32 0, i32 1
  %68 = load i8, ptr %67, align 4, !tbaa !14
  %69 = sext i8 %68 to i32
  %70 = load i32, ptr %5, align 4, !tbaa !8
  %71 = sext i32 %70 to i64
  %72 = call noundef nonnull align 8 dereferenceable(9) ptr @_ZNSt6vectorISt4pairIxcESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @x, i64 noundef %71) #6
  %73 = getelementptr inbounds %"struct.std::pair", ptr %72, i32 0, i32 1
  %74 = load i8, ptr %73, align 8, !tbaa !16
  %75 = sext i8 %74 to i32
  %76 = icmp eq i32 %69, %75
  br i1 %76, label %77, label %100

77:                                               ; preds = %66
  %78 = getelementptr inbounds %"struct.std::pair.8", ptr %4, i32 0, i32 0
  %79 = load i32, ptr %78, align 4, !tbaa !19
  %80 = sext i32 %79 to i64
  %81 = load i32, ptr %5, align 4, !tbaa !8
  %82 = sext i32 %81 to i64
  %83 = call noundef nonnull align 8 dereferenceable(9) ptr @_ZNSt6vectorISt4pairIxcESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @x, i64 noundef %82) #6
  %84 = getelementptr inbounds %"struct.std::pair", ptr %83, i32 0, i32 0
  %85 = load i64, ptr %84, align 8, !tbaa !20
  %86 = icmp sle i64 %80, %85
  br i1 %86, label %87, label %100

87:                                               ; preds = %77
  %88 = load i32, ptr %5, align 4, !tbaa !8
  %89 = sext i32 %88 to i64
  %90 = call noundef nonnull align 8 dereferenceable(9) ptr @_ZNSt6vectorISt4pairIxcESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @x, i64 noundef %89) #6
  %91 = getelementptr inbounds %"struct.std::pair", ptr %90, i32 0, i32 0
  %92 = load i64, ptr %91, align 8, !tbaa !20
  %93 = getelementptr inbounds %"struct.std::pair.8", ptr %4, i32 0, i32 0
  %94 = load i32, ptr %93, align 4, !tbaa !19
  %95 = sext i32 %94 to i64
  %96 = sub nsw i64 %92, %95
  %97 = add nsw i64 %96, 1
  %98 = load i64, ptr @answer, align 8, !tbaa !21
  %99 = add nsw i64 %98, %97
  store i64 %99, ptr @answer, align 8, !tbaa !21
  br label %100

100:                                              ; preds = %87, %77, %66
  br label %101

101:                                              ; preds = %100
  %102 = load i32, ptr %5, align 4, !tbaa !8
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %5, align 4, !tbaa !8
  br label %60, !llvm.loop !22

104:                                              ; preds = %65
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %105

105:                                              ; preds = %104, %55
  br label %106

106:                                              ; preds = %105, %53
  %107 = load i64, ptr @answer, align 8, !tbaa !21
  %108 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %107)
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %108, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #5

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIicEC2IxcTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE18_ConstructiblePairIS3_S4_EEclsr6_PCCFPIS3_S4_EE26_ImplicitlyConvertiblePairIS3_S4_EEEbE4typeELb1EEERKS_IS3_S4_E(ptr noundef nonnull align 4 dereferenceable(5), ptr noundef nonnull align 8 dereferenceable(9)) unnamed_addr #2 align 2

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

attributes #0 = { 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 #1 = { 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 #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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { "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 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !10, i64 4}
!15 = !{!"_ZTSSt4pairIicE", !9, i64 0, !10, i64 4}
!16 = !{!17, !10, i64 8}
!17 = !{!"_ZTSSt4pairIxcE", !18, i64 0, !10, i64 8}
!18 = !{!"long long", !10, i64 0}
!19 = !{!15, !9, i64 0}
!20 = !{!17, !18, i64 0}
!21 = !{!18, !18, i64 0}
!22 = distinct !{!22, !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::basic_ostream" = type { ptr, %"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::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<long long, char>, std::allocator<std::pair<long long, char>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<long long, char>, std::allocator<std::pair<long long, char>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<long long, char>, std::allocator<std::pair<long long, char>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<long long, char>, std::allocator<std::pair<long long, char>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"struct.std::pair.8" = type <{ i32, i8, [3 x i8] }>

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@answer = external dso_local local_unnamed_addr global i64, align 8
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@_Z1tB5cxx11 = external dso_local global %"class.std::vector.0", align 8
@_Z1sB5cxx11 = external dso_local global %"class.std::vector.0", align 8
@x = external dso_local global %"class.std::vector", align 8
@y = external dso_local global %"class.std::vector", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #1

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5matchRSt6vectorISt4pairIxcESaIS1_EES4_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca %"struct.std::pair.8", align 4
  %2 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %3 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %4 = getelementptr i8, ptr %3, i64 -24
  %5 = load i64, ptr %4, align 8
  %6 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %5
  %7 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %6, ptr noundef null)
  %8 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %9 = getelementptr i8, ptr %8, i64 -24
  %10 = load i64, ptr %9, align 8
  %11 = getelementptr inbounds i8, ptr @_ZSt4cout, 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 nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %14 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %15 = load i32, ptr @n, align 4, !tbaa !8
  %16 = sext i32 %15 to i64
  tail call void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z1tB5cxx11, i64 noundef %16)
  %17 = load i32, ptr @m, align 4, !tbaa !8
  %18 = sext i32 %17 to i64
  tail call void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z1sB5cxx11, i64 noundef %18)
  %19 = load i32, ptr @n, align 4, !tbaa !8
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph, label %.preheader

.preheader:                                       ; preds = %.lr.ph, %0
  %21 = load i32, ptr @m, align 4, !tbaa !8
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.lr.ph16, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %23 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z1tB5cxx11, i64 noundef %indvars.iv) #6
  %24 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %23)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %25 = load i32, ptr @n, align 4, !tbaa !8
  %26 = sext i32 %25 to i64
  %27 = icmp slt i64 %indvars.iv.next, %26
  br i1 %27, label %.lr.ph, label %.preheader, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph16, %.preheader
  tail call void @_Z5parseRSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EERS_ISt4pairIxcESaISA_EE(ptr noundef nonnull align 8 dereferenceable(24) @_Z1tB5cxx11, ptr noundef nonnull align 8 dereferenceable(24) @x)
  tail call void @_Z5parseRSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EERS_ISt4pairIxcESaISA_EE(ptr noundef nonnull align 8 dereferenceable(24) @_Z1sB5cxx11, ptr noundef nonnull align 8 dereferenceable(24) @y)
  %28 = tail call noundef i64 @_ZNKSt6vectorISt4pairIxcESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @y) #6
  %29 = icmp ugt i64 %28, 1
  br i1 %29, label %35, label %37

.lr.ph16:                                         ; preds = %.preheader, %.lr.ph16
  %indvars.iv23 = phi i64 [ %indvars.iv.next24, %.lr.ph16 ], [ 0, %.preheader ]
  %30 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z1sB5cxx11, i64 noundef %indvars.iv23) #6
  %31 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %30)
  %indvars.iv.next24 = add nuw nsw i64 %indvars.iv23, 1
  %32 = load i32, ptr @m, align 4, !tbaa !8
  %33 = sext i32 %32 to i64
  %34 = icmp slt i64 %indvars.iv.next24, %33
  br i1 %34, label %.lr.ph16, label %._crit_edge, !llvm.loop !13

35:                                               ; preds = %._crit_edge
  tail call void @_Z7build_fRSt6vectorISt4pairIxcESaIS1_EE(ptr noundef nonnull align 8 dereferenceable(24) @y)
  %36 = tail call noundef zeroext i1 @_Z5matchRSt6vectorISt4pairIxcESaIS1_EES4_(ptr noundef nonnull align 8 dereferenceable(24) @y, ptr noundef nonnull align 8 dereferenceable(24) @x)
  br label %67

37:                                               ; preds = %._crit_edge
  %38 = tail call noundef i64 @_ZNKSt6vectorISt4pairIxcESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @y) #6
  %39 = icmp eq i64 %38, 1
  br i1 %39, label %40, label %67

40:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %41 = tail call noundef nonnull align 8 dereferenceable(9) ptr @_ZNSt6vectorISt4pairIxcESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @y, i64 noundef 0) #6
  call void @_ZNSt4pairIicEC2IxcTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE18_ConstructiblePairIS3_S4_EEclsr6_PCCFPIS3_S4_EE26_ImplicitlyConvertiblePairIS3_S4_EEEbE4typeELb1EEERKS_IS3_S4_E(ptr noundef nonnull align 4 dereferenceable(5) %1, ptr noundef nonnull align 8 dereferenceable(9) %41)
  %42 = call noundef i64 @_ZNKSt6vectorISt4pairIxcESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @x) #6
  %.not21 = icmp eq i64 %42, 0
  br i1 %.not21, label %._crit_edge20, label %.lr.ph19

.lr.ph19:                                         ; preds = %40
  %43 = getelementptr inbounds i8, ptr %1, i64 4
  br label %44

._crit_edge20:                                    ; preds = %64, %40
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  br label %67

44:                                               ; preds = %.lr.ph19, %64
  %indvars.iv26 = phi i64 [ 0, %.lr.ph19 ], [ %indvars.iv.next27, %64 ]
  %45 = load i8, ptr %43, align 4, !tbaa !14
  %46 = call noundef nonnull align 8 dereferenceable(9) ptr @_ZNSt6vectorISt4pairIxcESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @x, i64 noundef %indvars.iv26) #6
  %47 = getelementptr inbounds i8, ptr %46, i64 8
  %48 = load i8, ptr %47, align 8, !tbaa !16
  %49 = icmp eq i8 %45, %48
  br i1 %49, label %50, label %64

50:                                               ; preds = %44
  %51 = load i32, ptr %1, align 4, !tbaa !19
  %52 = sext i32 %51 to i64
  %53 = call noundef nonnull align 8 dereferenceable(9) ptr @_ZNSt6vectorISt4pairIxcESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @x, i64 noundef %indvars.iv26) #6
  %54 = load i64, ptr %53, align 8, !tbaa !20
  %.not = icmp slt i64 %54, %52
  br i1 %.not, label %64, label %55

55:                                               ; preds = %50
  %56 = call noundef nonnull align 8 dereferenceable(9) ptr @_ZNSt6vectorISt4pairIxcESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @x, i64 noundef %indvars.iv26) #6
  %57 = load i64, ptr %56, align 8, !tbaa !20
  %58 = load i32, ptr %1, align 4, !tbaa !19
  %59 = sext i32 %58 to i64
  %60 = load i64, ptr @answer, align 8, !tbaa !21
  %61 = add i64 %57, 1
  %62 = sub i64 %61, %59
  %63 = add nsw i64 %62, %60
  store i64 %63, ptr @answer, align 8, !tbaa !21
  br label %64

64:                                               ; preds = %44, %50, %55
  %indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
  %65 = call noundef i64 @_ZNKSt6vectorISt4pairIxcESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @x) #6
  %66 = icmp ugt i64 %65, %indvars.iv.next27
  br i1 %66, label %44, label %._crit_edge20, !llvm.loop !22

67:                                               ; preds = %37, %._crit_edge20, %35
  %68 = load i64, ptr @answer, align 8, !tbaa !21
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %68)
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %69, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIicEC2IxcTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE18_ConstructiblePairIS3_S4_EEclsr6_PCCFPIS3_S4_EE26_ImplicitlyConvertiblePairIS3_S4_EEEbE4typeELb1EEERKS_IS3_S4_E(ptr noundef nonnull align 4 dereferenceable(5), ptr noundef nonnull align 8 dereferenceable(9)) unnamed_addr #2 align 2

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

attributes #0 = { 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 #1 = { 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 #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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { "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 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !10, i64 4}
!15 = !{!"_ZTSSt4pairIicE", !9, i64 0, !10, i64 4}
!16 = !{!17, !10, i64 8}
!17 = !{!"_ZTSSt4pairIxcE", !18, i64 0, !10, i64 8}
!18 = !{!"long long", !10, i64 0}
!19 = !{!15, !9, i64 0}
!20 = !{!17, !18, i64 0}
!21 = !{!18, !18, i64 0}
!22 = distinct !{!22, !12}


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