; LLVM IR from romerojosh/zefr :: src/funcs.ll (Z11adjoint_3x3PdS_)

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

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { mustprogress 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 = { 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++ 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @_Z11adjoint_3x3PdS_(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #1 {
  %3 = load double, ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load double, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = getelementptr inbounds i8, ptr %0, i64 32
  %8 = load double, ptr %7, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  %10 = getelementptr inbounds i8, ptr %0, i64 56
  %11 = load <2 x double>, ptr %10, align 8, !tbaa !5
  %12 = shufflevector <2 x double> %11, <2 x double> poison, <2 x i32> <i32 1, i32 0>
  %13 = insertelement <2 x double> poison, double %8, i64 0
  %14 = getelementptr inbounds i8, ptr %1, i64 16
  %15 = load <2 x double>, ptr %6, align 8, !tbaa !5
  %16 = load <2 x double>, ptr %9, align 8, !tbaa !5
  %17 = insertelement <2 x double> %16, double %5, i64 1
  %18 = fneg <2 x double> %17
  %19 = fmul <2 x double> %11, %18
  %20 = shufflevector <2 x double> %13, <2 x double> %15, <2 x i32> <i32 0, i32 2>
  %21 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %20, <2 x double> %12, <2 x double> %19)
  store <2 x double> %21, ptr %1, align 8, !tbaa !5
  %22 = fneg <2 x double> %15
  %23 = insertelement <2 x double> %11, double %8, i64 0
  %24 = fmul <2 x double> %23, %22
  %25 = insertelement <2 x double> poison, double %5, i64 0
  %26 = shufflevector <2 x double> %25, <2 x double> %16, <2 x i32> <i32 0, i32 2>
  %27 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %26, <2 x double> %16, <2 x double> %24)
  store <2 x double> %27, ptr %14, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %1, i64 32
  %29 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> <i32 poison, i32 0>
  %30 = insertelement <2 x double> %15, double %3, i64 1
  %31 = shufflevector <2 x double> %15, <2 x double> %11, <2 x i32> <i32 1, i32 3>
  %32 = getelementptr inbounds i8, ptr %1, i64 48
  %33 = insertelement <2 x double> %13, double %3, i64 1
  %34 = fneg <2 x double> %33
  %35 = shufflevector <2 x double> %29, <2 x double> %34, <2 x i32> <i32 3, i32 1>
  %36 = fmul <2 x double> %16, %35
  %37 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %30, <2 x double> %31, <2 x double> %36)
  %38 = shufflevector <2 x double> %37, <2 x double> poison, <2 x i32> <i32 1, i32 0>
  store <2 x double> %38, ptr %28, align 8, !tbaa !5
  %39 = shufflevector <2 x double> %16, <2 x double> %12, <2 x i32> <i32 1, i32 3>
  %40 = fmul <2 x double> %39, %34
  %41 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %42 = insertelement <2 x double> %41, double %5, i64 1
  %43 = shufflevector <2 x double> %11, <2 x double> %16, <2 x i32> <i32 0, i32 3>
  %44 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %42, <2 x double> %43, <2 x double> %40)
  store <2 x double> %44, ptr %32, align 8, !tbaa !5
  %45 = fmul <2 x double> %15, %18
  %46 = extractelement <2 x double> %45, i64 1
  %47 = tail call double @llvm.fmuladd.f64(double %3, double %8, double %46)
  %48 = getelementptr inbounds i8, ptr %1, i64 64
  store double %47, ptr %48, align 8, !tbaa !5
  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>) #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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++ TBAA"}


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