; LLVM IR from DionysiosB/CodeForces :: 1300-1399 (1301B-MotaracksBirthday)

; 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 [9 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 i64, align 8
  %4 = alloca %"class.std::vector", align 8
  %5 = alloca %"class.std::allocator", align 1
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %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)
  br label %17

17:                                               ; preds = %208, %0
  %18 = load i64, ptr %2, align 8, !tbaa !5
  %19 = add nsw i64 %18, -1
  store i64 %19, ptr %2, align 8, !tbaa !5
  %20 = icmp ne i64 %18, 0
  br i1 %20, label %21, label %215

21:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #5
  %23 = load i64, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #5
  call void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  invoke void @_ZNSt6vectorIlSaIlEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %23, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %24 unwind label %30

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

25:                                               ; preds = %39, %24
  %26 = load i64, ptr %8, align 8, !tbaa !5
  %27 = load i64, ptr %3, align 8, !tbaa !5
  %28 = icmp slt i64 %26, %27
  br i1 %28, label %34, label %29

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

30:                                               ; preds = %21
  %31 = landingpad { ptr, i32 }
          cleanup
  %32 = extractvalue { ptr, i32 } %31, 0
  store ptr %32, ptr %6, align 8
  %33 = extractvalue { ptr, i32 } %31, 1
  store i32 %33, ptr %7, align 4
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #5
  br label %214

34:                                               ; preds = %25
  %35 = load i64, ptr %8, align 8, !tbaa !5
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %35) #5
  %37 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %36)
          to label %38 unwind label %42

38:                                               ; preds = %34
  br label %39

39:                                               ; preds = %38
  %40 = load i64, ptr %8, align 8, !tbaa !5
  %41 = add nsw i64 %40, 1
  store i64 %41, ptr %8, align 8, !tbaa !5
  br label %25, !llvm.loop !9

42:                                               ; preds = %34
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %6, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %213

46:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store i64 2000000000, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %47 = load i64, ptr %9, align 8, !tbaa !5
  %48 = sub nsw i64 0, %47
  store i64 %48, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store i64 0, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store i64 0, ptr %12, align 8, !tbaa !5
  br label %49

49:                                               ; preds = %185, %46
  %50 = load i64, ptr %12, align 8, !tbaa !5
  %51 = load i64, ptr %3, align 8, !tbaa !5
  %52 = icmp slt i64 %50, %51
  br i1 %52, label %54, label %53

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

54:                                               ; preds = %49
  %55 = load i64, ptr %12, align 8, !tbaa !5
  %56 = icmp sgt i64 %55, 0
  br i1 %56, label %57, label %99

57:                                               ; preds = %54
  %58 = load i64, ptr %12, align 8, !tbaa !5
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %58) #5
  %60 = load i64, ptr %59, align 8, !tbaa !5
  %61 = icmp slt i64 %60, 0
  br i1 %61, label %62, label %99

62:                                               ; preds = %57
  %63 = load i64, ptr %12, align 8, !tbaa !5
  %64 = sub nsw i64 %63, 1
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %64) #5
  %66 = load i64, ptr %65, align 8, !tbaa !5
  %67 = icmp sge i64 %66, 0
  br i1 %67, label %68, label %99

68:                                               ; preds = %62
  %69 = load i64, ptr %9, align 8, !tbaa !5
  %70 = load i64, ptr %12, align 8, !tbaa !5
  %71 = sub nsw i64 %70, 1
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %71) #5
  %73 = load i64, ptr %72, align 8, !tbaa !5
  %74 = icmp slt i64 %69, %73
  br i1 %74, label %75, label %77

75:                                               ; preds = %68
  %76 = load i64, ptr %9, align 8, !tbaa !5
  br label %82

77:                                               ; preds = %68
  %78 = load i64, ptr %12, align 8, !tbaa !5
  %79 = sub nsw i64 %78, 1
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %79) #5
  %81 = load i64, ptr %80, align 8, !tbaa !5
  br label %82

82:                                               ; preds = %77, %75
  %83 = phi i64 [ %76, %75 ], [ %81, %77 ]
  store i64 %83, ptr %9, align 8, !tbaa !5
  %84 = load i64, ptr %10, align 8, !tbaa !5
  %85 = load i64, ptr %12, align 8, !tbaa !5
  %86 = sub nsw i64 %85, 1
  %87 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %86) #5
  %88 = load i64, ptr %87, align 8, !tbaa !5
  %89 = icmp sgt i64 %84, %88
  br i1 %89, label %90, label %92

90:                                               ; preds = %82
  %91 = load i64, ptr %10, align 8, !tbaa !5
  br label %97

92:                                               ; preds = %82
  %93 = load i64, ptr %12, align 8, !tbaa !5
  %94 = sub nsw i64 %93, 1
  %95 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %94) #5
  %96 = load i64, ptr %95, align 8, !tbaa !5
  br label %97

97:                                               ; preds = %92, %90
  %98 = phi i64 [ %91, %90 ], [ %96, %92 ]
  store i64 %98, ptr %10, align 8, !tbaa !5
  br label %99

99:                                               ; preds = %97, %62, %57, %54
  %100 = load i64, ptr %12, align 8, !tbaa !5
  %101 = add nsw i64 %100, 1
  %102 = load i64, ptr %3, align 8, !tbaa !5
  %103 = icmp slt i64 %101, %102
  br i1 %103, label %104, label %146

104:                                              ; preds = %99
  %105 = load i64, ptr %12, align 8, !tbaa !5
  %106 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %105) #5
  %107 = load i64, ptr %106, align 8, !tbaa !5
  %108 = icmp slt i64 %107, 0
  br i1 %108, label %109, label %146

109:                                              ; preds = %104
  %110 = load i64, ptr %12, align 8, !tbaa !5
  %111 = add nsw i64 %110, 1
  %112 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %111) #5
  %113 = load i64, ptr %112, align 8, !tbaa !5
  %114 = icmp sge i64 %113, 0
  br i1 %114, label %115, label %146

115:                                              ; preds = %109
  %116 = load i64, ptr %9, align 8, !tbaa !5
  %117 = load i64, ptr %12, align 8, !tbaa !5
  %118 = add nsw i64 %117, 1
  %119 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %118) #5
  %120 = load i64, ptr %119, align 8, !tbaa !5
  %121 = icmp slt i64 %116, %120
  br i1 %121, label %122, label %124

122:                                              ; preds = %115
  %123 = load i64, ptr %9, align 8, !tbaa !5
  br label %129

124:                                              ; preds = %115
  %125 = load i64, ptr %12, align 8, !tbaa !5
  %126 = add nsw i64 %125, 1
  %127 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %126) #5
  %128 = load i64, ptr %127, align 8, !tbaa !5
  br label %129

129:                                              ; preds = %124, %122
  %130 = phi i64 [ %123, %122 ], [ %128, %124 ]
  store i64 %130, ptr %9, align 8, !tbaa !5
  %131 = load i64, ptr %10, align 8, !tbaa !5
  %132 = load i64, ptr %12, align 8, !tbaa !5
  %133 = add nsw i64 %132, 1
  %134 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %133) #5
  %135 = load i64, ptr %134, align 8, !tbaa !5
  %136 = icmp sgt i64 %131, %135
  br i1 %136, label %137, label %139

137:                                              ; preds = %129
  %138 = load i64, ptr %10, align 8, !tbaa !5
  br label %144

139:                                              ; preds = %129
  %140 = load i64, ptr %12, align 8, !tbaa !5
  %141 = add nsw i64 %140, 1
  %142 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %141) #5
  %143 = load i64, ptr %142, align 8, !tbaa !5
  br label %144

144:                                              ; preds = %139, %137
  %145 = phi i64 [ %138, %137 ], [ %143, %139 ]
  store i64 %145, ptr %10, align 8, !tbaa !5
  br label %146

146:                                              ; preds = %144, %109, %104, %99
  %147 = load i64, ptr %12, align 8, !tbaa !5
  %148 = icmp sgt i64 %147, 0
  br i1 %148, label %149, label %184

149:                                              ; preds = %146
  %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) %4, i64 noundef %150) #5
  %152 = load i64, ptr %151, align 8, !tbaa !5
  %153 = icmp sge i64 %152, 0
  br i1 %153, label %154, label %184

154:                                              ; preds = %149
  %155 = load i64, ptr %12, align 8, !tbaa !5
  %156 = sub nsw i64 %155, 1
  %157 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %156) #5
  %158 = load i64, ptr %157, align 8, !tbaa !5
  %159 = icmp sge i64 %158, 0
  br i1 %159, label %160, label %184

160:                                              ; preds = %154
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %161 = load i64, ptr %12, align 8, !tbaa !5
  %162 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %161) #5
  %163 = load i64, ptr %162, align 8, !tbaa !5
  %164 = load i64, ptr %12, align 8, !tbaa !5
  %165 = sub nsw i64 %164, 1
  %166 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %165) #5
  %167 = load i64, ptr %166, align 8, !tbaa !5
  %168 = sub nsw i64 %163, %167
  store i64 %168, ptr %13, align 8, !tbaa !5
  %169 = load i64, ptr %13, align 8, !tbaa !5
  %170 = icmp slt i64 %169, 0
  br i1 %170, label %171, label %174

171:                                              ; preds = %160
  %172 = load i64, ptr %13, align 8, !tbaa !5
  %173 = sub nsw i64 0, %172
  store i64 %173, ptr %13, align 8, !tbaa !5
  br label %174

174:                                              ; preds = %171, %160
  %175 = load i64, ptr %13, align 8, !tbaa !5
  %176 = load i64, ptr %11, align 8, !tbaa !5
  %177 = icmp sgt i64 %175, %176
  br i1 %177, label %178, label %180

178:                                              ; preds = %174
  %179 = load i64, ptr %13, align 8, !tbaa !5
  br label %182

180:                                              ; preds = %174
  %181 = load i64, ptr %11, align 8, !tbaa !5
  br label %182

182:                                              ; preds = %180, %178
  %183 = phi i64 [ %179, %178 ], [ %181, %180 ]
  store i64 %183, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %184

184:                                              ; preds = %182, %154, %149, %146
  br label %185

185:                                              ; preds = %184
  %186 = load i64, ptr %12, align 8, !tbaa !5
  %187 = add nsw i64 %186, 1
  store i64 %187, ptr %12, align 8, !tbaa !5
  br label %49, !llvm.loop !11

188:                                              ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %189 = load i64, ptr %9, align 8, !tbaa !5
  %190 = load i64, ptr %10, align 8, !tbaa !5
  %191 = add nsw i64 %189, %190
  %192 = sdiv i64 %191, 2
  store i64 %192, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %193 = load i64, ptr %10, align 8, !tbaa !5
  %194 = load i64, ptr %14, align 8, !tbaa !5
  %195 = sub nsw i64 %193, %194
  store i64 %195, ptr %15, align 8, !tbaa !5
  %196 = load i64, ptr %11, align 8, !tbaa !5
  %197 = load i64, ptr %15, align 8, !tbaa !5
  %198 = icmp sgt i64 %196, %197
  br i1 %198, label %199, label %201

199:                                              ; preds = %188
  %200 = load i64, ptr %11, align 8, !tbaa !5
  br label %203

201:                                              ; preds = %188
  %202 = load i64, ptr %15, align 8, !tbaa !5
  br label %203

203:                                              ; preds = %201, %199
  %204 = phi i64 [ %200, %199 ], [ %202, %201 ]
  store i64 %204, ptr %11, align 8, !tbaa !5
  %205 = load i64, ptr %11, align 8, !tbaa !5
  %206 = load i64, ptr %14, align 8, !tbaa !5
  %207 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %205, i64 noundef %206)
          to label %208 unwind label %209

208:                                              ; preds = %203
  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 %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  br label %17, !llvm.loop !12

209:                                              ; preds = %203
  %210 = landingpad { ptr, i32 }
          cleanup
  %211 = extractvalue { ptr, i32 } %210, 0
  store ptr %211, ptr %6, align 8
  %212 = extractvalue { ptr, i32 } %210, 1
  store i32 %212, ptr %7, align 4
  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 %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %213

213:                                              ; preds = %209, %42
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  br label %214

214:                                              ; preds = %213, %30
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  br label %216

215:                                              ; preds = %17
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  ret i32 0

216:                                              ; preds = %214
  %217 = load ptr, ptr %6, align 8
  %218 = load i32, ptr %7, align 4
  %219 = insertvalue { ptr, i32 } poison, ptr %217, 0
  %220 = insertvalue { ptr, i32 } %219, i32 %218, 1
  resume { ptr, i32 } %220
}

; 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

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


; 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 [9 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 i64, align 8
  %3 = alloca %"class.std::vector", align 8
  %4 = alloca %"class.std::allocator", align 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %6 = load i64, ptr %1, align 8, !tbaa !5
  %7 = add nsw i64 %6, -1
  store i64 %7, ptr %1, align 8, !tbaa !5
  %.not70 = icmp eq i64 %6, 0
  br i1 %.not70, label %._crit_edge73, label %.lr.ph72

.lr.ph72:                                         ; preds = %0, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  %9 = load i64, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  invoke void @_ZNSt6vectorIlSaIlEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %9, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %10 unwind label %38

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

.preheader:                                       ; preds = %.lr.ph
  %13 = icmp sgt i64 %43, 0
  br i1 %13, label %.lr.ph67.preheader, label %._crit_edge

.lr.ph67.preheader:                               ; preds = %.preheader
  %.not82 = icmp eq i64 %43, 1
  br i1 %.not82, label %._crit_edge80, label %14

14:                                               ; preds = %.lr.ph67.preheader
  %15 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 0) #6
  %16 = load i64, ptr %15, align 8, !tbaa !5
  %17 = icmp slt i64 %16, 0
  br i1 %17, label %18, label %._crit_edge80

18:                                               ; preds = %14
  %19 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 1) #6
  %20 = load i64, ptr %19, align 8, !tbaa !5
  %21 = icmp sgt i64 %20, -1
  br i1 %21, label %22, label %._crit_edge80

22:                                               ; preds = %18
  %23 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 1) #6
  %24 = load i64, ptr %23, align 8, !tbaa !5
  %25 = icmp sgt i64 %24, 2000000000
  br i1 %25, label %29, label %26

26:                                               ; preds = %22
  %27 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 1) #6
  %28 = load i64, ptr %27, align 8, !tbaa !5
  br label %29

29:                                               ; preds = %26, %22
  %30 = phi i64 [ %28, %26 ], [ 2000000000, %22 ]
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 1) #6
  %32 = load i64, ptr %31, align 8, !tbaa !5
  %33 = icmp slt i64 %32, -2000000000
  br i1 %33, label %._crit_edge80, label %34

34:                                               ; preds = %29
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 1) #6
  %36 = load i64, ptr %35, align 8, !tbaa !5
  br label %._crit_edge80

._crit_edge80:                                    ; preds = %34, %29, %18, %14, %.lr.ph67.preheader
  %.257.peel = phi i64 [ -2000000000, %18 ], [ -2000000000, %14 ], [ -2000000000, %.lr.ph67.preheader ], [ %36, %34 ], [ -2000000000, %29 ]
  %.2.peel = phi i64 [ 2000000000, %18 ], [ 2000000000, %14 ], [ 2000000000, %.lr.ph67.preheader ], [ %30, %34 ], [ %30, %29 ]
  %.pre = load i64, ptr %2, align 8, !tbaa !5
  %37 = icmp sgt i64 %.pre, 1
  br i1 %37, label %.lr.ph67.peel.next, label %._crit_edge

38:                                               ; preds = %.lr.ph72
  %39 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  resume { ptr, i32 } %39

.lr.ph:                                           ; preds = %10, %.lr.ph
  %.062 = phi i64 [ %42, %.lr.ph ], [ 0, %10 ]
  %40 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.062) #6
  %41 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %40)
  %42 = add nuw nsw i64 %.062, 1
  %43 = load i64, ptr %2, align 8, !tbaa !5
  %44 = icmp slt i64 %42, %43
  br i1 %44, label %.lr.ph, label %.preheader, !llvm.loop !9

._crit_edge:                                      ; preds = %118, %10, %._crit_edge80, %.preheader
  %.055.lcssa = phi i64 [ -2000000000, %.preheader ], [ %.257.peel, %._crit_edge80 ], [ -2000000000, %10 ], [ %.257, %118 ]
  %.053.lcssa = phi i64 [ 0, %.preheader ], [ 0, %._crit_edge80 ], [ 0, %10 ], [ %.154, %118 ]
  %.050.lcssa = phi i64 [ 2000000000, %.preheader ], [ %.2.peel, %._crit_edge80 ], [ 2000000000, %10 ], [ %.2, %118 ]
  %45 = add nsw i64 %.050.lcssa, %.055.lcssa
  %46 = sdiv i64 %45, 2
  %47 = sub nsw i64 %.055.lcssa, %46
  %48 = call i64 @llvm.smax.i64(i64 %.053.lcssa, i64 %47)
  %49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %48, i64 noundef %46)
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %50 = load i64, ptr %1, align 8, !tbaa !5
  %51 = add nsw i64 %50, -1
  store i64 %51, ptr %1, align 8, !tbaa !5
  %.not = icmp eq i64 %50, 0
  br i1 %.not, label %._crit_edge73, label %.lr.ph72, !llvm.loop !11

.lr.ph67.peel.next:                               ; preds = %._crit_edge80, %118
  %.05066 = phi i64 [ %.2, %118 ], [ %.2.peel, %._crit_edge80 ]
  %.05265 = phi i64 [ %76, %118 ], [ 1, %._crit_edge80 ]
  %.05364 = phi i64 [ %.154, %118 ], [ 0, %._crit_edge80 ]
  %.05563 = phi i64 [ %.257, %118 ], [ %.257.peel, %._crit_edge80 ]
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.05265) #6
  %53 = load i64, ptr %52, align 8, !tbaa !5
  %54 = icmp slt i64 %53, 0
  br i1 %54, label %55, label %75

55:                                               ; preds = %.lr.ph67.peel.next
  %56 = add nsw i64 %.05265, -1
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %56) #6
  %58 = load i64, ptr %57, align 8, !tbaa !5
  %59 = icmp sgt i64 %58, -1
  br i1 %59, label %60, label %75

60:                                               ; preds = %55
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %56) #6
  %62 = load i64, ptr %61, align 8, !tbaa !5
  %63 = icmp slt i64 %.05066, %62
  br i1 %63, label %67, label %64

64:                                               ; preds = %60
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %56) #6
  %66 = load i64, ptr %65, align 8, !tbaa !5
  br label %67

67:                                               ; preds = %60, %64
  %68 = phi i64 [ %66, %64 ], [ %.05066, %60 ]
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %56) #6
  %70 = load i64, ptr %69, align 8, !tbaa !5
  %71 = icmp sgt i64 %.05563, %70
  br i1 %71, label %75, label %72

72:                                               ; preds = %67
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %56) #6
  %74 = load i64, ptr %73, align 8, !tbaa !5
  br label %75

75:                                               ; preds = %72, %67, %55, %.lr.ph67.peel.next
  %.156 = phi i64 [ %.05563, %55 ], [ %.05563, %.lr.ph67.peel.next ], [ %74, %72 ], [ %.05563, %67 ]
  %.1 = phi i64 [ %.05066, %55 ], [ %.05066, %.lr.ph67.peel.next ], [ %68, %72 ], [ %68, %67 ]
  %76 = add nuw nsw i64 %.05265, 1
  %77 = load i64, ptr %2, align 8, !tbaa !5
  %78 = icmp slt i64 %76, %77
  br i1 %78, label %79, label %102

79:                                               ; preds = %75
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.05265) #6
  %81 = load i64, ptr %80, align 8, !tbaa !5
  %82 = icmp slt i64 %81, 0
  br i1 %82, label %83, label %102

83:                                               ; preds = %79
  %84 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %76) #6
  %85 = load i64, ptr %84, align 8, !tbaa !5
  %86 = icmp sgt i64 %85, -1
  br i1 %86, label %87, label %102

87:                                               ; preds = %83
  %88 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %76) #6
  %89 = load i64, ptr %88, align 8, !tbaa !5
  %90 = icmp slt i64 %.1, %89
  br i1 %90, label %94, label %91

91:                                               ; preds = %87
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %76) #6
  %93 = load i64, ptr %92, align 8, !tbaa !5
  br label %94

94:                                               ; preds = %87, %91
  %95 = phi i64 [ %93, %91 ], [ %.1, %87 ]
  %96 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %76) #6
  %97 = load i64, ptr %96, align 8, !tbaa !5
  %98 = icmp sgt i64 %.156, %97
  br i1 %98, label %102, label %99

99:                                               ; preds = %94
  %100 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %76) #6
  %101 = load i64, ptr %100, align 8, !tbaa !5
  br label %102

102:                                              ; preds = %75, %79, %83, %94, %99
  %.257 = phi i64 [ %.156, %83 ], [ %.156, %79 ], [ %.156, %75 ], [ %101, %99 ], [ %.156, %94 ]
  %.2 = phi i64 [ %.1, %83 ], [ %.1, %79 ], [ %.1, %75 ], [ %95, %99 ], [ %95, %94 ]
  %103 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.05265) #6
  %104 = load i64, ptr %103, align 8, !tbaa !5
  %105 = icmp sgt i64 %104, -1
  br i1 %105, label %106, label %118

106:                                              ; preds = %102
  %107 = add nsw i64 %.05265, -1
  %108 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %107) #6
  %109 = load i64, ptr %108, align 8, !tbaa !5
  %110 = icmp sgt i64 %109, -1
  br i1 %110, label %111, label %118

111:                                              ; preds = %106
  %112 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.05265) #6
  %113 = load i64, ptr %112, align 8, !tbaa !5
  %114 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %107) #6
  %115 = load i64, ptr %114, align 8, !tbaa !5
  %116 = sub nsw i64 %113, %115
  %spec.select = call i64 @llvm.abs.i64(i64 %116, i1 true)
  %117 = call i64 @llvm.smax.i64(i64 %spec.select, i64 %.05364)
  br label %118

118:                                              ; preds = %102, %106, %111
  %.154 = phi i64 [ %117, %111 ], [ %.05364, %106 ], [ %.05364, %102 ]
  %119 = load i64, ptr %2, align 8, !tbaa !5
  %120 = icmp slt i64 %76, %119
  br i1 %120, label %.lr.ph67.peel.next, label %._crit_edge, !llvm.loop !12

._crit_edge73:                                    ; preds = %._crit_edge, %0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret i32 0
}

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

; Function Attrs: 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: 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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #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}
!13 = !{!"llvm.loop.peeled.count", i32 1}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopFullUnrollPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SROAPass,SimplifyCFGPass