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:
Instruction |
Step1 |
Step2 |
Step3 |
Step4 |
Step5 |
Step6 |
sub eax, eax |
eax –eax =0 |
|||||
sub ebx, ebx |
ebx –ebx =0 |
|||||
looptop: cmp ebx, 5 |
Comparing ebx value with 5 |
Comparing ebx value with 5 |
Comparing ebx value with 5 |
Comparing ebx value with 5 |
Comparing ebx value with 5 |
Comparing ebx value with 5 |
jge exitloop |
If 0 is greater than or equal to 5 then jump to “exitloop” |
If 1 is greater than or equal to 5 then jump to “exitloop” |
If 2 is greater than or equal to 5 then jump to “exitloop” |
If 3 is greater than or equal to 5 then jump to “exitloop” |
If 4 is greater than or equal to 5 then jump to “exitloop” |
If 5 is greater than or equal to 5 then jump to “exitloop” jump to “exitloop” |
add eax, ebx |
eax = eax +ebx eax = 0+0 à 0 |
eax = eax +ebx eax = 0+1 à 1 |
eax = eax +ebx eax = 1+2 à 3 |
eax = eax +ebx eax = 3+3 à 6 |
eax = eax +ebx eax = 6+4 à 10 |
|
inc ebx |
ebx = ebx +1 ebx = 0 +1 à 1 |
ebx = ebx +1 ebx = 1 +1 à 2 |
ebx = ebx +1 ebx = 2 +1 à 3 |
ebx = ebx +1 ebx = 3 +1 à 4 |
ebx = ebx +1 ebx = 4 +1 à 5 |
|
jmp looptop |
Jump to looptop |
Jump to looptop |
Jump to looptop |
Jump to looptop |
Jump to looptop |
|
exitloop: |
exitloop |
|||||
Decimal value will be in eax after this code executes 10 |
What decimal value will be in eax after this code executes? sub eax, eax ...
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
Binary Bomb phase 4 Dump of assembler code for function phase_4: > 0x0000000000400fe7 <+0>: sub $0x18,%rsp 0x0000000000400feb <+4>: lea 0x8(%rsp),%rcx 0x0000000000400ff0 <+9>: lea 0xc(%rsp),%rdx 0x0000000000400ff5 <+14>: mov $0x40290d,%esi 0x0000000000400ffa <+19>: mov $0x0,%eax 0x0000000000400fff <+24>: callq 0x400c00 <__isoc99_sscanf@plt> 0x0000000000401004 <+29>: cmp $0x2,%eax 0x0000000000401007 <+32>: jne 0x401010 <phase_4+41> 0x0000000000401009 <+34>: cmpl $0xe,0xc(%rsp) 0x000000000040100e <+39>: jbe 0x401015 <phase_4+46> 0x0000000000401010 <+41>: callq 0x401662 <explode_bomb> 0x0000000000401015 <+46>: mov $0xe,%edx 0x000000000040101a <+51>: mov $0x0,%esi...
6. What will be the final value in EDX after this code executes? mov edx, 1 mov eax,7FFFh cmp eax,0FFFF8000h jl L2 mov edx,0 し2: 7. (True/False): The following code will jump to the label named Target. mov eax,-30 cmp eax,-50 ig Target 8. Implement the following pseudocode in assembly language. Use short-circuit evaluation and assume that vall and X are 32-bit variables. if vall >ecx ) AND (ecx> edx) X=1 else X=2;
1. Assume that you are given values in eax, ebx, ecx. Write an assembly code that does the following: eax = (ecx + edx ) - (eax + ebx) 2. Write a piece of code that copies the number inside al to ch. Example: Assume that Initially eax = 0x15DBCB19. At the end of your code ecx = 0x00001900. Your code must be as efficient as possible. 3. You are given eax = 0x5. Write one line of code in...
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
Below is the disassembled code. PLease help me to defuse the binary bomb phase_4 so the right input should be 6 numbers with a certain pattern 08048cdb <phase_4>: 8048cdb: 53 push %ebx 8048cdc: 83 ec 38 sub $0x38,%esp 8048cdf: 8d 44 24 18 lea 0x18(%esp),%eax 8048ce3: 89 44 24 04 mov %eax,0x4(%esp) 8048ce7: 8b 44 24 40 mov 0x40(%esp),%eax 8048ceb: 89 04 24 mov %eax,(%esp) 8048cee: e8 11 07 00 00 call 8049404 <read_six_numbers> 8048cf3: 83 7c 24 18 00 cmpl...
4. The following code fragments show a sequence of virus instructions and a metamorphic version of the virus. Briefly describe the effect produced by the metamorphic code. We were unable to transcribe this imageThe following code fragments show a sequence of virus instructions and a metamorphic version of the virus. Briefly describe the effect produced by the metamorphic code. Original Code Metamorphic Code mov eax, 5 add eax, ebx call (eax] mov eax, 5 push ecx pop ecx add eax,...
What will be the value of w after the following section of code executes: int w = 4, 9 = 3; if (a < 5) if (w == 7) W = 3; else W = 3; else if (w > 3) W = 2; else W = 1; Select one 2.3 0 b.o 0.2 d. 1
I need help finding the input that wont result in explode_bomb in this assembly 08048cd3 <phase_4>: 8048cd3: 57 push %edi 8048cd4: 56 push %esi 8048cd5: 53 push %ebx 8048cd6: 83 ec 10 sub $0x10,%esp 8048cd9: 8b 74 24 20 mov 0x20(%esp),%esi 8048cdd: 89 34 24 mov %esi,(%esp) 8048ce0: e8 f6 03 00 00 call 80490db <string_length> 8048ce5: 83 c0 01 add $0x1,%eax 8048ce8: 89 04 24 mov %eax,(%esp) 8048ceb: e8 10 fb ff ff call 8048800 <malloc@plt> 8048cf0: 89 c7...
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...