; LLVM IR from tangjz/acm-icpc :: lydsy (2288)

; 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::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@a = external dso_local global [100003 x i32], align 16
@pL = external dso_local global [100003 x i32], align 16
@pR = external dso_local global [100003 x i32], align 16
@ans = external dso_local global i32, align 4
@Q = external dso_local global %"class.std::priority_queue", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair", align 4
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair", align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair", align 4
  %13 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @tot, ptr noundef @m)
  br label %15

15:                                               ; preds = %44, %0
  %16 = load i32, ptr @tot, align 4, !tbaa !5
  %17 = add nsw i32 %16, -1
  store i32 %17, ptr @tot, align 4, !tbaa !5
  %18 = icmp ne i32 %16, 0
  br i1 %18, label %19, label %51

19:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %2)
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %41

23:                                               ; preds = %19
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %26, label %32

26:                                               ; preds = %23
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = icmp slt i32 %30, 0
  br i1 %31, label %41, label %32

32:                                               ; preds = %26, %23
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = icmp slt i32 %33, 0
  br i1 %34, label %35, label %44

35:                                               ; preds = %32
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = icmp sgt i32 %39, 0
  br i1 %40, label %41, label %44

41:                                               ; preds = %35, %26, %19
  %42 = load i32, ptr @n, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr @n, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %41, %35, %32
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = load i32, ptr @n, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = add nsw i32 %49, %45
  store i32 %50, ptr %48, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %15, !llvm.loop !9

51:                                               ; preds = %15
  %52 = load i32, ptr @n, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %60, label %57

57:                                               ; preds = %51
  %58 = load i32, ptr @n, align 4, !tbaa !5
  %59 = add nsw i32 %58, -1
  store i32 %59, ptr @n, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %57, %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %82, %60
  %62 = load i32, ptr %3, align 4, !tbaa !5
  %63 = load i32, ptr @n, align 4, !tbaa !5
  %64 = icmp sle i32 %62, %63
  br i1 %64, label %66, label %65

65:                                               ; preds = %61
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %85

66:                                               ; preds = %61
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = icmp sgt i32 %70, 0
  br i1 %71, label %72, label %81

72:                                               ; preds = %66
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = load i32, ptr @ans, align 4, !tbaa !5
  %78 = add nsw i32 %77, %76
  store i32 %78, ptr @ans, align 4, !tbaa !5
  %79 = load i32, ptr @m, align 4, !tbaa !5
  %80 = add nsw i32 %79, -1
  store i32 %80, ptr @m, align 4, !tbaa !5
  br label %81

81:                                               ; preds = %72, %66
  br label %82

82:                                               ; preds = %81
  %83 = load i32, ptr %3, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %3, align 4, !tbaa !5
  br label %61, !llvm.loop !11

85:                                               ; preds = %65
  %86 = load i32, ptr @m, align 4, !tbaa !5
  %87 = icmp sge i32 %86, 0
  br i1 %87, label %88, label %91

88:                                               ; preds = %85
  %89 = load i32, ptr @ans, align 4, !tbaa !5
  %90 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %89)
  store i32 0, ptr %1, align 4
  br label %237

91:                                               ; preds = %85
  store i32 0, ptr @pL, align 16, !tbaa !5
  store i32 1, ptr @pR, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %92

92:                                               ; preds = %115, %91
  %93 = load i32, ptr %4, align 4, !tbaa !5
  %94 = load i32, ptr @n, align 4, !tbaa !5
  %95 = icmp sle i32 %93, %94
  br i1 %95, label %97, label %96

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

97:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %98 = load i32, ptr %4, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = call i32 @llvm.abs.i32(i32 %101, i1 true)
  %103 = sub nsw i32 0, %102
  store i32 %103, ptr %6, align 4, !tbaa !5
  %104 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %104, ptr %5, align 4
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  %105 = load i32, ptr %4, align 4, !tbaa !5
  %106 = sub nsw i32 %105, 1
  %107 = load i32, ptr %4, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100003 x i32], ptr @pL, i64 0, i64 %108
  store i32 %106, ptr %109, align 4, !tbaa !5
  %110 = load i32, ptr %4, align 4, !tbaa !5
  %111 = add nsw i32 %110, 1
  %112 = load i32, ptr %4, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [100003 x i32], ptr @pR, i64 0, i64 %113
  store i32 %111, ptr %114, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %97
  %116 = load i32, ptr %4, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %4, align 4, !tbaa !5
  br label %92, !llvm.loop !12

118:                                              ; preds = %96
  %119 = load i32, ptr @n, align 4, !tbaa !5
  %120 = load i32, ptr @n, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [100003 x i32], ptr @pL, i64 0, i64 %122
  store i32 %119, ptr %123, align 4, !tbaa !5
  %124 = load i32, ptr @n, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  %126 = load i32, ptr @n, align 4, !tbaa !5
  %127 = add nsw i32 %126, 1
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [100003 x i32], ptr @pR, i64 0, i64 %128
  store i32 %125, ptr %129, align 4, !tbaa !5
  br label %130

130:                                              ; preds = %233, %231, %118
  %131 = load i32, ptr @m, align 4, !tbaa !5
  %132 = icmp slt i32 %131, 0
  br i1 %132, label %133, label %234

133:                                              ; preds = %130
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %134 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %7, ptr align 4 %134, i64 8, i1 false)
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %135 = getelementptr inbounds %"struct.std::pair", ptr %7, i32 0, i32 1
  %136 = load i32, ptr %135, align 4, !tbaa !13
  store i32 %136, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %137 = load i32, ptr %8, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [100003 x i32], ptr @pL, i64 0, i64 %138
  %140 = load i32, ptr %139, align 4, !tbaa !5
  store i32 %140, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %141 = load i32, ptr %8, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [100003 x i32], ptr @pR, i64 0, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !5
  store i32 %144, ptr %10, align 4, !tbaa !5
  %145 = load i32, ptr %8, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [100003 x i32], ptr @pR, i64 0, i64 %146
  %148 = load i32, ptr %147, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [100003 x i32], ptr @pL, i64 0, i64 %149
  %151 = load i32, ptr %150, align 4, !tbaa !5
  %152 = load i32, ptr %8, align 4, !tbaa !5
  %153 = icmp ne i32 %151, %152
  br i1 %153, label %167, label %154

154:                                              ; preds = %133
  %155 = load i32, ptr %8, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %156
  %158 = load i32, ptr %157, align 4, !tbaa !5
  %159 = icmp sle i32 %158, 0
  br i1 %159, label %160, label %168

160:                                              ; preds = %154
  %161 = load i32, ptr %9, align 4, !tbaa !5
  %162 = icmp slt i32 %161, 1
  br i1 %162, label %167, label %163

163:                                              ; preds = %160
  %164 = load i32, ptr %10, align 4, !tbaa !5
  %165 = load i32, ptr @n, align 4, !tbaa !5
  %166 = icmp sgt i32 %164, %165
  br i1 %166, label %167, label %168

167:                                              ; preds = %163, %160, %133
  store i32 10, ptr %11, align 4
  br label %231, !llvm.loop !15

168:                                              ; preds = %163, %154
  %169 = getelementptr inbounds %"struct.std::pair", ptr %7, i32 0, i32 0
  %170 = load i32, ptr %169, align 4, !tbaa !16
  %171 = load i32, ptr @ans, align 4, !tbaa !5
  %172 = add nsw i32 %171, %170
  store i32 %172, ptr @ans, align 4, !tbaa !5
  %173 = load i32, ptr @m, align 4, !tbaa !5
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr @m, align 4, !tbaa !5
  %175 = load i32, ptr %9, align 4, !tbaa !5
  %176 = icmp sge i32 %175, 1
  br i1 %176, label %177, label %203

177:                                              ; preds = %168
  %178 = load i32, ptr %10, align 4, !tbaa !5
  %179 = load i32, ptr @n, align 4, !tbaa !5
  %180 = icmp sle i32 %178, %179
  br i1 %180, label %181, label %203

181:                                              ; preds = %177
  %182 = load i32, ptr %9, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %183
  %185 = load i32, ptr %184, align 4, !tbaa !5
  %186 = load i32, ptr %10, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %187
  %189 = load i32, ptr %188, align 4, !tbaa !5
  %190 = add nsw i32 %185, %189
  %191 = load i32, ptr %8, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %192
  %194 = load i32, ptr %193, align 4, !tbaa !5
  %195 = add nsw i32 %194, %190
  store i32 %195, ptr %193, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %196 = load i32, ptr %8, align 4, !tbaa !5
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %197
  %199 = load i32, ptr %198, align 4, !tbaa !5
  %200 = call i32 @llvm.abs.i32(i32 %199, i1 true)
  %201 = sub nsw i32 0, %200
  store i32 %201, ptr %13, align 4, !tbaa !5
  %202 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %8)
  store i64 %202, ptr %12, align 4
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 4 dereferenceable(8) %12)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %203

203:                                              ; preds = %181, %177, %168
  %204 = load i32, ptr %9, align 4, !tbaa !5
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds [100003 x i32], ptr @pL, i64 0, i64 %205
  %207 = load i32, ptr %206, align 4, !tbaa !5
  %208 = load i32, ptr %8, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [100003 x i32], ptr @pL, i64 0, i64 %209
  store i32 %207, ptr %210, align 4, !tbaa !5
  %211 = load i32, ptr %10, align 4, !tbaa !5
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds [100003 x i32], ptr @pR, i64 0, i64 %212
  %214 = load i32, ptr %213, align 4, !tbaa !5
  %215 = load i32, ptr %8, align 4, !tbaa !5
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [100003 x i32], ptr @pR, i64 0, i64 %216
  store i32 %214, ptr %217, align 4, !tbaa !5
  %218 = load i32, ptr %8, align 4, !tbaa !5
  %219 = load i32, ptr %9, align 4, !tbaa !5
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [100003 x i32], ptr @pL, i64 0, i64 %220
  %222 = load i32, ptr %221, align 4, !tbaa !5
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [100003 x i32], ptr @pR, i64 0, i64 %223
  store i32 %218, ptr %224, align 4, !tbaa !5
  %225 = load i32, ptr %10, align 4, !tbaa !5
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [100003 x i32], ptr @pR, i64 0, i64 %226
  %228 = load i32, ptr %227, align 4, !tbaa !5
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [100003 x i32], ptr @pL, i64 0, i64 %229
  store i32 %218, ptr %230, align 4, !tbaa !5
  store i32 0, ptr %11, align 4
  br label %231

231:                                              ; preds = %203, %167
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  %232 = load i32, ptr %11, align 4
  switch i32 %232, label %239 [
    i32 0, label %233
    i32 10, label %130
  ]

233:                                              ; preds = %231
  br label %130, !llvm.loop !15

234:                                              ; preds = %130
  %235 = load i32, ptr @ans, align 4, !tbaa !5
  %236 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %235)
  store i32 0, ptr %1, align 4
  br label %237

237:                                              ; preds = %234, %88
  %238 = load i32, ptr %1, align 4
  ret i32 %238

239:                                              ; preds = %231
  unreachable
}

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

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

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25)) #3 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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: readwrite) }
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 = distinct !{!12, !10}
!13 = !{!14, !6, i64 4}
!14 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!15 = distinct !{!15, !10}
!16 = !{!14, !6, i64 0}


; 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::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local local_unnamed_addr global i32, align 4
@m = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@a = external dso_local local_unnamed_addr global [100003 x i32], align 16
@pL = external dso_local local_unnamed_addr global [100003 x i32], align 16
@pR = external dso_local local_unnamed_addr global [100003 x i32], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@Q = external dso_local global %"class.std::priority_queue", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca i32, align 4
  %8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @tot, ptr noundef nonnull @m)
  %9 = load i32, ptr @tot, align 4, !tbaa !5
  %10 = add nsw i32 %9, -1
  store i32 %10, ptr @tot, align 4, !tbaa !5
  %.not26 = icmp eq i32 %9, 0
  br i1 %.not26, label %.._crit_edge_crit_edge, label %.lr.ph

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre42 = load i32, ptr @n, align 4, !tbaa !5
  %.phi.trans.insert = sext i32 %.pre42 to i64
  %.phi.trans.insert43 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %.phi.trans.insert
  %.pre44 = load i32, ptr %.phi.trans.insert43, align 4, !tbaa !5
  br label %._crit_edge

.lr.ph:                                           ; preds = %0, %.thread
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %1)
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %.not23 = icmp eq i32 %12, 0
  %.pre.pre = load i32, ptr %1, align 4, !tbaa !5
  br i1 %.not23, label %27, label %13

13:                                               ; preds = %.lr.ph
  %14 = icmp sgt i32 %.pre.pre, 0
  br i1 %14, label %15, label %20

15:                                               ; preds = %13
  %16 = sext i32 %12 to i64
  %17 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %16
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = icmp slt i32 %18, 0
  br i1 %19, label %27, label %.thread

20:                                               ; preds = %13
  %21 = icmp slt i32 %.pre.pre, 0
  br i1 %21, label %22, label %.thread

22:                                               ; preds = %20
  %23 = sext i32 %12 to i64
  %24 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = icmp sgt i32 %25, 0
  br i1 %26, label %27, label %.thread

27:                                               ; preds = %22, %15, %.lr.ph
  %28 = add nsw i32 %12, 1
  store i32 %28, ptr @n, align 4, !tbaa !5
  br label %.thread

.thread:                                          ; preds = %15, %27, %22, %20
  %29 = phi i32 [ %12, %15 ], [ %28, %27 ], [ %12, %22 ], [ %12, %20 ]
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = add nsw i32 %32, %.pre.pre
  store i32 %33, ptr %31, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %34 = load i32, ptr @tot, align 4, !tbaa !5
  %35 = add nsw i32 %34, -1
  store i32 %35, ptr @tot, align 4, !tbaa !5
  %.not = icmp eq i32 %34, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.thread, %.._crit_edge_crit_edge
  %36 = phi i32 [ %.pre44, %.._crit_edge_crit_edge ], [ %33, %.thread ]
  %37 = phi i32 [ %.pre42, %.._crit_edge_crit_edge ], [ %29, %.thread ]
  %.not18 = icmp eq i32 %36, 0
  br i1 %.not18, label %38, label %40

38:                                               ; preds = %._crit_edge
  %39 = add nsw i32 %37, -1
  store i32 %39, ptr @n, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %38, %._crit_edge
  %41 = phi i32 [ %39, %38 ], [ %37, %._crit_edge ]
  %ans.promoted = load i32, ptr @ans, align 4, !tbaa !5
  %m.promoted = load i32, ptr @m, align 4, !tbaa !5
  %.not1927 = icmp slt i32 %41, 1
  br i1 %.not1927, label %._crit_edge31.thread, label %.lr.ph30.preheader

.lr.ph30.preheader:                               ; preds = %40
  %42 = zext nneg i32 %41 to i64
  %xtraiter = and i64 %42, 1
  %43 = icmp eq i32 %41, 1
  br i1 %43, label %._crit_edge31.unr-lcssa, label %.lr.ph30.preheader.new

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

._crit_edge31.unr-lcssa:                          ; preds = %68, %.lr.ph30.preheader
  %.lcssa61.ph = phi i32 [ poison, %.lr.ph30.preheader ], [ %69, %68 ]
  %.lcssa60.ph = phi i32 [ poison, %.lr.ph30.preheader ], [ %70, %68 ]
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph30.preheader ], [ %indvars.iv.next.1, %68 ]
  %.unr = phi i32 [ %ans.promoted, %.lr.ph30.preheader ], [ %70, %68 ]
  %.unr64 = phi i32 [ %m.promoted, %.lr.ph30.preheader ], [ %69, %68 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge31, label %.lr.ph30.epil

.lr.ph30.epil:                                    ; preds = %._crit_edge31.unr-lcssa
  %44 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %indvars.iv.unr
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = icmp sgt i32 %45, 0
  br i1 %46, label %47, label %._crit_edge31

47:                                               ; preds = %.lr.ph30.epil
  %48 = add nsw i32 %.unr, %45
  store i32 %48, ptr @ans, align 4, !tbaa !5
  %49 = add nsw i32 %.unr64, -1
  store i32 %49, ptr @m, align 4, !tbaa !5
  br label %._crit_edge31

._crit_edge31:                                    ; preds = %.lr.ph30.epil, %47, %._crit_edge31.unr-lcssa
  %.lcssa61 = phi i32 [ %.lcssa61.ph, %._crit_edge31.unr-lcssa ], [ %.unr64, %.lr.ph30.epil ], [ %49, %47 ]
  %.lcssa60 = phi i32 [ %.lcssa60.ph, %._crit_edge31.unr-lcssa ], [ %.unr, %.lr.ph30.epil ], [ %48, %47 ]
  %50 = icmp sgt i32 %.lcssa61, -1
  br i1 %50, label %144, label %71

._crit_edge31.thread:                             ; preds = %40
  %51 = icmp sgt i32 %m.promoted, -1
  br i1 %51, label %144, label %.thread50

.thread50:                                        ; preds = %._crit_edge31.thread
  store i32 0, ptr @pL, align 16, !tbaa !5
  store i32 1, ptr @pR, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  br label %._crit_edge36.thread

.lr.ph30:                                         ; preds = %68, %.lr.ph30.preheader.new
  %indvars.iv = phi i64 [ 1, %.lr.ph30.preheader.new ], [ %indvars.iv.next.1, %68 ]
  %52 = phi i32 [ %ans.promoted, %.lr.ph30.preheader.new ], [ %70, %68 ]
  %53 = phi i32 [ %m.promoted, %.lr.ph30.preheader.new ], [ %69, %68 ]
  %niter = phi i64 [ 0, %.lr.ph30.preheader.new ], [ %niter.next.1, %68 ]
  %54 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %indvars.iv
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %57, label %.lr.ph30.1

57:                                               ; preds = %.lr.ph30
  %58 = add nsw i32 %52, %55
  store i32 %58, ptr @ans, align 4, !tbaa !5
  %59 = add nsw i32 %53, -1
  store i32 %59, ptr @m, align 4, !tbaa !5
  br label %.lr.ph30.1

.lr.ph30.1:                                       ; preds = %.lr.ph30, %57
  %60 = phi i32 [ %53, %.lr.ph30 ], [ %59, %57 ]
  %61 = phi i32 [ %52, %.lr.ph30 ], [ %58, %57 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %62 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %indvars.iv.next
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = icmp sgt i32 %63, 0
  br i1 %64, label %65, label %68

65:                                               ; preds = %.lr.ph30.1
  %66 = add nsw i32 %61, %63
  store i32 %66, ptr @ans, align 4, !tbaa !5
  %67 = add nsw i32 %60, -1
  store i32 %67, ptr @m, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %65, %.lr.ph30.1
  %69 = phi i32 [ %60, %.lr.ph30.1 ], [ %67, %65 ]
  %70 = phi i32 [ %61, %.lr.ph30.1 ], [ %66, %65 ]
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 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_edge31.unr-lcssa, label %.lr.ph30, !llvm.loop !11

71:                                               ; preds = %._crit_edge31
  store i32 0, ptr @pL, align 16, !tbaa !5
  store i32 1, ptr @pR, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  br i1 %.not1927, label %._crit_edge36.thread, label %.lr.ph35

._crit_edge36.thread:                             ; preds = %71, %.thread50
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %72 = add nsw i32 %41, 1
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [100003 x i32], ptr @pL, i64 0, i64 %73
  store i32 %41, ptr %74, align 4, !tbaa !5
  %75 = getelementptr inbounds [100003 x i32], ptr @pR, i64 0, i64 %73
  store i32 %72, ptr %75, align 4, !tbaa !5
  br label %.lr.ph38.preheader

._crit_edge36:                                    ; preds = %.lr.ph35
  %.pre45 = load i32, ptr @m, align 4, !tbaa !5
  %76 = icmp slt i32 %.pre45, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %77 = add nsw i32 %93, 1
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [100003 x i32], ptr @pL, i64 0, i64 %78
  store i32 %93, ptr %79, align 4, !tbaa !5
  %80 = getelementptr inbounds [100003 x i32], ptr @pR, i64 0, i64 %78
  store i32 %77, ptr %80, align 4, !tbaa !5
  br i1 %76, label %.lr.ph38.preheader, label %._crit_edge39

.lr.ph38.preheader:                               ; preds = %._crit_edge36.thread, %._crit_edge36
  br label %.lr.ph38

.lr.ph35:                                         ; preds = %71, %.lr.ph35
  %storemerge33 = phi i32 [ %91, %.lr.ph35 ], [ 1, %71 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %81 = sext i32 %storemerge33 to i64
  %82 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = call i32 @llvm.abs.i32(i32 %83, i1 true)
  %85 = sub nsw i32 0, %84
  store i32 %85, ptr %4, align 4, !tbaa !5
  %86 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %2)
  store i64 %86, ptr %3, align 8
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 4 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %87 = load i32, ptr %2, align 4, !tbaa !5
  %88 = add nsw i32 %87, -1
  %89 = sext i32 %87 to i64
  %90 = getelementptr inbounds [100003 x i32], ptr @pL, i64 0, i64 %89
  store i32 %88, ptr %90, align 4, !tbaa !5
  %91 = add nsw i32 %87, 1
  %92 = getelementptr inbounds [100003 x i32], ptr @pR, i64 0, i64 %89
  store i32 %91, ptr %92, align 4, !tbaa !5
  store i32 %91, ptr %2, align 4, !tbaa !5
  %93 = load i32, ptr @n, align 4, !tbaa !5
  %.not20.not = icmp slt i32 %87, %93
  br i1 %.not20.not, label %.lr.ph35, label %._crit_edge36, !llvm.loop !12

.lr.ph38:                                         ; preds = %.lr.ph38.preheader, %140
  %94 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %.sroa.0.0.copyload = load i32, ptr %94, align 4
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %94, i64 4
  %.sroa.4.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 4
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  store i32 %.sroa.4.0.copyload, ptr %5, align 4, !tbaa !5
  %95 = sext i32 %.sroa.4.0.copyload to i64
  %96 = getelementptr inbounds [100003 x i32], ptr @pL, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = getelementptr inbounds [100003 x i32], ptr @pR, i64 0, i64 %95
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [100003 x i32], ptr @pL, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %.not21 = icmp eq i32 %102, %.sroa.4.0.copyload
  br i1 %.not21, label %103, label %140, !llvm.loop !13

103:                                              ; preds = %.lr.ph38
  %104 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %95
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = icmp slt i32 %105, 1
  %.pre46 = load i32, ptr @n, align 4
  br i1 %106, label %107, label %._crit_edge49

107:                                              ; preds = %103
  %108 = icmp slt i32 %97, 1
  %109 = icmp sgt i32 %99, %.pre46
  %or.cond = select i1 %108, i1 true, i1 %109
  br i1 %or.cond, label %140, label %._crit_edge49, !llvm.loop !13

._crit_edge49:                                    ; preds = %103, %107
  %110 = load i32, ptr @ans, align 4, !tbaa !5
  %111 = add nsw i32 %110, %.sroa.0.0.copyload
  store i32 %111, ptr @ans, align 4, !tbaa !5
  %112 = load i32, ptr @m, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr @m, align 4, !tbaa !5
  %114 = icmp slt i32 %97, 1
  %.not22 = icmp sgt i32 %99, %.pre46
  %or.cond25 = select i1 %114, i1 true, i1 %.not22
  br i1 %or.cond25, label %126, label %115

115:                                              ; preds = %._crit_edge49
  %116 = zext nneg i32 %97 to i64
  %117 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = getelementptr inbounds [100003 x i32], ptr @a, i64 0, i64 %100
  %120 = load i32, ptr %119, align 4, !tbaa !5
  %121 = add i32 %118, %105
  %122 = add i32 %121, %120
  store i32 %122, ptr %104, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  %123 = call i32 @llvm.abs.i32(i32 %122, i1 true)
  %124 = sub nsw i32 0, %123
  store i32 %124, ptr %7, align 4, !tbaa !5
  %125 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i64 %125, ptr %6, align 8
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  %.pre47 = load i32, ptr %5, align 4, !tbaa !5
  %.pre = sext i32 %.pre47 to i64
  br label %126

126:                                              ; preds = %115, %._crit_edge49
  %.pre-phi48 = phi i64 [ %.pre, %115 ], [ %95, %._crit_edge49 ]
  %127 = phi i32 [ %.pre47, %115 ], [ %.sroa.4.0.copyload, %._crit_edge49 ]
  %128 = sext i32 %97 to i64
  %129 = getelementptr inbounds [100003 x i32], ptr @pL, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = getelementptr inbounds [100003 x i32], ptr @pL, i64 0, i64 %.pre-phi48
  store i32 %130, ptr %131, align 4, !tbaa !5
  %132 = getelementptr inbounds [100003 x i32], ptr @pR, i64 0, i64 %100
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = getelementptr inbounds [100003 x i32], ptr @pR, i64 0, i64 %.pre-phi48
  store i32 %133, ptr %134, align 4, !tbaa !5
  %135 = sext i32 %130 to i64
  %136 = getelementptr inbounds [100003 x i32], ptr @pR, i64 0, i64 %135
  store i32 %127, ptr %136, align 4, !tbaa !5
  %137 = load i32, ptr %132, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [100003 x i32], ptr @pL, i64 0, i64 %138
  store i32 %127, ptr %139, align 4, !tbaa !5
  br label %140

140:                                              ; preds = %.lr.ph38, %107, %126
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  %141 = load i32, ptr @m, align 4, !tbaa !5
  %142 = icmp slt i32 %141, 0
  br i1 %142, label %.lr.ph38, label %._crit_edge39

._crit_edge39:                                    ; preds = %140, %._crit_edge36
  %143 = load i32, ptr @ans, align 4, !tbaa !5
  br label %144

144:                                              ; preds = %._crit_edge31, %._crit_edge31.thread, %._crit_edge39
  %.sink = phi i32 [ %143, %._crit_edge39 ], [ %ans.promoted, %._crit_edge31.thread ], [ %.lcssa60, %._crit_edge31 ]
  %145 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.sink)
  ret i32 0
}

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

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

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

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

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #3 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


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