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

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

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

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

; Function Attrs: nounwind
declare double @sin(double noundef) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
define dso_local double @coef1(double noundef %0) #4 {
  %2 = alloca double, align 8
  %3 = alloca [5 x double], align 16
  %4 = alloca [5 x double], align 16
  %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 double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  store double %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 40, ptr %3) #5
  call void @llvm.memset.p0.i64(ptr align 16 %3, i8 0, i64 40, i1 false)
  %15 = getelementptr inbounds [5 x double], ptr %3, i32 0, i32 0
  store double 0x3FF20D4847C9409C, ptr %15, align 16
  %16 = getelementptr inbounds [5 x double], ptr %3, i32 0, i32 1
  store double 0xBF11D5C63DB8019A, ptr %16, align 8
  %17 = getelementptr inbounds [5 x double], ptr %3, i32 0, i32 2
  store double 1.668700e-07, ptr %17, align 16
  %18 = getelementptr inbounds [5 x double], ptr %3, i32 0, i32 3
  store double -1.280000e-09, ptr %18, align 8
  %19 = getelementptr inbounds [5 x double], ptr %3, i32 0, i32 4
  store double 2.000000e-11, ptr %19, align 16
  call void @llvm.lifetime.start.p0(i64 40, ptr %4) #5
  call void @llvm.memset.p0.i64(ptr align 16 %4, i8 0, i64 40, i1 false)
  %20 = getelementptr inbounds [5 x double], ptr %4, i32 0, i32 0
  store double 0x3FB4064C115CE8F4, ptr %20, align 16
  %21 = getelementptr inbounds [5 x double], ptr %4, i32 0, i32 1
  store double 0xBF1213977A4331C0, ptr %21, align 8
  %22 = getelementptr inbounds [5 x double], ptr %4, i32 0, i32 2
  store double 3.285700e-07, ptr %22, align 16
  %23 = getelementptr inbounds [5 x double], ptr %4, i32 0, i32 3
  store double -3.700000e-09, ptr %23, align 8
  %24 = getelementptr inbounds [5 x double], ptr %4, i32 0, i32 4
  store double 7.000000e-11, ptr %24, align 16
  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 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %25 = load double, ptr %2, align 8, !tbaa !5
  %26 = fneg double %25
  store double %26, ptr %5, align 8, !tbaa !5
  %27 = load double, ptr %5, align 8, !tbaa !5
  %28 = fmul double 0x3FE5555555555555, %27
  %29 = load double, ptr %5, align 8, !tbaa !5
  %30 = call double @sqrt(double noundef %29) #5
  %31 = fmul double %28, %30
  store double %31, ptr %9, align 8, !tbaa !5
  %32 = load double, ptr %9, align 8, !tbaa !5
  %33 = fadd double %32, 0x3FE921FB54442D18
  store double %33, ptr %10, align 8, !tbaa !5
  %34 = load double, ptr %10, align 8, !tbaa !5
  %35 = call double @sin(double noundef %34) #5
  store double %35, ptr %11, align 8, !tbaa !5
  %36 = load double, ptr %10, align 8, !tbaa !5
  %37 = call double @cos(double noundef %36) #5
  store double %37, ptr %12, align 8, !tbaa !5
  %38 = load double, ptr %5, align 8, !tbaa !5
  %39 = fdiv double 7.000000e+00, %38
  %40 = call double @pow(double noundef %39, double noundef 3.000000e+00) #5
  store double %40, ptr %6, align 8, !tbaa !5
  %41 = load double, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds [5 x double], ptr %3, i64 0, i64 0
  %43 = call double @cheb(double noundef %41, i32 noundef 5, ptr noundef %42)
  store double %43, ptr %13, align 8, !tbaa !5
  %44 = load double, ptr %6, align 8, !tbaa !5
  %45 = getelementptr inbounds [5 x double], ptr %4, i64 0, i64 0
  %46 = call double @cheb(double noundef %44, i32 noundef 5, ptr noundef %45)
  %47 = load double, ptr %9, align 8, !tbaa !5
  %48 = fdiv double %46, %47
  store double %48, ptr %14, align 8, !tbaa !5
  %49 = load double, ptr %5, align 8, !tbaa !5
  %50 = call double @pow(double noundef %49, double noundef -2.500000e-01) #5
  store double %50, ptr %7, align 8, !tbaa !5
  %51 = load double, ptr %7, align 8, !tbaa !5
  %52 = load double, ptr %11, align 8, !tbaa !5
  %53 = load double, ptr %13, align 8, !tbaa !5
  %54 = load double, ptr %12, align 8, !tbaa !5
  %55 = load double, ptr %14, align 8, !tbaa !5
  %56 = fmul double %54, %55
  %57 = fneg double %56
  %58 = call double @llvm.fmuladd.f64(double %52, double %53, double %57)
  %59 = fmul double %51, %58
  store double %59, ptr %8, align 8, !tbaa !5
  %60 = load double, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, 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 40, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr %3) #5
  ret double %60
}

; Function Attrs: nounwind
declare double @cos(double noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local double @cheb(double noundef, i32 noundef, ptr noundef) #4

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

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local double @coef1(double noundef %0) local_unnamed_addr #3 {
  %2 = alloca [5 x double], align 16
  %3 = alloca [5 x double], align 16
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %2) #4
  store <2 x double> <double 0x3FF20D4847C9409C, double 0xBF11D5C63DB8019A>, ptr %2, align 16
  %4 = getelementptr inbounds i8, ptr %2, i64 16
  store <2 x double> <double 1.668700e-07, double -1.280000e-09>, ptr %4, align 16
  %5 = getelementptr inbounds i8, ptr %2, i64 32
  store double 2.000000e-11, ptr %5, align 16
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %3) #4
  store <2 x double> <double 0x3FB4064C115CE8F4, double 0xBF1213977A4331C0>, ptr %3, align 16
  %6 = getelementptr inbounds i8, ptr %3, i64 16
  store <2 x double> <double 3.285700e-07, double -3.700000e-09>, ptr %6, align 16
  %7 = getelementptr inbounds i8, ptr %3, i64 32
  store double 7.000000e-11, ptr %7, align 16
  %8 = fneg double %0
  %9 = fmul double %0, 0xBFE5555555555555
  %10 = tail call double @sqrt(double noundef %8) #4
  %11 = fmul double %9, %10
  %12 = fadd double %11, 0x3FE921FB54442D18
  %13 = tail call double @sin(double noundef %12) #4
  %14 = tail call double @cos(double noundef %12) #4
  %15 = fdiv double -7.000000e+00, %0
  %16 = tail call double @pow(double noundef %15, double noundef 3.000000e+00) #4
  %17 = call double @cheb(double noundef %16, i32 noundef 5, ptr noundef nonnull %2)
  %18 = call double @cheb(double noundef %16, i32 noundef 5, ptr noundef nonnull %3)
  %19 = fdiv double %18, %11
  %20 = call double @pow(double noundef %8, double noundef -2.500000e-01) #4
  %21 = fneg double %14
  %22 = fmul double %19, %21
  %23 = call double @llvm.fmuladd.f64(double %13, double %17, double %22)
  %24 = fmul double %20, %23
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %2) #4
  ret double %24
}

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

; Function Attrs: nounwind uwtable
declare dso_local double @cheb(double noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #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: DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SLPVectorizerPass,SROAPass,TailCallElimPass