.section .data
output:
.asciz "The largest value is %d\n"
values:
.int 105, 235, 61, 315, 134, 221, 53, 145, 117, 5
.section .text
.globl _start
_start:
nop
movl values, %ebx #ebx=105
movl $1, %edi #edi=1
loop: #loop循环
movl values(, %edi, 4), %eax #eax=235
cmp %ebx, %eax #比较eax>=ebx
cmova %eax, %ebx #ebx=235
inc %edi #类似 edi++
cmp $10, %edi #edi>=10
jne loop #跳出loop循环
pushl %ebx
pushl $output
call printf #打印 315
addl $8, %esp
pushl $0
call exit
时间: 2024-09-24 17:50:16