; LLVM IR from aferikoglou/GenHLSOptimizer :: dataset/machsuite-fft-transpose (fft)

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

@__const.twiddles8.reversed8 = external hidden unnamed_addr constant [8 x i32], align 16

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

15:                                               ; preds = %4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %9, ptr align 16 @__const.twiddles8.reversed8, i64 32, i1 false)
  br label %16

16:                                               ; preds = %15
  br label %17

17:                                               ; preds = %16
  store i32 1, ptr %10, align 4, !tbaa !9
  br label %18

18:                                               ; preds = %76, %17
  %19 = load i32, ptr %10, align 4, !tbaa !9
  %20 = icmp slt i32 %19, 8
  br i1 %20, label %21, label %79

21:                                               ; preds = %18
  %22 = load i32, ptr %10, align 4, !tbaa !9
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [8 x i32], ptr %9, i64 0, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !9
  %26 = sitofp i32 %25 to double
  %27 = fmul double 0xC01921FB54411744, %26
  %28 = load i32, ptr %8, align 4, !tbaa !9
  %29 = sitofp i32 %28 to double
  %30 = fdiv double %27, %29
  %31 = load i32, ptr %7, align 4, !tbaa !9
  %32 = sitofp i32 %31 to double
  %33 = fmul double %30, %32
  store double %33, ptr %11, align 8, !tbaa !11
  %34 = load double, ptr %11, align 8, !tbaa !11
  %35 = call double @cos(double noundef %34) #4
  store double %35, ptr %13, align 8, !tbaa !11
  %36 = load double, ptr %11, align 8, !tbaa !11
  %37 = call double @sin(double noundef %36) #4
  store double %37, ptr %14, align 8, !tbaa !11
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = load i32, ptr %10, align 4, !tbaa !9
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds double, ptr %38, i64 %40
  %42 = load double, ptr %41, align 8, !tbaa !11
  store double %42, ptr %12, align 8, !tbaa !11
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = load i32, ptr %10, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds double, ptr %43, i64 %45
  %47 = load double, ptr %46, align 8, !tbaa !11
  %48 = load double, ptr %13, align 8, !tbaa !11
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = load i32, ptr %10, align 4, !tbaa !9
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds double, ptr %49, i64 %51
  %53 = load double, ptr %52, align 8, !tbaa !11
  %54 = load double, ptr %14, align 8, !tbaa !11
  %55 = fmul double %53, %54
  %56 = fneg double %55
  %57 = call double @llvm.fmuladd.f64(double %47, double %48, double %56)
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = load i32, ptr %10, align 4, !tbaa !9
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds double, ptr %58, i64 %60
  store double %57, ptr %61, align 8, !tbaa !11
  %62 = load double, ptr %12, align 8, !tbaa !11
  %63 = load double, ptr %14, align 8, !tbaa !11
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = load i32, ptr %10, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds double, ptr %64, i64 %66
  %68 = load double, ptr %67, align 8, !tbaa !11
  %69 = load double, ptr %13, align 8, !tbaa !11
  %70 = fmul double %68, %69
  %71 = call double @llvm.fmuladd.f64(double %62, double %63, double %70)
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = load i32, ptr %10, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds double, ptr %72, i64 %74
  store double %71, ptr %75, align 8, !tbaa !11
  br label %76

76:                                               ; preds = %21
  %77 = load i32, ptr %10, align 4, !tbaa !9
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %10, align 4, !tbaa !9
  br label %18, !llvm.loop !13

79:                                               ; preds = %18
  ret void
}

; 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) #1

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

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

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

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 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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

@__const.twiddles8.reversed8 = external hidden unnamed_addr constant [8 x i32], align 16

; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: readwrite) uwtable
define dso_local void @twiddles8(ptr nocapture noundef %0, ptr nocapture noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = sitofp i32 %3 to double
  %6 = sitofp i32 %2 to double
  %7 = load i32, ptr getelementptr inbounds (i8, ptr @__const.twiddles8.reversed8, i64 4), align 4, !tbaa !5
  %8 = sitofp i32 %7 to double
  %9 = fmul double %8, 0xC01921FB54411744
  %10 = fdiv double %9, %5
  %11 = fmul double %10, %6
  %12 = tail call double @cos(double noundef %11) #3
  %13 = tail call double @sin(double noundef %11) #3
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  %15 = load double, ptr %14, align 8, !tbaa !9
  %16 = getelementptr inbounds i8, ptr %1, i64 8
  %17 = load double, ptr %16, align 8, !tbaa !9
  %18 = fneg double %17
  %19 = fmul double %13, %18
  %20 = tail call double @llvm.fmuladd.f64(double %15, double %12, double %19)
  store double %20, ptr %14, align 8, !tbaa !9
  %21 = load double, ptr %16, align 8, !tbaa !9
  %22 = fmul double %12, %21
  %23 = tail call double @llvm.fmuladd.f64(double %15, double %13, double %22)
  store double %23, ptr %16, align 8, !tbaa !9
  %24 = load i32, ptr getelementptr inbounds (i8, ptr @__const.twiddles8.reversed8, i64 8), align 8, !tbaa !5
  %25 = sitofp i32 %24 to double
  %26 = fmul double %25, 0xC01921FB54411744
  %27 = fdiv double %26, %5
  %28 = fmul double %27, %6
  %29 = tail call double @cos(double noundef %28) #3
  %30 = tail call double @sin(double noundef %28) #3
  %31 = getelementptr inbounds i8, ptr %0, i64 16
  %32 = load double, ptr %31, align 8, !tbaa !9
  %33 = getelementptr inbounds i8, ptr %1, i64 16
  %34 = load double, ptr %33, align 8, !tbaa !9
  %35 = fneg double %34
  %36 = fmul double %30, %35
  %37 = tail call double @llvm.fmuladd.f64(double %32, double %29, double %36)
  store double %37, ptr %31, align 8, !tbaa !9
  %38 = load double, ptr %33, align 8, !tbaa !9
  %39 = fmul double %29, %38
  %40 = tail call double @llvm.fmuladd.f64(double %32, double %30, double %39)
  store double %40, ptr %33, align 8, !tbaa !9
  %41 = load i32, ptr getelementptr inbounds (i8, ptr @__const.twiddles8.reversed8, i64 12), align 4, !tbaa !5
  %42 = sitofp i32 %41 to double
  %43 = fmul double %42, 0xC01921FB54411744
  %44 = fdiv double %43, %5
  %45 = fmul double %44, %6
  %46 = tail call double @cos(double noundef %45) #3
  %47 = tail call double @sin(double noundef %45) #3
  %48 = getelementptr inbounds i8, ptr %0, i64 24
  %49 = load double, ptr %48, align 8, !tbaa !9
  %50 = getelementptr inbounds i8, ptr %1, i64 24
  %51 = load double, ptr %50, align 8, !tbaa !9
  %52 = fneg double %51
  %53 = fmul double %47, %52
  %54 = tail call double @llvm.fmuladd.f64(double %49, double %46, double %53)
  store double %54, ptr %48, align 8, !tbaa !9
  %55 = load double, ptr %50, align 8, !tbaa !9
  %56 = fmul double %46, %55
  %57 = tail call double @llvm.fmuladd.f64(double %49, double %47, double %56)
  store double %57, ptr %50, align 8, !tbaa !9
  %58 = load i32, ptr getelementptr inbounds (i8, ptr @__const.twiddles8.reversed8, i64 16), align 16, !tbaa !5
  %59 = sitofp i32 %58 to double
  %60 = fmul double %59, 0xC01921FB54411744
  %61 = fdiv double %60, %5
  %62 = fmul double %61, %6
  %63 = tail call double @cos(double noundef %62) #3
  %64 = tail call double @sin(double noundef %62) #3
  %65 = getelementptr inbounds i8, ptr %0, i64 32
  %66 = load double, ptr %65, align 8, !tbaa !9
  %67 = getelementptr inbounds i8, ptr %1, i64 32
  %68 = load double, ptr %67, align 8, !tbaa !9
  %69 = fneg double %68
  %70 = fmul double %64, %69
  %71 = tail call double @llvm.fmuladd.f64(double %66, double %63, double %70)
  store double %71, ptr %65, align 8, !tbaa !9
  %72 = load double, ptr %67, align 8, !tbaa !9
  %73 = fmul double %63, %72
  %74 = tail call double @llvm.fmuladd.f64(double %66, double %64, double %73)
  store double %74, ptr %67, align 8, !tbaa !9
  %75 = load i32, ptr getelementptr inbounds (i8, ptr @__const.twiddles8.reversed8, i64 20), align 4, !tbaa !5
  %76 = sitofp i32 %75 to double
  %77 = fmul double %76, 0xC01921FB54411744
  %78 = fdiv double %77, %5
  %79 = fmul double %78, %6
  %80 = tail call double @cos(double noundef %79) #3
  %81 = tail call double @sin(double noundef %79) #3
  %82 = getelementptr inbounds i8, ptr %0, i64 40
  %83 = load double, ptr %82, align 8, !tbaa !9
  %84 = getelementptr inbounds i8, ptr %1, i64 40
  %85 = load double, ptr %84, align 8, !tbaa !9
  %86 = fneg double %85
  %87 = fmul double %81, %86
  %88 = tail call double @llvm.fmuladd.f64(double %83, double %80, double %87)
  store double %88, ptr %82, align 8, !tbaa !9
  %89 = load double, ptr %84, align 8, !tbaa !9
  %90 = fmul double %80, %89
  %91 = tail call double @llvm.fmuladd.f64(double %83, double %81, double %90)
  store double %91, ptr %84, align 8, !tbaa !9
  %92 = load i32, ptr getelementptr inbounds (i8, ptr @__const.twiddles8.reversed8, i64 24), align 8, !tbaa !5
  %93 = sitofp i32 %92 to double
  %94 = fmul double %93, 0xC01921FB54411744
  %95 = fdiv double %94, %5
  %96 = fmul double %95, %6
  %97 = tail call double @cos(double noundef %96) #3
  %98 = tail call double @sin(double noundef %96) #3
  %99 = getelementptr inbounds i8, ptr %0, i64 48
  %100 = load double, ptr %99, align 8, !tbaa !9
  %101 = getelementptr inbounds i8, ptr %1, i64 48
  %102 = load double, ptr %101, align 8, !tbaa !9
  %103 = fneg double %102
  %104 = fmul double %98, %103
  %105 = tail call double @llvm.fmuladd.f64(double %100, double %97, double %104)
  store double %105, ptr %99, align 8, !tbaa !9
  %106 = load double, ptr %101, align 8, !tbaa !9
  %107 = fmul double %97, %106
  %108 = tail call double @llvm.fmuladd.f64(double %100, double %98, double %107)
  store double %108, ptr %101, align 8, !tbaa !9
  %109 = load i32, ptr getelementptr inbounds (i8, ptr @__const.twiddles8.reversed8, i64 28), align 4, !tbaa !5
  %110 = sitofp i32 %109 to double
  %111 = fmul double %110, 0xC01921FB54411744
  %112 = fdiv double %111, %5
  %113 = fmul double %112, %6
  %114 = tail call double @cos(double noundef %113) #3
  %115 = tail call double @sin(double noundef %113) #3
  %116 = getelementptr inbounds i8, ptr %0, i64 56
  %117 = load double, ptr %116, align 8, !tbaa !9
  %118 = getelementptr inbounds i8, ptr %1, i64 56
  %119 = load double, ptr %118, align 8, !tbaa !9
  %120 = fneg double %119
  %121 = fmul double %115, %120
  %122 = tail call double @llvm.fmuladd.f64(double %117, double %114, double %121)
  store double %122, ptr %116, align 8, !tbaa !9
  %123 = load double, ptr %118, align 8, !tbaa !9
  %124 = fmul double %114, %123
  %125 = tail call double @llvm.fmuladd.f64(double %117, double %115, double %124)
  store double %125, ptr %118, align 8, !tbaa !9
  ret void
}

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

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

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

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 = { mustprogress 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass