50 likes | 201 Views
Review. CAS CS210 Ying Ye. Boston University. movl $0x66666667,-0x10(%ebp) mov -0x10(%ebp),%eax imul %ecx sar %edx mov %ecx,%eax sar $0x1f,%eax mov %edx,%ebx sub %eax,%ebx mov %ebx,-0x8(%ebp) mov -0x8(%ebp),%eax shl $0x2,%eax
E N D
Review CAS CS210 Ying Ye Boston University
movl $0x66666667,-0x10(%ebp) mov -0x10(%ebp),%eax imul %ecx sar %edx mov %ecx,%eax sar $0x1f,%eax mov %edx,%ebx sub %eax,%ebx mov %ebx,-0x8(%ebp) mov -0x8(%ebp),%eax shl $0x2,%eax add -0x8(%ebp),%eax mov %ecx,%edx sub %eax,%edx mov %edx,-0x8(%ebp) mov -0x8(%ebp),%ebx ebx = ecx % 5
x at %ebp+8, n at %ebp+12 testl %edx, %edx movl 8(%ebp), %esi jne .L2 movl 12(%ebp), %ebx movl %edi, %eax movl $-1, %edi movl $1, %edx .L2: movl %edx, %eax andl %esi, %eax xorl %eax, %edi movl %ebx, %ecx sall %cl, %edx
int loop(int x, int n) { int result = ____; int mask; for(mask = ____; mask ____; mask = ____){ result ^= ____; } return result; }
typedef struct ELE *tree_ptr; trace: tp in %rdi movl $0, %eax struct ELE{ testq %rdi, %rdi long val; je .L3 tree_ptr left; .L5: movq (%rdi), %rax tree_ptr right; movq 16(%rdi), %rdi }; testq %rdi, %rdi jne .L5 long trace(tree_ptr tp); .L3: ret