ioef/code/tools/lcc/x86/linux/tst/wf1.sbk
2005-10-04 15:18:22 +00:00

437 lines
5.4 KiB
Text

.globl main
.text
.align 16
.type main,@function
main:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movl %esp,%ebp
subl $24,%esp
movl $0,-24(%ebp)
movl $0,next
jmp .LC3
.LC2:
leal -24(%ebp),%edi
pushl %edi
leal -20(%ebp),%edi
pushl %edi
call lookup
addl $8,%esp
incl (,%eax)
.LC3:
leal -20(%ebp),%edi
pushl %edi
call getword
addl $4,%esp
cmpl $0,%eax
jne .LC2
pushl -24(%ebp)
call tprint
addl $4,%esp
movl $0,%eax
.LC1:
movl %ebp,%esp
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
.Lf5:
.size main,.Lf5-main
.globl err
.align 16
.type err,@function
err:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movl %esp,%ebp
pushl 20(%ebp)
pushl $.LC7
call printf
addl $8,%esp
pushl $1
call exit
addl $4,%esp
movl $0,%eax
.LC6:
movl %ebp,%esp
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
.Lf8:
.size err,.Lf8-err
.globl getword
.align 16
.type getword,@function
getword:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movl %esp,%ebp
subl $8,%esp
.LC10:
.LC11:
call getchar
movl %eax,%edi
movl %edi,-4(%ebp)
cmpl $-1,%edi
je .LC13
pushl -4(%ebp)
call isletter
addl $4,%esp
cmpl $0,%eax
je .LC10
.LC13:
movl 20(%ebp),%edi
movl %edi,-8(%ebp)
jmp .LC17
.LC14:
movl -8(%ebp),%edi
leal 1(%edi),%esi
movl %esi,-8(%ebp)
movl -4(%ebp),%esi
movl %esi,%ebx
movb %bl,(,%edi)
.LC15:
call getchar
movl %eax,-4(%ebp)
.LC17:
pushl -4(%ebp)
call isletter
addl $4,%esp
movl %eax,-4(%ebp)
cmpl $0,%eax
jne .LC14
movl -8(%ebp),%edi
movb $0,(,%edi)
movl -8(%ebp),%edi
movl 20(%ebp),%esi
cmpl %esi,%edi
jbe .LC18
movl $1,%eax
jmp .LC9
.LC18:
movl $0,%eax
.LC9:
movl %ebp,%esp
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
.Lf20:
.size getword,.Lf20-getword
.globl isletter
.align 16
.type isletter,@function
isletter:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movl %esp,%ebp
movl 20(%ebp),%edi
cmpl $65,%edi
jl .LC22
cmpl $90,%edi
jg .LC22
addl $32,20(%ebp)
.LC22:
movl 20(%ebp),%edi
cmpl $97,%edi
jl .LC24
cmpl $122,%edi
jg .LC24
movl 20(%ebp),%eax
jmp .LC21
.LC24:
movl $0,%eax
.LC21:
movl %ebp,%esp
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
.Lf26:
.size isletter,.Lf26-isletter
.globl lookup
.align 16
.type lookup,@function
lookup:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movl %esp,%ebp
subl $4,%esp
movl 24(%ebp),%edi
movl (,%edi),%edi
cmpl $0,%edi
je .LC28
movl 24(%ebp),%edi
movl (,%edi),%edi
pushl 12(%edi)
pushl 20(%ebp)
call strcmp
addl $8,%esp
movl %eax,-4(%ebp)
cmpl $0,-4(%ebp)
jge .LC30
movl 24(%ebp),%edi
movl (,%edi),%edi
leal 4(%edi),%edi
pushl %edi
pushl 20(%ebp)
call lookup
addl $8,%esp
movl %eax,%edi
jmp .LC27
.LC30:
cmpl $0,-4(%ebp)
jle .LC32
movl 24(%ebp),%edi
movl (,%edi),%edi
leal 8(%edi),%edi
pushl %edi
pushl 20(%ebp)
call lookup
addl $8,%esp
movl %eax,%edi
jmp .LC27
.LC32:
movl 24(%ebp),%edi
movl (,%edi),%eax
jmp .LC27
.LC28:
cmpl $2000,next
jl .LC34
pushl $.LC36
call err
addl $4,%esp
.LC34:
movl next,%edi
sall $4,%edi
movl $0,words(%edi)
movl next,%edi
sall $4,%edi
movl $0,words+8(%edi)
movl $0,words+4(%edi)
pushl 20(%ebp)
call strlen
addl $4,%esp
leal 1(%eax),%edi
pushl %edi
call malloc
addl $4,%esp
movl next,%esi
sall $4,%esi
movl %eax,words+12(%esi)
movl next,%edi
sall $4,%edi
movl words+12(%edi),%edi
cmpl $0,%edi
jne .LC40
pushl $.LC43
call err
addl $4,%esp
.LC40:
pushl 20(%ebp)
movl next,%edi
sall $4,%edi
pushl words+12(%edi)
call strcpy
addl $8,%esp
movl next,%edi
leal 1(%edi),%esi
movl %esi,next
sall $4,%edi
leal words(%edi),%edi
movl 24(%ebp),%esi
movl %edi,(,%esi)
movl %edi,%eax
.LC27:
movl %ebp,%esp
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
.Lf45:
.size lookup,.Lf45-lookup
.globl tprint
.align 16
.type tprint,@function
tprint:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movl %esp,%ebp
movl 20(%ebp),%edi
cmpl $0,%edi
je .LC47
movl 20(%ebp),%edi
pushl 4(%edi)
call tprint
addl $4,%esp
movl 20(%ebp),%edi
pushl 12(%edi)
pushl (,%edi)
pushl $.LC49
call printf
addl $12,%esp
movl 20(%ebp),%edi
pushl 8(%edi)
call tprint
addl $4,%esp
.LC47:
movl $0,%eax
.LC46:
movl %ebp,%esp
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
.Lf50:
.size tprint,.Lf50-tprint
.globl strcmp
.align 16
.type strcmp,@function
strcmp:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movl %esp,%ebp
jmp .LC53
.LC52:
movl 20(%ebp),%edi
leal 1(%edi),%esi
movl %esi,20(%ebp)
movsbl (,%edi),%edi
cmpl $0,%edi
jne .LC55
movl $0,%eax
jmp .LC51
.LC55:
incl 24(%ebp)
.LC53:
movl 20(%ebp),%edi
movsbl (,%edi),%edi
movl 24(%ebp),%esi
movsbl (,%esi),%esi
cmpl %esi,%edi
je .LC52
movl 20(%ebp),%edi
movsbl (,%edi),%edi
cmpl $0,%edi
jne .LC57
movl $-1,%eax
jmp .LC51
.LC57:
movl 24(%ebp),%edi
movsbl (,%edi),%edi
cmpl $0,%edi
jne .LC59
movl $1,%eax
jmp .LC51
.LC59:
movl 20(%ebp),%edi
movsbl (,%edi),%edi
movl 24(%ebp),%esi
movsbl (,%esi),%esi
movl %edi,%eax
subl %esi,%eax
.LC51:
movl %ebp,%esp
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
.Lf61:
.size strcmp,.Lf61-strcmp
.bss
.globl next
.align 4
.type next,@object
.size next,4
.comm next,4
.globl words
.align 4
.type words,@object
.size words,32000
.comm words,32000
.data
.align 1
.LC49:
.byte 37
.byte 100
.byte 9
.byte 37
.byte 115
.byte 10
.byte 0
.align 1
.LC43:
.byte 111
.byte 117
.byte 116
.byte 32
.byte 111
.byte 102
.byte 32
.byte 119
.byte 111
.byte 114
.byte 100
.byte 32
.byte 115
.byte 116
.byte 111
.byte 114
.byte 97
.byte 103
.byte 101
.byte 0
.align 1
.LC36:
.byte 111
.byte 117
.byte 116
.byte 32
.byte 111
.byte 102
.byte 32
.byte 110
.byte 111
.byte 100
.byte 101
.byte 32
.byte 115
.byte 116
.byte 111
.byte 114
.byte 97
.byte 103
.byte 101
.byte 0
.align 1
.LC7:
.byte 63
.byte 32
.byte 37
.byte 115
.byte 10
.byte 0
.text
.ident "LCC: 4.1"