; LLVM IR from eyangch/competitive-programming :: Codeforces/1242 (c)

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

%"struct.std::pair" = type { i64, i64 }
%"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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, std::pair<const long long, long long>, std::_Select1st<std::pair<const long long, long long>>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, std::pair<const long long, long long>, std::_Select1st<std::pair<const long long, long long>>, std::less<long long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"struct.std::_Rb_tree_iterator" = type { ptr }
%"struct.std::pair.3" = type { i64, i64 }

@K = external dso_local global i64, align 8
@N = external dso_local global [15 x i64], align 16
@A = external dso_local global [15 x [5000 x i64]], align 16
@bsum = external dso_local global [15 x i64], align 16
@dp = external dso_local global [32768 x %"struct.std::pair"], align 16
@ans = external dso_local global [15 x %"struct.std::pair"], align 16
@V = external dso_local global [32768 x %"class.std::vector"], align 16
@M = external dso_local global %"class.std::map", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsx(i64 noundef) #1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxxEC2IRxS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 2

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca %"struct.std::pair", align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::pair", align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i64, align 8
  %17 = alloca i32, align 4
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca %"class.std::vector", align 8
  %22 = alloca ptr, align 8
  %23 = alloca i32, align 4
  %24 = alloca i64, align 8
  %25 = alloca i64, align 8
  %26 = alloca i64, align 8
  %27 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %28 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %29 = alloca i64, align 8
  %30 = alloca i64, align 8
  %31 = alloca i64, align 8
  %32 = alloca i64, align 8
  %33 = alloca i64, align 8
  %34 = alloca %"struct.std::pair", align 8
  %35 = alloca i64, align 8
  %36 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %37 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %38 = getelementptr i8, ptr %37, i64 -24
  %39 = load i64, ptr %38, align 8
  %40 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %39
  %41 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %40, ptr noundef null)
  %42 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store i64 0, ptr %2, align 8, !tbaa !8
  %43 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @K)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  store i64 0, ptr %3, align 8, !tbaa !8
  br label %44

44:                                               ; preds = %92, %0
  %45 = load i64, ptr %3, align 8, !tbaa !8
  %46 = load i64, ptr @K, align 8, !tbaa !8
  %47 = icmp slt i64 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  br label %95

49:                                               ; preds = %44
  %50 = load i64, ptr %3, align 8, !tbaa !8
  %51 = getelementptr inbounds [15 x i64], ptr @N, i64 0, i64 %50
  %52 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %51)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store i64 0, ptr %5, align 8, !tbaa !8
  br label %53

53:                                               ; preds = %88, %49
  %54 = load i64, ptr %5, align 8, !tbaa !8
  %55 = load i64, ptr %3, align 8, !tbaa !8
  %56 = getelementptr inbounds [15 x i64], ptr @N, i64 0, i64 %55
  %57 = load i64, ptr %56, align 8, !tbaa !8
  %58 = icmp slt i64 %54, %57
  br i1 %58, label %60, label %59

59:                                               ; preds = %53
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  br label %91

60:                                               ; preds = %53
  %61 = load i64, ptr %3, align 8, !tbaa !8
  %62 = getelementptr inbounds [15 x [5000 x i64]], ptr @A, i64 0, i64 %61
  %63 = load i64, ptr %5, align 8, !tbaa !8
  %64 = getelementptr inbounds [5000 x i64], ptr %62, i64 0, i64 %63
  %65 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %64)
  %66 = load i64, ptr %3, align 8, !tbaa !8
  %67 = load i64, ptr %3, align 8, !tbaa !8
  %68 = getelementptr inbounds [15 x [5000 x i64]], ptr @A, i64 0, i64 %67
  %69 = load i64, ptr %5, align 8, !tbaa !8
  %70 = getelementptr inbounds [5000 x i64], ptr %68, i64 0, i64 %69
  %71 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @M, ptr noundef nonnull align 8 dereferenceable(8) %70)
  store i64 %66, ptr %71, align 8, !tbaa !8
  %72 = load i64, ptr %3, align 8, !tbaa !8
  %73 = getelementptr inbounds [15 x [5000 x i64]], ptr @A, i64 0, i64 %72
  %74 = load i64, ptr %5, align 8, !tbaa !8
  %75 = getelementptr inbounds [5000 x i64], ptr %73, i64 0, i64 %74
  %76 = load i64, ptr %75, align 8, !tbaa !8
  %77 = load i64, ptr %3, align 8, !tbaa !8
  %78 = getelementptr inbounds [15 x i64], ptr @bsum, i64 0, i64 %77
  %79 = load i64, ptr %78, align 8, !tbaa !8
  %80 = add nsw i64 %79, %76
  store i64 %80, ptr %78, align 8, !tbaa !8
  %81 = load i64, ptr %3, align 8, !tbaa !8
  %82 = getelementptr inbounds [15 x [5000 x i64]], ptr @A, i64 0, i64 %81
  %83 = load i64, ptr %5, align 8, !tbaa !8
  %84 = getelementptr inbounds [5000 x i64], ptr %82, i64 0, i64 %83
  %85 = load i64, ptr %84, align 8, !tbaa !8
  %86 = load i64, ptr %2, align 8, !tbaa !8
  %87 = add nsw i64 %86, %85
  store i64 %87, ptr %2, align 8, !tbaa !8
  br label %88

88:                                               ; preds = %60
  %89 = load i64, ptr %5, align 8, !tbaa !8
  %90 = add nsw i64 %89, 1
  store i64 %90, ptr %5, align 8, !tbaa !8
  br label %53, !llvm.loop !11

91:                                               ; preds = %59
  br label %92

92:                                               ; preds = %91
  %93 = load i64, ptr %3, align 8, !tbaa !8
  %94 = add nsw i64 %93, 1
  store i64 %94, ptr %3, align 8, !tbaa !8
  br label %44, !llvm.loop !13

95:                                               ; preds = %48
  %96 = load i64, ptr %2, align 8, !tbaa !8
  %97 = load i64, ptr @K, align 8, !tbaa !8
  %98 = srem i64 %96, %97
  %99 = icmp ne i64 %98, 0
  br i1 %99, label %100, label %103

100:                                              ; preds = %95
  %101 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %102 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %101, i8 noundef signext 10)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  br label %346

103:                                              ; preds = %95
  %104 = load i64, ptr @K, align 8, !tbaa !8
  %105 = load i64, ptr %2, align 8, !tbaa !8
  %106 = sdiv i64 %105, %104
  store i64 %106, ptr %2, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 0, ptr %6, align 8, !tbaa !8
  br label %107

107:                                              ; preds = %119, %103
  %108 = load i64, ptr %6, align 8, !tbaa !8
  %109 = load i64, ptr @K, align 8, !tbaa !8
  %110 = trunc i64 %109 to i32
  %111 = shl i32 1, %110
  %112 = sext i32 %111 to i64
  %113 = icmp slt i64 %108, %112
  br i1 %113, label %115, label %114

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

115:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 -1, ptr %8, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 -1, ptr %9, align 4, !tbaa !14
  call void @_ZNSt4pairIxxEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %116 = load i64, ptr %6, align 8, !tbaa !8
  %117 = getelementptr inbounds [32768 x %"struct.std::pair"], ptr @dp, i64 0, i64 %116
  %118 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %117, ptr noundef nonnull align 8 dereferenceable(16) %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #7
  br label %119

119:                                              ; preds = %115
  %120 = load i64, ptr %6, align 8, !tbaa !8
  %121 = add nsw i64 %120, 1
  store i64 %121, ptr %6, align 8, !tbaa !8
  br label %107, !llvm.loop !16

122:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !14
  call void @_ZNSt4pairIxxEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %123 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) @dp, ptr noundef nonnull align 8 dereferenceable(16) %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  store i64 0, ptr %13, align 8, !tbaa !8
  br label %124

124:                                              ; preds = %250, %122
  %125 = load i64, ptr %13, align 8, !tbaa !8
  %126 = load i64, ptr @K, align 8, !tbaa !8
  %127 = icmp slt i64 %125, %126
  br i1 %127, label %129, label %128

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

129:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  store i64 0, ptr %14, align 8, !tbaa !8
  br label %130

130:                                              ; preds = %241, %129
  %131 = load i64, ptr %14, align 8, !tbaa !8
  %132 = load i64, ptr %13, align 8, !tbaa !8
  %133 = getelementptr inbounds [15 x i64], ptr @N, i64 0, i64 %132
  %134 = load i64, ptr %133, align 8, !tbaa !8
  %135 = icmp slt i64 %131, %134
  br i1 %135, label %137, label %136

136:                                              ; preds = %130
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %249

137:                                              ; preds = %130
  %138 = load i64, ptr @K, align 8, !tbaa !8
  %139 = call ptr @llvm.stacksave.p0()
  store ptr %139, ptr %15, align 8
  %140 = alloca i8, i64 %138, align 16
  store i64 %138, ptr %16, align 8
  %141 = load i64, ptr @K, align 8, !tbaa !8
  %142 = getelementptr inbounds i8, ptr %140, i64 %141
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 0, ptr %17, align 4, !tbaa !14
  call void @_ZSt4fillIPbiEvT_S1_RKT0_(ptr noundef %140, ptr noundef %142, ptr noundef nonnull align 4 dereferenceable(4) %17)
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %143 = load i64, ptr %13, align 8, !tbaa !8
  store i64 %143, ptr %18, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %144 = load i64, ptr %13, align 8, !tbaa !8
  %145 = getelementptr inbounds [15 x [5000 x i64]], ptr @A, i64 0, i64 %144
  %146 = load i64, ptr %14, align 8, !tbaa !8
  %147 = getelementptr inbounds [5000 x i64], ptr %145, i64 0, i64 %146
  %148 = load i64, ptr %147, align 8, !tbaa !8
  store i64 %148, ptr %19, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  store i64 0, ptr %20, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 24, ptr %21) #7
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %21) #7
  br label %149

149:                                              ; preds = %193, %137
  br label %150

150:                                              ; preds = %149
  %151 = load i64, ptr %18, align 8, !tbaa !8
  %152 = getelementptr inbounds i8, ptr %140, i64 %151
  %153 = load i8, ptr %152, align 1, !tbaa !17, !range !19, !noundef !20
  %154 = trunc i8 %153 to i1
  br i1 %154, label %155, label %156

155:                                              ; preds = %150
  br label %194

156:                                              ; preds = %150
  invoke void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %21, ptr noundef nonnull align 8 dereferenceable(8) %19)
          to label %157 unwind label %178

157:                                              ; preds = %156
  %158 = load i64, ptr %18, align 8, !tbaa !8
  %159 = getelementptr inbounds i8, ptr %140, i64 %158
  store i8 1, ptr %159, align 1, !tbaa !17
  %160 = load i64, ptr %20, align 8, !tbaa !8
  %161 = add nsw i64 %160, 1
  store i64 %161, ptr %20, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %162 = load i64, ptr %18, align 8, !tbaa !8
  %163 = getelementptr inbounds [15 x i64], ptr @bsum, i64 0, i64 %162
  %164 = load i64, ptr %163, align 8, !tbaa !8
  store i64 %164, ptr %24, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  %165 = load i64, ptr %24, align 8, !tbaa !8
  %166 = load i64, ptr %19, align 8, !tbaa !8
  %167 = sub nsw i64 %165, %166
  store i64 %167, ptr %25, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #7
  %168 = load i64, ptr %2, align 8, !tbaa !8
  %169 = load i64, ptr %25, align 8, !tbaa !8
  %170 = sub nsw i64 %168, %169
  store i64 %170, ptr %26, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #7
  %171 = invoke ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE4findERS3_(ptr noundef nonnull align 8 dereferenceable(48) @M, ptr noundef nonnull align 8 dereferenceable(8) %26)
          to label %172 unwind label %182

172:                                              ; preds = %157
  %173 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %27, i32 0, i32 0
  store ptr %171, ptr %173, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #7
  %174 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @M) #7
  %175 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %28, i32 0, i32 0
  store ptr %174, ptr %175, align 8
  %176 = call noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIKxxEES5_(ptr noundef nonnull align 8 dereferenceable(8) %27, ptr noundef nonnull align 8 dereferenceable(8) %28) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #7
  br i1 %176, label %177, label %186

177:                                              ; preds = %172
  store i64 1000000000000000, ptr %19, align 8, !tbaa !8
  store i32 18, ptr %4, align 4
  br label %191

178:                                              ; preds = %156
  %179 = landingpad { ptr, i32 }
          cleanup
  %180 = extractvalue { ptr, i32 } %179, 0
  store ptr %180, ptr %22, align 8
  %181 = extractvalue { ptr, i32 } %179, 1
  store i32 %181, ptr %23, align 4
  br label %248

182:                                              ; preds = %157
  %183 = landingpad { ptr, i32 }
          cleanup
  %184 = extractvalue { ptr, i32 } %183, 0
  store ptr %184, ptr %22, align 8
  %185 = extractvalue { ptr, i32 } %183, 1
  store i32 %185, ptr %23, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  br label %248

186:                                              ; preds = %172
  %187 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %27) #7
  %188 = getelementptr inbounds %"struct.std::pair.3", ptr %187, i32 0, i32 1
  %189 = load i64, ptr %188, align 8, !tbaa !21
  store i64 %189, ptr %18, align 8, !tbaa !8
  %190 = load i64, ptr %26, align 8, !tbaa !8
  store i64 %190, ptr %19, align 8, !tbaa !8
  store i32 0, ptr %4, align 4
  br label %191

191:                                              ; preds = %186, %177
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  %192 = load i32, ptr %4, align 4
  switch i32 %192, label %355 [
    i32 0, label %193
    i32 18, label %194
  ]

193:                                              ; preds = %191
  br label %149, !llvm.loop !23

194:                                              ; preds = %191, %155
  %195 = load i64, ptr %19, align 8, !tbaa !8
  %196 = load i64, ptr %13, align 8, !tbaa !8
  %197 = getelementptr inbounds [15 x [5000 x i64]], ptr @A, i64 0, i64 %196
  %198 = load i64, ptr %14, align 8, !tbaa !8
  %199 = getelementptr inbounds [5000 x i64], ptr %197, i64 0, i64 %198
  %200 = load i64, ptr %199, align 8, !tbaa !8
  %201 = icmp ne i64 %195, %200
  br i1 %201, label %202, label %203

202:                                              ; preds = %194
  store i32 16, ptr %4, align 4
  br label %237

203:                                              ; preds = %194
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #7
  store i64 0, ptr %29, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #7
  store i64 0, ptr %30, align 8, !tbaa !8
  br label %204

204:                                              ; preds = %222, %203
  %205 = load i64, ptr %30, align 8, !tbaa !8
  %206 = load i64, ptr @K, align 8, !tbaa !8
  %207 = icmp slt i64 %205, %206
  br i1 %207, label %209, label %208

208:                                              ; preds = %204
  store i32 19, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #7
  br label %225

209:                                              ; preds = %204
  %210 = load i64, ptr %30, align 8, !tbaa !8
  %211 = getelementptr inbounds i8, ptr %140, i64 %210
  %212 = load i8, ptr %211, align 1, !tbaa !17, !range !19, !noundef !20
  %213 = trunc i8 %212 to i1
  br i1 %213, label %214, label %221

214:                                              ; preds = %209
  %215 = load i64, ptr %30, align 8, !tbaa !8
  %216 = trunc i64 %215 to i32
  %217 = shl i32 1, %216
  %218 = sext i32 %217 to i64
  %219 = load i64, ptr %29, align 8, !tbaa !8
  %220 = or i64 %219, %218
  store i64 %220, ptr %29, align 8, !tbaa !8
  br label %221

221:                                              ; preds = %214, %209
  br label %222

222:                                              ; preds = %221
  %223 = load i64, ptr %30, align 8, !tbaa !8
  %224 = add nsw i64 %223, 1
  store i64 %224, ptr %30, align 8, !tbaa !8
  br label %204, !llvm.loop !24

225:                                              ; preds = %208
  %226 = load i64, ptr %29, align 8, !tbaa !8
  %227 = load i64, ptr %29, align 8, !tbaa !8
  %228 = getelementptr inbounds [32768 x %"struct.std::pair"], ptr @dp, i64 0, i64 %227
  %229 = getelementptr inbounds %"struct.std::pair", ptr %228, i32 0, i32 0
  store i64 %226, ptr %229, align 16, !tbaa !25
  %230 = load i64, ptr %29, align 8, !tbaa !8
  %231 = getelementptr inbounds [32768 x %"struct.std::pair"], ptr @dp, i64 0, i64 %230
  %232 = getelementptr inbounds %"struct.std::pair", ptr %231, i32 0, i32 1
  store i64 0, ptr %232, align 8, !tbaa !27
  %233 = load i64, ptr %29, align 8, !tbaa !8
  %234 = getelementptr inbounds [32768 x %"class.std::vector"], ptr @V, i64 0, i64 %233
  %235 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIxSaIxEEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %234, ptr noundef nonnull align 8 dereferenceable(24) %21)
          to label %236 unwind label %244

236:                                              ; preds = %225
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #7
  store i32 0, ptr %4, align 4
  br label %237

237:                                              ; preds = %236, %202
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %21) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  %238 = load ptr, ptr %15, align 8
  call void @llvm.stackrestore.p0(ptr %238)
  %239 = load i32, ptr %4, align 4
  switch i32 %239, label %355 [
    i32 0, label %240
    i32 16, label %241
  ]

240:                                              ; preds = %237
  br label %241

241:                                              ; preds = %240, %237
  %242 = load i64, ptr %14, align 8, !tbaa !8
  %243 = add nsw i64 %242, 1
  store i64 %243, ptr %14, align 8, !tbaa !8
  br label %130, !llvm.loop !28

244:                                              ; preds = %225
  %245 = landingpad { ptr, i32 }
          cleanup
  %246 = extractvalue { ptr, i32 } %245, 0
  store ptr %246, ptr %22, align 8
  %247 = extractvalue { ptr, i32 } %245, 1
  store i32 %247, ptr %23, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #7
  br label %248

248:                                              ; preds = %244, %182, %178
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %21) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  br label %350

249:                                              ; preds = %136
  br label %250

250:                                              ; preds = %249
  %251 = load i64, ptr %13, align 8, !tbaa !8
  %252 = add nsw i64 %251, 1
  store i64 %252, ptr %13, align 8, !tbaa !8
  br label %124, !llvm.loop !29

253:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #7
  store i64 0, ptr %31, align 8, !tbaa !8
  br label %254

254:                                              ; preds = %300, %253
  %255 = load i64, ptr %31, align 8, !tbaa !8
  %256 = load i64, ptr @K, align 8, !tbaa !8
  %257 = trunc i64 %256 to i32
  %258 = shl i32 1, %257
  %259 = sext i32 %258 to i64
  %260 = icmp slt i64 %255, %259
  br i1 %260, label %262, label %261

261:                                              ; preds = %254
  store i32 22, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #7
  br label %303

262:                                              ; preds = %254
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #7
  %263 = load i64, ptr %31, align 8, !tbaa !8
  store i64 %263, ptr %32, align 8, !tbaa !8
  br label %264

264:                                              ; preds = %293, %262
  %265 = load i64, ptr %32, align 8, !tbaa !8
  %266 = icmp sgt i64 %265, 0
  br i1 %266, label %268, label %267

267:                                              ; preds = %264
  store i32 25, ptr %4, align 4
  br label %298

268:                                              ; preds = %264
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #7
  %269 = load i64, ptr %31, align 8, !tbaa !8
  %270 = load i64, ptr %32, align 8, !tbaa !8
  %271 = xor i64 %269, %270
  store i64 %271, ptr %33, align 8, !tbaa !8
  %272 = load i64, ptr %32, align 8, !tbaa !8
  %273 = getelementptr inbounds [32768 x %"struct.std::pair"], ptr @dp, i64 0, i64 %272
  %274 = getelementptr inbounds %"struct.std::pair", ptr %273, i32 0, i32 0
  %275 = load i64, ptr %274, align 16, !tbaa !25
  %276 = xor i64 %275, -1
  %277 = icmp ne i64 %276, 0
  br i1 %277, label %278, label %289

278:                                              ; preds = %268
  %279 = load i64, ptr %33, align 8, !tbaa !8
  %280 = getelementptr inbounds [32768 x %"struct.std::pair"], ptr @dp, i64 0, i64 %279
  %281 = getelementptr inbounds %"struct.std::pair", ptr %280, i32 0, i32 0
  %282 = load i64, ptr %281, align 16, !tbaa !25
  %283 = xor i64 %282, -1
  %284 = icmp ne i64 %283, 0
  br i1 %284, label %285, label %289

285:                                              ; preds = %278
  call void @llvm.lifetime.start.p0(i64 16, ptr %34) #7
  call void @_ZNSt4pairIxxEC2IRxS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %34, ptr noundef nonnull align 8 dereferenceable(8) %32, ptr noundef nonnull align 8 dereferenceable(8) %33)
  %286 = load i64, ptr %31, align 8, !tbaa !8
  %287 = getelementptr inbounds [32768 x %"struct.std::pair"], ptr @dp, i64 0, i64 %286
  %288 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %287, ptr noundef nonnull align 8 dereferenceable(16) %34) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %34) #7
  store i32 25, ptr %4, align 4
  br label %290

289:                                              ; preds = %278, %268
  store i32 0, ptr %4, align 4
  br label %290

290:                                              ; preds = %289, %285
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #7
  %291 = load i32, ptr %4, align 4
  switch i32 %291, label %298 [
    i32 0, label %292
  ]

292:                                              ; preds = %290
  br label %293

293:                                              ; preds = %292
  %294 = load i64, ptr %32, align 8, !tbaa !8
  %295 = sub nsw i64 %294, 1
  %296 = load i64, ptr %31, align 8, !tbaa !8
  %297 = and i64 %295, %296
  store i64 %297, ptr %32, align 8, !tbaa !8
  br label %264, !llvm.loop !30

298:                                              ; preds = %290, %267
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #7
  br label %299

299:                                              ; preds = %298
  br label %300

300:                                              ; preds = %299
  %301 = load i64, ptr %31, align 8, !tbaa !8
  %302 = add nsw i64 %301, 1
  store i64 %302, ptr %31, align 8, !tbaa !8
  br label %254, !llvm.loop !31

303:                                              ; preds = %261
  call void @llvm.lifetime.start.p0(i64 8, ptr %35) #7
  %304 = load i64, ptr @K, align 8, !tbaa !8
  %305 = trunc i64 %304 to i32
  %306 = shl i32 1, %305
  %307 = sub nsw i32 %306, 1
  %308 = sext i32 %307 to i64
  store i64 %308, ptr %35, align 8, !tbaa !8
  %309 = load i64, ptr %35, align 8, !tbaa !8
  %310 = getelementptr inbounds [32768 x %"struct.std::pair"], ptr @dp, i64 0, i64 %309
  %311 = getelementptr inbounds %"struct.std::pair", ptr %310, i32 0, i32 0
  %312 = load i64, ptr %311, align 16, !tbaa !25
  %313 = xor i64 %312, -1
  %314 = icmp ne i64 %313, 0
  br i1 %314, label %315, label %342

315:                                              ; preds = %303
  %316 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
  %317 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %316, i8 noundef signext 10)
  %318 = load i64, ptr %35, align 8, !tbaa !8
  call void @_Z3dfsx(i64 noundef %318)
  call void @llvm.lifetime.start.p0(i64 8, ptr %36) #7
  store i64 0, ptr %36, align 8, !tbaa !8
  br label %319

319:                                              ; preds = %338, %315
  %320 = load i64, ptr %36, align 8, !tbaa !8
  %321 = load i64, ptr @K, align 8, !tbaa !8
  %322 = icmp slt i64 %320, %321
  br i1 %322, label %324, label %323

323:                                              ; preds = %319
  store i32 28, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %36) #7
  br label %341

324:                                              ; preds = %319
  %325 = load i64, ptr %36, align 8, !tbaa !8
  %326 = getelementptr inbounds [15 x %"struct.std::pair"], ptr @ans, i64 0, i64 %325
  %327 = getelementptr inbounds %"struct.std::pair", ptr %326, i32 0, i32 0
  %328 = load i64, ptr %327, align 16, !tbaa !25
  %329 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %328)
  %330 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %329, i8 noundef signext 32)
  %331 = load i64, ptr %36, align 8, !tbaa !8
  %332 = getelementptr inbounds [15 x %"struct.std::pair"], ptr @ans, i64 0, i64 %331
  %333 = getelementptr inbounds %"struct.std::pair", ptr %332, i32 0, i32 1
  %334 = load i64, ptr %333, align 8, !tbaa !27
  %335 = add nsw i64 %334, 1
  %336 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %330, i64 noundef %335)
  %337 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %336, i8 noundef signext 10)
  br label %338

338:                                              ; preds = %324
  %339 = load i64, ptr %36, align 8, !tbaa !8
  %340 = add nsw i64 %339, 1
  store i64 %340, ptr %36, align 8, !tbaa !8
  br label %319, !llvm.loop !32

341:                                              ; preds = %323
  br label %345

342:                                              ; preds = %303
  %343 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %344 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %343, i8 noundef signext 10)
  br label %345

345:                                              ; preds = %342, %341
  call void @llvm.lifetime.end.p0(i64 8, ptr %35) #7
  store i32 0, ptr %4, align 4
  br label %346

346:                                              ; preds = %345, %100
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  %347 = load i32, ptr %4, align 4
  switch i32 %347, label %355 [
    i32 0, label %348
    i32 1, label %348
  ]

348:                                              ; preds = %346, %346
  %349 = load i32, ptr %1, align 4
  ret i32 %349

350:                                              ; preds = %248
  %351 = load ptr, ptr %22, align 8
  %352 = load i32, ptr %23, align 4
  %353 = insertvalue { ptr, i32 } poison, ptr %351, 0
  %354 = insertvalue { ptr, i32 } %353, i32 %352, 1
  resume { ptr, i32 } %354

355:                                              ; preds = %346, %237, %191
  unreachable
}

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #5

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #6

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

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE4findERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #6

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

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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind willreturn }
attributes #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !10, i64 0}
!16 = distinct !{!16, !12}
!17 = !{!18, !18, i64 0}
!18 = !{!"bool", !10, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = !{!22, !9, i64 8}
!22 = !{!"_ZTSSt4pairIKxxE", !9, i64 0, !9, i64 8}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12}
!25 = !{!26, !9, i64 0}
!26 = !{!"_ZTSSt4pairIxxE", !9, i64 0, !9, i64 8}
!27 = !{!26, !9, i64 8}
!28 = distinct !{!28, !12}
!29 = distinct !{!29, !12}
!30 = distinct !{!30, !12}
!31 = distinct !{!31, !12}
!32 = distinct !{!32, !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"

%"struct.std::pair" = type { i64, i64 }
%"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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, std::pair<const long long, long long>, std::_Select1st<std::pair<const long long, long long>>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, std::pair<const long long, long long>, std::_Select1st<std::pair<const long long, long long>>, std::less<long long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"struct.std::_Rb_tree_iterator" = type { ptr }

@K = external dso_local global i64, align 8
@N = external dso_local global [15 x i64], align 16
@A = external dso_local global [15 x [5000 x i64]], align 16
@bsum = external dso_local local_unnamed_addr global [15 x i64], align 16
@dp = external dso_local global [32768 x %"struct.std::pair"], align 16
@ans = external dso_local local_unnamed_addr global [15 x %"struct.std::pair"], align 16
@V = external dso_local global [32768 x %"class.std::vector"], align 16
@M = external dso_local global %"class.std::map", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsx(i64 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxxEC2IRxS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"struct.std::pair", align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca %"class.std::vector", align 8
  %10 = alloca i64, align 8
  %11 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %12 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca %"struct.std::pair", align 8
  %16 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %17 = getelementptr i8, ptr %16, i64 -24
  %18 = load i64, ptr %17, align 8
  %19 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %18
  %20 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %19, ptr noundef null)
  %21 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %22 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @K)
  %23 = load i64, ptr @K, align 8, !tbaa !8
  %24 = icmp sgt i64 %23, 0
  br i1 %24, label %.lr.ph105, label %._crit_edge106

._crit_edge106:                                   ; preds = %._crit_edge, %0
  %.069.lcssa = phi i64 [ 0, %0 ], [ %.170.lcssa, %._crit_edge ]
  %25 = phi i64 [ %23, %0 ], [ %34, %._crit_edge ]
  %26 = srem i64 %.069.lcssa, %25
  %27 = sdiv i64 %.069.lcssa, %25
  %.not = icmp eq i64 %26, 0
  br i1 %.not, label %50, label %47

.lr.ph105:                                        ; preds = %0, %._crit_edge
  %.069103 = phi i64 [ %.170.lcssa, %._crit_edge ], [ 0, %0 ]
  %.071102 = phi i64 [ %33, %._crit_edge ], [ 0, %0 ]
  %28 = getelementptr inbounds [15 x i64], ptr @N, i64 0, i64 %.071102
  %29 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %28)
  %30 = load i64, ptr %28, align 8, !tbaa !8
  %31 = icmp sgt i64 %30, 0
  br i1 %31, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph105
  %32 = getelementptr inbounds [15 x i64], ptr @bsum, i64 0, i64 %.071102
  br label %36

._crit_edge:                                      ; preds = %36, %.lr.ph105
  %.170.lcssa = phi i64 [ %.069103, %.lr.ph105 ], [ %43, %36 ]
  %33 = add nuw nsw i64 %.071102, 1
  %34 = load i64, ptr @K, align 8, !tbaa !8
  %35 = icmp slt i64 %33, %34
  br i1 %35, label %.lr.ph105, label %._crit_edge106, !llvm.loop !11

36:                                               ; preds = %.lr.ph, %36
  %.170101 = phi i64 [ %.069103, %.lr.ph ], [ %43, %36 ]
  %.079100 = phi i64 [ 0, %.lr.ph ], [ %44, %36 ]
  %37 = getelementptr inbounds [15 x [5000 x i64]], ptr @A, i64 0, i64 %.071102, i64 %.079100
  %38 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %37)
  %39 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @M, ptr noundef nonnull align 8 dereferenceable(8) %37)
  store i64 %.071102, ptr %39, align 8, !tbaa !8
  %40 = load i64, ptr %37, align 8, !tbaa !8
  %41 = load i64, ptr %32, align 8, !tbaa !8
  %42 = add nsw i64 %41, %40
  store i64 %42, ptr %32, align 8, !tbaa !8
  %43 = add nsw i64 %40, %.170101
  %44 = add nuw nsw i64 %.079100, 1
  %45 = load i64, ptr %28, align 8, !tbaa !8
  %46 = icmp slt i64 %44, %45
  br i1 %46, label %36, label %._crit_edge, !llvm.loop !13

47:                                               ; preds = %._crit_edge106
  %48 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  %49 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %48, i8 noundef signext 10)
  br label %.loopexit

50:                                               ; preds = %._crit_edge106
  %51 = and i64 %25, 4294967295
  %.not138 = icmp eq i64 %51, 31
  br i1 %.not138, label %._crit_edge112, label %.lr.ph111

._crit_edge112:                                   ; preds = %.lr.ph111, %50
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  store i32 0, ptr %5, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  store i32 0, ptr %6, align 4, !tbaa !14
  call void @_ZNSt4pairIxxEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %52 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) @dp, ptr noundef nonnull align 8 dereferenceable(16) %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #7
  %53 = load i64, ptr @K, align 8, !tbaa !8
  %54 = icmp sgt i64 %53, 0
  br i1 %54, label %.preheader98, label %.preheader

.lr.ph111:                                        ; preds = %50, %.lr.ph111
  %.082109 = phi i64 [ %57, %.lr.ph111 ], [ 0, %50 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  store i32 -1, ptr %2, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  store i32 -1, ptr %3, align 4, !tbaa !14
  call void @_ZNSt4pairIxxEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %55 = getelementptr inbounds [32768 x %"struct.std::pair"], ptr @dp, i64 0, i64 %.082109
  %56 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %55, ptr noundef nonnull align 8 dereferenceable(16) %1) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #7
  %57 = add nuw nsw i64 %.082109, 1
  %58 = load i64, ptr @K, align 8, !tbaa !8
  %59 = trunc i64 %58 to i32
  %60 = shl nuw i32 1, %59
  %61 = sext i32 %60 to i64
  %62 = icmp slt i64 %57, %61
  br i1 %62, label %.lr.ph111, label %._crit_edge112, !llvm.loop !16

.preheader98:                                     ; preds = %._crit_edge112, %._crit_edge123
  %63 = phi i64 [ %69, %._crit_edge123 ], [ %53, %._crit_edge112 ]
  %.081124 = phi i64 [ %70, %._crit_edge123 ], [ 0, %._crit_edge112 ]
  %64 = getelementptr inbounds [15 x i64], ptr @N, i64 0, i64 %.081124
  %65 = load i64, ptr %64, align 8, !tbaa !8
  %66 = icmp sgt i64 %65, 0
  br i1 %66, label %.lr.ph122, label %._crit_edge123

.preheader:                                       ; preds = %._crit_edge123, %._crit_edge112
  %67 = phi i64 [ %53, %._crit_edge112 ], [ %69, %._crit_edge123 ]
  %68 = and i64 %67, 4294967295
  %.not139 = icmp eq i64 %68, 31
  br i1 %.not139, label %._crit_edge133, label %.lr.ph132

._crit_edge123.loopexit:                          ; preds = %153
  %.pre145 = load i64, ptr @K, align 8, !tbaa !8
  br label %._crit_edge123

._crit_edge123:                                   ; preds = %._crit_edge123.loopexit, %.preheader98
  %69 = phi i64 [ %.pre145, %._crit_edge123.loopexit ], [ %63, %.preheader98 ]
  %70 = add nuw nsw i64 %.081124, 1
  %71 = icmp slt i64 %70, %69
  br i1 %71, label %.preheader98, label %.preheader, !llvm.loop !17

.lr.ph122:                                        ; preds = %.preheader98, %153
  %.080121 = phi i64 [ %154, %153 ], [ 0, %.preheader98 ]
  %72 = load i64, ptr @K, align 8, !tbaa !8
  %73 = call ptr @llvm.stacksave.p0()
  %74 = alloca i8, i64 %72, align 16
  %75 = load i64, ptr @K, align 8, !tbaa !8
  %76 = getelementptr inbounds i8, ptr %74, i64 %75
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  store i32 0, ptr %7, align 4, !tbaa !14
  call void @_ZSt4fillIPbiEvT_S1_RKT0_(ptr noundef nonnull %74, ptr noundef nonnull %76, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %77 = getelementptr inbounds [15 x [5000 x i64]], ptr @A, i64 0, i64 %.081124, i64 %.080121
  %78 = load i64, ptr %77, align 8, !tbaa !8
  store i64 %78, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #7
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #7
  %79 = getelementptr inbounds i8, ptr %74, i64 %.081124
  %80 = load i8, ptr %79, align 1, !tbaa !18, !range !20, !noundef !21
  %81 = trunc nuw i8 %80 to i1
  br i1 %81, label %.lr.ph122..loopexit97_crit_edge, label %.lr.ph115

.lr.ph122..loopexit97_crit_edge:                  ; preds = %.lr.ph122
  %.pre = load i64, ptr %8, align 8, !tbaa !8
  br label %.loopexit97

.lr.ph115:                                        ; preds = %.lr.ph122, %96
  %82 = phi ptr [ %101, %96 ], [ %79, %.lr.ph122 ]
  %.075113 = phi i64 [ %99, %96 ], [ %.081124, %.lr.ph122 ]
  invoke void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %83 unwind label %92

83:                                               ; preds = %.lr.ph115
  store i8 1, ptr %82, align 1, !tbaa !18
  %84 = getelementptr inbounds [15 x i64], ptr @bsum, i64 0, i64 %.075113
  %85 = load i64, ptr %84, align 8, !tbaa !8
  %86 = load i64, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  %.neg = sub i64 %27, %85
  %87 = add i64 %.neg, %86
  store i64 %87, ptr %10, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #7
  %88 = invoke ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE4findERS3_(ptr noundef nonnull align 8 dereferenceable(48) @M, ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %89 unwind label %94

89:                                               ; preds = %83
  store ptr %88, ptr %11, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #7
  %90 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @M) #7
  store ptr %90, ptr %12, align 8
  %91 = call noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIKxxEES5_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #7
  br i1 %91, label %.thread, label %96

.thread:                                          ; preds = %89
  store i64 1000000000000000, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  br label %.loopexit97

92:                                               ; preds = %.lr.ph115
  %93 = landingpad { ptr, i32 }
          cleanup
  br label %159

94:                                               ; preds = %83
  %95 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  br label %159

96:                                               ; preds = %89
  %97 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  %98 = getelementptr inbounds i8, ptr %97, i64 8
  %99 = load i64, ptr %98, align 8, !tbaa !22
  %100 = load i64, ptr %10, align 8, !tbaa !8
  store i64 %100, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  %101 = getelementptr inbounds i8, ptr %74, i64 %99
  %102 = load i8, ptr %101, align 1, !tbaa !18, !range !20, !noundef !21
  %103 = trunc nuw i8 %102 to i1
  br i1 %103, label %.loopexit97, label %.lr.ph115

.loopexit97:                                      ; preds = %96, %.lr.ph122..loopexit97_crit_edge, %.thread
  %104 = phi i64 [ %.pre, %.lr.ph122..loopexit97_crit_edge ], [ 1000000000000000, %.thread ], [ %100, %96 ]
  %105 = load i64, ptr %77, align 8, !tbaa !8
  %.not88 = icmp eq i64 %104, %105
  br i1 %.not88, label %.preheader96, label %153

.preheader96:                                     ; preds = %.loopexit97
  %106 = load i64, ptr @K, align 8, !tbaa !8
  %107 = icmp sgt i64 %106, 0
  br i1 %107, label %.lr.ph118.preheader, label %._crit_edge119

.lr.ph118.preheader:                              ; preds = %.preheader96
  %xtraiter = and i64 %106, 3
  %108 = icmp ult i64 %106, 4
  br i1 %108, label %._crit_edge119.loopexit.unr-lcssa, label %.lr.ph118.preheader.new

.lr.ph118.preheader.new:                          ; preds = %.lr.ph118.preheader
  %unroll_iter = and i64 %106, 9223372036854775804
  br label %.lr.ph118

._crit_edge119.loopexit.unr-lcssa:                ; preds = %.lr.ph118, %.lr.ph118.preheader
  %.1.lcssa.ph = phi i64 [ poison, %.lr.ph118.preheader ], [ %.1.3, %.lr.ph118 ]
  %.067117.unr = phi i64 [ 0, %.lr.ph118.preheader ], [ %152, %.lr.ph118 ]
  %.068116.unr = phi i64 [ 0, %.lr.ph118.preheader ], [ %.1.3, %.lr.ph118 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge119, label %.lr.ph118.epil

.lr.ph118.epil:                                   ; preds = %._crit_edge119.loopexit.unr-lcssa, %.lr.ph118.epil
  %.067117.epil = phi i64 [ %116, %.lr.ph118.epil ], [ %.067117.unr, %._crit_edge119.loopexit.unr-lcssa ]
  %.068116.epil = phi i64 [ %.1.epil, %.lr.ph118.epil ], [ %.068116.unr, %._crit_edge119.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph118.epil ], [ 0, %._crit_edge119.loopexit.unr-lcssa ]
  %109 = getelementptr inbounds i8, ptr %74, i64 %.067117.epil
  %110 = load i8, ptr %109, align 1, !tbaa !18, !range !20, !noundef !21
  %111 = trunc nuw i8 %110 to i1
  %112 = trunc i64 %.067117.epil to i32
  %113 = shl nuw i32 1, %112
  %114 = sext i32 %113 to i64
  %115 = select i1 %111, i64 %114, i64 0
  %.1.epil = or i64 %115, %.068116.epil
  %116 = add nuw nsw i64 %.067117.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge119, label %.lr.ph118.epil, !llvm.loop !24

._crit_edge119:                                   ; preds = %._crit_edge119.loopexit.unr-lcssa, %.lr.ph118.epil, %.preheader96
  %.068.lcssa = phi i64 [ 0, %.preheader96 ], [ %.1.lcssa.ph, %._crit_edge119.loopexit.unr-lcssa ], [ %.1.epil, %.lr.ph118.epil ]
  %117 = getelementptr inbounds [32768 x %"struct.std::pair"], ptr @dp, i64 0, i64 %.068.lcssa
  store i64 %.068.lcssa, ptr %117, align 16, !tbaa !26
  %118 = getelementptr inbounds i8, ptr %117, i64 8
  store i64 0, ptr %118, align 8, !tbaa !28
  %119 = getelementptr inbounds [32768 x %"class.std::vector"], ptr @V, i64 0, i64 %.068.lcssa
  %120 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIxSaIxEEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %119, ptr noundef nonnull align 8 dereferenceable(24) %9)
          to label %153 unwind label %157

.lr.ph118:                                        ; preds = %.lr.ph118, %.lr.ph118.preheader.new
  %.067117 = phi i64 [ 0, %.lr.ph118.preheader.new ], [ %152, %.lr.ph118 ]
  %.068116 = phi i64 [ 0, %.lr.ph118.preheader.new ], [ %.1.3, %.lr.ph118 ]
  %niter = phi i64 [ 0, %.lr.ph118.preheader.new ], [ %niter.next.3, %.lr.ph118 ]
  %121 = getelementptr inbounds i8, ptr %74, i64 %.067117
  %122 = load i8, ptr %121, align 4, !tbaa !18, !range !20, !noundef !21
  %123 = trunc nuw i8 %122 to i1
  %124 = trunc i64 %.067117 to i32
  %125 = shl nuw i32 1, %124
  %126 = zext nneg i32 %125 to i64
  %127 = select i1 %123, i64 %126, i64 0
  %.1 = or i64 %127, %.068116
  %128 = or disjoint i64 %.067117, 1
  %129 = getelementptr inbounds i8, ptr %74, i64 %128
  %130 = load i8, ptr %129, align 1, !tbaa !18, !range !20, !noundef !21
  %131 = trunc nuw i8 %130 to i1
  %132 = trunc i64 %128 to i32
  %133 = shl nuw i32 1, %132
  %134 = zext nneg i32 %133 to i64
  %135 = select i1 %131, i64 %134, i64 0
  %.1.1 = or i64 %135, %.1
  %136 = or disjoint i64 %.067117, 2
  %137 = getelementptr inbounds i8, ptr %74, i64 %136
  %138 = load i8, ptr %137, align 2, !tbaa !18, !range !20, !noundef !21
  %139 = trunc nuw i8 %138 to i1
  %140 = trunc i64 %136 to i32
  %141 = shl nuw i32 1, %140
  %142 = zext nneg i32 %141 to i64
  %143 = select i1 %139, i64 %142, i64 0
  %.1.2 = or i64 %143, %.1.1
  %144 = or disjoint i64 %.067117, 3
  %145 = getelementptr inbounds i8, ptr %74, i64 %144
  %146 = load i8, ptr %145, align 1, !tbaa !18, !range !20, !noundef !21
  %147 = trunc nuw i8 %146 to i1
  %148 = trunc i64 %144 to i32
  %149 = shl nuw i32 1, %148
  %150 = sext i32 %149 to i64
  %151 = select i1 %147, i64 %150, i64 0
  %.1.3 = or i64 %151, %.1.2
  %152 = add nuw nsw i64 %.067117, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge119.loopexit.unr-lcssa, label %.lr.ph118, !llvm.loop !29

153:                                              ; preds = %._crit_edge119, %.loopexit97
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  call void @llvm.stackrestore.p0(ptr %73)
  %154 = add nuw nsw i64 %.080121, 1
  %155 = load i64, ptr %64, align 8, !tbaa !8
  %156 = icmp slt i64 %154, %155
  br i1 %156, label %.lr.ph122, label %._crit_edge123.loopexit, !llvm.loop !30

157:                                              ; preds = %._crit_edge119
  %158 = landingpad { ptr, i32 }
          cleanup
  br label %159

159:                                              ; preds = %157, %94, %92
  %.pn = phi { ptr, i32 } [ %158, %157 ], [ %95, %94 ], [ %93, %92 ]
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  resume { ptr, i32 } %.pn

._crit_edge133.loopexit:                          ; preds = %.loopexit95
  %160 = add nsw i32 %179, -1
  %161 = sext i32 %160 to i64
  br label %._crit_edge133

._crit_edge133:                                   ; preds = %._crit_edge133.loopexit, %.preheader
  %.lcssa = phi i64 [ 2147483647, %.preheader ], [ %161, %._crit_edge133.loopexit ]
  %162 = getelementptr inbounds [32768 x %"struct.std::pair"], ptr @dp, i64 0, i64 %.lcssa
  %163 = load i64, ptr %162, align 16, !tbaa !26
  %.not84 = icmp eq i64 %163, -1
  br i1 %.not84, label %199, label %182

.lr.ph132:                                        ; preds = %.preheader, %.loopexit95
  %164 = phi i64 [ %176, %.loopexit95 ], [ %67, %.preheader ]
  %.066130 = phi i64 [ %177, %.loopexit95 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #7
  %.not147 = icmp eq i64 %.066130, 0
  br i1 %.not147, label %.loopexit95, label %.lr.ph128

.lr.ph128:                                        ; preds = %.lr.ph132, %173
  %storemerge126 = phi i64 [ %175, %173 ], [ %.066130, %.lr.ph132 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #7
  %165 = xor i64 %storemerge126, %.066130
  store i64 %165, ptr %14, align 8, !tbaa !8
  %166 = getelementptr inbounds [32768 x %"struct.std::pair"], ptr @dp, i64 0, i64 %storemerge126
  %167 = load i64, ptr %166, align 16, !tbaa !26
  %.not85 = icmp eq i64 %167, -1
  br i1 %.not85, label %173, label %168

168:                                              ; preds = %.lr.ph128
  %169 = getelementptr inbounds [32768 x %"struct.std::pair"], ptr @dp, i64 0, i64 %165
  %170 = load i64, ptr %169, align 16, !tbaa !26
  %.not86 = icmp eq i64 %170, -1
  br i1 %.not86, label %173, label %.critedge

.critedge:                                        ; preds = %168
  store i64 %storemerge126, ptr %13, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %15) #7
  call void @_ZNSt4pairIxxEC2IRxS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %171 = getelementptr inbounds [32768 x %"struct.std::pair"], ptr @dp, i64 0, i64 %.066130
  %172 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %171, ptr noundef nonnull align 8 dereferenceable(16) %15) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #7
  %.pre146 = load i64, ptr @K, align 8, !tbaa !8
  br label %.loopexit95

173:                                              ; preds = %.lr.ph128, %168
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #7
  %174 = add nuw i64 %storemerge126, 9223372036854775807
  %175 = and i64 %174, %.066130
  %.not148 = icmp eq i64 %175, 0
  br i1 %.not148, label %.loopexit95, label %.lr.ph128, !llvm.loop !31

.loopexit95:                                      ; preds = %173, %.lr.ph132, %.critedge
  %176 = phi i64 [ %.pre146, %.critedge ], [ %164, %.lr.ph132 ], [ %164, %173 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #7
  %177 = add nuw nsw i64 %.066130, 1
  %178 = trunc i64 %176 to i32
  %179 = shl nuw i32 1, %178
  %180 = sext i32 %179 to i64
  %181 = icmp slt i64 %177, %180
  br i1 %181, label %.lr.ph132, label %._crit_edge133.loopexit, !llvm.loop !32

182:                                              ; preds = %._crit_edge133
  %183 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.3)
  %184 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %183, i8 noundef signext 10)
  call void @_Z3dfsx(i64 noundef %.lcssa)
  %185 = load i64, ptr @K, align 8, !tbaa !8
  %186 = icmp sgt i64 %185, 0
  br i1 %186, label %.lr.ph137, label %.loopexit

.lr.ph137:                                        ; preds = %182, %.lr.ph137
  %.0135 = phi i64 [ %196, %.lr.ph137 ], [ 0, %182 ]
  %187 = getelementptr inbounds [15 x %"struct.std::pair"], ptr @ans, i64 0, i64 %.0135
  %188 = load i64, ptr %187, align 16, !tbaa !26
  %189 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %188)
  %190 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %189, i8 noundef signext 32)
  %191 = getelementptr inbounds i8, ptr %187, i64 8
  %192 = load i64, ptr %191, align 8, !tbaa !28
  %193 = add nsw i64 %192, 1
  %194 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %190, i64 noundef %193)
  %195 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %194, i8 noundef signext 10)
  %196 = add nuw nsw i64 %.0135, 1
  %197 = load i64, ptr @K, align 8, !tbaa !8
  %198 = icmp slt i64 %196, %197
  br i1 %198, label %.lr.ph137, label %.loopexit, !llvm.loop !33

199:                                              ; preds = %._crit_edge133
  %200 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  %201 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %200, i8 noundef signext 10)
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph137, %182, %199, %47
  ret i32 0
}

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #6

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

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE4findERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

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

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

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #6

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

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 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !10, i64 0}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = !{!19, !19, i64 0}
!19 = !{!"bool", !10, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!23, !9, i64 8}
!23 = !{!"_ZTSSt4pairIKxxE", !9, i64 0, !9, i64 8}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.unroll.disable"}
!26 = !{!27, !9, i64 0}
!27 = !{!"_ZTSSt4pairIxxE", !9, i64 0, !9, i64 8}
!28 = !{!27, !9, i64 8}
!29 = distinct !{!29, !12}
!30 = distinct !{!30, !12}
!31 = distinct !{!31, !12}
!32 = distinct !{!32, !12}
!33 = distinct !{!33, !12}


; Effective O3 passes: ADCEPass,CorrelatedValuePropagationPass,DSEPass,DivRemPairsPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass