You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: interrupts.rs
    path of file: ./repos/kernel/src/arch/aarch64/kernel
    
    the code of the file until where you have to start completion: use alloc::collections::BTreeMap;
use alloc::vec::Vec;
use core::arch::asm;
use core::ptr;
use core::sync::atomic::{AtomicU64, Ordering};

use aarch64::regs::*;
use ahash::RandomState;
use arm_gic::gicv3::{GicV3, IntId, Trigger};
use hashbrown::HashMap;
use hermit_dtb::Dtb;
use hermit_sync::{InterruptSpinMutex, InterruptTicketMutex, OnceCell};

use crate::arch::aarch64::kernel::boot_info;
use crate::arch::aarch64::kernel::core_local::increment_irq_counter;
use crate::arch::aarch64::kernel::scheduler
    
pub(crate) extern "C" fn do_fiq(state: &State) -> *mut usize {
	if let Some(irqid) = GicV3::get_and_acknowledge_interrupt() {
		let mut reschedule: bool = false;
		let vector: usize = u32::from(irqid).try_into().unwrap();

		debug!("Receive fiq {}", vector);
		increment_irq_counter(vector.try_into().unwrap());

		if vector < MAX_HANDLERS {
			unsafe {
				if let Some(handler) = INTERRUPT_HANDLERS[vector] {
					reschedule = handler(state);
				}
			}
		}

		core_scheduler().handle_waiting_tasks();

		GicV3::end_interrupt(irqid);

		if unsafe {
			reschedule
				|| vector == TIMER_INTERRUPT.try_into().unwrap()
				|| vector == SGI_RESCHED.into()
		} {
			// a timer interrupt may have caused unblocking of tasks
			return core_scheduler()
				.scheduler()
				.unwrap_or(core::ptr::null_mut());
		}
	}

	core::ptr::null_mut()
}