; LLVM IR from alexzheng42/sDMD :: src (ToolFunctions)

; 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #0

; Function Attrs: nounwind uwtable
define dso_local void @Rotation(ptr noundef %0, ptr noundef %1, double noundef %2, i8 noundef signext %3) #1 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca i8, align 1
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store double %2, ptr %7, align 8, !tbaa !9
  store i8 %3, ptr %8, align 1, !tbaa !11
  %9 = load i8, ptr %8, align 1, !tbaa !11
  %10 = sext i8 %9 to i32
  %11 = icmp eq i32 %10, 120
  br i1 %11, label %12, label %47

12:                                               ; preds = %4
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = getelementptr inbounds double, ptr %13, i64 1
  %15 = load double, ptr %14, align 8, !tbaa !9
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = getelementptr inbounds double, ptr %16, i64 1
  store double %15, ptr %17, align 8, !tbaa !9
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds double, ptr %18, i64 2
  %20 = load double, ptr %19, align 8, !tbaa !9
  %21 = load double, ptr %7, align 8, !tbaa !9
  %22 = call double @cos(double noundef %21) #3
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds double, ptr %23, i64 3
  %25 = load double, ptr %24, align 8, !tbaa !9
  %26 = load double, ptr %7, align 8, !tbaa !9
  %27 = call double @sin(double noundef %26) #3
  %28 = fmul double %25, %27
  %29 = fneg double %28
  %30 = call double @llvm.fmuladd.f64(double %20, double %22, double %29)
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds double, ptr %31, i64 2
  store double %30, ptr %32, align 8, !tbaa !9
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds double, ptr %33, i64 2
  %35 = load double, ptr %34, align 8, !tbaa !9
  %36 = load double, ptr %7, align 8, !tbaa !9
  %37 = call double @sin(double noundef %36) #3
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds double, ptr %38, i64 3
  %40 = load double, ptr %39, align 8, !tbaa !9
  %41 = load double, ptr %7, align 8, !tbaa !9
  %42 = call double @cos(double noundef %41) #3
  %43 = fmul double %40, %42
  %44 = call double @llvm.fmuladd.f64(double %35, double %37, double %43)
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds double, ptr %45, i64 3
  store double %44, ptr %46, align 8, !tbaa !9
  br label %127

47:                                               ; preds = %4
  %48 = load i8, ptr %8, align 1, !tbaa !11
  %49 = sext i8 %48 to i32
  %50 = icmp eq i32 %49, 121
  br i1 %50, label %51, label %86

51:                                               ; preds = %47
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds double, ptr %52, i64 1
  %54 = load double, ptr %53, align 8, !tbaa !9
  %55 = load double, ptr %7, align 8, !tbaa !9
  %56 = call double @cos(double noundef %55) #3
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds double, ptr %57, i64 3
  %59 = load double, ptr %58, align 8, !tbaa !9
  %60 = load double, ptr %7, align 8, !tbaa !9
  %61 = call double @sin(double noundef %60) #3
  %62 = fmul double %59, %61
  %63 = call double @llvm.fmuladd.f64(double %54, double %56, double %62)
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds double, ptr %64, i64 1
  store double %63, ptr %65, align 8, !tbaa !9
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = getelementptr inbounds double, ptr %66, i64 2
  %68 = load double, ptr %67, align 8, !tbaa !9
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = getelementptr inbounds double, ptr %69, i64 2
  store double %68, ptr %70, align 8, !tbaa !9
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds double, ptr %71, i64 1
  %73 = load double, ptr %72, align 8, !tbaa !9
  %74 = fmul double -1.000000e+00, %73
  %75 = load double, ptr %7, align 8, !tbaa !9
  %76 = call double @sin(double noundef %75) #3
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = getelementptr inbounds double, ptr %77, i64 3
  %79 = load double, ptr %78, align 8, !tbaa !9
  %80 = load double, ptr %7, align 8, !tbaa !9
  %81 = call double @cos(double noundef %80) #3
  %82 = fmul double %79, %81
  %83 = call double @llvm.fmuladd.f64(double %74, double %76, double %82)
  %84 = load ptr, ptr %6, align 8, !tbaa !5
  %85 = getelementptr inbounds double, ptr %84, i64 3
  store double %83, ptr %85, align 8, !tbaa !9
  br label %126

86:                                               ; preds = %47
  %87 = load i8, ptr %8, align 1, !tbaa !11
  %88 = sext i8 %87 to i32
  %89 = icmp eq i32 %88, 122
  br i1 %89, label %90, label %125

90:                                               ; preds = %86
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = getelementptr inbounds double, ptr %91, i64 1
  %93 = load double, ptr %92, align 8, !tbaa !9
  %94 = load double, ptr %7, align 8, !tbaa !9
  %95 = call double @cos(double noundef %94) #3
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds double, ptr %96, i64 2
  %98 = load double, ptr %97, align 8, !tbaa !9
  %99 = load double, ptr %7, align 8, !tbaa !9
  %100 = call double @sin(double noundef %99) #3
  %101 = fmul double %98, %100
  %102 = fneg double %101
  %103 = call double @llvm.fmuladd.f64(double %93, double %95, double %102)
  %104 = load ptr, ptr %6, align 8, !tbaa !5
  %105 = getelementptr inbounds double, ptr %104, i64 1
  store double %103, ptr %105, align 8, !tbaa !9
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = getelementptr inbounds double, ptr %106, i64 1
  %108 = load double, ptr %107, align 8, !tbaa !9
  %109 = load double, ptr %7, align 8, !tbaa !9
  %110 = call double @sin(double noundef %109) #3
  %111 = load ptr, ptr %5, align 8, !tbaa !5
  %112 = getelementptr inbounds double, ptr %111, i64 2
  %113 = load double, ptr %112, align 8, !tbaa !9
  %114 = load double, ptr %7, align 8, !tbaa !9
  %115 = call double @cos(double noundef %114) #3
  %116 = fmul double %113, %115
  %117 = call double @llvm.fmuladd.f64(double %108, double %110, double %116)
  %118 = load ptr, ptr %6, align 8, !tbaa !5
  %119 = getelementptr inbounds double, ptr %118, i64 2
  store double %117, ptr %119, align 8, !tbaa !9
  %120 = load ptr, ptr %5, align 8, !tbaa !5
  %121 = getelementptr inbounds double, ptr %120, i64 3
  %122 = load double, ptr %121, align 8, !tbaa !9
  %123 = load ptr, ptr %6, align 8, !tbaa !5
  %124 = getelementptr inbounds double, ptr %123, i64 3
  store double %122, ptr %124, align 8, !tbaa !9
  br label %125

125:                                              ; preds = %90, %86
  br label %126

126:                                              ; preds = %125, %51
  br label %127

127:                                              ; preds = %126, %12
  ret void
}

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

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

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!7, !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 nounwind willreturn memory(write, argmem: readwrite) uwtable
define dso_local void @Rotation(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1, double noundef %2, i8 noundef signext %3) local_unnamed_addr #1 {
  switch i8 %3, label %66 [
    i8 120, label %5
    i8 121, label %25
    i8 122, label %45
  ]

5:                                                ; preds = %4
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load double, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %1, i64 8
  store double %7, ptr %8, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = load double, ptr %9, align 8, !tbaa !5
  %11 = tail call double @cos(double noundef %2) #3
  %12 = getelementptr inbounds i8, ptr %0, i64 24
  %13 = load double, ptr %12, align 8, !tbaa !5
  %14 = tail call double @sin(double noundef %2) #3
  %15 = fneg double %13
  %16 = fmul double %14, %15
  %17 = tail call double @llvm.fmuladd.f64(double %10, double %11, double %16)
  %18 = getelementptr inbounds i8, ptr %1, i64 16
  store double %17, ptr %18, align 8, !tbaa !5
  %19 = load double, ptr %9, align 8, !tbaa !5
  %20 = tail call double @sin(double noundef %2) #3
  %21 = load double, ptr %12, align 8, !tbaa !5
  %22 = tail call double @cos(double noundef %2) #3
  %23 = fmul double %21, %22
  %24 = tail call double @llvm.fmuladd.f64(double %19, double %20, double %23)
  br label %.sink.split

25:                                               ; preds = %4
  %26 = getelementptr inbounds i8, ptr %0, i64 8
  %27 = load double, ptr %26, align 8, !tbaa !5
  %28 = tail call double @cos(double noundef %2) #3
  %29 = getelementptr inbounds i8, ptr %0, i64 24
  %30 = load double, ptr %29, align 8, !tbaa !5
  %31 = tail call double @sin(double noundef %2) #3
  %32 = fmul double %30, %31
  %33 = tail call double @llvm.fmuladd.f64(double %27, double %28, double %32)
  %34 = getelementptr inbounds i8, ptr %1, i64 8
  store double %33, ptr %34, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %0, i64 16
  %36 = load double, ptr %35, align 8, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %1, i64 16
  store double %36, ptr %37, align 8, !tbaa !5
  %38 = load double, ptr %26, align 8, !tbaa !5
  %39 = fneg double %38
  %40 = tail call double @sin(double noundef %2) #3
  %41 = load double, ptr %29, align 8, !tbaa !5
  %42 = tail call double @cos(double noundef %2) #3
  %43 = fmul double %41, %42
  %44 = tail call double @llvm.fmuladd.f64(double %39, double %40, double %43)
  br label %.sink.split

45:                                               ; preds = %4
  %46 = getelementptr inbounds i8, ptr %0, i64 8
  %47 = load double, ptr %46, align 8, !tbaa !5
  %48 = tail call double @cos(double noundef %2) #3
  %49 = getelementptr inbounds i8, ptr %0, i64 16
  %50 = load double, ptr %49, align 8, !tbaa !5
  %51 = tail call double @sin(double noundef %2) #3
  %52 = fneg double %50
  %53 = fmul double %51, %52
  %54 = tail call double @llvm.fmuladd.f64(double %47, double %48, double %53)
  %55 = getelementptr inbounds i8, ptr %1, i64 8
  store double %54, ptr %55, align 8, !tbaa !5
  %56 = load double, ptr %46, align 8, !tbaa !5
  %57 = tail call double @sin(double noundef %2) #3
  %58 = load double, ptr %49, align 8, !tbaa !5
  %59 = tail call double @cos(double noundef %2) #3
  %60 = fmul double %58, %59
  %61 = tail call double @llvm.fmuladd.f64(double %56, double %57, double %60)
  %62 = getelementptr inbounds i8, ptr %1, i64 16
  store double %61, ptr %62, align 8, !tbaa !5
  %63 = getelementptr inbounds i8, ptr %0, i64 24
  %64 = load double, ptr %63, align 8, !tbaa !5
  br label %.sink.split

.sink.split:                                      ; preds = %5, %45, %25
  %.sink = phi double [ %44, %25 ], [ %64, %45 ], [ %24, %5 ]
  %65 = getelementptr inbounds i8, ptr %1, i64 24
  store double %.sink, ptr %65, align 8, !tbaa !5
  br label %66

66:                                               ; preds = %.sink.split, %4
  ret void
}

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

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

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