Homework Assignment 2 CS 350c Unique Number: 52140 Spring, 2017 Given: January 24, 2017 Due: February 2, 2017 This homework concerns the differences in the output of the compiler when used on different optimization settings. As for homework #1, the code below defines the original tak function taken from the Wikipedia page (just referenced): https://en.wikipedia.org/wiki/Tak_(function) unsigned long int tarai( unsigned long int x, unsigned long int y, unsigned long int z ) { if (y < x) return tarai( tarai( x-1, y, z ), tarai( y-1, z, x ), tarai( z-1, x, y )); else return y; } You are to compile a C version of the algorithm (given just above) using the "gcc" compiler available on the UTCS Departmental computers with the following commands: gcc -O2 -c -S tarai.c mv tarai.s tarai-O2.s gcc -O3 -c -S tarai.c mv tarai.s tarai-O3.s When "gcc" is called with the "-O3" optimization level, the number of x86 instructions produced is more than 10 times as many as with the "-O2" optimization level. Below are the questions that you are asked to answer as a part of this assignment: 1. What has the "gcc" compiler done to the optimization level "-O3" code as compared to the optimization level "-O2" code? Please explain what you believe the compiler is doing. 2. Given these two levels of optimization, what is the difference in execution performance? 3. Can you justify the generation of so much code when the "-O3" setting is selected? 4. Extra Credit: If you have access to an up-to-date (meaning the, software) Apple Macintosh or a FreeBSD system or any system using the Clang/LLVM compiler toolsuite for compiling C-language programs, perform the commands above and compare the size of the code to the size of the code produced on a UTCS computer.