; LLVM IR from DreamingInfraviolet/EstimateImageMatting :: Primatte/matrixd.ll (ZN4math3tmp5_mat412initRotationEffff)

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

%"class.math::tmp::_mat4" = type { [4 x [4 x float]] }

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef nonnull align 4 dereferenceable(64) ptr @_ZN4math3tmp5_mat412initRotationEffff(ptr noundef nonnull align 4 dereferenceable(64) %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4) #2 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store float %1, ptr %7, align 4, !tbaa !9
  store float %2, ptr %8, align 4, !tbaa !9
  store float %3, ptr %9, align 4, !tbaa !9
  store float %4, ptr %10, align 4, !tbaa !9
  %14 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %15 = load float, ptr %7, align 4, !tbaa !9
  %16 = fpext float %15 to double
  %17 = call double @cos(double noundef %16) #4
  %18 = fptrunc double %17 to float
  store float %18, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %19 = load float, ptr %7, align 4, !tbaa !9
  %20 = fpext float %19 to double
  %21 = call double @sin(double noundef %20) #4
  %22 = fptrunc double %21 to float
  store float %22, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %23 = load float, ptr %11, align 4, !tbaa !9
  %24 = fsub float 1.000000e+00, %23
  store float %24, ptr %13, align 4, !tbaa !9
  %25 = load float, ptr %8, align 4, !tbaa !9
  %26 = load float, ptr %8, align 4, !tbaa !9
  %27 = load float, ptr %8, align 4, !tbaa !9
  %28 = load float, ptr %8, align 4, !tbaa !9
  %29 = fneg float %27
  %30 = call float @llvm.fmuladd.f32(float %29, float %28, float 1.000000e+00)
  %31 = load float, ptr %11, align 4, !tbaa !9
  %32 = fmul float %30, %31
  %33 = call float @llvm.fmuladd.f32(float %25, float %26, float %32)
  %34 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %14, i32 0, i32 0
  %35 = getelementptr inbounds [4 x [4 x float]], ptr %34, i64 0, i64 0
  %36 = getelementptr inbounds [4 x float], ptr %35, i64 0, i64 0
  store float %33, ptr %36, align 4, !tbaa !9
  %37 = load float, ptr %13, align 4, !tbaa !9
  %38 = load float, ptr %8, align 4, !tbaa !9
  %39 = fmul float %37, %38
  %40 = load float, ptr %9, align 4, !tbaa !9
  %41 = load float, ptr %10, align 4, !tbaa !9
  %42 = load float, ptr %12, align 4, !tbaa !9
  %43 = fmul float %41, %42
  %44 = call float @llvm.fmuladd.f32(float %39, float %40, float %43)
  %45 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %14, i32 0, i32 0
  %46 = getelementptr inbounds [4 x [4 x float]], ptr %45, i64 0, i64 0
  %47 = getelementptr inbounds [4 x float], ptr %46, i64 0, i64 1
  store float %44, ptr %47, align 4, !tbaa !9
  %48 = load float, ptr %13, align 4, !tbaa !9
  %49 = load float, ptr %8, align 4, !tbaa !9
  %50 = fmul float %48, %49
  %51 = load float, ptr %10, align 4, !tbaa !9
  %52 = load float, ptr %9, align 4, !tbaa !9
  %53 = load float, ptr %12, align 4, !tbaa !9
  %54 = fmul float %52, %53
  %55 = fneg float %54
  %56 = call float @llvm.fmuladd.f32(float %50, float %51, float %55)
  %57 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %14, i32 0, i32 0
  %58 = getelementptr inbounds [4 x [4 x float]], ptr %57, i64 0, i64 0
  %59 = getelementptr inbounds [4 x float], ptr %58, i64 0, i64 2
  store float %56, ptr %59, align 4, !tbaa !9
  %60 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %14, i32 0, i32 0
  %61 = getelementptr inbounds [4 x [4 x float]], ptr %60, i64 0, i64 0
  %62 = getelementptr inbounds [4 x float], ptr %61, i64 0, i64 3
  store float 0.000000e+00, ptr %62, align 4, !tbaa !9
  %63 = load float, ptr %13, align 4, !tbaa !9
  %64 = load float, ptr %8, align 4, !tbaa !9
  %65 = fmul float %63, %64
  %66 = load float, ptr %9, align 4, !tbaa !9
  %67 = load float, ptr %10, align 4, !tbaa !9
  %68 = load float, ptr %12, align 4, !tbaa !9
  %69 = fmul float %67, %68
  %70 = fneg float %69
  %71 = call float @llvm.fmuladd.f32(float %65, float %66, float %70)
  %72 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %14, i32 0, i32 0
  %73 = getelementptr inbounds [4 x [4 x float]], ptr %72, i64 0, i64 1
  %74 = getelementptr inbounds [4 x float], ptr %73, i64 0, i64 0
  store float %71, ptr %74, align 4, !tbaa !9
  %75 = load float, ptr %9, align 4, !tbaa !9
  %76 = load float, ptr %9, align 4, !tbaa !9
  %77 = load float, ptr %9, align 4, !tbaa !9
  %78 = load float, ptr %9, align 4, !tbaa !9
  %79 = fneg float %77
  %80 = call float @llvm.fmuladd.f32(float %79, float %78, float 1.000000e+00)
  %81 = load float, ptr %11, align 4, !tbaa !9
  %82 = fmul float %80, %81
  %83 = call float @llvm.fmuladd.f32(float %75, float %76, float %82)
  %84 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %14, i32 0, i32 0
  %85 = getelementptr inbounds [4 x [4 x float]], ptr %84, i64 0, i64 1
  %86 = getelementptr inbounds [4 x float], ptr %85, i64 0, i64 1
  store float %83, ptr %86, align 4, !tbaa !9
  %87 = load float, ptr %13, align 4, !tbaa !9
  %88 = load float, ptr %9, align 4, !tbaa !9
  %89 = fmul float %87, %88
  %90 = load float, ptr %10, align 4, !tbaa !9
  %91 = load float, ptr %8, align 4, !tbaa !9
  %92 = load float, ptr %12, align 4, !tbaa !9
  %93 = fmul float %91, %92
  %94 = call float @llvm.fmuladd.f32(float %89, float %90, float %93)
  %95 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %14, i32 0, i32 0
  %96 = getelementptr inbounds [4 x [4 x float]], ptr %95, i64 0, i64 1
  %97 = getelementptr inbounds [4 x float], ptr %96, i64 0, i64 2
  store float %94, ptr %97, align 4, !tbaa !9
  %98 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %14, i32 0, i32 0
  %99 = getelementptr inbounds [4 x [4 x float]], ptr %98, i64 0, i64 1
  %100 = getelementptr inbounds [4 x float], ptr %99, i64 0, i64 3
  store float 0.000000e+00, ptr %100, align 4, !tbaa !9
  %101 = load float, ptr %13, align 4, !tbaa !9
  %102 = load float, ptr %8, align 4, !tbaa !9
  %103 = fmul float %101, %102
  %104 = load float, ptr %10, align 4, !tbaa !9
  %105 = load float, ptr %9, align 4, !tbaa !9
  %106 = load float, ptr %12, align 4, !tbaa !9
  %107 = fmul float %105, %106
  %108 = call float @llvm.fmuladd.f32(float %103, float %104, float %107)
  %109 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %14, i32 0, i32 0
  %110 = getelementptr inbounds [4 x [4 x float]], ptr %109, i64 0, i64 2
  %111 = getelementptr inbounds [4 x float], ptr %110, i64 0, i64 0
  store float %108, ptr %111, align 4, !tbaa !9
  %112 = load float, ptr %13, align 4, !tbaa !9
  %113 = load float, ptr %9, align 4, !tbaa !9
  %114 = fmul float %112, %113
  %115 = load float, ptr %10, align 4, !tbaa !9
  %116 = load float, ptr %8, align 4, !tbaa !9
  %117 = load float, ptr %12, align 4, !tbaa !9
  %118 = fmul float %116, %117
  %119 = fneg float %118
  %120 = call float @llvm.fmuladd.f32(float %114, float %115, float %119)
  %121 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %14, i32 0, i32 0
  %122 = getelementptr inbounds [4 x [4 x float]], ptr %121, i64 0, i64 2
  %123 = getelementptr inbounds [4 x float], ptr %122, i64 0, i64 1
  store float %120, ptr %123, align 4, !tbaa !9
  %124 = load float, ptr %10, align 4, !tbaa !9
  %125 = load float, ptr %10, align 4, !tbaa !9
  %126 = load float, ptr %10, align 4, !tbaa !9
  %127 = load float, ptr %10, align 4, !tbaa !9
  %128 = fneg float %126
  %129 = call float @llvm.fmuladd.f32(float %128, float %127, float 1.000000e+00)
  %130 = load float, ptr %11, align 4, !tbaa !9
  %131 = fmul float %129, %130
  %132 = call float @llvm.fmuladd.f32(float %124, float %125, float %131)
  %133 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %14, i32 0, i32 0
  %134 = getelementptr inbounds [4 x [4 x float]], ptr %133, i64 0, i64 2
  %135 = getelementptr inbounds [4 x float], ptr %134, i64 0, i64 2
  store float %132, ptr %135, align 4, !tbaa !9
  %136 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %14, i32 0, i32 0
  %137 = getelementptr inbounds [4 x [4 x float]], ptr %136, i64 0, i64 2
  %138 = getelementptr inbounds [4 x float], ptr %137, i64 0, i64 3
  store float 0.000000e+00, ptr %138, align 4, !tbaa !9
  %139 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %14, i32 0, i32 0
  %140 = getelementptr inbounds [4 x [4 x float]], ptr %139, i64 0, i64 3
  %141 = getelementptr inbounds [4 x float], ptr %140, i64 0, i64 0
  store float 0.000000e+00, ptr %141, align 4, !tbaa !9
  %142 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %14, i32 0, i32 0
  %143 = getelementptr inbounds [4 x [4 x float]], ptr %142, i64 0, i64 3
  %144 = getelementptr inbounds [4 x float], ptr %143, i64 0, i64 1
  store float 0.000000e+00, ptr %144, align 4, !tbaa !9
  %145 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %14, i32 0, i32 0
  %146 = getelementptr inbounds [4 x [4 x float]], ptr %145, i64 0, i64 3
  %147 = getelementptr inbounds [4 x float], ptr %146, i64 0, i64 2
  store float 0.000000e+00, ptr %147, align 4, !tbaa !9
  %148 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %14, i32 0, i32 0
  %149 = getelementptr inbounds [4 x [4 x float]], ptr %148, i64 0, i64 3
  %150 = getelementptr inbounds [4 x float], ptr %149, i64 0, i64 3
  store float 1.000000e+00, ptr %150, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  ret ptr %14
}

; Function Attrs: nounwind
declare double @cos(double noundef) #3

; Function Attrs: nounwind
declare double @sin(double noundef) #3

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 "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 #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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !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 float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable
define dso_local noundef nonnull align 4 dereferenceable(64) ptr @_ZN4math3tmp5_mat412initRotationEffff(ptr noundef nonnull returned writeonly align 4 dereferenceable(64) %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4) local_unnamed_addr #1 align 2 {
  %6 = fpext float %1 to double
  %7 = tail call double @cos(double noundef %6) #5
  %8 = tail call double @sin(double noundef %6) #5
  %9 = fneg float %2
  %10 = tail call float @llvm.fmuladd.f32(float %9, float %2, float 1.000000e+00)
  %11 = insertelement <2 x double> poison, double %7, i64 0
  %12 = insertelement <2 x double> %11, double %8, i64 1
  %13 = fptrunc <2 x double> %12 to <2 x float>
  %14 = extractelement <2 x float> %13, i64 0
  %15 = fsub float 1.000000e+00, %14
  %16 = insertelement <2 x float> poison, float %10, i64 0
  %17 = insertelement <2 x float> %16, float %4, i64 1
  %18 = fmul <2 x float> %17, %13
  %19 = insertelement <2 x float> poison, float %2, i64 0
  %20 = extractelement <2 x float> %13, i64 1
  %21 = fmul float %20, %3
  %22 = fneg float %21
  %23 = getelementptr inbounds i8, ptr %0, i64 8
  %24 = getelementptr inbounds i8, ptr %0, i64 12
  store float 0.000000e+00, ptr %24, align 4, !tbaa !5
  %25 = extractelement <2 x float> %18, i64 1
  %26 = fneg float %25
  %27 = getelementptr inbounds i8, ptr %0, i64 16
  %28 = fneg float %3
  %29 = tail call float @llvm.fmuladd.f32(float %28, float %3, float 1.000000e+00)
  %30 = getelementptr inbounds i8, ptr %0, i64 20
  %31 = insertelement <2 x float> poison, float %29, i64 0
  %32 = insertelement <2 x float> %31, float %2, i64 1
  %33 = fmul <2 x float> %32, %13
  %34 = getelementptr inbounds i8, ptr %0, i64 28
  store float 0.000000e+00, ptr %34, align 4, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %0, i64 32
  %36 = insertelement <2 x float> poison, float %15, i64 0
  %37 = shufflevector <2 x float> %36, <2 x float> poison, <2 x i32> zeroinitializer
  %38 = insertelement <2 x float> %19, float %3, i64 1
  %39 = fmul <2 x float> %37, %38
  %40 = shufflevector <2 x float> %19, <2 x float> %39, <2 x i32> <i32 0, i32 2>
  %41 = insertelement <2 x float> %40, float %3, i64 1
  %42 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %40, <2 x float> %41, <2 x float> %18)
  store <2 x float> %42, ptr %0, align 4, !tbaa !5
  %43 = extractelement <2 x float> %39, i64 0
  %44 = tail call float @llvm.fmuladd.f32(float %43, float %4, float %22)
  store float %44, ptr %23, align 4, !tbaa !5
  %45 = tail call float @llvm.fmuladd.f32(float %43, float %3, float %26)
  store float %45, ptr %27, align 4, !tbaa !5
  %46 = insertelement <2 x float> %39, float %3, i64 0
  %47 = insertelement <2 x float> %46, float %4, i64 1
  %48 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %46, <2 x float> %47, <2 x float> %33)
  store <2 x float> %48, ptr %30, align 4, !tbaa !5
  %49 = insertelement <2 x float> poison, float %4, i64 0
  %50 = shufflevector <2 x float> %49, <2 x float> poison, <2 x i32> zeroinitializer
  %51 = fneg <2 x float> %33
  %52 = insertelement <2 x float> %51, float %21, i64 0
  %53 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %39, <2 x float> %50, <2 x float> %52)
  store <2 x float> %53, ptr %35, align 4, !tbaa !5
  %54 = fneg float %4
  %55 = tail call float @llvm.fmuladd.f32(float %54, float %4, float 1.000000e+00)
  %56 = fmul float %55, %14
  %57 = tail call float @llvm.fmuladd.f32(float %4, float %4, float %56)
  %58 = getelementptr inbounds i8, ptr %0, i64 40
  store float %57, ptr %58, align 4, !tbaa !5
  %59 = getelementptr inbounds i8, ptr %0, i64 44
  %60 = getelementptr inbounds i8, ptr %0, i64 60
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %59, i8 0, i64 16, i1 false)
  store float 1.000000e+00, ptr %60, align 4, !tbaa !5
  ret ptr %0
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @cos(double noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sin(double noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree nounwind willreturn memory(write) 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 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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