Homework Assignment 1 CS 350c Unique Number: 51160 Spring, 2016 Given: January 19, 2016 Due: January 28, 2016 This homework concerns the use of the C programming language and x86 assembler programming. You are to write a two-part program; that is, you are to write a program that consists of two input files; the tarai function must be written in x86 assembler. "tak.c": A C program that reads three natural numbers from the terminal input (the command line) and calls the "tarai" function. "tarai.s": A x86 assembler program that computes the tarai function. The code below defines the original tak function taken from the Wikipedia page (just referenced). Look at: https://en.wikipedia.org/wiki/Tak_(function) def tarai(x, y, z) if y < x tarai( tarai(x-1, y, z), tarai(y-1, z, x), tarai(z-1, x, y) ) else y # not z! end end Below are the questions that you are required to answer as a part of this assignment: 1. How many times are your tarai function called when this program is called? tak 25 20 10 2. Can you get this call of tak to run in less than 10 seconds? You are allowed to change the algorithm. 3. How many x86 instructions are in the definition of your tarai function? 4. On average, how many x86 instructions per second is your x86 system executing when running this program? You may use the following Makefile template. Be careful when creating a Makefile, characters are used to offset make-target commands. The first two lines below, assign two variables with the text to the right of the "=" character. The line "tak: tak.c tarai.s" means that the "tak" target is dependent on files "tak.c" and "tarai.s". The next line runs the command "gcc -Wall -O2 -o tak tak.c tarai.s". The final target, "clean", asks that the object files and files with a final "~" in their names be removed. A makefile is generally named "Makefile". Below is a Makefile for a tarai file written in assembler. CC = gcc CFLAGS = -Wall -O2 tak: tak.c tarai.s $(CC) $(CFLAGS) -o tak tak.c tarai.s clean: rm -f tak *.o *~ It is important that you learn about the "Makefile" system. Although quite old, the "Makefile" system is in very wide-spread use, and you will definitely encounter it if you work in the operating systems and computer architecture areas.