Assembly language:
Before executing the following code, the value in eax was 1
What will be the value in eax after executing the following code:
mov ebx, eax
shl eax, 4
shl ebx, 3
add eax, ebx
mov ebx, eax -> ebx = 1 shl eax, 4 -> eax = eax * 16 = 16 shl ebx, 3 -> ebx = ebx * 8 = 8 add eax, ebx -> eax = eax + ebx = 16 + 8 = 24 Value of eax after code is executed is 24 Answer: 24
Assembly language: Before executing the following code, the value in eax was 1 What will be...
read carefully Which DOES NOT evaluate. Consider the following arithmetic operations in C: int X-20; int Y-20; int Z-2*(X+Y) which assembly code(0x86) does not evaluate value for Z correctly? mov eax.X b) mov ebx. Y add eax ebx mov el.4 mov ebx.Y a) add eax.ebx mov cl.2 imul cl mov Z eax imul cl shr eax. 1 mov Z.eax d) mov eax.X mov ebx.Y add eax.ebx shl eax, I mov Z,eax mov eax X c) mov ebx,Y shl eax.2 shl...
ASSEMBLY LANGUAGE. For each problem, show the contents or setting of the requested item after executing the instructions. 1. mov eax,0 mov al,5 mov bl,11 mul bl - Show the hexadecimal digits in eax: - Show the carry flag value: - Show the overflow flag value: mov eax,0 mov edx,0 mov ax,5h mov bx,20h mul bx - Show the hexadecimal digits in eax: - Show the hexadecimal digits in edx: - Show the carry flag value: - Show the...
This is Assembly Language. For each problem, show the contents or setting of the requested items after executing the instructions. mov eax, 403h ; i.e., 1027 mov ebx, -16 ; i.e., FFFFFFF0h mov edx, 0 idiv bl Show the hexadecimal digits in eax:_______________ Show the hexadecimal digits in edx:_______________ mov eax, 403h ; i.e., 1027 mov ebx, -16 ; i.e., FFFFFFF0h mov edx, 0 cwd idiv bx Show the hexadecimal digits in eax:_______________ Show the hexadecimal digits in edx:_______________ mov...
What decimal value will be in eax after this code executes? sub eax, eax sub ebx, ebx looptop: cmp ebx, 5 jge exitloop add eax, ebx inc ebx jmp looptop exitloop:
pls write correct answers asap.... Note- You are athempting question 9 out of 10 Match the following: 1) Quick Sort A) Divide and conquer programming 2) Task Scheduling B) Greedy programming 3) Merge Sort C) Dynamic programming 4) Prim's D) Not stable a) 1-B2-A 3-C4-D b) 1-D 2-C3-A 4-B c) 1-D 2-C 3-B 4-A d) 1-C 2-D 3-A 4-B Ansre Note - You are attermpring qpestion out of 10 Odd man out: e Topological sort Algorithm DFS Algorithm Binary search...
Understanding assembly language: The assembly language for cars() is: (gdb) disass cars Dump of assembler code for function vanilla: 0x00000000004004cd <+0>: push %rbp 0x00000000004004ce <+1>: mov %rsp,%rbp 0x00000000004004d1 <+4>: mov %edi,-0x14(%rbp) 0x00000000004004d4 <+7>: mov -0x14(%rbp),%eax 0x00000000004004d7 <+10>: add %eax,%eax 0x00000000004004d9 <+12>: mov %eax,-0x4(%rbp) 0x00000000004004dc <+15>: mov -0x4(%rbp),%eax 0x00000000004004df <+18>: mov -0x14(%rbp),%edx 0x00000000004004e2 <+21>: add %edx,%eax 0x00000000004004e4 <+23>: pop %rbp 0x00000000004004e5 <+24>: retq End of assembler dump. Give a 1-2...
And also when recursive(5). Consider the following funtion int recursive(int n) f The assembly code equivalent of the above function is: recursive push %ebp mov %esp,%ebp push %ebx sub $0x14,%esp cmpl $0x1,0x8(%ebp) je L1 cmpl $0x2,0x8(%ebp) jne L2 L1 mov 0x8 (%ebp),%eax jmp L3 L2 mov 0x8 (%ebp),%eax sub $0x1,%eax mov %eax, (%esp call recursive mov %eax,%ebx mov ox8(%ebp),%eax sub $0x2,%eax mov %eax, (%esp call recursive imul %ebx,%eax L3 add $0x14,%esp pop %ebx pop %ebp ret
Write an assembly language code Irvine32.inc x86 for the following pseudo code. Use Conditional jump If (op1 == op2) X=1; Else X=2; While (EAX < EBX) EAX = EAX + 1 ;
Assembly Memory Segment Layout (Little Endian) - What does the "add" instruction do?For example, on the first add instruction (add eax, 3), it moves the pointer for eax 3 spots to the right.Thus, EAX = 12, 17, A3, 00. (This I understand)But, on the second add instruction (add ebx, 5), it actually adds the value 5 to ebx, making EBX = 12, 17, A3, 05.Why is that?ANSWER:varl var2 var3 dd 179 db 0A3h, 017h 012h bca var1 eax. mov add...
IF statement is translated into assembly language with a o CMP instruction followed by Conditional jumps. If op1 or op2 is a memory operand o IF Statemert (a variable): o one of them must be moved Problem 3: Implement the following pseudocode in assembly language. to a register before executing CMP. All values are unsigned: стр ьї, ci ja next mov al,5 mov dl,6 al-50 dl-23 next: Add to the above code the mov instructions and assign values to bl,...