/* AC 17/18 * TPC3 Ex1 */ .text .global maiordif maiordif: # dispensando o uso de %ebp, usando diretamente %esp movl 4(%esp), %eax movl 8(%esp), %edx movl 12(%esp), %ecx cmpl %edx, %eax jge cont1 push %edx # troca mov %eax, %edx pop %eax cont1: cmpl %ecx, %eax jge cont2 mov %ecx, %eax cont2: cmp %ecx, %edx jle cont3 mov %ecx, %edx cont3: sub %edx, %eax ret /*****************************/ /* AC 17/18 * TPC3 Ex2 */ .text .global procura procura: push %ebp mov %esp, %ebp push %ebx movl 8(%ebp), %ecx movl 12(%ebp), %edx movl 16(%ebp), %ebx mov $0, %eax while: cmp %edx, %eax jnl notfound cmpl (%ecx, %eax, 4), %ebx je found inc %eax jmp while notfound: mov $-1, %eax found: pop %ebx pop %ebp ret