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

%struct.sig_dsp_Calibrator_Node = type { float, i64, float, float, float, float, float }

; 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: inlinehint nounwind uwtable
define dso_local void @sig_dsp_Calibrator_Node_init(ptr noundef %0, ptr noundef %1, i64 noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %9

9:                                                ; preds = %36, %3
  %10 = load i64, ptr %7, align 8, !tbaa !9
  %11 = load i64, ptr %6, align 8, !tbaa !9
  %12 = icmp ult i64 %10, %11
  br i1 %12, label %14, label %13

13:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  br label %39

14:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = load i64, ptr %7, align 8, !tbaa !9
  %17 = getelementptr inbounds %struct.sig_dsp_Calibrator_Node, ptr %15, i64 %16
  store ptr %17, ptr %8, align 8, !tbaa !5
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = load i64, ptr %7, align 8, !tbaa !9
  %20 = getelementptr inbounds float, ptr %18, i64 %19
  %21 = load float, ptr %20, align 4, !tbaa !11
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.sig_dsp_Calibrator_Node, ptr %22, i32 0, i32 5
  store float %21, ptr %23, align 4, !tbaa !13
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.sig_dsp_Calibrator_Node, ptr %24, i32 0, i32 0
  store float %21, ptr %25, align 8, !tbaa !15
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.sig_dsp_Calibrator_Node, ptr %26, i32 0, i32 1
  store i64 0, ptr %27, align 8, !tbaa !16
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.sig_dsp_Calibrator_Node, ptr %28, i32 0, i32 2
  store float 0x7FF0000000000000, ptr %29, align 8, !tbaa !17
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.sig_dsp_Calibrator_Node, ptr %30, i32 0, i32 3
  store float 0xFFF0000000000000, ptr %31, align 4, !tbaa !18
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.sig_dsp_Calibrator_Node, ptr %32, i32 0, i32 4
  store float 0.000000e+00, ptr %33, align 8, !tbaa !19
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.sig_dsp_Calibrator_Node, ptr %34, i32 0, i32 6
  store float 0.000000e+00, ptr %35, align 8, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  br label %36

36:                                               ; preds = %14
  %37 = load i64, ptr %7, align 8, !tbaa !9
  %38 = add i64 %37, 1
  store i64 %38, ptr %7, align 8, !tbaa !9
  br label %9, !llvm.loop !21

39:                                               ; preds = %13
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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" }
attributes #2 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !12, i64 28}
!14 = !{!"sig_dsp_Calibrator_Node", !12, i64 0, !10, i64 8, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32}
!15 = !{!14, !12, i64 0}
!16 = !{!14, !10, i64 8}
!17 = !{!14, !12, i64 16}
!18 = !{!14, !12, i64 20}
!19 = !{!14, !12, i64 24}
!20 = !{!14, !12, i64 32}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


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

%struct.sig_dsp_Calibrator_Node = type { float, i64, float, float, float, float, float }

; Function Attrs: inlinehint nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @sig_dsp_Calibrator_Node_init(ptr nocapture noundef writeonly %0, ptr nocapture noundef readonly %1, i64 noundef %2) local_unnamed_addr #0 {
  %.not = icmp eq i64 %2, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %3
  %xtraiter = and i64 %2, 1
  %4 = icmp eq i64 %2, 1
  br i1 %4, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %2, -2
  br label %.lr.ph

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %.013.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %30, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa
  %5 = getelementptr inbounds %struct.sig_dsp_Calibrator_Node, ptr %0, i64 %.013.unr
  %6 = getelementptr inbounds float, ptr %1, i64 %.013.unr
  %7 = load float, ptr %6, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %5, i64 28
  store float %7, ptr %8, align 4, !tbaa !9
  store float %7, ptr %5, align 8, !tbaa !12
  %9 = getelementptr inbounds i8, ptr %5, i64 8
  store i64 0, ptr %9, align 8, !tbaa !13
  %10 = getelementptr inbounds i8, ptr %5, i64 16
  store <2 x float> <float 0x7FF0000000000000, float 0xFFF0000000000000>, ptr %10, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %5, i64 24
  store float 0.000000e+00, ptr %11, align 8, !tbaa !14
  %12 = getelementptr inbounds i8, ptr %5, i64 32
  store float 0.000000e+00, ptr %12, align 8, !tbaa !15
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.epil, %._crit_edge.loopexit.unr-lcssa, %3
  ret void

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %.013 = phi i64 [ 0, %.lr.ph.preheader.new ], [ %30, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %.lr.ph ]
  %13 = getelementptr inbounds %struct.sig_dsp_Calibrator_Node, ptr %0, i64 %.013
  %14 = getelementptr inbounds float, ptr %1, i64 %.013
  %15 = load float, ptr %14, align 4, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %13, i64 28
  store float %15, ptr %16, align 4, !tbaa !9
  store float %15, ptr %13, align 8, !tbaa !12
  %17 = getelementptr inbounds i8, ptr %13, i64 8
  store i64 0, ptr %17, align 8, !tbaa !13
  %18 = getelementptr inbounds i8, ptr %13, i64 16
  store <2 x float> <float 0x7FF0000000000000, float 0xFFF0000000000000>, ptr %18, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %13, i64 24
  store float 0.000000e+00, ptr %19, align 8, !tbaa !14
  %20 = getelementptr inbounds i8, ptr %13, i64 32
  store float 0.000000e+00, ptr %20, align 8, !tbaa !15
  %21 = or disjoint i64 %.013, 1
  %22 = getelementptr inbounds %struct.sig_dsp_Calibrator_Node, ptr %0, i64 %21
  %23 = getelementptr inbounds float, ptr %1, i64 %21
  %24 = load float, ptr %23, align 4, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %22, i64 28
  store float %24, ptr %25, align 4, !tbaa !9
  store float %24, ptr %22, align 8, !tbaa !12
  %26 = getelementptr inbounds i8, ptr %22, i64 8
  store i64 0, ptr %26, align 8, !tbaa !13
  %27 = getelementptr inbounds i8, ptr %22, i64 16
  store <2 x float> <float 0x7FF0000000000000, float 0xFFF0000000000000>, ptr %27, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %22, i64 24
  store float 0.000000e+00, ptr %28, align 8, !tbaa !14
  %29 = getelementptr inbounds i8, ptr %22, i64 32
  store float 0.000000e+00, ptr %29, align 8, !tbaa !15
  %30 = add nuw i64 %.013, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !16
}

attributes #0 = { inlinehint nofree norecurse nosync nounwind memory(argmem: readwrite) 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"}
!9 = !{!10, !6, i64 28}
!10 = !{!"sig_dsp_Calibrator_Node", !6, i64 0, !11, i64 8, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32}
!11 = !{!"long", !7, i64 0}
!12 = !{!10, !6, i64 0}
!13 = !{!10, !11, i64 8}
!14 = !{!10, !6, i64 24}
!15 = !{!10, !6, i64 32}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass