Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- int x = 250;
- int y;
- asm volatile(
- ".intel_syntax noprefix;"
- "mov eax, %1;"
- "mov ebx, 33;"
- "xor edx, edx;"
- "xor ecx, ecx;"
- "loopstart:"
- "xor edx, edx;"
- "dec ebx;"
- "jz finish;"
- "innerloop:"
- "shl eax, 1;"
- "jnc loopstart;"
- "inc edx;"
- "cmp edx, ecx;"
- "jl innerloop;"
- "mov ecx, edx;"
- "jmp innerloop;"
- "finish:"
- "mov %0, ecx;"
- ".att_syntax prefix;"
- :"=r"(y)
- :"r"(x)
- :"eax", "ebx", "ecx", "edx"
- );
- printf("y=%i\n", y);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement