Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

User Assembly code: # void switcher ( long a , long b , long c , long * dest ) # a in % rsi,

User
Assembly code:
# void switcher(long a, long b, long c, long *dest)
# a in %rsi, b in %rdi, c in %rdx, d in %rcx
switcher:
cmpq $8,%rdi
ja .L2
jmp *.L4(,%rdi,8)
.L7:
divq %rdi, %rsi
movq %rsi, %rdx
.L3:
leaq 10(,%rdx,2),%rdx
jmp .L6
.L5:
leaq (%rdx,%rsi),%rdx
salq $4,%rdx
jmp .L6
.L2:
movq %rsi, %rdx
.L6:
movq %rdx,(%rcx)
ret
Jump table:
.L4:
.quad .L3
.quad .L2
.quad .L5
.quad .L2
.quad .L7
.quad .L6
.quad .L2
.quad .L5
.quad .L6
Please complete the following C code based on the above assembly code.
void switcher(long a, long b, long c, long *dest){
switch ( Blank 1 Question 14){
case Blank 2 Question 14 :
c = a;
*dest = Blank 3 Question 14 ;
break;
case 1:
case 3:
case Blank 4 Question 14 :
Blank 5 Question 14 ;
break;
case 2: // Jumps to .L5
case Blank 6 Question 14 :
*dest = Blank 7 Question 14 ;
break;
case 4:
c = Blank 8 Question 14 ;
// Fall through
case 5:
case Blank 9 Question 14 :
*dest = Blank 10 Question 14 ; // movq %rdx,(%rcx)
break;
default:
*dest = Blank 11 Question 14 ;
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions