; LLVM IR from EbTech/Elo-MMR :: deprecated/cpp/trueskill/src/ndtri.ll (Z5ndtrid)

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

@_ZL2P0 = external hidden global [5 x double], align 16
@_ZL2Q0 = external hidden global [8 x double], align 16
@_ZL4s2pi = external hidden global double, align 8
@_ZL2P1 = external hidden global [9 x double], align 16
@_ZL2Q1 = external hidden global [8 x double], align 16
@_ZL2P2 = external hidden global [9 x double], align 16
@_ZL2Q2 = external hidden global [8 x double], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_Z5ndtrid(double noundef %0) #0 {
  %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 double, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store double %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !9
  %12 = load double, ptr %3, align 8, !tbaa !5
  store double %12, ptr %5, align 8, !tbaa !5
  %13 = load double, ptr %5, align 8, !tbaa !5
  %14 = fcmp ogt double %13, 0x3FEBAB5557101F8D
  br i1 %14, label %15, label %18

15:                                               ; preds = %1
  %16 = load double, ptr %5, align 8, !tbaa !5
  %17 = fsub double 1.000000e+00, %16
  store double %17, ptr %5, align 8, !tbaa !5
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %18

18:                                               ; preds = %15, %1
  %19 = load double, ptr %5, align 8, !tbaa !5
  %20 = fcmp ogt double %19, 0x3FC152AAA3BF81CC
  br i1 %20, label %21, label %41

21:                                               ; preds = %18
  %22 = load double, ptr %5, align 8, !tbaa !5
  %23 = fsub double %22, 5.000000e-01
  store double %23, ptr %5, align 8, !tbaa !5
  %24 = load double, ptr %5, align 8, !tbaa !5
  %25 = load double, ptr %5, align 8, !tbaa !5
  %26 = fmul double %24, %25
  store double %26, ptr %7, align 8, !tbaa !5
  %27 = load double, ptr %5, align 8, !tbaa !5
  %28 = load double, ptr %5, align 8, !tbaa !5
  %29 = load double, ptr %7, align 8, !tbaa !5
  %30 = load double, ptr %7, align 8, !tbaa !5
  %31 = call noundef double @_ZL6polevldPdi(double noundef %30, ptr noundef @_ZL2P0, i32 noundef 4)
  %32 = fmul double %29, %31
  %33 = load double, ptr %7, align 8, !tbaa !5
  %34 = call noundef double @_ZL5p1evldPdi(double noundef %33, ptr noundef @_ZL2Q0, i32 noundef 8)
  %35 = fdiv double %32, %34
  %36 = call double @llvm.fmuladd.f64(double %28, double %35, double %27)
  store double %36, ptr %4, align 8, !tbaa !5
  %37 = load double, ptr %4, align 8, !tbaa !5
  %38 = load double, ptr @_ZL4s2pi, align 8, !tbaa !5
  %39 = fmul double %37, %38
  store double %39, ptr %4, align 8, !tbaa !5
  %40 = load double, ptr %4, align 8, !tbaa !5
  store double %40, ptr %2, align 8
  store i32 1, ptr %11, align 4
  br label %83

41:                                               ; preds = %18
  %42 = load double, ptr %5, align 8, !tbaa !5
  %43 = call double @log(double noundef %42) #5
  %44 = fmul double -2.000000e+00, %43
  %45 = call double @sqrt(double noundef %44) #5
  store double %45, ptr %4, align 8, !tbaa !5
  %46 = load double, ptr %4, align 8, !tbaa !5
  %47 = load double, ptr %4, align 8, !tbaa !5
  %48 = call double @log(double noundef %47) #5
  %49 = load double, ptr %4, align 8, !tbaa !5
  %50 = fdiv double %48, %49
  %51 = fsub double %46, %50
  store double %51, ptr %8, align 8, !tbaa !5
  %52 = load double, ptr %4, align 8, !tbaa !5
  %53 = fdiv double 1.000000e+00, %52
  store double %53, ptr %6, align 8, !tbaa !5
  %54 = load double, ptr %4, align 8, !tbaa !5
  %55 = fcmp olt double %54, 8.000000e+00
  br i1 %55, label %56, label %64

56:                                               ; preds = %41
  %57 = load double, ptr %6, align 8, !tbaa !5
  %58 = load double, ptr %6, align 8, !tbaa !5
  %59 = call noundef double @_ZL6polevldPdi(double noundef %58, ptr noundef @_ZL2P1, i32 noundef 8)
  %60 = fmul double %57, %59
  %61 = load double, ptr %6, align 8, !tbaa !5
  %62 = call noundef double @_ZL5p1evldPdi(double noundef %61, ptr noundef @_ZL2Q1, i32 noundef 8)
  %63 = fdiv double %60, %62
  store double %63, ptr %9, align 8, !tbaa !5
  br label %72

64:                                               ; preds = %41
  %65 = load double, ptr %6, align 8, !tbaa !5
  %66 = load double, ptr %6, align 8, !tbaa !5
  %67 = call noundef double @_ZL6polevldPdi(double noundef %66, ptr noundef @_ZL2P2, i32 noundef 8)
  %68 = fmul double %65, %67
  %69 = load double, ptr %6, align 8, !tbaa !5
  %70 = call noundef double @_ZL5p1evldPdi(double noundef %69, ptr noundef @_ZL2Q2, i32 noundef 8)
  %71 = fdiv double %68, %70
  store double %71, ptr %9, align 8, !tbaa !5
  br label %72

72:                                               ; preds = %64, %56
  %73 = load double, ptr %8, align 8, !tbaa !5
  %74 = load double, ptr %9, align 8, !tbaa !5
  %75 = fsub double %73, %74
  store double %75, ptr %4, align 8, !tbaa !5
  %76 = load i32, ptr %10, align 4, !tbaa !9
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %78, label %81

78:                                               ; preds = %72
  %79 = load double, ptr %4, align 8, !tbaa !5
  %80 = fneg double %79
  store double %80, ptr %4, align 8, !tbaa !5
  br label %81

81:                                               ; preds = %78, %72
  %82 = load double, ptr %4, align 8, !tbaa !5
  store double %82, ptr %2, align 8
  store i32 1, ptr %11, align 4
  br label %83

83:                                               ; preds = %81, %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  %84 = load double, ptr %2, align 8
  ret double %84
}

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

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

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

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

; Function Attrs: nounwind
declare double @sqrt(double noundef) #4

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 #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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}


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

@_ZL2P0 = external hidden global [5 x double], align 16
@_ZL2Q0 = external hidden global [8 x double], align 16
@_ZL4s2pi = external hidden local_unnamed_addr global double, align 8
@_ZL2P1 = external hidden global [9 x double], align 16
@_ZL2Q1 = external hidden global [8 x double], align 16
@_ZL2P2 = external hidden global [9 x double], align 16
@_ZL2Q2 = external hidden global [8 x double], align 16

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_Z5ndtrid(double noundef %0) local_unnamed_addr #0 {
  %2 = fcmp ogt double %0, 0x3FEBAB5557101F8D
  %3 = fsub double 1.000000e+00, %0
  %.034 = select i1 %2, double %3, double %0
  %4 = fcmp ogt double %.034, 0x3FC152AAA3BF81CC
  br i1 %4, label %5, label %15

5:                                                ; preds = %1
  %6 = fadd double %.034, -5.000000e-01
  %7 = fmul double %6, %6
  %8 = tail call noundef double @_ZL6polevldPdi(double noundef %7, ptr noundef nonnull @_ZL2P0, i32 noundef 4)
  %9 = fmul double %7, %8
  %10 = tail call noundef double @_ZL5p1evldPdi(double noundef %7, ptr noundef nonnull @_ZL2Q0, i32 noundef 8)
  %11 = fdiv double %9, %10
  %12 = tail call double @llvm.fmuladd.f64(double %6, double %11, double %6)
  %13 = load double, ptr @_ZL4s2pi, align 8, !tbaa !5
  %14 = fmul double %13, %12
  br label %35

15:                                               ; preds = %1
  %16 = tail call double @log(double noundef %.034) #3
  %17 = fmul double %16, -2.000000e+00
  %18 = tail call double @sqrt(double noundef %17) #3
  %19 = tail call double @log(double noundef %18) #3
  %20 = fcmp olt double %18, 8.000000e+00
  %_ZL2P1._ZL2P2 = select i1 %20, ptr @_ZL2P1, ptr @_ZL2P2
  %_ZL2Q1._ZL2Q2 = select i1 %20, ptr @_ZL2Q1, ptr @_ZL2Q2
  %21 = insertelement <2 x double> <double poison, double 1.000000e+00>, double %19, i64 0
  %22 = insertelement <2 x double> poison, double %18, i64 0
  %23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
  %24 = fdiv <2 x double> %21, %23
  %25 = extractelement <2 x double> %24, i64 1
  %26 = tail call noundef double @_ZL6polevldPdi(double noundef %25, ptr noundef nonnull %_ZL2P1._ZL2P2, i32 noundef 8)
  %27 = tail call noundef double @_ZL5p1evldPdi(double noundef %25, ptr noundef nonnull %_ZL2Q1._ZL2Q2, i32 noundef 8)
  %28 = extractelement <2 x double> %24, i64 1
  %29 = fmul double %26, %28
  %30 = fdiv double %29, %27
  %31 = extractelement <2 x double> %24, i64 0
  %32 = fsub double %18, %31
  %33 = fsub double %32, %30
  %34 = fneg double %33
  %.033 = select i1 %2, double %33, double %34
  br label %35

35:                                               ; preds = %15, %5
  %.032 = phi double [ %14, %5 ], [ %.033, %15 ]
  ret double %.032
}

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

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

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @log(double noundef) local_unnamed_addr #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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass