; LLVM IR from DionysiosB/CodeForces :: 1500-1599 (1530C-Pursuit)

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5checkRKSt6vectorIlSaIlEES3_l(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 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 %"class.std::vector", align 8
  %10 = alloca %"class.std::allocator", align 1
  %11 = alloca i64, align 8
  %12 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca i64, align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %16 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  br label %23

23:                                               ; preds = %161, %0
  %24 = load i64, ptr %2, align 8, !tbaa !5
  %25 = add nsw i64 %24, -1
  store i64 %25, ptr %2, align 8, !tbaa !5
  %26 = icmp ne i64 %24, 0
  br i1 %26, label %27, label %170

27:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  %28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #6
  %29 = load i64, ptr %3, align 8, !tbaa !5
  %30 = add nsw i64 %29, 1
  call void @llvm.lifetime.start.p0(i64 1, ptr %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 %30, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %31 unwind label %37

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

32:                                               ; preds = %46, %31
  %33 = load i64, ptr %8, align 8, !tbaa !5
  %34 = load i64, ptr %3, align 8, !tbaa !5
  %35 = icmp sle i64 %33, %34
  br i1 %35, label %41, label %36

36:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %53

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

41:                                               ; preds = %32
  %42 = load i64, ptr %8, align 8, !tbaa !5
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %42) #6
  %44 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %43)
          to label %45 unwind label %49

45:                                               ; preds = %41
  br label %46

46:                                               ; preds = %45
  %47 = load i64, ptr %8, align 8, !tbaa !5
  %48 = add nsw i64 %47, 1
  store i64 %48, ptr %8, align 8, !tbaa !5
  br label %32, !llvm.loop !9

49:                                               ; preds = %41
  %50 = landingpad { ptr, i32 }
          cleanup
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %6, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %168

53:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #6
  %54 = load i64, ptr %3, align 8, !tbaa !5
  %55 = add nsw i64 %54, 1
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #6
  call void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #6
  invoke void @_ZNSt6vectorIlSaIlEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %55, ptr noundef nonnull align 1 dereferenceable(1) %10)
          to label %56 unwind label %62

56:                                               ; preds = %53
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store i64 1, ptr %11, align 8, !tbaa !5
  br label %57

57:                                               ; preds = %71, %56
  %58 = load i64, ptr %11, align 8, !tbaa !5
  %59 = load i64, ptr %3, align 8, !tbaa !5
  %60 = icmp sle i64 %58, %59
  br i1 %60, label %66, label %61

61:                                               ; preds = %57
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %78

62:                                               ; preds = %53
  %63 = landingpad { ptr, i32 }
          cleanup
  %64 = extractvalue { ptr, i32 } %63, 0
  store ptr %64, ptr %6, align 8
  %65 = extractvalue { ptr, i32 } %63, 1
  store i32 %65, ptr %7, align 4
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #6
  br label %167

66:                                               ; preds = %57
  %67 = load i64, ptr %11, align 8, !tbaa !5
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %67) #6
  %69 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %68)
          to label %70 unwind label %74

70:                                               ; preds = %66
  br label %71

71:                                               ; preds = %70
  %72 = load i64, ptr %11, align 8, !tbaa !5
  %73 = add nsw i64 %72, 1
  store i64 %73, ptr %11, align 8, !tbaa !5
  br label %57, !llvm.loop !11

74:                                               ; preds = %66
  %75 = landingpad { ptr, i32 }
          cleanup
  %76 = extractvalue { ptr, i32 } %75, 0
  store ptr %76, ptr %6, align 8
  %77 = extractvalue { ptr, i32 } %75, 1
  store i32 %77, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %166

78:                                               ; preds = %61
  %79 = call ptr @_ZNSt6vectorIlSaIlEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  %80 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %12, i32 0, i32 0
  store ptr %79, ptr %80, align 8
  %81 = call ptr @_ZNSt6vectorIlSaIlEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  %82 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %81, ptr %82, align 8
  %83 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %12, i32 0, i32 0
  %84 = load ptr, ptr %83, align 8
  %85 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  %86 = load ptr, ptr %85, align 8
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPlSt6vectorIlSaIlEEEEEvT_S7_(ptr %84, ptr %86)
          to label %87 unwind label %93

87:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  store i64 1, ptr %14, align 8, !tbaa !5
  br label %88

88:                                               ; preds = %106, %87
  %89 = load i64, ptr %14, align 8, !tbaa !5
  %90 = load i64, ptr %3, align 8, !tbaa !5
  %91 = icmp sle i64 %89, %90
  br i1 %91, label %97, label %92

92:                                               ; preds = %88
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %109

93:                                               ; preds = %109, %78
  %94 = landingpad { ptr, i32 }
          cleanup
  %95 = extractvalue { ptr, i32 } %94, 0
  store ptr %95, ptr %6, align 8
  %96 = extractvalue { ptr, i32 } %94, 1
  store i32 %96, ptr %7, align 4
  br label %166

97:                                               ; preds = %88
  %98 = load i64, ptr %14, align 8, !tbaa !5
  %99 = sub nsw i64 %98, 1
  %100 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %99) #6
  %101 = load i64, ptr %100, align 8, !tbaa !5
  %102 = load i64, ptr %14, align 8, !tbaa !5
  %103 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %102) #6
  %104 = load i64, ptr %103, align 8, !tbaa !5
  %105 = add nsw i64 %104, %101
  store i64 %105, ptr %103, align 8, !tbaa !5
  br label %106

106:                                              ; preds = %97
  %107 = load i64, ptr %14, align 8, !tbaa !5
  %108 = add nsw i64 %107, 1
  store i64 %108, ptr %14, align 8, !tbaa !5
  br label %88, !llvm.loop !12

109:                                              ; preds = %92
  %110 = call ptr @_ZNSt6vectorIlSaIlEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #6
  %111 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %15, i32 0, i32 0
  store ptr %110, ptr %111, align 8
  %112 = call ptr @_ZNSt6vectorIlSaIlEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #6
  %113 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  store ptr %112, ptr %113, align 8
  %114 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %15, i32 0, i32 0
  %115 = load ptr, ptr %114, align 8
  %116 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  %117 = load ptr, ptr %116, align 8
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPlSt6vectorIlSaIlEEEEEvT_S7_(ptr %115, ptr %117)
          to label %118 unwind label %93

118:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  store i64 1, ptr %17, align 8, !tbaa !5
  br label %119

119:                                              ; preds = %133, %118
  %120 = load i64, ptr %17, align 8, !tbaa !5
  %121 = load i64, ptr %3, align 8, !tbaa !5
  %122 = icmp sle i64 %120, %121
  br i1 %122, label %124, label %123

123:                                              ; preds = %119
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %136

124:                                              ; preds = %119
  %125 = load i64, ptr %17, align 8, !tbaa !5
  %126 = sub nsw i64 %125, 1
  %127 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %126) #6
  %128 = load i64, ptr %127, align 8, !tbaa !5
  %129 = load i64, ptr %17, align 8, !tbaa !5
  %130 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %129) #6
  %131 = load i64, ptr %130, align 8, !tbaa !5
  %132 = add nsw i64 %131, %128
  store i64 %132, ptr %130, align 8, !tbaa !5
  br label %133

133:                                              ; preds = %124
  %134 = load i64, ptr %17, align 8, !tbaa !5
  %135 = add nsw i64 %134, 1
  store i64 %135, ptr %17, align 8, !tbaa !5
  br label %119, !llvm.loop !13

136:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  store i64 0, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %137 = load i64, ptr %3, align 8, !tbaa !5
  %138 = add nsw i64 %137, 1
  store i64 %138, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  store i64 0, ptr %20, align 8, !tbaa !5
  br label %139

139:                                              ; preds = %157, %136
  %140 = load i64, ptr %18, align 8, !tbaa !5
  %141 = load i64, ptr %19, align 8, !tbaa !5
  %142 = icmp sle i64 %140, %141
  br i1 %142, label %143, label %158

143:                                              ; preds = %139
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %144 = load i64, ptr %18, align 8, !tbaa !5
  %145 = load i64, ptr %19, align 8, !tbaa !5
  %146 = add nsw i64 %144, %145
  %147 = sdiv i64 %146, 2
  store i64 %147, ptr %21, align 8, !tbaa !5
  %148 = load i64, ptr %21, align 8, !tbaa !5
  %149 = call noundef zeroext i1 @_Z5checkRKSt6vectorIlSaIlEES3_l(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %148)
  br i1 %149, label %150, label %154

150:                                              ; preds = %143
  %151 = load i64, ptr %21, align 8, !tbaa !5
  store i64 %151, ptr %20, align 8, !tbaa !5
  %152 = load i64, ptr %21, align 8, !tbaa !5
  %153 = sub nsw i64 %152, 1
  store i64 %153, ptr %19, align 8, !tbaa !5
  br label %157

154:                                              ; preds = %143
  %155 = load i64, ptr %21, align 8, !tbaa !5
  %156 = add nsw i64 %155, 1
  store i64 %156, ptr %18, align 8, !tbaa !5
  br label %157

157:                                              ; preds = %154, %150
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %139, !llvm.loop !14

158:                                              ; preds = %139
  %159 = load i64, ptr %20, align 8, !tbaa !5
  %160 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %159)
          to label %161 unwind label %162

161:                                              ; preds = %158
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #6
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  br label %23, !llvm.loop !15

162:                                              ; preds = %158
  %163 = landingpad { ptr, i32 }
          cleanup
  %164 = extractvalue { ptr, i32 } %163, 0
  store ptr %164, ptr %6, align 8
  %165 = extractvalue { ptr, i32 } %163, 1
  store i32 %165, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  br label %166

166:                                              ; preds = %162, %93, %74
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #6
  br label %167

167:                                              ; preds = %166, %62
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #6
  br label %168

168:                                              ; preds = %167, %49
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  br label %169

169:                                              ; preds = %168, %37
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %172

170:                                              ; preds = %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  %171 = load i32, ptr %1, align 4
  ret i32 %171

172:                                              ; preds = %169
  %173 = load ptr, ptr %6, align 8
  %174 = load i32, ptr %7, align 4
  %175 = insertvalue { ptr, i32 } poison, ptr %173, 0
  %176 = insertvalue { ptr, i32 } %175, i32 %174, 1
  resume { ptr, i32 } %176
}

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5checkRKSt6vectorIlSaIlEES3_l(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 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
  %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) #6
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %8 = load i64, ptr %1, align 8, !tbaa !5
  %9 = add nsw i64 %8, -1
  store i64 %9, ptr %1, align 8, !tbaa !5
  %.not74 = icmp eq i64 %8, 0
  br i1 %.not74, label %._crit_edge77, label %.lr.ph76

.lr.ph76:                                         ; preds = %0, %._crit_edge72
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %10 = 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
  %11 = load i64, ptr %2, align 8, !tbaa !5
  %12 = add nsw i64 %11, 1
  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 %12, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %13 unwind label %16

13:                                               ; preds = %.lr.ph76
  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
  %14 = load i64, ptr %2, align 8, !tbaa !5
  %.not4150 = icmp slt i64 %14, 1
  br i1 %.not4150, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %13
  %.lcssa = phi i64 [ %14, %13 ], [ %21, %.lr.ph ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #6
  %15 = add nsw i64 %.lcssa, 1
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #6
  call void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #6
  invoke void @_ZNSt6vectorIlSaIlEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %15, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %22 unwind label %27

16:                                               ; preds = %.lr.ph76
  %17 = 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
  br label %64

.lr.ph:                                           ; preds = %13, %.lr.ph
  %.03751 = phi i64 [ %20, %.lr.ph ], [ 1, %13 ]
  %18 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.03751) #6
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %18)
  %20 = add nuw nsw i64 %.03751, 1
  %21 = load i64, ptr %2, align 8, !tbaa !5
  %.not41.not = icmp slt i64 %.03751, %21
  br i1 %.not41.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

22:                                               ; preds = %._crit_edge
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #6
  %23 = load i64, ptr %2, align 8, !tbaa !5
  %.not4252 = icmp slt i64 %23, 1
  br i1 %.not4252, label %._crit_edge56, label %.lr.ph55

._crit_edge56:                                    ; preds = %.lr.ph55, %22
  %24 = call ptr @_ZNSt6vectorIlSaIlEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  %25 = call ptr @_ZNSt6vectorIlSaIlEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPlSt6vectorIlSaIlEEEEEvT_S7_(ptr %24, ptr %25)
          to label %.preheader48 unwind label %36

.preheader48:                                     ; preds = %._crit_edge56
  %26 = load i64, ptr %2, align 8, !tbaa !5
  %.not4357 = icmp slt i64 %26, 1
  br i1 %.not4357, label %._crit_edge60, label %.lr.ph59

27:                                               ; preds = %._crit_edge
  %28 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #6
  br label %63

.lr.ph55:                                         ; preds = %22, %.lr.ph55
  %.03953 = phi i64 [ %31, %.lr.ph55 ], [ 1, %22 ]
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %.03953) #6
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %29)
  %31 = add nuw nsw i64 %.03953, 1
  %32 = load i64, ptr %2, align 8, !tbaa !5
  %.not42.not = icmp slt i64 %.03953, %32
  br i1 %.not42.not, label %.lr.ph55, label %._crit_edge56, !llvm.loop !11

._crit_edge60:                                    ; preds = %.lr.ph59, %.preheader48
  %33 = call ptr @_ZNSt6vectorIlSaIlEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  %34 = call ptr @_ZNSt6vectorIlSaIlEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPlSt6vectorIlSaIlEEEEEvT_S7_(ptr %33, ptr %34)
          to label %.preheader unwind label %36

.preheader:                                       ; preds = %._crit_edge60
  %35 = load i64, ptr %2, align 8, !tbaa !5
  %.not4661 = icmp slt i64 %35, 1
  br i1 %.not4661, label %._crit_edge64, label %.lr.ph63

36:                                               ; preds = %._crit_edge60, %._crit_edge56
  %37 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  br label %63

.lr.ph59:                                         ; preds = %.preheader48, %.lr.ph59
  %.03858 = phi i64 [ %44, %.lr.ph59 ], [ 1, %.preheader48 ]
  %38 = add nsw i64 %.03858, -1
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %38) #6
  %40 = load i64, ptr %39, align 8, !tbaa !5
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.03858) #6
  %42 = load i64, ptr %41, align 8, !tbaa !5
  %43 = add nsw i64 %42, %40
  store i64 %43, ptr %41, align 8, !tbaa !5
  %44 = add nuw nsw i64 %.03858, 1
  %45 = load i64, ptr %2, align 8, !tbaa !5
  %.not43.not = icmp slt i64 %.03858, %45
  br i1 %.not43.not, label %.lr.ph59, label %._crit_edge60, !llvm.loop !12

._crit_edge64:                                    ; preds = %.lr.ph63, %.preheader
  %.lcssa49 = phi i64 [ %35, %.preheader ], [ %54, %.lr.ph63 ]
  %.not4766 = icmp slt i64 %.lcssa49, -1
  br i1 %.not4766, label %._crit_edge72, label %.lr.ph71.preheader

.lr.ph71.preheader:                               ; preds = %._crit_edge64
  %46 = add nsw i64 %.lcssa49, 1
  br label %.lr.ph71

.lr.ph63:                                         ; preds = %.preheader, %.lr.ph63
  %.03462 = phi i64 [ %53, %.lr.ph63 ], [ 1, %.preheader ]
  %47 = add nsw i64 %.03462, -1
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %47) #6
  %49 = load i64, ptr %48, align 8, !tbaa !5
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %.03462) #6
  %51 = load i64, ptr %50, align 8, !tbaa !5
  %52 = add nsw i64 %51, %49
  store i64 %52, ptr %50, align 8, !tbaa !5
  %53 = add nuw nsw i64 %.03462, 1
  %54 = load i64, ptr %2, align 8, !tbaa !5
  %.not46.not = icmp slt i64 %.03462, %54
  br i1 %.not46.not, label %.lr.ph63, label %._crit_edge64, !llvm.loop !13

.lr.ph71:                                         ; preds = %.lr.ph71.preheader, %.lr.ph71
  %.02869 = phi i64 [ %.129, %.lr.ph71 ], [ 0, %.lr.ph71.preheader ]
  %.03068 = phi i64 [ %.131, %.lr.ph71 ], [ %46, %.lr.ph71.preheader ]
  %.03267 = phi i64 [ %.133, %.lr.ph71 ], [ 0, %.lr.ph71.preheader ]
  %55 = add nsw i64 %.03068, %.03267
  %56 = sdiv i64 %55, 2
  %57 = call noundef zeroext i1 @_Z5checkRKSt6vectorIlSaIlEES3_l(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %56)
  %58 = add nsw i64 %56, -1
  %59 = add nsw i64 %56, 1
  %.133 = select i1 %57, i64 %.03267, i64 %59
  %.131 = select i1 %57, i64 %58, i64 %.03068
  %.129 = select i1 %57, i64 %56, i64 %.02869
  %.not47 = icmp sgt i64 %.133, %.131
  br i1 %.not47, label %._crit_edge72, label %.lr.ph71, !llvm.loop !14

._crit_edge72:                                    ; preds = %.lr.ph71, %._crit_edge64
  %.028.lcssa = phi i64 [ 0, %._crit_edge64 ], [ %.129, %.lr.ph71 ]
  %60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %.028.lcssa)
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #6
  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
  %61 = load i64, ptr %1, align 8, !tbaa !5
  %62 = add nsw i64 %61, -1
  store i64 %62, ptr %1, align 8, !tbaa !5
  %.not = icmp eq i64 %61, 0
  br i1 %.not, label %._crit_edge77, label %.lr.ph76, !llvm.loop !15

63:                                               ; preds = %36, %27
  %.pn = phi { ptr, i32 } [ %37, %36 ], [ %28, %27 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #6
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  br label %64

64:                                               ; preds = %63, %16
  %.pn.pn = phi { ptr, i32 } [ %.pn, %63 ], [ %17, %16 ]
  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 } %.pn.pn

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 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 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 #0 align 2

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

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

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

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

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

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

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


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