; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2011-12/Mar (12 Mar S3)

; 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<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<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" }

@N = external dso_local global i32, align 4
@X = external dso_local global i32, align 4
@Y = external dso_local global i32, align 4
@Z = external dso_local global i32, align 4
@dp = external dso_local global [1001 x [1001 x i32]], align 16
@A = external dso_local global %"class.std::vector", align 8
@B = 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 i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %15 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %16 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %17 = getelementptr i8, ptr %16, i64 -24
  %18 = load i64, ptr %17, align 8
  %19 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %18
  %20 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %19, ptr noundef null)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 4 dereferenceable(4) @X)
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 4 dereferenceable(4) @Y)
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 4 dereferenceable(4) @Z)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %25

25:                                               ; preds = %53, %0
  %26 = load i32, ptr %2, align 4, !tbaa !8
  %27 = load i32, ptr @N, align 4, !tbaa !8
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %56

30:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %31, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !8
  br label %33

33:                                               ; preds = %39, %30
  %34 = load i32, ptr %6, align 4, !tbaa !8
  %35 = load i32, ptr %4, align 4, !tbaa !8
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

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

38:                                               ; preds = %33
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @A, ptr noundef nonnull align 4 dereferenceable(4) %2)
  br label %39

39:                                               ; preds = %38
  %40 = load i32, ptr %6, align 4, !tbaa !8
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %6, align 4, !tbaa !8
  br label %33, !llvm.loop !11

42:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !8
  br label %43

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

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

48:                                               ; preds = %43
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @B, ptr noundef nonnull align 4 dereferenceable(4) %2)
  br label %49

49:                                               ; preds = %48
  %50 = load i32, ptr %7, align 4, !tbaa !8
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %7, align 4, !tbaa !8
  br label %43, !llvm.loop !13

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

53:                                               ; preds = %52
  %54 = load i32, ptr %2, align 4, !tbaa !8
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %2, align 4, !tbaa !8
  br label %25, !llvm.loop !14

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

57:                                               ; preds = %72, %56
  %58 = load i32, ptr %8, align 4, !tbaa !8
  %59 = sext i32 %58 to i64
  %60 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @A) #7
  %61 = add i64 %60, 1
  %62 = icmp ult i64 %59, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %57
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %75

64:                                               ; preds = %57
  %65 = load i32, ptr %8, align 4, !tbaa !8
  %66 = load i32, ptr @Y, align 4, !tbaa !8
  %67 = mul nsw i32 %65, %66
  %68 = load i32, ptr %8, align 4, !tbaa !8
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [1001 x [1001 x i32]], ptr @dp, i64 0, i64 %69
  %71 = getelementptr inbounds [1001 x i32], ptr %70, i64 0, i64 0
  store i32 %67, ptr %71, align 4, !tbaa !8
  br label %72

72:                                               ; preds = %64
  %73 = load i32, ptr %8, align 4, !tbaa !8
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %8, align 4, !tbaa !8
  br label %57, !llvm.loop !15

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

76:                                               ; preds = %90, %75
  %77 = load i32, ptr %9, align 4, !tbaa !8
  %78 = sext i32 %77 to i64
  %79 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @B) #7
  %80 = add i64 %79, 1
  %81 = icmp ult i64 %78, %80
  br i1 %81, label %83, label %82

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

83:                                               ; preds = %76
  %84 = load i32, ptr %9, align 4, !tbaa !8
  %85 = load i32, ptr @X, align 4, !tbaa !8
  %86 = mul nsw i32 %84, %85
  %87 = load i32, ptr %9, align 4, !tbaa !8
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [1001 x i32], ptr @dp, i64 0, i64 %88
  store i32 %86, ptr %89, align 4, !tbaa !8
  br label %90

90:                                               ; preds = %83
  %91 = load i32, ptr %9, align 4, !tbaa !8
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %9, align 4, !tbaa !8
  br label %76, !llvm.loop !16

93:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 1, ptr %10, align 4, !tbaa !8
  br label %94

94:                                               ; preds = %180, %93
  %95 = load i32, ptr %10, align 4, !tbaa !8
  %96 = sext i32 %95 to i64
  %97 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @A) #7
  %98 = add i64 %97, 1
  %99 = icmp ult i64 %96, %98
  br i1 %99, label %101, label %100

100:                                              ; preds = %94
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %183

101:                                              ; preds = %94
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 1, ptr %11, align 4, !tbaa !8
  br label %102

102:                                              ; preds = %176, %101
  %103 = load i32, ptr %11, align 4, !tbaa !8
  %104 = sext i32 %103 to i64
  %105 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @B) #7
  %106 = add i64 %105, 1
  %107 = icmp ult i64 %104, %106
  br i1 %107, label %109, label %108

108:                                              ; preds = %102
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %179

109:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %110 = load i32, ptr %10, align 4, !tbaa !8
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [1001 x [1001 x i32]], ptr @dp, i64 0, i64 %111
  %113 = load i32, ptr %11, align 4, !tbaa !8
  %114 = sub nsw i32 %113, 1
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [1001 x i32], ptr %112, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !8
  %118 = load i32, ptr @X, align 4, !tbaa !8
  %119 = add nsw i32 %117, %118
  store i32 %119, ptr %12, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %120 = load i32, ptr %10, align 4, !tbaa !8
  %121 = sub nsw i32 %120, 1
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [1001 x [1001 x i32]], ptr @dp, i64 0, i64 %122
  %124 = load i32, ptr %11, align 4, !tbaa !8
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [1001 x i32], ptr %123, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !8
  %128 = load i32, ptr @Y, align 4, !tbaa !8
  %129 = add nsw i32 %127, %128
  store i32 %129, ptr %13, align 4, !tbaa !8
  %130 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %131 = load i32, ptr %130, align 4, !tbaa !8
  %132 = load i32, ptr %10, align 4, !tbaa !8
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [1001 x [1001 x i32]], ptr @dp, i64 0, i64 %133
  %135 = load i32, ptr %11, align 4, !tbaa !8
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [1001 x i32], ptr %134, i64 0, i64 %136
  store i32 %131, ptr %137, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  %138 = load i32, ptr %10, align 4, !tbaa !8
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [1001 x [1001 x i32]], ptr @dp, i64 0, i64 %139
  %141 = load i32, ptr %11, align 4, !tbaa !8
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [1001 x i32], ptr %140, i64 0, i64 %142
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %144 = load i32, ptr %10, align 4, !tbaa !8
  %145 = sub nsw i32 %144, 1
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [1001 x [1001 x i32]], ptr @dp, i64 0, i64 %146
  %148 = load i32, ptr %11, align 4, !tbaa !8
  %149 = sub nsw i32 %148, 1
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [1001 x i32], ptr %147, i64 0, i64 %150
  %152 = load i32, ptr %151, align 4, !tbaa !8
  %153 = load i32, ptr @Z, align 4, !tbaa !8
  %154 = load i32, ptr %10, align 4, !tbaa !8
  %155 = sub nsw i32 %154, 1
  %156 = sext i32 %155 to i64
  %157 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @A, i64 noundef %156) #7
  %158 = load i32, ptr %157, align 4, !tbaa !8
  %159 = load i32, ptr %11, align 4, !tbaa !8
  %160 = sub nsw i32 %159, 1
  %161 = sext i32 %160 to i64
  %162 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @B, i64 noundef %161) #7
  %163 = load i32, ptr %162, align 4, !tbaa !8
  %164 = sub nsw i32 %158, %163
  %165 = call i32 @llvm.abs.i32(i32 %164, i1 true)
  %166 = mul nsw i32 %153, %165
  %167 = add nsw i32 %152, %166
  store i32 %167, ptr %14, align 4, !tbaa !8
  %168 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %143, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %169 = load i32, ptr %168, align 4, !tbaa !8
  %170 = load i32, ptr %10, align 4, !tbaa !8
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [1001 x [1001 x i32]], ptr @dp, i64 0, i64 %171
  %173 = load i32, ptr %11, align 4, !tbaa !8
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [1001 x i32], ptr %172, i64 0, i64 %174
  store i32 %169, ptr %175, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %176

176:                                              ; preds = %109
  %177 = load i32, ptr %11, align 4, !tbaa !8
  %178 = add nsw i32 %177, 1
  store i32 %178, ptr %11, align 4, !tbaa !8
  br label %102, !llvm.loop !17

179:                                              ; preds = %108
  br label %180

180:                                              ; preds = %179
  %181 = load i32, ptr %10, align 4, !tbaa !8
  %182 = add nsw i32 %181, 1
  store i32 %182, ptr %10, align 4, !tbaa !8
  br label %94, !llvm.loop !18

183:                                              ; preds = %100
  %184 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @A) #7
  %185 = getelementptr inbounds [1001 x [1001 x i32]], ptr @dp, i64 0, i64 %184
  %186 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @B) #7
  %187 = getelementptr inbounds [1001 x i32], ptr %185, i64 0, i64 %186
  %188 = load i32, ptr %187, align 4, !tbaa !8
  %189 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %188)
  %190 = load i32, ptr %1, align 4
  ret i32 %190
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #2 align 2

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

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

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

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6

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

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = 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<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<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" }

@N = external dso_local global i32, align 4
@X = external dso_local global i32, align 4
@Y = external dso_local global i32, align 4
@Z = external dso_local global i32, align 4
@dp = external dso_local global [1001 x [1001 x i32]], align 16
@A = external dso_local global %"class.std::vector", align 8
@B = 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 {
  %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 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %8 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %9 = getelementptr i8, ptr %8, i64 -24
  %10 = load i64, ptr %9, align 8
  %11 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %10
  %12 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %11, ptr noundef null)
  %13 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %14 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(4) @X)
  %15 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 4 dereferenceable(4) @Y)
  %16 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 4 dereferenceable(4) @Z)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  store i32 0, ptr %1, align 4, !tbaa !8
  %17 = load i32, ptr @N, align 4, !tbaa !8
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph47, label %._crit_edge48

._crit_edge48:                                    ; preds = %._crit_edge, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %19 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @A) #7
  %.not = icmp eq i64 %19, -1
  br i1 %.not, label %.preheader41, label %.lr.ph51

.lr.ph47:                                         ; preds = %0, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %22 = load i32, ptr %2, align 4, !tbaa !8
  %23 = icmp sgt i32 %22, 0
  br i1 %23, label %.lr.ph, label %.preheader42

.preheader42:                                     ; preds = %.lr.ph, %.lr.ph47
  %24 = load i32, ptr %3, align 4, !tbaa !8
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.lr.ph45, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph47, %.lr.ph
  %.03543 = phi i32 [ %26, %.lr.ph ], [ 0, %.lr.ph47 ]
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @A, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %26 = add nuw nsw i32 %.03543, 1
  %27 = load i32, ptr %2, align 4, !tbaa !8
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %.lr.ph, label %.preheader42, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph45, %.preheader42
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %29 = load i32, ptr %1, align 4, !tbaa !8
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %1, align 4, !tbaa !8
  %31 = load i32, ptr @N, align 4, !tbaa !8
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %.lr.ph47, label %._crit_edge48, !llvm.loop !13

.lr.ph45:                                         ; preds = %.preheader42, %.lr.ph45
  %.03444 = phi i32 [ %33, %.lr.ph45 ], [ 0, %.preheader42 ]
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @B, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %33 = add nuw nsw i32 %.03444, 1
  %34 = load i32, ptr %3, align 4, !tbaa !8
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %.lr.ph45, label %._crit_edge, !llvm.loop !14

.preheader41:                                     ; preds = %.lr.ph51, %._crit_edge48
  %36 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @B) #7
  %.not59 = icmp eq i64 %36, -1
  br i1 %.not59, label %.preheader40, label %.lr.ph53

.lr.ph51:                                         ; preds = %._crit_edge48, %.lr.ph51
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph51 ], [ 0, %._crit_edge48 ]
  %37 = load i32, ptr @Y, align 4, !tbaa !8
  %38 = trunc nuw nsw i64 %indvars.iv to i32
  %39 = mul nsw i32 %37, %38
  %40 = getelementptr inbounds [1001 x [1001 x i32]], ptr @dp, i64 0, i64 %indvars.iv
  store i32 %39, ptr %40, align 4, !tbaa !8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %41 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @A) #7
  %42 = add i64 %41, 1
  %43 = icmp ugt i64 %42, %indvars.iv.next
  br i1 %43, label %.lr.ph51, label %.preheader41, !llvm.loop !15

.preheader40:                                     ; preds = %.lr.ph53, %.preheader41
  %44 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @A) #7
  %45 = add i64 %44, -1
  %46 = icmp ult i64 %45, -2
  br i1 %46, label %.preheader, label %._crit_edge58

.lr.ph53:                                         ; preds = %.preheader41, %.lr.ph53
  %indvars.iv61 = phi i64 [ %indvars.iv.next62, %.lr.ph53 ], [ 0, %.preheader41 ]
  %47 = load i32, ptr @X, align 4, !tbaa !8
  %48 = trunc nuw nsw i64 %indvars.iv61 to i32
  %49 = mul nsw i32 %47, %48
  %50 = getelementptr inbounds [1001 x i32], ptr @dp, i64 0, i64 %indvars.iv61
  store i32 %49, ptr %50, align 4, !tbaa !8
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %51 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @B) #7
  %52 = add i64 %51, 1
  %53 = icmp ugt i64 %52, %indvars.iv.next62
  br i1 %53, label %.lr.ph53, label %.preheader40, !llvm.loop !16

.preheader:                                       ; preds = %.preheader40, %._crit_edge56
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %._crit_edge56 ], [ 1, %.preheader40 ]
  %54 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @B) #7
  %55 = add i64 %54, -1
  %56 = icmp ult i64 %55, -2
  br i1 %56, label %.lr.ph55, label %._crit_edge56

.lr.ph55:                                         ; preds = %.preheader
  %57 = add nsw i64 %indvars.iv67, -1
  br label %66

._crit_edge58:                                    ; preds = %._crit_edge56, %.preheader40
  %58 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @A) #7
  %59 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @B) #7
  %60 = getelementptr inbounds [1001 x [1001 x i32]], ptr @dp, i64 0, i64 %58, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !8
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %61)
  ret i32 0

._crit_edge56:                                    ; preds = %66, %.preheader
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %63 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @A) #7
  %64 = add i64 %63, 1
  %65 = icmp ugt i64 %64, %indvars.iv.next68
  br i1 %65, label %.preheader, label %._crit_edge58, !llvm.loop !17

66:                                               ; preds = %.lr.ph55, %66
  %indvars.iv64 = phi i64 [ 1, %.lr.ph55 ], [ %indvars.iv.next65, %66 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %67 = add nsw i64 %indvars.iv64, -1
  %68 = getelementptr inbounds [1001 x [1001 x i32]], ptr @dp, i64 0, i64 %indvars.iv67, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !8
  %70 = load i32, ptr @X, align 4, !tbaa !8
  %71 = add nsw i32 %70, %69
  store i32 %71, ptr %4, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  %72 = getelementptr inbounds [1001 x [1001 x i32]], ptr @dp, i64 0, i64 %57, i64 %indvars.iv64
  %73 = load i32, ptr %72, align 4, !tbaa !8
  %74 = load i32, ptr @Y, align 4, !tbaa !8
  %75 = add nsw i32 %74, %73
  store i32 %75, ptr %5, align 4, !tbaa !8
  %76 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %77 = load i32, ptr %76, align 4, !tbaa !8
  %78 = getelementptr inbounds [1001 x [1001 x i32]], ptr @dp, i64 0, i64 %indvars.iv67, i64 %indvars.iv64
  store i32 %77, ptr %78, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %79 = getelementptr inbounds [1001 x [1001 x i32]], ptr @dp, i64 0, i64 %57, i64 %67
  %80 = load i32, ptr %79, align 4, !tbaa !8
  %81 = load i32, ptr @Z, align 4, !tbaa !8
  %82 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @A, i64 noundef %57) #7
  %83 = load i32, ptr %82, align 4, !tbaa !8
  %84 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @B, i64 noundef %67) #7
  %85 = load i32, ptr %84, align 4, !tbaa !8
  %86 = sub nsw i32 %83, %85
  %87 = call i32 @llvm.abs.i32(i32 %86, i1 true)
  %88 = mul nsw i32 %87, %81
  %89 = add nsw i32 %88, %80
  store i32 %89, ptr %6, align 4, !tbaa !8
  %90 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %78, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %91 = load i32, ptr %90, align 4, !tbaa !8
  store i32 %91, ptr %78, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %92 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @B) #7
  %93 = add i64 %92, 1
  %94 = icmp ugt i64 %93, %indvars.iv.next65
  br i1 %94, label %66, label %._crit_edge56, !llvm.loop !18
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #1

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6

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

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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