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
lyudmila [28]
1 year ago
8

Translate the following C program to Pep/9 assembly language.

Computers and Technology
1 answer:
docker41 [41]1 year ago
8 0

In this exercise we have to use the knowledge of computational language in C code to write a code that Translate the following C program to Pep/9 assembly language.

<h3>Writting the code:</h3>

  • In C code:

<em>#include <stdio.h></em>

<em>int myAge;</em>

<em>void </em><em>putNext</em><em>(int age) {</em>

<em>int nextYr;</em>

<em>nextYr = age + 1;</em>

<em>printf("Age: %d\n", age);</em>

<em>printf("Age next year: %d\n", nextYr);</em>

<em>}</em>

<em>int </em><em>main </em><em>() {</em>

<em>scanf("%d", &myAge);</em>

<em>putNext(myAge);</em>

<em>putNext(64);</em>

<em>return 0;</em>

<em>}</em>

  • In Pep 9 CODE-

<em>myAge:</em>

<em>.zero 4</em>

<em>.LC0:</em>

<em>.</em><em>string </em><em>"Age: %d\n"</em>

<em>.LC1:</em>

<em>.string "Age </em><em>next </em><em>year: %d\n"</em>

<em>_Z7putNexti:</em>

<em>pushq %rbp</em>

<em>movq %rsp, %rbp</em>

<em>subq $32, %rsp</em>

<em>movl %edi, -20(%rbp)</em>

<em>movl -20(%rbp), %eax</em>

<em>addl $1, %eax</em>

<em>movl %eax, -4(%rbp)</em>

<em>movl -20(%rbp), %eax</em>

<em>movl %eax, %esi</em>

<em>movl $.LC0, %edi</em>

<em>movl $0, %eax</em>

<em>call printf</em>

<em>movl -4(%rbp), %eax</em>

<em>movl %eax, %esi</em>

<em>movl $.LC1, %edi</em>

<em>movl $0, %eax</em>

<em>call printf</em>

<em>nop</em>

<em>leave</em>

<em>ret</em>

<em>.LC2:</em>

<em>.</em><em>string </em><em>"%d"</em>

<em>main:</em>

<em>pushq %rbp</em>

<em>movq %rsp, %rbp</em>

<em>movl $myAge, %esi</em>

<em>movl $.LC2, %edi</em>

<em>movl $0, %eax</em>

<em>call scanf</em>

<em>movl myAge(%rip), %eax</em>

<em>movl %eax, %edi</em>

<em>call _Z7putNexti</em>

<em>movl $64, %edi</em>

<em>call _Z7putNexti</em>

<em>movl $0, %eax</em>

<em>popq %rbp</em>

<em>ret</em>

See more about C code at  brainly.com/question/18502436

#SPJ1

You might be interested in
Which process best describes how you might prepare to apply for a job?
saveliy_v [14]
Take an online course,or maybe do special trainings,practice and study.
8 0
4 years ago
Read 2 more answers
What does the asterisk (*) after select tell the database to do in this query?
OlgaM077 [116]

In the case above, The asterisk helps database or tell it to select all data that meets the criteria as stated in the query.

<h3>What does asterisk (*) mean in SQL?</h3>

The term means all columns. Note that The asterisk or star symbol ( * ) is a term that implies all columns in a given database.

Therefore, In the case above, The asterisk helps database or tell it to select all data that meets the criteria as stated in the query.

Learn more about asterisk from

brainly.com/question/1620017

#SPJ11

4 0
2 years ago
Observing users as they enter passwords or other personal information to a computer Auditing software often used to test compute
GuDViN [60]

Answer:

Explanation:

1. Observing users as they enter passwords or other personal information to a computer Auditing software often used to test computer data - (shoulder surfing)

2. An acronym for security institute that studies computer crime activities The act of altering data that are entered into, or used by, a computer --- (CSI)

3. A small text file that stores information about your browsing habits and interests Stealing personal information from trash cans - (COOKIES)

4. A software program specifically designed for computer forensic investigations - (EnCase)

5. A type of fraud in which the perpetrator steals small amounts from many different accounts - (salami technique)

6. A software program or hardware device designed to prevent unauthorized data communications - (firewall)

7. Malicious software similar to a computer virus -- (_worm)

8. Federal legislation aimed specifically at computer crime (CFAA)

8 0
3 years ago
A window may be resized by dragging the___ or side of it
dangina [55]

top i believe is the answer


4 0
4 years ago
Read 2 more answers
My friend Leo wants to have an emergency plan for his final exams on University of Southern Algorithmville. He has N subjects to
leonid [27]

Answer:

Greedy is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the most obvious and immediate benefit. Greedy algorithms are used for optimization problems. An optimization problem can be solved using Greedy if the problem has the following property: At every step, we can make a choice that looks best at the moment, and we get the optimal solution of the complete problem.

If a Greedy Algorithm can solve a problem, then it generally becomes the best method to solve that problem as the Greedy algorithms are in general more efficient than other techniques like Dynamic Programming. But Greedy algorithms cannot always be applied. For example, the Fractional Knapsack problem (See this) can be solved using Greedy, but 0-1 Knapsack cannot be solved using Greedy.

The following are some standard algorithms that are Greedy algorithms.

1) Kruskal’s Minimum Spanning Tree (MST): In Kruskal’s algorithm, we create an MST by picking edges one by one. The Greedy Choice is to pick the smallest weight edge that doesn’t cause a cycle in the MST constructed so far.

2) Prim’s Minimum Spanning Tree: In Prim’s algorithm also, we create an MST by picking edges one by one. We maintain two sets: a set of the vertices already included in MST and the set of the vertices not yet included. The Greedy Choice is to pick the smallest weight edge that connects the two sets.

3) Dijkstra’s Shortest Path: Dijkstra’s algorithm is very similar to Prim’s algorithm. The shortest-path tree is built up, edge by edge. We maintain two sets: a set of the vertices already included in the tree and the set of the vertices not yet included. The Greedy Choice is to pick the edge that connects the two sets and is on the smallest weight path from source to the set that contains not yet included vertices.

4) Huffman Coding: Huffman Coding is a loss-less compression technique. It assigns variable-length bit codes to different characters. The Greedy Choice is to assign the least bit length code to the most frequent character. The greedy algorithms are sometimes also used to get an approximation for Hard optimization problems. For example, the Traveling Salesman Problem is an NP-Hard problem. A Greedy choice for this problem is to pick the nearest unvisited city from the current city at every step. These solutions don’t always produce the best optimal solution but can be used to get an approximately optimal solution.

6 0
3 years ago
Other questions:
  • the task is to ask the user for three numbers and find the average which pseudocode gives you the comment outline for task​
    10·1 answer
  • A friend has a CD of one of your favorite artists and has offered to let you copy it.
    8·1 answer
  • How can you create the first row of the table as the header of the table
    15·2 answers
  • An airline company would like to easily locate lost luggage. What technology would make it easier for them to locate the luggage
    6·2 answers
  • The binary number 0100001 represents the number 65
    5·1 answer
  • Need 2.5 Code Practice Answers
    14·2 answers
  • "Most of us know that when we come into a college classroom, we will see desks and chairs, a computer station and a projector. A
    6·1 answer
  • Which of the following is NOT contained on the Slide Show toolbar?
    11·2 answers
  • Which of the following is an example of metadata about a webpage?
    7·2 answers
  • This class is missing a number of functions. Rewrite the class declaration to follow best practices, e.g, operators, three impor
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!