Question

In: Computer Science

In 80X86 assembly language Calories Burned Running on a particular treadmill, you burn 4 calories per...

In 80X86 assembly language

Calories Burned
Running on a particular treadmill, you burn 4 calories per minute. Write a program that uses a loop to display the number of calories burned after 5, 10, 15, 20, 25, and 30 minutes

pls show input and output

Solutions

Expert Solution

C code :

#include <stdio.h>

int main()
{
const float CALORIES_BURNED_PER_MIN = 3.6;

float calories_burned = 0;

for (int i = 5; i <= 30; i += 5)
{
calories_burned = (i * CALORIES_BURNED_PER_MIN);
   printf("calories burned after %d minutes = %d\n",i,calories_burned);
}

return 0;
}

Assembly 8086 code :

.LC2:

        .string "calories burned after %d minutes = %d\n"

main:

        push    rbp

        mov     rbp, rsp

        sub     rsp, 16

        movss   xmm0, DWORD PTR .LC0[rip]

        movss   DWORD PTR [rbp-8], xmm0

        pxor    xmm0, xmm0

        movss   DWORD PTR [rbp-12], xmm0

        mov     DWORD PTR [rbp-4], 5

        jmp     .L2

.L3:

        pxor    xmm0, xmm0

        cvtsi2ss        xmm0, DWORD PTR [rbp-4]

        movss   xmm1, DWORD PTR [rbp-8]

        mulss   xmm0, xmm1

        movss   DWORD PTR [rbp-12], xmm0

        pxor    xmm2, xmm2

        cvtss2sd        xmm2, DWORD PTR [rbp-12]

        movq    rdx, xmm2

        mov     eax, DWORD PTR [rbp-4]

        movq    xmm0, rdx

        mov     esi, eax

        mov     edi, OFFSET FLAT:.LC2

        mov     eax, 1

        call    printf

        add     DWORD PTR [rbp-4], 5

.L2:

        cmp     DWORD PTR [rbp-4], 30

        jle     .L3

        mov     eax, 0

        leave

        ret

.LC0:

        .long   1080452710


Related Solutions

Calories Burned Running on a particular treadmill, you burn 4 calories per minute. Write a program...
Calories Burned Running on a particular treadmill, you burn 4 calories per minute. Write a program that uses a loop to display the number of calories burned after 5, 10, 15, 20, 25, and 30 minutes. Note the answer should be in assembly language using windows 32 and .586
Running on a particular treadmill you burn a specific number of calories per minute. Write a...
Running on a particular treadmill you burn a specific number of calories per minute. Write a python program that uses a loop (you must use a loop) to display the number of minutes (as an integer) it will take to burn greater than or equal to 100 calories. For example (user input indicated in bold): SAMPLE 1: How many calcories burned per minute? 54.3 2 minutes SAMPLE 2: How many calcories burned per minute? 4.3 24 minutes SAMPLE 3: How...
Why is it surprising that hunter-gatherers burn the same number of calories per day as a...
Why is it surprising that hunter-gatherers burn the same number of calories per day as a sedentary person in a western society?
The language is Assembly Language. Thank you! Assignment 3: Run the following code. Record what each...
The language is Assembly Language. Thank you! Assignment 3: Run the following code. Record what each of the flag changes are for each command. INCLUDE Irvine32.inc .data .code main PROC mov al,255 add al,1 call DumpRegs sub al,1 call DumpRegs sub al,1 call DumpRegs exit main ENDP END main
Assume you are running a consumer goods company that uses assembly lines for the majority of...
Assume you are running a consumer goods company that uses assembly lines for the majority of the filling and packaging process, how would you design the layout for the front office and the production operation in this COVID environment to maintain efficiency, protect the employee, make the employee comfortable and feel he/she can come to work safely . If you prefer choose a company you are familiar with and answer the same question.
If you are running a test to find out whether or not a particular drug works...
If you are running a test to find out whether or not a particular drug works better than a placebo in controlling depression, and you have no idea whether the effects of the drug will increase depression or decrease depression, you want to run a_______ Research study One-Tailed Test NHST Two-Tailed Test When you incorrectly reject the null hypothesis and claim there are significant differences between your two means, and no such difference exists in the population, you have a(n)______...
use python3 language and need answer ASAP please thank you. The primary sources of calories in...
use python3 language and need answer ASAP please thank you. The primary sources of calories in food are fat, carbohydrate, and protein. Proteins and carbohydrates have four calories per gram, and fat has nine calories per gram. For example, on a box of Honey Nut Cheerios, it says that a serving has 1.5 grams of fat, 22 grams of carbohydrates, and 2 grams of protein. That works out to: 1.5 * 9 + 22 * 4 + 2 * 4...
Problem 2. You wish to determine the energy content per gram and Calories per serving of...
Problem 2. You wish to determine the energy content per gram and Calories per serving of a chocolate chip cookie and a banana bread slice from the Student Union to decide which is less “fattening.” The intact cookie and banana bread slice you are analyzing weigh 72.501 g and 69.003 g, respectively. Before you can analyze the samples, the calorimeter heat capacity must be determined. It is known that combustion of 1.000 g of benzoic acid releases 26.44 kJ of...
Convert this C++ program exactly as you see it into x86 assembly language: // Use the...
Convert this C++ program exactly as you see it into x86 assembly language: // Use the Irvine library for the print function #include <iostream> // The string that needs to be printed char word[] = "Golf\0"; // Pointer to a specific character in the string char * character = word; //NOTE: This main() function is not portable outside of Visual Studio void main() { // Set up a LOOP - See the while loop's conditional expression below int ecx =...
You must write the code in 80x86 assembly language and must attach a screenshot of the...
You must write the code in 80x86 assembly language and must attach a screenshot of the output. # Pennies for Pay Write a program that calculates how much a person earns in a month if the salary is one penny the first day, two pennies the second day, four pennies the third day, and so on with the daily pay doubling each day the employee works. The program should ask the user for the number of days the employee worked...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT