; LLVM IR from DionysiosB/CodeForces :: 0001-0099 (20B-Equation)

; 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 [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %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
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %3, ptr noundef %4)
  %7 = load double, ptr %2, align 8, !tbaa !5
  %8 = fcmp oeq double %7, 0.000000e+00
  br i1 %8, label %9, label %25

9:                                                ; preds = %0
  %10 = load double, ptr %3, align 8, !tbaa !5
  %11 = fcmp oeq double %10, 0.000000e+00
  br i1 %11, label %12, label %18

12:                                               ; preds = %9
  %13 = load double, ptr %4, align 8, !tbaa !5
  %14 = fcmp une double %13, 0.000000e+00
  %15 = zext i1 %14 to i64
  %16 = select i1 %14, ptr @.str.1, ptr @.str.2
  %17 = call i32 @puts(ptr noundef %16)
  br label %24

18:                                               ; preds = %9
  %19 = load double, ptr %4, align 8, !tbaa !5
  %20 = fneg double %19
  %21 = load double, ptr %3, align 8, !tbaa !5
  %22 = fdiv double %20, %21
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, double noundef %22)
  br label %24

24:                                               ; preds = %18, %12
  br label %82

25:                                               ; preds = %0
  %26 = load double, ptr %2, align 8, !tbaa !5
  %27 = fcmp olt double %26, 0.000000e+00
  br i1 %27, label %28, label %35

28:                                               ; preds = %25
  %29 = load double, ptr %2, align 8, !tbaa !5
  %30 = fneg double %29
  store double %30, ptr %2, align 8, !tbaa !5
  %31 = load double, ptr %3, align 8, !tbaa !5
  %32 = fneg double %31
  store double %32, ptr %3, align 8, !tbaa !5
  %33 = load double, ptr %4, align 8, !tbaa !5
  %34 = fneg double %33
  store double %34, ptr %4, align 8, !tbaa !5
  br label %35

35:                                               ; preds = %28, %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %36 = load double, ptr %3, align 8, !tbaa !5
  %37 = load double, ptr %3, align 8, !tbaa !5
  %38 = load double, ptr %2, align 8, !tbaa !5
  %39 = fmul double 4.000000e+00, %38
  %40 = load double, ptr %4, align 8, !tbaa !5
  %41 = fmul double %39, %40
  %42 = fneg double %41
  %43 = call double @llvm.fmuladd.f64(double %36, double %37, double %42)
  store double %43, ptr %5, align 8, !tbaa !5
  %44 = load double, ptr %5, align 8, !tbaa !5
  %45 = fcmp olt double %44, 0.000000e+00
  br i1 %45, label %46, label %48

46:                                               ; preds = %35
  %47 = call i32 @puts(ptr noundef @.str.1)
  br label %81

48:                                               ; preds = %35
  %49 = load double, ptr %5, align 8, !tbaa !5
  %50 = fcmp oeq double %49, 0.000000e+00
  br i1 %50, label %51, label %58

51:                                               ; preds = %48
  %52 = load double, ptr %3, align 8, !tbaa !5
  %53 = fneg double %52
  %54 = load double, ptr %2, align 8, !tbaa !5
  %55 = fmul double 2.000000e+00, %54
  %56 = fdiv double %53, %55
  %57 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, double noundef %56)
  br label %80

58:                                               ; preds = %48
  %59 = load double, ptr %5, align 8, !tbaa !5
  %60 = fcmp ogt double %59, 0.000000e+00
  br i1 %60, label %61, label %79

61:                                               ; preds = %58
  %62 = load double, ptr %3, align 8, !tbaa !5
  %63 = fneg double %62
  %64 = load double, ptr %5, align 8, !tbaa !5
  %65 = call double @sqrt(double noundef %64) #5
  %66 = fsub double %63, %65
  %67 = load double, ptr %2, align 8, !tbaa !5
  %68 = fmul double 2.000000e+00, %67
  %69 = fdiv double %66, %68
  %70 = load double, ptr %3, align 8, !tbaa !5
  %71 = fneg double %70
  %72 = load double, ptr %5, align 8, !tbaa !5
  %73 = call double @sqrt(double noundef %72) #5
  %74 = fadd double %71, %73
  %75 = load double, ptr %2, align 8, !tbaa !5
  %76 = fmul double 2.000000e+00, %75
  %77 = fdiv double %74, %76
  %78 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, double noundef %69, double noundef %77)
  br label %79

79:                                               ; preds = %61, %58
  br label %80

80:                                               ; preds = %79, %51
  br label %81

81:                                               ; preds = %80, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  br label %82

82:                                               ; preds = %81, %24
  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
  ret i32 0
}

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

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

declare i32 @puts(ptr noundef) #2

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

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

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 = { 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 [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca double, align 8
  %2 = alloca double, align 8
  %3 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %5 = load double, ptr %1, align 8, !tbaa !5
  %6 = fcmp oeq double %5, 0.000000e+00
  %7 = load double, ptr %3, align 8, !tbaa !5
  br i1 %6, label %8, label %19

8:                                                ; preds = %0
  %9 = load double, ptr %2, align 8, !tbaa !5
  %10 = fcmp oeq double %9, 0.000000e+00
  br i1 %10, label %11, label %15

11:                                               ; preds = %8
  %12 = fcmp une double %7, 0.000000e+00
  %13 = select i1 %12, ptr @.str.1, ptr @.str.2
  %14 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %13)
  br label %58

15:                                               ; preds = %8
  %16 = fneg double %7
  %17 = fdiv double %16, %9
  %18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %17)
  br label %58

19:                                               ; preds = %0
  %20 = fcmp olt double %5, 0.000000e+00
  %.pre = load double, ptr %2, align 8, !tbaa !5
  br i1 %20, label %21, label %25

21:                                               ; preds = %19
  %22 = fneg double %5
  store double %22, ptr %1, align 8, !tbaa !5
  %23 = fneg double %.pre
  store double %23, ptr %2, align 8, !tbaa !5
  %24 = fneg double %7
  store double %24, ptr %3, align 8, !tbaa !5
  br label %25

25:                                               ; preds = %21, %19
  %26 = phi double [ %24, %21 ], [ %7, %19 ]
  %27 = phi double [ %22, %21 ], [ %5, %19 ]
  %28 = phi double [ %23, %21 ], [ %.pre, %19 ]
  %29 = fmul double %27, -4.000000e+00
  %30 = fmul double %29, %26
  %31 = call double @llvm.fmuladd.f64(double %28, double %28, double %30)
  %32 = fcmp olt double %31, 0.000000e+00
  br i1 %32, label %33, label %35

33:                                               ; preds = %25
  %34 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %58

35:                                               ; preds = %25
  %36 = fcmp oeq double %31, 0.000000e+00
  br i1 %36, label %37, label %42

37:                                               ; preds = %35
  %38 = fneg double %28
  %39 = fmul double %27, 2.000000e+00
  %40 = fdiv double %38, %39
  %41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %40)
  br label %58

42:                                               ; preds = %35
  %43 = fcmp ogt double %31, 0.000000e+00
  br i1 %43, label %44, label %58

44:                                               ; preds = %42
  %45 = fneg double %28
  %46 = call double @sqrt(double noundef %31) #5
  %47 = fsub double %45, %46
  %48 = load double, ptr %1, align 8, !tbaa !5
  %49 = fmul double %48, 2.000000e+00
  %50 = fdiv double %47, %49
  %51 = load double, ptr %2, align 8, !tbaa !5
  %52 = call double @sqrt(double noundef %31) #5
  %53 = fsub double %52, %51
  %54 = load double, ptr %1, align 8, !tbaa !5
  %55 = fmul double %54, 2.000000e+00
  %56 = fdiv double %53, %55
  %57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, double noundef %50, double noundef %56)
  br label %58

58:                                               ; preds = %33, %42, %44, %37, %11, %15
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret i32 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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) 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) #1

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


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