Subject to any orders of the Tribunal, an involuntary patient admitted to an SMHU under section 63 may be detained there until whichever occurs first.(a) the end of the period of detention determined under section 64(1) (or as extended under section 64(2) ); or(b) if the Chief Psychiatrist arranges for the transfer of the patient under section 64(5) , the end of the 24-hour period immediately after the arrangements have been made; or(c) if the patient is subject to an assessment order, the assessment order expires or is discharged; or(d) if the patient is subject to a treatment order, the treatment order expires or is discharged