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

; 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 [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 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
  %6 = alloca i32, align 4
  %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
  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
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store double 5.000000e-01, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 3, ptr %6, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %81, %0
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %3, ptr noundef %4)
  %17 = xor i32 %16, -1
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %19, label %87

19:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %20 = load double, ptr %2, align 8, !tbaa !5
  %21 = load double, ptr %4, align 8, !tbaa !5
  %22 = call double @acos(double noundef -1.000000e+00) #5
  %23 = fmul double %21, %22
  %24 = fdiv double %23, 1.800000e+02
  %25 = call double @cos(double noundef %24) #5
  %26 = fmul double %20, %25
  store double %26, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %27 = load double, ptr %2, align 8, !tbaa !5
  %28 = load double, ptr %4, align 8, !tbaa !5
  %29 = call double @acos(double noundef -1.000000e+00) #5
  %30 = fmul double %28, %29
  %31 = fdiv double %30, 1.800000e+02
  %32 = call double @sin(double noundef %31) #5
  %33 = fmul double %27, %32
  store double %33, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %34 = load double, ptr %8, align 8, !tbaa !5
  %35 = load double, ptr %8, align 8, !tbaa !5
  %36 = fmul double %34, %35
  %37 = fdiv double %36, 1.974000e+01
  %38 = load double, ptr %5, align 8, !tbaa !5
  %39 = fcmp ogt double %37, %38
  br i1 %39, label %40, label %66

40:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %41 = load double, ptr %8, align 8, !tbaa !5
  %42 = load double, ptr %8, align 8, !tbaa !5
  %43 = load double, ptr %8, align 8, !tbaa !5
  %44 = load double, ptr %5, align 8, !tbaa !5
  %45 = fmul double 2.000000e+00, %44
  %46 = fmul double %45, 0x4023BD70A3D70A3D
  %47 = fneg double %46
  %48 = call double @llvm.fmuladd.f64(double %42, double %43, double %47)
  %49 = call double @sqrt(double noundef %48) #5
  %50 = fsub double %41, %49
  %51 = fmul double 2.000000e+00, %50
  %52 = fdiv double %51, 0x4023BD70A3D70A3D
  store double %52, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %53 = load double, ptr %8, align 8, !tbaa !5
  %54 = load double, ptr %8, align 8, !tbaa !5
  %55 = load i32, ptr %6, align 4, !tbaa !9
  %56 = sitofp i32 %55 to double
  %57 = fmul double 1.974000e+01, %56
  %58 = call double @llvm.fmuladd.f64(double %53, double %54, double %57)
  %59 = call double @sqrt(double noundef %58) #5
  %60 = load double, ptr %8, align 8, !tbaa !5
  %61 = fsub double %59, %60
  %62 = fdiv double %61, 0x4023BD70A3D70A3D
  store double %62, ptr %14, align 8, !tbaa !5
  %63 = load double, ptr %13, align 8, !tbaa !5
  %64 = load double, ptr %14, align 8, !tbaa !5
  %65 = fadd double %63, %64
  store double %65, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %81

66:                                               ; preds = %19
  %67 = load double, ptr %8, align 8, !tbaa !5
  %68 = fmul double 2.000000e+00, %67
  %69 = fdiv double %68, 0x4023BD70A3D70A3D
  %70 = load double, ptr %8, align 8, !tbaa !5
  %71 = load double, ptr %8, align 8, !tbaa !5
  %72 = load i32, ptr %6, align 4, !tbaa !9
  %73 = sitofp i32 %72 to double
  %74 = fmul double 1.974000e+01, %73
  %75 = call double @llvm.fmuladd.f64(double %70, double %71, double %74)
  %76 = call double @sqrt(double noundef %75) #5
  %77 = load double, ptr %8, align 8, !tbaa !5
  %78 = fsub double %76, %77
  %79 = fdiv double %78, 0x4023BD70A3D70A3D
  %80 = fadd double %69, %79
  store double %80, ptr %12, align 8, !tbaa !5
  br label %81

81:                                               ; preds = %66, %40
  %82 = load double, ptr %12, align 8, !tbaa !5
  %83 = load double, ptr %7, align 8, !tbaa !5
  %84 = fmul double %82, %83
  store double %84, ptr %9, align 8, !tbaa !5
  %85 = load double, ptr %9, align 8, !tbaa !5
  %86 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %85)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %15, !llvm.loop !11

87:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  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

; Function Attrs: nounwind
declare double @cos(double noundef) #3

; Function Attrs: nounwind
declare double @acos(double noundef) #3

; Function Attrs: nounwind
declare double @sin(double noundef) #3

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

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

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

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

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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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"}


; 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 [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 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) #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
  %4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %.not21 = icmp eq i32 %4, -1
  br i1 %.not21, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %0, %39
  %5 = load double, ptr %1, align 8, !tbaa !5
  %6 = load double, ptr %3, align 8, !tbaa !5
  %7 = fmul double %6, 0x400921FB54442D18
  %8 = fdiv double %7, 1.800000e+02
  %9 = call double @cos(double noundef %8) #6
  %10 = fmul double %5, %9
  %11 = load double, ptr %1, align 8, !tbaa !5
  %12 = load double, ptr %3, align 8, !tbaa !5
  %13 = fmul double %12, 0x400921FB54442D18
  %14 = fdiv double %13, 1.800000e+02
  %15 = call double @sin(double noundef %14) #6
  %16 = fmul double %11, %15
  %17 = fmul double %16, %16
  %18 = fdiv double %17, 1.974000e+01
  %19 = fcmp ogt double %18, 5.000000e-01
  br i1 %19, label %20, label %30

20:                                               ; preds = %.lr.ph
  %21 = call double @llvm.fmuladd.f64(double %16, double %16, double 0xC023BD70A3D70A3D)
  %22 = call double @sqrt(double noundef %21) #6
  %23 = fsub double %16, %22
  %24 = fmul double %23, 2.000000e+00
  %25 = fdiv double %24, 0x4023BD70A3D70A3D
  %26 = call double @llvm.fmuladd.f64(double %16, double %16, double 5.922000e+01)
  %sqrt = call double @llvm.sqrt.f64(double %26)
  %27 = fsub double %sqrt, %16
  %28 = fdiv double %27, 0x4023BD70A3D70A3D
  %29 = fadd double %28, %25
  br label %39

30:                                               ; preds = %.lr.ph
  %31 = fmul double %16, 2.000000e+00
  %32 = call double @llvm.fmuladd.f64(double %16, double %16, double 5.922000e+01)
  %sqrt20 = call double @llvm.sqrt.f64(double %32)
  %33 = fsub double %sqrt20, %16
  %34 = insertelement <2 x double> poison, double %31, i64 0
  %35 = insertelement <2 x double> %34, double %33, i64 1
  %36 = fdiv <2 x double> %35, <double 0x4023BD70A3D70A3D, double 0x4023BD70A3D70A3D>
  %shift = shufflevector <2 x double> %36, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %37 = fadd <2 x double> %36, %shift
  %38 = extractelement <2 x double> %37, i64 0
  br label %39

39:                                               ; preds = %30, %20
  %.0 = phi double [ %29, %20 ], [ %38, %30 ]
  %40 = fmul double %10, %.0
  %41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %40)
  %42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %.not = icmp eq i32 %42, -1
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %39, %0
  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) #1

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @cos(double noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sin(double noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3

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

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

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

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

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 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 #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,VectorCombinePass