Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void stringcmp(char* s1, char* s2, int *rez);
- int main()
- {
- int rez;
- char str1[100];
- char str2[100];
- gets(str1);
- gets(str2);
- stringcmp(str1,str2,&rez);
- if(rez==-1)
- printf("prvi string je manji od drugog");
- else if(rez==0)
- printf("prvi string je veci od drugog");
- else
- printf("stringovi su jednaki");
- }
- .section .text
- .globl stringcmp
- stringcmp:
- pushl %ebp
- movl %esp, %ebp
- movl 8(%ebp), %eax
- movl 12(%ebp), %ebx
- movl 16(%ebp), %edx
- petlja:
- movb (%eax), %cl
- cmpb (%ebx), %cl
- ja veci
- jb manji
- cmpb $0, %cl
- je jednaki
- incl %eax
- incl %ebx
- jmp petlja
- jednaki:
- movl $0, (%edx)
- jmp kraj
- veci:
- movl $1, (%edx)
- jmp kraj
- manji:
- movl $-1, (%edx)
- kraj:
- movl %ebp, %esp
- popl %ebp
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement