; LLVM IR from CLASS-SZ/class_sz :: class-sz/tools (r8lib)

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local double @r8_max(double noundef, double noundef) #2

; Function Attrs: nounwind
declare double @pow(double noundef, double noundef) #3

; Function Attrs: nounwind uwtable
define dso_local double @r8_diff(double noundef %0, double noundef %1, i32 noundef %2) #2 {
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca i32, align 4
  %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
  %13 = alloca double, align 8
  %14 = alloca i32, align 4
  store double %0, ptr %5, align 8, !tbaa !5
  store double %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store double 2.000000e+00, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %15 = load double, ptr %5, align 8, !tbaa !5
  %16 = load double, ptr %6, align 8, !tbaa !5
  %17 = fcmp oeq double %15, %16
  br i1 %17, label %18, label %20

18:                                               ; preds = %3
  store double 0.000000e+00, ptr %13, align 8, !tbaa !5
  %19 = load double, ptr %13, align 8, !tbaa !5
  store double %19, ptr %4, align 8
  store i32 1, ptr %14, align 4
  br label %62

20:                                               ; preds = %3
  %21 = load i32, ptr %7, align 4, !tbaa !9
  %22 = sitofp i32 %21 to double
  %23 = call double @pow(double noundef 2.000000e+00, double noundef %22) #4
  store double %23, ptr %10, align 8, !tbaa !5
  %24 = load double, ptr %5, align 8, !tbaa !5
  %25 = call double @llvm.fabs.f64(double %24)
  %26 = load double, ptr %6, align 8, !tbaa !5
  %27 = call double @llvm.fabs.f64(double %26)
  %28 = call double @r8_max(double noundef %25, double noundef %27)
  store double %28, ptr %11, align 8, !tbaa !5
  %29 = load double, ptr %5, align 8, !tbaa !5
  %30 = load double, ptr %11, align 8, !tbaa !5
  %31 = fdiv double %29, %30
  store double %31, ptr %8, align 8, !tbaa !5
  %32 = load double, ptr %6, align 8, !tbaa !5
  %33 = load double, ptr %11, align 8, !tbaa !5
  %34 = fdiv double %32, %33
  store double %34, ptr %9, align 8, !tbaa !5
  %35 = load double, ptr %8, align 8, !tbaa !5
  %36 = load double, ptr %10, align 8, !tbaa !5
  %37 = load double, ptr %8, align 8, !tbaa !5
  %38 = call double @r8_sign(double noundef %37)
  %39 = fmul double 5.000000e-01, %38
  %40 = call double @llvm.fmuladd.f64(double %35, double %36, double %39)
  %41 = fptosi double %40 to i32
  %42 = sitofp i32 %41 to double
  %43 = load double, ptr %10, align 8, !tbaa !5
  %44 = fdiv double %42, %43
  store double %44, ptr %8, align 8, !tbaa !5
  %45 = load double, ptr %9, align 8, !tbaa !5
  %46 = load double, ptr %10, align 8, !tbaa !5
  %47 = load double, ptr %9, align 8, !tbaa !5
  %48 = call double @r8_sign(double noundef %47)
  %49 = fmul double 5.000000e-01, %48
  %50 = call double @llvm.fmuladd.f64(double %45, double %46, double %49)
  %51 = fptosi double %50 to i32
  %52 = sitofp i32 %51 to double
  %53 = load double, ptr %10, align 8, !tbaa !5
  %54 = fdiv double %52, %53
  store double %54, ptr %9, align 8, !tbaa !5
  %55 = load double, ptr %8, align 8, !tbaa !5
  %56 = load double, ptr %9, align 8, !tbaa !5
  %57 = fsub double %55, %56
  store double %57, ptr %13, align 8, !tbaa !5
  %58 = load double, ptr %13, align 8, !tbaa !5
  %59 = load double, ptr %11, align 8, !tbaa !5
  %60 = fmul double %58, %59
  store double %60, ptr %13, align 8, !tbaa !5
  %61 = load double, ptr %13, align 8, !tbaa !5
  store double %61, ptr %4, align 8
  store i32 1, ptr %14, align 4
  br label %62

62:                                               ; preds = %20, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %63 = load double, ptr %4, align 8
  ret double %63
}

; Function Attrs: nounwind uwtable
declare dso_local double @r8_sign(double noundef) #2

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

!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/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"

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

; Function Attrs: nounwind uwtable
declare dso_local double @r8_max(double noundef, double noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local double @r8_diff(double noundef %0, double noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = fcmp oeq double %0, %1
  br i1 %4, label %30, label %5

5:                                                ; preds = %3
  %ldexp = tail call double @ldexp(double 1.000000e+00, i32 %2) #4
  %6 = tail call double @llvm.fabs.f64(double %0)
  %7 = tail call double @llvm.fabs.f64(double %1)
  %8 = tail call double @r8_max(double noundef %6, double noundef %7)
  %9 = insertelement <2 x double> poison, double %0, i64 0
  %10 = insertelement <2 x double> %9, double %1, i64 1
  %11 = insertelement <2 x double> poison, double %8, i64 0
  %12 = shufflevector <2 x double> %11, <2 x double> poison, <2 x i32> zeroinitializer
  %13 = fdiv <2 x double> %10, %12
  %14 = extractelement <2 x double> %13, i64 0
  %15 = tail call double @r8_sign(double noundef %14)
  %16 = extractelement <2 x double> %13, i64 1
  %17 = tail call double @r8_sign(double noundef %16)
  %18 = insertelement <2 x double> poison, double %15, i64 0
  %19 = insertelement <2 x double> %18, double %17, i64 1
  %20 = fmul <2 x double> %19, <double 5.000000e-01, double 5.000000e-01>
  %21 = insertelement <2 x double> poison, double %ldexp, i64 0
  %22 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer
  %23 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %13, <2 x double> %22, <2 x double> %20)
  %24 = fptosi <2 x double> %23 to <2 x i32>
  %25 = sitofp <2 x i32> %24 to <2 x double>
  %26 = fdiv <2 x double> %25, %22
  %shift = shufflevector <2 x double> %26, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %27 = fsub <2 x double> %26, %shift
  %28 = extractelement <2 x double> %27, i64 0
  %29 = fmul double %8, %28
  br label %30

30:                                               ; preds = %3, %5
  %.0 = phi double [ %29, %5 ], [ 0.000000e+00, %3 ]
  ret double %.0
}

; Function Attrs: nounwind uwtable
declare dso_local double @r8_sign(double noundef) local_unnamed_addr #1

; Function Attrs: nofree willreturn
declare double @ldexp(double, i32) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 = { nofree willreturn }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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)"}


; Effective O3 passes: GlobalDCEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass,VectorCombinePass