original_string: static function merge($a, $b, $cmp, $offset)
      {
          if ($a === 0) {
              $head = $b;
          } elseif ($b === 0) {
              $head = $a;
          } else {
              if (call_user_func($cmp, $a, $b) < 0) {
                  $ptr = $a;
                  $a = $a->$offset;
              } else {
                  $ptr = $b;
                  $b = $b->$offset;
              }
              $head = $ptr;
              while ($a && $b) {
                  if (call_user_func($cmp, $a, $b) < 0) {
                      $ptr->$offset = $a;
                      $ptr = $a;
                      $a = $a->$offset;
                  } else {
                      $ptr->$offset = $b;
                      $ptr = $b;
                      $b = $b->$offset;
                  }
              }
              if ($a !== 0) {
                  $ptr->$offset = $a;
              } else {
                  $ptr->$offset = $b;
              }
          }
          return $head;
      }
code: static function merge($a, $b, $cmp, $offset)
      {
          if ($a === 0) {
              $head = $b;
          } elseif ($b === 0) {
              $head = $a;
          } else {
              if (call_user_func($cmp, $a, $b) < 0) {
                  $ptr = $a;
                  $a = $a->$offset;
              } else {
                  $ptr = $b;
                  $b = $b->$offset;
              }
              $head = $ptr;
              while ($a && $b) {
                  if (call_user_func($cmp, $a, $b) < 0) {
                      $ptr->$offset = $a;
                      $ptr = $a;
                      $a = $a->$offset;
                  } else {
                      $ptr->$offset = $b;
                      $ptr = $b;
                      $b = $b->$offset;
                  }
              }
              if ($a !== 0) {
                  $ptr->$offset = $a;
              } else {
                  $ptr->$offset = $b;
              }
          }
          return $head;
      }
code_tokens: static function merge ( $ a , $ b , $ cmp , $ offset ) { if ( $ a === 0 ) { $ head = $ b ; } elseif ( $ b === 0 ) { $ head = $ a ; } else { if ( call_user_func ( $ cmp , $ a , $ b ) < 0 ) { $ ptr = $ a ; $ a = $ a -> $ offset ; } else { $ ptr = $ b ; $ b = $ b -> $ offset ; } $ head = $ ptr ; while ( $ a && $ b ) { if ( call_user_func ( $ cmp , $ a , $ b ) < 0 ) { $ ptr -> $ offset = $ a ; $ ptr = $ a ; $ a = $ a -> $ offset ; } else { $ ptr -> $ offset = $ b ; $ ptr = $ b ; $ b = $ b -> $ offset ; } } if ( $ a !== 0 ) { $ ptr -> $ offset = $ a ; } else { $ ptr -> $ offset = $ b ; } } return $ head ; }
docstring: Merge in a merge sort for a linked list
  
  Side effects:
  The "next" pointers for elements in the lists a and b are
  changed.
  
  @param mixed    $a      A sorted, null-terminated linked list.  (May be null).
  @param mixed    $b      A sorted, null-terminated linked list.  (May be null).
  @param function $cmp    A pointer to the comparison function.
  @param integer  $offset Offset in the structure to the "next" field.
  
  @return mixed A pointer to the head of a sorted list containing the
  elements of both a and b.
docstring_tokens: Merge in a merge sort for a linked list