; LLVM IR from DionysiosB/CodeForces :: 1400-1499 (1462D-AddToNeighborAndRemove)

; 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.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long, long, std::_Identity<long>, std::less<long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long, long, std::_Identity<long>, std::less<long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_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 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 i64, align 8
  %6 = alloca %"class.std::allocator", align 1
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"class.std::vector", align 8
  %10 = alloca i64, align 8
  %11 = alloca %"class.std::allocator", align 1
  %12 = alloca %"class.std::set", align 8
  %13 = alloca i64, align 8
  %14 = alloca %"struct.std::pair", align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i32, align 4
  %19 = alloca i64, align 8
  %20 = alloca i8, align 1
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  br label %24

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

28:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #5
  %30 = load i64, ptr %3, align 8, !tbaa !5
  %31 = add nsw i64 %30, 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store i64 0, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #5
  call void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #5
  invoke void @_ZNSt6vectorIlSaIlEEC2EmRKlRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %31, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %32 unwind label %41

32:                                               ; preds = %28
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #5
  %33 = load i64, ptr %3, align 8, !tbaa !5
  %34 = add nsw i64 %33, 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  store i64 0, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #5
  call void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #5
  invoke void @_ZNSt6vectorIlSaIlEEC2EmRKlRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %34, ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 1 dereferenceable(1) %11)
          to label %35 unwind label %45

35:                                               ; preds = %32
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 48, ptr %12) #5
  call void @_ZNSt3setIlSt4lessIlESaIlEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store i64 1, ptr %13, align 8, !tbaa !5
  br label %36

36:                                               ; preds = %72, %35
  %37 = load i64, ptr %13, align 8, !tbaa !5
  %38 = load i64, ptr %3, align 8, !tbaa !5
  %39 = icmp sle i64 %37, %38
  br i1 %39, label %49, label %40

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

41:                                               ; preds = %28
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %7, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %8, align 4
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  br label %153

45:                                               ; preds = %32
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %7, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %8, align 4
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %152

49:                                               ; preds = %36
  %50 = load i64, ptr %13, align 8, !tbaa !5
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %50) #5
  %52 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %51)
          to label %53 unwind label %75

53:                                               ; preds = %49
  %54 = load i64, ptr %13, align 8, !tbaa !5
  %55 = sub nsw i64 %54, 1
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %55) #5
  %57 = load i64, ptr %56, align 8, !tbaa !5
  %58 = load i64, ptr %13, 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 = add nsw i64 %57, %60
  %62 = load i64, ptr %13, align 8, !tbaa !5
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %62) #5
  store i64 %61, ptr %63, align 8, !tbaa !5
  %64 = load i64, ptr %13, align 8, !tbaa !5
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %64) #5
  %66 = invoke { ptr, i8 } @_ZNSt3setIlSt4lessIlESaIlEE6insertERKl(ptr noundef nonnull align 8 dereferenceable(48) %12, ptr noundef nonnull align 8 dereferenceable(8) %65)
          to label %67 unwind label %75

67:                                               ; preds = %53
  %68 = getelementptr inbounds { ptr, i8 }, ptr %14, i32 0, i32 0
  %69 = extractvalue { ptr, i8 } %66, 0
  store ptr %69, ptr %68, align 8
  %70 = getelementptr inbounds { ptr, i8 }, ptr %14, i32 0, i32 1
  %71 = extractvalue { ptr, i8 } %66, 1
  store i8 %71, ptr %70, align 8
  br label %72

72:                                               ; preds = %67
  %73 = load i64, ptr %13, align 8, !tbaa !5
  %74 = add nsw i64 %73, 1
  store i64 %74, ptr %13, align 8, !tbaa !5
  br label %36, !llvm.loop !9

75:                                               ; preds = %53, %49
  %76 = landingpad { ptr, i32 }
          cleanup
  %77 = extractvalue { ptr, i32 } %76, 0
  store ptr %77, ptr %7, align 8
  %78 = extractvalue { ptr, i32 } %76, 1
  store i32 %78, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %151

79:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #5
  %81 = load i64, ptr %80, align 8, !tbaa !5
  store i64 %81, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %82 = load i64, ptr %3, align 8, !tbaa !5
  %83 = sub nsw i64 %82, 1
  store i64 %83, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  store i64 1, ptr %17, align 8, !tbaa !5
  br label %84

84:                                               ; preds = %138, %79
  %85 = load i64, ptr %17, align 8, !tbaa !5
  %86 = load i64, ptr %3, align 8, !tbaa !5
  %87 = icmp sle i64 %85, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %84
  store i32 7, ptr %18, align 4
  br label %141

89:                                               ; preds = %84
  %90 = load i64, ptr %15, align 8, !tbaa !5
  %91 = load i64, ptr %17, align 8, !tbaa !5
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %91) #5
  %93 = load i64, ptr %92, align 8, !tbaa !5
  %94 = srem i64 %90, %93
  %95 = icmp ne i64 %94, 0
  br i1 %95, label %96, label %97

96:                                               ; preds = %89
  br label %138

97:                                               ; preds = %89
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %98 = load i64, ptr %15, align 8, !tbaa !5
  %99 = load i64, ptr %17, align 8, !tbaa !5
  %100 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %99) #5
  %101 = load i64, ptr %100, align 8, !tbaa !5
  %102 = sdiv i64 %98, %101
  store i64 %102, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #5
  store i8 1, ptr %20, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  store i64 2, ptr %21, align 8, !tbaa !5
  br label %103

103:                                              ; preds = %123, %97
  %104 = load i64, ptr %21, align 8, !tbaa !5
  %105 = load i64, ptr %19, align 8, !tbaa !5
  %106 = icmp slt i64 %104, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %103
  store i32 10, ptr %18, align 4
  br label %126

108:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %109 = load i64, ptr %21, align 8, !tbaa !5
  %110 = load i64, ptr %17, align 8, !tbaa !5
  %111 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %110) #5
  %112 = load i64, ptr %111, align 8, !tbaa !5
  %113 = mul nsw i64 %109, %112
  store i64 %113, ptr %22, align 8, !tbaa !5
  %114 = invoke noundef i64 @_ZNKSt3setIlSt4lessIlESaIlEE5countERKl(ptr noundef nonnull align 8 dereferenceable(48) %12, ptr noundef nonnull align 8 dereferenceable(8) %22)
          to label %115 unwind label %118

115:                                              ; preds = %108
  %116 = icmp eq i64 %114, 0
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  br i1 %116, label %117, label %122

117:                                              ; preds = %115
  store i8 0, ptr %20, align 1, !tbaa !11
  store i32 10, ptr %18, align 4
  br label %126

118:                                              ; preds = %108
  %119 = landingpad { ptr, i32 }
          cleanup
  %120 = extractvalue { ptr, i32 } %119, 0
  store ptr %120, ptr %7, align 8
  %121 = extractvalue { ptr, i32 } %119, 1
  store i32 %121, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %150

122:                                              ; preds = %115
  br label %123

123:                                              ; preds = %122
  %124 = load i64, ptr %21, align 8, !tbaa !5
  %125 = add nsw i64 %124, 1
  store i64 %125, ptr %21, align 8, !tbaa !5
  br label %103, !llvm.loop !13

126:                                              ; preds = %117, %107
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  br label %127

127:                                              ; preds = %126
  %128 = load i8, ptr %20, align 1, !tbaa !11, !range !14, !noundef !15
  %129 = trunc i8 %128 to i1
  br i1 %129, label %130, label %134

130:                                              ; preds = %127
  %131 = load i64, ptr %3, align 8, !tbaa !5
  %132 = load i64, ptr %19, align 8, !tbaa !5
  %133 = sub nsw i64 %131, %132
  store i64 %133, ptr %16, align 8, !tbaa !5
  store i32 7, ptr %18, align 4
  br label %135

134:                                              ; preds = %127
  store i32 0, ptr %18, align 4
  br label %135

135:                                              ; preds = %134, %130
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  %136 = load i32, ptr %18, align 4
  switch i32 %136, label %141 [
    i32 0, label %137
  ]

137:                                              ; preds = %135
  br label %138

138:                                              ; preds = %137, %96
  %139 = load i64, ptr %17, align 8, !tbaa !5
  %140 = add nsw i64 %139, 1
  store i64 %140, ptr %17, align 8, !tbaa !5
  br label %84, !llvm.loop !16

141:                                              ; preds = %135, %88
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %142

142:                                              ; preds = %141
  %143 = load i64, ptr %16, align 8, !tbaa !5
  %144 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %143)
          to label %145 unwind label %146

145:                                              ; preds = %142
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @_ZNSt3setIlSt4lessIlESaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %12) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %12) #5
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #5
  call void @llvm.lifetime.end.p0(i64 24, 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 %24, !llvm.loop !17

146:                                              ; preds = %142
  %147 = landingpad { ptr, i32 }
          cleanup
  %148 = extractvalue { ptr, i32 } %147, 0
  store ptr %148, ptr %7, align 8
  %149 = extractvalue { ptr, i32 } %147, 1
  store i32 %149, ptr %8, align 4
  br label %150

150:                                              ; preds = %146, %118
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %151

151:                                              ; preds = %150, %75
  call void @_ZNSt3setIlSt4lessIlESaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %12) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %12) #5
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #5
  br label %152

152:                                              ; preds = %151, %45
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #5
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  br label %153

153:                                              ; preds = %152, %41
  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 %156

154:                                              ; preds = %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  %155 = load i32, ptr %1, align 4
  ret i32 %155

156:                                              ; preds = %153
  %157 = load ptr, ptr %7, align 8
  %158 = load i32, ptr %8, align 4
  %159 = insertvalue { ptr, i32 } poison, ptr %157, 0
  %160 = insertvalue { ptr, i32 } %159, i32 %158, 1
  resume { ptr, i32 } %160
}

; 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 @_ZNSt6vectorIlSaIlEEC2EmRKlRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 8 dereferenceable(8), 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 void @_ZNSt3setIlSt4lessIlESaIlEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3 align 2

; 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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIlSt4lessIlESaIlEE6insertERKl(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #4 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3setIlSt4lessIlESaIlEE5countERKl(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIlSt4lessIlESaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3 align 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 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !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 }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long, long, std::_Identity<long>, std::less<long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long, long, std::_Identity<long>, std::less<long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, 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 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 i64, align 8
  %5 = alloca %"class.std::allocator", align 1
  %6 = alloca %"class.std::vector", align 8
  %7 = alloca i64, align 8
  %8 = alloca %"class.std::allocator", align 1
  %9 = alloca %"class.std::set", align 8
  %10 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %12 = load i64, ptr %1, align 8, !tbaa !5
  %13 = add nsw i64 %12, -1
  store i64 %13, ptr %1, align 8, !tbaa !5
  %.not57 = icmp eq i64 %12, 0
  br i1 %.not57, label %._crit_edge60, label %.lr.ph59

.lr.ph59:                                         ; preds = %0, %.loopexit
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #5
  %15 = load i64, ptr %2, align 8, !tbaa !5
  %16 = add nsw i64 %15, 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  store i64 0, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #5
  call void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  invoke void @_ZNSt6vectorIlSaIlEEC2EmRKlRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %16, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %17 unwind label %26

17:                                               ; preds = %.lr.ph59
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #5
  %18 = load i64, ptr %2, align 8, !tbaa !5
  %19 = add nsw i64 %18, 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  store i64 0, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %8) #5
  call void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #5
  invoke void @_ZNSt6vectorIlSaIlEEC2EmRKlRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %19, ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 1 dereferenceable(1) %8)
          to label %20 unwind label %28

20:                                               ; preds = %17
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %9) #5
  call void @_ZNSt3setIlSt4lessIlESaIlEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #5
  %21 = load i64, ptr %2, align 8, !tbaa !5
  %.not3544 = icmp slt i64 %21, 1
  br i1 %.not3544, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %41, %20
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #5
  %23 = load i64, ptr %22, align 8, !tbaa !5
  %24 = load i64, ptr %2, align 8, !tbaa !5
  %25 = add nsw i64 %24, -1
  %.not3653 = icmp slt i64 %24, 1
  br i1 %.not3653, label %.loopexit, label %.lr.ph56

26:                                               ; preds = %.lr.ph59
  %27 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %72

28:                                               ; preds = %17
  %29 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br label %71

.lr.ph:                                           ; preds = %20, %41
  %.03445 = phi i64 [ %42, %41 ], [ 1, %20 ]
  %30 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.03445) #5
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %30)
  %32 = add nsw i64 %.03445, -1
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %32) #5
  %34 = load i64, ptr %33, align 8, !tbaa !5
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.03445) #5
  %36 = load i64, ptr %35, align 8, !tbaa !5
  %37 = add nsw i64 %36, %34
  %38 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %.03445) #5
  store i64 %37, ptr %38, align 8, !tbaa !5
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %.03445) #5
  %40 = invoke { ptr, i8 } @_ZNSt3setIlSt4lessIlESaIlEE6insertERKl(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull align 8 dereferenceable(8) %39)
          to label %41 unwind label %44

41:                                               ; preds = %.lr.ph
  %42 = add nuw nsw i64 %.03445, 1
  %43 = load i64, ptr %2, align 8, !tbaa !5
  %.not35.not = icmp slt i64 %.03445, %43
  br i1 %.not35.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

44:                                               ; preds = %.lr.ph
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %70

.lr.ph56:                                         ; preds = %._crit_edge, %.thread
  %.02754 = phi i64 [ %65, %.thread ], [ 1, %._crit_edge ]
  %46 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %.02754) #5
  %47 = load i64, ptr %46, align 8, !tbaa !5
  %48 = srem i64 %23, %47
  %.not37 = icmp eq i64 %48, 0
  br i1 %.not37, label %49, label %.thread

49:                                               ; preds = %.lr.ph56
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %.02754) #5
  %51 = load i64, ptr %50, align 8, !tbaa !5
  %52 = sdiv i64 %23, %51
  %.not3846 = icmp sgt i64 %52, 2
  br i1 %.not3846, label %.lr.ph49, label %._crit_edge50

53:                                               ; preds = %59
  %54 = add nuw nsw i64 %.047, 1
  %exitcond.not = icmp eq i64 %54, %52
  br i1 %exitcond.not, label %._crit_edge50, label %.lr.ph49, !llvm.loop !11

.lr.ph49:                                         ; preds = %49, %53
  %.047 = phi i64 [ %54, %53 ], [ 2, %49 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #5
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %.02754) #5
  %56 = load i64, ptr %55, align 8, !tbaa !5
  %57 = mul nsw i64 %56, %.047
  store i64 %57, ptr %10, align 8, !tbaa !5
  %58 = invoke noundef i64 @_ZNKSt3setIlSt4lessIlESaIlEE5countERKl(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %59 unwind label %61

59:                                               ; preds = %.lr.ph49
  %60 = icmp eq i64 %58, 0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #5
  br i1 %60, label %.thread, label %53

61:                                               ; preds = %.lr.ph49
  %62 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #5
  br label %70

._crit_edge50:                                    ; preds = %49, %53
  %63 = load i64, ptr %2, align 8, !tbaa !5
  %64 = sub nsw i64 %63, %52
  br label %.loopexit

.thread:                                          ; preds = %59, %.lr.ph56
  %65 = add nuw nsw i64 %.02754, 1
  %66 = load i64, ptr %2, align 8, !tbaa !5
  %.not36.not = icmp slt i64 %.02754, %66
  br i1 %.not36.not, label %.lr.ph56, label %.loopexit, !llvm.loop !12

.loopexit:                                        ; preds = %.thread, %._crit_edge, %._crit_edge50
  %.3 = phi i64 [ %64, %._crit_edge50 ], [ %25, %._crit_edge ], [ %25, %.thread ]
  %67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %.3)
  call void @_ZNSt3setIlSt4lessIlESaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %9) #5
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  %68 = load i64, ptr %1, align 8, !tbaa !5
  %69 = add nsw i64 %68, -1
  store i64 %69, ptr %1, align 8, !tbaa !5
  %.not = icmp eq i64 %68, 0
  br i1 %.not, label %._crit_edge60, label %.lr.ph59, !llvm.loop !13

70:                                               ; preds = %61, %44
  %.pn = phi { ptr, i32 } [ %45, %44 ], [ %62, %61 ]
  call void @_ZNSt3setIlSt4lessIlESaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %9) #5
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #5
  br label %71

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

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

._crit_edge60:                                    ; preds = %.loopexit, %0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  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 @_ZNSt6vectorIlSaIlEEC2EmRKlRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 8 dereferenceable(8), 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 void @_ZNSt3setIlSt4lessIlESaIlEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3 align 2

; 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: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIlSt4lessIlESaIlEE6insertERKl(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3setIlSt4lessIlESaIlEE5countERKl(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 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 @_ZNSt3setIlSt4lessIlESaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3 align 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !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}


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