Advertisement

09.09.2004 at 10:26AM PDT, ID: 21124987
[x]
Attachment Details

Convert c code into assembly code

Asked by tjodolf in Assembly Programming Language

Tags: c, convert, assembly, code

Hey. I hope you can help me with converting some c code into assembly code, i have tried much now, and i still don't get it. What would help me alot, would be some comments for each line in the assembly code, so i better can understand to convert process...

Here is the code:

/* Standard quicksort. */
void quicksort(int a[], int left, int right)
{
      int lp = left - 1;
      int rp = right;
      int v = a[right]; /* the partioning element */

      if (right <= left)
            /* Array has one or null elements to sort */
            return;

      /* No elements to the left of lp are greater than the partioning elemnt. */
      while (1) {
            while (a[++lp] < v)
                  ;

            while (v < a[--rp])
                  /* In case the partioning element is the smallest in the array */
                  if (rp == left)
                        break;

            if (lp >= rp)
                  break;

            /* Deadlock, switch elements and continue */
            swap(&a[lp], &a[rp]);
      }
      /* This completes the partioning */
      swap(&a[lp], &a[right]);

      /* Now every element to the left of a[lp] are smaller than a[lp],
       * and every element to the right is larger. */

      quicksort(a, left, lp - 1);
      quicksort(a, lp + 1, right);
}

static void swap(int *x, int *y)
{
      int temp = *x;
      *x = *y;
      *y = temp;
}



Hope you can help.

Terje.Start Free Trial
[+][-]09.09.2004 at 02:03PM PDT, ID: 12021428

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.11.2004 at 10:28AM PDT, ID: 12035105

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Assembly Programming Language
Tags: c, convert, assembly, code
Sign Up Now!
Solution Provided By: Dawaffleman
Participating Experts: 5
Solution Grade: B
 
 
[+][-]09.11.2004 at 02:42PM PDT, ID: 12036020

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.11.2004 at 11:09PM PDT, ID: 12037294

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.11.2004 at 11:10PM PDT, ID: 12037300

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.12.2004 at 05:23AM PDT, ID: 12037900

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.12.2004 at 11:40AM PDT, ID: 12039414

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.12.2004 at 01:50PM PDT, ID: 12039877

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32