aboutsummaryrefslogtreecommitdiffstats
path: root/code/tools/lcc/x86/linux/tst/8q.sbk
blob: 31a874885a8a7ec4c36ade0bd99cbefe857d27f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
.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"