; LLVM IR from tangjz/acm-icpc :: poj (3575)

; 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
  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
  %12 = 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 %13

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

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

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

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

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

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

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

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

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

147:                                              ; preds = %130, %111
  br label %148

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

151:                                              ; preds = %30
  br label %152

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

155:                                              ; preds = %17
  %156 = load double, ptr %3, align 8, !tbaa !5
  %157 = fadd double %156, 1.000000e+00
  store double %157, 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 %158

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

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

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

166:                                              ; preds = %184, %163
  %167 = load double, ptr %3, align 8, !tbaa !5
  %168 = load double, ptr %2, align 8, !tbaa !5
  %169 = fsub double %167, %168
  %170 = fcmp oge double %169, 1.000000e-09
  br i1 %170, label %171, label %185

171:                                              ; preds = %166
  %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 %166, !llvm.loop !14

185:                                              ; preds = %166
  %186 = load i32, ptr @pos, align 4, !tbaa !9
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [31 x i8], ptr @vis, i64 0, i64 %187
  store i8 1, ptr %188, align 1, !tbaa !15
  %189 = load double, ptr %9, align 8, !tbaa !5
  %190 = load i32, ptr @pos, align 4, !tbaa !9
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [31 x [2 x double]], ptr @ans, i64 0, i64 %191
  %193 = getelementptr inbounds [2 x double], ptr %192, i64 0, i64 0
  store double %189, ptr %193, align 16, !tbaa !5
  %194 = load double, ptr %3, align 8, !tbaa !5
  %195 = load i32, ptr @pos, align 4, !tbaa !9
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [31 x [2 x double]], ptr @ans, i64 0, i64 %196
  %198 = getelementptr inbounds [2 x double], ptr %197, i64 0, i64 1
  store double %194, ptr %198, align 8, !tbaa !5
  %199 = load double, ptr %3, align 8, !tbaa !5
  store double %199, ptr %2, align 8, !tbaa !5
  %200 = load double, ptr %10, align 8, !tbaa !5
  store double %200, 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 %201

201:                                              ; preds = %185
  %202 = load i32, ptr %8, align 4, !tbaa !9
  %203 = add nsw i32 %202, 1
  store i32 %203, ptr %8, align 4, !tbaa !9
  br label %158, !llvm.loop !17

204:                                              ; preds = %162
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %205

205:                                              ; preds = %232, %204
  %206 = load i32, ptr %11, align 4, !tbaa !9
  %207 = load i32, ptr @n, align 4, !tbaa !9
  %208 = icmp slt i32 %206, %207
  br i1 %208, label %210, label %209

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

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

232:                                              ; preds = %210
  %233 = load i32, ptr %11, align 4, !tbaa !9
  %234 = add nsw i32 %233, 1
  store i32 %234, ptr %11, align 4, !tbaa !9
  br label %205, !llvm.loop !18

235:                                              ; preds = %209
  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
  %236 = load i32, ptr %1, align 4
  ret i32 %236
}

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.ph79, label %._crit_edge92

._crit_edge80:                                    ; preds = %._crit_edge
  %4 = fadd double %.163.lcssa, 1.000000e+00
  %5 = icmp sgt i32 %14, 0
  br i1 %5, label %.preheader70, label %._crit_edge92

.lr.ph79:                                         ; preds = %0, %._crit_edge
  %indvars.iv94 = phi i64 [ %indvars.iv.next95, %._crit_edge ], [ 0, %0 ]
  %.05877 = phi double [ %.1.lcssa, %._crit_edge ], [ 3.000000e+03, %0 ]
  %.06275 = phi double [ %.163.lcssa, %._crit_edge ], [ -3.000000e+03, %0 ]
  %6 = getelementptr inbounds i32, ptr @m, i64 %indvars.iv94
  %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.ph79
  %10 = getelementptr inbounds [31 x [31 x i32]], ptr @x, i64 0, i64 %indvars.iv94
  %11 = getelementptr inbounds [31 x [31 x i32]], ptr @y, i64 0, i64 %indvars.iv94
  %12 = getelementptr inbounds [31 x [31 x i32]], ptr @r, i64 0, i64 %indvars.iv94
  %13 = getelementptr inbounds [31 x double], ptr @area, i64 0, i64 %indvars.iv94
  br label %17

._crit_edge:                                      ; preds = %17, %.lr.ph79
  %.163.lcssa = phi double [ %.06275, %.lr.ph79 ], [ %.264, %17 ]
  %.1.lcssa = phi double [ %.05877, %.lr.ph79 ], [ %.2, %17 ]
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = icmp slt i64 %indvars.iv.next95, %15
  br i1 %16, label %.lr.ph79, label %._crit_edge80, !llvm.loop !9

17:                                               ; preds = %.lr.ph, %17
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %17 ]
  %.173 = phi double [ %.05877, %.lr.ph ], [ %.2, %17 ]
  %.16371 = phi double [ %.06275, %.lr.ph ], [ %.264, %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.iv94, 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.iv94, 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 %.173, %31
  %.2 = select i1 %32, double %31, double %.173
  %33 = add nsw i32 %29, %23
  %34 = sitofp i32 %33 to double
  %35 = fcmp olt double %.16371, %34
  %.264 = select i1 %35, double %34, double %.16371
  %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

.preheader70:                                     ; preds = %._crit_edge80, %._crit_edge86
  %39 = phi i32 [ %48, %._crit_edge86 ], [ %14, %._crit_edge80 ]
  %.389 = phi double [ %.466.lcssa, %._crit_edge86 ], [ %.1.lcssa, %._crit_edge80 ]
  %.05988 = phi i32 [ %.pre100, %._crit_edge86 ], [ 0, %._crit_edge80 ]
  %40 = fsub double %4, %.389
  %41 = fcmp ult double %40, 1.000000e-09
  %.pre100 = add nuw nsw i32 %.05988, 1
  br i1 %41, label %._crit_edge86, label %.lr.ph85

.preheader:                                       ; preds = %._crit_edge86
  %42 = icmp sgt i32 %48, 0
  br i1 %42, label %.lr.ph91, label %._crit_edge92

.lr.ph85:                                         ; preds = %.preheader70, %.lr.ph85
  %.484 = phi double [ %.4., %.lr.ph85 ], [ %.389, %.preheader70 ]
  %.46683 = phi double [ %..466, %.lr.ph85 ], [ %4, %.preheader70 ]
  %43 = fadd double %.46683, %.484
  %44 = fmul double %43, 5.000000e-01
  %45 = tail call noundef zeroext i1 @_Z5checkdi(double noundef %44, i32 noundef %.pre100)
  %..466 = select i1 %45, double %44, double %.46683
  %.4. = select i1 %45, double %.484, double %44
  %46 = fsub double %..466, %.4.
  %47 = fcmp ult double %46, 1.000000e-09
  br i1 %47, label %._crit_edge86.loopexit, label %.lr.ph85, !llvm.loop !14

._crit_edge86.loopexit:                           ; preds = %.lr.ph85
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge86

._crit_edge86:                                    ; preds = %.preheader70, %._crit_edge86.loopexit
  %48 = phi i32 [ %.pre, %._crit_edge86.loopexit ], [ %39, %.preheader70 ]
  %.466.lcssa = phi double [ %..466, %._crit_edge86.loopexit ], [ %4, %.preheader70 ]
  %49 = load i32, ptr @pos, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [31 x i8], ptr @vis, i64 0, i64 %50
  store i8 1, ptr %51, align 1, !tbaa !15
  %52 = getelementptr inbounds [31 x [2 x double]], ptr @ans, i64 0, i64 %50
  store double %.389, ptr %52, align 16, !tbaa !11
  %53 = getelementptr inbounds [31 x [2 x double]], ptr @ans, i64 0, i64 %50, i64 1
  store double %.466.lcssa, ptr %53, align 8, !tbaa !11
  %54 = icmp slt i32 %.pre100, %48
  br i1 %54, label %.preheader70, label %.preheader, !llvm.loop !17

._crit_edge92:                                    ; preds = %.lr.ph91, %0, %._crit_edge80, %.preheader
  ret i32 0

.lr.ph91:                                         ; preds = %.preheader, %.lr.ph91
  %indvars.iv97 = phi i64 [ %indvars.iv.next98, %.lr.ph91 ], [ 0, %.preheader ]
  %55 = getelementptr inbounds [31 x [2 x double]], ptr @ans, i64 0, i64 %indvars.iv97
  %56 = load double, ptr %55, align 16, !tbaa !11
  %57 = getelementptr inbounds i8, ptr %55, i64 8
  %58 = load double, ptr %57, align 8, !tbaa !11
  %59 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %56, i32 noundef 3000, double noundef %56, i32 noundef -3000, double noundef %58, i32 noundef -3000, double noundef %58, i32 noundef 3000)
  %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
  %60 = load i32, ptr @n, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = icmp slt i64 %indvars.iv.next98, %61
  br i1 %62, label %.lr.ph91, label %._crit_edge92, !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 = distinct !{!14, !10}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !7, i64 0}
!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