; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2015-16/Open 2016/Plat (landscape_pq)

; 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::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }

@N = external dso_local global i32, align 4
@X = external dso_local global i64, align 8
@Y = external dso_local global i64, align 8
@Z = external dso_local global i64, align 8
@p1 = external dso_local global %"class.std::priority_queue", align 8
@p2 = external dso_local global %"class.std::priority_queue", align 8
@ans = external dso_local global i64, align 8
@.str.8 = external hidden unnamed_addr constant [10 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::__cxx11::basic_string", align 8
  %3 = alloca %"class.std::allocator", align 1
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef @.str.8, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %16 unwind label %23

16:                                               ; preds = %0
  invoke void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef %2)
          to label %17 unwind label %27

17:                                               ; preds = %16
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #4
  call void @_ZN5input2reIiJxxxEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @N, ptr noundef nonnull align 8 dereferenceable(8) @X, ptr noundef nonnull align 8 dereferenceable(8) @Y, ptr noundef nonnull align 8 dereferenceable(8) @Z)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %123, %17
  %19 = load i32, ptr %6, align 4, !tbaa !5
  %20 = load i32, ptr @N, align 4, !tbaa !5
  %21 = icmp slt i32 %19, %20
  br i1 %21, label %32, label %22

22:                                               ; preds = %18
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %126

23:                                               ; preds = %0
  %24 = landingpad { ptr, i32 }
          cleanup
  %25 = extractvalue { ptr, i32 } %24, 0
  store ptr %25, ptr %4, align 8
  %26 = extractvalue { ptr, i32 } %24, 1
  store i32 %26, ptr %5, align 4
  br label %31

27:                                               ; preds = %16
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %4, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %5, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  br label %31

31:                                               ; preds = %27, %23
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #4
  br label %128

32:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @_ZN5input2reIiJiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %33 = load i32, ptr %8, align 4, !tbaa !5
  %34 = load i32, ptr %9, align 4, !tbaa !5
  %35 = sub nsw i32 %34, %33
  store i32 %35, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %75, %32
  %37 = load i32, ptr %10, align 4, !tbaa !5
  %38 = load i32, ptr %9, align 4, !tbaa !5
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %78

41:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %42 = load i64, ptr @X, align 8, !tbaa !9
  store i64 %42, ptr %11, align 8, !tbaa !9
  %43 = call noundef i64 @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(25) @p2)
  %44 = trunc i64 %43 to i32
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %64

46:                                               ; preds = %41
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @p2)
  %48 = load i64, ptr %47, align 8, !tbaa !9
  %49 = load i64, ptr @Z, align 8, !tbaa !9
  %50 = load i32, ptr %6, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = mul nsw i64 %49, %51
  %53 = add nsw i64 %48, %52
  %54 = load i64, ptr @X, align 8, !tbaa !9
  %55 = icmp slt i64 %53, %54
  br i1 %55, label %56, label %64

56:                                               ; preds = %46
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @p2)
  %58 = load i64, ptr %57, align 8, !tbaa !9
  %59 = load i64, ptr @Z, align 8, !tbaa !9
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = mul nsw i64 %59, %61
  %63 = add nsw i64 %58, %62
  store i64 %63, ptr %11, align 8, !tbaa !9
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @p2)
  br label %64

64:                                               ; preds = %56, %46, %41
  %65 = load i64, ptr %11, align 8, !tbaa !9
  %66 = load i64, ptr @ans, align 8, !tbaa !9
  %67 = add nsw i64 %66, %65
  store i64 %67, ptr @ans, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %68 = load i64, ptr %11, align 8, !tbaa !9
  %69 = sub nsw i64 0, %68
  %70 = load i64, ptr @Z, align 8, !tbaa !9
  %71 = load i32, ptr %6, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = mul nsw i64 %70, %72
  %74 = sub nsw i64 %69, %73
  store i64 %74, ptr %12, align 8, !tbaa !9
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4pushEOx(ptr noundef nonnull align 8 dereferenceable(25) @p1, ptr noundef nonnull align 8 dereferenceable(8) %12)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %75

75:                                               ; preds = %64
  %76 = load i32, ptr %10, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %10, align 4, !tbaa !5
  br label %36, !llvm.loop !11

78:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %119, %78
  %80 = load i32, ptr %13, align 4, !tbaa !5
  %81 = load i32, ptr %9, align 4, !tbaa !5
  %82 = sub nsw i32 0, %81
  %83 = icmp slt i32 %80, %82
  br i1 %83, label %85, label %84

84:                                               ; preds = %79
  store i32 8, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %122

85:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %86 = load i64, ptr @Y, align 8, !tbaa !9
  store i64 %86, ptr %14, align 8, !tbaa !9
  %87 = call noundef i64 @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(25) @p1)
  %88 = trunc i64 %87 to i32
  %89 = icmp ne i32 %88, 0
  br i1 %89, label %90, label %108

90:                                               ; preds = %85
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @p1)
  %92 = load i64, ptr %91, align 8, !tbaa !9
  %93 = load i64, ptr @Z, align 8, !tbaa !9
  %94 = load i32, ptr %6, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = mul nsw i64 %93, %95
  %97 = add nsw i64 %92, %96
  %98 = load i64, ptr @Y, align 8, !tbaa !9
  %99 = icmp slt i64 %97, %98
  br i1 %99, label %100, label %108

100:                                              ; preds = %90
  %101 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @p1)
  %102 = load i64, ptr %101, align 8, !tbaa !9
  %103 = load i64, ptr @Z, align 8, !tbaa !9
  %104 = load i32, ptr %6, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = mul nsw i64 %103, %105
  %107 = add nsw i64 %102, %106
  store i64 %107, ptr %14, align 8, !tbaa !9
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @p1)
  br label %108

108:                                              ; preds = %100, %90, %85
  %109 = load i64, ptr %14, align 8, !tbaa !9
  %110 = load i64, ptr @ans, align 8, !tbaa !9
  %111 = add nsw i64 %110, %109
  store i64 %111, ptr @ans, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %112 = load i64, ptr %14, align 8, !tbaa !9
  %113 = sub nsw i64 0, %112
  %114 = load i64, ptr @Z, align 8, !tbaa !9
  %115 = load i32, ptr %6, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = mul nsw i64 %114, %116
  %118 = sub nsw i64 %113, %117
  store i64 %118, ptr %15, align 8, !tbaa !9
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4pushEOx(ptr noundef nonnull align 8 dereferenceable(25) @p2, ptr noundef nonnull align 8 dereferenceable(8) %15)
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %119

119:                                              ; preds = %108
  %120 = load i32, ptr %13, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %13, align 4, !tbaa !5
  br label %79, !llvm.loop !13

122:                                              ; preds = %84
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %123

123:                                              ; preds = %122
  %124 = load i32, ptr %6, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %6, align 4, !tbaa !5
  br label %18, !llvm.loop !14

126:                                              ; preds = %22
  call void @_ZN6output2psIxEEvRKT_(ptr noundef nonnull align 8 dereferenceable(8) @ans)
  %127 = load i32, ptr %1, align 4
  ret i32 %127

128:                                              ; preds = %31
  %129 = load ptr, ptr %4, align 8
  %130 = load i32, ptr %5, align 4
  %131 = insertvalue { ptr, i32 } poison, ptr %129, 0
  %132 = insertvalue { ptr, i32 } %131, i32 %130, 1
  resume { ptr, i32 } %132
}

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { 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 #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !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::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }

@N = external dso_local global i32, align 4
@X = external dso_local global i64, align 8
@Y = external dso_local global i64, align 8
@Z = external dso_local global i64, align 8
@p1 = external dso_local global %"class.std::priority_queue", align 8
@p2 = external dso_local global %"class.std::priority_queue", align 8
@ans = external dso_local global i64, align 8
@.str.8 = external hidden unnamed_addr constant [10 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) 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) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::__cxx11::basic_string", align 8
  %2 = alloca %"class.std::allocator", align 1
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull @.str.8, ptr noundef nonnull align 1 dereferenceable(1) %2)
          to label %7 unwind label %11

7:                                                ; preds = %0
  invoke void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull %1)
          to label %8 unwind label %13

8:                                                ; preds = %7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #4
  call void @_ZN5input2reIiJxxxEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @N, ptr noundef nonnull align 8 dereferenceable(8) @X, ptr noundef nonnull align 8 dereferenceable(8) @Y, ptr noundef nonnull align 8 dereferenceable(8) @Z)
  %9 = load i32, ptr @N, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph31, label %._crit_edge32

._crit_edge32:                                    ; preds = %._crit_edge, %8
  call void @_ZN6output2psIxEEvRKT_(ptr noundef nonnull align 8 dereferenceable(8) @ans)
  ret i32 0

11:                                               ; preds = %0
  %12 = landingpad { ptr, i32 }
          cleanup
  br label %15

13:                                               ; preds = %7
  %14 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #4
  br label %15

15:                                               ; preds = %13, %11
  %.pn = phi { ptr, i32 } [ %14, %13 ], [ %12, %11 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #4
  resume { ptr, i32 } %.pn

.lr.ph31:                                         ; preds = %8, %._crit_edge
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge ], [ 0, %8 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  call void @_ZN5input2reIiJiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %16 = load i32, ptr %3, align 4, !tbaa !5
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = sub nsw i32 %17, %16
  store i32 %18, ptr %4, align 4, !tbaa !5
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.lr.ph, label %.preheader

.preheader:                                       ; preds = %39, %.lr.ph31
  %20 = phi i32 [ %18, %.lr.ph31 ], [ %47, %39 ]
  %21 = icmp slt i32 %20, 0
  br i1 %21, label %.lr.ph28, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph31, %39
  %.02026 = phi i32 [ %46, %39 ], [ 0, %.lr.ph31 ]
  %22 = load i64, ptr @X, align 8, !tbaa !9
  %23 = call noundef i64 @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(25) @p2)
  %24 = and i64 %23, 4294967295
  %.not25 = icmp eq i64 %24, 0
  br i1 %.not25, label %39, label %25

25:                                               ; preds = %.lr.ph
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @p2)
  %27 = load i64, ptr %26, align 8, !tbaa !9
  %28 = load i64, ptr @Z, align 8, !tbaa !9
  %29 = mul nsw i64 %28, %indvars.iv
  %30 = add nsw i64 %29, %27
  %31 = load i64, ptr @X, align 8, !tbaa !9
  %32 = icmp slt i64 %30, %31
  br i1 %32, label %33, label %39

33:                                               ; preds = %25
  %34 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @p2)
  %35 = load i64, ptr %34, align 8, !tbaa !9
  %36 = load i64, ptr @Z, align 8, !tbaa !9
  %37 = mul nsw i64 %36, %indvars.iv
  %38 = add nsw i64 %37, %35
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @p2)
  br label %39

39:                                               ; preds = %33, %25, %.lr.ph
  %.019 = phi i64 [ %38, %33 ], [ %22, %25 ], [ %22, %.lr.ph ]
  %40 = load i64, ptr @ans, align 8, !tbaa !9
  %41 = add nsw i64 %40, %.019
  store i64 %41, ptr @ans, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  %42 = load i64, ptr @Z, align 8, !tbaa !9
  %43 = mul nsw i64 %42, %indvars.iv
  %44 = add i64 %.019, %43
  %45 = sub i64 0, %44
  store i64 %45, ptr %5, align 8, !tbaa !9
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4pushEOx(ptr noundef nonnull align 8 dereferenceable(25) @p1, ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  %46 = add nuw nsw i32 %.02026, 1
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = icmp slt i32 %46, %47
  br i1 %48, label %.lr.ph, label %.preheader, !llvm.loop !11

._crit_edge:                                      ; preds = %69, %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %49 = load i32, ptr @N, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = icmp slt i64 %indvars.iv.next, %50
  br i1 %51, label %.lr.ph31, label %._crit_edge32, !llvm.loop !13

.lr.ph28:                                         ; preds = %.preheader, %69
  %.01827 = phi i32 [ %76, %69 ], [ 0, %.preheader ]
  %52 = load i64, ptr @Y, align 8, !tbaa !9
  %53 = call noundef i64 @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(25) @p1)
  %54 = and i64 %53, 4294967295
  %.not = icmp eq i64 %54, 0
  br i1 %.not, label %69, label %55

55:                                               ; preds = %.lr.ph28
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @p1)
  %57 = load i64, ptr %56, align 8, !tbaa !9
  %58 = load i64, ptr @Z, align 8, !tbaa !9
  %59 = mul nsw i64 %58, %indvars.iv
  %60 = add nsw i64 %59, %57
  %61 = load i64, ptr @Y, align 8, !tbaa !9
  %62 = icmp slt i64 %60, %61
  br i1 %62, label %63, label %69

63:                                               ; preds = %55
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @p1)
  %65 = load i64, ptr %64, align 8, !tbaa !9
  %66 = load i64, ptr @Z, align 8, !tbaa !9
  %67 = mul nsw i64 %66, %indvars.iv
  %68 = add nsw i64 %67, %65
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @p1)
  br label %69

69:                                               ; preds = %63, %55, %.lr.ph28
  %.0 = phi i64 [ %68, %63 ], [ %52, %55 ], [ %52, %.lr.ph28 ]
  %70 = load i64, ptr @ans, align 8, !tbaa !9
  %71 = add nsw i64 %70, %.0
  store i64 %71, ptr @ans, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %72 = load i64, ptr @Z, align 8, !tbaa !9
  %73 = mul nsw i64 %72, %indvars.iv
  %74 = add i64 %.0, %73
  %75 = sub i64 0, %74
  store i64 %75, ptr %6, align 8, !tbaa !9
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIxEE4pushEOx(ptr noundef nonnull align 8 dereferenceable(25) @p2, ptr noundef nonnull align 8 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  %76 = add nuw nsw i32 %.01827, 1
  %77 = load i32, ptr %4, align 4, !tbaa !5
  %78 = sub nsw i32 0, %77
  %79 = icmp slt i32 %76, %78
  br i1 %79, label %.lr.ph28, label %._crit_edge, !llvm.loop !14
}

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { 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 #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}


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