1 / 5

Review

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

ashanti
Download Presentation

Review

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Review CAS CS210 Ying Ye Boston University

  2. 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

  3. 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

  4. int loop(int x, int n) { int result = ____; int mask; for(mask = ____; mask ____; mask = ____){ result ^= ____; } return result; }

  5. 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

More Related