; LLVM IR from interpretml/interpret :: shared/libebm/interpretable_numerics.ll (ZN14NAMESPACE_MAIN14ArithmeticMeanEdd)

; 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 [96 x i8], align 1
@__func__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [20 x i8], align 1
@__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd = external hidden unnamed_addr constant [66 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZN14NAMESPACE_MAIN14ArithmeticMeanEdd(double noundef %0, double noundef %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  store double %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !5
  %6 = load double, ptr %3, align 8, !tbaa !5
  %7 = invoke noundef zeroext i1 @_ZSt5isnand(double noundef %6)
          to label %8 unwind label %81

8:                                                ; preds = %2
  br i1 %7, label %9, label %12

9:                                                ; preds = %8
  invoke void @LogAssertFailure(i64 noundef 68, ptr noundef @.str, ptr noundef @__func__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd, ptr noundef @.str.1)
          to label %10 unwind label %81

10:                                               ; preds = %9
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str, i32 noundef 68, ptr noundef @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd) #7
  unreachable

11:                                               ; No predecessors!
  br label %12

12:                                               ; preds = %11, %8
  %13 = phi i1 [ true, %8 ], [ false, %11 ]
  %14 = load double, ptr %4, align 8, !tbaa !5
  %15 = invoke noundef zeroext i1 @_ZSt5isnand(double noundef %14)
          to label %16 unwind label %81

16:                                               ; preds = %12
  br i1 %15, label %17, label %20

17:                                               ; preds = %16
  invoke void @LogAssertFailure(i64 noundef 69, ptr noundef @.str, ptr noundef @__func__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd, ptr noundef @.str.3)
          to label %18 unwind label %81

18:                                               ; preds = %17
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str, i32 noundef 69, ptr noundef @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd) #7
  unreachable

19:                                               ; No predecessors!
  br label %20

20:                                               ; preds = %19, %16
  %21 = phi i1 [ true, %16 ], [ false, %19 ]
  %22 = load double, ptr %3, align 8, !tbaa !5
  %23 = invoke noundef zeroext i1 @_ZSt5isinfd(double noundef %22)
          to label %24 unwind label %81

24:                                               ; preds = %20
  br i1 %23, label %25, label %28

25:                                               ; preds = %24
  invoke void @LogAssertFailure(i64 noundef 73, ptr noundef @.str, ptr noundef @__func__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd, ptr noundef @.str.5)
          to label %26 unwind label %81

26:                                               ; preds = %25
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str, i32 noundef 73, ptr noundef @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd) #7
  unreachable

27:                                               ; No predecessors!
  br label %28

28:                                               ; preds = %27, %24
  %29 = phi i1 [ true, %24 ], [ false, %27 ]
  %30 = load double, ptr %4, align 8, !tbaa !5
  %31 = invoke noundef zeroext i1 @_ZSt5isinfd(double noundef %30)
          to label %32 unwind label %81

32:                                               ; preds = %28
  br i1 %31, label %33, label %36

33:                                               ; preds = %32
  invoke void @LogAssertFailure(i64 noundef 74, ptr noundef @.str, ptr noundef @__func__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd, ptr noundef @.str.7)
          to label %34 unwind label %81

34:                                               ; preds = %33
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str, i32 noundef 74, ptr noundef @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd) #7
  unreachable

35:                                               ; No predecessors!
  br label %36

36:                                               ; preds = %35, %32
  %37 = phi i1 [ true, %32 ], [ false, %35 ]
  %38 = load double, ptr %3, align 8, !tbaa !5
  %39 = load double, ptr %4, align 8, !tbaa !5
  %40 = fcmp olt double %38, %39
  br i1 %40, label %44, label %41

41:                                               ; preds = %36
  invoke void @LogAssertFailure(i64 noundef 76, ptr noundef @.str, ptr noundef @__func__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd, ptr noundef @.str.9)
          to label %42 unwind label %81

42:                                               ; preds = %41
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str, i32 noundef 76, ptr noundef @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd) #7
  unreachable

43:                                               ; No predecessors!
  br label %44

44:                                               ; preds = %43, %36
  %45 = phi i1 [ true, %36 ], [ false, %43 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  %46 = load double, ptr %3, align 8, !tbaa !5
  %47 = load double, ptr %4, align 8, !tbaa !5
  %48 = fmul double %47, 5.000000e-01
  %49 = call double @llvm.fmuladd.f64(double %46, double 5.000000e-01, double %48)
  store double %49, ptr %5, align 8, !tbaa !5
  %50 = load double, ptr %5, align 8, !tbaa !5
  %51 = invoke noundef zeroext i1 @_ZSt5isnand(double noundef %50)
          to label %52 unwind label %81

52:                                               ; preds = %44
  br i1 %51, label %53, label %56

53:                                               ; preds = %52
  invoke void @LogAssertFailure(i64 noundef 93, ptr noundef @.str, ptr noundef @__func__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd, ptr noundef @.str.11)
          to label %54 unwind label %81

54:                                               ; preds = %53
  call void @__assert_fail(ptr noundef @.str.12, ptr noundef @.str, i32 noundef 93, ptr noundef @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd) #7
  unreachable

55:                                               ; No predecessors!
  br label %56

56:                                               ; preds = %55, %52
  %57 = phi i1 [ true, %52 ], [ false, %55 ]
  %58 = load double, ptr %5, align 8, !tbaa !5
  %59 = load double, ptr %3, align 8, !tbaa !5
  %60 = fcmp ole double %58, %59
  %61 = xor i1 %60, true
  %62 = xor i1 %61, true
  %63 = zext i1 %62 to i64
  %64 = call i64 @llvm.expect.i64(i64 %63, i64 0)
  %65 = icmp ne i64 %64, 0
  br i1 %65, label %66, label %68

66:                                               ; preds = %56
  %67 = load double, ptr %4, align 8, !tbaa !5
  store double %67, ptr %5, align 8, !tbaa !5
  br label %68

68:                                               ; preds = %66, %56
  %69 = load double, ptr %4, align 8, !tbaa !5
  %70 = load double, ptr %5, align 8, !tbaa !5
  %71 = fcmp olt double %69, %70
  %72 = xor i1 %71, true
  %73 = xor i1 %72, true
  %74 = zext i1 %73 to i64
  %75 = call i64 @llvm.expect.i64(i64 %74, i64 0)
  %76 = icmp ne i64 %75, 0
  br i1 %76, label %77, label %79

77:                                               ; preds = %68
  %78 = load double, ptr %4, align 8, !tbaa !5
  store double %78, ptr %5, align 8, !tbaa !5
  br label %79

79:                                               ; preds = %77, %68
  %80 = load double, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  ret double %80

81:                                               ; preds = %53, %44, %41, %33, %28, %25, %20, %17, %12, %9, %2
  %82 = landingpad { ptr, i32 }
          catch ptr null
  %83 = extractvalue { ptr, i32 } %82, 0
  call void @__clang_call_terminate(ptr %83) #7
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSt5isnand(double noundef) #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #1

declare void @LogAssertFailure(i64 noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSt5isinfd(double noundef) #0

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #6

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

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 = { noinline noreturn nounwind uwtable "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 = { "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 = { noreturn 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 willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #7 = { noreturn nounwind }
attributes #8 = { 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 [96 x i8], align 1
@__func__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [20 x i8], align 1
@__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd = external hidden unnamed_addr constant [66 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZN14NAMESPACE_MAIN14ArithmeticMeanEdd(double noundef %0, double noundef %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = tail call noundef zeroext i1 @_ZSt5isnand(double noundef %0)
  br i1 %3, label %4, label %6

4:                                                ; preds = %2
  invoke void @LogAssertFailure(i64 noundef 68, ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd, ptr noundef nonnull @.str.1)
          to label %5 unwind label %33

5:                                                ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str, i32 noundef 68, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd) #5
  unreachable

6:                                                ; preds = %2
  %7 = tail call noundef zeroext i1 @_ZSt5isnand(double noundef %1)
  br i1 %7, label %8, label %10

8:                                                ; preds = %6
  invoke void @LogAssertFailure(i64 noundef 69, ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd, ptr noundef nonnull @.str.3)
          to label %9 unwind label %33

9:                                                ; preds = %8
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str, i32 noundef 69, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd) #5
  unreachable

10:                                               ; preds = %6
  %11 = tail call noundef zeroext i1 @_ZSt5isinfd(double noundef %0)
  br i1 %11, label %12, label %14

12:                                               ; preds = %10
  invoke void @LogAssertFailure(i64 noundef 73, ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd, ptr noundef nonnull @.str.5)
          to label %13 unwind label %33

13:                                               ; preds = %12
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str, i32 noundef 73, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd) #5
  unreachable

14:                                               ; preds = %10
  %15 = tail call noundef zeroext i1 @_ZSt5isinfd(double noundef %1)
  br i1 %15, label %16, label %18

16:                                               ; preds = %14
  invoke void @LogAssertFailure(i64 noundef 74, ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd, ptr noundef nonnull @.str.7)
          to label %17 unwind label %33

17:                                               ; preds = %16
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str, i32 noundef 74, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd) #5
  unreachable

18:                                               ; preds = %14
  %19 = fcmp olt double %0, %1
  br i1 %19, label %22, label %20

20:                                               ; preds = %18
  invoke void @LogAssertFailure(i64 noundef 76, ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd, ptr noundef nonnull @.str.9)
          to label %21 unwind label %33

21:                                               ; preds = %20
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str, i32 noundef 76, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd) #5
  unreachable

22:                                               ; preds = %18
  %23 = fmul double %1, 5.000000e-01
  %24 = tail call double @llvm.fmuladd.f64(double %0, double 5.000000e-01, double %23)
  %25 = tail call noundef zeroext i1 @_ZSt5isnand(double noundef %24)
  br i1 %25, label %26, label %28

26:                                               ; preds = %22
  invoke void @LogAssertFailure(i64 noundef 93, ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd, ptr noundef nonnull @.str.11)
          to label %27 unwind label %33

27:                                               ; preds = %26
  tail call void @__assert_fail(ptr noundef nonnull @.str.12, ptr noundef nonnull @.str, i32 noundef 93, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN14ArithmeticMeanEdd) #5
  unreachable

28:                                               ; preds = %22
  %29 = fcmp ugt double %24, %0
  br i1 %29, label %30, label %.thread, !prof !5

30:                                               ; preds = %28
  %31 = fcmp ogt double %24, %1
  br i1 %31, label %32, label %.thread, !prof !6

32:                                               ; preds = %30
  br label %.thread

.thread:                                          ; preds = %28, %32, %30
  %.1 = phi double [ %1, %32 ], [ %24, %30 ], [ %1, %28 ]
  ret double %.1

33:                                               ; preds = %26, %20, %16, %12, %8, %4
  %34 = landingpad { ptr, i32 }
          catch ptr null
  %35 = extractvalue { ptr, i32 } %34, 0
  tail call void @__clang_call_terminate(ptr %35) #5
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSt5isnand(double noundef) local_unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #1

declare void @LogAssertFailure(i64 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSt5isinfd(double noundef) local_unnamed_addr #0

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

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 = { noinline noreturn nounwind uwtable "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 = { "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 = { noreturn 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { noreturn 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 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!6 = !{!"branch_weights", !"expected", i32 1073741, i32 2146409907}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LowerExpectIntrinsicPass,SROAPass,SimplifyCFGPass,TailCallElimPass