; LLVM IR from TobiasKozel/VAE :: external/portaudio/src/common (pa_process)

; 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.PaUtilBufferProcessor = type { i64, i64, i32, i32, i32, i32, i64, i32, i32, i32, i32, ptr, ptr, i32, i32, i32, i32, ptr, ptr, i64, i64, ptr, ptr, i64, ptr, ptr, i64, ptr, i64, i32, [2 x i64], [2 x ptr], i32, [2 x i64], [2 x ptr], %struct.PaUtilTriangularDitherGenerator, double, ptr, ptr }
%struct.PaUtilTriangularDitherGenerator = type { i32, i32, i32 }
%struct.PaStreamCallbackTimeInfo = type { double, double, double }

; Function Attrs: nounwind uwtable
define dso_local void @PaUtil_BeginBufferProcessing(ptr noundef %0, ptr noundef %1, i64 noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, 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
  %7 = load ptr, ptr %5, align 8, !tbaa !5
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.PaUtilBufferProcessor, ptr %8, i32 0, i32 27
  store ptr %7, ptr %9, align 8, !tbaa !11
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.PaUtilBufferProcessor, ptr %10, i32 0, i32 23
  %12 = load i64, ptr %11, align 8, !tbaa !16
  %13 = uitofp i64 %12 to double
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.PaUtilBufferProcessor, ptr %14, i32 0, i32 36
  %16 = load double, ptr %15, align 8, !tbaa !17
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.PaUtilBufferProcessor, ptr %17, i32 0, i32 27
  %19 = load ptr, ptr %18, align 8, !tbaa !11
  %20 = getelementptr inbounds %struct.PaStreamCallbackTimeInfo, ptr %19, i32 0, i32 0
  %21 = load double, ptr %20, align 8, !tbaa !18
  %22 = fneg double %13
  %23 = call double @llvm.fmuladd.f64(double %22, double %16, double %21)
  store double %23, ptr %20, align 8, !tbaa !18
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.PaUtilBufferProcessor, ptr %24, i32 0, i32 26
  %26 = load i64, ptr %25, align 8, !tbaa !20
  %27 = uitofp i64 %26 to double
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.PaUtilBufferProcessor, ptr %28, i32 0, i32 36
  %30 = load double, ptr %29, align 8, !tbaa !17
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.PaUtilBufferProcessor, ptr %31, i32 0, i32 27
  %33 = load ptr, ptr %32, align 8, !tbaa !11
  %34 = getelementptr inbounds %struct.PaStreamCallbackTimeInfo, ptr %33, i32 0, i32 2
  %35 = load double, ptr %34, align 8, !tbaa !21
  %36 = call double @llvm.fmuladd.f64(double %27, double %30, double %35)
  store double %36, ptr %34, align 8, !tbaa !21
  %37 = load i64, ptr %6, align 8, !tbaa !9
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.PaUtilBufferProcessor, ptr %38, i32 0, i32 28
  store i64 %37, ptr %39, align 8, !tbaa !22
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.PaUtilBufferProcessor, ptr %40, i32 0, i32 30
  %42 = getelementptr inbounds [2 x i64], ptr %41, i64 0, i64 1
  store i64 0, ptr %42, align 8, !tbaa !9
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.PaUtilBufferProcessor, ptr %43, i32 0, i32 33
  %45 = getelementptr inbounds [2 x i64], ptr %44, i64 0, i64 1
  store i64 0, ptr %45, align 8, !tbaa !9
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !6, i64 168}
!12 = !{!"", !10, i64 0, !10, i64 8, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !10, i64 32, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !6, i64 56, !6, i64 64, !13, i64 72, !13, i64 76, !13, i64 80, !13, i64 84, !6, i64 88, !6, i64 96, !10, i64 104, !10, i64 112, !6, i64 120, !6, i64 128, !10, i64 136, !6, i64 144, !6, i64 152, !10, i64 160, !6, i64 168, !10, i64 176, !13, i64 184, !7, i64 192, !7, i64 208, !13, i64 224, !7, i64 232, !7, i64 248, !14, i64 264, !15, i64 280, !6, i64 288, !6, i64 296}
!13 = !{!"int", !7, i64 0}
!14 = !{!"PaUtilTriangularDitherGenerator", !13, i64 0, !13, i64 4, !13, i64 8}
!15 = !{!"double", !7, i64 0}
!16 = !{!12, !10, i64 136}
!17 = !{!12, !15, i64 280}
!18 = !{!19, !15, i64 0}
!19 = !{!"PaStreamCallbackTimeInfo", !15, i64 0, !15, i64 8, !15, i64 16}
!20 = !{!12, !10, i64 160}
!21 = !{!19, !15, i64 16}
!22 = !{!12, !10, i64 176}


; 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 norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @PaUtil_BeginBufferProcessing(ptr nocapture noundef %0, ptr noundef %1, i64 noundef %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 168
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 136
  %6 = load i64, ptr %5, align 8, !tbaa !14
  %7 = uitofp i64 %6 to double
  %8 = getelementptr inbounds i8, ptr %0, i64 280
  %9 = load double, ptr %8, align 8, !tbaa !15
  %10 = load double, ptr %1, align 8, !tbaa !16
  %11 = fneg double %7
  %12 = tail call double @llvm.fmuladd.f64(double %11, double %9, double %10)
  store double %12, ptr %1, align 8, !tbaa !16
  %13 = getelementptr inbounds i8, ptr %0, i64 160
  %14 = load i64, ptr %13, align 8, !tbaa !18
  %15 = uitofp i64 %14 to double
  %16 = getelementptr inbounds i8, ptr %1, i64 16
  %17 = load double, ptr %16, align 8, !tbaa !19
  %18 = tail call double @llvm.fmuladd.f64(double %15, double %9, double %17)
  store double %18, ptr %16, align 8, !tbaa !19
  %19 = getelementptr inbounds i8, ptr %0, i64 176
  store i64 %2, ptr %19, align 8, !tbaa !20
  %20 = getelementptr inbounds i8, ptr %0, i64 200
  store i64 0, ptr %20, align 8, !tbaa !21
  %21 = getelementptr inbounds i8, ptr %0, i64 240
  store i64 0, ptr %21, align 8, !tbaa !21
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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

!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 168}
!6 = !{!"", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !7, i64 32, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !11, i64 56, !11, i64 64, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !11, i64 88, !11, i64 96, !7, i64 104, !7, i64 112, !11, i64 120, !11, i64 128, !7, i64 136, !11, i64 144, !11, i64 152, !7, i64 160, !11, i64 168, !7, i64 176, !10, i64 184, !8, i64 192, !8, i64 208, !10, i64 224, !8, i64 232, !8, i64 248, !12, i64 264, !13, i64 280, !11, i64 288, !11, i64 296}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"PaUtilTriangularDitherGenerator", !10, i64 0, !10, i64 4, !10, i64 8}
!13 = !{!"double", !8, i64 0}
!14 = !{!6, !7, i64 136}
!15 = !{!6, !13, i64 280}
!16 = !{!17, !13, i64 0}
!17 = !{!"PaStreamCallbackTimeInfo", !13, i64 0, !13, i64 8, !13, i64 16}
!18 = !{!6, !7, i64 160}
!19 = !{!17, !13, i64 16}
!20 = !{!6, !7, i64 176}
!21 = !{!7, !7, i64 0}


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