.include "macros.inc"
.section .text, "ax"
.global strtol
strtol:
mflr r0
lis r6, 0x7FFFFFFF@ha
stw r0, 4(r1)
li r0, 0
stwu r1, -0x30(r1)
stw r31, 0x2c(r1)
addi r31, r4, 0
addi r4, r6, 0x7FFFFFFF@l
stw r30, 0x28(r1)
mr r30, r3
lis r3, __StringRead@ha
stw r30, 0x14(r1)
addi r6, r1, 0x14
addi r7, r1, 0x24
stw r0, 0x18(r1)
addi r0, r3, __StringRead@l
addi r3, r5, 0
mr r5, r0
addi r8, r1, 0x20
addi r9, r1, 0x1c
bl __strtoul
cmplwi r31, 0
beq lbl_80085F2C
lwz r0, 0x24(r1)
add r0, r30, r0
stw r0, 0(r31)
lbl_80085F2C:
lwz r0, 0x1c(r1)
cmpwi r0, 0
bne lbl_80085F68
lwz r5, 0x20(r1)
cmpwi r5, 0
bne lbl_80085F54
lis r4, 0x7FFFFFFF@ha
addi r0, r4, 0x7FFFFFFF@l
cmplw r3, r0
bgt lbl_80085F68
lbl_80085F54:
cmpwi r5, 0
beq lbl_80085F90
lis r0, 0x8000
cmplw r3, r0
ble lbl_80085F90
lbl_80085F68:
lwz r0, 0x20(r1)
cmpwi r0, 0
beq lbl_80085F7C
lis r3, 0x8000
b lbl_80085F84
lbl_80085F7C:
lis r3, 0x7FFFFFFF@ha
addi r3, r3, 0x7FFFFFFF@l
lbl_80085F84:
li r0, 0x22
stw r0, errno@sda21(r13)
b lbl_80085F9C
lbl_80085F90:
cmpwi r5, 0
beq lbl_80085F9C
neg r3, r3
lbl_80085F9C:
lwz r0, 0x34(r1)
lwz r31, 0x2c(r1)
lwz r30, 0x28(r1)
mtlr r0
addi r1, r1, 0x30
blr
.global strtoul
strtoul:
mflr r0
lis r6, 0x7FFFFFFF@ha
stw r0, 4(r1)
li r0, 0
stwu r1, -0x30(r1)
stw r31, 0x2c(r1)
addi r31, r4, 0
addi r4, r6, 0x7FFFFFFF@l
stw r30, 0x28(r1)
mr r30, r3
lis r3, __StringRead@ha
stw r30, 0x14(r1)
addi r6, r1, 0x14
addi r7, r1, 0x24
stw r0, 0x18(r1)
addi r0, r3, __StringRead@l
addi r3, r5, 0
mr r5, r0
addi r8, r1, 0x20
addi r9, r1, 0x1c
bl __strtoul
cmplwi r31, 0
beq lbl_8008601C
lwz r0, 0x24(r1)
add r0, r30, r0
stw r0, 0(r31)
lbl_8008601C:
lwz r0, 0x1c(r1)
cmpwi r0, 0
beq lbl_80086038
li r0, 0x22
stw r0, errno@sda21(r13)
li r3, -1
b lbl_80086048
lbl_80086038:
lwz r0, 0x20(r1)
cmpwi r0, 0
beq lbl_80086048
neg r3, r3
lbl_80086048:
lwz r0, 0x34(r1)
lwz r31, 0x2c(r1)
lwz r30, 0x28(r1)
mtlr r0
addi r1, r1, 0x30
blr
.global __strtoul
__strtoul:
mflr r0
stw r0, 4(r1)
li r0, 0
stwu r1, -0x60(r1)
stmw r18, 0x28(r1)
or. r28, r3, r3
addi r23, r9, 0
mr r21, r8
addi r22, r4, 0
addi r29, r5, 0
addi r30, r6, 0
addi r19, r7, 0
li r24, 1
li r31, 0
li r27, 0
li r26, 0
stw r0, 0(r9)
stw r0, 0(r8)
blt lbl_800860C4
cmpwi r28, 1
beq lbl_800860C4
cmpwi r28, 0x24
bgt lbl_800860C4
cmpwi r22, 1
bge lbl_800860CC
lbl_800860C4:
li r24, 0x40
b lbl_800860EC
lbl_800860CC:
addi r12, r29, 0
mtlr r12
addi r3, r30, 0
li r31, 1
li r4, 0
li r5, 0
blrl
mr r18, r3
lbl_800860EC:
cmpwi r28, 0
beq lbl_800860FC
li r0, -1
divwu r26, r0, r28
lbl_800860FC:
lis r3, __ctype_map@ha
lis r4, "@410"@ha
addi r25, r3, __ctype_map@l
addi r20, r4, "@410"@l
b lbl_80086344
lbl_80086110:
cmplwi r24, 0x10
bgt lbl_80086344
slwi r0, r24, 2
lwzx r0, r20, r0
mtctr r0
bctr
lbl_80086128:
clrlwi r0, r18, 0x18
add r3, r25, r0
lbz r0, 0(r3)
rlwinm. r0, r0, 0, 0x1d, 0x1e
beq lbl_80086160
addi r12, r29, 0
mtlr r12
addi r3, r30, 0
li r4, 0
li r5, 0
addi r31, r31, 1
blrl
mr r18, r3
b lbl_80086344
lbl_80086160:
cmpwi r18, 0x2b
bne lbl_8008618C
addi r12, r29, 0
mtlr r12
addi r3, r30, 0
li r4, 0
li r5, 0
addi r31, r31, 1
blrl
mr r18, r3
b lbl_800861BC
lbl_8008618C:
cmpwi r18, 0x2d
bne lbl_800861BC
addi r12, r29, 0
mtlr r12
addi r3, r30, 0
li r4, 0
li r5, 0
addi r31, r31, 1
blrl
li r0, 1
stw r0, 0(r21)
mr r18, r3
lbl_800861BC:
li r24, 2
b lbl_80086344
lbl_800861C4:
cmpwi r28, 0
beq lbl_800861D4
cmpwi r28, 0x10
bne lbl_80086204
lbl_800861D4:
cmpwi r18, 0x30
bne lbl_80086204
addi r12, r29, 0
mtlr r12
addi r3, r30, 0
li r24, 4
li r4, 0
li r5, 0
addi r31, r31, 1
blrl
mr r18, r3
b lbl_80086344
lbl_80086204:
li r24, 8
b lbl_80086344
lbl_8008620C:
cmpwi r18, 0x58
beq lbl_8008621C
cmpwi r18, 0x78
bne lbl_80086248
lbl_8008621C:
addi r12, r29, 0
mtlr r12
addi r3, r30, 0
li r28, 0x10
li r24, 8
li r4, 0
li r5, 0
addi r31, r31, 1
blrl
mr r18, r3
b lbl_80086344
lbl_80086248:
cmpwi r28, 0
bne lbl_80086254
li r28, 8
lbl_80086254:
li r24, 0x10
b lbl_80086344
lbl_8008625C:
cmpwi r28, 0
bne lbl_80086268
li r28, 0xa
lbl_80086268:
cmplwi r26, 0
bne lbl_80086278
li r0, -1
divwu r26, r0, r28
lbl_80086278:
clrlwi r0, r18, 0x18
add r3, r25, r0
lbz r3, 0(r3)
rlwinm. r0, r3, 0, 0x1b, 0x1b
beq lbl_800862B4
addi r18, r18, -48
cmpw r18, r28
blt lbl_800862F4
cmpwi r24, 0x10
bne lbl_800862A8
li r24, 0x20
b lbl_800862AC
lbl_800862A8:
li r24, 0x40
lbl_800862AC:
addi r18, r18, 0x30
b lbl_80086344
lbl_800862B4:
rlwinm. r0, r3, 0, 0x18, 0x19
beq lbl_800862D0
mr r3, r18
bl toupper
addi r0, r3, -55
cmpw r0, r28
blt lbl_800862E8
lbl_800862D0:
cmpwi r24, 0x10
bne lbl_800862E0
li r24, 0x20
b lbl_80086344
lbl_800862E0:
li r24, 0x40
b lbl_80086344
lbl_800862E8:
mr r3, r18
bl toupper
addi r18, r3, -55
lbl_800862F4:
cmplw r27, r26
ble lbl_80086304
li r0, 1
stw r0, 0(r23)
lbl_80086304:
mullw r27, r27, r28
subfic r0, r27, -1
cmplw r18, r0
ble lbl_8008631C
li r0, 1
stw r0, 0(r23)
lbl_8008631C:
addi r12, r29, 0
mtlr r12
addi r3, r30, 0
add r27, r27, r18
li r24, 0x10
li r4, 0
li r5, 0
addi r31, r31, 1
blrl
mr r18, r3
lbl_80086344:
cmpw r31, r22
bgt lbl_8008635C
cmpwi r18, -1
beq lbl_8008635C
rlwinm. r0, r24, 0, 0x19, 0x1a
beq lbl_80086110
lbl_8008635C:
andi. r0, r24, 0x34
bne lbl_80086370
li r27, 0
li r31, 0
b lbl_80086374
lbl_80086370:
addi r31, r31, -1
lbl_80086374:
mr r12, r29
stw r31, 0(r19)
mtlr r12
addi r3, r30, 0
addi r4, r18, 0
li r5, 1
blrl
mr r3, r27
lmw r18, 0x28(r1)
lwz r0, 0x64(r1)
addi r1, r1, 0x60
mtlr r0
blr
.section .data, "wa"
.balign 8
"@410":
.4byte lbl_80086344
.4byte lbl_80086128
.4byte lbl_800861C4
.4byte lbl_80086344
.4byte lbl_8008620C
.4byte lbl_80086344
.4byte lbl_80086344
.4byte lbl_80086344
.4byte lbl_8008625C
.4byte lbl_80086344
.4byte lbl_80086344
.4byte lbl_80086344
.4byte lbl_80086344
.4byte lbl_80086344
.4byte lbl_80086344
.4byte lbl_80086344
.4byte lbl_8008625C