.include "macros.inc"

.section .bss
.balign 8
.global __CARDBlock
__CARDBlock:
	.skip 0x220
.global __CARDDiskNone
__CARDDiskNone:
	.skip 0x20

.section .data, "wa"
.balign 8
__CARDVersionStr:
	.asciz "<< Dolphin SDK - CARD\trelease build: Sep  5 2002 05:35:20 (0x2301) >>"
	.balign 4

ResetFunctionInfo:
	.4byte OnReset
	.4byte 0x0000007f

.skip 32

.section .sdata, "wa"
.balign 8

.global __CARDVersion
__CARDVersion:
	.4byte __CARDVersionStr
	.skip 4

.section .sbss, "wa"
.balign 8
.global __CARDEncode
__CARDEncode:
	.skip 0x8

.section .text, "ax"

.global __CARDDefaultApiCallback
__CARDDefaultApiCallback:
/* 803B7E74 003B4DD4  4E 80 00 20 */	blr

.global __CARDExtHandler
__CARDExtHandler:
/* 803B7E78 003B4DD8  7C 08 02 A6 */	mflr r0
/* 803B7E7C 003B4DDC  90 01 00 04 */	stw r0, 4(r1)
/* 803B7E80 003B4DE0  94 21 FF E0 */	stwu r1, -0x20(r1)
/* 803B7E84 003B4DE4  93 E1 00 1C */	stw r31, 0x1c(r1)
/* 803B7E88 003B4DE8  93 C1 00 18 */	stw r30, 0x18(r1)
/* 803B7E8C 003B4DEC  93 A1 00 14 */	stw r29, 0x14(r1)
/* 803B7E90 003B4DF0  3B A3 00 00 */	addi r29, r3, 0
/* 803B7E94 003B4DF4  1C 9D 01 10 */	mulli r4, r29, 0x110
/* 803B7E98 003B4DF8  3C 60 80 57 */	lis r3, __CARDBlock@ha
/* 803B7E9C 003B4DFC  38 03 9A 58 */	addi r0, r3, __CARDBlock@l
/* 803B7EA0 003B4E00  7F C0 22 14 */	add r30, r0, r4
/* 803B7EA4 003B4E04  80 1E 00 00 */	lwz r0, 0(r30)
/* 803B7EA8 003B4E08  2C 00 00 00 */	cmpwi r0, 0
/* 803B7EAC 003B4E0C  41 82 00 88 */	beq lbl_803B7F34
/* 803B7EB0 003B4E10  3B E0 00 00 */	li r31, 0
/* 803B7EB4 003B4E14  93 FE 00 00 */	stw r31, 0(r30)
/* 803B7EB8 003B4E18  38 7D 00 00 */	addi r3, r29, 0
/* 803B7EBC 003B4E1C  38 80 00 00 */	li r4, 0
/* 803B7EC0 003B4E20  48 00 88 B1 */	bl EXISetExiCallback
/* 803B7EC4 003B4E24  38 7E 00 E0 */	addi r3, r30, 0xe0
/* 803B7EC8 003B4E28  4B FC 65 2D */	bl OSCancelAlarm
/* 803B7ECC 003B4E2C  80 1E 00 CC */	lwz r0, 0xcc(r30)
/* 803B7ED0 003B4E30  28 00 00 00 */	cmplwi r0, 0
/* 803B7ED4 003B4E34  7C 0C 03 78 */	mr r12, r0
/* 803B7ED8 003B4E38  41 82 00 18 */	beq lbl_803B7EF0
/* 803B7EDC 003B4E3C  93 FE 00 CC */	stw r31, 0xcc(r30)
/* 803B7EE0 003B4E40  7D 88 03 A6 */	mtlr r12
/* 803B7EE4 003B4E44  38 7D 00 00 */	addi r3, r29, 0
/* 803B7EE8 003B4E48  38 80 FF FD */	li r4, -3
/* 803B7EEC 003B4E4C  4E 80 00 21 */	blrl
lbl_803B7EF0:
/* 803B7EF0 003B4E50  80 1E 00 04 */	lwz r0, 4(r30)
/* 803B7EF4 003B4E54  2C 00 FF FF */	cmpwi r0, -1
/* 803B7EF8 003B4E58  41 82 00 0C */	beq lbl_803B7F04
/* 803B7EFC 003B4E5C  38 00 FF FD */	li r0, -3
/* 803B7F00 003B4E60  90 1E 00 04 */	stw r0, 4(r30)
lbl_803B7F04:
/* 803B7F04 003B4E64  81 9E 00 C4 */	lwz r12, 0xc4(r30)
/* 803B7F08 003B4E68  28 0C 00 00 */	cmplwi r12, 0
/* 803B7F0C 003B4E6C  41 82 00 28 */	beq lbl_803B7F34
/* 803B7F10 003B4E70  80 1E 00 24 */	lwz r0, 0x24(r30)
/* 803B7F14 003B4E74  2C 00 00 07 */	cmpwi r0, 7
/* 803B7F18 003B4E78  41 80 00 1C */	blt lbl_803B7F34
/* 803B7F1C 003B4E7C  38 00 00 00 */	li r0, 0
/* 803B7F20 003B4E80  7D 88 03 A6 */	mtlr r12
/* 803B7F24 003B4E84  90 1E 00 C4 */	stw r0, 0xc4(r30)
/* 803B7F28 003B4E88  38 7D 00 00 */	addi r3, r29, 0
/* 803B7F2C 003B4E8C  38 80 FF FD */	li r4, -3
/* 803B7F30 003B4E90  4E 80 00 21 */	blrl
lbl_803B7F34:
/* 803B7F34 003B4E94  80 01 00 24 */	lwz r0, 0x24(r1)
/* 803B7F38 003B4E98  83 E1 00 1C */	lwz r31, 0x1c(r1)
/* 803B7F3C 003B4E9C  83 C1 00 18 */	lwz r30, 0x18(r1)
/* 803B7F40 003B4EA0  83 A1 00 14 */	lwz r29, 0x14(r1)
/* 803B7F44 003B4EA4  38 21 00 20 */	addi r1, r1, 0x20
/* 803B7F48 003B4EA8  7C 08 03 A6 */	mtlr r0
/* 803B7F4C 003B4EAC  4E 80 00 20 */	blr

.global __CARDExiHandler
__CARDExiHandler:
/* 803B7F50 003B4EB0  7C 08 02 A6 */	mflr r0
/* 803B7F54 003B4EB4  90 01 00 04 */	stw r0, 4(r1)
/* 803B7F58 003B4EB8  94 21 FF D8 */	stwu r1, -0x28(r1)
/* 803B7F5C 003B4EBC  93 E1 00 24 */	stw r31, 0x24(r1)
/* 803B7F60 003B4EC0  3B E3 00 00 */	addi r31, r3, 0
/* 803B7F64 003B4EC4  1C 9F 01 10 */	mulli r4, r31, 0x110
/* 803B7F68 003B4EC8  93 C1 00 20 */	stw r30, 0x20(r1)
/* 803B7F6C 003B4ECC  3C 60 80 57 */	lis r3, __CARDBlock@ha
/* 803B7F70 003B4ED0  93 A1 00 1C */	stw r29, 0x1c(r1)
/* 803B7F74 003B4ED4  38 03 9A 58 */	addi r0, r3, __CARDBlock@l
/* 803B7F78 003B4ED8  7F C0 22 14 */	add r30, r0, r4
/* 803B7F7C 003B4EDC  38 7E 00 E0 */	addi r3, r30, 0xe0
/* 803B7F80 003B4EE0  4B FC 64 75 */	bl OSCancelAlarm
/* 803B7F84 003B4EE4  80 1E 00 00 */	lwz r0, 0(r30)
/* 803B7F88 003B4EE8  2C 00 00 00 */	cmpwi r0, 0
/* 803B7F8C 003B4EEC  41 82 00 C0 */	beq lbl_803B804C
/* 803B7F90 003B4EF0  38 7F 00 00 */	addi r3, r31, 0
/* 803B7F94 003B4EF4  38 80 00 00 */	li r4, 0
/* 803B7F98 003B4EF8  38 A0 00 00 */	li r5, 0
/* 803B7F9C 003B4EFC  48 00 93 C9 */	bl EXILock
/* 803B7FA0 003B4F00  2C 03 00 00 */	cmpwi r3, 0
/* 803B7FA4 003B4F04  40 82 00 0C */	bne lbl_803B7FB0
/* 803B7FA8 003B4F08  3B A0 FF 80 */	li r29, -128
/* 803B7FAC 003B4F0C  48 00 00 78 */	b lbl_803B8024
lbl_803B7FB0:
/* 803B7FB0 003B4F10  38 7F 00 00 */	addi r3, r31, 0
/* 803B7FB4 003B4F14  38 81 00 10 */	addi r4, r1, 0x10
/* 803B7FB8 003B4F18  48 00 02 9D */	bl __CARDReadStatus
/* 803B7FBC 003B4F1C  7C 7D 1B 79 */	or. r29, r3, r3
/* 803B7FC0 003B4F20  41 80 00 5C */	blt lbl_803B801C
/* 803B7FC4 003B4F24  7F E3 FB 78 */	mr r3, r31
/* 803B7FC8 003B4F28  48 00 03 7D */	bl __CARDClearStatus
/* 803B7FCC 003B4F2C  7C 7D 1B 79 */	or. r29, r3, r3
/* 803B7FD0 003B4F30  41 80 00 4C */	blt lbl_803B801C
/* 803B7FD4 003B4F34  88 01 00 10 */	lbz r0, 0x10(r1)
/* 803B7FD8 003B4F38  54 00 06 F9 */	rlwinm. r0, r0, 0, 0x1b, 0x1c
/* 803B7FDC 003B4F3C  41 82 00 0C */	beq lbl_803B7FE8
/* 803B7FE0 003B4F40  38 00 FF FB */	li r0, -5
/* 803B7FE4 003B4F44  48 00 00 08 */	b lbl_803B7FEC
lbl_803B7FE8:
/* 803B7FE8 003B4F48  38 00 00 00 */	li r0, 0
lbl_803B7FEC:
/* 803B7FEC 003B4F4C  7C 1D 03 78 */	mr r29, r0
/* 803B7FF0 003B4F50  2C 1D FF FB */	cmpwi r29, -5
/* 803B7FF4 003B4F54  40 82 00 28 */	bne lbl_803B801C
/* 803B7FF8 003B4F58  80 7E 00 A8 */	lwz r3, 0xa8(r30)
/* 803B7FFC 003B4F5C  34 03 FF FF */	addic. r0, r3, -1
/* 803B8000 003B4F60  90 1E 00 A8 */	stw r0, 0xa8(r30)
/* 803B8004 003B4F64  40 81 00 18 */	ble lbl_803B801C
/* 803B8008 003B4F68  7F E3 FB 78 */	mr r3, r31
/* 803B800C 003B4F6C  48 00 04 89 */	bl Retry
/* 803B8010 003B4F70  7C 7D 1B 79 */	or. r29, r3, r3
/* 803B8014 003B4F74  41 80 00 10 */	blt lbl_803B8024
/* 803B8018 003B4F78  48 00 00 34 */	b lbl_803B804C
lbl_803B801C:
/* 803B801C 003B4F7C  7F E3 FB 78 */	mr r3, r31
/* 803B8020 003B4F80  48 00 94 39 */	bl EXIUnlock
lbl_803B8024:
/* 803B8024 003B4F84  80 1E 00 CC */	lwz r0, 0xcc(r30)
/* 803B8028 003B4F88  28 00 00 00 */	cmplwi r0, 0
/* 803B802C 003B4F8C  7C 0C 03 78 */	mr r12, r0
/* 803B8030 003B4F90  41 82 00 1C */	beq lbl_803B804C
/* 803B8034 003B4F94  38 00 00 00 */	li r0, 0
/* 803B8038 003B4F98  7D 88 03 A6 */	mtlr r12
/* 803B803C 003B4F9C  90 1E 00 CC */	stw r0, 0xcc(r30)
/* 803B8040 003B4FA0  38 7F 00 00 */	addi r3, r31, 0
/* 803B8044 003B4FA4  38 9D 00 00 */	addi r4, r29, 0
/* 803B8048 003B4FA8  4E 80 00 21 */	blrl
lbl_803B804C:
/* 803B804C 003B4FAC  80 01 00 2C */	lwz r0, 0x2c(r1)
/* 803B8050 003B4FB0  83 E1 00 24 */	lwz r31, 0x24(r1)
/* 803B8054 003B4FB4  83 C1 00 20 */	lwz r30, 0x20(r1)
/* 803B8058 003B4FB8  83 A1 00 1C */	lwz r29, 0x1c(r1)
/* 803B805C 003B4FBC  38 21 00 28 */	addi r1, r1, 0x28
/* 803B8060 003B4FC0  7C 08 03 A6 */	mtlr r0
/* 803B8064 003B4FC4  4E 80 00 20 */	blr

.global __CARDTxHandler
__CARDTxHandler:
/* 803B8068 003B4FC8  7C 08 02 A6 */	mflr r0
/* 803B806C 003B4FCC  90 01 00 04 */	stw r0, 4(r1)
/* 803B8070 003B4FD0  94 21 FF D8 */	stwu r1, -0x28(r1)
/* 803B8074 003B4FD4  BF 61 00 14 */	stmw r27, 0x14(r1)
/* 803B8078 003B4FD8  3B 63 00 00 */	addi r27, r3, 0
/* 803B807C 003B4FDC  3C 60 80 57 */	lis r3, __CARDBlock@ha
/* 803B8080 003B4FE0  38 03 9A 58 */	addi r0, r3, __CARDBlock@l
/* 803B8084 003B4FE4  1C 9B 01 10 */	mulli r4, r27, 0x110
/* 803B8088 003B4FE8  38 7B 00 00 */	addi r3, r27, 0
/* 803B808C 003B4FEC  7F A0 22 14 */	add r29, r0, r4
/* 803B8090 003B4FF0  48 00 8C F9 */	bl EXIDeselect
/* 803B8094 003B4FF4  7C 60 00 34 */	cntlzw r0, r3
/* 803B8098 003B4FF8  38 7B 00 00 */	addi r3, r27, 0
/* 803B809C 003B4FFC  54 1F D9 7E */	srwi r31, r0, 5
/* 803B80A0 003B5000  48 00 93 B9 */	bl EXIUnlock
/* 803B80A4 003B5004  80 1D 00 C8 */	lwz r0, 0xc8(r29)
/* 803B80A8 003B5008  28 00 00 00 */	cmplwi r0, 0
/* 803B80AC 003B500C  7C 1C 03 78 */	mr r28, r0
/* 803B80B0 003B5010  41 82 00 4C */	beq lbl_803B80FC
/* 803B80B4 003B5014  3B C0 00 00 */	li r30, 0
/* 803B80B8 003B5018  2C 1F 00 00 */	cmpwi r31, 0
/* 803B80BC 003B501C  93 DD 00 C8 */	stw r30, 0xc8(r29)
/* 803B80C0 003B5020  40 82 00 18 */	bne lbl_803B80D8
/* 803B80C4 003B5024  7F 63 DB 78 */	mr r3, r27
/* 803B80C8 003B5028  48 00 88 99 */	bl EXIProbe
/* 803B80CC 003B502C  2C 03 00 00 */	cmpwi r3, 0
/* 803B80D0 003B5030  41 82 00 08 */	beq lbl_803B80D8
/* 803B80D4 003B5034  3B C0 00 01 */	li r30, 1
lbl_803B80D8:
/* 803B80D8 003B5038  2C 1E 00 00 */	cmpwi r30, 0
/* 803B80DC 003B503C  41 82 00 0C */	beq lbl_803B80E8
/* 803B80E0 003B5040  38 80 00 00 */	li r4, 0
/* 803B80E4 003B5044  48 00 00 08 */	b lbl_803B80EC
lbl_803B80E8:
/* 803B80E8 003B5048  38 80 FF FD */	li r4, -3
lbl_803B80EC:
/* 803B80EC 003B504C  39 9C 00 00 */	addi r12, r28, 0
/* 803B80F0 003B5050  7D 88 03 A6 */	mtlr r12
/* 803B80F4 003B5054  38 7B 00 00 */	addi r3, r27, 0
/* 803B80F8 003B5058  4E 80 00 21 */	blrl
lbl_803B80FC:
/* 803B80FC 003B505C  BB 61 00 14 */	lmw r27, 0x14(r1)
/* 803B8100 003B5060  80 01 00 2C */	lwz r0, 0x2c(r1)
/* 803B8104 003B5064  38 21 00 28 */	addi r1, r1, 0x28
/* 803B8108 003B5068  7C 08 03 A6 */	mtlr r0
/* 803B810C 003B506C  4E 80 00 20 */	blr

.global __CARDUnlockedHandler
__CARDUnlockedHandler:
/* 803B8110 003B5070  7C 08 02 A6 */	mflr r0
/* 803B8114 003B5074  90 01 00 04 */	stw r0, 4(r1)
/* 803B8118 003B5078  94 21 FF E8 */	stwu r1, -0x18(r1)
/* 803B811C 003B507C  93 E1 00 14 */	stw r31, 0x14(r1)
/* 803B8120 003B5080  93 C1 00 10 */	stw r30, 0x10(r1)
/* 803B8124 003B5084  3B C3 00 00 */	addi r30, r3, 0
/* 803B8128 003B5088  1C 9E 01 10 */	mulli r4, r30, 0x110
/* 803B812C 003B508C  3C 60 80 57 */	lis r3, __CARDBlock@ha
/* 803B8130 003B5090  38 03 9A 58 */	addi r0, r3, __CARDBlock@l
/* 803B8134 003B5094  7C 60 22 14 */	add r3, r0, r4
/* 803B8138 003B5098  80 03 00 DC */	lwz r0, 0xdc(r3)
/* 803B813C 003B509C  28 00 00 00 */	cmplwi r0, 0
/* 803B8140 003B50A0  7C 1F 03 78 */	mr r31, r0
/* 803B8144 003B50A4  41 82 00 38 */	beq lbl_803B817C
/* 803B8148 003B50A8  38 00 00 00 */	li r0, 0
/* 803B814C 003B50AC  90 03 00 DC */	stw r0, 0xdc(r3)
/* 803B8150 003B50B0  7F C3 F3 78 */	mr r3, r30
/* 803B8154 003B50B4  48 00 88 0D */	bl EXIProbe
/* 803B8158 003B50B8  2C 03 00 00 */	cmpwi r3, 0
/* 803B815C 003B50BC  41 82 00 0C */	beq lbl_803B8168
/* 803B8160 003B50C0  38 80 00 01 */	li r4, 1
/* 803B8164 003B50C4  48 00 00 08 */	b lbl_803B816C
lbl_803B8168:
/* 803B8168 003B50C8  38 80 FF FD */	li r4, -3
lbl_803B816C:
/* 803B816C 003B50CC  39 9F 00 00 */	addi r12, r31, 0
/* 803B8170 003B50D0  7D 88 03 A6 */	mtlr r12
/* 803B8174 003B50D4  38 7E 00 00 */	addi r3, r30, 0
/* 803B8178 003B50D8  4E 80 00 21 */	blrl
lbl_803B817C:
/* 803B817C 003B50DC  80 01 00 1C */	lwz r0, 0x1c(r1)
/* 803B8180 003B50E0  83 E1 00 14 */	lwz r31, 0x14(r1)
/* 803B8184 003B50E4  83 C1 00 10 */	lwz r30, 0x10(r1)
/* 803B8188 003B50E8  38 21 00 18 */	addi r1, r1, 0x18
/* 803B818C 003B50EC  7C 08 03 A6 */	mtlr r0
/* 803B8190 003B50F0  4E 80 00 20 */	blr

.global __CARDEnableInterrupt
__CARDEnableInterrupt:
/* 803B8194 003B50F4  7C 08 02 A6 */	mflr r0
/* 803B8198 003B50F8  38 A0 00 04 */	li r5, 4
/* 803B819C 003B50FC  90 01 00 04 */	stw r0, 4(r1)
/* 803B81A0 003B5100  94 21 FF E0 */	stwu r1, -0x20(r1)
/* 803B81A4 003B5104  93 E1 00 1C */	stw r31, 0x1c(r1)
/* 803B81A8 003B5108  3B E4 00 00 */	addi r31, r4, 0
/* 803B81AC 003B510C  38 80 00 00 */	li r4, 0
/* 803B81B0 003B5110  93 C1 00 18 */	stw r30, 0x18(r1)
/* 803B81B4 003B5114  3B C3 00 00 */	addi r30, r3, 0
/* 803B81B8 003B5118  48 00 8A A5 */	bl EXISelect
/* 803B81BC 003B511C  2C 03 00 00 */	cmpwi r3, 0
/* 803B81C0 003B5120  40 82 00 0C */	bne lbl_803B81CC
/* 803B81C4 003B5124  38 60 FF FD */	li r3, -3
/* 803B81C8 003B5128  48 00 00 74 */	b lbl_803B823C
lbl_803B81CC:
/* 803B81CC 003B512C  2C 1F 00 00 */	cmpwi r31, 0
/* 803B81D0 003B5130  41 82 00 0C */	beq lbl_803B81DC
/* 803B81D4 003B5134  3C 00 81 01 */	lis r0, 0x8101
/* 803B81D8 003B5138  48 00 00 08 */	b lbl_803B81E0
lbl_803B81DC:
/* 803B81DC 003B513C  3C 00 81 00 */	lis r0, 0x8100
lbl_803B81E0:
/* 803B81E0 003B5140  90 01 00 10 */	stw r0, 0x10(r1)
/* 803B81E4 003B5144  38 7E 00 00 */	addi r3, r30, 0
/* 803B81E8 003B5148  38 81 00 10 */	addi r4, r1, 0x10
/* 803B81EC 003B514C  38 A0 00 02 */	li r5, 2
/* 803B81F0 003B5150  38 C0 00 01 */	li r6, 1
/* 803B81F4 003B5154  38 E0 00 00 */	li r7, 0
/* 803B81F8 003B5158  48 00 7F 11 */	bl EXIImm
/* 803B81FC 003B515C  7C 60 00 34 */	cntlzw r0, r3
/* 803B8200 003B5160  38 7E 00 00 */	addi r3, r30, 0
/* 803B8204 003B5164  54 1F D9 7E */	srwi r31, r0, 5
/* 803B8208 003B5168  48 00 82 E9 */	bl EXISync
/* 803B820C 003B516C  7C 60 00 34 */	cntlzw r0, r3
/* 803B8210 003B5170  54 00 D9 7E */	srwi r0, r0, 5
/* 803B8214 003B5174  38 7E 00 00 */	addi r3, r30, 0
/* 803B8218 003B5178  7F FF 03 78 */	or r31, r31, r0
/* 803B821C 003B517C  48 00 8B 6D */	bl EXIDeselect
/* 803B8220 003B5180  7C 60 00 34 */	cntlzw r0, r3
/* 803B8224 003B5184  54 00 D9 7E */	srwi r0, r0, 5
/* 803B8228 003B5188  7F FF 03 79 */	or. r31, r31, r0
/* 803B822C 003B518C  41 82 00 0C */	beq lbl_803B8238
/* 803B8230 003B5190  38 60 FF FD */	li r3, -3
/* 803B8234 003B5194  48 00 00 08 */	b lbl_803B823C
lbl_803B8238:
/* 803B8238 003B5198  38 60 00 00 */	li r3, 0
lbl_803B823C:
/* 803B823C 003B519C  80 01 00 24 */	lwz r0, 0x24(r1)
/* 803B8240 003B51A0  83 E1 00 1C */	lwz r31, 0x1c(r1)
/* 803B8244 003B51A4  83 C1 00 18 */	lwz r30, 0x18(r1)
/* 803B8248 003B51A8  38 21 00 20 */	addi r1, r1, 0x20
/* 803B824C 003B51AC  7C 08 03 A6 */	mtlr r0
/* 803B8250 003B51B0  4E 80 00 20 */	blr

.global __CARDReadStatus
__CARDReadStatus:
/* 803B8254 003B51B4  7C 08 02 A6 */	mflr r0
/* 803B8258 003B51B8  38 A0 00 04 */	li r5, 4
/* 803B825C 003B51BC  90 01 00 04 */	stw r0, 4(r1)
/* 803B8260 003B51C0  94 21 FF D8 */	stwu r1, -0x28(r1)
/* 803B8264 003B51C4  93 E1 00 24 */	stw r31, 0x24(r1)
/* 803B8268 003B51C8  93 C1 00 20 */	stw r30, 0x20(r1)
/* 803B826C 003B51CC  3B C4 00 00 */	addi r30, r4, 0
/* 803B8270 003B51D0  38 80 00 00 */	li r4, 0
/* 803B8274 003B51D4  93 A1 00 1C */	stw r29, 0x1c(r1)
/* 803B8278 003B51D8  3B A3 00 00 */	addi r29, r3, 0
/* 803B827C 003B51DC  48 00 89 E1 */	bl EXISelect
/* 803B8280 003B51E0  2C 03 00 00 */	cmpwi r3, 0
/* 803B8284 003B51E4  40 82 00 0C */	bne lbl_803B8290
/* 803B8288 003B51E8  38 60 FF FD */	li r3, -3
/* 803B828C 003B51EC  48 00 00 9C */	b lbl_803B8328
lbl_803B8290:
/* 803B8290 003B51F0  3C 00 83 00 */	lis r0, 0x8300
/* 803B8294 003B51F4  90 01 00 10 */	stw r0, 0x10(r1)
/* 803B8298 003B51F8  38 7D 00 00 */	addi r3, r29, 0
/* 803B829C 003B51FC  38 81 00 10 */	addi r4, r1, 0x10
/* 803B82A0 003B5200  38 A0 00 02 */	li r5, 2
/* 803B82A4 003B5204  38 C0 00 01 */	li r6, 1
/* 803B82A8 003B5208  38 E0 00 00 */	li r7, 0
/* 803B82AC 003B520C  48 00 7E 5D */	bl EXIImm
/* 803B82B0 003B5210  7C 60 00 34 */	cntlzw r0, r3
/* 803B82B4 003B5214  38 7D 00 00 */	addi r3, r29, 0
/* 803B82B8 003B5218  54 1F D9 7E */	srwi r31, r0, 5
/* 803B82BC 003B521C  48 00 82 35 */	bl EXISync
/* 803B82C0 003B5220  7C 60 00 34 */	cntlzw r0, r3
/* 803B82C4 003B5224  54 00 D9 7E */	srwi r0, r0, 5
/* 803B82C8 003B5228  38 7D 00 00 */	addi r3, r29, 0
/* 803B82CC 003B522C  38 9E 00 00 */	addi r4, r30, 0
/* 803B82D0 003B5230  7F FF 03 78 */	or r31, r31, r0
/* 803B82D4 003B5234  38 A0 00 01 */	li r5, 1
/* 803B82D8 003B5238  38 C0 00 00 */	li r6, 0
/* 803B82DC 003B523C  38 E0 00 00 */	li r7, 0
/* 803B82E0 003B5240  48 00 7E 29 */	bl EXIImm
/* 803B82E4 003B5244  7C 60 00 34 */	cntlzw r0, r3
/* 803B82E8 003B5248  54 00 D9 7E */	srwi r0, r0, 5
/* 803B82EC 003B524C  38 7D 00 00 */	addi r3, r29, 0
/* 803B82F0 003B5250  7F FF 03 78 */	or r31, r31, r0
/* 803B82F4 003B5254  48 00 81 FD */	bl EXISync
/* 803B82F8 003B5258  7C 60 00 34 */	cntlzw r0, r3
/* 803B82FC 003B525C  54 00 D9 7E */	srwi r0, r0, 5
/* 803B8300 003B5260  38 7D 00 00 */	addi r3, r29, 0
/* 803B8304 003B5264  7F FF 03 78 */	or r31, r31, r0
/* 803B8308 003B5268  48 00 8A 81 */	bl EXIDeselect
/* 803B830C 003B526C  7C 60 00 34 */	cntlzw r0, r3
/* 803B8310 003B5270  54 00 D9 7E */	srwi r0, r0, 5
/* 803B8314 003B5274  7F FF 03 79 */	or. r31, r31, r0
/* 803B8318 003B5278  41 82 00 0C */	beq lbl_803B8324
/* 803B831C 003B527C  38 60 FF FD */	li r3, -3
/* 803B8320 003B5280  48 00 00 08 */	b lbl_803B8328
lbl_803B8324:
/* 803B8324 003B5284  38 60 00 00 */	li r3, 0
lbl_803B8328:
/* 803B8328 003B5288  80 01 00 2C */	lwz r0, 0x2c(r1)
/* 803B832C 003B528C  83 E1 00 24 */	lwz r31, 0x24(r1)
/* 803B8330 003B5290  83 C1 00 20 */	lwz r30, 0x20(r1)
/* 803B8334 003B5294  83 A1 00 1C */	lwz r29, 0x1c(r1)
/* 803B8338 003B5298  38 21 00 28 */	addi r1, r1, 0x28
/* 803B833C 003B529C  7C 08 03 A6 */	mtlr r0
/* 803B8340 003B52A0  4E 80 00 20 */	blr

.global __CARDClearStatus
__CARDClearStatus:
/* 803B8344 003B52A4  7C 08 02 A6 */	mflr r0
/* 803B8348 003B52A8  38 80 00 00 */	li r4, 0
/* 803B834C 003B52AC  90 01 00 04 */	stw r0, 4(r1)
/* 803B8350 003B52B0  38 A0 00 04 */	li r5, 4
/* 803B8354 003B52B4  94 21 FF E8 */	stwu r1, -0x18(r1)
/* 803B8358 003B52B8  93 E1 00 14 */	stw r31, 0x14(r1)
/* 803B835C 003B52BC  93 C1 00 10 */	stw r30, 0x10(r1)
/* 803B8360 003B52C0  3B C3 00 00 */	addi r30, r3, 0
/* 803B8364 003B52C4  48 00 88 F9 */	bl EXISelect
/* 803B8368 003B52C8  2C 03 00 00 */	cmpwi r3, 0
/* 803B836C 003B52CC  40 82 00 0C */	bne lbl_803B8378
/* 803B8370 003B52D0  38 60 FF FD */	li r3, -3
/* 803B8374 003B52D4  48 00 00 64 */	b lbl_803B83D8
lbl_803B8378:
/* 803B8378 003B52D8  3C 00 89 00 */	lis r0, 0x8900
/* 803B837C 003B52DC  90 01 00 0C */	stw r0, 0xc(r1)
/* 803B8380 003B52E0  38 7E 00 00 */	addi r3, r30, 0
/* 803B8384 003B52E4  38 81 00 0C */	addi r4, r1, 0xc
/* 803B8388 003B52E8  38 A0 00 01 */	li r5, 1
/* 803B838C 003B52EC  38 C0 00 01 */	li r6, 1
/* 803B8390 003B52F0  38 E0 00 00 */	li r7, 0
/* 803B8394 003B52F4  48 00 7D 75 */	bl EXIImm
/* 803B8398 003B52F8  7C 60 00 34 */	cntlzw r0, r3
/* 803B839C 003B52FC  38 7E 00 00 */	addi r3, r30, 0
/* 803B83A0 003B5300  54 1F D9 7E */	srwi r31, r0, 5
/* 803B83A4 003B5304  48 00 81 4D */	bl EXISync
/* 803B83A8 003B5308  7C 60 00 34 */	cntlzw r0, r3
/* 803B83AC 003B530C  54 00 D9 7E */	srwi r0, r0, 5
/* 803B83B0 003B5310  38 7E 00 00 */	addi r3, r30, 0
/* 803B83B4 003B5314  7F FF 03 78 */	or r31, r31, r0
/* 803B83B8 003B5318  48 00 89 D1 */	bl EXIDeselect
/* 803B83BC 003B531C  7C 60 00 34 */	cntlzw r0, r3
/* 803B83C0 003B5320  54 00 D9 7E */	srwi r0, r0, 5
/* 803B83C4 003B5324  7F FF 03 79 */	or. r31, r31, r0
/* 803B83C8 003B5328  41 82 00 0C */	beq lbl_803B83D4
/* 803B83CC 003B532C  38 60 FF FD */	li r3, -3
/* 803B83D0 003B5330  48 00 00 08 */	b lbl_803B83D8
lbl_803B83D4:
/* 803B83D4 003B5334  38 60 00 00 */	li r3, 0
lbl_803B83D8:
/* 803B83D8 003B5338  80 01 00 1C */	lwz r0, 0x1c(r1)
/* 803B83DC 003B533C  83 E1 00 14 */	lwz r31, 0x14(r1)
/* 803B83E0 003B5340  83 C1 00 10 */	lwz r30, 0x10(r1)
/* 803B83E4 003B5344  38 21 00 18 */	addi r1, r1, 0x18
/* 803B83E8 003B5348  7C 08 03 A6 */	mtlr r0
/* 803B83EC 003B534C  4E 80 00 20 */	blr

.global TimeoutHandler
TimeoutHandler:
/* 803B83F0 003B5350  7C 08 02 A6 */	mflr r0
/* 803B83F4 003B5354  3C 80 80 57 */	lis r4, __CARDBlock@ha
/* 803B83F8 003B5358  90 01 00 04 */	stw r0, 4(r1)
/* 803B83FC 003B535C  38 84 9A 58 */	addi r4, r4, __CARDBlock@l
/* 803B8400 003B5360  38 04 00 E0 */	addi r0, r4, 0xe0
/* 803B8404 003B5364  94 21 FF E8 */	stwu r1, -0x18(r1)
/* 803B8408 003B5368  7C 03 00 40 */	cmplw r3, r0
/* 803B840C 003B536C  93 E1 00 14 */	stw r31, 0x14(r1)
/* 803B8410 003B5370  3B E0 00 00 */	li r31, 0
/* 803B8414 003B5374  93 C1 00 10 */	stw r30, 0x10(r1)
/* 803B8418 003B5378  3B C4 00 00 */	addi r30, r4, 0
/* 803B841C 003B537C  41 82 00 20 */	beq lbl_803B843C
/* 803B8420 003B5380  38 04 01 F0 */	addi r0, r4, 0x1f0
/* 803B8424 003B5384  7C 03 00 40 */	cmplw r3, r0
/* 803B8428 003B5388  38 84 01 10 */	addi r4, r4, 0x110
/* 803B842C 003B538C  3B C4 00 00 */	addi r30, r4, 0
/* 803B8430 003B5390  3B E0 00 01 */	li r31, 1
/* 803B8434 003B5394  41 82 00 08 */	beq lbl_803B843C
/* 803B8438 003B5398  3B E0 00 02 */	li r31, 2
lbl_803B843C:
/* 803B843C 003B539C  80 1E 00 00 */	lwz r0, 0(r30)
/* 803B8440 003B53A0  2C 00 00 00 */	cmpwi r0, 0
/* 803B8444 003B53A4  41 82 00 38 */	beq lbl_803B847C
/* 803B8448 003B53A8  38 7F 00 00 */	addi r3, r31, 0
/* 803B844C 003B53AC  38 80 00 00 */	li r4, 0
/* 803B8450 003B53B0  48 00 83 21 */	bl EXISetExiCallback
/* 803B8454 003B53B4  80 1E 00 CC */	lwz r0, 0xcc(r30)
/* 803B8458 003B53B8  28 00 00 00 */	cmplwi r0, 0
/* 803B845C 003B53BC  7C 0C 03 78 */	mr r12, r0
/* 803B8460 003B53C0  41 82 00 1C */	beq lbl_803B847C
/* 803B8464 003B53C4  38 00 00 00 */	li r0, 0
/* 803B8468 003B53C8  7D 88 03 A6 */	mtlr r12
/* 803B846C 003B53CC  90 1E 00 CC */	stw r0, 0xcc(r30)
/* 803B8470 003B53D0  38 7F 00 00 */	addi r3, r31, 0
/* 803B8474 003B53D4  38 80 FF FB */	li r4, -5
/* 803B8478 003B53D8  4E 80 00 21 */	blrl
lbl_803B847C:
/* 803B847C 003B53DC  80 01 00 1C */	lwz r0, 0x1c(r1)
/* 803B8480 003B53E0  83 E1 00 14 */	lwz r31, 0x14(r1)
/* 803B8484 003B53E4  83 C1 00 10 */	lwz r30, 0x10(r1)
/* 803B8488 003B53E8  38 21 00 18 */	addi r1, r1, 0x18
/* 803B848C 003B53EC  7C 08 03 A6 */	mtlr r0
/* 803B8490 003B53F0  4E 80 00 20 */	blr

.global Retry
Retry:
/* 803B8494 003B53F4  7C 08 02 A6 */	mflr r0
/* 803B8498 003B53F8  38 A0 00 04 */	li r5, 4
/* 803B849C 003B53FC  90 01 00 04 */	stw r0, 4(r1)
/* 803B84A0 003B5400  94 21 FF E8 */	stwu r1, -0x18(r1)
/* 803B84A4 003B5404  93 E1 00 14 */	stw r31, 0x14(r1)
/* 803B84A8 003B5408  93 C1 00 10 */	stw r30, 0x10(r1)
/* 803B84AC 003B540C  3B C3 00 00 */	addi r30, r3, 0
/* 803B84B0 003B5410  1C 9E 01 10 */	mulli r4, r30, 0x110
/* 803B84B4 003B5414  3C 60 80 57 */	lis r3, __CARDBlock@ha
/* 803B84B8 003B5418  38 03 9A 58 */	addi r0, r3, __CARDBlock@l
/* 803B84BC 003B541C  7F E0 22 14 */	add r31, r0, r4
/* 803B84C0 003B5420  38 7E 00 00 */	addi r3, r30, 0
/* 803B84C4 003B5424  38 80 00 00 */	li r4, 0
/* 803B84C8 003B5428  48 00 87 95 */	bl EXISelect
/* 803B84CC 003B542C  2C 03 00 00 */	cmpwi r3, 0
/* 803B84D0 003B5430  40 82 00 14 */	bne lbl_803B84E4
/* 803B84D4 003B5434  7F C3 F3 78 */	mr r3, r30
/* 803B84D8 003B5438  48 00 8F 81 */	bl EXIUnlock
/* 803B84DC 003B543C  38 60 FF FD */	li r3, -3
/* 803B84E0 003B5440  48 00 01 C8 */	b lbl_803B86A8
lbl_803B84E4:
/* 803B84E4 003B5444  38 7F 00 E0 */	addi r3, r31, 0xe0
/* 803B84E8 003B5448  4B FC 5F 0D */	bl OSCancelAlarm
/* 803B84EC 003B544C  88 1F 00 94 */	lbz r0, 0x94(r31)
/* 803B84F0 003B5450  2C 00 00 F3 */	cmpwi r0, 0xf3
/* 803B84F4 003B5454  41 82 00 C0 */	beq lbl_803B85B4
/* 803B84F8 003B5458  40 80 00 14 */	bge lbl_803B850C
/* 803B84FC 003B545C  2C 00 00 F1 */	cmpwi r0, 0xf1
/* 803B8500 003B5460  41 82 00 50 */	beq lbl_803B8550
/* 803B8504 003B5464  40 80 00 14 */	bge lbl_803B8518
/* 803B8508 003B5468  48 00 00 AC */	b lbl_803B85B4
lbl_803B850C:
/* 803B850C 003B546C  2C 00 00 F5 */	cmpwi r0, 0xf5
/* 803B8510 003B5470  40 80 00 A4 */	bge lbl_803B85B4
/* 803B8514 003B5474  48 00 00 3C */	b lbl_803B8550
lbl_803B8518:
/* 803B8518 003B5478  3C 60 80 00 */	lis r3, 0x800000F8@ha
/* 803B851C 003B547C  80 03 00 F8 */	lwz r0, 0x800000F8@l(r3)
/* 803B8520 003B5480  3C 80 10 62 */	lis r4, 0x10624DD3@ha
/* 803B8524 003B5484  3C 60 80 3C */	lis r3, TimeoutHandler@ha
/* 803B8528 003B5488  54 00 F0 BE */	srwi r0, r0, 2
/* 803B852C 003B548C  38 84 4D D3 */	addi r4, r4, 0x10624DD3@l
/* 803B8530 003B5490  7C 04 00 16 */	mulhwu r0, r4, r0
/* 803B8534 003B5494  54 00 D1 BE */	srwi r0, r0, 6
/* 803B8538 003B5498  1C C0 00 64 */	mulli r6, r0, 0x64
/* 803B853C 003B549C  38 E3 83 F0 */	addi r7, r3, TimeoutHandler@l
/* 803B8540 003B54A0  38 7F 00 E0 */	addi r3, r31, 0xe0
/* 803B8544 003B54A4  38 A0 00 00 */	li r5, 0
/* 803B8548 003B54A8  4B FC 5D C9 */	bl OSSetAlarm
/* 803B854C 003B54AC  48 00 00 68 */	b lbl_803B85B4
lbl_803B8550:
/* 803B8550 003B54B0  3C 60 80 00 */	lis r3, 0x800000F8@ha
/* 803B8554 003B54B4  80 9F 00 0C */	lwz r4, 0xc(r31)
/* 803B8558 003B54B8  80 03 00 F8 */	lwz r0, 0x800000F8@l(r3)
/* 803B855C 003B54BC  3C 60 80 3C */	lis r3, TimeoutHandler@ha
/* 803B8560 003B54C0  7C 89 6E 70 */	srawi r9, r4, 0xd
/* 803B8564 003B54C4  54 07 F0 BE */	srwi r7, r0, 2
/* 803B8568 003B54C8  38 00 00 02 */	li r0, 2
/* 803B856C 003B54CC  38 80 00 00 */	li r4, 0
/* 803B8570 003B54D0  7D 04 01 D6 */	mullw r8, r4, r0
/* 803B8574 003B54D4  7C C7 00 16 */	mulhwu r6, r7, r0
/* 803B8578 003B54D8  7D 08 32 14 */	add r8, r8, r6
/* 803B857C 003B54DC  7C A7 01 D6 */	mullw r5, r7, r0
/* 803B8580 003B54E0  7D 29 01 94 */	addze r9, r9
/* 803B8584 003B54E4  7C C7 21 D6 */	mullw r6, r7, r4
/* 803B8588 003B54E8  7D 20 FE 70 */	srawi r0, r9, 0x1f
/* 803B858C 003B54EC  7C 80 29 D6 */	mullw r4, r0, r5
/* 803B8590 003B54F0  7C 09 28 16 */	mulhwu r0, r9, r5
/* 803B8594 003B54F4  38 E3 83 F0 */	addi r7, r3, TimeoutHandler@l
/* 803B8598 003B54F8  7C 68 32 14 */	add r3, r8, r6
/* 803B859C 003B54FC  7C 84 02 14 */	add r4, r4, r0
/* 803B85A0 003B5500  7C 09 19 D6 */	mullw r0, r9, r3
/* 803B85A4 003B5504  7C C9 29 D6 */	mullw r6, r9, r5
/* 803B85A8 003B5508  38 7F 00 E0 */	addi r3, r31, 0xe0
/* 803B85AC 003B550C  7C A4 02 14 */	add r5, r4, r0
/* 803B85B0 003B5510  4B FC 5D 61 */	bl OSSetAlarm
lbl_803B85B4:
/* 803B85B4 003B5514  80 BF 00 A0 */	lwz r5, 0xa0(r31)
/* 803B85B8 003B5518  38 7E 00 00 */	addi r3, r30, 0
/* 803B85BC 003B551C  38 9F 00 94 */	addi r4, r31, 0x94
/* 803B85C0 003B5520  38 C0 00 01 */	li r6, 1
/* 803B85C4 003B5524  48 00 7D A1 */	bl EXIImmEx
/* 803B85C8 003B5528  2C 03 00 00 */	cmpwi r3, 0
/* 803B85CC 003B552C  40 82 00 1C */	bne lbl_803B85E8
/* 803B85D0 003B5530  7F C3 F3 78 */	mr r3, r30
/* 803B85D4 003B5534  48 00 87 B5 */	bl EXIDeselect
/* 803B85D8 003B5538  7F C3 F3 78 */	mr r3, r30
/* 803B85DC 003B553C  48 00 8E 7D */	bl EXIUnlock
/* 803B85E0 003B5540  38 60 FF FD */	li r3, -3
/* 803B85E4 003B5544  48 00 00 C4 */	b lbl_803B86A8
lbl_803B85E8:
/* 803B85E8 003B5548  88 1F 00 94 */	lbz r0, 0x94(r31)
/* 803B85EC 003B554C  28 00 00 52 */	cmplwi r0, 0x52
/* 803B85F0 003B5550  40 82 00 3C */	bne lbl_803B862C
/* 803B85F4 003B5554  80 9F 00 80 */	lwz r4, 0x80(r31)
/* 803B85F8 003B5558  7F C3 F3 78 */	mr r3, r30
/* 803B85FC 003B555C  80 BF 00 14 */	lwz r5, 0x14(r31)
/* 803B8600 003B5560  38 C0 00 01 */	li r6, 1
/* 803B8604 003B5564  38 84 02 00 */	addi r4, r4, 0x200
/* 803B8608 003B5568  48 00 7D 5D */	bl EXIImmEx
/* 803B860C 003B556C  2C 03 00 00 */	cmpwi r3, 0
/* 803B8610 003B5570  40 82 00 1C */	bne lbl_803B862C
/* 803B8614 003B5574  7F C3 F3 78 */	mr r3, r30
/* 803B8618 003B5578  48 00 87 71 */	bl EXIDeselect
/* 803B861C 003B557C  7F C3 F3 78 */	mr r3, r30
/* 803B8620 003B5580  48 00 8E 39 */	bl EXIUnlock
/* 803B8624 003B5584  38 60 FF FD */	li r3, -3
/* 803B8628 003B5588  48 00 00 80 */	b lbl_803B86A8
lbl_803B862C:
/* 803B862C 003B558C  80 7F 00 A4 */	lwz r3, 0xa4(r31)
/* 803B8630 003B5590  3C 03 00 01 */	addis r0, r3, 1
/* 803B8634 003B5594  28 00 FF FF */	cmplwi r0, 0xffff
/* 803B8638 003B5598  40 82 00 1C */	bne lbl_803B8654
/* 803B863C 003B559C  7F C3 F3 78 */	mr r3, r30
/* 803B8640 003B55A0  48 00 87 49 */	bl EXIDeselect
/* 803B8644 003B55A4  7F C3 F3 78 */	mr r3, r30
/* 803B8648 003B55A8  48 00 8E 11 */	bl EXIUnlock
/* 803B864C 003B55AC  38 60 00 00 */	li r3, 0
/* 803B8650 003B55B0  48 00 00 58 */	b lbl_803B86A8
lbl_803B8654:
/* 803B8654 003B55B4  88 1F 00 94 */	lbz r0, 0x94(r31)
/* 803B8658 003B55B8  28 00 00 52 */	cmplwi r0, 0x52
/* 803B865C 003B55BC  40 82 00 0C */	bne lbl_803B8668
/* 803B8660 003B55C0  38 A0 02 00 */	li r5, 0x200
/* 803B8664 003B55C4  48 00 00 08 */	b lbl_803B866C
lbl_803B8668:
/* 803B8668 003B55C8  38 A0 00 80 */	li r5, 0x80
lbl_803B866C:
/* 803B866C 003B55CC  3C 60 80 3C */	lis r3, __CARDTxHandler@ha
/* 803B8670 003B55D0  80 9F 00 B4 */	lwz r4, 0xb4(r31)
/* 803B8674 003B55D4  38 E3 80 68 */	addi r7, r3, __CARDTxHandler@l
/* 803B8678 003B55D8  80 DF 00 A4 */	lwz r6, 0xa4(r31)
/* 803B867C 003B55DC  7F C3 F3 78 */	mr r3, r30
/* 803B8680 003B55E0  48 00 7D 85 */	bl EXIDma
/* 803B8684 003B55E4  2C 03 00 00 */	cmpwi r3, 0
/* 803B8688 003B55E8  40 82 00 1C */	bne lbl_803B86A4
/* 803B868C 003B55EC  7F C3 F3 78 */	mr r3, r30
/* 803B8690 003B55F0  48 00 86 F9 */	bl EXIDeselect
/* 803B8694 003B55F4  7F C3 F3 78 */	mr r3, r30
/* 803B8698 003B55F8  48 00 8D C1 */	bl EXIUnlock
/* 803B869C 003B55FC  38 60 FF FD */	li r3, -3
/* 803B86A0 003B5600  48 00 00 08 */	b lbl_803B86A8
lbl_803B86A4:
/* 803B86A4 003B5604  38 60 00 00 */	li r3, 0
lbl_803B86A8:
/* 803B86A8 003B5608  80 01 00 1C */	lwz r0, 0x1c(r1)
/* 803B86AC 003B560C  83 E1 00 14 */	lwz r31, 0x14(r1)
/* 803B86B0 003B5610  83 C1 00 10 */	lwz r30, 0x10(r1)
/* 803B86B4 003B5614  38 21 00 18 */	addi r1, r1, 0x18
/* 803B86B8 003B5618  7C 08 03 A6 */	mtlr r0
/* 803B86BC 003B561C  4E 80 00 20 */	blr

.global UnlockedCallback
UnlockedCallback:
/* 803B86C0 003B5620  7C 08 02 A6 */	mflr r0
/* 803B86C4 003B5624  2C 04 00 00 */	cmpwi r4, 0
/* 803B86C8 003B5628  90 01 00 04 */	stw r0, 4(r1)
/* 803B86CC 003B562C  94 21 FF E8 */	stwu r1, -0x18(r1)
/* 803B86D0 003B5630  93 E1 00 14 */	stw r31, 0x14(r1)
/* 803B86D4 003B5634  3B E3 00 00 */	addi r31, r3, 0
/* 803B86D8 003B5638  1C BF 01 10 */	mulli r5, r31, 0x110
/* 803B86DC 003B563C  93 C1 00 10 */	stw r30, 0x10(r1)
/* 803B86E0 003B5640  3C 60 80 57 */	lis r3, __CARDBlock@ha
/* 803B86E4 003B5644  38 03 9A 58 */	addi r0, r3, __CARDBlock@l
/* 803B86E8 003B5648  7F C0 2A 14 */	add r30, r0, r5
/* 803B86EC 003B564C  41 80 00 48 */	blt lbl_803B8734
/* 803B86F0 003B5650  3C 60 80 3C */	lis r3, UnlockedCallback@ha
/* 803B86F4 003B5654  38 03 86 C0 */	addi r0, r3, UnlockedCallback@l
/* 803B86F8 003B5658  3C 60 80 3C */	lis r3, __CARDUnlockedHandler@ha
/* 803B86FC 003B565C  90 1E 00 DC */	stw r0, 0xdc(r30)
/* 803B8700 003B5660  38 A3 81 10 */	addi r5, r3, __CARDUnlockedHandler@l
/* 803B8704 003B5664  38 7F 00 00 */	addi r3, r31, 0
/* 803B8708 003B5668  38 80 00 00 */	li r4, 0
/* 803B870C 003B566C  48 00 8C 59 */	bl EXILock
/* 803B8710 003B5670  2C 03 00 00 */	cmpwi r3, 0
/* 803B8714 003B5674  40 82 00 0C */	bne lbl_803B8720
/* 803B8718 003B5678  38 80 00 00 */	li r4, 0
/* 803B871C 003B567C  48 00 00 18 */	b lbl_803B8734
lbl_803B8720:
/* 803B8720 003B5680  38 00 00 00 */	li r0, 0
/* 803B8724 003B5684  90 1E 00 DC */	stw r0, 0xdc(r30)
/* 803B8728 003B5688  7F E3 FB 78 */	mr r3, r31
/* 803B872C 003B568C  4B FF FD 69 */	bl Retry
/* 803B8730 003B5690  7C 64 1B 78 */	mr r4, r3
lbl_803B8734:
/* 803B8734 003B5694  2C 04 00 00 */	cmpwi r4, 0
/* 803B8738 003B5698  40 80 00 80 */	bge lbl_803B87B8
/* 803B873C 003B569C  88 1E 00 94 */	lbz r0, 0x94(r30)
/* 803B8740 003B56A0  2C 00 00 F3 */	cmpwi r0, 0xf3
/* 803B8744 003B56A4  41 82 00 74 */	beq lbl_803B87B8
/* 803B8748 003B56A8  40 80 00 1C */	bge lbl_803B8764
/* 803B874C 003B56AC  2C 00 00 52 */	cmpwi r0, 0x52
/* 803B8750 003B56B0  41 82 00 20 */	beq lbl_803B8770
/* 803B8754 003B56B4  41 80 00 64 */	blt lbl_803B87B8
/* 803B8758 003B56B8  2C 00 00 F1 */	cmpwi r0, 0xf1
/* 803B875C 003B56BC  40 80 00 3C */	bge lbl_803B8798
/* 803B8760 003B56C0  48 00 00 58 */	b lbl_803B87B8
lbl_803B8764:
/* 803B8764 003B56C4  2C 00 00 F5 */	cmpwi r0, 0xf5
/* 803B8768 003B56C8  40 80 00 50 */	bge lbl_803B87B8
/* 803B876C 003B56CC  48 00 00 2C */	b lbl_803B8798
lbl_803B8770:
/* 803B8770 003B56D0  80 1E 00 C8 */	lwz r0, 0xc8(r30)
/* 803B8774 003B56D4  28 00 00 00 */	cmplwi r0, 0
/* 803B8778 003B56D8  7C 0C 03 78 */	mr r12, r0
/* 803B877C 003B56DC  41 82 00 3C */	beq lbl_803B87B8
/* 803B8780 003B56E0  38 00 00 00 */	li r0, 0
/* 803B8784 003B56E4  7D 88 03 A6 */	mtlr r12
/* 803B8788 003B56E8  90 1E 00 C8 */	stw r0, 0xc8(r30)
/* 803B878C 003B56EC  7F E3 FB 78 */	mr r3, r31
/* 803B8790 003B56F0  4E 80 00 21 */	blrl
/* 803B8794 003B56F4  48 00 00 24 */	b lbl_803B87B8
lbl_803B8798:
/* 803B8798 003B56F8  81 9E 00 CC */	lwz r12, 0xcc(r30)
/* 803B879C 003B56FC  28 0C 00 00 */	cmplwi r12, 0
/* 803B87A0 003B5700  41 82 00 18 */	beq lbl_803B87B8
/* 803B87A4 003B5704  38 00 00 00 */	li r0, 0
/* 803B87A8 003B5708  7D 88 03 A6 */	mtlr r12
/* 803B87AC 003B570C  90 1E 00 CC */	stw r0, 0xcc(r30)
/* 803B87B0 003B5710  7F E3 FB 78 */	mr r3, r31
/* 803B87B4 003B5714  4E 80 00 21 */	blrl
lbl_803B87B8:
/* 803B87B8 003B5718  80 01 00 1C */	lwz r0, 0x1c(r1)
/* 803B87BC 003B571C  83 E1 00 14 */	lwz r31, 0x14(r1)
/* 803B87C0 003B5720  83 C1 00 10 */	lwz r30, 0x10(r1)
/* 803B87C4 003B5724  38 21 00 18 */	addi r1, r1, 0x18
/* 803B87C8 003B5728  7C 08 03 A6 */	mtlr r0
/* 803B87CC 003B572C  4E 80 00 20 */	blr

.global __CARDStart
__CARDStart:
/* 803B87D0 003B5730  7C 08 02 A6 */	mflr r0
/* 803B87D4 003B5734  90 01 00 04 */	stw r0, 4(r1)
/* 803B87D8 003B5738  94 21 FF D0 */	stwu r1, -0x30(r1)
/* 803B87DC 003B573C  BF 61 00 1C */	stmw r27, 0x1c(r1)
/* 803B87E0 003B5740  3B 63 00 00 */	addi r27, r3, 0
/* 803B87E4 003B5744  3B 84 00 00 */	addi r28, r4, 0
/* 803B87E8 003B5748  3B A5 00 00 */	addi r29, r5, 0
/* 803B87EC 003B574C  4B FC 8E 75 */	bl OSDisableInterrupts
/* 803B87F0 003B5750  1C BB 01 10 */	mulli r5, r27, 0x110
/* 803B87F4 003B5754  3C 80 80 57 */	lis r4, __CARDBlock@ha
/* 803B87F8 003B5758  38 04 9A 58 */	addi r0, r4, __CARDBlock@l
/* 803B87FC 003B575C  7F E0 2A 14 */	add r31, r0, r5
/* 803B8800 003B5760  80 1F 00 00 */	lwz r0, 0(r31)
/* 803B8804 003B5764  3B C3 00 00 */	addi r30, r3, 0
/* 803B8808 003B5768  2C 00 00 00 */	cmpwi r0, 0
/* 803B880C 003B576C  40 82 00 0C */	bne lbl_803B8818
/* 803B8810 003B5770  3B E0 FF FD */	li r31, -3
/* 803B8814 003B5774  48 00 01 50 */	b lbl_803B8964
lbl_803B8818:
/* 803B8818 003B5778  28 1C 00 00 */	cmplwi r28, 0
/* 803B881C 003B577C  41 82 00 08 */	beq lbl_803B8824
/* 803B8820 003B5780  93 9F 00 C8 */	stw r28, 0xc8(r31)
lbl_803B8824:
/* 803B8824 003B5784  28 1D 00 00 */	cmplwi r29, 0
/* 803B8828 003B5788  41 82 00 08 */	beq lbl_803B8830
/* 803B882C 003B578C  93 BF 00 CC */	stw r29, 0xcc(r31)
lbl_803B8830:
/* 803B8830 003B5790  3C 60 80 3C */	lis r3, UnlockedCallback@ha
/* 803B8834 003B5794  38 03 86 C0 */	addi r0, r3, UnlockedCallback@l
/* 803B8838 003B5798  3C 60 80 3C */	lis r3, __CARDUnlockedHandler@ha
/* 803B883C 003B579C  90 1F 00 DC */	stw r0, 0xdc(r31)
/* 803B8840 003B57A0  38 A3 81 10 */	addi r5, r3, __CARDUnlockedHandler@l
/* 803B8844 003B57A4  38 7B 00 00 */	addi r3, r27, 0
/* 803B8848 003B57A8  38 80 00 00 */	li r4, 0
/* 803B884C 003B57AC  48 00 8B 19 */	bl EXILock
/* 803B8850 003B57B0  2C 03 00 00 */	cmpwi r3, 0
/* 803B8854 003B57B4  40 82 00 0C */	bne lbl_803B8860
/* 803B8858 003B57B8  3B E0 FF FF */	li r31, -1
/* 803B885C 003B57BC  48 00 01 08 */	b lbl_803B8964
lbl_803B8860:
/* 803B8860 003B57C0  38 00 00 00 */	li r0, 0
/* 803B8864 003B57C4  90 1F 00 DC */	stw r0, 0xdc(r31)
/* 803B8868 003B57C8  38 7B 00 00 */	addi r3, r27, 0
/* 803B886C 003B57CC  38 80 00 00 */	li r4, 0
/* 803B8870 003B57D0  38 A0 00 04 */	li r5, 4
/* 803B8874 003B57D4  48 00 83 E9 */	bl EXISelect
/* 803B8878 003B57D8  2C 03 00 00 */	cmpwi r3, 0
/* 803B887C 003B57DC  40 82 00 14 */	bne lbl_803B8890
/* 803B8880 003B57E0  7F 63 DB 78 */	mr r3, r27
/* 803B8884 003B57E4  48 00 8B D5 */	bl EXIUnlock
/* 803B8888 003B57E8  3B E0 FF FD */	li r31, -3
/* 803B888C 003B57EC  48 00 00 D8 */	b lbl_803B8964
lbl_803B8890:
/* 803B8890 003B57F0  38 7F 00 E0 */	addi r3, r31, 0xe0
/* 803B8894 003B57F4  4B FC 5B 61 */	bl OSCancelAlarm
/* 803B8898 003B57F8  88 1F 00 94 */	lbz r0, 0x94(r31)
/* 803B889C 003B57FC  2C 00 00 F3 */	cmpwi r0, 0xf3
/* 803B88A0 003B5800  41 82 00 C0 */	beq lbl_803B8960
/* 803B88A4 003B5804  40 80 00 14 */	bge lbl_803B88B8
/* 803B88A8 003B5808  2C 00 00 F1 */	cmpwi r0, 0xf1
/* 803B88AC 003B580C  41 82 00 50 */	beq lbl_803B88FC
/* 803B88B0 003B5810  40 80 00 14 */	bge lbl_803B88C4
/* 803B88B4 003B5814  48 00 00 AC */	b lbl_803B8960
lbl_803B88B8:
/* 803B88B8 003B5818  2C 00 00 F5 */	cmpwi r0, 0xf5
/* 803B88BC 003B581C  40 80 00 A4 */	bge lbl_803B8960
/* 803B88C0 003B5820  48 00 00 3C */	b lbl_803B88FC
lbl_803B88C4:
/* 803B88C4 003B5824  3C 60 80 00 */	lis r3, 0x800000F8@ha
/* 803B88C8 003B5828  80 03 00 F8 */	lwz r0, 0x800000F8@l(r3)
/* 803B88CC 003B582C  3C 80 10 62 */	lis r4, 0x10624DD3@ha
/* 803B88D0 003B5830  3C 60 80 3C */	lis r3, TimeoutHandler@ha
/* 803B88D4 003B5834  54 00 F0 BE */	srwi r0, r0, 2
/* 803B88D8 003B5838  38 84 4D D3 */	addi r4, r4, 0x10624DD3@l
/* 803B88DC 003B583C  7C 04 00 16 */	mulhwu r0, r4, r0
/* 803B88E0 003B5840  54 00 D1 BE */	srwi r0, r0, 6
/* 803B88E4 003B5844  1C C0 00 64 */	mulli r6, r0, 0x64
/* 803B88E8 003B5848  38 E3 83 F0 */	addi r7, r3, TimeoutHandler@l
/* 803B88EC 003B584C  38 7F 00 E0 */	addi r3, r31, 0xe0
/* 803B88F0 003B5850  38 A0 00 00 */	li r5, 0
/* 803B88F4 003B5854  4B FC 5A 1D */	bl OSSetAlarm
/* 803B88F8 003B5858  48 00 00 68 */	b lbl_803B8960
lbl_803B88FC:
/* 803B88FC 003B585C  3C 60 80 00 */	lis r3, 0x800000F8@ha
/* 803B8900 003B5860  80 9F 00 0C */	lwz r4, 0xc(r31)
/* 803B8904 003B5864  80 03 00 F8 */	lwz r0, 0x800000F8@l(r3)
/* 803B8908 003B5868  3C 60 80 3C */	lis r3, TimeoutHandler@ha
/* 803B890C 003B586C  7C 89 6E 70 */	srawi r9, r4, 0xd
/* 803B8910 003B5870  54 07 F0 BE */	srwi r7, r0, 2
/* 803B8914 003B5874  38 00 00 02 */	li r0, 2
/* 803B8918 003B5878  38 80 00 00 */	li r4, 0
/* 803B891C 003B587C  7D 04 01 D6 */	mullw r8, r4, r0
/* 803B8920 003B5880  7C C7 00 16 */	mulhwu r6, r7, r0
/* 803B8924 003B5884  7D 08 32 14 */	add r8, r8, r6
/* 803B8928 003B5888  7C A7 01 D6 */	mullw r5, r7, r0
/* 803B892C 003B588C  7D 29 01 94 */	addze r9, r9
/* 803B8930 003B5890  7C C7 21 D6 */	mullw r6, r7, r4
/* 803B8934 003B5894  7D 20 FE 70 */	srawi r0, r9, 0x1f
/* 803B8938 003B5898  7C 80 29 D6 */	mullw r4, r0, r5
/* 803B893C 003B589C  7C 09 28 16 */	mulhwu r0, r9, r5
/* 803B8940 003B58A0  38 E3 83 F0 */	addi r7, r3, TimeoutHandler@l
/* 803B8944 003B58A4  7C 68 32 14 */	add r3, r8, r6
/* 803B8948 003B58A8  7C 84 02 14 */	add r4, r4, r0
/* 803B894C 003B58AC  7C 09 19 D6 */	mullw r0, r9, r3
/* 803B8950 003B58B0  7C C9 29 D6 */	mullw r6, r9, r5
/* 803B8954 003B58B4  38 7F 00 E0 */	addi r3, r31, 0xe0
/* 803B8958 003B58B8  7C A4 02 14 */	add r5, r4, r0
/* 803B895C 003B58BC  4B FC 59 B5 */	bl OSSetAlarm
lbl_803B8960:
/* 803B8960 003B58C0  3B E0 00 00 */	li r31, 0
lbl_803B8964:
/* 803B8964 003B58C4  7F C3 F3 78 */	mr r3, r30
/* 803B8968 003B58C8  4B FC 8D 21 */	bl OSRestoreInterrupts
/* 803B896C 003B58CC  7F E3 FB 78 */	mr r3, r31
/* 803B8970 003B58D0  BB 61 00 1C */	lmw r27, 0x1c(r1)
/* 803B8974 003B58D4  80 01 00 34 */	lwz r0, 0x34(r1)
/* 803B8978 003B58D8  38 21 00 30 */	addi r1, r1, 0x30
/* 803B897C 003B58DC  7C 08 03 A6 */	mtlr r0
/* 803B8980 003B58E0  4E 80 00 20 */	blr

.global __CARDReadSegment
__CARDReadSegment:
/* 803B8984 003B58E4  7C 08 02 A6 */	mflr r0
/* 803B8988 003B58E8  38 C0 00 05 */	li r6, 5
/* 803B898C 003B58EC  90 01 00 04 */	stw r0, 4(r1)
/* 803B8990 003B58F0  94 21 FF E8 */	stwu r1, -0x18(r1)
/* 803B8994 003B58F4  93 E1 00 14 */	stw r31, 0x14(r1)
/* 803B8998 003B58F8  93 C1 00 10 */	stw r30, 0x10(r1)
/* 803B899C 003B58FC  3B C3 00 00 */	addi r30, r3, 0
/* 803B89A0 003B5900  1C BE 01 10 */	mulli r5, r30, 0x110
/* 803B89A4 003B5904  3C 60 80 57 */	lis r3, __CARDBlock@ha
/* 803B89A8 003B5908  38 03 9A 58 */	addi r0, r3, __CARDBlock@l
/* 803B89AC 003B590C  7F E0 2A 14 */	add r31, r0, r5
/* 803B89B0 003B5910  38 00 00 52 */	li r0, 0x52
/* 803B89B4 003B5914  98 1F 00 94 */	stb r0, 0x94(r31)
/* 803B89B8 003B5918  38 00 00 00 */	li r0, 0
/* 803B89BC 003B591C  38 7E 00 00 */	addi r3, r30, 0
/* 803B89C0 003B5920  80 BF 00 B0 */	lwz r5, 0xb0(r31)
/* 803B89C4 003B5924  54 A5 7E 7E */	rlwinm r5, r5, 0xf, 0x19, 0x1f
/* 803B89C8 003B5928  98 BF 00 95 */	stb r5, 0x95(r31)
/* 803B89CC 003B592C  38 A0 00 00 */	li r5, 0
/* 803B89D0 003B5930  80 FF 00 B0 */	lwz r7, 0xb0(r31)
/* 803B89D4 003B5934  54 E7 BE 3E */	rlwinm r7, r7, 0x17, 0x18, 0x1f
/* 803B89D8 003B5938  98 FF 00 96 */	stb r7, 0x96(r31)
/* 803B89DC 003B593C  80 FF 00 B0 */	lwz r7, 0xb0(r31)
/* 803B89E0 003B5940  54 E7 CF BE */	rlwinm r7, r7, 0x19, 0x1e, 0x1f
/* 803B89E4 003B5944  98 FF 00 97 */	stb r7, 0x97(r31)
/* 803B89E8 003B5948  80 FF 00 B0 */	lwz r7, 0xb0(r31)
/* 803B89EC 003B594C  54 E7 06 7E */	clrlwi r7, r7, 0x19
/* 803B89F0 003B5950  98 FF 00 98 */	stb r7, 0x98(r31)
/* 803B89F4 003B5954  90 DF 00 A0 */	stw r6, 0xa0(r31)
/* 803B89F8 003B5958  90 1F 00 A4 */	stw r0, 0xa4(r31)
/* 803B89FC 003B595C  90 1F 00 A8 */	stw r0, 0xa8(r31)
/* 803B8A00 003B5960  4B FF FD D1 */	bl __CARDStart
/* 803B8A04 003B5964  2C 03 FF FF */	cmpwi r3, -1
/* 803B8A08 003B5968  40 82 00 0C */	bne lbl_803B8A14
/* 803B8A0C 003B596C  38 60 00 00 */	li r3, 0
/* 803B8A10 003B5970  48 00 00 90 */	b lbl_803B8AA0
lbl_803B8A14:
/* 803B8A14 003B5974  2C 03 00 00 */	cmpwi r3, 0
/* 803B8A18 003B5978  41 80 00 88 */	blt lbl_803B8AA0
/* 803B8A1C 003B597C  80 BF 00 A0 */	lwz r5, 0xa0(r31)
/* 803B8A20 003B5980  38 7E 00 00 */	addi r3, r30, 0
/* 803B8A24 003B5984  38 9F 00 94 */	addi r4, r31, 0x94
/* 803B8A28 003B5988  38 C0 00 01 */	li r6, 1
/* 803B8A2C 003B598C  48 00 79 39 */	bl EXIImmEx
/* 803B8A30 003B5990  2C 03 00 00 */	cmpwi r3, 0
/* 803B8A34 003B5994  41 82 00 48 */	beq lbl_803B8A7C
/* 803B8A38 003B5998  80 9F 00 80 */	lwz r4, 0x80(r31)
/* 803B8A3C 003B599C  7F C3 F3 78 */	mr r3, r30
/* 803B8A40 003B59A0  80 BF 00 14 */	lwz r5, 0x14(r31)
/* 803B8A44 003B59A4  38 C0 00 01 */	li r6, 1
/* 803B8A48 003B59A8  38 84 02 00 */	addi r4, r4, 0x200
/* 803B8A4C 003B59AC  48 00 79 19 */	bl EXIImmEx
/* 803B8A50 003B59B0  2C 03 00 00 */	cmpwi r3, 0
/* 803B8A54 003B59B4  41 82 00 28 */	beq lbl_803B8A7C
/* 803B8A58 003B59B8  3C 60 80 3C */	lis r3, __CARDTxHandler@ha
/* 803B8A5C 003B59BC  80 9F 00 B4 */	lwz r4, 0xb4(r31)
/* 803B8A60 003B59C0  38 E3 80 68 */	addi r7, r3, __CARDTxHandler@l
/* 803B8A64 003B59C4  80 DF 00 A4 */	lwz r6, 0xa4(r31)
/* 803B8A68 003B59C8  38 7E 00 00 */	addi r3, r30, 0
/* 803B8A6C 003B59CC  38 A0 02 00 */	li r5, 0x200
/* 803B8A70 003B59D0  48 00 79 95 */	bl EXIDma
/* 803B8A74 003B59D4  2C 03 00 00 */	cmpwi r3, 0
/* 803B8A78 003B59D8  40 82 00 24 */	bne lbl_803B8A9C
lbl_803B8A7C:
/* 803B8A7C 003B59DC  38 00 00 00 */	li r0, 0
/* 803B8A80 003B59E0  90 1F 00 C8 */	stw r0, 0xc8(r31)
/* 803B8A84 003B59E4  7F C3 F3 78 */	mr r3, r30
/* 803B8A88 003B59E8  48 00 83 01 */	bl EXIDeselect
/* 803B8A8C 003B59EC  7F C3 F3 78 */	mr r3, r30
/* 803B8A90 003B59F0  48 00 89 C9 */	bl EXIUnlock
/* 803B8A94 003B59F4  38 60 FF FD */	li r3, -3
/* 803B8A98 003B59F8  48 00 00 08 */	b lbl_803B8AA0
lbl_803B8A9C:
/* 803B8A9C 003B59FC  38 60 00 00 */	li r3, 0
lbl_803B8AA0:
/* 803B8AA0 003B5A00  80 01 00 1C */	lwz r0, 0x1c(r1)
/* 803B8AA4 003B5A04  83 E1 00 14 */	lwz r31, 0x14(r1)
/* 803B8AA8 003B5A08  83 C1 00 10 */	lwz r30, 0x10(r1)
/* 803B8AAC 003B5A0C  38 21 00 18 */	addi r1, r1, 0x18
/* 803B8AB0 003B5A10  7C 08 03 A6 */	mtlr r0
/* 803B8AB4 003B5A14  4E 80 00 20 */	blr

.global __CARDWritePage
__CARDWritePage:
/* 803B8AB8 003B5A18  7C 08 02 A6 */	mflr r0
/* 803B8ABC 003B5A1C  38 E0 00 05 */	li r7, 5
/* 803B8AC0 003B5A20  90 01 00 04 */	stw r0, 4(r1)
/* 803B8AC4 003B5A24  38 C0 00 01 */	li r6, 1
/* 803B8AC8 003B5A28  94 21 FF E8 */	stwu r1, -0x18(r1)
/* 803B8ACC 003B5A2C  93 E1 00 14 */	stw r31, 0x14(r1)
/* 803B8AD0 003B5A30  93 C1 00 10 */	stw r30, 0x10(r1)
/* 803B8AD4 003B5A34  3B C3 00 00 */	addi r30, r3, 0
/* 803B8AD8 003B5A38  1C BE 01 10 */	mulli r5, r30, 0x110
/* 803B8ADC 003B5A3C  3C 60 80 57 */	lis r3, __CARDBlock@ha
/* 803B8AE0 003B5A40  38 03 9A 58 */	addi r0, r3, __CARDBlock@l
/* 803B8AE4 003B5A44  7F E0 2A 14 */	add r31, r0, r5
/* 803B8AE8 003B5A48  38 00 00 F2 */	li r0, 0xf2
/* 803B8AEC 003B5A4C  98 1F 00 94 */	stb r0, 0x94(r31)
/* 803B8AF0 003B5A50  38 A4 00 00 */	addi r5, r4, 0
/* 803B8AF4 003B5A54  38 00 00 03 */	li r0, 3
/* 803B8AF8 003B5A58  80 7F 00 B0 */	lwz r3, 0xb0(r31)
/* 803B8AFC 003B5A5C  38 80 00 00 */	li r4, 0
/* 803B8B00 003B5A60  54 63 7E 7E */	rlwinm r3, r3, 0xf, 0x19, 0x1f
/* 803B8B04 003B5A64  98 7F 00 95 */	stb r3, 0x95(r31)
/* 803B8B08 003B5A68  38 7E 00 00 */	addi r3, r30, 0
/* 803B8B0C 003B5A6C  81 1F 00 B0 */	lwz r8, 0xb0(r31)
/* 803B8B10 003B5A70  55 08 BE 3E */	rlwinm r8, r8, 0x17, 0x18, 0x1f
/* 803B8B14 003B5A74  99 1F 00 96 */	stb r8, 0x96(r31)
/* 803B8B18 003B5A78  81 1F 00 B0 */	lwz r8, 0xb0(r31)
/* 803B8B1C 003B5A7C  55 08 CF BE */	rlwinm r8, r8, 0x19, 0x1e, 0x1f
/* 803B8B20 003B5A80  99 1F 00 97 */	stb r8, 0x97(r31)
/* 803B8B24 003B5A84  81 1F 00 B0 */	lwz r8, 0xb0(r31)
/* 803B8B28 003B5A88  55 08 06 7E */	clrlwi r8, r8, 0x19
/* 803B8B2C 003B5A8C  99 1F 00 98 */	stb r8, 0x98(r31)
/* 803B8B30 003B5A90  90 FF 00 A0 */	stw r7, 0xa0(r31)
/* 803B8B34 003B5A94  90 DF 00 A4 */	stw r6, 0xa4(r31)
/* 803B8B38 003B5A98  90 1F 00 A8 */	stw r0, 0xa8(r31)
/* 803B8B3C 003B5A9C  4B FF FC 95 */	bl __CARDStart
/* 803B8B40 003B5AA0  2C 03 FF FF */	cmpwi r3, -1
/* 803B8B44 003B5AA4  40 82 00 0C */	bne lbl_803B8B50
/* 803B8B48 003B5AA8  38 60 00 00 */	li r3, 0
/* 803B8B4C 003B5AAC  48 00 00 70 */	b lbl_803B8BBC
lbl_803B8B50:
/* 803B8B50 003B5AB0  2C 03 00 00 */	cmpwi r3, 0
/* 803B8B54 003B5AB4  41 80 00 68 */	blt lbl_803B8BBC
/* 803B8B58 003B5AB8  80 BF 00 A0 */	lwz r5, 0xa0(r31)
/* 803B8B5C 003B5ABC  38 7E 00 00 */	addi r3, r30, 0
/* 803B8B60 003B5AC0  38 9F 00 94 */	addi r4, r31, 0x94
/* 803B8B64 003B5AC4  38 C0 00 01 */	li r6, 1
/* 803B8B68 003B5AC8  48 00 77 FD */	bl EXIImmEx
/* 803B8B6C 003B5ACC  2C 03 00 00 */	cmpwi r3, 0
/* 803B8B70 003B5AD0  41 82 00 28 */	beq lbl_803B8B98
/* 803B8B74 003B5AD4  3C 60 80 3C */	lis r3, __CARDTxHandler@ha
/* 803B8B78 003B5AD8  80 9F 00 B4 */	lwz r4, 0xb4(r31)
/* 803B8B7C 003B5ADC  38 E3 80 68 */	addi r7, r3, __CARDTxHandler@l
/* 803B8B80 003B5AE0  80 DF 00 A4 */	lwz r6, 0xa4(r31)
/* 803B8B84 003B5AE4  38 7E 00 00 */	addi r3, r30, 0
/* 803B8B88 003B5AE8  38 A0 00 80 */	li r5, 0x80
/* 803B8B8C 003B5AEC  48 00 78 79 */	bl EXIDma
/* 803B8B90 003B5AF0  2C 03 00 00 */	cmpwi r3, 0
/* 803B8B94 003B5AF4  40 82 00 24 */	bne lbl_803B8BB8
lbl_803B8B98:
/* 803B8B98 003B5AF8  38 00 00 00 */	li r0, 0
/* 803B8B9C 003B5AFC  90 1F 00 CC */	stw r0, 0xcc(r31)
/* 803B8BA0 003B5B00  7F C3 F3 78 */	mr r3, r30
/* 803B8BA4 003B5B04  48 00 81 E5 */	bl EXIDeselect
/* 803B8BA8 003B5B08  7F C3 F3 78 */	mr r3, r30
/* 803B8BAC 003B5B0C  48 00 88 AD */	bl EXIUnlock
/* 803B8BB0 003B5B10  38 60 FF FD */	li r3, -3
/* 803B8BB4 003B5B14  48 00 00 08 */	b lbl_803B8BBC
lbl_803B8BB8:
/* 803B8BB8 003B5B18  38 60 00 00 */	li r3, 0
lbl_803B8BBC:
/* 803B8BBC 003B5B1C  80 01 00 1C */	lwz r0, 0x1c(r1)
/* 803B8BC0 003B5B20  83 E1 00 14 */	lwz r31, 0x14(r1)
/* 803B8BC4 003B5B24  83 C1 00 10 */	lwz r30, 0x10(r1)
/* 803B8BC8 003B5B28  38 21 00 18 */	addi r1, r1, 0x18
/* 803B8BCC 003B5B2C  7C 08 03 A6 */	mtlr r0
/* 803B8BD0 003B5B30  4E 80 00 20 */	blr

.global __CARDEraseSector
__CARDEraseSector:
/* 803B8BD4 003B5B34  7C 08 02 A6 */	mflr r0
/* 803B8BD8 003B5B38  90 01 00 04 */	stw r0, 4(r1)
/* 803B8BDC 003B5B3C  94 21 FF D8 */	stwu r1, -0x28(r1)
/* 803B8BE0 003B5B40  93 E1 00 24 */	stw r31, 0x24(r1)
/* 803B8BE4 003B5B44  93 C1 00 20 */	stw r30, 0x20(r1)
/* 803B8BE8 003B5B48  93 A1 00 1C */	stw r29, 0x1c(r1)
/* 803B8BEC 003B5B4C  3B A3 00 00 */	addi r29, r3, 0
/* 803B8BF0 003B5B50  1C DD 01 10 */	mulli r6, r29, 0x110
/* 803B8BF4 003B5B54  3C 60 80 57 */	lis r3, __CARDBlock@ha
/* 803B8BF8 003B5B58  38 03 9A 58 */	addi r0, r3, __CARDBlock@l
/* 803B8BFC 003B5B5C  7F E0 32 14 */	add r31, r0, r6
/* 803B8C00 003B5B60  38 00 00 F1 */	li r0, 0xf1
/* 803B8C04 003B5B64  98 1F 00 94 */	stb r0, 0x94(r31)
/* 803B8C08 003B5B68  54 83 7E 7E */	rlwinm r3, r4, 0xf, 0x19, 0x1f
/* 803B8C0C 003B5B6C  54 80 BE 3E */	rlwinm r0, r4, 0x17, 0x18, 0x1f
/* 803B8C10 003B5B70  98 7F 00 95 */	stb r3, 0x95(r31)
/* 803B8C14 003B5B74  38 C0 00 03 */	li r6, 3
/* 803B8C18 003B5B78  38 7D 00 00 */	addi r3, r29, 0
/* 803B8C1C 003B5B7C  98 1F 00 96 */	stb r0, 0x96(r31)
/* 803B8C20 003B5B80  38 00 FF FF */	li r0, -1
/* 803B8C24 003B5B84  38 80 00 00 */	li r4, 0
/* 803B8C28 003B5B88  90 DF 00 A0 */	stw r6, 0xa0(r31)
/* 803B8C2C 003B5B8C  90 1F 00 A4 */	stw r0, 0xa4(r31)
/* 803B8C30 003B5B90  90 DF 00 A8 */	stw r6, 0xa8(r31)
/* 803B8C34 003B5B94  4B FF FB 9D */	bl __CARDStart
/* 803B8C38 003B5B98  3B C3 00 00 */	addi r30, r3, 0
/* 803B8C3C 003B5B9C  2C 1E FF FF */	cmpwi r30, -1
/* 803B8C40 003B5BA0  40 82 00 0C */	bne lbl_803B8C4C
/* 803B8C44 003B5BA4  3B C0 00 00 */	li r30, 0
/* 803B8C48 003B5BA8  48 00 00 4C */	b lbl_803B8C94
lbl_803B8C4C:
/* 803B8C4C 003B5BAC  2C 1E 00 00 */	cmpwi r30, 0
/* 803B8C50 003B5BB0  41 80 00 44 */	blt lbl_803B8C94
/* 803B8C54 003B5BB4  80 BF 00 A0 */	lwz r5, 0xa0(r31)
/* 803B8C58 003B5BB8  38 7D 00 00 */	addi r3, r29, 0
/* 803B8C5C 003B5BBC  38 9F 00 94 */	addi r4, r31, 0x94
/* 803B8C60 003B5BC0  38 C0 00 01 */	li r6, 1
/* 803B8C64 003B5BC4  48 00 77 01 */	bl EXIImmEx
/* 803B8C68 003B5BC8  2C 03 00 00 */	cmpwi r3, 0
/* 803B8C6C 003B5BCC  40 82 00 14 */	bne lbl_803B8C80
/* 803B8C70 003B5BD0  38 00 00 00 */	li r0, 0
/* 803B8C74 003B5BD4  90 1F 00 CC */	stw r0, 0xcc(r31)
/* 803B8C78 003B5BD8  3B C0 FF FD */	li r30, -3
/* 803B8C7C 003B5BDC  48 00 00 08 */	b lbl_803B8C84
lbl_803B8C80:
/* 803B8C80 003B5BE0  3B C0 00 00 */	li r30, 0
lbl_803B8C84:
/* 803B8C84 003B5BE4  7F A3 EB 78 */	mr r3, r29
/* 803B8C88 003B5BE8  48 00 81 01 */	bl EXIDeselect
/* 803B8C8C 003B5BEC  7F A3 EB 78 */	mr r3, r29
/* 803B8C90 003B5BF0  48 00 87 C9 */	bl EXIUnlock
lbl_803B8C94:
/* 803B8C94 003B5BF4  7F C3 F3 78 */	mr r3, r30
/* 803B8C98 003B5BF8  80 01 00 2C */	lwz r0, 0x2c(r1)
/* 803B8C9C 003B5BFC  83 E1 00 24 */	lwz r31, 0x24(r1)
/* 803B8CA0 003B5C00  83 C1 00 20 */	lwz r30, 0x20(r1)
/* 803B8CA4 003B5C04  83 A1 00 1C */	lwz r29, 0x1c(r1)
/* 803B8CA8 003B5C08  38 21 00 28 */	addi r1, r1, 0x28
/* 803B8CAC 003B5C0C  7C 08 03 A6 */	mtlr r0
/* 803B8CB0 003B5C10  4E 80 00 20 */	blr

.global CARDInit
CARDInit:
/* 803B8CB4 003B5C14  7C 08 02 A6 */	mflr r0
/* 803B8CB8 003B5C18  3C 60 80 57 */	lis r3, __CARDBlock@ha
/* 803B8CBC 003B5C1C  90 01 00 04 */	stw r0, 4(r1)
/* 803B8CC0 003B5C20  94 21 FF E8 */	stwu r1, -0x18(r1)
/* 803B8CC4 003B5C24  93 E1 00 14 */	stw r31, 0x14(r1)
/* 803B8CC8 003B5C28  93 C1 00 10 */	stw r30, 0x10(r1)
/* 803B8CCC 003B5C2C  3B C3 9A 58 */	addi r30, r3, __CARDBlock@l
/* 803B8CD0 003B5C30  93 A1 00 0C */	stw r29, 0xc(r1)
/* 803B8CD4 003B5C34  80 1E 01 0C */	lwz r0, 0x10c(r30)
/* 803B8CD8 003B5C38  28 00 00 00 */	cmplwi r0, 0
/* 803B8CDC 003B5C3C  41 82 00 10 */	beq lbl_803B8CEC
/* 803B8CE0 003B5C40  80 1E 02 1C */	lwz r0, 0x21c(r30)
/* 803B8CE4 003B5C44  28 00 00 00 */	cmplwi r0, 0
/* 803B8CE8 003B5C48  40 82 00 5C */	bne lbl_803B8D44
lbl_803B8CEC:
/* 803B8CEC 003B5C4C  4B FC 82 59 */	bl OSGetFontEncode
/* 803B8CF0 003B5C50  B0 6D B0 08 */	sth r3, __CARDEncode@sda21(r13)
/* 803B8CF4 003B5C54  80 6D A0 30 */	lwz r3, __CARDVersion@sda21(r13)
/* 803B8CF8 003B5C58  4B FC 53 41 */	bl OSRegisterVersion
/* 803B8CFC 003B5C5C  4B FB 6D 09 */	bl DSPInit
/* 803B8D00 003B5C60  4B FC 53 65 */	bl OSInitAlarm
/* 803B8D04 003B5C64  3B A0 00 00 */	li r29, 0
/* 803B8D08 003B5C68  3B E0 FF FD */	li r31, -3
lbl_803B8D0C:
/* 803B8D0C 003B5C6C  93 FE 00 04 */	stw r31, 4(r30)
/* 803B8D10 003B5C70  38 7E 00 8C */	addi r3, r30, 0x8c
/* 803B8D14 003B5C74  4B FC B8 B1 */	bl OSInitThreadQueue
/* 803B8D18 003B5C78  38 7E 00 E0 */	addi r3, r30, 0xe0
/* 803B8D1C 003B5C7C  4B FC 53 95 */	bl OSCreateAlarm
/* 803B8D20 003B5C80  3B BD 00 01 */	addi r29, r29, 1
/* 803B8D24 003B5C84  2C 1D 00 02 */	cmpwi r29, 2
/* 803B8D28 003B5C88  3B DE 01 10 */	addi r30, r30, 0x110
/* 803B8D2C 003B5C8C  41 80 FF E0 */	blt lbl_803B8D0C
/* 803B8D30 003B5C90  3C 60 80 00 */	lis r3, 0x8000
/* 803B8D34 003B5C94  48 00 00 35 */	bl __CARDSetDiskID
/* 803B8D38 003B5C98  3C 60 80 3F */	lis r3, ResetFunctionInfo@ha
/* 803B8D3C 003B5C9C  38 63 6C D8 */	addi r3, r3, ResetFunctionInfo@l
/* 803B8D40 003B5CA0  4B FC A2 ED */	bl OSRegisterResetFunction
lbl_803B8D44:
/* 803B8D44 003B5CA4  80 01 00 1C */	lwz r0, 0x1c(r1)
/* 803B8D48 003B5CA8  83 E1 00 14 */	lwz r31, 0x14(r1)
/* 803B8D4C 003B5CAC  83 C1 00 10 */	lwz r30, 0x10(r1)
/* 803B8D50 003B5CB0  83 A1 00 0C */	lwz r29, 0xc(r1)
/* 803B8D54 003B5CB4  38 21 00 18 */	addi r1, r1, 0x18
/* 803B8D58 003B5CB8  7C 08 03 A6 */	mtlr r0
/* 803B8D5C 003B5CBC  4E 80 00 20 */	blr

.global __CARDGetFontEncode
__CARDGetFontEncode:
/* 803B8D60 003B5CC0  A0 6D B0 08 */	lhz r3, __CARDEncode@sda21(r13)
/* 803B8D64 003B5CC4  4E 80 00 20 */	blr

.global __CARDSetDiskID
__CARDSetDiskID:
/* 803B8D68 003B5CC8  28 03 00 00 */	cmplwi r3, 0
/* 803B8D6C 003B5CCC  3C 80 80 57 */	lis r4, __CARDBlock@ha
/* 803B8D70 003B5CD0  38 84 9A 58 */	addi r4, r4, __CARDBlock@l
/* 803B8D74 003B5CD4  41 82 00 0C */	beq lbl_803B8D80
/* 803B8D78 003B5CD8  7C 60 1B 78 */	mr r0, r3
/* 803B8D7C 003B5CDC  48 00 00 08 */	b lbl_803B8D84
lbl_803B8D80:
/* 803B8D80 003B5CE0  38 04 02 20 */	addi r0, r4, 0x220
lbl_803B8D84:
/* 803B8D84 003B5CE4  28 03 00 00 */	cmplwi r3, 0
/* 803B8D88 003B5CE8  90 04 01 0C */	stw r0, 0x10c(r4)
/* 803B8D8C 003B5CEC  41 82 00 08 */	beq lbl_803B8D94
/* 803B8D90 003B5CF0  48 00 00 08 */	b lbl_803B8D98
lbl_803B8D94:
/* 803B8D94 003B5CF4  38 64 02 20 */	addi r3, r4, 0x220
lbl_803B8D98:
/* 803B8D98 003B5CF8  90 64 02 1C */	stw r3, 0x21c(r4)
/* 803B8D9C 003B5CFC  4E 80 00 20 */	blr

.global __CARDGetControlBlock
__CARDGetControlBlock:
/* 803B8DA0 003B5D00  7C 08 02 A6 */	mflr r0
/* 803B8DA4 003B5D04  1C C3 01 10 */	mulli r6, r3, 0x110
/* 803B8DA8 003B5D08  90 01 00 04 */	stw r0, 4(r1)
/* 803B8DAC 003B5D0C  94 21 FF E0 */	stwu r1, -0x20(r1)
/* 803B8DB0 003B5D10  3C A0 80 57 */	lis r5, __CARDBlock@ha
/* 803B8DB4 003B5D14  2C 03 00 00 */	cmpwi r3, 0
/* 803B8DB8 003B5D18  93 E1 00 1C */	stw r31, 0x1c(r1)
/* 803B8DBC 003B5D1C  38 05 9A 58 */	addi r0, r5, __CARDBlock@l
/* 803B8DC0 003B5D20  93 C1 00 18 */	stw r30, 0x18(r1)
/* 803B8DC4 003B5D24  7F C0 32 14 */	add r30, r0, r6
/* 803B8DC8 003B5D28  93 A1 00 14 */	stw r29, 0x14(r1)
/* 803B8DCC 003B5D2C  3B A4 00 00 */	addi r29, r4, 0
/* 803B8DD0 003B5D30  41 80 00 18 */	blt lbl_803B8DE8
/* 803B8DD4 003B5D34  2C 03 00 02 */	cmpwi r3, 2
/* 803B8DD8 003B5D38  40 80 00 10 */	bge lbl_803B8DE8
/* 803B8DDC 003B5D3C  80 1E 01 0C */	lwz r0, 0x10c(r30)
/* 803B8DE0 003B5D40  28 00 00 00 */	cmplwi r0, 0
/* 803B8DE4 003B5D44  40 82 00 0C */	bne lbl_803B8DF0
lbl_803B8DE8:
/* 803B8DE8 003B5D48  38 60 FF 80 */	li r3, -128
/* 803B8DEC 003B5D4C  48 00 00 50 */	b lbl_803B8E3C
lbl_803B8DF0:
/* 803B8DF0 003B5D50  4B FC 88 71 */	bl OSDisableInterrupts
/* 803B8DF4 003B5D54  80 1E 00 00 */	lwz r0, 0(r30)
/* 803B8DF8 003B5D58  2C 00 00 00 */	cmpwi r0, 0
/* 803B8DFC 003B5D5C  40 82 00 0C */	bne lbl_803B8E08
/* 803B8E00 003B5D60  3B E0 FF FD */	li r31, -3
/* 803B8E04 003B5D64  48 00 00 30 */	b lbl_803B8E34
lbl_803B8E08:
/* 803B8E08 003B5D68  80 1E 00 04 */	lwz r0, 4(r30)
/* 803B8E0C 003B5D6C  2C 00 FF FF */	cmpwi r0, -1
/* 803B8E10 003B5D70  40 82 00 0C */	bne lbl_803B8E1C
/* 803B8E14 003B5D74  3B E0 FF FF */	li r31, -1
/* 803B8E18 003B5D78  48 00 00 1C */	b lbl_803B8E34
lbl_803B8E1C:
/* 803B8E1C 003B5D7C  38 00 FF FF */	li r0, -1
/* 803B8E20 003B5D80  90 1E 00 04 */	stw r0, 4(r30)
/* 803B8E24 003B5D84  38 00 00 00 */	li r0, 0
/* 803B8E28 003B5D88  3B E0 00 00 */	li r31, 0
/* 803B8E2C 003B5D8C  90 1E 00 D0 */	stw r0, 0xd0(r30)
/* 803B8E30 003B5D90  93 DD 00 00 */	stw r30, 0(r29)
lbl_803B8E34:
/* 803B8E34 003B5D94  4B FC 88 55 */	bl OSRestoreInterrupts
/* 803B8E38 003B5D98  7F E3 FB 78 */	mr r3, r31
lbl_803B8E3C:
/* 803B8E3C 003B5D9C  80 01 00 24 */	lwz r0, 0x24(r1)
/* 803B8E40 003B5DA0  83 E1 00 1C */	lwz r31, 0x1c(r1)
/* 803B8E44 003B5DA4  83 C1 00 18 */	lwz r30, 0x18(r1)
/* 803B8E48 003B5DA8  83 A1 00 14 */	lwz r29, 0x14(r1)
/* 803B8E4C 003B5DAC  38 21 00 20 */	addi r1, r1, 0x20
/* 803B8E50 003B5DB0  7C 08 03 A6 */	mtlr r0
/* 803B8E54 003B5DB4  4E 80 00 20 */	blr

.global __CARDPutControlBlock
__CARDPutControlBlock:
/* 803B8E58 003B5DB8  7C 08 02 A6 */	mflr r0
/* 803B8E5C 003B5DBC  90 01 00 04 */	stw r0, 4(r1)
/* 803B8E60 003B5DC0  94 21 FF E8 */	stwu r1, -0x18(r1)
/* 803B8E64 003B5DC4  93 E1 00 14 */	stw r31, 0x14(r1)
/* 803B8E68 003B5DC8  3B E4 00 00 */	addi r31, r4, 0
/* 803B8E6C 003B5DCC  93 C1 00 10 */	stw r30, 0x10(r1)
/* 803B8E70 003B5DD0  3B C3 00 00 */	addi r30, r3, 0
/* 803B8E74 003B5DD4  4B FC 87 ED */	bl OSDisableInterrupts
/* 803B8E78 003B5DD8  80 1E 00 00 */	lwz r0, 0(r30)
/* 803B8E7C 003B5DDC  2C 00 00 00 */	cmpwi r0, 0
/* 803B8E80 003B5DE0  41 82 00 0C */	beq lbl_803B8E8C
/* 803B8E84 003B5DE4  93 FE 00 04 */	stw r31, 4(r30)
/* 803B8E88 003B5DE8  48 00 00 14 */	b lbl_803B8E9C
lbl_803B8E8C:
/* 803B8E8C 003B5DEC  80 1E 00 04 */	lwz r0, 4(r30)
/* 803B8E90 003B5DF0  2C 00 FF FF */	cmpwi r0, -1
/* 803B8E94 003B5DF4  40 82 00 08 */	bne lbl_803B8E9C
/* 803B8E98 003B5DF8  93 FE 00 04 */	stw r31, 4(r30)
lbl_803B8E9C:
/* 803B8E9C 003B5DFC  4B FC 87 ED */	bl OSRestoreInterrupts
/* 803B8EA0 003B5E00  7F E3 FB 78 */	mr r3, r31
/* 803B8EA4 003B5E04  80 01 00 1C */	lwz r0, 0x1c(r1)
/* 803B8EA8 003B5E08  83 E1 00 14 */	lwz r31, 0x14(r1)
/* 803B8EAC 003B5E0C  83 C1 00 10 */	lwz r30, 0x10(r1)
/* 803B8EB0 003B5E10  38 21 00 18 */	addi r1, r1, 0x18
/* 803B8EB4 003B5E14  7C 08 03 A6 */	mtlr r0
/* 803B8EB8 003B5E18  4E 80 00 20 */	blr

.global CARDGetResultCode
CARDGetResultCode:
/* 803B8EBC 003B5E1C  2C 03 00 00 */	cmpwi r3, 0
/* 803B8EC0 003B5E20  41 80 00 0C */	blt lbl_803B8ECC
/* 803B8EC4 003B5E24  2C 03 00 02 */	cmpwi r3, 2
/* 803B8EC8 003B5E28  41 80 00 0C */	blt lbl_803B8ED4
lbl_803B8ECC:
/* 803B8ECC 003B5E2C  38 60 FF 80 */	li r3, -128
/* 803B8ED0 003B5E30  4E 80 00 20 */	blr
lbl_803B8ED4:
/* 803B8ED4 003B5E34  1C 83 01 10 */	mulli r4, r3, 0x110
/* 803B8ED8 003B5E38  3C 60 80 57 */	lis r3, __CARDBlock@ha
/* 803B8EDC 003B5E3C  38 03 9A 58 */	addi r0, r3, __CARDBlock@l
/* 803B8EE0 003B5E40  7C 60 22 14 */	add r3, r0, r4
/* 803B8EE4 003B5E44  80 63 00 04 */	lwz r3, 4(r3)
/* 803B8EE8 003B5E48  4E 80 00 20 */	blr

.global CARDFreeBlocks
CARDFreeBlocks:
/* 803B8EEC 003B5E4C  7C 08 02 A6 */	mflr r0
/* 803B8EF0 003B5E50  90 01 00 04 */	stw r0, 4(r1)
/* 803B8EF4 003B5E54  94 21 FF D0 */	stwu r1, -0x30(r1)
/* 803B8EF8 003B5E58  93 E1 00 2C */	stw r31, 0x2c(r1)
/* 803B8EFC 003B5E5C  3B E5 00 00 */	addi r31, r5, 0
/* 803B8F00 003B5E60  93 C1 00 28 */	stw r30, 0x28(r1)
/* 803B8F04 003B5E64  93 A1 00 24 */	stw r29, 0x24(r1)
/* 803B8F08 003B5E68  3B A4 00 00 */	addi r29, r4, 0
/* 803B8F0C 003B5E6C  38 81 00 18 */	addi r4, r1, 0x18
/* 803B8F10 003B5E70  4B FF FE 91 */	bl __CARDGetControlBlock
/* 803B8F14 003B5E74  2C 03 00 00 */	cmpwi r3, 0
/* 803B8F18 003B5E78  40 80 00 08 */	bge lbl_803B8F20
/* 803B8F1C 003B5E7C  48 00 01 04 */	b lbl_803B9020
lbl_803B8F20:
/* 803B8F20 003B5E80  80 61 00 18 */	lwz r3, 0x18(r1)
/* 803B8F24 003B5E84  48 00 16 49 */	bl __CARDGetFatBlock
/* 803B8F28 003B5E88  7C 7E 1B 78 */	mr r30, r3
/* 803B8F2C 003B5E8C  80 61 00 18 */	lwz r3, 0x18(r1)
/* 803B8F30 003B5E90  48 00 1A 41 */	bl __CARDGetDirBlock
/* 803B8F34 003B5E94  28 1E 00 00 */	cmplwi r30, 0
/* 803B8F38 003B5E98  41 82 00 0C */	beq lbl_803B8F44
/* 803B8F3C 003B5E9C  28 03 00 00 */	cmplwi r3, 0
/* 803B8F40 003B5EA0  40 82 00 44 */	bne lbl_803B8F84
lbl_803B8F44:
/* 803B8F44 003B5EA4  83 C1 00 18 */	lwz r30, 0x18(r1)
/* 803B8F48 003B5EA8  4B FC 87 19 */	bl OSDisableInterrupts
/* 803B8F4C 003B5EAC  80 1E 00 00 */	lwz r0, 0(r30)
/* 803B8F50 003B5EB0  2C 00 00 00 */	cmpwi r0, 0
/* 803B8F54 003B5EB4  41 82 00 10 */	beq lbl_803B8F64
/* 803B8F58 003B5EB8  38 00 FF FA */	li r0, -6
/* 803B8F5C 003B5EBC  90 1E 00 04 */	stw r0, 4(r30)
/* 803B8F60 003B5EC0  48 00 00 18 */	b lbl_803B8F78
lbl_803B8F64:
/* 803B8F64 003B5EC4  80 1E 00 04 */	lwz r0, 4(r30)
/* 803B8F68 003B5EC8  2C 00 FF FF */	cmpwi r0, -1
/* 803B8F6C 003B5ECC  40 82 00 0C */	bne lbl_803B8F78
/* 803B8F70 003B5ED0  38 00 FF FA */	li r0, -6
/* 803B8F74 003B5ED4  90 1E 00 04 */	stw r0, 4(r30)
lbl_803B8F78:
/* 803B8F78 003B5ED8  4B FC 87 11 */	bl OSRestoreInterrupts
/* 803B8F7C 003B5EDC  38 60 FF FA */	li r3, -6
/* 803B8F80 003B5EE0  48 00 00 A0 */	b lbl_803B9020
lbl_803B8F84:
/* 803B8F84 003B5EE4  28 1D 00 00 */	cmplwi r29, 0
/* 803B8F88 003B5EE8  41 82 00 18 */	beq lbl_803B8FA0
/* 803B8F8C 003B5EEC  80 81 00 18 */	lwz r4, 0x18(r1)
/* 803B8F90 003B5EF0  A0 1E 00 06 */	lhz r0, 6(r30)
/* 803B8F94 003B5EF4  80 84 00 0C */	lwz r4, 0xc(r4)
/* 803B8F98 003B5EF8  7C 04 01 D6 */	mullw r0, r4, r0
/* 803B8F9C 003B5EFC  90 1D 00 00 */	stw r0, 0(r29)
lbl_803B8FA0:
/* 803B8FA0 003B5F00  28 1F 00 00 */	cmplwi r31, 0
/* 803B8FA4 003B5F04  41 82 00 40 */	beq lbl_803B8FE4
/* 803B8FA8 003B5F08  38 00 00 00 */	li r0, 0
/* 803B8FAC 003B5F0C  90 1F 00 00 */	stw r0, 0(r31)
/* 803B8FB0 003B5F10  38 A0 00 00 */	li r5, 0
/* 803B8FB4 003B5F14  48 00 00 24 */	b lbl_803B8FD8
lbl_803B8FB8:
/* 803B8FB8 003B5F18  88 03 00 08 */	lbz r0, 8(r3)
/* 803B8FBC 003B5F1C  28 00 00 FF */	cmplwi r0, 0xff
/* 803B8FC0 003B5F20  40 82 00 10 */	bne lbl_803B8FD0
/* 803B8FC4 003B5F24  80 9F 00 00 */	lwz r4, 0(r31)
/* 803B8FC8 003B5F28  38 04 00 01 */	addi r0, r4, 1
/* 803B8FCC 003B5F2C  90 1F 00 00 */	stw r0, 0(r31)
lbl_803B8FD0:
/* 803B8FD0 003B5F30  38 63 00 40 */	addi r3, r3, 0x40
/* 803B8FD4 003B5F34  38 A5 00 01 */	addi r5, r5, 1
lbl_803B8FD8:
/* 803B8FD8 003B5F38  54 A0 04 3E */	clrlwi r0, r5, 0x10
/* 803B8FDC 003B5F3C  28 00 00 7F */	cmplwi r0, 0x7f
/* 803B8FE0 003B5F40  41 80 FF D8 */	blt lbl_803B8FB8
lbl_803B8FE4:
/* 803B8FE4 003B5F44  83 C1 00 18 */	lwz r30, 0x18(r1)
/* 803B8FE8 003B5F48  4B FC 86 79 */	bl OSDisableInterrupts
/* 803B8FEC 003B5F4C  80 1E 00 00 */	lwz r0, 0(r30)
/* 803B8FF0 003B5F50  2C 00 00 00 */	cmpwi r0, 0
/* 803B8FF4 003B5F54  41 82 00 10 */	beq lbl_803B9004
/* 803B8FF8 003B5F58  38 00 00 00 */	li r0, 0
/* 803B8FFC 003B5F5C  90 1E 00 04 */	stw r0, 4(r30)
/* 803B9000 003B5F60  48 00 00 18 */	b lbl_803B9018
lbl_803B9004:
/* 803B9004 003B5F64  80 1E 00 04 */	lwz r0, 4(r30)
/* 803B9008 003B5F68  2C 00 FF FF */	cmpwi r0, -1
/* 803B900C 003B5F6C  40 82 00 0C */	bne lbl_803B9018
/* 803B9010 003B5F70  38 00 00 00 */	li r0, 0
/* 803B9014 003B5F74  90 1E 00 04 */	stw r0, 4(r30)
lbl_803B9018:
/* 803B9018 003B5F78  4B FC 86 71 */	bl OSRestoreInterrupts
/* 803B901C 003B5F7C  38 60 00 00 */	li r3, 0
lbl_803B9020:
/* 803B9020 003B5F80  80 01 00 34 */	lwz r0, 0x34(r1)
/* 803B9024 003B5F84  83 E1 00 2C */	lwz r31, 0x2c(r1)
/* 803B9028 003B5F88  83 C1 00 28 */	lwz r30, 0x28(r1)
/* 803B902C 003B5F8C  83 A1 00 24 */	lwz r29, 0x24(r1)
/* 803B9030 003B5F90  38 21 00 30 */	addi r1, r1, 0x30
/* 803B9034 003B5F94  7C 08 03 A6 */	mtlr r0
/* 803B9038 003B5F98  4E 80 00 20 */	blr

OnReset:
/* 803B903C 003B5F9C  7C 08 02 A6 */	mflr r0
/* 803B9040 003B5FA0  2C 03 00 00 */	cmpwi r3, 0
/* 803B9044 003B5FA4  90 01 00 04 */	stw r0, 4(r1)
/* 803B9048 003B5FA8  94 21 FF F8 */	stwu r1, -8(r1)
/* 803B904C 003B5FAC  40 82 00 2C */	bne lbl_803B9078
/* 803B9050 003B5FB0  38 60 00 00 */	li r3, 0
/* 803B9054 003B5FB4  48 00 34 89 */	bl CARDUnmount
/* 803B9058 003B5FB8  2C 03 FF FF */	cmpwi r3, -1
/* 803B905C 003B5FBC  41 82 00 14 */	beq lbl_803B9070
/* 803B9060 003B5FC0  38 60 00 01 */	li r3, 1
/* 803B9064 003B5FC4  48 00 34 79 */	bl CARDUnmount
/* 803B9068 003B5FC8  2C 03 FF FF */	cmpwi r3, -1
/* 803B906C 003B5FCC  40 82 00 0C */	bne lbl_803B9078
lbl_803B9070:
/* 803B9070 003B5FD0  38 60 00 00 */	li r3, 0
/* 803B9074 003B5FD4  48 00 00 08 */	b lbl_803B907C
lbl_803B9078:
/* 803B9078 003B5FD8  38 60 00 01 */	li r3, 1
lbl_803B907C:
/* 803B907C 003B5FDC  80 01 00 0C */	lwz r0, 0xc(r1)
/* 803B9080 003B5FE0  38 21 00 08 */	addi r1, r1, 8
/* 803B9084 003B5FE4  7C 08 03 A6 */	mtlr r0
/* 803B9088 003B5FE8  4E 80 00 20 */	blr