; LLVM IR from yettabaa/FdF :: fdf_transformations3D (rotation)

; 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.s_colect = type { i32, i32, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double, %struct.s_mlx }
%struct.s_mlx = type { ptr, ptr, ptr, ptr, i32, i32, i32 }

; Function Attrs: nounwind uwtable
declare dso_local double @rad(double noundef) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
define dso_local void @rotation(ptr noundef %0, ptr noundef %1, ptr noundef %2, double noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store double %3, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  %13 = load double, ptr %12, align 8, !tbaa !9
  store double %13, ptr %9, align 8, !tbaa !9
  %14 = load ptr, ptr %7, align 8, !tbaa !5
  %15 = load double, ptr %14, align 8, !tbaa !9
  store double %15, ptr %10, align 8, !tbaa !9
  %16 = load double, ptr %8, align 8, !tbaa !9
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.s_colect, ptr %17, i32 0, i32 8
  %19 = load i32, ptr %18, align 8, !tbaa !11
  %20 = sitofp i32 %19 to double
  %21 = fmul double %16, %20
  store double %21, ptr %11, align 8, !tbaa !9
  %22 = load double, ptr %10, align 8, !tbaa !9
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.s_colect, ptr %23, i32 0, i32 9
  %25 = load i32, ptr %24, align 4, !tbaa !15
  %26 = sitofp i32 %25 to double
  %27 = call double @rad(double noundef %26)
  %28 = call double @cos(double noundef %27) #4
  %29 = load double, ptr %11, align 8, !tbaa !9
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.s_colect, ptr %30, i32 0, i32 9
  %32 = load i32, ptr %31, align 4, !tbaa !15
  %33 = sitofp i32 %32 to double
  %34 = call double @rad(double noundef %33)
  %35 = call double @sin(double noundef %34) #4
  %36 = fmul double %29, %35
  %37 = fneg double %36
  %38 = call double @llvm.fmuladd.f64(double %22, double %28, double %37)
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  store double %38, ptr %39, align 8, !tbaa !9
  %40 = load double, ptr %10, align 8, !tbaa !9
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.s_colect, ptr %41, i32 0, i32 9
  %43 = load i32, ptr %42, align 4, !tbaa !15
  %44 = sitofp i32 %43 to double
  %45 = call double @rad(double noundef %44)
  %46 = call double @sin(double noundef %45) #4
  %47 = load double, ptr %11, align 8, !tbaa !9
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.s_colect, ptr %48, i32 0, i32 9
  %50 = load i32, ptr %49, align 4, !tbaa !15
  %51 = sitofp i32 %50 to double
  %52 = call double @rad(double noundef %51)
  %53 = call double @cos(double noundef %52) #4
  %54 = fmul double %47, %53
  %55 = call double @llvm.fmuladd.f64(double %40, double %46, double %54)
  store double %55, ptr %8, align 8, !tbaa !9
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = load double, ptr %56, align 8, !tbaa !9
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.s_colect, ptr %58, i32 0, i32 10
  %60 = load i32, ptr %59, align 8, !tbaa !16
  %61 = sitofp i32 %60 to double
  %62 = call double @rad(double noundef %61)
  %63 = call double @cos(double noundef %62) #4
  %64 = load double, ptr %8, align 8, !tbaa !9
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.s_colect, ptr %65, i32 0, i32 10
  %67 = load i32, ptr %66, align 8, !tbaa !16
  %68 = sitofp i32 %67 to double
  %69 = call double @rad(double noundef %68)
  %70 = call double @sin(double noundef %69) #4
  %71 = fmul double %64, %70
  %72 = call double @llvm.fmuladd.f64(double %57, double %63, double %71)
  store double %72, ptr %9, align 8, !tbaa !9
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = load double, ptr %73, align 8, !tbaa !9
  store double %74, ptr %10, align 8, !tbaa !9
  %75 = load double, ptr %9, align 8, !tbaa !9
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.s_colect, ptr %76, i32 0, i32 11
  %78 = load i32, ptr %77, align 4, !tbaa !17
  %79 = sitofp i32 %78 to double
  %80 = call double @rad(double noundef %79)
  %81 = call double @cos(double noundef %80) #4
  %82 = load double, ptr %10, align 8, !tbaa !9
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.s_colect, ptr %83, i32 0, i32 11
  %85 = load i32, ptr %84, align 4, !tbaa !17
  %86 = sitofp i32 %85 to double
  %87 = call double @rad(double noundef %86)
  %88 = call double @sin(double noundef %87) #4
  %89 = fneg double %88
  %90 = fmul double %82, %89
  %91 = call double @llvm.fmuladd.f64(double %75, double %81, double %90)
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  store double %91, ptr %92, align 8, !tbaa !9
  %93 = load double, ptr %9, align 8, !tbaa !9
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.s_colect, ptr %94, i32 0, i32 11
  %96 = load i32, ptr %95, align 4, !tbaa !17
  %97 = sitofp i32 %96 to double
  %98 = call double @rad(double noundef %97)
  %99 = call double @sin(double noundef %98) #4
  %100 = load double, ptr %10, align 8, !tbaa !9
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.s_colect, ptr %101, i32 0, i32 11
  %103 = load i32, ptr %102, align 4, !tbaa !17
  %104 = sitofp i32 %103 to double
  %105 = call double @rad(double noundef %104)
  %106 = call double @cos(double noundef %105) #4
  %107 = fmul double %100, %106
  %108 = call double @llvm.fmuladd.f64(double %93, double %99, double %107)
  %109 = load ptr, ptr %7, align 8, !tbaa !5
  store double %108, ptr %109, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  ret void
}

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 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !13, i64 40}
!12 = !{!"s_colect", !13, i64 0, !13, i64 4, !6, i64 8, !6, i64 16, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60, !13, i64 64, !13, i64 68, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !14, i64 104}
!13 = !{!"int", !7, i64 0}
!14 = !{!"s_mlx", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !13, i64 36, !13, i64 40}
!15 = !{!12, !13, i64 44}
!16 = !{!12, !13, i64 48}
!17 = !{!12, !13, i64 52}


; 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: nounwind uwtable
declare dso_local double @rad(double noundef) local_unnamed_addr #0

; 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

; Function Attrs: nounwind uwtable
define dso_local void @rotation(ptr nocapture noundef readonly %0, ptr nocapture noundef %1, ptr nocapture noundef %2, double noundef %3) local_unnamed_addr #0 {
  %5 = load double, ptr %2, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 40
  %7 = load i32, ptr %6, align 8, !tbaa !9
  %8 = sitofp i32 %7 to double
  %9 = fmul double %8, %3
  %10 = getelementptr inbounds i8, ptr %0, i64 44
  %11 = load i32, ptr %10, align 4, !tbaa !14
  %12 = sitofp i32 %11 to double
  %13 = tail call double @rad(double noundef %12)
  %14 = tail call double @cos(double noundef %13) #3
  %15 = load i32, ptr %10, align 4, !tbaa !14
  %16 = sitofp i32 %15 to double
  %17 = tail call double @rad(double noundef %16)
  %18 = tail call double @sin(double noundef %17) #3
  %19 = fneg double %9
  %20 = fmul double %18, %19
  %21 = tail call double @llvm.fmuladd.f64(double %5, double %14, double %20)
  store double %21, ptr %2, align 8, !tbaa !5
  %22 = load i32, ptr %10, align 4, !tbaa !14
  %23 = sitofp i32 %22 to double
  %24 = tail call double @rad(double noundef %23)
  %25 = tail call double @sin(double noundef %24) #3
  %26 = load i32, ptr %10, align 4, !tbaa !14
  %27 = sitofp i32 %26 to double
  %28 = tail call double @rad(double noundef %27)
  %29 = tail call double @cos(double noundef %28) #3
  %30 = fmul double %9, %29
  %31 = tail call double @llvm.fmuladd.f64(double %5, double %25, double %30)
  %32 = load double, ptr %1, align 8, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %0, i64 48
  %34 = load i32, ptr %33, align 8, !tbaa !15
  %35 = sitofp i32 %34 to double
  %36 = tail call double @rad(double noundef %35)
  %37 = tail call double @cos(double noundef %36) #3
  %38 = load i32, ptr %33, align 8, !tbaa !15
  %39 = sitofp i32 %38 to double
  %40 = tail call double @rad(double noundef %39)
  %41 = tail call double @sin(double noundef %40) #3
  %42 = fmul double %31, %41
  %43 = tail call double @llvm.fmuladd.f64(double %32, double %37, double %42)
  %44 = load double, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %0, i64 52
  %46 = load i32, ptr %45, align 4, !tbaa !16
  %47 = sitofp i32 %46 to double
  %48 = tail call double @rad(double noundef %47)
  %49 = tail call double @cos(double noundef %48) #3
  %50 = load i32, ptr %45, align 4, !tbaa !16
  %51 = sitofp i32 %50 to double
  %52 = tail call double @rad(double noundef %51)
  %53 = tail call double @sin(double noundef %52) #3
  %54 = fneg double %53
  %55 = fmul double %44, %54
  %56 = tail call double @llvm.fmuladd.f64(double %43, double %49, double %55)
  store double %56, ptr %1, align 8, !tbaa !5
  %57 = load i32, ptr %45, align 4, !tbaa !16
  %58 = sitofp i32 %57 to double
  %59 = tail call double @rad(double noundef %58)
  %60 = tail call double @sin(double noundef %59) #3
  %61 = load i32, ptr %45, align 4, !tbaa !16
  %62 = sitofp i32 %61 to double
  %63 = tail call double @rad(double noundef %62)
  %64 = tail call double @cos(double noundef %63) #3
  %65 = fmul double %44, %64
  %66 = tail call double @llvm.fmuladd.f64(double %43, double %60, double %65)
  store double %66, ptr %2, align 8, !tbaa !5
  ret void
}

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 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 40}
!10 = !{!"s_colect", !11, i64 0, !11, i64 4, !12, i64 8, !12, i64 16, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !13, i64 104}
!11 = !{!"int", !7, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!"s_mlx", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !11, i64 32, !11, i64 36, !11, i64 40}
!14 = !{!10, !11, i64 44}
!15 = !{!10, !11, i64 48}
!16 = !{!10, !11, i64 52}


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