; LLVM IR from robinrodricks/InspiritImage :: Inspirit.Assurf/clib/rpp (rpp)

; 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.vec3_t = type { [3 x double] }
%struct.mat33_t = type { [9 x double] }

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

declare void @_sin_cos(double noundef, ptr noundef, ptr noundef) #1

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

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

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

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


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

declare void @_sin_cos(double noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @rpyMat(ptr nocapture noundef writeonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #2 {
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  %9 = getelementptr inbounds i8, ptr %1, i64 16
  %10 = load double, ptr %9, align 8, !tbaa !5
  call void @_sin_cos(double noundef %10, ptr noundef nonnull %4, ptr noundef nonnull %3) #4
  %11 = getelementptr inbounds i8, ptr %1, i64 8
  %12 = load double, ptr %11, align 8, !tbaa !5
  call void @_sin_cos(double noundef %12, ptr noundef nonnull %6, ptr noundef nonnull %5) #4
  %13 = load double, ptr %1, align 8, !tbaa !5
  call void @_sin_cos(double noundef %13, ptr noundef nonnull %8, ptr noundef nonnull %7) #4
  %14 = load double, ptr %3, align 8, !tbaa !5
  %15 = load double, ptr %6, align 8, !tbaa !5
  %16 = fmul double %14, %15
  %17 = load double, ptr %4, align 8, !tbaa !5
  %18 = fmul double %15, %17
  %19 = load double, ptr %5, align 8, !tbaa !5
  %20 = fmul double %14, %19
  store double %20, ptr %0, align 8, !tbaa !5
  %21 = load double, ptr %8, align 8, !tbaa !5
  %22 = load double, ptr %7, align 8, !tbaa !5
  %23 = fneg double %17
  %24 = getelementptr inbounds i8, ptr %0, i64 8
  %25 = insertelement <2 x double> poison, double %22, i64 0
  %26 = insertelement <2 x double> %25, double %17, i64 1
  %27 = insertelement <2 x double> poison, double %23, i64 0
  %28 = insertelement <2 x double> %27, double %21, i64 1
  %29 = fmul <2 x double> %26, %28
  %30 = insertelement <2 x double> poison, double %16, i64 0
  %31 = shufflevector <2 x double> %30, <2 x double> poison, <2 x i32> zeroinitializer
  %32 = insertelement <2 x double> poison, double %21, i64 0
  %33 = insertelement <2 x double> %32, double %22, i64 1
  %34 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %31, <2 x double> %33, <2 x double> %29)
  store <2 x double> %34, ptr %24, align 8, !tbaa !5
  %35 = fmul double %17, %19
  %36 = getelementptr inbounds i8, ptr %0, i64 24
  store double %35, ptr %36, align 8, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %0, i64 32
  %38 = fneg double %14
  %39 = insertelement <2 x double> poison, double %14, i64 0
  %40 = insertelement <2 x double> %39, double %21, i64 1
  %41 = insertelement <2 x double> %25, double %38, i64 1
  %42 = fmul <2 x double> %40, %41
  %43 = insertelement <2 x double> poison, double %18, i64 0
  %44 = shufflevector <2 x double> %43, <2 x double> poison, <2 x i32> zeroinitializer
  %45 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %44, <2 x double> %33, <2 x double> %42)
  store <2 x double> %45, ptr %37, align 8, !tbaa !5
  %46 = fneg double %15
  %47 = getelementptr inbounds i8, ptr %0, i64 48
  store double %46, ptr %47, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %0, i64 56
  %49 = insertelement <2 x double> poison, double %19, i64 0
  %50 = shufflevector <2 x double> %49, <2 x double> poison, <2 x i32> zeroinitializer
  %51 = fmul <2 x double> %50, %33
  store <2 x double> %51, ptr %48, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 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 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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