; LLVM IR from lichen-community-systems/signaletic :: libsignaletic/src (libsignaletic)

; 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 float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: nounwind uwtable
define dso_local float @sig_interpolate_cubic(float noundef %0, ptr noundef %1, i64 noundef %2) #2 {
  %4 = alloca float, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca float, align 4
  %9 = alloca i64, align 8
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  store float %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  store i64 %2, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %19 = load float, ptr %4, align 4, !tbaa !5
  %20 = fptoui float %19 to i64
  store i64 %20, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %21 = load float, ptr %4, align 4, !tbaa !5
  %22 = load i64, ptr %7, align 8, !tbaa !11
  %23 = uitofp i64 %22 to float
  %24 = fsub float %21, %23
  store float %24, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %25 = load i64, ptr %7, align 8, !tbaa !11
  %26 = load i64, ptr %6, align 8, !tbaa !11
  %27 = urem i64 %25, %26
  store i64 %27, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %28 = load ptr, ptr %5, align 8, !tbaa !9
  %29 = load i64, ptr %9, align 8, !tbaa !11
  %30 = icmp ugt i64 %29, 0
  br i1 %30, label %31, label %34

31:                                               ; preds = %3
  %32 = load i64, ptr %9, align 8, !tbaa !11
  %33 = sub i64 %32, 1
  br label %37

34:                                               ; preds = %3
  %35 = load i64, ptr %6, align 8, !tbaa !11
  %36 = sub i64 %35, 1
  br label %37

37:                                               ; preds = %34, %31
  %38 = phi i64 [ %33, %31 ], [ %36, %34 ]
  %39 = getelementptr inbounds float, ptr %28, i64 %38
  %40 = load float, ptr %39, align 4, !tbaa !5
  store float %40, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %41 = load ptr, ptr %5, align 8, !tbaa !9
  %42 = load i64, ptr %9, align 8, !tbaa !11
  %43 = getelementptr inbounds float, ptr %41, i64 %42
  %44 = load float, ptr %43, align 4, !tbaa !5
  store float %44, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %45 = load ptr, ptr %5, align 8, !tbaa !9
  %46 = load i64, ptr %9, align 8, !tbaa !11
  %47 = add i64 %46, 1
  %48 = load i64, ptr %6, align 8, !tbaa !11
  %49 = urem i64 %47, %48
  %50 = getelementptr inbounds float, ptr %45, i64 %49
  %51 = load float, ptr %50, align 4, !tbaa !5
  store float %51, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %52 = load ptr, ptr %5, align 8, !tbaa !9
  %53 = load i64, ptr %9, align 8, !tbaa !11
  %54 = add i64 %53, 2
  %55 = load i64, ptr %6, align 8, !tbaa !11
  %56 = urem i64 %54, %55
  %57 = getelementptr inbounds float, ptr %52, i64 %56
  %58 = load float, ptr %57, align 4, !tbaa !5
  store float %58, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %59 = load float, ptr %12, align 4, !tbaa !5
  %60 = load float, ptr %10, align 4, !tbaa !5
  %61 = fsub float %59, %60
  %62 = fmul float %61, 5.000000e-01
  store float %62, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %63 = load float, ptr %11, align 4, !tbaa !5
  %64 = load float, ptr %12, align 4, !tbaa !5
  %65 = fsub float %63, %64
  store float %65, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %66 = load float, ptr %14, align 4, !tbaa !5
  %67 = load float, ptr %15, align 4, !tbaa !5
  %68 = fadd float %66, %67
  store float %68, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %69 = load float, ptr %16, align 4, !tbaa !5
  %70 = load float, ptr %15, align 4, !tbaa !5
  %71 = fadd float %69, %70
  %72 = load float, ptr %13, align 4, !tbaa !5
  %73 = load float, ptr %11, align 4, !tbaa !5
  %74 = fsub float %72, %73
  %75 = call float @llvm.fmuladd.f32(float %74, float 5.000000e-01, float %71)
  store float %75, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %76 = load float, ptr %16, align 4, !tbaa !5
  %77 = load float, ptr %17, align 4, !tbaa !5
  %78 = fadd float %76, %77
  store float %78, ptr %18, align 4, !tbaa !5
  %79 = load float, ptr %17, align 4, !tbaa !5
  %80 = load float, ptr %8, align 4, !tbaa !5
  %81 = load float, ptr %18, align 4, !tbaa !5
  %82 = fneg float %81
  %83 = call float @llvm.fmuladd.f32(float %79, float %80, float %82)
  %84 = load float, ptr %8, align 4, !tbaa !5
  %85 = load float, ptr %14, align 4, !tbaa !5
  %86 = call float @llvm.fmuladd.f32(float %83, float %84, float %85)
  %87 = load float, ptr %8, align 4, !tbaa !5
  %88 = load float, ptr %11, align 4, !tbaa !5
  %89 = call float @llvm.fmuladd.f32(float %86, float %87, float %88)
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  ret float %89
}

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 }

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !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 float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local float @sig_interpolate_cubic(float noundef %0, ptr nocapture noundef readonly %1, i64 noundef %2) local_unnamed_addr #1 {
  %4 = fptoui float %0 to i64
  %.fr35 = freeze i64 %4
  %5 = uitofp i64 %.fr35 to float
  %6 = fsub float %0, %5
  %7 = urem i64 %.fr35, %2
  %.not = icmp eq i64 %7, 0
  %.v = select i1 %.not, i64 %2, i64 %7
  %8 = getelementptr float, ptr %1, i64 %.v
  %9 = getelementptr i8, ptr %8, i64 -4
  %10 = load float, ptr %9, align 4, !tbaa !5
  %11 = getelementptr inbounds float, ptr %1, i64 %7
  %12 = load float, ptr %11, align 4, !tbaa !5
  %13 = add nuw i64 %7, 1
  %14 = icmp eq i64 %13, %2
  %15 = select i1 %14, i64 0, i64 %13
  %16 = getelementptr inbounds float, ptr %1, i64 %15
  %17 = load float, ptr %16, align 4, !tbaa !5
  %18 = add i64 %7, 2
  %19 = urem i64 %18, %2
  %20 = getelementptr inbounds float, ptr %1, i64 %19
  %21 = load float, ptr %20, align 4, !tbaa !5
  %22 = fsub float %17, %10
  %23 = fmul float %22, 5.000000e-01
  %24 = fsub float %12, %17
  %25 = fadd float %24, %23
  %26 = fadd float %24, %25
  %27 = fsub float %21, %12
  %28 = tail call float @llvm.fmuladd.f32(float %27, float 5.000000e-01, float %26)
  %29 = fadd float %25, %28
  %30 = fneg float %29
  %31 = tail call float @llvm.fmuladd.f32(float %28, float %6, float %30)
  %32 = tail call float @llvm.fmuladd.f32(float %31, float %6, float %23)
  %33 = tail call float @llvm.fmuladd.f32(float %32, float %6, float %12)
  ret float %33
}

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

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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