Following is the C code that was recovered for funcl: int funcl( int x, int y) { int t1 = func3( &x ); printf("t1 is: %d \n", t1); int t2 = func3( &y ); printf("t2 is: %d \n", t2); if ( t1 > t2 ) { return tl; } return t2; } And here is the assembly code for func3 Dump of assembler code for function func3: Ox0000000000400666 <+0>: Ox0000000000400667 <+1>: => 0x000000000040066a <+4>: Ox000000000040066e <+8>: Ox0000000000400672 <+12>: Ox0000000000400679 <+19>: θx000000000040067d <423> : Ox000000000040067f <+25>: push %rbp (%rsp),%rbp $0x20, %rsp %rdi,-0x18(%rbp) $0x1,-0x4(%rbp) -0x18, (%rbp),%rax (%rax),%eax $0x4, %eax Ox4006a7 # SETUP mov %23 sub %#3 mov %23 movl %23 mov mov %23 cmp jle Ox0000000000400682 <+28>: #3 Ox0000000000400684 <+30>: -0x18, (%rbp),%rax (%rax),%eax $0x2,%eax %eax,%edx -0x18(%rbp),%rax %edx,(%rax) -0x18(%rbp),%rax %rax, %rdi callq Ox400666 $0x1,%eax %eax,-0x4(%rbp) -0x4(%rbp),%eax mov #3 Ox0000000000400688 <+34>: Ox000000000040068a <+36>: Ox000000000040068d <+39>: Ox000000000040068f <+41>: Ox0000000000400693 <+45>: Ox0000000000400695 <+47>: mov #3 sar # mov mov %23 mov 23 mov #3 Ox0000000000400699 <+51>: mov #3 Ox000000000040069c <+54>: %23 Ox00000000004006a1 <+59>: add #3 Ox00000000004006a4 <+62>: Ox00000000004006a7 <+65>: Ox00000000004006aa <+68>: mov %23 mov %23 leaveq retq # CLEAN-Up Ox00000000004006ab <+69>: %#3 End of assembler dump. Q2) What is the halting condition for the recursive function func3? Assuming the fist parameter is called x.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Following is the C code that was recovered for func1:
int funcl( int x, int y) {
int t1 = func3( &x );
printf("t1 is: %d \n", tl);
int t2 = func3( &y );
printf("t2 is: %d \n", t2);
if ( t1 > t2 ) {
return t1;
return t2;
And here is the assembly code for func3
Dump of assembler code for function func3:
Ox0000000000400666 <+0>: push
Ox0000000000400667 <+1>:
=> 0x000000000040066a <+4>;
%rbp
(%rsp),%rbp
$0x20,%rsp
%rdi,-0x18(%rbp)
$0x1,-0x4(%rbp)
-0x18, (%rbp), %rax
(%rax),%eax
$0x4,%eax
Ox4006a7 <func3+65>
# SETUP
mov
sub
Ox000000000040066e <+8>:
mov
23
Ox0000000000400672 <+12>:
movl
Ox0000000000400679 <+19>:
mov
Ox000000000040067d <+23>:
Ox000000000040067f <+25>:
θx0000000000400682 <+28>:
Ox0000000000400684 <+30>:
mov
23
cmp
jle
%23
%23
-0x18, (%rbp), %rax
(%rax),%eax
$0x2,%eax
%eax,%edx
-0x18(%rbp),%rax
%edx,(%rax)
-0x18(%rbp),%rax
%rax,%rdi
callq Ox400666 <func3>
$0x1,%eax
%eax,-0x4(%rbp)
-0x4(%rbp),%eax
mov
%23
Ox0000000000400688 <+34>:
Ox000000000040068a <+36>:
Ox000000000040068d <+39>:
Ox000000000040068f <+41>:
mov
%23
sar
%23
mov
%23
mov
%23
Ox0000000000400693 <+45>:
mov
%23
θx0000000000400695<+47>:
mov
#:
Ox0000000000400699 <+51>:
mov
#3
Ox000000000040069c <+54>:
%23
Ox00000000004006al <+59>:
add
Ox00000000004006a4 <+62>:
mov
%23
Ox00000000004006a7 <+65>:
mov
#3
Ox00000000004006aa <+68>:
leaveq
retq
# CLEAN-UP
Ox00000000004006ab <+69>:
End of assembler dump.
%23
Q2)
Assuming the fist parameter is called x.
What is the halting condition for the recursive function func3?
betta er allt dæmið i þessari spurningu
Open original
Transcribed Image Text:Following is the C code that was recovered for func1: int funcl( int x, int y) { int t1 = func3( &x ); printf("t1 is: %d \n", tl); int t2 = func3( &y ); printf("t2 is: %d \n", t2); if ( t1 > t2 ) { return t1; return t2; And here is the assembly code for func3 Dump of assembler code for function func3: Ox0000000000400666 <+0>: push Ox0000000000400667 <+1>: => 0x000000000040066a <+4>; %rbp (%rsp),%rbp $0x20,%rsp %rdi,-0x18(%rbp) $0x1,-0x4(%rbp) -0x18, (%rbp), %rax (%rax),%eax $0x4,%eax Ox4006a7 <func3+65> # SETUP mov sub Ox000000000040066e <+8>: mov 23 Ox0000000000400672 <+12>: movl Ox0000000000400679 <+19>: mov Ox000000000040067d <+23>: Ox000000000040067f <+25>: θx0000000000400682 <+28>: Ox0000000000400684 <+30>: mov 23 cmp jle %23 %23 -0x18, (%rbp), %rax (%rax),%eax $0x2,%eax %eax,%edx -0x18(%rbp),%rax %edx,(%rax) -0x18(%rbp),%rax %rax,%rdi callq Ox400666 <func3> $0x1,%eax %eax,-0x4(%rbp) -0x4(%rbp),%eax mov %23 Ox0000000000400688 <+34>: Ox000000000040068a <+36>: Ox000000000040068d <+39>: Ox000000000040068f <+41>: mov %23 sar %23 mov %23 mov %23 Ox0000000000400693 <+45>: mov %23 θx0000000000400695<+47>: mov #: Ox0000000000400699 <+51>: mov #3 Ox000000000040069c <+54>: %23 Ox00000000004006al <+59>: add Ox00000000004006a4 <+62>: mov %23 Ox00000000004006a7 <+65>: mov #3 Ox00000000004006aa <+68>: leaveq retq # CLEAN-UP Ox00000000004006ab <+69>: End of assembler dump. %23 Q2) Assuming the fist parameter is called x. What is the halting condition for the recursive function func3? betta er allt dæmið i þessari spurningu Open original
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Algebraic Expressions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education