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

; 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: mustprogress nounwind uwtable
declare dso_local void @_ZN4math3tmp5_mat45resetEv(ptr noundef nonnull align 4 dereferenceable(64)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef nonnull align 4 dereferenceable(64) ptr @_ZN4math3tmp5_mat419initOrthoProjectionEffffff(ptr noundef nonnull align 4 dereferenceable(64) %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4, float noundef %5, float noundef %6) #0 align 2 {
  %8 = alloca ptr, align 8
  %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
  %14 = alloca float, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store float %1, ptr %9, align 4, !tbaa !9
  store float %2, ptr %10, align 4, !tbaa !9
  store float %3, ptr %11, align 4, !tbaa !9
  store float %4, ptr %12, align 4, !tbaa !9
  store float %5, ptr %13, align 4, !tbaa !9
  store float %6, ptr %14, align 4, !tbaa !9
  %15 = load ptr, ptr %8, align 8
  call void @_ZN4math3tmp5_mat45resetEv(ptr noundef nonnull align 4 dereferenceable(64) %15)
  %16 = load float, ptr %10, align 4, !tbaa !9
  %17 = load float, ptr %9, align 4, !tbaa !9
  %18 = fsub float %16, %17
  %19 = fdiv float 2.000000e+00, %18
  %20 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %15, i32 0, i32 0
  %21 = getelementptr inbounds [4 x [4 x float]], ptr %20, i64 0, i64 0
  %22 = getelementptr inbounds [4 x float], ptr %21, i64 0, i64 0
  store float %19, ptr %22, align 4, !tbaa !9
  %23 = load float, ptr %12, align 4, !tbaa !9
  %24 = load float, ptr %11, align 4, !tbaa !9
  %25 = fsub float %23, %24
  %26 = fdiv float 2.000000e+00, %25
  %27 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %15, i32 0, i32 0
  %28 = getelementptr inbounds [4 x [4 x float]], ptr %27, i64 0, i64 1
  %29 = getelementptr inbounds [4 x float], ptr %28, i64 0, i64 1
  store float %26, ptr %29, align 4, !tbaa !9
  %30 = load float, ptr %14, align 4, !tbaa !9
  %31 = load float, ptr %13, align 4, !tbaa !9
  %32 = fsub float %30, %31
  %33 = fdiv float -2.000000e+00, %32
  %34 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %15, i32 0, i32 0
  %35 = getelementptr inbounds [4 x [4 x float]], ptr %34, i64 0, i64 2
  %36 = getelementptr inbounds [4 x float], ptr %35, i64 0, i64 2
  store float %33, ptr %36, align 4, !tbaa !9
  %37 = load float, ptr %10, align 4, !tbaa !9
  %38 = load float, ptr %9, align 4, !tbaa !9
  %39 = fadd float %37, %38
  %40 = load float, ptr %10, align 4, !tbaa !9
  %41 = load float, ptr %9, align 4, !tbaa !9
  %42 = fsub float %40, %41
  %43 = fdiv float %39, %42
  %44 = fneg float %43
  %45 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %15, i32 0, i32 0
  %46 = getelementptr inbounds [4 x [4 x float]], ptr %45, i64 0, i64 3
  %47 = getelementptr inbounds [4 x float], ptr %46, i64 0, i64 0
  store float %44, ptr %47, align 4, !tbaa !9
  %48 = load float, ptr %12, align 4, !tbaa !9
  %49 = load float, ptr %11, align 4, !tbaa !9
  %50 = fadd float %48, %49
  %51 = load float, ptr %12, align 4, !tbaa !9
  %52 = load float, ptr %11, align 4, !tbaa !9
  %53 = fsub float %51, %52
  %54 = fdiv float %50, %53
  %55 = fneg float %54
  %56 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %15, i32 0, i32 0
  %57 = getelementptr inbounds [4 x [4 x float]], ptr %56, i64 0, i64 3
  %58 = getelementptr inbounds [4 x float], ptr %57, i64 0, i64 1
  store float %55, ptr %58, align 4, !tbaa !9
  %59 = load float, ptr %14, align 4, !tbaa !9
  %60 = load float, ptr %13, align 4, !tbaa !9
  %61 = fadd float %59, %60
  %62 = load float, ptr %14, align 4, !tbaa !9
  %63 = load float, ptr %13, align 4, !tbaa !9
  %64 = fsub float %62, %63
  %65 = fdiv float %61, %64
  %66 = getelementptr inbounds %"class.math::tmp::_mat4", ptr %15, i32 0, i32 0
  %67 = getelementptr inbounds [4 x [4 x float]], ptr %66, i64 0, i64 3
  %68 = getelementptr inbounds [4 x float], ptr %67, i64 0, i64 2
  store float %65, ptr %68, align 4, !tbaa !9
  ret ptr %15
}

attributes #0 = { 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" }

!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 nounwind uwtable
declare dso_local void @_ZN4math3tmp5_mat45resetEv(ptr noundef nonnull align 4 dereferenceable(64)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef nonnull align 4 dereferenceable(64) ptr @_ZN4math3tmp5_mat419initOrthoProjectionEffffff(ptr noundef nonnull returned align 4 dereferenceable(64) %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4, float noundef %5, float noundef %6) local_unnamed_addr #0 align 2 {
  tail call void @_ZN4math3tmp5_mat45resetEv(ptr noundef nonnull align 4 dereferenceable(64) %0)
  %8 = insertelement <2 x float> poison, float %2, i64 0
  %9 = insertelement <2 x float> %8, float %4, i64 1
  %10 = insertelement <2 x float> poison, float %1, i64 0
  %11 = insertelement <2 x float> %10, float %3, i64 1
  %12 = fsub <2 x float> %9, %11
  %13 = extractelement <2 x float> %12, i64 0
  %14 = fdiv float 2.000000e+00, %13
  store float %14, ptr %0, align 4, !tbaa !5
  %15 = extractelement <2 x float> %12, i64 1
  %16 = fdiv float 2.000000e+00, %15
  %17 = getelementptr inbounds i8, ptr %0, i64 20
  store float %16, ptr %17, align 4, !tbaa !5
  %18 = fsub float %6, %5
  %19 = fdiv float -2.000000e+00, %18
  %20 = getelementptr inbounds i8, ptr %0, i64 40
  store float %19, ptr %20, align 4, !tbaa !5
  %21 = fadd <2 x float> %11, %9
  %22 = getelementptr inbounds i8, ptr %0, i64 48
  %23 = fneg <2 x float> %21
  %24 = fdiv <2 x float> %23, %12
  store <2 x float> %24, ptr %22, align 4, !tbaa !5
  %25 = fadd float %5, %6
  %26 = fdiv float %25, %18
  %27 = getelementptr inbounds i8, ptr %0, i64 56
  store float %26, ptr %27, align 4, !tbaa !5
  ret ptr %0
}

attributes #0 = { 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" }

!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,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,TailCallElimPass