; LLVM IR from VastoLorde95/Competitive-Programming :: Hackerrank/Company Contests/Zalando Codesprint 2016/Problem D/D.ll (Z5checkeeee)

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

@found = external dso_local global i8, align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4fitseeee(x86_fp80 noundef, x86_fp80 noundef, x86_fp80 noundef, x86_fp80 noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5checkeeee(x86_fp80 noundef %0, x86_fp80 noundef %1, x86_fp80 noundef %2, x86_fp80 noundef %3) #1 {
  %5 = alloca x86_fp80, align 16
  %6 = alloca x86_fp80, align 16
  %7 = alloca x86_fp80, align 16
  %8 = alloca x86_fp80, align 16
  %9 = alloca x86_fp80, align 16
  %10 = alloca x86_fp80, align 16
  %11 = alloca x86_fp80, align 16
  store x86_fp80 %0, ptr %5, align 16, !tbaa !5
  store x86_fp80 %1, ptr %6, align 16, !tbaa !5
  store x86_fp80 %2, ptr %7, align 16, !tbaa !5
  store x86_fp80 %3, ptr %8, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #5
  store x86_fp80 0xK00000000000000000000, ptr %9, align 16, !tbaa !5
  br label %12

12:                                               ; preds = %47, %4
  %13 = load x86_fp80, ptr %9, align 16, !tbaa !5
  %14 = fcmp ole x86_fp80 %13, 0xK3FFFC90FDAA22168C000
  br i1 %14, label %16, label %15

15:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #5
  br label %50

16:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #5
  %17 = load x86_fp80, ptr %5, align 16, !tbaa !5
  %18 = load x86_fp80, ptr %9, align 16, !tbaa !5
  %19 = call noundef x86_fp80 @_ZSt3cose(x86_fp80 noundef %18)
  %20 = load x86_fp80, ptr %6, align 16, !tbaa !5
  %21 = load x86_fp80, ptr %9, align 16, !tbaa !5
  %22 = call noundef x86_fp80 @_ZSt3sine(x86_fp80 noundef %21)
  %23 = fmul x86_fp80 %20, %22
  %24 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %17, x86_fp80 %19, x86_fp80 %23)
  store x86_fp80 %24, ptr %10, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #5
  %25 = load x86_fp80, ptr %5, align 16, !tbaa !5
  %26 = load x86_fp80, ptr %9, align 16, !tbaa !5
  %27 = call noundef x86_fp80 @_ZSt3sine(x86_fp80 noundef %26)
  %28 = load x86_fp80, ptr %6, align 16, !tbaa !5
  %29 = load x86_fp80, ptr %9, align 16, !tbaa !5
  %30 = call noundef x86_fp80 @_ZSt3cose(x86_fp80 noundef %29)
  %31 = fmul x86_fp80 %28, %30
  %32 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %25, x86_fp80 %27, x86_fp80 %31)
  store x86_fp80 %32, ptr %11, align 16, !tbaa !5
  %33 = load x86_fp80, ptr %10, align 16, !tbaa !5
  %34 = load x86_fp80, ptr %11, align 16, !tbaa !5
  %35 = load x86_fp80, ptr %7, align 16, !tbaa !5
  %36 = load x86_fp80, ptr %8, align 16, !tbaa !5
  %37 = call noundef zeroext i1 @_Z4fitseeee(x86_fp80 noundef %33, x86_fp80 noundef %34, x86_fp80 noundef %35, x86_fp80 noundef %36)
  br i1 %37, label %38, label %39

38:                                               ; preds = %16
  store i8 1, ptr @found, align 1, !tbaa !9
  br label %39

39:                                               ; preds = %38, %16
  %40 = load x86_fp80, ptr %10, align 16, !tbaa !5
  %41 = load x86_fp80, ptr %11, align 16, !tbaa !5
  %42 = load x86_fp80, ptr %8, align 16, !tbaa !5
  %43 = load x86_fp80, ptr %7, align 16, !tbaa !5
  %44 = call noundef zeroext i1 @_Z4fitseeee(x86_fp80 noundef %40, x86_fp80 noundef %41, x86_fp80 noundef %42, x86_fp80 noundef %43)
  br i1 %44, label %45, label %46

45:                                               ; preds = %39
  store i8 1, ptr @found, align 1, !tbaa !9
  br label %46

46:                                               ; preds = %45, %39
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #5
  br label %47

47:                                               ; preds = %46
  %48 = load x86_fp80, ptr %9, align 16, !tbaa !5
  %49 = fadd x86_fp80 %48, 0xK3FEEA7C5AC471B478800
  store x86_fp80 %49, ptr %9, align 16, !tbaa !5
  br label %12, !llvm.loop !11

50:                                               ; preds = %15
  ret void
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_ZSt3cose(x86_fp80 noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_ZSt3sine(x86_fp80 noundef) #3

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

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

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 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint 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 #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 = !{!"long double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !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"

@found = external dso_local local_unnamed_addr global i8, align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4fitseeee(x86_fp80 noundef, x86_fp80 noundef, x86_fp80 noundef, x86_fp80 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z5checkeeee(x86_fp80 noundef %0, x86_fp80 noundef %1, x86_fp80 noundef %2, x86_fp80 noundef %3) local_unnamed_addr #0 {
  br label %6

5:                                                ; preds = %20
  ret void

6:                                                ; preds = %4, %20
  %.019 = phi x86_fp80 [ 0xK00000000000000000000, %4 ], [ %21, %20 ]
  %7 = tail call noundef x86_fp80 @_ZSt3cose(x86_fp80 noundef %.019)
  %8 = tail call noundef x86_fp80 @_ZSt3sine(x86_fp80 noundef %.019)
  %9 = fmul x86_fp80 %8, %1
  %10 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %0, x86_fp80 %7, x86_fp80 %9)
  %11 = tail call noundef x86_fp80 @_ZSt3sine(x86_fp80 noundef %.019)
  %12 = tail call noundef x86_fp80 @_ZSt3cose(x86_fp80 noundef %.019)
  %13 = fmul x86_fp80 %12, %1
  %14 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %0, x86_fp80 %11, x86_fp80 %13)
  %15 = tail call noundef zeroext i1 @_Z4fitseeee(x86_fp80 noundef %10, x86_fp80 noundef %14, x86_fp80 noundef %2, x86_fp80 noundef %3)
  br i1 %15, label %16, label %17

16:                                               ; preds = %6
  store i8 1, ptr @found, align 1, !tbaa !5
  br label %17

17:                                               ; preds = %16, %6
  %18 = tail call noundef zeroext i1 @_Z4fitseeee(x86_fp80 noundef %10, x86_fp80 noundef %14, x86_fp80 noundef %3, x86_fp80 noundef %2)
  br i1 %18, label %19, label %20

19:                                               ; preds = %17
  store i8 1, ptr @found, align 1, !tbaa !5
  br label %20

20:                                               ; preds = %19, %17
  %21 = fadd x86_fp80 %.019, 0xK3FEEA7C5AC471B478800
  %22 = fcmp ugt x86_fp80 %21, 0xK3FFFC90FDAA22168C000
  br i1 %22, label %5, label %6, !llvm.loop !9
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_ZSt3cose(x86_fp80 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_ZSt3sine(x86_fp80 noundef) local_unnamed_addr #1

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

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

!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 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass