; LLVM IR from DionysiosB/CodeForces :: 0700-0799 (788A-FunctionsAgain)

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

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 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 %"class.std::vector", align 8
  %9 = alloca %"class.std::allocator", align 1
  %10 = alloca i64, align 8
  %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
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  call void @llvm.lifetime.start.p0(i64 24, ptr %3) #5
  %17 = load i64, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #5
  call void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #5
  invoke void @_ZNSt6vectorIlSaIlEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %17, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %18 unwind label %24

18:                                               ; preds = %0
  call void @_ZNSt15__new_allocatorIlED2Ev(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 %19

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

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

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

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

32:                                               ; preds = %28
  br label %33

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

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

40:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #5
  %41 = load i64, ptr %2, align 8, !tbaa !5
  %42 = sub nsw i64 %41, 1
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #5
  call void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #5
  invoke void @_ZNSt6vectorIlSaIlEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %42, ptr noundef nonnull align 1 dereferenceable(1) %9)
          to label %43 unwind label %50

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

44:                                               ; preds = %77, %43
  %45 = load i64, ptr %10, align 8, !tbaa !5
  %46 = load i64, ptr %2, align 8, !tbaa !5
  %47 = sub nsw i64 %46, 1
  %48 = icmp slt i64 %45, %47
  br i1 %48, label %54, label %49

49:                                               ; preds = %44
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %80

50:                                               ; preds = %40
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %5, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %6, align 4
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #5
  br label %207

54:                                               ; preds = %44
  %55 = load i64, ptr %10, align 8, !tbaa !5
  %56 = add nsw i64 %55, 1
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %56) #5
  %58 = load i64, ptr %57, align 8, !tbaa !5
  %59 = load i64, ptr %10, align 8, !tbaa !5
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %59) #5
  %61 = load i64, ptr %60, align 8, !tbaa !5
  %62 = sub nsw i64 %58, %61
  %63 = load i64, ptr %10, align 8, !tbaa !5
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %63) #5
  store i64 %62, ptr %64, align 8, !tbaa !5
  %65 = load i64, ptr %10, align 8, !tbaa !5
  %66 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %65) #5
  %67 = load i64, ptr %66, align 8, !tbaa !5
  %68 = icmp slt i64 %67, 0
  br i1 %68, label %69, label %76

69:                                               ; preds = %54
  %70 = load i64, ptr %10, align 8, !tbaa !5
  %71 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %70) #5
  %72 = load i64, ptr %71, align 8, !tbaa !5
  %73 = sub nsw i64 0, %72
  %74 = load i64, ptr %10, align 8, !tbaa !5
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %74) #5
  store i64 %73, ptr %75, align 8, !tbaa !5
  br label %76

76:                                               ; preds = %69, %54
  br label %77

77:                                               ; preds = %76
  %78 = load i64, ptr %10, align 8, !tbaa !5
  %79 = add nsw i64 %78, 1
  store i64 %79, ptr %10, align 8, !tbaa !5
  br label %44, !llvm.loop !11

80:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store i64 0, ptr %11, align 8, !tbaa !5
  br label %81

81:                                               ; preds = %93, %80
  %82 = load i64, ptr %11, align 8, !tbaa !5
  %83 = load i64, ptr %2, align 8, !tbaa !5
  %84 = sub nsw i64 %83, 1
  %85 = icmp slt i64 %82, %84
  br i1 %85, label %87, label %86

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

87:                                               ; preds = %81
  %88 = load i64, ptr %11, align 8, !tbaa !5
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %88) #5
  %90 = load i64, ptr %89, align 8, !tbaa !5
  %91 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %90)
          to label %92 unwind label %96

92:                                               ; preds = %87
  br label %93

93:                                               ; preds = %92
  %94 = load i64, ptr %11, align 8, !tbaa !5
  %95 = add nsw i64 %94, 1
  store i64 %95, ptr %11, align 8, !tbaa !5
  br label %81, !llvm.loop !12

96:                                               ; preds = %87
  %97 = landingpad { ptr, i32 }
          cleanup
  %98 = extractvalue { ptr, i32 } %97, 0
  store ptr %98, ptr %5, align 8
  %99 = extractvalue { ptr, i32 } %97, 1
  store i32 %99, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %206

100:                                              ; preds = %86
  %101 = invoke i32 @puts(ptr noundef @.str.2)
          to label %102 unwind label %113

102:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %103 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef 0) #5
  %104 = load i64, ptr %103, align 8, !tbaa !5
  store i64 %104, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %105 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef 0) #5
  %106 = load i64, ptr %105, align 8, !tbaa !5
  store i64 %106, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store i64 2, ptr %14, align 8, !tbaa !5
  br label %107

107:                                              ; preds = %144, %102
  %108 = load i64, ptr %14, align 8, !tbaa !5
  %109 = load i64, ptr %2, align 8, !tbaa !5
  %110 = sub nsw i64 %109, 1
  %111 = icmp slt i64 %108, %110
  br i1 %111, label %117, label %112

112:                                              ; preds = %107
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %147

113:                                              ; preds = %100
  %114 = landingpad { ptr, i32 }
          cleanup
  %115 = extractvalue { ptr, i32 } %114, 0
  store ptr %115, ptr %5, align 8
  %116 = extractvalue { ptr, i32 } %114, 1
  store i32 %116, ptr %6, align 4
  br label %206

117:                                              ; preds = %107
  %118 = load i64, ptr %14, align 8, !tbaa !5
  %119 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %118) #5
  %120 = load i64, ptr %119, align 8, !tbaa !5
  %121 = load i64, ptr %14, align 8, !tbaa !5
  %122 = sub nsw i64 %121, 1
  %123 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %122) #5
  %124 = load i64, ptr %123, align 8, !tbaa !5
  %125 = sub nsw i64 %120, %124
  %126 = load i64, ptr %13, align 8, !tbaa !5
  %127 = add nsw i64 %126, %125
  store i64 %127, ptr %13, align 8, !tbaa !5
  %128 = load i64, ptr %13, align 8, !tbaa !5
  %129 = icmp slt i64 %128, 0
  br i1 %129, label %130, label %134

130:                                              ; preds = %117
  %131 = load i64, ptr %14, align 8, !tbaa !5
  %132 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %131) #5
  %133 = load i64, ptr %132, align 8, !tbaa !5
  store i64 %133, ptr %13, align 8, !tbaa !5
  br label %134

134:                                              ; preds = %130, %117
  %135 = load i64, ptr %12, align 8, !tbaa !5
  %136 = load i64, ptr %13, align 8, !tbaa !5
  %137 = icmp sgt i64 %135, %136
  br i1 %137, label %138, label %140

138:                                              ; preds = %134
  %139 = load i64, ptr %12, align 8, !tbaa !5
  br label %142

140:                                              ; preds = %134
  %141 = load i64, ptr %13, align 8, !tbaa !5
  br label %142

142:                                              ; preds = %140, %138
  %143 = phi i64 [ %139, %138 ], [ %141, %140 ]
  store i64 %143, ptr %12, align 8, !tbaa !5
  br label %144

144:                                              ; preds = %142
  %145 = load i64, ptr %14, align 8, !tbaa !5
  %146 = add nsw i64 %145, 2
  store i64 %146, ptr %14, align 8, !tbaa !5
  br label %107, !llvm.loop !13

147:                                              ; preds = %112
  %148 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef 1) #5
  %149 = load i64, ptr %148, align 8, !tbaa !5
  store i64 %149, ptr %13, align 8, !tbaa !5
  %150 = load i64, ptr %12, align 8, !tbaa !5
  %151 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef 1) #5
  %152 = load i64, ptr %151, align 8, !tbaa !5
  %153 = icmp sgt i64 %150, %152
  br i1 %153, label %154, label %156

154:                                              ; preds = %147
  %155 = load i64, ptr %12, align 8, !tbaa !5
  br label %159

156:                                              ; preds = %147
  %157 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef 1) #5
  %158 = load i64, ptr %157, align 8, !tbaa !5
  br label %159

159:                                              ; preds = %156, %154
  %160 = phi i64 [ %155, %154 ], [ %158, %156 ]
  store i64 %160, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  store i64 3, ptr %15, align 8, !tbaa !5
  br label %161

161:                                              ; preds = %194, %159
  %162 = load i64, ptr %15, align 8, !tbaa !5
  %163 = load i64, ptr %2, align 8, !tbaa !5
  %164 = sub nsw i64 %163, 1
  %165 = icmp slt i64 %162, %164
  br i1 %165, label %167, label %166

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

167:                                              ; preds = %161
  %168 = load i64, ptr %15, align 8, !tbaa !5
  %169 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %168) #5
  %170 = load i64, ptr %169, align 8, !tbaa !5
  %171 = load i64, ptr %15, align 8, !tbaa !5
  %172 = sub nsw i64 %171, 1
  %173 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %172) #5
  %174 = load i64, ptr %173, align 8, !tbaa !5
  %175 = sub nsw i64 %170, %174
  %176 = load i64, ptr %13, align 8, !tbaa !5
  %177 = add nsw i64 %176, %175
  store i64 %177, ptr %13, align 8, !tbaa !5
  %178 = load i64, ptr %13, align 8, !tbaa !5
  %179 = icmp slt i64 %178, 0
  br i1 %179, label %180, label %184

180:                                              ; preds = %167
  %181 = load i64, ptr %15, align 8, !tbaa !5
  %182 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %181) #5
  %183 = load i64, ptr %182, align 8, !tbaa !5
  store i64 %183, ptr %13, align 8, !tbaa !5
  br label %184

184:                                              ; preds = %180, %167
  %185 = load i64, ptr %12, align 8, !tbaa !5
  %186 = load i64, ptr %13, align 8, !tbaa !5
  %187 = icmp sgt i64 %185, %186
  br i1 %187, label %188, label %190

188:                                              ; preds = %184
  %189 = load i64, ptr %12, align 8, !tbaa !5
  br label %192

190:                                              ; preds = %184
  %191 = load i64, ptr %13, align 8, !tbaa !5
  br label %192

192:                                              ; preds = %190, %188
  %193 = phi i64 [ %189, %188 ], [ %191, %190 ]
  store i64 %193, ptr %12, align 8, !tbaa !5
  br label %194

194:                                              ; preds = %192
  %195 = load i64, ptr %15, align 8, !tbaa !5
  %196 = add nsw i64 %195, 2
  store i64 %196, ptr %15, align 8, !tbaa !5
  br label %161, !llvm.loop !14

197:                                              ; preds = %166
  %198 = load i64, ptr %12, align 8, !tbaa !5
  %199 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %198)
          to label %200 unwind label %202

200:                                              ; preds = %197
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #5
  call void @_ZNSt6vectorIlSaIlEED2Ev(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
  %201 = load i32, ptr %1, align 4
  ret i32 %201

202:                                              ; preds = %197
  %203 = landingpad { ptr, i32 }
          cleanup
  %204 = extractvalue { ptr, i32 } %203, 0
  store ptr %204, ptr %5, align 8
  %205 = extractvalue { ptr, i32 } %203, 1
  store i32 %205, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %206

206:                                              ; preds = %202, %113, %96
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #5
  br label %207

207:                                              ; preds = %206, %50
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #5
  br label %208

208:                                              ; preds = %207, %36
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #5
  br label %209

209:                                              ; preds = %208, %24
  call void @llvm.lifetime.end.p0(i64 24, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  br label %210

210:                                              ; preds = %209
  %211 = load ptr, ptr %5, align 8
  %212 = load i32, ptr %6, align 4
  %213 = insertvalue { ptr, i32 } poison, ptr %211, 0
  %214 = insertvalue { ptr, i32 } %213, i32 %212, 1
  resume { ptr, i32 } %214
}

; 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 @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

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

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

declare i32 @puts(ptr noundef) #2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIlED2Ev(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", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


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

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 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 %"class.std::vector", align 8
  %5 = alloca %"class.std::allocator", align 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #6
  %7 = load i64, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #6
  call void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #6
  invoke void @_ZNSt6vectorIlSaIlEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %7, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %8 unwind label %12

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

._crit_edge:                                      ; preds = %.lr.ph, %8
  %.lcssa = phi i64 [ %9, %8 ], [ %17, %.lr.ph ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #6
  %11 = add nsw i64 %.lcssa, -1
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #6
  call void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  invoke void @_ZNSt6vectorIlSaIlEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %11, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %19 unwind label %23

12:                                               ; preds = %0
  %13 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #6
  br label %105

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

19:                                               ; preds = %._crit_edge
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #6
  %20 = load i64, ptr %1, align 8, !tbaa !5
  %21 = icmp sgt i64 %20, 1
  br i1 %21, label %.lr.ph56, label %._crit_edge59

.preheader:                                       ; preds = %40
  %22 = icmp sgt i64 %41, 1
  br i1 %22, label %.lr.ph58, label %._crit_edge59

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

.lr.ph56:                                         ; preds = %19, %40
  %.04654 = phi i64 [ %25, %40 ], [ 0, %19 ]
  %25 = add nuw nsw i64 %.04654, 1
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %25) #6
  %27 = load i64, ptr %26, align 8, !tbaa !5
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.04654) #6
  %29 = load i64, ptr %28, align 8, !tbaa !5
  %30 = sub nsw i64 %27, %29
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %.04654) #6
  store i64 %30, ptr %31, align 8, !tbaa !5
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %.04654) #6
  %33 = load i64, ptr %32, align 8, !tbaa !5
  %34 = icmp slt i64 %33, 0
  br i1 %34, label %35, label %40

35:                                               ; preds = %.lr.ph56
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %.04654) #6
  %37 = load i64, ptr %36, align 8, !tbaa !5
  %38 = sub nsw i64 0, %37
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %.04654) #6
  store i64 %38, ptr %39, align 8, !tbaa !5
  br label %40

40:                                               ; preds = %.lr.ph56, %35
  %41 = load i64, ptr %1, align 8, !tbaa !5
  %42 = add nsw i64 %41, -1
  %43 = icmp slt i64 %25, %42
  br i1 %43, label %.lr.ph56, label %.preheader, !llvm.loop !11

._crit_edge59:                                    ; preds = %.lr.ph58, %19, %.preheader
  %44 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef 0) #6
  %46 = load i64, ptr %45, align 8, !tbaa !5
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef 0) #6
  %48 = load i64, ptr %1, align 8, !tbaa !5
  %49 = icmp sgt i64 %48, 3
  br i1 %49, label %.lr.ph64.preheader, label %._crit_edge65

.lr.ph64.preheader:                               ; preds = %._crit_edge59
  %50 = load i64, ptr %47, align 8, !tbaa !5
  br label %.lr.ph64

.lr.ph58:                                         ; preds = %.preheader, %.lr.ph58
  %.04557 = phi i64 [ %54, %.lr.ph58 ], [ 0, %.preheader ]
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %.04557) #6
  %52 = load i64, ptr %51, align 8, !tbaa !5
  %53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %52)
  %54 = add nuw nsw i64 %.04557, 1
  %55 = load i64, ptr %1, align 8, !tbaa !5
  %56 = add nsw i64 %55, -1
  %57 = icmp slt i64 %54, %56
  br i1 %57, label %.lr.ph58, label %._crit_edge59, !llvm.loop !12

._crit_edge65:                                    ; preds = %74, %._crit_edge59
  %.043.lcssa = phi i64 [ %46, %._crit_edge59 ], [ %75, %74 ]
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef 1) #6
  %59 = load i64, ptr %58, align 8, !tbaa !5
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef 1) #6
  %61 = load i64, ptr %60, align 8, !tbaa !5
  %62 = icmp sgt i64 %.043.lcssa, %61
  br i1 %62, label %83, label %80

.lr.ph64:                                         ; preds = %.lr.ph64.preheader, %74
  %.04162 = phi i64 [ %76, %74 ], [ 2, %.lr.ph64.preheader ]
  %.04261 = phi i64 [ %.1, %74 ], [ %50, %.lr.ph64.preheader ]
  %.04360 = phi i64 [ %75, %74 ], [ %46, %.lr.ph64.preheader ]
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %.04162) #6
  %64 = load i64, ptr %63, align 8, !tbaa !5
  %65 = add nsw i64 %.04162, -1
  %66 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %65) #6
  %67 = load i64, ptr %66, align 8, !tbaa !5
  %68 = sub nsw i64 %64, %67
  %69 = add nsw i64 %68, %.04261
  %70 = icmp slt i64 %69, 0
  br i1 %70, label %71, label %74

71:                                               ; preds = %.lr.ph64
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %.04162) #6
  %73 = load i64, ptr %72, align 8, !tbaa !5
  br label %74

74:                                               ; preds = %71, %.lr.ph64
  %.1 = phi i64 [ %73, %71 ], [ %69, %.lr.ph64 ]
  %75 = call i64 @llvm.smax.i64(i64 %.04360, i64 %.1)
  %76 = add nuw nsw i64 %.04162, 2
  %77 = load i64, ptr %1, align 8, !tbaa !5
  %78 = add nsw i64 %77, -1
  %79 = icmp slt i64 %76, %78
  br i1 %79, label %.lr.ph64, label %._crit_edge65, !llvm.loop !13

80:                                               ; preds = %._crit_edge65
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef 1) #6
  %82 = load i64, ptr %81, align 8, !tbaa !5
  br label %83

83:                                               ; preds = %._crit_edge65, %80
  %84 = phi i64 [ %82, %80 ], [ %.043.lcssa, %._crit_edge65 ]
  %85 = load i64, ptr %1, align 8, !tbaa !5
  %86 = icmp sgt i64 %85, 4
  br i1 %86, label %.lr.ph71, label %._crit_edge72

._crit_edge72:                                    ; preds = %99, %83
  %.144.lcssa = phi i64 [ %84, %83 ], [ %100, %99 ]
  %87 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %.144.lcssa)
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret i32 0

.lr.ph71:                                         ; preds = %83, %99
  %.069 = phi i64 [ %101, %99 ], [ 3, %83 ]
  %.268 = phi i64 [ %.3, %99 ], [ %59, %83 ]
  %.14467 = phi i64 [ %100, %99 ], [ %84, %83 ]
  %88 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %.069) #6
  %89 = load i64, ptr %88, align 8, !tbaa !5
  %90 = add nsw i64 %.069, -1
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %90) #6
  %92 = load i64, ptr %91, align 8, !tbaa !5
  %93 = sub nsw i64 %89, %92
  %94 = add nsw i64 %93, %.268
  %95 = icmp slt i64 %94, 0
  br i1 %95, label %96, label %99

96:                                               ; preds = %.lr.ph71
  %97 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %.069) #6
  %98 = load i64, ptr %97, align 8, !tbaa !5
  br label %99

99:                                               ; preds = %96, %.lr.ph71
  %.3 = phi i64 [ %98, %96 ], [ %94, %.lr.ph71 ]
  %100 = call i64 @llvm.smax.i64(i64 %.14467, i64 %.3)
  %101 = add nuw nsw i64 %.069, 2
  %102 = load i64, ptr %1, align 8, !tbaa !5
  %103 = add nsw i64 %102, -1
  %104 = icmp slt i64 %101, %103
  br i1 %104, label %.lr.ph71, label %._crit_edge72, !llvm.loop !14

105:                                              ; preds = %23, %12
  %.pn = phi { ptr, i32 } [ %24, %23 ], [ %13, %12 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  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 @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIlSaIlEEC2EmRKS0_(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 @_ZNSt6vectorIlSaIlEEixEm(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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #5

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


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