; LLVM IR from tangjz/acm-icpc :: uvalive (6911)

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

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@a = external dso_local global [100001 x i32], align 16
@b = external dso_local global [100001 x i32], align 16
@c = external dso_local global [100001 x i32], align 16
@ans = external dso_local global i32, align 4
@Hash = external dso_local global %"class.std::set", align 8
@seg = external dso_local global [100001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"class.std::set", 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", align 4
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair.0", align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %209, %0
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = load i32, ptr @t, align 4, !tbaa !5
  %22 = icmp sle i32 %20, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %212

24:                                               ; preds = %19
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 48, ptr %4) #7
  call void @llvm.memset.p0.i64(ptr align 8 %4, i8 0, i64 48, i1 false)
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  call void @_ZNSt3setIiSt4lessIiESaIiEE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 8 dereferenceable(48) @Hash) #7
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %50, %24
  %27 = load i32, ptr %5, align 4, !tbaa !5
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %53

31:                                               ; preds = %26
  %32 = load i32, ptr %5, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds i32, ptr @a, i64 %33
  %35 = load i32, ptr %5, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds i32, ptr @b, i64 %36
  %38 = load i32, ptr %5, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds i32, ptr @c, i64 %39
  %41 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %34, ptr noundef %37, ptr noundef %40)
  %42 = load i32, ptr %5, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %43
  %45 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(4) %44)
  %46 = getelementptr inbounds { ptr, i8 }, ptr %6, i32 0, i32 0
  %47 = extractvalue { ptr, i8 } %45, 0
  store ptr %47, ptr %46, align 8
  %48 = getelementptr inbounds { ptr, i8 }, ptr %6, i32 0, i32 1
  %49 = extractvalue { ptr, i8 } %45, 1
  store i8 %49, ptr %48, align 8
  br label %50

50:                                               ; preds = %31
  %51 = load i32, ptr %5, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %5, align 4, !tbaa !5
  br label %26, !llvm.loop !9

53:                                               ; preds = %30
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %106, %53
  %55 = load i32, ptr %7, align 4, !tbaa !5
  %56 = load i32, ptr @n, align 4, !tbaa !5
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %54
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %109

59:                                               ; preds = %54
  %60 = load i32, ptr %7, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %61
  %63 = call noundef i64 @_ZNSt3setIiSt4lessIiESaIiEE5eraseERKi(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(4) %62)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %65
  %67 = call ptr @_ZNSt3setIiSt4lessIiESaIiEE11lower_boundERKi(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(4) %66)
  %68 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %8, i32 0, i32 0
  store ptr %67, ptr %68, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %69 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #7
  %70 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %9, i32 0, i32 0
  store ptr %69, ptr %70, align 8
  %71 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  br i1 %71, label %80, label %72

72:                                               ; preds = %59
  %73 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = load i32, ptr %7, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [100001 x i32], ptr @c, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = icmp sgt i32 %74, %78
  br label %80

80:                                               ; preds = %72, %59
  %81 = phi i1 [ true, %59 ], [ %79, %72 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br i1 %81, label %82, label %97

82:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %83 = load i32, ptr %7, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %84
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %86 = load i32, ptr %7, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [100001 x i32], ptr @c, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = sub nsw i32 0, %89
  store i32 %90, ptr %11, align 4, !tbaa !5
  %91 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %85, ptr noundef nonnull align 4 dereferenceable(4) %11)
  store i64 %91, ptr %10, align 4
  %92 = load i32, ptr @tot, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr @tot, align 4, !tbaa !5
  %94 = sext i32 %92 to i64
  %95 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %94
  %96 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %95, ptr noundef nonnull align 4 dereferenceable(8) %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %97

97:                                               ; preds = %82, %80
  %98 = load i32, ptr %7, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %99
  %101 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(4) %100)
  %102 = getelementptr inbounds { ptr, i8 }, ptr %12, i32 0, i32 0
  %103 = extractvalue { ptr, i8 } %101, 0
  store ptr %103, ptr %102, align 8
  %104 = getelementptr inbounds { ptr, i8 }, ptr %12, i32 0, i32 1
  %105 = extractvalue { ptr, i8 } %101, 1
  store i8 %105, ptr %104, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %106

106:                                              ; preds = %97
  %107 = load i32, ptr %7, align 4, !tbaa !5
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %7, align 4, !tbaa !5
  br label %54, !llvm.loop !11

109:                                              ; preds = %58
  %110 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #7
  %111 = trunc i64 %110 to i32
  store i32 %111, ptr @ans, align 4, !tbaa !5
  %112 = load i32, ptr @tot, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds %"struct.std::pair", ptr @seg, i64 %113
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef @seg, ptr noundef %114)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %115 = load i32, ptr @tot, align 4, !tbaa !5
  %116 = sub nsw i32 %115, 1
  store i32 %116, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 2147483647, ptr %14, align 4, !tbaa !5
  br label %117

117:                                              ; preds = %142, %109
  %118 = load i32, ptr %13, align 4, !tbaa !5
  %119 = icmp sge i32 %118, 0
  br i1 %119, label %121, label %120

120:                                              ; preds = %117
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %145

121:                                              ; preds = %117
  %122 = load i32, ptr %13, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %123
  %125 = getelementptr inbounds %"struct.std::pair", ptr %124, i32 0, i32 1
  %126 = load i32, ptr %125, align 4, !tbaa !12
  %127 = sub nsw i32 0, %126
  %128 = load i32, ptr %14, align 4, !tbaa !5
  %129 = icmp slt i32 %127, %128
  %130 = zext i1 %129 to i32
  %131 = load i32, ptr %13, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %132
  store i32 %130, ptr %133, align 4, !tbaa !5
  br i1 %129, label %134, label %141

134:                                              ; preds = %121
  %135 = load i32, ptr %13, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %136
  %138 = getelementptr inbounds %"struct.std::pair", ptr %137, i32 0, i32 1
  %139 = load i32, ptr %138, align 4, !tbaa !12
  %140 = sub nsw i32 0, %139
  store i32 %140, ptr %14, align 4, !tbaa !5
  br label %141

141:                                              ; preds = %134, %121
  br label %142

142:                                              ; preds = %141
  %143 = load i32, ptr %13, align 4, !tbaa !5
  %144 = add nsw i32 %143, -1
  store i32 %144, ptr %13, align 4, !tbaa !5
  br label %117, !llvm.loop !14

145:                                              ; preds = %120
  store i32 0, ptr @n, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %146

146:                                              ; preds = %167, %145
  %147 = load i32, ptr %15, align 4, !tbaa !5
  %148 = load i32, ptr @tot, align 4, !tbaa !5
  %149 = icmp slt i32 %147, %148
  br i1 %149, label %151, label %150

150:                                              ; preds = %146
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %170

151:                                              ; preds = %146
  %152 = load i32, ptr %15, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %153
  %155 = load i32, ptr %154, align 4, !tbaa !5
  %156 = icmp ne i32 %155, 0
  br i1 %156, label %157, label %166

157:                                              ; preds = %151
  %158 = load i32, ptr %15, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %159
  %161 = load i32, ptr @n, align 4, !tbaa !5
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr @n, align 4, !tbaa !5
  %163 = sext i32 %161 to i64
  %164 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %163
  %165 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %164, ptr noundef nonnull align 4 dereferenceable(8) %160)
  br label %166

166:                                              ; preds = %157, %151
  br label %167

167:                                              ; preds = %166
  %168 = load i32, ptr %15, align 4, !tbaa !5
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %15, align 4, !tbaa !5
  br label %146, !llvm.loop !15

170:                                              ; preds = %150
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %171

171:                                              ; preds = %201, %170
  %172 = load i32, ptr %16, align 4, !tbaa !5
  %173 = load i32, ptr @n, align 4, !tbaa !5
  %174 = icmp slt i32 %172, %173
  br i1 %174, label %176, label %175

175:                                              ; preds = %171
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %205

176:                                              ; preds = %171
  br label %177

177:                                              ; preds = %197, %176
  %178 = load i32, ptr %17, align 4, !tbaa !5
  %179 = load i32, ptr @n, align 4, !tbaa !5
  %180 = icmp slt i32 %178, %179
  br i1 %180, label %181, label %194

181:                                              ; preds = %177
  %182 = load i32, ptr %17, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %183
  %185 = getelementptr inbounds %"struct.std::pair", ptr %184, i32 0, i32 0
  %186 = load i32, ptr %185, align 8, !tbaa !16
  %187 = load i32, ptr %16, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %188
  %190 = getelementptr inbounds %"struct.std::pair", ptr %189, i32 0, i32 1
  %191 = load i32, ptr %190, align 4, !tbaa !12
  %192 = sub nsw i32 0, %191
  %193 = icmp sle i32 %186, %192
  br label %194

194:                                              ; preds = %181, %177
  %195 = phi i1 [ false, %177 ], [ %193, %181 ]
  br i1 %195, label %196, label %200

196:                                              ; preds = %194
  br label %197

197:                                              ; preds = %196
  %198 = load i32, ptr %17, align 4, !tbaa !5
  %199 = add nsw i32 %198, 1
  store i32 %199, ptr %17, align 4, !tbaa !5
  br label %177, !llvm.loop !17

200:                                              ; preds = %194
  br label %201

201:                                              ; preds = %200
  %202 = load i32, ptr %17, align 4, !tbaa !5
  store i32 %202, ptr %16, align 4, !tbaa !5
  %203 = load i32, ptr @ans, align 4, !tbaa !5
  %204 = add nsw i32 %203, 1
  store i32 %204, ptr @ans, align 4, !tbaa !5
  br label %171, !llvm.loop !18

205:                                              ; preds = %175
  %206 = load i32, ptr %2, align 4, !tbaa !5
  %207 = load i32, ptr @ans, align 4, !tbaa !5
  %208 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %206, i32 noundef %207)
  br label %209

209:                                              ; preds = %205
  %210 = load i32, ptr %2, align 4, !tbaa !5
  %211 = add nsw i32 %210, 1
  store i32 %211, ptr %2, align 4, !tbaa !5
  br label %19, !llvm.loop !19

212:                                              ; preds = %23
  ret i32 0
}

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) #0 align 2

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

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

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

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef, ptr noundef) #6

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

declare i32 @printf(ptr noundef, ...) #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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 = { 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 #7 = { 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 = distinct !{!11, !10}
!12 = !{!13, !6, i64 4}
!13 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = !{!13, !6, i64 0}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !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<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<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" = type { i32, i32 }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@a = external dso_local global [100001 x i32], align 16
@b = external dso_local global [100001 x i32], align 16
@c = external dso_local global [100001 x i32], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@Hash = external dso_local global %"class.std::set", align 8
@seg = external dso_local global [100001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca %"class.std::set", align 8
  %2 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %3 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca i32, align 4
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %7 = load i32, ptr @t, align 4, !tbaa !5
  %.not64 = icmp slt i32 %7, 1
  br i1 %.not64, label %._crit_edge68, label %.lr.ph67

._crit_edge68:                                    ; preds = %95, %0
  ret i32 0

.lr.ph67:                                         ; preds = %0, %95
  %.04265 = phi i32 [ %98, %95 ], [ 1, %0 ]
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %1) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %1, i8 0, i64 48, i1 false)
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #8
  call void @_ZNSt3setIiSt4lessIiESaIiEE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(48) @Hash) #8
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #8
  %9 = load i32, ptr @n, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.lr.ph67
  store i32 0, ptr @tot, align 4, !tbaa !5
  br label %._crit_edge52

._crit_edge:                                      ; preds = %.lr.ph
  store i32 0, ptr @tot, align 4, !tbaa !5
  %11 = icmp sgt i32 %17, 0
  br i1 %11, label %.lr.ph51, label %._crit_edge52

.lr.ph:                                           ; preds = %.lr.ph67, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph67 ]
  %12 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %13 = getelementptr inbounds i32, ptr @b, i64 %indvars.iv
  %14 = getelementptr inbounds i32, ptr @c, i64 %indvars.iv
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %12, ptr noundef nonnull %13, ptr noundef nonnull %14)
  %16 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = icmp slt i64 %indvars.iv.next, %18
  br i1 %19, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge52:                                    ; preds = %50, %._crit_edge.thread, %._crit_edge
  %20 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #8
  %21 = trunc i64 %20 to i32
  store i32 %21, ptr @ans, align 4, !tbaa !5
  %22 = load i32, ptr @tot, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds %"struct.std::pair", ptr @seg, i64 %23
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef nonnull @seg, ptr noundef nonnull %24)
  %25 = load i32, ptr @tot, align 4, !tbaa !5
  %26 = icmp sgt i32 %25, 0
  br i1 %26, label %.lr.ph56.preheader, label %._crit_edge57.thread

._crit_edge57.thread:                             ; preds = %._crit_edge52
  store i32 0, ptr @n, align 4, !tbaa !5
  br label %.preheader47.thread

.lr.ph56.preheader:                               ; preds = %._crit_edge52
  %27 = zext nneg i32 %25 to i64
  %xtraiter = and i64 %27, 1
  %28 = icmp eq i32 %25, 1
  br i1 %28, label %._crit_edge57.unr-lcssa, label %.lr.ph56.preheader.new

.lr.ph56.preheader.new:                           ; preds = %.lr.ph56.preheader
  %unroll_iter = and i64 %27, 2147483646
  br label %.lr.ph56

.lr.ph51:                                         ; preds = %._crit_edge, %50
  %indvars.iv70 = phi i64 [ %indvars.iv.next71, %50 ], [ 0, %._crit_edge ]
  %29 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %indvars.iv70
  %30 = call noundef i64 @_ZNSt3setIiSt4lessIiESaIiEE5eraseERKi(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(4) %29)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  %31 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %indvars.iv70
  %32 = call ptr @_ZNSt3setIiSt4lessIiESaIiEE11lower_boundERKi(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(4) %31)
  store ptr %32, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  %33 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #8
  store ptr %33, ptr %3, align 8
  %34 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #8
  br i1 %34, label %.critedge, label %35

35:                                               ; preds = %.lr.ph51
  %36 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #8
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = getelementptr inbounds [100001 x i32], ptr @c, i64 0, i64 %indvars.iv70
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = icmp sgt i32 %37, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  br i1 %40, label %41, label %50

.critedge:                                        ; preds = %.lr.ph51
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  %.phi.trans.insert = getelementptr inbounds [100001 x i32], ptr @c, i64 0, i64 %indvars.iv70
  %.pre = load i32, ptr %.phi.trans.insert, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %.critedge, %35
  %42 = phi i32 [ %.pre, %.critedge ], [ %39, %35 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  %43 = sub nsw i32 0, %42
  store i32 %43, ptr %5, align 4, !tbaa !5
  %44 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %31, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i64 %44, ptr %4, align 8
  %45 = load i32, ptr @tot, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr @tot, align 4, !tbaa !5
  %47 = sext i32 %45 to i64
  %48 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %47
  %49 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %48, ptr noundef nonnull align 4 dereferenceable(8) %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  br label %50

50:                                               ; preds = %41, %35
  %51 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(4) %29)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %52 = load i32, ptr @n, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = icmp slt i64 %indvars.iv.next71, %53
  br i1 %54, label %.lr.ph51, label %._crit_edge52, !llvm.loop !11

._crit_edge57.unr-lcssa:                          ; preds = %.lr.ph56, %.lr.ph56.preheader
  %indvars.iv73.unr = phi i64 [ %27, %.lr.ph56.preheader ], [ %indvars.iv.next74.1, %.lr.ph56 ]
  %.03954.unr = phi i32 [ 2147483647, %.lr.ph56.preheader ], [ %spec.select.1, %.lr.ph56 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge57, label %.lr.ph56.epil

.lr.ph56.epil:                                    ; preds = %._crit_edge57.unr-lcssa
  %indvars.iv.next74.epil = add nsw i64 %indvars.iv73.unr, -1
  %55 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %indvars.iv.next74.epil, i32 1
  %56 = load i32, ptr %55, align 4, !tbaa !12
  %57 = sub nsw i32 0, %56
  %58 = icmp sgt i32 %.03954.unr, %57
  %59 = zext i1 %58 to i32
  %60 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %indvars.iv.next74.epil
  store i32 %59, ptr %60, align 4, !tbaa !5
  br label %._crit_edge57

._crit_edge57:                                    ; preds = %._crit_edge57.unr-lcssa, %.lr.ph56.epil
  store i32 0, ptr @n, align 4, !tbaa !5
  br i1 %26, label %.lr.ph60, label %.preheader47.thread

.lr.ph56:                                         ; preds = %.lr.ph56, %.lr.ph56.preheader.new
  %indvars.iv73 = phi i64 [ %27, %.lr.ph56.preheader.new ], [ %indvars.iv.next74.1, %.lr.ph56 ]
  %.03954 = phi i32 [ 2147483647, %.lr.ph56.preheader.new ], [ %spec.select.1, %.lr.ph56 ]
  %niter = phi i64 [ 0, %.lr.ph56.preheader.new ], [ %niter.next.1, %.lr.ph56 ]
  %indvars.iv.next74 = add nsw i64 %indvars.iv73, -1
  %61 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %indvars.iv.next74, i32 1
  %62 = load i32, ptr %61, align 4, !tbaa !12
  %63 = sub nsw i32 0, %62
  %64 = icmp sgt i32 %.03954, %63
  %65 = zext i1 %64 to i32
  %66 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %indvars.iv.next74
  store i32 %65, ptr %66, align 4, !tbaa !5
  %spec.select = call i32 @llvm.smin.i32(i32 %.03954, i32 %63)
  %indvars.iv.next74.1 = add nsw i64 %indvars.iv73, -2
  %67 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %indvars.iv.next74.1, i32 1
  %68 = load i32, ptr %67, align 4, !tbaa !12
  %69 = sub nsw i32 0, %68
  %70 = icmp sgt i32 %spec.select, %69
  %71 = zext i1 %70 to i32
  %72 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %indvars.iv.next74.1
  store i32 %71, ptr %72, align 4, !tbaa !5
  %spec.select.1 = call i32 @llvm.smin.i32(i32 %spec.select, i32 %69)
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1.not = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1.not, label %._crit_edge57.unr-lcssa, label %.lr.ph56, !llvm.loop !14

.preheader47.thread:                              ; preds = %._crit_edge57, %._crit_edge57.thread
  %ans.promoted84 = load i32, ptr @ans, align 4, !tbaa !5
  br label %95

.preheader47:                                     ; preds = %85
  %.pre83 = load i32, ptr @n, align 4, !tbaa !5
  %ans.promoted = load i32, ptr @ans, align 4, !tbaa !5
  %73 = icmp sgt i32 %.pre83, 0
  br i1 %73, label %.preheader.preheader, label %95

.preheader.preheader:                             ; preds = %.preheader47
  %74 = zext nneg i32 %.pre83 to i64
  br label %.preheader

.lr.ph60:                                         ; preds = %._crit_edge57, %85
  %75 = phi i32 [ %86, %85 ], [ %25, %._crit_edge57 ]
  %indvars.iv76 = phi i64 [ %indvars.iv.next77, %85 ], [ 0, %._crit_edge57 ]
  %76 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %indvars.iv76
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %.not46 = icmp eq i32 %77, 0
  br i1 %.not46, label %85, label %78

78:                                               ; preds = %.lr.ph60
  %79 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %indvars.iv76
  %80 = load i32, ptr @n, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr @n, align 4, !tbaa !5
  %82 = sext i32 %80 to i64
  %83 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %82
  %84 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %83, ptr noundef nonnull align 4 dereferenceable(8) %79)
  %.pre82 = load i32, ptr @tot, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %.lr.ph60, %78
  %86 = phi i32 [ %75, %.lr.ph60 ], [ %.pre82, %78 ]
  %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
  %87 = sext i32 %86 to i64
  %88 = icmp slt i64 %indvars.iv.next77, %87
  br i1 %88, label %.lr.ph60, label %.preheader47, !llvm.loop !15

.preheader:                                       ; preds = %.preheader.preheader, %.critedge2
  %.062 = phi i64 [ %indvars.iv79, %.critedge2 ], [ 0, %.preheader.preheader ]
  %89 = phi i32 [ %107, %.critedge2 ], [ %ans.promoted, %.preheader.preheader ]
  %sext = shl i64 %.062, 32
  %90 = ashr exact i64 %sext, 32
  %91 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %90, i32 1
  %92 = load i32, ptr %91, align 4, !tbaa !12
  %93 = sub nsw i32 0, %92
  br label %100

._crit_edge63:                                    ; preds = %.critedge2, %.critedge2.thread
  %94 = phi i32 [ %105, %.critedge2.thread ], [ %107, %.critedge2 ]
  store i32 %94, ptr @ans, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %.preheader47.thread, %._crit_edge63, %.preheader47
  %96 = phi i32 [ %94, %._crit_edge63 ], [ %ans.promoted, %.preheader47 ], [ %ans.promoted84, %.preheader47.thread ]
  %97 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.04265, i32 noundef %96)
  %98 = add nuw nsw i32 %.04265, 1
  %99 = load i32, ptr @t, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.04265, %99
  br i1 %.not.not, label %.lr.ph67, label %._crit_edge68, !llvm.loop !16

100:                                              ; preds = %.preheader, %103
  %indvars.iv79 = phi i64 [ %90, %.preheader ], [ %indvars.iv.next80, %103 ]
  %101 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %indvars.iv79
  %102 = load i32, ptr %101, align 8, !tbaa !17
  %.not45 = icmp sgt i32 %102, %93
  br i1 %.not45, label %.critedge2, label %103

103:                                              ; preds = %100
  %indvars.iv.next80 = add nsw i64 %indvars.iv79, 1
  %104 = icmp slt i64 %indvars.iv.next80, %74
  br i1 %104, label %100, label %.critedge2.thread, !llvm.loop !18

.critedge2.thread:                                ; preds = %103
  %105 = add nsw i32 %89, 1
  br label %._crit_edge63

.critedge2:                                       ; preds = %100
  %106 = trunc nsw i64 %indvars.iv79 to i32
  %107 = add nsw i32 %89, 1
  %108 = icmp sgt i32 %.pre83, %106
  br i1 %108, label %.preheader, label %._crit_edge63, !llvm.loop !19
}

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #0 align 2

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

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

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

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef, ptr noundef) local_unnamed_addr #6

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7

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 = { 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 = { 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { 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 = distinct !{!11, !10}
!12 = !{!13, !6, i64 4}
!13 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!13, !6, i64 0}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}


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