<gh_stars>10-100
#include "types.h"

/*
    Generated from dpostproc

    .section .ctors, "wa"  # 0x80472F00 - 0x804732C0
        .4byte __sinit_PSMainSide_Sound_cpp

    .section .rodata  # 0x804732E0 - 0x8049E220
    .global lbl_8049DC30
    lbl_8049DC30:
        .4byte 0x00000000
        .4byte 0x00000000
        .4byte 0x00000000
    .global smACosPrm__Q23PSM7SeSound
    smACosPrm__Q23PSM7SeSound:
        .4byte 0x40490FD8
        .4byte 0x403C3D92
        .4byte 0x4036E62E
        .4byte 0x4032C782
        .4byte 0x402F49C3
        .4byte 0x402C323C
        .4byte 0x402962D8
        .4byte 0x4026C9C9
        .4byte 0x40245B68
        .4byte 0x40220FAE
        .4byte 0x401FE0BD
        .4byte 0x401DCA21
        .4byte 0x401BC871
        .4byte 0x4019D8F5
        .4byte 0x4017F96E
        .4byte 0x4016280B
        .4byte 0x40146345
        .4byte 0x4012A9D2
        .4byte 0x4010FA98
        .4byte 0x400F549B
        .4byte 0x400DB70F
        .4byte 0x400C212D
        .4byte 0x400A9258
        .4byte 0x400909F6
        .4byte 0x40078787
        .4byte 0x40060A91
        .4byte 0x400492A7
        .4byte 0x40031F64
        .4byte 0x4001B075
        .4byte 0x4000457C
        .4byte 0x3FFDBC6F
        .4byte 0x3FFAF4B6
        .4byte 0x3FF83340
        .4byte 0x3FF5779F
        .4byte 0x3FF2C15D
        .4byte 0x3FF01006
        .4byte 0x3FED633D
        .4byte 0x3FEABA95
        .4byte 0x3FE815B1
        .4byte 0x3FE57447
        .4byte 0x3FE2D5F1
        .4byte 0x3FE03A6D
        .4byte 0x3FDDA15E
        .4byte 0x3FDB0A81
        .4byte 0x3FD87582
        .4byte 0x3FD5E226
        .4byte 0x3FD3501A
        .4byte 0x3FD0BF1A
        .4byte 0x3FCE2EEC
        .4byte 0x3FCB9F45
        .4byte 0x3FC90FD8
        .4byte 0x3FC68073
        .4byte 0x3FC3F0CC
        .4byte 0x3FC16095
        .4byte 0x3FBECF9E
        .4byte 0x3FBC3D92
        .4byte 0x3FB9AA37
        .4byte 0x3FB71538
        .4byte 0x3FB47E5A
        .4byte 0x3FB1E54B
        .4byte 0x3FAF49C7
        .4byte 0x3FACAB71
        .4byte 0x3FAA0A07
        .4byte 0x3FA76523
        .4byte 0x3FA4BC7B
        .4byte 0x3FA20FB2
        .4byte 0x3F9F5E5B
        .4byte 0x3F9CA811
        .4byte 0x3F99EC70
        .4byte 0x3F972B02
        .4byte 0x3F946349
        .4byte 0x3F9194B8
        .4byte 0x3F8EBECF
        .4byte 0x3F8BE0E7
        .4byte 0x3F88FA6A
        .4byte 0x3F860A96
        .4byte 0x3F8310A1
        .4byte 0x3F800BC4
        .4byte 0x3F79F612
        .4byte 0x3F73BABA
        .4byte 0x3F6D6335
        .4byte 0x3F66ED03
        .4byte 0x3F605511
        .4byte 0x3F599829
        .4byte 0x3F52B25B
        .4byte 0x3F4B9F45
        .4byte 0x3F4459B8
        .4byte 0x3F3CDB9C
        .4byte 0x3F351D9B
        .4byte 0x3F2D16EC
        .4byte 0x3F24BC7B
        .4byte 0x3F1C00B9
        .4byte 0x3F12D1BF
        .4byte 0x3F09184C
        .4byte 0x3EFD67FD
        .4byte 0x3EE6ED03
        .4byte 0x3ECE30CB
        .4byte 0x3EB242D0
        .4byte 0x3E914D72
        .4byte 0x3E4D249E
        .4byte 0x00000000
    .global lbl_8049DDD0
    lbl_8049DDD0:
        .4byte 0x50534D61
        .4byte 0x696E5369
        .4byte 0x64655F53
        .4byte 0x6F756E64
        .4byte 0x2E637070
        .4byte 0x00000000
    .global lbl_8049DDE8
    lbl_8049DDE8:
        .asciz "P2Assert"
        .skip 3
        .4byte 0x5053436F
        .4byte 0x6D6D6F6E
        .4byte 0x2E680000
        .4byte 0x50535379
        .4byte 0x7374656D
        .4byte 0x49462E68
        .4byte 0x00000000
    .global lbl_8049DE10
    lbl_8049DE10:
        .4byte 0x50534761
        .4byte 0x6D652E68
        .4byte 0x00000000
        .4byte 0x50535363
        .4byte 0x656E652E
        .4byte 0x68000000
        .4byte 0x0A534520
        .4byte 0x63616C6C
        .4byte 0x65642061
        .4byte 0x7420696E
        .4byte 0x76616C69
        .4byte 0x64207469
        .4byte 0x6D6D696E
        .4byte 0x670A2825
        .4byte 0x30387829
        .4byte 0x0A000000
        .4byte 0x67657420
        .4byte 0x736F756E
        .4byte 0x64207363
        .4byte 0x656E6520
        .4byte 0x61740A69
        .4byte 0x6E76616C
        .4byte 0x69642074
        .4byte 0x696D6D69
        .4byte 0x6E670A00
        .4byte 0x00000000

    .section .data, "wa"  # 0x8049E220 - 0x804EFC20
    .global lbl_804EF9A8
    lbl_804EF9A8:
        .4byte 0x00000000
        .4byte 0x00000000
        .4byte 0x00000000
    .global __vt__Q23PSM7SeSound
    __vt__Q23PSM7SeSound:
        .4byte 0
        .4byte 0
        .4byte setPortData__5JAISeFUcUs
        .4byte getPortData__5JAISeFUc
        .4byte start__8JAISoundFUl
        .4byte stop__5JAISeFUl
        .4byte release__8JAISoundFv
        .4byte setVolume__5JAISeFfUlUc
        .4byte getVolume__5JAISeFUc
        .4byte setPan__5JAISeFfUlUc
        .4byte getPan__5JAISeFUc
        .4byte setPitch__5JAISeFfUlUc
        .4byte getPitch__5JAISeFUc
        .4byte setFxmix__5JAISeFfUlUc
        .4byte getFxmix__5JAISeFUc
        .4byte setDolby__5JAISeFfUlUc
        .4byte getDolby__5JAISeFUc
        .4byte setTempoProportion__8JAISoundFfUl
        .4byte getTempoProportion__8JAISoundFv
        .4byte setVolumeU7__5JAISeFUcUlUc
        .4byte getVolumeU7__5JAISeFUc
        .4byte setPanU7__5JAISeFUcUlUc
        .4byte getPanU7__5JAISeFUc
        .4byte setFxmixU7__5JAISeFUcUlUc
        .4byte getFxmixU7__5JAISeFUc
        .4byte setDolbyU7__5JAISeFUcUlUc
        .4byte getDolbyU7__5JAISeFUc
        .4byte setDirectVolume__8JAISoundFfUl
        .4byte setDirectPan__8JAISoundFfUl
        .4byte setDirectPitch__8JAISoundFfUl
        .4byte setDirectFxmix__8JAISoundFfUl
        .4byte setDirectDolby__8JAISoundFfUl
        .4byte setDemoVolume__8JAISoundFfUl
        .4byte setDemoPan__8JAISoundFfUl
        .4byte setDemoPitch__8JAISoundFfUl
        .4byte setDemoFxmix__8JAISoundFfUl
        .4byte setDemoDolby__8JAISoundFfUl
        .4byte setDemoVolumeU7__8JAISoundFUcUl
        .4byte setDemoPanU7__8JAISoundFUcUl
        .4byte setDemoFxmixU7__8JAISoundFUcUl
        .4byte setDemoDolbyU7__8JAISoundFUcUl
        .4byte getFadeCounter__5JAISeFv
        .4byte setPrepareFlag__8JAISoundFUc
        .4byte checkReady__8JAISoundFv
        .4byte setDistanceParameterMoveTime__8JAISoundFUc
        .4byte setAdjustPriority__8JAISoundFs
        .4byte setPositionDopplarCommon__8JAISoundFUl
        .4byte setDistanceVolumeCommon__Q23PSM7SeSoundFfUc
        .4byte setDistancePanCommon__8JAISoundFv
        .4byte setDistanceDolbyCommon__8JAISoundFv
        .4byte
   initParameter__Q23PSM7SeSoundFPvPQ27JAInter5ActorUlUlUcPQ27JAInter9SoundInfo
        .4byte onGet__Q23PSM7SeSoundFv
        .4byte onRelease__Q23PSM7SeSoundFv
        .4byte setSeDistanceParameters__5JAISeFv
        .4byte setSeDistanceVolume__5JAISeFUc
        .4byte setSeDistancePan__Q23PSM7SeSoundFUc
        .4byte setSeDistancePitch__5JAISeFUc
        .4byte setSeDistanceFxmix__5JAISeFUc
        .4byte setSeDistanceFir__5JAISeFUc
        .4byte setSeDistanceDolby__Q23PSM7SeSoundFUc
        .4byte setSePositionDopplar__5JAISeFv

    .section .sdata, "wa"  # 0x80514680 - 0x80514D80
    .global cDol_0Rad__Q23PSM7SeSound
    cDol_0Rad__Q23PSM7SeSound:
        .float 1.0316
    .global cDol_HalfRad__Q23PSM7SeSound
    cDol_HalfRad__Q23PSM7SeSound:
        .float 1.5708
    .global cDol_FullRad__Q23PSM7SeSound
    cDol_FullRad__Q23PSM7SeSound:
        .float 2.11
    .global cPan_MaxAmp__Q23PSM7SeSound
    cPan_MaxAmp__Q23PSM7SeSound:
        .float 0.98
    .global cCenterRad__Q23PSM7SeSound
    cCenterRad__Q23PSM7SeSound:
        .float 1.57

    .section .sbss # 0x80514D80 - 0x80516360
    .global lbl_80516330
    lbl_80516330:
        .skip 0x4
    .global lbl_80516334
    lbl_80516334:
        .skip 0x4
    .global panRatio$3853
    panRatio$3853:
        .skip 0x4
    .global init$3854_1
    init$3854_1:
        .skip 0x4

    .section .sdata2, "a"     # 0x80516360 - 0x80520E40
    .global lbl_80520D90
    lbl_80520D90:
        .float 1.0
    .global lbl_80520D94
    lbl_80520D94:
        .4byte 0x00000000
    .global lbl_80520D98
    lbl_80520D98:
        .4byte 0x42480000
    .global lbl_80520D9C
    lbl_80520D9C:
        .4byte 0x41700000
    .global lbl_80520DA0
    lbl_80520DA0:
        .4byte 0x43300000
        .4byte 0x00000000
    .global lbl_80520DA8
    lbl_80520DA8:
        .float 0.5
    .global lbl_80520DAC
    lbl_80520DAC:
        .4byte 0x40490E56
*/

namespace PSM {

/*
 * --INFO--
 * Address:	80470F0C
 * Size:	000078
 */
void SeSound::makeSeSound()
{
	/*
	stwu     r1, -0x10(r1)
	mflr     r0
	li       r3, 0x4a4
	stw      r0, 0x14(r1)
	stw      r31, 0xc(r1)
	bl       __nw__FUl
	or.      r31, r3, r3
	beq      lbl_80470F6C
	bl       __ct__5JAISeFv
	lis      r3, __vt__Q23PSM7SeSound@ha
	lfs      f1, lbl_80520D90@sda21(r2)
	addi     r0, r3, __vt__Q23PSM7SeSound@l
	lfs      f0, lbl_80520D94@sda21(r2)
	stw      r0, 0x10(r31)
	li       r0, 0
	stfs     f1, 0x484(r31)
	stfs     f0, 0x488(r31)
	stfs     f0, 0x48c(r31)
	stfs     f0, 0x490(r31)
	stfs     f0, 0x494(r31)
	stb      r0, 0x498(r31)
	stb      r0, 0x499(r31)
	stb      r0, 0x49c(r31)
	stfs     f1, 0x4a0(r31)

lbl_80470F6C:
	lwz      r0, 0x14(r1)
	mr       r3, r31
	lwz      r31, 0xc(r1)
	mtlr     r0
	addi     r1, r1, 0x10
	blr
	*/
}

/*
 * --INFO--
 * Address:	80470F84
 * Size:	000004
 */
void SeSound::onGet() { }

/*
 * --INFO--
 * Address:	80470F88
 * Size:	0000A4
 */
void SeSound::onRelease()
{
	/*
	stwu     r1, -0x10(r1)
	mflr     r0
	lis      r4, lbl_8049DC30@ha
	stw      r0, 0x14(r1)
	stw      r31, 0xc(r1)
	addi     r31, r4, lbl_8049DC30@l
	stw      r30, 8(r1)
	lbz      r0, 0x1a(r3)
	cmplwi   r0, 0
	beq      lbl_80471014
	lwz      r0, 0x38(r3)
	cmplwi   r0, 0
	beq      lbl_80471014
	mr       r30, r0
	bne      lbl_80470FD8
	addi     r3, r31, 0x1a0
	addi     r5, r31, 0x1b8
	li       r4, 0xb8
	crclr    6
	bl       panic_f__12JUTExceptionFPCciPCce

lbl_80470FD8:
	mr       r3, r30
	bl       getPlayingHandleNum__Q23PSM8CreatureFv
	clrlwi.  r0, r3, 0x18
	bne      lbl_80471014
	lwz      r0,
"sInstance__Q28PSSystem28SingletonBase<Q23PSM6ObjMgr>"@sda21(r13) cmplwi   r0, 0
	bne      lbl_80471008
	addi     r3, r31, 0x1c4
	addi     r5, r31, 0x1b8
	li       r4, 0x89
	crclr    6
	bl       panic_f__12JUTExceptionFPCciPCce

lbl_80471008:
	lwz      r3,
"sInstance__Q28PSSystem28SingletonBase<Q23PSM6ObjMgr>"@sda21(r13) mr       r4,
r30 bl       remove__10JSUPtrListFP10JSUPtrLink

lbl_80471014:
	lwz      r0, 0x14(r1)
	lwz      r31, 0xc(r1)
	lwz      r30, 8(r1)
	mtlr     r0
	addi     r1, r1, 0x10
	blr
	*/
}

/*
 * --INFO--
 * Address:	8047102C
 * Size:	000154
 */
void SeSound::initParameter(void*, JAInter::Actor*, unsigned long, unsigned long, unsigned char, JAInter::SoundInfo*)
{
	/*
	.loc_0x0:
	  stwu      r1, -0x20(r1)
	  mflr      r0
	  lis       r10, 0x804A
	  stw       r0, 0x24(r1)
	  stw       r31, 0x1C(r1)
	  subi      r31, r10, 0x23D0
	  stw       r30, 0x18(r1)
	  stw       r29, 0x14(r1)
	  mr        r29, r9
	  stw       r28, 0x10(r1)
	  mr        r28, r3
	  bl        -0x3BBA44
	  li        r0, 0
	  stb       r0, 0x498(r28)
	  lbz       r0, 0x1A(r28)
	  cmplwi    r0, 0
	  beq-      .loc_0xA8
	  lwz       r0, 0x38(r28)
	  cmplwi    r0, 0
	  beq-      .loc_0xA8
	  mr        r30, r0
	  bne-      .loc_0x6C
	  addi      r3, r31, 0x1A0
	  addi      r5, r31, 0x1B8
	  li        r4, 0xD0
	  crclr     6, 0x6
	  bl        -0x446A54

	.loc_0x6C:
	  mr        r3, r30
	  bl        -0x13E48
	  rlwinm.   r0,r3,0,24,31
	  bne-      .loc_0xA8
	  lwz       r0, -0x6E44(r13)
	  cmplwi    r0, 0
	  bne-      .loc_0x9C
	  addi      r3, r31, 0x1C4
	  addi      r5, r31, 0x1B8
	  li        r4, 0x89
	  crclr     6, 0x6
	  bl        -0x446A84

	.loc_0x9C:
	  lwz       r3, -0x6E44(r13)
	  mr        r4, r30
	  bl        -0x44A7EC

	.loc_0xA8:
	  cmplwi    r29, 0
	  bne-      .loc_0xC4
	  addi      r3, r31, 0x1A0
	  addi      r5, r31, 0x1B8
	  li        r4, 0xD7
	  crclr     6, 0x6
	  bl        -0x446AAC

	.loc_0xC4:
	  lwz       r0, 0x0(r29)
	  rlwinm.   r30,r0,4,28,31
	  beq-      .loc_0x12C
	  bl        -0x3B6C08
	  lis       r0, 0x4330
	  stw       r30, 0xC(r1)
	  lfd       f3, 0x2A40(r2)
	  stw       r0, 0x8(r1)
	  lfs       f0, 0x2A3C(r2)
	  lfd       f2, 0x8(r1)
	  lfs       f4, 0x2A34(r2)
	  fsubs     f2, f2, f3
	  fdivs     f0, f2, f0
	  fmuls     f0, f0, f1
	  stfs      f0, 0x4A0(r28)
	  lfs       f0, 0x4A0(r28)
	  fcmpo     cr0, f0, f4
	  bge-      .loc_0x110
	  b         .loc_0x124

	.loc_0x110:
	  lfs       f4, 0x2A30(r2)
	  fcmpo     cr0, f0, f4
	  ble-      .loc_0x120
	  b         .loc_0x124

	.loc_0x120:
	  fmr       f4, f0

	.loc_0x124:
	  stfs      f4, 0x4A0(r28)
	  b         .loc_0x134

	.loc_0x12C:
	  lfs       f0, 0x2A34(r2)
	  stfs      f0, 0x4A0(r28)

	.loc_0x134:
	  lwz       r0, 0x24(r1)
	  lwz       r31, 0x1C(r1)
	  lwz       r30, 0x18(r1)
	  lwz       r29, 0x14(r1)
	  lwz       r28, 0x10(r1)
	  mtlr      r0
	  addi      r1, r1, 0x20
	  blr
	*/
}

/*
 * --INFO--
 * Address:	80471180
 * Size:	0002D8
 */
void SeSound::setDistanceVolumeCommon(float, unsigned char)
{
	/*
	stwu     r1, -0x40(r1)
	mflr     r0
	stw      r0, 0x44(r1)
	stfd     f31, 0x30(r1)
	psq_st   f31, 56(r1), 0, qr0
	stfd     f30, 0x20(r1)
	psq_st   f30, 40(r1), 0, qr0
	stw      r31, 0x1c(r1)
	stw      r30, 0x18(r1)
	stw      r29, 0x14(r1)
	lwz      r12, 0x10(r3)
	lis      r5, lbl_8049DC30@ha
	mr       r29, r4
	mr       r31, r3
	lwz      r12, 0x34(r12)
	addi     r30, r5, lbl_8049DC30@l
	lfs      f1, cSeFxMix__Q23PSM11CreaturePrm@sda21(r2)
	li       r4, 0
	li       r5, 1
	mtctr    r12
	bctrl
	lwz      r0, 0x20(r31)
	lwz      r3, 0x34(r31)
	rlwinm.  r4, r0, 2, 0x1e, 0x1f
	lfs      f31, 0x18(r3)
	rlwinm   r3, r0, 0x14, 0x1c, 0x1f
	bne      lbl_804711F0
	b        lbl_80471244

lbl_804711F0:
	cmplwi   r4, 2
	bne      lbl_80471210
	addi     r3, r30, 0x1d0
	addi     r5, r30, 0x1b8
	li       r4, 0x1f
	crclr    6
	bl       panic_f__12JUTExceptionFPCciPCce
	b        lbl_8047122C

lbl_80471210:
	cmplwi   r4, 3
	bne      lbl_8047122C
	addi     r3, r30, 0x1d0
	addi     r5, r30, 0x1b8
	li       r4, 0x23
	crclr    6
	bl       panic_f__12JUTExceptionFPCciPCce

lbl_8047122C:
	addi     r3, r30, 0x1d0
	addi     r5, r30, 0x1b8
	li       r4, 0x25
	crclr    6
	bl       panic_f__12JUTExceptionFPCciPCce
	li       r3, 0

lbl_80471244:
	lbz      r0, 0x498(r31)
	clrlwi   r4, r3, 0x18
	cmplwi   r0, 1
	bne      lbl_80471264
	fmr      f1, f31
	mr       r3, r31
	bl       calcVolumeSpecialized__Q23PSM7SeSoundFf
	b        lbl_80471270

lbl_80471264:
	fmr      f1, f31
	mr       r3, r29
	bl       calcVolume__Q23PSM7SeSoundFfUcUc

lbl_80471270:
	lfs      f0, 0x4a0(r31)
	lbz      r0, 0x1a(r31)
	fsubs    f30, f1, f0
	cmplwi   r0, 0
	beq      lbl_80471290
	lwz      r0, 0x38(r31)
	cmplwi   r0, 0
	beq      lbl_80471408

lbl_80471290:
	lwz      r0, spSceneMgr__8PSSystem@sda21(r13)
	cmplwi   r0, 0
	bne      lbl_804712B0
	addi     r3, r30, 0x1e0
	addi     r5, r30, 0x1b8
	li       r4, 0x1d3
	crclr    6
	bl       panic_f__12JUTExceptionFPCciPCce

lbl_804712B0:
	lwz      r29, spSceneMgr__8PSSystem@sda21(r13)
	cmplwi   r29, 0
	bne      lbl_804712D0
	addi     r3, r30, 0x1e0
	addi     r5, r30, 0x1b8
	li       r4, 0x1dc
	crclr    6
	bl       panic_f__12JUTExceptionFPCciPCce

lbl_804712D0:
	lwz      r0, 8(r29)
	cmplwi   r0, 0
	bne      lbl_804712F0
	addi     r3, r30, 0x1ec
	addi     r5, r30, 0x1b8
	li       r4, 0xa1
	crclr    6
	bl       panic_f__12JUTExceptionFPCciPCce

lbl_804712F0:
	lwz      r29, 8(r29)
	cmplwi   r29, 0
	bne      lbl_80471310
	addi     r3, r30, 0x1a0
	addi     r5, r30, 0x1b8
	li       r4, 0x105
	crclr    6
	bl       panic_f__12JUTExceptionFPCciPCce

lbl_80471310:
	mr       r3, r29
	lbz      r4, 0x49c(r31)
	lwz      r12, 0(r29)
	lwz      r12, 0x28(r12)
	mtctr    r12
	bctrl
	fmr      f31, f1
	lfs      f0, lbl_80520D94@sda21(r2)
	fcmpu    cr0, f0, f31
	bne      lbl_80471350
	lwz      r6, 0x20(r31)
	addi     r3, r30, 0x1a0
	addi     r5, r30, 0x1f8
	li       r4, 0x10d
	crclr    6
	bl       panic_f__12JUTExceptionFPCciPCce

lbl_80471350:
	lwz      r0, spSceneMgr__8PSSystem@sda21(r13)
	fmuls    f30, f30, f31
	cmplwi   r0, 0
	bne      lbl_80471374
	addi     r3, r30, 0x1e0
	addi     r5, r30, 0x1b8
	li       r4, 0x1d3
	crclr    6
	bl       panic_f__12JUTExceptionFPCciPCce

lbl_80471374:
	lwz      r29, spSceneMgr__8PSSystem@sda21(r13)
	cmplwi   r29, 0
	bne      lbl_80471394
	addi     r3, r30, 0x1e0
	addi     r5, r30, 0x1b8
	li       r4, 0x1dc
	crclr    6
	bl       panic_f__12JUTExceptionFPCciPCce

lbl_80471394:
	lwz      r0, 4(r29)
	cmplwi   r0, 0
	bne      lbl_804713B4
	addi     r3, r30, 0x1ec
	addi     r5, r30, 0x1b8
	li       r4, 0xcf
	crclr    6
	bl       panic_f__12JUTExceptionFPCciPCce

lbl_804713B4:
	lwz      r3, 4(r29)
	lwz      r29, 4(r3)
	cmplwi   r29, 0
	bne      lbl_804713D8
	addi     r3, r30, 0x1ec
	addi     r5, r30, 0x220
	li       r4, 0xd1
	crclr    6
	bl       panic_f__12JUTExceptionFPCciPCce

lbl_804713D8:
	mr       r3, r29
	lwz      r12, 0(r29)
	lwz      r12, 0x30(r12)
	mtctr    r12
	bctrl
	mr       r3, r31
	li       r4, 0
	lwz      r12, 0x10(r31)
	li       r5, 2
	lwz      r12, 0x34(r12)
	mtctr    r12
	bctrl

lbl_80471408:
	lfs      f1, lbl_80520D94@sda21(r2)
	fcmpo    cr0, f30, f1
	bge      lbl_80471418
	b        lbl_8047142C

lbl_80471418:
	lfs      f1, lbl_80520D90@sda21(r2)
	fcmpo    cr0, f30, f1
	ble      lbl_80471428
	b        lbl_8047142C

lbl_80471428:
	fmr      f1, f30

lbl_8047142C:
	psq_l    f31, 56(r1), 0, qr0
	lfd      f31, 0x30(r1)
	psq_l    f30, 40(r1), 0, qr0
	lfd      f30, 0x20(r1)
	lwz      r31, 0x1c(r1)
	lwz      r30, 0x18(r1)
	lwz      r0, 0x44(r1)
	lwz      r29, 0x14(r1)
	mtlr     r0
	addi     r1, r1, 0x40
	blr
	*/
}

/*
 * --INFO--
 * Address:	80471458
 * Size:	000044
 */
void SeSound::specializePerspCalc(const PSGame::SoundTable::SePerspInfo&)
{
	/*
	lfs      f0, 0(r4)
	li       r0, 1
	lfs      f1, 4(r4)
	stfs     f0, 0x484(r3)
	lfs      f0, 8(r4)
	stfs     f1, 0x488(r3)
	lfs      f1, 0xc(r4)
	stfs     f0, 0x48c(r3)
	lfs      f0, 0x10(r4)
	stfs     f1, 0x490(r3)
	lbz      r5, 0x14(r4)
	stfs     f0, 0x494(r3)
	lbz      r4, 0x15(r4)
	stb      r5, 0x498(r3)
	stb      r4, 0x499(r3)
	stb      r0, 0x498(r3)
	blr
	*/
}

/*
 * --INFO--
 * Address:	8047149C
 * Size:	00006C
 */
void SeSound::calcVolumeSpecialized(float)
{
	/*
	stwu     r1, -0x20(r1)
	mflr     r0
	stw      r0, 0x24(r1)
	stfd     f31, 0x18(r1)
	fmr      f31, f1
	stw      r31, 0x14(r1)
	mr       r31, r3
	lbz      r0, 0x498(r3)
	cmplwi   r0, 1
	beq      lbl_804714E0
	lis      r3, lbl_8049DDD0@ha
	lis      r5, lbl_8049DDE8@ha
	addi     r3, r3, lbl_8049DDD0@l
	li       r4, 0x126
	addi     r5, r5, lbl_8049DDE8@l
	crclr    6
	bl       panic_f__12JUTExceptionFPCciPCce

lbl_804714E0:
	fmr      f1, f31
	addi     r3, r31, 0x484
	li       r4, 0
	bl       getDistVol__Q36PSGame10SoundTable11SePerspInfoFfUc
	lwz      r0, 0x24(r1)
	lfd      f31, 0x18(r1)
	lwz      r31, 0x14(r1)
	mtlr     r0
	addi     r1, r1, 0x20
	blr
	*/
}

/*
 * --INFO--
 * Address:	80471508
 * Size:	00008C
 */
void SeSound::calcVolume(float, unsigned char, unsigned char)
{
	/*
	stwu     r1, -0x20(r1)
	mflr     r0
	stw      r0, 0x24(r1)
	stfd     f31, 0x18(r1)
	fmr      f31, f1
	stw      r31, 0x14(r1)
	stw      r30, 0x10(r1)
	rlwinm   r30, r4, 2, 0x16, 0x1d
	stw      r29, 0xc(r1)
	mr       r29, r3
	lwz      r31,
"sInstance__Q28PSSystem49SingletonBase<Q36PSGame10SoundTable11CategoryMgr>"@sda21(r13)
	add      r3, r31, r30
	lwz      r0, 4(r3)
	cmplwi   r0, 0
	bne      lbl_80471560
	lis      r3, lbl_8049DE10@ha
	lis      r5, lbl_8049DDE8@ha
	addi     r3, r3, lbl_8049DE10@l
	li       r4, 0x5d
	addi     r5, r5, lbl_8049DDE8@l
	crclr    6
	bl       panic_f__12JUTExceptionFPCciPCce

lbl_80471560:
	add      r3, r31, r30
	fmr      f1, f31
	lwz      r3, 4(r3)
	mr       r4, r29
	bl       getDistVol__Q36PSGame10SoundTable11SePerspInfoFfUc
	lwz      r0, 0x24(r1)
	lfd      f31, 0x18(r1)
	lwz      r31, 0x14(r1)
	lwz      r30, 0x10(r1)
	lwz      r29, 0xc(r1)
	mtlr     r0
	addi     r1, r1, 0x20
	blr
	*/
}

/*
 * --INFO--
 * Address:	80471594
 * Size:	0000B8
 */
void SeSound::setSeDistancePan(unsigned char)
{
	/*
	stwu     r1, -0x20(r1)
	mflr     r0
	lfs      f1, lbl_80520DA8@sda21(r2)
	stw      r0, 0x24(r1)
	stw      r31, 0x1c(r1)
	stw      r30, 0x18(r1)
	mr       r30, r4
	stw      r29, 0x14(r1)
	mr       r29, r3
	lbz      r0, 0x1a(r3)
	cmplwi   r0, 0
	bne      lbl_804715D4
	lwz      r3, 0x34(r29)
	lfs      f1, 0x18(r3)
	bl       calcPan__Q23PSM7SeSoundFRC3Vecf
	b        lbl_8047161C

lbl_804715D4:
	lwz      r0, 0x38(r29)
	cmplwi   r0, 0
	beq      lbl_8047161C
	mr       r31, r0
	bne      lbl_80471604
	lis      r3, lbl_8049DDD0@ha
	lis      r5, lbl_8049DDE8@ha
	addi     r3, r3, lbl_8049DDD0@l
	li       r4, 0x151
	addi     r5, r5, lbl_8049DDE8@l
	crclr    6
	bl       panic_f__12JUTExceptionFPCciPCce

lbl_80471604:
	mr       r3, r31
	lwz      r12, 0x28(r31)
	lwz      r12, 0x24(r12)
	mtctr    r12
	bctrl
	lfs      f1, 0x38(r3)

lbl_8047161C:
	mr       r3, r29
	clrlwi   r5, r30, 0x18
	li       r4, 4
	li       r6, 0
	bl       setSeInterPan__5JAISeFUcfUlUc
	lwz      r0, 0x24(r1)
	lwz      r31, 0x1c(r1)
	lwz      r30, 0x18(r1)
	lwz      r29, 0x14(r1)
	mtlr     r0
	addi     r1, r1, 0x20
	blr
	*/
}

/*
 * --INFO--
 * Address:	8047164C
 * Size:	0000C8
 */
void SeSound::calcPan(const Vec&, float)
{
	/*
	lfs      f0, lbl_80520D94@sda21(r2)
	stwu     r1, -0x10(r1)
	fcmpo    cr0, f1, f0
	cror     2, 0, 2
	bne      lbl_80471668
	lfs      f2, cCenterRad__Q23PSM7SeSound@sda21(r13)
	b        lbl_804716CC

lbl_80471668:
	lfs      f0, 0(r3)
	lfs      f2, lbl_80520D90@sda21(r2)
	fneg     f0, f0
	lfs      f3, lbl_80520D98@sda21(r2)
	fdivs    f0, f0, f1
	fadds    f0, f2, f0
	fmuls    f0, f3, f0
	fctiwz   f0, f0
	stfd     f0, 8(r1)
	lwz      r0, 0xc(r1)
	cmpwi    r0, 0
	bge      lbl_804716A4
	lis      r3, smACosPrm__Q23PSM7SeSound@ha
	lfs      f2, smACosPrm__Q23PSM7SeSound@l(r3)
	b        lbl_804716CC

lbl_804716A4:
	cmpwi    r0, 0x65
	blt      lbl_804716BC
	lis      r3, smACosPrm__Q23PSM7SeSound@ha
	addi     r3, r3, smACosPrm__Q23PSM7SeSound@l
	lfs      f2, 0x190(r3)
	b        lbl_804716CC

lbl_804716BC:
	lis      r3, smACosPrm__Q23PSM7SeSound@ha
	slwi     r0, r0, 2
	addi     r3, r3, smACosPrm__Q23PSM7SeSound@l
	lfsx     f2, r3, r0

lbl_804716CC:
	lbz      r0, init$3854_1@sda21(r13)
	extsb.   r0, r0
	bne      lbl_804716F0
	lfs      f1, cPan_MaxAmp__Q23PSM7SeSound@sda21(r13)
	li       r0, 1
	lfs      f0, lbl_80520DAC@sda21(r2)
	stb      r0, init$3854_1@sda21(r13)
	fdivs    f0, f1, f0
	stfs     f0, panRatio$3853@sda21(r13)

lbl_804716F0:
	lfs      f0, panRatio$3853@sda21(r13)
	lfs      f1, lbl_80520D90@sda21(r2)
	fmuls    f0, f0, f2
	fcmpo    cr0, f0, f1
	ble      lbl_80471708
	b        lbl_8047170C

lbl_80471708:
	fmr      f1, f0

lbl_8047170C:
	addi     r1, r1, 0x10
	blr
	*/
}

/*
 * --INFO--
 * Address:	80471714
 * Size:	000088
 */
void SeSound::setSeDistanceDolby(unsigned char)
{
	/*
	stwu     r1, -0x10(r1)
	mflr     r0
	lfs      f1, lbl_80520D94@sda21(r2)
	stw      r0, 0x14(r1)
	stw      r31, 0xc(r1)
	mr       r31, r4
	stw      r30, 8(r1)
	mr       r30, r3
	lbz      r0, 0x1a(r3)
	cmplwi   r0, 0
	bne      lbl_80471750
	lwz      r3, 0x34(r30)
	lfs      f1, 0x18(r3)
	bl       calcDolby__Q23PSM7SeSoundFRC3Vecf
	b        lbl_80471770

lbl_80471750:
	lwz      r3, 0x38(r30)
	cmplwi   r3, 0
	beq      lbl_80471770
	lwz      r12, 0x28(r3)
	lwz      r12, 0x24(r12)
	mtctr    r12
	bctrl
	lfs      f1, 0x3c(r3)

lbl_80471770:
	mr       r3, r30
	clrlwi   r5, r31, 0x18
	li       r4, 4
	li       r6, 0
	bl       setSeInterDolby__5JAISeFUcfUlUc
	lwz      r0, 0x14(r1)
	lwz      r31, 0xc(r1)
	lwz      r30, 8(r1)
	mtlr     r0
	addi     r1, r1, 0x10
	blr
	*/
}

/*
 * --INFO--
 * Address:	8047179C
 * Size:	00010C
 */
void SeSound::calcDolby(const Vec&, float)
{
	/*
	lfs      f0, lbl_80520D94@sda21(r2)
	stwu     r1, -0x10(r1)
	fcmpo    cr0, f1, f0
	cror     2, 0, 2
	bne      lbl_804717B8
	fmr      f1, f0
	b        lbl_804718A0

lbl_804717B8:
	lfs      f0, 8(r3)
	lfs      f2, lbl_80520D90@sda21(r2)
	fneg     f0, f0
	lfs      f3, lbl_80520D98@sda21(r2)
	fdivs    f0, f0, f1
	fadds    f0, f2, f0
	fmuls    f0, f3, f0
	fctiwz   f0, f0
	stfd     f0, 8(r1)
	lwz      r0, 0xc(r1)
	cmpwi    r0, 0
	bge      lbl_804717F4
	lis      r3, smACosPrm__Q23PSM7SeSound@ha
	lfs      f0, smACosPrm__Q23PSM7SeSound@l(r3)
	b        lbl_8047181C

lbl_804717F4:
	cmpwi    r0, 0x65
	blt      lbl_8047180C
	lis      r3, smACosPrm__Q23PSM7SeSound@ha
	addi     r3, r3, smACosPrm__Q23PSM7SeSound@l
	lfs      f0, 0x190(r3)
	b        lbl_8047181C

lbl_8047180C:
	lis      r3, smACosPrm__Q23PSM7SeSound@ha
	slwi     r0, r0, 2
	addi     r3, r3, smACosPrm__Q23PSM7SeSound@l
	lfsx     f0, r3, r0

lbl_8047181C:
	lfs      f3, cDol_0Rad__Q23PSM7SeSound@sda21(r13)
	fcmpo    cr0, f0, f3
	bge      lbl_80471830
	lfs      f0, lbl_80520D94@sda21(r2)
	b        lbl_8047187C

lbl_80471830:
	lfs      f4, cDol_HalfRad__Q23PSM7SeSound@sda21(r13)
	fcmpo    cr0, f0, f4
	bge      lbl_80471854
	fsubs    f1, f4, f3
	lfs      f2, lbl_80520DA8@sda21(r2)
	fsubs    f0, f0, f3
	fdivs    f1, f2, f1
	fmuls    f0, f1, f0
	b        lbl_8047187C

lbl_80471854:
	lfs      f1, cDol_FullRad__Q23PSM7SeSound@sda21(r13)
	fcmpo    cr0, f0, f1
	bge      lbl_80471878
	fsubs    f1, f1, f4
	lfs      f2, lbl_80520DA8@sda21(r2)
	fsubs    f0, f0, f4
	fdivs    f1, f2, f1
	fmadds   f0, f1, f0, f2
	b        lbl_8047187C

lbl_80471878:
	lfs      f0, lbl_80520D90@sda21(r2)

lbl_8047187C:
	lfs      f1, lbl_80520D90@sda21(r2)
	fcmpo    cr0, f0, f1
	ble      lbl_8047188C
	b        lbl_804718A0

lbl_8047188C:
	lfs      f1, lbl_80520D94@sda21(r2)
	fcmpo    cr0, f0, f1
	bge      lbl_8047189C
	b        lbl_804718A0

lbl_8047189C:
	fmr      f1, f0

lbl_804718A0:
	addi     r1, r1, 0x10
	blr
	*/
}

} // namespace PSM

/*
 * --INFO--
 * Address:	804718A8
 * Size:	000028
 */
void __sinit_PSMainSide_Sound_cpp(void)
{
	/*
	lis      r4, __float_nan@ha
	li       r0, -1
	lfs      f0, __float_nan@l(r4)
	lis      r3, lbl_804EF9A8@ha
	stw      r0, lbl_80516330@sda21(r13)
	stfsu    f0, lbl_804EF9A8@l(r3)
	stfs     f0, lbl_80516334@sda21(r13)
	stfs     f0, 4(r3)
	stfs     f0, 8(r3)
	blr
	*/
}
