.include "macros.inc"

.section .text, "ax"

.global __va_arg
__va_arg:
/* 8038957C 003864DC  88 E3 00 00 */	lbz r7, 0(r3)
/* 80389580 003864E0  2C 04 00 03 */	cmpwi r4, 3
/* 80389584 003864E4  7C 66 1B 78 */	mr r6, r3
/* 80389588 003864E8  38 00 00 08 */	li r0, 8
/* 8038958C 003864EC  39 00 00 04 */	li r8, 4
/* 80389590 003864F0  7C E7 07 74 */	extsb r7, r7
/* 80389594 003864F4  39 20 00 01 */	li r9, 1
/* 80389598 003864F8  38 A0 00 00 */	li r5, 0
/* 8038959C 003864FC  39 40 00 00 */	li r10, 0
/* 803895A0 00386500  39 60 00 04 */	li r11, 4
/* 803895A4 00386504  40 82 00 1C */	bne lbl_803895C0
/* 803895A8 00386508  88 E3 00 01 */	lbz r7, 1(r3)
/* 803895AC 0038650C  38 C3 00 01 */	addi r6, r3, 1
/* 803895B0 00386510  39 00 00 08 */	li r8, 8
/* 803895B4 00386514  39 40 00 20 */	li r10, 0x20
/* 803895B8 00386518  7C E7 07 74 */	extsb r7, r7
/* 803895BC 0038651C  39 60 00 08 */	li r11, 8
lbl_803895C0:
/* 803895C0 00386520  2C 04 00 02 */	cmpwi r4, 2
/* 803895C4 00386524  40 82 00 1C */	bne lbl_803895E0
/* 803895C8 00386528  54 E0 07 FF */	clrlwi. r0, r7, 0x1f
/* 803895CC 0038652C  39 00 00 08 */	li r8, 8
/* 803895D0 00386530  38 00 00 07 */	li r0, 7
/* 803895D4 00386534  41 82 00 08 */	beq lbl_803895DC
/* 803895D8 00386538  38 A0 00 01 */	li r5, 1
lbl_803895DC:
/* 803895DC 0038653C  39 20 00 02 */	li r9, 2
lbl_803895E0:
/* 803895E0 00386540  7C 07 00 00 */	cmpw r7, r0
/* 803895E4 00386544  40 80 00 24 */	bge lbl_80389608
/* 803895E8 00386548  7C E7 2A 14 */	add r7, r7, r5
/* 803895EC 0038654C  80 A3 00 08 */	lwz r5, 8(r3)
/* 803895F0 00386550  7C 67 59 D6 */	mullw r3, r7, r11
/* 803895F4 00386554  7C 07 4A 14 */	add r0, r7, r9
/* 803895F8 00386558  98 06 00 00 */	stb r0, 0(r6)
/* 803895FC 0038655C  7C CA 1A 14 */	add r6, r10, r3
/* 80389600 00386560  7C C5 32 14 */	add r6, r5, r6
/* 80389604 00386564  48 00 00 2C */	b lbl_80389630
lbl_80389608:
/* 80389608 00386568  38 A0 00 08 */	li r5, 8
/* 8038960C 0038656C  38 08 FF FF */	addi r0, r8, -1
/* 80389610 00386570  98 A6 00 00 */	stb r5, 0(r6)
/* 80389614 00386574  7C 06 00 F8 */	nor r6, r0, r0
/* 80389618 00386578  80 03 00 04 */	lwz r0, 4(r3)
/* 8038961C 0038657C  7C A8 02 14 */	add r5, r8, r0
/* 80389620 00386580  38 05 FF FF */	addi r0, r5, -1
/* 80389624 00386584  7C C6 00 38 */	and r6, r6, r0
/* 80389628 00386588  7C 06 42 14 */	add r0, r6, r8
/* 8038962C 0038658C  90 03 00 04 */	stw r0, 4(r3)
lbl_80389630:
/* 80389630 00386590  2C 04 00 00 */	cmpwi r4, 0
/* 80389634 00386594  40 82 00 08 */	bne lbl_8038963C
/* 80389638 00386598  80 C6 00 00 */	lwz r6, 0(r6)
lbl_8038963C:
/* 8038963C 0038659C  7C C3 33 78 */	mr r3, r6
/* 80389640 003865A0  4E 80 00 20 */	blr