; LLVM IR from kazunetakahashi/atcoder :: 2019/0406_ABC123 (D3)

; 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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::tuple<int, int, int>, std::tuple<int, int, int>, std::_Identity<std::tuple<int, int, int>>, std::less<std::tuple<int, int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::tuple<int, int, int>, std::tuple<int, int, int>, std::_Identity<std::tuple<int, int, int>>, std::less<std::tuple<int, int, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::priority_queue" = type <{ %"class.std::vector.3", [8 x i8] }>
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<std::tuple<long long, std::tuple<int, int, int>>, std::allocator<std::tuple<long long, std::tuple<int, int, int>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::tuple<long long, std::tuple<int, int, int>>, std::allocator<std::tuple<long long, std::tuple<int, int, int>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::tuple<long long, std::tuple<int, int, int>>, std::allocator<std::tuple<long long, std::tuple<int, int, int>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::tuple<long long, std::tuple<int, int, int>>, std::allocator<std::tuple<long long, std::tuple<int, int, int>>>>::_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.8", %"struct.std::_Head_base.16" }
%"struct.std::_Tuple_impl.8" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { %"class.std::tuple.9" }
%"class.std::tuple.9" = type { %"struct.std::_Tuple_impl.10" }
%"struct.std::_Tuple_impl.10" = type { %"struct.std::_Tuple_impl.11", %"struct.std::_Head_base.15" }
%"struct.std::_Tuple_impl.11" = type { %"struct.std::_Tuple_impl.12", %"struct.std::_Head_base.14" }
%"struct.std::_Tuple_impl.12" = type { %"struct.std::_Head_base.13" }
%"struct.std::_Head_base.13" = type { i32 }
%"struct.std::_Head_base.14" = type { i32 }
%"struct.std::_Head_base.15" = type { i32 }
%"struct.std::_Head_base.16" = type { i64 }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@X = external dso_local global [3 x i64], align 16
@K = external dso_local global i64, align 8
@A = external dso_local global [3 x [1010 x i64]], align 16
@S = external dso_local global %"class.std::set", align 8
@Q = external dso_local global %"class.std::priority_queue", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"class.std::tuple", align 8
  %8 = alloca i64, align 8
  %9 = alloca %"class.std::tuple.9", align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %"class.std::tuple.9", align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %"struct.std::pair", align 8
  %18 = alloca i32, align 4
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i32, align 4
  %24 = alloca %"class.std::tuple.9", align 4
  %25 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %26 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %27 = alloca %"class.std::tuple", align 8
  %28 = alloca i64, align 8
  %29 = alloca %"struct.std::pair", align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %39, %0
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = icmp slt i32 %31, 3
  br i1 %32, label %34, label %33

33:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %42

34:                                               ; preds = %30
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [3 x i64], ptr @X, i64 0, i64 %36
  %38 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %37)
  br label %39

39:                                               ; preds = %34
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %2, align 4, !tbaa !5
  br label %30, !llvm.loop !9

42:                                               ; preds = %33
  %43 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @K)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %83, %42
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = icmp slt i32 %45, 3
  br i1 %46, label %48, label %47

47:                                               ; preds = %44
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %86

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

49:                                               ; preds = %66, %48
  %50 = load i32, ptr %5, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [3 x i64], ptr @X, i64 0, i64 %53
  %55 = load i64, ptr %54, align 8, !tbaa !11
  %56 = icmp slt i64 %51, %55
  br i1 %56, label %58, label %57

57:                                               ; preds = %49
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %69

58:                                               ; preds = %49
  %59 = load i32, ptr %3, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 %60
  %62 = load i32, ptr %5, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [1010 x i64], ptr %61, i64 0, i64 %63
  %65 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %64)
  br label %66

66:                                               ; preds = %58
  %67 = load i32, ptr %5, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %5, align 4, !tbaa !5
  br label %49, !llvm.loop !13

69:                                               ; preds = %57
  %70 = load i32, ptr %3, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 %71
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [3 x i64], ptr @X, i64 0, i64 %74
  %76 = load i64, ptr %75, align 8, !tbaa !11
  %77 = getelementptr inbounds [1010 x i64], ptr %72, i64 0, i64 %76
  store i64 -100000000000000000, ptr %77, align 8, !tbaa !11
  %78 = load i32, ptr %3, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [3 x i64], ptr @X, i64 0, i64 %79
  %81 = load i64, ptr %80, align 8, !tbaa !11
  %82 = add nsw i64 %81, 1
  store i64 %82, ptr %80, align 8, !tbaa !11
  br label %83

83:                                               ; preds = %69
  %84 = load i32, ptr %3, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %3, align 4, !tbaa !5
  br label %44, !llvm.loop !14

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

87:                                               ; preds = %118, %86
  %88 = load i32, ptr %6, align 4, !tbaa !5
  %89 = icmp slt i32 %88, 3
  br i1 %89, label %91, label %90

90:                                               ; preds = %87
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %121

91:                                               ; preds = %87
  %92 = load i32, ptr %6, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 %93
  %95 = getelementptr inbounds [1010 x i64], ptr %94, i64 0, i64 0
  %96 = load i32, ptr %6, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 %97
  %99 = getelementptr inbounds [1010 x i64], ptr %98, i64 0, i64 0
  %100 = load i32, ptr %6, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [3 x i64], ptr @X, i64 0, i64 %101
  %103 = load i64, ptr %102, align 8, !tbaa !11
  %104 = getelementptr inbounds i64, ptr %99, i64 %103
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef %95, ptr noundef %104)
  %105 = load i32, ptr %6, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 %106
  %108 = getelementptr inbounds [1010 x i64], ptr %107, i64 0, i64 0
  %109 = load i32, ptr %6, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 %110
  %112 = getelementptr inbounds [1010 x i64], ptr %111, i64 0, i64 0
  %113 = load i32, ptr %6, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [3 x i64], ptr @X, i64 0, i64 %114
  %116 = load i64, ptr %115, align 8, !tbaa !11
  %117 = getelementptr inbounds i64, ptr %112, i64 %116
  call void @_ZSt7reverseIPxEvT_S1_(ptr noundef %108, ptr noundef %117)
  br label %118

118:                                              ; preds = %91
  %119 = load i32, ptr %6, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %6, align 4, !tbaa !5
  br label %87, !llvm.loop !15

121:                                              ; preds = %90
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %122 = load i64, ptr @A, align 16, !tbaa !11
  %123 = load i64, ptr getelementptr inbounds ([3 x [1010 x i64]], ptr @A, i64 0, i64 1), align 16, !tbaa !11
  %124 = add nsw i64 %122, %123
  %125 = load i64, ptr getelementptr inbounds ([3 x [1010 x i64]], ptr @A, i64 0, i64 2), align 16, !tbaa !11
  %126 = add nsw i64 %124, %125
  store i64 %126, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 12, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @_ZNSt5tupleIJiiiEEC2IJiiiELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS3_(ptr noundef nonnull align 4 dereferenceable(12) %9, ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12) #5
  call void @_ZNSt5tupleIJxS_IJiiiEEEEC2IxS0_TnNSt9enable_ifIXclsr4_TCCIXntcl14__is_alloc_argIT_EEEEE29__is_implicitly_constructibleIS4_T0_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(12) %9) #5
  call void @_ZNSt14priority_queueISt5tupleIJxS0_IJiiiEEEESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(24) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 12, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !5
  call void @_ZNSt5tupleIJiiiEEC2IJiiiELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS3_(ptr noundef nonnull align 4 dereferenceable(12) %13, ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %16) #5
  %127 = call { ptr, i8 } @_ZNSt3setISt5tupleIJiiiEESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 4 dereferenceable(12) %13)
  %128 = getelementptr inbounds { ptr, i8 }, ptr %17, i32 0, i32 0
  %129 = extractvalue { ptr, i8 } %127, 0
  store ptr %129, ptr %128, align 8
  %130 = getelementptr inbounds { ptr, i8 }, ptr %17, i32 0, i32 1
  %131 = extractvalue { ptr, i8 } %127, 1
  store i8 %131, ptr %130, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %132

132:                                              ; preds = %224, %121
  %133 = load i32, ptr %18, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = load i64, ptr @K, align 8, !tbaa !11
  %136 = icmp slt i64 %134, %135
  br i1 %136, label %138, label %137

137:                                              ; preds = %132
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %227

138:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %139 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt14priority_queueISt5tupleIJxS0_IJiiiEEEESt6vectorIS2_SaIS2_EESt4lessIS2_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %140 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3getILm0EJxSt5tupleIJiiiEEEERKNSt13tuple_elementIXT_ES0_IJDpT0_EEE4typeERKS5_(ptr noundef nonnull align 8 dereferenceable(24) %139) #5
  %141 = load i64, ptr %140, align 8, !tbaa !11
  store i64 %141, ptr %19, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %142 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt14priority_queueISt5tupleIJxS0_IJiiiEEEESt6vectorIS2_SaIS2_EESt4lessIS2_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %143 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZSt3getILm1EJxSt5tupleIJiiiEEEERKNSt13tuple_elementIXT_ES0_IJDpT0_EEE4typeERKS5_(ptr noundef nonnull align 8 dereferenceable(24) %142) #5
  %144 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_(ptr noundef nonnull align 4 dereferenceable(12) %143) #5
  %145 = load i32, ptr %144, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  store i64 %146, ptr %20, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %147 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt14priority_queueISt5tupleIJxS0_IJiiiEEEESt6vectorIS2_SaIS2_EESt4lessIS2_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %148 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZSt3getILm1EJxSt5tupleIJiiiEEEERKNSt13tuple_elementIXT_ES0_IJDpT0_EEE4typeERKS5_(ptr noundef nonnull align 8 dereferenceable(24) %147) #5
  %149 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_(ptr noundef nonnull align 4 dereferenceable(12) %148) #5
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  store i64 %151, ptr %21, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %152 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt14priority_queueISt5tupleIJxS0_IJiiiEEEESt6vectorIS2_SaIS2_EESt4lessIS2_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %153 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZSt3getILm1EJxSt5tupleIJiiiEEEERKNSt13tuple_elementIXT_ES0_IJDpT0_EEE4typeERKS5_(ptr noundef nonnull align 8 dereferenceable(24) %152) #5
  %154 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm2EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_(ptr noundef nonnull align 4 dereferenceable(12) %153) #5
  %155 = load i32, ptr %154, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  store i64 %156, ptr %22, align 8, !tbaa !11
  call void @_ZNSt14priority_queueISt5tupleIJxS0_IJiiiEEEESt6vectorIS2_SaIS2_EESt4lessIS2_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %157 = load i64, ptr %19, align 8, !tbaa !11
  %158 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %157)
  %159 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %158, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  store i32 0, ptr %23, align 4, !tbaa !5
  br label %160

160:                                              ; preds = %220, %138
  %161 = load i32, ptr %23, align 4, !tbaa !5
  %162 = icmp slt i32 %161, 3
  br i1 %162, label %164, label %163

163:                                              ; preds = %160
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  br label %223

164:                                              ; preds = %160
  %165 = load i32, ptr %23, align 4, !tbaa !5
  %166 = icmp eq i32 %165, 0
  br i1 %166, label %167, label %170

167:                                              ; preds = %164
  %168 = load i64, ptr %20, align 8, !tbaa !11
  %169 = add nsw i64 %168, 1
  store i64 %169, ptr %20, align 8, !tbaa !11
  br label %180

170:                                              ; preds = %164
  %171 = load i32, ptr %23, align 4, !tbaa !5
  %172 = icmp eq i32 %171, 1
  br i1 %172, label %173, label %176

173:                                              ; preds = %170
  %174 = load i64, ptr %21, align 8, !tbaa !11
  %175 = add nsw i64 %174, 1
  store i64 %175, ptr %21, align 8, !tbaa !11
  br label %179

176:                                              ; preds = %170
  %177 = load i64, ptr %22, align 8, !tbaa !11
  %178 = add nsw i64 %177, 1
  store i64 %178, ptr %22, align 8, !tbaa !11
  br label %179

179:                                              ; preds = %176, %173
  br label %180

180:                                              ; preds = %179, %167
  call void @llvm.lifetime.start.p0(i64 12, ptr %24) #5
  call void @_ZNSt5tupleIJiiiEEC2IJRxS2_S2_ELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS4_(ptr noundef nonnull align 4 dereferenceable(12) %24, ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 8 dereferenceable(8) %22) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #5
  %181 = call ptr @_ZNSt3setISt5tupleIJiiiEESt4lessIS1_ESaIS1_EE4findERKS1_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 4 dereferenceable(12) %24)
  %182 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %25, i32 0, i32 0
  store ptr %181, ptr %182, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #5
  %183 = call ptr @_ZNKSt3setISt5tupleIJiiiEESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @S) #5
  %184 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %26, i32 0, i32 0
  store ptr %183, ptr %184, align 8
  %185 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorISt5tupleIJiiiEEES4_(ptr noundef nonnull align 8 dereferenceable(8) %25, ptr noundef nonnull align 8 dereferenceable(8) %26) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #5
  br i1 %185, label %186, label %203

186:                                              ; preds = %180
  call void @llvm.lifetime.start.p0(i64 24, ptr %27) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #5
  %187 = load i64, ptr %20, align 8, !tbaa !11
  %188 = getelementptr inbounds [1010 x i64], ptr @A, i64 0, i64 %187
  %189 = load i64, ptr %188, align 8, !tbaa !11
  %190 = load i64, ptr %21, align 8, !tbaa !11
  %191 = getelementptr inbounds [1010 x i64], ptr getelementptr inbounds ([3 x [1010 x i64]], ptr @A, i64 0, i64 1), i64 0, i64 %190
  %192 = load i64, ptr %191, align 8, !tbaa !11
  %193 = add nsw i64 %189, %192
  %194 = load i64, ptr %22, align 8, !tbaa !11
  %195 = getelementptr inbounds [1010 x i64], ptr getelementptr inbounds ([3 x [1010 x i64]], ptr @A, i64 0, i64 2), i64 0, i64 %194
  %196 = load i64, ptr %195, align 8, !tbaa !11
  %197 = add nsw i64 %193, %196
  store i64 %197, ptr %28, align 8, !tbaa !11
  call void @_ZNSt5tupleIJxS_IJiiiEEEEC2IxRS0_TnNSt9enable_ifIXclsr4_TCCIXntcl14__is_alloc_argIT_EEEEE29__is_implicitly_constructibleIS5_T0_EEEbE4typeELb1EEEOS5_OS6_(ptr noundef nonnull align 8 dereferenceable(24) %27, ptr noundef nonnull align 8 dereferenceable(8) %28, ptr noundef nonnull align 4 dereferenceable(12) %24) #5
  call void @_ZNSt14priority_queueISt5tupleIJxS0_IJiiiEEEESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(24) %27)
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %27) #5
  %198 = call { ptr, i8 } @_ZNSt3setISt5tupleIJiiiEESt4lessIS1_ESaIS1_EE6insertERKS1_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 4 dereferenceable(12) %24)
  %199 = getelementptr inbounds { ptr, i8 }, ptr %29, i32 0, i32 0
  %200 = extractvalue { ptr, i8 } %198, 0
  store ptr %200, ptr %199, align 8
  %201 = getelementptr inbounds { ptr, i8 }, ptr %29, i32 0, i32 1
  %202 = extractvalue { ptr, i8 } %198, 1
  store i8 %202, ptr %201, align 8
  br label %203

203:                                              ; preds = %186, %180
  %204 = load i32, ptr %23, align 4, !tbaa !5
  %205 = icmp eq i32 %204, 0
  br i1 %205, label %206, label %209

206:                                              ; preds = %203
  %207 = load i64, ptr %20, align 8, !tbaa !11
  %208 = add nsw i64 %207, -1
  store i64 %208, ptr %20, align 8, !tbaa !11
  br label %219

209:                                              ; preds = %203
  %210 = load i32, ptr %23, align 4, !tbaa !5
  %211 = icmp eq i32 %210, 1
  br i1 %211, label %212, label %215

212:                                              ; preds = %209
  %213 = load i64, ptr %21, align 8, !tbaa !11
  %214 = add nsw i64 %213, -1
  store i64 %214, ptr %21, align 8, !tbaa !11
  br label %218

215:                                              ; preds = %209
  %216 = load i64, ptr %22, align 8, !tbaa !11
  %217 = add nsw i64 %216, -1
  store i64 %217, ptr %22, align 8, !tbaa !11
  br label %218

218:                                              ; preds = %215, %212
  br label %219

219:                                              ; preds = %218, %206
  call void @llvm.lifetime.end.p0(i64 12, ptr %24) #5
  br label %220

220:                                              ; preds = %219
  %221 = load i32, ptr %23, align 4, !tbaa !5
  %222 = add nsw i32 %221, 1
  store i32 %222, ptr %23, align 4, !tbaa !5
  br label %160, !llvm.loop !16

223:                                              ; preds = %163
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  br label %224

224:                                              ; preds = %223
  %225 = load i32, ptr %18, align 4, !tbaa !5
  %226 = add nsw i32 %225, 1
  store i32 %226, ptr %18, align 4, !tbaa !5
  br label %132, !llvm.loop !17

227:                                              ; preds = %137
  %228 = load i32, ptr %1, align 4
  ret i32 %228
}

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setISt5tupleIJiiiEESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(12)) #2 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_(ptr noundef nonnull align 4 dereferenceable(12)) #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_(ptr noundef nonnull align 4 dereferenceable(12)) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm2EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_(ptr noundef nonnull align 4 dereferenceable(12)) #4

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setISt5tupleIJiiiEESt4lessIS1_ESaIS1_EE6insertERKS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(12)) #2 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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 #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::tuple<int, int, int>, std::tuple<int, int, int>, std::_Identity<std::tuple<int, int, int>>, std::less<std::tuple<int, int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::tuple<int, int, int>, std::tuple<int, int, int>, std::_Identity<std::tuple<int, int, int>>, std::less<std::tuple<int, int, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::priority_queue" = type <{ %"class.std::vector.3", [8 x i8] }>
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<std::tuple<long long, std::tuple<int, int, int>>, std::allocator<std::tuple<long long, std::tuple<int, int, int>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::tuple<long long, std::tuple<int, int, int>>, std::allocator<std::tuple<long long, std::tuple<int, int, int>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::tuple<long long, std::tuple<int, int, int>>, std::allocator<std::tuple<long long, std::tuple<int, int, int>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::tuple<long long, std::tuple<int, int, int>>, std::allocator<std::tuple<long long, std::tuple<int, int, int>>>>::_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.8", %"struct.std::_Head_base.16" }
%"struct.std::_Tuple_impl.8" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { %"class.std::tuple.9" }
%"class.std::tuple.9" = type { %"struct.std::_Tuple_impl.10" }
%"struct.std::_Tuple_impl.10" = type { %"struct.std::_Tuple_impl.11", %"struct.std::_Head_base.15" }
%"struct.std::_Tuple_impl.11" = type { %"struct.std::_Tuple_impl.12", %"struct.std::_Head_base.14" }
%"struct.std::_Tuple_impl.12" = type { %"struct.std::_Head_base.13" }
%"struct.std::_Head_base.13" = type { i32 }
%"struct.std::_Head_base.14" = type { i32 }
%"struct.std::_Head_base.15" = type { i32 }
%"struct.std::_Head_base.16" = type { i64 }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@X = external dso_local global [3 x i64], align 16
@K = external dso_local global i64, align 8
@A = external dso_local global [3 x [1010 x i64]], align 16
@S = external dso_local global %"class.std::set", align 8
@Q = external dso_local global %"class.std::priority_queue", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
.preheader40:
  %0 = alloca %"class.std::tuple", align 8
  %1 = alloca i64, align 8
  %2 = alloca %"class.std::tuple.9", align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"class.std::tuple.9", align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca %"class.std::tuple.9", align 4
  %14 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %15 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %16 = alloca %"class.std::tuple", align 8
  %17 = alloca i64, align 8
  %18 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @X)
  %19 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) getelementptr inbounds (i8, ptr @X, i64 8))
  %20 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) getelementptr inbounds (i8, ptr @X, i64 16))
  %21 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @K)
  %22 = load i64, ptr @X, align 16, !tbaa !5
  %23 = icmp sgt i64 %22, 0
  br i1 %23, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.preheader40
  %.lcssa = phi i64 [ %22, %.preheader40 ], [ %64, %.lr.ph ]
  %24 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 0, i64 %.lcssa
  store i64 -100000000000000000, ptr %24, align 8, !tbaa !5
  %25 = add nsw i64 %.lcssa, 1
  store i64 %25, ptr @X, align 16, !tbaa !5
  %26 = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 8), align 8, !tbaa !5
  %27 = icmp sgt i64 %26, 0
  br i1 %27, label %.lr.ph.1, label %._crit_edge.1

.lr.ph.1:                                         ; preds = %._crit_edge, %.lr.ph.1
  %indvars.iv.1 = phi i64 [ %indvars.iv.next.1, %.lr.ph.1 ], [ 0, %._crit_edge ]
  %28 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 1, i64 %indvars.iv.1
  %29 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %28)
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv.1, 1
  %30 = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 8), align 8, !tbaa !5
  %31 = icmp sgt i64 %30, %indvars.iv.next.1
  br i1 %31, label %.lr.ph.1, label %._crit_edge.1, !llvm.loop !9

._crit_edge.1:                                    ; preds = %.lr.ph.1, %._crit_edge
  %.lcssa.1 = phi i64 [ %26, %._crit_edge ], [ %30, %.lr.ph.1 ]
  %32 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 1, i64 %.lcssa.1
  store i64 -100000000000000000, ptr %32, align 8, !tbaa !5
  %33 = add nsw i64 %.lcssa.1, 1
  store i64 %33, ptr getelementptr inbounds (i8, ptr @X, i64 8), align 8, !tbaa !5
  %34 = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 16), align 16, !tbaa !5
  %35 = icmp sgt i64 %34, 0
  br i1 %35, label %.lr.ph.2, label %._crit_edge.2

.lr.ph.2:                                         ; preds = %._crit_edge.1, %.lr.ph.2
  %indvars.iv.2 = phi i64 [ %indvars.iv.next.2, %.lr.ph.2 ], [ 0, %._crit_edge.1 ]
  %36 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 2, i64 %indvars.iv.2
  %37 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %36)
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv.2, 1
  %38 = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 16), align 16, !tbaa !5
  %39 = icmp sgt i64 %38, %indvars.iv.next.2
  br i1 %39, label %.lr.ph.2, label %._crit_edge.2, !llvm.loop !9

._crit_edge.2:                                    ; preds = %.lr.ph.2, %._crit_edge.1
  %.lcssa.2 = phi i64 [ %34, %._crit_edge.1 ], [ %38, %.lr.ph.2 ]
  %40 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 2, i64 %.lcssa.2
  store i64 -100000000000000000, ptr %40, align 8, !tbaa !5
  %41 = add nsw i64 %.lcssa.2, 1
  store i64 %41, ptr getelementptr inbounds (i8, ptr @X, i64 16), align 16, !tbaa !5
  %42 = load i64, ptr @X, align 16, !tbaa !5
  %43 = getelementptr inbounds i64, ptr @A, i64 %42
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @A, ptr noundef nonnull %43)
  %44 = load i64, ptr @X, align 16, !tbaa !5
  %45 = getelementptr inbounds i64, ptr @A, i64 %44
  tail call void @_ZSt7reverseIPxEvT_S1_(ptr noundef nonnull @A, ptr noundef nonnull %45)
  %46 = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 8), align 8, !tbaa !5
  %47 = getelementptr inbounds i64, ptr getelementptr inbounds (i8, ptr @A, i64 8080), i64 %46
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @A, i64 8080), ptr noundef nonnull %47)
  %48 = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 8), align 8, !tbaa !5
  %49 = getelementptr inbounds i64, ptr getelementptr inbounds (i8, ptr @A, i64 8080), i64 %48
  tail call void @_ZSt7reverseIPxEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @A, i64 8080), ptr noundef nonnull %49)
  %50 = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 16), align 16, !tbaa !5
  %51 = getelementptr inbounds i64, ptr getelementptr inbounds (i8, ptr @A, i64 16160), i64 %50
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @A, i64 16160), ptr noundef nonnull %51)
  %52 = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 16), align 16, !tbaa !5
  %53 = getelementptr inbounds i64, ptr getelementptr inbounds (i8, ptr @A, i64 16160), i64 %52
  tail call void @_ZSt7reverseIPxEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @A, i64 16160), ptr noundef nonnull %53)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %0) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  %54 = load i64, ptr @A, align 16, !tbaa !5
  %55 = load i64, ptr getelementptr inbounds (i8, ptr @A, i64 8080), align 16, !tbaa !5
  %56 = add nsw i64 %55, %54
  %57 = load i64, ptr getelementptr inbounds (i8, ptr @A, i64 16160), align 16, !tbaa !5
  %58 = add nsw i64 %56, %57
  store i64 %58, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 0, ptr %3, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  store i32 0, ptr %4, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  store i32 0, ptr %5, align 4, !tbaa !11
  call void @_ZNSt5tupleIJiiiEEC2IJiiiELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS3_(ptr noundef nonnull align 4 dereferenceable(12) %2, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5) #5
  call void @_ZNSt5tupleIJxS_IJiiiEEEEC2IxS0_TnNSt9enable_ifIXclsr4_TCCIXntcl14__is_alloc_argIT_EEEEE29__is_implicitly_constructibleIS4_T0_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(12) %2) #5
  call void @_ZNSt14priority_queueISt5tupleIJxS0_IJiiiEEEESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(24) %0)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %0) #5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  store i32 0, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  store i32 0, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #5
  store i32 0, ptr %9, align 4, !tbaa !11
  call void @_ZNSt5tupleIJiiiEEC2IJiiiELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS3_(ptr noundef nonnull align 4 dereferenceable(12) %6, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9) #5
  %59 = call { ptr, i8 } @_ZNSt3setISt5tupleIJiiiEESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 4 dereferenceable(12) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #5
  %60 = load i64, ptr @K, align 8, !tbaa !5
  %61 = icmp sgt i64 %60, 0
  br i1 %61, label %.lr.ph53.preheader, label %._crit_edge54

.lr.ph:                                           ; preds = %.preheader40, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader40 ]
  %62 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 0, i64 %indvars.iv
  %63 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %62)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %64 = load i64, ptr @X, align 16, !tbaa !5
  %65 = icmp sgt i64 %64, %indvars.iv.next
  br i1 %65, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge54:                                    ; preds = %146, %._crit_edge.2
  ret i32 0

.lr.ph53.preheader:                               ; preds = %._crit_edge.2, %146
  %indvars.iv64 = phi i64 [ %indvars.iv.next65, %146 ], [ 0, %._crit_edge.2 ]
  %66 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt14priority_queueISt5tupleIJxS0_IJiiiEEEESt6vectorIS2_SaIS2_EESt4lessIS2_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3getILm0EJxSt5tupleIJiiiEEEERKNSt13tuple_elementIXT_ES0_IJDpT0_EEE4typeERKS5_(ptr noundef nonnull align 8 dereferenceable(24) %66) #5
  %68 = load i64, ptr %67, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #5
  %69 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt14priority_queueISt5tupleIJxS0_IJiiiEEEESt6vectorIS2_SaIS2_EESt4lessIS2_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %70 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZSt3getILm1EJxSt5tupleIJiiiEEEERKNSt13tuple_elementIXT_ES0_IJDpT0_EEE4typeERKS5_(ptr noundef nonnull align 8 dereferenceable(24) %69) #5
  %71 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_(ptr noundef nonnull align 4 dereferenceable(12) %70) #5
  %72 = load i32, ptr %71, align 4, !tbaa !11
  %73 = sext i32 %72 to i64
  store i64 %73, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #5
  %74 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt14priority_queueISt5tupleIJxS0_IJiiiEEEESt6vectorIS2_SaIS2_EESt4lessIS2_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %75 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZSt3getILm1EJxSt5tupleIJiiiEEEERKNSt13tuple_elementIXT_ES0_IJDpT0_EEE4typeERKS5_(ptr noundef nonnull align 8 dereferenceable(24) %74) #5
  %76 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_(ptr noundef nonnull align 4 dereferenceable(12) %75) #5
  %77 = load i32, ptr %76, align 4, !tbaa !11
  %78 = sext i32 %77 to i64
  store i64 %78, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #5
  %79 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt14priority_queueISt5tupleIJxS0_IJiiiEEEESt6vectorIS2_SaIS2_EESt4lessIS2_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %80 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZSt3getILm1EJxSt5tupleIJiiiEEEERKNSt13tuple_elementIXT_ES0_IJDpT0_EEE4typeERKS5_(ptr noundef nonnull align 8 dereferenceable(24) %79) #5
  %81 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm2EJiiiEERKNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERKS4_(ptr noundef nonnull align 4 dereferenceable(12) %80) #5
  %82 = load i32, ptr %81, align 4, !tbaa !11
  %83 = sext i32 %82 to i64
  store i64 %83, ptr %12, align 8, !tbaa !5
  call void @_ZNSt14priority_queueISt5tupleIJxS0_IJiiiEEEESt6vectorIS2_SaIS2_EESt4lessIS2_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %84 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %68)
  %85 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %84, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %86 = load i64, ptr %10, align 8, !tbaa !5
  %87 = add nsw i64 %86, 1
  store i64 %87, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %13) #5
  call void @_ZNSt5tupleIJiiiEEC2IJRxS2_S2_ELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS4_(ptr noundef nonnull align 4 dereferenceable(12) %13, ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #5
  %88 = call ptr @_ZNSt3setISt5tupleIJiiiEESt4lessIS1_ESaIS1_EE4findERKS1_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 4 dereferenceable(12) %13)
  store ptr %88, ptr %14, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #5
  %89 = call ptr @_ZNKSt3setISt5tupleIJiiiEESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @S) #5
  store ptr %89, ptr %15, align 8
  %90 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorISt5tupleIJiiiEEES4_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #5
  br i1 %90, label %91, label %104

91:                                               ; preds = %.lr.ph53.preheader
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %16) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %17) #5
  %92 = load i64, ptr %10, align 8, !tbaa !5
  %93 = getelementptr inbounds [1010 x i64], ptr @A, i64 0, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !5
  %95 = load i64, ptr %11, align 8, !tbaa !5
  %96 = getelementptr inbounds [1010 x i64], ptr getelementptr inbounds (i8, ptr @A, i64 8080), i64 0, i64 %95
  %97 = load i64, ptr %96, align 8, !tbaa !5
  %98 = add nsw i64 %97, %94
  %99 = load i64, ptr %12, align 8, !tbaa !5
  %100 = getelementptr inbounds [1010 x i64], ptr getelementptr inbounds (i8, ptr @A, i64 16160), i64 0, i64 %99
  %101 = load i64, ptr %100, align 8, !tbaa !5
  %102 = add nsw i64 %98, %101
  store i64 %102, ptr %17, align 8, !tbaa !5
  call void @_ZNSt5tupleIJxS_IJiiiEEEEC2IxRS0_TnNSt9enable_ifIXclsr4_TCCIXntcl14__is_alloc_argIT_EEEEE29__is_implicitly_constructibleIS5_T0_EEEbE4typeELb1EEEOS5_OS6_(ptr noundef nonnull align 8 dereferenceable(24) %16, ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 4 dereferenceable(12) %13) #5
  call void @_ZNSt14priority_queueISt5tupleIJxS0_IJiiiEEEESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(24) %16)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %16) #5
  %103 = call { ptr, i8 } @_ZNSt3setISt5tupleIJiiiEESt4lessIS1_ESaIS1_EE6insertERKS1_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 4 dereferenceable(12) %13)
  br label %104

104:                                              ; preds = %.lr.ph53.preheader, %91
  %105 = load i64, ptr %10, align 8, !tbaa !5
  %106 = add nsw i64 %105, -1
  store i64 %106, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %13) #5
  %107 = load i64, ptr %11, align 8, !tbaa !5
  %108 = add nsw i64 %107, 1
  store i64 %108, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %13) #5
  call void @_ZNSt5tupleIJiiiEEC2IJRxS2_S2_ELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS4_(ptr noundef nonnull align 4 dereferenceable(12) %13, ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #5
  %109 = call ptr @_ZNSt3setISt5tupleIJiiiEESt4lessIS1_ESaIS1_EE4findERKS1_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 4 dereferenceable(12) %13)
  store ptr %109, ptr %14, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #5
  %110 = call ptr @_ZNKSt3setISt5tupleIJiiiEESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @S) #5
  store ptr %110, ptr %15, align 8
  %111 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorISt5tupleIJiiiEEES4_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #5
  br i1 %111, label %112, label %125

112:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %16) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %17) #5
  %113 = load i64, ptr %10, align 8, !tbaa !5
  %114 = getelementptr inbounds [1010 x i64], ptr @A, i64 0, i64 %113
  %115 = load i64, ptr %114, align 8, !tbaa !5
  %116 = load i64, ptr %11, align 8, !tbaa !5
  %117 = getelementptr inbounds [1010 x i64], ptr getelementptr inbounds (i8, ptr @A, i64 8080), i64 0, i64 %116
  %118 = load i64, ptr %117, align 8, !tbaa !5
  %119 = add nsw i64 %118, %115
  %120 = load i64, ptr %12, align 8, !tbaa !5
  %121 = getelementptr inbounds [1010 x i64], ptr getelementptr inbounds (i8, ptr @A, i64 16160), i64 0, i64 %120
  %122 = load i64, ptr %121, align 8, !tbaa !5
  %123 = add nsw i64 %119, %122
  store i64 %123, ptr %17, align 8, !tbaa !5
  call void @_ZNSt5tupleIJxS_IJiiiEEEEC2IxRS0_TnNSt9enable_ifIXclsr4_TCCIXntcl14__is_alloc_argIT_EEEEE29__is_implicitly_constructibleIS5_T0_EEEbE4typeELb1EEEOS5_OS6_(ptr noundef nonnull align 8 dereferenceable(24) %16, ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 4 dereferenceable(12) %13) #5
  call void @_ZNSt14priority_queueISt5tupleIJxS0_IJiiiEEEESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(24) %16)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %16) #5
  %124 = call { ptr, i8 } @_ZNSt3setISt5tupleIJiiiEESt4lessIS1_ESaIS1_EE6insertERKS1_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 4 dereferenceable(12) %13)
  br label %125

125:                                              ; preds = %112, %104
  %126 = load i64, ptr %11, align 8, !tbaa !5
  %127 = add nsw i64 %126, -1
  store i64 %127, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %13) #5
  %128 = load i64, ptr %12, align 8, !tbaa !5
  %129 = add nsw i64 %128, 1
  store i64 %129, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %13) #5
  call void @_ZNSt5tupleIJiiiEEC2IJRxS2_S2_ELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS4_(ptr noundef nonnull align 4 dereferenceable(12) %13, ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #5
  %130 = call ptr @_ZNSt3setISt5tupleIJiiiEESt4lessIS1_ESaIS1_EE4findERKS1_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 4 dereferenceable(12) %13)
  store ptr %130, ptr %14, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #5
  %131 = call ptr @_ZNKSt3setISt5tupleIJiiiEESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @S) #5
  store ptr %131, ptr %15, align 8
  %132 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorISt5tupleIJiiiEEES4_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #5
  br i1 %132, label %133, label %146

133:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %16) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %17) #5
  %134 = load i64, ptr %10, align 8, !tbaa !5
  %135 = getelementptr inbounds [1010 x i64], ptr @A, i64 0, i64 %134
  %136 = load i64, ptr %135, align 8, !tbaa !5
  %137 = load i64, ptr %11, align 8, !tbaa !5
  %138 = getelementptr inbounds [1010 x i64], ptr getelementptr inbounds (i8, ptr @A, i64 8080), i64 0, i64 %137
  %139 = load i64, ptr %138, align 8, !tbaa !5
  %140 = add nsw i64 %139, %136
  %141 = load i64, ptr %12, align 8, !tbaa !5
  %142 = getelementptr inbounds [1010 x i64], ptr getelementptr inbounds (i8, ptr @A, i64 16160), i64 0, i64 %141
  %143 = load i64, ptr %142, align 8, !tbaa !5
  %144 = add nsw i64 %140, %143
  store i64 %144, ptr %17, align 8, !tbaa !5
  call void @_ZNSt5tupleIJxS_IJiiiEEEEC2IxRS0_TnNSt9enable_ifIXclsr4_TCCIXntcl14__is_alloc_argIT_EEEEE29__is_implicitly_constructibleIS5_T0_EEEbE4typeELb1EEEOS5_OS6_(ptr noundef nonnull align 8 dereferenceable(24) %16, ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 4 dereferenceable(12) %13) #5
  call void @_ZNSt14priority_queueISt5tupleIJxS0_IJiiiEEEESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(24) %16)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %16) #5
  %145 = call { ptr, i8 } @_ZNSt3setISt5tupleIJiiiEESt4lessIS1_ESaIS1_EE6insertERKS1_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 4 dereferenceable(12) %13)
  br label %146

146:                                              ; preds = %125, %133
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #5
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %147 = load i64, ptr @K, align 8, !tbaa !5
  %148 = icmp sgt i64 %147, %indvars.iv.next65
  br i1 %148, label %.lr.ph53.preheader, label %._crit_edge54, !llvm.loop !13
}

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setISt5tupleIJiiiEESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #2 align 2

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

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

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

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

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

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

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

; 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 #2 align 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 #2 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)) #3

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setISt5tupleIJiiiEESt4lessIS1_ESaIS1_EE6insertERKS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #2 align 2

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


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