; LLVM IR from kazunetakahashi/atcoder :: 2018/0415_s8pc-5 (E)

; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::tuple<long long, int, int, int, long long>, std::allocator<std::tuple<long long, int, int, int, long long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::tuple<long long, int, int, int, long long>, std::allocator<std::tuple<long long, int, int, int, long long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::tuple<long long, int, int, int, long long>, std::allocator<std::tuple<long long, int, int, int, long long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::tuple<long long, int, int, int, long long>, std::allocator<std::tuple<long long, int, int, int, long long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.base.10", %"struct.std::_Head_base.11" }
%"struct.std::_Tuple_impl.base.10" = type { %"struct.std::_Tuple_impl.4", %"struct.std::_Head_base.9" }
%"struct.std::_Tuple_impl.4" = type { %"struct.std::_Tuple_impl.base", %"struct.std::_Head_base.8" }
%"struct.std::_Tuple_impl.base" = type <{ %"struct.std::_Tuple_impl.6", %"struct.std::_Head_base.7" }>
%"struct.std::_Tuple_impl.6" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { i64 }
%"struct.std::_Head_base.7" = type { i32 }
%"struct.std::_Head_base.8" = type { i32 }
%"struct.std::_Head_base.9" = type { i32 }
%"struct.std::_Head_base.11" = type { i64 }

@H = external dso_local global i32, align 4
@W = external dso_local global i32, align 4
@D = external dso_local global [777 x [777 x [4 x i64]]], align 16
@ans = external dso_local global [777 x [777 x i64]], align 16
@_Z1SB5cxx11 = external dso_local global [777 x %"class.std::__cxx11::basic_string"], align 16
@Q = external dso_local global %"class.std::priority_queue", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [27 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [80 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@_ZL2dx = external hidden constant [4 x i32], align 16
@_ZL2dy = external hidden constant [4 x i32], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"class.std::tuple", align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i64, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca %"class.std::tuple", align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca %"class.std::tuple", align 8
  %27 = alloca i64, align 8
  %28 = alloca i64, align 8
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 -1, ptr %2, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @D, ptr noundef getelementptr inbounds (i64, ptr @D, i64 2414916), ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @H)
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %32, ptr noundef nonnull align 4 dereferenceable(4) @W)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %44, %0
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = load i32, ptr @H, align 4, !tbaa !5
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %47

39:                                               ; preds = %34
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [777 x %"class.std::__cxx11::basic_string"], ptr @_Z1SB5cxx11, i64 0, i64 %41
  %43 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %42)
  br label %44

44:                                               ; preds = %39
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %3, align 4, !tbaa !5
  br label %34, !llvm.loop !9

47:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 -1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 -1, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %77, %47
  %49 = load i32, ptr %6, align 4, !tbaa !5
  %50 = load i32, ptr @H, align 4, !tbaa !5
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %53, label %52

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

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

54:                                               ; preds = %73, %53
  %55 = load i32, ptr %8, align 4, !tbaa !5
  %56 = load i32, ptr @W, align 4, !tbaa !5
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %54
  store i32 8, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %76

59:                                               ; preds = %54
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [777 x %"class.std::__cxx11::basic_string"], ptr @_Z1SB5cxx11, i64 0, i64 %61
  %63 = load i32, ptr %8, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %62, i64 noundef %64)
  %66 = load i8, ptr %65, align 1, !tbaa !11
  %67 = sext i8 %66 to i32
  %68 = icmp eq i32 %67, 71
  br i1 %68, label %69, label %72

69:                                               ; preds = %59
  %70 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %70, ptr %4, align 4, !tbaa !5
  %71 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %71, ptr %5, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %69, %59
  br label %73

73:                                               ; preds = %72
  %74 = load i32, ptr %8, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %8, align 4, !tbaa !5
  br label %54, !llvm.loop !12

76:                                               ; preds = %58
  br label %77

77:                                               ; preds = %76
  %78 = load i32, ptr %6, align 4, !tbaa !5
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %6, align 4, !tbaa !5
  br label %48, !llvm.loop !13

80:                                               ; preds = %52
  %81 = load i32, ptr %4, align 4, !tbaa !5
  %82 = icmp sge i32 %81, 0
  br i1 %82, label %83, label %86

83:                                               ; preds = %80
  %84 = load i32, ptr %5, align 4, !tbaa !5
  %85 = icmp sge i32 %84, 0
  br label %86

86:                                               ; preds = %83, %80
  %87 = phi i1 [ false, %80 ], [ %85, %83 ]
  br i1 %87, label %88, label %89

88:                                               ; preds = %86
  br label %91

89:                                               ; preds = %86
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.3, i32 noundef 69, ptr noundef @__PRETTY_FUNCTION__.main) #9
  unreachable

90:                                               ; No predecessors!
  br label %91

91:                                               ; preds = %90, %88
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @_ZNSt5tupleIJxiiixEEC2IJiRiS2_iiELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS4_(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12) #8
  call void @_ZNSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(32) %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #8
  br label %92

92:                                               ; preds = %210, %91
  %93 = call noundef zeroext i1 @_ZNKSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %94 = xor i1 %93, true
  br i1 %94, label %95, label %211

95:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %96 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %97 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3getILm0EJxiiixEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %96) #8
  %98 = load i64, ptr %97, align 8, !tbaa !14
  store i64 %98, ptr %13, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  %99 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %100 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EJxiiixEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %99) #8
  %101 = load i32, ptr %100, align 4, !tbaa !5
  store i32 %101, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  %102 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %103 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm2EJxiiixEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %102) #8
  %104 = load i32, ptr %103, align 4, !tbaa !5
  store i32 %104, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  %105 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %106 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm3EJxiiixEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %105) #8
  %107 = load i32, ptr %106, align 4, !tbaa !5
  store i32 %107, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %108 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3getILm4EJxiiixEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %108) #8
  %110 = load i64, ptr %109, align 8, !tbaa !14
  store i64 %110, ptr %17, align 8, !tbaa !14
  call void @_ZNSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %111 = load i32, ptr %14, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [777 x [777 x [4 x i64]]], ptr @D, i64 0, i64 %112
  %114 = load i32, ptr %15, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [777 x [4 x i64]], ptr %113, i64 0, i64 %115
  %117 = load i32, ptr %16, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [4 x i64], ptr %116, i64 0, i64 %118
  %120 = load i64, ptr %119, align 8, !tbaa !14
  %121 = icmp slt i64 %120, 0
  br i1 %121, label %122, label %210

122:                                              ; preds = %95
  %123 = load i32, ptr %14, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [777 x %"class.std::__cxx11::basic_string"], ptr @_Z1SB5cxx11, i64 0, i64 %124
  %126 = load i32, ptr %15, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %125, i64 noundef %127)
  %129 = load i8, ptr %128, align 1, !tbaa !11
  %130 = sext i8 %129 to i32
  %131 = icmp eq i32 %130, 46
  br i1 %131, label %132, label %165

132:                                              ; preds = %122
  %133 = load i64, ptr %13, align 8, !tbaa !14
  %134 = load i32, ptr %14, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [777 x [777 x [4 x i64]]], ptr @D, i64 0, i64 %135
  %137 = load i32, ptr %15, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [777 x [4 x i64]], ptr %136, i64 0, i64 %138
  %140 = load i32, ptr %16, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [4 x i64], ptr %139, i64 0, i64 %141
  store i64 %133, ptr %142, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  %143 = load i32, ptr %14, align 4, !tbaa !5
  %144 = load i32, ptr %16, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [4 x i32], ptr @_ZL2dx, i64 0, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !5
  %148 = add nsw i32 %143, %147
  store i32 %148, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  %149 = load i32, ptr %15, align 4, !tbaa !5
  %150 = load i32, ptr %16, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [4 x i32], ptr @_ZL2dy, i64 0, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = add nsw i32 %149, %153
  store i32 %154, ptr %19, align 4, !tbaa !5
  %155 = load i32, ptr %18, align 4, !tbaa !5
  %156 = load i32, ptr %19, align 4, !tbaa !5
  %157 = load i32, ptr %16, align 4, !tbaa !5
  %158 = call noundef zeroext i1 @_Z5validiii(i32 noundef %155, i32 noundef %156, i32 noundef %157)
  br i1 %158, label %159, label %164

159:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 32, ptr %20) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %160 = load i64, ptr %13, align 8, !tbaa !14
  %161 = add nsw i64 %160, 1
  store i64 %161, ptr %21, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  %162 = load i64, ptr %17, align 8, !tbaa !14
  %163 = add nsw i64 %162, 1
  store i64 %163, ptr %22, align 8, !tbaa !14
  call void @_ZNSt5tupleIJxiiixEEC2IJxRiS2_S2_xELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS4_(ptr noundef nonnull align 8 dereferenceable(32) %20, ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 4 dereferenceable(4) %18, ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %16, ptr noundef nonnull align 8 dereferenceable(8) %22) #8
  call void @_ZNSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(32) %20)
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %20) #8
  br label %164

164:                                              ; preds = %159, %132
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  br label %209

165:                                              ; preds = %122
  %166 = load i64, ptr %13, align 8, !tbaa !14
  %167 = load i32, ptr %14, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [777 x [777 x [4 x i64]]], ptr @D, i64 0, i64 %168
  %170 = load i32, ptr %15, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [777 x [4 x i64]], ptr %169, i64 0, i64 %171
  %173 = load i32, ptr %16, align 4, !tbaa !5
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [4 x i64], ptr %172, i64 0, i64 %174
  store i64 %166, ptr %175, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #8
  store i32 0, ptr %23, align 4, !tbaa !5
  br label %176

176:                                              ; preds = %205, %165
  %177 = load i32, ptr %23, align 4, !tbaa !5
  %178 = icmp slt i32 %177, 4
  br i1 %178, label %180, label %179

179:                                              ; preds = %176
  store i32 13, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  br label %208

180:                                              ; preds = %176
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #8
  %181 = load i32, ptr %14, align 4, !tbaa !5
  %182 = load i32, ptr %23, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [4 x i32], ptr @_ZL2dx, i64 0, i64 %183
  %185 = load i32, ptr %184, align 4, !tbaa !5
  %186 = add nsw i32 %181, %185
  store i32 %186, ptr %24, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #8
  %187 = load i32, ptr %15, align 4, !tbaa !5
  %188 = load i32, ptr %23, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [4 x i32], ptr @_ZL2dy, i64 0, i64 %189
  %191 = load i32, ptr %190, align 4, !tbaa !5
  %192 = add nsw i32 %187, %191
  store i32 %192, ptr %25, align 4, !tbaa !5
  %193 = load i32, ptr %24, align 4, !tbaa !5
  %194 = load i32, ptr %25, align 4, !tbaa !5
  %195 = load i32, ptr %23, align 4, !tbaa !5
  %196 = call noundef zeroext i1 @_Z5validiii(i32 noundef %193, i32 noundef %194, i32 noundef %195)
  br i1 %196, label %197, label %204

197:                                              ; preds = %180
  call void @llvm.lifetime.start.p0(i64 32, ptr %26) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #8
  %198 = load i64, ptr %13, align 8, !tbaa !14
  %199 = load i64, ptr %17, align 8, !tbaa !14
  %200 = add nsw i64 %198, %199
  %201 = add nsw i64 %200, 1
  store i64 %201, ptr %27, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #8
  %202 = load i64, ptr %17, align 8, !tbaa !14
  %203 = add nsw i64 %202, 1
  store i64 %203, ptr %28, align 8, !tbaa !14
  call void @_ZNSt5tupleIJxiiixEEC2IJxRiS2_S2_xELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS4_(ptr noundef nonnull align 8 dereferenceable(32) %26, ptr noundef nonnull align 8 dereferenceable(8) %27, ptr noundef nonnull align 4 dereferenceable(4) %24, ptr noundef nonnull align 4 dereferenceable(4) %25, ptr noundef nonnull align 4 dereferenceable(4) %23, ptr noundef nonnull align 8 dereferenceable(8) %28) #8
  call void @_ZNSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(32) %26)
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %26) #8
  br label %204

204:                                              ; preds = %197, %180
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #8
  br label %205

205:                                              ; preds = %204
  %206 = load i32, ptr %23, align 4, !tbaa !5
  %207 = add nsw i32 %206, 1
  store i32 %207, ptr %23, align 4, !tbaa !5
  br label %176, !llvm.loop !16

208:                                              ; preds = %179
  br label %209

209:                                              ; preds = %208, %164
  br label %210

210:                                              ; preds = %209, %95
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %92, !llvm.loop !17

211:                                              ; preds = %92
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #8
  store i32 0, ptr %29, align 4, !tbaa !5
  br label %212

212:                                              ; preds = %323, %211
  %213 = load i32, ptr %29, align 4, !tbaa !5
  %214 = load i32, ptr @H, align 4, !tbaa !5
  %215 = icmp slt i32 %213, %214
  br i1 %215, label %217, label %216

216:                                              ; preds = %212
  store i32 16, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #8
  br label %326

217:                                              ; preds = %212
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #8
  store i32 0, ptr %30, align 4, !tbaa !5
  br label %218

218:                                              ; preds = %319, %217
  %219 = load i32, ptr %30, align 4, !tbaa !5
  %220 = load i32, ptr @W, align 4, !tbaa !5
  %221 = icmp slt i32 %219, %220
  br i1 %221, label %223, label %222

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

223:                                              ; preds = %218
  %224 = load i32, ptr %29, align 4, !tbaa !5
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [777 x [777 x i64]], ptr @ans, i64 0, i64 %225
  %227 = load i32, ptr %30, align 4, !tbaa !5
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [777 x i64], ptr %226, i64 0, i64 %228
  store i64 -1, ptr %229, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #8
  store i32 0, ptr %31, align 4, !tbaa !5
  br label %230

230:                                              ; preds = %298, %223
  %231 = load i32, ptr %31, align 4, !tbaa !5
  %232 = icmp slt i32 %231, 4
  br i1 %232, label %234, label %233

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

234:                                              ; preds = %230
  %235 = load i32, ptr %29, align 4, !tbaa !5
  %236 = sext i32 %235 to i64
  %237 = getelementptr inbounds [777 x [777 x [4 x i64]]], ptr @D, i64 0, i64 %236
  %238 = load i32, ptr %30, align 4, !tbaa !5
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds [777 x [4 x i64]], ptr %237, i64 0, i64 %239
  %241 = load i32, ptr %31, align 4, !tbaa !5
  %242 = sext i32 %241 to i64
  %243 = getelementptr inbounds [4 x i64], ptr %240, i64 0, i64 %242
  %244 = load i64, ptr %243, align 8, !tbaa !14
  %245 = icmp sge i64 %244, 0
  br i1 %245, label %246, label %297

246:                                              ; preds = %234
  %247 = load i32, ptr %29, align 4, !tbaa !5
  %248 = sext i32 %247 to i64
  %249 = getelementptr inbounds [777 x [777 x i64]], ptr @ans, i64 0, i64 %248
  %250 = load i32, ptr %30, align 4, !tbaa !5
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds [777 x i64], ptr %249, i64 0, i64 %251
  %253 = load i64, ptr %252, align 8, !tbaa !14
  %254 = icmp slt i64 %253, 0
  br i1 %254, label %255, label %272

255:                                              ; preds = %246
  %256 = load i32, ptr %29, align 4, !tbaa !5
  %257 = sext i32 %256 to i64
  %258 = getelementptr inbounds [777 x [777 x [4 x i64]]], ptr @D, i64 0, i64 %257
  %259 = load i32, ptr %30, align 4, !tbaa !5
  %260 = sext i32 %259 to i64
  %261 = getelementptr inbounds [777 x [4 x i64]], ptr %258, i64 0, i64 %260
  %262 = load i32, ptr %31, align 4, !tbaa !5
  %263 = sext i32 %262 to i64
  %264 = getelementptr inbounds [4 x i64], ptr %261, i64 0, i64 %263
  %265 = load i64, ptr %264, align 8, !tbaa !14
  %266 = load i32, ptr %29, align 4, !tbaa !5
  %267 = sext i32 %266 to i64
  %268 = getelementptr inbounds [777 x [777 x i64]], ptr @ans, i64 0, i64 %267
  %269 = load i32, ptr %30, align 4, !tbaa !5
  %270 = sext i32 %269 to i64
  %271 = getelementptr inbounds [777 x i64], ptr %268, i64 0, i64 %270
  store i64 %265, ptr %271, align 8, !tbaa !14
  br label %296

272:                                              ; preds = %246
  %273 = load i32, ptr %29, align 4, !tbaa !5
  %274 = sext i32 %273 to i64
  %275 = getelementptr inbounds [777 x [777 x i64]], ptr @ans, i64 0, i64 %274
  %276 = load i32, ptr %30, align 4, !tbaa !5
  %277 = sext i32 %276 to i64
  %278 = getelementptr inbounds [777 x i64], ptr %275, i64 0, i64 %277
  %279 = load i32, ptr %29, align 4, !tbaa !5
  %280 = sext i32 %279 to i64
  %281 = getelementptr inbounds [777 x [777 x [4 x i64]]], ptr @D, i64 0, i64 %280
  %282 = load i32, ptr %30, align 4, !tbaa !5
  %283 = sext i32 %282 to i64
  %284 = getelementptr inbounds [777 x [4 x i64]], ptr %281, i64 0, i64 %283
  %285 = load i32, ptr %31, align 4, !tbaa !5
  %286 = sext i32 %285 to i64
  %287 = getelementptr inbounds [4 x i64], ptr %284, i64 0, i64 %286
  %288 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %278, ptr noundef nonnull align 8 dereferenceable(8) %287)
  %289 = load i64, ptr %288, align 8, !tbaa !14
  %290 = load i32, ptr %29, align 4, !tbaa !5
  %291 = sext i32 %290 to i64
  %292 = getelementptr inbounds [777 x [777 x i64]], ptr @ans, i64 0, i64 %291
  %293 = load i32, ptr %30, align 4, !tbaa !5
  %294 = sext i32 %293 to i64
  %295 = getelementptr inbounds [777 x i64], ptr %292, i64 0, i64 %294
  store i64 %289, ptr %295, align 8, !tbaa !14
  br label %296

296:                                              ; preds = %272, %255
  br label %297

297:                                              ; preds = %296, %234
  br label %298

298:                                              ; preds = %297
  %299 = load i32, ptr %31, align 4, !tbaa !5
  %300 = add nsw i32 %299, 1
  store i32 %300, ptr %31, align 4, !tbaa !5
  br label %230, !llvm.loop !18

301:                                              ; preds = %233
  %302 = load i32, ptr %29, align 4, !tbaa !5
  %303 = sext i32 %302 to i64
  %304 = getelementptr inbounds [777 x [777 x i64]], ptr @ans, i64 0, i64 %303
  %305 = load i32, ptr %30, align 4, !tbaa !5
  %306 = sext i32 %305 to i64
  %307 = getelementptr inbounds [777 x i64], ptr %304, i64 0, i64 %306
  %308 = load i64, ptr %307, align 8, !tbaa !14
  %309 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %308)
  %310 = load i32, ptr %30, align 4, !tbaa !5
  %311 = load i32, ptr @W, align 4, !tbaa !5
  %312 = sub nsw i32 %311, 1
  %313 = icmp slt i32 %310, %312
  br i1 %313, label %314, label %316

314:                                              ; preds = %301
  %315 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.4)
  br label %318

316:                                              ; preds = %301
  %317 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %318

318:                                              ; preds = %316, %314
  br label %319

319:                                              ; preds = %318
  %320 = load i32, ptr %30, align 4, !tbaa !5
  %321 = add nsw i32 %320, 1
  store i32 %321, ptr %30, align 4, !tbaa !5
  br label %218, !llvm.loop !19

322:                                              ; preds = %222
  br label %323

323:                                              ; preds = %322
  %324 = load i32, ptr %29, align 4, !tbaa !5
  %325 = add nsw i32 %324, 1
  store i32 %325, ptr %29, align 4, !tbaa !5
  br label %212, !llvm.loop !20

326:                                              ; preds = %216
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  %327 = load i32, ptr %1, align 4
  ret i32 %327
}

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.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)) #4

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #4

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #5

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5tupleIJxiiixEEC2IJiRiS2_iiELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), 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 zeroext i1 @_ZNKSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) #0 align 2

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25)) #6 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #6 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)) #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 = { 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 }
attributes #9 = { noreturn 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!15, !15, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}


; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::tuple<long long, int, int, int, long long>, std::allocator<std::tuple<long long, int, int, int, long long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::tuple<long long, int, int, int, long long>, std::allocator<std::tuple<long long, int, int, int, long long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::tuple<long long, int, int, int, long long>, std::allocator<std::tuple<long long, int, int, int, long long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::tuple<long long, int, int, int, long long>, std::allocator<std::tuple<long long, int, int, int, long long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.base.10", %"struct.std::_Head_base.11" }
%"struct.std::_Tuple_impl.base.10" = type { %"struct.std::_Tuple_impl.4", %"struct.std::_Head_base.9" }
%"struct.std::_Tuple_impl.4" = type { %"struct.std::_Tuple_impl.base", %"struct.std::_Head_base.8" }
%"struct.std::_Tuple_impl.base" = type <{ %"struct.std::_Tuple_impl.6", %"struct.std::_Head_base.7" }>
%"struct.std::_Tuple_impl.6" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { i64 }
%"struct.std::_Head_base.7" = type { i32 }
%"struct.std::_Head_base.8" = type { i32 }
%"struct.std::_Head_base.9" = type { i32 }
%"struct.std::_Head_base.11" = type { i64 }

@H = external dso_local global i32, align 4
@W = external dso_local global i32, align 4
@D = external dso_local global [777 x [777 x [4 x i64]]], align 16
@ans = external dso_local global [777 x [777 x i64]], align 16
@_Z1SB5cxx11 = external dso_local global [777 x %"class.std::__cxx11::basic_string"], align 16
@Q = external dso_local global %"class.std::priority_queue", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [27 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [80 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@_ZL2dx = external hidden local_unnamed_addr constant [4 x i32], align 16
@_ZL2dy = external hidden local_unnamed_addr constant [4 x i32], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"class.std::tuple", align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"class.std::tuple", align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %"class.std::tuple", align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  store i32 -1, ptr %1, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @D, ptr noundef nonnull getelementptr inbounds (i8, ptr @D, i64 19319328), ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @H)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 4 dereferenceable(4) @W)
  %22 = load i32, ptr @H, align 4, !tbaa !5
  %23 = icmp sgt i32 %22, 0
  br i1 %23, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  br label %._crit_edge72.thread

._crit_edge:                                      ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  store i32 -1, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  store i32 -1, ptr %3, align 4, !tbaa !5
  %24 = icmp sgt i32 %29, 0
  %25 = load i32, ptr @W, align 4
  %26 = icmp sgt i32 %25, 0
  %or.cond = select i1 %24, i1 %26, i1 false
  br i1 %or.cond, label %.preheader66, label %._crit_edge72.thread

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %27 = getelementptr inbounds [777 x %"class.std::__cxx11::basic_string"], ptr @_Z1SB5cxx11, i64 0, i64 %indvars.iv
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %27)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %29 = load i32, ptr @H, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = icmp slt i64 %indvars.iv.next, %30
  br i1 %31, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader66:                                     ; preds = %._crit_edge, %._crit_edge70
  %32 = phi i32 [ %40, %._crit_edge70 ], [ %29, %._crit_edge ]
  %33 = phi i32 [ %41, %._crit_edge70 ], [ %25, %._crit_edge ]
  %indvars.iv88 = phi i64 [ %indvars.iv.next89, %._crit_edge70 ], [ 0, %._crit_edge ]
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph69, label %._crit_edge70

.lr.ph69:                                         ; preds = %.preheader66
  %35 = getelementptr inbounds [777 x %"class.std::__cxx11::basic_string"], ptr @_Z1SB5cxx11, i64 0, i64 %indvars.iv88
  %36 = trunc nuw nsw i64 %indvars.iv88 to i32
  br label %44

._crit_edge72:                                    ; preds = %._crit_edge70
  %.pre100 = load i32, ptr %2, align 4, !tbaa !5
  %.pre101 = load i32, ptr %3, align 4
  %37 = icmp sgt i32 %.pre100, -1
  %38 = icmp sgt i32 %.pre101, -1
  %39 = select i1 %37, i1 %38, i1 false
  br i1 %39, label %54, label %._crit_edge72.thread

._crit_edge70.loopexit:                           ; preds = %50
  %.pre = load i32, ptr @H, align 4, !tbaa !5
  br label %._crit_edge70

._crit_edge70:                                    ; preds = %._crit_edge70.loopexit, %.preheader66
  %40 = phi i32 [ %.pre, %._crit_edge70.loopexit ], [ %32, %.preheader66 ]
  %41 = phi i32 [ %51, %._crit_edge70.loopexit ], [ %33, %.preheader66 ]
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %42 = sext i32 %40 to i64
  %43 = icmp slt i64 %indvars.iv.next89, %42
  br i1 %43, label %.preheader66, label %._crit_edge72, !llvm.loop !11

44:                                               ; preds = %.lr.ph69, %50
  %indvars.iv85 = phi i64 [ 0, %.lr.ph69 ], [ %indvars.iv.next86, %50 ]
  %45 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %35, i64 noundef %indvars.iv85)
  %46 = load i8, ptr %45, align 1, !tbaa !13
  %47 = icmp eq i8 %46, 71
  br i1 %47, label %48, label %50

48:                                               ; preds = %44
  store i32 %36, ptr %2, align 4, !tbaa !5
  %49 = trunc nuw nsw i64 %indvars.iv85 to i32
  store i32 %49, ptr %3, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %44, %48
  %indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
  %51 = load i32, ptr @W, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = icmp slt i64 %indvars.iv.next86, %52
  br i1 %53, label %44, label %._crit_edge70.loopexit, !llvm.loop !14

._crit_edge72.thread:                             ; preds = %._crit_edge.thread, %._crit_edge, %._crit_edge72
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.3, i32 noundef 69, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #9
  unreachable

54:                                               ; preds = %._crit_edge72
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #8
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @_ZNSt5tupleIJxiiixEEC2IJiRiS2_iiELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS4_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7) #8
  call void @_ZNSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(32) %4)
  call void @llvm.lifetime.end.p0(i64 4, 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
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #8
  %55 = call noundef zeroext i1 @_ZNKSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  br i1 %55, label %.preheader65, label %.lr.ph75

.preheader65:                                     ; preds = %120, %54
  %56 = load i32, ptr @H, align 4, !tbaa !5
  %57 = icmp sgt i32 %56, 0
  %58 = load i32, ptr @W, align 4
  %59 = icmp sgt i32 %58, 0
  %or.cond118 = select i1 %57, i1 %59, i1 false
  br i1 %or.cond118, label %.preheader, label %._crit_edge81

.lr.ph75:                                         ; preds = %54, %120
  %60 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3getILm0EJxiiixEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %60) #8
  %62 = load i64, ptr %61, align 8, !tbaa !15
  %63 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %64 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EJxiiixEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %63) #8
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %67 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm2EJxiiixEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %66) #8
  %68 = load i32, ptr %67, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #8
  %69 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %70 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm3EJxiiixEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %69) #8
  %71 = load i32, ptr %70, align 4, !tbaa !5
  store i32 %71, ptr %8, align 4, !tbaa !5
  %72 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3getILm4EJxiiixEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %72) #8
  %74 = load i64, ptr %73, align 8, !tbaa !15
  call void @_ZNSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %75 = sext i32 %65 to i64
  %76 = sext i32 %68 to i64
  %77 = load i32, ptr %8, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [777 x [777 x [4 x i64]]], ptr @D, i64 0, i64 %75, i64 %76, i64 %78
  %80 = load i64, ptr %79, align 8, !tbaa !15
  %81 = icmp slt i64 %80, 0
  br i1 %81, label %82, label %120

82:                                               ; preds = %.lr.ph75
  %83 = getelementptr inbounds [777 x %"class.std::__cxx11::basic_string"], ptr @_Z1SB5cxx11, i64 0, i64 %75
  %84 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %83, i64 noundef %76)
  %85 = load i8, ptr %84, align 1, !tbaa !13
  %86 = icmp eq i8 %85, 46
  %87 = load i32, ptr %8, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [777 x [777 x [4 x i64]]], ptr @D, i64 0, i64 %75, i64 %76, i64 %88
  store i64 %62, ptr %89, align 8, !tbaa !15
  br i1 %86, label %90, label %102

90:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #8
  %91 = getelementptr inbounds [4 x i32], ptr @_ZL2dx, i64 0, i64 %88
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = add nsw i32 %92, %65
  store i32 %93, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #8
  %94 = getelementptr inbounds [4 x i32], ptr @_ZL2dy, i64 0, i64 %88
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = add nsw i32 %95, %68
  store i32 %96, ptr %10, align 4, !tbaa !5
  %97 = call noundef zeroext i1 @_Z5validiii(i32 noundef %93, i32 noundef %96, i32 noundef %87)
  br i1 %97, label %98, label %101

98:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %11) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #8
  %99 = add nsw i64 %62, 1
  store i64 %99, ptr %12, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #8
  %100 = add nsw i64 %74, 1
  store i64 %100, ptr %13, align 8, !tbaa !15
  call void @_ZNSt5tupleIJxiiixEEC2IJxRiS2_S2_xELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS4_(ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 8 dereferenceable(8) %13) #8
  call void @_ZNSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(32) %11)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #8
  br label %101

101:                                              ; preds = %98, %90
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #8
  br label %120

102:                                              ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %14) #8
  store i32 0, ptr %14, align 4, !tbaa !5
  %103 = add i64 %74, 1
  %104 = add i64 %103, %62
  br label %106

105:                                              ; preds = %116
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #8
  br label %120

106:                                              ; preds = %102, %116
  %storemerge73 = phi i32 [ 0, %102 ], [ %118, %116 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %15) #8
  %107 = sext i32 %storemerge73 to i64
  %108 = getelementptr inbounds [4 x i32], ptr @_ZL2dx, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = add nsw i32 %109, %65
  store i32 %110, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %16) #8
  %111 = getelementptr inbounds [4 x i32], ptr @_ZL2dy, i64 0, i64 %107
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = add nsw i32 %112, %68
  store i32 %113, ptr %16, align 4, !tbaa !5
  %114 = call noundef zeroext i1 @_Z5validiii(i32 noundef %110, i32 noundef %113, i32 noundef %storemerge73)
  br i1 %114, label %115, label %116

115:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %17) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %18) #8
  store i64 %104, ptr %18, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %19) #8
  store i64 %103, ptr %19, align 8, !tbaa !15
  call void @_ZNSt5tupleIJxiiixEEC2IJxRiS2_S2_xELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS4_(ptr noundef nonnull align 8 dereferenceable(32) %17, ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %16, ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 8 dereferenceable(8) %19) #8
  call void @_ZNSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(32) %17)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %17) #8
  br label %116

116:                                              ; preds = %115, %106
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %16) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #8
  %117 = load i32, ptr %14, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %14, align 4, !tbaa !5
  %119 = icmp slt i32 %117, 3
  br i1 %119, label %106, label %105, !llvm.loop !17

120:                                              ; preds = %101, %105, %.lr.ph75
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #8
  %121 = call noundef zeroext i1 @_ZNKSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  br i1 %121, label %.preheader65, label %.lr.ph75, !llvm.loop !18

.preheader:                                       ; preds = %.preheader65, %._crit_edge79
  %122 = phi i32 [ %125, %._crit_edge79 ], [ %56, %.preheader65 ]
  %123 = phi i32 [ %126, %._crit_edge79 ], [ %58, %.preheader65 ]
  %indvars.iv97 = phi i64 [ %indvars.iv.next98, %._crit_edge79 ], [ 0, %.preheader65 ]
  %124 = icmp sgt i32 %123, 0
  br i1 %124, label %.lr.ph78, label %._crit_edge79

._crit_edge81:                                    ; preds = %._crit_edge79, %.preheader65
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  ret i32 0

._crit_edge79.loopexit:                           ; preds = %180
  %.pre102 = load i32, ptr @H, align 4, !tbaa !5
  br label %._crit_edge79

._crit_edge79:                                    ; preds = %._crit_edge79.loopexit, %.preheader
  %125 = phi i32 [ %.pre102, %._crit_edge79.loopexit ], [ %122, %.preheader ]
  %126 = phi i32 [ %181, %._crit_edge79.loopexit ], [ %123, %.preheader ]
  %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
  %127 = sext i32 %125 to i64
  %128 = icmp slt i64 %indvars.iv.next98, %127
  br i1 %128, label %.preheader, label %._crit_edge81, !llvm.loop !19

.lr.ph78:                                         ; preds = %.preheader, %180
  %indvars.iv94 = phi i64 [ %indvars.iv.next95, %180 ], [ 0, %.preheader ]
  %129 = getelementptr inbounds [777 x [777 x i64]], ptr @ans, i64 0, i64 %indvars.iv97, i64 %indvars.iv94
  store i64 -1, ptr %129, align 8, !tbaa !15
  %130 = getelementptr inbounds [777 x [777 x [4 x i64]]], ptr @D, i64 0, i64 %indvars.iv97, i64 %indvars.iv94, i64 0
  %131 = load i64, ptr %130, align 16, !tbaa !15
  %132 = icmp sgt i64 %131, -1
  br i1 %132, label %133, label %.thread

133:                                              ; preds = %.lr.ph78
  store i64 %131, ptr %129, align 8, !tbaa !15
  %134 = getelementptr inbounds [777 x [777 x [4 x i64]]], ptr @D, i64 0, i64 %indvars.iv97, i64 %indvars.iv94, i64 1
  %135 = load i64, ptr %134, align 8, !tbaa !15
  %136 = icmp sgt i64 %135, -1
  br i1 %136, label %140, label %143

.thread:                                          ; preds = %.lr.ph78
  %137 = getelementptr inbounds [777 x [777 x [4 x i64]]], ptr @D, i64 0, i64 %indvars.iv97, i64 %indvars.iv94, i64 1
  %138 = load i64, ptr %137, align 8, !tbaa !15
  %139 = icmp sgt i64 %138, -1
  br i1 %139, label %.sink.split, label %.thread104

140:                                              ; preds = %133
  %141 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %129, ptr noundef nonnull align 8 dereferenceable(8) %134)
  %142 = load i64, ptr %141, align 8, !tbaa !15
  br label %.sink.split

.sink.split:                                      ; preds = %.thread, %140
  %.sink = phi i64 [ %142, %140 ], [ %138, %.thread ]
  store i64 %.sink, ptr %129, align 8, !tbaa !15
  br label %143

143:                                              ; preds = %.sink.split, %133
  %144 = phi i64 [ %131, %133 ], [ %.sink, %.sink.split ]
  %145 = getelementptr inbounds [777 x [777 x [4 x i64]]], ptr @D, i64 0, i64 %indvars.iv97, i64 %indvars.iv94, i64 2
  %146 = load i64, ptr %145, align 16, !tbaa !15
  %147 = icmp sgt i64 %146, -1
  br i1 %147, label %151, label %156

.thread104:                                       ; preds = %.thread
  %148 = getelementptr inbounds [777 x [777 x [4 x i64]]], ptr @D, i64 0, i64 %indvars.iv97, i64 %indvars.iv94, i64 2
  %149 = load i64, ptr %148, align 16, !tbaa !15
  %150 = icmp sgt i64 %149, -1
  br i1 %150, label %.sink.split110, label %.thread106

151:                                              ; preds = %143
  %152 = icmp slt i64 %144, 0
  br i1 %152, label %.sink.split110, label %153

153:                                              ; preds = %151
  %154 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %129, ptr noundef nonnull align 8 dereferenceable(8) %145)
  %155 = load i64, ptr %154, align 8, !tbaa !15
  br label %.sink.split110

.sink.split110:                                   ; preds = %151, %.thread104, %153
  %.sink112 = phi i64 [ %155, %153 ], [ %146, %151 ], [ %149, %.thread104 ]
  store i64 %.sink112, ptr %129, align 8, !tbaa !15
  br label %156

156:                                              ; preds = %.sink.split110, %143
  %157 = phi i64 [ %144, %143 ], [ %.sink112, %.sink.split110 ]
  %158 = getelementptr inbounds [777 x [777 x [4 x i64]]], ptr @D, i64 0, i64 %indvars.iv97, i64 %indvars.iv94, i64 3
  %159 = load i64, ptr %158, align 8, !tbaa !15
  %160 = icmp sgt i64 %159, -1
  br i1 %160, label %164, label %169

.thread106:                                       ; preds = %.thread104
  %161 = getelementptr inbounds [777 x [777 x [4 x i64]]], ptr @D, i64 0, i64 %indvars.iv97, i64 %indvars.iv94, i64 3
  %162 = load i64, ptr %161, align 8, !tbaa !15
  %163 = icmp sgt i64 %162, -1
  br i1 %163, label %.sink.split113, label %169

164:                                              ; preds = %156
  %165 = icmp slt i64 %157, 0
  br i1 %165, label %.sink.split113, label %166

166:                                              ; preds = %164
  %167 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %129, ptr noundef nonnull align 8 dereferenceable(8) %158)
  %168 = load i64, ptr %167, align 8, !tbaa !15
  br label %.sink.split113

.sink.split113:                                   ; preds = %164, %.thread106, %166
  %.sink115 = phi i64 [ %168, %166 ], [ %159, %164 ], [ %162, %.thread106 ]
  store i64 %.sink115, ptr %129, align 8, !tbaa !15
  br label %169

169:                                              ; preds = %.sink.split113, %.thread106, %156
  %170 = phi i64 [ %157, %156 ], [ -1, %.thread106 ], [ %.sink115, %.sink.split113 ]
  %171 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %170)
  %172 = load i32, ptr @W, align 4, !tbaa !5
  %173 = add nsw i32 %172, -1
  %174 = sext i32 %173 to i64
  %175 = icmp slt i64 %indvars.iv94, %174
  br i1 %175, label %176, label %178

176:                                              ; preds = %169
  %177 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.4)
  br label %180

178:                                              ; preds = %169
  %179 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %180

180:                                              ; preds = %176, %178
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %181 = load i32, ptr @W, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = icmp slt i64 %indvars.iv.next95, %182
  br i1 %183, label %.lr.ph78, label %._crit_edge79.loopexit, !llvm.loop !20
}

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.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 #4

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #5

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5tupleIJxiiixEEC2IJiRiS2_iiELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), 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 zeroext i1 @_ZNKSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #0 align 2

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueISt5tupleIJxiiixEESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #6 align 2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #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 #6 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)) #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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 }
attributes #9 = { noreturn 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !7, i64 0}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !12}
!20 = distinct !{!20, !10}


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