The assignment has two parts. One in C and the other in IA32 assembly language. The attached file shows the full assignment detail. The testing part doesn't need to be done. Just the creation of the .s and .c files.
Microsoft Word - assign-02-asm.docx CS 5463/4593 1 CS 5463: Fundamentals of Systems – Programming Assignment 1 (50 points) Description and Requirements: This assignment has two parts. In Part I, you will write two functions in C, void swap (int*, int*) and int sum (int, int), in separate files cSwap.c and cSum.c, respectively. The main function in another C file cAssign2.c will declare and initialize necessary variables and call these two functions. You need to compile the two functions into assembly codes and study them by adding necessary comments at the end of each line of code. In Part II: you will need to implement the following two functions using IA32 assembly language (as we discussed in classes) in two different assembly files. 1) In asmMagicSum.s file, write a function that will take two integers as parameters and return the sum of 2*v1 and v2/2, where the function prototype in C will be: int magicSum (int v1, int v2); 2) In asmMajicSwap.s file, write a function that will take two integer pointers as parameters and swap their modified values where the first value plus 1 and second value minus 1. The function prototype in C will be: void magicSwap (int *p1, int *p2). You should add comments for each line of assembly code in the .s file, using #comment or /* comment */ In addition, the main function in a C file asmAssign2.c needs to be implemented, which should declare a few variables with initial values, and call the above two functions and print out messages to show the affects of the function calls. Here, you will need to separately compile the two functions and the main program in object codes first as below, before link them together to be an executable program. > as -c asmMagicSum.s -o asmMagicSum.o > as -c asmMagicSwap.s -o asmMagicSwap.o > gcc -c asmAssign2.c -o asmAssign2.o > gcc main.o asmMagicSum.o asmMagicSwap.o -o asmAssign2 Note: you need to work out this assignment on henXX.cs.utsarr.net ; where XX can be 01, 02, 03, or 04 What and how to submit: First, you should write a text Readme file to describe the status of this assignment (completed, or partial done etc.), and clearly show the steps to compile and run the program. Then, you should compress all files (.s and .c) and Readme into a zip file, which should have the name as: LastName-FirstName-abc123-assignment02.zip (or tar.gz). You need to submit the above compressed file on Blackboard. Dakai Zhu You need to use direct IPs to access hen machines: 10.100.240.211 - 214