Homework #1

Due 5 February, 1996

Start with the following C routine that finds the largest element in an array:

int findit(int U[], int size)
   int max, i, j ;

   max = U[1] ;
   for (i=2; j<size; ++j)
      if (U[j] > max)
         max = U[j] ;
   return(max) ;

  } ;

Choose one of the workstations in 004 and compile the program twice at two levels of optimization to generate two different assembly language programs corresponding to the C routine. Use the -S option of the C compiler to generate the assembly language. On the Digital machines use the -O option to set the optimization level. On the Suns, use -xO option.

Now take your two different assembly language programs and mark them up to show how the assembly language programs really implement the C routine.

Your completed assignment will be marked up programs with a lot of comments something like

Back to the Handout index
Return to Dean Brock's home page
UNCA CSCI logo Return to the UNCA Computer Science home page