Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- char s[] = "jebac tego asemblera";
- char *y;
- asm volatile(
- ".intel_syntax noprefix;"
- "mov edx, %1;"
- "mov ebx, %1;"
- "xor ecx, ecx;"
- "loop:"
- "mov al, [ebx];"
- "cmp al, 0;"
- "je xd;"
- "inc ebx;"
- "inc ecx;"
- "jmp loop;"
- "xd:"
- "dec ebx;"
- "shr ecx, 1;"
- "reverseLoop:"
- "mov al, [edx];"
- "mov ah, [ebx];"
- "mov [ebx], al;"
- "mov [edx], ah;"
- "inc edx;"
- "dec ebx;"
- "dec ecx;"
- "jnz reverseLoop;"
- ".att_syntax prefix;"
- :"=r"(y)
- :"r"(s)
- :"ebx", "ecx", "edx"
- );
- printf("%s\n", s);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement