; LLVM IR from VastoLorde95/Competitive-Programming :: Hackerrank/Codesprints 2016/Codesprint April/Problem H (H)

; 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<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.2" = type { %"struct.std::_Vector_base.3" }
%"struct.std::_Vector_base.3" = type { %"struct.std::_Vector_base<std::pair<std::pair<long long, long long>, std::pair<long long, long long>>, std::allocator<std::pair<std::pair<long long, long long>, std::pair<long long, long long>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<std::pair<long long, long long>, std::pair<long long, long long>>, std::allocator<std::pair<std::pair<long long, long long>, std::pair<long long, long long>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<std::pair<long long, long long>, std::pair<long long, long long>>, std::allocator<std::pair<std::pair<long long, long long>, std::pair<long long, long long>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<std::pair<long long, long long>, std::pair<long long, long long>>, std::allocator<std::pair<std::pair<long long, long long>, std::pair<long long, long long>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.10" = type { %"struct.std::_Vector_base.11" }
%"struct.std::_Vector_base.11" = type { %"struct.std::_Vector_base<std::pair<long long, long long>, std::allocator<std::pair<long long, long long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<long long, long long>, std::allocator<std::pair<long long, long long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<long long, long long>, std::allocator<std::pair<long long, long long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<long long, long long>, std::allocator<std::pair<long long, long long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair.8" = type { %"struct.std::pair", %"struct.std::pair" }
%"struct.std::pair" = type { i64, i64 }
%"class.__gnu_cxx::__normal_iterator.7" = type { ptr }

@g = external dso_local global [262144 x %"class.std::vector"], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@p = external dso_local global [18 x [262144 x i32]], align 16
@l = external dso_local global [262144 x i32], align 16
@f = external dso_local global [262144 x i64], align 16
@buffer = external dso_local global %"class.std::vector.2", align 8
@up = external dso_local global [262144 x %"class.std::vector.10"], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3LCAii(i32 noundef, i32 noundef) #0

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

; 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 void @_Z3dfsii(i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z14buildJumpTablev() #0

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_Z3fibx(i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRxS0_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)) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4costi(i32 noundef) #0

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIS1_IxxES2_ESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6updateiixxx(i32 noundef, i32 noundef, i64 noundef, i64 noundef, i64 noundef) #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 i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i8, align 1
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::pair.8", align 8
  %12 = alloca %"struct.std::pair", align 8
  %13 = alloca %"struct.std::pair", align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator.7", align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator.7", align 8
  %16 = alloca i32, align 4
  %17 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  store i64 1, ptr getelementptr inbounds ([262144 x i64], ptr @f, i64 0, i64 2), align 16, !tbaa !5
  store i64 1, ptr getelementptr inbounds ([262144 x i64], ptr @f, i64 0, i64 1), align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 3, ptr %2, align 4, !tbaa !9
  br label %18

18:                                               ; preds = %49, %0
  %19 = load i32, ptr %2, align 4, !tbaa !9
  %20 = icmp slt i32 %19, 262144
  br i1 %20, label %22, label %21

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

22:                                               ; preds = %18
  %23 = load i32, ptr %2, align 4, !tbaa !9
  %24 = sub nsw i32 %23, 1
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [262144 x i64], ptr @f, i64 0, i64 %25
  %27 = load i64, ptr %26, align 8, !tbaa !5
  %28 = load i32, ptr %2, align 4, !tbaa !9
  %29 = sub nsw i32 %28, 2
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [262144 x i64], ptr @f, i64 0, i64 %30
  %32 = load i64, ptr %31, align 8, !tbaa !5
  %33 = add nsw i64 %27, %32
  %34 = load i32, ptr %2, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [262144 x i64], ptr @f, i64 0, i64 %35
  store i64 %33, ptr %36, align 8, !tbaa !5
  %37 = load i32, ptr %2, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [262144 x i64], ptr @f, i64 0, i64 %38
  %40 = load i64, ptr %39, align 8, !tbaa !5
  %41 = icmp sge i64 %40, 1000000007
  br i1 %41, label %42, label %48

42:                                               ; preds = %22
  %43 = load i32, ptr %2, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [262144 x i64], ptr @f, i64 0, i64 %44
  %46 = load i64, ptr %45, align 8, !tbaa !5
  %47 = sub nsw i64 %46, 1000000007
  store i64 %47, ptr %45, align 8, !tbaa !5
  br label %48

48:                                               ; preds = %42, %22
  br label %49

49:                                               ; preds = %48
  %50 = load i32, ptr %2, align 4, !tbaa !9
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %2, align 4, !tbaa !9
  br label %18, !llvm.loop !11

52:                                               ; preds = %21
  %53 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !9
  br label %54

54:                                               ; preds = %70, %52
  %55 = load i32, ptr %4, align 4, !tbaa !9
  %56 = load i32, ptr @n, align 4, !tbaa !9
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %59, label %58

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

59:                                               ; preds = %54
  %60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef %3)
  %61 = load i32, ptr %4, align 4, !tbaa !9
  %62 = add nsw i32 %61, 1
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [262144 x %"class.std::vector"], ptr @g, i64 0, i64 %63
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %64, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %65 = load i32, ptr %3, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [262144 x %"class.std::vector"], ptr @g, i64 0, i64 %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %68 = load i32, ptr %4, align 4, !tbaa !9
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %5, align 4, !tbaa !9
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %67, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %70

70:                                               ; preds = %59
  %71 = load i32, ptr %4, align 4, !tbaa !9
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %4, align 4, !tbaa !9
  br label %54, !llvm.loop !13

73:                                               ; preds = %58
  store i32 1, ptr getelementptr inbounds ([262144 x i32], ptr @l, i64 0, i64 1), align 4, !tbaa !9
  call void @_Z3dfsii(i32 noundef 1, i32 noundef 1)
  call void @_Z14buildJumpTablev()
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 1, ptr %9, align 4, !tbaa !9
  br label %74

74:                                               ; preds = %160, %73
  %75 = load i32, ptr %9, align 4, !tbaa !9
  %76 = load i32, ptr @m, align 4, !tbaa !9
  %77 = icmp sle i32 %75, %76
  br i1 %77, label %79, label %78

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

79:                                               ; preds = %74
  %80 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.6, ptr noundef %6, ptr noundef %7, ptr noundef %8)
  %81 = load i8, ptr %6, align 1, !tbaa !14
  %82 = sext i8 %81 to i32
  %83 = icmp eq i32 %82, 85
  br i1 %83, label %84, label %119

84:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #6
  %85 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %86 = getelementptr inbounds { i64, i64 }, ptr %12, i32 0, i32 0
  %87 = extractvalue { i64, i64 } %85, 0
  store i64 %87, ptr %86, align 8
  %88 = getelementptr inbounds { i64, i64 }, ptr %12, i32 0, i32 1
  %89 = extractvalue { i64, i64 } %85, 1
  store i64 %89, ptr %88, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #6
  %90 = load i64, ptr %8, align 8, !tbaa !5
  %91 = add nsw i64 %90, 1
  %92 = call { i64, i64 } @_Z3fibx(i64 noundef %91)
  %93 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 0
  %94 = extractvalue { i64, i64 } %92, 0
  store i64 %94, ptr %93, align 8
  %95 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 1
  %96 = extractvalue { i64, i64 } %92, 1
  store i64 %96, ptr %95, align 8
  call void @_ZSt9make_pairISt4pairIxxES1_ES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr dead_on_unwind writable sret(%"struct.std::pair.8") align 8 %11, ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) %13)
  call void @_ZNSt6vectorISt4pairIS0_IxxES1_ESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) @buffer, ptr noundef nonnull align 8 dereferenceable(32) %11)
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #6
  %97 = call noundef i64 @_ZNKSt6vectorISt4pairIS0_IxxES1_ESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @buffer) #6
  %98 = icmp eq i64 %97, 320
  br i1 %98, label %99, label %118

99:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %100 = call ptr @_ZNSt6vectorISt4pairIS0_IxxES1_ESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @buffer) #6
  %101 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.7", ptr %14, i32 0, i32 0
  store ptr %100, ptr %101, align 8
  br label %102

102:                                              ; preds = %115, %99
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %103 = call ptr @_ZNSt6vectorISt4pairIS0_IxxES1_ESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @buffer) #6
  %104 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.7", ptr %15, i32 0, i32 0
  store ptr %103, ptr %104, align 8
  %105 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIS1_IxxES2_ESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br i1 %105, label %107, label %106

106:                                              ; preds = %102
  store i32 11, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %117

107:                                              ; preds = %102
  %108 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIS1_IxxES2_ESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #6
  %109 = getelementptr inbounds %"struct.std::pair.8", ptr %108, i32 0, i32 0
  %110 = getelementptr inbounds %"struct.std::pair", ptr %109, i32 0, i32 0
  %111 = load i64, ptr %110, align 8, !tbaa !15
  %112 = getelementptr inbounds [262144 x %"class.std::vector.10"], ptr @up, i64 0, i64 %111
  %113 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIS1_IxxES2_ESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #6
  %114 = getelementptr inbounds %"struct.std::pair.8", ptr %113, i32 0, i32 1
  call void @_ZNSt6vectorISt4pairIxxESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %112, ptr noundef nonnull align 8 dereferenceable(16) %114)
  br label %115

115:                                              ; preds = %107
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIS1_IxxES2_ESt6vectorIS3_SaIS3_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #6
  br label %102, !llvm.loop !18

117:                                              ; preds = %106
  call void @_Z6updateiixxx(i32 noundef 1, i32 noundef 1, i64 noundef 0, i64 noundef 0, i64 noundef 0)
  call void @_ZNSt6vectorISt4pairIS0_IxxES1_ESaIS2_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @buffer) #6
  br label %118

118:                                              ; preds = %117, %84
  br label %159

119:                                              ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %120 = load i64, ptr %7, align 8, !tbaa !5
  %121 = trunc i64 %120 to i32
  %122 = load i64, ptr %8, align 8, !tbaa !5
  %123 = trunc i64 %122 to i32
  %124 = call noundef i32 @_Z3LCAii(i32 noundef %121, i32 noundef %123)
  store i32 %124, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %125 = load i64, ptr %7, align 8, !tbaa !5
  %126 = trunc i64 %125 to i32
  %127 = call noundef i64 @_Z4costi(i32 noundef %126)
  %128 = load i64, ptr %8, align 8, !tbaa !5
  %129 = trunc i64 %128 to i32
  %130 = call noundef i64 @_Z4costi(i32 noundef %129)
  %131 = add nsw i64 %127, %130
  store i64 %131, ptr %17, align 8, !tbaa !5
  %132 = load i64, ptr %17, align 8, !tbaa !5
  %133 = icmp sge i64 %132, 1000000007
  br i1 %133, label %134, label %137

134:                                              ; preds = %119
  %135 = load i64, ptr %17, align 8, !tbaa !5
  %136 = sub nsw i64 %135, 1000000007
  store i64 %136, ptr %17, align 8, !tbaa !5
  br label %137

137:                                              ; preds = %134, %119
  %138 = load i64, ptr %17, align 8, !tbaa !5
  %139 = load i32, ptr %16, align 4, !tbaa !9
  %140 = call noundef i64 @_Z4costi(i32 noundef %139)
  %141 = sub nsw i64 %138, %140
  %142 = add nsw i64 %141, 1000000007
  %143 = srem i64 %142, 1000000007
  store i64 %143, ptr %17, align 8, !tbaa !5
  %144 = load i32, ptr %16, align 4, !tbaa !9
  %145 = icmp ne i32 %144, 1
  br i1 %145, label %146, label %156

146:                                              ; preds = %137
  %147 = load i64, ptr %17, align 8, !tbaa !5
  %148 = load i32, ptr %16, align 4, !tbaa !9
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [262144 x i32], ptr @p, i64 0, i64 %149
  %151 = load i32, ptr %150, align 4, !tbaa !9
  %152 = call noundef i64 @_Z4costi(i32 noundef %151)
  %153 = sub nsw i64 %147, %152
  %154 = add nsw i64 %153, 1000000007
  %155 = srem i64 %154, 1000000007
  store i64 %155, ptr %17, align 8, !tbaa !5
  br label %156

156:                                              ; preds = %146, %137
  %157 = load i64, ptr %17, align 8, !tbaa !5
  %158 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i64 noundef %157)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %159

159:                                              ; preds = %156, %118
  br label %160

160:                                              ; preds = %159
  %161 = load i32, ptr %9, align 4, !tbaa !9
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %9, align 4, !tbaa !9
  br label %74, !llvm.loop !19

163:                                              ; preds = %78
  store i32 0, ptr %1, align 4
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  %164 = load i32, ptr %1, align 4
  ret i32 %164
}

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZSt9make_pairISt4pairIxxES1_ES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr dead_on_unwind noalias writable sret(%"struct.std::pair.8") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2

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

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

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint 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 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTSSt4pairIS_IxxES0_E", !17, i64 0, !17, i64 16}
!17 = !{!"_ZTSSt4pairIxxE", !6, i64 0, !6, i64 8}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.2" = type { %"struct.std::_Vector_base.3" }
%"struct.std::_Vector_base.3" = type { %"struct.std::_Vector_base<std::pair<std::pair<long long, long long>, std::pair<long long, long long>>, std::allocator<std::pair<std::pair<long long, long long>, std::pair<long long, long long>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<std::pair<long long, long long>, std::pair<long long, long long>>, std::allocator<std::pair<std::pair<long long, long long>, std::pair<long long, long long>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<std::pair<long long, long long>, std::pair<long long, long long>>, std::allocator<std::pair<std::pair<long long, long long>, std::pair<long long, long long>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<std::pair<long long, long long>, std::pair<long long, long long>>, std::allocator<std::pair<std::pair<long long, long long>, std::pair<long long, long long>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.10" = type { %"struct.std::_Vector_base.11" }
%"struct.std::_Vector_base.11" = type { %"struct.std::_Vector_base<std::pair<long long, long long>, std::allocator<std::pair<long long, long long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<long long, long long>, std::allocator<std::pair<long long, long long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<long long, long long>, std::allocator<std::pair<long long, long long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<long long, long long>, std::allocator<std::pair<long long, long long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair.8" = type { %"struct.std::pair", %"struct.std::pair" }
%"struct.std::pair" = type { i64, i64 }
%"class.__gnu_cxx::__normal_iterator.7" = type { ptr }

@g = external dso_local global [262144 x %"class.std::vector"], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@p = external dso_local local_unnamed_addr global [18 x [262144 x i32]], align 16
@l = external dso_local local_unnamed_addr global [262144 x i32], align 16
@f = external dso_local local_unnamed_addr global [262144 x i64], align 16
@buffer = external dso_local global %"class.std::vector.2", align 8
@up = external dso_local global [262144 x %"class.std::vector.10"], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3LCAii(i32 noundef, i32 noundef) local_unnamed_addr #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: 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 void @_Z3dfsii(i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z14buildJumpTablev() local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_Z3fibx(i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRxS0_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 #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4costi(i32 noundef) local_unnamed_addr #0

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIS1_IxxES2_ESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6updateiixxx(i32 noundef, i32 noundef, i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i8, align 1
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca %"struct.std::pair.8", align 8
  %7 = alloca %"struct.std::pair", align 8
  %8 = alloca %"struct.std::pair", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator.7", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator.7", align 8
  store i64 1, ptr getelementptr inbounds (i8, ptr @f, i64 16), align 16, !tbaa !5
  store i64 1, ptr getelementptr inbounds (i8, ptr @f, i64 8), align 8, !tbaa !5
  br label %15

11:                                               ; preds = %15
  %12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %13 = load i32, ptr @n, align 4, !tbaa !9
  %14 = icmp sgt i32 %13, 1
  br i1 %14, label %.lr.ph, label %._crit_edge

15:                                               ; preds = %24, %0
  %16 = phi i64 [ 1, %0 ], [ %spec.select.1, %24 ]
  %indvars.iv = phi i64 [ 3, %0 ], [ %indvars.iv.next.1, %24 ]
  %17 = add nsw i64 %indvars.iv, -2
  %18 = getelementptr inbounds [262144 x i64], ptr @f, i64 0, i64 %17
  %19 = load i64, ptr %18, align 8, !tbaa !5
  %20 = add nsw i64 %19, %16
  %21 = getelementptr inbounds [262144 x i64], ptr @f, i64 0, i64 %indvars.iv
  %22 = icmp sgt i64 %20, 1000000006
  %23 = add nsw i64 %20, -1000000007
  %spec.select = select i1 %22, i64 %23, i64 %20
  store i64 %spec.select, ptr %21, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 262144
  br i1 %exitcond.not, label %11, label %24, !llvm.loop !11

24:                                               ; preds = %15
  %25 = add nsw i64 %indvars.iv, -1
  %26 = getelementptr inbounds [262144 x i64], ptr @f, i64 0, i64 %25
  %27 = load i64, ptr %26, align 8, !tbaa !5
  %28 = add nsw i64 %27, %spec.select
  %29 = getelementptr inbounds [262144 x i64], ptr @f, i64 0, i64 %indvars.iv.next
  %30 = icmp sgt i64 %28, 1000000006
  %31 = add nsw i64 %28, -1000000007
  %spec.select.1 = select i1 %30, i64 %31, i64 %28
  store i64 %spec.select.1, ptr %29, align 8, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  br label %15

._crit_edge:                                      ; preds = %.lr.ph, %11
  store i32 1, ptr getelementptr inbounds (i8, ptr @l, i64 4), align 4, !tbaa !9
  call void @_Z3dfsii(i32 noundef 1, i32 noundef 1)
  call void @_Z14buildJumpTablev()
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %32 = load i32, ptr @m, align 4, !tbaa !9
  %.not37 = icmp slt i32 %32, 1
  br i1 %.not37, label %._crit_edge41, label %.lr.ph40

.lr.ph40:                                         ; preds = %._crit_edge
  %33 = getelementptr inbounds i8, ptr %7, i64 8
  %34 = getelementptr inbounds i8, ptr %8, i64 8
  br label %44

.lr.ph:                                           ; preds = %11, %.lr.ph
  %indvars.iv43 = phi i64 [ %indvars.iv.next44, %.lr.ph ], [ 1, %11 ]
  %35 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %1)
  %indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
  %36 = getelementptr inbounds [262144 x %"class.std::vector"], ptr @g, i64 0, i64 %indvars.iv.next44
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %36, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %37 = load i32, ptr %1, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [262144 x %"class.std::vector"], ptr @g, i64 0, i64 %38
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %40 = trunc nuw nsw i64 %indvars.iv.next44 to i32
  store i32 %40, ptr %2, align 4, !tbaa !9
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %39, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %41 = load i32, ptr @n, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = icmp slt i64 %indvars.iv.next44, %42
  br i1 %43, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge41:                                    ; preds = %99, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0

44:                                               ; preds = %.lr.ph40, %99
  %.02238 = phi i32 [ 1, %.lr.ph40 ], [ %100, %99 ]
  %45 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %46 = load i8, ptr %3, align 1, !tbaa !14
  %47 = icmp eq i8 %46, 85
  br i1 %47, label %48, label %71

48:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #6
  %49 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %50 = extractvalue { i64, i64 } %49, 0
  store i64 %50, ptr %7, align 8
  %51 = extractvalue { i64, i64 } %49, 1
  store i64 %51, ptr %33, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #6
  %52 = load i64, ptr %5, align 8, !tbaa !5
  %53 = add nsw i64 %52, 1
  %54 = call { i64, i64 } @_Z3fibx(i64 noundef %53)
  %55 = extractvalue { i64, i64 } %54, 0
  store i64 %55, ptr %8, align 8
  %56 = extractvalue { i64, i64 } %54, 1
  store i64 %56, ptr %34, align 8
  call void @_ZSt9make_pairISt4pairIxxES1_ES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr dead_on_unwind nonnull writable sret(%"struct.std::pair.8") align 8 %6, ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %8)
  call void @_ZNSt6vectorISt4pairIS0_IxxES1_ESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) @buffer, ptr noundef nonnull align 8 dereferenceable(32) %6)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #6
  %57 = call noundef i64 @_ZNKSt6vectorISt4pairIS0_IxxES1_ESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @buffer) #6
  %58 = icmp eq i64 %57, 320
  br i1 %58, label %59, label %99

59:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  %60 = call ptr @_ZNSt6vectorISt4pairIS0_IxxES1_ESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @buffer) #6
  store ptr %60, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  %61 = call ptr @_ZNSt6vectorISt4pairIS0_IxxES1_ESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @buffer) #6
  store ptr %61, ptr %10, align 8
  %62 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIS1_IxxES2_ESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  br i1 %62, label %.lr.ph35, label %._crit_edge36

._crit_edge36:                                    ; preds = %.lr.ph35, %59
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  call void @_Z6updateiixxx(i32 noundef 1, i32 noundef 1, i64 noundef 0, i64 noundef 0, i64 noundef 0)
  call void @_ZNSt6vectorISt4pairIS0_IxxES1_ESaIS2_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @buffer) #6
  br label %99

.lr.ph35:                                         ; preds = %59, %.lr.ph35
  %63 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIS1_IxxES2_ESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  %64 = load i64, ptr %63, align 8, !tbaa !15
  %65 = getelementptr inbounds [262144 x %"class.std::vector.10"], ptr @up, i64 0, i64 %64
  %66 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIS1_IxxES2_ESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  %67 = getelementptr inbounds i8, ptr %66, i64 16
  call void @_ZNSt6vectorISt4pairIxxESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %65, ptr noundef nonnull align 8 dereferenceable(16) %67)
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIS1_IxxES2_ESt6vectorIS3_SaIS3_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  %69 = call ptr @_ZNSt6vectorISt4pairIS0_IxxES1_ESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @buffer) #6
  store ptr %69, ptr %10, align 8
  %70 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIS1_IxxES2_ESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  br i1 %70, label %.lr.ph35, label %._crit_edge36, !llvm.loop !18

71:                                               ; preds = %44
  %72 = load i64, ptr %4, align 8, !tbaa !5
  %73 = trunc i64 %72 to i32
  %74 = load i64, ptr %5, align 8, !tbaa !5
  %75 = trunc i64 %74 to i32
  %76 = call noundef i32 @_Z3LCAii(i32 noundef %73, i32 noundef %75)
  %77 = load i64, ptr %4, align 8, !tbaa !5
  %78 = trunc i64 %77 to i32
  %79 = call noundef i64 @_Z4costi(i32 noundef %78)
  %80 = load i64, ptr %5, align 8, !tbaa !5
  %81 = trunc i64 %80 to i32
  %82 = call noundef i64 @_Z4costi(i32 noundef %81)
  %83 = add nsw i64 %82, %79
  %84 = icmp sgt i64 %83, 1000000006
  %85 = add nsw i64 %83, -1000000007
  %spec.select30 = select i1 %84, i64 %85, i64 %83
  %86 = call noundef i64 @_Z4costi(i32 noundef %76)
  %reass.sub = sub i64 %spec.select30, %86
  %87 = add i64 %reass.sub, 1000000007
  %88 = srem i64 %87, 1000000007
  %.not29 = icmp eq i32 %76, 1
  br i1 %.not29, label %97, label %89

89:                                               ; preds = %71
  %90 = sext i32 %76 to i64
  %91 = getelementptr inbounds [262144 x i32], ptr @p, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !9
  %93 = call noundef i64 @_Z4costi(i32 noundef %92)
  %94 = add nsw i64 %88, 1000000007
  %95 = sub i64 %94, %93
  %96 = srem i64 %95, 1000000007
  br label %97

97:                                               ; preds = %89, %71
  %.1 = phi i64 [ %96, %89 ], [ %88, %71 ]
  %98 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i64 noundef %.1)
  br label %99

99:                                               ; preds = %97, %._crit_edge36, %48
  %100 = add nuw nsw i32 %.02238, 1
  %101 = load i32, ptr @m, align 4, !tbaa !9
  %.not.not = icmp slt i32 %.02238, %101
  br i1 %.not.not, label %44, label %._crit_edge41, !llvm.loop !19
}

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZSt9make_pairISt4pairIxxES1_ES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr dead_on_unwind noalias writable sret(%"struct.std::pair.8") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2

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

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

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint 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 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 = { 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 #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 long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTSSt4pairIS_IxxES0_E", !17, i64 0, !17, i64 16}
!17 = !{!"_ZTSSt4pairIxxE", !6, i64 0, !6, i64 8}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


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