; LLVM IR from DionysiosB/CodeForces :: 0900-0999 (935C-FifaAndFafa)

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

@.str = external hidden unnamed_addr constant [20 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [19 x i8], align 1

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

; Function Attrs: nounwind
declare double @sqrt(double noundef) #1

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

; 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 double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 8, 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
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %17 = load double, ptr %3, align 8, !tbaa !5
  %18 = load double, ptr %4, align 8, !tbaa !5
  %19 = load double, ptr %5, align 8, !tbaa !5
  %20 = load double, ptr %6, align 8, !tbaa !5
  %21 = call noundef double @_Z7getDistdddd(double noundef %17, double noundef %18, double noundef %19, double noundef %20)
  store double %21, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %22 = load double, ptr %7, align 8, !tbaa !5
  %23 = load double, ptr %2, align 8, !tbaa !5
  %24 = fadd double %22, %23
  %25 = fmul double 5.000000e-01, %24
  store double %25, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %26 = load double, ptr %7, align 8, !tbaa !5
  %27 = load double, ptr %2, align 8, !tbaa !5
  %28 = fcmp oge double %26, %27
  br i1 %28, label %29, label %33

29:                                               ; preds = %0
  %30 = load double, ptr %3, align 8, !tbaa !5
  store double %30, ptr %11, align 8, !tbaa !5
  store double %30, ptr %9, align 8, !tbaa !5
  %31 = load double, ptr %4, align 8, !tbaa !5
  store double %31, ptr %12, align 8, !tbaa !5
  store double %31, ptr %10, align 8, !tbaa !5
  %32 = load double, ptr %2, align 8, !tbaa !5
  store double %32, ptr %8, align 8, !tbaa !5
  br label %90

33:                                               ; preds = %0
  %34 = load double, ptr %3, align 8, !tbaa !5
  %35 = load double, ptr %5, align 8, !tbaa !5
  %36 = fcmp une double %34, %35
  br i1 %36, label %37, label %81

37:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %38 = load double, ptr %6, align 8, !tbaa !5
  %39 = load double, ptr %4, align 8, !tbaa !5
  %40 = fsub double %38, %39
  %41 = load double, ptr %5, align 8, !tbaa !5
  %42 = load double, ptr %3, align 8, !tbaa !5
  %43 = fsub double %41, %42
  %44 = fdiv double %40, %43
  store double %44, ptr %13, align 8, !tbaa !5
  %45 = load double, ptr %5, align 8, !tbaa !5
  %46 = load double, ptr %8, align 8, !tbaa !5
  %47 = load double, ptr %13, align 8, !tbaa !5
  %48 = load double, ptr %13, align 8, !tbaa !5
  %49 = call double @llvm.fmuladd.f64(double %47, double %48, double 1.000000e+00)
  %50 = call double @sqrt(double noundef %49) #6
  %51 = fdiv double %46, %50
  %52 = fadd double %45, %51
  store double %52, ptr %9, align 8, !tbaa !5
  %53 = load double, ptr %5, align 8, !tbaa !5
  %54 = load double, ptr %8, align 8, !tbaa !5
  %55 = load double, ptr %13, align 8, !tbaa !5
  %56 = load double, ptr %13, align 8, !tbaa !5
  %57 = call double @llvm.fmuladd.f64(double %55, double %56, double 1.000000e+00)
  %58 = call double @sqrt(double noundef %57) #6
  %59 = fdiv double %54, %58
  %60 = fsub double %53, %59
  store double %60, ptr %11, align 8, !tbaa !5
  %61 = load double, ptr %6, align 8, !tbaa !5
  %62 = load double, ptr %13, align 8, !tbaa !5
  %63 = load double, ptr %8, align 8, !tbaa !5
  %64 = fmul double %62, %63
  %65 = load double, ptr %13, align 8, !tbaa !5
  %66 = load double, ptr %13, align 8, !tbaa !5
  %67 = call double @llvm.fmuladd.f64(double %65, double %66, double 1.000000e+00)
  %68 = call double @sqrt(double noundef %67) #6
  %69 = fdiv double %64, %68
  %70 = fadd double %61, %69
  store double %70, ptr %10, align 8, !tbaa !5
  %71 = load double, ptr %6, align 8, !tbaa !5
  %72 = load double, ptr %13, align 8, !tbaa !5
  %73 = load double, ptr %8, align 8, !tbaa !5
  %74 = fmul double %72, %73
  %75 = load double, ptr %13, align 8, !tbaa !5
  %76 = load double, ptr %13, align 8, !tbaa !5
  %77 = call double @llvm.fmuladd.f64(double %75, double %76, double 1.000000e+00)
  %78 = call double @sqrt(double noundef %77) #6
  %79 = fdiv double %74, %78
  %80 = fsub double %71, %79
  store double %80, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %89

81:                                               ; preds = %33
  %82 = load double, ptr %5, align 8, !tbaa !5
  store double %82, ptr %11, align 8, !tbaa !5
  store double %82, ptr %9, align 8, !tbaa !5
  %83 = load double, ptr %6, align 8, !tbaa !5
  %84 = load double, ptr %8, align 8, !tbaa !5
  %85 = fsub double %83, %84
  store double %85, ptr %10, align 8, !tbaa !5
  %86 = load double, ptr %6, align 8, !tbaa !5
  %87 = load double, ptr %8, align 8, !tbaa !5
  %88 = fadd double %86, %87
  store double %88, ptr %12, align 8, !tbaa !5
  br label %89

89:                                               ; preds = %81, %37
  br label %90

90:                                               ; preds = %89, %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %91 = load double, ptr %3, align 8, !tbaa !5
  %92 = load double, ptr %4, align 8, !tbaa !5
  %93 = load double, ptr %9, align 8, !tbaa !5
  %94 = load double, ptr %10, align 8, !tbaa !5
  %95 = call noundef double @_Z7getDistdddd(double noundef %91, double noundef %92, double noundef %93, double noundef %94)
  store double %95, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %96 = load double, ptr %3, align 8, !tbaa !5
  %97 = load double, ptr %4, align 8, !tbaa !5
  %98 = load double, ptr %11, align 8, !tbaa !5
  %99 = load double, ptr %12, align 8, !tbaa !5
  %100 = call noundef double @_Z7getDistdddd(double noundef %96, double noundef %97, double noundef %98, double noundef %99)
  store double %100, ptr %15, align 8, !tbaa !5
  %101 = load double, ptr %14, align 8, !tbaa !5
  %102 = load double, ptr %15, align 8, !tbaa !5
  %103 = fcmp olt double %101, %102
  br i1 %103, label %104, label %109

104:                                              ; preds = %90
  %105 = load double, ptr %9, align 8, !tbaa !5
  %106 = load double, ptr %10, align 8, !tbaa !5
  %107 = load double, ptr %8, align 8, !tbaa !5
  %108 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %105, double noundef %106, double noundef %107)
  br label %114

109:                                              ; preds = %90
  %110 = load double, ptr %11, align 8, !tbaa !5
  %111 = load double, ptr %12, align 8, !tbaa !5
  %112 = load double, ptr %8, align 8, !tbaa !5
  %113 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %110, double noundef %111, double noundef %112)
  br label %114

114:                                              ; preds = %109, %104
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  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 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  ret i32 0
}

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

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

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

declare i32 @printf(ptr noundef, ...) #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 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { "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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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

@.str = external hidden unnamed_addr constant [20 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [19 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z7getDistdddd(double noundef, double noundef, double noundef, double 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 = alloca double, align 8
  %2 = alloca double, align 8
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %7 = load double, ptr %2, align 8, !tbaa !5
  %8 = load double, ptr %3, align 8, !tbaa !5
  %9 = load double, ptr %4, align 8, !tbaa !5
  %10 = load double, ptr %5, align 8, !tbaa !5
  %11 = call noundef double @_Z7getDistdddd(double noundef %7, double noundef %8, double noundef %9, double noundef %10)
  %12 = load double, ptr %1, align 8, !tbaa !5
  %13 = fadd double %11, %12
  %14 = fmul double %13, 5.000000e-01
  %15 = fcmp ult double %11, %12
  %16 = load double, ptr %2, align 8, !tbaa !5
  br i1 %15, label %19, label %17

17:                                               ; preds = %0
  %18 = load double, ptr %3, align 8, !tbaa !5
  br label %39

19:                                               ; preds = %0
  %20 = load double, ptr %4, align 8, !tbaa !5
  %21 = fcmp une double %16, %20
  %22 = load double, ptr %5, align 8, !tbaa !5
  br i1 %21, label %23, label %36

23:                                               ; preds = %19
  %24 = load double, ptr %3, align 8, !tbaa !5
  %25 = fsub double %22, %24
  %26 = fsub double %20, %16
  %27 = fdiv double %25, %26
  %28 = call double @llvm.fmuladd.f64(double %27, double %27, double 1.000000e+00)
  %sqrt39 = call double @llvm.sqrt.f64(double %28)
  %29 = fdiv double %14, %sqrt39
  %30 = fadd double %20, %29
  %31 = fsub double %20, %29
  %32 = fmul double %14, %27
  %33 = fdiv double %32, %sqrt39
  %34 = fadd double %22, %33
  %35 = fsub double %22, %33
  br label %39

36:                                               ; preds = %19
  %37 = fsub double %22, %14
  %38 = fadd double %14, %22
  %.pre = load double, ptr %3, align 8, !tbaa !5
  br label %39

39:                                               ; preds = %23, %36, %17
  %40 = phi double [ %18, %17 ], [ %24, %23 ], [ %.pre, %36 ]
  %.033 = phi double [ %16, %17 ], [ %31, %23 ], [ %20, %36 ]
  %.032 = phi double [ %18, %17 ], [ %35, %23 ], [ %38, %36 ]
  %.031 = phi double [ %18, %17 ], [ %34, %23 ], [ %37, %36 ]
  %.030 = phi double [ %16, %17 ], [ %30, %23 ], [ %20, %36 ]
  %.0 = phi double [ %12, %17 ], [ %14, %23 ], [ %14, %36 ]
  %41 = call noundef double @_Z7getDistdddd(double noundef %16, double noundef %40, double noundef %.030, double noundef %.031)
  %42 = load double, ptr %2, align 8, !tbaa !5
  %43 = load double, ptr %3, align 8, !tbaa !5
  %44 = call noundef double @_Z7getDistdddd(double noundef %42, double noundef %43, double noundef %.033, double noundef %.032)
  %45 = fcmp olt double %41, %44
  br i1 %45, label %46, label %48

46:                                               ; preds = %39
  %47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %.030, double noundef %.031, double noundef %.0)
  br label %50

48:                                               ; preds = %39
  %49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %.033, double noundef %.032, double noundef %.0)
  br label %50

50:                                               ; preds = %48, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret i32 0
}

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass