// A. // vframe: // pushq %rbp // movq %rsp, %rbp // subq $16, %rsp // leaq 22(,%rdi,8), %rax // andq $-16, %rax // // // bitlevel representation of -16 // 1111111111111111111111111111111111111111111111111111111111110000 // // rax // 22 + n*8 // n=0 0000000000000000000000000000000000000000000000000000000000010110 22 // n=1 0000000000000000000000000000000000000000000000000000000000011110 30 // n=2 0000000000000000000000000000000000000000000000000000000000100110 38 // n=3 0000000000000000000000000000000000000000000000000000000000101110 46 // n=4 0000000000000000000000000000000000000000000000000000000000110110 54 // n=5 0000000000000000000000000000000000000000000000000000000000111110 62 // // (22 + n*8) & -16 // n=0 0000000000000000000000000000000000000000000000000000000000010000 16 8n+16 // n=1 0000000000000000000000000000000000000000000000000000000000010000 16 8n+8 // n=2 0000000000000000000000000000000000000000000000000000000000100000 32 8n+16 // n=3 0000000000000000000000000000000000000000000000000000000000100000 32 8n+8 // n=4 0000000000000000000000000000000000000000000000000000000000110000 48 // n=5 0000000000000000000000000000000000000000000000000000000000110000 48 // // print("{:064b}".format((0*8+22) & -16)) // print("{:064b}".format((1*8+22) & -16)) // print("{:064b}".format((2*8+22) & -16)) // print("{:064b}".format((3*8+22) & -16)) // print("{:064b}".format((4*8+22) & -16)) // print("{:064b}".format((5*8+22) & -16)) // // B. // vframe: // pushq %rbp // movq %rsp, %rbp // subq $16, %rsp // leaq 22(,%rdi,8), %rax // andq $-16, %rax // // subq %rax, %rsp // // leaq 7(%rsp), %rax rax <- (rsp+7) = (rsp+(n-1)), n = 8 // shrq $3, %rax rax <- (floor(rax/8)) // leaq 0(,%rax,8), %r8 r8 <- ceil(rsp/8)*8 // // Important We are growing the stack downwards. // But the array index grows upwards. // // See 2.3.7 for derivation. // If x%(1<