-int __fastcall__ fputs (const char* s, FILE* f)
+int __fastcall__ fputs (const char* s, register FILE* f)
 {
     /* Check if the file is open or if there is an error condition */
     if ((f->f_flags & _FOPEN) == 0 || (f->f_flags & (_FERROR | _FEOF)) != 0) {
 
 
 
 
-void* __fastcall__ realloc (void* block, size_t size)
+void* __fastcall__ realloc (void* block, register size_t size)
 {
-    struct usedblock* b;
+    register struct usedblock* b;
     struct usedblock* newblock;
     unsigned oldsize;
     unsigned newhptr;
-    int diff;
 
     /* Check the block parameter */
     if (!block) {
     b = (((struct usedblock*) block) - 1)->start;
     oldsize = b->size;
 
-    /* Get the size difference as a signed quantity */
-    diff = size - oldsize;
-
     /* Is the block at the current heap top? */
     if (((unsigned) b) + oldsize == ((unsigned) _heapptr)) {
        /* Check if we've enough memory at the heap top */
-       newhptr = ((unsigned) _heapptr) + diff;
+       newhptr = ((unsigned) _heapptr) - oldsize + size;
        if (newhptr <= ((unsigned) _heapend)) {
            /* Ok, there's space enough */
                    _heapptr = (unsigned*) newhptr;