; LLVM IR from Izaron/ACM-ICPC :: Russian Council of School Olympiads (R.S.O.Sh.)/IOIP/IOIP 2015 (cakes)

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

%"class.std::basic_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::pair" = type { i64, i64 }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.0", %"struct.std::_Head_base.3" }
%"struct.std::_Tuple_impl.0" = type { %"struct.std::_Tuple_impl.1", %"struct.std::_Head_base.2" }
%"struct.std::_Tuple_impl.1" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { i64 }
%"struct.std::_Head_base.2" = type { i64 }
%"struct.std::_Head_base.3" = type { i64 }
%"class.std::tuple.4" = type { %"struct.std::_Tuple_impl.5" }
%"struct.std::_Tuple_impl.5" = type { %"struct.std::_Tuple_impl.6", %"struct.std::_Head_base.3" }
%"struct.std::_Tuple_impl.6" = type { %"struct.std::_Tuple_impl.7", %"struct.std::_Head_base.2" }
%"struct.std::_Tuple_impl.7" = type { %"struct.std::_Head_base.8" }
%"struct.std::_Head_base.8" = type { i32 }

@_ZL1M = external hidden global i32, align 4
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca [100005 x %"struct.std::pair"], align 16
  %5 = alloca i32, align 4
  %6 = alloca [100005 x %"class.std::tuple"], align 16
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::tuple.4", align 8
  %9 = alloca [100005 x i32], align 16
  %10 = alloca i32, align 4
  %11 = alloca [100005 x i64], align 16
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %24 = load ptr, ptr @stdin, align 8, !tbaa !5
  %25 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.2, ptr noundef %24)
  %26 = load ptr, ptr @stdout, align 8, !tbaa !5
  %27 = call ptr @freopen(ptr noundef @.str.3, ptr noundef @.str.4, ptr noundef %26)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #8
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERy(ptr noundef nonnull align 8 dereferenceable(16) %28, ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.start.p0(i64 1600080, ptr %4) #8
  %30 = getelementptr inbounds [100005 x %"struct.std::pair"], ptr %4, i32 0, i32 0
  %31 = getelementptr inbounds %"struct.std::pair", ptr %30, i64 100005
  br label %32

32:                                               ; preds = %32, %0
  %33 = phi ptr [ %30, %0 ], [ %34, %32 ]
  call void @_ZNSt4pairIyyEC2IyyTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16) %33)
  %34 = getelementptr inbounds %"struct.std::pair", ptr %33, i64 1
  %35 = icmp eq ptr %34, %31
  br i1 %35, label %36, label %32

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

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

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

42:                                               ; preds = %37
  %43 = load i32, ptr %5, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [100005 x %"struct.std::pair"], ptr %4, i64 0, i64 %44
  %46 = getelementptr inbounds %"struct.std::pair", ptr %45, i32 0, i32 0
  %47 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERy(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %46)
  %48 = load i32, ptr %5, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [100005 x %"struct.std::pair"], ptr %4, i64 0, i64 %49
  %51 = getelementptr inbounds %"struct.std::pair", ptr %50, i32 0, i32 1
  %52 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERy(ptr noundef nonnull align 8 dereferenceable(16) %47, ptr noundef nonnull align 8 dereferenceable(8) %51)
  br label %53

53:                                               ; preds = %42
  %54 = load i32, ptr %5, align 4, !tbaa !9
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %5, align 4, !tbaa !9
  br label %37, !llvm.loop !11

56:                                               ; preds = %41
  %57 = getelementptr inbounds [100005 x %"struct.std::pair"], ptr %4, i64 0, i64 0
  %58 = getelementptr inbounds [100005 x %"struct.std::pair"], ptr %4, i64 0, i64 0
  %59 = load i32, ptr %2, align 4, !tbaa !9
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds %"struct.std::pair", ptr %58, i64 %60
  call void @_ZSt4sortIPSt4pairIyyEEvT_S3_(ptr noundef %57, ptr noundef %61)
  call void @llvm.lifetime.start.p0(i64 2400120, ptr %6) #8
  %62 = getelementptr inbounds [100005 x %"class.std::tuple"], ptr %6, i32 0, i32 0
  %63 = getelementptr inbounds %"class.std::tuple", ptr %62, i64 100005
  br label %64

64:                                               ; preds = %64, %56
  %65 = phi ptr [ %62, %56 ], [ %66, %64 ]
  call void @_ZNSt5tupleIJyyyEEC2IvTnNSt9enable_ifIXclsr4_TCCIXsr7is_voidIT_EE5valueEEE37__is_implicitly_default_constructibleEEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(24) %65) #8
  %66 = getelementptr inbounds %"class.std::tuple", ptr %65, i64 1
  %67 = icmp eq ptr %66, %63
  br i1 %67, label %68, label %64

68:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %69

69:                                               ; preds = %87, %68
  %70 = load i32, ptr %7, align 4, !tbaa !9
  %71 = load i32, ptr %2, align 4, !tbaa !9
  %72 = icmp slt i32 %70, %71
  br i1 %72, label %74, label %73

73:                                               ; preds = %69
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %90

74:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #8
  %75 = load i32, ptr %7, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [100005 x %"struct.std::pair"], ptr %4, i64 0, i64 %76
  %78 = getelementptr inbounds %"struct.std::pair", ptr %77, i32 0, i32 1
  %79 = load i32, ptr %7, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [100005 x %"struct.std::pair"], ptr %4, i64 0, i64 %80
  %82 = getelementptr inbounds %"struct.std::pair", ptr %81, i32 0, i32 0
  call void @_ZSt10make_tupleIJRyS0_RiEESt5tupleIJDpNSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeEEEDpOS5_(ptr dead_on_unwind writable sret(%"class.std::tuple.4") align 8 %8, ptr noundef nonnull align 8 dereferenceable(8) %78, ptr noundef nonnull align 8 dereferenceable(8) %82, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %83 = load i32, ptr %7, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [100005 x %"class.std::tuple"], ptr %6, i64 0, i64 %84
  %86 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt5tupleIJyyyEEaSIJyyiEEENSt9enable_ifIXcl12__assignableIDpT_EEERS0_E4typeEOS_IJS4_EE(ptr noundef nonnull align 8 dereferenceable(24) %85, ptr noundef nonnull align 8 dereferenceable(24) %8) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #8
  br label %87

87:                                               ; preds = %74
  %88 = load i32, ptr %7, align 4, !tbaa !9
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %7, align 4, !tbaa !9
  br label %69, !llvm.loop !13

90:                                               ; preds = %73
  %91 = getelementptr inbounds [100005 x %"class.std::tuple"], ptr %6, i64 0, i64 0
  %92 = getelementptr inbounds [100005 x %"class.std::tuple"], ptr %6, i64 0, i64 0
  %93 = load i32, ptr %2, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds %"class.std::tuple", ptr %92, i64 %94
  call void @_ZSt4sortIPSt5tupleIJyyyEEEvT_S3_(ptr noundef %91, ptr noundef %95)
  call void @llvm.lifetime.start.p0(i64 400020, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %96

96:                                               ; preds = %109, %90
  %97 = load i32, ptr %10, align 4, !tbaa !9
  %98 = load i32, ptr %2, align 4, !tbaa !9
  %99 = icmp slt i32 %97, %98
  br i1 %99, label %101, label %100

100:                                              ; preds = %96
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %112

101:                                              ; preds = %96
  %102 = load i32, ptr %10, align 4, !tbaa !9
  %103 = load i32, ptr %10, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [100005 x %"class.std::tuple"], ptr %6, i64 0, i64 %104
  %106 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3getILm2EJyyyEERNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERS4_(ptr noundef nonnull align 8 dereferenceable(24) %105) #8
  %107 = load i64, ptr %106, align 8, !tbaa !14
  %108 = getelementptr inbounds [100005 x i32], ptr %9, i64 0, i64 %107
  store i32 %102, ptr %108, align 4, !tbaa !9
  br label %109

109:                                              ; preds = %101
  %110 = load i32, ptr %10, align 4, !tbaa !9
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %10, align 4, !tbaa !9
  br label %96, !llvm.loop !16

112:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 800040, ptr %11) #8
  %113 = load i32, ptr @_ZL1M, align 4, !tbaa !9
  %114 = zext i32 %113 to i64
  %115 = call ptr @llvm.stacksave.p0()
  store ptr %115, ptr %12, align 8
  %116 = alloca %"struct.std::pair", i64 %114, align 16
  store i64 %114, ptr %13, align 8
  %117 = icmp eq i64 %114, 0
  br i1 %117, label %124, label %118

118:                                              ; preds = %112
  %119 = getelementptr inbounds %"struct.std::pair", ptr %116, i64 %114
  br label %120

120:                                              ; preds = %120, %118
  %121 = phi ptr [ %116, %118 ], [ %122, %120 ]
  call void @_ZNSt4pairIyyEC2IyyTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16) %121)
  %122 = getelementptr inbounds %"struct.std::pair", ptr %121, i64 1
  %123 = icmp eq ptr %122, %119
  br i1 %123, label %124, label %120

124:                                              ; preds = %120, %112
  %125 = getelementptr inbounds [100005 x i64], ptr %11, i64 0, i64 0
  %126 = getelementptr inbounds [100005 x i64], ptr %11, i64 0, i64 0
  %127 = getelementptr inbounds i64, ptr %126, i64 100005
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 0, ptr %14, align 4, !tbaa !9
  call void @_ZSt4fillIPyiEvT_S1_RKT0_(ptr noundef %125, ptr noundef %127, ptr noundef nonnull align 4 dereferenceable(4) %14)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 0, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %128

128:                                              ; preds = %297, %124
  %129 = load i32, ptr %16, align 4, !tbaa !9
  %130 = load i32, ptr %2, align 4, !tbaa !9
  %131 = icmp slt i32 %129, %130
  br i1 %131, label %133, label %132

132:                                              ; preds = %128
  store i32 11, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %300

133:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  %134 = load i64, ptr %3, align 8, !tbaa !14
  %135 = load i32, ptr %16, align 4, !tbaa !9
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [100005 x %"struct.std::pair"], ptr %4, i64 0, i64 %136
  %138 = getelementptr inbounds %"struct.std::pair", ptr %137, i32 0, i32 0
  %139 = load i64, ptr %138, align 16, !tbaa !17
  %140 = sub i64 %134, %139
  %141 = load i32, ptr %16, align 4, !tbaa !9
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [100005 x %"struct.std::pair"], ptr %4, i64 0, i64 %142
  %144 = getelementptr inbounds %"struct.std::pair", ptr %143, i32 0, i32 1
  %145 = load i64, ptr %144, align 8, !tbaa !19
  %146 = sub i64 %140, %145
  %147 = trunc i64 %146 to i32
  store i32 %147, ptr %18, align 4, !tbaa !9
  %148 = load i32, ptr %18, align 4, !tbaa !9
  %149 = icmp slt i32 %148, 0
  br i1 %149, label %150, label %184

150:                                              ; preds = %133
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  %151 = load i32, ptr %16, align 4, !tbaa !9
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [100005 x i32], ptr %9, i64 0, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !9
  store i32 %154, ptr %19, align 4, !tbaa !9
  %155 = load i32, ptr %16, align 4, !tbaa !9
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [100005 x %"struct.std::pair"], ptr %4, i64 0, i64 %156
  %158 = getelementptr inbounds %"struct.std::pair", ptr %157, i32 0, i32 1
  %159 = load i64, ptr %158, align 8, !tbaa !19
  %160 = load i32, ptr %19, align 4, !tbaa !9
  %161 = load i32, ptr @_ZL1M, align 4, !tbaa !9
  %162 = sdiv i32 %160, %161
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds %"struct.std::pair", ptr %116, i64 %163
  %165 = getelementptr inbounds %"struct.std::pair", ptr %164, i32 0, i32 0
  %166 = load i64, ptr %165, align 16, !tbaa !17
  %167 = add i64 %166, %159
  store i64 %167, ptr %165, align 16, !tbaa !17
  %168 = load i32, ptr %19, align 4, !tbaa !9
  %169 = load i32, ptr @_ZL1M, align 4, !tbaa !9
  %170 = sdiv i32 %168, %169
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds %"struct.std::pair", ptr %116, i64 %171
  %173 = getelementptr inbounds %"struct.std::pair", ptr %172, i32 0, i32 1
  %174 = load i64, ptr %173, align 8, !tbaa !19
  %175 = add i64 %174, 1
  store i64 %175, ptr %173, align 8, !tbaa !19
  %176 = load i32, ptr %16, align 4, !tbaa !9
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [100005 x %"struct.std::pair"], ptr %4, i64 0, i64 %177
  %179 = getelementptr inbounds %"struct.std::pair", ptr %178, i32 0, i32 1
  %180 = load i64, ptr %179, align 8, !tbaa !19
  %181 = load i32, ptr %19, align 4, !tbaa !9
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [100005 x i64], ptr %11, i64 0, i64 %182
  store i64 %180, ptr %183, align 8, !tbaa !14
  store i32 13, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %294

184:                                              ; preds = %133
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  store i32 1, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #8
  store i32 0, ptr %21, align 4, !tbaa !9
  br label %185

185:                                              ; preds = %255, %184
  %186 = load i32, ptr %21, align 4, !tbaa !9
  %187 = load i32, ptr @_ZL1M, align 4, !tbaa !9
  %188 = icmp slt i32 %186, %187
  br i1 %188, label %190, label %189

189:                                              ; preds = %185
  store i32 14, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  br label %258

190:                                              ; preds = %185
  %191 = load i32, ptr %18, align 4, !tbaa !9
  %192 = sext i32 %191 to i64
  %193 = load i32, ptr %21, align 4, !tbaa !9
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds %"struct.std::pair", ptr %116, i64 %194
  %196 = getelementptr inbounds %"struct.std::pair", ptr %195, i32 0, i32 0
  %197 = load i64, ptr %196, align 16, !tbaa !17
  %198 = icmp uge i64 %192, %197
  br i1 %198, label %199, label %218

199:                                              ; preds = %190
  %200 = load i32, ptr %21, align 4, !tbaa !9
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds %"struct.std::pair", ptr %116, i64 %201
  %203 = getelementptr inbounds %"struct.std::pair", ptr %202, i32 0, i32 1
  %204 = load i64, ptr %203, align 8, !tbaa !19
  %205 = load i32, ptr %20, align 4, !tbaa !9
  %206 = sext i32 %205 to i64
  %207 = add i64 %206, %204
  %208 = trunc i64 %207 to i32
  store i32 %208, ptr %20, align 4, !tbaa !9
  %209 = load i32, ptr %21, align 4, !tbaa !9
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds %"struct.std::pair", ptr %116, i64 %210
  %212 = getelementptr inbounds %"struct.std::pair", ptr %211, i32 0, i32 0
  %213 = load i64, ptr %212, align 16, !tbaa !17
  %214 = load i32, ptr %18, align 4, !tbaa !9
  %215 = sext i32 %214 to i64
  %216 = sub i64 %215, %213
  %217 = trunc i64 %216 to i32
  store i32 %217, ptr %18, align 4, !tbaa !9
  br label %254

218:                                              ; preds = %190
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #8
  %219 = load i32, ptr %21, align 4, !tbaa !9
  %220 = load i32, ptr @_ZL1M, align 4, !tbaa !9
  %221 = mul nsw i32 %219, %220
  store i32 %221, ptr %22, align 4, !tbaa !9
  br label %222

222:                                              ; preds = %250, %218
  %223 = load i32, ptr %18, align 4, !tbaa !9
  %224 = sext i32 %223 to i64
  %225 = load i32, ptr %22, align 4, !tbaa !9
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [100005 x i64], ptr %11, i64 0, i64 %226
  %228 = load i64, ptr %227, align 8, !tbaa !14
  %229 = icmp uge i64 %224, %228
  br i1 %229, label %230, label %248

230:                                              ; preds = %222
  %231 = load i32, ptr %22, align 4, !tbaa !9
  %232 = sext i32 %231 to i64
  %233 = getelementptr inbounds [100005 x i64], ptr %11, i64 0, i64 %232
  %234 = load i64, ptr %233, align 8, !tbaa !14
  %235 = icmp ugt i64 %234, 0
  br i1 %235, label %236, label %239

236:                                              ; preds = %230
  %237 = load i32, ptr %20, align 4, !tbaa !9
  %238 = add nsw i32 %237, 1
  store i32 %238, ptr %20, align 4, !tbaa !9
  br label %239

239:                                              ; preds = %236, %230
  %240 = load i32, ptr %22, align 4, !tbaa !9
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds [100005 x i64], ptr %11, i64 0, i64 %241
  %243 = load i64, ptr %242, align 8, !tbaa !14
  %244 = load i32, ptr %18, align 4, !tbaa !9
  %245 = sext i32 %244 to i64
  %246 = sub i64 %245, %243
  %247 = trunc i64 %246 to i32
  store i32 %247, ptr %18, align 4, !tbaa !9
  br label %249

248:                                              ; preds = %222
  store i32 17, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #8
  br label %253

249:                                              ; preds = %239
  br label %250

250:                                              ; preds = %249
  %251 = load i32, ptr %22, align 4, !tbaa !9
  %252 = add nsw i32 %251, 1
  store i32 %252, ptr %22, align 4, !tbaa !9
  br label %222, !llvm.loop !20

253:                                              ; preds = %248
  br label %254

254:                                              ; preds = %253, %199
  br label %255

255:                                              ; preds = %254
  %256 = load i32, ptr %21, align 4, !tbaa !9
  %257 = add nsw i32 %256, 1
  store i32 %257, ptr %21, align 4, !tbaa !9
  br label %185, !llvm.loop !21

258:                                              ; preds = %189
  %259 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %20)
  %260 = load i32, ptr %259, align 4, !tbaa !9
  store i32 %260, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #8
  %261 = load i32, ptr %16, align 4, !tbaa !9
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds [100005 x i32], ptr %9, i64 0, i64 %262
  %264 = load i32, ptr %263, align 4, !tbaa !9
  store i32 %264, ptr %23, align 4, !tbaa !9
  %265 = load i32, ptr %16, align 4, !tbaa !9
  %266 = sext i32 %265 to i64
  %267 = getelementptr inbounds [100005 x %"struct.std::pair"], ptr %4, i64 0, i64 %266
  %268 = getelementptr inbounds %"struct.std::pair", ptr %267, i32 0, i32 1
  %269 = load i64, ptr %268, align 8, !tbaa !19
  %270 = load i32, ptr %23, align 4, !tbaa !9
  %271 = load i32, ptr @_ZL1M, align 4, !tbaa !9
  %272 = sdiv i32 %270, %271
  %273 = sext i32 %272 to i64
  %274 = getelementptr inbounds %"struct.std::pair", ptr %116, i64 %273
  %275 = getelementptr inbounds %"struct.std::pair", ptr %274, i32 0, i32 0
  %276 = load i64, ptr %275, align 16, !tbaa !17
  %277 = add i64 %276, %269
  store i64 %277, ptr %275, align 16, !tbaa !17
  %278 = load i32, ptr %23, align 4, !tbaa !9
  %279 = load i32, ptr @_ZL1M, align 4, !tbaa !9
  %280 = sdiv i32 %278, %279
  %281 = sext i32 %280 to i64
  %282 = getelementptr inbounds %"struct.std::pair", ptr %116, i64 %281
  %283 = getelementptr inbounds %"struct.std::pair", ptr %282, i32 0, i32 1
  %284 = load i64, ptr %283, align 8, !tbaa !19
  %285 = add i64 %284, 1
  store i64 %285, ptr %283, align 8, !tbaa !19
  %286 = load i32, ptr %16, align 4, !tbaa !9
  %287 = sext i32 %286 to i64
  %288 = getelementptr inbounds [100005 x %"struct.std::pair"], ptr %4, i64 0, i64 %287
  %289 = getelementptr inbounds %"struct.std::pair", ptr %288, i32 0, i32 1
  %290 = load i64, ptr %289, align 8, !tbaa !19
  %291 = load i32, ptr %23, align 4, !tbaa !9
  %292 = sext i32 %291 to i64
  %293 = getelementptr inbounds [100005 x i64], ptr %11, i64 0, i64 %292
  store i64 %290, ptr %293, align 8, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  store i32 0, ptr %17, align 4
  br label %294

294:                                              ; preds = %258, %150
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  %295 = load i32, ptr %17, align 4
  switch i32 %295, label %305 [
    i32 0, label %296
    i32 13, label %297
  ]

296:                                              ; preds = %294
  br label %297

297:                                              ; preds = %296, %294
  %298 = load i32, ptr %16, align 4, !tbaa !9
  %299 = add nsw i32 %298, 1
  store i32 %299, ptr %16, align 4, !tbaa !9
  br label %128, !llvm.loop !22

300:                                              ; preds = %132
  %301 = load i32, ptr %15, align 4, !tbaa !9
  %302 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %301)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  %303 = load ptr, ptr %12, align 8
  call void @llvm.stackrestore.p0(ptr %303)
  call void @llvm.lifetime.end.p0(i64 800040, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 400020, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 2400120, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 1600080, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  %304 = load i32, ptr %1, align 4
  ret i32 %304

305:                                              ; preds = %294
  unreachable
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIyyEC2IyyTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4 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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIyyEEvT_S3_(ptr noundef, ptr noundef) #5

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZSt10make_tupleIJRyS0_RiEESt5tupleIJDpNSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeEEEDpOS5_(ptr dead_on_unwind noalias writable sret(%"class.std::tuple.4") align 8, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt5tupleIJyyyEEEvT_S3_(ptr noundef, ptr noundef) #5

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #7

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #1

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 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 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 #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 = { 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 #8 = { 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 = !{!"any pointer", !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 = !{!15, !15, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = distinct !{!16, !12}
!17 = !{!18, !15, i64 0}
!18 = !{!"_ZTSSt4pairIyyE", !15, i64 0, !15, i64 8}
!19 = !{!18, !15, i64 8}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}


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

%"class.std::basic_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::pair" = type { i64, i64 }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.0", %"struct.std::_Head_base.3" }
%"struct.std::_Tuple_impl.0" = type { %"struct.std::_Tuple_impl.1", %"struct.std::_Head_base.2" }
%"struct.std::_Tuple_impl.1" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { i64 }
%"struct.std::_Head_base.2" = type { i64 }
%"struct.std::_Head_base.3" = type { i64 }
%"class.std::tuple.4" = type { %"struct.std::_Tuple_impl.5" }
%"struct.std::_Tuple_impl.5" = type { %"struct.std::_Tuple_impl.6", %"struct.std::_Head_base.3" }
%"struct.std::_Tuple_impl.6" = type { %"struct.std::_Tuple_impl.7", %"struct.std::_Head_base.2" }
%"struct.std::_Tuple_impl.7" = type { %"struct.std::_Head_base.8" }
%"struct.std::_Head_base.8" = type { i32 }

@_ZL1M = external hidden local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca [100005 x %"struct.std::pair"], align 16
  %4 = alloca [100005 x %"class.std::tuple"], align 16
  %5 = alloca i32, align 4
  %6 = alloca %"class.std::tuple.4", align 8
  %7 = alloca [100005 x i32], align 16
  %8 = alloca [100005 x i64], align 16
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = load ptr, ptr @stdin, align 8, !tbaa !5
  %13 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.2, ptr noundef %12)
  %14 = load ptr, ptr @stdout, align 8, !tbaa !5
  %15 = tail call ptr @freopen(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, ptr noundef %14)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERy(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 8 dereferenceable(8) %2)
  call void @llvm.lifetime.start.p0(i64 1600080, ptr nonnull %3) #8
  br label %18

18:                                               ; preds = %18, %0
  %.idx = phi i64 [ 0, %0 ], [ %.add, %18 ]
  %.ptr = getelementptr inbounds i8, ptr %3, i64 %.idx
  call void @_ZNSt4pairIyyEC2IyyTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16) %.ptr)
  %.add = add nuw nsw i64 %.idx, 16
  %19 = icmp eq i64 %.add, 1600080
  br i1 %19, label %.preheader, label %18

.preheader:                                       ; preds = %18
  %20 = load i32, ptr %1, align 4, !tbaa !9
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph, label %.preheader.._crit_edge_crit_edge

.preheader.._crit_edge_crit_edge:                 ; preds = %.preheader
  %.pre113 = sext i32 %20 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.preheader.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre113, %.preheader.._crit_edge_crit_edge ], [ %28, %.lr.ph ]
  %22 = getelementptr inbounds %"struct.std::pair", ptr %3, i64 %.pre-phi
  call void @_ZSt4sortIPSt4pairIyyEEvT_S3_(ptr noundef nonnull %3, ptr noundef nonnull %22)
  call void @llvm.lifetime.start.p0(i64 2400120, ptr nonnull %4) #8
  br label %30

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader ]
  %23 = getelementptr inbounds [100005 x %"struct.std::pair"], ptr %3, i64 0, i64 %indvars.iv
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERy(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %23)
  %25 = getelementptr inbounds i8, ptr %23, i64 8
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERy(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(8) %25)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %27 = load i32, ptr %1, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = icmp slt i64 %indvars.iv.next, %28
  br i1 %29, label %.lr.ph, label %._crit_edge, !llvm.loop !11

30:                                               ; preds = %30, %._crit_edge
  %.idx53 = phi i64 [ 0, %._crit_edge ], [ %.add54, %30 ]
  %.ptr55 = getelementptr inbounds i8, ptr %4, i64 %.idx53
  call void @_ZNSt5tupleIJyyyEEC2IvTnNSt9enable_ifIXclsr4_TCCIXsr7is_voidIT_EE5valueEEE37__is_implicitly_default_constructibleEEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(24) %.ptr55) #8
  %.add54 = add nuw nsw i64 %.idx53, 24
  %31 = icmp eq i64 %.add54, 2400120
  br i1 %31, label %32, label %30

32:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  store i32 0, ptr %5, align 4, !tbaa !9
  %33 = load i32, ptr %1, align 4, !tbaa !9
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph66, label %._crit_edge67

._crit_edge67:                                    ; preds = %.lr.ph66, %32
  %.lcssa = phi i32 [ %33, %32 ], [ %48, %.lr.ph66 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  %35 = sext i32 %.lcssa to i64
  %36 = getelementptr inbounds %"class.std::tuple", ptr %4, i64 %35
  call void @_ZSt4sortIPSt5tupleIJyyyEEEvT_S3_(ptr noundef nonnull %4, ptr noundef nonnull %36)
  call void @llvm.lifetime.start.p0(i64 400020, ptr nonnull %7) #8
  %37 = load i32, ptr %1, align 4, !tbaa !9
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %.lr.ph71, label %._crit_edge72

.lr.ph66:                                         ; preds = %32, %.lr.ph66
  %storemerge64 = phi i32 [ %47, %.lr.ph66 ], [ 0, %32 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #8
  %39 = sext i32 %storemerge64 to i64
  %40 = getelementptr inbounds [100005 x %"struct.std::pair"], ptr %3, i64 0, i64 %39
  %41 = getelementptr inbounds i8, ptr %40, i64 8
  call void @_ZSt10make_tupleIJRyS0_RiEESt5tupleIJDpNSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeEEEDpOS5_(ptr dead_on_unwind nonnull writable sret(%"class.std::tuple.4") align 8 %6, ptr noundef nonnull align 8 dereferenceable(8) %41, ptr noundef nonnull align 8 dereferenceable(8) %40, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %42 = load i32, ptr %5, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [100005 x %"class.std::tuple"], ptr %4, i64 0, i64 %43
  %45 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt5tupleIJyyyEEaSIJyyiEEENSt9enable_ifIXcl12__assignableIDpT_EEERS0_E4typeEOS_IJS4_EE(ptr noundef nonnull align 8 dereferenceable(24) %44, ptr noundef nonnull align 8 dereferenceable(24) %6) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #8
  %46 = load i32, ptr %5, align 4, !tbaa !9
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %5, align 4, !tbaa !9
  %48 = load i32, ptr %1, align 4, !tbaa !9
  %49 = icmp slt i32 %47, %48
  br i1 %49, label %.lr.ph66, label %._crit_edge67, !llvm.loop !13

._crit_edge72:                                    ; preds = %.lr.ph71, %._crit_edge67
  call void @llvm.lifetime.start.p0(i64 800040, ptr nonnull %8) #8
  %50 = load i32, ptr @_ZL1M, align 4, !tbaa !9
  %51 = zext i32 %50 to i64
  %52 = call ptr @llvm.stacksave.p0()
  %53 = alloca %"struct.std::pair", i64 %51, align 16
  %54 = icmp eq i32 %50, 0
  br i1 %54, label %.loopexit61, label %63

.lr.ph71:                                         ; preds = %._crit_edge67, %.lr.ph71
  %indvars.iv99 = phi i64 [ %indvars.iv.next100, %.lr.ph71 ], [ 0, %._crit_edge67 ]
  %55 = getelementptr inbounds [100005 x %"class.std::tuple"], ptr %4, i64 0, i64 %indvars.iv99
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3getILm2EJyyyEERNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERS4_(ptr noundef nonnull align 8 dereferenceable(24) %55) #8
  %57 = load i64, ptr %56, align 8, !tbaa !14
  %58 = getelementptr inbounds [100005 x i32], ptr %7, i64 0, i64 %57
  %59 = trunc nuw nsw i64 %indvars.iv99 to i32
  store i32 %59, ptr %58, align 4, !tbaa !9
  %indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
  %60 = load i32, ptr %1, align 4, !tbaa !9
  %61 = sext i32 %60 to i64
  %62 = icmp slt i64 %indvars.iv.next100, %61
  br i1 %62, label %.lr.ph71, label %._crit_edge72, !llvm.loop !16

63:                                               ; preds = %._crit_edge72
  %64 = getelementptr inbounds %"struct.std::pair", ptr %53, i64 %51
  br label %65

65:                                               ; preds = %65, %63
  %66 = phi ptr [ %53, %63 ], [ %67, %65 ]
  call void @_ZNSt4pairIyyEC2IyyTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16) %66)
  %67 = getelementptr inbounds i8, ptr %66, i64 16
  %68 = icmp eq ptr %67, %64
  br i1 %68, label %.loopexit61, label %65

.loopexit61:                                      ; preds = %65, %._crit_edge72
  %69 = getelementptr inbounds i8, ptr %8, i64 800040
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #8
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @_ZSt4fillIPyiEvT_S1_RKT0_(ptr noundef nonnull %8, ptr noundef nonnull %69, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #8
  store i32 0, ptr %10, align 4, !tbaa !9
  %70 = load i32, ptr %1, align 4, !tbaa !9
  %71 = icmp sgt i32 %70, 0
  br i1 %71, label %.lr.ph93, label %._crit_edge94

._crit_edge94:                                    ; preds = %141, %.loopexit61
  %72 = phi i32 [ 0, %.loopexit61 ], [ %142, %141 ]
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %72)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #8
  call void @llvm.stackrestore.p0(ptr %52)
  call void @llvm.lifetime.end.p0(i64 800040, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 400020, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 2400120, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 1600080, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0

.lr.ph93:                                         ; preds = %.loopexit61, %141
  %74 = phi i32 [ %142, %141 ], [ 0, %.loopexit61 ]
  %75 = phi i32 [ %143, %141 ], [ %70, %.loopexit61 ]
  %indvars.iv110 = phi i64 [ %indvars.iv.next111, %141 ], [ 0, %.loopexit61 ]
  %76 = load i64, ptr %2, align 8, !tbaa !14
  %77 = getelementptr inbounds [100005 x %"struct.std::pair"], ptr %3, i64 0, i64 %indvars.iv110
  %78 = load i64, ptr %77, align 16, !tbaa !17
  %79 = getelementptr inbounds i8, ptr %77, i64 8
  %80 = load i64, ptr %79, align 8, !tbaa !19
  %81 = add i64 %78, %80
  %82 = sub i64 %76, %81
  %83 = trunc i64 %82 to i32
  %84 = icmp slt i32 %83, 0
  br i1 %84, label %85, label %97

85:                                               ; preds = %.lr.ph93
  %86 = getelementptr inbounds [100005 x i32], ptr %7, i64 0, i64 %indvars.iv110
  %87 = load i32, ptr %86, align 4, !tbaa !9
  %88 = load i32, ptr @_ZL1M, align 4, !tbaa !9
  %89 = sdiv i32 %87, %88
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds %"struct.std::pair", ptr %53, i64 %90
  %92 = load <2 x i64>, ptr %91, align 16, !tbaa !14
  %93 = insertelement <2 x i64> <i64 poison, i64 1>, i64 %80, i64 0
  %94 = add <2 x i64> %92, %93
  store <2 x i64> %94, ptr %91, align 16, !tbaa !14
  %95 = sext i32 %87 to i64
  %96 = getelementptr inbounds [100005 x i64], ptr %8, i64 0, i64 %95
  store i64 %80, ptr %96, align 8, !tbaa !14
  br label %141

97:                                               ; preds = %.lr.ph93
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #8
  store i32 1, ptr %11, align 4, !tbaa !9
  %98 = load i32, ptr @_ZL1M, align 4, !tbaa !9
  %99 = icmp sgt i32 %98, 0
  br i1 %99, label %.lr.ph89.preheader, label %._crit_edge90

.lr.ph89.preheader:                               ; preds = %97
  %100 = zext nneg i32 %98 to i64
  br label %.lr.ph89

._crit_edge90:                                    ; preds = %.loopexit, %97
  %101 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %102 = load i32, ptr %101, align 4, !tbaa !9
  store i32 %102, ptr %10, align 4, !tbaa !9
  %103 = getelementptr inbounds [100005 x i32], ptr %7, i64 0, i64 %indvars.iv110
  %104 = load i32, ptr %103, align 4, !tbaa !9
  %105 = load i64, ptr %79, align 8, !tbaa !19
  %106 = load i32, ptr @_ZL1M, align 4, !tbaa !9
  %107 = sdiv i32 %104, %106
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds %"struct.std::pair", ptr %53, i64 %108
  %110 = load <2 x i64>, ptr %109, align 16, !tbaa !14
  %111 = insertelement <2 x i64> <i64 poison, i64 1>, i64 %105, i64 0
  %112 = add <2 x i64> %110, %111
  store <2 x i64> %112, ptr %109, align 16, !tbaa !14
  %113 = sext i32 %104 to i64
  %114 = getelementptr inbounds [100005 x i64], ptr %8, i64 0, i64 %113
  store i64 %105, ptr %114, align 8, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #8
  %.pre = load i32, ptr %1, align 4, !tbaa !9
  br label %141

.lr.ph89:                                         ; preds = %.lr.ph89.preheader, %.loopexit
  %indvars.iv107 = phi i64 [ 0, %.lr.ph89.preheader ], [ %indvars.iv.next108, %.loopexit ]
  %indvars.iv102 = phi i32 [ 0, %.lr.ph89.preheader ], [ %indvars.iv.next103, %.loopexit ]
  %.04386 = phi i32 [ %83, %.lr.ph89.preheader ], [ %.2, %.loopexit ]
  %.promoted8485 = phi i32 [ 1, %.lr.ph89.preheader ], [ %.promoted82, %.loopexit ]
  %115 = sext i32 %.04386 to i64
  %116 = getelementptr inbounds %"struct.std::pair", ptr %53, i64 %indvars.iv107
  %117 = load i64, ptr %116, align 16, !tbaa !17
  %.not = icmp ugt i64 %117, %115
  br i1 %.not, label %125, label %118

118:                                              ; preds = %.lr.ph89
  %119 = getelementptr inbounds i8, ptr %116, i64 8
  %120 = load i64, ptr %119, align 8, !tbaa !19
  %121 = trunc i64 %120 to i32
  %122 = add i32 %.promoted8485, %121
  store i32 %122, ptr %11, align 4, !tbaa !9
  %123 = trunc i64 %117 to i32
  %124 = sub i32 %.04386, %123
  br label %.loopexit

125:                                              ; preds = %.lr.ph89
  %126 = mul nuw nsw i64 %indvars.iv107, %100
  %127 = getelementptr inbounds [100005 x i64], ptr %8, i64 0, i64 %126
  %128 = load i64, ptr %127, align 8, !tbaa !14
  %.not5773 = icmp ugt i64 %128, %115
  br i1 %.not5773, label %.loopexit, label %.lr.ph77.preheader

.lr.ph77.preheader:                               ; preds = %125
  %129 = zext i32 %indvars.iv102 to i64
  br label %.lr.ph77

.lr.ph77:                                         ; preds = %.lr.ph77.preheader, %134
  %indvars.iv104 = phi i64 [ %indvars.iv.next105, %134 ], [ %129, %.lr.ph77.preheader ]
  %.promoted81 = phi i32 [ %.promoted80, %134 ], [ %.promoted8485, %.lr.ph77.preheader ]
  %130 = phi i64 [ %140, %134 ], [ %128, %.lr.ph77.preheader ]
  %.174 = phi i32 [ %137, %134 ], [ %.04386, %.lr.ph77.preheader ]
  %131 = phi i32 [ %135, %134 ], [ %.promoted8485, %.lr.ph77.preheader ]
  %.not58 = icmp eq i64 %130, 0
  br i1 %.not58, label %134, label %132

132:                                              ; preds = %.lr.ph77
  %133 = add nsw i32 %131, 1
  store i32 %133, ptr %11, align 4, !tbaa !9
  br label %134

134:                                              ; preds = %132, %.lr.ph77
  %.promoted80 = phi i32 [ %133, %132 ], [ %.promoted81, %.lr.ph77 ]
  %135 = phi i32 [ %133, %132 ], [ %131, %.lr.ph77 ]
  %136 = trunc i64 %130 to i32
  %137 = sub i32 %.174, %136
  %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [100005 x i64], ptr %8, i64 0, i64 %indvars.iv.next105
  %140 = load i64, ptr %139, align 8, !tbaa !14
  %.not57 = icmp ugt i64 %140, %138
  br i1 %.not57, label %.loopexit, label %.lr.ph77, !llvm.loop !20

.loopexit:                                        ; preds = %134, %125, %118
  %.promoted82 = phi i32 [ %122, %118 ], [ %.promoted8485, %125 ], [ %.promoted80, %134 ]
  %.2 = phi i32 [ %124, %118 ], [ %.04386, %125 ], [ %137, %134 ]
  %indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
  %indvars.iv.next103 = add i32 %indvars.iv102, %98
  %exitcond.not = icmp eq i64 %indvars.iv.next108, %100
  br i1 %exitcond.not, label %._crit_edge90, label %.lr.ph89, !llvm.loop !21

141:                                              ; preds = %._crit_edge90, %85
  %142 = phi i32 [ %102, %._crit_edge90 ], [ %74, %85 ]
  %143 = phi i32 [ %.pre, %._crit_edge90 ], [ %75, %85 ]
  %indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
  %144 = sext i32 %143 to i64
  %145 = icmp slt i64 %indvars.iv.next111, %144
  br i1 %145, label %.lr.ph93, label %._crit_edge94, !llvm.loop !22
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr 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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIyyEC2IyyTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4 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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIyyEEvT_S3_(ptr noundef, ptr noundef) local_unnamed_addr #5

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZSt10make_tupleIJRyS0_RiEESt5tupleIJDpNSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeEEEDpOS5_(ptr dead_on_unwind noalias writable sret(%"class.std::tuple.4") align 8, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt5tupleIJyyyEEEvT_S3_(ptr noundef, ptr noundef) local_unnamed_addr #5

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #7

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #1

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 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 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 #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 = { 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 #8 = { 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 = !{!"any pointer", !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 = !{!15, !15, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = distinct !{!16, !12}
!17 = !{!18, !15, i64 0}
!18 = !{!"_ZTSSt4pairIyyE", !15, i64 0, !15, i64 8}
!19 = !{!18, !15, i64 8}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}


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