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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.center = type { double, double }

@cas = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@.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 [13 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z4Area6centerS_S_(double, double, double, double, double, double) #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 %struct.center, align 8
  %3 = alloca %struct.center, align 8
  %4 = alloca %struct.center, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca i32, align 4
  %10 = alloca %struct.center, align 8
  %11 = alloca %struct.center, align 8
  %12 = alloca %struct.center, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @cas)
  br label %14

14:                                               ; preds = %76, %0
  %15 = load i32, ptr @cas, align 4, !tbaa !5
  %16 = add nsw i32 %15, -1
  store i32 %16, ptr @cas, align 4, !tbaa !5
  %17 = icmp ne i32 %15, 0
  br i1 %17, label %18, label %86

18:                                               ; preds = %14
  store double 0.000000e+00, ptr %7, align 8, !tbaa !9
  store double 0.000000e+00, ptr %6, align 8, !tbaa !9
  store double 0.000000e+00, ptr %5, align 8, !tbaa !9
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %20 = getelementptr inbounds %struct.center, ptr %2, i32 0, i32 0
  %21 = getelementptr inbounds %struct.center, ptr %2, i32 0, i32 1
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %20, ptr noundef %21)
  %23 = getelementptr inbounds %struct.center, ptr %3, i32 0, i32 0
  %24 = getelementptr inbounds %struct.center, ptr %3, i32 0, i32 1
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %23, ptr noundef %24)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 2, ptr %9, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %73, %18
  %27 = load i32, ptr %9, align 4, !tbaa !5
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %76

31:                                               ; preds = %26
  %32 = getelementptr inbounds %struct.center, ptr %4, i32 0, i32 0
  %33 = getelementptr inbounds %struct.center, ptr %4, i32 0, i32 1
  %34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %32, ptr noundef %33)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %2, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %3, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %12, ptr align 8 %4, i64 16, i1 false), !tbaa.struct !11
  %35 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 0
  %36 = load double, ptr %35, align 8
  %37 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 1
  %38 = load double, ptr %37, align 8
  %39 = getelementptr inbounds { double, double }, ptr %11, i32 0, i32 0
  %40 = load double, ptr %39, align 8
  %41 = getelementptr inbounds { double, double }, ptr %11, i32 0, i32 1
  %42 = load double, ptr %41, align 8
  %43 = getelementptr inbounds { double, double }, ptr %12, i32 0, i32 0
  %44 = load double, ptr %43, align 8
  %45 = getelementptr inbounds { double, double }, ptr %12, i32 0, i32 1
  %46 = load double, ptr %45, align 8
  %47 = call noundef double @_Z4Area6centerS_S_(double %36, double %38, double %40, double %42, double %44, double %46)
  store double %47, ptr %8, align 8, !tbaa !9
  %48 = load double, ptr %8, align 8, !tbaa !9
  %49 = load double, ptr %7, align 8, !tbaa !9
  %50 = fadd double %49, %48
  store double %50, ptr %7, align 8, !tbaa !9
  %51 = getelementptr inbounds %struct.center, ptr %2, i32 0, i32 0
  %52 = load double, ptr %51, align 8, !tbaa !12
  %53 = getelementptr inbounds %struct.center, ptr %3, i32 0, i32 0
  %54 = load double, ptr %53, align 8, !tbaa !12
  %55 = fadd double %52, %54
  %56 = getelementptr inbounds %struct.center, ptr %4, i32 0, i32 0
  %57 = load double, ptr %56, align 8, !tbaa !12
  %58 = fadd double %55, %57
  %59 = load double, ptr %8, align 8, !tbaa !9
  %60 = load double, ptr %5, align 8, !tbaa !9
  %61 = call double @llvm.fmuladd.f64(double %58, double %59, double %60)
  store double %61, ptr %5, align 8, !tbaa !9
  %62 = getelementptr inbounds %struct.center, ptr %2, i32 0, i32 1
  %63 = load double, ptr %62, align 8, !tbaa !14
  %64 = getelementptr inbounds %struct.center, ptr %3, i32 0, i32 1
  %65 = load double, ptr %64, align 8, !tbaa !14
  %66 = fadd double %63, %65
  %67 = getelementptr inbounds %struct.center, ptr %4, i32 0, i32 1
  %68 = load double, ptr %67, align 8, !tbaa !14
  %69 = fadd double %66, %68
  %70 = load double, ptr %8, align 8, !tbaa !9
  %71 = load double, ptr %6, align 8, !tbaa !9
  %72 = call double @llvm.fmuladd.f64(double %69, double %70, double %71)
  store double %72, ptr %6, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %3, ptr align 8 %4, i64 16, i1 false), !tbaa.struct !11
  br label %73

73:                                               ; preds = %31
  %74 = load i32, ptr %9, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %9, align 4, !tbaa !5
  br label %26, !llvm.loop !15

76:                                               ; preds = %30
  %77 = load double, ptr %5, align 8, !tbaa !9
  %78 = load double, ptr %7, align 8, !tbaa !9
  %79 = fdiv double %77, %78
  %80 = fdiv double %79, 3.000000e+00
  %81 = load double, ptr %6, align 8, !tbaa !9
  %82 = load double, ptr %7, align 8, !tbaa !9
  %83 = fdiv double %81, %82
  %84 = fdiv double %83, 3.000000e+00
  %85 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, double noundef %80, double noundef %84)
  br label %14, !llvm.loop !17

86:                                               ; preds = %14
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %2) #6
  ret i32 0
}

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

; 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) #5

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{i64 0, i64 8, !9, i64 8, i64 8, !9}
!12 = !{!13, !10, i64 0}
!13 = !{!"_ZTS6center", !10, i64 0, !10, i64 8}
!14 = !{!13, !10, i64 8}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


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

%struct.center = type { double, double }

@cas = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@.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 [13 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z4Area6centerS_S_(double, double, double, double, double, double) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca %struct.center, align 16
  %2 = alloca %struct.center, align 16
  %3 = alloca %struct.center, align 16
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #6
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @cas)
  %5 = load i32, ptr @cas, align 4, !tbaa !5
  %6 = add nsw i32 %5, -1
  store i32 %6, ptr @cas, align 4, !tbaa !5
  %.not24 = icmp eq i32 %5, 0
  br i1 %.not24, label %._crit_edge27, label %.lr.ph26

.lr.ph26:                                         ; preds = %0
  %7 = getelementptr inbounds i8, ptr %1, i64 8
  %8 = getelementptr inbounds i8, ptr %2, i64 8
  %9 = getelementptr inbounds i8, ptr %3, i64 8
  br label %10

10:                                               ; preds = %.lr.ph26, %._crit_edge
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1, ptr noundef nonnull %7)
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2, ptr noundef nonnull %8)
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = icmp sgt i32 %14, 2
  br i1 %15, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %10
  %.016.lcssa = phi double [ 0.000000e+00, %10 ], [ %29, %.lr.ph ]
  %16 = phi <2 x double> [ zeroinitializer, %10 ], [ %37, %.lr.ph ]
  %17 = extractelement <2 x double> %16, i64 0
  %18 = fdiv double %17, %.016.lcssa
  %19 = fdiv double %18, 3.000000e+00
  %20 = extractelement <2 x double> %16, i64 1
  %21 = fdiv double %20, %.016.lcssa
  %22 = fdiv double %21, 3.000000e+00
  %23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %19, double noundef %22)
  %24 = load i32, ptr @cas, align 4, !tbaa !5
  %25 = add nsw i32 %24, -1
  store i32 %25, ptr @cas, align 4, !tbaa !5
  %.not = icmp eq i32 %24, 0
  br i1 %.not, label %._crit_edge27, label %10, !llvm.loop !9

.lr.ph:                                           ; preds = %10, %.lr.ph
  %.01619 = phi double [ %29, %.lr.ph ], [ 0.000000e+00, %10 ]
  %.01718 = phi i32 [ %38, %.lr.ph ], [ 2, %10 ]
  %26 = phi <2 x double> [ %37, %.lr.ph ], [ zeroinitializer, %10 ]
  %27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %3, ptr noundef nonnull %9)
  %.sroa.03.0.copyload = load double, ptr %1, align 16, !tbaa !11
  %.sroa.24.0.copyload = load double, ptr %7, align 8, !tbaa !11
  %.sroa.01.0.copyload = load double, ptr %2, align 16, !tbaa !11
  %.sroa.22.0.copyload = load double, ptr %8, align 8, !tbaa !11
  %.sroa.0.0.copyload = load double, ptr %3, align 16, !tbaa !11
  %.sroa.2.0.copyload = load double, ptr %9, align 8, !tbaa !11
  %28 = call noundef double @_Z4Area6centerS_S_(double %.sroa.03.0.copyload, double %.sroa.24.0.copyload, double %.sroa.01.0.copyload, double %.sroa.22.0.copyload, double %.sroa.0.0.copyload, double %.sroa.2.0.copyload)
  %29 = fadd double %.01619, %28
  %30 = load <2 x double>, ptr %1, align 16, !tbaa !11
  %31 = load <2 x double>, ptr %2, align 16, !tbaa !11
  %32 = fadd <2 x double> %30, %31
  %33 = load <2 x double>, ptr %3, align 16, !tbaa !11
  %34 = fadd <2 x double> %32, %33
  %35 = insertelement <2 x double> poison, double %28, i64 0
  %36 = shufflevector <2 x double> %35, <2 x double> poison, <2 x i32> zeroinitializer
  %37 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %34, <2 x double> %36, <2 x double> %26)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %2, ptr noundef nonnull align 16 dereferenceable(16) %3, i64 16, i1 false), !tbaa.struct !13
  %38 = add nuw nsw i32 %.01718, 1
  %39 = load i32, ptr @n, align 4, !tbaa !5
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %.lr.ph, label %._crit_edge, !llvm.loop !14

._crit_edge27:                                    ; preds = %._crit_edge, %0
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #6
  ret i32 0
}

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #5

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 willreturn memory(argmem: readwrite) }
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" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{i64 0, i64 8, !11, i64 8, i64 8, !11}
!14 = distinct !{!14, !10}


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