; LLVM IR from Overload-Technologies/Overload :: Dependencies/soloud/src/audiosource/speech/klatt.ll (ZN5klatt7flutterEv)

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

%class.klatt = type <{ %class.resonator, %class.resonator, %class.resonator, %class.resonator, %class.resonator, %class.resonator, %class.resonator, %class.resonator, %class.resonator, %class.resonator, %class.resonator, %class.resonator, i32, float, float, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, float, float, float, float, i32, float, float, float, float, float, i32, i32, ptr, i32, %class.klatt_frame, [4 x i8], ptr, i32, i32, %class.Slope, %class.Slope, float, [4 x i8] }>
%class.resonator = type { float, float, float, float, float }
%class.klatt_frame = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%class.Slope = type { float, i32 }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN5klatt7flutterEv(ptr noundef nonnull align 8 dereferenceable(564) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %10 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %11 = getelementptr inbounds %class.klatt, ptr %10, i32 0, i32 42
  %12 = getelementptr inbounds %class.klatt_frame, ptr %11, i32 0, i32 0
  %13 = load i32, ptr %12, align 4, !tbaa !9
  %14 = sdiv i32 %13, 10
  store i32 %14, ptr %3, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %15 = getelementptr inbounds %class.klatt, ptr %10, i32 0, i32 16
  %16 = load i32, ptr %15, align 8, !tbaa !17
  %17 = sitofp i32 %16 to float
  %18 = fdiv float %17, 5.000000e+01
  store float %18, ptr %4, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %19 = load i32, ptr %3, align 4, !tbaa !16
  %20 = sitofp i32 %19 to float
  %21 = fdiv float %20, 1.000000e+02
  store float %21, ptr %5, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %22 = getelementptr inbounds %class.klatt, ptr %10, i32 0, i32 22
  %23 = load i32, ptr %22, align 8, !tbaa !19
  %24 = sitofp i32 %23 to double
  %25 = fmul double 0x4053F2F921000000, %24
  %26 = call double @sin(double noundef %25) #3
  %27 = fptrunc double %26 to float
  store float %27, ptr %6, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %28 = getelementptr inbounds %class.klatt, ptr %10, i32 0, i32 22
  %29 = load i32, ptr %28, align 8, !tbaa !19
  %30 = sitofp i32 %29 to double
  %31 = fmul double 0x40464E28B2000000, %30
  %32 = call double @sin(double noundef %31) #3
  %33 = fptrunc double %32 to float
  store float %33, ptr %7, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %34 = getelementptr inbounds %class.klatt, ptr %10, i32 0, i32 22
  %35 = load i32, ptr %34, align 8, !tbaa !19
  %36 = sitofp i32 %35 to double
  %37 = fmul double 0x403D87EDC4000000, %36
  %38 = call double @sin(double noundef %37) #3
  %39 = fptrunc double %38 to float
  store float %39, ptr %8, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %40 = load float, ptr %4, align 4, !tbaa !18
  %41 = load float, ptr %5, align 4, !tbaa !18
  %42 = fmul float %40, %41
  %43 = load float, ptr %6, align 4, !tbaa !18
  %44 = load float, ptr %7, align 4, !tbaa !18
  %45 = fadd float %43, %44
  %46 = load float, ptr %8, align 4, !tbaa !18
  %47 = fadd float %45, %46
  %48 = fmul float %42, %47
  %49 = fmul float %48, 1.000000e+01
  store float %49, ptr %9, align 4, !tbaa !18
  %50 = load float, ptr %9, align 4, !tbaa !18
  %51 = fptosi float %50 to i32
  %52 = getelementptr inbounds %class.klatt, ptr %10, i32 0, i32 19
  %53 = load i32, ptr %52, align 4, !tbaa !20
  %54 = add nsw i32 %53, %51
  store i32 %54, ptr %52, align 4, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

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

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

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

attributes #0 = { mustprogress 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 }

!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++ TBAA"}
!9 = !{!10, !13, i64 364}
!10 = !{!"_ZTS5klatt", !11, i64 0, !11, i64 20, !11, i64 40, !11, i64 60, !11, i64 80, !11, i64 100, !11, i64 120, !11, i64 140, !11, i64 160, !11, i64 180, !11, i64 200, !11, i64 220, !13, i64 240, !12, i64 244, !12, i64 248, !13, i64 252, !13, i64 256, !13, i64 260, !13, i64 264, !13, i64 268, !13, i64 272, !13, i64 276, !13, i64 280, !13, i64 284, !13, i64 288, !13, i64 292, !13, i64 296, !12, i64 300, !12, i64 304, !12, i64 308, !12, i64 312, !12, i64 316, !13, i64 320, !12, i64 324, !12, i64 328, !12, i64 332, !12, i64 336, !12, i64 340, !13, i64 344, !13, i64 348, !6, i64 352, !13, i64 360, !14, i64 364, !6, i64 528, !13, i64 536, !13, i64 540, !15, i64 544, !15, i64 552, !12, i64 560}
!11 = !{!"_ZTS9resonator", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16}
!12 = !{!"float", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTS11klatt_frame", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60, !13, i64 64, !13, i64 68, !13, i64 72, !13, i64 76, !13, i64 80, !13, i64 84, !13, i64 88, !13, i64 92, !13, i64 96, !13, i64 100, !13, i64 104, !13, i64 108, !13, i64 112, !13, i64 116, !13, i64 120, !13, i64 124, !13, i64 128, !13, i64 132, !13, i64 136, !13, i64 140, !13, i64 144, !13, i64 148, !13, i64 152, !13, i64 156}
!15 = !{!"_ZTS5Slope", !12, i64 0, !13, i64 4}
!16 = !{!13, !13, i64 0}
!17 = !{!10, !13, i64 256}
!18 = !{!12, !12, i64 0}
!19 = !{!10, !13, i64 280}
!20 = !{!10, !13, i64 268}


; 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 nofree nounwind willreturn memory(write, argmem: readwrite) uwtable
define dso_local void @_ZN5klatt7flutterEv(ptr nocapture noundef nonnull align 8 dereferenceable(564) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 364
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %4 = sdiv i32 %3, 10
  %5 = getelementptr inbounds i8, ptr %0, i64 256
  %6 = load <4 x i32>, ptr %5, align 8
  %7 = shufflevector <4 x i32> %6, <4 x i32> poison, <2 x i32> <i32 0, i32 poison>
  %8 = insertelement <2 x i32> %7, i32 %4, i64 1
  %9 = sitofp <2 x i32> %8 to <2 x float>
  %10 = fdiv <2 x float> %9, <float 5.000000e+01, float 1.000000e+02>
  %11 = getelementptr inbounds i8, ptr %0, i64 280
  %12 = load i32, ptr %11, align 8, !tbaa !15
  %13 = sitofp i32 %12 to double
  %14 = fmul double %13, 0x4053F2F921000000
  %15 = tail call double @sin(double noundef %14) #2
  %16 = fptrunc double %15 to float
  %17 = load i32, ptr %11, align 8, !tbaa !15
  %18 = sitofp i32 %17 to double
  %19 = fmul double %18, 0x40464E28B2000000
  %20 = tail call double @sin(double noundef %19) #2
  %21 = fptrunc double %20 to float
  %22 = load i32, ptr %11, align 8, !tbaa !15
  %23 = sitofp i32 %22 to double
  %24 = fmul double %23, 0x403D87EDC4000000
  %25 = tail call double @sin(double noundef %24) #2
  %26 = fptrunc double %25 to float
  %shift = shufflevector <2 x float> %10, <2 x float> poison, <2 x i32> <i32 1, i32 poison>
  %27 = fmul <2 x float> %10, %shift
  %28 = extractelement <2 x float> %27, i64 0
  %29 = fadd float %16, %21
  %30 = fadd float %29, %26
  %31 = fmul float %28, %30
  %32 = fmul float %31, 1.000000e+01
  %33 = fptosi float %32 to i32
  %34 = getelementptr inbounds i8, ptr %0, i64 268
  %35 = load i32, ptr %34, align 4, !tbaa !16
  %36 = add nsw i32 %35, %33
  store i32 %36, ptr %34, align 4, !tbaa !16
  ret void
}

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

attributes #0 = { mustprogress nofree nounwind willreturn memory(write, 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" }
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 = { 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, !11, i64 364}
!6 = !{!"_ZTS5klatt", !7, i64 0, !7, i64 20, !7, i64 40, !7, i64 60, !7, i64 80, !7, i64 100, !7, i64 120, !7, i64 140, !7, i64 160, !7, i64 180, !7, i64 200, !7, i64 220, !11, i64 240, !8, i64 244, !8, i64 248, !11, i64 252, !11, i64 256, !11, i64 260, !11, i64 264, !11, i64 268, !11, i64 272, !11, i64 276, !11, i64 280, !11, i64 284, !11, i64 288, !11, i64 292, !11, i64 296, !8, i64 300, !8, i64 304, !8, i64 308, !8, i64 312, !8, i64 316, !11, i64 320, !8, i64 324, !8, i64 328, !8, i64 332, !8, i64 336, !8, i64 340, !11, i64 344, !11, i64 348, !12, i64 352, !11, i64 360, !13, i64 364, !12, i64 528, !11, i64 536, !11, i64 540, !14, i64 544, !14, i64 552, !8, i64 560}
!7 = !{!"_ZTS9resonator", !8, i64 0, !8, i64 4, !8, i64 8, !8, i64 12, !8, i64 16}
!8 = !{!"float", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!"_ZTS11klatt_frame", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116, !11, i64 120, !11, i64 124, !11, i64 128, !11, i64 132, !11, i64 136, !11, i64 140, !11, i64 144, !11, i64 148, !11, i64 152, !11, i64 156}
!14 = !{!"_ZTS5Slope", !8, i64 0, !11, i64 4}
!15 = !{!6, !11, i64 280}
!16 = !{!6, !11, i64 268}


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