; LLVM IR from lzyrapx/Competitive-Programming :: 百度之星/2019 (1002)

; 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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, 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::_Rb_tree_iterator" = type { ptr }
%"struct.std::pair" = type { i32, i32 }

@l = external dso_local global [1000123 x i32], align 16
@r = external dso_local global [1000123 x i32], align 16
@a = external dso_local global [1000123 x i32], align 16
@pos = external dso_local global [1000123 x i32], align 16
@num = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6updatei(i32 noundef) #0

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

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

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

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

26:                                               ; preds = %258, %2
  %27 = load i32, ptr %6, align 4, !tbaa !5
  %28 = add nsw i32 %27, -1
  store i32 %28, ptr %6, align 4, !tbaa !5
  %29 = icmp ne i32 %27, 0
  br i1 %29, label %30, label %265

30:                                               ; preds = %26
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 48, ptr %7) #6
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %93, %30
  %33 = load i32, ptr %8, align 4, !tbaa !5
  %34 = load i32, ptr @n, align 4, !tbaa !5
  %35 = icmp sle i32 %33, %34
  br i1 %35, label %37, label %36

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

37:                                               ; preds = %32
  %38 = load i32, ptr %8, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [1000123 x i32], ptr @l, i64 0, i64 %39
  %41 = load i32, ptr %8, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [1000123 x i32], ptr @r, i64 0, i64 %42
  %44 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %40, ptr noundef %43)
          to label %45 unwind label %80

45:                                               ; preds = %37
  %46 = load i32, ptr %8, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [1000123 x i32], ptr @r, i64 0, i64 %47
  %49 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 4 dereferenceable(4) %48)
          to label %50 unwind label %80

50:                                               ; preds = %45
  store i32 0, ptr %49, align 4, !tbaa !5
  %51 = load i32, ptr %8, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [1000123 x i32], ptr @l, i64 0, i64 %52
  %54 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 4 dereferenceable(4) %53)
          to label %55 unwind label %80

55:                                               ; preds = %50
  store i32 0, ptr %54, align 4, !tbaa !5
  %56 = load i32, ptr %8, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [1000123 x i32], ptr @l, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = load i32, ptr %8, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [1000123 x i32], ptr @r, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = icmp slt i32 %59, %63
  br i1 %64, label %65, label %92

65:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %66 = load i32, ptr %8, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [1000123 x i32], ptr @l, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %11, align 4, !tbaa !5
  %71 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 4 dereferenceable(4) %11)
          to label %72 unwind label %84

72:                                               ; preds = %65
  store i32 0, ptr %71, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %73 = load i32, ptr %8, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1000123 x i32], ptr @r, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = sub nsw i32 %76, 1
  store i32 %77, ptr %12, align 4, !tbaa !5
  %78 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 4 dereferenceable(4) %12)
          to label %79 unwind label %88

79:                                               ; preds = %72
  store i32 0, ptr %78, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %92

80:                                               ; preds = %50, %45, %37
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %9, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %10, align 4
  br label %96

84:                                               ; preds = %65
  %85 = landingpad { ptr, i32 }
          cleanup
  %86 = extractvalue { ptr, i32 } %85, 0
  store ptr %86, ptr %9, align 8
  %87 = extractvalue { ptr, i32 } %85, 1
  store i32 %87, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %96

88:                                               ; preds = %72
  %89 = landingpad { ptr, i32 }
          cleanup
  %90 = extractvalue { ptr, i32 } %89, 0
  store ptr %90, ptr %9, align 8
  %91 = extractvalue { ptr, i32 } %89, 1
  store i32 %91, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %96

92:                                               ; preds = %79, %55
  br label %93

93:                                               ; preds = %92
  %94 = load i32, ptr %8, align 4, !tbaa !5
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %8, align 4, !tbaa !5
  br label %32, !llvm.loop !11

96:                                               ; preds = %88, %84, %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %264

97:                                               ; preds = %36
  store i32 0, ptr @num, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  store ptr %7, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %98 = load ptr, ptr %13, align 8, !tbaa !9
  %99 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %98) #6
  %100 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %14, i32 0, i32 0
  store ptr %99, ptr %100, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %101 = load ptr, ptr %13, align 8, !tbaa !9
  %102 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %101) #6
  %103 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %15, i32 0, i32 0
  store ptr %102, ptr %103, align 8
  br label %104

104:                                              ; preds = %120, %97
  %105 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  br i1 %105, label %107, label %106

106:                                              ; preds = %104
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %122

107:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %108 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #6
  store ptr %108, ptr %16, align 8, !tbaa !9
  %109 = load i32, ptr @num, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr @num, align 4, !tbaa !5
  %111 = load i32, ptr @num, align 4, !tbaa !5
  %112 = load ptr, ptr %16, align 8, !tbaa !9
  %113 = getelementptr inbounds %"struct.std::pair", ptr %112, i32 0, i32 1
  store i32 %111, ptr %113, align 4, !tbaa !13
  %114 = load ptr, ptr %16, align 8, !tbaa !9
  %115 = getelementptr inbounds %"struct.std::pair", ptr %114, i32 0, i32 0
  %116 = load i32, ptr %115, align 4, !tbaa !15
  %117 = load i32, ptr @num, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [1000123 x i32], ptr @pos, i64 0, i64 %118
  store i32 %116, ptr %119, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %120

120:                                              ; preds = %107
  %121 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKiiEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #6
  br label %104

122:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 1, ptr %17, align 4, !tbaa !5
  br label %123

123:                                              ; preds = %132, %122
  %124 = load i32, ptr %17, align 4, !tbaa !5
  %125 = load i32, ptr @num, align 4, !tbaa !5
  %126 = icmp sle i32 %124, %125
  br i1 %126, label %128, label %127

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

128:                                              ; preds = %123
  %129 = load i32, ptr %17, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [1000123 x i32], ptr @a, i64 0, i64 %130
  store i32 0, ptr %131, align 4, !tbaa !5
  br label %132

132:                                              ; preds = %128
  %133 = load i32, ptr %17, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %17, align 4, !tbaa !5
  br label %123, !llvm.loop !16

135:                                              ; preds = %127
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 1, ptr %18, align 4, !tbaa !5
  br label %136

136:                                              ; preds = %231, %135
  %137 = load i32, ptr %18, align 4, !tbaa !5
  %138 = load i32, ptr @n, align 4, !tbaa !5
  %139 = icmp sle i32 %137, %138
  br i1 %139, label %141, label %140

140:                                              ; preds = %136
  store i32 12, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %235

141:                                              ; preds = %136
  %142 = load i32, ptr %18, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [1000123 x i32], ptr @l, i64 0, i64 %143
  %145 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 4 dereferenceable(4) %144)
          to label %146 unwind label %184

146:                                              ; preds = %141
  %147 = load i32, ptr %145, align 4, !tbaa !5
  invoke void @_Z6updatei(i32 noundef %147)
          to label %148 unwind label %184

148:                                              ; preds = %146
  %149 = load i32, ptr %18, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [1000123 x i32], ptr @r, i64 0, i64 %150
  %152 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 4 dereferenceable(4) %151)
          to label %153 unwind label %184

153:                                              ; preds = %148
  %154 = load i32, ptr %152, align 4, !tbaa !5
  invoke void @_Z6updatei(i32 noundef %154)
          to label %155 unwind label %184

155:                                              ; preds = %153
  %156 = load i32, ptr %18, align 4, !tbaa !5
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [1000123 x i32], ptr @l, i64 0, i64 %157
  %159 = load i32, ptr %158, align 4, !tbaa !5
  %160 = load i32, ptr %18, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [1000123 x i32], ptr @r, i64 0, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !5
  %164 = icmp slt i32 %159, %163
  br i1 %164, label %165, label %196

165:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %166 = load i32, ptr %18, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [1000123 x i32], ptr @l, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !5
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr %20, align 4, !tbaa !5
  %171 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 4 dereferenceable(4) %20)
          to label %172 unwind label %188

172:                                              ; preds = %165
  %173 = load i32, ptr %171, align 4, !tbaa !5
  invoke void @_Z6updatei(i32 noundef %173)
          to label %174 unwind label %188

174:                                              ; preds = %172
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  %175 = load i32, ptr %18, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [1000123 x i32], ptr @r, i64 0, i64 %176
  %178 = load i32, ptr %177, align 4, !tbaa !5
  %179 = sub nsw i32 %178, 1
  store i32 %179, ptr %21, align 4, !tbaa !5
  %180 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %181 unwind label %192

181:                                              ; preds = %174
  %182 = load i32, ptr %180, align 4, !tbaa !5
  invoke void @_Z6updatei(i32 noundef %182)
          to label %183 unwind label %192

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

184:                                              ; preds = %153, %148, %146, %141
  %185 = landingpad { ptr, i32 }
          cleanup
  %186 = extractvalue { ptr, i32 } %185, 0
  store ptr %186, ptr %9, align 8
  %187 = extractvalue { ptr, i32 } %185, 1
  store i32 %187, ptr %10, align 4
  br label %234

188:                                              ; preds = %172, %165
  %189 = landingpad { ptr, i32 }
          cleanup
  %190 = extractvalue { ptr, i32 } %189, 0
  store ptr %190, ptr %9, align 8
  %191 = extractvalue { ptr, i32 } %189, 1
  store i32 %191, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %234

192:                                              ; preds = %181, %174
  %193 = landingpad { ptr, i32 }
          cleanup
  %194 = extractvalue { ptr, i32 } %193, 0
  store ptr %194, ptr %9, align 8
  %195 = extractvalue { ptr, i32 } %193, 1
  store i32 %195, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %234

196:                                              ; preds = %183, %155
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 1, ptr %22, align 4, !tbaa !5
  br label %197

197:                                              ; preds = %227, %196
  %198 = load i32, ptr %22, align 4, !tbaa !5
  %199 = load i32, ptr @num, align 4, !tbaa !5
  %200 = icmp sle i32 %198, %199
  br i1 %200, label %202, label %201

201:                                              ; preds = %197
  store i32 15, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  br label %230

202:                                              ; preds = %197
  %203 = load i32, ptr %18, align 4, !tbaa !5
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [1000123 x i32], ptr @l, i64 0, i64 %204
  %206 = load i32, ptr %205, align 4, !tbaa !5
  %207 = load i32, ptr %22, align 4, !tbaa !5
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [1000123 x i32], ptr @pos, i64 0, i64 %208
  %210 = load i32, ptr %209, align 4, !tbaa !5
  %211 = icmp sgt i32 %206, %210
  br i1 %211, label %222, label %212

212:                                              ; preds = %202
  %213 = load i32, ptr %18, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [1000123 x i32], ptr @r, i64 0, i64 %214
  %216 = load i32, ptr %215, align 4, !tbaa !5
  %217 = load i32, ptr %22, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [1000123 x i32], ptr @pos, i64 0, i64 %218
  %220 = load i32, ptr %219, align 4, !tbaa !5
  %221 = icmp slt i32 %216, %220
  br i1 %221, label %222, label %226

222:                                              ; preds = %212, %202
  %223 = load i32, ptr %22, align 4, !tbaa !5
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds [1000123 x i32], ptr @a, i64 0, i64 %224
  store i32 1000000000, ptr %225, align 4, !tbaa !5
  br label %226

226:                                              ; preds = %222, %212
  br label %227

227:                                              ; preds = %226
  %228 = load i32, ptr %22, align 4, !tbaa !5
  %229 = add nsw i32 %228, 1
  store i32 %229, ptr %22, align 4, !tbaa !5
  br label %197, !llvm.loop !17

230:                                              ; preds = %201
  br label %231

231:                                              ; preds = %230
  %232 = load i32, ptr %18, align 4, !tbaa !5
  %233 = add nsw i32 %232, 1
  store i32 %233, ptr %18, align 4, !tbaa !5
  br label %136, !llvm.loop !18

234:                                              ; preds = %192, %188, %184
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %264

235:                                              ; preds = %140
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  store i32 1000000000, ptr %23, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  store i32 1, ptr %24, align 4, !tbaa !5
  br label %236

236:                                              ; preds = %248, %235
  %237 = load i32, ptr %24, align 4, !tbaa !5
  %238 = load i32, ptr @num, align 4, !tbaa !5
  %239 = icmp sle i32 %237, %238
  br i1 %239, label %241, label %240

240:                                              ; preds = %236
  store i32 18, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %255

241:                                              ; preds = %236
  %242 = load i32, ptr %24, align 4, !tbaa !5
  %243 = sext i32 %242 to i64
  %244 = getelementptr inbounds [1000123 x i32], ptr @a, i64 0, i64 %243
  %245 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %23, ptr noundef nonnull align 4 dereferenceable(4) %244)
          to label %246 unwind label %251

246:                                              ; preds = %241
  %247 = load i32, ptr %245, align 4, !tbaa !5
  store i32 %247, ptr %23, align 4, !tbaa !5
  br label %248

248:                                              ; preds = %246
  %249 = load i32, ptr %24, align 4, !tbaa !5
  %250 = add nsw i32 %249, 1
  store i32 %250, ptr %24, align 4, !tbaa !5
  br label %236, !llvm.loop !19

251:                                              ; preds = %241
  %252 = landingpad { ptr, i32 }
          cleanup
  %253 = extractvalue { ptr, i32 } %252, 0
  store ptr %253, ptr %9, align 8
  %254 = extractvalue { ptr, i32 } %252, 1
  store i32 %254, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %263

255:                                              ; preds = %240
  %256 = load i32, ptr %23, align 4, !tbaa !5
  %257 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %256)
          to label %258 unwind label %259

258:                                              ; preds = %255
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %7) #6
  br label %26, !llvm.loop !20

259:                                              ; preds = %255
  %260 = landingpad { ptr, i32 }
          cleanup
  %261 = extractvalue { ptr, i32 } %260, 0
  store ptr %261, ptr %9, align 8
  %262 = extractvalue { ptr, i32 } %260, 1
  store i32 %262, ptr %10, align 4
  br label %263

263:                                              ; preds = %259, %251
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  br label %264

264:                                              ; preds = %263, %234, %96
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %267

265:                                              ; preds = %26
  store i32 0, ptr %3, align 4
  store i32 1, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %266 = load i32, ptr %3, align 4
  ret i32 %266

267:                                              ; preds = %264
  %268 = load ptr, ptr %9, align 8
  %269 = load i32, ptr %10, align 4
  %270 = insertvalue { ptr, i32 } poison, ptr %268, 0
  %271 = insertvalue { ptr, i32 } %270, i32 %269, 1
  resume { ptr, i32 } %271
}

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #3 = { 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 #4 = { "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 = { 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 #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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !6, i64 4}
!14 = !{!"_ZTSSt4pairIKiiE", !6, i64 0, !6, i64 4}
!15 = !{!14, !6, i64 0}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}


; 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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, 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::_Rb_tree_iterator" = type { ptr }

@l = external dso_local global [1000123 x i32], align 16
@r = external dso_local global [1000123 x i32], align 16
@a = external dso_local global [1000123 x i32], align 16
@pos = external dso_local local_unnamed_addr global [1000123 x i32], align 16
@num = external dso_local local_unnamed_addr global i32, align 4
@n = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6updatei(i32 noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca %"class.std::map", align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %8 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %3)
  %13 = load i32, ptr %3, align 4, !tbaa !5
  %14 = add nsw i32 %13, -1
  store i32 %14, ptr %3, align 4, !tbaa !5
  %.not78 = icmp eq i32 %13, 0
  br i1 %.not78, label %._crit_edge81, label %.lr.ph80

.lr.ph80:                                         ; preds = %2, %._crit_edge77
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #7
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %.not4655 = icmp slt i32 %16, 1
  br i1 %.not4655, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %44, %.lr.ph80
  store i32 0, ptr @num, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %17 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  store ptr %17, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %18 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  store ptr %18, ptr %8, align 8
  %19 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  br i1 %19, label %.lr.ph58, label %._crit_edge59

.lr.ph:                                           ; preds = %.lr.ph80, %44
  %indvars.iv = phi i64 [ %indvars.iv.next, %44 ], [ 1, %.lr.ph80 ]
  %20 = getelementptr inbounds [1000123 x i32], ptr @l, i64 0, i64 %indvars.iv
  %21 = getelementptr inbounds [1000123 x i32], ptr @r, i64 0, i64 %indvars.iv
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %20, ptr noundef nonnull %21)
  %23 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %24 unwind label %38

24:                                               ; preds = %.lr.ph
  store i32 0, ptr %23, align 4, !tbaa !5
  %25 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %20)
          to label %26 unwind label %38

26:                                               ; preds = %24
  store i32 0, ptr %25, align 4, !tbaa !5
  %27 = load i32, ptr %20, align 4, !tbaa !5
  %28 = load i32, ptr %21, align 4, !tbaa !5
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %30, label %44

30:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  %31 = add nsw i32 %27, 1
  store i32 %31, ptr %5, align 4, !tbaa !5
  %32 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %33 unwind label %40

33:                                               ; preds = %30
  store i32 0, ptr %32, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %34 = load i32, ptr %21, align 4, !tbaa !5
  %35 = add nsw i32 %34, -1
  store i32 %35, ptr %6, align 4, !tbaa !5
  %36 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %37 unwind label %42

37:                                               ; preds = %33
  store i32 0, ptr %36, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  br label %44

38:                                               ; preds = %24, %.lr.ph
  %39 = landingpad { ptr, i32 }
          cleanup
  br label %135

40:                                               ; preds = %30
  %41 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  br label %135

42:                                               ; preds = %33
  %43 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  br label %135

44:                                               ; preds = %26, %37
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %45 = load i32, ptr @n, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %.not46.not = icmp slt i64 %indvars.iv, %46
  br i1 %.not46.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge59:                                    ; preds = %.lr.ph58, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  %47 = load i32, ptr @num, align 4, !tbaa !5
  %.not4760 = icmp slt i32 %47, 1
  br i1 %.not4760, label %.preheader, label %.lr.ph63.preheader

.lr.ph63.preheader:                               ; preds = %._crit_edge59
  %48 = zext nneg i32 %47 to i64
  %49 = shl nuw nsw i64 %48, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @a, i64 4), i8 0, i64 %49, i1 false), !tbaa !5
  br label %.preheader

.lr.ph58:                                         ; preds = %._crit_edge, %.lr.ph58
  %50 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  %51 = load i32, ptr @num, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr @num, align 4, !tbaa !5
  %53 = getelementptr inbounds i8, ptr %50, i64 4
  store i32 %52, ptr %53, align 4, !tbaa !11
  %54 = load i32, ptr %50, align 4, !tbaa !13
  %55 = sext i32 %52 to i64
  %56 = getelementptr inbounds [1000123 x i32], ptr @pos, i64 0, i64 %55
  store i32 %54, ptr %56, align 4, !tbaa !5
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKiiEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  %58 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  br i1 %58, label %.lr.ph58, label %._crit_edge59

.preheader:                                       ; preds = %.lr.ph63.preheader, %._crit_edge59
  %59 = load i32, ptr @n, align 4, !tbaa !5
  %.not4869 = icmp slt i32 %59, 1
  br i1 %.not4869, label %._crit_edge72, label %.lr.ph71

._crit_edge72:                                    ; preds = %._crit_edge68, %.preheader
  %60 = phi i32 [ %47, %.preheader ], [ %93, %._crit_edge68 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #7
  store i32 1000000000, ptr %11, align 4, !tbaa !5
  %.not4973 = icmp slt i32 %60, 1
  br i1 %.not4973, label %._crit_edge77, label %.lr.ph76

.lr.ph71:                                         ; preds = %.preheader, %._crit_edge68
  %indvars.iv89 = phi i64 [ %indvars.iv.next90, %._crit_edge68 ], [ 1, %.preheader ]
  %61 = getelementptr inbounds [1000123 x i32], ptr @l, i64 0, i64 %indvars.iv89
  %62 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %61)
          to label %63 unwind label %86

63:                                               ; preds = %.lr.ph71
  %64 = load i32, ptr %62, align 4, !tbaa !5
  invoke void @_Z6updatei(i32 noundef %64)
          to label %65 unwind label %86

65:                                               ; preds = %63
  %66 = getelementptr inbounds [1000123 x i32], ptr @r, i64 0, i64 %indvars.iv89
  %67 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %66)
          to label %68 unwind label %86

68:                                               ; preds = %65
  %69 = load i32, ptr %67, align 4, !tbaa !5
  invoke void @_Z6updatei(i32 noundef %69)
          to label %70 unwind label %86

70:                                               ; preds = %68
  %71 = load i32, ptr %61, align 4, !tbaa !5
  %72 = load i32, ptr %66, align 4, !tbaa !5
  %73 = icmp slt i32 %71, %72
  br i1 %73, label %74, label %92

74:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  %75 = add nsw i32 %71, 1
  store i32 %75, ptr %9, align 4, !tbaa !5
  %76 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %77 unwind label %88

77:                                               ; preds = %74
  %78 = load i32, ptr %76, align 4, !tbaa !5
  invoke void @_Z6updatei(i32 noundef %78)
          to label %79 unwind label %88

79:                                               ; preds = %77
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #7
  %80 = load i32, ptr %66, align 4, !tbaa !5
  %81 = add nsw i32 %80, -1
  store i32 %81, ptr %10, align 4, !tbaa !5
  %82 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %10)
          to label %83 unwind label %90

83:                                               ; preds = %79
  %84 = load i32, ptr %82, align 4, !tbaa !5
  invoke void @_Z6updatei(i32 noundef %84)
          to label %85 unwind label %90

85:                                               ; preds = %83
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #7
  br label %92

86:                                               ; preds = %68, %65, %63, %.lr.ph71
  %87 = landingpad { ptr, i32 }
          cleanup
  br label %135

88:                                               ; preds = %77, %74
  %89 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  br label %135

90:                                               ; preds = %83, %79
  %91 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #7
  br label %135

92:                                               ; preds = %85, %70
  %93 = load i32, ptr @num, align 4, !tbaa !5
  %.not5164 = icmp slt i32 %93, 1
  br i1 %.not5164, label %._crit_edge68, label %.lr.ph67

.lr.ph67:                                         ; preds = %92
  %94 = load i32, ptr %61, align 4, !tbaa !5
  %95 = zext nneg i32 %93 to i64
  %xtraiter = and i64 %95, 1
  %96 = icmp eq i32 %93, 1
  br i1 %96, label %._crit_edge68.loopexit.unr-lcssa, label %.lr.ph67.new

.lr.ph67.new:                                     ; preds = %.lr.ph67
  %unroll_iter = and i64 %95, 2147483646
  br label %107

._crit_edge68.loopexit.unr-lcssa:                 ; preds = %125, %.lr.ph67
  %indvars.iv86.unr = phi i64 [ 1, %.lr.ph67 ], [ %indvars.iv.next87.1, %125 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge68, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge68.loopexit.unr-lcssa
  %97 = getelementptr inbounds [1000123 x i32], ptr @pos, i64 0, i64 %indvars.iv86.unr
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = icmp sgt i32 %94, %98
  br i1 %99, label %103, label %100

100:                                              ; preds = %.epil.preheader
  %101 = load i32, ptr %66, align 4, !tbaa !5
  %102 = icmp slt i32 %101, %98
  br i1 %102, label %103, label %._crit_edge68

103:                                              ; preds = %100, %.epil.preheader
  %104 = getelementptr inbounds [1000123 x i32], ptr @a, i64 0, i64 %indvars.iv86.unr
  store i32 1000000000, ptr %104, align 4, !tbaa !5
  br label %._crit_edge68

._crit_edge68:                                    ; preds = %._crit_edge68.loopexit.unr-lcssa, %103, %100, %92
  %indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
  %105 = load i32, ptr @n, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %.not48.not = icmp slt i64 %indvars.iv89, %106
  br i1 %.not48.not, label %.lr.ph71, label %._crit_edge72, !llvm.loop !14

107:                                              ; preds = %125, %.lr.ph67.new
  %indvars.iv86 = phi i64 [ 1, %.lr.ph67.new ], [ %indvars.iv.next87.1, %125 ]
  %niter = phi i64 [ 0, %.lr.ph67.new ], [ %niter.next.1, %125 ]
  %108 = getelementptr inbounds [1000123 x i32], ptr @pos, i64 0, i64 %indvars.iv86
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = icmp sgt i32 %94, %109
  br i1 %110, label %114, label %111

111:                                              ; preds = %107
  %112 = load i32, ptr %66, align 4, !tbaa !5
  %113 = icmp slt i32 %112, %109
  br i1 %113, label %114, label %116

114:                                              ; preds = %111, %107
  %115 = getelementptr inbounds [1000123 x i32], ptr @a, i64 0, i64 %indvars.iv86
  store i32 1000000000, ptr %115, align 4, !tbaa !5
  br label %116

116:                                              ; preds = %111, %114
  %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
  %117 = getelementptr inbounds [1000123 x i32], ptr @pos, i64 0, i64 %indvars.iv.next87
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = icmp sgt i32 %94, %118
  br i1 %119, label %123, label %120

120:                                              ; preds = %116
  %121 = load i32, ptr %66, align 4, !tbaa !5
  %122 = icmp slt i32 %121, %118
  br i1 %122, label %123, label %125

123:                                              ; preds = %120, %116
  %124 = getelementptr inbounds [1000123 x i32], ptr @a, i64 0, i64 %indvars.iv.next87
  store i32 1000000000, ptr %124, align 4, !tbaa !5
  br label %125

125:                                              ; preds = %123, %120
  %indvars.iv.next87.1 = add nuw nsw i64 %indvars.iv86, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge68.loopexit.unr-lcssa, label %107, !llvm.loop !15

._crit_edge77:                                    ; preds = %.lr.ph76, %._crit_edge72
  %126 = phi i32 [ 1000000000, %._crit_edge72 ], [ %132, %.lr.ph76 ]
  %127 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %126)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #7
  %128 = load i32, ptr %3, align 4, !tbaa !5
  %129 = add nsw i32 %128, -1
  store i32 %129, ptr %3, align 4, !tbaa !5
  %.not = icmp eq i32 %128, 0
  br i1 %.not, label %._crit_edge81, label %.lr.ph80, !llvm.loop !16

.lr.ph76:                                         ; preds = %._crit_edge72, %.lr.ph76
  %indvars.iv92 = phi i64 [ %indvars.iv.next93, %.lr.ph76 ], [ 1, %._crit_edge72 ]
  %130 = getelementptr inbounds [1000123 x i32], ptr @a, i64 0, i64 %indvars.iv92
  %131 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %130)
  %132 = load i32, ptr %131, align 4, !tbaa !5
  store i32 %132, ptr %11, align 4, !tbaa !5
  %indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
  %133 = load i32, ptr @num, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %.not49.not = icmp slt i64 %indvars.iv92, %134
  br i1 %.not49.not, label %.lr.ph76, label %._crit_edge77, !llvm.loop !17

135:                                              ; preds = %86, %88, %90, %38, %40, %42
  %.pn52.pn = phi { ptr, i32 } [ %43, %42 ], [ %41, %40 ], [ %39, %38 ], [ %91, %90 ], [ %89, %88 ], [ %87, %86 ]
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  resume { ptr, i32 } %.pn52.pn

._crit_edge81:                                    ; preds = %._crit_edge77, %2
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  ret i32 0
}

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

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

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #3 = { 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 #4 = { 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 #5 = { 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!12, !6, i64 4}
!12 = !{!"_ZTSSt4pairIKiiE", !6, i64 0, !6, i64 4}
!13 = !{!12, !6, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass