; LLVM IR from upupming/algorithm :: acwing/寒假每日一题（入门组）/week2/1113. 红与黑 (main)

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

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

@w = external dso_local global i32, align 4
@h = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@v = external dso_local global [30 x [30 x i32]], align 16
@dx = external dso_local global [4 x i32], align 16
@dy = external dso_local global [4 x i32], align 16
@s = external dso_local global [30 x [30 x i8]], align 16
@start = external dso_local global %"struct.std::pair", align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair", align 4
  %6 = alloca %"class.std::queue", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::pair", align 4
  store i32 0, ptr %1, align 4
  br label %14

14:                                               ; preds = %149, %0
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @w)
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 4 dereferenceable(4) @h)
  %17 = load ptr, ptr %16, align 8, !tbaa !5
  %18 = getelementptr i8, ptr %17, i64 -24
  %19 = load i64, ptr %18, align 8
  %20 = getelementptr inbounds i8, ptr %16, i64 %19
  %21 = call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %20)
  br i1 %21, label %22, label %30

22:                                               ; preds = %14
  %23 = load i32, ptr @w, align 4, !tbaa !8
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %28, label %25

25:                                               ; preds = %22
  %26 = load i32, ptr @h, align 4, !tbaa !8
  %27 = icmp ne i32 %26, 0
  br label %28

28:                                               ; preds = %25, %22
  %29 = phi i1 [ true, %22 ], [ %27, %25 ]
  br label %30

30:                                               ; preds = %28, %14
  %31 = phi i1 [ false, %14 ], [ %29, %28 ]
  br i1 %31, label %32, label %151

32:                                               ; preds = %30
  call void @llvm.memset.p0.i64(ptr align 16 @v, i8 0, i64 3600, i1 false)
  store i32 0, ptr @ans, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #9
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %33

33:                                               ; preds = %66, %32
  %34 = load i32, ptr %2, align 4, !tbaa !8
  %35 = load i32, ptr @h, align 4, !tbaa !8
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  store i32 4, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #9
  br label %69

38:                                               ; preds = %33
  %39 = load i32, ptr %2, align 4, !tbaa !8
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [30 x [30 x i8]], ptr @s, i64 0, i64 %40
  %42 = getelementptr inbounds [30 x i8], ptr %41, i64 0, i64 0
  %43 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef %42)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #9
  store i32 0, ptr %4, align 4, !tbaa !8
  br label %44

44:                                               ; preds = %62, %38
  %45 = load i32, ptr %4, align 4, !tbaa !8
  %46 = load i32, ptr @w, align 4, !tbaa !8
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %49, label %48

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

49:                                               ; preds = %44
  %50 = load i32, ptr %2, align 4, !tbaa !8
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [30 x [30 x i8]], ptr @s, i64 0, i64 %51
  %53 = load i32, ptr %4, align 4, !tbaa !8
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [30 x i8], ptr %52, i64 0, i64 %54
  %56 = load i8, ptr %55, align 1, !tbaa !11
  %57 = sext i8 %56 to i32
  %58 = icmp eq i32 %57, 64
  br i1 %58, label %59, label %61

59:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #9
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %60 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) @start, ptr noundef nonnull align 4 dereferenceable(8) %5) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #9
  br label %61

61:                                               ; preds = %59, %49
  br label %62

62:                                               ; preds = %61
  %63 = load i32, ptr %4, align 4, !tbaa !8
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %4, align 4, !tbaa !8
  br label %44, !llvm.loop !12

65:                                               ; preds = %48
  br label %66

66:                                               ; preds = %65
  %67 = load i32, ptr %2, align 4, !tbaa !8
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %2, align 4, !tbaa !8
  br label %33, !llvm.loop !14

69:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 80, ptr %6) #9
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
  %70 = load i32, ptr @ans, align 4, !tbaa !8
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr @ans, align 4, !tbaa !8
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %6, ptr noundef nonnull align 4 dereferenceable(8) @start)
          to label %72 unwind label %85

72:                                               ; preds = %69
  br label %73

73:                                               ; preds = %142, %72
  %74 = invoke noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
          to label %75 unwind label %85

75:                                               ; preds = %73
  %76 = icmp ne i64 %74, 0
  br i1 %76, label %77, label %144

77:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  %78 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
          to label %79 unwind label %89

79:                                               ; preds = %77
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 %78, i64 8, i1 false)
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
          to label %80 unwind label %89

80:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #9
  store i32 0, ptr %10, align 4, !tbaa !8
  br label %81

81:                                               ; preds = %135, %80
  %82 = load i32, ptr %10, align 4, !tbaa !8
  %83 = icmp slt i32 %82, 4
  br i1 %83, label %93, label %84

84:                                               ; preds = %81
  store i32 12, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #9
  br label %142

85:                                               ; preds = %147, %144, %73, %69
  %86 = landingpad { ptr, i32 }
          cleanup
  %87 = extractvalue { ptr, i32 } %86, 0
  store ptr %87, ptr %7, align 8
  %88 = extractvalue { ptr, i32 } %86, 1
  store i32 %88, ptr %8, align 4
  br label %150

89:                                               ; preds = %79, %77
  %90 = landingpad { ptr, i32 }
          cleanup
  %91 = extractvalue { ptr, i32 } %90, 0
  store ptr %91, ptr %7, align 8
  %92 = extractvalue { ptr, i32 } %90, 1
  store i32 %92, ptr %8, align 4
  br label %143

93:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  %94 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 0
  %95 = load i32, ptr %94, align 4, !tbaa !15
  %96 = load i32, ptr %10, align 4, !tbaa !8
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [4 x i32], ptr @dx, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !8
  %100 = add nsw i32 %95, %99
  store i32 %100, ptr %11, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  %101 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 1
  %102 = load i32, ptr %101, align 4, !tbaa !17
  %103 = load i32, ptr %10, align 4, !tbaa !8
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [4 x i32], ptr @dy, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !8
  %107 = add nsw i32 %102, %106
  store i32 %107, ptr %12, align 4, !tbaa !8
  %108 = load i32, ptr %11, align 4, !tbaa !8
  %109 = load i32, ptr %12, align 4, !tbaa !8
  %110 = call noundef zeroext i1 @_Z5validii(i32 noundef %108, i32 noundef %109)
  br i1 %110, label %111, label %120

111:                                              ; preds = %93
  %112 = load i32, ptr %11, align 4, !tbaa !8
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [30 x [30 x i32]], ptr @v, i64 0, i64 %113
  %115 = load i32, ptr %12, align 4, !tbaa !8
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [30 x i32], ptr %114, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !8
  %119 = icmp ne i32 %118, 0
  br i1 %119, label %120, label %121

120:                                              ; preds = %111, %93
  store i32 14, ptr %3, align 4
  br label %132

121:                                              ; preds = %111
  %122 = load i32, ptr %11, align 4, !tbaa !8
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [30 x [30 x i32]], ptr @v, i64 0, i64 %123
  %125 = load i32, ptr %12, align 4, !tbaa !8
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [30 x i32], ptr %124, i64 0, i64 %126
  store i32 1, ptr %127, align 4, !tbaa !8
  %128 = load i32, ptr @ans, align 4, !tbaa !8
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr @ans, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #9
  invoke void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %13, ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
          to label %130 unwind label %138

130:                                              ; preds = %121
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %6, ptr noundef nonnull align 4 dereferenceable(8) %13)
          to label %131 unwind label %138

131:                                              ; preds = %130
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  store i32 0, ptr %3, align 4
  br label %132

132:                                              ; preds = %131, %120
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  %133 = load i32, ptr %3, align 4
  switch i32 %133, label %157 [
    i32 0, label %134
    i32 14, label %135
  ]

134:                                              ; preds = %132
  br label %135

135:                                              ; preds = %134, %132
  %136 = load i32, ptr %10, align 4, !tbaa !8
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %10, align 4, !tbaa !8
  br label %81, !llvm.loop !18

138:                                              ; preds = %130, %121
  %139 = landingpad { ptr, i32 }
          cleanup
  %140 = extractvalue { ptr, i32 } %139, 0
  store ptr %140, ptr %7, align 8
  %141 = extractvalue { ptr, i32 } %139, 1
  store i32 %141, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #9
  br label %143

142:                                              ; preds = %84
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  br label %73, !llvm.loop !19

143:                                              ; preds = %138, %89
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  br label %150

144:                                              ; preds = %75
  %145 = load i32, ptr @ans, align 4, !tbaa !8
  %146 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %145)
          to label %147 unwind label %85

147:                                              ; preds = %144
  %148 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %146, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %149 unwind label %85

149:                                              ; preds = %147
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %6) #9
  call void @llvm.lifetime.end.p0(i64 80, ptr %6) #9
  br label %14, !llvm.loop !20

150:                                              ; preds = %143, %85
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %6) #9
  call void @llvm.lifetime.end.p0(i64 80, ptr %6) #9
  br label %152

151:                                              ; preds = %30
  ret i32 0

152:                                              ; preds = %150
  %153 = load ptr, ptr %7, align 8
  %154 = load i32, ptr %8, align 4
  %155 = insertvalue { ptr, i32 } poison, ptr %153, 0
  %156 = insertvalue { ptr, i32 } %155, i32 %154, 1
  resume { ptr, i32 } %156

157:                                              ; preds = %132
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264)) #3 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_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 #0 align 2

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80)) #0 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) #7

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3 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 nounwind uwtable
declare dso_local void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #8 align 2

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


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

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

@w = external dso_local global i32, align 4
@h = external dso_local global i32, align 4
@ans = external dso_local local_unnamed_addr global i32, align 4
@v = external dso_local local_unnamed_addr global [30 x [30 x i32]], align 16
@dx = external dso_local local_unnamed_addr global [4 x i32], align 16
@dy = external dso_local local_unnamed_addr global [4 x i32], align 16
@s = external dso_local global [30 x [30 x i8]], align 16
@start = external dso_local global %"struct.std::pair", align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5validii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair", align 4
  %4 = alloca %"class.std::queue", align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair", align 4
  %8 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @w)
  %9 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(4) @h)
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  %11 = getelementptr i8, ptr %10, i64 -24
  %12 = load i64, ptr %11, align 8
  %13 = getelementptr inbounds i8, ptr %9, i64 %12
  %14 = tail call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %13)
  br i1 %14, label %.lr.ph22, label %.critedge

.lr.ph22:                                         ; preds = %0, %125
  %15 = load i32, ptr @w, align 4, !tbaa !8
  %16 = icmp ne i32 %15, 0
  %17 = load i32, ptr @h, align 4
  %18 = icmp ne i32 %17, 0
  %19 = select i1 %16, i1 true, i1 %18
  br i1 %19, label %20, label %.critedge

20:                                               ; preds = %.lr.ph22
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(3600) @v, i8 0, i64 3600, i1 false)
  store i32 0, ptr @ans, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  store i32 0, ptr %1, align 4, !tbaa !8
  %21 = icmp sgt i32 %17, 0
  br i1 %21, label %.lr.ph15, label %._crit_edge16

._crit_edge16:                                    ; preds = %._crit_edge, %20
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %4) #8
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
  %22 = load i32, ptr @ans, align 4, !tbaa !8
  %23 = add nsw i32 %22, 1
  store i32 %23, ptr @ans, align 4, !tbaa !8
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %4, ptr noundef nonnull align 4 dereferenceable(8) @start)
          to label %.preheader unwind label %54

.preheader:                                       ; preds = %._crit_edge16
  %24 = call noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
  %.not18 = icmp eq i64 %24, 0
  br i1 %.not18, label %._crit_edge20, label %.lr.ph19

.lr.ph15:                                         ; preds = %20, %._crit_edge
  %storemerge13 = phi i32 [ %31, %._crit_edge ], [ 0, %20 ]
  %25 = sext i32 %storemerge13 to i64
  %26 = getelementptr inbounds [30 x [30 x i8]], ptr @s, i64 0, i64 %25
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef %26)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  store i32 0, ptr %2, align 4, !tbaa !8
  %28 = load i32, ptr @w, align 4, !tbaa !8
  %29 = icmp sgt i32 %28, 0
  br i1 %29, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %43, %.lr.ph15
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  %30 = load i32, ptr %1, align 4, !tbaa !8
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %1, align 4, !tbaa !8
  %32 = load i32, ptr @h, align 4, !tbaa !8
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %.lr.ph15, label %._crit_edge16, !llvm.loop !11

.lr.ph:                                           ; preds = %.lr.ph15, %43
  %34 = phi i32 [ %44, %43 ], [ %28, %.lr.ph15 ]
  %storemerge1112 = phi i32 [ %46, %43 ], [ 0, %.lr.ph15 ]
  %35 = load i32, ptr %1, align 4, !tbaa !8
  %36 = sext i32 %35 to i64
  %37 = sext i32 %storemerge1112 to i64
  %38 = getelementptr inbounds [30 x [30 x i8]], ptr @s, i64 0, i64 %36, i64 %37
  %39 = load i8, ptr %38, align 1, !tbaa !13
  %40 = icmp eq i8 %39, 64
  br i1 %40, label %41, label %43

41:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %42 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) @start, ptr noundef nonnull align 4 dereferenceable(8) %3) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  %.pre = load i32, ptr %2, align 4, !tbaa !8
  %.pre25 = load i32, ptr @w, align 4, !tbaa !8
  br label %43

43:                                               ; preds = %.lr.ph, %41
  %44 = phi i32 [ %34, %.lr.ph ], [ %.pre25, %41 ]
  %45 = phi i32 [ %storemerge1112, %.lr.ph ], [ %.pre, %41 ]
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %2, align 4, !tbaa !8
  %47 = icmp slt i32 %46, %44
  br i1 %47, label %.lr.ph, label %._crit_edge, !llvm.loop !14

.lr.ph19:                                         ; preds = %.preheader, %.loopexit
  %48 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
  %.sroa.0.0.copyload = load i32, ptr %48, align 4
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %48, i64 4
  %.sroa.5.0.copyload = load i32, ptr %.sroa.5.0..sroa_idx, align 4
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  %49 = load i32, ptr @dx, align 16, !tbaa !8
  %50 = add nsw i32 %49, %.sroa.0.0.copyload
  store i32 %50, ptr %5, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  %51 = load i32, ptr @dy, align 16, !tbaa !8
  %52 = add nsw i32 %51, %.sroa.5.0.copyload
  store i32 %52, ptr %6, align 4, !tbaa !8
  %53 = call noundef zeroext i1 @_Z5validii(i32 noundef %50, i32 noundef %52)
  br i1 %53, label %56, label %67

54:                                               ; preds = %123, %._crit_edge20, %._crit_edge16
  %55 = landingpad { ptr, i32 }
          cleanup
  br label %133

56:                                               ; preds = %.lr.ph19
  %57 = load i32, ptr %5, align 4, !tbaa !8
  %58 = sext i32 %57 to i64
  %59 = load i32, ptr %6, align 4, !tbaa !8
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [30 x [30 x i32]], ptr @v, i64 0, i64 %58, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !8
  %.not9 = icmp eq i32 %62, 0
  br i1 %.not9, label %63, label %67

63:                                               ; preds = %56
  store i32 1, ptr %61, align 4, !tbaa !8
  %64 = load i32, ptr @ans, align 4, !tbaa !8
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr @ans, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %4, ptr noundef nonnull align 4 dereferenceable(8) %7)
          to label %66 unwind label %119

66:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  br label %67

67:                                               ; preds = %.lr.ph19, %56, %66
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  %68 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 4), align 4, !tbaa !8
  %69 = add nsw i32 %68, %.sroa.0.0.copyload
  store i32 %69, ptr %5, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  %70 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 4), align 4, !tbaa !8
  %71 = add nsw i32 %70, %.sroa.5.0.copyload
  store i32 %71, ptr %6, align 4, !tbaa !8
  %72 = call noundef zeroext i1 @_Z5validii(i32 noundef %69, i32 noundef %71)
  br i1 %72, label %73, label %84

73:                                               ; preds = %67
  %74 = load i32, ptr %5, align 4, !tbaa !8
  %75 = sext i32 %74 to i64
  %76 = load i32, ptr %6, align 4, !tbaa !8
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [30 x [30 x i32]], ptr @v, i64 0, i64 %75, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !8
  %.not9.1 = icmp eq i32 %79, 0
  br i1 %.not9.1, label %80, label %84

80:                                               ; preds = %73
  store i32 1, ptr %78, align 4, !tbaa !8
  %81 = load i32, ptr @ans, align 4, !tbaa !8
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr @ans, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %4, ptr noundef nonnull align 4 dereferenceable(8) %7)
          to label %83 unwind label %119

83:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  br label %84

84:                                               ; preds = %83, %73, %67
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  %85 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 8), align 8, !tbaa !8
  %86 = add nsw i32 %85, %.sroa.0.0.copyload
  store i32 %86, ptr %5, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  %87 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 8), align 8, !tbaa !8
  %88 = add nsw i32 %87, %.sroa.5.0.copyload
  store i32 %88, ptr %6, align 4, !tbaa !8
  %89 = call noundef zeroext i1 @_Z5validii(i32 noundef %86, i32 noundef %88)
  br i1 %89, label %90, label %101

90:                                               ; preds = %84
  %91 = load i32, ptr %5, align 4, !tbaa !8
  %92 = sext i32 %91 to i64
  %93 = load i32, ptr %6, align 4, !tbaa !8
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [30 x [30 x i32]], ptr @v, i64 0, i64 %92, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !8
  %.not9.2 = icmp eq i32 %96, 0
  br i1 %.not9.2, label %97, label %101

97:                                               ; preds = %90
  store i32 1, ptr %95, align 4, !tbaa !8
  %98 = load i32, ptr @ans, align 4, !tbaa !8
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr @ans, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %4, ptr noundef nonnull align 4 dereferenceable(8) %7)
          to label %100 unwind label %119

100:                                              ; preds = %97
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  br label %101

101:                                              ; preds = %100, %90, %84
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  %102 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 12), align 4, !tbaa !8
  %103 = add nsw i32 %102, %.sroa.0.0.copyload
  store i32 %103, ptr %5, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  %104 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 12), align 4, !tbaa !8
  %105 = add nsw i32 %104, %.sroa.5.0.copyload
  store i32 %105, ptr %6, align 4, !tbaa !8
  %106 = call noundef zeroext i1 @_Z5validii(i32 noundef %103, i32 noundef %105)
  br i1 %106, label %107, label %.loopexit

107:                                              ; preds = %101
  %108 = load i32, ptr %5, align 4, !tbaa !8
  %109 = sext i32 %108 to i64
  %110 = load i32, ptr %6, align 4, !tbaa !8
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [30 x [30 x i32]], ptr @v, i64 0, i64 %109, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !8
  %.not9.3 = icmp eq i32 %113, 0
  br i1 %.not9.3, label %114, label %.loopexit

114:                                              ; preds = %107
  store i32 1, ptr %112, align 4, !tbaa !8
  %115 = load i32, ptr @ans, align 4, !tbaa !8
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr @ans, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %4, ptr noundef nonnull align 4 dereferenceable(8) %7)
          to label %117 unwind label %119

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

.loopexit:                                        ; preds = %117, %107, %101
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  %118 = call noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
  %.not = icmp eq i64 %118, 0
  br i1 %.not, label %._crit_edge20, label %.lr.ph19, !llvm.loop !15

119:                                              ; preds = %114, %97, %80, %63
  %120 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  br label %133

._crit_edge20:                                    ; preds = %.loopexit, %.preheader
  %121 = load i32, ptr @ans, align 4, !tbaa !8
  %122 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %121)
          to label %123 unwind label %54

123:                                              ; preds = %._crit_edge20
  %124 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %122, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %125 unwind label %54

125:                                              ; preds = %123
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %4) #8
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %4) #8
  %126 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @w)
  %127 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %126, ptr noundef nonnull align 4 dereferenceable(4) @h)
  %128 = load ptr, ptr %127, align 8, !tbaa !5
  %129 = getelementptr i8, ptr %128, i64 -24
  %130 = load i64, ptr %129, align 8
  %131 = getelementptr inbounds i8, ptr %127, i64 %130
  %132 = call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %131)
  br i1 %132, label %.lr.ph22, label %.critedge, !llvm.loop !16

133:                                              ; preds = %119, %54
  %.pn = phi { ptr, i32 } [ %120, %119 ], [ %55, %54 ]
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %4) #8
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %4) #8
  resume { ptr, i32 } %.pn

.critedge:                                        ; preds = %.lr.ph22, %125, %0
  ret i32 0
}

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 #2

; Function Attrs: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_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 #0 align 2

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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


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