; LLVM IR from tfhe/spqlios-arithmetic :: spqlios/reim (reim_ifft_ref)

; 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: nounwind uwtable
define dso_local void @reim_invctwiddle(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, double noundef %4, double noundef %5) #0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store double %4, ptr %11, align 8, !tbaa !9
  store double %5, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = load double, ptr %15, align 8, !tbaa !9
  %17 = load ptr, ptr %9, align 8, !tbaa !5
  %18 = load double, ptr %17, align 8, !tbaa !9
  %19 = fsub double %16, %18
  store double %19, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = load double, ptr %20, align 8, !tbaa !9
  %22 = load ptr, ptr %10, align 8, !tbaa !5
  %23 = load double, ptr %22, align 8, !tbaa !9
  %24 = fsub double %21, %23
  store double %24, ptr %14, align 8, !tbaa !9
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = load double, ptr %25, align 8, !tbaa !9
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  %28 = load double, ptr %27, align 8, !tbaa !9
  %29 = fadd double %26, %28
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  store double %29, ptr %30, align 8, !tbaa !9
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = load double, ptr %31, align 8, !tbaa !9
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  %34 = load double, ptr %33, align 8, !tbaa !9
  %35 = fadd double %32, %34
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  store double %35, ptr %36, align 8, !tbaa !9
  %37 = load double, ptr %13, align 8, !tbaa !9
  %38 = load double, ptr %11, align 8, !tbaa !9
  %39 = load double, ptr %14, align 8, !tbaa !9
  %40 = load double, ptr %12, align 8, !tbaa !9
  %41 = fmul double %39, %40
  %42 = fneg double %41
  %43 = call double @llvm.fmuladd.f64(double %37, double %38, double %42)
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  store double %43, ptr %44, align 8, !tbaa !9
  %45 = load double, ptr %13, align 8, !tbaa !9
  %46 = load double, ptr %12, align 8, !tbaa !9
  %47 = load double, ptr %14, align 8, !tbaa !9
  %48 = load double, ptr %11, align 8, !tbaa !9
  %49 = fmul double %47, %48
  %50 = call double @llvm.fmuladd.f64(double %45, double %46, double %49)
  %51 = load ptr, ptr %10, align 8, !tbaa !5
  store double %50, ptr %51, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}


; 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 @reim_invctwiddle(ptr nocapture noundef %0, ptr nocapture noundef %1, ptr nocapture noundef %2, ptr nocapture noundef %3, double noundef %4, double noundef %5) local_unnamed_addr #0 {
  %7 = load double, ptr %0, align 8, !tbaa !5
  %8 = load double, ptr %2, align 8, !tbaa !5
  %9 = fsub double %7, %8
  %10 = load double, ptr %1, align 8, !tbaa !5
  %11 = load double, ptr %3, align 8, !tbaa !5
  %12 = fsub double %10, %11
  %13 = fadd double %7, %8
  store double %13, ptr %0, align 8, !tbaa !5
  %14 = load double, ptr %1, align 8, !tbaa !5
  %15 = load double, ptr %3, align 8, !tbaa !5
  %16 = fadd double %14, %15
  store double %16, ptr %1, align 8, !tbaa !5
  %17 = fneg double %12
  %18 = fmul double %17, %5
  %19 = tail call double @llvm.fmuladd.f64(double %9, double %4, double %18)
  store double %19, ptr %2, align 8, !tbaa !5
  %20 = fmul double %12, %4
  %21 = tail call double @llvm.fmuladd.f64(double %9, double %5, double %20)
  store double %21, ptr %3, align 8, !tbaa !5
  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, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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