.include "macros.inc"

.section .data
.balign 8

.global __vt__14CScriptCounter
__vt__14CScriptCounter:
	# ROM: 0x3D7EF0
	.4byte 0
	.4byte 0
	.4byte __dt__14CScriptCounterFv
	.4byte Accept__14CScriptCounterFR8IVisitor
	.4byte PreThink__7CEntityFfR13CStateManager
	.4byte Think__7CEntityFfR13CStateManager
	.4byte AcceptScriptMsg__14CScriptCounterF20EScriptObjectMessage9TUniqueIdR13CStateManager
	.4byte SetActive__7CEntityFUc

.global lbl_803DAF10
lbl_803DAF10:
	# ROM: 0x3D7F10
	.4byte lbl_8009E4E8
	.4byte lbl_8009E5AC
	.4byte lbl_8009E53C
	.4byte lbl_8009E5AC
	.4byte lbl_8009E5AC
	.4byte lbl_8009E598
	.4byte lbl_8009E5AC
	.4byte lbl_8009E4AC
	.4byte lbl_8009E470
	.4byte 0

.section .text, "ax"

.global Accept__14CScriptCounterFR8IVisitor
Accept__14CScriptCounterFR8IVisitor:
/* 8009E3E8 0009B348  94 21 FF F0 */	stwu r1, -0x10(r1)
/* 8009E3EC 0009B34C  7C 08 02 A6 */	mflr r0
/* 8009E3F0 0009B350  90 01 00 14 */	stw r0, 0x14(r1)
/* 8009E3F4 0009B354  7C 60 1B 78 */	mr r0, r3
/* 8009E3F8 0009B358  7C 83 23 78 */	mr r3, r4
/* 8009E3FC 0009B35C  81 84 00 00 */	lwz r12, 0(r4)
/* 8009E400 0009B360  7C 04 03 78 */	mr r4, r0
/* 8009E404 0009B364  81 8C 00 24 */	lwz r12, 0x24(r12)
/* 8009E408 0009B368  7D 89 03 A6 */	mtctr r12
/* 8009E40C 0009B36C  4E 80 04 21 */	bctrl
/* 8009E410 0009B370  80 01 00 14 */	lwz r0, 0x14(r1)
/* 8009E414 0009B374  7C 08 03 A6 */	mtlr r0
/* 8009E418 0009B378  38 21 00 10 */	addi r1, r1, 0x10
/* 8009E41C 0009B37C  4E 80 00 20 */	blr

.global AcceptScriptMsg__14CScriptCounterF20EScriptObjectMessage9TUniqueIdR13CStateManager
AcceptScriptMsg__14CScriptCounterF20EScriptObjectMessage9TUniqueIdR13CStateManager:
/* 8009E420 0009B380  94 21 FF E0 */	stwu r1, -0x20(r1)
/* 8009E424 0009B384  7C 08 02 A6 */	mflr r0
/* 8009E428 0009B388  90 01 00 24 */	stw r0, 0x24(r1)
/* 8009E42C 0009B38C  93 E1 00 1C */	stw r31, 0x1c(r1)
/* 8009E430 0009B390  7C DF 33 78 */	mr r31, r6
/* 8009E434 0009B394  93 C1 00 18 */	stw r30, 0x18(r1)
/* 8009E438 0009B398  7C BE 2B 78 */	mr r30, r5
/* 8009E43C 0009B39C  93 A1 00 14 */	stw r29, 0x14(r1)
/* 8009E440 0009B3A0  7C 9D 23 78 */	mr r29, r4
/* 8009E444 0009B3A4  38 1D FF FB */	addi r0, r29, -5
/* 8009E448 0009B3A8  28 00 00 08 */	cmplwi r0, 8
/* 8009E44C 0009B3AC  93 81 00 10 */	stw r28, 0x10(r1)
/* 8009E450 0009B3B0  7C 7C 1B 78 */	mr r28, r3
/* 8009E454 0009B3B4  41 81 01 58 */	bgt lbl_8009E5AC
/* 8009E458 0009B3B8  3C 80 80 3E */	lis r4, lbl_803DAF10@ha
/* 8009E45C 0009B3BC  54 00 10 3A */	slwi r0, r0, 2
/* 8009E460 0009B3C0  38 84 AF 10 */	addi r4, r4, lbl_803DAF10@l
/* 8009E464 0009B3C4  7C 04 00 2E */	lwzx r0, r4, r0
/* 8009E468 0009B3C8  7C 09 03 A6 */	mtctr r0
/* 8009E46C 0009B3CC  4E 80 04 20 */	bctr
lbl_8009E470:
/* 8009E470 0009B3D0  88 1C 00 30 */	lbz r0, 0x30(r28)
/* 8009E474 0009B3D4  54 00 CF FF */	rlwinm. r0, r0, 0x19, 0x1f, 0x1f
/* 8009E478 0009B3D8  41 82 01 34 */	beq lbl_8009E5AC
/* 8009E47C 0009B3DC  38 00 00 00 */	li r0, 0
/* 8009E480 0009B3E0  7F E5 FB 78 */	mr r5, r31
/* 8009E484 0009B3E4  90 1C 00 38 */	stw r0, 0x38(r28)
/* 8009E488 0009B3E8  38 80 00 09 */	li r4, 9
/* 8009E48C 0009B3EC  38 C0 FF FF */	li r6, -1
/* 8009E490 0009B3F0  4B FB 2C 31 */	bl SendScriptMsgs__7CEntityF18EScriptObjectStateR13CStateManager20EScriptObjectMessage
/* 8009E494 0009B3F4  88 1C 00 40 */	lbz r0, 0x40(r28)
/* 8009E498 0009B3F8  28 00 00 00 */	cmplwi r0, 0
/* 8009E49C 0009B3FC  41 82 01 10 */	beq lbl_8009E5AC
/* 8009E4A0 0009B400  80 1C 00 34 */	lwz r0, 0x34(r28)
/* 8009E4A4 0009B404  90 1C 00 38 */	stw r0, 0x38(r28)
/* 8009E4A8 0009B408  48 00 01 04 */	b lbl_8009E5AC
lbl_8009E4AC:
/* 8009E4AC 0009B40C  88 1C 00 30 */	lbz r0, 0x30(r28)
/* 8009E4B0 0009B410  54 00 CF FF */	rlwinm. r0, r0, 0x19, 0x1f, 0x1f
/* 8009E4B4 0009B414  41 82 00 F8 */	beq lbl_8009E5AC
/* 8009E4B8 0009B418  80 1C 00 3C */	lwz r0, 0x3c(r28)
/* 8009E4BC 0009B41C  7F E5 FB 78 */	mr r5, r31
/* 8009E4C0 0009B420  38 80 00 07 */	li r4, 7
/* 8009E4C4 0009B424  38 C0 FF FF */	li r6, -1
/* 8009E4C8 0009B428  90 1C 00 38 */	stw r0, 0x38(r28)
/* 8009E4CC 0009B42C  4B FB 2B F5 */	bl SendScriptMsgs__7CEntityF18EScriptObjectStateR13CStateManager20EScriptObjectMessage
/* 8009E4D0 0009B430  88 1C 00 40 */	lbz r0, 0x40(r28)
/* 8009E4D4 0009B434  28 00 00 00 */	cmplwi r0, 0
/* 8009E4D8 0009B438  41 82 00 D4 */	beq lbl_8009E5AC
/* 8009E4DC 0009B43C  80 1C 00 34 */	lwz r0, 0x34(r28)
/* 8009E4E0 0009B440  90 1C 00 38 */	stw r0, 0x38(r28)
/* 8009E4E4 0009B444  48 00 00 C8 */	b lbl_8009E5AC
lbl_8009E4E8:
/* 8009E4E8 0009B448  88 1C 00 30 */	lbz r0, 0x30(r28)
/* 8009E4EC 0009B44C  54 00 CF FF */	rlwinm. r0, r0, 0x19, 0x1f, 0x1f
/* 8009E4F0 0009B450  41 82 00 BC */	beq lbl_8009E5AC
/* 8009E4F4 0009B454  80 9C 00 38 */	lwz r4, 0x38(r28)
/* 8009E4F8 0009B458  2C 04 00 00 */	cmpwi r4, 0
/* 8009E4FC 0009B45C  41 82 00 B0 */	beq lbl_8009E5AC
/* 8009E500 0009B460  38 04 FF FF */	addi r0, r4, -1
/* 8009E504 0009B464  90 1C 00 38 */	stw r0, 0x38(r28)
/* 8009E508 0009B468  80 1C 00 38 */	lwz r0, 0x38(r28)
/* 8009E50C 0009B46C  2C 00 00 00 */	cmpwi r0, 0
/* 8009E510 0009B470  40 82 00 9C */	bne lbl_8009E5AC
/* 8009E514 0009B474  7F E5 FB 78 */	mr r5, r31
/* 8009E518 0009B478  38 80 00 09 */	li r4, 9
/* 8009E51C 0009B47C  38 C0 FF FF */	li r6, -1
/* 8009E520 0009B480  4B FB 2B A1 */	bl SendScriptMsgs__7CEntityF18EScriptObjectStateR13CStateManager20EScriptObjectMessage
/* 8009E524 0009B484  88 1C 00 40 */	lbz r0, 0x40(r28)
/* 8009E528 0009B488  28 00 00 00 */	cmplwi r0, 0
/* 8009E52C 0009B48C  41 82 00 80 */	beq lbl_8009E5AC
/* 8009E530 0009B490  80 1C 00 34 */	lwz r0, 0x34(r28)
/* 8009E534 0009B494  90 1C 00 38 */	stw r0, 0x38(r28)
/* 8009E538 0009B498  48 00 00 74 */	b lbl_8009E5AC
lbl_8009E53C:
/* 8009E53C 0009B49C  88 1C 00 30 */	lbz r0, 0x30(r28)
/* 8009E540 0009B4A0  54 00 CF FF */	rlwinm. r0, r0, 0x19, 0x1f, 0x1f
/* 8009E544 0009B4A4  41 82 00 68 */	beq lbl_8009E5AC
/* 8009E548 0009B4A8  80 9C 00 38 */	lwz r4, 0x38(r28)
/* 8009E54C 0009B4AC  80 1C 00 3C */	lwz r0, 0x3c(r28)
/* 8009E550 0009B4B0  7C 04 00 00 */	cmpw r4, r0
/* 8009E554 0009B4B4  40 80 00 58 */	bge lbl_8009E5AC
/* 8009E558 0009B4B8  38 04 00 01 */	addi r0, r4, 1
/* 8009E55C 0009B4BC  90 1C 00 38 */	stw r0, 0x38(r28)
/* 8009E560 0009B4C0  80 9C 00 38 */	lwz r4, 0x38(r28)
/* 8009E564 0009B4C4  80 1C 00 3C */	lwz r0, 0x3c(r28)
/* 8009E568 0009B4C8  7C 04 00 00 */	cmpw r4, r0
/* 8009E56C 0009B4CC  40 82 00 40 */	bne lbl_8009E5AC
/* 8009E570 0009B4D0  7F E5 FB 78 */	mr r5, r31
/* 8009E574 0009B4D4  38 80 00 07 */	li r4, 7
/* 8009E578 0009B4D8  38 C0 FF FF */	li r6, -1
/* 8009E57C 0009B4DC  4B FB 2B 45 */	bl SendScriptMsgs__7CEntityF18EScriptObjectStateR13CStateManager20EScriptObjectMessage
/* 8009E580 0009B4E0  88 1C 00 40 */	lbz r0, 0x40(r28)
/* 8009E584 0009B4E4  28 00 00 00 */	cmplwi r0, 0
/* 8009E588 0009B4E8  41 82 00 24 */	beq lbl_8009E5AC
/* 8009E58C 0009B4EC  80 1C 00 34 */	lwz r0, 0x34(r28)
/* 8009E590 0009B4F0  90 1C 00 38 */	stw r0, 0x38(r28)
/* 8009E594 0009B4F4  48 00 00 18 */	b lbl_8009E5AC
lbl_8009E598:
/* 8009E598 0009B4F8  88 1C 00 30 */	lbz r0, 0x30(r28)
/* 8009E59C 0009B4FC  54 00 CF FF */	rlwinm. r0, r0, 0x19, 0x1f, 0x1f
/* 8009E5A0 0009B500  41 82 00 0C */	beq lbl_8009E5AC
/* 8009E5A4 0009B504  80 1C 00 34 */	lwz r0, 0x34(r28)
/* 8009E5A8 0009B508  90 1C 00 38 */	stw r0, 0x38(r28)
lbl_8009E5AC:
/* 8009E5AC 0009B50C  A0 1E 00 00 */	lhz r0, 0(r30)
/* 8009E5B0 0009B510  7F 83 E3 78 */	mr r3, r28
/* 8009E5B4 0009B514  7F A4 EB 78 */	mr r4, r29
/* 8009E5B8 0009B518  7F E6 FB 78 */	mr r6, r31
/* 8009E5BC 0009B51C  B0 01 00 08 */	sth r0, 8(r1)
/* 8009E5C0 0009B520  38 A1 00 08 */	addi r5, r1, 8
/* 8009E5C4 0009B524  4B FB 2B 99 */	bl AcceptScriptMsg__7CEntityF20EScriptObjectMessage9TUniqueIdR13CStateManager
/* 8009E5C8 0009B528  80 01 00 24 */	lwz r0, 0x24(r1)
/* 8009E5CC 0009B52C  83 E1 00 1C */	lwz r31, 0x1c(r1)
/* 8009E5D0 0009B530  83 C1 00 18 */	lwz r30, 0x18(r1)
/* 8009E5D4 0009B534  83 A1 00 14 */	lwz r29, 0x14(r1)
/* 8009E5D8 0009B538  83 81 00 10 */	lwz r28, 0x10(r1)
/* 8009E5DC 0009B53C  7C 08 03 A6 */	mtlr r0
/* 8009E5E0 0009B540  38 21 00 20 */	addi r1, r1, 0x20
/* 8009E5E4 0009B544  4E 80 00 20 */	blr

.global __dt__14CScriptCounterFv
__dt__14CScriptCounterFv:
/* 8009E5E8 0009B548  94 21 FF F0 */	stwu r1, -0x10(r1)
/* 8009E5EC 0009B54C  7C 08 02 A6 */	mflr r0
/* 8009E5F0 0009B550  90 01 00 14 */	stw r0, 0x14(r1)
/* 8009E5F4 0009B554  93 E1 00 0C */	stw r31, 0xc(r1)
/* 8009E5F8 0009B558  7C 9F 23 78 */	mr r31, r4
/* 8009E5FC 0009B55C  93 C1 00 08 */	stw r30, 8(r1)
/* 8009E600 0009B560  7C 7E 1B 79 */	or. r30, r3, r3
/* 8009E604 0009B564  41 82 00 28 */	beq lbl_8009E62C
/* 8009E608 0009B568  3C A0 80 3E */	lis r5, __vt__14CScriptCounter@ha
/* 8009E60C 0009B56C  38 80 00 00 */	li r4, 0
/* 8009E610 0009B570  38 05 AE F0 */	addi r0, r5, __vt__14CScriptCounter@l
/* 8009E614 0009B574  90 1E 00 00 */	stw r0, 0(r30)
/* 8009E618 0009B578  4B FB 2C 5D */	bl __dt__7CEntityFv
/* 8009E61C 0009B57C  7F E0 07 35 */	extsh. r0, r31
/* 8009E620 0009B580  40 81 00 0C */	ble lbl_8009E62C
/* 8009E624 0009B584  7F C3 F3 78 */	mr r3, r30
/* 8009E628 0009B588  48 27 73 09 */	bl Free__7CMemoryFPCv
lbl_8009E62C:
/* 8009E62C 0009B58C  80 01 00 14 */	lwz r0, 0x14(r1)
/* 8009E630 0009B590  7F C3 F3 78 */	mr r3, r30
/* 8009E634 0009B594  83 E1 00 0C */	lwz r31, 0xc(r1)
/* 8009E638 0009B598  83 C1 00 08 */	lwz r30, 8(r1)
/* 8009E63C 0009B59C  7C 08 03 A6 */	mtlr r0
/* 8009E640 0009B5A0  38 21 00 10 */	addi r1, r1, 0x10
/* 8009E644 0009B5A4  4E 80 00 20 */	blr

.global "__ct__14CScriptCounterF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfoiibb"
"__ct__14CScriptCounterF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfoiibb":
/* 8009E648 0009B5A8  94 21 FF E0 */	stwu r1, -0x20(r1)
/* 8009E64C 0009B5AC  7C 08 02 A6 */	mflr r0
/* 8009E650 0009B5B0  90 01 00 24 */	stw r0, 0x24(r1)
/* 8009E654 0009B5B4  93 E1 00 1C */	stw r31, 0x1c(r1)
/* 8009E658 0009B5B8  7D 3F 4B 78 */	mr r31, r9
/* 8009E65C 0009B5BC  93 C1 00 18 */	stw r30, 0x18(r1)
/* 8009E660 0009B5C0  7D 1E 43 78 */	mr r30, r8
/* 8009E664 0009B5C4  93 A1 00 14 */	stw r29, 0x14(r1)
/* 8009E668 0009B5C8  7C FD 3B 78 */	mr r29, r7
/* 8009E66C 0009B5CC  93 81 00 10 */	stw r28, 0x10(r1)
/* 8009E670 0009B5D0  7C 7C 1B 78 */	mr r28, r3
/* 8009E674 0009B5D4  A0 04 00 00 */	lhz r0, 0(r4)
/* 8009E678 0009B5D8  7C A4 2B 78 */	mr r4, r5
/* 8009E67C 0009B5DC  7C C5 33 78 */	mr r5, r6
/* 8009E680 0009B5E0  7D 46 53 78 */	mr r6, r10
/* 8009E684 0009B5E4  B0 01 00 08 */	sth r0, 8(r1)
/* 8009E688 0009B5E8  7C 87 23 78 */	mr r7, r4
/* 8009E68C 0009B5EC  38 81 00 08 */	addi r4, r1, 8
/* 8009E690 0009B5F0  4B FB 2C 95 */	bl "__ct__7CEntityF9TUniqueIdRC11CEntityInfobRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>"
/* 8009E694 0009B5F4  3C 80 80 3E */	lis r4, __vt__14CScriptCounter@ha
/* 8009E698 0009B5F8  7F 83 E3 78 */	mr r3, r28
/* 8009E69C 0009B5FC  38 04 AE F0 */	addi r0, r4, __vt__14CScriptCounter@l
/* 8009E6A0 0009B600  90 1C 00 00 */	stw r0, 0(r28)
/* 8009E6A4 0009B604  93 BC 00 34 */	stw r29, 0x34(r28)
/* 8009E6A8 0009B608  93 BC 00 38 */	stw r29, 0x38(r28)
/* 8009E6AC 0009B60C  93 DC 00 3C */	stw r30, 0x3c(r28)
/* 8009E6B0 0009B610  9B FC 00 40 */	stb r31, 0x40(r28)
/* 8009E6B4 0009B614  80 01 00 24 */	lwz r0, 0x24(r1)
/* 8009E6B8 0009B618  83 E1 00 1C */	lwz r31, 0x1c(r1)
/* 8009E6BC 0009B61C  83 C1 00 18 */	lwz r30, 0x18(r1)
/* 8009E6C0 0009B620  83 A1 00 14 */	lwz r29, 0x14(r1)
/* 8009E6C4 0009B624  83 81 00 10 */	lwz r28, 0x10(r1)
/* 8009E6C8 0009B628  7C 08 03 A6 */	mtlr r0
/* 8009E6CC 0009B62C  38 21 00 20 */	addi r1, r1, 0x20
/* 8009E6D0 0009B630  4E 80 00 20 */	blr