; LLVM IR from tangjz/acm-icpc :: TDL_training/2015-10-05 (K - Kingdom Partitioning - tjz)

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

@n = external dso_local global i32, align 4
@m = external dso_local global [31 x i32], align 16
@x = external dso_local global [31 x [31 x i32]], align 16
@y = external dso_local global [31 x [31 x i32]], align 16
@r = external dso_local global [31 x [31 x i32]], align 16
@pos = external dso_local global i32, align 4
@area = external dso_local global [31 x double], align 16
@ans = external dso_local global [31 x [2 x double]], align 16
@vis = external dso_local global [31 x i8], 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 [35 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5checkdi(double noundef, i32 noundef) #0

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca double, align 8
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  store double 3.000000e+03, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  store double -3.000000e+03, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %14

14:                                               ; preds = %153, %0
  %15 = load i32, ptr %5, align 4, !tbaa !9
  %16 = load i32, ptr @n, align 4, !tbaa !9
  %17 = icmp slt i32 %15, %16
  br i1 %17, label %19, label %18

18:                                               ; preds = %14
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %156

19:                                               ; preds = %14
  %20 = load i32, ptr %5, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds i32, ptr @m, i64 %21
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %22)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %149, %19
  %25 = load i32, ptr %7, align 4, !tbaa !9
  %26 = load i32, ptr %5, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [31 x i32], ptr @m, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !9
  %30 = icmp slt i32 %25, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %24
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %152

32:                                               ; preds = %24
  %33 = load i32, ptr %5, align 4, !tbaa !9
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [31 x [31 x i32]], ptr @x, i64 0, i64 %34
  %36 = getelementptr inbounds [31 x i32], ptr %35, i64 0, i64 0
  %37 = load i32, ptr %7, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds i32, ptr %36, i64 %38
  %40 = load i32, ptr %5, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [31 x [31 x i32]], ptr @y, i64 0, i64 %41
  %43 = getelementptr inbounds [31 x i32], ptr %42, i64 0, i64 0
  %44 = load i32, ptr %7, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds i32, ptr %43, i64 %45
  %47 = load i32, ptr %5, align 4, !tbaa !9
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [31 x [31 x i32]], ptr @r, i64 0, i64 %48
  %50 = getelementptr inbounds [31 x i32], ptr %49, i64 0, i64 0
  %51 = load i32, ptr %7, align 4, !tbaa !9
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds i32, ptr %50, i64 %52
  %54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %39, ptr noundef %46, ptr noundef %53)
  %55 = load i32, ptr %5, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [31 x [31 x i32]], ptr @r, i64 0, i64 %56
  %58 = load i32, ptr %7, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [31 x i32], ptr %57, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !9
  %62 = sitofp i32 %61 to double
  %63 = fmul double 0x400921FB54442C46, %62
  %64 = load i32, ptr %5, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [31 x [31 x i32]], ptr @r, i64 0, i64 %65
  %67 = load i32, ptr %7, align 4, !tbaa !9
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [31 x i32], ptr %66, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !9
  %71 = sitofp i32 %70 to double
  %72 = load i32, ptr %5, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [31 x double], ptr @area, i64 0, i64 %73
  %75 = load double, ptr %74, align 8, !tbaa !5
  %76 = call double @llvm.fmuladd.f64(double %63, double %71, double %75)
  store double %76, ptr %74, align 8, !tbaa !5
  %77 = load double, ptr %2, align 8, !tbaa !5
  %78 = load i32, ptr %5, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [31 x [31 x i32]], ptr @x, i64 0, i64 %79
  %81 = load i32, ptr %7, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [31 x i32], ptr %80, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !9
  %85 = load i32, ptr %5, align 4, !tbaa !9
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [31 x [31 x i32]], ptr @r, i64 0, i64 %86
  %88 = load i32, ptr %7, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [31 x i32], ptr %87, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !9
  %92 = sub nsw i32 %84, %91
  %93 = sitofp i32 %92 to double
  %94 = fcmp ogt double %77, %93
  br i1 %94, label %95, label %112

95:                                               ; preds = %32
  %96 = load i32, ptr %5, align 4, !tbaa !9
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [31 x [31 x i32]], ptr @x, i64 0, i64 %97
  %99 = load i32, ptr %7, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [31 x i32], ptr %98, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !9
  %103 = load i32, ptr %5, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [31 x [31 x i32]], ptr @r, i64 0, i64 %104
  %106 = load i32, ptr %7, align 4, !tbaa !9
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [31 x i32], ptr %105, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !9
  %110 = sub nsw i32 %102, %109
  %111 = sitofp i32 %110 to double
  store double %111, ptr %2, align 8, !tbaa !5
  br label %112

112:                                              ; preds = %95, %32
  %113 = load double, ptr %3, align 8, !tbaa !5
  %114 = load i32, ptr %5, align 4, !tbaa !9
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [31 x [31 x i32]], ptr @x, i64 0, i64 %115
  %117 = load i32, ptr %7, align 4, !tbaa !9
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [31 x i32], ptr %116, i64 0, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !9
  %121 = load i32, ptr %5, align 4, !tbaa !9
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [31 x [31 x i32]], ptr @r, i64 0, i64 %122
  %124 = load i32, ptr %7, align 4, !tbaa !9
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [31 x i32], ptr %123, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !9
  %128 = add nsw i32 %120, %127
  %129 = sitofp i32 %128 to double
  %130 = fcmp olt double %113, %129
  br i1 %130, label %131, label %148

131:                                              ; preds = %112
  %132 = load i32, ptr %5, align 4, !tbaa !9
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [31 x [31 x i32]], ptr @x, i64 0, i64 %133
  %135 = load i32, ptr %7, align 4, !tbaa !9
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [31 x i32], ptr %134, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !9
  %139 = load i32, ptr %5, align 4, !tbaa !9
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [31 x [31 x i32]], ptr @r, i64 0, i64 %140
  %142 = load i32, ptr %7, align 4, !tbaa !9
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [31 x i32], ptr %141, i64 0, i64 %143
  %145 = load i32, ptr %144, align 4, !tbaa !9
  %146 = add nsw i32 %138, %145
  %147 = sitofp i32 %146 to double
  store double %147, ptr %3, align 8, !tbaa !5
  br label %148

148:                                              ; preds = %131, %112
  br label %149

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

152:                                              ; preds = %31
  br label %153

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

156:                                              ; preds = %18
  %157 = load double, ptr %3, align 8, !tbaa !5
  %158 = fadd double %157, 1.000000e+00
  store double %158, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %159

159:                                              ; preds = %204, %156
  %160 = load i32, ptr %8, align 4, !tbaa !9
  %161 = load i32, ptr @n, align 4, !tbaa !9
  %162 = icmp slt i32 %160, %161
  br i1 %162, label %164, label %163

163:                                              ; preds = %159
  store i32 8, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %207

164:                                              ; preds = %159
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %165 = load double, ptr %2, align 8, !tbaa !5
  store double %165, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %166 = load double, ptr %3, align 8, !tbaa !5
  store double %166, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %167

167:                                              ; preds = %185, %164
  %168 = load i32, ptr %11, align 4, !tbaa !9
  %169 = icmp slt i32 %168, 100
  br i1 %169, label %171, label %170

170:                                              ; preds = %167
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %188

171:                                              ; preds = %167
  %172 = load double, ptr %2, align 8, !tbaa !5
  %173 = load double, ptr %3, align 8, !tbaa !5
  %174 = fadd double %172, %173
  %175 = fdiv double %174, 2.000000e+00
  store double %175, ptr %4, align 8, !tbaa !5
  %176 = load double, ptr %4, align 8, !tbaa !5
  %177 = load i32, ptr %8, align 4, !tbaa !9
  %178 = add nsw i32 %177, 1
  %179 = call noundef zeroext i1 @_Z5checkdi(double noundef %176, i32 noundef %178)
  br i1 %179, label %180, label %182

180:                                              ; preds = %171
  %181 = load double, ptr %4, align 8, !tbaa !5
  store double %181, ptr %3, align 8, !tbaa !5
  br label %184

182:                                              ; preds = %171
  %183 = load double, ptr %4, align 8, !tbaa !5
  store double %183, ptr %2, align 8, !tbaa !5
  br label %184

184:                                              ; preds = %182, %180
  br label %185

185:                                              ; preds = %184
  %186 = load i32, ptr %11, align 4, !tbaa !9
  %187 = add nsw i32 %186, 1
  store i32 %187, ptr %11, align 4, !tbaa !9
  br label %167, !llvm.loop !14

188:                                              ; preds = %170
  %189 = load i32, ptr @pos, align 4, !tbaa !9
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [31 x i8], ptr @vis, i64 0, i64 %190
  store i8 1, ptr %191, align 1, !tbaa !15
  %192 = load double, ptr %9, align 8, !tbaa !5
  %193 = load i32, ptr @pos, align 4, !tbaa !9
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [31 x [2 x double]], ptr @ans, i64 0, i64 %194
  %196 = getelementptr inbounds [2 x double], ptr %195, i64 0, i64 0
  store double %192, ptr %196, align 16, !tbaa !5
  %197 = load double, ptr %3, align 8, !tbaa !5
  %198 = load i32, ptr @pos, align 4, !tbaa !9
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [31 x [2 x double]], ptr @ans, i64 0, i64 %199
  %201 = getelementptr inbounds [2 x double], ptr %200, i64 0, i64 1
  store double %197, ptr %201, align 8, !tbaa !5
  %202 = load double, ptr %3, align 8, !tbaa !5
  store double %202, ptr %2, align 8, !tbaa !5
  %203 = load double, ptr %10, align 8, !tbaa !5
  store double %203, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %204

204:                                              ; preds = %188
  %205 = load i32, ptr %8, align 4, !tbaa !9
  %206 = add nsw i32 %205, 1
  store i32 %206, ptr %8, align 4, !tbaa !9
  br label %159, !llvm.loop !17

207:                                              ; preds = %163
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %208

208:                                              ; preds = %235, %207
  %209 = load i32, ptr %12, align 4, !tbaa !9
  %210 = load i32, ptr @n, align 4, !tbaa !9
  %211 = icmp slt i32 %209, %210
  br i1 %211, label %213, label %212

212:                                              ; preds = %208
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %238

213:                                              ; preds = %208
  %214 = load i32, ptr %12, align 4, !tbaa !9
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [31 x [2 x double]], ptr @ans, i64 0, i64 %215
  %217 = getelementptr inbounds [2 x double], ptr %216, i64 0, i64 0
  %218 = load double, ptr %217, align 16, !tbaa !5
  %219 = load i32, ptr %12, align 4, !tbaa !9
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [31 x [2 x double]], ptr @ans, i64 0, i64 %220
  %222 = getelementptr inbounds [2 x double], ptr %221, i64 0, i64 0
  %223 = load double, ptr %222, align 16, !tbaa !5
  %224 = load i32, ptr %12, align 4, !tbaa !9
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [31 x [2 x double]], ptr @ans, i64 0, i64 %225
  %227 = getelementptr inbounds [2 x double], ptr %226, i64 0, i64 1
  %228 = load double, ptr %227, align 8, !tbaa !5
  %229 = load i32, ptr %12, align 4, !tbaa !9
  %230 = sext i32 %229 to i64
  %231 = getelementptr inbounds [31 x [2 x double]], ptr @ans, i64 0, i64 %230
  %232 = getelementptr inbounds [2 x double], ptr %231, i64 0, i64 1
  %233 = load double, ptr %232, align 8, !tbaa !5
  %234 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, double noundef %218, i32 noundef 3000, double noundef %223, i32 noundef -3000, double noundef %228, i32 noundef -3000, double noundef %233, i32 noundef 3000)
  br label %235

235:                                              ; preds = %213
  %236 = load i32, ptr %12, align 4, !tbaa !9
  %237 = add nsw i32 %236, 1
  store i32 %237, ptr %12, align 4, !tbaa !9
  br label %208, !llvm.loop !18

238:                                              ; preds = %212
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  %239 = load i32, ptr %1, align 4
  ret i32 %239
}

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

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

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


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

@n = external dso_local global i32, align 4
@m = external dso_local global [31 x i32], align 16
@x = external dso_local global [31 x [31 x i32]], align 16
@y = external dso_local global [31 x [31 x i32]], align 16
@r = external dso_local global [31 x [31 x i32]], align 16
@pos = external dso_local local_unnamed_addr global i32, align 4
@area = external dso_local local_unnamed_addr global [31 x double], align 16
@ans = external dso_local local_unnamed_addr global [31 x [2 x double]], align 16
@vis = external dso_local local_unnamed_addr global [31 x i8], 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 [35 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5checkdi(double noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %.lr.ph80, label %._crit_edge91

._crit_edge81:                                    ; preds = %._crit_edge
  %4 = fadd double %.164.lcssa, 1.000000e+00
  %5 = icmp sgt i32 %14, 0
  br i1 %5, label %.preheader71, label %._crit_edge91

.lr.ph80:                                         ; preds = %0, %._crit_edge
  %indvars.iv93 = phi i64 [ %indvars.iv.next94, %._crit_edge ], [ 0, %0 ]
  %.05978 = phi double [ %.1.lcssa, %._crit_edge ], [ 3.000000e+03, %0 ]
  %.06376 = phi double [ %.164.lcssa, %._crit_edge ], [ -3.000000e+03, %0 ]
  %6 = getelementptr inbounds i32, ptr @m, i64 %indvars.iv93
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %6)
  %8 = load i32, ptr %6, align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph80
  %10 = getelementptr inbounds [31 x [31 x i32]], ptr @x, i64 0, i64 %indvars.iv93
  %11 = getelementptr inbounds [31 x [31 x i32]], ptr @y, i64 0, i64 %indvars.iv93
  %12 = getelementptr inbounds [31 x [31 x i32]], ptr @r, i64 0, i64 %indvars.iv93
  %13 = getelementptr inbounds [31 x double], ptr @area, i64 0, i64 %indvars.iv93
  br label %17

._crit_edge:                                      ; preds = %17, %.lr.ph80
  %.164.lcssa = phi double [ %.06376, %.lr.ph80 ], [ %.265, %17 ]
  %.1.lcssa = phi double [ %.05978, %.lr.ph80 ], [ %.2, %17 ]
  %indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = icmp slt i64 %indvars.iv.next94, %15
  br i1 %16, label %.lr.ph80, label %._crit_edge81, !llvm.loop !9

17:                                               ; preds = %.lr.ph, %17
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %17 ]
  %.174 = phi double [ %.05978, %.lr.ph ], [ %.2, %17 ]
  %.16472 = phi double [ %.06376, %.lr.ph ], [ %.265, %17 ]
  %18 = getelementptr inbounds i32, ptr %10, i64 %indvars.iv
  %19 = getelementptr inbounds i32, ptr %11, i64 %indvars.iv
  %20 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv
  %21 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %18, ptr noundef nonnull %19, ptr noundef nonnull %20)
  %22 = getelementptr inbounds [31 x [31 x i32]], ptr @r, i64 0, i64 %indvars.iv93, i64 %indvars.iv
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = sitofp i32 %23 to double
  %25 = fmul double %24, 0x400921FB54442C46
  %26 = load double, ptr %13, align 8, !tbaa !11
  %27 = tail call double @llvm.fmuladd.f64(double %25, double %24, double %26)
  store double %27, ptr %13, align 8, !tbaa !11
  %28 = getelementptr inbounds [31 x [31 x i32]], ptr @x, i64 0, i64 %indvars.iv93, i64 %indvars.iv
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = sub nsw i32 %29, %23
  %31 = sitofp i32 %30 to double
  %32 = fcmp ogt double %.174, %31
  %.2 = select i1 %32, double %31, double %.174
  %33 = add nsw i32 %29, %23
  %34 = sitofp i32 %33 to double
  %35 = fcmp olt double %.16472, %34
  %.265 = select i1 %35, double %34, double %.16472
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %36 = load i32, ptr %6, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = icmp slt i64 %indvars.iv.next, %37
  br i1 %38, label %17, label %._crit_edge, !llvm.loop !13

.preheader71:                                     ; preds = %._crit_edge81, %41
  %.388 = phi double [ %..467, %41 ], [ %.1.lcssa, %._crit_edge81 ]
  %.06087 = phi i32 [ %39, %41 ], [ 0, %._crit_edge81 ]
  %39 = add nuw nsw i32 %.06087, 1
  br label %49

.preheader:                                       ; preds = %41
  %40 = icmp sgt i32 %47, 0
  br i1 %40, label %.lr.ph90, label %._crit_edge91

41:                                               ; preds = %49
  %42 = load i32, ptr @pos, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [31 x i8], ptr @vis, i64 0, i64 %43
  store i8 1, ptr %44, align 1, !tbaa !14
  %45 = getelementptr inbounds [31 x [2 x double]], ptr @ans, i64 0, i64 %43
  store double %.388, ptr %45, align 16, !tbaa !11
  %46 = getelementptr inbounds [31 x [2 x double]], ptr @ans, i64 0, i64 %43, i64 1
  store double %..467, ptr %46, align 8, !tbaa !11
  %47 = load i32, ptr @n, align 4, !tbaa !5
  %48 = icmp slt i32 %39, %47
  br i1 %48, label %.preheader71, label %.preheader, !llvm.loop !16

49:                                               ; preds = %.preheader71, %49
  %.05886 = phi i32 [ 0, %.preheader71 ], [ %53, %49 ]
  %.485 = phi double [ %.388, %.preheader71 ], [ %.4., %49 ]
  %.46784 = phi double [ %4, %.preheader71 ], [ %..467, %49 ]
  %50 = fadd double %.46784, %.485
  %51 = fmul double %50, 5.000000e-01
  %52 = tail call noundef zeroext i1 @_Z5checkdi(double noundef %51, i32 noundef %39)
  %..467 = select i1 %52, double %51, double %.46784
  %.4. = select i1 %52, double %.485, double %51
  %53 = add nuw nsw i32 %.05886, 1
  %exitcond.not = icmp eq i32 %53, 100
  br i1 %exitcond.not, label %41, label %49, !llvm.loop !17

._crit_edge91:                                    ; preds = %.lr.ph90, %0, %._crit_edge81, %.preheader
  ret i32 0

.lr.ph90:                                         ; preds = %.preheader, %.lr.ph90
  %indvars.iv96 = phi i64 [ %indvars.iv.next97, %.lr.ph90 ], [ 0, %.preheader ]
  %54 = getelementptr inbounds [31 x [2 x double]], ptr @ans, i64 0, i64 %indvars.iv96
  %55 = load double, ptr %54, align 16, !tbaa !11
  %56 = getelementptr inbounds i8, ptr %54, i64 8
  %57 = load double, ptr %56, align 8, !tbaa !11
  %58 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %55, i32 noundef 3000, double noundef %55, i32 noundef -3000, double noundef %57, i32 noundef -3000, double noundef %57, i32 noundef 3000)
  %indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
  %59 = load i32, ptr @n, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = icmp slt i64 %indvars.iv.next97, %60
  br i1 %61, label %.lr.ph90, label %._crit_edge91, !llvm.loop !18
}

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

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

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

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

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


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