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
What device operates at the network layer (layer 3) of the osi model and forwards packets across computer networks?
Oksi-84 [34.3K]
Yup. D) Router. 


Good guess! (:
7 0
3 years ago
Yo, what's the tinyclick.ml/7hTq link?? I don't trust it, but I'm curious-
Rashid [163]
<h2>Answer:</h2>

<u><em>Usually, random people will say that on your questions page to give you a virus but then that link doesn't look like the same link I see every day. I would still not click it just in case.</em></u>

<h2>Explanation:</h2>

<em>Have a good one!</em>

<h2>( ◑‿◑)ɔ┏--┑٩(^◡^ )</h2>
5 0
3 years ago
How to transfer music from computer to iphone?
vladimir1956 [14]
Depends on how you wanna do it, through iTunes or whatever other you are syncing from
8 0
3 years ago
What is the fifth-generation wireless broadband technology based on the 802.11ac standard engineered to greatly increase the spe
kirza4 [7]

Answer:

The fifth-generation wireless broadband technology based on the 802.11ac standard is called the

5G.

Explanation:

The 5G is the newest baby in town in the area of wireless broadband technology.  The technology is based on the IEEE 802.11ac standard. 5G operates with a 5Ghz signal and is set to offer out-of-this-world speeds of up to 1 Gb/s.  This implies massive connectivity for everyone and everything.  However, its trial has been fraught with many challenges.  Questions have been raised, especially relating to some health concerns about the technology.  However, many advantages have been ascribed to this wireless technology.  They include more reliability, massive network capacity, increased availability, more uniform user experience, higher performance. and improved efficiency.

4 0
3 years ago
A user logs into Active Directory on a workstation and the user home directory does not redirect to a network share on a file se
inysia [295]

Answer:

gpresult

Explanation:

Group Policy provides the system administrator with settings that would be necessary to manage the different user accounts available in an organization. It also controls their work environment centrally by configuring the user Operating System (OS), applications and user accounts.

Group policy settings or configurations are referred to as Group Policy Objects (GPOs). These objects can be linked to organizational units (OUs), domains or sites.

There are various group policy commands such as;

  1. rstrui (System Restore tool will run),
  2. runas (using different permission to run a tool or program),
  3. tasklist (currently running programs are shown
  4. gpupdate (Group policies are refreshed)
  5. gpresult (group policy configurations are displayed for verification)

gpresult command can be used to verify the group policy configurations for adjustment or optimization. The technician can start troubleshooting from viewing the active settings, then running the rstrui to start the System Restore utility to restore the computer to an earlier date

6 0
3 years ago
Other questions:
  • 1. Which of the following might be a problem taken on by environment engineers?
    8·1 answer
  • What is the unit of electric power?
    15·1 answer
  • Which of the following is a central feature of agroup?interactionmutual influenceinterdependenceall of the given options
    10·1 answer
  • In fixed-width files, each record is on a separate line and the fields are separated by a special character.
    7·1 answer
  • ____ is the security guarantee that people who intercept messages cannot read them. A. Availability B. Encryption C. Confidentia
    9·1 answer
  • Where do you get your news? Is it owned by a large conglomerate does it matter to you who own your local news outlets? why or wh
    5·1 answer
  • Which graphic file format is used for commercial purposes.
    10·1 answer
  • Amber wants to give her audience copies of her presentation so they can follow along and take notes. What option should Amber ch
    9·2 answers
  • A(an)_______is built-in preset calculation. <br>formula <br> function <br>equation <br>AutoSum​
    12·1 answer
  • If String str = "Computer Science";, then what is the value of str.substring(10);? ​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!