; LLVM IR from HRI-EU/Rcs :: src/RcsCore (Rcs_Mat3d)

; 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.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: nounwind uwtable
define dso_local void @Mat3d_mulTranspose(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %9

9:                                                ; preds = %67, %3
  %10 = load i32, ptr %7, align 4, !tbaa !9
  %11 = icmp slt i32 %10, 3
  br i1 %11, label %12, label %70

12:                                               ; preds = %9
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %13

13:                                               ; preds = %63, %12
  %14 = load i32, ptr %8, align 4, !tbaa !9
  %15 = icmp slt i32 %14, 3
  br i1 %15, label %16, label %66

16:                                               ; preds = %13
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = load i32, ptr %7, align 4, !tbaa !9
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [3 x double], ptr %17, i64 %19
  %21 = getelementptr inbounds [3 x double], ptr %20, i64 0, i64 0
  %22 = load double, ptr %21, align 8, !tbaa !11
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = load i32, ptr %8, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [3 x double], ptr %23, i64 %25
  %27 = getelementptr inbounds [3 x double], ptr %26, i64 0, i64 0
  %28 = load double, ptr %27, align 8, !tbaa !11
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = load i32, ptr %7, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [3 x double], ptr %29, i64 %31
  %33 = getelementptr inbounds [3 x double], ptr %32, i64 0, i64 1
  %34 = load double, ptr %33, align 8, !tbaa !11
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = load i32, ptr %8, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [3 x double], ptr %35, i64 %37
  %39 = getelementptr inbounds [3 x double], ptr %38, i64 0, i64 1
  %40 = load double, ptr %39, align 8, !tbaa !11
  %41 = fmul double %34, %40
  %42 = call double @llvm.fmuladd.f64(double %22, double %28, double %41)
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = load i32, ptr %7, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [3 x double], ptr %43, i64 %45
  %47 = getelementptr inbounds [3 x double], ptr %46, i64 0, i64 2
  %48 = load double, ptr %47, align 8, !tbaa !11
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = load i32, ptr %8, align 4, !tbaa !9
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [3 x double], ptr %49, i64 %51
  %53 = getelementptr inbounds [3 x double], ptr %52, i64 0, i64 2
  %54 = load double, ptr %53, align 8, !tbaa !11
  %55 = call double @llvm.fmuladd.f64(double %48, double %54, double %42)
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = load i32, ptr %7, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [3 x double], ptr %56, i64 %58
  %60 = load i32, ptr %8, align 4, !tbaa !9
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [3 x double], ptr %59, i64 0, i64 %61
  store double %55, ptr %62, align 8, !tbaa !11
  br label %63

63:                                               ; preds = %16
  %64 = load i32, ptr %8, align 4, !tbaa !9
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %8, align 4, !tbaa !9
  br label %13, !llvm.loop !13

66:                                               ; preds = %13
  br label %67

67:                                               ; preds = %66
  %68 = load i32, ptr %7, align 4, !tbaa !9
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %7, align 4, !tbaa !9
  br label %9, !llvm.loop !15

70:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #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 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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 @Mat3d_mulTranspose(ptr nocapture noundef writeonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2) local_unnamed_addr #1 {
.preheader:
  %3 = getelementptr inbounds i8, ptr %1, i64 8
  %4 = getelementptr inbounds i8, ptr %1, i64 16
  %5 = load double, ptr %1, align 8, !tbaa !5
  %6 = load double, ptr %2, align 8, !tbaa !5
  %7 = load double, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %2, i64 8
  %9 = load double, ptr %8, align 8, !tbaa !5
  %10 = fmul double %7, %9
  %11 = tail call double @llvm.fmuladd.f64(double %5, double %6, double %10)
  %12 = load double, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %2, i64 16
  %14 = load double, ptr %13, align 8, !tbaa !5
  %15 = tail call double @llvm.fmuladd.f64(double %12, double %14, double %11)
  store double %15, ptr %0, align 8, !tbaa !5
  %16 = load double, ptr %1, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %2, i64 24
  %18 = load double, ptr %17, align 8, !tbaa !5
  %19 = load double, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %2, i64 32
  %21 = load double, ptr %20, align 8, !tbaa !5
  %22 = fmul double %19, %21
  %23 = tail call double @llvm.fmuladd.f64(double %16, double %18, double %22)
  %24 = load double, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %2, i64 40
  %26 = load double, ptr %25, align 8, !tbaa !5
  %27 = tail call double @llvm.fmuladd.f64(double %24, double %26, double %23)
  %28 = getelementptr inbounds i8, ptr %0, i64 8
  store double %27, ptr %28, align 8, !tbaa !5
  %29 = load double, ptr %1, align 8, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %2, i64 48
  %31 = load double, ptr %30, align 8, !tbaa !5
  %32 = load double, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %2, i64 56
  %34 = load double, ptr %33, align 8, !tbaa !5
  %35 = fmul double %32, %34
  %36 = tail call double @llvm.fmuladd.f64(double %29, double %31, double %35)
  %37 = load double, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %2, i64 64
  %39 = load double, ptr %38, align 8, !tbaa !5
  %40 = tail call double @llvm.fmuladd.f64(double %37, double %39, double %36)
  %41 = getelementptr inbounds i8, ptr %0, i64 16
  store double %40, ptr %41, align 8, !tbaa !5
  %42 = getelementptr inbounds i8, ptr %1, i64 24
  %43 = getelementptr inbounds i8, ptr %1, i64 32
  %44 = getelementptr inbounds i8, ptr %1, i64 40
  %45 = load double, ptr %42, align 8, !tbaa !5
  %46 = load double, ptr %2, align 8, !tbaa !5
  %47 = load double, ptr %43, align 8, !tbaa !5
  %48 = load double, ptr %8, align 8, !tbaa !5
  %49 = fmul double %47, %48
  %50 = tail call double @llvm.fmuladd.f64(double %45, double %46, double %49)
  %51 = load double, ptr %44, align 8, !tbaa !5
  %52 = load double, ptr %13, align 8, !tbaa !5
  %53 = tail call double @llvm.fmuladd.f64(double %51, double %52, double %50)
  %54 = getelementptr inbounds i8, ptr %0, i64 24
  store double %53, ptr %54, align 8, !tbaa !5
  %55 = load double, ptr %42, align 8, !tbaa !5
  %56 = load double, ptr %17, align 8, !tbaa !5
  %57 = load double, ptr %43, align 8, !tbaa !5
  %58 = load double, ptr %20, align 8, !tbaa !5
  %59 = fmul double %57, %58
  %60 = tail call double @llvm.fmuladd.f64(double %55, double %56, double %59)
  %61 = load double, ptr %44, align 8, !tbaa !5
  %62 = load double, ptr %25, align 8, !tbaa !5
  %63 = tail call double @llvm.fmuladd.f64(double %61, double %62, double %60)
  %64 = getelementptr inbounds i8, ptr %0, i64 32
  store double %63, ptr %64, align 8, !tbaa !5
  %65 = load double, ptr %42, align 8, !tbaa !5
  %66 = load double, ptr %30, align 8, !tbaa !5
  %67 = load double, ptr %43, align 8, !tbaa !5
  %68 = load double, ptr %33, align 8, !tbaa !5
  %69 = fmul double %67, %68
  %70 = tail call double @llvm.fmuladd.f64(double %65, double %66, double %69)
  %71 = load double, ptr %44, align 8, !tbaa !5
  %72 = load double, ptr %38, align 8, !tbaa !5
  %73 = tail call double @llvm.fmuladd.f64(double %71, double %72, double %70)
  %74 = getelementptr inbounds i8, ptr %0, i64 40
  store double %73, ptr %74, align 8, !tbaa !5
  %75 = getelementptr inbounds i8, ptr %1, i64 48
  %76 = getelementptr inbounds i8, ptr %1, i64 56
  %77 = getelementptr inbounds i8, ptr %1, i64 64
  %78 = load double, ptr %75, align 8, !tbaa !5
  %79 = load double, ptr %2, align 8, !tbaa !5
  %80 = load double, ptr %76, align 8, !tbaa !5
  %81 = load double, ptr %8, align 8, !tbaa !5
  %82 = fmul double %80, %81
  %83 = tail call double @llvm.fmuladd.f64(double %78, double %79, double %82)
  %84 = load double, ptr %77, align 8, !tbaa !5
  %85 = load double, ptr %13, align 8, !tbaa !5
  %86 = tail call double @llvm.fmuladd.f64(double %84, double %85, double %83)
  %87 = getelementptr inbounds i8, ptr %0, i64 48
  store double %86, ptr %87, align 8, !tbaa !5
  %88 = load double, ptr %75, align 8, !tbaa !5
  %89 = load double, ptr %17, align 8, !tbaa !5
  %90 = load double, ptr %76, align 8, !tbaa !5
  %91 = load double, ptr %20, align 8, !tbaa !5
  %92 = fmul double %90, %91
  %93 = tail call double @llvm.fmuladd.f64(double %88, double %89, double %92)
  %94 = load double, ptr %77, align 8, !tbaa !5
  %95 = load double, ptr %25, align 8, !tbaa !5
  %96 = tail call double @llvm.fmuladd.f64(double %94, double %95, double %93)
  %97 = getelementptr inbounds i8, ptr %0, i64 56
  store double %96, ptr %97, align 8, !tbaa !5
  %98 = load double, ptr %75, align 8, !tbaa !5
  %99 = load double, ptr %30, align 8, !tbaa !5
  %100 = load double, ptr %76, align 8, !tbaa !5
  %101 = load double, ptr %33, align 8, !tbaa !5
  %102 = fmul double %100, %101
  %103 = tail call double @llvm.fmuladd.f64(double %98, double %99, double %102)
  %104 = load double, ptr %77, align 8, !tbaa !5
  %105 = load double, ptr %38, align 8, !tbaa !5
  %106 = tail call double @llvm.fmuladd.f64(double %104, double %105, double %103)
  %107 = getelementptr inbounds i8, ptr %0, i64 64
  store double %106, ptr %107, align 8, !tbaa !5
  ret void
}

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" }

!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,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass