mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-13 00:24:10 +00:00
323 lines
4.2 KiB
Text
323 lines
4.2 KiB
Text
.sdata
|
|
.globl in
|
|
.align 2
|
|
in:
|
|
.long 0xa
|
|
.long 0x20
|
|
.long 0xffffffff
|
|
.long 0x237
|
|
.long 0x3
|
|
.long 0x12
|
|
.long 0x1
|
|
.long 0xffffffcd
|
|
.long 0x315
|
|
.long 0x0
|
|
.globl main
|
|
.text
|
|
.text
|
|
.ent main
|
|
main:
|
|
ldgp $gp,0($27)
|
|
lda $sp,-80($sp)
|
|
.mask 0x4004000,-72
|
|
.frame $sp,80,$26,48
|
|
stq $14,0($sp)
|
|
stq $26,8($sp)
|
|
.prologue 1
|
|
lda $16,in
|
|
lda $17,10
|
|
jsr $26,sort
|
|
ldgp $gp,0($26)
|
|
mov $31,$14
|
|
br L.5
|
|
L.2:
|
|
sll $14,8*(8-4),$27
|
|
sra $27,8*(8-4),$27
|
|
sll $27,2,$27
|
|
ldl $16,in($27)
|
|
jsr $26,putd
|
|
ldgp $gp,0($26)
|
|
lda $16,10
|
|
jsr $26,putchar
|
|
ldgp $gp,0($26)
|
|
L.3:
|
|
lda $14,1($14)
|
|
L.5:
|
|
mov $14,$27
|
|
lda $25,10
|
|
cmpult $27,$25,$23
|
|
bne $23,L.2
|
|
mov $31,$0
|
|
L.1:
|
|
ldq $14,0($sp)
|
|
ldq $26,8($sp)
|
|
lda $sp,80($sp)
|
|
ret
|
|
.end main
|
|
.globl putd
|
|
.text
|
|
.ent putd
|
|
putd:
|
|
ldgp $gp,0($27)
|
|
lda $sp,-80($sp)
|
|
.mask 0x5004000,-64
|
|
.frame $sp,80,$26,48
|
|
stq $14,0($sp)
|
|
stq $24,8($sp)
|
|
stq $26,16($sp)
|
|
mov $16,$14
|
|
.prologue 1
|
|
cmplt $14,$31,$23
|
|
beq $23,L.7
|
|
lda $16,45
|
|
jsr $26,putchar
|
|
ldgp $gp,0($26)
|
|
negl $14,$14
|
|
L.7:
|
|
divl $14,10,$27
|
|
cmpeq $27,$31,$23
|
|
bne $23,L.9
|
|
divl $14,10,$16
|
|
jsr $26,putd
|
|
ldgp $gp,0($26)
|
|
L.9:
|
|
reml $14,10,$27
|
|
lda $16,48($27)
|
|
jsr $26,putchar
|
|
ldgp $gp,0($26)
|
|
mov $31,$0
|
|
L.6:
|
|
ldq $14,0($sp)
|
|
ldq $24,8($sp)
|
|
ldq $26,16($sp)
|
|
lda $sp,80($sp)
|
|
ret
|
|
.end putd
|
|
.globl sort
|
|
.text
|
|
.ent sort
|
|
sort:
|
|
ldgp $gp,0($27)
|
|
lda $sp,-64($sp)
|
|
.mask 0x4000000,-64
|
|
.frame $sp,64,$26,48
|
|
stq $26,0($sp)
|
|
stq $16,16($sp)
|
|
stq $17,24($sp)
|
|
.prologue 1
|
|
ldq $27,-48+64($sp)
|
|
stq $27,xx
|
|
mov $27,$16
|
|
mov $31,$17
|
|
ldl $27,-40+64($sp)
|
|
subl $27,1,$27
|
|
stl $27,-40+64($sp)
|
|
mov $27,$18
|
|
jsr $26,quick
|
|
ldgp $gp,0($26)
|
|
mov $31,$0
|
|
L.11:
|
|
ldq $26,0($sp)
|
|
lda $sp,64($sp)
|
|
ret
|
|
.end sort
|
|
.globl quick
|
|
.text
|
|
.ent quick
|
|
quick:
|
|
ldgp $gp,0($27)
|
|
lda $sp,-96($sp)
|
|
.mask 0x4007800,-64
|
|
.frame $sp,96,$26,48
|
|
stq $11,0($sp)
|
|
stq $12,8($sp)
|
|
stq $13,16($sp)
|
|
stq $14,24($sp)
|
|
stq $26,32($sp)
|
|
mov $16,$14
|
|
mov $17,$13
|
|
mov $18,$12
|
|
.prologue 1
|
|
cmplt $13,$12,$23
|
|
bne $23,L.13
|
|
br L.12
|
|
L.13:
|
|
mov $14,$16
|
|
mov $13,$17
|
|
mov $12,$18
|
|
jsr $26,partition
|
|
ldgp $gp,0($26)
|
|
mov $0,$11
|
|
mov $14,$16
|
|
mov $13,$17
|
|
subl $11,1,$18
|
|
jsr $26,quick
|
|
ldgp $gp,0($26)
|
|
mov $14,$16
|
|
lda $17,1($11)
|
|
mov $12,$18
|
|
jsr $26,quick
|
|
ldgp $gp,0($26)
|
|
mov $31,$0
|
|
L.12:
|
|
ldq $11,0($sp)
|
|
ldq $12,8($sp)
|
|
ldq $13,16($sp)
|
|
ldq $14,24($sp)
|
|
ldq $26,32($sp)
|
|
lda $sp,96($sp)
|
|
ret
|
|
.end quick
|
|
.globl partition
|
|
.text
|
|
.ent partition
|
|
partition:
|
|
ldgp $gp,0($27)
|
|
lda $sp,-112($sp)
|
|
.mask 0x4007c00,-72
|
|
.frame $sp,112,$26,48
|
|
stq $10,0($sp)
|
|
stq $11,8($sp)
|
|
stq $12,16($sp)
|
|
stq $13,24($sp)
|
|
stq $14,32($sp)
|
|
stq $26,40($sp)
|
|
mov $16,$14
|
|
mov $17,$13
|
|
mov $18,$12
|
|
.prologue 1
|
|
lda $12,1($12)
|
|
mov $13,$10
|
|
sll $10,8*(8-4),$27
|
|
sra $27,8*(8-4),$27
|
|
sll $27,2,$27
|
|
addq $27,$14,$27
|
|
ldl $11,($27)
|
|
br L.17
|
|
L.16:
|
|
lda $13,1($13)
|
|
br L.20
|
|
L.19:
|
|
lda $13,1($13)
|
|
L.20:
|
|
sll $13,8*(8-4),$27
|
|
sra $27,8*(8-4),$27
|
|
sll $27,2,$27
|
|
addq $27,$14,$27
|
|
ldl $27,($27)
|
|
cmplt $27,$11,$23
|
|
bne $23,L.19
|
|
subl $12,1,$12
|
|
br L.23
|
|
L.22:
|
|
subl $12,1,$12
|
|
L.23:
|
|
sll $12,8*(8-4),$27
|
|
sra $27,8*(8-4),$27
|
|
sll $27,2,$27
|
|
addq $27,$14,$27
|
|
ldl $27,($27)
|
|
cmple $27,$11,$23
|
|
beq $23,L.22
|
|
cmplt $13,$12,$23
|
|
beq $23,L.25
|
|
sll $13,8*(8-4),$27
|
|
sra $27,8*(8-4),$27
|
|
sll $27,2,$27
|
|
addq $27,$14,$16
|
|
sll $12,8*(8-4),$27
|
|
sra $27,8*(8-4),$27
|
|
sll $27,2,$27
|
|
addq $27,$14,$17
|
|
jsr $26,exchange
|
|
ldgp $gp,0($26)
|
|
L.25:
|
|
L.17:
|
|
cmplt $13,$12,$23
|
|
bne $23,L.16
|
|
sll $10,8*(8-4),$27
|
|
sra $27,8*(8-4),$27
|
|
sll $27,2,$27
|
|
addq $27,$14,$16
|
|
sll $12,8*(8-4),$27
|
|
sra $27,8*(8-4),$27
|
|
sll $27,2,$27
|
|
addq $27,$14,$17
|
|
jsr $26,exchange
|
|
ldgp $gp,0($26)
|
|
mov $12,$0
|
|
L.15:
|
|
ldq $10,0($sp)
|
|
ldq $11,8($sp)
|
|
ldq $12,16($sp)
|
|
ldq $13,24($sp)
|
|
ldq $14,32($sp)
|
|
ldq $26,40($sp)
|
|
lda $sp,112($sp)
|
|
ret
|
|
.end partition
|
|
.globl exchange
|
|
.text
|
|
.ent exchange
|
|
exchange:
|
|
ldgp $gp,0($27)
|
|
lda $sp,-112($sp)
|
|
.mask 0x5006000,-88
|
|
.frame $sp,112,$26,48
|
|
stq $13,0($sp)
|
|
stq $14,8($sp)
|
|
stq $24,16($sp)
|
|
stq $26,24($sp)
|
|
mov $16,$14
|
|
mov $17,$13
|
|
.prologue 1
|
|
lda $16,L.28
|
|
ldq $27,xx
|
|
stq $27,-80+112($sp)
|
|
mov $14,$25
|
|
subq $25,$27,$25
|
|
stq $25,-72+112($sp)
|
|
divq $25,4,$17
|
|
mov $13,$27
|
|
ldq $25,-80+112($sp)
|
|
subq $27,$25,$27
|
|
divq $27,4,$18
|
|
jsr $26,printf
|
|
ldgp $gp,0($26)
|
|
ldl $27,($14)
|
|
stl $27,-60+112($sp)
|
|
ldl $27,($13)
|
|
stl $27,($14)
|
|
ldl $27,-60+112($sp)
|
|
stl $27,($13)
|
|
mov $31,$0
|
|
L.27:
|
|
ldq $13,0($sp)
|
|
ldq $14,8($sp)
|
|
ldq $24,16($sp)
|
|
ldq $26,24($sp)
|
|
lda $sp,112($sp)
|
|
ret
|
|
.end exchange
|
|
.globl xx
|
|
.comm xx,8
|
|
.rdata
|
|
.align 0
|
|
L.28:
|
|
.byte 101
|
|
.byte 120
|
|
.byte 99
|
|
.byte 104
|
|
.byte 97
|
|
.byte 110
|
|
.byte 103
|
|
.byte 101
|
|
.byte 40
|
|
.byte 37
|
|
.byte 100
|
|
.byte 44
|
|
.byte 37
|
|
.byte 100
|
|
.byte 41
|
|
.byte 10
|
|
.byte 0
|