; LLVM IR from lzyrapx/Competitive-Programming :: HDUOJ (5784 (2))

; 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"

%struct.Point = type { i64, i64 }

@p = external dso_local global [2010 x %struct.Point], align 16
@v = external dso_local global [4020 x %struct.Point], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 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 i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %struct.Point, align 8
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  br label %17

17:                                               ; preds = %231, %0
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  %19 = icmp ne i32 %18, -1
  br i1 %19, label %20, label %237

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

21:                                               ; preds = %36, %20
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %26, label %25

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

26:                                               ; preds = %21
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [2010 x %struct.Point], ptr @p, i64 0, i64 %28
  %30 = getelementptr inbounds %struct.Point, ptr %29, i32 0, i32 0
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [2010 x %struct.Point], ptr @p, i64 0, i64 %32
  %34 = getelementptr inbounds %struct.Point, ptr %33, i32 0, i32 1
  %35 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %30, ptr noundef %34)
  br label %36

36:                                               ; preds = %26
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %3, align 4, !tbaa !5
  br label %21, !llvm.loop !9

39:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = mul nsw i64 1, %41
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = sub nsw i32 %43, 1
  %45 = sext i32 %44 to i64
  %46 = mul nsw i64 %42, %45
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = sub nsw i32 %47, 2
  %49 = sext i32 %48 to i64
  %50 = mul nsw i64 %46, %49
  %51 = sdiv i64 %50, 6
  store i64 %51, ptr %4, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store i64 0, ptr %5, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %228, %39
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = load i32, ptr %2, align 4, !tbaa !5
  %55 = icmp slt i32 %53, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  store i32 7, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %231

57:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %84, %57
  %59 = load i32, ptr %9, align 4, !tbaa !5
  %60 = load i32, ptr %2, align 4, !tbaa !5
  %61 = icmp slt i32 %59, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  store i32 10, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %87

63:                                               ; preds = %58
  %64 = load i32, ptr %6, align 4, !tbaa !5
  %65 = load i32, ptr %9, align 4, !tbaa !5
  %66 = icmp eq i32 %64, %65
  br i1 %66, label %67, label %68

67:                                               ; preds = %63
  br label %84

68:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #7
  %69 = load i32, ptr %9, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [2010 x %struct.Point], ptr @p, i64 0, i64 %70
  %72 = load i32, ptr %6, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [2010 x %struct.Point], ptr @p, i64 0, i64 %73
  %75 = call { i64, i64 } @_ZNK5PointmiERKS_(ptr noundef nonnull align 8 dereferenceable(16) %71, ptr noundef nonnull align 8 dereferenceable(16) %74)
  %76 = getelementptr inbounds { i64, i64 }, ptr %10, i32 0, i32 0
  %77 = extractvalue { i64, i64 } %75, 0
  store i64 %77, ptr %76, align 8
  %78 = getelementptr inbounds { i64, i64 }, ptr %10, i32 0, i32 1
  %79 = extractvalue { i64, i64 } %75, 1
  store i64 %79, ptr %78, align 8
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %8, align 4, !tbaa !5
  %82 = sext i32 %80 to i64
  %83 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %82
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %83, ptr align 8 %10, i64 16, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #7
  br label %84

84:                                               ; preds = %68, %67
  %85 = load i32, ptr %9, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %9, align 4, !tbaa !5
  br label %58, !llvm.loop !14

87:                                               ; preds = %62
  %88 = load i32, ptr %8, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds %struct.Point, ptr @v, i64 %89
  call void @_ZSt4sortIP5PointEvT_S2_(ptr noundef @v, ptr noundef %90)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %105, %87
  %92 = load i32, ptr %11, align 4, !tbaa !5
  %93 = load i32, ptr %8, align 4, !tbaa !5
  %94 = icmp slt i32 %92, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %91
  store i32 13, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %108

96:                                               ; preds = %91
  %97 = load i32, ptr %11, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %98
  %100 = load i32, ptr %11, align 4, !tbaa !5
  %101 = load i32, ptr %8, align 4, !tbaa !5
  %102 = add nsw i32 %100, %101
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %103
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %104, ptr align 16 %99, i64 16, i1 false), !tbaa.struct !13
  br label %105

105:                                              ; preds = %96
  %106 = load i32, ptr %11, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %11, align 4, !tbaa !5
  br label %91, !llvm.loop !15

108:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store i64 0, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %109

109:                                              ; preds = %145, %108
  %110 = load i32, ptr %13, align 4, !tbaa !5
  %111 = load i32, ptr %8, align 4, !tbaa !5
  %112 = icmp slt i32 %110, %111
  br i1 %112, label %114, label %113

113:                                              ; preds = %109
  store i32 16, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %148

114:                                              ; preds = %109
  %115 = load i32, ptr %13, align 4, !tbaa !5
  %116 = icmp ne i32 %115, 0
  br i1 %116, label %117, label %140

117:                                              ; preds = %114
  %118 = load i32, ptr %13, align 4, !tbaa !5
  %119 = sub nsw i32 %118, 1
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %120
  %122 = load i32, ptr %13, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %123
  %125 = call noundef i64 @_ZNK5PointmlERKS_(ptr noundef nonnull align 8 dereferenceable(16) %121, ptr noundef nonnull align 8 dereferenceable(16) %124)
  %126 = icmp eq i64 %125, 0
  br i1 %126, label %127, label %140

127:                                              ; preds = %117
  %128 = load i32, ptr %13, align 4, !tbaa !5
  %129 = sub nsw i32 %128, 1
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %130
  %132 = load i32, ptr %13, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %133
  %135 = call noundef i64 @_ZNK5PointeoERKS_(ptr noundef nonnull align 8 dereferenceable(16) %131, ptr noundef nonnull align 8 dereferenceable(16) %134)
  %136 = icmp sgt i64 %135, 0
  br i1 %136, label %137, label %140

137:                                              ; preds = %127
  %138 = load i64, ptr %12, align 8, !tbaa !11
  %139 = add nsw i64 %138, 1
  store i64 %139, ptr %12, align 8, !tbaa !11
  br label %141

140:                                              ; preds = %127, %117, %114
  store i64 0, ptr %12, align 8, !tbaa !11
  br label %141

141:                                              ; preds = %140, %137
  %142 = load i64, ptr %12, align 8, !tbaa !11
  %143 = load i64, ptr %5, align 8, !tbaa !11
  %144 = add nsw i64 %143, %142
  store i64 %144, ptr %5, align 8, !tbaa !11
  br label %145

145:                                              ; preds = %141
  %146 = load i32, ptr %13, align 4, !tbaa !5
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %13, align 4, !tbaa !5
  br label %109, !llvm.loop !16

148:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %224, %148
  %150 = load i32, ptr %14, align 4, !tbaa !5
  %151 = load i32, ptr %8, align 4, !tbaa !5
  %152 = icmp slt i32 %150, %151
  br i1 %152, label %154, label %153

153:                                              ; preds = %149
  store i32 19, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %227

154:                                              ; preds = %149
  br label %155

155:                                              ; preds = %187, %154
  %156 = load i32, ptr %15, align 4, !tbaa !5
  %157 = load i32, ptr %14, align 4, !tbaa !5
  %158 = icmp sle i32 %156, %157
  br i1 %158, label %185, label %159

159:                                              ; preds = %155
  %160 = load i32, ptr %15, align 4, !tbaa !5
  %161 = load i32, ptr %14, align 4, !tbaa !5
  %162 = load i32, ptr %8, align 4, !tbaa !5
  %163 = add nsw i32 %161, %162
  %164 = icmp slt i32 %160, %163
  br i1 %164, label %165, label %183

165:                                              ; preds = %159
  %166 = load i32, ptr %15, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %167
  %169 = load i32, ptr %14, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %170
  %172 = call noundef i64 @_ZNK5PointmlERKS_(ptr noundef nonnull align 8 dereferenceable(16) %168, ptr noundef nonnull align 8 dereferenceable(16) %171)
  %173 = icmp slt i64 %172, 0
  br i1 %173, label %174, label %183

174:                                              ; preds = %165
  %175 = load i32, ptr %15, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %176
  %178 = load i32, ptr %14, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %179
  %181 = call noundef i64 @_ZNK5PointeoERKS_(ptr noundef nonnull align 8 dereferenceable(16) %177, ptr noundef nonnull align 8 dereferenceable(16) %180)
  %182 = icmp sgt i64 %181, 0
  br label %183

183:                                              ; preds = %174, %165, %159
  %184 = phi i1 [ false, %165 ], [ false, %159 ], [ %182, %174 ]
  br label %185

185:                                              ; preds = %183, %155
  %186 = phi i1 [ true, %155 ], [ %184, %183 ]
  br i1 %186, label %187, label %190

187:                                              ; preds = %185
  %188 = load i32, ptr %15, align 4, !tbaa !5
  %189 = add nsw i32 %188, 1
  store i32 %189, ptr %15, align 4, !tbaa !5
  br label %155, !llvm.loop !17

190:                                              ; preds = %185
  br label %191

191:                                              ; preds = %214, %190
  %192 = load i32, ptr %16, align 4, !tbaa !5
  %193 = load i32, ptr %14, align 4, !tbaa !5
  %194 = icmp sle i32 %192, %193
  br i1 %194, label %212, label %195

195:                                              ; preds = %191
  %196 = load i32, ptr %16, align 4, !tbaa !5
  %197 = load i32, ptr %14, align 4, !tbaa !5
  %198 = load i32, ptr %8, align 4, !tbaa !5
  %199 = add nsw i32 %197, %198
  %200 = icmp slt i32 %196, %199
  br i1 %200, label %201, label %210

201:                                              ; preds = %195
  %202 = load i32, ptr %16, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %203
  %205 = load i32, ptr %14, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %206
  %208 = call noundef i64 @_ZNK5PointmlERKS_(ptr noundef nonnull align 8 dereferenceable(16) %204, ptr noundef nonnull align 8 dereferenceable(16) %207)
  %209 = icmp slt i64 %208, 0
  br label %210

210:                                              ; preds = %201, %195
  %211 = phi i1 [ false, %195 ], [ %209, %201 ]
  br label %212

212:                                              ; preds = %210, %191
  %213 = phi i1 [ true, %191 ], [ %211, %210 ]
  br i1 %213, label %214, label %217

214:                                              ; preds = %212
  %215 = load i32, ptr %16, align 4, !tbaa !5
  %216 = add nsw i32 %215, 1
  store i32 %216, ptr %16, align 4, !tbaa !5
  br label %191, !llvm.loop !18

217:                                              ; preds = %212
  %218 = load i32, ptr %16, align 4, !tbaa !5
  %219 = load i32, ptr %15, align 4, !tbaa !5
  %220 = sub nsw i32 %218, %219
  %221 = sext i32 %220 to i64
  %222 = load i64, ptr %4, align 8, !tbaa !11
  %223 = sub nsw i64 %222, %221
  store i64 %223, ptr %4, align 8, !tbaa !11
  br label %224

224:                                              ; preds = %217
  %225 = load i32, ptr %14, align 4, !tbaa !5
  %226 = add nsw i32 %225, 1
  store i32 %226, ptr %14, align 4, !tbaa !5
  br label %149, !llvm.loop !19

227:                                              ; preds = %153
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %228

228:                                              ; preds = %227
  %229 = load i32, ptr %6, align 4, !tbaa !5
  %230 = add nsw i32 %229, 1
  store i32 %230, ptr %6, align 4, !tbaa !5
  br label %52, !llvm.loop !20

231:                                              ; preds = %56
  %232 = load i64, ptr %4, align 8, !tbaa !11
  %233 = load i64, ptr %5, align 8, !tbaa !11
  %234 = sdiv i64 %233, 2
  %235 = sub nsw i64 %232, %234
  %236 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i64 noundef %235)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  br label %17, !llvm.loop !21

237:                                              ; preds = %17
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %238 = load i32, ptr %1, align 4
  ret i32 %238
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZNK5PointmiERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #3 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK5PointmlERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #6 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK5PointeoERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #6 align 2

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.Point = type { i64, i64 }

@p = external dso_local global [2010 x %struct.Point], align 16
@v = external dso_local global [4020 x %struct.Point], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %.not114 = icmp eq i32 %2, -1
  br i1 %.not114, label %._crit_edge115, label %.preheader87

.preheader87:                                     ; preds = %0, %._crit_edge111
  %3 = load i32, ptr %1, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph, label %.preheader87.._crit_edge_crit_edge

.preheader87.._crit_edge_crit_edge:               ; preds = %.preheader87
  %.pre147 = sext i32 %3 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.preheader87.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre147, %.preheader87.._crit_edge_crit_edge ], [ %18, %.lr.ph ]
  %5 = phi i32 [ %3, %.preheader87.._crit_edge_crit_edge ], [ %17, %.lr.ph ]
  %6 = add nsw i32 %5, -1
  %7 = sext i32 %6 to i64
  %8 = mul nsw i64 %.pre-phi, %7
  %9 = add nsw i32 %5, -2
  %10 = sext i32 %9 to i64
  %11 = mul nsw i64 %8, %10
  %12 = sdiv i64 %11, 6
  %13 = icmp sgt i32 %5, 0
  br i1 %13, label %.preheader86, label %._crit_edge111

.lr.ph:                                           ; preds = %.preheader87, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader87 ]
  %14 = getelementptr inbounds [2010 x %struct.Point], ptr @p, i64 0, i64 %indvars.iv
  %15 = getelementptr inbounds i8, ptr %14, i64 8
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %14, ptr noundef nonnull %15)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %17 = load i32, ptr %1, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = icmp slt i64 %indvars.iv.next, %18
  br i1 %19, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader86:                                     ; preds = %._crit_edge, %._crit_edge106
  %20 = phi i32 [ %70, %._crit_edge106 ], [ %5, %._crit_edge ]
  %indvars.iv143 = phi i64 [ %indvars.iv.next144, %._crit_edge106 ], [ 0, %._crit_edge ]
  %.076109 = phi i64 [ %.177.lcssa151, %._crit_edge106 ], [ 0, %._crit_edge ]
  %.078108 = phi i64 [ %.179.lcssa, %._crit_edge106 ], [ %12, %._crit_edge ]
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph91, label %._crit_edge92

.lr.ph91:                                         ; preds = %.preheader86
  %22 = getelementptr inbounds [2010 x %struct.Point], ptr @p, i64 0, i64 %indvars.iv143
  br label %31

._crit_edge111:                                   ; preds = %._crit_edge106, %._crit_edge
  %.078.lcssa = phi i64 [ %12, %._crit_edge ], [ %.179.lcssa, %._crit_edge106 ]
  %.076.lcssa = phi i64 [ 0, %._crit_edge ], [ %.177.lcssa151, %._crit_edge106 ]
  %.neg = sdiv i64 %.076.lcssa, -2
  %23 = add i64 %.neg, %.078.lcssa
  %24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %23)
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %.not = icmp eq i32 %25, -1
  br i1 %.not, label %._crit_edge115, label %.preheader87, !llvm.loop !11

._crit_edge92:                                    ; preds = %42, %.preheader86
  %.073.lcssa = phi i32 [ 0, %.preheader86 ], [ %.174, %42 ]
  %26 = sext i32 %.073.lcssa to i64
  %27 = getelementptr inbounds %struct.Point, ptr @v, i64 %26
  call void @_ZSt4sortIP5PointEvT_S2_(ptr noundef nonnull @v, ptr noundef nonnull %27)
  %28 = icmp sgt i32 %.073.lcssa, 0
  br i1 %28, label %.lr.ph96.preheader, label %._crit_edge106

.lr.ph96.preheader:                               ; preds = %._crit_edge92
  %29 = zext nneg i32 %.073.lcssa to i64
  %xtraiter = and i64 %29, 1
  %30 = icmp eq i32 %.073.lcssa, 1
  br i1 %30, label %.preheader85.unr-lcssa, label %.lr.ph96.preheader.new

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

31:                                               ; preds = %.lr.ph91, %42
  %32 = phi i32 [ %20, %.lr.ph91 ], [ %43, %42 ]
  %indvars.iv120 = phi i64 [ 0, %.lr.ph91 ], [ %indvars.iv.next121, %42 ]
  %.07389 = phi i32 [ 0, %.lr.ph91 ], [ %.174, %42 ]
  %33 = icmp eq i64 %indvars.iv143, %indvars.iv120
  br i1 %33, label %42, label %34

34:                                               ; preds = %31
  %35 = getelementptr inbounds [2010 x %struct.Point], ptr @p, i64 0, i64 %indvars.iv120
  %36 = call { i64, i64 } @_ZNK5PointmiERKS_(ptr noundef nonnull align 8 dereferenceable(16) %35, ptr noundef nonnull align 8 dereferenceable(16) %22)
  %37 = extractvalue { i64, i64 } %36, 0
  %38 = extractvalue { i64, i64 } %36, 1
  %39 = add nsw i32 %.07389, 1
  %40 = sext i32 %.07389 to i64
  %41 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %40
  store i64 %37, ptr %41, align 16, !tbaa !12
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %41, i64 8
  store i64 %38, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !12
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %31, %34
  %43 = phi i32 [ %32, %31 ], [ %.pre, %34 ]
  %.174 = phi i32 [ %.07389, %31 ], [ %39, %34 ]
  %indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
  %44 = sext i32 %43 to i64
  %45 = icmp slt i64 %indvars.iv.next121, %44
  br i1 %45, label %31, label %._crit_edge92, !llvm.loop !14

.preheader85.unr-lcssa:                           ; preds = %.lr.ph96, %.lr.ph96.preheader
  %indvars.iv123.unr = phi i64 [ 0, %.lr.ph96.preheader ], [ %indvars.iv.next124.1, %.lr.ph96 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader85, label %.lr.ph96.epil

.lr.ph96.epil:                                    ; preds = %.preheader85.unr-lcssa
  %46 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %indvars.iv123.unr
  %47 = add nuw nsw i64 %indvars.iv123.unr, %29
  %48 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %47
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %48, ptr noundef nonnull align 16 dereferenceable(16) %46, i64 16, i1 false), !tbaa.struct !15
  br label %.preheader85

.preheader85:                                     ; preds = %.preheader85.unr-lcssa, %.lr.ph96.epil
  br i1 %28, label %49, label %._crit_edge106

49:                                               ; preds = %.preheader85
  %wide.trip.count129 = zext nneg i32 %.073.lcssa to i64
  %exitcond130.peel.not = icmp eq i32 %.073.lcssa, 1
  br i1 %exitcond130.peel.not, label %.preheader.preheader, label %.lr.ph100.peel.next

.lr.ph96:                                         ; preds = %.lr.ph96, %.lr.ph96.preheader.new
  %indvars.iv123 = phi i64 [ 0, %.lr.ph96.preheader.new ], [ %indvars.iv.next124.1, %.lr.ph96 ]
  %niter = phi i64 [ 0, %.lr.ph96.preheader.new ], [ %niter.next.1, %.lr.ph96 ]
  %50 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %indvars.iv123
  %51 = add nuw nsw i64 %indvars.iv123, %29
  %52 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %51
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %52, ptr noundef nonnull align 16 dereferenceable(16) %50, i64 16, i1 false), !tbaa.struct !15
  %indvars.iv.next124 = or disjoint i64 %indvars.iv123, 1
  %53 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %indvars.iv.next124
  %54 = add nuw nsw i64 %indvars.iv.next124, %29
  %55 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %54
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %55, ptr noundef nonnull align 16 dereferenceable(16) %53, i64 16, i1 false), !tbaa.struct !15
  %indvars.iv.next124.1 = add nuw nsw i64 %indvars.iv123, 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 %.preheader85.unr-lcssa, label %.lr.ph96, !llvm.loop !16

.preheader84:                                     ; preds = %65
  br i1 %28, label %.preheader.preheader, label %._crit_edge106

.preheader.preheader:                             ; preds = %49, %.preheader84
  %.177.lcssa154 = phi i64 [ %66, %.preheader84 ], [ %.076109, %49 ]
  %wide.trip.count141 = zext nneg i32 %.073.lcssa to i64
  br label %.preheader

.lr.ph100.peel.next:                              ; preds = %49, %65
  %indvars.iv126 = phi i64 [ %indvars.iv.next127, %65 ], [ 1, %49 ]
  %.06898 = phi i64 [ %.169, %65 ], [ 0, %49 ]
  %.17797 = phi i64 [ %66, %65 ], [ %.076109, %49 ]
  %56 = add nsw i64 %indvars.iv126, -1
  %57 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %56
  %58 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %indvars.iv126
  %59 = call noundef i64 @_ZNK5PointmlERKS_(ptr noundef nonnull align 8 dereferenceable(16) %57, ptr noundef nonnull align 8 dereferenceable(16) %58)
  %60 = icmp eq i64 %59, 0
  br i1 %60, label %61, label %65

61:                                               ; preds = %.lr.ph100.peel.next
  %62 = call noundef i64 @_ZNK5PointeoERKS_(ptr noundef nonnull align 8 dereferenceable(16) %57, ptr noundef nonnull align 8 dereferenceable(16) %58)
  %63 = icmp sgt i64 %62, 0
  %64 = add nsw i64 %.06898, 1
  %spec.select = select i1 %63, i64 %64, i64 0
  br label %65

65:                                               ; preds = %61, %.lr.ph100.peel.next
  %.169 = phi i64 [ 0, %.lr.ph100.peel.next ], [ %spec.select, %61 ]
  %66 = add nsw i64 %.169, %.17797
  %indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
  %exitcond130.not = icmp eq i64 %indvars.iv.next127, %wide.trip.count129
  br i1 %exitcond130.not, label %.preheader84, label %.lr.ph100.peel.next, !llvm.loop !17

.preheader:                                       ; preds = %.preheader.preheader, %.critedge6
  %indvars.iv138 = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.next139, %.critedge6 ]
  %.0105 = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv135, %.critedge6 ]
  %.064104 = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv132, %.critedge6 ]
  %.179102 = phi i64 [ %.078108, %.preheader.preheader ], [ %93, %.critedge6 ]
  %67 = add nuw nsw i64 %indvars.iv138, %26
  %68 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %indvars.iv138
  %sext = shl i64 %.064104, 32
  %69 = ashr exact i64 %sext, 32
  br label %73

._crit_edge106:                                   ; preds = %.critedge6, %._crit_edge92, %.preheader85, %.preheader84
  %.177.lcssa151 = phi i64 [ %66, %.preheader84 ], [ %.076109, %.preheader85 ], [ %.076109, %._crit_edge92 ], [ %.177.lcssa154, %.critedge6 ]
  %.179.lcssa = phi i64 [ %.078108, %.preheader84 ], [ %.078108, %.preheader85 ], [ %.078108, %._crit_edge92 ], [ %93, %.critedge6 ]
  %indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
  %70 = load i32, ptr %1, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = icmp slt i64 %indvars.iv.next144, %71
  br i1 %72, label %.preheader86, label %._crit_edge111, !llvm.loop !19

73:                                               ; preds = %.preheader, %.critedge
  %indvars.iv132 = phi i64 [ %69, %.preheader ], [ %indvars.iv.next133, %.critedge ]
  %.not81 = icmp sgt i64 %indvars.iv132, %indvars.iv138
  br i1 %.not81, label %74, label %.critedge

74:                                               ; preds = %73
  %75 = icmp slt i64 %indvars.iv132, %67
  br i1 %75, label %76, label %.critedge2

76:                                               ; preds = %74
  %77 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %indvars.iv132
  %78 = call noundef i64 @_ZNK5PointmlERKS_(ptr noundef nonnull align 8 dereferenceable(16) %77, ptr noundef nonnull align 8 dereferenceable(16) %68)
  %79 = icmp slt i64 %78, 0
  br i1 %79, label %80, label %.critedge2

80:                                               ; preds = %76
  %81 = call noundef i64 @_ZNK5PointeoERKS_(ptr noundef nonnull align 8 dereferenceable(16) %77, ptr noundef nonnull align 8 dereferenceable(16) %68)
  %82 = icmp sgt i64 %81, 0
  br i1 %82, label %.critedge, label %.critedge2

.critedge:                                        ; preds = %73, %80
  %indvars.iv.next133 = add nsw i64 %indvars.iv132, 1
  br label %73, !llvm.loop !20

.critedge2:                                       ; preds = %76, %74, %80
  %sext148 = shl i64 %.0105, 32
  %83 = ashr exact i64 %sext148, 32
  br label %84

84:                                               ; preds = %.critedge4, %.critedge2
  %indvars.iv135 = phi i64 [ %indvars.iv.next136, %.critedge4 ], [ %83, %.critedge2 ]
  %.not82 = icmp sgt i64 %indvars.iv135, %indvars.iv138
  br i1 %.not82, label %85, label %.critedge4

85:                                               ; preds = %84
  %86 = icmp slt i64 %indvars.iv135, %67
  br i1 %86, label %87, label %.critedge6

87:                                               ; preds = %85
  %88 = getelementptr inbounds [4020 x %struct.Point], ptr @v, i64 0, i64 %indvars.iv135
  %89 = call noundef i64 @_ZNK5PointmlERKS_(ptr noundef nonnull align 8 dereferenceable(16) %88, ptr noundef nonnull align 8 dereferenceable(16) %68)
  %90 = icmp slt i64 %89, 0
  br i1 %90, label %.critedge4, label %.critedge6

.critedge4:                                       ; preds = %84, %87
  %indvars.iv.next136 = add nsw i64 %indvars.iv135, 1
  br label %84, !llvm.loop !21

.critedge6:                                       ; preds = %85, %87
  %91 = sub i64 %indvars.iv135, %indvars.iv132
  %sext149 = shl i64 %91, 32
  %92 = ashr exact i64 %sext149, 32
  %93 = sub nsw i64 %.179102, %92
  %indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
  %exitcond142.not = icmp eq i64 %indvars.iv.next139, %wide.trip.count141
  br i1 %exitcond142.not, label %._crit_edge106, label %.preheader, !llvm.loop !22

._crit_edge115:                                   ; preds = %._crit_edge111, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZNK5PointmiERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress 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) #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK5PointmlERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK5PointeoERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #6 align 2

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = !{i64 0, i64 8, !12, i64 8, i64 8, !12}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !18}
!18 = !{!"llvm.loop.peeled.count", i32 1}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}


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