; 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: inlinehint nounwind uwtable
declare dso_local float @sig_clamp(float noundef, float noundef, float noundef) #0

; Function Attrs: inlinehint nounwind uwtable
define dso_local float @sig_dsp_List_constrain(i1 noundef zeroext %0, float noundef %1, float noundef %2, float noundef %3) #0 {
  %5 = alloca i8, align 1
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = zext i1 %0 to i8
  store i8 %9, ptr %5, align 1, !tbaa !5
  store float %1, ptr %6, align 4, !tbaa !9
  store float %2, ptr %7, align 4, !tbaa !9
  store float %3, ptr %8, align 4, !tbaa !9
  %10 = load i8, ptr %5, align 1, !tbaa !5, !range !11, !noundef !12
  %11 = trunc i8 %10 to i1
  br i1 %11, label %12, label %30

12:                                               ; preds = %4
  br label %13

13:                                               ; preds = %16, %12
  %14 = load float, ptr %6, align 4, !tbaa !9
  %15 = fcmp olt float %14, 0.000000e+00
  br i1 %15, label %16, label %20

16:                                               ; preds = %13
  %17 = load float, ptr %8, align 4, !tbaa !9
  %18 = load float, ptr %6, align 4, !tbaa !9
  %19 = fadd float %17, %18
  store float %19, ptr %6, align 4, !tbaa !9
  br label %13, !llvm.loop !13

20:                                               ; preds = %13
  br label %21

21:                                               ; preds = %25, %20
  %22 = load float, ptr %6, align 4, !tbaa !9
  %23 = load float, ptr %7, align 4, !tbaa !9
  %24 = fcmp ogt float %22, %23
  br i1 %24, label %25, label %29

25:                                               ; preds = %21
  %26 = load float, ptr %7, align 4, !tbaa !9
  %27 = load float, ptr %6, align 4, !tbaa !9
  %28 = fsub float %27, %26
  store float %28, ptr %6, align 4, !tbaa !9
  br label %21, !llvm.loop !15

29:                                               ; preds = %21
  br label %34

30:                                               ; preds = %4
  %31 = load float, ptr %6, align 4, !tbaa !9
  %32 = load float, ptr %7, align 4, !tbaa !9
  %33 = call float @sig_clamp(float noundef %31, float noundef 0.000000e+00, float noundef %32)
  store float %33, ptr %6, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %30, %29
  %35 = load float, ptr %6, align 4, !tbaa !9
  ret float %35
}

attributes #0 = { inlinehint 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" }

!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 = !{!"_Bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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: inlinehint nounwind uwtable
declare dso_local float @sig_clamp(float noundef, float noundef, float noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
define dso_local float @sig_dsp_List_constrain(i1 noundef zeroext %0, float noundef %1, float noundef %2, float noundef %3) local_unnamed_addr #0 {
  br i1 %0, label %.preheader11, label %11

.preheader11:                                     ; preds = %4
  %5 = fcmp olt float %1, 0.000000e+00
  br i1 %5, label %.lr.ph, label %.preheader

.preheader:                                       ; preds = %.lr.ph, %.preheader11
  %.0.lcssa = phi float [ %1, %.preheader11 ], [ %7, %.lr.ph ]
  %6 = fcmp ogt float %.0.lcssa, %2
  br i1 %6, label %.lr.ph14, label %.loopexit

.lr.ph:                                           ; preds = %.preheader11, %.lr.ph
  %.012 = phi float [ %7, %.lr.ph ], [ %1, %.preheader11 ]
  %7 = fadd float %.012, %3
  %8 = fcmp olt float %7, 0.000000e+00
  br i1 %8, label %.lr.ph, label %.preheader, !llvm.loop !5

.lr.ph14:                                         ; preds = %.preheader, %.lr.ph14
  %.113 = phi float [ %9, %.lr.ph14 ], [ %.0.lcssa, %.preheader ]
  %9 = fsub float %.113, %2
  %10 = fcmp ogt float %9, %2
  br i1 %10, label %.lr.ph14, label %.loopexit, !llvm.loop !7

11:                                               ; preds = %4
  %12 = tail call float @sig_clamp(float noundef %1, float noundef 0.000000e+00, float noundef %2)
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph14, %.preheader, %11
  %.2 = phi float [ %12, %11 ], [ %.0.lcssa, %.preheader ], [ %9, %.lr.ph14 ]
  ret float %.2
}

attributes #0 = { inlinehint 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" }

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass