; LLVM IR from DionysiosB/CodeForces :: 1000-1099 (1036D-VasyaAndArrays)

; 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::allocator" = type { i8 }

@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca %"class.std::vector", align 8
  %4 = alloca %"class.std::allocator", align 1
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca %"class.std::vector", align 8
  %10 = alloca %"class.std::allocator", align 1
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  call void @llvm.lifetime.start.p0(i64 24, ptr %3) #5
  %18 = load i64, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #5
  call void @_ZNSaIxEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #5
  invoke void @_ZNSt6vectorIxSaIxEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %18, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %19 unwind label %25

19:                                               ; preds = %0
  call void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store i64 0, ptr %7, align 8, !tbaa !5
  br label %20

20:                                               ; preds = %34, %19
  %21 = load i64, ptr %7, align 8, !tbaa !5
  %22 = load i64, ptr %2, align 8, !tbaa !5
  %23 = icmp slt i64 %21, %22
  br i1 %23, label %29, label %24

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %41

25:                                               ; preds = %0
  %26 = landingpad { ptr, i32 }
          cleanup
  %27 = extractvalue { ptr, i32 } %26, 0
  store ptr %27, ptr %5, align 8
  %28 = extractvalue { ptr, i32 } %26, 1
  store i32 %28, ptr %6, align 4
  call void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #5
  br label %198

29:                                               ; preds = %20
  %30 = load i64, ptr %7, align 8, !tbaa !5
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %30) #5
  %32 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %31)
          to label %33 unwind label %37

33:                                               ; preds = %29
  br label %34

34:                                               ; preds = %33
  %35 = load i64, ptr %7, align 8, !tbaa !5
  %36 = add nsw i64 %35, 1
  store i64 %36, ptr %7, align 8, !tbaa !5
  br label %20, !llvm.loop !9

37:                                               ; preds = %29
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %5, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %197

41:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %42 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %8)
          to label %43 unwind label %51

43:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #5
  %44 = load i64, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #5
  call void @_ZNSaIxEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #5
  invoke void @_ZNSt6vectorIxSaIxEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %44, ptr noundef nonnull align 1 dereferenceable(1) %10)
          to label %45 unwind label %55

45:                                               ; preds = %43
  call void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store i64 0, ptr %11, align 8, !tbaa !5
  br label %46

46:                                               ; preds = %64, %45
  %47 = load i64, ptr %11, align 8, !tbaa !5
  %48 = load i64, ptr %8, align 8, !tbaa !5
  %49 = icmp slt i64 %47, %48
  br i1 %49, label %59, label %50

50:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %71

51:                                               ; preds = %41
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %5, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %6, align 4
  br label %196

55:                                               ; preds = %43
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %5, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %6, align 4
  call void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #5
  br label %195

59:                                               ; preds = %46
  %60 = load i64, ptr %11, align 8, !tbaa !5
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %60) #5
  %62 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %61)
          to label %63 unwind label %67

63:                                               ; preds = %59
  br label %64

64:                                               ; preds = %63
  %65 = load i64, ptr %11, align 8, !tbaa !5
  %66 = add nsw i64 %65, 1
  store i64 %66, ptr %11, align 8, !tbaa !5
  br label %46, !llvm.loop !11

67:                                               ; preds = %59
  %68 = landingpad { ptr, i32 }
          cleanup
  %69 = extractvalue { ptr, i32 } %68, 0
  store ptr %69, ptr %5, align 8
  %70 = extractvalue { ptr, i32 } %68, 1
  store i32 %70, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %194

71:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store i64 0, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store i64 0, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store i64 0, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  store i64 0, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  store i64 0, ptr %16, align 8, !tbaa !5
  br label %72

72:                                               ; preds = %171, %71
  %73 = load i64, ptr %12, align 8, !tbaa !5
  %74 = load i64, ptr %2, align 8, !tbaa !5
  %75 = icmp slt i64 %73, %74
  br i1 %75, label %80, label %76

76:                                               ; preds = %72
  %77 = load i64, ptr %13, align 8, !tbaa !5
  %78 = load i64, ptr %8, align 8, !tbaa !5
  %79 = icmp slt i64 %77, %78
  br label %80

80:                                               ; preds = %76, %72
  %81 = phi i1 [ true, %72 ], [ %79, %76 ]
  br i1 %81, label %82, label %172

82:                                               ; preds = %80
  %83 = load i64, ptr %14, align 8, !tbaa !5
  %84 = load i64, ptr %15, align 8, !tbaa !5
  %85 = icmp eq i64 %83, %84
  br i1 %85, label %86, label %105

86:                                               ; preds = %82
  %87 = load i64, ptr %12, align 8, !tbaa !5
  %88 = load i64, ptr %2, align 8, !tbaa !5
  %89 = icmp slt i64 %87, %88
  br i1 %89, label %90, label %105

90:                                               ; preds = %86
  %91 = load i64, ptr %13, align 8, !tbaa !5
  %92 = load i64, ptr %8, align 8, !tbaa !5
  %93 = icmp slt i64 %91, %92
  br i1 %93, label %94, label %105

94:                                               ; preds = %90
  %95 = load i64, ptr %12, align 8, !tbaa !5
  %96 = add nsw i64 %95, 1
  store i64 %96, ptr %12, align 8, !tbaa !5
  %97 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %95) #5
  %98 = load i64, ptr %97, align 8, !tbaa !5
  store i64 %98, ptr %14, align 8, !tbaa !5
  %99 = load i64, ptr %13, align 8, !tbaa !5
  %100 = add nsw i64 %99, 1
  store i64 %100, ptr %13, align 8, !tbaa !5
  %101 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %99) #5
  %102 = load i64, ptr %101, align 8, !tbaa !5
  store i64 %102, ptr %15, align 8, !tbaa !5
  %103 = load i64, ptr %16, align 8, !tbaa !5
  %104 = add nsw i64 %103, 1
  store i64 %104, ptr %16, align 8, !tbaa !5
  br label %171

105:                                              ; preds = %90, %86, %82
  %106 = load i64, ptr %14, align 8, !tbaa !5
  %107 = load i64, ptr %15, align 8, !tbaa !5
  %108 = icmp eq i64 %106, %107
  br i1 %108, label %109, label %118

109:                                              ; preds = %105
  %110 = load i64, ptr %12, align 8, !tbaa !5
  %111 = load i64, ptr %2, align 8, !tbaa !5
  %112 = icmp sge i64 %110, %111
  br i1 %112, label %117, label %113

113:                                              ; preds = %109
  %114 = load i64, ptr %13, align 8, !tbaa !5
  %115 = load i64, ptr %8, align 8, !tbaa !5
  %116 = icmp sge i64 %114, %115
  br i1 %116, label %117, label %118

117:                                              ; preds = %113, %109
  br label %172

118:                                              ; preds = %113, %105
  %119 = load i64, ptr %14, align 8, !tbaa !5
  %120 = load i64, ptr %15, align 8, !tbaa !5
  %121 = icmp slt i64 %119, %120
  br i1 %121, label %122, label %133

122:                                              ; preds = %118
  %123 = load i64, ptr %12, align 8, !tbaa !5
  %124 = load i64, ptr %2, align 8, !tbaa !5
  %125 = icmp slt i64 %123, %124
  br i1 %125, label %126, label %133

126:                                              ; preds = %122
  %127 = load i64, ptr %12, align 8, !tbaa !5
  %128 = add nsw i64 %127, 1
  store i64 %128, ptr %12, align 8, !tbaa !5
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %127) #5
  %130 = load i64, ptr %129, align 8, !tbaa !5
  %131 = load i64, ptr %14, align 8, !tbaa !5
  %132 = add nsw i64 %131, %130
  store i64 %132, ptr %14, align 8, !tbaa !5
  br label %169

133:                                              ; preds = %122, %118
  %134 = load i64, ptr %14, align 8, !tbaa !5
  %135 = load i64, ptr %15, align 8, !tbaa !5
  %136 = icmp slt i64 %134, %135
  br i1 %136, label %137, label %142

137:                                              ; preds = %133
  %138 = load i64, ptr %12, align 8, !tbaa !5
  %139 = load i64, ptr %2, align 8, !tbaa !5
  %140 = icmp sge i64 %138, %139
  br i1 %140, label %141, label %142

141:                                              ; preds = %137
  br label %172

142:                                              ; preds = %137, %133
  %143 = load i64, ptr %15, align 8, !tbaa !5
  %144 = load i64, ptr %14, align 8, !tbaa !5
  %145 = icmp slt i64 %143, %144
  br i1 %145, label %146, label %157

146:                                              ; preds = %142
  %147 = load i64, ptr %13, align 8, !tbaa !5
  %148 = load i64, ptr %8, align 8, !tbaa !5
  %149 = icmp slt i64 %147, %148
  br i1 %149, label %150, label %157

150:                                              ; preds = %146
  %151 = load i64, ptr %13, align 8, !tbaa !5
  %152 = add nsw i64 %151, 1
  store i64 %152, ptr %13, align 8, !tbaa !5
  %153 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %151) #5
  %154 = load i64, ptr %153, align 8, !tbaa !5
  %155 = load i64, ptr %15, align 8, !tbaa !5
  %156 = add nsw i64 %155, %154
  store i64 %156, ptr %15, align 8, !tbaa !5
  br label %167

157:                                              ; preds = %146, %142
  %158 = load i64, ptr %15, align 8, !tbaa !5
  %159 = load i64, ptr %14, align 8, !tbaa !5
  %160 = icmp slt i64 %158, %159
  br i1 %160, label %161, label %166

161:                                              ; preds = %157
  %162 = load i64, ptr %13, align 8, !tbaa !5
  %163 = load i64, ptr %8, align 8, !tbaa !5
  %164 = icmp sge i64 %162, %163
  br i1 %164, label %165, label %166

165:                                              ; preds = %161
  br label %172

166:                                              ; preds = %161, %157
  br label %167

167:                                              ; preds = %166, %150
  br label %168

168:                                              ; preds = %167
  br label %169

169:                                              ; preds = %168, %126
  br label %170

170:                                              ; preds = %169
  br label %171

171:                                              ; preds = %170, %94
  br label %72, !llvm.loop !12

172:                                              ; preds = %165, %141, %117, %80
  %173 = load i64, ptr %12, align 8, !tbaa !5
  %174 = load i64, ptr %2, align 8, !tbaa !5
  %175 = icmp slt i64 %173, %174
  br i1 %175, label %184, label %176

176:                                              ; preds = %172
  %177 = load i64, ptr %13, align 8, !tbaa !5
  %178 = load i64, ptr %8, align 8, !tbaa !5
  %179 = icmp slt i64 %177, %178
  br i1 %179, label %184, label %180

180:                                              ; preds = %176
  %181 = load i64, ptr %14, align 8, !tbaa !5
  %182 = load i64, ptr %15, align 8, !tbaa !5
  %183 = icmp ne i64 %181, %182
  br i1 %183, label %184, label %185

184:                                              ; preds = %180, %176, %172
  store i64 -1, ptr %16, align 8, !tbaa !5
  br label %185

185:                                              ; preds = %184, %180
  %186 = load i64, ptr %16, align 8, !tbaa !5
  %187 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %186)
          to label %188 unwind label %190

188:                                              ; preds = %185
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  %189 = load i32, ptr %1, align 4
  ret i32 %189

190:                                              ; preds = %185
  %191 = landingpad { ptr, i32 }
          cleanup
  %192 = extractvalue { ptr, i32 } %191, 0
  store ptr %192, ptr %5, align 8
  %193 = extractvalue { ptr, i32 } %191, 1
  store i32 %193, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %194

194:                                              ; preds = %190, %67
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #5
  br label %195

195:                                              ; preds = %194, %55
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #5
  br label %196

196:                                              ; preds = %195, %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %197

197:                                              ; preds = %196, %37
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #5
  br label %198

198:                                              ; preds = %197, %25
  call void @llvm.lifetime.end.p0(i64 24, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  br label %199

199:                                              ; preds = %198
  %200 = load ptr, ptr %5, align 8
  %201 = load i32, ptr %6, align 4
  %202 = insertvalue { ptr, i32 } poison, ptr %200, 0
  %203 = insertvalue { ptr, i32 } %202, i32 %201, 1
  resume { ptr, i32 } %203
}

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

declare i32 @__isoc99_scanf(ptr noundef, ...) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIxEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

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

declare i32 @__gxx_personality_v0(...)

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

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

declare i32 @printf(ptr noundef, ...) #2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

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


; 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::allocator" = type { i8 }

@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca %"class.std::vector", align 8
  %3 = alloca %"class.std::allocator", align 1
  %4 = alloca i64, align 8
  %5 = alloca %"class.std::vector", align 8
  %6 = alloca %"class.std::allocator", align 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #5
  %8 = load i64, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #5
  call void @_ZNSaIxEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  invoke void @_ZNSt6vectorIxSaIxEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %8, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %9 unwind label %14

9:                                                ; preds = %0
  call void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #5
  %10 = load i64, ptr %1, align 8, !tbaa !5
  %11 = icmp sgt i64 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %4)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #5
  %13 = load i64, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #5
  call void @_ZNSaIxEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #5
  invoke void @_ZNSt6vectorIxSaIxEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %13, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %21 unwind label %29

14:                                               ; preds = %0
  %15 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #5
  br label %71

.lr.ph:                                           ; preds = %9, %.lr.ph
  %.05175 = phi i64 [ %18, %.lr.ph ], [ 0, %9 ]
  %16 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.05175) #5
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %16)
  %18 = add nuw nsw i64 %.05175, 1
  %19 = load i64, ptr %1, align 8, !tbaa !5
  %20 = icmp slt i64 %18, %19
  br i1 %20, label %.lr.ph, label %._crit_edge, !llvm.loop !9

21:                                               ; preds = %._crit_edge
  call void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #5
  %22 = load i64, ptr %4, align 8
  %23 = icmp sgt i64 %22, 0
  br i1 %23, label %.lr.ph78, label %.preheader

.preheader.loopexit:                              ; preds = %.lr.ph78
  %24 = icmp sgt i64 %34, 0
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %21
  %25 = phi i1 [ %24, %.preheader.loopexit ], [ false, %21 ]
  %26 = load i64, ptr %1, align 8
  %27 = icmp sgt i64 %26, 0
  %28 = or i1 %27, %25
  br i1 %28, label %.lr.ph84, label %._crit_edge85

29:                                               ; preds = %._crit_edge
  %30 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  br label %71

.lr.ph78:                                         ; preds = %21, %.lr.ph78
  %.05076 = phi i64 [ %33, %.lr.ph78 ], [ 0, %21 ]
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %.05076) #5
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %31)
  %33 = add nuw nsw i64 %.05076, 1
  %34 = load i64, ptr %4, align 8
  %35 = icmp slt i64 %33, %34
  br i1 %35, label %.lr.ph78, label %.preheader.loopexit, !llvm.loop !11

.lr.ph84:                                         ; preds = %.preheader, %64
  %36 = phi i1 [ %68, %64 ], [ %25, %.preheader ]
  %37 = phi i1 [ %66, %64 ], [ %27, %.preheader ]
  %.083 = phi i64 [ %.1, %64 ], [ 0, %.preheader ]
  %.04282 = phi i64 [ %.143, %64 ], [ 0, %.preheader ]
  %.04481 = phi i64 [ %.145, %64 ], [ 0, %.preheader ]
  %.04680 = phi i64 [ %.147, %64 ], [ 0, %.preheader ]
  %.04879 = phi i64 [ %.149, %64 ], [ 0, %.preheader ]
  %38 = icmp ne i64 %.04481, %.04282
  %.not60 = xor i1 %37, true
  %brmerge = or i1 %38, %.not60
  %.not61 = xor i1 %36, true
  %brmerge62 = select i1 %brmerge, i1 true, i1 %.not61
  br i1 %brmerge62, label %47, label %39

39:                                               ; preds = %.lr.ph84
  %40 = add nsw i64 %.04879, 1
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.04879) #5
  %42 = load i64, ptr %41, align 8, !tbaa !5
  %43 = add nsw i64 %.04680, 1
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %.04680) #5
  %45 = load i64, ptr %44, align 8, !tbaa !5
  %46 = add nsw i64 %.083, 1
  br label %64

47:                                               ; preds = %.lr.ph84
  %or.cond = select i1 %37, i1 %36, i1 false
  %or.cond74 = select i1 %38, i1 true, i1 %or.cond
  br i1 %or.cond74, label %48, label %._crit_edge85

48:                                               ; preds = %47
  %49 = icmp slt i64 %.04481, %.04282
  %or.cond64 = and i1 %49, %37
  br i1 %or.cond64, label %50, label %55

50:                                               ; preds = %48
  %51 = add nsw i64 %.04879, 1
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.04879) #5
  %53 = load i64, ptr %52, align 8, !tbaa !5
  %54 = add nsw i64 %53, %.04481
  br label %64

55:                                               ; preds = %48
  %.not65 = xor i1 %49, true
  %or.cond66 = or i1 %37, %.not65
  br i1 %or.cond66, label %56, label %._crit_edge85

56:                                               ; preds = %55
  %57 = icmp slt i64 %.04282, %.04481
  %or.cond68 = select i1 %57, i1 %36, i1 false
  br i1 %or.cond68, label %58, label %63

58:                                               ; preds = %56
  %59 = add nsw i64 %.04680, 1
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %.04680) #5
  %61 = load i64, ptr %60, align 8, !tbaa !5
  %62 = add nsw i64 %61, %.04282
  br label %64

63:                                               ; preds = %56
  %.not69 = xor i1 %57, true
  %or.cond70 = select i1 %.not69, i1 true, i1 %36
  br i1 %or.cond70, label %64, label %._crit_edge85

64:                                               ; preds = %63, %58, %50, %39
  %.149 = phi i64 [ %40, %39 ], [ %51, %50 ], [ %.04879, %58 ], [ %.04879, %63 ]
  %.147 = phi i64 [ %43, %39 ], [ %.04680, %50 ], [ %59, %58 ], [ %.04680, %63 ]
  %.145 = phi i64 [ %42, %39 ], [ %54, %50 ], [ %.04481, %58 ], [ %.04481, %63 ]
  %.143 = phi i64 [ %45, %39 ], [ %.04282, %50 ], [ %62, %58 ], [ %.04282, %63 ]
  %.1 = phi i64 [ %46, %39 ], [ %.083, %50 ], [ %.083, %58 ], [ %.083, %63 ]
  %65 = load i64, ptr %1, align 8
  %66 = icmp slt i64 %.149, %65
  %67 = load i64, ptr %4, align 8
  %68 = icmp slt i64 %.147, %67
  %69 = select i1 %66, i1 true, i1 %68
  br i1 %69, label %.lr.ph84, label %._crit_edge85, !llvm.loop !12

._crit_edge85:                                    ; preds = %64, %55, %63, %47, %.preheader
  %.044.lcssa = phi i64 [ 0, %.preheader ], [ %.04282, %47 ], [ %.04481, %63 ], [ %.04481, %55 ], [ %.145, %64 ]
  %.042.lcssa = phi i64 [ 0, %.preheader ], [ %.04282, %47 ], [ %.04282, %63 ], [ %.04282, %55 ], [ %.143, %64 ]
  %.0.lcssa = phi i64 [ 0, %.preheader ], [ %.083, %47 ], [ %.083, %63 ], [ %.083, %55 ], [ %.1, %64 ]
  %.lcssa = phi i1 [ false, %.preheader ], [ true, %47 ], [ true, %63 ], [ true, %55 ], [ false, %64 ]
  %.not58 = icmp ne i64 %.044.lcssa, %.042.lcssa
  %or.cond73.not = select i1 %.lcssa, i1 true, i1 %.not58
  %.2 = select i1 %or.cond73.not, i64 -1, i64 %.0.lcssa
  %70 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %.2)
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret i32 0

71:                                               ; preds = %29, %14
  %.pn = phi { ptr, i32 } [ %30, %29 ], [ %15, %14 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  resume { ptr, i32 } %.pn
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIxEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass