; LLVM IR from eyangch/competitive-programming :: USACOcontests/gold/2016.12 (lasers)

; 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 { i32, i32 }
%struct.state = type { %"struct.std::pair", i32, i32 }
%"class.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<state, std::allocator<state>>::_Deque_impl" }
%"struct.std::_Deque_base<state, std::allocator<state>>::_Deque_impl" = type { %"struct.std::_Deque_base<state, std::allocator<state>>::_Deque_impl_data" }
%"struct.std::_Deque_base<state, std::allocator<state>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair", align 4
  %4 = alloca %"struct.std::pair", align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca %struct.state, align 4
  %11 = alloca %"class.std::queue", align 8
  %12 = alloca %struct.state, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca %"struct.std::pair", align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca %"struct.std::pair", align 4
  %21 = alloca i32, align 4
  %22 = alloca %"struct.std::pair", align 4
  %23 = alloca %struct.state, align 4
  %24 = alloca ptr, align 8
  %25 = alloca %"struct.std::pair", align 4
  %26 = alloca i32, align 4
  %27 = alloca %"struct.std::pair", align 4
  %28 = alloca %struct.state, align 4
  store i32 0, ptr %1, align 4
  %29 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %30 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %31 = getelementptr i8, ptr %30, i64 -24
  %32 = load i64, ptr %31, align 8
  %33 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %32
  %34 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %33, ptr noundef null)
  %35 = load ptr, ptr @stdin, align 8, !tbaa !8
  %36 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %35)
  %37 = load ptr, ptr @stdout, align 8, !tbaa !8
  %38 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %37)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #9
  %39 = 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)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #9
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %3)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #9
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %4)
  %40 = getelementptr inbounds %"struct.std::pair", ptr %3, i32 0, i32 0
  %41 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %40)
  %42 = getelementptr inbounds %"struct.std::pair", ptr %3, i32 0, i32 1
  %43 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %41, ptr noundef nonnull align 4 dereferenceable(4) %42)
  %44 = getelementptr inbounds %"struct.std::pair", ptr %4, i32 0, i32 0
  %45 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %43, ptr noundef nonnull align 4 dereferenceable(4) %44)
  %46 = getelementptr inbounds %"struct.std::pair", ptr %4, i32 0, i32 1
  %47 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %45, ptr noundef nonnull align 4 dereferenceable(4) %46)
  %48 = load i32, ptr %2, align 4, !tbaa !11
  %49 = add nsw i32 %48, 1
  %50 = zext i32 %49 to i64
  %51 = call ptr @llvm.stacksave.p0()
  store ptr %51, ptr %5, align 8
  %52 = alloca %"struct.std::pair", i64 %50, align 16
  store i64 %50, ptr %6, align 8
  %53 = icmp eq i64 %50, 0
  br i1 %53, label %60, label %54

54:                                               ; preds = %0
  %55 = getelementptr inbounds %"struct.std::pair", ptr %52, i64 %50
  br label %56

56:                                               ; preds = %56, %54
  %57 = phi ptr [ %52, %54 ], [ %58, %56 ]
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %57)
  %58 = getelementptr inbounds %"struct.std::pair", ptr %57, i64 1
  %59 = icmp eq ptr %58, %55
  br i1 %59, label %60, label %56

60:                                               ; preds = %56, %0
  %61 = load i32, ptr %2, align 4, !tbaa !11
  %62 = add nsw i32 %61, 1
  %63 = zext i32 %62 to i64
  %64 = alloca %"struct.std::pair", i64 %63, align 16
  store i64 %63, ptr %7, align 8
  %65 = icmp eq i64 %63, 0
  br i1 %65, label %72, label %66

66:                                               ; preds = %60
  %67 = getelementptr inbounds %"struct.std::pair", ptr %64, i64 %63
  br label %68

68:                                               ; preds = %68, %66
  %69 = phi ptr [ %64, %66 ], [ %70, %68 ]
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %69)
  %70 = getelementptr inbounds %"struct.std::pair", ptr %69, i64 1
  %71 = icmp eq ptr %70, %67
  br i1 %71, label %72, label %68

72:                                               ; preds = %68, %60
  %73 = load i32, ptr %2, align 4, !tbaa !11
  %74 = add nsw i32 %73, 1
  %75 = zext i32 %74 to i64
  %76 = alloca %"struct.std::pair", i64 %75, align 16
  store i64 %75, ptr %8, align 8
  %77 = icmp eq i64 %75, 0
  br i1 %77, label %84, label %78

78:                                               ; preds = %72
  %79 = getelementptr inbounds %"struct.std::pair", ptr %76, i64 %75
  br label %80

80:                                               ; preds = %80, %78
  %81 = phi ptr [ %76, %78 ], [ %82, %80 ]
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %81)
  %82 = getelementptr inbounds %"struct.std::pair", ptr %81, i64 1
  %83 = icmp eq ptr %82, %79
  br i1 %83, label %84, label %80

84:                                               ; preds = %80, %72
  %85 = load i32, ptr %2, align 4, !tbaa !11
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds %"struct.std::pair", ptr %76, i64 %86
  %88 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %87, ptr noundef nonnull align 4 dereferenceable(8) %4)
  %89 = load i32, ptr %2, align 4, !tbaa !11
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds %"struct.std::pair", ptr %64, i64 %90
  %92 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %91, ptr noundef nonnull align 4 dereferenceable(8) %88)
  %93 = load i32, ptr %2, align 4, !tbaa !11
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds %"struct.std::pair", ptr %52, i64 %94
  %96 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %95, ptr noundef nonnull align 4 dereferenceable(8) %92)
  %97 = load i32, ptr %2, align 4, !tbaa !11
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds %"struct.std::pair", ptr %76, i64 %98
  %100 = getelementptr inbounds %"struct.std::pair", ptr %99, i32 0, i32 0
  %101 = load i32, ptr %2, align 4, !tbaa !11
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds %"struct.std::pair", ptr %76, i64 %102
  %104 = getelementptr inbounds %"struct.std::pair", ptr %103, i32 0, i32 1
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %100, ptr noundef nonnull align 4 dereferenceable(4) %104) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  store i32 0, ptr %9, align 4, !tbaa !11
  br label %105

105:                                              ; preds = %140, %84
  %106 = load i32, ptr %9, align 4, !tbaa !11
  %107 = load i32, ptr %2, align 4, !tbaa !11
  %108 = icmp slt i32 %106, %107
  br i1 %108, label %110, label %109

109:                                              ; preds = %105
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  br label %143

110:                                              ; preds = %105
  %111 = load i32, ptr %9, align 4, !tbaa !11
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds %"struct.std::pair", ptr %52, i64 %112
  %114 = getelementptr inbounds %"struct.std::pair", ptr %113, i32 0, i32 0
  %115 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %114)
  %116 = load i32, ptr %9, align 4, !tbaa !11
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds %"struct.std::pair", ptr %52, i64 %117
  %119 = getelementptr inbounds %"struct.std::pair", ptr %118, i32 0, i32 1
  %120 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %115, ptr noundef nonnull align 4 dereferenceable(4) %119)
  %121 = load i32, ptr %9, align 4, !tbaa !11
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds %"struct.std::pair", ptr %52, i64 %122
  %124 = load i32, ptr %9, align 4, !tbaa !11
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds %"struct.std::pair", ptr %64, i64 %125
  %127 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %126, ptr noundef nonnull align 4 dereferenceable(8) %123)
  %128 = load i32, ptr %9, align 4, !tbaa !11
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds %"struct.std::pair", ptr %76, i64 %129
  %131 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %130, ptr noundef nonnull align 4 dereferenceable(8) %127)
  %132 = load i32, ptr %9, align 4, !tbaa !11
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds %"struct.std::pair", ptr %76, i64 %133
  %135 = getelementptr inbounds %"struct.std::pair", ptr %134, i32 0, i32 0
  %136 = load i32, ptr %9, align 4, !tbaa !11
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds %"struct.std::pair", ptr %76, i64 %137
  %139 = getelementptr inbounds %"struct.std::pair", ptr %138, i32 0, i32 1
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %135, ptr noundef nonnull align 4 dereferenceable(4) %139) #9
  br label %140

140:                                              ; preds = %110
  %141 = load i32, ptr %9, align 4, !tbaa !11
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %9, align 4, !tbaa !11
  br label %105, !llvm.loop !13

143:                                              ; preds = %109
  %144 = load i32, ptr %2, align 4, !tbaa !11
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %2, align 4, !tbaa !11
  %146 = load i32, ptr %2, align 4, !tbaa !11
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds %"struct.std::pair", ptr %64, i64 %147
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef %64, ptr noundef %148)
  %149 = load i32, ptr %2, align 4, !tbaa !11
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds %"struct.std::pair", ptr %76, i64 %150
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef %76, ptr noundef %151)
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #9
  call void @_ZN5stateC2Ev(ptr noundef nonnull align 4 dereferenceable(16) %10)
  call void @llvm.lifetime.start.p0(i64 80, ptr %11) #9
  call void @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #9
  %152 = getelementptr inbounds %struct.state, ptr %12, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %152, ptr align 4 %3, i64 8, i1 false)
  %153 = getelementptr inbounds %struct.state, ptr %12, i32 0, i32 1
  store i32 -1, ptr %153, align 4, !tbaa !15
  %154 = getelementptr inbounds %struct.state, ptr %12, i32 0, i32 2
  store i32 0, ptr %154, align 4, !tbaa !18
  %155 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN5stateaSEOS_(ptr noundef nonnull align 4 dereferenceable(16) %10, ptr noundef nonnull align 4 dereferenceable(16) %12) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #9
  invoke void @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %11, ptr noundef nonnull align 4 dereferenceable(16) %10)
          to label %156 unwind label %183

156:                                              ; preds = %143
  br label %157

157:                                              ; preds = %322, %156
  %158 = invoke noundef zeroext i1 @_ZNKSt5queueI5stateSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %159 unwind label %183

159:                                              ; preds = %157
  %160 = xor i1 %158, true
  br i1 %160, label %161, label %326

161:                                              ; preds = %159
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #9
  %162 = invoke noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %163 unwind label %187

163:                                              ; preds = %161
  %164 = getelementptr inbounds %struct.state, ptr %162, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %164, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  %165 = invoke noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %166 unwind label %191

166:                                              ; preds = %163
  %167 = getelementptr inbounds %struct.state, ptr %165, i32 0, i32 1
  %168 = load i32, ptr %167, align 4, !tbaa !15
  store i32 %168, ptr %16, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #9
  %169 = invoke noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %170 unwind label %195

170:                                              ; preds = %166
  %171 = getelementptr inbounds %struct.state, ptr %169, i32 0, i32 2
  %172 = load i32, ptr %171, align 4, !tbaa !18
  store i32 %172, ptr %17, align 4, !tbaa !11
  invoke void @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %173 unwind label %195

173:                                              ; preds = %170
  %174 = invoke noundef zeroext i1 @_ZSteqIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8) %15, ptr noundef nonnull align 4 dereferenceable(8) %4)
          to label %175 unwind label %195

175:                                              ; preds = %173
  br i1 %174, label %176, label %199

176:                                              ; preds = %175
  %177 = load i32, ptr %17, align 4, !tbaa !11
  %178 = sub nsw i32 %177, 1
  %179 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %178)
          to label %180 unwind label %195

180:                                              ; preds = %176
  %181 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %179, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %182 unwind label %195

182:                                              ; preds = %180
  store i32 0, ptr %1, align 4
  store i32 1, ptr %18, align 4
  br label %320

183:                                              ; preds = %328, %326, %157, %143
  %184 = landingpad { ptr, i32 }
          cleanup
  %185 = extractvalue { ptr, i32 } %184, 0
  store ptr %185, ptr %13, align 8
  %186 = extractvalue { ptr, i32 } %184, 1
  store i32 %186, ptr %14, align 4
  br label %334

187:                                              ; preds = %161
  %188 = landingpad { ptr, i32 }
          cleanup
  %189 = extractvalue { ptr, i32 } %188, 0
  store ptr %189, ptr %13, align 8
  %190 = extractvalue { ptr, i32 } %188, 1
  store i32 %190, ptr %14, align 4
  br label %325

191:                                              ; preds = %163
  %192 = landingpad { ptr, i32 }
          cleanup
  %193 = extractvalue { ptr, i32 } %192, 0
  store ptr %193, ptr %13, align 8
  %194 = extractvalue { ptr, i32 } %192, 1
  store i32 %194, ptr %14, align 4
  br label %324

195:                                              ; preds = %180, %176, %173, %170, %166
  %196 = landingpad { ptr, i32 }
          cleanup
  %197 = extractvalue { ptr, i32 } %196, 0
  store ptr %197, ptr %13, align 8
  %198 = extractvalue { ptr, i32 } %196, 1
  store i32 %198, ptr %14, align 4
  br label %323

199:                                              ; preds = %175
  %200 = load i32, ptr %16, align 4, !tbaa !11
  %201 = icmp ne i32 %200, 0
  br i1 %201, label %202, label %258

202:                                              ; preds = %199
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #9
  %203 = load i32, ptr %2, align 4, !tbaa !11
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds %"struct.std::pair", ptr %64, i64 %204
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #9
  %206 = getelementptr inbounds %"struct.std::pair", ptr %15, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #9
  store i32 0, ptr %21, align 4, !tbaa !11
  invoke void @_ZNSt4pairIiiEC2IRiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %20, ptr noundef nonnull align 4 dereferenceable(4) %206, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %207 unwind label %235

207:                                              ; preds = %202
  %208 = invoke noundef ptr @_ZSt11lower_boundIPSt4pairIiiES1_ET_S3_S3_RKT0_(ptr noundef %64, ptr noundef %205, ptr noundef nonnull align 4 dereferenceable(8) %20)
          to label %209 unwind label %235

209:                                              ; preds = %207
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #9
  store ptr %208, ptr %19, align 8, !tbaa !8
  br label %210

210:                                              ; preds = %255, %253, %209
  %211 = load ptr, ptr %19, align 8, !tbaa !8
  %212 = ptrtoint ptr %211 to i64
  %213 = ptrtoint ptr %64 to i64
  %214 = sub i64 %212, %213
  %215 = sdiv exact i64 %214, 8
  %216 = load i32, ptr %2, align 4, !tbaa !11
  %217 = sext i32 %216 to i64
  %218 = icmp slt i64 %215, %217
  br i1 %218, label %219, label %226

219:                                              ; preds = %210
  %220 = load ptr, ptr %19, align 8, !tbaa !8
  %221 = getelementptr inbounds %"struct.std::pair", ptr %220, i32 0, i32 0
  %222 = load i32, ptr %221, align 4, !tbaa !19
  %223 = getelementptr inbounds %"struct.std::pair", ptr %15, i32 0, i32 0
  %224 = load i32, ptr %223, align 4, !tbaa !19
  %225 = icmp eq i32 %222, %224
  br label %226

226:                                              ; preds = %219, %210
  %227 = phi i1 [ false, %210 ], [ %225, %219 ]
  br i1 %227, label %228, label %256

228:                                              ; preds = %226
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #9
  %229 = load ptr, ptr %19, align 8, !tbaa !8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %229, i64 8, i1 false)
  %230 = invoke noundef zeroext i1 @_ZSteqIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8) %22, ptr noundef nonnull align 4 dereferenceable(8) %15)
          to label %231 unwind label %239

231:                                              ; preds = %228
  br i1 %230, label %232, label %243

232:                                              ; preds = %231
  %233 = load ptr, ptr %19, align 8, !tbaa !8
  %234 = getelementptr inbounds %"struct.std::pair", ptr %233, i32 1
  store ptr %234, ptr %19, align 8, !tbaa !8
  store i32 7, ptr %18, align 4
  br label %253, !llvm.loop !20

235:                                              ; preds = %207, %202
  %236 = landingpad { ptr, i32 }
          cleanup
  %237 = extractvalue { ptr, i32 } %236, 0
  store ptr %237, ptr %13, align 8
  %238 = extractvalue { ptr, i32 } %236, 1
  store i32 %238, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #9
  br label %257

239:                                              ; preds = %243, %228
  %240 = landingpad { ptr, i32 }
          cleanup
  %241 = extractvalue { ptr, i32 } %240, 0
  store ptr %241, ptr %13, align 8
  %242 = extractvalue { ptr, i32 } %240, 1
  store i32 %242, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #9
  br label %257

243:                                              ; preds = %231
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #9
  %244 = getelementptr inbounds %struct.state, ptr %23, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %244, ptr align 4 %22, i64 8, i1 false)
  %245 = getelementptr inbounds %struct.state, ptr %23, i32 0, i32 1
  store i32 0, ptr %245, align 4, !tbaa !15
  %246 = getelementptr inbounds %struct.state, ptr %23, i32 0, i32 2
  %247 = load i32, ptr %17, align 4, !tbaa !11
  %248 = add nsw i32 %247, 1
  store i32 %248, ptr %246, align 4, !tbaa !18
  %249 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN5stateaSEOS_(ptr noundef nonnull align 4 dereferenceable(16) %10, ptr noundef nonnull align 4 dereferenceable(16) %23) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #9
  invoke void @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %11, ptr noundef nonnull align 4 dereferenceable(16) %10)
          to label %250 unwind label %239

250:                                              ; preds = %243
  %251 = load ptr, ptr %19, align 8, !tbaa !8
  %252 = getelementptr inbounds %"struct.std::pair", ptr %251, i32 1
  store ptr %252, ptr %19, align 8, !tbaa !8
  store i32 0, ptr %18, align 4
  br label %253

253:                                              ; preds = %250, %232
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #9
  %254 = load i32, ptr %18, align 4
  switch i32 %254, label %340 [
    i32 0, label %255
    i32 7, label %210
  ]

255:                                              ; preds = %253
  br label %210, !llvm.loop !20

256:                                              ; preds = %226
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #9
  br label %258

257:                                              ; preds = %239, %235
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #9
  br label %323

258:                                              ; preds = %256, %199
  %259 = load i32, ptr %16, align 4, !tbaa !11
  %260 = icmp ne i32 %259, 1
  br i1 %260, label %261, label %319

261:                                              ; preds = %258
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #9
  %262 = load i32, ptr %2, align 4, !tbaa !11
  %263 = sext i32 %262 to i64
  %264 = getelementptr inbounds %"struct.std::pair", ptr %76, i64 %263
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #9
  %265 = getelementptr inbounds %"struct.std::pair", ptr %15, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #9
  store i32 0, ptr %26, align 4, !tbaa !11
  invoke void @_ZNSt4pairIiiEC2IRiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %25, ptr noundef nonnull align 4 dereferenceable(4) %265, ptr noundef nonnull align 4 dereferenceable(4) %26)
          to label %266 unwind label %296

266:                                              ; preds = %261
  %267 = invoke noundef ptr @_ZSt11lower_boundIPSt4pairIiiES1_ET_S3_S3_RKT0_(ptr noundef %76, ptr noundef %264, ptr noundef nonnull align 4 dereferenceable(8) %25)
          to label %268 unwind label %296

268:                                              ; preds = %266
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #9
  store ptr %267, ptr %24, align 8, !tbaa !8
  br label %269

269:                                              ; preds = %316, %314, %268
  %270 = load ptr, ptr %24, align 8, !tbaa !8
  %271 = ptrtoint ptr %270 to i64
  %272 = ptrtoint ptr %76 to i64
  %273 = sub i64 %271, %272
  %274 = sdiv exact i64 %273, 8
  %275 = load i32, ptr %2, align 4, !tbaa !11
  %276 = sext i32 %275 to i64
  %277 = icmp slt i64 %274, %276
  br i1 %277, label %278, label %285

278:                                              ; preds = %269
  %279 = load ptr, ptr %24, align 8, !tbaa !8
  %280 = getelementptr inbounds %"struct.std::pair", ptr %279, i32 0, i32 0
  %281 = load i32, ptr %280, align 4, !tbaa !19
  %282 = getelementptr inbounds %"struct.std::pair", ptr %15, i32 0, i32 1
  %283 = load i32, ptr %282, align 4, !tbaa !21
  %284 = icmp eq i32 %281, %283
  br label %285

285:                                              ; preds = %278, %269
  %286 = phi i1 [ false, %269 ], [ %284, %278 ]
  br i1 %286, label %287, label %317

287:                                              ; preds = %285
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #9
  %288 = load ptr, ptr %24, align 8, !tbaa !8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %27, ptr align 4 %288, i64 8, i1 false)
  %289 = getelementptr inbounds %"struct.std::pair", ptr %27, i32 0, i32 0
  %290 = getelementptr inbounds %"struct.std::pair", ptr %27, i32 0, i32 1
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %289, ptr noundef nonnull align 4 dereferenceable(4) %290) #9
  %291 = invoke noundef zeroext i1 @_ZSteqIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8) %27, ptr noundef nonnull align 4 dereferenceable(8) %15)
          to label %292 unwind label %300

292:                                              ; preds = %287
  br i1 %291, label %293, label %304

293:                                              ; preds = %292
  %294 = load ptr, ptr %24, align 8, !tbaa !8
  %295 = getelementptr inbounds %"struct.std::pair", ptr %294, i32 1
  store ptr %295, ptr %24, align 8, !tbaa !8
  store i32 9, ptr %18, align 4
  br label %314, !llvm.loop !22

296:                                              ; preds = %266, %261
  %297 = landingpad { ptr, i32 }
          cleanup
  %298 = extractvalue { ptr, i32 } %297, 0
  store ptr %298, ptr %13, align 8
  %299 = extractvalue { ptr, i32 } %297, 1
  store i32 %299, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #9
  br label %318

300:                                              ; preds = %304, %287
  %301 = landingpad { ptr, i32 }
          cleanup
  %302 = extractvalue { ptr, i32 } %301, 0
  store ptr %302, ptr %13, align 8
  %303 = extractvalue { ptr, i32 } %301, 1
  store i32 %303, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #9
  br label %318

304:                                              ; preds = %292
  call void @llvm.lifetime.start.p0(i64 16, ptr %28) #9
  %305 = getelementptr inbounds %struct.state, ptr %28, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %305, ptr align 4 %27, i64 8, i1 false)
  %306 = getelementptr inbounds %struct.state, ptr %28, i32 0, i32 1
  store i32 1, ptr %306, align 4, !tbaa !15
  %307 = getelementptr inbounds %struct.state, ptr %28, i32 0, i32 2
  %308 = load i32, ptr %17, align 4, !tbaa !11
  %309 = add nsw i32 %308, 1
  store i32 %309, ptr %307, align 4, !tbaa !18
  %310 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN5stateaSEOS_(ptr noundef nonnull align 4 dereferenceable(16) %10, ptr noundef nonnull align 4 dereferenceable(16) %28) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %28) #9
  invoke void @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %11, ptr noundef nonnull align 4 dereferenceable(16) %10)
          to label %311 unwind label %300

311:                                              ; preds = %304
  %312 = load ptr, ptr %24, align 8, !tbaa !8
  %313 = getelementptr inbounds %"struct.std::pair", ptr %312, i32 1
  store ptr %313, ptr %24, align 8, !tbaa !8
  store i32 0, ptr %18, align 4
  br label %314

314:                                              ; preds = %311, %293
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #9
  %315 = load i32, ptr %18, align 4
  switch i32 %315, label %340 [
    i32 0, label %316
    i32 9, label %269
  ]

316:                                              ; preds = %314
  br label %269, !llvm.loop !22

317:                                              ; preds = %285
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #9
  br label %319

318:                                              ; preds = %300, %296
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #9
  br label %323

319:                                              ; preds = %317, %258
  store i32 0, ptr %18, align 4
  br label %320

320:                                              ; preds = %319, %182
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #9
  %321 = load i32, ptr %18, align 4
  switch i32 %321, label %331 [
    i32 0, label %322
  ]

322:                                              ; preds = %320
  br label %157, !llvm.loop !23

323:                                              ; preds = %318, %257, %195
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  br label %324

324:                                              ; preds = %323, %191
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  br label %325

325:                                              ; preds = %324, %187
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #9
  br label %334

326:                                              ; preds = %159
  %327 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
          to label %328 unwind label %183

328:                                              ; preds = %326
  %329 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %327, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %330 unwind label %183

330:                                              ; preds = %328
  store i32 0, ptr %1, align 4
  store i32 1, ptr %18, align 4
  br label %331

331:                                              ; preds = %330, %320
  call void @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %11) #9
  call void @llvm.lifetime.end.p0(i64 80, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #9
  %332 = load ptr, ptr %5, align 8
  call void @llvm.stackrestore.p0(ptr %332)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #9
  %333 = load i32, ptr %1, align 4
  ret i32 %333

334:                                              ; preds = %325, %183
  call void @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %11) #9
  call void @llvm.lifetime.end.p0(i64 80, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #9
  br label %335

335:                                              ; preds = %334
  %336 = load ptr, ptr %13, align 8
  %337 = load i32, ptr %14, align 4
  %338 = insertvalue { ptr, i32 } poison, ptr %336, 0
  %339 = insertvalue { ptr, i32 } %338, i32 %337, 1
  resume { ptr, i32 } %339

340:                                              ; preds = %314, %253
  unreachable
}

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

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

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) #3

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 nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #2 align 2

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5stateC2Ev(ptr noundef nonnull align 4 dereferenceable(16)) unnamed_addr #6 align 2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #8

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN5stateaSEOS_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) #5 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5queueI5stateSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80)) #2 align 2

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #7 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPSt4pairIiiES1_ET_S3_S3_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(8)) #6

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #5 align 2

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

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 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nosync nounwind willreturn }
attributes #5 = { 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 #6 = { 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 #7 = { 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 #8 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #9 = { 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 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !12, i64 8}
!16 = !{!"_ZTS5state", !17, i64 0, !12, i64 8, !12, i64 12}
!17 = !{!"_ZTSSt4pairIiiE", !12, i64 0, !12, i64 4}
!18 = !{!16, !12, i64 12}
!19 = !{!17, !12, i64 0}
!20 = distinct !{!20, !14}
!21 = !{!17, !12, i64 4}
!22 = distinct !{!22, !14}
!23 = distinct !{!23, !14}


; 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 { i32, i32 }
%struct.state = type { %"struct.std::pair", i32, i32 }
%"class.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<state, std::allocator<state>>::_Deque_impl" }
%"struct.std::_Deque_base<state, std::allocator<state>>::_Deque_impl" = type { %"struct.std::_Deque_base<state, std::allocator<state>>::_Deque_impl_data" }
%"struct.std::_Deque_base<state, std::allocator<state>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, 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 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"struct.std::pair", align 8
  %3 = alloca %"struct.std::pair", align 4
  %4 = alloca %struct.state, align 4
  %5 = alloca %"class.std::queue", align 8
  %6 = alloca %struct.state, align 8
  %7 = alloca %"struct.std::pair", align 8
  %8 = alloca %"struct.std::pair", align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::pair", align 8
  %11 = alloca %struct.state, align 8
  %12 = alloca %"struct.std::pair", align 4
  %13 = alloca i32, align 4
  %14 = alloca %"struct.std::pair", align 8
  %15 = alloca %struct.state, align 8
  %16 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %17 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %18 = getelementptr i8, ptr %17, i64 -24
  %19 = load i64, ptr %18, align 8
  %20 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %19
  %21 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %20, ptr noundef null)
  %22 = load ptr, ptr @stdin, align 8, !tbaa !8
  %23 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %22)
  %24 = load ptr, ptr @stdout, align 8, !tbaa !8
  %25 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %24)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  %26 = 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)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %2)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %3)
  %27 = 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)
  %28 = getelementptr inbounds i8, ptr %2, i64 4
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %27, ptr noundef nonnull align 4 dereferenceable(4) %28)
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %29, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %31 = getelementptr inbounds i8, ptr %3, i64 4
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef nonnull align 4 dereferenceable(4) %31)
  %33 = load i32, ptr %1, align 4, !tbaa !11
  %34 = add nsw i32 %33, 1
  %35 = zext i32 %34 to i64
  %36 = call ptr @llvm.stacksave.p0()
  %37 = alloca %"struct.std::pair", i64 %35, align 16
  %38 = icmp eq i32 %34, 0
  br i1 %38, label %.loopexit56, label %39

39:                                               ; preds = %0
  %40 = getelementptr inbounds %"struct.std::pair", ptr %37, i64 %35
  br label %41

41:                                               ; preds = %41, %39
  %42 = phi ptr [ %37, %39 ], [ %43, %41 ]
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %42)
  %43 = getelementptr inbounds i8, ptr %42, i64 8
  %44 = icmp eq ptr %43, %40
  br i1 %44, label %.loopexit56, label %41

.loopexit56:                                      ; preds = %41, %0
  %45 = load i32, ptr %1, align 4, !tbaa !11
  %46 = add nsw i32 %45, 1
  %47 = zext i32 %46 to i64
  %48 = alloca %"struct.std::pair", i64 %47, align 16
  %49 = icmp eq i32 %46, 0
  br i1 %49, label %.loopexit55.thread, label %51

.loopexit55.thread:                               ; preds = %.loopexit56
  %50 = alloca %"struct.std::pair", i64 %47, align 16
  br label %.loopexit54

51:                                               ; preds = %.loopexit56
  %52 = getelementptr inbounds %"struct.std::pair", ptr %48, i64 %47
  br label %53

53:                                               ; preds = %53, %51
  %54 = phi ptr [ %48, %51 ], [ %55, %53 ]
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %54)
  %55 = getelementptr inbounds i8, ptr %54, i64 8
  %56 = icmp eq ptr %55, %52
  br i1 %56, label %.loopexit55, label %53

.loopexit55:                                      ; preds = %53
  %.pre = load i32, ptr %1, align 4, !tbaa !11
  %.pre81 = add nsw i32 %.pre, 1
  %.pre82 = zext i32 %.pre81 to i64
  %57 = alloca %"struct.std::pair", i64 %.pre82, align 16
  %58 = icmp eq i32 %.pre81, 0
  br i1 %58, label %.loopexit54, label %59

59:                                               ; preds = %.loopexit55
  %60 = getelementptr inbounds %"struct.std::pair", ptr %57, i64 %.pre82
  br label %61

61:                                               ; preds = %61, %59
  %62 = phi ptr [ %57, %59 ], [ %63, %61 ]
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %62)
  %63 = getelementptr inbounds i8, ptr %62, i64 8
  %64 = icmp eq ptr %63, %60
  br i1 %64, label %.loopexit54.loopexit, label %61

.loopexit54.loopexit:                             ; preds = %61
  %.pre79 = load i32, ptr %1, align 4, !tbaa !11
  %65 = sext i32 %.pre79 to i64
  br label %.loopexit54

.loopexit54:                                      ; preds = %.loopexit55.thread, %.loopexit54.loopexit, %.loopexit55
  %66 = phi ptr [ %57, %.loopexit54.loopexit ], [ %57, %.loopexit55 ], [ %50, %.loopexit55.thread ]
  %67 = phi i64 [ %65, %.loopexit54.loopexit ], [ -1, %.loopexit55 ], [ -1, %.loopexit55.thread ]
  %68 = getelementptr inbounds %"struct.std::pair", ptr %66, i64 %67
  %69 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %68, ptr noundef nonnull align 4 dereferenceable(8) %3)
  %70 = load i32, ptr %1, align 4, !tbaa !11
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds %"struct.std::pair", ptr %48, i64 %71
  %73 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %72, ptr noundef nonnull align 4 dereferenceable(8) %69)
  %74 = load i32, ptr %1, align 4, !tbaa !11
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds %"struct.std::pair", ptr %37, i64 %75
  %77 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %76, ptr noundef nonnull align 4 dereferenceable(8) %73)
  %78 = load i32, ptr %1, align 4, !tbaa !11
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds %"struct.std::pair", ptr %66, i64 %79
  %81 = getelementptr inbounds i8, ptr %80, i64 4
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %80, ptr noundef nonnull align 4 dereferenceable(4) %81) #8
  %82 = load i32, ptr %1, align 4, !tbaa !11
  %83 = icmp sgt i32 %82, 0
  br i1 %83, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.loopexit54
  %.lcssa62 = phi i32 [ %82, %.loopexit54 ], [ %112, %.lr.ph ]
  %84 = add nsw i32 %.lcssa62, 1
  store i32 %84, ptr %1, align 4, !tbaa !11
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds %"struct.std::pair", ptr %48, i64 %85
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef nonnull %48, ptr noundef nonnull %86)
  %87 = load i32, ptr %1, align 4, !tbaa !11
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds %"struct.std::pair", ptr %66, i64 %88
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef nonnull %66, ptr noundef nonnull %89)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #8
  call void @_ZN5stateC2Ev(ptr noundef nonnull align 4 dereferenceable(16) %4)
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %5) #8
  call void @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #8
  %90 = load i64, ptr %2, align 8
  store i64 %90, ptr %6, align 8
  %91 = getelementptr inbounds i8, ptr %6, i64 8
  store i32 -1, ptr %91, align 8, !tbaa !13
  %92 = getelementptr inbounds i8, ptr %6, i64 12
  store i32 0, ptr %92, align 4, !tbaa !16
  %93 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN5stateaSEOS_(ptr noundef nonnull align 4 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(16) %6) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #8
  invoke void @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(16) %4)
          to label %.preheader unwind label %129

.preheader:                                       ; preds = %._crit_edge
  %94 = ptrtoint ptr %48 to i64
  %95 = getelementptr inbounds i8, ptr %11, i64 8
  %96 = getelementptr inbounds i8, ptr %11, i64 12
  %97 = getelementptr inbounds i8, ptr %7, i64 4
  %98 = ptrtoint ptr %66 to i64
  %99 = getelementptr inbounds i8, ptr %14, i64 4
  %100 = getelementptr inbounds i8, ptr %15, i64 8
  %101 = getelementptr inbounds i8, ptr %15, i64 12
  %102 = call noundef zeroext i1 @_ZNKSt5queueI5stateSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  br i1 %102, label %._crit_edge101, label %.lr.ph100

.lr.ph:                                           ; preds = %.loopexit54, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.loopexit54 ]
  %103 = getelementptr inbounds %"struct.std::pair", ptr %37, i64 %indvars.iv
  %104 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %103)
  %105 = getelementptr inbounds i8, ptr %103, i64 4
  %106 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %104, ptr noundef nonnull align 4 dereferenceable(4) %105)
  %107 = getelementptr inbounds %"struct.std::pair", ptr %48, i64 %indvars.iv
  %108 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %107, ptr noundef nonnull align 4 dereferenceable(8) %103)
  %109 = getelementptr inbounds %"struct.std::pair", ptr %66, i64 %indvars.iv
  %110 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %109, ptr noundef nonnull align 4 dereferenceable(8) %108)
  %111 = getelementptr inbounds i8, ptr %109, i64 4
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %109, ptr noundef nonnull align 4 dereferenceable(4) %111) #8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %112 = load i32, ptr %1, align 4, !tbaa !11
  %113 = sext i32 %112 to i64
  %114 = icmp slt i64 %indvars.iv.next, %113
  br i1 %114, label %.lr.ph, label %._crit_edge, !llvm.loop !17

.lr.ph100:                                        ; preds = %.preheader, %.critedge2
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %115 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %116 = load i64, ptr %115, align 4
  store i64 %116, ptr %7, align 8
  %117 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %118 = getelementptr inbounds i8, ptr %117, i64 8
  %119 = load i32, ptr %118, align 4, !tbaa !13
  %120 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %121 = getelementptr inbounds i8, ptr %120, i64 12
  %122 = load i32, ptr %121, align 4, !tbaa !16
  call void @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %123 = call noundef zeroext i1 @_ZSteqIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(8) %3)
  br i1 %123, label %124, label %133

124:                                              ; preds = %.lr.ph100
  %125 = add nsw i32 %122, -1
  %126 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %125)
          to label %127 unwind label %131

127:                                              ; preds = %124
  %128 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %126, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %.critedge2.thread unwind label %131

.critedge2.thread:                                ; preds = %127
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  br label %.loopexit

129:                                              ; preds = %207, %._crit_edge101, %._crit_edge
  %130 = landingpad { ptr, i32 }
          cleanup
  br label %209

131:                                              ; preds = %127, %124
  %132 = landingpad { ptr, i32 }
          cleanup
  br label %205

133:                                              ; preds = %.lr.ph100
  %cond = icmp eq i32 %119, 0
  %.pre80 = load i32, ptr %1, align 4, !tbaa !11
  br i1 %cond, label %170, label %134

134:                                              ; preds = %133
  %135 = sext i32 %.pre80 to i64
  %136 = getelementptr inbounds %"struct.std::pair", ptr %48, i64 %135
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #8
  store i32 0, ptr %9, align 4, !tbaa !11
  call void @_ZNSt4pairIiiEC2IRiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %137 = invoke noundef ptr @_ZSt11lower_boundIPSt4pairIiiES1_ET_S3_S3_RKT0_(ptr noundef nonnull %48, ptr noundef nonnull %136, ptr noundef nonnull align 4 dereferenceable(8) %8)
          to label %138 unwind label %155

138:                                              ; preds = %134
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  %139 = ptrtoint ptr %137 to i64
  %140 = sub i64 %139, %94
  %141 = ashr exact i64 %140, 3
  %142 = load i32, ptr %1, align 4, !tbaa !11
  %143 = sext i32 %142 to i64
  %144 = icmp slt i64 %141, %143
  br i1 %144, label %.lr.ph66, label %.critedge

.lr.ph66:                                         ; preds = %138
  %145 = add nsw i32 %122, 1
  %146 = load i32, ptr %137, align 4, !tbaa !19
  %147 = load i32, ptr %7, align 8, !tbaa !19
  %148 = icmp eq i32 %146, %147
  br i1 %148, label %.lr.ph97, label %.critedge

149:                                              ; preds = %162
  %150 = load i32, ptr %.131, align 4, !tbaa !19
  %151 = load i32, ptr %7, align 8, !tbaa !19
  %152 = icmp eq i32 %150, %151
  br i1 %152, label %.lr.ph97, label %.critedge

.lr.ph97:                                         ; preds = %.lr.ph66, %149
  %.0306496 = phi ptr [ %.131, %149 ], [ %137, %.lr.ph66 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #8
  %153 = load i64, ptr %.0306496, align 4
  store i64 %153, ptr %10, align 8
  %154 = call noundef zeroext i1 @_ZSteqIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8) %10, ptr noundef nonnull align 4 dereferenceable(8) %7)
  br i1 %154, label %162, label %159, !llvm.loop !20

155:                                              ; preds = %134
  %156 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  br label %205

157:                                              ; preds = %159
  %158 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #8
  br label %205

159:                                              ; preds = %.lr.ph97
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %11) #8
  %160 = load i64, ptr %10, align 8
  store i64 %160, ptr %11, align 8
  store i32 0, ptr %95, align 8, !tbaa !13
  store i32 %145, ptr %96, align 4, !tbaa !16
  %161 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN5stateaSEOS_(ptr noundef nonnull align 4 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(16) %11) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #8
  invoke void @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(16) %4)
          to label %162 unwind label %157

162:                                              ; preds = %159, %.lr.ph97
  %.131 = getelementptr inbounds i8, ptr %.0306496, i64 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #8
  %163 = ptrtoint ptr %.131 to i64
  %164 = sub i64 %163, %94
  %165 = ashr exact i64 %164, 3
  %166 = load i32, ptr %1, align 4, !tbaa !11
  %167 = sext i32 %166 to i64
  %168 = icmp slt i64 %165, %167
  br i1 %168, label %149, label %.critedge

.critedge:                                        ; preds = %149, %162, %.lr.ph66, %138
  %169 = phi i32 [ %142, %138 ], [ %142, %.lr.ph66 ], [ %166, %162 ], [ %166, %149 ]
  %.not47 = icmp eq i32 %119, 1
  br i1 %.not47, label %.critedge2, label %170

170:                                              ; preds = %133, %.critedge
  %171 = phi i32 [ %.pre80, %133 ], [ %169, %.critedge ]
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds %"struct.std::pair", ptr %66, i64 %172
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #8
  store i32 0, ptr %13, align 4, !tbaa !11
  call void @_ZNSt4pairIiiEC2IRiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %12, ptr noundef nonnull align 4 dereferenceable(4) %97, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %174 = invoke noundef ptr @_ZSt11lower_boundIPSt4pairIiiES1_ET_S3_S3_RKT0_(ptr noundef nonnull %66, ptr noundef nonnull %173, ptr noundef nonnull align 4 dereferenceable(8) %12)
          to label %175 unwind label %190

175:                                              ; preds = %170
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #8
  %176 = ptrtoint ptr %174 to i64
  %177 = sub i64 %176, %98
  %178 = ashr exact i64 %177, 3
  %179 = load i32, ptr %1, align 4, !tbaa !11
  %180 = sext i32 %179 to i64
  %181 = icmp slt i64 %178, %180
  br i1 %181, label %.lr.ph70, label %.critedge2

.lr.ph70:                                         ; preds = %175
  %182 = add nsw i32 %122, 1
  br label %183

183:                                              ; preds = %.lr.ph70, %197
  %.068 = phi ptr [ %174, %.lr.ph70 ], [ %.1, %197 ]
  %184 = load i32, ptr %.068, align 4, !tbaa !19
  %185 = load i32, ptr %97, align 4, !tbaa !21
  %186 = icmp eq i32 %184, %185
  br i1 %186, label %187, label %.critedge2

187:                                              ; preds = %183
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #8
  %188 = load i64, ptr %.068, align 4
  store i64 %188, ptr %14, align 8
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %99) #8
  %189 = call noundef zeroext i1 @_ZSteqIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(8) %7)
  br i1 %189, label %197, label %194, !llvm.loop !22

190:                                              ; preds = %170
  %191 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #8
  br label %205

192:                                              ; preds = %194
  %193 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #8
  br label %205

194:                                              ; preds = %187
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %15) #8
  %195 = load i64, ptr %14, align 8
  store i64 %195, ptr %15, align 8
  store i32 1, ptr %100, align 8, !tbaa !13
  store i32 %182, ptr %101, align 4, !tbaa !16
  %196 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN5stateaSEOS_(ptr noundef nonnull align 4 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(16) %15) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %15) #8
  invoke void @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(16) %4)
          to label %197 unwind label %192

197:                                              ; preds = %194, %187
  %.1 = getelementptr inbounds i8, ptr %.068, i64 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #8
  %198 = ptrtoint ptr %.1 to i64
  %199 = sub i64 %198, %98
  %200 = ashr exact i64 %199, 3
  %201 = load i32, ptr %1, align 4, !tbaa !11
  %202 = sext i32 %201 to i64
  %203 = icmp slt i64 %200, %202
  br i1 %203, label %183, label %.critedge2

.critedge2:                                       ; preds = %183, %197, %175, %.critedge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  %204 = call noundef zeroext i1 @_ZNKSt5queueI5stateSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  br i1 %204, label %._crit_edge101, label %.lr.ph100

205:                                              ; preds = %190, %192, %155, %157, %131
  %.pn51 = phi { ptr, i32 } [ %132, %131 ], [ %158, %157 ], [ %156, %155 ], [ %193, %192 ], [ %191, %190 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  br label %209

._crit_edge101:                                   ; preds = %.critedge2, %.preheader
  %206 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
          to label %207 unwind label %129

207:                                              ; preds = %._crit_edge101
  %208 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %206, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %.loopexit unwind label %129

.loopexit:                                        ; preds = %.critedge2.thread, %207
  call void @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #8
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #8
  call void @llvm.stackrestore.p0(ptr %36)
  call void @llvm.lifetime.end.p0(i64 8, 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

209:                                              ; preds = %205, %129
  %.pn51.pn = phi { ptr, i32 } [ %.pn51, %205 ], [ %130, %129 ]
  call void @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #8
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 8, 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
  resume { ptr, i32 } %.pn51.pn
}

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

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

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) #3

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 nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #2 align 2

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5stateC2Ev(ptr noundef nonnull align 4 dereferenceable(16)) unnamed_addr #6 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN5stateaSEOS_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #5 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5queueI5stateSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #2 align 2

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

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

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 uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #7 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPSt4pairIiiES1_ET_S3_S3_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #6

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueI5stateSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #5 align 2

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

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 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { 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 #6 = { 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 #7 = { 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 #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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = !{!14, !12, i64 8}
!14 = !{!"_ZTS5state", !15, i64 0, !12, i64 8, !12, i64 12}
!15 = !{!"_ZTSSt4pairIiiE", !12, i64 0, !12, i64 4}
!16 = !{!14, !12, i64 12}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!15, !12, i64 0}
!20 = distinct !{!20, !18}
!21 = !{!15, !12, i64 4}
!22 = distinct !{!22, !18}


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