1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Anuta_ua [19.1K]
4 years ago
10

Write a C function which mimics the behavior of the assembly language function below. Note that this time, the assembly language

code is recursive (despite –O2 compilation), and your C code should likewise be recursive.
f:
cmpl $1, %edi
je .L3
xorl %eax, %eax
testl %edi, %edi
jle .L7
subq $8, %rsp
subl $1, %edi
call f
testl %eax, %eax
sete %al
addq $8, %rsp
movzbl %al, %eax
.L7:
ret
.L3:
movl $1, %eax
ret
Computers and Technology
1 answer:
Digiron [165]4 years ago
6 0

Answer:

#include <stdio.h>

int f(int edi) {

 

  if (edi == 1) {

      return 1;  

  }

  if (edi <= 0) {

      return 0;

  }

 

  edi--;

  int eax = f(edi);

 

  if(eax == 0) {

      return 1;

  } else {

      return 0;

  }

}

int main(void) {

  int edi = 9;

  int ret;

  ret = f(edi);

  printf("%d", ret);

  return 0;

}

Explanation:

  • Inside the function f, check if edi is 1 or less than 1 and then return a number accordingly.
  • Decrement the edi variable, call the f function and assign its value to eax.
  • Check if eax is equal to 0 then return 1 else return 0.
  • Inside the main function, call the f function by passing the edi value and finally display the value of ret.
You might be interested in
Letters, memos, and computer printouts of numerical information are examples of formal reports.Group startsTrue or False
kati45 [8]

Letters, memos, and computer printouts of numerical information are examples of formal reports is a  false statement.

<h3>What are  formal reports?</h3>

Formal reports are known to be a type of report that has elements such as a title page, a transmittal, a table of contents, etc. An example are:

  • Inspection Report.
  • Safety and Health Report.

Conclusively, Letters, memos, and computer printouts of numerical information are examples of formal reports is a  false statement because  they are all examples of informal reports.

Learn more about formal reports from

brainly.com/question/11599232

6 0
3 years ago
How will you create a blog using Wordpress?​
levacccp [35]

Answer:

yes

Explanation:

8 0
3 years ago
Read 2 more answers
The lower the weight of your water rocket the better it will fly. Why?
Gwar [14]

Yo, Big Shaq, the one and only

Man's not hot, never hot

Skrrat, skidi-kat-kat

Boom

Two plus two is four, minus one that's three, quick maths

Everyday man's on the block, smoke trees

See your girl in the park, that girl is a uckers

When the ting went quack-quack-quack, you man were ducking (you man ducked)

Hold tight, Asnee (my brotha), he's got the pumpy (big ting)

Hold tight, my man (my guy), he's got the frisbee

I trap, trap, trap on the phone, movin' that cornflakes

Rice Krispies, hold tight my girl, Whitney (my G)

On the road doin' ten toes, like my toes (like my toes)

You man thought I froze, I see a peng girl, then I pose (chilin')

If she ain't on it, I ghost, hah, look at your nose

6 0
3 years ago
Who has a relationship like this quote?
lora16 [44]

Answer:

me

Explanation:

5 0
3 years ago
Read 2 more answers
Where should you endorse a check
yKpoI14uk [10]
This is done by signing your name on the back of the left end of thecheck<span>. </span>You<span> can also limit who can cash it by specifying in your </span>endorsement<span> that it is only to be deposited into your specified account at Provident.</span>
5 0
3 years ago
Read 2 more answers
Other questions:
  • Trish uas bought a new computer, which she plans to start working on aftwr a week. Since Trish has not used computers in the pas
    13·1 answer
  • Write the formal descriptions of the following sets: (a) The set containing the numbers 5, 9, and 27. (b) The set that contains
    5·1 answer
  • Two of the goals of community mobilization are getting the community interested and
    6·1 answer
  • Technological progress has reduced the cost of manufacturing mp3 players. what happens if demand is unchanged?
    9·1 answer
  • What does an operating system do?
    11·2 answers
  • 6.10.1: Modify a C string parameter. Complete the function to replace any period by an exclamation point. Ex: "Hello. I'm Miley.
    8·1 answer
  • the penalties for ignoring the requirements for protecting classified information when using social networking services are ____
    12·1 answer
  • Suppose users share a 1-Gbps link. Also, suppose each user requires 200 Mbps when transmitting, but each user only transmits 30
    5·1 answer
  • Which statement is true concerning user-defined data types?
    10·1 answer
  • One subtask in the game is to ‘refuel a car’. Explain why ‘refuel a car’ is an abstraction.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!