; LLVM IR from EbTech/Elo-MMR :: deprecated/cpp/trueskill/src (ndtr)

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

@MAXLOG = external global double, align 8
@_ZL1P = external hidden global [9 x double], align 16
@_ZL1Q = external hidden global [8 x double], align 16
@_ZL1R = external hidden global [6 x double], align 16
@_ZL1S = external hidden global [6 x double], align 16

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local double @erf(double noundef) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local double @erfc(double noundef %0) #1 personality ptr @__gxx_personality_v0 {
  %2 = alloca double, align 8
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca i32, align 4
  store double %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %10 = load double, ptr %3, align 8, !tbaa !5
  %11 = fcmp olt double %10, 0.000000e+00
  br i1 %11, label %12, label %15

12:                                               ; preds = %1
  %13 = load double, ptr %3, align 8, !tbaa !5
  %14 = fneg double %13
  store double %14, ptr %6, align 8, !tbaa !5
  br label %17

15:                                               ; preds = %1
  %16 = load double, ptr %3, align 8, !tbaa !5
  store double %16, ptr %6, align 8, !tbaa !5
  br label %17

17:                                               ; preds = %15, %12
  %18 = load double, ptr %6, align 8, !tbaa !5
  %19 = fcmp olt double %18, 1.000000e+00
  br i1 %19, label %20, label %24

20:                                               ; preds = %17
  %21 = load double, ptr %3, align 8, !tbaa !5
  %22 = call double @erf(double noundef %21) #4
  %23 = fsub double 1.000000e+00, %22
  store double %23, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %75

24:                                               ; preds = %17
  %25 = load double, ptr %3, align 8, !tbaa !5
  %26 = fneg double %25
  %27 = load double, ptr %3, align 8, !tbaa !5
  %28 = fmul double %26, %27
  store double %28, ptr %8, align 8, !tbaa !5
  %29 = load double, ptr %8, align 8, !tbaa !5
  %30 = load double, ptr @MAXLOG, align 8, !tbaa !5
  %31 = fneg double %30
  %32 = fcmp olt double %29, %31
  br i1 %32, label %33, label %39

33:                                               ; preds = %24
  br label %34

34:                                               ; preds = %72, %33
  %35 = load double, ptr %3, align 8, !tbaa !5
  %36 = fcmp olt double %35, 0.000000e+00
  br i1 %36, label %37, label %38

37:                                               ; preds = %34
  store double 2.000000e+00, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %75

38:                                               ; preds = %34
  store double 0.000000e+00, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %75

39:                                               ; preds = %24
  %40 = load double, ptr %8, align 8, !tbaa !5
  %41 = call double @exp(double noundef %40) #4
  store double %41, ptr %8, align 8, !tbaa !5
  %42 = load double, ptr %6, align 8, !tbaa !5
  %43 = fcmp olt double %42, 8.000000e+00
  br i1 %43, label %44, label %51

44:                                               ; preds = %39
  %45 = load double, ptr %6, align 8, !tbaa !5
  %46 = invoke noundef double @_ZL6polevldPdi(double noundef %45, ptr noundef @_ZL1P, i32 noundef 8)
          to label %47 unwind label %77

47:                                               ; preds = %44
  store double %46, ptr %4, align 8, !tbaa !5
  %48 = load double, ptr %6, align 8, !tbaa !5
  %49 = invoke noundef double @_ZL5p1evldPdi(double noundef %48, ptr noundef @_ZL1Q, i32 noundef 8)
          to label %50 unwind label %77

50:                                               ; preds = %47
  store double %49, ptr %5, align 8, !tbaa !5
  br label %58

51:                                               ; preds = %39
  %52 = load double, ptr %6, align 8, !tbaa !5
  %53 = invoke noundef double @_ZL6polevldPdi(double noundef %52, ptr noundef @_ZL1R, i32 noundef 5)
          to label %54 unwind label %77

54:                                               ; preds = %51
  store double %53, ptr %4, align 8, !tbaa !5
  %55 = load double, ptr %6, align 8, !tbaa !5
  %56 = invoke noundef double @_ZL5p1evldPdi(double noundef %55, ptr noundef @_ZL1S, i32 noundef 6)
          to label %57 unwind label %77

57:                                               ; preds = %54
  store double %56, ptr %5, align 8, !tbaa !5
  br label %58

58:                                               ; preds = %57, %50
  %59 = load double, ptr %8, align 8, !tbaa !5
  %60 = load double, ptr %4, align 8, !tbaa !5
  %61 = fmul double %59, %60
  %62 = load double, ptr %5, align 8, !tbaa !5
  %63 = fdiv double %61, %62
  store double %63, ptr %7, align 8, !tbaa !5
  %64 = load double, ptr %3, align 8, !tbaa !5
  %65 = fcmp olt double %64, 0.000000e+00
  br i1 %65, label %66, label %69

66:                                               ; preds = %58
  %67 = load double, ptr %7, align 8, !tbaa !5
  %68 = fsub double 2.000000e+00, %67
  store double %68, ptr %7, align 8, !tbaa !5
  br label %69

69:                                               ; preds = %66, %58
  %70 = load double, ptr %7, align 8, !tbaa !5
  %71 = fcmp oeq double %70, 0.000000e+00
  br i1 %71, label %72, label %73

72:                                               ; preds = %69
  br label %34

73:                                               ; preds = %69
  %74 = load double, ptr %7, align 8, !tbaa !5
  store double %74, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %75

75:                                               ; preds = %73, %38, %37, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  %76 = load double, ptr %2, align 8
  ret double %76

77:                                               ; preds = %54, %51, %47, %44
  %78 = landingpad { ptr, i32 }
          catch ptr null
  %79 = extractvalue { ptr, i32 } %78, 0
  call void @__clang_call_terminate(ptr %79) #5
  unreachable
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef double @_ZL6polevldPdi(double noundef, ptr noundef, i32 noundef) #1

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef double @_ZL5p1evldPdi(double noundef, ptr noundef, i32 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { nounwind }
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 = !{!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"

@MAXLOG = external local_unnamed_addr global double, align 8
@_ZL1P = external hidden global [9 x double], align 16
@_ZL1Q = external hidden global [8 x double], align 16
@_ZL1R = external hidden global [6 x double], align 16
@_ZL1S = external hidden global [6 x double], align 16

; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable
declare dso_local double @erf(double noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local double @erfc(double noundef %0) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %2 = fcmp olt double %0, 0.000000e+00
  %3 = fneg double %0
  %.023 = select i1 %2, double %3, double %0
  %4 = fcmp olt double %.023, 1.000000e+00
  br i1 %4, label %5, label %8

5:                                                ; preds = %1
  %6 = tail call double @erf(double noundef %0) #3
  %7 = fsub double 1.000000e+00, %6
  br label %28

8:                                                ; preds = %1
  %9 = fmul double %3, %0
  %10 = load double, ptr @MAXLOG, align 8, !tbaa !5
  %11 = fneg double %10
  %12 = fcmp olt double %9, %11
  br i1 %12, label %13, label %14

13:                                               ; preds = %23, %8
  %. = select i1 %2, double 2.000000e+00, double 0.000000e+00
  br label %28

14:                                               ; preds = %8
  %15 = tail call double @exp(double noundef %9) #3
  %16 = fcmp olt double %.023, 8.000000e+00
  br i1 %16, label %17, label %20

17:                                               ; preds = %14
  %18 = tail call noundef double @_ZL6polevldPdi(double noundef %.023, ptr noundef nonnull @_ZL1P, i32 noundef 8)
  %19 = tail call noundef double @_ZL5p1evldPdi(double noundef %.023, ptr noundef nonnull @_ZL1Q, i32 noundef 8)
  br label %23

20:                                               ; preds = %14
  %21 = tail call noundef double @_ZL6polevldPdi(double noundef %.023, ptr noundef nonnull @_ZL1R, i32 noundef 5)
  %22 = tail call noundef double @_ZL5p1evldPdi(double noundef %.023, ptr noundef nonnull @_ZL1S, i32 noundef 6)
  br label %23

23:                                               ; preds = %20, %17
  %.025 = phi double [ %18, %17 ], [ %21, %20 ]
  %.024 = phi double [ %19, %17 ], [ %22, %20 ]
  %24 = fmul double %15, %.025
  %25 = fdiv double %24, %.024
  %26 = fsub double 2.000000e+00, %25
  %.0 = select i1 %2, double %26, double %25
  %27 = fcmp oeq double %.0, 0.000000e+00
  br i1 %27, label %13, label %28

28:                                               ; preds = %23, %13, %5
  %.026 = phi double [ %7, %5 ], [ %., %13 ], [ %.0, %23 ]
  ret double %.026
}

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef double @_ZL6polevldPdi(double noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef double @_ZL5p1evldPdi(double noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nofree nounwind willreturn memory(write) 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 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 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, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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