mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-12-14 14:11:15 +00:00
330 lines
4.4 KiB
Text
Executable file
330 lines
4.4 KiB
Text
Executable file
.data
|
|
.globl in
|
|
.align 4
|
|
.type in,@object
|
|
in:
|
|
.long 10
|
|
.long 32
|
|
.long -1
|
|
.long 567
|
|
.long 3
|
|
.long 18
|
|
.long 1
|
|
.long -51
|
|
.long 789
|
|
.long 0
|
|
.size in,40
|
|
.globl main
|
|
.text
|
|
.align 16
|
|
.type main,@function
|
|
main:
|
|
pushl %ebp
|
|
pushl %ebx
|
|
pushl %esi
|
|
pushl %edi
|
|
movl %esp,%ebp
|
|
subl $4,%esp
|
|
pushl $10
|
|
pushl $in
|
|
call sort
|
|
addl $8,%esp
|
|
movl $0,-4(%ebp)
|
|
jmp .LC5
|
|
.LC2:
|
|
movl -4(%ebp),%edi
|
|
pushl in(,%edi,4)
|
|
call putd
|
|
addl $4,%esp
|
|
pushl $10
|
|
call putchar
|
|
addl $4,%esp
|
|
.LC3:
|
|
incl -4(%ebp)
|
|
.LC5:
|
|
movl -4(%ebp),%edi
|
|
cmpl $10,%edi
|
|
jb .LC2
|
|
movl $0,%eax
|
|
.LC1:
|
|
movl %ebp,%esp
|
|
popl %edi
|
|
popl %esi
|
|
popl %ebx
|
|
popl %ebp
|
|
ret
|
|
.Lf6:
|
|
.size main,.Lf6-main
|
|
.globl putd
|
|
.align 16
|
|
.type putd,@function
|
|
putd:
|
|
pushl %ebp
|
|
pushl %ebx
|
|
pushl %esi
|
|
pushl %edi
|
|
movl %esp,%ebp
|
|
cmpl $0,20(%ebp)
|
|
jge .LC8
|
|
pushl $45
|
|
call putchar
|
|
addl $4,%esp
|
|
negl 20(%ebp)
|
|
.LC8:
|
|
movl 20(%ebp),%eax
|
|
movl $10,%ecx
|
|
cdq
|
|
idivl %ecx
|
|
cmpl $0,%eax
|
|
je .LC10
|
|
movl 20(%ebp),%eax
|
|
movl $10,%ecx
|
|
cdq
|
|
idivl %ecx
|
|
pushl %eax
|
|
call putd
|
|
addl $4,%esp
|
|
.LC10:
|
|
movl 20(%ebp),%eax
|
|
movl $10,%ecx
|
|
cdq
|
|
idivl %ecx
|
|
leal 48(%edx),%edi
|
|
pushl %edi
|
|
call putchar
|
|
addl $4,%esp
|
|
movl $0,%eax
|
|
.LC7:
|
|
movl %ebp,%esp
|
|
popl %edi
|
|
popl %esi
|
|
popl %ebx
|
|
popl %ebp
|
|
ret
|
|
.Lf12:
|
|
.size putd,.Lf12-putd
|
|
.globl sort
|
|
.align 16
|
|
.type sort,@function
|
|
sort:
|
|
pushl %ebp
|
|
pushl %ebx
|
|
pushl %esi
|
|
pushl %edi
|
|
movl %esp,%ebp
|
|
movl 24(%ebp),%edi
|
|
subl $1,%edi
|
|
movl %edi,24(%ebp)
|
|
pushl %edi
|
|
pushl $0
|
|
movl 20(%ebp),%edi
|
|
movl %edi,xx
|
|
pushl %edi
|
|
call quick
|
|
addl $12,%esp
|
|
movl $0,%eax
|
|
.LC13:
|
|
movl %ebp,%esp
|
|
popl %edi
|
|
popl %esi
|
|
popl %ebx
|
|
popl %ebp
|
|
ret
|
|
.Lf14:
|
|
.size sort,.Lf14-sort
|
|
.globl quick
|
|
.align 16
|
|
.type quick,@function
|
|
quick:
|
|
pushl %ebp
|
|
pushl %ebx
|
|
pushl %esi
|
|
pushl %edi
|
|
movl %esp,%ebp
|
|
subl $4,%esp
|
|
movl 28(%ebp),%edi
|
|
cmpl %edi,24(%ebp)
|
|
jl .LC16
|
|
jmp .LC15
|
|
.LC16:
|
|
pushl 28(%ebp)
|
|
pushl 24(%ebp)
|
|
pushl 20(%ebp)
|
|
call partition
|
|
addl $12,%esp
|
|
movl %eax,-4(%ebp)
|
|
movl -4(%ebp),%edi
|
|
subl $1,%edi
|
|
pushl %edi
|
|
pushl 24(%ebp)
|
|
pushl 20(%ebp)
|
|
call quick
|
|
addl $12,%esp
|
|
pushl 28(%ebp)
|
|
movl -4(%ebp),%edi
|
|
leal 1(%edi),%edi
|
|
pushl %edi
|
|
pushl 20(%ebp)
|
|
call quick
|
|
addl $12,%esp
|
|
movl $0,%eax
|
|
.LC15:
|
|
movl %ebp,%esp
|
|
popl %edi
|
|
popl %esi
|
|
popl %ebx
|
|
popl %ebp
|
|
ret
|
|
.Lf18:
|
|
.size quick,.Lf18-quick
|
|
.globl partition
|
|
.align 16
|
|
.type partition,@function
|
|
partition:
|
|
pushl %ebp
|
|
pushl %ebx
|
|
pushl %esi
|
|
pushl %edi
|
|
movl %esp,%ebp
|
|
subl $8,%esp
|
|
incl 28(%ebp)
|
|
movl 24(%ebp),%edi
|
|
movl %edi,-8(%ebp)
|
|
movl -8(%ebp),%edi
|
|
movl 20(%ebp),%esi
|
|
movl (%esi,%edi,4),%edi
|
|
movl %edi,-4(%ebp)
|
|
jmp .LC21
|
|
.LC20:
|
|
incl 24(%ebp)
|
|
jmp .LC24
|
|
.LC23:
|
|
incl 24(%ebp)
|
|
.LC24:
|
|
movl 24(%ebp),%edi
|
|
movl 20(%ebp),%esi
|
|
movl -4(%ebp),%ebx
|
|
cmpl %ebx,(%esi,%edi,4)
|
|
jl .LC23
|
|
decl 28(%ebp)
|
|
jmp .LC27
|
|
.LC26:
|
|
decl 28(%ebp)
|
|
.LC27:
|
|
movl 28(%ebp),%edi
|
|
movl 20(%ebp),%esi
|
|
movl -4(%ebp),%ebx
|
|
cmpl %ebx,(%esi,%edi,4)
|
|
jg .LC26
|
|
movl 28(%ebp),%edi
|
|
cmpl %edi,24(%ebp)
|
|
jge .LC29
|
|
movl 20(%ebp),%edi
|
|
movl 28(%ebp),%esi
|
|
leal (%edi,%esi,4),%esi
|
|
pushl %esi
|
|
movl 24(%ebp),%esi
|
|
leal (%edi,%esi,4),%edi
|
|
pushl %edi
|
|
call exchange
|
|
addl $8,%esp
|
|
.LC29:
|
|
.LC21:
|
|
movl 28(%ebp),%edi
|
|
cmpl %edi,24(%ebp)
|
|
jl .LC20
|
|
movl 20(%ebp),%edi
|
|
movl 28(%ebp),%esi
|
|
leal (%edi,%esi,4),%esi
|
|
pushl %esi
|
|
movl -8(%ebp),%esi
|
|
leal (%edi,%esi,4),%edi
|
|
pushl %edi
|
|
call exchange
|
|
addl $8,%esp
|
|
movl 28(%ebp),%eax
|
|
.LC19:
|
|
movl %ebp,%esp
|
|
popl %edi
|
|
popl %esi
|
|
popl %ebx
|
|
popl %ebp
|
|
ret
|
|
.Lf31:
|
|
.size partition,.Lf31-partition
|
|
.globl exchange
|
|
.align 16
|
|
.type exchange,@function
|
|
exchange:
|
|
pushl %ebp
|
|
pushl %ebx
|
|
pushl %esi
|
|
pushl %edi
|
|
movl %esp,%ebp
|
|
subl $4,%esp
|
|
movl xx,%edi
|
|
movl $4,%esi
|
|
movl 24(%ebp),%ebx
|
|
subl %edi,%ebx
|
|
movl %ebx,%eax
|
|
movl %esi,%ecx
|
|
cdq
|
|
idivl %ecx
|
|
pushl %eax
|
|
movl 20(%ebp),%ebx
|
|
subl %edi,%ebx
|
|
movl %ebx,%eax
|
|
movl %esi,%ecx
|
|
cdq
|
|
idivl %ecx
|
|
pushl %eax
|
|
pushl $.LC33
|
|
call printf
|
|
addl $12,%esp
|
|
movl 20(%ebp),%edi
|
|
movl (,%edi),%esi
|
|
movl %esi,-4(%ebp)
|
|
movl 24(%ebp),%esi
|
|
movl (,%esi),%esi
|
|
movl %esi,(,%edi)
|
|
movl 24(%ebp),%edi
|
|
movl -4(%ebp),%esi
|
|
movl %esi,(,%edi)
|
|
movl $0,%eax
|
|
.LC32:
|
|
movl %ebp,%esp
|
|
popl %edi
|
|
popl %esi
|
|
popl %ebx
|
|
popl %ebp
|
|
ret
|
|
.Lf34:
|
|
.size exchange,.Lf34-exchange
|
|
.bss
|
|
.globl xx
|
|
.align 4
|
|
.type xx,@object
|
|
.size xx,4
|
|
.comm xx,4
|
|
.data
|
|
.align 1
|
|
.LC33:
|
|
.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
|
|
.text
|
|
.ident "LCC: 4.1"
|