.include "macros.inc"

.comm lbl_8059FBAC, 0xC, 4
.comm lbl_8059FBB8, 0xC, 4 # MWCC .comm bug
.comm lbl_8059FBC4, 0xC, 4

.section .ctors, "wa"
lbl_ctor:
.4byte __sinit_CWorldLight_cpp

.section .sdata
.balign 8

.global lbl_805A8610
lbl_805A8610:
	# ROM: 0x3F5FB0
	.float 1.0

.global lbl_805A8614
lbl_805A8614:
	# ROM: 0x3F5FB4
	.float 1.0

.global lbl_805A8618
lbl_805A8618:
	# ROM: 0x3F5FB8
	.float 1.0
	.4byte 0

.section .text, "ax"

.global GetAsCGraphicsLight__11CWorldLightCFv
GetAsCGraphicsLight__11CWorldLightCFv:
/* 802A75FC 002A455C  94 21 FF 00 */	stwu r1, -0x100(r1)
/* 802A7600 002A4560  7C 08 02 A6 */	mflr r0
/* 802A7604 002A4564  90 01 01 04 */	stw r0, 0x104(r1)
/* 802A7608 002A4568  DB E1 00 F0 */	stfd f31, 0xf0(r1)
/* 802A760C 002A456C  F3 E1 00 F8 */	psq_st f31, 248(r1), 0, qr0
/* 802A7610 002A4570  93 E1 00 EC */	stw r31, 0xec(r1)
/* 802A7614 002A4574  93 C1 00 E8 */	stw r30, 0xe8(r1)
/* 802A7618 002A4578  93 A1 00 E4 */	stw r29, 0xe4(r1)
/* 802A761C 002A457C  93 81 00 E0 */	stw r28, 0xe0(r1)
/* 802A7620 002A4580  C0 24 00 04 */	lfs f1, 4(r4)
/* 802A7624 002A4584  7C 7C 1B 78 */	mr r28, r3
/* 802A7628 002A4588  C0 44 00 08 */	lfs f2, 8(r4)
/* 802A762C 002A458C  7C 9D 23 78 */	mr r29, r4
/* 802A7630 002A4590  C0 64 00 0C */	lfs f3, 0xc(r4)
/* 802A7634 002A4594  3B E1 00 2C */	addi r31, r1, 0x2c
/* 802A7638 002A4598  D0 21 00 28 */	stfs f1, 0x28(r1)
/* 802A763C 002A459C  3B C1 00 30 */	addi r30, r1, 0x30
/* 802A7640 002A45A0  C0 82 C1 80 */	lfs f4, lbl_805ADEA0@sda21(r2)
/* 802A7644 002A45A4  38 61 00 0C */	addi r3, r1, 0xc
/* 802A7648 002A45A8  D0 41 00 2C */	stfs f2, 0x2c(r1)
/* 802A764C 002A45AC  D0 61 00 30 */	stfs f3, 0x30(r1)
/* 802A7650 002A45B0  48 0B BD 9D */	bl __ct__6CColorFffff
/* 802A7654 002A45B4  C0 3D 00 28 */	lfs f1, 0x28(r29)
/* 802A7658 002A45B8  C0 02 C1 88 */	lfs f0, lbl_805ADEA8@sda21(r2)
/* 802A765C 002A45BC  FF E0 08 90 */	fmr f31, f1
/* 802A7660 002A45C0  FC 01 00 40 */	fcmpo cr0, f1, f0
/* 802A7664 002A45C4  40 80 00 08 */	bge lbl_802A766C
/* 802A7668 002A45C8  C3 E2 C1 84 */	lfs f31, lbl_805ADEA4@sda21(r2)
lbl_802A766C:
/* 802A766C 002A45CC  80 1D 00 00 */	lwz r0, 0(r29)
/* 802A7670 002A45D0  2C 00 00 00 */	cmpwi r0, 0
/* 802A7674 002A45D4  40 82 00 B8 */	bne lbl_802A772C
/* 802A7678 002A45D8  C0 41 00 28 */	lfs f2, 0x28(r1)
/* 802A767C 002A45DC  C0 01 00 2C */	lfs f0, 0x2c(r1)
/* 802A7680 002A45E0  C0 21 00 30 */	lfs f1, 0x30(r1)
/* 802A7684 002A45E4  EC 62 07 F2 */	fmuls f3, f2, f31
/* 802A7688 002A45E8  EC 40 07 F2 */	fmuls f2, f0, f31
/* 802A768C 002A45EC  C0 0D 9A 50 */	lfs f0, lbl_805A8610@sda21(r13)
/* 802A7690 002A45F0  EC 21 07 F2 */	fmuls f1, f1, f31
/* 802A7694 002A45F4  FC 03 00 40 */	fcmpo cr0, f3, f0
/* 802A7698 002A45F8  D0 61 00 28 */	stfs f3, 0x28(r1)
/* 802A769C 002A45FC  D0 41 00 2C */	stfs f2, 0x2c(r1)
/* 802A76A0 002A4600  D0 21 00 30 */	stfs f1, 0x30(r1)
/* 802A76A4 002A4604  40 80 00 0C */	bge lbl_802A76B0
/* 802A76A8 002A4608  38 61 00 28 */	addi r3, r1, 0x28
/* 802A76AC 002A460C  48 00 00 08 */	b lbl_802A76B4
lbl_802A76B0:
/* 802A76B0 002A4610  38 6D 9A 50 */	addi r3, r13, lbl_805A8610@sda21
lbl_802A76B4:
/* 802A76B4 002A4614  C0 3F 00 00 */	lfs f1, 0(r31)
/* 802A76B8 002A4618  C0 0D 9A 54 */	lfs f0, lbl_805A8614@sda21(r13)
/* 802A76BC 002A461C  C0 43 00 00 */	lfs f2, 0(r3)
/* 802A76C0 002A4620  FC 01 00 40 */	fcmpo cr0, f1, f0
/* 802A76C4 002A4624  D0 41 00 28 */	stfs f2, 0x28(r1)
/* 802A76C8 002A4628  40 80 00 0C */	bge lbl_802A76D4
/* 802A76CC 002A462C  7F E3 FB 78 */	mr r3, r31
/* 802A76D0 002A4630  48 00 00 08 */	b lbl_802A76D8
lbl_802A76D4:
/* 802A76D4 002A4634  38 6D 9A 54 */	addi r3, r13, lbl_805A8614@sda21
lbl_802A76D8:
/* 802A76D8 002A4638  C0 3E 00 00 */	lfs f1, 0(r30)
/* 802A76DC 002A463C  C0 0D 9A 58 */	lfs f0, lbl_805A8618@sda21(r13)
/* 802A76E0 002A4640  C0 43 00 00 */	lfs f2, 0(r3)
/* 802A76E4 002A4644  FC 01 00 40 */	fcmpo cr0, f1, f0
/* 802A76E8 002A4648  D0 5F 00 00 */	stfs f2, 0(r31)
/* 802A76EC 002A464C  40 80 00 0C */	bge lbl_802A76F8
/* 802A76F0 002A4650  7F C3 F3 78 */	mr r3, r30
/* 802A76F4 002A4654  48 00 00 08 */	b lbl_802A76FC
lbl_802A76F8:
/* 802A76F8 002A4658  38 6D 9A 58 */	addi r3, r13, lbl_805A8618@sda21
lbl_802A76FC:
/* 802A76FC 002A465C  C0 63 00 00 */	lfs f3, 0(r3)
/* 802A7700 002A4660  38 61 00 08 */	addi r3, r1, 8
/* 802A7704 002A4664  C0 21 00 28 */	lfs f1, 0x28(r1)
/* 802A7708 002A4668  D0 7E 00 00 */	stfs f3, 0(r30)
/* 802A770C 002A466C  C0 5F 00 00 */	lfs f2, 0(r31)
/* 802A7710 002A4670  C0 82 C1 80 */	lfs f4, lbl_805ADEA0@sda21(r2)
/* 802A7714 002A4674  48 0B BC D9 */	bl __ct__6CColorFffff
/* 802A7718 002A4678  7F 83 E3 78 */	mr r3, r28
/* 802A771C 002A467C  38 9D 00 10 */	addi r4, r29, 0x10
/* 802A7720 002A4680  38 A1 00 08 */	addi r5, r1, 8
/* 802A7724 002A4684  48 05 ED 81 */	bl BuildLocalAmbient__6CLightFRC9CVector3fRC6CColor
/* 802A7728 002A4688  48 00 01 3C */	b lbl_802A7864
lbl_802A772C:
/* 802A772C 002A468C  2C 00 00 01 */	cmpwi r0, 1
/* 802A7730 002A4690  40 82 00 18 */	bne lbl_802A7748
/* 802A7734 002A4694  7F 83 E3 78 */	mr r3, r28
/* 802A7738 002A4698  38 9D 00 1C */	addi r4, r29, 0x1c
/* 802A773C 002A469C  38 A1 00 0C */	addi r5, r1, 0xc
/* 802A7740 002A46A0  48 05 ED 2D */	bl BuildDirectional__6CLightFRC9CVector3fRC6CColor
/* 802A7744 002A46A4  48 00 01 20 */	b lbl_802A7864
lbl_802A7748:
/* 802A7748 002A46A8  2C 00 00 03 */	cmpwi r0, 3
/* 802A774C 002A46AC  40 82 00 A0 */	bne lbl_802A77EC
/* 802A7750 002A46B0  38 61 00 1C */	addi r3, r1, 0x1c
/* 802A7754 002A46B4  38 9D 00 1C */	addi r4, r29, 0x1c
/* 802A7758 002A46B8  48 06 D0 F9 */	bl AsNormalized__9CVector3fCFv
/* 802A775C 002A46BC  C0 3D 00 2C */	lfs f1, 0x2c(r29)
/* 802A7760 002A46C0  38 61 00 34 */	addi r3, r1, 0x34
/* 802A7764 002A46C4  C0 02 C1 8C */	lfs f0, lbl_805ADEAC@sda21(r2)
/* 802A7768 002A46C8  38 9D 00 10 */	addi r4, r29, 0x10
/* 802A776C 002A46CC  38 A1 00 1C */	addi r5, r1, 0x1c
/* 802A7770 002A46D0  38 C1 00 0C */	addi r6, r1, 0xc
/* 802A7774 002A46D4  EC 21 00 32 */	fmuls f1, f1, f0
/* 802A7778 002A46D8  48 05 EC 85 */	bl BuildSpot__6CLightFRC9CVector3fRC9CVector3fRC6CColorf
/* 802A777C 002A46DC  38 61 00 84 */	addi r3, r1, 0x84
/* 802A7780 002A46E0  38 81 00 34 */	addi r4, r1, 0x34
/* 802A7784 002A46E4  4B D9 3D ED */	bl __ct__6CLightFRC6CLight
/* 802A7788 002A46E8  80 1D 00 3C */	lwz r0, 0x3c(r29)
/* 802A778C 002A46EC  2C 00 00 02 */	cmpwi r0, 2
/* 802A7790 002A46F0  40 82 00 10 */	bne lbl_802A77A0
/* 802A7794 002A46F4  C0 02 C1 90 */	lfs f0, lbl_805ADEB0@sda21(r2)
/* 802A7798 002A46F8  EC 60 F8 24 */	fdivs f3, f0, f31
/* 802A779C 002A46FC  48 00 00 08 */	b lbl_802A77A4
lbl_802A77A0:
/* 802A77A0 002A4700  C0 62 C1 94 */	lfs f3, lbl_805ADEB4@sda21(r2)
lbl_802A77A4:
/* 802A77A4 002A4704  2C 00 00 01 */	cmpwi r0, 1
/* 802A77A8 002A4708  40 82 00 10 */	bne lbl_802A77B8
/* 802A77AC 002A470C  C0 02 C1 98 */	lfs f0, lbl_805ADEB8@sda21(r2)
/* 802A77B0 002A4710  EC 40 F8 24 */	fdivs f2, f0, f31
/* 802A77B4 002A4714  48 00 00 08 */	b lbl_802A77BC
lbl_802A77B8:
/* 802A77B8 002A4718  C0 42 C1 94 */	lfs f2, lbl_805ADEB4@sda21(r2)
lbl_802A77BC:
/* 802A77BC 002A471C  2C 00 00 00 */	cmpwi r0, 0
/* 802A77C0 002A4720  38 61 00 84 */	addi r3, r1, 0x84
/* 802A77C4 002A4724  40 82 00 10 */	bne lbl_802A77D4
/* 802A77C8 002A4728  C0 02 C1 9C */	lfs f0, lbl_805ADEBC@sda21(r2)
/* 802A77CC 002A472C  EC 20 F8 24 */	fdivs f1, f0, f31
/* 802A77D0 002A4730  48 00 00 08 */	b lbl_802A77D8
lbl_802A77D4:
/* 802A77D4 002A4734  C0 22 C1 94 */	lfs f1, lbl_805ADEB4@sda21(r2)
lbl_802A77D8:
/* 802A77D8 002A4738  48 05 EB D9 */	bl SetAttenuation__6CLightFfff
/* 802A77DC 002A473C  7F 83 E3 78 */	mr r3, r28
/* 802A77E0 002A4740  38 81 00 84 */	addi r4, r1, 0x84
/* 802A77E4 002A4744  4B D9 3D 8D */	bl __ct__6CLightFRC6CLight
/* 802A77E8 002A4748  48 00 00 7C */	b lbl_802A7864
lbl_802A77EC:
/* 802A77EC 002A474C  80 1D 00 3C */	lwz r0, 0x3c(r29)
/* 802A77F0 002A4750  2C 00 00 02 */	cmpwi r0, 2
/* 802A77F4 002A4754  40 82 00 10 */	bne lbl_802A7804
/* 802A77F8 002A4758  C0 02 C1 90 */	lfs f0, lbl_805ADEB0@sda21(r2)
/* 802A77FC 002A475C  EC 60 F8 24 */	fdivs f3, f0, f31
/* 802A7800 002A4760  48 00 00 08 */	b lbl_802A7808
lbl_802A7804:
/* 802A7804 002A4764  C0 62 C1 94 */	lfs f3, lbl_805ADEB4@sda21(r2)
lbl_802A7808:
/* 802A7808 002A4768  2C 00 00 01 */	cmpwi r0, 1
/* 802A780C 002A476C  40 82 00 10 */	bne lbl_802A781C
/* 802A7810 002A4770  C0 02 C1 98 */	lfs f0, lbl_805ADEB8@sda21(r2)
/* 802A7814 002A4774  EC 40 F8 24 */	fdivs f2, f0, f31
/* 802A7818 002A4778  48 00 00 08 */	b lbl_802A7820
lbl_802A781C:
/* 802A781C 002A477C  C0 42 C1 94 */	lfs f2, lbl_805ADEB4@sda21(r2)
lbl_802A7820:
/* 802A7820 002A4780  2C 00 00 00 */	cmpwi r0, 0
/* 802A7824 002A4784  40 82 00 10 */	bne lbl_802A7834
/* 802A7828 002A4788  C0 02 C1 9C */	lfs f0, lbl_805ADEBC@sda21(r2)
/* 802A782C 002A478C  EC 20 F8 24 */	fdivs f1, f0, f31
/* 802A7830 002A4790  48 00 00 08 */	b lbl_802A7838
lbl_802A7834:
/* 802A7834 002A4794  C0 22 C1 94 */	lfs f1, lbl_805ADEB4@sda21(r2)
lbl_802A7838:
/* 802A7838 002A4798  C0 A2 C1 94 */	lfs f5, lbl_805ADEB4@sda21(r2)
/* 802A783C 002A479C  7F 83 E3 78 */	mr r3, r28
/* 802A7840 002A47A0  C0 82 C1 80 */	lfs f4, lbl_805ADEA0@sda21(r2)
/* 802A7844 002A47A4  38 9D 00 10 */	addi r4, r29, 0x10
/* 802A7848 002A47A8  FC C0 28 90 */	fmr f6, f5
/* 802A784C 002A47AC  D0 A1 00 14 */	stfs f5, 0x14(r1)
/* 802A7850 002A47B0  38 A1 00 10 */	addi r5, r1, 0x10
/* 802A7854 002A47B4  38 C1 00 0C */	addi r6, r1, 0xc
/* 802A7858 002A47B8  D0 81 00 10 */	stfs f4, 0x10(r1)
/* 802A785C 002A47BC  D0 A1 00 18 */	stfs f5, 0x18(r1)
/* 802A7860 002A47C0  48 05 EB 7D */	bl BuildCustom__6CLightFRC9CVector3fRC9CVector3fRC6CColorffffff
lbl_802A7864:
/* 802A7864 002A47C4  E3 E1 00 F8 */	psq_l f31, 248(r1), 0, qr0
/* 802A7868 002A47C8  80 01 01 04 */	lwz r0, 0x104(r1)
/* 802A786C 002A47CC  CB E1 00 F0 */	lfd f31, 0xf0(r1)
/* 802A7870 002A47D0  83 E1 00 EC */	lwz r31, 0xec(r1)
/* 802A7874 002A47D4  83 C1 00 E8 */	lwz r30, 0xe8(r1)
/* 802A7878 002A47D8  83 A1 00 E4 */	lwz r29, 0xe4(r1)
/* 802A787C 002A47DC  83 81 00 E0 */	lwz r28, 0xe0(r1)
/* 802A7880 002A47E0  7C 08 03 A6 */	mtlr r0
/* 802A7884 002A47E4  38 21 01 00 */	addi r1, r1, 0x100
/* 802A7888 002A47E8  4E 80 00 20 */	blr

.global __ct__11CWorldLightFR12CInputStream
__ct__11CWorldLightFR12CInputStream:
/* 802A788C 002A47EC  94 21 FF F0 */	stwu r1, -0x10(r1)
/* 802A7890 002A47F0  7C 08 02 A6 */	mflr r0
/* 802A7894 002A47F4  90 01 00 14 */	stw r0, 0x14(r1)
/* 802A7898 002A47F8  93 E1 00 0C */	stw r31, 0xc(r1)
/* 802A789C 002A47FC  7C 9F 23 78 */	mr r31, r4
/* 802A78A0 002A4800  93 C1 00 08 */	stw r30, 8(r1)
/* 802A78A4 002A4804  7C 7E 1B 78 */	mr r30, r3
/* 802A78A8 002A4808  7F E3 FB 78 */	mr r3, r31
/* 802A78AC 002A480C  48 09 73 D9 */	bl ReadLong__12CInputStreamFv
/* 802A78B0 002A4810  90 7E 00 00 */	stw r3, 0(r30)
/* 802A78B4 002A4814  7F E4 FB 78 */	mr r4, r31
/* 802A78B8 002A4818  38 7E 00 04 */	addi r3, r30, 4
/* 802A78BC 002A481C  48 06 D2 D1 */	bl __ct__9CVector3fFR12CInputStream
/* 802A78C0 002A4820  7F E4 FB 78 */	mr r4, r31
/* 802A78C4 002A4824  38 7E 00 10 */	addi r3, r30, 0x10
/* 802A78C8 002A4828  48 06 D2 C5 */	bl __ct__9CVector3fFR12CInputStream
/* 802A78CC 002A482C  7F E4 FB 78 */	mr r4, r31
/* 802A78D0 002A4830  38 7E 00 1C */	addi r3, r30, 0x1c
/* 802A78D4 002A4834  48 06 D2 B9 */	bl __ct__9CVector3fFR12CInputStream
/* 802A78D8 002A4838  7F E3 FB 78 */	mr r3, r31
/* 802A78DC 002A483C  48 09 73 4D */	bl ReadFloat__12CInputStreamFv
/* 802A78E0 002A4840  D0 3E 00 28 */	stfs f1, 0x28(r30)
/* 802A78E4 002A4844  7F E3 FB 78 */	mr r3, r31
/* 802A78E8 002A4848  48 09 73 41 */	bl ReadFloat__12CInputStreamFv
/* 802A78EC 002A484C  D0 3E 00 2C */	stfs f1, 0x2c(r30)
/* 802A78F0 002A4850  7F E3 FB 78 */	mr r3, r31
/* 802A78F4 002A4854  48 09 73 35 */	bl ReadFloat__12CInputStreamFv
/* 802A78F8 002A4858  D0 3E 00 30 */	stfs f1, 0x30(r30)
/* 802A78FC 002A485C  7F E3 FB 78 */	mr r3, r31
/* 802A7900 002A4860  48 09 73 DD */	bl ReadBool__12CInputStreamFv
/* 802A7904 002A4864  98 7E 00 34 */	stb r3, 0x34(r30)
/* 802A7908 002A4868  7F E3 FB 78 */	mr r3, r31
/* 802A790C 002A486C  48 09 73 1D */	bl ReadFloat__12CInputStreamFv
/* 802A7910 002A4870  D0 3E 00 38 */	stfs f1, 0x38(r30)
/* 802A7914 002A4874  7F E3 FB 78 */	mr r3, r31
/* 802A7918 002A4878  48 09 73 6D */	bl ReadLong__12CInputStreamFv
/* 802A791C 002A487C  90 7E 00 3C */	stw r3, 0x3c(r30)
/* 802A7920 002A4880  7F E3 FB 78 */	mr r3, r31
/* 802A7924 002A4884  48 09 73 05 */	bl ReadFloat__12CInputStreamFv
/* 802A7928 002A4888  D0 3E 00 40 */	stfs f1, 0x40(r30)
/* 802A792C 002A488C  7F C3 F3 78 */	mr r3, r30
/* 802A7930 002A4890  80 01 00 14 */	lwz r0, 0x14(r1)
/* 802A7934 002A4894  83 E1 00 0C */	lwz r31, 0xc(r1)
/* 802A7938 002A4898  83 C1 00 08 */	lwz r30, 8(r1)
/* 802A793C 002A489C  7C 08 03 A6 */	mtlr r0
/* 802A7940 002A48A0  38 21 00 10 */	addi r1, r1, 0x10
/* 802A7944 002A48A4  4E 80 00 20 */	blr

.global __sinit_CWorldLight_cpp
__sinit_CWorldLight_cpp:
/* 802A7948 002A48A8  C0 22 C1 94 */	lfs f1, lbl_805ADEB4@sda21(r2)
/* 802A794C 002A48AC  3C 80 80 5A */	lis r4, lbl_8059FBAC@ha
/* 802A7950 002A48B0  3C 60 80 5A */	lis r3, lbl_8059FBC4@ha
/* 802A7954 002A48B4  C0 02 C1 80 */	lfs f0, lbl_805ADEA0@sda21(r2)
/* 802A7958 002A48B8  D4 24 FB AC */	stfsu f1, lbl_8059FBAC@l(r4)
/* 802A795C 002A48BC  D4 23 FB C4 */	stfsu f1, lbl_8059FBC4@l(r3)
/* 802A7960 002A48C0  D0 24 00 04 */	stfs f1, 4(r4)
/* 802A7964 002A48C4  D0 24 00 08 */	stfs f1, 8(r4)
/* 802A7968 002A48C8  D0 03 00 04 */	stfs f0, 4(r3)
/* 802A796C 002A48CC  D0 23 00 08 */	stfs f1, 8(r3)
/* 802A7970 002A48D0  4E 80 00 20 */	blr

.section .sdata2, "a"
.balign 8
.global lbl_805ADEA0
lbl_805ADEA0:
	# ROM: 0x3FA740
	.float 1.0

.global lbl_805ADEA4
lbl_805ADEA4:
	# ROM: 0x3FA744
	.4byte 0x35A00000

.global lbl_805ADEA8
lbl_805ADEA8:
	# ROM: 0x3FA748
	.float 1.1920929E-7

.global lbl_805ADEAC
lbl_805ADEAC:
	# ROM: 0x3FA74C
	.float 0.5

.global lbl_805ADEB0
lbl_805ADEB0:
	# ROM: 0x3FA750
	.4byte 0x46C35000

.global lbl_805ADEB4
lbl_805ADEB4:
	# ROM: 0x3FA754
	.4byte 0

.global lbl_805ADEB8
lbl_805ADEB8:
	# ROM: 0x3FA758
	.4byte 0x4379FFFF

.global lbl_805ADEBC
lbl_805ADEBC:
	# ROM: 0x3FA75C
	.float 2.0