objc_msgSend Sorting
#import <Foundation/Foundation.h>
id objc_msgSend(id, SEL, ...);
typedef id (*messengerFunctionPointer_t)(id, SEL, ...);
register messengerFunctionPointer_t messengerFunctionPointer asm ("r18");
@interface Number : NSObject {
	int val;
}
- initWithVal:(int)v;
- (int)val;
@end
@implementation Number : NSObject
- (NSComparisonResult)compare:(Number*)obj {
	int objVal = [obj val];
	if (val > objVal) return NSOrderedDescending;
	else if (val < objVal ) return NSOrderedAscending;
	else return NSOrderedSame;
}

- initWithVal:(int)v {
	[super init];
	val = v;
	return self;
}
- (int)val { return val; }
@end
static int objectComparer(const void* a, const void* b) {
	return [*(id*)a compare:*(id*)b];
}
#define NUM_OBJECTS 3000000
void swap(id* a, id* b) {
  id temp = *a;
  *a = *b;
  *b = temp;
}
void sort(id arr[], unsigned beg, unsigned end) {
  if (end >  beg + 1)
  {
    id piv = arr[beg];
    unsigned l = beg + 1, r = end;
    while (l < r)
    {
      if ([arr[l] compare:piv] != NSOrderedDescending)
        l++;
      else
        swap(&arr[l], &arr[--r]);
    }
    swap(&arr[--l], &arr[beg]);
    sort(arr, beg, l);
    sort(arr, r, end);
  }
}
int main(void) {
	messengerFunctionPointer = objc_msgSend;
	id* objects = malloc(NUM_OBJECTS * sizeof *objects);
	if (! objects) return EXIT_FAILURE;
	unsigned i;
	for (i=0; i < NUM_OBJECTS; i++) {
		objects[i] = [[Number alloc] initWithVal:rand()];
	}
	sort(objects, 0, NUM_OBJECTS);
	return 0;
}