Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

What does this code do?

Name: Anonymous 2011-10-04 11:23

What does this code do?

      v8 = v46;
      v45 = &(*Tree)->Root;
      v44 = &(*Tree)->Left;
      v43 = &(*Tree)->Right;
      if ( v46->Left )
      {
        v9 = v46->Right;
        if ( !v9 )
        {
          v10 = v46->Left;
          goto LABEL_20;
        }
        v8 = v46->Right;
        if ( v9->Left )
        {
          do
            v8 = v8->Left;
          while ( v8->Left );
        }
      }
      v10 = v8->Right;
LABEL_20:
      if ( v8 == v46 )
      {
        v11 = v8->Root;
        if ( v10 )
          v10->Root = v11;
        if ( *v45 == v8 )
        {
          *v45 = v10;
        }
        else
        {
          v14 = v8->Root;
          if ( v14->Left == v8 )
            v14->Left = v10;
          else
            v14->Right = v10;
        }
        if ( *v44 == v46 )
        {
          if ( v46->Right )
          {
            for ( i = v10; i->Left; i = i->Left )
              ;
          }
          else
          {
            i = v46->Root;
          }
          *v44 = i;
        }
        if ( *v43 == v46 )
        {
          if ( v46->Left )
          {
            for ( j = v10; j->Right; j = j->Right )
              ;
            *v43 = j;
          }
          else
          {
            *v43 = v46->Root;
          }
        }
      }
      else
      {
        v46->Left->Root = v8;
        v8->Left = v46->Left;
        if ( v8 == v46->Right )
        {
          v11 = v8;
        }
        else
        {
          v11 = v8->Root;
          if ( v10 )
            v10->Root = v11;
          v8->Root->Left = v10;
          v8->Right = v46->Right;
          v46->Right->Root = v8;
        }
        if ( *v45 == v46 )
        {
          *v45 = v8;
        }
        else
        {
          v12 = v46->Root;
          if ( v12->Left == v46 )
            v12->Left = v8;
          else
            v12->Right = v8;
        }
        v8->Root = v46->Root;
        v13 = LOBYTE(v8->field_0);
        LOBYTE(v8->field_0) = LOBYTE(v46->field_0);
        LOBYTE(v46->field_0) = v13;
        v8 = v46;
      }
      if ( LOBYTE(v8->field_0) )
      {
        if ( v10 != *v45 )
        {
          while ( !v10 || LOBYTE(v10->field_0) == 1 )
          {
            v17 = v11->Left;
            if ( v10 == v17 )
            {
              v18 = v11->Right;
              if ( !LOBYTE(v18->field_0) )
              {
                LOBYTE(v18->field_0) = 1;
                v19 = v11->Right;
                LOBYTE(v11->field_0) = 0;
                v11->Right = v19->Left;
                v20 = v19->Left;
                if ( v20 )
                  v20->Root = v11;
                v19->Root = v11->Root;
                if ( v11 == *v45 )
                {
                  *v45 = v19;
                }
                else
                {
                  v21 = v11->Root;
                  if ( v11 == v21->Left )
                    v21->Left = v19;
                  else
                    v21->Right = v19;
                }
                v19->Left = v11;
                v11->Root = v19;
                v18 = v11->Right;
              }

Name: Anonymous 2011-10-04 17:40

>>11
I tend to find that decompiler output can sometimes contain duplicated code and may even be harder to understand than the optimized assembly. You can also debug the assembly thus see exactly what it does - no guessing and it's the most accurate answer you'll be getting.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List