//
// Generated by dtk
// Translation Unit: J3DTransform.cpp
//

#include "JSystem/J3DGraphBase/J3DTransform.h"
#include "JSystem/J3DGraphBase/J3DStruct.h"
#include "dolphin/types.h"

/* 802DA0A8-802DA0B0       .text __MTGQR7__FUl */
void __MTGQR7(u32) {
    /* Nonmatching */
}

/* 802DA0B0-802DA0E8       .text J3DGQRSetup7__FUlUlUlUl */
void J3DGQRSetup7(u32, u32, u32, u32) {
    /* Nonmatching */
}

/* 802DA0E8-802DA120       .text J3DCalcZValue__FPA4_f3Vec */

// matches debug
f32 J3DCalcZValue(register MtxP m, register Vec v) {
    register f32 temp_f4;
    register f32 out;
    register f32 temp_f0;
    register f32 temp_f2;
    register f32 temp_f1 = 1.0f;

    // clang-format off
    asm {
        psq_l temp_f0, 0(v), 0, 0 /* qr0 */
        lfs temp_f2, 8(v)
        psq_l temp_f4, 32(m), 0, 0 /* qr0 */
        psq_l out, 40(m), 0, 0 /* qr0 */
        ps_merge00 temp_f2, temp_f2, temp_f1
        ps_mul temp_f4, temp_f0, temp_f4
        ps_madd out, temp_f2, out, temp_f4
        ps_sum0 out, out, out, out
    }
    // clang-format on

    return out;
}

/* 802DA120-802DA2E0       .text J3DCalcBBoardMtx__FPA4_f */
void J3DCalcBBoardMtx(f32(*)[4]) {
    /* Nonmatching */
}

/* 802DA2E0-802DA584       .text J3DCalcYBBoardMtx__FPA4_f */
void J3DCalcYBBoardMtx(f32(*)[4]) {
    /* Nonmatching */
}

/* 802DA584-802DA64C       .text J3DPSCalcInverseTranspose__FPA4_fPA3_f */
void J3DPSCalcInverseTranspose(f32(*)[4], f32(*)[3]) {
    /* Nonmatching */
}

/* 802DA64C-802DA724       .text J3DGetTranslateRotateMtx__FRC16J3DTransformInfoPA4_f */
void J3DGetTranslateRotateMtx(const J3DTransformInfo&, Mtx) {
    /* Nonmatching */
}

/* 802DA724-802DA7E4       .text J3DGetTranslateRotateMtx__FsssfffPA4_f */
void J3DGetTranslateRotateMtx(s16, s16, s16, f32, f32, f32, Mtx) {
    /* Nonmatching */
}

/* 802DA7E4-802DA8A8       .text J3DGetTextureMtx__FRC17J3DTextureSRTInfo3VecPA4_f */
void J3DGetTextureMtx(const J3DTextureSRTInfo&, Vec, f32(*)[4]) {
    /* Nonmatching */
}

/* 802DA8A8-802DA96C       .text J3DGetTextureMtxOld__FRC17J3DTextureSRTInfo3VecPA4_f */
void J3DGetTextureMtxOld(const J3DTextureSRTInfo&, Vec, f32(*)[4]) {
    /* Nonmatching */
}

/* 802DA96C-802DAA38       .text J3DGetTextureMtxMaya__FRC17J3DTextureSRTInfoPA4_f */
void J3DGetTextureMtxMaya(const J3DTextureSRTInfo&, f32(*)[4]) {
    /* Nonmatching */
}

/* 802DAA38-802DAB04       .text J3DGetTextureMtxMayaOld__FRC17J3DTextureSRTInfoPA4_f */
void J3DGetTextureMtxMayaOld(const J3DTextureSRTInfo&, f32(*)[4]) {
    /* Nonmatching */
}

/* 802DAB04-802DAB68       .text J3DScaleNrmMtx__FPA4_fRC3Vec */
void J3DScaleNrmMtx(f32(*)[4], const Vec&) {
    /* Nonmatching */
}

/* 802DAB68-802DABBC       .text J3DScaleNrmMtx33__FPA3_fRC3Vec */
void J3DScaleNrmMtx33(f32(*)[3], const Vec&) {
    /* Nonmatching */
}

/* 802DABBC-802DACE0       .text J3DMtxProjConcat__FPA4_fPA4_fPA4_f */
void J3DMtxProjConcat(f32(*)[4], f32(*)[4], f32(*)[4]) {
    /* Nonmatching */
}

/* 802DACE0-802DAD0C       .text J3DPSMtx33Copy__FPA3_fPA3_f */
void J3DPSMtx33Copy(register Mtx3P src, register Mtx3P dst) {
    register f32 x1_y1;
    register f32 z1_x2;
    register f32 y2_z2;
    register f32 x3_y3;
    register f32 z3;

    asm {
        psq_l x1_y1, 0(src), 0, 0
        psq_l z1_x2, 8(src), 0, 0
        psq_l y2_z2, 16(src), 0, 0
        psq_l x3_y3, 24(src), 0, 0
        lfs z3, 32(src)
        psq_st x1_y1, 0(dst), 0, 0
        psq_st z1_x2, 8(dst), 0, 0
        psq_st y2_z2, 16(dst), 0, 0
        psq_st x3_y3, 24(dst), 0, 0
        stfs z3, 32(dst)
    }
}

/* 802DAD0C-802DAD40       .text J3DPSMtx33CopyFrom34__FPA4_fPA3_f */
void J3DPSMtx33CopyFrom34(register MtxP src, register Mtx3P dst) {
    register f32 x_y1;
    register f32 z1;
    register f32 x_y2;
    register f32 z2;
    register f32 x_y3;
    register f32 z3;

    asm {
        psq_l x_y1, 0(src), 0, 0
        psq_st x_y1, 0(dst), 0, 0
        lfs z1, 8(src)
        stfs z1, 8(dst)
        psq_l x_y2, 16(src), 0, 0
        psq_st x_y2, 12(dst), 0, 0
        lfs z2, 0x18(src)
        stfs z2, 0x14(dst)
        psq_l x_y3, 32(src), 0, 0
        psq_st x_y3, 24(dst), 0, 0
        lfs z3, 0x28(src)
        stfs z3, 0x20(dst)
    }
}

/* 802DAD40-802DAE1C       .text J3DPSMtxArrayConcat__FPA4_fPA4_fPA4_fUl */
void J3DPSMtxArrayConcat(f32(*)[4], f32(*)[4], f32(*)[4], u32) {
    /* Nonmatching */
}
