; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local double @get_value_at_small_phi(i32 noundef %0, i32 noundef %1, double noundef %2, double noundef %3) #3 {
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %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
  store i32 %0, ptr %5, align 4, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !5
  store double %2, ptr %7, align 8, !tbaa !9
  store double %3, ptr %8, align 8, !tbaa !9
  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
  %13 = load i32, ptr %6, align 4, !tbaa !5
  %14 = sitofp i32 %13 to double
  %15 = fadd double %14, 5.000000e-01
  store double %15, ptr %9, align 8, !tbaa !9
  %16 = load double, ptr %9, align 8, !tbaa !9
  %17 = fdiv double 1.000000e+00, %16
  %18 = load double, ptr %8, align 8, !tbaa !9
  %19 = fmul double 2.000000e+00, %18
  %20 = load double, ptr %9, align 8, !tbaa !9
  %21 = fmul double %19, %20
  %22 = call double @log(double noundef %21) #4
  %23 = fmul double %17, %22
  store double %23, ptr %10, align 8, !tbaa !9
  %24 = load double, ptr %10, align 8, !tbaa !9
  %25 = fmul double -2.000000e+00, %24
  %26 = fdiv double %25, 5.000000e+00
  %27 = load double, ptr %10, align 8, !tbaa !9
  %28 = fmul double 1.600000e+01, %27
  %29 = load double, ptr %10, align 8, !tbaa !9
  %30 = fmul double %28, %29
  %31 = fdiv double 3.750000e+02, %30
  %32 = fadd double 1.000000e+00, %31
  %33 = call double @acosh(double noundef %32) #4
  %34 = fmul double 0x3FD5555555555555, %33
  %35 = call double @cosh(double noundef %34) #4
  %36 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %35, double 1.000000e+00)
  %37 = fmul double %26, %36
  store double %37, ptr %11, align 8, !tbaa !9
  %38 = load double, ptr %9, align 8, !tbaa !9
  %39 = load double, ptr %11, align 8, !tbaa !9
  %40 = call double @cosh(double noundef %39) #4
  %41 = fdiv double %38, %40
  %42 = load double, ptr %7, align 8, !tbaa !9
  %43 = fdiv double %41, %42
  store double %43, ptr %12, align 8, !tbaa !9
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = icmp eq i32 %44, 1
  br i1 %45, label %46, label %59

46:                                               ; preds = %4
  %47 = load i32, ptr %6, align 4, !tbaa !5
  %48 = sitofp i32 %47 to double
  %49 = load double, ptr %7, align 8, !tbaa !9
  %50 = fdiv double %48, %49
  %51 = call double @asin(double noundef %50) #4
  %52 = load i32, ptr %6, align 4, !tbaa !5
  %53 = sitofp i32 %52 to double
  %54 = load double, ptr %7, align 8, !tbaa !9
  %55 = fdiv double %53, %54
  %56 = fdiv double %51, %55
  %57 = load double, ptr %12, align 8, !tbaa !9
  %58 = fmul double %57, %56
  store double %58, ptr %12, align 8, !tbaa !9
  br label %76

59:                                               ; preds = %4
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = icmp eq i32 %60, -1
  br i1 %61, label %62, label %75

62:                                               ; preds = %59
  %63 = load i32, ptr %6, align 4, !tbaa !5
  %64 = sitofp i32 %63 to double
  %65 = load double, ptr %7, align 8, !tbaa !9
  %66 = fdiv double %64, %65
  %67 = call double @asinh(double noundef %66) #4
  %68 = load i32, ptr %6, align 4, !tbaa !5
  %69 = sitofp i32 %68 to double
  %70 = load double, ptr %7, align 8, !tbaa !9
  %71 = fdiv double %69, %70
  %72 = fdiv double %67, %71
  %73 = load double, ptr %12, align 8, !tbaa !9
  %74 = fmul double %73, %72
  store double %74, ptr %12, align 8, !tbaa !9
  br label %75

75:                                               ; preds = %62, %59
  br label %76

76:                                               ; preds = %75, %46
  %77 = load double, ptr %12, align 8, !tbaa !9
  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
  ret double %77
}

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

; Function Attrs: nounwind
declare double @acosh(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 "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 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)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !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.fmuladd.f64(double, double, double) #0

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

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable
define dso_local double @get_value_at_small_phi(i32 noundef %0, i32 noundef %1, double noundef %2, double noundef %3) local_unnamed_addr #2 {
  %5 = sitofp i32 %1 to double
  %6 = fadd double %5, 5.000000e-01
  %7 = fdiv double 1.000000e+00, %6
  %8 = fmul double %3, 2.000000e+00
  %9 = fmul double %6, %8
  %10 = tail call double @log(double noundef %9) #3
  %11 = fmul double %7, %10
  %12 = fmul double %11, -2.000000e+00
  %13 = fdiv double %12, 5.000000e+00
  %14 = fmul double %11, 1.600000e+01
  %15 = fmul double %11, %14
  %16 = fdiv double 3.750000e+02, %15
  %17 = fadd double %16, 1.000000e+00
  %18 = tail call double @acosh(double noundef %17) #3
  %19 = fmul double %18, 0x3FD5555555555555
  %20 = tail call double @cosh(double noundef %19) #3
  %21 = tail call double @llvm.fmuladd.f64(double %20, double 2.000000e+00, double 1.000000e+00)
  %22 = fmul double %13, %21
  %23 = tail call double @cosh(double noundef %22) #3
  %24 = fdiv double %6, %23
  %25 = fdiv double %24, %2
  switch i32 %0, label %36 [
    i32 1, label %26
    i32 -1, label %31
  ]

26:                                               ; preds = %4
  %27 = fdiv double %5, %2
  %28 = tail call double @asin(double noundef %27) #3
  %29 = fdiv double %28, %27
  %30 = fmul double %25, %29
  br label %36

31:                                               ; preds = %4
  %32 = fdiv double %5, %2
  %33 = tail call double @asinh(double noundef %32) #3
  %34 = fdiv double %33, %32
  %35 = fmul double %25, %34
  br label %36

36:                                               ; preds = %4, %31, %26
  %.0 = phi double [ %30, %26 ], [ %35, %31 ], [ %25, %4 ]
  ret double %.0
}

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

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

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


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