lilium-voyager/code/tools/lcc/x86/linux/tst/8q.sbk
2005-10-04 15:18:22 +00:00

180 lines
2.3 KiB
Text

.globl main
.text
.align 16
.type main,@function
main:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movl %esp,%ebp
subl $4,%esp
movl $0,-4(%ebp)
.LC2:
movl -4(%ebp),%edi
leal (,%edi,4),%edi
movl $1,down(%edi)
movl $1,up(%edi)
.LC3:
incl -4(%ebp)
cmpl $15,-4(%ebp)
jl .LC2
movl $0,-4(%ebp)
.LC6:
movl -4(%ebp),%edi
movl $1,rows(,%edi,4)
.LC7:
incl -4(%ebp)
cmpl $8,-4(%ebp)
jl .LC6
pushl $0
call queens
addl $4,%esp
movl $0,%eax
.LC1:
movl %ebp,%esp
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
.Lf10:
.size main,.Lf10-main
.globl queens
.align 16
.type queens,@function
queens:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movl %esp,%ebp
subl $4,%esp
movl $0,-4(%ebp)
.LC12:
movl -4(%ebp),%edi
cmpl $0,rows(,%edi,4)
je .LC16
movl 20(%ebp),%esi
movl %edi,%ebx
subl %esi,%ebx
cmpl $0,up+28(,%ebx,4)
je .LC16
leal (%esi,%edi),%edi
cmpl $0,down(,%edi,4)
je .LC16
movl -4(%ebp),%edi
movl 20(%ebp),%esi
leal (%esi,%edi),%ebx
movl $0,down(,%ebx,4)
movl %edi,%ebx
subl %esi,%ebx
movl $0,up+28(,%ebx,4)
movl $0,rows(,%edi,4)
movl 20(%ebp),%edi
movl -4(%ebp),%esi
movl %esi,x(,%edi,4)
cmpl $7,20(%ebp)
jne .LC20
call print
jmp .LC21
.LC20:
movl 20(%ebp),%edi
leal 1(%edi),%edi
pushl %edi
call queens
addl $4,%esp
.LC21:
movl -4(%ebp),%edi
movl 20(%ebp),%esi
leal (%esi,%edi),%ebx
movl $1,down(,%ebx,4)
movl %edi,%ebx
subl %esi,%ebx
movl $1,up+28(,%ebx,4)
movl $1,rows(,%edi,4)
.LC16:
.LC13:
incl -4(%ebp)
cmpl $8,-4(%ebp)
jl .LC12
movl $0,%eax
.LC11:
movl %ebp,%esp
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
.Lf23:
.size queens,.Lf23-queens
.globl print
.align 16
.type print,@function
print:
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movl %esp,%ebp
subl $4,%esp
movl $0,-4(%ebp)
.LC25:
movl -4(%ebp),%edi
movl x(,%edi,4),%edi
leal 49(%edi),%edi
pushl %edi
pushl $.LC29
call printf
addl $8,%esp
.LC26:
incl -4(%ebp)
cmpl $8,-4(%ebp)
jl .LC25
pushl $.LC30
call printf
addl $4,%esp
movl $0,%eax
.LC24:
movl %ebp,%esp
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
.Lf31:
.size print,.Lf31-print
.bss
.globl x
.align 4
.type x,@object
.size x,32
.comm x,32
.globl rows
.align 4
.type rows,@object
.size rows,32
.comm rows,32
.globl down
.align 4
.type down,@object
.size down,60
.comm down,60
.globl up
.align 4
.type up,@object
.size up,60
.comm up,60
.data
.align 1
.LC30:
.byte 10
.byte 0
.align 1
.LC29:
.byte 37
.byte 99
.byte 32
.byte 0
.text
.ident "LCC: 4.1"