; LLVM IR from tfhe/spqlios-arithmetic :: spqlios/reim (reim_fft_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: 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #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 nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @reim_citwiddle(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 #1 {
  %7 = load double, ptr %2, align 8, !tbaa !5
  %8 = fneg double %7
  %9 = load double, ptr %3, align 8, !tbaa !5
  %10 = fneg double %9
  %11 = fmul double %10, %4
  %12 = tail call double @llvm.fmuladd.f64(double %8, double %5, double %11)
  %13 = fmul double %10, %5
  %14 = tail call double @llvm.fmuladd.f64(double %7, double %4, double %13)
  %15 = load double, ptr %0, align 8, !tbaa !5
  %16 = fsub double %15, %12
  store double %16, ptr %2, align 8, !tbaa !5
  %17 = load double, ptr %1, align 8, !tbaa !5
  %18 = fsub double %17, %14
  store double %18, ptr %3, align 8, !tbaa !5
  %19 = load double, ptr %0, align 8, !tbaa !5
  %20 = fadd double %12, %19
  store double %20, ptr %0, align 8, !tbaa !5
  %21 = load double, ptr %1, align 8, !tbaa !5
  %22 = fadd double %14, %21
  store double %22, ptr %1, align 8, !tbaa !5
  ret void
}

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

!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