; LLVM IR from chriskiefer/libcccrt :: benchmarks/maximilian.ll (ZN7maxiDyn10compressorEddddd)

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

%class.maxiDyn = type { double, double, double, double, double, double, double, double, i64, i64, i32, i32, i32 }

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZN7maxiDyn10compressorEddddd(ptr noundef nonnull align 8 dereferenceable(96) %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5) #1 align 2 {
  %7 = alloca ptr, 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
  store ptr %0, ptr %7, align 8, !tbaa !5
  store double %1, ptr %8, align 8, !tbaa !9
  store double %2, ptr %9, align 8, !tbaa !9
  store double %3, ptr %10, align 8, !tbaa !9
  store double %4, ptr %11, align 8, !tbaa !9
  store double %5, ptr %12, align 8, !tbaa !9
  %13 = load ptr, ptr %7, align 8
  %14 = load double, ptr %8, align 8, !tbaa !9
  %15 = call double @llvm.fabs.f64(double %14)
  %16 = load double, ptr %10, align 8, !tbaa !9
  %17 = fcmp ogt double %15, %16
  br i1 %17, label %18, label %33

18:                                               ; preds = %6
  %19 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 10
  %20 = load i32, ptr %19, align 8, !tbaa !11
  %21 = icmp ne i32 %20, 1
  br i1 %21, label %22, label %33

22:                                               ; preds = %18
  %23 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 9
  store i64 0, ptr %23, align 8, !tbaa !15
  %24 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 12
  store i32 0, ptr %24, align 8, !tbaa !16
  %25 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 10
  store i32 1, ptr %25, align 8, !tbaa !11
  %26 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 2
  %27 = load double, ptr %26, align 8, !tbaa !17
  %28 = fcmp oeq double %27, 0.000000e+00
  br i1 %28, label %29, label %32

29:                                               ; preds = %22
  %30 = load double, ptr %9, align 8, !tbaa !9
  %31 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 2
  store double %30, ptr %31, align 8, !tbaa !17
  br label %32

32:                                               ; preds = %29, %22
  br label %33

33:                                               ; preds = %32, %18, %6
  %34 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 10
  %35 = load i32, ptr %34, align 8, !tbaa !11
  %36 = icmp eq i32 %35, 1
  br i1 %36, label %37, label %49

37:                                               ; preds = %33
  %38 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 2
  %39 = load double, ptr %38, align 8, !tbaa !17
  %40 = load double, ptr %9, align 8, !tbaa !9
  %41 = fsub double %40, 1.000000e+00
  %42 = fcmp olt double %39, %41
  br i1 %42, label %43, label %49

43:                                               ; preds = %37
  %44 = load double, ptr %11, align 8, !tbaa !9
  %45 = fadd double 1.000000e+00, %44
  %46 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 2
  %47 = load double, ptr %46, align 8, !tbaa !17
  %48 = fmul double %47, %45
  store double %48, ptr %46, align 8, !tbaa !17
  br label %49

49:                                               ; preds = %43, %37, %33
  %50 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 2
  %51 = load double, ptr %50, align 8, !tbaa !17
  %52 = load double, ptr %9, align 8, !tbaa !9
  %53 = fsub double %52, 1.000000e+00
  %54 = fcmp oge double %51, %53
  br i1 %54, label %55, label %58

55:                                               ; preds = %49
  %56 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 10
  store i32 0, ptr %56, align 8, !tbaa !11
  %57 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 12
  store i32 1, ptr %57, align 8, !tbaa !16
  br label %58

58:                                               ; preds = %55, %49
  %59 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 12
  %60 = load i32, ptr %59, align 8, !tbaa !16
  %61 = icmp eq i32 %60, 1
  br i1 %61, label %62, label %71

62:                                               ; preds = %58
  %63 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 2
  %64 = load double, ptr %63, align 8, !tbaa !17
  %65 = fcmp ogt double %64, 0.000000e+00
  br i1 %65, label %66, label %71

66:                                               ; preds = %62
  %67 = load double, ptr %12, align 8, !tbaa !9
  %68 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 2
  %69 = load double, ptr %68, align 8, !tbaa !17
  %70 = fmul double %69, %67
  store double %70, ptr %68, align 8, !tbaa !17
  br label %71

71:                                               ; preds = %66, %62, %58
  %72 = load double, ptr %8, align 8, !tbaa !9
  %73 = fcmp ogt double %72, 0.000000e+00
  br i1 %73, label %74, label %81

74:                                               ; preds = %71
  %75 = load double, ptr %8, align 8, !tbaa !9
  %76 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 2
  %77 = load double, ptr %76, align 8, !tbaa !17
  %78 = fadd double 1.000000e+00, %77
  %79 = fdiv double %75, %78
  %80 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 4
  store double %79, ptr %80, align 8, !tbaa !18
  br label %88

81:                                               ; preds = %71
  %82 = load double, ptr %8, align 8, !tbaa !9
  %83 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 2
  %84 = load double, ptr %83, align 8, !tbaa !17
  %85 = fadd double 1.000000e+00, %84
  %86 = fdiv double %82, %85
  %87 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 4
  store double %86, ptr %87, align 8, !tbaa !18
  br label %88

88:                                               ; preds = %81, %74
  %89 = getelementptr inbounds %class.maxiDyn, ptr %13, i32 0, i32 4
  %90 = load double, ptr %89, align 8, !tbaa !18
  %91 = load double, ptr %9, align 8, !tbaa !9
  %92 = call double @log(double noundef %91) #3
  %93 = fadd double 1.000000e+00, %92
  %94 = fmul double %90, %93
  ret double %94
}

; Function Attrs: nounwind
declare double @log(double noundef) #2

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 = { 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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !14, i64 80}
!12 = !{!"_ZTS7maxiDyn", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !13, i64 64, !13, i64 72, !14, i64 80, !14, i64 84, !14, i64 88}
!13 = !{!"long", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!12, !13, i64 72}
!16 = !{!12, !14, i64 88}
!17 = !{!12, !10, i64 16}
!18 = !{!12, !10, i64 32}


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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: readwrite) uwtable
define dso_local noundef double @_ZN7maxiDyn10compressorEddddd(ptr nocapture noundef nonnull align 8 dereferenceable(96) %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5) local_unnamed_addr #1 align 2 {
  %7 = tail call double @llvm.fabs.f64(double %1)
  %8 = fcmp ogt double %7, %3
  %9 = getelementptr inbounds i8, ptr %0, i64 80
  %10 = load i32, ptr %9, align 8, !tbaa !5
  %.not = icmp eq i32 %10, 1
  br i1 %8, label %11, label %20

11:                                               ; preds = %6
  br i1 %.not, label %.thread, label %12

12:                                               ; preds = %11
  %13 = getelementptr inbounds i8, ptr %0, i64 72
  store i64 0, ptr %13, align 8, !tbaa !12
  %14 = getelementptr inbounds i8, ptr %0, i64 88
  store i32 0, ptr %14, align 8, !tbaa !13
  store i32 1, ptr %9, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  %16 = load double, ptr %15, align 8, !tbaa !14
  %17 = fcmp oeq double %16, 0.000000e+00
  br i1 %17, label %18, label %.thread

18:                                               ; preds = %12
  store double %2, ptr %15, align 8, !tbaa !14
  br label %.thread

.thread:                                          ; preds = %12, %18, %11
  %19 = getelementptr inbounds i8, ptr %0, i64 80
  br label %22

20:                                               ; preds = %6
  %21 = getelementptr inbounds i8, ptr %0, i64 80
  br i1 %.not, label %22, label %._crit_edge14

._crit_edge14:                                    ; preds = %20
  %.phi.trans.insert15 = getelementptr inbounds i8, ptr %0, i64 16
  %.pre16 = load double, ptr %.phi.trans.insert15, align 8, !tbaa !14
  %.pre20 = fadd double %2, -1.000000e+00
  br label %31

22:                                               ; preds = %.thread, %20
  %23 = phi ptr [ %19, %.thread ], [ %21, %20 ]
  %24 = getelementptr inbounds i8, ptr %0, i64 16
  %25 = load double, ptr %24, align 8, !tbaa !14
  %26 = fadd double %2, -1.000000e+00
  %27 = fcmp olt double %25, %26
  br i1 %27, label %28, label %31

28:                                               ; preds = %22
  %29 = fadd double %4, 1.000000e+00
  %30 = fmul double %29, %25
  store double %30, ptr %24, align 8, !tbaa !14
  br label %31

31:                                               ; preds = %._crit_edge14, %28, %22
  %32 = phi ptr [ %21, %._crit_edge14 ], [ %23, %28 ], [ %23, %22 ]
  %.pre-phi = phi double [ %.pre20, %._crit_edge14 ], [ %26, %28 ], [ %26, %22 ]
  %33 = phi double [ %.pre16, %._crit_edge14 ], [ %30, %28 ], [ %25, %22 ]
  %34 = getelementptr inbounds i8, ptr %0, i64 16
  %35 = fcmp ult double %33, %.pre-phi
  br i1 %35, label %._crit_edge17, label %37

._crit_edge17:                                    ; preds = %31
  %.phi.trans.insert18 = getelementptr inbounds i8, ptr %0, i64 88
  %.pre19 = load i32, ptr %.phi.trans.insert18, align 8, !tbaa !13
  %36 = icmp eq i32 %.pre19, 1
  br label %39

37:                                               ; preds = %31
  store i32 0, ptr %32, align 8, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %0, i64 88
  store i32 1, ptr %38, align 8, !tbaa !13
  br label %39

39:                                               ; preds = %._crit_edge17, %37
  %40 = phi i1 [ %36, %._crit_edge17 ], [ true, %37 ]
  %41 = fcmp ogt double %33, 0.000000e+00
  %or.cond = and i1 %41, %40
  br i1 %or.cond, label %42, label %44

42:                                               ; preds = %39
  %43 = fmul double %33, %5
  store double %43, ptr %34, align 8, !tbaa !14
  br label %44

44:                                               ; preds = %39, %42
  %45 = phi double [ %43, %42 ], [ %33, %39 ]
  %.pn = fadd double %45, 1.000000e+00
  %.sink = fdiv double %1, %.pn
  %46 = getelementptr inbounds i8, ptr %0, i64 32
  store double %.sink, ptr %46, align 8
  %47 = tail call double @log(double noundef %2) #3
  %48 = fadd double %47, 1.000000e+00
  %49 = fmul double %.sink, %48
  ret double %49
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree nounwind willreturn memory(write, argmem: readwrite) 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 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 #3 = { 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, !11, i64 80}
!6 = !{!"_ZTS7maxiDyn", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !10, i64 64, !10, i64 72, !11, i64 80, !11, i64 84, !11, i64 88}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!6, !10, i64 72}
!13 = !{!6, !11, i64 88}
!14 = !{!6, !7, i64 16}


; Effective O3 passes: ADCEPass,BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass