; LLVM IR from jgaeddert/liquid-dsp :: src/audio/src (cvsd)

; 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.cvsd_s = type { i32, i8, i8, float, float, float, float, float, float, float, ptr, ptr }

@.str = external hidden unnamed_addr constant [75 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [38 x i8], align 1
@__const.cvsd_create.a_pre = external hidden unnamed_addr constant [2 x float], align 4
@__const.cvsd_create.b_post = external hidden unnamed_addr constant [3 x float], align 4

; Function Attrs: nounwind uwtable
define dso_local ptr @cvsd_create(i32 noundef %0, float noundef %1, float noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca ptr, align 8
  %9 = alloca [2 x float], align 4
  %10 = alloca [2 x float], align 4
  %11 = alloca [3 x float], align 4
  %12 = alloca [3 x float], align 4
  store i32 %0, ptr %5, align 4, !tbaa !5
  store float %1, ptr %6, align 4, !tbaa !9
  store float %2, ptr %7, align 4, !tbaa !9
  %13 = load i32, ptr %5, align 4, !tbaa !5
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %15, label %17

15:                                               ; preds = %3
  %16 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str, i32 noundef 64, ptr noundef @.str.1)
  store ptr %16, ptr %4, align 8
  br label %94

17:                                               ; preds = %3
  %18 = load float, ptr %6, align 4, !tbaa !9
  %19 = fcmp ole float %18, 1.000000e+00
  br i1 %19, label %20, label %22

20:                                               ; preds = %17
  %21 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str, i32 noundef 66, ptr noundef @.str.2)
  store ptr %21, ptr %4, align 8
  br label %94

22:                                               ; preds = %17
  %23 = load float, ptr %7, align 4, !tbaa !9
  %24 = fcmp olt float %23, 0.000000e+00
  br i1 %24, label %28, label %25

25:                                               ; preds = %22
  %26 = load float, ptr %7, align 4, !tbaa !9
  %27 = fcmp ogt float %26, 1.000000e+00
  br i1 %27, label %28, label %30

28:                                               ; preds = %25, %22
  %29 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str, i32 noundef 68, ptr noundef @.str.3)
  store ptr %29, ptr %4, align 8
  br label %94

30:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %31 = call noalias ptr @malloc(i64 noundef 56) #6
  store ptr %31, ptr %8, align 8, !tbaa !11
  %32 = load i32, ptr %5, align 4, !tbaa !5
  %33 = load ptr, ptr %8, align 8, !tbaa !11
  %34 = getelementptr inbounds %struct.cvsd_s, ptr %33, i32 0, i32 0
  store i32 %32, ptr %34, align 8, !tbaa !13
  %35 = load ptr, ptr %8, align 8, !tbaa !11
  %36 = getelementptr inbounds %struct.cvsd_s, ptr %35, i32 0, i32 1
  store i8 0, ptr %36, align 4, !tbaa !15
  %37 = load ptr, ptr %8, align 8, !tbaa !11
  %38 = getelementptr inbounds %struct.cvsd_s, ptr %37, i32 0, i32 0
  %39 = load i32, ptr %38, align 8, !tbaa !13
  %40 = shl i32 1, %39
  %41 = sub nsw i32 %40, 1
  %42 = trunc i32 %41 to i8
  %43 = load ptr, ptr %8, align 8, !tbaa !11
  %44 = getelementptr inbounds %struct.cvsd_s, ptr %43, i32 0, i32 2
  store i8 %42, ptr %44, align 1, !tbaa !16
  %45 = load ptr, ptr %8, align 8, !tbaa !11
  %46 = getelementptr inbounds %struct.cvsd_s, ptr %45, i32 0, i32 3
  store float 0.000000e+00, ptr %46, align 8, !tbaa !17
  %47 = load float, ptr %6, align 4, !tbaa !9
  %48 = load ptr, ptr %8, align 8, !tbaa !11
  %49 = getelementptr inbounds %struct.cvsd_s, ptr %48, i32 0, i32 4
  store float %47, ptr %49, align 4, !tbaa !18
  %50 = load ptr, ptr %8, align 8, !tbaa !11
  %51 = getelementptr inbounds %struct.cvsd_s, ptr %50, i32 0, i32 5
  store float 0x3F847AE140000000, ptr %51, align 8, !tbaa !19
  %52 = load ptr, ptr %8, align 8, !tbaa !11
  %53 = getelementptr inbounds %struct.cvsd_s, ptr %52, i32 0, i32 6
  store float 0x3F847AE140000000, ptr %53, align 4, !tbaa !20
  %54 = load ptr, ptr %8, align 8, !tbaa !11
  %55 = getelementptr inbounds %struct.cvsd_s, ptr %54, i32 0, i32 7
  store float 1.000000e+00, ptr %55, align 8, !tbaa !21
  %56 = load float, ptr %7, align 4, !tbaa !9
  %57 = load ptr, ptr %8, align 8, !tbaa !11
  %58 = getelementptr inbounds %struct.cvsd_s, ptr %57, i32 0, i32 8
  store float %56, ptr %58, align 4, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store float 1.000000e+00, ptr %9, align 4, !tbaa !9
  %59 = getelementptr inbounds float, ptr %9, i64 1
  %60 = load ptr, ptr %8, align 8, !tbaa !11
  %61 = getelementptr inbounds %struct.cvsd_s, ptr %60, i32 0, i32 8
  %62 = load float, ptr %61, align 4, !tbaa !22
  %63 = fneg float %62
  store float %63, ptr %59, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 @__const.cvsd_create.a_pre, i64 8, i1 false)
  %64 = getelementptr inbounds [2 x float], ptr %9, i64 0, i64 0
  %65 = getelementptr inbounds [2 x float], ptr %10, i64 0, i64 0
  %66 = call ptr @iirfilt_rrrf_create(ptr noundef %64, i32 noundef 2, ptr noundef %65, i32 noundef 2)
  %67 = load ptr, ptr %8, align 8, !tbaa !11
  %68 = getelementptr inbounds %struct.cvsd_s, ptr %67, i32 0, i32 10
  store ptr %66, ptr %68, align 8, !tbaa !23
  %69 = load ptr, ptr %8, align 8, !tbaa !11
  %70 = getelementptr inbounds %struct.cvsd_s, ptr %69, i32 0, i32 9
  store float 0x3FEFAE1480000000, ptr %70, align 8, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 12, ptr %11) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 @__const.cvsd_create.b_post, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %12) #5
  store float 1.000000e+00, ptr %12, align 4, !tbaa !9
  %71 = getelementptr inbounds float, ptr %12, i64 1
  %72 = load ptr, ptr %8, align 8, !tbaa !11
  %73 = getelementptr inbounds %struct.cvsd_s, ptr %72, i32 0, i32 8
  %74 = load float, ptr %73, align 4, !tbaa !22
  %75 = load ptr, ptr %8, align 8, !tbaa !11
  %76 = getelementptr inbounds %struct.cvsd_s, ptr %75, i32 0, i32 9
  %77 = load float, ptr %76, align 8, !tbaa !24
  %78 = fadd float %74, %77
  %79 = fneg float %78
  store float %79, ptr %71, align 4, !tbaa !9
  %80 = getelementptr inbounds float, ptr %12, i64 2
  %81 = load ptr, ptr %8, align 8, !tbaa !11
  %82 = getelementptr inbounds %struct.cvsd_s, ptr %81, i32 0, i32 8
  %83 = load float, ptr %82, align 4, !tbaa !22
  %84 = load ptr, ptr %8, align 8, !tbaa !11
  %85 = getelementptr inbounds %struct.cvsd_s, ptr %84, i32 0, i32 9
  %86 = load float, ptr %85, align 8, !tbaa !24
  %87 = fmul float %83, %86
  store float %87, ptr %80, align 4, !tbaa !9
  %88 = getelementptr inbounds [3 x float], ptr %11, i64 0, i64 0
  %89 = getelementptr inbounds [3 x float], ptr %12, i64 0, i64 0
  %90 = call ptr @iirfilt_rrrf_create(ptr noundef %88, i32 noundef 3, ptr noundef %89, i32 noundef 3)
  %91 = load ptr, ptr %8, align 8, !tbaa !11
  %92 = getelementptr inbounds %struct.cvsd_s, ptr %91, i32 0, i32 11
  store ptr %90, ptr %92, align 8, !tbaa !25
  %93 = load ptr, ptr %8, align 8, !tbaa !11
  store ptr %93, ptr %4, align 8
  call void @llvm.lifetime.end.p0(i64 12, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 12, 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
  br label %94

94:                                               ; preds = %30, %28, %20, %15
  %95 = load ptr, ptr %4, align 8
  ret ptr %95
}

declare ptr @liquid_error_config_fl(ptr noundef, i32 noundef, ptr noundef, ...) #1

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

declare ptr @iirfilt_rrrf_create(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #1

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

attributes #0 = { 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 #1 = { "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 willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind allocsize(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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }

!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 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"cvsd_s", !6, i64 0, !7, i64 4, !7, i64 5, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !12, i64 40, !12, i64 48}
!15 = !{!14, !7, i64 4}
!16 = !{!14, !7, i64 5}
!17 = !{!14, !10, i64 8}
!18 = !{!14, !10, i64 12}
!19 = !{!14, !10, i64 16}
!20 = !{!14, !10, i64 20}
!21 = !{!14, !10, i64 24}
!22 = !{!14, !10, i64 28}
!23 = !{!14, !12, i64 40}
!24 = !{!14, !10, i64 32}
!25 = !{!14, !12, i64 48}


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

@.str = external hidden unnamed_addr constant [75 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [38 x i8], align 1
@__const.cvsd_create.a_pre = external hidden unnamed_addr constant [2 x float], align 4
@__const.cvsd_create.b_post = external hidden unnamed_addr constant [3 x float], align 4

; Function Attrs: nounwind uwtable
define dso_local ptr @cvsd_create(i32 noundef %0, float noundef %1, float noundef %2) local_unnamed_addr #0 {
  %4 = alloca [2 x float], align 4
  %5 = alloca [2 x float], align 8
  %6 = alloca [3 x float], align 4
  %7 = alloca [3 x float], align 4
  %8 = icmp eq i32 %0, 0
  br i1 %8, label %9, label %11

9:                                                ; preds = %3
  %10 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str, i32 noundef 64, ptr noundef nonnull @.str.1) #5
  br label %44

11:                                               ; preds = %3
  %12 = fcmp ugt float %1, 1.000000e+00
  br i1 %12, label %15, label %13

13:                                               ; preds = %11
  %14 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str, i32 noundef 66, ptr noundef nonnull @.str.2) #5
  br label %44

15:                                               ; preds = %11
  %16 = fcmp olt float %2, 0.000000e+00
  %17 = fcmp ogt float %2, 1.000000e+00
  %or.cond = or i1 %16, %17
  br i1 %or.cond, label %18, label %20

18:                                               ; preds = %15
  %19 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str, i32 noundef 68, ptr noundef nonnull @.str.3) #5
  br label %44

20:                                               ; preds = %15
  %21 = tail call noalias dereferenceable_or_null(56) ptr @malloc(i64 noundef 56) #6
  store i32 %0, ptr %21, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %21, i64 4
  store i8 0, ptr %22, align 4, !tbaa !12
  %notmask = shl nsw i32 -1, %0
  %23 = trunc i32 %notmask to i8
  %24 = xor i8 %23, -1
  %25 = getelementptr inbounds i8, ptr %21, i64 5
  store i8 %24, ptr %25, align 1, !tbaa !13
  %26 = getelementptr inbounds i8, ptr %21, i64 8
  store float 0.000000e+00, ptr %26, align 8, !tbaa !14
  %27 = getelementptr inbounds i8, ptr %21, i64 12
  store float %1, ptr %27, align 4, !tbaa !15
  %28 = getelementptr inbounds i8, ptr %21, i64 16
  store <2 x float> <float 0x3F847AE140000000, float 0x3F847AE140000000>, ptr %28, align 8, !tbaa !16
  %29 = getelementptr inbounds i8, ptr %21, i64 24
  store float 1.000000e+00, ptr %29, align 8, !tbaa !17
  %30 = getelementptr inbounds i8, ptr %21, i64 28
  store float %2, ptr %30, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  store float 1.000000e+00, ptr %4, align 4, !tbaa !16
  %31 = getelementptr inbounds i8, ptr %4, i64 4
  %32 = fneg float %2
  store float %32, ptr %31, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %33 = load i64, ptr @__const.cvsd_create.a_pre, align 4
  store i64 %33, ptr %5, align 8
  %34 = call ptr @iirfilt_rrrf_create(ptr noundef nonnull %4, i32 noundef 2, ptr noundef nonnull %5, i32 noundef 2) #5
  %35 = getelementptr inbounds i8, ptr %21, i64 40
  store ptr %34, ptr %35, align 8, !tbaa !19
  %36 = getelementptr inbounds i8, ptr %21, i64 32
  store float 0x3FEFAE1480000000, ptr %36, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %6, ptr noundef nonnull align 4 dereferenceable(12) @__const.cvsd_create.b_post, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %7) #5
  store float 1.000000e+00, ptr %7, align 4, !tbaa !16
  %37 = getelementptr inbounds i8, ptr %7, i64 4
  %38 = fadd float %2, 0x3FEFAE1480000000
  %39 = fneg float %38
  store float %39, ptr %37, align 4, !tbaa !16
  %40 = getelementptr inbounds i8, ptr %7, i64 8
  %41 = fmul float %2, 0x3FEFAE1480000000
  store float %41, ptr %40, align 4, !tbaa !16
  %42 = call ptr @iirfilt_rrrf_create(ptr noundef nonnull %6, i32 noundef 3, ptr noundef nonnull %7, i32 noundef 3) #5
  %43 = getelementptr inbounds i8, ptr %21, i64 48
  store ptr %42, ptr %43, align 8, !tbaa !21
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %44

44:                                               ; preds = %20, %18, %13, %9
  %.0 = phi ptr [ %10, %9 ], [ %14, %13 ], [ %19, %18 ], [ %21, %20 ]
  ret ptr %.0
}

declare ptr @liquid_error_config_fl(ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

declare ptr @iirfilt_rrrf_create(ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

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

attributes #0 = { 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 #1 = { "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 willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }

!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, !7, i64 0}
!6 = !{!"cvsd_s", !7, i64 0, !8, i64 4, !8, i64 5, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !11, i64 40, !11, i64 48}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !8, i64 4}
!13 = !{!6, !8, i64 5}
!14 = !{!6, !10, i64 8}
!15 = !{!6, !10, i64 12}
!16 = !{!10, !10, i64 0}
!17 = !{!6, !10, i64 24}
!18 = !{!6, !10, i64 28}
!19 = !{!6, !11, i64 40}
!20 = !{!6, !10, i64 32}
!21 = !{!6, !11, i64 48}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass