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

; 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.__gnu_cxx::__normal_iterator" = type { ptr }

@X = external dso_local global i64, align 8
@Y = external dso_local global i64, align 8
@Z = external dso_local global i64, align 8
@W = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@A = external dso_local global [1010 x i64], align 16
@B = external dso_local global [1010 x i64], align 16
@C = external dso_local global [1010 x i64], align 16
@D = external dso_local global %"class.std::vector", align 8
@ans = external dso_local global %"class.std::vector", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5flushv() #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) #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: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %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 i64, align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %12 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %13 = alloca [1010 x i64], align 16
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i32, align 4
  %19 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %20 = 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)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(8) @Y)
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 8 dereferenceable(8) @Z)
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 8 dereferenceable(8) @K)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %35, %0
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = load i64, ptr @X, align 8, !tbaa !9
  %28 = icmp slt i64 %26, %27
  br i1 %28, label %30, label %29

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

30:                                               ; preds = %24
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [1010 x i64], ptr @A, i64 0, i64 %32
  %34 = 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)
  br label %35

35:                                               ; preds = %30
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %2, align 4, !tbaa !5
  br label %24, !llvm.loop !11

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

39:                                               ; preds = %50, %38
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = load i64, ptr @Y, align 8, !tbaa !9
  %43 = icmp slt i64 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %53

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

50:                                               ; preds = %45
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %3, align 4, !tbaa !5
  br label %39, !llvm.loop !13

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

54:                                               ; preds = %65, %53
  %55 = load i32, ptr %4, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = load i64, ptr @Z, align 8, !tbaa !9
  %58 = icmp slt i64 %56, %57
  br i1 %58, label %60, label %59

59:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %68

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

65:                                               ; preds = %60
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %4, align 4, !tbaa !5
  br label %54, !llvm.loop !14

68:                                               ; preds = %59
  %69 = load i64, ptr @Y, align 8, !tbaa !9
  %70 = load i64, ptr @Z, align 8, !tbaa !9
  %71 = mul nsw i64 %69, %70
  store i64 %71, ptr @W, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %99, %68
  %73 = load i32, ptr %5, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = load i64, ptr @Y, align 8, !tbaa !9
  %76 = icmp slt i64 %74, %75
  br i1 %76, label %78, label %77

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

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

79:                                               ; preds = %95, %78
  %80 = load i32, ptr %7, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = load i64, ptr @Z, align 8, !tbaa !9
  %83 = icmp slt i64 %81, %82
  br i1 %83, label %85, label %84

84:                                               ; preds = %79
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %98

85:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %86 = load i32, ptr %5, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [1010 x i64], ptr @B, i64 0, i64 %87
  %89 = load i64, ptr %88, align 8, !tbaa !9
  %90 = load i32, ptr %7, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [1010 x i64], ptr @C, i64 0, i64 %91
  %93 = load i64, ptr %92, align 8, !tbaa !9
  %94 = add nsw i64 %89, %93
  store i64 %94, ptr %8, align 8, !tbaa !9
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) @D, ptr noundef nonnull align 8 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %95

95:                                               ; preds = %85
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %7, align 4, !tbaa !5
  br label %79, !llvm.loop !15

98:                                               ; preds = %84
  br label %99

99:                                               ; preds = %98
  %100 = load i32, ptr %5, align 4, !tbaa !5
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %5, align 4, !tbaa !5
  br label %72, !llvm.loop !16

102:                                              ; preds = %77
  %103 = load i64, ptr @X, align 8, !tbaa !9
  %104 = getelementptr inbounds i64, ptr @A, i64 %103
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef @A, ptr noundef %104)
  %105 = load i64, ptr @X, align 8, !tbaa !9
  %106 = getelementptr inbounds i64, ptr @A, i64 %105
  call void @_ZSt7reverseIPxEvT_S1_(ptr noundef @A, ptr noundef %106)
  %107 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @D) #5
  %108 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %107, ptr %108, align 8
  %109 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @D) #5
  %110 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  store ptr %109, ptr %110, align 8
  %111 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  %112 = load ptr, ptr %111, align 8
  %113 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  %114 = load ptr, ptr %113, align 8
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr %112, ptr %114)
  %115 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @D) #5
  %116 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %11, i32 0, i32 0
  store ptr %115, ptr %116, align 8
  %117 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @D) #5
  %118 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %12, i32 0, i32 0
  store ptr %117, ptr %118, align 8
  %119 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %11, i32 0, i32 0
  %120 = load ptr, ptr %119, align 8
  %121 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %12, i32 0, i32 0
  %122 = load ptr, ptr %121, align 8
  call void @_ZSt7reverseIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr %120, ptr %122)
  call void @llvm.lifetime.start.p0(i64 8080, ptr %13) #5
  %123 = getelementptr inbounds [1010 x i64], ptr %13, i64 0, i64 0
  %124 = getelementptr inbounds [1010 x i64], ptr %13, i64 0, i64 0
  %125 = load i64, ptr @X, align 8, !tbaa !9
  %126 = getelementptr inbounds i64, ptr %124, i64 %125
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef %123, ptr noundef %126, ptr noundef nonnull align 4 dereferenceable(4) %14)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %127

127:                                              ; preds = %176, %102
  %128 = load i32, ptr %15, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = load i64, ptr @K, align 8, !tbaa !9
  %131 = icmp slt i64 %129, %130
  br i1 %131, label %133, label %132

132:                                              ; preds = %127
  store i32 17, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %179

133:                                              ; preds = %127
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  store i64 0, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  store i64 0, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %134

134:                                              ; preds = %168, %133
  %135 = load i32, ptr %18, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = load i64, ptr @X, align 8, !tbaa !9
  %138 = icmp slt i64 %136, %137
  br i1 %138, label %140, label %139

139:                                              ; preds = %134
  store i32 20, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %171

140:                                              ; preds = %134
  %141 = load i32, ptr %18, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [1010 x i64], ptr %13, i64 0, i64 %142
  %144 = load i64, ptr %143, align 8, !tbaa !9
  %145 = load i64, ptr @W, align 8, !tbaa !9
  %146 = icmp sge i64 %144, %145
  br i1 %146, label %147, label %148

147:                                              ; preds = %140
  br label %168

148:                                              ; preds = %140
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %149 = load i32, ptr %18, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [1010 x i64], ptr %13, i64 0, i64 %150
  %152 = load i64, ptr %151, align 8, !tbaa !9
  %153 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @D, i64 noundef %152) #5
  %154 = load i64, ptr %153, align 8, !tbaa !9
  %155 = load i32, ptr %18, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [1010 x i64], ptr @A, i64 0, i64 %156
  %158 = load i64, ptr %157, align 8, !tbaa !9
  %159 = add nsw i64 %154, %158
  store i64 %159, ptr %19, align 8, !tbaa !9
  %160 = load i64, ptr %19, align 8, !tbaa !9
  %161 = load i64, ptr %16, align 8, !tbaa !9
  %162 = icmp sgt i64 %160, %161
  br i1 %162, label %163, label %167

163:                                              ; preds = %148
  %164 = load i64, ptr %19, align 8, !tbaa !9
  store i64 %164, ptr %16, align 8, !tbaa !9
  %165 = load i32, ptr %18, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  store i64 %166, ptr %17, align 8, !tbaa !9
  br label %167

167:                                              ; preds = %163, %148
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  br label %168

168:                                              ; preds = %167, %147
  %169 = load i32, ptr %18, align 4, !tbaa !5
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr %18, align 4, !tbaa !5
  br label %134, !llvm.loop !17

171:                                              ; preds = %139
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) @ans, ptr noundef nonnull align 8 dereferenceable(8) %16)
  %172 = load i64, ptr %17, align 8, !tbaa !9
  %173 = getelementptr inbounds [1010 x i64], ptr %13, i64 0, i64 %172
  %174 = load i64, ptr %173, align 8, !tbaa !9
  %175 = add nsw i64 %174, 1
  store i64 %175, ptr %173, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %176

176:                                              ; preds = %171
  %177 = load i32, ptr %15, align 4, !tbaa !5
  %178 = add nsw i32 %177, 1
  store i32 %178, ptr %15, align 4, !tbaa !5
  br label %127, !llvm.loop !18

179:                                              ; preds = %132
  call void @_Z5flushv()
  call void @llvm.lifetime.end.p0(i64 8080, ptr %13) #5
  %180 = load i32, ptr %1, align 4
  ret i32 %180
}

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

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

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

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

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

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

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

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

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

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


; 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 }

@X = external dso_local global i64, align 8
@Y = external dso_local global i64, align 8
@Z = external dso_local global i64, align 8
@W = external dso_local local_unnamed_addr global i64, align 8
@K = external dso_local global i64, align 8
@A = external dso_local global [1010 x i64], align 16
@B = external dso_local global [1010 x i64], align 16
@C = external dso_local global [1010 x i64], align 16
@D = external dso_local global %"class.std::vector", align 8
@ans = external dso_local global %"class.std::vector", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5flushv() local_unnamed_addr #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) 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: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i64, align 8
  %2 = alloca [1010 x i64], align 16
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = 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)
  %6 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(8) @Y)
  %7 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(8) @Z)
  %8 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(8) @K)
  %9 = load i64, ptr @X, align 8, !tbaa !5
  %10 = icmp sgt i64 %9, 0
  br i1 %10, label %.lr.ph, label %.preheader47

.preheader47:                                     ; preds = %.lr.ph, %0
  %11 = load i64, ptr @Y, align 8, !tbaa !5
  %12 = icmp sgt i64 %11, 0
  br i1 %12, label %.lr.ph50, label %.preheader46

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

.preheader46:                                     ; preds = %.lr.ph50, %.preheader47
  %17 = phi i64 [ %11, %.preheader47 ], [ %22, %.lr.ph50 ]
  %18 = load i64, ptr @Z, align 8, !tbaa !5
  %19 = icmp sgt i64 %18, 0
  br i1 %19, label %.lr.ph52, label %._crit_edge

.lr.ph50:                                         ; preds = %.preheader47, %.lr.ph50
  %indvars.iv71 = phi i64 [ %indvars.iv.next72, %.lr.ph50 ], [ 0, %.preheader47 ]
  %20 = getelementptr inbounds [1010 x i64], ptr @B, i64 0, i64 %indvars.iv71
  %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) %20)
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %22 = load i64, ptr @Y, align 8, !tbaa !5
  %23 = icmp sgt i64 %22, %indvars.iv.next72
  br i1 %23, label %.lr.ph50, label %.preheader46, !llvm.loop !11

._crit_edge.loopexit:                             ; preds = %.lr.ph52
  %.pre = load i64, ptr @Y, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader46
  %24 = phi i64 [ %17, %.preheader46 ], [ %.pre, %._crit_edge.loopexit ]
  %25 = phi i64 [ %18, %.preheader46 ], [ %31, %._crit_edge.loopexit ]
  %26 = mul nsw i64 %24, %25
  store i64 %26, ptr @W, align 8, !tbaa !5
  %27 = icmp sgt i64 %24, 0
  %28 = icmp sgt i64 %25, 0
  %or.cond = and i1 %27, %28
  br i1 %or.cond, label %.preheader, label %._crit_edge57

.lr.ph52:                                         ; preds = %.preheader46, %.lr.ph52
  %indvars.iv74 = phi i64 [ %indvars.iv.next75, %.lr.ph52 ], [ 0, %.preheader46 ]
  %29 = getelementptr inbounds [1010 x i64], ptr @C, i64 0, i64 %indvars.iv74
  %30 = 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) %29)
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %31 = load i64, ptr @Z, align 8, !tbaa !5
  %32 = icmp sgt i64 %31, %indvars.iv.next75
  br i1 %32, label %.lr.ph52, label %._crit_edge.loopexit, !llvm.loop !12

.preheader:                                       ; preds = %._crit_edge, %._crit_edge55
  %33 = phi i64 [ %49, %._crit_edge55 ], [ %24, %._crit_edge ]
  %34 = phi i64 [ %50, %._crit_edge55 ], [ %25, %._crit_edge ]
  %indvars.iv83 = phi i64 [ %indvars.iv.next84, %._crit_edge55 ], [ 0, %._crit_edge ]
  %35 = icmp sgt i64 %34, 0
  br i1 %35, label %.lr.ph54, label %._crit_edge55

.lr.ph54:                                         ; preds = %.preheader
  %36 = getelementptr inbounds [1010 x i64], ptr @B, i64 0, i64 %indvars.iv83
  br label %52

._crit_edge57:                                    ; preds = %._crit_edge55, %._crit_edge
  %37 = load i64, ptr @X, align 8, !tbaa !5
  %38 = getelementptr inbounds i64, ptr @A, i64 %37
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @A, ptr noundef nonnull %38)
  %39 = load i64, ptr @X, align 8, !tbaa !5
  %40 = getelementptr inbounds i64, ptr @A, i64 %39
  call void @_ZSt7reverseIPxEvT_S1_(ptr noundef nonnull @A, ptr noundef nonnull %40)
  %41 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @D) #5
  %42 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @D) #5
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr %41, ptr %42)
  %43 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @D) #5
  %44 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @D) #5
  call void @_ZSt7reverseIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr %43, ptr %44)
  call void @llvm.lifetime.start.p0(i64 8080, ptr nonnull %2) #5
  %45 = load i64, ptr @X, align 8, !tbaa !5
  %46 = getelementptr inbounds i64, ptr %2, i64 %45
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 0, ptr %3, align 4, !tbaa !13
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull %2, ptr noundef nonnull %46, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  %47 = load i64, ptr @K, align 8, !tbaa !5
  %48 = icmp sgt i64 %47, 0
  br i1 %48, label %.lr.ph66, label %._crit_edge67

._crit_edge55.loopexit:                           ; preds = %52
  %.pre92 = load i64, ptr @Y, align 8, !tbaa !5
  br label %._crit_edge55

._crit_edge55:                                    ; preds = %._crit_edge55.loopexit, %.preheader
  %49 = phi i64 [ %.pre92, %._crit_edge55.loopexit ], [ %33, %.preheader ]
  %50 = phi i64 [ %57, %._crit_edge55.loopexit ], [ %34, %.preheader ]
  %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
  %51 = icmp sgt i64 %49, %indvars.iv.next84
  br i1 %51, label %.preheader, label %._crit_edge57, !llvm.loop !15

52:                                               ; preds = %.lr.ph54, %52
  %indvars.iv80 = phi i64 [ 0, %.lr.ph54 ], [ %indvars.iv.next81, %52 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  %53 = load i64, ptr %36, align 8, !tbaa !5
  %54 = getelementptr inbounds [1010 x i64], ptr @C, i64 0, i64 %indvars.iv80
  %55 = load i64, ptr %54, align 8, !tbaa !5
  %56 = add nsw i64 %55, %53
  store i64 %56, ptr %1, align 8, !tbaa !5
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) @D, ptr noundef nonnull align 8 dereferenceable(8) %1)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %57 = load i64, ptr @Z, align 8, !tbaa !5
  %58 = icmp sgt i64 %57, %indvars.iv.next81
  br i1 %58, label %52, label %._crit_edge55.loopexit, !llvm.loop !17

._crit_edge67:                                    ; preds = %._crit_edge62, %._crit_edge57
  call void @_Z5flushv()
  call void @llvm.lifetime.end.p0(i64 8080, ptr nonnull %2) #5
  ret i32 0

.lr.ph66:                                         ; preds = %._crit_edge57, %._crit_edge62
  %indvars.iv89 = phi i64 [ %indvars.iv.next90, %._crit_edge62 ], [ 0, %._crit_edge57 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  store i64 0, ptr %4, align 8, !tbaa !5
  %59 = load i64, ptr @X, align 8, !tbaa !5
  %60 = icmp sgt i64 %59, 0
  br i1 %60, label %.lr.ph61.preheader, label %._crit_edge62

.lr.ph61.preheader:                               ; preds = %.lr.ph66
  %.pre94 = load i64, ptr @W, align 8, !tbaa !5
  br label %.lr.ph61

._crit_edge62:                                    ; preds = %78, %.lr.ph66
  %.031.lcssa = phi i64 [ 0, %.lr.ph66 ], [ %.2, %78 ]
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) @ans, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %61 = getelementptr inbounds [1010 x i64], ptr %2, i64 0, i64 %.031.lcssa
  %62 = load i64, ptr %61, align 8, !tbaa !5
  %63 = add nsw i64 %62, 1
  store i64 %63, ptr %61, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  %indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
  %64 = load i64, ptr @K, align 8, !tbaa !5
  %65 = icmp sgt i64 %64, %indvars.iv.next90
  br i1 %65, label %.lr.ph66, label %._crit_edge67, !llvm.loop !18

.lr.ph61:                                         ; preds = %.lr.ph61.preheader, %78
  %66 = phi i64 [ %.pre94, %.lr.ph61.preheader ], [ %79, %78 ]
  %indvars.iv86 = phi i64 [ 0, %.lr.ph61.preheader ], [ %indvars.iv.next87, %78 ]
  %.03158 = phi i64 [ 0, %.lr.ph61.preheader ], [ %.2, %78 ]
  %67 = getelementptr inbounds [1010 x i64], ptr %2, i64 0, i64 %indvars.iv86
  %68 = load i64, ptr %67, align 8, !tbaa !5
  %.not = icmp slt i64 %68, %66
  br i1 %.not, label %69, label %78

69:                                               ; preds = %.lr.ph61
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @D, i64 noundef %68) #5
  %71 = load i64, ptr %70, align 8, !tbaa !5
  %72 = getelementptr inbounds [1010 x i64], ptr @A, i64 0, i64 %indvars.iv86
  %73 = load i64, ptr %72, align 8, !tbaa !5
  %74 = add nsw i64 %73, %71
  %75 = load i64, ptr %4, align 8, !tbaa !5
  %76 = icmp sgt i64 %74, %75
  %.pre93 = load i64, ptr @W, align 8, !tbaa !5
  br i1 %76, label %77, label %78

77:                                               ; preds = %69
  store i64 %74, ptr %4, align 8, !tbaa !5
  br label %78

78:                                               ; preds = %69, %77, %.lr.ph61
  %79 = phi i64 [ %66, %.lr.ph61 ], [ %.pre93, %77 ], [ %.pre93, %69 ]
  %.2 = phi i64 [ %.03158, %.lr.ph61 ], [ %indvars.iv86, %77 ], [ %.03158, %69 ]
  %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
  %80 = load i64, ptr @X, align 8, !tbaa !5
  %81 = icmp sgt i64 %80, %indvars.iv.next87
  br i1 %81, label %.lr.ph61, label %._crit_edge62, !llvm.loop !19
}

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

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

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

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

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

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

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

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

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

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


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