; LLVM IR from DionysiosB/CodeForces :: 1100-1199 (1102B-ArrayKColoring)

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

%struct.elem = type { i64, i64, i64 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<elem, std::allocator<elem>>::_Vector_impl" }
%"struct.std::_Vector_base<elem, std::allocator<elem>>::_Vector_impl" = type { %"struct.std::_Vector_base<elem, std::allocator<elem>>::_Vector_impl_data" }
%"struct.std::_Vector_base<elem, std::allocator<elem>>::_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 [8 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5compA4elemS_(ptr noundef byval(%struct.elem) align 8, ptr noundef byval(%struct.elem) align 8) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5compB4elemS_(ptr noundef byval(%struct.elem) align 8, ptr noundef byval(%struct.elem) align 8) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 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.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i8, align 1
  %14 = alloca i8, align 1
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %18 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %19 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #6
  %21 = load i64, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #6
  call void @_ZNSaI4elemEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  invoke void @_ZNSt6vectorI4elemSaIS0_EEC2EmRKS1_(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %21, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %22 unwind label %28

22:                                               ; preds = %0
  call void @_ZNSt15__new_allocatorI4elemED2Ev(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 0, ptr %8, align 8, !tbaa !5
  br label %23

23:                                               ; preds = %45, %22
  %24 = load i64, ptr %8, align 8, !tbaa !5
  %25 = load i64, ptr %2, align 8, !tbaa !5
  %26 = icmp slt i64 %24, %25
  br i1 %26, label %32, label %27

27:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %52

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

32:                                               ; preds = %23
  %33 = load i64, ptr %8, align 8, !tbaa !5
  %34 = load i64, ptr %8, align 8, !tbaa !5
  %35 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI4elemSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %34) #6
  %36 = getelementptr inbounds %struct.elem, ptr %35, i32 0, i32 0
  store i64 %33, ptr %36, align 8, !tbaa !9
  %37 = load i64, ptr %8, align 8, !tbaa !5
  %38 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI4elemSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %37) #6
  %39 = getelementptr inbounds %struct.elem, ptr %38, i32 0, i32 1
  %40 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %39)
          to label %41 unwind label %48

41:                                               ; preds = %32
  %42 = load i64, ptr %8, align 8, !tbaa !5
  %43 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI4elemSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %42) #6
  %44 = getelementptr inbounds %struct.elem, ptr %43, i32 0, i32 2
  store i64 -1, ptr %44, align 8, !tbaa !11
  br label %45

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

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

52:                                               ; preds = %27
  %53 = call ptr @_ZNSt6vectorI4elemSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  %54 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %53, ptr %54, align 8
  %55 = call ptr @_ZNSt6vectorI4elemSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  %56 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  store ptr %55, ptr %56, align 8
  %57 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8
  %59 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  %60 = load ptr, ptr %59, align 8
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIP4elemSt6vectorIS2_SaIS2_EEEEPFbS2_S2_EEvT_SA_T0_(ptr %58, ptr %60, ptr noundef @_Z5compB4elemS_)
          to label %61 unwind label %67

61:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store i64 0, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store i64 0, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #6
  store i8 0, ptr %13, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #6
  store i8 1, ptr %14, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  store i64 0, ptr %15, align 8, !tbaa !5
  br label %62

62:                                               ; preds = %106, %61
  %63 = load i64, ptr %15, align 8, !tbaa !5
  %64 = load i64, ptr %2, align 8, !tbaa !5
  %65 = icmp slt i64 %63, %64
  br i1 %65, label %71, label %66

66:                                               ; preds = %62
  store i32 5, ptr %16, align 4
  br label %109

67:                                               ; preds = %52
  %68 = landingpad { ptr, i32 }
          cleanup
  %69 = extractvalue { ptr, i32 } %68, 0
  store ptr %69, ptr %6, align 8
  %70 = extractvalue { ptr, i32 } %68, 1
  store i32 %70, ptr %7, align 4
  br label %165

71:                                               ; preds = %62
  %72 = load i64, ptr %15, align 8, !tbaa !5
  %73 = icmp sgt i64 %72, 0
  br i1 %73, label %74, label %91

74:                                               ; preds = %71
  %75 = load i64, ptr %15, align 8, !tbaa !5
  %76 = sub nsw i64 %75, 1
  %77 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI4elemSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %76) #6
  %78 = getelementptr inbounds %struct.elem, ptr %77, i32 0, i32 1
  %79 = load i64, ptr %78, align 8, !tbaa !16
  %80 = load i64, ptr %15, align 8, !tbaa !5
  %81 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI4elemSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %80) #6
  %82 = getelementptr inbounds %struct.elem, ptr %81, i32 0, i32 1
  %83 = load i64, ptr %82, align 8, !tbaa !16
  %84 = icmp ne i64 %79, %83
  br i1 %84, label %85, label %91

85:                                               ; preds = %74
  %86 = load i64, ptr %12, align 8, !tbaa !5
  %87 = load i64, ptr %3, align 8, !tbaa !5
  %88 = icmp sgt i64 %86, %87
  br i1 %88, label %89, label %90

89:                                               ; preds = %85
  store i8 0, ptr %14, align 1, !tbaa !14
  store i32 5, ptr %16, align 4
  br label %109

90:                                               ; preds = %85
  store i64 0, ptr %12, align 8, !tbaa !5
  br label %91

91:                                               ; preds = %90, %74, %71
  %92 = load i64, ptr %12, align 8, !tbaa !5
  %93 = add nsw i64 %92, 1
  store i64 %93, ptr %12, align 8, !tbaa !5
  %94 = load i64, ptr %11, align 8, !tbaa !5
  %95 = add nsw i64 %94, 1
  %96 = load i64, ptr %15, align 8, !tbaa !5
  %97 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI4elemSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %96) #6
  %98 = getelementptr inbounds %struct.elem, ptr %97, i32 0, i32 2
  store i64 %95, ptr %98, align 8, !tbaa !11
  %99 = load i64, ptr %11, align 8, !tbaa !5
  %100 = add nsw i64 %99, 1
  store i64 %100, ptr %11, align 8, !tbaa !5
  %101 = load i64, ptr %11, align 8, !tbaa !5
  %102 = load i64, ptr %3, align 8, !tbaa !5
  %103 = icmp sge i64 %101, %102
  br i1 %103, label %104, label %105

104:                                              ; preds = %91
  store i8 1, ptr %13, align 1, !tbaa !14
  store i64 0, ptr %11, align 8, !tbaa !5
  br label %105

105:                                              ; preds = %104, %91
  br label %106

106:                                              ; preds = %105
  %107 = load i64, ptr %15, align 8, !tbaa !5
  %108 = add nsw i64 %107, 1
  store i64 %108, ptr %15, align 8, !tbaa !5
  br label %62, !llvm.loop !17

109:                                              ; preds = %89, %66
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %110

110:                                              ; preds = %109
  %111 = load i8, ptr %13, align 1, !tbaa !14, !range !18, !noundef !19
  %112 = trunc i8 %111 to i1
  br i1 %112, label %113, label %117

113:                                              ; preds = %110
  %114 = load i64, ptr %12, align 8, !tbaa !5
  %115 = load i64, ptr %3, align 8, !tbaa !5
  %116 = icmp sgt i64 %114, %115
  br i1 %116, label %117, label %118

117:                                              ; preds = %113, %110
  store i8 0, ptr %14, align 1, !tbaa !14
  br label %118

118:                                              ; preds = %117, %113
  %119 = call ptr @_ZNSt6vectorI4elemSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  %120 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  store ptr %119, ptr %120, align 8
  %121 = call ptr @_ZNSt6vectorI4elemSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  %122 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %18, i32 0, i32 0
  store ptr %121, ptr %122, align 8
  %123 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  %124 = load ptr, ptr %123, align 8
  %125 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %18, i32 0, i32 0
  %126 = load ptr, ptr %125, align 8
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIP4elemSt6vectorIS2_SaIS2_EEEEPFbS2_S2_EEvT_SA_T0_(ptr %124, ptr %126, ptr noundef @_Z5compA4elemS_)
          to label %127 unwind label %138

127:                                              ; preds = %118
  %128 = load i8, ptr %14, align 1, !tbaa !14, !range !18, !noundef !19
  %129 = trunc i8 %128 to i1
  br i1 %129, label %130, label %159

130:                                              ; preds = %127
  %131 = invoke i32 @puts(ptr noundef @.str.2)
          to label %132 unwind label %138

132:                                              ; preds = %130
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  store i64 0, ptr %19, align 8, !tbaa !5
  br label %133

133:                                              ; preds = %149, %132
  %134 = load i64, ptr %19, align 8, !tbaa !5
  %135 = load i64, ptr %2, align 8, !tbaa !5
  %136 = icmp slt i64 %134, %135
  br i1 %136, label %142, label %137

137:                                              ; preds = %133
  store i32 8, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  br label %156

138:                                              ; preds = %159, %156, %130, %118
  %139 = landingpad { ptr, i32 }
          cleanup
  %140 = extractvalue { ptr, i32 } %139, 0
  store ptr %140, ptr %6, align 8
  %141 = extractvalue { ptr, i32 } %139, 1
  store i32 %141, ptr %7, align 4
  br label %164

142:                                              ; preds = %133
  %143 = load i64, ptr %19, align 8, !tbaa !5
  %144 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI4elemSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %143) #6
  %145 = getelementptr inbounds %struct.elem, ptr %144, i32 0, i32 2
  %146 = load i64, ptr %145, align 8, !tbaa !11
  %147 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %146)
          to label %148 unwind label %152

148:                                              ; preds = %142
  br label %149

149:                                              ; preds = %148
  %150 = load i64, ptr %19, align 8, !tbaa !5
  %151 = add nsw i64 %150, 1
  store i64 %151, ptr %19, align 8, !tbaa !5
  br label %133, !llvm.loop !20

152:                                              ; preds = %142
  %153 = landingpad { ptr, i32 }
          cleanup
  %154 = extractvalue { ptr, i32 } %153, 0
  store ptr %154, ptr %6, align 8
  %155 = extractvalue { ptr, i32 } %153, 1
  store i32 %155, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  br label %164

156:                                              ; preds = %137
  %157 = invoke i32 @puts(ptr noundef @.str.4)
          to label %158 unwind label %138

158:                                              ; preds = %156
  br label %162

159:                                              ; preds = %127
  %160 = invoke i32 @puts(ptr noundef @.str.5)
          to label %161 unwind label %138

161:                                              ; preds = %159
  br label %162

162:                                              ; preds = %161, %158
  store i32 0, ptr %1, align 4
  store i32 1, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @_ZNSt6vectorI4elemSaIS0_EED2Ev(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
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  %163 = load i32, ptr %1, align 4
  ret i32 %163

164:                                              ; preds = %152, %138
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %165

165:                                              ; preds = %164, %67, %48
  call void @_ZNSt6vectorI4elemSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  br label %166

166:                                              ; preds = %165, %28
  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 %167

167:                                              ; preds = %166
  %168 = load ptr, ptr %6, align 8
  %169 = load i32, ptr %7, align 4
  %170 = insertvalue { ptr, i32 } poison, ptr %168, 0
  %171 = insertvalue { ptr, i32 } %170, i32 %169, 1
  resume { ptr, i32 } %171
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI4elemSaIS0_EEC2EmRKS1_(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) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI4elemSaIS0_EEixEm(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_iteratorIP4elemSt6vectorIS2_SaIS2_EEEEPFbS2_S2_EEvT_SA_T0_(ptr, ptr, ptr noundef) #5

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

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

declare i32 @puts(ptr noundef) #3

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorI4elemED2Ev(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 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!10, !6, i64 0}
!10 = !{!"_ZTS4elem", !6, i64 0, !6, i64 8, !6, i64 16}
!11 = !{!10, !6, i64 16}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{!10, !6, i64 8}
!17 = distinct !{!17, !13}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = distinct !{!20, !13}


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

%struct.elem = type { i64, i64, i64 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<elem, std::allocator<elem>>::_Vector_impl" }
%"struct.std::_Vector_base<elem, std::allocator<elem>>::_Vector_impl" = type { %"struct.std::_Vector_base<elem, std::allocator<elem>>::_Vector_impl_data" }
%"struct.std::_Vector_base<elem, std::allocator<elem>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5compA4elemS_(ptr noundef byval(%struct.elem) align 8, ptr noundef byval(%struct.elem) align 8) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5compB4elemS_(ptr noundef byval(%struct.elem) align 8, ptr noundef byval(%struct.elem) align 8) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 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
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  %6 = load i64, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @_ZNSaI4elemEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  invoke void @_ZNSt6vectorI4elemSaIS0_EEC2EmRKS1_(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %6, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %7 unwind label %19

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

._crit_edge:                                      ; preds = %.lr.ph, %7
  %10 = call ptr @_ZNSt6vectorI4elemSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  %11 = call ptr @_ZNSt6vectorI4elemSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIP4elemSt6vectorIS2_SaIS2_EEEEPFbS2_S2_EEvT_SA_T0_(ptr %10, ptr %11, ptr noundef nonnull @_Z5compB4elemS_)
          to label %.preheader unwind label %30

.preheader:                                       ; preds = %._crit_edge
  %12 = load i64, ptr %1, align 8, !tbaa !5
  %13 = icmp slt i64 %12, 1
  br i1 %13, label %.preheader.._crit_edge57_crit_edge, label %.lr.ph56.preheader

.preheader.._crit_edge57_crit_edge:               ; preds = %.preheader
  %.pre = load i64, ptr %2, align 8
  br label %._crit_edge57

.lr.ph56.preheader:                               ; preds = %.preheader
  %14 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI4elemSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 0) #6
  %15 = getelementptr inbounds i8, ptr %14, i64 16
  store i64 1, ptr %15, align 8, !tbaa !9
  %16 = load i64, ptr %2, align 8
  %.not43.peel = icmp slt i64 %16, 2
  %17 = load i64, ptr %1, align 8, !tbaa !5
  %18 = icmp slt i64 %17, 2
  br i1 %18, label %._crit_edge57, label %.lr.ph56.peel.next

.lr.ph56.peel.next:                               ; preds = %.lr.ph56.preheader
  %not..not43.peel = xor i1 %.not43.peel, true
  %spec.select.peel = zext i1 %not..not43.peel to i64
  br label %32

19:                                               ; preds = %0
  %20 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorI4elemED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  br label %71

.lr.ph:                                           ; preds = %7, %.lr.ph
  %.04051 = phi i64 [ %27, %.lr.ph ], [ 0, %7 ]
  %21 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI4elemSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.04051) #6
  store i64 %.04051, ptr %21, align 8, !tbaa !11
  %22 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI4elemSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.04051) #6
  %23 = getelementptr inbounds i8, ptr %22, i64 8
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %23)
  %25 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI4elemSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.04051) #6
  %26 = getelementptr inbounds i8, ptr %25, i64 16
  store i64 -1, ptr %26, align 8, !tbaa !9
  %27 = add nuw nsw i64 %.04051, 1
  %28 = load i64, ptr %1, align 8, !tbaa !5
  %29 = icmp slt i64 %27, %28
  br i1 %29, label %.lr.ph, label %._crit_edge, !llvm.loop !12

30:                                               ; preds = %._crit_edge
  %31 = landingpad { ptr, i32 }
          cleanup
  br label %70

32:                                               ; preds = %43, %.lr.ph56.peel.next
  %.02955 = phi i64 [ %49, %43 ], [ 1, %.lr.ph56.peel.next ]
  %.03254 = phi i1 [ %spec.select46, %43 ], [ %.not43.peel, %.lr.ph56.peel.next ]
  %.03453 = phi i64 [ %44, %43 ], [ 1, %.lr.ph56.peel.next ]
  %.03652 = phi i64 [ %spec.select, %43 ], [ %spec.select.peel, %.lr.ph56.peel.next ]
  %33 = add nsw i64 %.02955, -1
  %34 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI4elemSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %33) #6
  %35 = getelementptr inbounds i8, ptr %34, i64 8
  %36 = load i64, ptr %35, align 8, !tbaa !14
  %37 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI4elemSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.02955) #6
  %38 = getelementptr inbounds i8, ptr %37, i64 8
  %39 = load i64, ptr %38, align 8, !tbaa !14
  %.not42 = icmp eq i64 %36, %39
  br i1 %.not42, label %43, label %40

40:                                               ; preds = %32
  %41 = load i64, ptr %2, align 8
  %42 = icmp sgt i64 %.03453, %41
  br i1 %42, label %._crit_edge57, label %43

43:                                               ; preds = %40, %32
  %.135 = phi i64 [ %.03453, %32 ], [ 0, %40 ]
  %44 = add nsw i64 %.135, 1
  %45 = add nsw i64 %.03652, 1
  %46 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI4elemSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.02955) #6
  %47 = getelementptr inbounds i8, ptr %46, i64 16
  store i64 %45, ptr %47, align 8, !tbaa !9
  %48 = load i64, ptr %2, align 8
  %.not43 = icmp sge i64 %45, %48
  %spec.select = select i1 %.not43, i64 0, i64 %45
  %spec.select46 = select i1 %.not43, i1 true, i1 %.03254
  %49 = add nuw nsw i64 %.02955, 1
  %50 = load i64, ptr %1, align 8, !tbaa !5
  %.not = icmp slt i64 %49, %50
  br i1 %.not, label %32, label %._crit_edge57, !llvm.loop !15

._crit_edge57:                                    ; preds = %43, %40, %.lr.ph56.preheader, %.preheader.._crit_edge57_crit_edge
  %51 = phi i64 [ %.pre, %.preheader.._crit_edge57_crit_edge ], [ %16, %.lr.ph56.preheader ], [ %48, %43 ], [ %41, %40 ]
  %.034.lcssa = phi i64 [ 0, %.preheader.._crit_edge57_crit_edge ], [ 1, %.lr.ph56.preheader ], [ %44, %43 ], [ %.03453, %40 ]
  %.032.lcssa = phi i1 [ false, %.preheader.._crit_edge57_crit_edge ], [ %.not43.peel, %.lr.ph56.preheader ], [ %spec.select46, %43 ], [ %.03254, %40 ]
  %.lcssa = phi i1 [ true, %.preheader.._crit_edge57_crit_edge ], [ true, %.lr.ph56.preheader ], [ true, %43 ], [ false, %40 ]
  %52 = call ptr @_ZNSt6vectorI4elemSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  %53 = call ptr @_ZNSt6vectorI4elemSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIP4elemSt6vectorIS2_SaIS2_EEEEPFbS2_S2_EEvT_SA_T0_(ptr %52, ptr %53, ptr noundef nonnull @_Z5compA4elemS_)
          to label %54 unwind label %60

54:                                               ; preds = %._crit_edge57
  %55 = icmp sle i64 %.034.lcssa, %51
  %or.cond.not = select i1 %.032.lcssa, i1 %55, i1 false
  %spec.select49 = and i1 %.lcssa, %or.cond.not
  br i1 %spec.select49, label %56, label %._crit_edge67

56:                                               ; preds = %54
  %57 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  %58 = load i64, ptr %1, align 8, !tbaa !5
  %59 = icmp sgt i64 %58, 0
  br i1 %59, label %.lr.ph66, label %._crit_edge67

60:                                               ; preds = %._crit_edge57
  %61 = landingpad { ptr, i32 }
          cleanup
  br label %70

.lr.ph66:                                         ; preds = %56, %.lr.ph66
  %.064 = phi i64 [ %66, %.lr.ph66 ], [ 0, %56 ]
  %62 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI4elemSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.064) #6
  %63 = getelementptr inbounds i8, ptr %62, i64 16
  %64 = load i64, ptr %63, align 8, !tbaa !9
  %65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %64)
  %66 = add nuw nsw i64 %.064, 1
  %67 = load i64, ptr %1, align 8, !tbaa !5
  %68 = icmp slt i64 %66, %67
  br i1 %68, label %.lr.ph66, label %._crit_edge67, !llvm.loop !17

._crit_edge67:                                    ; preds = %.lr.ph66, %54, %56
  %.str.5.sink = phi ptr [ @.str.4, %56 ], [ @.str.5, %54 ], [ @.str.4, %.lr.ph66 ]
  %69 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.5.sink)
  call void @_ZNSt6vectorI4elemSaIS0_EED2Ev(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
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret i32 0

70:                                               ; preds = %60, %30
  %.pn = phi { ptr, i32 } [ %61, %60 ], [ %31, %30 ]
  call void @_ZNSt6vectorI4elemSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  br label %71

71:                                               ; preds = %70, %19
  %.pn.pn = phi { ptr, i32 } [ %.pn, %70 ], [ %20, %19 ]
  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
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI4elemSaIS0_EEC2EmRKS1_(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) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI4elemSaIS0_EEixEm(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_iteratorIP4elemSt6vectorIS2_SaIS2_EEEEPFbS2_S2_EEvT_SA_T0_(ptr, ptr, ptr noundef) local_unnamed_addr #5

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

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

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

; 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 @_ZNSt6vectorI4elemSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorI4elemED2Ev(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 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!10, !6, i64 16}
!10 = !{!"_ZTS4elem", !6, i64 0, !6, i64 8, !6, i64 16}
!11 = !{!10, !6, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 8}
!15 = distinct !{!15, !13, !16}
!16 = !{!"llvm.loop.peeled.count", i32 1}
!17 = distinct !{!17, !13}


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