.include "macros.inc"
.section .text, "ax"
.global GDSetCurrentMtx
GDSetCurrentMtx:
mflr r0
slwi r11, r4, 6
stw r0, 4(r1)
slwi r9, r9, 6
slwi r6, r6, 0x12
stwu r1, -0x50(r1)
slwi r7, r7, 0x18
stmw r23, 0x2c(r1)
lwz r23, 0x58(r1)
lwz r12, __GDCurrentDL@sda21(r13)
lwz r4, 8(r12)
lwz r0, 0xc(r12)
slwi r12, r5, 0xc
or r5, r3, r11
addi r3, r4, 1
cmplw r3, r0
or r4, r12, r5
or r5, r6, r4
slwi r3, r10, 0xc
or r0, r8, r9
slwi r4, r23, 0x12
or r0, r3, r0
or r24, r7, r5
or r23, r4, r0
ble lbl_800B28D4
bl GDOverflowed
lbl_800B28D4:
lwz r4, __GDCurrentDL@sda21(r13)
li r5, 8
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 1
cmplw r3, r0
ble lbl_800B2908
bl GDOverflowed
lbl_800B2908:
lwz r4, __GDCurrentDL@sda21(r13)
li r5, 0x30
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 4
cmplw r3, r0
ble lbl_800B293C
bl GDOverflowed
lbl_800B293C:
lwz r4, __GDCurrentDL@sda21(r13)
srwi r31, r24, 0x18
rlwinm r30, r24, 0x10, 0x18, 0x1f
lwz r3, 8(r4)
rlwinm r29, r24, 0x18, 0x18, 0x1f
clrlwi r28, r24, 0x18
addi r0, r3, 1
stw r0, 8(r4)
stb r31, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r30, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r29, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r24, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 1
cmplw r3, r0
ble lbl_800B29B8
bl GDOverflowed
lbl_800B29B8:
lwz r4, __GDCurrentDL@sda21(r13)
li r5, 8
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 1
cmplw r3, r0
ble lbl_800B29EC
bl GDOverflowed
lbl_800B29EC:
lwz r4, __GDCurrentDL@sda21(r13)
li r5, 0x40
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 4
cmplw r3, r0
ble lbl_800B2A20
bl GDOverflowed
lbl_800B2A20:
lwz r4, __GDCurrentDL@sda21(r13)
srwi r27, r23, 0x18
rlwinm r26, r23, 0x10, 0x18, 0x1f
lwz r3, 8(r4)
rlwinm r25, r23, 0x18, 0x18, 0x1f
clrlwi r24, r23, 0x18
addi r0, r3, 1
stw r0, 8(r4)
stb r27, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r26, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r25, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r23, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 1
cmplw r3, r0
ble lbl_800B2A9C
bl GDOverflowed
lbl_800B2A9C:
lwz r4, __GDCurrentDL@sda21(r13)
li r5, 0x10
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 2
cmplw r3, r0
ble lbl_800B2AD0
bl GDOverflowed
lbl_800B2AD0:
lwz r4, __GDCurrentDL@sda21(r13)
li r6, 0
li r5, 1
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r6, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 2
cmplw r3, r0
ble lbl_800B2B1C
bl GDOverflowed
lbl_800B2B1C:
lwz r4, __GDCurrentDL@sda21(r13)
li r6, 0x10
li r5, 0x18
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r6, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r5, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 4
cmplw r3, r0
ble lbl_800B2B68
bl GDOverflowed
lbl_800B2B68:
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r31, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r30, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r29, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r28, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
lwz r0, 0xc(r4)
addi r3, r3, 4
cmplw r3, r0
ble lbl_800B2BD4
bl GDOverflowed
lbl_800B2BD4:
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r27, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r26, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r25, 0(r3)
lwz r4, __GDCurrentDL@sda21(r13)
lwz r3, 8(r4)
addi r0, r3, 1
stw r0, 8(r4)
stb r24, 0(r3)
lwz r0, 0x54(r1)
lmw r23, 0x2c(r1)
addi r1, r1, 0x50
mtlr r0
blr