; LLVM IR from tangjz/acm-icpc :: codeforces/gym (101412G)

; 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::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [32 x i64] }
%struct.Point = type { i32, i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@r = external dso_local global [2000 x i32], align 16
@val = external dso_local global [15 x i32], align 16
@dis = external dso_local global [15 x i32], align 16
@cnt = external dso_local global [15 x %"class.std::bitset"], align 16
@cost = external dso_local global { [32 x i64] }, align 8
@cir = external dso_local global [2000 x %struct.Point], align 16
@lht = external dso_local global [15 x %struct.Point], align 16
@obj = external dso_local global %struct.Point, align 4
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3sgni(i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %struct.Point, align 4
  %6 = alloca { i64, i32 }, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %struct.Point, align 4
  %10 = alloca { i64, i32 }, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %struct.Point, align 4
  %14 = alloca { i64, i32 }, align 8
  %15 = alloca i32, align 4
  %16 = alloca %struct.Point, align 4
  %17 = alloca { i64, i32 }, align 8
  %18 = alloca %struct.Point, align 4
  %19 = alloca { i64, i32 }, align 8
  %20 = alloca double, align 8
  %21 = alloca i32, align 4
  %22 = alloca double, align 8
  %23 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  br label %24

24:                                               ; preds = %310, %0
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m, ptr noundef @q)
  %26 = icmp eq i32 %25, 3
  br i1 %26, label %27, label %34

27:                                               ; preds = %24
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = load i32, ptr @m, align 4, !tbaa !5
  %30 = add nsw i32 %28, %29
  %31 = load i32, ptr @q, align 4, !tbaa !5
  %32 = add nsw i32 %30, %31
  %33 = icmp ne i32 %32, 0
  br label %34

34:                                               ; preds = %27, %24
  %35 = phi i1 [ false, %24 ], [ %33, %27 ]
  br i1 %35, label %36, label %313

36:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %59, %36
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = load i32, ptr @n, align 4, !tbaa !5
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %62

42:                                               ; preds = %37
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [2000 x %struct.Point], ptr @cir, i64 0, i64 %44
  %46 = getelementptr inbounds %struct.Point, ptr %45, i32 0, i32 0
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [2000 x %struct.Point], ptr @cir, i64 0, i64 %48
  %50 = getelementptr inbounds %struct.Point, ptr %49, i32 0, i32 1
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [2000 x %struct.Point], ptr @cir, i64 0, i64 %52
  %54 = getelementptr inbounds %struct.Point, ptr %53, i32 0, i32 2
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds i32, ptr @r, i64 %56
  %58 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %46, ptr noundef %50, ptr noundef %54, ptr noundef %57)
  br label %59

59:                                               ; preds = %42
  %60 = load i32, ptr %2, align 4, !tbaa !5
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %2, align 4, !tbaa !5
  br label %37, !llvm.loop !9

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

63:                                               ; preds = %85, %62
  %64 = load i32, ptr %3, align 4, !tbaa !5
  %65 = load i32, ptr @m, align 4, !tbaa !5
  %66 = icmp slt i32 %64, %65
  br i1 %66, label %68, label %67

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

68:                                               ; preds = %63
  %69 = load i32, ptr %3, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [15 x %struct.Point], ptr @lht, i64 0, i64 %70
  %72 = getelementptr inbounds %struct.Point, ptr %71, i32 0, i32 0
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [15 x %struct.Point], ptr @lht, i64 0, i64 %74
  %76 = getelementptr inbounds %struct.Point, ptr %75, i32 0, i32 1
  %77 = load i32, ptr %3, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [15 x %struct.Point], ptr @lht, i64 0, i64 %78
  %80 = getelementptr inbounds %struct.Point, ptr %79, i32 0, i32 2
  %81 = load i32, ptr %3, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds i32, ptr @val, i64 %82
  %84 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %72, ptr noundef %76, ptr noundef %80, ptr noundef %83)
  br label %85

85:                                               ; preds = %68
  %86 = load i32, ptr %3, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %3, align 4, !tbaa !5
  br label %63, !llvm.loop !11

88:                                               ; preds = %67
  %89 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @obj, ptr noundef getelementptr inbounds (%struct.Point, ptr @obj, i32 0, i32 1), ptr noundef getelementptr inbounds (%struct.Point, ptr @obj, i32 0, i32 2))
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %90

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

94:                                               ; preds = %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %106

95:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 12, ptr %5) #7
  %96 = load i32, ptr %4, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [2000 x %struct.Point], ptr @cir, i64 0, i64 %97
  %99 = call { i64, i32 } @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(12) %98, ptr noundef nonnull align 4 dereferenceable(12) @obj)
  store { i64, i32 } %99, ptr %6, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 8 %6, i64 12, i1 false)
  %100 = load i32, ptr %4, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [2000 x %struct.Point], ptr @cir, i64 0, i64 %101
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %102, ptr align 4 %5, i64 12, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 12, ptr %5) #7
  br label %103

103:                                              ; preds = %95
  %104 = load i32, ptr %4, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %4, align 4, !tbaa !5
  br label %90, !llvm.loop !13

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

107:                                              ; preds = %250, %106
  %108 = load i32, ptr %7, align 4, !tbaa !5
  %109 = load i32, ptr @m, align 4, !tbaa !5
  %110 = icmp slt i32 %108, %109
  br i1 %110, label %112, label %111

111:                                              ; preds = %107
  store i32 13, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %253

112:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 12, ptr %9) #7
  %113 = load i32, ptr %7, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [15 x %struct.Point], ptr @lht, i64 0, i64 %114
  %116 = call { i64, i32 } @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(12) %115, ptr noundef nonnull align 4 dereferenceable(12) @obj)
  store { i64, i32 } %116, ptr %10, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 8 %10, i64 12, i1 false)
  %117 = load i32, ptr %7, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [15 x %struct.Point], ptr @lht, i64 0, i64 %118
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %119, ptr align 4 %9, i64 12, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #7
  %120 = load i32, ptr %7, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [15 x %struct.Point], ptr @lht, i64 0, i64 %121
  %123 = call noundef i64 @_ZNK5Point4modeEv(ptr noundef nonnull align 4 dereferenceable(12) %122)
  %124 = trunc i64 %123 to i32
  %125 = load i32, ptr %7, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [15 x i32], ptr @dis, i64 0, i64 %126
  store i32 %124, ptr %127, align 4, !tbaa !5
  %128 = load i32, ptr %7, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [15 x %"class.std::bitset"], ptr @cnt, i64 0, i64 %129
  %131 = call noundef nonnull align 8 dereferenceable(256) ptr @_ZNSt6bitsetILm2000EE5resetEv(ptr noundef nonnull align 8 dereferenceable(256) %130) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %132

132:                                              ; preds = %246, %112
  %133 = load i32, ptr %11, align 4, !tbaa !5
  %134 = load i32, ptr @n, align 4, !tbaa !5
  %135 = icmp slt i32 %133, %134
  br i1 %135, label %137, label %136

136:                                              ; preds = %132
  store i32 16, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %249

137:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr %13) #7
  %138 = load i32, ptr %7, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [15 x %struct.Point], ptr @lht, i64 0, i64 %139
  %141 = load i32, ptr %11, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [2000 x %struct.Point], ptr @cir, i64 0, i64 %142
  %144 = call { i64, i32 } @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(12) %140, ptr noundef nonnull align 4 dereferenceable(12) %143)
  store { i64, i32 } %144, ptr %14, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 8 %14, i64 12, i1 false)
  %145 = call noundef i64 @_ZNK5Point4modeEv(ptr noundef nonnull align 4 dereferenceable(12) %13)
  %146 = load i32, ptr %11, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [2000 x i32], ptr @r, i64 0, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !5
  %150 = load i32, ptr %11, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [2000 x i32], ptr @r, i64 0, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = mul nsw i32 %149, %153
  %155 = sext i32 %154 to i64
  %156 = sub nsw i64 %145, %155
  %157 = trunc i64 %156 to i32
  %158 = call noundef i32 @_Z3sgni(i32 noundef %157)
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #7
  store i32 %158, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %159 = load i32, ptr %11, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [2000 x %struct.Point], ptr @cir, i64 0, i64 %160
  %162 = call noundef i64 @_ZNK5Point4modeEv(ptr noundef nonnull align 4 dereferenceable(12) %161)
  %163 = load i32, ptr %11, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [2000 x i32], ptr @r, i64 0, i64 %164
  %166 = load i32, ptr %165, align 4, !tbaa !5
  %167 = load i32, ptr %11, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [2000 x i32], ptr @r, i64 0, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !5
  %171 = mul nsw i32 %166, %170
  %172 = sext i32 %171 to i64
  %173 = sub nsw i64 %162, %172
  %174 = trunc i64 %173 to i32
  %175 = call noundef i32 @_Z3sgni(i32 noundef %174)
  store i32 %175, ptr %15, align 4, !tbaa !5
  %176 = load i32, ptr %12, align 4, !tbaa !5
  %177 = load i32, ptr %15, align 4, !tbaa !5
  %178 = mul nsw i32 %176, %177
  %179 = icmp slt i32 %178, 0
  call void @llvm.lifetime.start.p0(i64 12, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr %18) #7
  br i1 %179, label %236, label %180

180:                                              ; preds = %137
  %181 = load i32, ptr %12, align 4, !tbaa !5
  %182 = icmp sgt i32 %181, 0
  br i1 %182, label %183, label %234

183:                                              ; preds = %180
  %184 = load i32, ptr %15, align 4, !tbaa !5
  %185 = icmp sgt i32 %184, 0
  br i1 %185, label %186, label %234

186:                                              ; preds = %183
  %187 = load i32, ptr %7, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [15 x %struct.Point], ptr @lht, i64 0, i64 %188
  %190 = load i32, ptr %11, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [2000 x %struct.Point], ptr @cir, i64 0, i64 %191
  %193 = call { i64, i32 } @_ZNK5Point3detERKS_(ptr noundef nonnull align 4 dereferenceable(12) %189, ptr noundef nonnull align 4 dereferenceable(12) %192)
  store { i64, i32 } %193, ptr %17, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 8 %17, i64 12, i1 false)
  %194 = call noundef i64 @_ZNK5Point4modeEv(ptr noundef nonnull align 4 dereferenceable(12) %16)
  %195 = load i32, ptr %11, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [2000 x i32], ptr @r, i64 0, i64 %196
  %198 = load i32, ptr %197, align 4, !tbaa !5
  %199 = load i32, ptr %11, align 4, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [2000 x i32], ptr @r, i64 0, i64 %200
  %202 = load i32, ptr %201, align 4, !tbaa !5
  %203 = mul nsw i32 %198, %202
  %204 = sext i32 %203 to i64
  %205 = load i32, ptr %7, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [15 x i32], ptr @dis, i64 0, i64 %206
  %208 = load i32, ptr %207, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = mul nsw i64 %204, %209
  %211 = icmp slt i64 %194, %210
  br i1 %211, label %212, label %234

212:                                              ; preds = %186
  %213 = load i32, ptr %7, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [15 x %struct.Point], ptr @lht, i64 0, i64 %214
  %216 = load i32, ptr %7, align 4, !tbaa !5
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds [15 x %struct.Point], ptr @lht, i64 0, i64 %217
  %219 = load i32, ptr %11, align 4, !tbaa !5
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [2000 x %struct.Point], ptr @cir, i64 0, i64 %220
  %222 = call { i64, i32 } @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(12) %218, ptr noundef nonnull align 4 dereferenceable(12) %221)
  store { i64, i32 } %222, ptr %19, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 8 %19, i64 12, i1 false)
  %223 = call noundef i64 @_ZNK5Point3dotERKS_(ptr noundef nonnull align 4 dereferenceable(12) %215, ptr noundef nonnull align 4 dereferenceable(12) %18)
  %224 = icmp sgt i64 %223, 0
  br i1 %224, label %225, label %234

225:                                              ; preds = %212
  %226 = load i32, ptr %7, align 4, !tbaa !5
  %227 = sext i32 %226 to i64
  %228 = getelementptr inbounds [15 x %struct.Point], ptr @lht, i64 0, i64 %227
  %229 = load i32, ptr %11, align 4, !tbaa !5
  %230 = sext i32 %229 to i64
  %231 = getelementptr inbounds [2000 x %struct.Point], ptr @cir, i64 0, i64 %230
  %232 = call noundef i64 @_ZNK5Point3dotERKS_(ptr noundef nonnull align 4 dereferenceable(12) %228, ptr noundef nonnull align 4 dereferenceable(12) %231)
  %233 = icmp sgt i64 %232, 0
  br label %234

234:                                              ; preds = %225, %212, %186, %183, %180
  %235 = phi i1 [ false, %212 ], [ false, %186 ], [ false, %183 ], [ false, %180 ], [ %233, %225 ]
  br label %236

236:                                              ; preds = %234, %137
  %237 = phi i1 [ true, %137 ], [ %235, %234 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %16) #7
  br i1 %237, label %238, label %245

238:                                              ; preds = %236
  %239 = load i32, ptr %7, align 4, !tbaa !5
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds [15 x %"class.std::bitset"], ptr @cnt, i64 0, i64 %240
  %242 = load i32, ptr %11, align 4, !tbaa !5
  %243 = sext i32 %242 to i64
  %244 = call noundef nonnull align 8 dereferenceable(256) ptr @_ZNSt6bitsetILm2000EE3setEmb(ptr noundef nonnull align 8 dereferenceable(256) %241, i64 noundef %243, i1 noundef zeroext true)
  br label %245

245:                                              ; preds = %238, %236
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %246

246:                                              ; preds = %245
  %247 = load i32, ptr %11, align 4, !tbaa !5
  %248 = add nsw i32 %247, 1
  store i32 %248, ptr %11, align 4, !tbaa !5
  br label %132, !llvm.loop !14

249:                                              ; preds = %136
  br label %250

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

253:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  store double 0.000000e+00, ptr %20, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  store i32 0, ptr %21, align 4, !tbaa !5
  br label %254

254:                                              ; preds = %307, %253
  %255 = load i32, ptr %21, align 4, !tbaa !5
  %256 = load i32, ptr @m, align 4, !tbaa !5
  %257 = shl i32 1, %256
  %258 = icmp slt i32 %255, %257
  br i1 %258, label %260, label %259

259:                                              ; preds = %254
  store i32 19, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %310

260:                                              ; preds = %254
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  store double 0.000000e+00, ptr %22, align 8, !tbaa !16
  %261 = call noundef nonnull align 8 dereferenceable(256) ptr @_ZNSt6bitsetILm2000EE5resetEv(ptr noundef nonnull align 8 dereferenceable(256) @cost) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  store i32 0, ptr %23, align 4, !tbaa !5
  br label %262

262:                                              ; preds = %292, %260
  %263 = load i32, ptr %23, align 4, !tbaa !5
  %264 = load i32, ptr @m, align 4, !tbaa !5
  %265 = icmp slt i32 %263, %264
  br i1 %265, label %267, label %266

266:                                              ; preds = %262
  store i32 22, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  br label %295

267:                                              ; preds = %262
  %268 = load i32, ptr %21, align 4, !tbaa !5
  %269 = load i32, ptr %23, align 4, !tbaa !5
  %270 = ashr i32 %268, %269
  %271 = and i32 %270, 1
  %272 = icmp ne i32 %271, 0
  br i1 %272, label %273, label %291

273:                                              ; preds = %267
  %274 = load i32, ptr %23, align 4, !tbaa !5
  %275 = sext i32 %274 to i64
  %276 = getelementptr inbounds [15 x %"class.std::bitset"], ptr @cnt, i64 0, i64 %275
  %277 = call noundef nonnull align 8 dereferenceable(256) ptr @_ZNSt6bitsetILm2000EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(256) @cost, ptr noundef nonnull align 8 dereferenceable(256) %276) #7
  %278 = load i32, ptr %23, align 4, !tbaa !5
  %279 = sext i32 %278 to i64
  %280 = getelementptr inbounds [15 x i32], ptr @val, i64 0, i64 %279
  %281 = load i32, ptr %280, align 4, !tbaa !5
  %282 = sitofp i32 %281 to double
  %283 = load i32, ptr %23, align 4, !tbaa !5
  %284 = sext i32 %283 to i64
  %285 = getelementptr inbounds [15 x i32], ptr @dis, i64 0, i64 %284
  %286 = load i32, ptr %285, align 4, !tbaa !5
  %287 = sitofp i32 %286 to double
  %288 = fdiv double %282, %287
  %289 = load double, ptr %22, align 8, !tbaa !16
  %290 = fadd double %289, %288
  store double %290, ptr %22, align 8, !tbaa !16
  br label %291

291:                                              ; preds = %273, %267
  br label %292

292:                                              ; preds = %291
  %293 = load i32, ptr %23, align 4, !tbaa !5
  %294 = add nsw i32 %293, 1
  store i32 %294, ptr %23, align 4, !tbaa !5
  br label %262, !llvm.loop !18

295:                                              ; preds = %266
  %296 = call noundef i64 @_ZNKSt6bitsetILm2000EE5countEv(ptr noundef nonnull align 8 dereferenceable(256) @cost) #7
  %297 = trunc i64 %296 to i32
  %298 = load i32, ptr @q, align 4, !tbaa !5
  %299 = icmp sle i32 %297, %298
  br i1 %299, label %300, label %306

300:                                              ; preds = %295
  %301 = load double, ptr %20, align 8, !tbaa !16
  %302 = load double, ptr %22, align 8, !tbaa !16
  %303 = fcmp olt double %301, %302
  br i1 %303, label %304, label %306

304:                                              ; preds = %300
  %305 = load double, ptr %22, align 8, !tbaa !16
  store double %305, ptr %20, align 8, !tbaa !16
  br label %306

306:                                              ; preds = %304, %300, %295
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  br label %307

307:                                              ; preds = %306
  %308 = load i32, ptr %21, align 4, !tbaa !5
  %309 = add nsw i32 %308, 1
  store i32 %309, ptr %21, align 4, !tbaa !5
  br label %254, !llvm.loop !19

310:                                              ; preds = %259
  %311 = load double, ptr %20, align 8, !tbaa !16
  %312 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, double noundef %311)
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %24, !llvm.loop !20

313:                                              ; preds = %34
  ret i32 0
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { i64, i32 } @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #0 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 noundef i64 @_ZNK5Point4modeEv(ptr noundef nonnull align 4 dereferenceable(12)) #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { i64, i32 } @_ZNK5Point3detERKS_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(256) ptr @_ZNSt6bitsetILm2000EE3setEmb(ptr noundef nonnull align 8 dereferenceable(256), i64 noundef, i1 noundef zeroext) #6 align 2

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

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

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

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


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

%"class.std::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [32 x i64] }
%struct.Point = type { i32, i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@r = external dso_local global [2000 x i32], align 16
@val = external dso_local global [15 x i32], align 16
@dis = external dso_local local_unnamed_addr global [15 x i32], align 16
@cnt = external dso_local global [15 x %"class.std::bitset"], align 16
@cost = external dso_local global { [32 x i64] }, align 8
@cir = external dso_local global [2000 x %struct.Point], align 16
@lht = external dso_local global [15 x %struct.Point], align 16
@obj = external dso_local global %struct.Point, align 4
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca %struct.Point, align 8
  %2 = alloca %struct.Point, align 8
  %3 = alloca %struct.Point, align 8
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @q)
  %5 = icmp eq i32 %4, 3
  br i1 %5, label %.lr.ph123, label %.critedge

.lr.ph123:                                        ; preds = %0
  %.sroa.227.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 8
  %.sroa.221.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  br label %6

6:                                                ; preds = %.lr.ph123, %._crit_edge120
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %8 = load i32, ptr @m, align 4, !tbaa !5
  %9 = add nsw i32 %8, %7
  %10 = load i32, ptr @q, align 4, !tbaa !5
  %11 = sub i32 0, %10
  %.not = icmp eq i32 %9, %11
  br i1 %.not, label %.critedge, label %.preheader99

.preheader99:                                     ; preds = %6
  %12 = icmp sgt i32 %7, 0
  br i1 %12, label %.lr.ph, label %.preheader98

.preheader98.loopexit:                            ; preds = %.lr.ph
  %.pre = load i32, ptr @m, align 4, !tbaa !5
  br label %.preheader98

.preheader98:                                     ; preds = %.preheader98.loopexit, %.preheader99
  %13 = phi i32 [ %.pre, %.preheader98.loopexit ], [ %8, %.preheader99 ]
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph102, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader99, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader99 ]
  %15 = getelementptr inbounds [2000 x %struct.Point], ptr @cir, i64 0, i64 %indvars.iv
  %16 = getelementptr inbounds i8, ptr %15, i64 4
  %17 = getelementptr inbounds i8, ptr %15, i64 8
  %18 = getelementptr inbounds i32, ptr @r, i64 %indvars.iv
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %15, ptr noundef nonnull %16, ptr noundef nonnull %17, ptr noundef nonnull %18)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = icmp slt i64 %indvars.iv.next, %21
  br i1 %22, label %.lr.ph, label %.preheader98.loopexit, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph102, %.preheader98
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @obj, ptr noundef nonnull getelementptr inbounds (i8, ptr @obj, i64 4), ptr noundef nonnull getelementptr inbounds (i8, ptr @obj, i64 8))
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.lr.ph105, label %.preheader97

.lr.ph102:                                        ; preds = %.preheader98, %.lr.ph102
  %indvars.iv127 = phi i64 [ %indvars.iv.next128, %.lr.ph102 ], [ 0, %.preheader98 ]
  %26 = getelementptr inbounds [15 x %struct.Point], ptr @lht, i64 0, i64 %indvars.iv127
  %27 = getelementptr inbounds i8, ptr %26, i64 4
  %28 = getelementptr inbounds i8, ptr %26, i64 8
  %29 = getelementptr inbounds i32, ptr @val, i64 %indvars.iv127
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %26, ptr noundef nonnull %27, ptr noundef nonnull %28, ptr noundef nonnull %29)
  %indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1
  %31 = load i32, ptr @m, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = icmp slt i64 %indvars.iv.next128, %32
  br i1 %33, label %.lr.ph102, label %._crit_edge, !llvm.loop !11

.preheader97:                                     ; preds = %.lr.ph105, %._crit_edge
  %34 = load i32, ptr @m, align 4, !tbaa !5
  %35 = icmp sgt i32 %34, 0
  br i1 %35, label %.lr.ph111, label %.lr.ph119.preheader

.lr.ph105:                                        ; preds = %._crit_edge, %.lr.ph105
  %indvars.iv130 = phi i64 [ %indvars.iv.next131, %.lr.ph105 ], [ 0, %._crit_edge ]
  %36 = getelementptr inbounds [2000 x %struct.Point], ptr @cir, i64 0, i64 %indvars.iv130
  %37 = call { i64, i32 } @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(12) %36, ptr noundef nonnull align 4 dereferenceable(12) @obj)
  %.fca.0.extract63 = extractvalue { i64, i32 } %37, 0
  %.fca.1.extract64 = extractvalue { i64, i32 } %37, 1
  store i64 %.fca.0.extract63, ptr %36, align 4
  %.sroa.468.0..sroa_idx = getelementptr inbounds i8, ptr %36, i64 8
  store i32 %.fca.1.extract64, ptr %.sroa.468.0..sroa_idx, align 4, !tbaa !5
  %indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1
  %38 = load i32, ptr @n, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = icmp slt i64 %indvars.iv.next131, %39
  br i1 %40, label %.lr.ph105, label %.preheader97, !llvm.loop !12

.preheader:                                       ; preds = %._crit_edge109
  %.not125 = icmp eq i32 %50, 31
  br i1 %.not125, label %._crit_edge120, label %.lr.ph119.preheader

.lr.ph119.preheader:                              ; preds = %.preheader97, %.preheader
  br label %.lr.ph119

.lr.ph111:                                        ; preds = %.preheader97, %._crit_edge109
  %indvars.iv136 = phi i64 [ %indvars.iv.next137, %._crit_edge109 ], [ 0, %.preheader97 ]
  %41 = getelementptr inbounds [15 x %struct.Point], ptr @lht, i64 0, i64 %indvars.iv136
  %42 = call { i64, i32 } @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(12) %41, ptr noundef nonnull align 4 dereferenceable(12) @obj)
  %.fca.0.extract44 = extractvalue { i64, i32 } %42, 0
  %.fca.1.extract45 = extractvalue { i64, i32 } %42, 1
  store i64 %.fca.0.extract44, ptr %41, align 4
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %41, i64 8
  store i32 %.fca.1.extract45, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  %43 = call noundef i64 @_ZNK5Point4modeEv(ptr noundef nonnull align 4 dereferenceable(12) %41)
  %44 = trunc i64 %43 to i32
  %45 = getelementptr inbounds [15 x i32], ptr @dis, i64 0, i64 %indvars.iv136
  store i32 %44, ptr %45, align 4, !tbaa !5
  %46 = getelementptr inbounds [15 x %"class.std::bitset"], ptr @cnt, i64 0, i64 %indvars.iv136
  %47 = call noundef nonnull align 8 dereferenceable(256) ptr @_ZNSt6bitsetILm2000EE5resetEv(ptr noundef nonnull align 8 dereferenceable(256) %46) #6
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %49 = icmp sgt i32 %48, 0
  br i1 %49, label %.lr.ph108, label %._crit_edge109

._crit_edge109:                                   ; preds = %92, %.lr.ph111
  %indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
  %50 = load i32, ptr @m, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = icmp slt i64 %indvars.iv.next137, %51
  br i1 %52, label %.lr.ph111, label %.preheader, !llvm.loop !13

.lr.ph108:                                        ; preds = %.lr.ph111, %92
  %indvars.iv133 = phi i64 [ %indvars.iv.next134, %92 ], [ 0, %.lr.ph111 ]
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %1) #6
  %53 = getelementptr inbounds [2000 x %struct.Point], ptr @cir, i64 0, i64 %indvars.iv133
  %54 = call { i64, i32 } @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(12) %41, ptr noundef nonnull align 4 dereferenceable(12) %53)
  %.fca.0.extract24 = extractvalue { i64, i32 } %54, 0
  %.fca.1.extract25 = extractvalue { i64, i32 } %54, 1
  store i64 %.fca.0.extract24, ptr %1, align 8
  store i32 %.fca.1.extract25, ptr %.sroa.227.0..sroa_idx, align 8
  %55 = call noundef i64 @_ZNK5Point4modeEv(ptr noundef nonnull align 4 dereferenceable(12) %1)
  %56 = getelementptr inbounds [2000 x i32], ptr @r, i64 0, i64 %indvars.iv133
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = mul nsw i32 %57, %57
  %59 = trunc i64 %55 to i32
  %60 = sub i32 %59, %58
  %61 = call noundef i32 @_Z3sgni(i32 noundef %60)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %1) #6
  %62 = call noundef i64 @_ZNK5Point4modeEv(ptr noundef nonnull align 4 dereferenceable(12) %53)
  %63 = load i32, ptr %56, align 4, !tbaa !5
  %64 = mul nsw i32 %63, %63
  %65 = trunc i64 %62 to i32
  %66 = sub i32 %65, %64
  %67 = call noundef i32 @_Z3sgni(i32 noundef %66)
  %68 = mul nsw i32 %67, %61
  %69 = icmp slt i32 %68, 0
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %3) #6
  br i1 %69, label %.critedge3, label %70

70:                                               ; preds = %.lr.ph108
  %71 = icmp sgt i32 %61, 0
  %72 = icmp sgt i32 %67, 0
  %or.cond = and i1 %71, %72
  br i1 %or.cond, label %73, label %.critedge5

73:                                               ; preds = %70
  %74 = call { i64, i32 } @_ZNK5Point3detERKS_(ptr noundef nonnull align 4 dereferenceable(12) %41, ptr noundef nonnull align 4 dereferenceable(12) %53)
  %.fca.0.extract18 = extractvalue { i64, i32 } %74, 0
  %.fca.1.extract19 = extractvalue { i64, i32 } %74, 1
  store i64 %.fca.0.extract18, ptr %2, align 8
  store i32 %.fca.1.extract19, ptr %.sroa.221.0..sroa_idx, align 8
  %75 = call noundef i64 @_ZNK5Point4modeEv(ptr noundef nonnull align 4 dereferenceable(12) %2)
  %76 = load i32, ptr %56, align 4, !tbaa !5
  %77 = mul nsw i32 %76, %76
  %78 = zext nneg i32 %77 to i64
  %79 = load i32, ptr %45, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = mul nsw i64 %78, %80
  %82 = icmp slt i64 %75, %81
  br i1 %82, label %83, label %.critedge5

83:                                               ; preds = %73
  %84 = call { i64, i32 } @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(12) %41, ptr noundef nonnull align 4 dereferenceable(12) %53)
  %.fca.0.extract = extractvalue { i64, i32 } %84, 0
  %.fca.1.extract = extractvalue { i64, i32 } %84, 1
  store i64 %.fca.0.extract, ptr %3, align 8
  store i32 %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  %85 = call noundef i64 @_ZNK5Point3dotERKS_(ptr noundef nonnull align 4 dereferenceable(12) %41, ptr noundef nonnull align 4 dereferenceable(12) %3)
  %86 = icmp sgt i64 %85, 0
  br i1 %86, label %87, label %.critedge5

87:                                               ; preds = %83
  %88 = call noundef i64 @_ZNK5Point3dotERKS_(ptr noundef nonnull align 4 dereferenceable(12) %41, ptr noundef nonnull align 4 dereferenceable(12) %53)
  %89 = icmp sgt i64 %88, 0
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %2) #6
  br i1 %89, label %90, label %92

.critedge3:                                       ; preds = %.lr.ph108
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %2) #6
  br label %90

90:                                               ; preds = %.critedge3, %87
  %91 = call noundef nonnull align 8 dereferenceable(256) ptr @_ZNSt6bitsetILm2000EE3setEmb(ptr noundef nonnull align 8 dereferenceable(256) %46, i64 noundef %indvars.iv133, i1 noundef zeroext true)
  br label %92

.critedge5:                                       ; preds = %70, %73, %83
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %2) #6
  br label %92

92:                                               ; preds = %.critedge5, %90, %87
  %indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1
  %93 = load i32, ptr @n, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = icmp slt i64 %indvars.iv.next134, %94
  br i1 %95, label %.lr.ph108, label %._crit_edge109, !llvm.loop !14

._crit_edge120:                                   ; preds = %._crit_edge116, %.preheader
  %.087.lcssa = phi double [ 0.000000e+00, %.preheader ], [ %.188, %._crit_edge116 ]
  %96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %.087.lcssa)
  %97 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @q)
  %98 = icmp eq i32 %97, 3
  br i1 %98, label %6, label %.critedge, !llvm.loop !15

.lr.ph119:                                        ; preds = %.lr.ph119.preheader, %._crit_edge116
  %.086118 = phi i32 [ %106, %._crit_edge116 ], [ 0, %.lr.ph119.preheader ]
  %.087117 = phi double [ %.188, %._crit_edge116 ], [ 0.000000e+00, %.lr.ph119.preheader ]
  %99 = call noundef nonnull align 8 dereferenceable(256) ptr @_ZNSt6bitsetILm2000EE5resetEv(ptr noundef nonnull align 8 dereferenceable(256) @cost) #6
  %100 = load i32, ptr @m, align 4, !tbaa !5
  %101 = icmp sgt i32 %100, 0
  br i1 %101, label %.lr.ph115, label %._crit_edge116

._crit_edge116:                                   ; preds = %125, %.lr.ph119
  %.085.lcssa = phi double [ 0.000000e+00, %.lr.ph119 ], [ %.1, %125 ]
  %102 = call noundef i64 @_ZNKSt6bitsetILm2000EE5countEv(ptr noundef nonnull align 8 dereferenceable(256) @cost) #6
  %103 = trunc i64 %102 to i32
  %104 = load i32, ptr @q, align 4, !tbaa !5
  %.not94 = icmp sge i32 %104, %103
  %105 = fcmp olt double %.087117, %.085.lcssa
  %or.cond96 = select i1 %.not94, i1 %105, i1 false
  %.188 = select i1 %or.cond96, double %.085.lcssa, double %.087117
  %106 = add nuw nsw i32 %.086118, 1
  %107 = load i32, ptr @m, align 4, !tbaa !5
  %108 = shl nuw i32 1, %107
  %109 = icmp slt i32 %106, %108
  br i1 %109, label %.lr.ph119, label %._crit_edge120, !llvm.loop !16

.lr.ph115:                                        ; preds = %.lr.ph119, %125
  %110 = phi i32 [ %126, %125 ], [ %100, %.lr.ph119 ]
  %indvars.iv139 = phi i64 [ %indvars.iv.next140, %125 ], [ 0, %.lr.ph119 ]
  %.085112 = phi double [ %.1, %125 ], [ 0.000000e+00, %.lr.ph119 ]
  %111 = trunc nuw nsw i64 %indvars.iv139 to i32
  %112 = shl nuw i32 1, %111
  %113 = and i32 %112, %.086118
  %.not95 = icmp eq i32 %113, 0
  br i1 %.not95, label %125, label %114

114:                                              ; preds = %.lr.ph115
  %115 = getelementptr inbounds [15 x %"class.std::bitset"], ptr @cnt, i64 0, i64 %indvars.iv139
  %116 = call noundef nonnull align 8 dereferenceable(256) ptr @_ZNSt6bitsetILm2000EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(256) @cost, ptr noundef nonnull align 8 dereferenceable(256) %115) #6
  %117 = getelementptr inbounds [15 x i32], ptr @val, i64 0, i64 %indvars.iv139
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = sitofp i32 %118 to double
  %120 = getelementptr inbounds [15 x i32], ptr @dis, i64 0, i64 %indvars.iv139
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = sitofp i32 %121 to double
  %123 = fdiv double %119, %122
  %124 = fadd double %.085112, %123
  %.pre142 = load i32, ptr @m, align 4, !tbaa !5
  br label %125

125:                                              ; preds = %.lr.ph115, %114
  %126 = phi i32 [ %.pre142, %114 ], [ %110, %.lr.ph115 ]
  %.1 = phi double [ %124, %114 ], [ %.085112, %.lr.ph115 ]
  %indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1
  %127 = sext i32 %126 to i64
  %128 = icmp slt i64 %indvars.iv.next140, %127
  br i1 %128, label %.lr.ph115, label %._crit_edge116, !llvm.loop !17

.critedge:                                        ; preds = %6, %._crit_edge120, %0
  ret i32 0
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { i64, i32 } @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZNK5Point4modeEv(ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { i64, i32 } @_ZNK5Point3detERKS_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(256) ptr @_ZNSt6bitsetILm2000EE3setEmb(ptr noundef nonnull align 8 dereferenceable(256), i64 noundef, i1 noundef zeroext) local_unnamed_addr #5 align 2

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

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

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

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


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