// File: /workspace/github_c_makefile_star2_O1/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 0x18f62
leaq 0x1bab2(%rip), %r14     # 0x33ed0
movq 0x18(%r14), %r8
leaq 0x570f(%rip), %rdx      # 0x1db38
leaq 0x572d(%rip), %r9       # 0x1db5d
xorl %ebp, %ebp
movl $0x3, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19ca8
cmpl $0x0, 0xbc(%rbx)
je 0x18610
cmpl $0x1, 0xc8(%rbx)
jne 0x18495
movq 0x58(%rbx), %rax
testq %rax, %rax
je 0x184c2
movq %rbx, %rdi
callq *%rax
testl %eax, %eax
je 0x184c2
callq 0x18f62
movq (%r14), %r8
movq (%rbx), %r9
leaq 0x566e(%rip), %rdx      # 0x1daeb
xorl %edi, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19ca8
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x18610
callq 0x18f62
movq 0x10(%r14), %r8
movl 0xc8(%rbx), %r9d
leaq 0x5668(%rip), %rdx      # 0x1db14
movl $0x2, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19ca8
jmp 0x185e6
callq 0x18f62
movq 0x18(%r14), %r8
leaq 0x5c69(%rip), %rdx      # 0x1e13b
leaq 0x5c8c(%rip), %r9       # 0x1e165
movl $0x3, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19ca8
cmpl $0x0, 0xc4(%rbx)
je 0x185c6
callq 0x18f62
movq 0x18(%r14), %r8
movl 0xc4(%rbx), %ecx
movl %ecx, (%rsp)
leaq 0x5b35(%rip), %rdx      # 0x1e045
leaq 0x5c4e(%rip), %r9       # 0x1e165
movl $0x3, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19ca8
movabsq $0x2100000014, %rax     # imm = 0x2100000014
leaq 0x10(%rsp), %rdx
movq %rax, (%rdx)
movl $0x1, 0x8(%rdx)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0xc(%rdx)
movl 0xc0(%rbx), %edi
movl $0x3b6e, %esi           # imm = 0x3B6E
xorl %eax, %eax
callq 0xd190
movl %eax, %ebp
callq 0x18f62
testl %ebp, %ebp
je 0x185a3
movq (%r14), %r8
leaq 0x5c00(%rip), %rdx      # 0x1e176
xorl %edi, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19ca8
callq 0x18f62
movq (%r14), %r8
leaq 0x55dc(%rip), %rdx      # 0x1db6f
xorl %edi, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19ca8
jmp 0x185c6
movq 0x18(%r14), %r8
leaq 0x5bf0(%rip), %rdx      # 0x1e19e
leaq 0x5bb0(%rip), %r9       # 0x1e165
movl $0x3, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19ca8
movl 0xc4(%rbx), %edi
callq 0x195e8
movl 0xc4(%rbx), %edi
callq 0xd1a0
movl $0x0, 0xc4(%rbx)
callq 0x18f62
movq 0x18(%r14), %r8
leaq 0x2f2e(%rip), %rdx      # 0x1b524
leaq 0x5560(%rip), %r9       # 0x1db5d
xorl %ebp, %ebp
movl $0x3, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19ca8
movl %ebp, %eax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq