anchor.diff:  
     Result := PK64PoolMedium(NativeInt(Header) and MASK_K64_CLEAR).ThreadHeap.PenaltyReallocMediumToMedium(Pointer(Header), NewB16Count);
   end;
  +{$else}
  +asm
  +  // if (not Allocated(P)) then PenaltyReallocMediumToMedium
  +  {$ifdef CPUX86}
  +    mov eax, [EDX - 16].THeaderMedium.Flags
  +    push ebx
  +    mov ebx, MASK_MEDIUM_ALLOCATED_TEST
  +    and ebx, eax
  +    movzx eax, ax
  +    cmp ebx, MASK_MEDIUM_ALLOCATED_VALUE
  +  {$else .CPUX64}
  +    mov rcx, [RDX - 16].THeaderMedium.Flags
  +    mov r9, MASK_MEDIUM_ALLOCATED_TEST
  +    and r9, rcx
  +    movzx rcx, cx
  +    cmp r9, MASK_MEDIUM_ALLOCATED_VALUE
  +  {$endif}
  +  jne @penalty_reallocmem
  +
  +  // GrowCount := NewB16Count - Header(P).P16Count
  +  // if (not Next.Empty) then PenaltyReallocMediumToMedium
  +  {$ifdef CPUX86}
  +    sub ecx, eax
  +    shl eax, 4
  +    cmp [EDX + eax].THeaderMedium.PreviousSize, eax
  +    lea edx, [edx + eax]
  +    jne @penalty_reallocmem_restore
  +    mov ebx, [EDX].THeaderMedium.Flags
  +    test ebx, MASK_MEDIUM_EMPTY_TEST
  +    jnz @penalty_reallocmem_restore
  +  {$else .CPUX64}
  +    sub r8, rcx
  +    shl rcx, 4
  +    cmp [RDX + rcx].THeaderMedium.PreviousSize, rcx
  +    lea rdx, [rdx + rcx]
  +    jne @penalty_reallocmem_restore
  +    mov r9, [RDX].THeaderMedium.Flags
  +    test r9, MASK_MEDIUM_EMPTY_TEST
  +    jnz @penalty_reallocmem_restore
  +  {$endif}
  +
  +  // if (EmptyFlags < NewB16Count + 2) then PenaltyReallocMediumToMedium
  +  {$ifdef CPUX86}
  +    add ecx, 2
  +    cmp ebx, ecx
  +    lea ecx, [ecx - 2]
  +  {$else .CPUX64}
  +    add r8, 2
  +    cmp r9, r8
  +    lea r8, [r8 - 2]
  +  {$endif}
  +  jb @penalty_reallocmem_restore
  +
  +  // empty reduce routine, result
  +  {$ifdef CPUX86}
  +    shl ebx, 4
  +    shl ecx, 4
  +    add edx, ebx
  +
  +    sub ebx, ecx
  +    add ecx, eax
  +    mov [EDX].THeaderMediumEmptyEx.Size, ebx
  +
  +    sub edx, ebx
  +    shr ebx, 4
  +    mov [EDX].THeaderMedium.PreviousSize, ecx
  +    mov [EDX].THeaderMedium.Flags, ebx
  +
  +    sub edx, ecx
  +    shr ecx, 4
  +    pop ebx
  +    mov [EDX - 16].THeaderMedium.B16Count, cx
  +    xchg eax, edx
  +  {$else .CPUX64}
  +    shl r9, 4
  +    shl r8, 4
  +    add rdx, r9
  +
  +    sub r9, r8
  +    add r8, rcx
  +    mov [RDX].THeaderMediumEmptyEx.Size, r9
  +
  +    sub rdx, r9
  +    shr r9, 4
  +    mov [RDX].THeaderMedium.PreviousSize, r8
  +    mov [RDX].THeaderMedium.Flags, r9
  +
  +    sub rdx, r8
  +    shr r8, 4
  +    mov [RDX - 16].THeaderMedium.B16Count, r8w
  +    xchg rax, rdx
  +  {$endif}
  +
  +  // Exit
  +  ret
  +@penalty_reallocmem_restore:
  +  {$ifdef CPUX86}
  +    sub edx, eax
  +    shr eax, 4
  +    add ecx, eax
  +  {$else .CPUX64}
  +    sub rdx, rcx
  +    shr rcx, 4
  +    add r8, rcx
  +  {$endif}
  +@penalty_reallocmem:
  +  {$ifdef CPUX86}
  +    mov eax, MASK_K64_CLEAR
  +    and eax, edx
  +    mov eax, [EAX].TK64PoolMedium.ThreadHeap
  +    pop ebx
  +  {$else .CPUX64}
  +    mov rcx, MASK_K64_CLEAR
  +    and rcx, rdx
  +    mov rcx, [RCX].TK64PoolMedium.ThreadHeap
  +  {$endif}
  +  jmp TThreadHeap.PenaltyReallocMediumToMedium
  +end;
  +{$endif}
   
   function TThreadHeap.PenaltyReallocMediumToMedium(P: Pointer;
     NewB16Count: NativeUInt): Pointer;
  
positive.code: 
    Result := PK64PoolMedium(NativeInt(Header) and MASK_K64_CLEAR).ThreadHeap.PenaltyRegetMediumToMedium(Pointer(Header), NewB16Count);
  end;
  
  function TThreadHeap.PenaltyRegetMediumToMedium(P: Pointer;
    NewB16Count: NativeUInt): Pointer;
  
negative.code: end;
  
  function TThreadHeap.GetMedium(B16Count: NativeUInt; Align: NativeUInt{TMemoryAlign}): Pointer;
  {$ifdef PUREPASCAL}
  var
    Pool: PK64PoolMedium;
    Header: PHeaderMedium;
  