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

; 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: nounwind uwtable
define dso_local void @isometric(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 double, ptr %11, align 8, !tbaa !9
  %24 = fsub double %22, %23
  %25 = call double @rad(double noundef 4.500000e+01)
  %26 = call double @cos(double noundef %25) #4
  %27 = fmul double %24, %26
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  store double %27, ptr %28, align 8, !tbaa !9
  %29 = load double, ptr %10, align 8, !tbaa !9
  %30 = load double, ptr %11, align 8, !tbaa !9
  %31 = fadd double %29, %30
  %32 = call double @rad(double noundef 4.500000e+01)
  %33 = call double @cos(double noundef %32) #4
  %34 = fmul double %31, %33
  store double %34, ptr %8, align 8, !tbaa !9
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = load double, ptr %35, align 8, !tbaa !9
  %37 = load double, ptr %8, align 8, !tbaa !9
  %38 = fadd double %36, %37
  %39 = call double @rad(double noundef 4.500000e+01)
  %40 = call double @cos(double noundef %39) #4
  %41 = fmul double %38, %40
  store double %41, ptr %9, align 8, !tbaa !9
  %42 = load double, ptr %9, align 8, !tbaa !9
  %43 = call double @rad(double noundef -3.500000e+01)
  %44 = call double @cos(double noundef %43) #4
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = load double, ptr %45, align 8, !tbaa !9
  %47 = call double @rad(double noundef -3.500000e+01)
  %48 = call double @sin(double noundef %47) #4
  %49 = fneg double %48
  %50 = fmul double %46, %49
  %51 = call double @llvm.fmuladd.f64(double %42, double %44, double %50)
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  store double %51, ptr %52, align 8, !tbaa !9
  %53 = load double, ptr %9, align 8, !tbaa !9
  %54 = call double @rad(double noundef -3.500000e+01)
  %55 = call double @sin(double noundef %54) #4
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = load double, ptr %56, align 8, !tbaa !9
  %58 = call double @rad(double noundef -3.500000e+01)
  %59 = call double @cos(double noundef %58) #4
  %60 = fmul double %57, %59
  %61 = call double @llvm.fmuladd.f64(double %53, double %55, double %60)
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  store double %61, ptr %62, 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
}

; 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

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}


; 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: nounwind uwtable
define dso_local void @isometric(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 = fsub double %5, %9
  %11 = tail call double @rad(double noundef 4.500000e+01)
  %12 = tail call double @cos(double noundef %11) #3
  %13 = fmul double %12, %10
  store double %13, ptr %2, align 8, !tbaa !5
  %14 = fadd double %5, %9
  %15 = tail call double @rad(double noundef 4.500000e+01)
  %16 = tail call double @cos(double noundef %15) #3
  %17 = fmul double %14, %16
  %18 = load double, ptr %1, align 8, !tbaa !5
  %19 = fadd double %18, %17
  %20 = tail call double @rad(double noundef 4.500000e+01)
  %21 = tail call double @cos(double noundef %20) #3
  %22 = fmul double %19, %21
  %23 = tail call double @rad(double noundef -3.500000e+01)
  %24 = tail call double @cos(double noundef %23) #3
  %25 = load double, ptr %2, align 8, !tbaa !5
  %26 = tail call double @rad(double noundef -3.500000e+01)
  %27 = tail call double @sin(double noundef %26) #3
  %28 = fneg double %27
  %29 = fmul double %25, %28
  %30 = tail call double @llvm.fmuladd.f64(double %22, double %24, double %29)
  store double %30, ptr %1, align 8, !tbaa !5
  %31 = tail call double @rad(double noundef -3.500000e+01)
  %32 = tail call double @sin(double noundef %31) #3
  %33 = load double, ptr %2, align 8, !tbaa !5
  %34 = tail call double @rad(double noundef -3.500000e+01)
  %35 = tail call double @cos(double noundef %34) #3
  %36 = fmul double %33, %35
  %37 = tail call double @llvm.fmuladd.f64(double %22, double %32, double %36)
  store double %37, ptr %2, align 8, !tbaa !5
  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 = { 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}


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