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

; 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: nounwind
declare double @log(double noundef) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZN7maxiDyn8compressEd(ptr noundef nonnull align 8 dereferenceable(96) %0, double noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !9
  %5 = load ptr, ptr %3, align 8
  %6 = load double, ptr %4, align 8, !tbaa !9
  %7 = call double @llvm.fabs.f64(double %6)
  %8 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 3
  %9 = load double, ptr %8, align 8, !tbaa !11
  %10 = fcmp ogt double %7, %9
  br i1 %10, label %11, label %27

11:                                               ; preds = %2
  %12 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 10
  %13 = load i32, ptr %12, align 8, !tbaa !15
  %14 = icmp ne i32 %13, 1
  br i1 %14, label %15, label %27

15:                                               ; preds = %11
  %16 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 9
  store i64 0, ptr %16, align 8, !tbaa !16
  %17 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 12
  store i32 0, ptr %17, align 8, !tbaa !17
  %18 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 10
  store i32 1, ptr %18, align 8, !tbaa !15
  %19 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 2
  %20 = load double, ptr %19, align 8, !tbaa !18
  %21 = fcmp oeq double %20, 0.000000e+00
  br i1 %21, label %22, label %26

22:                                               ; preds = %15
  %23 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 1
  %24 = load double, ptr %23, align 8, !tbaa !19
  %25 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 2
  store double %24, ptr %25, align 8, !tbaa !18
  br label %26

26:                                               ; preds = %22, %15
  br label %27

27:                                               ; preds = %26, %11, %2
  %28 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 10
  %29 = load i32, ptr %28, align 8, !tbaa !15
  %30 = icmp eq i32 %29, 1
  br i1 %30, label %31, label %45

31:                                               ; preds = %27
  %32 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 2
  %33 = load double, ptr %32, align 8, !tbaa !18
  %34 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 1
  %35 = load double, ptr %34, align 8, !tbaa !19
  %36 = fsub double %35, 1.000000e+00
  %37 = fcmp olt double %33, %36
  br i1 %37, label %38, label %45

38:                                               ; preds = %31
  %39 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 5
  %40 = load double, ptr %39, align 8, !tbaa !20
  %41 = fadd double 1.000000e+00, %40
  %42 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 2
  %43 = load double, ptr %42, align 8, !tbaa !18
  %44 = fmul double %43, %41
  store double %44, ptr %42, align 8, !tbaa !18
  br label %45

45:                                               ; preds = %38, %31, %27
  %46 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 2
  %47 = load double, ptr %46, align 8, !tbaa !18
  %48 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 1
  %49 = load double, ptr %48, align 8, !tbaa !19
  %50 = fsub double %49, 1.000000e+00
  %51 = fcmp oge double %47, %50
  br i1 %51, label %52, label %55

52:                                               ; preds = %45
  %53 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 10
  store i32 0, ptr %53, align 8, !tbaa !15
  %54 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 12
  store i32 1, ptr %54, align 8, !tbaa !17
  br label %55

55:                                               ; preds = %52, %45
  %56 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 12
  %57 = load i32, ptr %56, align 8, !tbaa !17
  %58 = icmp eq i32 %57, 1
  br i1 %58, label %59, label %69

59:                                               ; preds = %55
  %60 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 2
  %61 = load double, ptr %60, align 8, !tbaa !18
  %62 = fcmp ogt double %61, 0.000000e+00
  br i1 %62, label %63, label %69

63:                                               ; preds = %59
  %64 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 6
  %65 = load double, ptr %64, align 8, !tbaa !21
  %66 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 2
  %67 = load double, ptr %66, align 8, !tbaa !18
  %68 = fmul double %67, %65
  store double %68, ptr %66, align 8, !tbaa !18
  br label %69

69:                                               ; preds = %63, %59, %55
  %70 = load double, ptr %4, align 8, !tbaa !9
  %71 = fcmp ogt double %70, 0.000000e+00
  br i1 %71, label %72, label %79

72:                                               ; preds = %69
  %73 = load double, ptr %4, align 8, !tbaa !9
  %74 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 2
  %75 = load double, ptr %74, align 8, !tbaa !18
  %76 = fadd double 1.000000e+00, %75
  %77 = fdiv double %73, %76
  %78 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 4
  store double %77, ptr %78, align 8, !tbaa !22
  br label %86

79:                                               ; preds = %69
  %80 = load double, ptr %4, align 8, !tbaa !9
  %81 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 2
  %82 = load double, ptr %81, align 8, !tbaa !18
  %83 = fadd double 1.000000e+00, %82
  %84 = fdiv double %80, %83
  %85 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 4
  store double %84, ptr %85, align 8, !tbaa !22
  br label %86

86:                                               ; preds = %79, %72
  %87 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 4
  %88 = load double, ptr %87, align 8, !tbaa !22
  %89 = getelementptr inbounds %class.maxiDyn, ptr %5, i32 0, i32 1
  %90 = load double, ptr %89, align 8, !tbaa !19
  %91 = call double @log(double noundef %90) #3
  %92 = fadd double 1.000000e+00, %91
  %93 = fmul double %88, %92
  ret double %93
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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 #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, !10, i64 24}
!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, !14, i64 80}
!16 = !{!12, !13, i64 72}
!17 = !{!12, !14, i64 88}
!18 = !{!12, !10, i64 16}
!19 = !{!12, !10, i64 8}
!20 = !{!12, !10, i64 40}
!21 = !{!12, !10, i64 48}
!22 = !{!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)
declare double @log(double noundef) local_unnamed_addr #1

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

9:                                                ; preds = %2
  br i1 %.not, label %.thread, label %10

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

16:                                               ; preds = %10
  %17 = getelementptr inbounds i8, ptr %0, i64 8
  %18 = load double, ptr %17, align 8, !tbaa !16
  store double %18, ptr %13, align 8, !tbaa !15
  br label %.thread

.thread:                                          ; preds = %10, %16, %9
  %19 = getelementptr inbounds i8, ptr %0, i64 80
  br label %22

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

._crit_edge7:                                     ; preds = %20
  %.phi.trans.insert8 = getelementptr inbounds i8, ptr %0, i64 16
  %.pre9 = load double, ptr %.phi.trans.insert8, align 8, !tbaa !15
  %.phi.trans.insert10 = getelementptr inbounds i8, ptr %0, i64 8
  %.pre11 = load double, ptr %.phi.trans.insert10, align 8, !tbaa !16
  %.pre15 = fadd double %.pre11, -1.000000e+00
  br label %35

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 !15
  %26 = getelementptr inbounds i8, ptr %0, i64 8
  %27 = load double, ptr %26, align 8, !tbaa !16
  %28 = fadd double %27, -1.000000e+00
  %29 = fcmp olt double %25, %28
  br i1 %29, label %30, label %35

30:                                               ; preds = %22
  %31 = getelementptr inbounds i8, ptr %0, i64 40
  %32 = load double, ptr %31, align 8, !tbaa !17
  %33 = fadd double %32, 1.000000e+00
  %34 = fmul double %25, %33
  store double %34, ptr %24, align 8, !tbaa !15
  br label %35

35:                                               ; preds = %._crit_edge7, %30, %22
  %36 = phi ptr [ %21, %._crit_edge7 ], [ %23, %30 ], [ %23, %22 ]
  %.pre-phi = phi double [ %.pre15, %._crit_edge7 ], [ %28, %30 ], [ %28, %22 ]
  %37 = phi double [ %.pre11, %._crit_edge7 ], [ %27, %30 ], [ %27, %22 ]
  %38 = phi double [ %.pre9, %._crit_edge7 ], [ %34, %30 ], [ %25, %22 ]
  %39 = getelementptr inbounds i8, ptr %0, i64 16
  %40 = fcmp ult double %38, %.pre-phi
  br i1 %40, label %._crit_edge12, label %42

._crit_edge12:                                    ; preds = %35
  %.phi.trans.insert13 = getelementptr inbounds i8, ptr %0, i64 88
  %.pre14 = load i32, ptr %.phi.trans.insert13, align 8, !tbaa !14
  %41 = icmp eq i32 %.pre14, 1
  br label %44

42:                                               ; preds = %35
  store i32 0, ptr %36, align 8, !tbaa !12
  %43 = getelementptr inbounds i8, ptr %0, i64 88
  store i32 1, ptr %43, align 8, !tbaa !14
  br label %44

44:                                               ; preds = %._crit_edge12, %42
  %45 = phi i1 [ %41, %._crit_edge12 ], [ true, %42 ]
  %46 = fcmp ogt double %38, 0.000000e+00
  %or.cond = and i1 %46, %45
  br i1 %or.cond, label %47, label %51

47:                                               ; preds = %44
  %48 = getelementptr inbounds i8, ptr %0, i64 48
  %49 = load double, ptr %48, align 8, !tbaa !18
  %50 = fmul double %38, %49
  store double %50, ptr %39, align 8, !tbaa !15
  br label %51

51:                                               ; preds = %44, %47
  %52 = phi double [ %50, %47 ], [ %38, %44 ]
  %.pn = fadd double %52, 1.000000e+00
  %.sink = fdiv double %1, %.pn
  %53 = getelementptr inbounds i8, ptr %0, i64 32
  store double %.sink, ptr %53, align 8
  %54 = tail call double @log(double noundef %37) #3
  %55 = fadd double %54, 1.000000e+00
  %56 = fmul double %.sink, %55
  ret double %56
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #2 = { 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 #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, !7, i64 24}
!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, !11, i64 80}
!13 = !{!6, !10, i64 72}
!14 = !{!6, !11, i64 88}
!15 = !{!6, !7, i64 16}
!16 = !{!6, !7, i64 8}
!17 = !{!6, !7, i64 40}
!18 = !{!6, !7, i64 48}


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