Question: File 1 given: #include #include int main() { int* favoritePointer; printf(Enter your favorite number: ); scanf(%d, favoritePointer); printf( ); printf(%d , favoritePointer); int favoriteTimes9 =

File 1 given:

#include

#include

int main() {

int* favoritePointer;

printf("Enter your favorite number: ");

scanf("%d", favoritePointer);

printf(" ");

printf("%d ", favoritePointer);

int favoriteTimes9 = favoritePointer * 9; /courses/30397/files/7582889

printf("%d ", favoriteTimes9);

int favoriteTimes24 = favoritePointer * 24;

printf("%d ", favoriteTimes24);

}

File 2 given:

%include "asm_io.inc"

segment .data ; ; initialized data is put in the data segment here ; prompt db "Enter your favorite number: ", 0 ; creating a string for use later

segment .bss ; ; uninitialized data is put in the bss segment ; favorite resd 1

segment .text global asm_main asm_main: enter 0,0 ; setup routine pusha

; ; don't edit anything between lines 20 and 23 ;

; STARTER CODE, DO NOT EDIT mov eax, prompt call print_string ; print out the prompt defined in the .data segment call read_int ; value entered by user now lives in EAX call print_nl ; print a new line character

call print_int ; print value in EAX, currently what user entered ; YOUR CODE HERE

; ; don't edit anything below this line ; popa mov eax, 0 ; return back to C leave ret

You are being given an assembly starter code. The code includes new constructs but they are explained in the comments in the file itself. The new instructions are: DX, print_string, read_int, print_int You will need to use print_int to get the required output for the code. Include comments, variable names, and spacing. The C file you are being provided with has 2 types of errors, a few syntax errors and a runtime error that results in a segfault. You are tasked with identifying these errors and fixing them. The use of gdb might be useful for this portion of the project.

Once you have fixed the problems with the C code you will transcribe the code from C into assembly

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!