Question: Consider the following assembly code for a function with a switch: foo: .LFBO: movl fedi, feax cmpb $4, $dil ja .L9 movzbl %dil, fecx leaq


Consider the following assembly code for a function with a switch: foo: .LFBO: movl fedi, feax cmpb $4, $dil ja .L9 movzbl %dil, fecx leaq .L4 (&rip), %rsi movsla (frsi, xrcx, 4), frdx adda frsi, %rdx notrack jmp *Srdx .L4: .long .L8-.L4 .long .L7-.L4 .long .L10-.L4 .long L6-.L4 .long .L3-L4 .text .L8: leal 0 (, &rdi, 8), feax subl %edi, Seax jmp .L2 .L7: leal (&rdi, $rdi, 4), Sedx leal (&rdi, frdx, 2), Seax jmp .L2 .L10: movl $99, $eax .L6: addl $1, eax .L2: movsbl Sal, $eax ret .L3: leal (&rdi, &rdi,2), Seax sall $2, feax jmp .L2 .L9: movl $0, eax jmp .L2 int foo (char c) { switch (c) { case 0: case 1: case 2: case 3: case 4: default: } return }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
