// File: /workspace/github_c_makefile_star2_O3/intel[P]pf-bb-config/bb_acc_vfio.c
// Function: vfio_disable_intr
int vfio_disable_intr(void *dev)
{
	hw_device *hwd = (hw_device *)dev;

	LOG(DEBUG, "VFIO disable interrupts");

	if (!hwd->vfio_mode)
		return 0;

	switch (hwd->vfio_int_mode) {
	case VFIO_PCI_MSI_IRQ_INDEX:
		if ((hwd->ops.dev_disable_intr) && (hwd->ops.dev_disable_intr(hwd))) {
			LOG(ERR, "vfio enable %s device intr failed", hwd->device_name);
			return -1;
		}

		if (vfio_disable_msi(hwd))
			LOG(ERR, "vfio disable MSI intr failed");

		/* deregister isr callback for intr event */
		event_del_fd(hwd->irq_event_fd);
		close(hwd->irq_event_fd);
		hwd->irq_event_fd = 0;
		break;

	case VFIO_PCI_INTX_IRQ_INDEX:
	case VFIO_PCI_MSIX_IRQ_INDEX:
	case VFIO_PCI_ERR_IRQ_INDEX:
	default:
		LOG(INFO, "Not supported irq index (%d)", hwd->vfio_int_mode);
		break;
	}

	LOG(DEBUG, "Done");
	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
callq 0x18c40
leaq 0x1bdcd(%rip), %r14     # 0x33ed0
movq 0x18(%r14), %r8
leaq 0x5a89(%rip), %rdx      # 0x1db97
leaq 0x5aa7(%rip), %r9       # 0x1dbbc
xorl %ebp, %ebp
movl $0x3, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x199b4
cmpl $0x0, 0xbc(%rbx)
je 0x182e4
cmpl $0x1, 0xc8(%rbx)
jne 0x1817a
movq 0x58(%rbx), %rax
testq %rax, %rax
je 0x181a7
movq %rbx, %rdi
callq *%rax
testl %eax, %eax
je 0x181a7
callq 0x18c40
movq (%r14), %r8
movq (%rbx), %r9
leaq 0x59e8(%rip), %rdx      # 0x1db4a
xorl %edi, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x199b4
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x182e4
callq 0x18c40
movq 0x10(%r14), %r8
movl 0xc8(%rbx), %r9d
leaq 0x59e2(%rip), %rdx      # 0x1db73
movl $0x2, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x199b4
jmp 0x182ba
callq 0x18c40
movq 0x18(%r14), %r8
leaq 0x5fe3(%rip), %rdx      # 0x1e19a
leaq 0x6006(%rip), %r9       # 0x1e1c4
movl $0x3, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x199b4
cmpl $0x0, 0xc4(%rbx)
je 0x1829a
callq 0x18c40
movq 0x18(%r14), %r8
movl 0xc4(%rbx), %ecx
movl %ecx, (%rsp)
leaq 0x5eaf(%rip), %rdx      # 0x1e0a4
leaq 0x5fc8(%rip), %r9       # 0x1e1c4
movl $0x3, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x199b4
movaps 0x580c(%rip), %xmm0     # 0x1da20
leaq 0x10(%rsp), %rdx
movaps %xmm0, (%rdx)
movl $0x1, 0x10(%rdx)
movl 0xc0(%rbx), %edi
movl $0x3b6e, %esi           # imm = 0x3B6E
xorl %eax, %eax
callq 0xd190
movl %eax, %ebp
callq 0x18c40
testl %ebp, %ebp
je 0x18277
movq (%r14), %r8
leaq 0x5f8b(%rip), %rdx      # 0x1e1d5
xorl %edi, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x199b4
callq 0x18c40
movq (%r14), %r8
leaq 0x5967(%rip), %rdx      # 0x1dbce
xorl %edi, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x199b4
jmp 0x1829a
movq 0x18(%r14), %r8
leaq 0x5f7b(%rip), %rdx      # 0x1e1fd
leaq 0x5f3b(%rip), %r9       # 0x1e1c4
movl $0x3, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x199b4
movl 0xc4(%rbx), %edi
callq 0x192c7
movl 0xc4(%rbx), %edi
callq 0xd1a0
movl $0x0, 0xc4(%rbx)
callq 0x18c40
movq 0x18(%r14), %r8
leaq 0x325a(%rip), %rdx      # 0x1b524
leaq 0x58eb(%rip), %r9       # 0x1dbbc
xorl %ebp, %ebp
movl $0x3, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x199b4
movl %ebp, %eax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq