Question

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

And also when recursive(5).

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer

C.  return_val_1 is 1 and return_val_2 is 2.

return_val_5 is 8
Add a comment
Know the answer?
Add Answer to:
And also when recursive(5). Consider the following funtion int recursive(int n) f The assembly code equivalent...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Below is the disassembled code. PLease help me to defuse the binary bomb phase_4 so the...

    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...

  • I need help finding the input that wont result in explode_bomb in this assembly 08048cd3 <phase_4>:...

    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...

  • 0x401050 : push %ebp 0x401051 : mov %esp,%ebp 0x401053 : sub $0xc,%esp 0x401056 : mov 0x8(%ebp),%eax...

    0x401050 : push %ebp 0x401051 : mov %esp,%ebp 0x401053 : sub $0xc,%esp 0x401056 : mov 0x8(%ebp),%eax 0x401059 : add $0x4,%eax 0x40105c : mov %eax,0xfffffffc(%ebp) 0x40105f : mov 0x8(%ebp),%eax 0x401062 : imul 0xc(%ebp),%eax 0x401066 : mov %eax,0xfffffff8(%ebp) 0x401069 : mov 0xc(%ebp),%edx 0x40106c : mov 0x8(%ebp),%eax 0x40106f : sub %edx,%eax 0x401071 : mov %eax,0xfffffff4(%ebp) 0x401074 : mov 0xfffffff8(%ebp),%eax 0x401077 : add 0xfffffffc(%ebp),%eax 0x40107a : add 0xfffffff4(%ebp),%eax 0x40107d : leave 0x40107e : ret 0x401089 : push %ebp 0x40108a : mov %esp,%ebp 0x40108c :...

  • Binary Bomb phase 4 Dump of assembler code for function phase_4: > 0x0000000000400fe7 <+0>:     sub    $0x18,%rsp...

    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...

  • Exercise 3 [Conditionals] Consider the following assembly code for a function F3 with two integer arguments:...

    Exercise 3 [Conditionals] Consider the following assembly code for a function F3 with two integer arguments: F3: push EBP mov EBP, ESP mov EDX, DWORD PTR [ebp+12] mov EAX, DWORD PTR [ebp+8] cmp EAX, EDX # setup stack #if # goto .L1 #EAX- mov EAX, EDX # ignore for now mov DWORD PTR [EBP-4], EAX mov ESP, EBP pop EBE ret # cleanup stack To the right of each instruction, show the contents of the register whose value changes as...

  • #define SIZE 10 prob3: void prob3 (int mat [SIZE] [SIZE]) int r, c pushl movl tebp...

    #define SIZE 10 prob3: void prob3 (int mat [SIZE] [SIZE]) int r, c pushl movl tebp esp, ebp edi 2 pushl esi pushl ebx pushl $4, esp 8 (ebp), eax $1, (eax) subl movl mat [0] [0] 1; movl leal 40 (teax), Sebx movl $1, 40 (teax) 11 addl $80, teax 12 eax, -16 (tebp) movl 13 movl $1, tedi .L2 14 jmp 15 for (r 1; r<SIZE; r++) ( L5: 16 -16 (ebp), tebx movl 17 mat [r] [0]...

  • Below is the disassembled code. PLease help me to defuse the binary bomb phase_7 08048e88 <pha...

    Below is the disassembled code. PLease help me to defuse the binary bomb phase_7 08048e88 <phase_7>: 8048e88: 83 ec 2c sub $0x2c,%esp 8048e8b: 8d 44 24 18 lea 0x18(%esp),%eax 8048e8f: 89 44 24 0c mov %eax,0xc(%esp) 8048e93: 8d 44 24 1c lea 0x1c(%esp),%eax 8048e97: 89 44 24 08 mov %eax,0x8(%esp) 8048e9b: c7 44 24 04 61 a6 04 movl $0x804a661,0x4(%esp) 8048ea2: 08 8048ea3: 8b 44 24 30 mov 0x30(%esp),%eax 8048ea7: 89 04 24 mov %eax,(%esp) 8048eaa: e8 c1 f9 ff...

  • Reverse Engineering

    I need to reverse engineer from machine code to C, how do I do it?This problem will give you a chance to reverse engineer a switch statement frommachine code. In the following procedure, the body of the switch statement hasbeen removed:1 int switch_prob(int x, int n)2 {3 int result = x;45 switch(n) {67 /* Fill in code here */8 }910 return result;11 }Figure 3.44 shows the disassembled machine code for the procedure. We cansee in lines 4 and 5 that...

  • X86 Assembly Language Help to implement the CipherChar Procedure at the end of the given code...

    X86 Assembly Language Help to implement the CipherChar Procedure at the end of the given code INCLUDE Irvine32.inc         .data       KeyPrompt BYTE "Enter the passphrase: ",0       TextPrompt BYTE "Enter the plaintest: ",0           str1 BYTE "The passphrase has length:",0           str2 BYTE "The plaintest has length:",0       KeyIs BYTE "The passphrase: ",0       PlainTextIs BYTE "The plaintext: ",0       CipherTextIs BYTE "The ciphertext: ",0       KMAX = 64                        ; passphrase buffer maximum size       BMAX = 128                       ; test...

  • You know the following assembly code snippet is from a recursive function in C. You also...

    You know the following assembly code snippet is from a recursive function in C. You also know that the stack contents at a particular point in time when we are in the recursive function are shown on the next page. Answer the following questions: a) how many Foo stack frames are on the stack? b) what is the return address back to the function that called Foo for the first time? c) what is the return address back into the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT