; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/353 Division 2/Problem D (D)

; 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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_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.0" = type { i32, i32 }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@s = external dso_local global %"class.std::set", align 8
@l = external dso_local global [100100 x i32], align 16
@r = external dso_local global [100100 x i32], align 16
@n = external dso_local global i32, align 4
@a = external dso_local global [100100 x i32], align 16
@p = external dso_local global [100100 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair.0", align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %7 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %10 = alloca %"struct.std::pair.0", align 4
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %13 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %17 = alloca %"struct.std::pair.0", align 4
  %18 = alloca %"struct.std::pair", align 8
  %19 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %31, %0
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = icmp sle i32 %22, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %34

26:                                               ; preds = %21
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %28
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %29)
  br label %31

31:                                               ; preds = %26
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %2, align 4, !tbaa !5
  br label %21, !llvm.loop !9

34:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !5
  %35 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds ([100100 x i32], ptr @a, i64 0, i64 1), ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %35, ptr %3, align 4
  %36 = call { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @s, ptr noundef nonnull align 4 dereferenceable(8) %3)
  %37 = getelementptr inbounds { ptr, i8 }, ptr %5, i32 0, i32 0
  %38 = extractvalue { ptr, i8 } %36, 0
  store ptr %38, ptr %37, align 8
  %39 = getelementptr inbounds { ptr, i8 }, ptr %5, i32 0, i32 1
  %40 = extractvalue { ptr, i8 } %36, 1
  store i8 %40, ptr %39, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  call void @_ZNSt23_Rb_tree_const_iteratorISt4pairIiiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @_ZNSt23_Rb_tree_const_iteratorISt4pairIiiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 2, ptr %8, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %130, %34
  %42 = load i32, ptr %8, align 4, !tbaa !5
  %43 = load i32, ptr @n, align 4, !tbaa !5
  %44 = icmp sle i32 %42, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %133

46:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %47 = load i32, ptr %8, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  %50 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %49, ptr noundef nonnull align 4 dereferenceable(4) %11)
  store i64 %50, ptr %10, align 4
  %51 = call ptr @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE11upper_boundERKS1_(ptr noundef nonnull align 8 dereferenceable(48) @s, ptr noundef nonnull align 4 dereferenceable(8) %10)
  %52 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %9, i32 0, i32 0
  store ptr %51, ptr %52, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 %9, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %53 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @s) #6
  %54 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %12, i32 0, i32 0
  store ptr %53, ptr %54, align 8
  %55 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br i1 %55, label %56, label %69

56:                                               ; preds = %46
  %57 = load i32, ptr %8, align 4, !tbaa !5
  %58 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %59 = getelementptr inbounds %"struct.std::pair.0", ptr %58, i32 0, i32 1
  %60 = load i32, ptr %59, align 4, !tbaa !14
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [100100 x i32], ptr @l, i64 0, i64 %61
  store i32 %57, ptr %62, align 4, !tbaa !5
  %63 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %64 = getelementptr inbounds %"struct.std::pair.0", ptr %63, i32 0, i32 1
  %65 = load i32, ptr %64, align 4, !tbaa !14
  %66 = load i32, ptr %8, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [100100 x i32], ptr @p, i64 0, i64 %67
  store i32 %65, ptr %68, align 4, !tbaa !5
  br label %120

69:                                               ; preds = %46
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %7, ptr align 8 %6, i64 8, i1 false), !tbaa.struct !11
  %70 = call ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIiiEEmmEi(ptr noundef nonnull align 8 dereferenceable(8) %7, i32 noundef 0) #6
  %71 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %13, i32 0, i32 0
  store ptr %70, ptr %71, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 -1, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 -1, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %72 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @s) #6
  %73 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %16, i32 0, i32 0
  store ptr %72, ptr %73, align 8
  %74 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br i1 %74, label %75, label %79

75:                                               ; preds = %69
  %76 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %77 = getelementptr inbounds %"struct.std::pair.0", ptr %76, i32 0, i32 1
  %78 = load i32, ptr %77, align 4, !tbaa !14
  store i32 %78, ptr %14, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %75, %69
  %80 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  %81 = getelementptr inbounds %"struct.std::pair.0", ptr %80, i32 0, i32 1
  %82 = load i32, ptr %81, align 4, !tbaa !14
  store i32 %82, ptr %15, align 4, !tbaa !5
  %83 = load i32, ptr %14, align 4, !tbaa !5
  %84 = icmp eq i32 %83, -1
  br i1 %84, label %85, label %94

85:                                               ; preds = %79
  %86 = load i32, ptr %8, align 4, !tbaa !5
  %87 = load i32, ptr %15, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [100100 x i32], ptr @r, i64 0, i64 %88
  store i32 %86, ptr %89, align 4, !tbaa !5
  %90 = load i32, ptr %15, align 4, !tbaa !5
  %91 = load i32, ptr %8, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [100100 x i32], ptr @p, i64 0, i64 %92
  store i32 %90, ptr %93, align 4, !tbaa !5
  br label %119

94:                                               ; preds = %79
  %95 = load i32, ptr %14, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [100100 x i32], ptr @l, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = icmp sgt i32 %98, 0
  br i1 %99, label %100, label %109

100:                                              ; preds = %94
  %101 = load i32, ptr %8, align 4, !tbaa !5
  %102 = load i32, ptr %15, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [100100 x i32], ptr @r, i64 0, i64 %103
  store i32 %101, ptr %104, align 4, !tbaa !5
  %105 = load i32, ptr %15, align 4, !tbaa !5
  %106 = load i32, ptr %8, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [100100 x i32], ptr @p, i64 0, i64 %107
  store i32 %105, ptr %108, align 4, !tbaa !5
  br label %118

109:                                              ; preds = %94
  %110 = load i32, ptr %8, align 4, !tbaa !5
  %111 = load i32, ptr %14, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [100100 x i32], ptr @l, i64 0, i64 %112
  store i32 %110, ptr %113, align 4, !tbaa !5
  %114 = load i32, ptr %14, align 4, !tbaa !5
  %115 = load i32, ptr %8, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [100100 x i32], ptr @p, i64 0, i64 %116
  store i32 %114, ptr %117, align 4, !tbaa !5
  br label %118

118:                                              ; preds = %109, %100
  br label %119

119:                                              ; preds = %118, %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %120

120:                                              ; preds = %119, %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %121 = load i32, ptr %8, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %122
  %124 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %123, ptr noundef nonnull align 4 dereferenceable(4) %8)
  store i64 %124, ptr %17, align 4
  %125 = call { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @s, ptr noundef nonnull align 4 dereferenceable(8) %17)
  %126 = getelementptr inbounds { ptr, i8 }, ptr %18, i32 0, i32 0
  %127 = extractvalue { ptr, i8 } %125, 0
  store ptr %127, ptr %126, align 8
  %128 = getelementptr inbounds { ptr, i8 }, ptr %18, i32 0, i32 1
  %129 = extractvalue { ptr, i8 } %125, 1
  store i8 %129, ptr %128, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %130

130:                                              ; preds = %120
  %131 = load i32, ptr %8, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %8, align 4, !tbaa !5
  br label %41, !llvm.loop !16

133:                                              ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 2, ptr %19, align 4, !tbaa !5
  br label %134

134:                                              ; preds = %148, %133
  %135 = load i32, ptr %19, align 4, !tbaa !5
  %136 = load i32, ptr @n, align 4, !tbaa !5
  %137 = icmp sle i32 %135, %136
  br i1 %137, label %139, label %138

138:                                              ; preds = %134
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %151

139:                                              ; preds = %134
  %140 = load i32, ptr %19, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [100100 x i32], ptr @p, i64 0, i64 %141
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %144
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %146)
  br label %148

148:                                              ; preds = %139
  %149 = load i32, ptr %19, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %19, align 4, !tbaa !5
  br label %134, !llvm.loop !17

151:                                              ; preds = %138
  %152 = call i32 @puts(ptr noundef @.str.3)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  ret i32 0
}

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIiiEEmmEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

declare i32 @puts(ptr noundef) #1

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 = { "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 = { 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 #4 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{i64 0, i64 8, !12}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!15, !6, i64 4}
!15 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_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.0" = type { i32, i32 }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@s = external dso_local global %"class.std::set", align 8
@l = external dso_local local_unnamed_addr global [100100 x i32], align 16
@r = external dso_local local_unnamed_addr global [100100 x i32], align 16
@n = external dso_local global i32, align 4
@a = external dso_local global [100100 x i32], align 16
@p = external dso_local local_unnamed_addr global [100100 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %"struct.std::pair.0", align 8
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %4 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair.0", align 8
  %7 = alloca i32, align 4
  %8 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %9 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %10 = alloca %"struct.std::pair.0", align 8
  %11 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %.not23 = icmp slt i32 %12, 1
  br i1 %.not23, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  %13 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @a, i64 4), ptr noundef nonnull align 4 dereferenceable(4) %2)
  store i64 %13, ptr %1, align 8
  %14 = call { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @s, ptr noundef nonnull align 4 dereferenceable(8) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  call void @_ZNSt23_Rb_tree_const_iteratorISt4pairIiiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  call void @_ZNSt23_Rb_tree_const_iteratorISt4pairIiiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  store i32 2, ptr %5, align 4, !tbaa !5
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %.not2025 = icmp slt i32 %15, 2
  br i1 %.not2025, label %._crit_edge29.thread, label %.lr.ph28

._crit_edge29.thread:                             ; preds = %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  br label %._crit_edge34

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %16 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %indvars.iv
  %17 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %16)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %.not.not = icmp slt i64 %indvars.iv, %19
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge29:                                    ; preds = %69
  %20 = icmp slt i32 %77, 2
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  br i1 %20, label %._crit_edge34, label %.lr.ph33

.lr.ph28:                                         ; preds = %._crit_edge, %69
  %storemerge26 = phi i32 [ %76, %69 ], [ 2, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %21 = sext i32 %storemerge26 to i64
  %22 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %21
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  %23 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %22, ptr noundef nonnull align 4 dereferenceable(4) %7)
  store i64 %23, ptr %6, align 8
  %24 = call ptr @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE11upper_boundERKS1_(ptr noundef nonnull align 8 dereferenceable(48) @s, ptr noundef nonnull align 4 dereferenceable(8) %6)
  store ptr %24, ptr %3, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  %25 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @s) #5
  store ptr %25, ptr %8, align 8
  %26 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  br i1 %26, label %27, label %38

27:                                               ; preds = %.lr.ph28
  %28 = load i32, ptr %5, align 4, !tbaa !5
  %29 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %30 = getelementptr inbounds i8, ptr %29, i64 4
  %31 = load i32, ptr %30, align 4, !tbaa !13
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [100100 x i32], ptr @l, i64 0, i64 %32
  store i32 %28, ptr %33, align 4, !tbaa !5
  %34 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %35 = getelementptr inbounds i8, ptr %34, i64 4
  %36 = load i32, ptr %35, align 4, !tbaa !13
  %37 = load i32, ptr %5, align 4, !tbaa !5
  br label %69

38:                                               ; preds = %.lr.ph28
  %39 = load i64, ptr %3, align 8, !tbaa !11
  store i64 %39, ptr %4, align 8, !tbaa !11
  %40 = call ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIiiEEmmEi(ptr noundef nonnull align 8 dereferenceable(8) %4, i32 noundef 0) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #5
  %41 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @s) #5
  store ptr %41, ptr %9, align 8
  %42 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  br i1 %42, label %46, label %.thread

.thread:                                          ; preds = %38
  %43 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  %44 = getelementptr inbounds i8, ptr %43, i64 4
  %45 = load i32, ptr %44, align 4, !tbaa !13
  br label %54

46:                                               ; preds = %38
  %47 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %48 = getelementptr inbounds i8, ptr %47, i64 4
  %49 = load i32, ptr %48, align 4, !tbaa !13
  %50 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  %51 = getelementptr inbounds i8, ptr %50, i64 4
  %52 = load i32, ptr %51, align 4, !tbaa !13
  %53 = icmp eq i32 %49, -1
  br i1 %53, label %54, label %59

54:                                               ; preds = %.thread, %46
  %55 = phi i32 [ %45, %.thread ], [ %52, %46 ]
  %56 = load i32, ptr %5, align 4, !tbaa !5
  %57 = sext i32 %55 to i64
  %58 = getelementptr inbounds [100100 x i32], ptr @r, i64 0, i64 %57
  store i32 %56, ptr %58, align 4, !tbaa !5
  br label %69

59:                                               ; preds = %46
  %60 = sext i32 %49 to i64
  %61 = getelementptr inbounds [100100 x i32], ptr @l, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = icmp sgt i32 %62, 0
  %64 = load i32, ptr %5, align 4, !tbaa !5
  br i1 %63, label %65, label %68

65:                                               ; preds = %59
  %66 = sext i32 %52 to i64
  %67 = getelementptr inbounds [100100 x i32], ptr @r, i64 0, i64 %66
  store i32 %64, ptr %67, align 4, !tbaa !5
  br label %69

68:                                               ; preds = %59
  store i32 %64, ptr %61, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %54, %68, %65, %27
  %.sink42 = phi i32 [ %56, %54 ], [ %64, %68 ], [ %64, %65 ], [ %37, %27 ]
  %.sink = phi i32 [ %55, %54 ], [ %49, %68 ], [ %52, %65 ], [ %36, %27 ]
  %70 = sext i32 %.sink42 to i64
  %71 = getelementptr inbounds [100100 x i32], ptr @p, i64 0, i64 %70
  store i32 %.sink, ptr %71, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #5
  %72 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %70
  %73 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %72, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i64 %73, ptr %10, align 8
  %74 = call { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @s, ptr noundef nonnull align 4 dereferenceable(8) %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #5
  %75 = load i32, ptr %5, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %5, align 4, !tbaa !5
  %77 = load i32, ptr @n, align 4, !tbaa !5
  %.not20.not = icmp slt i32 %75, %77
  br i1 %.not20.not, label %.lr.ph28, label %._crit_edge29, !llvm.loop !15

._crit_edge34:                                    ; preds = %.lr.ph33, %._crit_edge29.thread, %._crit_edge29
  %78 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  ret i32 0

.lr.ph33:                                         ; preds = %._crit_edge29, %.lr.ph33
  %indvars.iv36 = phi i64 [ %indvars.iv.next37, %.lr.ph33 ], [ 2, %._crit_edge29 ]
  %79 = getelementptr inbounds [100100 x i32], ptr @p, i64 0, i64 %indvars.iv36
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %83)
  %indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
  %85 = load i32, ptr @n, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %.not21.not = icmp slt i64 %indvars.iv36, %86
  br i1 %.not21.not, label %.lr.ph33, label %._crit_edge34, !llvm.loop !16
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIiiEEmmEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

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

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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #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 = !{!"int", !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 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !6, i64 4}
!14 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass