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

; 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 { i32, i32 }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@fact = external dso_local global [2000010 x [2 x i32]], align 16
@inv = external dso_local global [997 x i32], align 16
@f = external dso_local global [100 x i32], align 16
@a = external dso_local global [100 x %struct.Point], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [14 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4pathii(i32 noundef, i32 noundef) #1

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

18:                                               ; preds = %63, %0
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = icmp slt i32 %19, 2000010
  br i1 %20, label %22, label %21

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

22:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  %23 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %23, ptr %3, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %28, %22
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = srem i32 %25, 997
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %37

28:                                               ; preds = %24
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [2000010 x [2 x i32]], ptr @fact, i64 0, i64 %30
  %32 = getelementptr inbounds [2 x i32], ptr %31, i64 0, i64 1
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %32, align 4, !tbaa !5
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = sdiv i32 %35, 997
  store i32 %36, ptr %3, align 4, !tbaa !5
  br label %24, !llvm.loop !9

37:                                               ; preds = %24
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = sub nsw i32 %38, 1
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [2000010 x [2 x i32]], ptr @fact, i64 0, i64 %40
  %42 = getelementptr inbounds [2 x i32], ptr %41, i64 0, i64 0
  %43 = load i32, ptr %42, align 8, !tbaa !5
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = mul nsw i32 %43, %44
  %46 = srem i32 %45, 997
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [2000010 x [2 x i32]], ptr @fact, i64 0, i64 %48
  %50 = getelementptr inbounds [2 x i32], ptr %49, i64 0, i64 0
  store i32 %46, ptr %50, align 8, !tbaa !5
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = sub nsw i32 %51, 1
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [2000010 x [2 x i32]], ptr @fact, i64 0, i64 %53
  %55 = getelementptr inbounds [2 x i32], ptr %54, i64 0, i64 1
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = load i32, ptr %2, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [2000010 x [2 x i32]], ptr @fact, i64 0, i64 %58
  %60 = getelementptr inbounds [2 x i32], ptr %59, i64 0, i64 1
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = add nsw i32 %61, %56
  store i32 %62, ptr %60, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %63

63:                                               ; preds = %37
  %64 = load i32, ptr %2, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %2, align 4, !tbaa !5
  br label %18, !llvm.loop !11

66:                                               ; preds = %21
  store i32 1, ptr getelementptr inbounds ([997 x i32], ptr @inv, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 2, ptr %4, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %85, %66
  %68 = load i32, ptr %4, align 4, !tbaa !5
  %69 = icmp slt i32 %68, 997
  br i1 %69, label %71, label %70

70:                                               ; preds = %67
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %88

71:                                               ; preds = %67
  %72 = load i32, ptr %4, align 4, !tbaa !5
  %73 = srem i32 997, %72
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [997 x i32], ptr @inv, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = load i32, ptr %4, align 4, !tbaa !5
  %78 = sdiv i32 997, %77
  %79 = sub nsw i32 997, %78
  %80 = mul nsw i32 %76, %79
  %81 = srem i32 %80, 997
  %82 = load i32, ptr %4, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [997 x i32], ptr @inv, i64 0, i64 %83
  store i32 %81, ptr %84, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %71
  %86 = load i32, ptr %4, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %4, align 4, !tbaa !5
  br label %67, !llvm.loop !12

88:                                               ; preds = %70
  %89 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %268, %88
  %91 = load i32, ptr %5, align 4, !tbaa !5
  %92 = load i32, ptr @t, align 4, !tbaa !5
  %93 = icmp sle i32 %91, %92
  br i1 %93, label %95, label %94

94:                                               ; preds = %90
  store i32 10, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %271

95:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr @tot, align 4, !tbaa !5
  %96 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m, ptr noundef %7)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %97

97:                                               ; preds = %153, %95
  %98 = load i32, ptr %8, align 4, !tbaa !5
  %99 = load i32, ptr %7, align 4, !tbaa !5
  %100 = icmp sle i32 %98, %99
  br i1 %100, label %102, label %101

101:                                              ; preds = %97
  store i32 13, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %156

102:                                              ; preds = %97
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %103 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %9, ptr noundef %10)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %104 = load i32, ptr %9, align 4, !tbaa !5
  %105 = sub nsw i32 %104, 1
  store i32 %105, ptr %11, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %149, %102
  %107 = load i32, ptr %11, align 4, !tbaa !5
  %108 = load i32, ptr %9, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  %110 = icmp sle i32 %107, %109
  br i1 %110, label %112, label %111

111:                                              ; preds = %106
  store i32 16, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %152

112:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %113 = load i32, ptr %10, align 4, !tbaa !5
  %114 = sub nsw i32 %113, 1
  store i32 %114, ptr %12, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %145, %112
  %116 = load i32, ptr %12, align 4, !tbaa !5
  %117 = load i32, ptr %10, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  %119 = icmp sle i32 %116, %118
  br i1 %119, label %121, label %120

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

121:                                              ; preds = %115
  %122 = load i32, ptr %11, align 4, !tbaa !5
  %123 = icmp sge i32 %122, 1
  br i1 %123, label %124, label %144

124:                                              ; preds = %121
  %125 = load i32, ptr %11, align 4, !tbaa !5
  %126 = load i32, ptr @n, align 4, !tbaa !5
  %127 = icmp sle i32 %125, %126
  br i1 %127, label %128, label %144

128:                                              ; preds = %124
  %129 = load i32, ptr %12, align 4, !tbaa !5
  %130 = icmp sge i32 %129, 1
  br i1 %130, label %131, label %144

131:                                              ; preds = %128
  %132 = load i32, ptr %12, align 4, !tbaa !5
  %133 = load i32, ptr @m, align 4, !tbaa !5
  %134 = icmp sle i32 %132, %133
  br i1 %134, label %135, label %144

135:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %136 = getelementptr inbounds %struct.Point, ptr %13, i32 0, i32 0
  %137 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %137, ptr %136, align 4, !tbaa !13
  %138 = getelementptr inbounds %struct.Point, ptr %13, i32 0, i32 1
  %139 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %139, ptr %138, align 4, !tbaa !15
  %140 = load i32, ptr @tot, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr @tot, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [100 x %struct.Point], ptr @a, i64 0, i64 %142
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %143, ptr align 4 %13, i64 8, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %144

144:                                              ; preds = %135, %131, %128, %124, %121
  br label %145

145:                                              ; preds = %144
  %146 = load i32, ptr %12, align 4, !tbaa !5
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %12, align 4, !tbaa !5
  br label %115, !llvm.loop !17

148:                                              ; preds = %120
  br label %149

149:                                              ; preds = %148
  %150 = load i32, ptr %11, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %11, align 4, !tbaa !5
  br label %106, !llvm.loop !18

152:                                              ; preds = %111
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %153

153:                                              ; preds = %152
  %154 = load i32, ptr %8, align 4, !tbaa !5
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %8, align 4, !tbaa !5
  br label %97, !llvm.loop !19

156:                                              ; preds = %101
  %157 = load i32, ptr @tot, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds %struct.Point, ptr @a, i64 %158
  %160 = getelementptr inbounds %struct.Point, ptr %159, i64 1
  call void @_ZSt4sortIP5PointEvT_S2_(ptr noundef getelementptr inbounds (%struct.Point, ptr @a, i64 1), ptr noundef %160)
  %161 = load i32, ptr @tot, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds %struct.Point, ptr @a, i64 %162
  %164 = getelementptr inbounds %struct.Point, ptr %163, i64 1
  %165 = call noundef ptr @_ZSt6uniqueIP5PointET_S2_S2_(ptr noundef getelementptr inbounds (%struct.Point, ptr @a, i64 1), ptr noundef %164)
  %166 = ptrtoint ptr %165 to i64
  %167 = sub i64 %166, ptrtoint (ptr @a to i64)
  %168 = sdiv exact i64 %167, 8
  %169 = sub nsw i64 %168, 1
  %170 = trunc i64 %169 to i32
  store i32 %170, ptr @tot, align 4, !tbaa !5
  %171 = load i32, ptr getelementptr inbounds ([100 x %struct.Point], ptr @a, i64 0, i64 1), align 8, !tbaa !13
  %172 = icmp eq i32 %171, 1
  br i1 %172, label %173, label %176

173:                                              ; preds = %156
  %174 = load i32, ptr getelementptr inbounds (%struct.Point, ptr getelementptr inbounds ([100 x %struct.Point], ptr @a, i64 0, i64 1), i32 0, i32 1), align 4, !tbaa !15
  %175 = icmp eq i32 %174, 1
  br i1 %175, label %192, label %176

176:                                              ; preds = %173, %156
  %177 = load i32, ptr @tot, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [100 x %struct.Point], ptr @a, i64 0, i64 %178
  %180 = getelementptr inbounds %struct.Point, ptr %179, i32 0, i32 0
  %181 = load i32, ptr %180, align 8, !tbaa !13
  %182 = load i32, ptr @n, align 4, !tbaa !5
  %183 = icmp eq i32 %181, %182
  br i1 %183, label %184, label %195

184:                                              ; preds = %176
  %185 = load i32, ptr @tot, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [100 x %struct.Point], ptr @a, i64 0, i64 %186
  %188 = getelementptr inbounds %struct.Point, ptr %187, i32 0, i32 1
  %189 = load i32, ptr %188, align 4, !tbaa !15
  %190 = load i32, ptr @m, align 4, !tbaa !5
  %191 = icmp eq i32 %189, %190
  br i1 %191, label %192, label %195

192:                                              ; preds = %184, %173
  %193 = load i32, ptr %5, align 4, !tbaa !5
  %194 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %193)
  store i32 12, ptr %6, align 4
  br label %265

195:                                              ; preds = %184, %176
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %196 = getelementptr inbounds %struct.Point, ptr %14, i32 0, i32 0
  store i32 1, ptr %196, align 4, !tbaa !13
  %197 = getelementptr inbounds %struct.Point, ptr %14, i32 0, i32 1
  store i32 1, ptr %197, align 4, !tbaa !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 @a, ptr align 4 %14, i64 8, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %198 = getelementptr inbounds %struct.Point, ptr %15, i32 0, i32 0
  %199 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %199, ptr %198, align 4, !tbaa !13
  %200 = getelementptr inbounds %struct.Point, ptr %15, i32 0, i32 1
  %201 = load i32, ptr @m, align 4, !tbaa !5
  store i32 %201, ptr %200, align 4, !tbaa !15
  %202 = load i32, ptr @tot, align 4, !tbaa !5
  %203 = add nsw i32 %202, 1
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [100 x %struct.Point], ptr @a, i64 0, i64 %204
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %205, ptr align 4 %15, i64 8, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  store i32 1, ptr @f, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 1, ptr %16, align 4, !tbaa !5
  br label %206

206:                                              ; preds = %254, %195
  %207 = load i32, ptr %16, align 4, !tbaa !5
  %208 = load i32, ptr @tot, align 4, !tbaa !5
  %209 = add nsw i32 %208, 1
  %210 = icmp sle i32 %207, %209
  br i1 %210, label %212, label %211

211:                                              ; preds = %206
  store i32 22, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %257

212:                                              ; preds = %206
  %213 = load i32, ptr %16, align 4, !tbaa !5
  %214 = call noundef i32 @_Z4pathii(i32 noundef 0, i32 noundef %213)
  %215 = load i32, ptr %16, align 4, !tbaa !5
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %216
  store i32 %214, ptr %217, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 1, ptr %17, align 4, !tbaa !5
  br label %218

218:                                              ; preds = %250, %212
  %219 = load i32, ptr %17, align 4, !tbaa !5
  %220 = load i32, ptr %16, align 4, !tbaa !5
  %221 = icmp slt i32 %219, %220
  br i1 %221, label %223, label %222

222:                                              ; preds = %218
  store i32 25, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %253

223:                                              ; preds = %218
  %224 = load i32, ptr %17, align 4, !tbaa !5
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %225
  %227 = load i32, ptr %226, align 4, !tbaa !5
  %228 = load i32, ptr %17, align 4, !tbaa !5
  %229 = load i32, ptr %16, align 4, !tbaa !5
  %230 = call noundef i32 @_Z4pathii(i32 noundef %228, i32 noundef %229)
  %231 = mul nsw i32 %227, %230
  %232 = srem i32 %231, 997
  %233 = load i32, ptr %16, align 4, !tbaa !5
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %234
  %236 = load i32, ptr %235, align 4, !tbaa !5
  %237 = sub nsw i32 %236, %232
  store i32 %237, ptr %235, align 4, !tbaa !5
  %238 = load i32, ptr %16, align 4, !tbaa !5
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %239
  %241 = load i32, ptr %240, align 4, !tbaa !5
  %242 = icmp slt i32 %241, 0
  br i1 %242, label %243, label %249

243:                                              ; preds = %223
  %244 = load i32, ptr %16, align 4, !tbaa !5
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %245
  %247 = load i32, ptr %246, align 4, !tbaa !5
  %248 = add nsw i32 %247, 997
  store i32 %248, ptr %246, align 4, !tbaa !5
  br label %249

249:                                              ; preds = %243, %223
  br label %250

250:                                              ; preds = %249
  %251 = load i32, ptr %17, align 4, !tbaa !5
  %252 = add nsw i32 %251, 1
  store i32 %252, ptr %17, align 4, !tbaa !5
  br label %218, !llvm.loop !20

253:                                              ; preds = %222
  br label %254

254:                                              ; preds = %253
  %255 = load i32, ptr %16, align 4, !tbaa !5
  %256 = add nsw i32 %255, 1
  store i32 %256, ptr %16, align 4, !tbaa !5
  br label %206, !llvm.loop !21

257:                                              ; preds = %211
  %258 = load i32, ptr %5, align 4, !tbaa !5
  %259 = load i32, ptr @tot, align 4, !tbaa !5
  %260 = add nsw i32 %259, 1
  %261 = sext i32 %260 to i64
  %262 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %261
  %263 = load i32, ptr %262, align 4, !tbaa !5
  %264 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %258, i32 noundef %263)
  store i32 0, ptr %6, align 4
  br label %265

265:                                              ; preds = %257, %192
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  %266 = load i32, ptr %6, align 4
  switch i32 %266, label %272 [
    i32 0, label %267
    i32 12, label %268
  ]

267:                                              ; preds = %265
  br label %268

268:                                              ; preds = %267, %265
  %269 = load i32, ptr %5, align 4, !tbaa !5
  %270 = add nsw i32 %269, 1
  store i32 %270, ptr %5, align 4, !tbaa !5
  br label %90, !llvm.loop !22

271:                                              ; preds = %94
  ret i32 0

272:                                              ; preds = %265
  unreachable
}

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

; 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: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt6uniqueIP5PointET_S2_S2_(ptr noundef, ptr noundef) #5

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { "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 = { 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 0}
!14 = !{!"_ZTS5Point", !6, i64 0, !6, i64 4}
!15 = !{!14, !6, i64 4}
!16 = !{i64 0, i64 4, !5, i64 4, i64 4, !5}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !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 { i32, i32 }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@fact = external dso_local local_unnamed_addr global [2000010 x [2 x i32]], align 16
@inv = external dso_local local_unnamed_addr global [997 x i32], align 16
@f = external dso_local local_unnamed_addr global [100 x i32], align 16
@a = external dso_local global [100 x %struct.Point], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [14 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4pathii(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  store i32 1, ptr @fact, align 16, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %0, %.preheader._crit_edge
  %4 = phi i32 [ 1, %0 ], [ %18, %.preheader._crit_edge ]
  %indvars.iv = phi i64 [ 1, %0 ], [ %indvars.iv.next, %.preheader._crit_edge ]
  %5 = trunc nuw nsw i64 %indvars.iv to i32
  %6 = urem i32 %5, 997
  %7 = icmp eq i32 %6, 0
  %8 = getelementptr inbounds [2000010 x [2 x i32]], ptr @fact, i64 0, i64 %indvars.iv, i64 1
  %.promoted = load i32, ptr %8, align 4, !tbaa !5
  br i1 %7, label %.lr.ph, label %.preheader._crit_edge

9:                                                ; preds = %.preheader._crit_edge
  store i32 1, ptr getelementptr inbounds (i8, ptr @inv, i64 4), align 4, !tbaa !5
  br label %27

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %10 = phi i32 [ %11, %.lr.ph ], [ %.promoted, %.preheader ]
  %.05473 = phi i32 [ %12, %.lr.ph ], [ %5, %.preheader ]
  %11 = add nsw i32 %10, 1
  %12 = sdiv i32 %.05473, 997
  %13 = srem i32 %12, 997
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %.lr.ph, label %.preheader._crit_edge, !llvm.loop !9

.preheader._crit_edge:                            ; preds = %.lr.ph, %.preheader
  %15 = phi i32 [ %.promoted, %.preheader ], [ %11, %.lr.ph ]
  %.054.lcssa = phi i32 [ %5, %.preheader ], [ %12, %.lr.ph ]
  %16 = add nsw i64 %indvars.iv, -1
  %17 = mul nsw i32 %4, %.054.lcssa
  %18 = srem i32 %17, 997
  %19 = getelementptr inbounds [2000010 x [2 x i32]], ptr @fact, i64 0, i64 %indvars.iv
  store i32 %18, ptr %19, align 8, !tbaa !5
  %20 = getelementptr inbounds [2000010 x [2 x i32]], ptr @fact, i64 0, i64 %16, i64 1
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %19, i64 4
  %23 = add nsw i32 %15, %21
  store i32 %23, ptr %22, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 2000010
  br i1 %exitcond.not, label %9, label %.preheader, !llvm.loop !11

24:                                               ; preds = %27
  %25 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %26 = load i32, ptr @t, align 4, !tbaa !5
  %.not100 = icmp slt i32 %26, 1
  br i1 %.not100, label %._crit_edge105, label %.lr.ph104

27:                                               ; preds = %9, %27
  %indvars.iv113 = phi i64 [ 2, %9 ], [ %indvars.iv.next114, %27 ]
  %.rhs.trunc = trunc i64 %indvars.iv113 to i16
  %28 = urem i16 997, %.rhs.trunc
  %29 = zext nneg i16 %28 to i64
  %30 = getelementptr inbounds [997 x i32], ptr @inv, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = udiv i16 997, %.rhs.trunc
  %narrow = sub nuw nsw i16 997, %32
  %33 = zext nneg i16 %narrow to i32
  %34 = mul nsw i32 %31, %33
  %35 = srem i32 %34, 997
  %36 = getelementptr inbounds [997 x i32], ptr @inv, i64 0, i64 %indvars.iv113
  store i32 %35, ptr %36, align 4, !tbaa !5
  %indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1
  %exitcond116.not = icmp eq i64 %indvars.iv.next114, 997
  br i1 %exitcond116.not, label %24, label %27, !llvm.loop !12

._crit_edge105:                                   ; preds = %162, %24
  ret i32 0

.lr.ph104:                                        ; preds = %24, %162
  %.056101 = phi i32 [ %163, %162 ], [ 1, %24 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  store i32 0, ptr @tot, align 4, !tbaa !5
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull %1)
  %38 = load i32, ptr %1, align 4, !tbaa !5
  %.not6284 = icmp slt i32 %38, 1
  br i1 %.not6284, label %.lr.ph104.._crit_edge88_crit_edge, label %.lr.ph87

.lr.ph104.._crit_edge88_crit_edge:                ; preds = %.lr.ph104
  %.pre133 = load i32, ptr @tot, align 4, !tbaa !5
  br label %._crit_edge88

._crit_edge88:                                    ; preds = %.split.preheader.2, %.lr.ph104.._crit_edge88_crit_edge
  %39 = phi i32 [ %.pre133, %.lr.ph104.._crit_edge88_crit_edge ], [ %61, %.split.preheader.2 ]
  %40 = sext i32 %39 to i64
  %gep = getelementptr %struct.Point, ptr getelementptr inbounds (i8, ptr @a, i64 8), i64 %40
  call void @_ZSt4sortIP5PointEvT_S2_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 8), ptr noundef nonnull %gep)
  %41 = load i32, ptr @tot, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %gep99 = getelementptr %struct.Point, ptr getelementptr inbounds (i8, ptr @a, i64 8), i64 %42
  %43 = call noundef ptr @_ZSt6uniqueIP5PointET_S2_S2_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 8), ptr noundef nonnull %gep99)
  %44 = ptrtoint ptr %43 to i64
  %45 = sub i64 %44, ptrtoint (ptr @a to i64)
  %46 = lshr exact i64 %45, 3
  %47 = trunc i64 %46 to i32
  %48 = add i32 %47, -1
  store i32 %48, ptr @tot, align 4, !tbaa !5
  %49 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 8), align 8, !tbaa !13
  %50 = icmp eq i32 %49, 1
  %51 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 12), align 4
  %52 = icmp eq i32 %51, 1
  %or.cond3 = select i1 %50, i1 %52, i1 false
  br i1 %or.cond3, label %137, label %127

.lr.ph87:                                         ; preds = %.lr.ph104, %.split.preheader.2
  %.05785 = phi i32 [ %62, %.split.preheader.2 ], [ 1, %.lr.ph104 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %53 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %54 = load i32, ptr %2, align 4, !tbaa !5
  %55 = add nsw i32 %54, -1
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = add nsw i32 %56, -1
  %58 = load i32, ptr @n, align 4
  %59 = load i32, ptr @m, align 4
  %tot.promoted80 = load i32, ptr @tot, align 4, !tbaa !5
  %60 = icmp sgt i32 %54, 1
  br i1 %60, label %.split.us, label %.split79.us

.split.preheader.2:                               ; preds = %.split.us.2, %122, %.split.us.split.2.2, %.split79.us.1
  %61 = phi i32 [ %tot.promoted80, %.split79.us.1 ], [ %124, %122 ], [ %120, %.split.us.split.2.2 ], [ %107, %.split.us.2 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  %62 = add nuw nsw i32 %.05785, 1
  %63 = load i32, ptr %1, align 4, !tbaa !5
  %.not62.not = icmp slt i32 %.05785, %63
  br i1 %.not62.not, label %.lr.ph87, label %._crit_edge88, !llvm.loop !15

.split.us:                                        ; preds = %.lr.ph87
  %64 = icmp sgt i32 %55, %58
  %.fr = freeze i1 %64
  br i1 %.fr, label %.split.us.1, label %.split.us.split.preheader

.split.us.split.preheader:                        ; preds = %.split.us
  %65 = icmp slt i32 %56, 2
  %.not66.us = icmp sgt i32 %57, %59
  %or.cond67.us = select i1 %65, i1 true, i1 %.not66.us
  br i1 %or.cond67.us, label %.split.us.split.1, label %66

66:                                               ; preds = %.split.us.split.preheader
  %67 = add nsw i32 %tot.promoted80, 1
  store i32 %67, ptr @tot, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [100 x %struct.Point], ptr @a, i64 0, i64 %68
  store i32 %55, ptr %69, align 8, !tbaa !5
  %.sroa.419.0..sroa_idx.us = getelementptr inbounds i8, ptr %69, i64 4
  store i32 %57, ptr %.sroa.419.0..sroa_idx.us, align 4, !tbaa !5
  br label %.split.us.split.1

.split.us.split.1:                                ; preds = %.split.us.split.preheader, %66
  %70 = phi i32 [ %tot.promoted80, %.split.us.split.preheader ], [ %67, %66 ]
  %71 = icmp slt i32 %56, 1
  %.not66.us.1 = icmp sgt i32 %56, %59
  %or.cond67.us.1 = select i1 %71, i1 true, i1 %.not66.us.1
  br i1 %or.cond67.us.1, label %.split.us.split.2, label %72

72:                                               ; preds = %.split.us.split.1
  %73 = add nsw i32 %70, 1
  store i32 %73, ptr @tot, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [100 x %struct.Point], ptr @a, i64 0, i64 %74
  store i32 %55, ptr %75, align 8, !tbaa !5
  %.sroa.419.0..sroa_idx.us.1 = getelementptr inbounds i8, ptr %75, i64 4
  store i32 %56, ptr %.sroa.419.0..sroa_idx.us.1, align 4, !tbaa !5
  br label %.split.us.split.2

.split.us.split.2:                                ; preds = %72, %.split.us.split.1
  %76 = phi i32 [ %70, %.split.us.split.1 ], [ %73, %72 ]
  %77 = icmp slt i32 %56, 0
  %.not66.us.2 = icmp sge i32 %56, %59
  %or.cond67.us.2 = select i1 %77, i1 true, i1 %.not66.us.2
  br i1 %or.cond67.us.2, label %.split.us.1, label %78

78:                                               ; preds = %.split.us.split.2
  %79 = add nuw nsw i32 %56, 1
  %80 = add nsw i32 %76, 1
  store i32 %80, ptr @tot, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [100 x %struct.Point], ptr @a, i64 0, i64 %81
  store i32 %55, ptr %82, align 8, !tbaa !5
  %.sroa.419.0..sroa_idx.us.2 = getelementptr inbounds i8, ptr %82, i64 4
  store i32 %79, ptr %.sroa.419.0..sroa_idx.us.2, align 4, !tbaa !5
  br label %.split.us.1

.split79.us:                                      ; preds = %.lr.ph87
  %83 = icmp eq i32 %54, 1
  br i1 %83, label %.split.us.1, label %.split79.us.1

.split.us.1:                                      ; preds = %78, %.split.us.split.2, %.split.us, %.split79.us
  %84 = phi i32 [ %tot.promoted80, %.split79.us ], [ %80, %78 ], [ %76, %.split.us.split.2 ], [ %tot.promoted80, %.split.us ]
  %85 = icmp sgt i32 %54, %58
  %.fr.1 = freeze i1 %85
  br i1 %.fr.1, label %.split79.us.1.thread, label %.split.us.split.preheader.1

.split.us.split.preheader.1:                      ; preds = %.split.us.1
  %86 = icmp slt i32 %56, 2
  %.not66.us.1117 = icmp sgt i32 %57, %59
  %or.cond67.us.1118 = select i1 %86, i1 true, i1 %.not66.us.1117
  br i1 %or.cond67.us.1118, label %.split.us.split.1.1, label %87

87:                                               ; preds = %.split.us.split.preheader.1
  %88 = add nsw i32 %84, 1
  store i32 %88, ptr @tot, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [100 x %struct.Point], ptr @a, i64 0, i64 %89
  store i32 %54, ptr %90, align 8, !tbaa !5
  %.sroa.419.0..sroa_idx.us.1120 = getelementptr inbounds i8, ptr %90, i64 4
  store i32 %57, ptr %.sroa.419.0..sroa_idx.us.1120, align 4, !tbaa !5
  br label %.split.us.split.1.1

.split.us.split.1.1:                              ; preds = %.split.us.split.preheader.1, %87
  %91 = phi i32 [ %84, %.split.us.split.preheader.1 ], [ %88, %87 ]
  %92 = icmp slt i32 %56, 1
  %.not66.us.1.1 = icmp sgt i32 %56, %59
  %or.cond67.us.1.1 = select i1 %92, i1 true, i1 %.not66.us.1.1
  br i1 %or.cond67.us.1.1, label %.split.us.split.2.1, label %93

93:                                               ; preds = %.split.us.split.1.1
  %94 = add nsw i32 %91, 1
  store i32 %94, ptr @tot, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [100 x %struct.Point], ptr @a, i64 0, i64 %95
  store i32 %54, ptr %96, align 8, !tbaa !5
  %.sroa.419.0..sroa_idx.us.1.1 = getelementptr inbounds i8, ptr %96, i64 4
  store i32 %56, ptr %.sroa.419.0..sroa_idx.us.1.1, align 4, !tbaa !5
  br label %.split.us.split.2.1

.split.us.split.2.1:                              ; preds = %93, %.split.us.split.1.1
  %97 = phi i32 [ %91, %.split.us.split.1.1 ], [ %94, %93 ]
  %98 = icmp slt i32 %56, 0
  %.not66.us.2.1 = icmp sge i32 %56, %59
  %or.cond67.us.2.1 = select i1 %98, i1 true, i1 %.not66.us.2.1
  br i1 %or.cond67.us.2.1, label %.split79.us.1.thread, label %99

99:                                               ; preds = %.split.us.split.2.1
  %100 = add nuw nsw i32 %56, 1
  %101 = add nsw i32 %97, 1
  store i32 %101, ptr @tot, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [100 x %struct.Point], ptr @a, i64 0, i64 %102
  store i32 %54, ptr %103, align 8, !tbaa !5
  %.sroa.419.0..sroa_idx.us.2.1 = getelementptr inbounds i8, ptr %103, i64 4
  store i32 %100, ptr %.sroa.419.0..sroa_idx.us.2.1, align 4, !tbaa !5
  br label %.split79.us.1.thread

.split79.us.1.thread:                             ; preds = %.split.us.1, %99, %.split.us.split.2.1
  %.ph135 = phi i32 [ %84, %.split.us.1 ], [ %101, %99 ], [ %97, %.split.us.split.2.1 ]
  %104 = add nuw nsw i32 %54, 1
  br label %.split.us.2

.split79.us.1:                                    ; preds = %.split79.us
  %105 = icmp sgt i32 %54, -1
  br i1 %105, label %.split.us.2, label %.split.preheader.2

.split.us.2:                                      ; preds = %.split79.us.1.thread, %.split79.us.1
  %106 = phi i32 [ %104, %.split79.us.1.thread ], [ 1, %.split79.us.1 ]
  %107 = phi i32 [ %.ph135, %.split79.us.1.thread ], [ %tot.promoted80, %.split79.us.1 ]
  %108 = icmp sge i32 %54, %58
  %.fr.2 = freeze i1 %108
  br i1 %.fr.2, label %.split.preheader.2, label %.split.us.split.preheader.2

.split.us.split.preheader.2:                      ; preds = %.split.us.2
  %109 = icmp slt i32 %56, 2
  %.not66.us.2121 = icmp sgt i32 %57, %59
  %or.cond67.us.2122 = select i1 %109, i1 true, i1 %.not66.us.2121
  br i1 %or.cond67.us.2122, label %.split.us.split.1.2, label %110

110:                                              ; preds = %.split.us.split.preheader.2
  %111 = add nsw i32 %107, 1
  store i32 %111, ptr @tot, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [100 x %struct.Point], ptr @a, i64 0, i64 %112
  store i32 %106, ptr %113, align 8, !tbaa !5
  %.sroa.419.0..sroa_idx.us.2124 = getelementptr inbounds i8, ptr %113, i64 4
  store i32 %57, ptr %.sroa.419.0..sroa_idx.us.2124, align 4, !tbaa !5
  br label %.split.us.split.1.2

.split.us.split.1.2:                              ; preds = %.split.us.split.preheader.2, %110
  %114 = phi i32 [ %107, %.split.us.split.preheader.2 ], [ %111, %110 ]
  %115 = icmp slt i32 %56, 1
  %.not66.us.1.2 = icmp sgt i32 %56, %59
  %or.cond67.us.1.2 = select i1 %115, i1 true, i1 %.not66.us.1.2
  br i1 %or.cond67.us.1.2, label %.split.us.split.2.2, label %116

116:                                              ; preds = %.split.us.split.1.2
  %117 = add nsw i32 %114, 1
  store i32 %117, ptr @tot, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [100 x %struct.Point], ptr @a, i64 0, i64 %118
  store i32 %106, ptr %119, align 8, !tbaa !5
  %.sroa.419.0..sroa_idx.us.1.2 = getelementptr inbounds i8, ptr %119, i64 4
  store i32 %56, ptr %.sroa.419.0..sroa_idx.us.1.2, align 4, !tbaa !5
  br label %.split.us.split.2.2

.split.us.split.2.2:                              ; preds = %116, %.split.us.split.1.2
  %120 = phi i32 [ %114, %.split.us.split.1.2 ], [ %117, %116 ]
  %121 = icmp slt i32 %56, 0
  %.not66.us.2.2 = icmp sge i32 %56, %59
  %or.cond67.us.2.2 = select i1 %121, i1 true, i1 %.not66.us.2.2
  br i1 %or.cond67.us.2.2, label %.split.preheader.2, label %122

122:                                              ; preds = %.split.us.split.2.2
  %123 = add nuw nsw i32 %56, 1
  %124 = add nsw i32 %120, 1
  store i32 %124, ptr @tot, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [100 x %struct.Point], ptr @a, i64 0, i64 %125
  store i32 %106, ptr %126, align 8, !tbaa !5
  %.sroa.419.0..sroa_idx.us.2.2 = getelementptr inbounds i8, ptr %126, i64 4
  store i32 %123, ptr %.sroa.419.0..sroa_idx.us.2.2, align 4, !tbaa !5
  br label %.split.preheader.2

127:                                              ; preds = %._crit_edge88
  %128 = sext i32 %48 to i64
  %129 = getelementptr inbounds [100 x %struct.Point], ptr @a, i64 0, i64 %128
  %130 = load i32, ptr %129, align 8, !tbaa !13
  %131 = load i32, ptr @n, align 4, !tbaa !5
  %132 = icmp eq i32 %130, %131
  %.pre134 = load i32, ptr @m, align 4, !tbaa !5
  br i1 %132, label %133, label %139

133:                                              ; preds = %127
  %134 = getelementptr inbounds i8, ptr %129, i64 4
  %135 = load i32, ptr %134, align 4, !tbaa !16
  %136 = icmp eq i32 %135, %.pre134
  br i1 %136, label %137, label %139

137:                                              ; preds = %._crit_edge88, %133
  %138 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.056101)
  br label %162

139:                                              ; preds = %133, %127
  store i32 1, ptr @a, align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @a, i64 4), align 4, !tbaa !5
  %sext = shl i64 %45, 29
  %140 = ashr i64 %sext, 32
  %141 = getelementptr inbounds [100 x %struct.Point], ptr @a, i64 0, i64 %140
  store i32 %131, ptr %141, align 8, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %141, i64 4
  store i32 %.pre134, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  store i32 1, ptr @f, align 16, !tbaa !5
  %.not6393 = icmp slt i32 %48, 0
  br i1 %.not6393, label %._crit_edge97, label %.lr.ph96

._crit_edge97:                                    ; preds = %._crit_edge92, %139
  %.lcssa.in = phi i32 [ %48, %139 ], [ %150, %._crit_edge92 ]
  %.lcssa = add nsw i32 %.lcssa.in, 1
  %142 = sext i32 %.lcssa to i64
  %143 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %145 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %.056101, i32 noundef %144)
  br label %162

.lr.ph96:                                         ; preds = %139, %._crit_edge92
  %indvars.iv129 = phi i64 [ %indvars.iv.next130, %._crit_edge92 ], [ 1, %139 ]
  %146 = trunc nuw nsw i64 %indvars.iv129 to i32
  %147 = call noundef i32 @_Z4pathii(i32 noundef 0, i32 noundef %146)
  %148 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv129
  store i32 %147, ptr %148, align 4, !tbaa !5
  %149 = icmp ugt i64 %indvars.iv129, 1
  br i1 %149, label %.lr.ph91, label %._crit_edge92

._crit_edge92:                                    ; preds = %.lr.ph91, %.lr.ph96
  %indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
  %150 = load i32, ptr @tot, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %.not63 = icmp sgt i64 %indvars.iv129, %151
  br i1 %.not63, label %._crit_edge97, label %.lr.ph96, !llvm.loop !17

.lr.ph91:                                         ; preds = %.lr.ph96, %.lr.ph91
  %indvars.iv125 = phi i64 [ %indvars.iv.next126, %.lr.ph91 ], [ 1, %.lr.ph96 ]
  %152 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv125
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = trunc nuw nsw i64 %indvars.iv125 to i32
  %155 = call noundef i32 @_Z4pathii(i32 noundef %154, i32 noundef %146)
  %156 = mul nsw i32 %155, %153
  %157 = srem i32 %156, 997
  %158 = load i32, ptr %148, align 4, !tbaa !5
  %159 = sub nsw i32 %158, %157
  %160 = icmp slt i32 %159, 0
  %161 = add nsw i32 %159, 997
  %spec.select = select i1 %160, i32 %161, i32 %159
  store i32 %spec.select, ptr %148, align 4, !tbaa !5
  %indvars.iv.next126 = add nuw nsw i64 %indvars.iv125, 1
  %exitcond128.not = icmp eq i64 %indvars.iv.next126, %indvars.iv129
  br i1 %exitcond128.not, label %._crit_edge92, label %.lr.ph91, !llvm.loop !18

162:                                              ; preds = %._crit_edge97, %137
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %163 = add nuw nsw i32 %.056101, 1
  %164 = load i32, ptr @t, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.056101, %164
  br i1 %.not.not, label %.lr.ph104, label %._crit_edge105, !llvm.loop !19
}

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt6uniqueIP5PointET_S2_S2_(ptr noundef, ptr noundef) local_unnamed_addr #4

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 #4 = { 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 #5 = { nounwind }

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

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


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