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

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<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.__gnu_cxx::__normal_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
@ans = external dso_local global %"class.std::vector", 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 i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %12 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %15 = alloca i32, align 4
  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 %16

16:                                               ; preds = %25, %0
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = icmp slt i32 %17, 3
  br i1 %18, label %20, label %19

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

20:                                               ; preds = %16
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [3 x i64], ptr @X, i64 0, i64 %22
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %23)
  br label %25

25:                                               ; preds = %20
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %2, align 4, !tbaa !5
  br label %16, !llvm.loop !9

28:                                               ; preds = %19
  %29 = 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 %30

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

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

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

35:                                               ; preds = %52, %34
  %36 = load i32, ptr %5, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = load i32, ptr %3, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [3 x i64], ptr @X, i64 0, i64 %39
  %41 = load i64, ptr %40, align 8, !tbaa !11
  %42 = icmp slt i64 %37, %41
  br i1 %42, label %44, label %43

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

44:                                               ; preds = %35
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 %46
  %48 = load i32, ptr %5, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [1010 x i64], ptr %47, i64 0, i64 %49
  %51 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %50)
  br label %52

52:                                               ; preds = %44
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %5, align 4, !tbaa !5
  br label %35, !llvm.loop !13

55:                                               ; preds = %43
  br label %56

56:                                               ; preds = %55
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %3, align 4, !tbaa !5
  br label %30, !llvm.loop !14

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

60:                                               ; preds = %91, %59
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = icmp slt i32 %61, 3
  br i1 %62, label %64, label %63

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

64:                                               ; preds = %60
  %65 = load i32, ptr %6, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 %66
  %68 = getelementptr inbounds [1010 x i64], ptr %67, i64 0, i64 0
  %69 = load i32, ptr %6, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 %70
  %72 = getelementptr inbounds [1010 x i64], ptr %71, i64 0, i64 0
  %73 = load i32, ptr %6, 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 i64, ptr %72, i64 %76
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef %68, ptr noundef %77)
  %78 = load i32, ptr %6, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 %79
  %81 = getelementptr inbounds [1010 x i64], ptr %80, i64 0, i64 0
  %82 = load i32, ptr %6, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 %83
  %85 = getelementptr inbounds [1010 x i64], ptr %84, i64 0, i64 0
  %86 = load i32, ptr %6, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [3 x i64], ptr @X, i64 0, i64 %87
  %89 = load i64, ptr %88, align 8, !tbaa !11
  %90 = getelementptr inbounds i64, ptr %85, i64 %89
  call void @_ZSt7reverseIPxEvT_S1_(ptr noundef %81, ptr noundef %90)
  br label %91

91:                                               ; preds = %64
  %92 = load i32, ptr %6, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %6, align 4, !tbaa !5
  br label %60, !llvm.loop !15

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

95:                                               ; preds = %170, %94
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = load i64, ptr @X, align 16, !tbaa !11
  %99 = icmp slt i64 %97, %98
  br i1 %99, label %101, label %100

100:                                              ; preds = %95
  store i32 14, ptr %4, align 4
  br label %173

101:                                              ; preds = %95
  %102 = load i32, ptr %7, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  %104 = sext i32 %103 to i64
  %105 = load i64, ptr @K, align 8, !tbaa !11
  %106 = icmp sgt i64 %104, %105
  br i1 %106, label %107, label %108

107:                                              ; preds = %101
  store i32 14, ptr %4, align 4
  br label %173

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

109:                                              ; preds = %165, %108
  %110 = load i32, ptr %8, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = load i64, ptr getelementptr inbounds ([3 x i64], ptr @X, i64 0, i64 1), align 8, !tbaa !11
  %113 = icmp slt i64 %111, %112
  br i1 %113, label %115, label %114

114:                                              ; preds = %109
  store i32 17, ptr %4, align 4
  br label %168

115:                                              ; preds = %109
  %116 = load i32, ptr %7, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  %118 = load i32, ptr %8, align 4, !tbaa !5
  %119 = add nsw i32 %118, 1
  %120 = mul nsw i32 %117, %119
  %121 = sext i32 %120 to i64
  %122 = load i64, ptr @K, align 8, !tbaa !11
  %123 = icmp sgt i64 %121, %122
  br i1 %123, label %124, label %125

124:                                              ; preds = %115
  store i32 17, ptr %4, align 4
  br label %168

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

126:                                              ; preds = %160, %125
  %127 = load i32, ptr %9, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = load i64, ptr getelementptr inbounds ([3 x i64], ptr @X, i64 0, i64 2), align 16, !tbaa !11
  %130 = icmp slt i64 %128, %129
  br i1 %130, label %132, label %131

131:                                              ; preds = %126
  store i32 20, ptr %4, align 4
  br label %163

132:                                              ; preds = %126
  %133 = load i32, ptr %7, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  %135 = load i32, ptr %8, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  %137 = mul nsw i32 %134, %136
  %138 = load i32, ptr %9, align 4, !tbaa !5
  %139 = add nsw i32 %138, 1
  %140 = mul nsw i32 %137, %139
  %141 = sext i32 %140 to i64
  %142 = load i64, ptr @K, align 8, !tbaa !11
  %143 = icmp sgt i64 %141, %142
  br i1 %143, label %144, label %145

144:                                              ; preds = %132
  store i32 20, ptr %4, align 4
  br label %163

145:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %146 = load i32, ptr %7, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [1010 x i64], ptr @A, i64 0, i64 %147
  %149 = load i64, ptr %148, align 8, !tbaa !11
  %150 = load i32, ptr %8, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [1010 x i64], ptr getelementptr inbounds ([3 x [1010 x i64]], ptr @A, i64 0, i64 1), i64 0, i64 %151
  %153 = load i64, ptr %152, align 8, !tbaa !11
  %154 = add nsw i64 %149, %153
  %155 = load i32, ptr %9, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [1010 x i64], ptr getelementptr inbounds ([3 x [1010 x i64]], ptr @A, i64 0, i64 2), i64 0, i64 %156
  %158 = load i64, ptr %157, align 8, !tbaa !11
  %159 = add nsw i64 %154, %158
  store i64 %159, ptr %10, align 8, !tbaa !11
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) @ans, ptr noundef nonnull align 8 dereferenceable(8) %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %160

160:                                              ; preds = %145
  %161 = load i32, ptr %9, align 4, !tbaa !5
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %9, align 4, !tbaa !5
  br label %126, !llvm.loop !16

163:                                              ; preds = %144, %131
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %164

164:                                              ; preds = %163
  br label %165

165:                                              ; preds = %164
  %166 = load i32, ptr %8, align 4, !tbaa !5
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr %8, align 4, !tbaa !5
  br label %109, !llvm.loop !17

168:                                              ; preds = %124, %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %169

169:                                              ; preds = %168
  br label %170

170:                                              ; preds = %169
  %171 = load i32, ptr %7, align 4, !tbaa !5
  %172 = add nsw i32 %171, 1
  store i32 %172, ptr %7, align 4, !tbaa !5
  br label %95, !llvm.loop !18

173:                                              ; preds = %107, %100
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %174

174:                                              ; preds = %173
  %175 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @ans) #5
  %176 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %11, i32 0, i32 0
  store ptr %175, ptr %176, align 8
  %177 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @ans) #5
  %178 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %12, i32 0, i32 0
  store ptr %177, ptr %178, align 8
  %179 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %11, i32 0, i32 0
  %180 = load ptr, ptr %179, align 8
  %181 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %12, i32 0, i32 0
  %182 = load ptr, ptr %181, align 8
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr %180, ptr %182)
  %183 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @ans) #5
  %184 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %183, ptr %184, align 8
  %185 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @ans) #5
  %186 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  store ptr %185, ptr %186, align 8
  %187 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  %188 = load ptr, ptr %187, align 8
  %189 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  %190 = load ptr, ptr %189, align 8
  call void @_ZSt7reverseIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr %188, ptr %190)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %191

191:                                              ; preds = %204, %174
  %192 = load i32, ptr %15, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %194 = load i64, ptr @K, align 8, !tbaa !11
  %195 = icmp slt i64 %193, %194
  br i1 %195, label %197, label %196

196:                                              ; preds = %191
  store i32 23, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %207

197:                                              ; preds = %191
  %198 = load i32, ptr %15, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ans, i64 noundef %199) #5
  %201 = load i64, ptr %200, align 8, !tbaa !11
  %202 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %201)
  %203 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %202, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %204

204:                                              ; preds = %197
  %205 = load i32, ptr %15, align 4, !tbaa !5
  %206 = add nsw i32 %205, 1
  store i32 %206, ptr %15, align 4, !tbaa !5
  br label %191, !llvm.loop !19

207:                                              ; preds = %196
  %208 = load i32, ptr %1, align 4
  ret i32 %208
}

; 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 @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

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

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

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

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

; 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #4 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

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}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<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" }

@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
@ans = external dso_local global %"class.std::vector", 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 {
.preheader55:
  %0 = alloca i64, align 8
  %1 = 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)
  %2 = 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))
  %3 = 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))
  %4 = 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)
  %5 = load i64, ptr @X, align 16, !tbaa !5
  %6 = icmp sgt i64 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.preheader55
  %7 = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 8), align 8, !tbaa !5
  %8 = icmp sgt i64 %7, 0
  br i1 %8, 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 ]
  %9 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 1, i64 %indvars.iv.1
  %10 = 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) %9)
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv.1, 1
  %11 = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 8), align 8, !tbaa !5
  %12 = icmp sgt i64 %11, %indvars.iv.next.1
  br i1 %12, label %.lr.ph.1, label %._crit_edge.1, !llvm.loop !9

._crit_edge.1:                                    ; preds = %.lr.ph.1, %._crit_edge
  %13 = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 16), align 16, !tbaa !5
  %14 = icmp sgt i64 %13, 0
  br i1 %14, 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 ]
  %15 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 2, i64 %indvars.iv.2
  %16 = 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) %15)
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv.2, 1
  %17 = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 16), align 16, !tbaa !5
  %18 = icmp sgt i64 %17, %indvars.iv.next.2
  br i1 %18, label %.lr.ph.2, label %._crit_edge.2, !llvm.loop !9

._crit_edge.2:                                    ; preds = %.lr.ph.2, %._crit_edge.1
  %19 = load i64, ptr @X, align 16, !tbaa !5
  %20 = getelementptr inbounds i64, ptr @A, i64 %19
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @A, ptr noundef nonnull %20)
  %21 = load i64, ptr @X, align 16, !tbaa !5
  %22 = getelementptr inbounds i64, ptr @A, i64 %21
  tail call void @_ZSt7reverseIPxEvT_S1_(ptr noundef nonnull @A, ptr noundef nonnull %22)
  %23 = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 8), align 8, !tbaa !5
  %24 = getelementptr inbounds i64, ptr getelementptr inbounds (i8, ptr @A, i64 8080), i64 %23
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @A, i64 8080), ptr noundef nonnull %24)
  %25 = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 8), align 8, !tbaa !5
  %26 = getelementptr inbounds i64, ptr getelementptr inbounds (i8, ptr @A, i64 8080), i64 %25
  tail call void @_ZSt7reverseIPxEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @A, i64 8080), ptr noundef nonnull %26)
  %27 = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 16), align 16, !tbaa !5
  %28 = getelementptr inbounds i64, ptr getelementptr inbounds (i8, ptr @A, i64 16160), i64 %27
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @A, i64 16160), ptr noundef nonnull %28)
  %29 = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 16), align 16, !tbaa !5
  %30 = getelementptr inbounds i64, ptr getelementptr inbounds (i8, ptr @A, i64 16160), i64 %29
  tail call void @_ZSt7reverseIPxEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @A, i64 16160), ptr noundef nonnull %30)
  %31 = load i64, ptr @X, align 16, !tbaa !5
  %32 = icmp sgt i64 %31, 0
  br i1 %32, label %.lr.ph69, label %._crit_edge70

.lr.ph:                                           ; preds = %.preheader55, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader55 ]
  %33 = getelementptr inbounds [3 x [1010 x i64]], ptr @A, i64 0, i64 0, i64 %indvars.iv
  %34 = 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) %33)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %35 = load i64, ptr @X, align 16, !tbaa !5
  %36 = icmp sgt i64 %35, %indvars.iv.next
  br i1 %36, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.lr.ph69:                                         ; preds = %._crit_edge.2, %._crit_edge66
  %37 = phi i64 [ %65, %._crit_edge66 ], [ %31, %._crit_edge.2 ]
  %indvars.iv90 = phi i64 [ %indvars.iv.next91, %._crit_edge66 ], [ 0, %._crit_edge.2 ]
  %indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
  %38 = load i64, ptr @K, align 8, !tbaa !5
  %.not = icmp sgt i64 %38, %indvars.iv90
  br i1 %.not, label %.preheader52, label %._crit_edge70

.preheader52:                                     ; preds = %.lr.ph69
  %39 = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 8), align 8, !tbaa !5
  %40 = icmp sgt i64 %39, 0
  br i1 %40, label %.lr.ph65, label %._crit_edge66

.lr.ph65:                                         ; preds = %.preheader52
  %41 = getelementptr inbounds [1010 x i64], ptr @A, i64 0, i64 %indvars.iv90
  br label %42

42:                                               ; preds = %.lr.ph65, %._crit_edge62
  %43 = phi i64 [ %39, %.lr.ph65 ], [ %63, %._crit_edge62 ]
  %indvars.iv87 = phi i64 [ 0, %.lr.ph65 ], [ %indvars.iv.next88, %._crit_edge62 ]
  %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
  %44 = mul nuw nsw i64 %indvars.iv.next88, %indvars.iv.next91
  %45 = load i64, ptr @K, align 8, !tbaa !5
  %46 = icmp slt i64 %45, %44
  br i1 %46, label %._crit_edge66.loopexit, label %.preheader

.preheader:                                       ; preds = %42
  %47 = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 16), align 16, !tbaa !5
  %48 = icmp sgt i64 %47, 0
  br i1 %48, label %.lr.ph61, label %._crit_edge62

.lr.ph61:                                         ; preds = %.preheader
  %49 = getelementptr inbounds [1010 x i64], ptr getelementptr inbounds (i8, ptr @A, i64 8080), i64 0, i64 %indvars.iv87
  br label %50

50:                                               ; preds = %.lr.ph61, %54
  %indvars.iv84 = phi i64 [ 0, %.lr.ph61 ], [ %indvars.iv.next85, %54 ]
  %indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
  %51 = mul nuw nsw i64 %indvars.iv.next85, %44
  %52 = load i64, ptr @K, align 8, !tbaa !5
  %53 = icmp slt i64 %52, %51
  br i1 %53, label %._crit_edge62.loopexit, label %54

54:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %0) #5
  %55 = load i64, ptr %41, align 8, !tbaa !5
  %56 = load i64, ptr %49, align 8, !tbaa !5
  %57 = add nsw i64 %56, %55
  %58 = getelementptr inbounds [1010 x i64], ptr getelementptr inbounds (i8, ptr @A, i64 16160), i64 0, i64 %indvars.iv84
  %59 = load i64, ptr %58, align 8, !tbaa !5
  %60 = add nsw i64 %57, %59
  store i64 %60, ptr %0, align 8, !tbaa !5
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) @ans, ptr noundef nonnull align 8 dereferenceable(8) %0)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %0) #5
  %61 = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 16), align 16, !tbaa !5
  %62 = icmp sgt i64 %61, %indvars.iv.next85
  br i1 %62, label %50, label %._crit_edge62.loopexit, !llvm.loop !11

._crit_edge62.loopexit:                           ; preds = %50, %54
  %.pre = load i64, ptr getelementptr inbounds (i8, ptr @X, i64 8), align 8, !tbaa !5
  br label %._crit_edge62

._crit_edge62:                                    ; preds = %._crit_edge62.loopexit, %.preheader
  %63 = phi i64 [ %.pre, %._crit_edge62.loopexit ], [ %43, %.preheader ]
  %64 = icmp sgt i64 %63, %indvars.iv.next88
  br i1 %64, label %42, label %._crit_edge66.loopexit, !llvm.loop !12

._crit_edge66.loopexit:                           ; preds = %42, %._crit_edge62
  %.pre96 = load i64, ptr @X, align 16, !tbaa !5
  br label %._crit_edge66

._crit_edge66:                                    ; preds = %._crit_edge66.loopexit, %.preheader52
  %65 = phi i64 [ %.pre96, %._crit_edge66.loopexit ], [ %37, %.preheader52 ]
  %66 = icmp sgt i64 %65, %indvars.iv.next91
  br i1 %66, label %.lr.ph69, label %._crit_edge70, !llvm.loop !13

._crit_edge70:                                    ; preds = %._crit_edge66, %.lr.ph69, %._crit_edge.2
  %67 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @ans) #5
  %68 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @ans) #5
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr %67, ptr %68)
  %69 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @ans) #5
  %70 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @ans) #5
  call void @_ZSt7reverseIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr %69, ptr %70)
  %71 = load i64, ptr @K, align 8, !tbaa !5
  %72 = icmp sgt i64 %71, 0
  br i1 %72, label %.lr.ph74, label %._crit_edge75

._crit_edge75:                                    ; preds = %.lr.ph74, %._crit_edge70
  ret i32 0

.lr.ph74:                                         ; preds = %._crit_edge70, %.lr.ph74
  %indvars.iv93 = phi i64 [ %indvars.iv.next94, %.lr.ph74 ], [ 0, %._crit_edge70 ]
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ans, i64 noundef %indvars.iv93) #5
  %74 = load i64, ptr %73, align 8, !tbaa !5
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %74)
  %76 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %75, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
  %77 = load i64, ptr @K, align 8, !tbaa !5
  %78 = icmp sgt i64 %77, %indvars.iv.next94
  br i1 %78, label %.lr.ph74, label %._crit_edge75, !llvm.loop !14
}

; 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 @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

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

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

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

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

; 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #4 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

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 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


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