; LLVM IR from DionysiosB/CodeForces :: 1859B-OlyaAndGameWithArrays (main)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"struct.std::pair" = type { i64, i64 }

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca %"class.std::vector", align 8
  %5 = alloca %"class.std::allocator", align 1
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca %"struct.std::pair", align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  br label %22

22:                                               ; preds = %137, %0
  %23 = load i64, ptr %2, align 8, !tbaa !5
  %24 = add nsw i64 %23, -1
  store i64 %24, ptr %2, align 8, !tbaa !5
  %25 = icmp ne i64 %23, 0
  br i1 %25, label %26, label %144

26:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #5
  %28 = load i64, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #5
  call void @_ZNSaISt4pairIllEEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  invoke void @_ZNSt6vectorISt4pairIllESaIS1_EEC2EmRKS2_(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %28, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %29 unwind label %35

29:                                               ; preds = %26
  call void @_ZNSt15__new_allocatorISt4pairIllEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store i64 -1, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store i64 1000000007, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  store i64 1000000007, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store i64 0, ptr %11, align 8, !tbaa !5
  br label %30

30:                                               ; preds = %105, %29
  %31 = load i64, ptr %11, align 8, !tbaa !5
  %32 = load i64, ptr %3, align 8, !tbaa !5
  %33 = icmp slt i64 %31, %32
  br i1 %33, label %39, label %34

34:                                               ; preds = %30
  store i32 4, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %110

35:                                               ; preds = %26
  %36 = landingpad { ptr, i32 }
          cleanup
  %37 = extractvalue { ptr, i32 } %36, 0
  store ptr %37, ptr %6, align 8
  %38 = extractvalue { ptr, i32 } %36, 1
  store i32 %38, ptr %7, align 4
  call void @_ZNSt15__new_allocatorISt4pairIllEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #5
  br label %143

39:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %40 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %13)
          to label %41 unwind label %47

41:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store i64 1000000007, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  store i64 1000000007, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  store i64 0, ptr %16, align 8, !tbaa !5
  br label %42

42:                                               ; preds = %72, %41
  %43 = load i64, ptr %16, align 8, !tbaa !5
  %44 = load i64, ptr %13, align 8, !tbaa !5
  %45 = icmp slt i64 %43, %44
  br i1 %45, label %51, label %46

46:                                               ; preds = %42
  store i32 7, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %75

47:                                               ; preds = %39
  %48 = landingpad { ptr, i32 }
          cleanup
  %49 = extractvalue { ptr, i32 } %48, 0
  store ptr %49, ptr %6, align 8
  %50 = extractvalue { ptr, i32 } %48, 1
  store i32 %50, ptr %7, align 4
  br label %109

51:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %52 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %17)
          to label %53 unwind label %60

53:                                               ; preds = %51
  %54 = load i64, ptr %17, align 8, !tbaa !5
  %55 = load i64, ptr %14, align 8, !tbaa !5
  %56 = icmp sle i64 %54, %55
  br i1 %56, label %57, label %64

57:                                               ; preds = %53
  %58 = load i64, ptr %14, align 8, !tbaa !5
  store i64 %58, ptr %15, align 8, !tbaa !5
  %59 = load i64, ptr %17, align 8, !tbaa !5
  store i64 %59, ptr %14, align 8, !tbaa !5
  br label %71

60:                                               ; preds = %51
  %61 = landingpad { ptr, i32 }
          cleanup
  %62 = extractvalue { ptr, i32 } %61, 0
  store ptr %62, ptr %6, align 8
  %63 = extractvalue { ptr, i32 } %61, 1
  store i32 %63, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %108

64:                                               ; preds = %53
  %65 = load i64, ptr %17, align 8, !tbaa !5
  %66 = load i64, ptr %15, align 8, !tbaa !5
  %67 = icmp slt i64 %65, %66
  br i1 %67, label %68, label %70

68:                                               ; preds = %64
  %69 = load i64, ptr %17, align 8, !tbaa !5
  store i64 %69, ptr %15, align 8, !tbaa !5
  br label %70

70:                                               ; preds = %68, %64
  br label %71

71:                                               ; preds = %70, %57
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %72

72:                                               ; preds = %71
  %73 = load i64, ptr %16, align 8, !tbaa !5
  %74 = add nsw i64 %73, 1
  store i64 %74, ptr %16, align 8, !tbaa !5
  br label %42, !llvm.loop !9

75:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #5
  %76 = invoke { i64, i64 } @_ZSt9make_pairIRlS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %77 unwind label %100

77:                                               ; preds = %75
  %78 = getelementptr inbounds { i64, i64 }, ptr %18, i32 0, i32 0
  %79 = extractvalue { i64, i64 } %76, 0
  store i64 %79, ptr %78, align 8
  %80 = getelementptr inbounds { i64, i64 }, ptr %18, i32 0, i32 1
  %81 = extractvalue { i64, i64 } %76, 1
  store i64 %81, ptr %80, align 8
  %82 = load i64, ptr %11, align 8, !tbaa !5
  %83 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %82) #5
  %84 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIllEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %83, ptr noundef nonnull align 8 dereferenceable(16) %18) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #5
  %85 = load i64, ptr %9, align 8, !tbaa !5
  %86 = load i64, ptr %14, align 8, !tbaa !5
  %87 = icmp slt i64 %85, %86
  br i1 %87, label %88, label %90

88:                                               ; preds = %77
  %89 = load i64, ptr %9, align 8, !tbaa !5
  br label %92

90:                                               ; preds = %77
  %91 = load i64, ptr %14, align 8, !tbaa !5
  br label %92

92:                                               ; preds = %90, %88
  %93 = phi i64 [ %89, %88 ], [ %91, %90 ]
  store i64 %93, ptr %9, align 8, !tbaa !5
  %94 = load i64, ptr %15, align 8, !tbaa !5
  %95 = load i64, ptr %10, align 8, !tbaa !5
  %96 = icmp slt i64 %94, %95
  br i1 %96, label %97, label %104

97:                                               ; preds = %92
  %98 = load i64, ptr %15, align 8, !tbaa !5
  store i64 %98, ptr %10, align 8, !tbaa !5
  %99 = load i64, ptr %11, align 8, !tbaa !5
  store i64 %99, ptr %8, align 8, !tbaa !5
  br label %104

100:                                              ; preds = %75
  %101 = landingpad { ptr, i32 }
          cleanup
  %102 = extractvalue { ptr, i32 } %101, 0
  store ptr %102, ptr %6, align 8
  %103 = extractvalue { ptr, i32 } %101, 1
  store i32 %103, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #5
  br label %108

104:                                              ; preds = %97, %92
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %105

105:                                              ; preds = %104
  %106 = load i64, ptr %11, align 8, !tbaa !5
  %107 = add nsw i64 %106, 1
  store i64 %107, ptr %11, align 8, !tbaa !5
  br label %30, !llvm.loop !11

108:                                              ; preds = %100, %60
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %109

109:                                              ; preds = %108, %47
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %142

110:                                              ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  store i64 0, ptr %19, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  store i64 0, ptr %20, align 8, !tbaa !5
  br label %111

111:                                              ; preds = %131, %110
  %112 = load i64, ptr %20, align 8, !tbaa !5
  %113 = load i64, ptr %3, align 8, !tbaa !5
  %114 = icmp slt i64 %112, %113
  br i1 %114, label %116, label %115

115:                                              ; preds = %111
  store i32 10, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  br label %134

116:                                              ; preds = %111
  %117 = load i64, ptr %20, align 8, !tbaa !5
  %118 = load i64, ptr %8, align 8, !tbaa !5
  %119 = icmp ne i64 %117, %118
  br i1 %119, label %120, label %125

120:                                              ; preds = %116
  %121 = load i64, ptr %20, align 8, !tbaa !5
  %122 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %121) #5
  %123 = getelementptr inbounds %"struct.std::pair", ptr %122, i32 0, i32 1
  %124 = load i64, ptr %123, align 8, !tbaa !14
  br label %127

125:                                              ; preds = %116
  %126 = load i64, ptr %9, align 8, !tbaa !5
  br label %127

127:                                              ; preds = %125, %120
  %128 = phi i64 [ %124, %120 ], [ %126, %125 ]
  %129 = load i64, ptr %19, align 8, !tbaa !12
  %130 = add nsw i64 %129, %128
  store i64 %130, ptr %19, align 8, !tbaa !12
  br label %131

131:                                              ; preds = %127
  %132 = load i64, ptr %20, align 8, !tbaa !5
  %133 = add nsw i64 %132, 1
  store i64 %133, ptr %20, align 8, !tbaa !5
  br label %111, !llvm.loop !16

134:                                              ; preds = %115
  %135 = load i64, ptr %19, align 8, !tbaa !12
  %136 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %135)
          to label %137 unwind label %138

137:                                              ; preds = %134
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @_ZNSt6vectorISt4pairIllESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  br label %22, !llvm.loop !17

138:                                              ; preds = %134
  %139 = landingpad { ptr, i32 }
          cleanup
  %140 = extractvalue { ptr, i32 } %139, 0
  store ptr %140, ptr %6, align 8
  %141 = extractvalue { ptr, i32 } %139, 1
  store i32 %141, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  br label %142

142:                                              ; preds = %138, %109
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @_ZNSt6vectorISt4pairIllESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  br label %143

143:                                              ; preds = %142, %35
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  br label %146

144:                                              ; preds = %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  %145 = load i32, ptr %1, align 4
  ret i32 %145

146:                                              ; preds = %143
  %147 = load ptr, ptr %6, align 8
  %148 = load i32, ptr %7, align 4
  %149 = insertvalue { ptr, i32 } poison, ptr %147, 0
  %150 = insertvalue { ptr, i32 } %149, i32 %148, 1
  resume { ptr, i32 } %150
}

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

declare i32 @__isoc99_scanf(ptr noundef, ...) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIllESaIS1_EEC2EmRKS2_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRlS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIllEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #3 align 2

declare i32 @printf(ptr noundef, ...) #2

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

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #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 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = !{!15, !6, i64 8}
!15 = !{!"_ZTSSt4pairIllE", !6, i64 0, !6, i64 8}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<long, long>, std::allocator<std::pair<long, long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"struct.std::pair" = type { i64, i64 }

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca %"class.std::vector", align 8
  %4 = alloca %"class.std::allocator", align 1
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca %"struct.std::pair", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %11 = load i64, ptr %1, align 8, !tbaa !5
  %12 = add nsw i64 %11, -1
  store i64 %12, ptr %1, align 8, !tbaa !5
  %.not50 = icmp eq i64 %11, 0
  br i1 %.not50, label %._crit_edge53, label %.lr.ph52

.lr.ph52:                                         ; preds = %0
  %13 = getelementptr inbounds i8, ptr %9, i64 8
  br label %14

14:                                               ; preds = %.lr.ph52, %._crit_edge48
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  %16 = load i64, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @_ZNSaISt4pairIllEEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  invoke void @_ZNSt6vectorISt4pairIllESaIS1_EEC2EmRKS2_(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %16, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %17 unwind label %21

17:                                               ; preds = %14
  call void @_ZNSt15__new_allocatorISt4pairIllEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  %18 = load i64, ptr %2, align 8, !tbaa !5
  %19 = icmp sgt i64 %18, 0
  br i1 %19, label %.lr.ph43, label %._crit_edge48

.preheader:                                       ; preds = %39
  %20 = icmp sgt i64 %49, 0
  br i1 %20, label %.lr.ph47, label %._crit_edge48

21:                                               ; preds = %14
  %22 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorISt4pairIllEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  br label %67

.lr.ph43:                                         ; preds = %17, %39
  %.02141 = phi i64 [ %48, %39 ], [ 0, %17 ]
  %.02240 = phi i64 [ %spec.select34, %39 ], [ 1000000007, %17 ]
  %.02339 = phi i64 [ %45, %39 ], [ 1000000007, %17 ]
  %.02438 = phi i64 [ %spec.select, %39 ], [ -1, %17 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %5)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  store i64 1000000007, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  store i64 1000000007, ptr %7, align 8, !tbaa !5
  %24 = load i64, ptr %5, align 8, !tbaa !5
  %25 = icmp sgt i64 %24, 0
  br i1 %25, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %35, %.lr.ph43
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #6
  %26 = invoke { i64, i64 } @_ZSt9make_pairIRlS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %39 unwind label %51

.lr.ph:                                           ; preds = %.lr.ph43, %35
  %.02037 = phi i64 [ %36, %35 ], [ 0, %.lr.ph43 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %8)
  %28 = load i64, ptr %8, align 8, !tbaa !5
  %29 = load i64, ptr %6, align 8, !tbaa !5
  %.not33 = icmp sgt i64 %28, %29
  br i1 %.not33, label %31, label %30

30:                                               ; preds = %.lr.ph
  store i64 %29, ptr %7, align 8, !tbaa !5
  store i64 %28, ptr %6, align 8, !tbaa !5
  br label %35

31:                                               ; preds = %.lr.ph
  %32 = load i64, ptr %7, align 8, !tbaa !5
  %33 = icmp slt i64 %28, %32
  br i1 %33, label %34, label %35

34:                                               ; preds = %31
  store i64 %28, ptr %7, align 8, !tbaa !5
  br label %35

35:                                               ; preds = %31, %34, %30
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  %36 = add nuw nsw i64 %.02037, 1
  %37 = load i64, ptr %5, align 8, !tbaa !5
  %38 = icmp slt i64 %36, %37
  br i1 %38, label %.lr.ph, label %._crit_edge, !llvm.loop !9

39:                                               ; preds = %._crit_edge
  %40 = extractvalue { i64, i64 } %26, 0
  store i64 %40, ptr %9, align 8
  %41 = extractvalue { i64, i64 } %26, 1
  store i64 %41, ptr %13, align 8
  %42 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.02141) #6
  %43 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIllEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %42, ptr noundef nonnull align 8 dereferenceable(16) %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #6
  %44 = load i64, ptr %6, align 8
  %45 = call i64 @llvm.smin.i64(i64 %.02339, i64 %44)
  %46 = load i64, ptr %7, align 8, !tbaa !5
  %47 = icmp slt i64 %46, %.02240
  %spec.select = select i1 %47, i64 %.02141, i64 %.02438
  %spec.select34 = call i64 @llvm.smin.i64(i64 %46, i64 %.02240)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %48 = add nuw nsw i64 %.02141, 1
  %49 = load i64, ptr %2, align 8, !tbaa !5
  %50 = icmp slt i64 %48, %49
  br i1 %50, label %.lr.ph43, label %.preheader, !llvm.loop !11

51:                                               ; preds = %._crit_edge
  %52 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @_ZNSt6vectorISt4pairIllESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  br label %67

._crit_edge48:                                    ; preds = %61, %17, %.preheader
  %.019.lcssa = phi i64 [ 0, %.preheader ], [ 0, %17 ], [ %64, %61 ]
  %53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %.019.lcssa)
  call void @_ZNSt6vectorISt4pairIllESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %54 = load i64, ptr %1, align 8, !tbaa !5
  %55 = add nsw i64 %54, -1
  store i64 %55, ptr %1, align 8, !tbaa !5
  %.not = icmp eq i64 %54, 0
  br i1 %.not, label %._crit_edge53, label %14, !llvm.loop !12

.lr.ph47:                                         ; preds = %.preheader, %61
  %56 = phi i64 [ %62, %61 ], [ %49, %.preheader ]
  %.046 = phi i64 [ %65, %61 ], [ 0, %.preheader ]
  %.01945 = phi i64 [ %64, %61 ], [ 0, %.preheader ]
  %.not31 = icmp eq i64 %.046, %spec.select
  br i1 %.not31, label %61, label %57

57:                                               ; preds = %.lr.ph47
  %58 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.046) #6
  %59 = getelementptr inbounds i8, ptr %58, i64 8
  %60 = load i64, ptr %59, align 8, !tbaa !13
  %.pre = load i64, ptr %2, align 8, !tbaa !5
  br label %61

61:                                               ; preds = %.lr.ph47, %57
  %62 = phi i64 [ %.pre, %57 ], [ %56, %.lr.ph47 ]
  %63 = phi i64 [ %60, %57 ], [ %45, %.lr.ph47 ]
  %64 = add nsw i64 %63, %.01945
  %65 = add nuw nsw i64 %.046, 1
  %66 = icmp slt i64 %65, %62
  br i1 %66, label %.lr.ph47, label %._crit_edge48, !llvm.loop !15

67:                                               ; preds = %51, %21
  %.pn = phi { ptr, i32 } [ %52, %51 ], [ %22, %21 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn

._crit_edge53:                                    ; preds = %._crit_edge48, %0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret i32 0
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIllESaIS1_EEC2EmRKS2_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRlS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIllEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #5

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


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