.global _main
.seg "text"
.align 4
.proc 4
_main:
save %sp,-120,%sp
st %g0,[%fp+-24]
set _next,%i5
st %g0,[%i5]
ba L3; nop
L2:
add -20,%fp,%o0
add -24,%fp,%o1
call _lookup; nop
ld [%o0],%i4
add %i4,1,%i4
st %i4,[%o0]
L3:
add -20,%fp,%o0
call _getword; nop
cmp %o0,0; bne L2; nop
ld [%fp+-24],%o0
call _tprint; nop
mov %g0,%i0
L1:
ret; restore
.global _err
.align 4
.proc 4
_err:
save %sp,-96,%sp
set L9,%o0
mov %i0,%o1
call _printf; nop
set 1,%o0
call _exit; nop
L8:
ret; restore
.global _getword
.align 4
.proc 4
_getword:
save %sp,-96,%sp
L11:
L12:
call _getchar; nop
mov %o0,%i3
mov %i3,%i5
cmp %i3,-1; be L14; nop
mov %i5,%o0
call _isletter; nop
cmp %o0,0; be L11; nop
L14:
mov %i0,%i4
ba L18; nop
L15:
mov %i4,%i3
add %i3,1,%i4
stb %i5,[%i3]
L16:
call _getchar; nop
mov %o0,%i5
L18:
mov %i5,%o0
call _isletter; nop
mov %o0,%i5
cmp %o0,0; bne L15; nop
stb %g0,[%i4]
cmp %i4,%i0; bleu L19; nop
set 1,%i0
ba L10; nop
L19:
mov %g0,%i0
L10:
ret; restore
.global _isletter
.align 4
.proc 4
_isletter:
cmp %o0,65; bl L27; nop
cmp %o0,90; bg L27; nop
add %o0,32,%o0
L27:
cmp %o0,97; bl L29; nop
cmp %o0,122; bg L29; nop
ba L26; nop
L29:
mov %g0,%o0
L26:
retl; nop
.global _lookup
.align 4
.proc 4
_lookup:
save %sp,-96,%sp
ld [%i1],%i4
cmp %i4,%g0; be L32; nop
mov %i0,%o0
ld [%i1],%i4
ld [%i4+12],%o1
call _strcmp; nop
mov %o0,%i5
cmp %i5,0; bge L34; nop
mov %i0,%o0
ld [%i1],%i4
add %i4,4,%o1
call _lookup; nop
mov %o0,%i0
ba L31; nop
L34:
cmp %i5,0; ble L36; nop
mov %i0,%o0
ld [%i1],%i4
add %i4,8,%o1
call _lookup; nop
mov %o0,%i0
ba L31; nop
L36:
ld [%i1],%i4
mov %i4,%i0
ba L31; nop
L32:
set _next,%i4
ld [%i4],%i4
cmp %i4,2000; bl L38; nop
set L40,%o0
call _err; nop
L38:
set _next,%i4
ld [%i4],%i4
sll %i4,4,%i4
set _words,%i3
st %g0,[%i4+%i3]
set _next,%i4
ld [%i4],%i4
sll %i4,4,%i4
set _words+8,%i2
st %g0,[%i4+%i2]
set _words+4,%i2
st %g0,[%i4+%i2]
mov %i0,%o0
call _strlen; nop
mov %o0,%i4
add %i4,1,%o0
call _malloc; nop
set _next,%i3
ld [%i3],%i3
sll %i3,4,%i3
set _words+12,%i2
st %o0,[%i3+%i2]
set _next,%i4
ld [%i4],%i4
sll %i4,4,%i4
set _words+12,%i3
ld [%i4+%i3],%i4
cmp %i4,%g0; bne L44; nop
set L47,%o0
call _err; nop
L44:
set _next,%i4
ld [%i4],%i4
sll %i4,4,%i4
set _words+12,%i3
ld [%i4+%i3],%o0
mov %i0,%o1
call _strcpy; nop
set _next,%i4
ld [%i4],%i3
add %i3,1,%i2
st %i2,[%i4]
sll %i3,4,%i4
set _words,%i3
add %i4,%i3,%i4
st %i4,[%i1]
mov %i4,%i0
L31:
ret; restore
.global _tprint
.align 4
.proc 4
_tprint:
save %sp,-96,%sp
cmp %i0,%g0; be L60; nop
ld [%i0+4],%o0
call _tprint; nop
set L62,%o0
ld [%i0],%o1
ld [%i0+12],%o2
call _printf; nop
ld [%i0+8],%o0
call _tprint; nop
L60:
L59:
ret; restore
.global _strcmp
.align 4
.proc 4
_strcmp:
ba L65; nop
L64:
mov %o0,%o5
add %o5,1,%o0
ldsb [%o5],%o5
cmp %o5,0; bne L67; nop
mov %g0,%o0
ba L63; nop
L67:
add %o1,1,%o1
L65:
ldsb [%o0],%o5
ldsb [%o1],%o4
cmp %o5,%o4; be L64; nop
ldsb [%o0],%o5
cmp %o5,0; bne L69; nop
set -1,%o0
ba L63; nop
L69:
ldsb [%o1],%o5
cmp %o5,0; bne L71; nop
set 1,%o0
ba L63; nop
L71:
ldsb [%o0],%o5
ldsb [%o1],%o4
sub %o5,%o4,%o0
L63:
retl; nop
.seg "bss"
.global _next
.align 4
.common _next,4
.global _words
.align 4
.common _words,32000
.seg "text"
.align 1
L62:
.byte 37
.byte 100
.byte 9
.byte 37
.byte 115
.byte 10
.byte 0
.align 1
L47:
.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
L40:
.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
L9:
.byte 63
.byte 32
.byte 37
.byte 115
.byte 10
.byte 0
